<?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>Hung Truong: The Blog! &#187; Code</title>
	<atom:link href="http://www.hung-truong.com/blog/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hung-truong.com/blog</link>
	<description>I say potato, you say potato...</description>
	<lastBuildDate>Sun, 22 Jan 2012 18:10:30 +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>Photo Hack Day NYC 2011 And My Hack: AllPaper</title>
		<link>http://www.hung-truong.com/blog/2011/08/22/photo-hack-day-nyc-2011-and-my-hack-allpaper/</link>
		<comments>http://www.hung-truong.com/blog/2011/08/22/photo-hack-day-nyc-2011-and-my-hack-allpaper/#comments</comments>
		<pubDate>Mon, 22 Aug 2011 19:29:49 +0000</pubDate>
		<dc:creator>Hung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Hackathon]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[New York]]></category>

		<guid isPermaLink="false">http://www.hung-truong.com/blog/?p=2492</guid>
		<description><![CDATA[This past weekend I participated in my first NYC hackathon. The New York Hackathon is a mythical beast. They&#8217;ve been written about quite extensively, but you really need to just show up to one to know what it&#8217;s all about. This particular hackathon (Photo Hack Day) was organized by Aviary, with sponsorships by Bing, Pepsi, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.hung-truong.com/blog/wp-content/uploads/2011/08/Hackathon-Crowd.jpg" rel="lightbox[2492]"><img src="http://www.hung-truong.com/blog/wp-content/uploads/2011/08/Hackathon-Crowd-500x500.jpg" alt="" title="Hackathon Crowd" width="500" height="500" class="aligncenter size-medium wp-image-2496" /></a></p>
<p>This past weekend I participated in my first NYC hackathon. The New York Hackathon is a mythical beast. They&#8217;ve been written about quite extensively, but you really need to just show up to one to know what it&#8217;s all about.</p>
<p>This particular hackathon (<a href="http://photohackday.org/">Photo Hack Day</a>) was organized by Aviary, with sponsorships by Bing, Pepsi, PBR and others. There was plenty of food so that hackers didn&#8217;t have an excuse to leave, ever. I still ended up going home to get some sleep on Saturday night before the demo on Sunday.</p>
<p>I really think I picked a good first hackathon to attend, as the prizes were pretty insane. First place got $5000 and the cash prizes for second and third place were quite good as well. On top of those, there were prizes for best use of certain APIs. Face.com&#8217;s API stood out as a popular one; 500px had quite a few users as well.</p>
<p>I ended up working on a project I had wanted to build for a while: a custom collage creator for your iPhone wallpaper. I called it &#8220;AllPaper.&#8221; It seemed pretty catchy and I don&#8217;t think there&#8217;s a product with that name yet. I integrated Instagram into it first, then threw support for 500px, PicPlz and Facebook before calling it a hack. I also integrated the <a href="http://dev.sincerely.com/">Sincerely Ship Library</a> which lets you turn your collage into a real postcard. I&#8217;m really looking forward to trying that out!</p>
<p><a href="http://www.hung-truong.com/blog/wp-content/uploads/2011/08/AllPaper.png" rel="lightbox[2492]"><img src="http://www.hung-truong.com/blog/wp-content/uploads/2011/08/AllPaper.png" alt="" title="AllPaper" width="320" height="480" class="aligncenter size-full wp-image-2494" /></a></p>
<p>Overall I&#8217;m pretty happy with how the hack turned out. I can probably turn it into a real app fairly easily with some tweaking here and there. As this was my first hackathon, I noticed a few interesting things about the top hacks. There was some grumbling about how many of them seemed &#8220;hardcoded.&#8221; I wonder if presentation really counts more than actual hack-worthiness these days. You could spend your time actually coding something, or you could create the facade of something that looks even better, but is not really that worthy of being called a &#8220;hack.&#8221; It seems that the presentation wins over the true hack-worthiness, as one of the cooler ones, a jailbroken iPhone that took MMS messages and uploaded them to a web service, won nothing.</p>
<p>Coming away empty-handed was a little damaging to the ego, especially after winning something in my <a href="http://www.hung-truong.com/blog/2009/03/21/yahoos-hacku-event-at-the-university-of-michigan/">last hackathon</a>, but my ego&#8217;s not too bruised. I hate to sound like I&#8217;m complaining! Almost all of the presentations were well done, and the winners certainly did deserve to win. I&#8217;m hoping to participate in something similar again soon, as the atmosphere was really enjoyable.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hung-truong.com/blog/2011/08/22/photo-hack-day-nyc-2011-and-my-hack-allpaper/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Delayed Gratification in Engineering and Entrepreneurship</title>
		<link>http://www.hung-truong.com/blog/2011/04/29/delayed-gratification-in-engineering-and-entrepreneurship/</link>
		<comments>http://www.hung-truong.com/blog/2011/04/29/delayed-gratification-in-engineering-and-entrepreneurship/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 19:12:25 +0000</pubDate>
		<dc:creator>Hung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://www.hung-truong.com/blog/?p=2425</guid>
		<description><![CDATA[<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>407</b><br />
<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>415</b><br />
I read a blog post about Engineers and Delayed Gratification a while ago from ex-Googler and ex-Microsoftie Ninane Wang that made me think. She says that new engineers (like straight from school) have a hard time adjusting to the real world because they expect to be rewarded immediately for their work. In the real world, [...]]]></description>
			<content:encoded><![CDATA[<p>I read a blog post about <a href="http://niniane.blogspot.com/2010/08/delayed-rewards.html">Engineers and Delayed Gratification</a> a while ago from ex-Googler and ex-Microsoftie Ninane Wang that made me think. She says that new engineers (like straight from school) have a hard time adjusting to the real world because they expect to be rewarded immediately for their work. In the real world, you don&#8217;t see rewards for your work for months, or even years! Her solution is to have managers provide instant feedback to their reports so they get at least some acknowledgment of their work.</p>
<p>Since quitting Microsoft and setting out on my own (and even before that), I&#8217;ve had to trust that the stuff I am working on is meaningful and worthwhile. This is hard sometimes, especially if the thing I&#8217;m working on seems like a gamble. Having done the whole independent hacking thing for a while, I think I&#8217;ve built up the rolling reward cycle that Niniane mentions. Some days I&#8217;ll feel like I&#8217;m underachieving or working on something that no one will find useful. Then I&#8217;ll get a donation from someone for <a href="http://www.instascriber.com/">Instascriber</a> (this actually happened!!!) or see another <a href="http://itunes.apple.com/us/app/id403917180?mt=8">5 star review</a> for my Threadless app and get re-encouraged.</p>
<p>At the end of the day, I think what really separates the employees from the entrepreneurs is the willingness to be unsure about something and still do it. The uncertainty is much greater when you&#8217;re working on an unproven idea, business model, or whatever, but then so are the potential rewards, too. And <a href="http://www.hung-truong.com/blog/2009/03/04/managing-rejection-and-success/">even if you end up failing, you learn something and are better for it</a>.</p>
<p>In some ways, delaying gratification even sort of makes sense. If you immediately were rewarded for doing something innovative, you might lose the passion (like Rocky did) and stop innovating so you can enjoy your riches. While I can&#8217;t say that delaying gratification indefinitely would be a good idea, accepting that there will be a delay is probably healthy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hung-truong.com/blog/2011/04/29/delayed-gratification-in-engineering-and-entrepreneurship/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mapskrieg iPhone/iPad App Launch!</title>
		<link>http://www.hung-truong.com/blog/2011/04/08/mapskrieg-iphoneipad-app-launch/</link>
		<comments>http://www.hung-truong.com/blog/2011/04/08/mapskrieg-iphoneipad-app-launch/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 14:29:31 +0000</pubDate>
		<dc:creator>Hung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[MapsKrieg]]></category>
		<category><![CDATA[Mashup]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.hung-truong.com/blog/?p=2403</guid>
		<description><![CDATA[<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>407</b><br />
<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>415</b><br />
It&#8217;s been about 4 years since I announced the launch of Mapskrieg, my Google Maps and craigslist mashup web app. Since then, I&#8217;ve gone to school (again), worked for Microsoft and quit, and made a few apps. Today, I&#8217;m happy to announce the launch of my newest app, Mapskrieg for iOS! I&#8217;ve been working on [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.hung-truong.com/blog/wp-content/uploads/2011/04/iPadandiPhoneMapskrieg.png" rel="lightbox[2403]"><img src="http://www.hung-truong.com/blog/wp-content/uploads/2011/04/iPadandiPhoneMapskrieg-500x340.png" alt="" title="iPadandiPhoneMapskrieg" width="500" height="340" class="aligncenter size-medium wp-image-2420" /></a></p>
<p>It&#8217;s been about 4 years since <a href="http://www.hung-truong.com/blog/2007/05/06/mapskrieg-craigslist-google-maps-mashup-launch/">I announced the launch of Mapskrieg</a>, my Google Maps and craigslist mashup web app. Since then, I&#8217;ve gone to school (again), worked for Microsoft and quit, and made a few apps. Today, I&#8217;m happy to announce the launch of my newest app, <a href="http://itunes.apple.com/us/app/mapskrieg-apartment-search/id429360989?mt=8&#038;ls=1">Mapskrieg for iOS</a>!</p>
<p>I&#8217;ve been working on this app for a few weeks, and I think it&#8217;s ready for public consumption. It&#8217;s basically <a href="http://www.mapskrieg.com/">Mapskrieg</a>, but developed natively for the iPhone and iPad. In the past, I&#8217;ve taken a sort of iterative approach of releasing fairly minimal apps and improving on them. For example, I released Threadless as an iPhone only app and later added the iPad support. I wanted to release Mapskrieg on both platforms so the launch would have a little more bang. Plus I think the iPad app is the better of the two, and I really wanted that one to stand out for the release. I&#8217;ve been getting much more comfortable with mobile development, and I&#8217;m very happy with the rate at which I was able to conceive and release this app.</p>
<p>That&#8217;s not to say I didn&#8217;t struggle or learn anything new with it. While a lot of the concepts are borrowed from my Threadless iPad app, I had to do a lot of stuff I hadn&#8217;t done before. For example, since Mapskrieg is going to rely on iAds to make money, I decided that both the iPad and iPhone versions would support iAd. Apple, in their infinite wisdom, made the split view controller a very useful and now, standard, design paradigm. Unfortunately, they don&#8217;t provide any support for using it with iAd at all. What the fucking fuck, Apple!? So I had to basically recreate the Split View (well, the landscape mode at least) in order to support iAds. It&#8217;ll be well worth it if I can rake in some iAd dough, though!</p>
<p>This post also comes almost 1 year after I quit my job at Microsoft. That milestone probably deserves its own post, but I&#8217;ll just say that I have not yet regretted my decision in the very least so far. This is as fun as it gets, folks!</p>
<p>Edit: Oh, I forgot to link to a demo video that I recorded for a contest. Check it out in case you don&#8217;t have an iOS device:</p>
<p><iframe title="YouTube video player" width="500" height="311" src="http://www.youtube.com/embed/Ja9UcUkDPio?rel=0&amp;hd=1" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hung-truong.com/blog/2011/04/08/mapskrieg-iphoneipad-app-launch/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>♥s Threadless for iPad Release!</title>
		<link>http://www.hung-truong.com/blog/2011/03/23/%e2%99%a5s-threadless-for-ipad-release/</link>
		<comments>http://www.hung-truong.com/blog/2011/03/23/%e2%99%a5s-threadless-for-ipad-release/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 20:22:41 +0000</pubDate>
		<dc:creator>Hung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[T-Shirts]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Threadless]]></category>

		<guid isPermaLink="false">http://www.hung-truong.com/blog/?p=2396</guid>
		<description><![CDATA[<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>407</b><br />
<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>415</b><br />
About a week ago I thought about working some more on ♥s Threadless, my fan made iPhone app. I originally designed it for the small iOS devices like the iPhone and iPod touch, and figured I would do the proper iPad version later. I got the itch, so I got to work figuring out what [...]]]></description>
			<content:encoded><![CDATA[<p>About a week ago I thought about working some more on ♥s Threadless, my fan made iPhone app. I originally designed it for the small iOS devices like the iPhone and iPod touch, and figured I would do the proper iPad version later. I got the itch, so I got to work figuring out what an app on the bigger screen would look like. </p>
<p><a href="http://www.hung-truong.com/blog/wp-content/uploads/2011/03/iPad1.png" rel="lightbox[2396]"><img src="http://www.hung-truong.com/blog/wp-content/uploads/2011/03/iPad1-500x375.png" alt="" title="iPad1" width="500" height="375" class="aligncenter size-medium wp-image-2397" /></a></p>
<p>I knew that I wanted a grid-y layout as opposed to the list-y one of the iPhone/iPod, which was partly the reason why I hadn&#8217;t done the iPad version yet. Lists on iOS are easy because they&#8217;re given to you for free. Grids are a whole other beast. Luckily, I ran into a framework (<a href="https://github.com/AlanQuatermain/AQGridView">AQGridView</a>) on GitHub that does grid layouts in a tableview-y sort of paradigm. The framework was still a little beta (or alpha) as I had to go in and change a few things that were crashing, but it did succeed in making my job a lot easier overall. I&#8217;d like to try contributing to that code to improve it, but I guess that&#8217;s another post altogether.</p>
<p><a href="http://www.hung-truong.com/blog/wp-content/uploads/2011/03/iPad3.png" rel="lightbox[2396]"><img src="http://www.hung-truong.com/blog/wp-content/uploads/2011/03/iPad3-450x600.png" alt="" title="iPad3" width="450" height="600" class="aligncenter size-medium wp-image-2398" /></a></p>
<p>After getting the grid stuff working, I decided to use a modal pop up view to display the images and sharing options all in one view. Since the iPad has much more screen real estate, it&#8217;s easy to design things without running into space issues. You don&#8217;t, however, want to just stick a billion buttons in because you can. I think this design does a good job of showing enough stuff to the user, but not too much stuff too soon.</p>
<p>I still have some bugs to fix, mainly with memory management due to the grid view stuff. If you have any suggestions, feel free to comment on this blog! </p>
<p>Hopefully the iPad app continues the mission of the iPhone app, which is to provide a really easy and fun way to browse and share awesome Threadless designs! I may have been an early iPad doubter, but I really believe that it&#8217;s a great device for consuming content. Even on my iPad 1, the designs and colors just pop on the app. At least I think so. But you don&#8217;t have to take my word for it!</p>
<p><a href="http://itunes.apple.com/us/app/id403917180?mt=8">Get the app if you don&#8217;t have it already</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hung-truong.com/blog/2011/03/23/%e2%99%a5s-threadless-for-ipad-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Note to Myself about UISplitViewController and Auto-Rotation</title>
		<link>http://www.hung-truong.com/blog/2011/03/14/note-to-myself-about-uisplitviewcontroller-and-auto-rotation/</link>
		<comments>http://www.hung-truong.com/blog/2011/03/14/note-to-myself-about-uisplitviewcontroller-and-auto-rotation/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 01:59:28 +0000</pubDate>
		<dc:creator>Hung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[UISplitViewController]]></category>

		<guid isPermaLink="false">http://www.hung-truong.com/blog/?p=2389</guid>
		<description><![CDATA[<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>407</b><br />
<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>415</b><br />
In order to prevent my future self from wasting like, 2 hours fucking around with UISplitViewController getting it to auto-rotate its subviews, here&#8217;s a little post! Most of the time, UISplitViewController doesn&#8217;t want to rotate because you didn&#8217;t set it as the root subview of the Window. This is pretty well documented on StackOverflow, etc. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.hung-truong.com/blog/wp-content/uploads/2011/03/fuuuuu.jpg" rel="lightbox[2389]"><img src="http://www.hung-truong.com/blog/wp-content/uploads/2011/03/fuuuuu-e1300154340809.jpg" alt="" title="fuuuuu" width="268" height="343" class="aligncenter size-full wp-image-2391" /></a></p>
<p>In order to prevent my future self from wasting like, 2 hours fucking around with UISplitViewController getting it to auto-rotate its subviews, here&#8217;s a little post!</p>
<p>Most of the time, UISplitViewController doesn&#8217;t want to rotate because you didn&#8217;t set it as the root subview of the Window. This is pretty well documented on StackOverflow, etc. I thought this was why my splitviewblahblahblah wasn&#8217;t rotating. It turns out that, according to Apple&#8217;s documentation,</p>
<blockquote><p>A split view controller relies on its two view controllers to determine whether interface orientation changes should be made. If one or both of the view controllers do not support the new orientation, no change is made. This is true even in portrait mode, where the first view controller is not displayed. Therefore, you must override the shouldAutorotateToInterfaceOrientation: method for both view controllers and return YES for all supported orientations.</p></blockquote>
<p>The key here is that the view controller wasn&#8217;t autorotating because the subviews did not answer &#8220;YES!!!&#8221; (exclamation points added by me) to shouldAutoRotateToInterfaceOrientation. I was fucking around with the Split View Controller in Interface Builder (and later programmatically) to no avail. Adding the stupid autorotate thing to yes in the subviews made it work (shouldn&#8217;t it default to YES!?!??!).</p>
<p>Okay, lesson learned. Just don&#8217;t forget this next time, Hung!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hung-truong.com/blog/2011/03/14/note-to-myself-about-uisplitviewcontroller-and-auto-rotation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Porting Mapskrieg to App Engine</title>
		<link>http://www.hung-truong.com/blog/2011/02/23/porting-mapskrieg-to-app-engine/</link>
		<comments>http://www.hung-truong.com/blog/2011/02/23/porting-mapskrieg-to-app-engine/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 17:22:08 +0000</pubDate>
		<dc:creator>Hung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[app engine]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.hung-truong.com/blog/?p=2380</guid>
		<description><![CDATA[<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>407</b><br />
<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>415</b><br />
Lately I&#8217;ve been playing around a lot with Google App Engine. I think it&#8217;s finally at a point where it makes sense to develop for it, and it can be fun and profitable to do so. For example, I wrote Instascriber on App Engine, and so far it has cost me a few pennies in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.hung-truong.com/blog/wp-content/uploads/2011/02/appengine_lowres.gif" rel="lightbox[2380]"><img src="http://www.hung-truong.com/blog/wp-content/uploads/2011/02/appengine_lowres.gif" alt="" title="appengine_lowres" width="142" height="109" class="aligncenter size-full wp-image-2381" /></a></p>
<p>Lately I&#8217;ve been playing around a lot with Google App Engine. I think it&#8217;s finally at a point where it makes sense to develop for it, and it can be fun and profitable to do so. For example, I wrote Instascriber on App Engine, and so far it has cost me a few pennies in CPU cycles (and like $2 for a domain name or something).</p>
<p>Playing around with memcaching and stuff with Instascriber has led me to become a little obsessed with efficiency (not that I wasn&#8217;t already). I took a look at <a href="http://www.mapskrieg.com/">Mapskrieg</a> and found that it was performing pretty slowly. My Google Webmaster Tools thing was saying it took on average 6-8 seconds to load! I wanted to decrease that number, and I figured I could make it work on App Engine, so I started working on it last week.</p>
<p>I modified the parser I use to grab craigslist listings to also send them to Mapskrieg. Then I basically rewrote all of the logic that existed in PHP and ported it over to App Engine. This took a little while but it wasn&#8217;t too difficult since Mapskrieg is a pretty simple web app. I hardly changed any code in the Maps API implementation, though I&#8217;m thinking of moving to v3 (which is apparently supposed to be faster).</p>
<p>I just switched out the hosting from my MediaTemple PHP based host to the Google App Engine based one. So far the results look good. I think Mapskrieg is faster in terms of response time and the caching is definitely smarter than it was before (a memcache that only gets cleared when the content in it changes versus a time based cache expiration).</p>
<p>I&#8217;m going to watch closely to make sure nothing got borked in the transition, but so far so good. If I can keep Mapskrieg on App Engine, I might downgrade the MediaTemple server to save some money and maybe eventually move other services to App Engine as well.</p>
<p>One funny thing I noticed was the pricing plan for App Engine. I&#8217;m currently pruning listings from the database when they get too old or move past the limit of listings per listing type (because I&#8217;ll never show them). This is actually older behavior from when I had listing info in MySQL. Back then, the size of the database would affect the performance of selecting rows. Google&#8217;s datastore apparently does not get slower with respect to size. This is actually pretty awesome. </p>
<p>The weird thing is that adding and removing datastore objects costs quite a lot in CPU time. Additional CPU time past 6.5 hours is $.10 an hour. Storage, on the other hand, is .$01 per 2 gigabytes per day. From my usage, I am predicting that the CPU cycles that I would use to trim the datastore listings would actually cost more than just leaving them in the datastore and paying for storage. Is that insane or what? I still have to test some things out, but it kind of surprises me that storage would be that much cheaper than the CPU cycles to remove something.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hung-truong.com/blog/2011/02/23/porting-mapskrieg-to-app-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Greplin Programming Challenge</title>
		<link>http://www.hung-truong.com/blog/2011/02/16/greplin-programming-challenge/</link>
		<comments>http://www.hung-truong.com/blog/2011/02/16/greplin-programming-challenge/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 22:31:11 +0000</pubDate>
		<dc:creator>Hung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Greplin]]></category>

		<guid isPermaLink="false">http://www.hung-truong.com/blog/?p=2375</guid>
		<description><![CDATA[<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>407</b><br />
<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>415</b><br />
I had some spare time on Monday and just read about Greplin getting some funding (and I guess they just went out of private beta today), so I did the Greplin Programming Challenge. Unlike many programming challenges, the problems in this one were pretty easy to solve. I think a lot of people on Hacker [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.hung-truong.com/blog/wp-content/uploads/2011/02/greplin.png" rel="lightbox[2375]"><img src="http://www.hung-truong.com/blog/wp-content/uploads/2011/02/greplin.png" alt="" title="greplin" width="442" height="136" class="aligncenter size-full wp-image-2377" /></a></p>
<p>I had some spare time on Monday and just read about Greplin getting some funding (and I guess they just went out of private beta today), so I did the <a href="http://challenge.greplin.com/">Greplin Programming Challenge</a>.</p>
<p>Unlike many programming challenges, the problems in this one were pretty easy to solve. I think a lot of people on Hacker News complained that you could basically brute force them into submission. For example, one question is finding a prime Fibonacci number. I&#8217;m sure there&#8217;s super smart ways to do it but I just iterated through Fibs and then ran a really slow primeness function on each one. It worked eventually!</p>
<p>I finished the challenge and sent an email to the Greplin guys, since the challenge instructed me to do so. After reading through some of their site, the challenge actually started to make more sense to me.  From their <a href="https://www.greplin.com/jobs">jobs page</a>:</p>
<blockquote><p>You should know the fastest way to do something &#8211; which sometimes means the least CPU cycles and sometimes means the least programmer cycles.</p></blockquote>
<p>Basically, you could figure out the most efficient way to do the challenges (from a computational perspective) at a cost to programming time. Or you could recognize that N was trivially large for all of the challenge cases and just code something really simple up and get the answer. I picked the latter. Greplin is probably looking for both types, so I think they did a good job designing the challenge.</p>
<p>In other news, I signed up for their service and tried it out. It seems like a really cool concept and I like it so far. I kind of wish there was a roll your own version though. I dunno if I can trust Greplin with all of my innermost secrets&#8230; It&#8217;s bad enough that Google has all of your email; Greplin can have that plus your tweets and Facebook stuff too!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hung-truong.com/blog/2011/02/16/greplin-programming-challenge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iAd Vs. AdMob &#8211; Clicks, Fill Rate, Impressions, eCPM and Revenue</title>
		<link>http://www.hung-truong.com/blog/2011/02/07/iad-vs-admob-clicks-fill-rate-impressions-ecpm-and-revenue/</link>
		<comments>http://www.hung-truong.com/blog/2011/02/07/iad-vs-admob-clicks-fill-rate-impressions-ecpm-and-revenue/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 20:19:52 +0000</pubDate>
		<dc:creator>Hung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[AdMob]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[iAd]]></category>

		<guid isPermaLink="false">http://www.hung-truong.com/blog/?p=2350</guid>
		<description><![CDATA[<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>407</b><br />
<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>415</b><br />
About two weeks ago I updated one of my apps to use AdMob mobile ads when iAd fails to deliver (pretty damn often). Instead of swapping out iAd for AdMob, I use the iAd &#8220;didFailToReceiveAdWithError&#8221; delegate method to request an AdMob ad when iAd fails. This means that AdMob shouldn&#8217;t take any income away from [...]]]></description>
			<content:encoded><![CDATA[<p>About two weeks ago I updated one of my apps to use AdMob mobile ads when iAd fails to deliver (pretty damn often). Instead of swapping out iAd for AdMob, I use the iAd &#8220;didFailToReceiveAdWithError&#8221; delegate method to request an AdMob ad when iAd fails. This means that AdMob shouldn&#8217;t take any income away from iAd, but only supplement it. I thought I&#8217;d take a look at the stats and compare the performance of the two ad networks on my app.</p>
<p>(The following numbers I&#8217;m referring to are from the time period from 1/25 to 2/7)</p>
<p>For an idea of scale, my app, <a href="http://itunes.apple.com/us/app/anime-nano/id385697452?mt=8">Anime Nano</a>, gets about 600 iAd requests per day. My app analytics software (Flurry) is saying I&#8217;m getting about 600 sessions per day. The thing is that about 1/5 of those sessions are on the iPad (and I haven&#8217;t enabled iAd on the iPad yet), so I think that on average, the iPhone apps are making a little more than one iAd request per session.</p>
<p><a href="http://www.hung-truong.com/blog/wp-content/uploads/2011/02/iadstats.png" rel="lightbox[2350]"><img src="http://www.hung-truong.com/blog/wp-content/uploads/2011/02/iadstats-500x47.png" alt="" title="iAd Stats" width="500" height="47" class="aligncenter size-medium wp-image-2352" /></a></p>
<p>Despite the fairly healthy rate of requests that I&#8217;m getting, iAds are only getting sent about 15% of the time. This percentage is what&#8217;s known as the &#8220;fill rate.&#8221; This is also what most developers complain about being too low. The clickthrough rate is actually pretty good at 0.81%. </p>
<p><a href="http://www.hung-truong.com/blog/wp-content/uploads/2011/02/admobstats.png" rel="lightbox[2350]"><img src="http://www.hung-truong.com/blog/wp-content/uploads/2011/02/admobstats-500x42.png" alt="" title="AdMob Stats" width="500" height="42" class="aligncenter size-medium wp-image-2354" /></a></p>
<p>When iAd fails to deliver (85% of the time), I fall back to AdMob. The fill rate for AdMob is a high 88%, though the past few days it&#8217;s been closer to 99%. The CTR, however, is a fairly low 0.25%, which is less than half of iAd. This is partly due to the fact that AdMob ads refresh more often, so the number of impressions is higher.</p>
<p>I&#8217;m going to describe my revenue in terms of percentages here since ad platforms typically don&#8217;t like it when publishers publish their income. Not sure if that&#8217;s changed lately, but whatever! In the time period from 1/25/2011 to 2/7/2011, I made 2.3x more with iAd than AdMob, even with the super low fill rate (and impressions) of iAd. This is pretty interesting since iAd only shows up 15% of the time. There were actually a few days where AdMob beat iAd, but there were a couple of days where iAd made a killing (relatively), probably from those super awesome interactive ads which I still haven&#8217;t experienced firsthand yet. </p>
<p>For now, I&#8217;m content with the fill rate of AdMob, though it sort of pains me to see such a low click rate and revenue per click. Something tells me that if AdMob worked harder at increasing ad quality (like iAd), they&#8217;d be able to charge more and their advertisers would probably see a better return on investment. Most of the advertisers don&#8217;t even bother to use an image ad, which I assume would increase the clickthrough rate.</p>
<p>I noticed something really strange when looking at ads on my app. There&#8217;s no way for advertisers to disable ads on devices that already have the app installed. I keep seeing Amazon Kindle ads on both my iPad and my iPhone that already have the application installed. As a developer, I know there&#8217;s a way to prevent those ads from showing by detecting whether the app is installed at runtime. I think this strange behavior happens on both iAd and AdMob. If anyone from either organization is reading this, <a href="http://www.hung-truong.com/blog/about/">contact me</a>!</p>
<p>As far as the future of ads in mobile apps goes, I hope Apple will continue working on increasing the fill rate, and that AdMob tries to increase relevancy and ad quality. Right now it&#8217;s really frustrating to see my &#8220;inventory&#8221; not live up to its revenue potential.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hung-truong.com/blog/2011/02/07/iad-vs-admob-clicks-fill-rate-impressions-ecpm-and-revenue/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Instapaper Friendly &#8211; WordPress Plugin</title>
		<link>http://www.hung-truong.com/blog/2011/02/03/instapaper-friendly-wordpress-plugin/</link>
		<comments>http://www.hung-truong.com/blog/2011/02/03/instapaper-friendly-wordpress-plugin/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 00:11:12 +0000</pubDate>
		<dc:creator>Hung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Instapaper]]></category>

		<guid isPermaLink="false">http://www.hung-truong.com/blog/2011/02/03/instapaper-friendly-wordpress-plugin/</guid>
		<description><![CDATA[<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>407</b><br />
<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>415</b><br />
While I was testing Instascriber , I noticed that the way that Instapaper was grabbing the content of my blog was a little off. The Instapaper for Publishers page describes how you can give Instapaper a hint on what your actual content is. I looked for a WordPress plugin that does this but didn&#8217;t see [...]]]></description>
			<content:encoded><![CDATA[<p>While I was testing <a href="http://www.instascriber.com">Instascriber </a>, I noticed that the way that Instapaper was grabbing the content of my blog was a little off. The <a href="http://www.instapaper.com/publishers">Instapaper for Publishers</a> page describes how you can give Instapaper a hint on what your actual content is. I looked for a WordPress plugin that does this but didn&#8217;t see anything, so I figured I&#8217;d do it myself. </p>
<p>Up to this point I had never made a WordPress plugin, so I had go figure that out first. It&#8217;s relatively simple and there&#8217;s a lot of good documentation out there. I just needed to hook into the &#8220;the_content&#8221; API hook and alter the content so it had a div surrounding it. The scary part is mostly that WordPress seems to give you a hella lot of control. So you could seriously eff things up with a simple plugin. </p>
<p>With this being my first plugin, I&#8217;m not completely sure it&#8217;s been written the right way (kinda like when you make an edit on Wikipedia for the first time). Nevertheless, I&#8217;m making the plugin available. So let me know if there&#8217;s something glaringly wrong with it. It&#8217;s fairly simple, so I&#8217;m not sure exactly what could go wrong. </p>
<p>I made a special page for the plugin to live at, so get it at <a href="http://www.hung-truong.com/blog/instapaper-friendly-wordpress-plugin/">Instascriber Friendly &#8211; WordPress Plugin</a>. You can also download it through the internal WordPress plugin search (look for &#8216;instapaper friendly&#8217;).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hung-truong.com/blog/2011/02/03/instapaper-friendly-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Impressions of Android From an iPhone User/Developer</title>
		<link>http://www.hung-truong.com/blog/2011/01/06/impressions-of-android-from-an-iphone-userdeveloper/</link>
		<comments>http://www.hung-truong.com/blog/2011/01/06/impressions-of-android-from-an-iphone-userdeveloper/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 19:55:14 +0000</pubDate>
		<dc:creator>Hung</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.hung-truong.com/blog/?p=2220</guid>
		<description><![CDATA[<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>407</b><br />
<br />
<b>Warning</b>:  Division by zero in <b>/home/hungtruong/hung-truong.com/blog/wp-content/plugins/tla_49490.php</b> on line <b>415</b><br />
I just got an Android phone, the HTC Hero, to play around with and perhaps develop on. It was only $55 on Ebay (including shipping) which seemed like a steal to me. I&#8217;m currently using it on WiFi without any phone service (the phone has a bad ESN, so that&#8217;s probably why the price was [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.hung-truong.com/blog/wp-content/uploads/2011/01/android-s1-box.jpg" alt="" title="android-s1-box" width="500" height="375" class="aligncenter size-full wp-image-2221" /></p>
<p>I just got an Android phone, the HTC Hero, to play around with and perhaps develop on. It was only $55 on Ebay (including shipping) which seemed like a steal to me. I&#8217;m currently using it on WiFi without any phone service (the phone has a bad ESN, so that&#8217;s probably why the price was so low).</p>
<p>My first impression as an iPhone user is that the interface is really clunky. There just isn&#8217;t as much attention payed to detail. For example, there are often measurable delays between pressing a button and seeing something happen. This happens when I try to add a widget to the home screen or open an app that hasn&#8217;t been opened into memory. If I press a button and I don&#8217;t see something <a href="http://www.useit.com/papers/responsetime.html">happen immediately</a>, I will assume I missed the button and press it again. This is extremely frustrating since the iPhone animates immediately upon user interaction. The iPhone may not be any faster than my Android phone, but it at least gives the illusion of it (which is probably just as good in terms of usability).</p>
<p>Another thing I noticed is the lack of &#8220;back&#8221; buttons in the Android apps. Even Twitter lacks the onscreen back button. I assume this is following some kind of standard Android paradigm of favoring physical buttons over onscreen ones. It took me a while to get used to hitting the physical back button (and home, menu and search for that matter) instead of looking for navigation on the screen. While this is a different paradigm, I&#8217;m not sure I&#8217;m in a position to say it&#8217;s worse, better or on par with the iPhone. My suspicion is that the lack of onscreen navigation requires the user to go through more context switches (screen to physical button back to screen) which is disorienting. This is made worse by the fact that there&#8217;s seven fuckin&#8217; buttons on my particular phone! I&#8217;m sure people adapt and get used to it, but I&#8217;m personally used to having just one button that takes me to the home screen (oh, and the volume and lock buttons, but they don&#8217;t serve dynamic functions in applications (unless they want to break the App Store terms)).</p>
<p>About the only positive thing I can say about the Android platform is that Google is integrating the shit out of it with their own services. I only have to sign in once with my Google account and I get Voice, Talk, Maps, Search, Goggles, Places, Latitude, Market, Contacts, Gmail, YouTube and probably some other things I&#8217;m forgetting. The voice commands are incredibly cool, though I wonder how many times I&#8217;d actually use them instead of doing things the normal way. Oh, another positive is that Angry Birds is free on Android, though my device is way too slow to run it.</p>
<p>I&#8217;m currently using a ROM with 2.2 on my HTC Hero, so that might account for some performance issues (though I thought it was supposed to be faster). I&#8217;m still kind of unimpressed by Android as a whole though, especially in terms of end to end usability. I originally got this device so I could test code on hardware, but I&#8217;m not so sure I even want to develop for Android anymore. I&#8217;ll probably end up writing some simple code, at least.</p>
<p>Does anyone with a newer Android phone want to debunk or argue with anything I&#8217;ve written?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hung-truong.com/blog/2011/01/06/impressions-of-android-from-an-iphone-userdeveloper/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

