<?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>MrBrown blob</title>
	<atom:link href="http://charles.lescampeurs.org/feed" rel="self" type="application/rss+xml" />
	<link>http://charles.lescampeurs.org</link>
	<description>random bits.</description>
	<lastBuildDate>Thu, 02 Feb 2012 14:34:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Ubuntu 11.10: setting up Apache2 and SSL with self-signed certificate</title>
		<link>http://charles.lescampeurs.org/2012/01/14/ubuntu-11-10-setting-up-apache2-and-ssl-with-self-signed-certificate?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ubuntu-11-10-setting-up-apache2-and-ssl-with-self-signed-certificate</link>
		<comments>http://charles.lescampeurs.org/2012/01/14/ubuntu-11-10-setting-up-apache2-and-ssl-with-self-signed-certificate#comments</comments>
		<pubDate>Sat, 14 Jan 2012 15:23:46 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=985</guid>
		<description><![CDATA[Create a self-signed certificate: $ make-ssl-cert generate-default-snakeoil --force-overwrite It creates the following files: /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/certs/ssl-cert-snakeoil.pem Activate Apache SSL module: $ a2enmod ssl Activate Apache default ssl virtual host: $ a2ensite default-ssl Restart Apache: /etc/init.d/apache2 restart You should now see the following page on your webserver: It works! This is the default web page for this [...]]]></description>
			<content:encoded><![CDATA[<p>Create a self-signed certificate:</p>
<pre>$ make-ssl-cert generate-default-snakeoil --force-overwrite</pre>
<p>It creates the following files:</p>
<ul>
<li>/etc/ssl/private/ssl-cert-snakeoil.key</li>
<li>/etc/ssl/certs/ssl-cert-snakeoil.pem</li>
</ul>
<p>Activate Apache SSL module:</p>
<pre>$ a2enmod ssl</pre>
<p>Activate Apache default ssl virtual host:</p>
<pre>$ a2ensite default-ssl</pre>
<p>Restart Apache:</p>
<pre>/etc/init.d/apache2 restart</pre>
<p>You should now see the following page on your webserver:</p>
<pre>It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.</pre>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=985" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2012/01/14/ubuntu-11-10-setting-up-apache2-and-ssl-with-self-signed-certificate/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How I upgraded my iPhone 3GS from 3.x to 4.x</title>
		<link>http://charles.lescampeurs.org/2011/11/19/how-i-upgraded-my-iphone-3gs-from-3-x-to-4-x?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-i-upgraded-my-iphone-3gs-from-3-x-to-4-x</link>
		<comments>http://charles.lescampeurs.org/2011/11/19/how-i-upgraded-my-iphone-3gs-from-3-x-to-4-x#comments</comments>
		<pubDate>Sat, 19 Nov 2011 17:54:43 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[iOS]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=917</guid>
		<description><![CDATA[When I tried to upgrade my phone 3GS 3.x to a 4.x firmware found on osxdaily.com, I got the famous &#8220;this device isn&#8217;t eligible for the requested build&#8221;. My jailbroken device was on a 3.1.3 firmware with Cydia installed. After trying different 4.x firmwares, I googled this error message and found an interesting thread here. [...]]]></description>
			<content:encoded><![CDATA[<p>When I tried to upgrade my phone 3GS 3.x to a 4.x firmware found on <a href="http://osxdaily.com/2010/10/25/download-iphone-firmware-ipsw/">osxdaily.com</a>, I got the famous <em>&#8220;this device isn&#8217;t eligible for the requested build&#8221;</em>.</p>
<p>My jailbroken device was on a 3.1.3 firmware with Cydia installed. After trying different 4.x firmwares, I googled this error message and found an interesting thread <a href="http://modmyi.com/forums/3g-s-downgrading/789424-restoring-4-0-2-a.html" target="_blank">here</a>.</p>
<p>I followed their advice and it worked:</p>
<ul>
<li>Install <a href="http://thefirmwareumbrella.blogspot.com/" target="_blank">TinyUmbrella</a>,</li>
<li>Clicked on my device,</li>
<li>went to Advanced tab and unchecked <em>&#8220;Request SHSH from Cydia&#8221;,</em></li>
<li>Started TSS Server,</li>
<li>Entered Recovery,</li>
<li>and finally in iTunes clicked on Restore (with option key) and selected a 4.1 firmware,</li>
<li>done!</li>
</ul>
<div>I can now test my apps on a 4.x device.</div>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=917" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2011/11/19/how-i-upgraded-my-iphone-3gs-from-3-x-to-4-x/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learn iOS Application Development with Stanford</title>
		<link>http://charles.lescampeurs.org/2011/11/18/learn-ios-application-development-with-stanford?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=learn-ios-application-development-with-stanford</link>
		<comments>http://charles.lescampeurs.org/2011/11/18/learn-ios-application-development-with-stanford#comments</comments>
		<pubDate>Fri, 18 Nov 2011 20:07:13 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[iOS]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=912</guid>
		<description><![CDATA[The new Fall 2011 courses from Stanford on iTunes U are available! Courses by Paul Hegardy released with a Creative Commons BY-NC-ND license in full HD. 7 courses are available: MVC and Introduction to Objective-C My first iOS App Objective-C Views Protocols and Gestures Multiple MVCs and Segues iPad Apps]]></description>
			<content:encoded><![CDATA[<p><a href="http://charles.lescampeurs.org/wp-content/uploads/2011/11/stanford-college.jpg"><img class="aligncenter size-full wp-image-914" title="stanford-college" src="http://charles.lescampeurs.org/wp-content/uploads/2011/11/stanford-college.jpg" alt="" width="445" height="151" /></a></p>
<p>The new <a href="http://itunes.apple.com/itunes-u/ipad-iphone-application-development/id473757255" target="_blank">Fall 2011 courses from Stanford on iTunes U</a> are available!</p>
<p>Courses by Paul Hegardy released with a Creative Commons BY-NC-ND license in full HD.</p>
<p>7 courses are available:</p>
<ul>
<li>MVC and Introduction to Objective-C</li>
<li>My first iOS App</li>
<li>Objective-C</li>
<li>Views</li>
<li>Protocols and Gestures</li>
<li>Multiple MVCs and Segues</li>
<li>iPad Apps</li>
</ul>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=912" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2011/11/18/learn-ios-application-development-with-stanford/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging EXC_BAD_ACCESS</title>
		<link>http://charles.lescampeurs.org/2011/10/05/debugging-exc_bad_access?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=debugging-exc_bad_access</link>
		<comments>http://charles.lescampeurs.org/2011/10/05/debugging-exc_bad_access#comments</comments>
		<pubDate>Wed, 05 Oct 2011 20:47:55 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[iOS]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=855</guid>
		<description><![CDATA[A helpful article explaining how to use gdb to debug EXC_BAD_ACCESS: EXC_BAD_ACCESS and no stack trace == more quality time lost in Xcode Also, if you don&#8217;t know about NSZombieEnabled you should read the following articles: What is NSZombieEnabled? How do I set NSZombieEnabled in Xcode 4?]]></description>
			<content:encoded><![CDATA[<p>A helpful article explaining how to use gdb to debug EXC_BAD_ACCESS:</p>
<ul>
<li><a href="http://www.mulle-kybernetik.com/weblog/2010/07/exc_bad_access_and_no_stack_tr.html" target="_blank">EXC_BAD_ACCESS and no stack trace == more quality time lost in Xcode</a></li>
</ul>
<div>Also, if you don&#8217;t know about NSZombieEnabled you should read the following articles:</div>
<div>
<ul>
<li><a href="http://www.cocoadev.com/index.pl?NSZombieEnabled" target="_blank">What is NSZombieEnabled?</a></li>
<li><a href="http://stackoverflow.com/questions/2190227/how-do-i-set-nszombieenabled-in-xcode-4" target="_blank">How do I set NSZombieEnabled in Xcode 4?</a></li>
</ul>
</div>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=855" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2011/10/05/debugging-exc_bad_access/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iOS device and OS version</title>
		<link>http://charles.lescampeurs.org/2011/03/30/ios-device-and-os-version?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ios-device-and-os-version</link>
		<comments>http://charles.lescampeurs.org/2011/03/30/ios-device-and-os-version#comments</comments>
		<pubDate>Wed, 30 Mar 2011 12:19:30 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=551</guid>
		<description><![CDATA[If you are interested in device class and OS version statistics, I&#8217;ve compiled a list of recent articles: iOS device and OS version stats from Instapaper 3.0 2011-03-24 is it worth supporting iOS 3 in 2011? 2011-03-20 What proportion of all iPhone owners use iOS 4.x today? 2011-01-18 61% of iPads already running iOS 4 [...]]]></description>
			<content:encoded><![CDATA[<p>If you are interested in device class and OS version statistics, I&#8217;ve compiled a list of recent articles:</p>
<ul>
<li><a href="http://www.marco.org/4073734086" target="_blank">iOS device and OS version stats from Instapaper 3.0</a> <em>2011-03-24</em></li>
<li><a href="http://blog.jcmultimedia.com.au/2011/03/is-it-worth-supporting-ios-3-in-2011.html" target="_blank">is it worth supporting iOS 3 in 2011?</a> <em>2011-03-20</em></li>
<li><a href="http://www.quora.com/What-proportion-of-all-iPhone-owners-use-iOS4-%2a-today" target="_blank">What proportion of all iPhone owners use iOS 4.x today?</a> <em>2011-01-18</em></li>
<li><a href="http://insights.chitika.com/2011/61-of-ipads-already-running-ios-4-january-ios-and-android-os-breakdown/" target="_blank">61% of iPads already running iOS 4</a> <em>2011-01-07</em></li>
</ul>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=551" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2011/03/30/ios-device-and-os-version/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install DataMapper MySQL adapter on Mac OS X (10.6.6)</title>
		<link>http://charles.lescampeurs.org/2011/03/28/install-datamapper-mysql-adapter-on-mac-os-x-10-6-6?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=install-datamapper-mysql-adapter-on-mac-os-x-10-6-6</link>
		<comments>http://charles.lescampeurs.org/2011/03/28/install-datamapper-mysql-adapter-on-mac-os-x-10-6-6#comments</comments>
		<pubDate>Mon, 28 Mar 2011 20:13:08 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[gem]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=427</guid>
		<description><![CDATA[I&#8217;ve just installed MySQL 5 from mysql-5.5.9-osx10.6-x86_64.dmg package, see MySQL download website or mirrors. This package installs MySQL in /usr/local/mysql (symlink to mysql-5.5.9-osx10.6-x86_64). When I wanted to install DataMapper MySQL driver, I ran into the following error: $ sudo gem install dm-mysql-adapter --no-rdoc --no-ri Fetching: data_objects-0.10.3.gem (100%) Fetching: do_mysql-0.10.3.gem (100%) Building native extensions.  This could take [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just installed MySQL 5 from <em>mysql-5.5.9-osx10.6-x86_64.dmg</em> package, see MySQL download website or mirrors.<br />
This package installs MySQL in <em>/usr/local/mysql</em> (symlink to <em>mysql-5.5.9-osx10.6-x86_64</em>).<br />
When I wanted to install DataMapper MySQL driver, I ran into the following error:</p>
<pre>$ sudo gem install dm-mysql-adapter --no-rdoc --no-ri
Fetching: data_objects-0.10.3.gem (100%)
Fetching: do_mysql-0.10.3.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing dm-mysql-adapter:
<span style="white-space: pre;">	</span>ERROR: Failed to build gem native extension.
/opt/ruby-1.9.1/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.
[...]</pre>
<p>This means while compiling the extension, compiler can&#8217;t find mysql librairies. It&#8217;s because they haven&#8217;t been installed in standard include folders. They actually are in <em>/usr/local/mysql</em>.<br />
To indicate to the compilation process to check this folder you need to add the following parameter to the command line:</p>
<pre>$ sudo gem install dm-mysql-adapter --no-rdoc --no-ri -- --with-mysql-dir=/usr/local/mysql/

Building native extensions.  This could take a while...
Fetching: dm-do-adapter-1.0.2.gem (100%)
Fetching: dm-mysql-adapter-1.0.2.gem (100%)
Successfully installed do_mysql-0.10.3
Successfully installed dm-do-adapter-1.0.2
Successfully installed dm-mysql-adapter-1.0.2
3 gems installed</pre>
<p>You&#8217;re done!</p>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=427" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2011/03/28/install-datamapper-mysql-adapter-on-mac-os-x-10-6-6/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Editorial Calendar WordPress plugin</title>
		<link>http://charles.lescampeurs.org/2011/03/24/editorial-calendar-wordpress-plugin?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=editorial-calendar-wordpress-plugin</link>
		<comments>http://charles.lescampeurs.org/2011/03/24/editorial-calendar-wordpress-plugin#comments</comments>
		<pubDate>Thu, 24 Mar 2011 20:32:08 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=514</guid>
		<description><![CDATA[WordPress doesn&#8217;t make it easy to see when your posts are scheduled. That&#8217;s exactly what I was thinking! Browsing WordPress Plugin Directory, I found Editorial Calendar. This plugin shows you all your posts through a calendar view instead of the classic list view: You can also manage your posts, drag and drop between dates, etc&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p><em>WordPress doesn&#8217;t make it easy to see when your posts are scheduled</em>.</p>
<p>That&#8217;s exactly what I was thinking!</p>
<p>Browsing <a href="http://wordpress.org/extend/plugins/search.php?q=calendar&amp;sort=" target="_blank">WordPress Plugin Directory</a>, I found <a href="http://wordpress.org/extend/plugins/editorial-calendar/" target="_blank">Editorial Calendar</a>.</p>
<p>This plugin shows you all your posts through a calendar view instead of the classic list view:</p>
<p><a href="http://charles.lescampeurs.org/wp-content/uploads/2011/03/wordpress-editorial-calendar.png"><img class="aligncenter size-medium wp-image-516" title="wordpress-editorial-calendar" src="http://charles.lescampeurs.org/wp-content/uploads/2011/03/wordpress-editorial-calendar-300x245.png" alt="" width="300" height="245" /></a></p>
<p>You can also manage your posts, drag and drop between dates, etc&#8230; A must have when you schedule your posts.</p>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=514" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2011/03/24/editorial-calendar-wordpress-plugin/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSSMERR_TP_NOT_TRUSTED with Xcode</title>
		<link>http://charles.lescampeurs.org/2011/03/19/cssmerr_tp_not_trusted-with-xcode?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cssmerr_tp_not_trusted-with-xcode</link>
		<comments>http://charles.lescampeurs.org/2011/03/19/cssmerr_tp_not_trusted-with-xcode#comments</comments>
		<pubDate>Sat, 19 Mar 2011 12:09:08 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=490</guid>
		<description><![CDATA[After switching to a new MacBook (and copying everything through Firewire cable), I couldn&#8217;t compile any app on my iPhone. Compilation was always ending up with the following message: /.../build/Debug-iphoneos/xxxxxx.app: CSSMERR_TP_NOT_TRUSTED Command /usr/bin/codesign failed with exit code 1 I checked my provisioning profiles, certificates and everything and couldn&#8217;t find a solution. Finally, while browsing the [...]]]></description>
			<content:encoded><![CDATA[<p>After switching to a new MacBook (and copying everything through Firewire cable), I couldn&#8217;t compile any app on my iPhone.</p>
<p>Compilation was always ending up with the following message:</p>
<pre>/.../build/Debug-iphoneos/xxxxxx.app: CSSMERR_TP_NOT_TRUSTED
Command /usr/bin/codesign failed with exit code 1</pre>
<p><a href="http://charles.lescampeurs.org/wp-content/uploads/2011/03/Screen-shot-2011-03-19-at-12.55.34-PM.png"><img class="aligncenter size-medium wp-image-491" title="CSSMERR_TP_NOT_TRUSTED" src="http://charles.lescampeurs.org/wp-content/uploads/2011/03/Screen-shot-2011-03-19-at-12.55.34-PM-300x86.png" alt="" width="300" height="86" /></a></p>
<p>I checked my provisioning profiles, certificates and everything and couldn&#8217;t find a solution.</p>
<p>Finally, while browsing the iOS Provisioning Portal, I read this under my Development Certificate:</p>
<p><em>*If you do not have the WWDR intermediate certificate installed, click here to download now.</em></p>
<p><em><a href="http://charles.lescampeurs.org/wp-content/uploads/2011/03/Screen-shot-2011-03-19-at-12.52.41-PM.png"><img class="aligncenter size-medium wp-image-492" title="iOS Provisioning Portal" src="http://charles.lescampeurs.org/wp-content/uploads/2011/03/Screen-shot-2011-03-19-at-12.52.41-PM-300x93.png" alt="" width="300" height="93" /></a><br />
</em></p>
<p>I downloaded this certificate and added it to <em>Keychain Access:</em></p>
<p><a href="http://charles.lescampeurs.org/wp-content/uploads/2011/03/Screen-shot-2011-03-19-at-12.53.03-PM.png"><img class="aligncenter size-medium wp-image-493" title="Keychain Access" src="http://charles.lescampeurs.org/wp-content/uploads/2011/03/Screen-shot-2011-03-19-at-12.53.03-PM-300x132.png" alt="" width="300" height="132" /></a></p>
<p>I compiled my app again and it worked!</p>
<p>I don&#8217;t know why this certificate disappeared during my MacBook migration&#8230;</p>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=490" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2011/03/19/cssmerr_tp_not_trusted-with-xcode/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Xcode tips and tricks</title>
		<link>http://charles.lescampeurs.org/2011/03/14/xcode-tips-and-tricks?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=xcode-tips-and-tricks</link>
		<comments>http://charles.lescampeurs.org/2011/03/14/xcode-tips-and-tricks#comments</comments>
		<pubDate>Mon, 14 Mar 2011 19:05:24 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=352</guid>
		<description><![CDATA[Starting or not Mac OS X / iOS development, it&#8217;s worth reading articles to find tips that suits you. 10 Xcode power user tips for iPhone devs What are those little Xcode tips &#38; tricks you wish you knew about 2 years ago? 14 Essential Xcode Tips, Tricks and Resources for iPhone Devs Killer Xcode [...]]]></description>
			<content:encoded><![CDATA[<p>Starting or not Mac OS X / iOS development, it&#8217;s worth reading articles to find tips that suits you.</p>
<ul>
<li><a href="http://www.reigndesign.com/blog/10-xcode-power-user-tips-for-iphone-devs/" target="_blank">10 Xcode power user tips for iPhone devs</a></li>
<li><a href="http://stackoverflow.com/questions/146297/what-are-those-little-xcode-tips-tricks-you-wish-you-knew-about-2-years-ago" target="_blank">What are those little Xcode tips &amp; tricks you wish you knew about 2 years ago?</a></li>
<li><a href="http://mobileorchard.com/14-essential-xcode-tips-tricks-and-resources-for-iphone-devs/" target="_blank">14 Essential Xcode Tips, Tricks and Resources for iPhone Devs</a></li>
<li><a href="http://iphonedevelopertips.com/xcode/xcode-tips-and-tricks-tips-1-to-10.html" target="_blank">Killer Xcode Tips and Tricks – Tips 1 to 10</a></li>
<li><a href="http://www.chimoosoft.com/articles/xcode.php" target="_blank">Xcode Tips and Tricks for MacOS X devs</a></li>
<li><a href="http://brandontreb.com/xcode-tips-and-shortcuts-to-improve-your-workflow/" target="_blank">XCode Tips And Shortcuts To Improve Your Workflow</a></li>
</ul>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=352" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2011/03/14/xcode-tips-and-tricks/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tint UIButton and UIBarButtonItem</title>
		<link>http://charles.lescampeurs.org/2011/02/10/tint-color-uibutton-and-uibarbuttonitem?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tint-color-uibutton-and-uibarbuttonitem</link>
		<comments>http://charles.lescampeurs.org/2011/02/10/tint-color-uibutton-and-uibarbuttonitem#comments</comments>
		<pubDate>Thu, 10 Feb 2011 21:58:00 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[tint]]></category>
		<category><![CDATA[UIBarButtonItem]]></category>
		<category><![CDATA[UIButton]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=397</guid>
		<description><![CDATA[Edit 2011-11-04 Since iOS 5.0, UIButton and UIBarButtonItem have a tintColor property. &#160; You may have noticed that the tint property is not available for UIButton and UIBarButtonItem. Two common techniques to change the color, you can find around are drawing button with CoreGraphic or using a stretchable UIImage. Lately, I found a new technique based on [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>Edit 2011-11-04</strong></em></p>
<p><em>Since iOS 5.0, UIButton and UIBarButtonItem have a tintColor property.</em></p>
<p>&nbsp;</p>
<p>You may have noticed that the <em>tint</em> property is not available for <a title="UIButton Class Reference" href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIButton_Class/UIButton/UIButton.html" target="_blank">UIButton</a> and <a title="UIBarButtonItem Class Reference" href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIBarButtonItem_Class/Reference/Reference.html" target="_blank">UIBarButtonItem</a>.</p>
<p>Two common techniques to change the color, you can find around are <a href="http://cocoawithlove.com/2008/09/drawing-gloss-gradients-in-coregraphics.html" target="_blank">drawing button with CoreGraphic</a> or <a href="http://stackoverflow.com/questions/2707958/creating-a-custom-uibutton" target="_blank">using a stretchable UIImage</a>.</p>
<p>Lately, I found a new technique based on UISegmentedControl which you can use the tint property to change the color of your button. This control can be tweaked to have only one segment with a UIButton style (UISegmentedControlStyleBar).</p>
<h2>A standard UISegmentedControl</h2>
<p><a href="http://charles.lescampeurs.org/wp-content/uploads/2011/02/uisegmentedcontrol.png"><img class="aligncenter size-full wp-image-403" title="uisegmentedcontrol" src="http://charles.lescampeurs.org/wp-content/uploads/2011/02/uisegmentedcontrol.png" alt="" width="405" height="99" /></a></p>
<h2>Tweaking the control</h2>
<p>We will now create a UISegmentedControl with one segment and set its tint color:</p>
<pre lang="objc">UISegmentedControl *button = [[[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"Add", nil]] autorelease];
button.frame = CGRectMake(0, 0, 160, 33);
button.center = self.view.center;
button.momentary = YES;
button.segmentedControlStyle = UISegmentedControlStyleBar;
button.tintColor = UIColorFromRGB(0x0000DD);
[self.view addSubview:button];</pre>
<p>Compile your code, your button will look like the following screenshot:</p>
<p><a href="http://charles.lescampeurs.org/wp-content/uploads/2011/02/tinted-uibutton.png"><img class="aligncenter size-full wp-image-401" title="tinted-uibutton" src="http://charles.lescampeurs.org/wp-content/uploads/2011/02/tinted-uibutton.png" alt="" width="405" height="100" /></a></p>
<p>Refer to the <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UISegmentedControl_Class/Reference/UISegmentedControl.html" target="_blank">UISegmentedControl class reference</a> for a detailled explanation of its properties.</p>
<p>I used a macro in this code to define my tint color. Macro definition is:</p>
<pre lang="objc">#define UIColorFromRGB(rgbValue) [UIColor \
  colorWithRed:((float)((rgbValue &amp; 0xFF0000) &gt;&gt; 16))/255.0 \
  green:((float)((rgbValue &amp; 0xFF00) &gt;&gt; 8))/255.0 \
  blue:((float)(rgbValue &amp; 0xFF))/255.0 alpha:1.0]</pre>
<p>You can read more about defining macro or function <a href="http://stackoverflow.com/questions/1243201/is-macro-better-than-uicolor-for-setting-rgb-color" target="_blank">here</a> and <a href="http://pegolon.wordpress.com/2008/11/03/quick-iphone-dev-tip-creating-a-uicolor-with-just-one-rgb-value/" target="_blank">here</a>.</p>
<h2>In a toolbar</h2>
<p>You can also use this technique to tint UIBarButtonItem used in UIToolBar.</p>
<pre lang="objc">UIToolbar *toolbar = [[[UIToolbar alloc] init] autorelease];
toolbar.barStyle = UIBarStyleDefault;
[toolbar sizeToFit];
toolbar.frame = CGRectMake(0, self.view.frame.size.height-44, self.view.frame.size.width, 44);
[self.view addSubview:toolbar];

/* Create our tinted buttons */
UISegmentedControl *button = [[[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"Add", nil]] autorelease];
button.momentary = YES;
button.segmentedControlStyle = UISegmentedControlStyleBar;
button.tintColor = UIColorFromRGB(0x0d9c23);

UIBarButtonItem *barButton = [[[UIBarButtonItem alloc] initWithCustomView:button] autorelease];
UISegmentedControl *button2 = [[[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"Delete", nil]] autorelease];
button2.momentary = YES;
button2.segmentedControlStyle = UISegmentedControlStyleBar;
button2.tintColor = UIColorFromRGB(0xC84131);
UIBarButtonItem *barButton2 = [[[UIBarButtonItem alloc] initWithCustomView:button2] autorelease];

[toolbar setItems:[NSArray arrayWithObjects: barButton, barButton2, nil]];</pre>
<p>You now have a toolbar with 2 tinted buttons that look like that:</p>
<p><a href="http://charles.lescampeurs.org/wp-content/uploads/2011/02/tinted-uibarbuttonitem.png"><img class="aligncenter size-full wp-image-406" title="tinted-uibarbuttonitem" src="http://charles.lescampeurs.org/wp-content/uploads/2011/02/tinted-uibarbuttonitem.png" alt="" width="405" height="99" /></a></p>
<div class="download"><a href="http://charles.lescampeurs.org/wp-content/plugins/download-monitor/download.php?id=1">Download Tint UIButton and UIBarButtonItem source code</a></div>
<p><a class="github" title="Download source code on GitHub.com" href="https://github.com/CharlyBr/MrBrown-Blob/tree/master/TintedUIBarButtonItem" target="_blank">Download on GitHub.com</a></p>
<form class="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHVwYJKoZIhvcNAQcEoIIHSDCCB0QCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYATzck3TPezapuwDJqIyobnErjqL2kJokectysMAT90RoC0ISUf16jevpDK33q89o1Cvl6caSCggDjJ4yNvH+w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8A=-----END PKCS7-----" />
<input type="image" name="submit" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/btn/btn_donate_LG.gif" alt="PayPal - The safer, easier way to pay online!" /> This source code is created and enhanced in my leisure time for free. Your donation allows me to continue my development and any amount is greatly appreciated.<br />
<img class="paypal" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/fr_FR/i/scr/pixel.gif" alt="" width="1" height="1" border="0" /></form>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=397" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2011/02/10/tint-color-uibutton-and-uibarbuttonitem/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

