<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Johannes Rudolph&#039;s Blog</title>
	<atom:link href="http://jorudolph.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jorudolph.wordpress.com</link>
	<description>Random thoughts on Software Development</description>
	<lastBuildDate>Fri, 27 Jan 2012 14:56:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='jorudolph.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Johannes Rudolph&#039;s Blog</title>
		<link>http://jorudolph.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://jorudolph.wordpress.com/osd.xml" title="Johannes Rudolph&#039;s Blog" />
	<atom:link rel='hub' href='http://jorudolph.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Kiwi as a static framework or Universal Library</title>
		<link>http://jorudolph.wordpress.com/2012/01/27/kiwi-as-a-static-framework-or-universal-library/</link>
		<comments>http://jorudolph.wordpress.com/2012/01/27/kiwi-as-a-static-framework-or-universal-library/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 14:56:28 +0000</pubDate>
		<dc:creator>jorudolph</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://jorudolph.wordpress.com/?p=458</guid>
		<description><![CDATA[A problem commonly encountered when using open-source iOS frameworks is the lack of a fully-functional framework facility in xCode. Part of the issue is that Apple does not allow dynamic linking on iOS devices, the other is that there are two different architectures that need to be supported by libraries targeting both armv6 (up to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=458&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A problem commonly encountered when using open-source iOS frameworks is the lack of a fully-functional framework facility in xCode. Part of the issue is that Apple does not allow dynamic linking on iOS devices, the other is that there are two different architectures that need to be supported by libraries targeting both armv6 (up to iPhone 3G) and armv7 devices (iPhone 3GS and later). On top of that, we also need a binary that will run on the simulator (x86).</p>
<p>The easiest solution to the library problem in XCode is using project dependencies to build libraries in the configuration you need them. When taking a source dependency is not desirable, you are pretty much left to your own if the OSS project doesn&#8217;t provide binaries.</p>
<p>Fortunately enough, it&#8217;s not too difficult to build your own universal frameworks. Below are the steps I use for building a version of <a href="https://github.com/allending/Kiwi">Kiwi</a>:</p>
<ol>
<li>Grab the Universal Framework XCode templates from <a href="https://github.com/kstenerud/iOS-Universal-Framework">https://github.com/kstenerud/iOS-Universal-Framework</a></li>
<li>Install the Fake framework flavor (although the Real framework flavor should work as well)</li>
<li>Create a new xCode project with the Fake framework template</li>
<li>Add all source files of Kiwi (make sure to check the Copy to destination group folder box)</li>
<li>Select the Kiwi static library target, project editor, build phases, Copy Headers, select all headers in the Project Group, right click and select move to Public</li>
<li>Select the Kiwi static library target, project editor, build phases, link binary with libraries and add SenTestingKit.framework</li>
<li>Build</li>
<li>Go to the  Project Navigator (Cmd-1) and select Products Kiwi.framework. Right-Click and select &#8220;Show in Finder&#8221;</li>
<li>You should see two folders: Kiwi.framework and Kiwi.embeddedframework &#8211; Kiwi.framework is the one we need</li>
<li>Copy the Kiwi.framework folder into your lib folder</li>
<li>Open the project you want to use Kiwi.framework in and select your target, project editor, build phases, link binary with libraries, click + and add Kiwi.framework from your lib folder</li>
</ol>
<p>That&#8217;s it. Takes less than two minutes once you know the trick.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jorudolph.wordpress.com/458/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jorudolph.wordpress.com/458/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jorudolph.wordpress.com/458/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jorudolph.wordpress.com/458/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jorudolph.wordpress.com/458/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jorudolph.wordpress.com/458/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jorudolph.wordpress.com/458/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jorudolph.wordpress.com/458/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jorudolph.wordpress.com/458/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jorudolph.wordpress.com/458/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jorudolph.wordpress.com/458/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jorudolph.wordpress.com/458/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jorudolph.wordpress.com/458/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jorudolph.wordpress.com/458/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=458&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jorudolph.wordpress.com/2012/01/27/kiwi-as-a-static-framework-or-universal-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d2acfb42ed883e5e6ec8969262f5c61?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jorudolph</media:title>
		</media:content>
	</item>
		<item>
		<title>Continous Deployment for Apps via testflightapp</title>
		<link>http://jorudolph.wordpress.com/2012/01/26/continous-deployment-for-apps-via-testflightapp/</link>
		<comments>http://jorudolph.wordpress.com/2012/01/26/continous-deployment-for-apps-via-testflightapp/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 22:09:11 +0000</pubDate>
		<dc:creator>jorudolph</dc:creator>
				<category><![CDATA[Continous Integration]]></category>
		<category><![CDATA[iOS Continous Integration Series]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iRow]]></category>

		<guid isPermaLink="false">http://jorudolph.wordpress.com/?p=452</guid>
		<description><![CDATA[The benefits of continous integration are widely known. By extending the ideas of continous integration to the full software lifecycle, continous delivery becomes an inevitable practice. Especially in the context of managing a beta program for mobile devices, to most of which I as a developer have no physical access, the ability to have fully [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=452&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The benefits of continous integration are widely known. By extending the ideas of continous integration to the full software lifecycle, continous delivery becomes an inevitable practice. Especially in the context of managing a beta program for mobile devices, to most of which I as a developer have no physical access, the ability to have fully automated deployments is crucial.</p>
<p><a href="http://www.testflightapp.com">Testflightapp.com</a> provides a great service to iOS developers by managing app provisioning and deployments. They do also provide easy to use instrumentation facilities.</p>
<p>Continous deployment with testflightapp.com is a breaze, all you need your build-server to do is interact with a straightforward web-api to upload your ipa packages.<br />
Here&#8217;s the script I&#8217;m using for <a href="http://www.rowmotionapp.com">RowMotion</a>:</p>
<p><pre class="brush: bash;">
#!/bin/bash
# 

# testflightapp.com tokens
API_TOKEN=&quot;YOUR_API_TOKEN&quot;
TEAM_TOKEN=&quot;YOUR_TEAM_TOKEN&quot;

PRODUCT_NAME=&quot;RowMotion&quot;
ARTEFACTS=&quot;$PWD/Artefacts&quot;

SIGNING_IDENTITY=&quot;iPhone Distribution&quot;
PROVISIONING_PROFILE=&quot;$PWD/id/RowMotionAdHoc.mobileprovision&quot;

# calculated vars
OUT_IPA=&quot;${ARTEFACTS}/${PRODUCT_NAME}.ipa&quot;
OUT_DSYM=&quot;${ARTEFACTS}/${PRODUCT_NAME}.dSYM.zip&quot;

# kill artefacts directory
rm -rf $ARTEFACTS
mkdir $ARTEFACTS

# compile
echo &quot;##teamcity[compilationStarted compiler='xcodebuild']&quot;
xcodebuild -workspace RowMotion.xcworkspace -scheme RowMotion -sdk iphoneos5.0 -configuration Release build archive
buildSucess=$?

if [[ $buildSucess != 0 ]] ; then
echo &quot;##teamcity[message text='compiler error' status='ERROR']&quot;
echo &quot;##teamcity[compilationFinished compiler='xcodebuild']&quot;
exit $buildSucess
fi

echo &quot;##teamcity[compilationFinished compiler='xcodebuild']&quot;

#ipa
echo &quot;##teamcity[progressMessage 'Creating .ipa for ${PRODUCT_NAME}']&quot;

DATE=$( /bin/date +&quot;%Y-%m-%d&quot; )
ARCHIVE=$( /bin/ls -t &quot;${HOME}/Library/Developer/Xcode/Archives/${DATE}&quot; | /usr/bin/grep xcarchive | /usr/bin/sed -n 1p )
DSYM=&quot;${HOME}/Library/Developer/Xcode/Archives/${DATE}/${ARCHIVE}/dSYMs/${PRODUCT_NAME}.app.dSYM&quot;
APP=&quot;${HOME}/Library/Developer/Xcode/Archives/${DATE}/${ARCHIVE}/Products/Applications/${PRODUCT_NAME}.app&quot;

/usr/bin/xcrun -sdk iphoneos PackageApplication -v &quot;${APP}&quot; -o &quot;${OUT_IPA}&quot; --sign &quot;${SIGNING_IDENTITY}&quot; --embed &quot;${PROVISIONING_PROFILE}&quot;

#symbols
echo &quot;##teamcity[progressMessage 'Zipping .dSYM for ${PRODUCT_NAME}']&quot;
/usr/bin/zip -r &quot;${OUT_DSYM}&quot; &quot;${DSYM}&quot;

# prepare build notes
NOTES=`hg tip`

#upload
echo &quot;##teamcity[progressMessage 'Uploading ${PRODUCT_NAME} to TestFlight']&quot;

/usr/bin/curl &quot;http://testflightapp.com/api/builds.json&quot; \
-F file=@&quot;${OUT_IPA}&quot; \
-F dsym=@&quot;${OUT_DSYM}&quot; \
-F api_token=&quot;${API_TOKEN}&quot; \
-F team_token=&quot;${TEAM_TOKEN}&quot; \
-F notes=&quot;${NOTES}&quot; \
-F notify=&quot;True&quot; \
-F distribution_lists=&quot;Private&quot;
</pre><br />
Make sure to adapt the script to your requirements. One trick I&#8217;m fond of is automatically providing SCM information in the build notes (the step with executing hg tip does just that).<br />
For deployments I&#8217;m using two lists, a private one to which all builds will be published, and a public one to which I can selectively deploy. What&#8217;s so great about testflightapp.com is that it will automatically send emails to notify my testers about the new build and will then allow me to monitor installs.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jorudolph.wordpress.com/452/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jorudolph.wordpress.com/452/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jorudolph.wordpress.com/452/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jorudolph.wordpress.com/452/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jorudolph.wordpress.com/452/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jorudolph.wordpress.com/452/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jorudolph.wordpress.com/452/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jorudolph.wordpress.com/452/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jorudolph.wordpress.com/452/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jorudolph.wordpress.com/452/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jorudolph.wordpress.com/452/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jorudolph.wordpress.com/452/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jorudolph.wordpress.com/452/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jorudolph.wordpress.com/452/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=452&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jorudolph.wordpress.com/2012/01/26/continous-deployment-for-apps-via-testflightapp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d2acfb42ed883e5e6ec8969262f5c61?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jorudolph</media:title>
		</media:content>
	</item>
		<item>
		<title>Retrieving Coverage Information &#8211; LLVM, CoverStory and Teamcity</title>
		<link>http://jorudolph.wordpress.com/2011/08/10/retrieving-coverage-information-llvm-coverstory-and-teamcity/</link>
		<comments>http://jorudolph.wordpress.com/2011/08/10/retrieving-coverage-information-llvm-coverstory-and-teamcity/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 15:57:18 +0000</pubDate>
		<dc:creator>jorudolph</dc:creator>
				<category><![CDATA[iOS Continous Integration Series]]></category>

		<guid isPermaLink="false">http://jorudolph.wordpress.com/?p=414</guid>
		<description><![CDATA[Abstract This time, we will set up automated code coverage metrics retrieval from our unit and integration test suites. When I started writing my iOS Continous Integration Series, we needed to use GCC and GCov to generate coverage information. Fortunately, this has changed and starting with iOS 5 Beta 4 XCode ships a version of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=414&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Abstract</h2>
<p>This time, we will set up automated code coverage metrics retrieval from our unit and integration test suites. When I started writing my iOS Continous Integration Series, we needed to use GCC and GCov to generate coverage information. Fortunately, this has changed and starting with iOS 5 Beta 4 XCode ships a version of LLVM that is capable of generating coverage information.</p>
<p>We will use CoverStory to create a (not-so-pretty but useful) HTML report of our coverage information and teamcity will pick this up and display it in the Build Result tab.</p>
<h2>Collecting Metrics</h2>
<p>Setting up LLVM to generate coverage information is easy. The following is an augmented version of the <a href="http://code.google.com/p/coverstory/wiki/UsingCoverstory">instructions</a> found at the CoverStory Wiki:</p>
<ol>
<li>Edit all test targets, add <tt>-fprofile-arcs</tt> and <tt>-ftest-coverage</tt> to <tt>Other C Flags</tt></li>
<li>Edit all test targets, select the &#8220;Build Phases&#8221; tab and add <tt>/Developer/usr/lib/libprofile_rt.dylib</tt> to the stage &#8220;Link Binary WIth Libraries&#8221;</li>
<li>Build and run, you should see *.gcda and *.gcno files generated in your bin directory</li>
</ol>
<h2>HTML Reports with CoverStory</h2>
<p>Once the Build Script compiled the product and executed all the tests, we need to pick up the coverage information generated. From this data, we need to generate a report that shows the number of lines covered. I&#8217;m using <a href="http://code.google.com/p/coverstory/">CoverStory</a> to do just this. Unfortunately, it doesn&#8217;t come with a command line interface, so I had to resort to some hacked AppleScript to drive the process (note that I checked in CoverStory in my source tree under tool/CoverStory.app). The script takes two command line parameters, the first being the directory to search for coverage information, the second being the output directory for the generated html report.</p>
<p><pre class="brush: bash;">
on run argv
	
	tell application &quot;tool/CoverStory.app&quot;
	    quit
		activate
		set x to open (item 1 of argv)
		tell x to export to HTML in (item 2 of argv)
		quit
	end tell
	
	return item 1 of argv &amp; &quot;|&quot; &amp; item 2 of argv
	
end run
</pre></p>
<p>Ok, so that&#8217;s all nice and sweet. However, there is another issue I hit with CoverStory (which has already been filed as a <a href="http://code.google.com/p/coverstory/issues/detail?id=21#c16">bug</a> with the maintainers). Basically, CoverStory would startup and freeze upon opening your coverage information. The Link also has a patch fixing it, that did not make it&#8217;s way into an official release yet. I do have a private build of CoverStory with the fix applied, If you are feel unable to build CoverStory yourself email me and I&#8217;ll be happy to provide you with my build. I hope this becomes obsolete very soon.</p>
<p>Alright, where did we left off? We have an apple script for collecting coverage information. This needs to be included in our build script. So our Shell based build script looks like this now:</p>
<p><pre class="brush: bash;">
# build here

# test here

# collect coverage results
echo &quot;##teamcity[progressStart 'Collecting Coverage results']&quot;
osascript coverStory.applescript $PWD $PWD/Artefacts/Coverage
echo &quot;##teamcity[progressFinish 'Collecting Coverage results']&quot;
</pre></p>
<p>Note that $PWD denotes the current working directory, i.e. the directory the build script is executed from. CoverStory will generate  a HTML based report and put it in our Artefacts directory in a subdirectory called Coverage. Next, we&#8217;re going to make Teamcity pick up this report.</p>
<h2>Integrating Coverage Reports with Teamcity</h2>
<p>Teamcity does an admirable job at managing artefacts. As a first step, we need to edit our build configuration and add an Artifact Path: &#8220;%system.teamcity.build.checkoutDir%/Artefacts/Coverage =&gt; coverage.zip&#8221;. This will cause TeamCity to take the Coverage Report and put it into a coverage.zip archive that it sucks in and stores along the build results.</p>
<p>Next, we edit the Teamcity Server Configuration, chose &#8220;Report Tabs&#8221; and hit &#8220;Create new report tab&#8221; with the following settings:</p>
<ul>
<li>Tab Title: Code Coverage</li>
<li>Base path: coverage.zip</li>
<li>Start page: index.html</li>
</ul>
<p>Teamcity will display an iframe with the contents of index.html of the coverage.zip artifact we created in the previous step. If everything went well, your build results should look like this now:</p>
<p><a href="http://jorudolph.files.wordpress.com/2011/08/tc_codecoverage.png"><img class="aligncenter size-full wp-image-437" title="TC_CodeCoverage" src="http://jorudolph.files.wordpress.com/2011/08/tc_codecoverage.png?w=600&#038;h=484" alt="" width="600" height="484" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jorudolph.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jorudolph.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jorudolph.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jorudolph.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jorudolph.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jorudolph.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jorudolph.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jorudolph.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jorudolph.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jorudolph.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jorudolph.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jorudolph.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jorudolph.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jorudolph.wordpress.com/414/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=414&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jorudolph.wordpress.com/2011/08/10/retrieving-coverage-information-llvm-coverstory-and-teamcity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d2acfb42ed883e5e6ec8969262f5c61?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jorudolph</media:title>
		</media:content>

		<media:content url="http://jorudolph.files.wordpress.com/2011/08/tc_codecoverage.png" medium="image">
			<media:title type="html">TC_CodeCoverage</media:title>
		</media:content>
	</item>
		<item>
		<title>iOS: Detect Personal Hotspot</title>
		<link>http://jorudolph.wordpress.com/2011/07/22/ios-detect-personal-hotspot/</link>
		<comments>http://jorudolph.wordpress.com/2011/07/22/ios-detect-personal-hotspot/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 11:29:44 +0000</pubDate>
		<dc:creator>jorudolph</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://jorudolph.wordpress.com/?p=431</guid>
		<description><![CDATA[When you want to detect the type of available connections on an iPhone, the best resource you can find on the web is the sample code from Erica Sadun&#8217;s excellent iPhone Cookbook book (which I can wholeheartedly recommend). The sample code can be found on github (look into 02 and 03): https://github.com/erica/iphone-3.0-cookbook-/tree/master/C13-Networking While the solution presented [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=431&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When you want to detect the type of available connections on an iPhone, the best resource you can find on the web is the sample code from Erica Sadun&#8217;s excellent <a href="http://www.amazon.com/iPhone-Developers-Cookbook-Building-Applications/dp/0321659570/ref=ntt_at_ep_dpt_1">iPhone Cookbook</a> book (which I can wholeheartedly recommend). The sample code can be found on github (look into 02 and 03): <a href="https://github.com/erica/iphone-3.0-cookbook-/tree/master/C13-Networking">https://github.com/erica/iphone-3.0-cookbook-/tree/master/C13-Networking</a></p>
<p>While the solution presented is great, it fails to work on an iPhone 4 that has the Personal Hotspot feature enabled. In this scenario, the iPhone will create a network interface called &#8220;ap0&#8243; that bridges through to &#8220;en0&#8243; (WiFi) and &#8220;pdp_ip0&#8243; (3G) . Since &#8220;en0&#8243; will not be marked as AF_INET interface in this scenario, the approach Erica outlined will fail here. Here&#8217;s a dump of the available interfaces, their loopback and AF_INET status and their assigned address:</p>
<pre>2011-07-22 12:59:07.120 RowMotion[286:707] name: lo0, inet: 0, loopback: 0, adress: 24.3.0.0
2011-07-22 12:59:07.126 RowMotion[286:707] name: lo0, inet: 0, loopback: 0, adress: 0.0.0.0
2011-07-22 12:59:07.129 RowMotion[286:707] name: lo0, inet: 1, loopback: 0, adress: 127.0.0.1
2011-07-22 12:59:07.134 RowMotion[286:707] name: lo0, inet: 0, loopback: 0, adress: 0.0.0.0
2011-07-22 12:59:07.137 RowMotion[286:707] name: en0, inet: 0, loopback: 1, adress: 6.3.6.0
2011-07-22 12:59:07.141 RowMotion[286:707] name: ap0, inet: 0, loopback: 1, adress: 6.3.6.0
2011-07-22 12:59:07.145 RowMotion[286:707] name: pdp_ip0, inet: 0, loopback: 1, adress: 255.7.0.0
2011-07-22 12:59:07.149 RowMotion[286:707] name: pdp_ip0, inet: 1, loopback: 1, adress: 10.217.22.129
2011-07-22 12:59:07.154 RowMotion[286:707] name: pdp_ip1, inet: 0, loopback: 1, adress: 255.7.0.0
2011-07-22 12:59:07.157 RowMotion[286:707] name: pdp_ip2, inet: 0, loopback: 1, adress: 255.7.0.0
2011-07-22 12:59:07.161 RowMotion[286:707] name: pdp_ip3, inet: 0, loopback: 1, adress: 255.7.0.0
2011-07-22 12:59:07.165 RowMotion[286:707] name: en1, inet: 0, loopback: 1, adress: 6.3.6.0
2011-07-22 12:59:07.168 RowMotion[286:707] name: bridge0, inet: 0, loopback: 1, adress: 6.7.6.0
<strong>2011-07-22 12:59:07.172 RowMotion[286:707] name: bridge0, inet: 1, loopback: 1, adress: 172.20.10.1</strong></pre>
<p>See that last line? Yep, that&#8217;s the bridge interface we need to use to communicate with other devices on our &#8220;personal hotspot&#8221;. Here&#8217;s how to ammend Erica&#8217;s code to make personal hotspots transparent:</p>
<p><pre class="brush: cpp;">
// Matt Brown's get WiFi IP addy solution
// http://mattbsoftware.blogspot.com/2009/04/how-to-get-ip-address-of-iphone-os-v221.html
+ (NSString *) localWiFiIPAddress
{
    BOOL success;
    struct ifaddrs * addrs;
    const struct ifaddrs * cursor;
    
    success = getifaddrs(&amp;amp;addrs) == 0;
    if (success) {
        cursor = addrs;
        while (cursor != NULL) {
            
            NSString *name = [NSString stringWithUTF8String:cursor-&amp;gt;ifa_name];
            
            NSLog(@&quot;available network interfaces: name: %@, inet: %d, loopback: %d, adress: %@&quot;, name, cursor-&amp;gt;ifa_addr-&amp;gt;sa_family == AF_INET, (cursor-&amp;gt;ifa_flags &amp;amp; IFF_LOOPBACK) == 0, [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)cursor-&amp;gt;ifa_addr)-&amp;gt;sin_addr)]);
            
            // the second test keeps from picking up the loopback address
            if (cursor-&amp;gt;ifa_addr-&amp;gt;sa_family == AF_INET &amp;amp;&amp;amp; (cursor-&amp;gt;ifa_flags &amp;amp; IFF_LOOPBACK) == 0) 
            {
                if ([name isEqualToString:@&quot;en0&quot;] || [name isEqualToString:@&quot;bridge0&quot;])  //  Wi-Fi adapter, or iPhone 4 Personal hotspot bridge adapter
                    return [NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)cursor-&amp;gt;ifa_addr)-&amp;gt;sin_addr)];
            }
            cursor = cursor-&amp;gt;ifa_next;
        }
        freeifaddrs(addrs);
    }
    return nil;
}

+ (BOOL) activeWLAN
{
    return ([self localWiFiIPAddress] != nil);
}

+ (BOOL) activePersonalHotspot
{

    // Personal hotspot is fixed to 172.20.10
    return ([self activeWLAN] &amp;amp;&amp;amp; [ hasPrefix:@&quot;172.20.10&quot;]);
}

+ (BOOL) activeWLAN
{
    return ([self localWiFiIPAddress] != nil);
}

+ (BOOL) activePersonalHotspot
{
    // Personal hotspot is fixed to 172.20.10
    NSString* localWifiAddress = [self localWiFiIPAddress];
    return (localWifiAddress != nil &amp;amp;&amp;amp; [localWifiAddress hasPrefix:@&quot;172.20.10&quot;]);
}

</pre></p>
<p>I hope this will find it&#8217;s way into the sample code soon. Pull request is pending.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jorudolph.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jorudolph.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jorudolph.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jorudolph.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jorudolph.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jorudolph.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jorudolph.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jorudolph.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jorudolph.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jorudolph.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jorudolph.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jorudolph.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jorudolph.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jorudolph.wordpress.com/431/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=431&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jorudolph.wordpress.com/2011/07/22/ios-detect-personal-hotspot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d2acfb42ed883e5e6ec8969262f5c61?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jorudolph</media:title>
		</media:content>
	</item>
		<item>
		<title>LLVM/Clang Code Coverage about to come</title>
		<link>http://jorudolph.wordpress.com/2011/07/07/llvmclang-code-coverage-about-to-come/</link>
		<comments>http://jorudolph.wordpress.com/2011/07/07/llvmclang-code-coverage-about-to-come/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 13:44:27 +0000</pubDate>
		<dc:creator>jorudolph</dc:creator>
				<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://jorudolph.wordpress.com/?p=428</guid>
		<description><![CDATA[According to information from this LLVM bug report, Nick Lewycky recently implemented support for generating gcov compatible coverage files from LLVM/Clang. I&#8217;m not keen to replace my local LLVM with a svn build, but I&#8217;m really looking forward to finally ditch gcc.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=428&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>According to information from <a href="http://llvm.org/bugs/show_bug.cgi?id=8030">this LLVM bug report</a>, Nick Lewycky recently implemented support for generating gcov compatible coverage files from LLVM/Clang. I&#8217;m not keen to replace my local LLVM with a svn build, but I&#8217;m really looking forward to finally ditch gcc.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jorudolph.wordpress.com/428/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jorudolph.wordpress.com/428/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jorudolph.wordpress.com/428/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jorudolph.wordpress.com/428/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jorudolph.wordpress.com/428/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jorudolph.wordpress.com/428/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jorudolph.wordpress.com/428/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jorudolph.wordpress.com/428/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jorudolph.wordpress.com/428/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jorudolph.wordpress.com/428/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jorudolph.wordpress.com/428/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jorudolph.wordpress.com/428/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jorudolph.wordpress.com/428/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jorudolph.wordpress.com/428/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=428&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jorudolph.wordpress.com/2011/07/07/llvmclang-code-coverage-about-to-come/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d2acfb42ed883e5e6ec8969262f5c61?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jorudolph</media:title>
		</media:content>
	</item>
		<item>
		<title>Joomla backups made easy</title>
		<link>http://jorudolph.wordpress.com/2011/07/02/joomla-backups-made-easy/</link>
		<comments>http://jorudolph.wordpress.com/2011/07/02/joomla-backups-made-easy/#comments</comments>
		<pubDate>Sat, 02 Jul 2011 13:32:00 +0000</pubDate>
		<dc:creator>jorudolph</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://jorudolph.wordpress.com/?p=424</guid>
		<description><![CDATA[This post sums up the backup strategy I&#8217;m using for the website of my next project RowMotion. RowMotion is hosted on a Joomla installation. My hoster is nice enough to provide a decent pre-built mysqldump based backup script, which can be found here. Did I mention it does email notifications too? All the necessary instructions to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=424&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post sums up the backup strategy I&#8217;m using for the website of my next project <a href="http://rowmotionapp.com">RowMotion</a>. RowMotion is hosted on a Joomla installation. My hoster is nice enough to provide a decent pre-built mysqldump based backup script, which can be found <a href="http://all-inkl.com/wichtig/anleitungen/datensicherung/mysql/php-skript-zum-sichern-der-datenbank/dump-erstellen-mit-e-mail-benachrichtigung_85.html">here</a>. Did I mention it does email notifications too? All the necessary instructions to set it up are mentioned there too.</p>
<p>Okay, so now we have a nice backup script for our Joomla database that needs to be triggered and the resulting backup file downloaded? Since the web-request needs to be authenticated, I figured it would be easiest to use some PowerShell magic to leverage the .NET WebClient. Here&#8217;s the full script:</p>
<p><pre class="brush: powershell;">
$username = &quot;un&quot;
$password = &quot;pw&quot;
$backupDir = &quot;C:\backup\&quot;

$web_client = New-Object System.Net.WebClient;
$web_client.Credentials = new-object System.Net.NetworkCredential($username, $password)

$response = $web_client.DownloadString(&quot;http://yourDomain.com/backup/databaseBackup.phpx&quot;);
echo &quot;Response:\n&quot;
echo $response

$regex = &quot;http://yourDomain.com.com/backup/.*?.gz&quot;;

$response -match $regex
$dumpUrl = $matches[0]

echo &quot;URL:\n&quot;
echo $dumpUrl

$fn = [System.IO.Path]::GetFileName($dumpUrl);

echo &quot;Filename:\n&quot;
echo $fn

$target = [System.IO.Path]::Combine($backupDir, $fn);

echo &quot;Target:\n&quot;
echo $target

$web_client.DownloadFile($dumpUrl, $target);
</pre></p>
<p>Sure enough, this is neither pretty nor the most robust, but it&#8217;s the simplest thing that could possibly work (and it does). Next, we need to schedule this task with the Windows Task Scheduler. I&#8217;m running this on my server together with all the other backup tasks.</p>
<p>Be sure to enter &#8220;powershell&#8221; as the command and &#8220;-noprofile -command &#8220;C:\backupJobs\yourps.ps1&#8243; &#8220;as the argument.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jorudolph.wordpress.com/424/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jorudolph.wordpress.com/424/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jorudolph.wordpress.com/424/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jorudolph.wordpress.com/424/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jorudolph.wordpress.com/424/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jorudolph.wordpress.com/424/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jorudolph.wordpress.com/424/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jorudolph.wordpress.com/424/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jorudolph.wordpress.com/424/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jorudolph.wordpress.com/424/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jorudolph.wordpress.com/424/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jorudolph.wordpress.com/424/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jorudolph.wordpress.com/424/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jorudolph.wordpress.com/424/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=424&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jorudolph.wordpress.com/2011/07/02/joomla-backups-made-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d2acfb42ed883e5e6ec8969262f5c61?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jorudolph</media:title>
		</media:content>
	</item>
		<item>
		<title>Mercurial Server using hgweb.cgi on Ubuntu</title>
		<link>http://jorudolph.wordpress.com/2011/06/30/mercurial-server-using-hgweb-cgi-on-ubuntu/</link>
		<comments>http://jorudolph.wordpress.com/2011/06/30/mercurial-server-using-hgweb-cgi-on-ubuntu/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 18:13:58 +0000</pubDate>
		<dc:creator>jorudolph</dc:creator>
				<category><![CDATA[Continous Integration]]></category>
		<category><![CDATA[iOS Continous Integration Series]]></category>
		<category><![CDATA[Source Control]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://jorudolph.wordpress.com/?p=422</guid>
		<description><![CDATA[In a previous post, we set up a virtual machine template for an ubuntu server. Now that we have set up a clone of this machine, it is time to set up a Mercurial repository server Abstract Mercurial provides an easy to use repository server via a python cgi script. Mercurials protocol facilitates fast transfers [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=422&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In a previous post, we set up a virtual machine template for an ubuntu server. Now that we have set up a clone of this machine, it is time to set up a Mercurial repository server</p>
<h2>Abstract</h2>
<p>Mercurial provides an easy to use repository server via a python cgi script. Mercurials protocol facilitates fast transfers over http, making it superior over an ssh solution based (such as git) when considering minimal protocol overhead vs. ease of use. As my webserver of choice, we will use lighttpd. This guide will follow the instructions published here <a href="http://mercurial.selenic.com/wiki/PublishingRepositories#multiple">http://mercurial.selenic.com/wiki/PublishingRepositories#multiple</a></p>
<h2>Installing Python</h2>
<p>This one is simple:</p>
<pre>ubuntu@localhost: sudo apt-get install python</pre>
<h2>Installing Lighttpd</h2>
<p>To install lighttpd, run:</p>
<pre>ubuntu@localhost: sudo apt-get install lighttpd</pre>
<p>Next, we need to create a specific configuration for our mercurial cgi script. We need to redirect all incoming requests to the cgi script, and then we apply some url rewrite magic to remove the ugly hgweb.cgi from our URLs. The hgweb.cgi script will be served from /var/www/hgweb.cgi. If you use a different location, make sure to chown it to www-data and chmod+x it (all described in the mercurial wiki). I created my config like this:</p>
<pre>ubuntu@localhost:~$ sudo vi /etc/lighttpd/hg.conf
ubuntu@localhost:~$ cat /etc/lighttpd/hg.conf
url.rewrite-once = (
  "^([/?].*)?$" =&gt; "/hgweb.cgi$1",
   "^/([/?].*)?$" =&gt; "/hgweb.cgi$1"
)

$HTTP["url"] =~ "^/hgweb.cgi([/?].*)?$" {
             server.document-root = "/var/www/"
             cgi.assign = ( ".cgi" =&gt; "/usr/bin/python" )
}</pre>
<p>Next is the lighttpd config, that will need to reference our hg.conf and enable mod_cgi:</p>
<pre>ubuntu@localhost:~$ cat /etc/lighttpd/lighttpd.conf
include "hg.conf"

server.modules = (
	"mod_access",
	"mod_alias",
	"mod_compress",
 	"mod_redirect",
        "mod_rewrite",
        "mod_cgi"
)</pre>
<h2>Further configuration Tricks</h2>
<p>You should force hgweb.cgi to serve UTF-8 content. Fortunately enough, this is as simple as adding (or uncommenting) the following lines to hgweb.cgi:</p>
<pre>import os
os.environ["HGENCODING"] = "UTF-8"</pre>
<p id="CA-7a6d7d20ab6949db770c6ff00c83db73221e311c" lang="en" dir="ltr">You will also need a hgweb.conf right next to hgweb.cgi and reference it from there (again, described in the mercurial wiki). For reference, my configuration includes all repos sourced under /var/hg/repos (and subdirectories) and allows anonymous push (I&#8217;m authenticated via VPN policy):</p>
<pre>ubuntu@localhost:~$ cat /var/www/hgweb.config
[paths]
/ = /var/hg/repos/**

[web]
baseurl = /
allow_push = *
push_ssl = false</pre>
<h2>Final Words</h2>
<p>That&#8217;s all there is to it. To make the server available via DNS, you need to make sure the servers hostname is registered with your local DNS. In my case, I simply added a static record to it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jorudolph.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jorudolph.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jorudolph.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jorudolph.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jorudolph.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jorudolph.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jorudolph.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jorudolph.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jorudolph.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jorudolph.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jorudolph.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jorudolph.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jorudolph.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jorudolph.wordpress.com/422/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=422&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jorudolph.wordpress.com/2011/06/30/mercurial-server-using-hgweb-cgi-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d2acfb42ed883e5e6ec8969262f5c61?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jorudolph</media:title>
		</media:content>
	</item>
		<item>
		<title>Objective-C Pitfall: Synthesized Properties without backing field</title>
		<link>http://jorudolph.wordpress.com/2011/06/29/objective-c-pitfall-synthesized-properties-without-backing-field/</link>
		<comments>http://jorudolph.wordpress.com/2011/06/29/objective-c-pitfall-synthesized-properties-without-backing-field/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 21:32:25 +0000</pubDate>
		<dc:creator>jorudolph</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://jorudolph.wordpress.com/?p=416</guid>
		<description><![CDATA[This is just a quick and short post about an Objective-C pitfall I have encountered today. When using synthesized properties, you do normally supply a backing field: @property (nonatomic, readwrite, retain) Message* message = message_; This will synthesize a getter and setter, that will use message_ as its backing field. Since I found out one [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=416&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is just a quick and short post about an Objective-C pitfall I have encountered today. When using synthesized properties, you do normally supply a backing field:</p>
<pre>@property (nonatomic, readwrite, retain) Message* message = message_;</pre>
<p>This will synthesize a getter and setter, that will use message_ as its backing field. Since I found out one can go clever and ommit the backing field, so a simple line like this will work too:</p>
<pre>@property (nonatomic, readwrite, retain) Message* message;</pre>
<p>However, now we get into a bit of trouble when accessing the property. Contrary to the behavior in Java or C#, you now get something different when accessing 
<pre>self.message</pre>
<p> vs.
<pre>message</pre>
<p>. While the former will use the synthesized getter, the latter will use the synthesized backing field directly. This is a bit unexpected (I thought the backing field would be anonymous). So, my general advice would be to always use backing fields in your synthesized backing fields, so you don&#8217;t accidentally forget a &#8220;self.&#8221;. (This is water on the mills of people that advocate _not_ using the dot syntax for properties).</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jorudolph.wordpress.com/416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jorudolph.wordpress.com/416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jorudolph.wordpress.com/416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jorudolph.wordpress.com/416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jorudolph.wordpress.com/416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jorudolph.wordpress.com/416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jorudolph.wordpress.com/416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jorudolph.wordpress.com/416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jorudolph.wordpress.com/416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jorudolph.wordpress.com/416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jorudolph.wordpress.com/416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jorudolph.wordpress.com/416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jorudolph.wordpress.com/416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jorudolph.wordpress.com/416/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=416&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jorudolph.wordpress.com/2011/06/29/objective-c-pitfall-synthesized-properties-without-backing-field/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d2acfb42ed883e5e6ec8969262f5c61?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jorudolph</media:title>
		</media:content>
	</item>
		<item>
		<title>TeamCity Server on Ubuntu</title>
		<link>http://jorudolph.wordpress.com/2011/06/18/teamcity-server-on-ubuntu/</link>
		<comments>http://jorudolph.wordpress.com/2011/06/18/teamcity-server-on-ubuntu/#comments</comments>
		<pubDate>Sat, 18 Jun 2011 07:36:23 +0000</pubDate>
		<dc:creator>jorudolph</dc:creator>
				<category><![CDATA[Continous Integration]]></category>
		<category><![CDATA[iOS Continous Integration Series]]></category>

		<guid isPermaLink="false">http://jorudolph.wordpress.com/?p=404</guid>
		<description><![CDATA[Last time, we set up a virtual machine template for an ubuntu server. Now that we have set up a clone of this machine, it is time to set up Teamcity on it. Abstract Teamcity on linux is meant to be run from its integrated Tomcat server. We will use the default Teamcity installation procedure [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=404&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Last time, we set up a virtual machine template for an ubuntu server. Now that we have set up a clone of this machine, it is time to set up Teamcity on it.</p>
<h2>Abstract</h2>
<p>Teamcity on linux is meant to be run from its integrated Tomcat server. We will use the default Teamcity installation procedure in combination with the lightweight lighttpd to act as a front end server listening on port 80 and forwarding requests to Teamcity&#8217;s Tomcat installation. This setup is both, easier than configuring Tomcat on Port 80 (remember it requires root permissions to allocate) and we could add authentication or https access more easily later (though I will not do that for now).</p>
<h2>Installing Teamcity</h2>
<p>To install Teamcity, follow the instructions from JetBrains, which can be found here (takes less than 10 minutes). I chose to install mine at /var/TeamCity:<br />
<a href="http://confluence.jetbrains.net/display/TCD65/Installing+and+Configuring+the+TeamCity+Server#InstallingandConfiguringtheTeamCityServer-installingWithTomcat">http://confluence.jetbrains.net/display/TCD65/Installing+and+Configuring+the+TeamCity+Server#InstallingandConfiguringtheTeamCityServer-installingWithTomcat </a></p>
<p>Follow the instructions to set up your external database (recommended approach). I am using a SQL Server 2008 Installation that is already present and regularly backed up in my &#8220;private cloud&#8221;.  Edit your server.conf to <a href="http://confluence.jetbrains.net/display/TCD65/Installing+and+Configuring+the+TeamCity+Server#InstallingandConfiguringtheTeamCityServer-changingServerPort">configure a port </a>for the Tomcat Server :</p>
<pre>ubuntu@localhost: sudo vi /var/TeamCity/conf/server.xml</pre>
<p>Permissions are a chore, but we don&#8217;t want the Teamcity Server directory to be owned by our admin user, so we change the owner of our Teamcity install directory to the default www-data user.</p>
<pre>ubuntu@localhost: sudo chown -R www-data /var/TeamCity</pre>
<p>Next, we want Teamcity to start automatically when the server is booted, so we add a small init script. Be sure to adjust the TEAMCITY_DATA_PATH environment variable to a static directory of your choice, otherwise TCs default will make end up in www-data&#8217;s home directory, which is, frankly, a very inconvenient location.</p>
<pre>ubuntu@localhost:/var/TeamCity$ cat /etc/init.d/teamcity
#!/bin/sh
# /etc/init.d/teamcity -  startup script for teamcity
export TEAMCITY_DATA_PATH="/var/TeamCity/.BuildServer"

case $1 in
start)
 start-stop-daemon --start  -c www-data --exec /var/TeamCity/bin/teamcity-server.sh start
;;

stop)
 start-stop-daemon --start -c www-data  --exec  /var/TeamCity/bin/teamcity-server.sh stop
;;

esac

exit 0</pre>
<p>Now we need to register the startup script to run automatically:</p>
<pre>ubuntu@localhost: sudo update-rc.d teamcity defaults</pre>
<p>Next, we start the server manually (you can reboot too):</p>
<pre>ubuntu@localhost: sudo /etc/init.d/teamcity start</pre>
<h2>Installing Lighttpd</h2>
<p>Now we need to install lighttpd:</p>
<pre>ubuntu@localhost: sudo apt-get install lighttpd</pre>
<p>And configure it to forward requests from port 80 to the port we configured for Tomcat (8080 in my case).</p>
<pre>
ubuntu@localhost: sudo vi /etc/lighttpd/lighttpd.conf
server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
#       "mod_rewrite",
        <strong>"mod_proxy"</strong>
)

$HTTP["host"] =~ "teamcity.yourdomain.com" {
        proxy.server = (
                "" =&gt; (
                        "tomcat" =&gt; (
                                "host" =&gt; "127.0.0.1",
                                "port" =&gt; 8080,
                                "fix-redirects" =&gt; 1
                        )
                )
        )
}</pre>
<h2>Final Words</h2>
<p>That&#8217;s it. By now you should have a running teamcity server. If something goes wrong, be sure to check the logs which can be found at /var/TeamCity/logs. To make the server available via DNS, you need to make sure the servers hostname is registered with your local DNS. In my case, I simply added a static record to it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jorudolph.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jorudolph.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jorudolph.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jorudolph.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jorudolph.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jorudolph.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jorudolph.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jorudolph.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jorudolph.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jorudolph.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jorudolph.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jorudolph.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jorudolph.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jorudolph.wordpress.com/404/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=404&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jorudolph.wordpress.com/2011/06/18/teamcity-server-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d2acfb42ed883e5e6ec8969262f5c61?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jorudolph</media:title>
		</media:content>
	</item>
		<item>
		<title>Ubuntu Server on HyperV</title>
		<link>http://jorudolph.wordpress.com/2011/06/17/ubuntu-server-on-hyperv/</link>
		<comments>http://jorudolph.wordpress.com/2011/06/17/ubuntu-server-on-hyperv/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 07:31:09 +0000</pubDate>
		<dc:creator>jorudolph</dc:creator>
				<category><![CDATA[Continous Integration]]></category>
		<category><![CDATA[iOS Continous Integration Series]]></category>

		<guid isPermaLink="false">https://jorudolph.wordpress.com/2011/06/17/ubuntu-server-on-hyperv/</guid>
		<description><![CDATA[As my Linux distro of choice for a set of lightweight virtualized Servers, Ubuntu Sever provides several advantages that made me go for it: * Driver support for HyperV * Active Community, number of HowTo&#8217;s available considered superior to Debian * Packages available are cutting edge * Well documented * Good experience with Ubuntu Desktop [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=408&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As my Linux distro of choice for a set of lightweight virtualized Servers, <a href="http://www.ubuntu.com/download/server/download">Ubuntu Sever</a> provides several advantages that made me go for it:</p>
<p>* Driver support for HyperV<br />
* Active Community, number of HowTo&#8217;s available considered superior to Debian<br />
* Packages available are cutting edge<br />
* Well documented<br />
* Good experience with Ubuntu Desktop</p>
<p>At the time of writing this, there are two choices of Ubuntu Server: Ubuntu 10 with LTS or cutting edge Ubuntu 11. LTS stands for LongTermSupport and Cannonical guarantees there will be updates for at least 3 years. It&#8217;s a matter of preference, but I chose Ubuntu 11.</p>
<p>To install it in HyperV, I recommend you follow this guide: http://social.technet.microsoft.com/wiki/contents/articles/how-to-install-ubuntu-server-10-04-in-hyper-v.aspx</p>
<p>Of course, you should adapt your network configuration to your requirements. Before templating this machine, I installed openssh because I consider it a core part of my server administration toolkit.</p>
<p>By this point, we should have a core installation of Ubuntu Server template that is ready to be cloned. Depending on your virtualization solution of choice, different steps apply here. (In HyperV it is as simple as exporting and re-importing the machine.) Make sure you create a unique copy of the machine, so that its network adapter gets assigned a new MAC Adress (everything else is calling for trouble).</p>
<p>After instantiating your template, we now need to customize that template:</p>
<pre>1. Change hostname
 sudo hostname "NewHostName"</pre>
<p>2. Configure Networking (it is likely your adapter will now show up as eth1 instead of eth0, rember that instantiating a VM tempate involves changing the MAC adress of the server)</p>
<pre>sudo vi /etc/network/interfaces</pre>
<p>3. Change user name/password</p>
<pre>sudo passwd</pre>
<p>4. Reboot</p>
<pre>sudo shutdown -r now</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jorudolph.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jorudolph.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jorudolph.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jorudolph.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jorudolph.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jorudolph.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jorudolph.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jorudolph.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jorudolph.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jorudolph.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jorudolph.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jorudolph.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jorudolph.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jorudolph.wordpress.com/408/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jorudolph.wordpress.com&amp;blog=9794496&amp;post=408&amp;subd=jorudolph&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jorudolph.wordpress.com/2011/06/17/ubuntu-server-on-hyperv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d2acfb42ed883e5e6ec8969262f5c61?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jorudolph</media:title>
		</media:content>
	</item>
	</channel>
</rss>
