<?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>The Daydream Blog &#187; Sample Code</title>
	<atom:link href="http://www.daytimesoftware.com/blog/category/sample-code/feed" rel="self" type="application/rss+xml" />
	<link>http://www.daytimesoftware.com/blog</link>
	<description>The official blog of DayTime Software</description>
	<lastBuildDate>Thu, 10 Dec 2009 13:49:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using Git With FogBugz for Local Repositories</title>
		<link>http://www.daytimesoftware.com/blog/2009/10/using-git-with-fogbugz-for-local-repositories</link>
		<comments>http://www.daytimesoftware.com/blog/2009/10/using-git-with-fogbugz-for-local-repositories#comments</comments>
		<pubDate>Thu, 22 Oct 2009 21:02:22 +0000</pubDate>
		<dc:creator>Sanjay Samani</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Mac Software]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[iPhone Software]]></category>
		<category><![CDATA[Developers]]></category>
		<category><![CDATA[FogBugz]]></category>
		<category><![CDATA[Git]]></category>

		<guid isPermaLink="false">http://www.daytimesoftware.com/blog/?p=118</guid>
		<description><![CDATA[Note that this article is intended for developers and may not be of interest to a wider audience
If you, like me, have migrated from using Subversion to Git, you may be missing the ability to link commits with FogBugz cases.  I have adapted the Subversion integration post commit hook to work with Git.
It should [...]]]></description>
			<content:encoded><![CDATA[<p><em>Note that this article is intended for developers and may not be of interest to a wider audience</em></p>
<p>If you, like me, have migrated from using Subversion to Git, you may be missing the ability to link commits with FogBugz cases.  I have adapted the Subversion integration post commit hook to work with Git.</p>
<p>It should be noted that integration with repositories hosted on GitHub can be found by <a href="http://github.com/johnreilly/github-fogbugz" title="GitHub FogBugz Integration Source Code">clicking on this link, to appropriately enough, GitHub</a> (via <a href="http://www.fogcreek.com/FogBugz/blog/post/Git-Integration.aspx" title="GitHub FogBugz Git Integration Blog Post">a blog post on FogBugz</a>).  These instructions are for use with local repositories.</p>
<p>I have simply taken the Subverson integration script, <a href="http://www.fogcreek.com/FogBugz/docs/70/topics/sourcecontrol/setup/Subversion.html">that is available at this link on the FogBugz website</a> and adapted it for use with Git.</p>
<p>To use, follow the instructions below:</p>
<ul>
<li>Install Perl in the unlikely situation that it is not already installed on your system</li>
<li>Install wget.  On Mac OS X, you can install via MacPorts by simply typing <code>sudo port install wget</code> in a Terminal window.</li>
<li>Download post-commit and logBugDataGit.pl by <a href="http://www.daytimesoftware.com/downloads/GitFogBugz.zip">clicking on this link to GitFogBugz.zip</a></li>
<li>Unzip the archive and copy the two scripts to your [Path To Project]/.git/hooks directory and make sure they are both executable</li>
<li>Edit logBugDataGit.pl as follows:
<ul>
<li>If you are using the free FogBugz version set <code>$BUGZ_URL_FINAL</code> to <code>https://yourdomain.fogbugz.com</code> and set <code>$IS_TRIAL</code> to 1.</li>
<li>If you host your own FogBugz installation, set <code>$BUGZ_SERVER</code> to your domain <strong>without</strong> http:// and set <code>$IS_TRIAL</code> to 0.</li>
</ul>
</li>
</ul>
<p>That&#8217;s it, there is not step 6!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daytimesoftware.com/blog/2009/10/using-git-with-fogbugz-for-local-repositories/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Differencia: Code Acknowledgements</title>
		<link>http://www.daytimesoftware.com/blog/2007/11/differencia-code-acknowledgements</link>
		<comments>http://www.daytimesoftware.com/blog/2007/11/differencia-code-acknowledgements#comments</comments>
		<pubDate>Sun, 18 Nov 2007 09:39:43 +0000</pubDate>
		<dc:creator>Sanjay Samani</dc:creator>
				<category><![CDATA[Acknowledgements]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Differencia]]></category>
		<category><![CDATA[Sample Code]]></category>

		<guid isPermaLink="false">http://www.daytimesoftware.com/blog/2007/11/differencia-code-acknowledgements</guid>
		<description><![CDATA[One great thing about being a Mac developer at the moment, is that there is a lot of free-to-use, free-to-distribute software that helps you do common things that Apple&#8217;s developer frameworks oddly do not provide.  So there is quite a lot of third party code in Differencia.  The developers are largely unaware of [...]]]></description>
			<content:encoded><![CDATA[<p>One great thing about being a Mac developer at the moment, is that there is a lot of free-to-use, free-to-distribute software that helps you do common things that Apple&#8217;s developer frameworks oddly do not provide.  So there is quite a lot of third party code in Differencia.  The developers are largely unaware of the use of their work in Differencia, or in many other products.  I would like to say a big Thankyou to all of those developers whose work has unwittingly gone into Differencia.  As well as nestling credits in the About Box, I would like to thank them again here:</p>
<p class="p1"><a href="http://homepage.mac.com/kenferry/software.html"><strong>Ken Ferry</strong></a></p>
<p class="p2">KFSplitView</p>
<p class="p1"><a href="http://mattgemmell.com/source"><strong>Matt Gemmell</strong></a></p>
<p class="p1">NSColor+ContrastingLabelExtensions</p>
<p class="p2">TunesWindow</p>
<p class="p1"><a href="http://eschatologist.net/bDistributed.com/index.html"><strong>Chris Hanson</strong></a></p>
<p class="p2">BDAlias</p>
<p class="p1"><a href="http://red-sweater.com"><strong>Daniel Jakult, Red Sweater Software</strong></a></p>
<p class="p2">NSTableView+RSAutosaving</p>
<p class="p1"><a href="http://andymatuschak.org/"><strong>Andy Matuschak</strong></a></p>
<p class="p1">AMRollOverButton</p>
<p class="p2">Help Toolkit</p>
<p class="p1"><strong>Andy Matuschak / Tom Harrington</strong></p>
<p class="p2"><a href="http://code.google.com/p/sparkleplus/">Sparkle+</a></p>
<p class="p1"><a href="http://www.seanpatrickobrien.com/2006/09/28/ilifecontrols-10/"><strong>Sean Patrick O&#8217;Brien</strong></a></p>
<p class="p2">iLifeControls</p>
<p class="p1"><a href="http://belkadan.com/generictoolbar/"><strong>Jordy Rose, Belkadan Software</strong></a></p>
<p class="p2">GenericToolbar</p>
<p class="p1"><a href="http://shiira.jp/hmblkappkit/en.html"><strong>Shiira Project</strong></a></p>
<p class="p2">HMBlkAppKit</p>
<p class="p1"><a href="http://blog.oofn.net/projects/misc/"><strong>Chad Weider</strong></a></p>
<p class="p2">CTGradient</p>
<p>Thanks to all of them and I hope that I can contribute back to the Mac developer community in the same way in the not so distant future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daytimesoftware.com/blog/2007/11/differencia-code-acknowledgements/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Suicidal Code Redux</title>
		<link>http://www.daytimesoftware.com/blog/2007/10/suicidal-code-redux</link>
		<comments>http://www.daytimesoftware.com/blog/2007/10/suicidal-code-redux#comments</comments>
		<pubDate>Wed, 24 Oct 2007 15:57:46 +0000</pubDate>
		<dc:creator>Sanjay Samani</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Sample Code]]></category>

		<guid isPermaLink="false">http://www.daytimesoftware.com/blog/2007/10/suicidal-code-redux</guid>
		<description><![CDATA[Back in July, Daniel Jakult posted some sample code for some suicidal code that prevents your application from running beyond a fixed period after it was compiled.  Ideal for a Beta copies of your software that you don&#8217;t want used beyond a certain period, without having to deal with licences.  For example the [...]]]></description>
			<content:encoded><![CDATA[<p>Back in July, Daniel Jakult <a href="http://www.red-sweater.com/blog/371/suicidal-code">posted some sample code for some suicidal code</a> that prevents your application from running beyond a fixed period after it was compiled.  Ideal for a Beta copies of your software that you don&#8217;t want used beyond a certain period, without having to deal with licences.  For example the Beta release of Differencia that was released last week.</p>
<p>In the comments for Daniel&#8217;s post it was pointed out that the sample code was not internationalised and might cause an issue when run outside of English speaking countries.  Of the suggested solutions in the comments, one, I suspect, exhibits the same issue and the other is very complex.  </p>
<p>I discussed a potential solution with Michal Bencur (benko23) in the #macsb IRC channel a couple of weeks ago and I&#8217;ve posted some sample code to resolve the locale issue below. </p>
<p>The gcc documentation states that __DATE__ is in the format &#8220;MMM dd yyyy&#8221;, but I have no idea whether gcc will localise this when compiling in non English locales, but if it does, just replace &#8220;en_US&#8221; with the locale you are using when compiling.</p>
<p>The code is also Tiger only, as it uses a 10_4 behaviour date formatter for proper locale handling.</p>
<p>
<pre style="font-size:1.1em;">
// Based on original code by Daniel Jakult, based on an idea from Brian Cooke.
#ifdef BETA  // 4 week expiration
#define EXPIREAFTERDAYS 28
#endif
</pre>
</p>
<p>
<pre style="font-size:1.1em;">#if EXPIREAFTERDAYS
NSString* compileDateString = [NSString stringWithUTF8String:__DATE__];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
[dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]
	autorelease]];
[dateFormatter setDateFormat:@"MMM dd yyyy"];
NSDate *compileDate = [dateFormatter dateFromString:compileDateString];
[dateFormatter release];
NSDate *expireDate = [compileDate addTimeInterval:(60*60*24* EXPIREAFTERDAYS)];
</pre>
</p>
<p>
<pre style="font-size:1.1em;">if ([expireDate earlierDate:[NSDate date]] == expireDate)
{
	// Run an alert or whatever
</pre>
</p>
<p>
<pre style="font-size:1.1em;">
	// Quit!
	[NSApp terminate:self];
}
#endif
</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://www.daytimesoftware.com/blog/2007/10/suicidal-code-redux/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
