<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>meandmark.com</title>
	<atom:link href="http://meandmark.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://meandmark.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 16 Jan 2012 19:04:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Installing Pyglet on 64-bit Macs</title>
		<link>http://meandmark.com/blog/2012/01/installing-pyglet-on-64-bit-macs/</link>
		<comments>http://meandmark.com/blog/2012/01/installing-pyglet-on-64-bit-macs/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 19:03:25 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Game Development]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[pyglet]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=434</guid>
		<description><![CDATA[Pyglet is a technology to write cross-platform OpenGL games and applications in Python. If you go to the pyglet site, you will find installers for Mac OS X and Windows. The current Mac version of the installer, 1.1.4, uses Carbon, which means it doesn&#8217;t work with 64-bit applications. Not working with 64-bit applications is a [...]]]></description>
			<content:encoded><![CDATA[<p>Pyglet is a technology to write cross-platform OpenGL games and applications in Python. If you go to the <a href="http://www.pyglet.org">pyglet site</a>, you will find installers for Mac OS X and Windows. The current Mac version of the installer, 1.1.4, uses Carbon, which means it doesn&#8217;t work with 64-bit applications. Not working with 64-bit applications is a problem if you&#8217;re running Mac OS X 10.6 and later. Version 1.2 uses Cocoa and works with 64-bit applications, but an installer is not currently available because 1.2 is still in development. Until an installer for 1.2 becomes available, you will have to install pyglet from source code to use version 1.2.</p>
<h3>Install Mercurial</h3>
<p>The source code for pyglet is in a Mercurial repository. If you do not have Mercurial installed on your computer, you must install it to be able to install pyglet 1.2. Installers for Mac OS X and Windows are available at the <a href="http://mercurial.selenic.com">Mercurial site</a>.</p>
<h3>Clone the Repository</h3>
<p>Cloning the pyglet repository gives you a copy of the source code so you can install pyglet. Launch the Terminal application, navigate to where you want the source code to reside, and run the following command:</p>
<pre>hg clone https://pyglet.googlecode.com/hg/ pyglet</pre>
<p>There is a space before pyglet in the last part of the URL. You should see a pyglet folder after cloning the repository.</p>
<h3>Install Pyglet</h3>
<p>After cloning the repository, it&#8217;s time to install pyglet. In the Terminal application go to the pyglet folder and run the following command:</p>
<pre>python setup.py install</pre>
<p>Now pyglet should be installed and you can start coding.</p>
<h3>Install AVbin</h3>
<p>Installing pyglet alone has one limitation. It can play only uncompressed audio files. To play compressed audio files, such as MP3 and Ogg Vorbis files, with pyglet, you must install the AVbin library, which is what pyglet uses to play compressed audio. There are multiple versions available for Mac OS X, Windows, and Linux on the <a href="http://avbin.github.com/AVbin/Download.html">AVbin download page</a>. Those of you running Mac OS X 10.6 and later should download a version that supports 64-bit Intel.</p>
<p>After downloading AVbin, you must install it from the Terminal application. Navigate to the avbin folder (the latest name of the folder on Mac OS X is avbin-darwin-x86-64-v8) and enter the following command:</p>
<pre>sudo bash install.sh</pre>
<p>Running the installation script installs AVbin and lets you play compressed audio files with pyglet.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2012/01/installing-pyglet-on-64-bit-macs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SDL with Xcode 4</title>
		<link>http://meandmark.com/blog/2012/01/using-sdl-with-xcode-4/</link>
		<comments>http://meandmark.com/blog/2012/01/using-sdl-with-xcode-4/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 19:31:36 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[SDL]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[xcode 4]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=432</guid>
		<description><![CDATA[Apple changed the format for project templates in Xcode 4. The format change means the Xcode templates that ship with the Mac version of SDL don&#8217;t work in Xcode 4. If you have both Xcode 3 and 4 installed on your Mac, you can create a project that uses SDL in Xcode 3 and open [...]]]></description>
			<content:encoded><![CDATA[<p>Apple changed the format for project templates in Xcode 4. The format change means the Xcode templates that ship with the Mac version of SDL don&#8217;t work in Xcode 4. If you have both Xcode 3 and 4 installed on your Mac, you can create a project that uses SDL in Xcode 3 and open it in Xcode 4. But if you&#8217;re running Xcode 10.7 and don&#8217;t have Xcode 3 installed, you&#8217;re stuck with Xcode 4 and can&#8217;t use the SDL project templates. But you can use Xcode 4 to create SDL applications without too much hassle.</p>
<h3>Create a Cocoa Application Project</h3>
<p>When you create a project in Xcode, select the Cocoa Application project, as you can see in the following screenshot:</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/01/Xcode4CocoaProjectStep1.png" border="0" alt="Xcode4CocoaProjectStep1" width="600" height="404" /></p>
<p>The Mac OS X version of SDL is written with Cocoa so a Cocoa application project is the closest template to the old SDL project templates. Click the Next button to move to the next step where you name the project.</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/01/Xcode4CocoaProjectStep2.png" border="0" alt="Xcode4CocoaProjectStep2" width="600" height="404" /></p>
<p>Deselect the Create Document-Based Application, Use Core Data, and Use Automatic Reference Counting checkboxes. SDL games don&#8217;t use Core Data or Apple&#8217;s NSDocument class. Automatic Reference Counting is for Objective-C code, which most of you won&#8217;t use if you&#8217;re using SDL. If you want to unit test your game with OCUnit, select the Include Unit Tests checkbox. My <a href="http://meandmark.com/blog/2010/11/using-xcode-to-unit-test-sdl-games-written-in-c/">Using Xcode to Unit Test SDL Games Written in C++</a> post has detailed information on using OCUnit to unit test C++ code.</p>
<p>Click the Next button to move on to the final step of creating a project. Pick a location to save the project and click the Create button. If you want to place your project in a local git repository, select the checkbox to create the repository.</p>
<h3>Remove Unwanted Files from the Project</h3>
<p>Apple&#8217;s Cocoa application project template contains files that are not needed for SDL games. You can remove the xib file and source code files from the project: any files ending in .xib, .m, and .h. In Xcode 4.2 you would delete the following files: main.m, MainMenu.xib, AppDelegate.h, and AppDelegate.m. Select a file and choose Edit &gt; Delete to delete the file from the project. An alert opens. If you click the Delete button, Xcode deletes the file instead of moving it to the Trash. Clicking the Remove Reference button is the safer option. My <a href="http://meandmark.com/blog/2011/05/xcode-4-removing-files-from-a-project/">Xcode 4: Removing Files from a Project</a> post has additional information on removing files from a project.</p>
<h3>Add the SDL Framework to the Project</h3>
<p>Now it&#8217;s time to add the SDL framework to the project. Select the project file from the project navigator to open the project editor. Select your target from the left side of the project editor. Click the Summary button at the top of the editor to see a list of linked frameworks. Click the + button to add a framework. More information on adding frameworks is in my <a href="http://meandmark.com/blog/2011/03/xcode-4-adding-a-framework-to-your-project/">Xcode 4: Adding a Framework to Your Project</a> post. Click the + button to add any additional frameworks, such as OpenGL, SDL_image, and SDL_mixer.</p>
<h3>Add SDLMain to the Project</h3>
<p>The Mac version of SDL uses two files, SDLMain.m and SDLMain.h, that contain glue code for running SDL code on Mac OS X. The SDL project templates include these files, but in Xcode 4 you must add them to your project. Choose File &gt; Add Files to ProjectName to add the files. After adding the SDLMain files to the project, you can start coding.</p>
<h3>Add Search Paths</h3>
<p>When I tried to build a SDL project with Xcode 4, I got a build error saying that the file SDL.h was not found. The solution was to add the following search path to the Header Search Paths build setting:</p>
<p>/Library/Frameworks/SDL.framework/Headers</p>
<p>You may also need to add a search path to the Framework Search Paths build setting, but I didn&#8217;t need to add a path. You may also need to specify additional search paths if you use additional frameworks, such as SDL_image and SDL_mixer. My <a href="http://meandmark.com/blog/2011/03/xcode-4-accessing-build-settings/">Xcode 4: Accessing Build Settings</a> post has detailed information on accessing build settings in Xcode 4.</p>
<h3>Copy the SDL Framework to Your Application Bundle</h3>
<p>The SDL Xcode project templates copy the SDL framework to your application bundle. Copying the framework to the application bundle allows someone to play your SDL game without having SDL installed. If you want the SDL framework added to your application bundle, add a Copy Files build phase to your target and add the SDL framework to the build phase.</p>
<ol>
<li>Select the project file from the project navigator to open the project editor.</li>
<li>Select the target from the left side of the project editor.</li>
<li>Click the Build Phases button at the top of the editor.</li>
<li>Click the Add Build Phase button at the bottom of the editor.</li>
<li>Choose Add Copy Files from the menu.</li>
<li>Drag the SDL framework from the project navigator to the table in the Copy Files build phase.</li>
<li>Choose Frameworks from the Destination menu.</li>
</ol>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/01/SDLCopyFilesBuildPhase.png" border="0" alt="SDLCopyFilesBuildPhase" width="600" height="163" /></p>
<p>If you have additional frameworks to copy to the application bundle, repeat Step 6 for those frameworks. Don&#8217;t copy Apple&#8217;s frameworks to the application bundle; every Mac has Apple&#8217;s frameworks installed. Only copy third-party frameworks, such as SDL_image and SDL_mixer.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2012/01/using-sdl-with-xcode-4/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Accessing Local git Repositories in Redmine</title>
		<link>http://meandmark.com/blog/2012/01/accessing-local-git-repositories-in-redmine/</link>
		<comments>http://meandmark.com/blog/2012/01/accessing-local-git-repositories-in-redmine/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 19:21:30 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[scm]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[redmine]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=427</guid>
		<description><![CDATA[For those of you who don&#8217;t know what it is, Redmine is a tool for managing software projects and tracking bugs and other issues. One of Redmine&#8217;s features is its integration with version control systems. Suppose you have a bug in your software. You fix the bug and commit the fix to the repository. You [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who don&#8217;t know what it is, <a href="http://www.redmine.org">Redmine</a> is a tool for managing software projects and tracking bugs and other issues. One of Redmine&#8217;s features is its integration with version control systems. Suppose you have a bug in your software. You fix the bug and commit the fix to the repository. You can associate the revision number of your code fix with the bug in Redmine so you know which revision fixed the bug. Redmine supports several version controls, but I&#8217;m focusing on git because git is the only one I tested.</p>
<p>Configuring a repository is not difficult in Redmine. Create a project, go to its Settings section, and click the Repository tab. But the instructions to configure the repository are misleading for local git repositories. They tell you to enter the path to the repository. If you enter the path to your local git repository, such as the following:</p>
<pre>/path/to/repository</pre>
<p>You will get a 404 error when you try to access the repository in Redmine. You must enter the path to the repository&#8217;s .git folder for Redmine to be able to access it.</p>
<pre>/path/to/repository/.git</pre>
<p>If you enter the wrong repository path, discover the 404 error, and go back to correct the error by adding .git to the path, you will notice that Redmine does not let you modify the repository path. You must delete the reference to the repository and recreate it.</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/01/RedmineGitConfiguration.png" border="0" alt="RedmineGitConfiguration" width="600" height="180" /></p>
<p>Click the Delete button, which is in the bottom right corner of the screenshot, to delete the reference to the repository. After deleting the reference, choose a version control system from the SCM menu and reenter the path to the repository.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2012/01/accessing-local-git-repositories-in-redmine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Items to NSTextView&#8217;s Contextual Menu</title>
		<link>http://meandmark.com/blog/2012/01/adding-items-to-nstextviews-contextual-menu/</link>
		<comments>http://meandmark.com/blog/2012/01/adding-items-to-nstextviews-contextual-menu/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 20:36:28 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[cocoa]]></category>
		<category><![CDATA[Mac Development]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=424</guid>
		<description><![CDATA[When you add a text view to your application using Interface Builder you get access to the text view&#8217;s default contextual menu. You can open the contextual menu in your application by right-clicking (or control-clicking) in the text view. This menu lets you do things like cut, copy, paste, and check the document for spelling [...]]]></description>
			<content:encoded><![CDATA[<p>When you add a text view to your application using Interface Builder you get access to the text view&#8217;s default contextual menu. You can open the contextual menu in your application by right-clicking (or control-clicking) in the text view. This menu lets you do things like cut, copy, paste, and check the document for spelling errors. If you&#8217;ve read Aaron Hillegass&#8217;s Cocoa programming book you know how to replace the default contextual menu, but you may want to use the default menu and add some menu items to it. If you&#8217;re writing an HTML editor, you may want to add a menu item to wrap HTML tags around selected text. This post shows you how to add a menu item to NSTextView&#8217;s contextual menu.</p>
<h3>Accessing the Contextual Menu</h3>
<p>The first step to adding an item to a text view&#8217;s contextual menu is to access the menu. You can access NSTextView&#8217;s default contextual menu using the menu: method.</p>
<pre>IBOutlet NSTextView* textView;</pre>
<pre>NSMenu* textViewContextualMenu = [textView menu];</pre>
<h3>Adding a Menu Item to the Contextual Menu</h3>
<p>After you get access to the contextual menu, call NSMenu&#8217;s addItemWithTitle: method to add a menu item to the contextual menu. You must supply three pieces of information: the name of the menu item, the action, and the keyboard equivalent for the menu item. The action is the method that gets called when the user chooses the menu item. The following example adds a Tags menu item to the contextual menu with no keyboard equivalent:</p>
<pre>- (IBAction)createTag:(id)sender;</pre>
<pre>NSMenuItem* tagsMenuItem = [textViewContextualMenu addItemWithTitle:@"Tags" action:@selector(createTag:) keyEquivalent:@""];</pre>
<p>If you want to place a menu item in a specific place in the contextual menu, call NSMenu&#8217;s insertItemWithTitle: method. This method works similarly to the addItemWithTitle: method, but there is an additional argument to specify: the index (location in the menu) where you want to insert the menu item.</p>
<h3>Adding a Submenu</h3>
<p>Sometimes you need to add a submenu to a menu item. In the example I&#8217;ve been using in this article, you may decide to add a menu of tags as a submenu of the Tags menu so the user can add a specific tag. Call the contextual menu&#8217;s setSubmenu: method to add a submenu. Supply the menu to add and the menu item where you&#8217;re adding the menu. The following example adds a menu of tags to the Tags menu item:</p>
<pre>IBOutlet NSMenu* tagsMenu;</pre>
<pre>[textViewContextualMenu setSubmenu:tagsMenu forItem:tagsMenuItem];</pre>
<p>The example assumes you created a menu in Interface Builder. Add a NSMenu object to the xib file, and add items to the NSMenu object. Creating a menu in Interface Builder is generally easier than creating a menu programmatically, but you can create the menu in your source code if you want. Refer to the <em>NSMenu Class Reference</em>, which is part of Apple&#8217;s documentation, to learn more about creating a menu in code. Searching for NSMenu in Xcode&#8217;s documentation window should be enough to find the class reference.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2012/01/adding-items-to-nstextviews-contextual-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>User Interface Instrument</title>
		<link>http://meandmark.com/blog/2011/12/user-interface-instrument/</link>
		<comments>http://meandmark.com/blog/2011/12/user-interface-instrument/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 17:00:26 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Instruments]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=422</guid>
		<description><![CDATA[The User Interface instrument records the user interaction with your Mac application and lets you replay the recording. This instrument records every event that occurs when you run the application. Choose the UI Recorder template to use the User Interface instrument. Before You Trace User Interface recording requires the Enable access for assistive devices checkbox [...]]]></description>
			<content:encoded><![CDATA[<p>The User Interface instrument records the user interaction with your Mac application and lets you replay the recording. This instrument records every event that occurs when you run the application. Choose the UI Recorder template to use the User Interface instrument.</p>
<h2>Before You Trace</h2>
<p>User Interface recording requires the Enable access for assistive devices checkbox to be selected in the Universal Access section of Apple&#8217;s System Preferences. The System Preferences application should be in your Applications folder.</p>
<h2>User Interface Instrument Results</h2>
<p>When you finish a trace with the User Interface instrument, it shows the following information for each event:</p>
<ul>
<li>Sample number.</li>
<li>A thumbnail image of where the event happened.</li>
<li>Triggers, whose purpose escapes me. For me it always shows an image of a menu with Triggers as the menu choice.</li>
<li>The type of event, such as mouse button down, mouse moved, and key down.<span style="white-space: pre;"> </span></li>
<li>Key, which tells you the key that was pressed for a keyboard event.<span style="white-space: pre;"> </span></li>
<li>Title, which is the title of the view where the event occurred: window, view, control, menu, etc. <span style="white-space: pre;"> </span></li>
<li>Location, which tells you the location of the event. Mouse button events are the most common events to have a location.</li>
</ul>
<p>Don’t worry if you see lots of samples with blank values in the Key, Title, and Location columns. That’s normal behavior. In the track pane mouse events are blue, keyboard events are green, and system events are yellow.</p>
<h2>Replaying what the User Interface Instrument Recorded</h2>
<p>To replay a sequence you recorded, you must first finish a trace by clicking the Stop button. The Record button now has the title Drive and Record. Click the Drive and Record button to replay the recording. Instruments creates a new run and replays the event sequence.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2011/12/user-interface-instrument/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenGL Driver Instrument</title>
		<link>http://meandmark.com/blog/2011/12/opengl-driver-instrument/</link>
		<comments>http://meandmark.com/blog/2011/12/opengl-driver-instrument/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 05:30:01 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Instruments]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[xcode 4]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=418</guid>
		<description><![CDATA[Researching Instruments for Xcode Tools Sensei allowed me to become familiar with most of the built-in instruments. Due to the high number of instruments, there was no way for me to cover them all in the book. I focused on the most commonly used instruments in the book. I can use this blog to explain [...]]]></description>
			<content:encoded><![CDATA[<p>Researching Instruments for <em>Xcode Tools Sensei</em> allowed me to become familiar with most of the built-in instruments. Due to the high number of instruments, there was no way for me to cover them all in the book. I focused on the most commonly used instruments in the book. I can use this blog to explain some of the other instruments. I start with the OpenGL Driver instrument.</p>
<h2>What the OpenGL Driver Instrument Does</h2>
<p>The OpenGL Driver instrument records OpenGL statistics. Some statistics this instrument records include the following:</p>
<ul>
<li>The amount of free video memory.<span style="white-space: pre;"> </span></li>
<li>The number of textures used.<span style="white-space: pre;"> </span></li>
<li>The number of buffer swaps.<span style="white-space: pre;"> </span></li>
<li>The amount of time the CPU waited for the GPU.<span style="white-space: pre;"> </span></li>
<li>The number of surfaces the GPU allocated.</li>
</ul>
<p>Obviously OpenGL applications are the ones to benefit from the OpenGL Driver instrument. The OpenGL ES Driver instrument records similar information for iOS applications. The OpenGL ES Driver instrument is available in both the OpenGL ES Driver and OpenGL ES Analysis templates. In most cases you should use the OpenGL ES Analysis template for OpenGL ES profiling.</p>
<p>One thing you&#8217;ll notice when you create a new trace document is there is no template for the OpenGL Driver instrument. Pick one of the other templates (Time Profiler and Empty would be good choices for profiling purposes) and add the OpenGL Driver instrument to the trace document by dragging the instrument from the Library to the instrument list. Click the Library button in the trace document window toolbar to open the Library.</p>
<h2>Before You Trace</h2>
<p>Before you start tracing you must tell Instruments the statistics to show in the track pane and detail view. Click the Info button next to the OpenGL Driver instrument to open a pop-up editor. Click the Configure button to see all the available statistics. Select the checkbox next to a statistic to tell Instruments to show it in the track pane and detail view. The extended detail view shows all the statistics so you should show only the most important statistics in the track pane and detail view.</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2011/12/OpenGL-Driver-Configuration.png" border="0" alt="OpenGL Driver Configuration" width="495" height="273" /></p>
<p>The screenshot also shows where you set the sampling rate.</p>
<h2>Trace Results</h2>
<p>Use the Target menu in the trace document window toolbar to pick an application to profile. Click the Record button to start profiling. Click the Pause button to pause recording and see the statistics. The track pane graphs each statistic you told the OpenGL Driver instrument to observe.</p>
<p>The detail view at the bottom of the trace document window has one column for each statistic you told Instruments to show. There is one row in the detail view for each sample the OpenGL Driver instrument recorded. Selecting a sample from the list shows all the OpenGL statistics for that sample in the extended detail view. The extended detail view is on the right side of the trace document window. If you don&#8217;t see it, choose View &gt; Extended Detail or click the right button in the View group in the toolbar.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2011/12/opengl-driver-instrument/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Instruments: Finding Where You Allocate Memory</title>
		<link>http://meandmark.com/blog/2011/12/instruments-finding-where-you-allocate-memory/</link>
		<comments>http://meandmark.com/blog/2011/12/instruments-finding-where-you-allocate-memory/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 00:04:33 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Instruments]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=413</guid>
		<description><![CDATA[I have seen several questions recently on Stack Overflow from people using the Allocations instrument in Instruments. When looking through the information the Allocations instrument provides, they have difficulty finding the areas of their code responsible for the memory allocations. Answering questions on this topic several times on Stack Overflow tells me it&#8217;s time to [...]]]></description>
			<content:encoded><![CDATA[<p>I have seen several questions recently on Stack Overflow from people using the Allocations instrument in Instruments. When looking through the information the Allocations instrument provides, they have difficulty finding the areas of their code responsible for the memory allocations. Answering questions on this topic several times on Stack Overflow tells me it&#8217;s time to make a post about finding where your application allocates memory.</p>
<p>There are three views in Instruments that can help you find the parts of your code that are allocating large amounts of memory: the extended detail view, the call tree view, and the source view.</p>
<h2>Extended Detail View</h2>
<p>When you select a memory allocation from the detail view, the extended detail view shows the call stack for that memory allocation. Examining the call stack can help you find the function in your code that makes the memory allocation. To open the extended detail view, choose View &gt; Extended Detail or click the right button in the View group in the toolbar.</p>
<h2>Call Tree View</h2>
<p>The Allocations instrument initially shows the table view, which tells you memory allocation statistics. Switching to the call tree view can help you find where your application allocates memory. Use the jump bar to switch to the call tree view.</p>
<p>To the left of the call tree view is the Call Tree collection of checkboxes. Selecting the Invert Call Tree and Hide System Libraries checkboxes can help you quickly find your code in the call tree view.</p>
<h2>Source View</h2>
<p>Double-clicking one of your functions from the extended detail view&#8217;s call stack or the call tree view opens the source view. The source view highlights the lines of code in the function that are allocating memory and tells you the amount of memory allocated. More information on the source view is available in the <a href="http://meandmark.com/blog/2010/05/instruments-source-view/">Instruments Source View</a> post, but keep in mind that some parts of the post do not apply in Xcode 4.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2011/12/instruments-finding-where-you-allocate-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Custom Xcode 4 Project Templates</title>
		<link>http://meandmark.com/blog/2011/12/creating-custom-xcode-4-project-templates/</link>
		<comments>http://meandmark.com/blog/2011/12/creating-custom-xcode-4-project-templates/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 01:15:04 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Xcode]]></category>
		<category><![CDATA[xcode 4]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=406</guid>
		<description><![CDATA[This post contains the material on custom project templates I had prepared for the book. The material was not strong enough to put in the book, mainly because creating custom project templates manually in Xcode 4 is difficult (much more difficult than in previous versions of Xcode) and not documented by Apple. I had a [...]]]></description>
			<content:encoded><![CDATA[<p>This post contains the material on custom project templates I had prepared for the book. The material was not strong enough to put in the book, mainly because creating custom project templates manually in Xcode 4 is difficult (much more difficult than in previous versions of Xcode) and not documented by Apple. I had a difficult time getting a simple project template to work. But there is not a lot of information available on creating Xcode 4 project templates so I&#8217;m making what I wrote available here. I hope it helps you create your own project templates.</p>
<p>For more information on Xcode 4 project templates, look at Apple&#8217;s templates and read the following articles, which you&#8217;ve probably read if you&#8217;ve done a Google search for creating project templates in Xcode 4:</p>
<p><a href="http://blog.boreal-kiss.net/2011/03/11/a-minimal-project-template-for-xcode-4/">A minimal project template for Xcode 4</a></p>
<p><a href="http://snipt.net/yonishin/about-xcode-4-project-template">About XCode 4 Project Template (How To Create Custom Project Template)</a></p>
<h2>Project Template Contents</h2>
<p>At a minimum a project template consists of two items: a folder with the extension .xctemplate and a property list file named TemplateInfo.plist. You can also have additional files like icon files, source code files, and xib files in the project template. Place these files and the property list file in the template folder.</p>
<p>The .xctemplate extension defines the folder as a template folder. The name of the folder is the name that appears in the list of templates for the selected category in the New Project Assistant. The name of the folder is the name of the template.</p>
<h2>Apple&#8217;s Project Templates</h2>
<p>I recommend duplicating the TemplateInfo.plist file from one of Apple’s templates and using that copy as your TemplateInfo.plist file. You can find Apple’s iOS project templates in the following location:</p>
<pre>Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates</pre>
<p>The rest of Apple’s project templates are in the following location:</p>
<pre>Developer/Library/Xcode/Templates/Project Templates</pre>
<p>Developer is where you installed Xcode 4.</p>
<p>Open the TemplateInfo.plist file in Xcode to modify it. I&#8217;m going to cover the keys in the TemplateInfo.plist file later in this post.</p>
<h2>Moving the Template Folder</h2>
<p style="font-family: 'Lucida Grande';">For Xcode to find your project template you must move the template folder to the user templates folder, which is in the following location:</p>
<pre>/Users/Username/Library/Developer/Xcode/Templates/Project Templates/GroupName</pre>
<p style="font-family: 'Lucida Grande';">You may need to manually create some of the folders in the path to the user templates folder. GroupName is the name of the category on the left side of the New Project Assistant. You can create your own group name or use one of the built-in names. Your project template will appear in the GroupName category.</p>
<h2 style="font-family: 'Lucida Grande';">TemplateInfo.plist Keys</h2>
<p style="font-family: 'Lucida Grande';">The TemplateInfo.plist file has the following keys (this may not be an exhaustive list) for project templates:</p>
<ul>
<li>Ancestors</li>
<li>Concrete</li>
<li>Definitions</li>
<li>Description</li>
<li>Identifier</li>
<li>InjectionTargets</li>
<li>Kind</li>
<li>MacOSXVersionMin</li>
<li>Nodes</li>
<li>Options</li>
<li>Platforms</li>
<li>Project</li>
<li>SortOrder</li>
<li>Targets</li>
</ul>
<p style="font-family: 'Lucida Grande';">Your template does not have to use all these keys. The data type for the keys is usually one of the following: Array, Boolean, Dictionary, or String.</p>
<h3 style="font-family: 'Lucida Grande';">Ancestors Key</h3>
<p style="font-family: 'Lucida Grande';">The Ancestors key is an array of strings. The strings are the identifiers of the project templates your template inherits from. If your template has no ancestors, you can ignore this key.</p>
<p style="font-family: 'Lucida Grande';">Suppose your template inherits from Apple’s Cocoa Application template. You want the same options the Apple template has to create a document-based application, to use Core Data, and to add a unit testing bundle. In this case you would need to inherit from Apple’s document-based application, Core Data application, and CoreDataSpotlight application templates. You would add the following ancestor values to your template:</p>
<pre style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier;">com.apple.dt.unit.cocoaDocumentBasedApplication</pre>
<pre style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier;">com.apple.dt.unit.coreDataApplication</pre>
<pre style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier;">com.apple.dt.unit.coreDataSpotlightApplication</pre>
<h3 style="font-family: 'Lucida Grande';">Concrete Key</h3>
<p style="font-family: 'Lucida Grande';">The Concrete key is a Boolean value. You must set the Concrete key to YES for your template to appear in the New Project Assistant.</p>
<h3 style="font-family: 'Lucida Grande';">Definitions Key</h3>
<p style="font-family: 'Lucida Grande';">The Definitions key is a dictionary. This key allows you to add comments, includes, and code to source code files. It also allows you to create groups from files or folders in an Xcode workspace. If you use the Definitions key to create groups, you must also have a Nodes key in your project template.</p>
<h3 style="font-family: 'Lucida Grande';">Description Key</h3>
<p style="font-family: 'Lucida Grande';">The Description key describes the project template. The contents of the Description key appear at the bottom of the New Project Assistant when you select the project template.</p>
<h3 style="font-family: 'Lucida Grande';">Identifier Key</h3>
<p style="font-family: 'Lucida Grande';">The Identifier key is a string value that uniquely identifies your template. It takes the following form:</p>
<pre style="font-family: 'Lucida Grande';">
<pre style="margin: 8px;">com.CompanyName.TemplateName</pre>
</pre>
<h3 style="font-family: 'Lucida Grande';">InjectionTargets</h3>
<p>The InjectionTargets key is an array of strings. The strings are the identifiers of project templates. The InjectionTargets key is a new key, which didn&#8217;t exist when I originally researched custom project templates. A Google search turned up no results. You&#8217;re on your own.</p>
<h3 style="font-family: 'Lucida Grande';">Kind Key</h3>
<p style="font-family: 'Lucida Grande';">The Kind key is a string value. It should have the following value:</p>
<pre style="margin: 8px;">Xcode.Xcode3.ProjetTemplateUnitKind</pre>
<p><span style="font-family: 'Lucida Grande';">If you inherit from another template, you shouldn’t have to specify the Kind key.</span></p>
<h3 style="font-size: 1.17em;">MacOSXVersionMin Key</h3>
<p>The MacOSXVersionMin key is the earliest version of Mac OS X that can use the template.</p>
<h3 style="font-family: 'Lucida Grande';">Nodes Key</h3>
<p style="font-family: 'Lucida Grande';">The Nodes key is an array key that creates a file in the project. Add a string key for each file you want to be created in the project. The value for the key is the name of the file.</p>
<h3 style="font-family: 'Lucida Grande';">Options Key</h3>
<p style="font-family: 'Lucida Grande';">The Options key is an array that lets you add controls to the New Project Assistant. An example of a custom control is the Type pop-up menu for command-line tool projects that lets you choose the language for the project. The Type menu is an example of a custom control.</p>
<p style="font-family: 'Lucida Grande';">Create a dictionary key for each control you want to add. Add keys to the dictionary key. The following are common keys for controls:</p>
<ul style="font-family: 'Lucida Grande';">
<li>Type identifies the type of control. Pop-up menus should use a value of popup. Checkboxes should use a value of checkbox. Text fields should use a value of text. Combo boxes should use a value of combo.</li>
<li>Name is the label for the control.</li>
<li>Description contains tool tip text for the control.</li>
<li>Identifier is a string that uniquely identifies the control.</li>
<li>Default is a string that provides a default value for a control.</li>
<li>Values is an array that contains the entries for a combo box or pop-up menu.</li>
<li>Required is a Boolean key that says whether a condition has to be true for the control to be enabled.</li>
</ul>
<p>You can see an example of the Required key if you create a Cocoa application. The Document Extension text field is disabled unless you select the Create Document-Based Application checkbox. If you use the Required key, you must add a RequiredOptions dictionary key that contains the conditions.</p>
<h3 style="font-family: 'Lucida Grande';">Platforms Key</h3>
<p style="font-family: 'Lucida Grande';">The Platforms key is an array of strings that identifies the platforms the template works on. A Mac project template has the following value:</p>
<pre>com.apple.platform.macosx</pre>
<p style="font-family: 'Lucida Grande';">An iOS project template has the following value:</p>
<pre>com.apple.platform.iphoneos</pre>
<h3>Project Key</h3>
<p>The Project key is a dictionary key that contains build settings. For those of you creating project templates for personal use, I recommend using a configuration settings file instead of placing build setting values in the project template. A reason to add build settings is if you want to add libraries to the project template. Add a build setting for linker flags and add the flags for the libraries, such as -lLibraryName.</p>
<p>If you use the Project key to place build settings in the project template, you will most likely need to create additional dictionary keys inside the Project key. Create a Configuration dictionary key for configuration-specific build settings. Inside the Configurations dictionary, create Debug and Release dictionaries. Place your configuration-specific build settings inside the Debug and Release dictionaries. Create a SharedSettings dictionary for any build settings that apply to all build configurations. Place any build settings that apply to all build configurations inside the SharedSettings dictionary.</p>
<h3 style="font-size: 1.17em;">SortOrder Key</h3>
<p>I&#8217;m not exactly sure what the SortOrder key does. I haven&#8217;t seen a sort order value other than 1 in Apple&#8217;s templates.</p>
<h3>Target Key</h3>
<p>The Targets key is an array key you use to add frameworks, libraries, build phases, and build settings to the template. The build settings you add to the Targets key apply to the target while the build settings you add to the Project key apply to the project.</p>
<p>To add frameworks to the template, add a Frameworks key to the Targets key. The Frameworks key should be an array. Add string keys to the Frameworks key. The value of a string key is the name of the framework. None of Apple&#8217;s project templates use a library so I don&#8217;t know what you have to do to add a library to the Target key.</p>
<p>To add build phases, create a dictionary key named BuildPhases. Add a dictionary key for each build phase you want in the project template. At a minimum you need to add a Class string key to the dictionary key that contains the name of the build phase. Use the following values:</p>
<ul>
<li>Sources is the name for the Compile Sources build phase.</li>
<li>Frameworks is the name for the Link Binary with Libraries build phase.</li>
<li>Resources is the name for the Copy Bundle Resources build phase.</li>
<li>CopyFiles is the name for the Copy Files build phase.</li>
<li>ShellScript is the name for the Run Script build phase.</li>
<li>Headers is the name for the Copy Headers build phase.</li>
<li>Rez is the name for the Build Carbon Resources build phase.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2011/12/creating-custom-xcode-4-project-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xcode 4.2: Application and Logic Unit Test Classes</title>
		<link>http://meandmark.com/blog/2011/11/xcode-4-2-application-and-logic-unit-test-classes/</link>
		<comments>http://meandmark.com/blog/2011/11/xcode-4-2-application-and-logic-unit-test-classes/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 20:46:30 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Xcode]]></category>
		<category><![CDATA[unit testing]]></category>
		<category><![CDATA[xcode 4]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=404</guid>
		<description><![CDATA[In Xcode 4.2 when you add a new Objective-C test case class to your project and click the Next button, you will see a Test Type menu. This menu has two choices: Application and Logic. The menu determines the unit test Xcode adds in the class&#8217;s implementation file. If you choose Application, Xcode adds a [...]]]></description>
			<content:encoded><![CDATA[<p>In Xcode 4.2 when you add a new Objective-C test case class to your project and click the Next button, you will see a Test Type menu. This menu has two choices: Application and Logic. The menu determines the unit test Xcode adds in the class&#8217;s implementation file. If you choose Application, Xcode adds a test for the application delegate. If you choose Logic, Xcode adds a dummy test that asserts 1 + 1 = 2.</p>
<p>It doesn&#8217;t matter what you choose from the Test Type menu. You&#8217;ll probably delete the unit test Xcode creates and add your tests. You can add your tests to both test types.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2011/11/xcode-4-2-application-and-logic-unit-test-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xcode 4: Open New Tab When Double-Clicking a File</title>
		<link>http://meandmark.com/blog/2011/11/xcode-4-open-new-tab-when-double-clicking-a-file/</link>
		<comments>http://meandmark.com/blog/2011/11/xcode-4-open-new-tab-when-double-clicking-a-file/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 18:20:48 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Xcode]]></category>
		<category><![CDATA[xcode 4]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=402</guid>
		<description><![CDATA[Xcode 4 adds support for tabbed editing. When using tabbed editing you most likely want Xcode to open a new tab when you open a file from the project navigator. To get this behavior you must tell Xcode to open a new tab when you double-click a file in the project navigator. Open Xcode&#8217;s preferences. [...]]]></description>
			<content:encoded><![CDATA[<p>Xcode 4 adds support for tabbed editing. When using tabbed editing you most likely want Xcode to open a new tab when you open a file from the project navigator. To get this behavior you must tell Xcode to open a new tab when you double-click a file in the project navigator.</p>
<p>Open Xcode&#8217;s preferences. Click the General button. Choose Uses Separate Tab from the Double Click Navigation menu.</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2011/11/Xcode-Tabbed-Editing-Prefs.png" border="0" alt="Xcode Tabbed Editing Prefs" width="599" height="432" /></p>
<p>Now when you double-click a file in the project navigator, Xcode opens the file in a new tab.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2011/11/xcode-4-open-new-tab-when-double-clicking-a-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<br />
<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /home/szymczyk/public_html/blog/wp-includes/feed-rss2.php:11) in <b>/home/szymczyk/public_html/blog/wp-includes/pluggable.php</b> on line <b>897</b><br />

