Go to http://www.mattmakai.com/ for the current blog.Makai's BlogTumblr (3.0; @makaimc)https://mmakai.com/My New Blog<p>I’m blogging over at <a href="http://www.mattmakai.com/">http://www.mattmakai.com/</a> now. Tumblr’s been great over the past two years but I wanted more flexibility to revamp my web presence. My latest posts since January 1, 2012 are all over on my new site.</p>
<p>Link: <a href="http://www.mattmakai.com/" target="_self">Matt Makai’s Blog</a></p>https://mmakai.com/post/15589949112https://mmakai.com/post/15589949112Mon, 09 Jan 2012 18:59:01 -0500blogDjango 1.4 Alpha Release 1<p>At last, a version of Django that isn’t a maintenance release is out, albeit in alpha form (not for production use):</p>
<p><a href="https://www.djangoproject.com/weblog/2011/dec/22/14-alpha-1/">https://www.djangoproject.com/weblog/2011/dec/22/14-alpha-1/</a></p>https://mmakai.com/post/14677441553https://mmakai.com/post/14677441553Fri, 23 Dec 2011 13:00:25 -0500DjangoPythonBuilding and Testing with Gradle<p>I’m currently researching build tools. I need a build and configure tool for a iOS/Android/BlackBerry mobile app with a single set of core components but many configurations for different app deployments. I could hack something together with Python or Bash shell scripts, but there’s a reason why build tools exist. Options:</p>
<ol><li>Ant/Ivy - doable, but loads of XML to write</li>
<li>Maven - my project structure does not lend itself to Maven’s rigid conventions</li>
<li>Gradle - I’ve never used it before, so let’s take a look</li>
</ol><p><a href="http://shop.oreilly.com/product/0636920019909.do" target="_self">Building and Testing with Gradle</a> by Tim Berglund and Matthew McCullough is an O'Reilly book was the logical pick. I saw Matt speak on Hadoop & Git at No Fluff Just Stuff last year and really enjoyed his clear, concise explanations. This book is also clear, concise, and only took a few hours to read and work through the examples.</p>
<p>My notes for the book are on <a href="https://github.com/makaimc/programming-notes/blob/master/gradle/build-and-testing-with-gradle.txt" target="_self">my programming notes Github repository</a>. The notes won’t make as much sense without reading the book, so I suggest picking up the <a href="http://shop.oreilly.com/product/0636920019909.do" target="_self">eBook copy over at O'Reilly</a>.</p>
<p>Over the next couple of days I’ll be working through producing a Gradle build for the mobile app I’m working on for Excella. I’ll post my full impressions of Gradle after I’ve had more time with the tool.</p>https://mmakai.com/post/14262960430https://mmakai.com/post/14262960430Thu, 15 Dec 2011 10:07:49 -0500GradleStructuring a Combined Android & BlackBerry PhoneGap Project<p>Android and BlackBerry expect two different folder locations for resources. Android has its <em>assets/www</em> folder while BlackBerry expects just a <em>www</em> folder under the project root directory. Since the BlackBerry .cod file is opaque after compilation, it makes it difficult to understand how resources are structured in the file.</p>
<p>I found that putting the BlackBerry config.xml file under <em>assets/www</em> and referencing my HTML file within the <em>assets/www</em> folder worked fine as long as there is a <em>www</em> folder in the root of the project which contains <em>plugins.xml</em>, the <em>ext</em> folder with the <em>phonegap.1.2.0.jar</em> file, and a <em>resources</em> directory with my icons and splash screen image.</p>
<p>Make sure to modify the BlackBerry <em>build.xml</em> file to reference the <em>config.xml</em> file in the <em>assets/www</em> folder and to include <strong>both</strong> the <em>assets/www</em> folder as well as the <em>www</em> under the project’s root directory.</p>
<p>With this folder set up, I was able to successfully deploy to both Android and BlackBerry without duplicating any files within the project structure.</p>
<p>Once I integrate iOS into the project structure I’ll post the code on Github.</p>https://mmakai.com/post/13923595054https://mmakai.com/post/13923595054Thu, 08 Dec 2011 11:04:00 -0500PhoneGapBlackBerryAndroidJQuery Mobile 1.0, PhoneGap 1.2, and BlackBerry Simulator 9930<p>I spent a couple of hours yesterday evening trying to figure out why I only got a blank white screen after the app splash screen on the BlackBerry 9930 with a JQM 1.0 and PhoneGap 1.2 app that worked fine on the 9550 simulator.</p>
<p>Apparently this problem has been duplicated and the “recommended” fix is to use JQM Alpha 4 (not an option for me in this case). See this <a href="https://groups.google.com/forum/#!topic/phonegap/1jK5w5xOQNM" target="_self">post on Google Groups</a>.</p>
<p>I’ve opened an <a href="https://github.com/jquery/jquery-mobile/issues/3232" target="_self">outstanding Github issue ticket</a> for the problem and hopefully can extract the code for analysis.</p>https://mmakai.com/post/13877201806https://mmakai.com/post/13877201806Wed, 07 Dec 2011 12:01:24 -0500JQuery MobilePhoneGapBlackBerry 9930Dear BlackBerry<p>Dear BlackBerry,</p>
<p>I’m going out of my way to develop a cross-platform app that will work on your devices. Don’t inconvenience me by making me download some “Akamai Net Session” software which I have no idea what it does before I can even download your simulator or SDK files.</p>
<p>Thanks,</p>
<p>Matt</p>https://mmakai.com/post/13876084983https://mmakai.com/post/13876084983Wed, 07 Dec 2011 11:23:33 -0500BlackBerryUpgrading from PhoneGap 1.1 to PhoneGap 1.2 for Android Applications<p>I upgraded from PhoneGap (Apache Callback) 1.1 to version 1.2 today. Unfortunately, I encountered the following cryptic stacktrace:</p>
<blockquote>
<p>ERROR/AndroidRuntime(9469): FATAL EXCEPTION: Thread-9</p>
<p>java.lang.RuntimeException: Can’t create handler inside thread that has not called Looper.prepare()</p>
<p>at android.os.Handler.<init>(Handler.java:121)</p>
<p>at android.webkit.WebView$PrivateHandler.<init>(WebView.java:7341)</p>
<p>at android.webkit.WebView.<init>(WebView.java:416)</p>
<p>at android.webkit.WebView.<init>(WebView.java:967)</p>
<p>at android.webkit.WebView.<init>(WebView.java:957)</p>
<p>at android.webkit.WebView.<init>(WebView.java:948)</p>
<p>at com.phonegap.DroidGap.init(DroidGap.java:268)</p>
<p>at com.phonegap.DroidGap.loadUrlIntoView(DroidGap.java:381)</p>
<p>at com.phonegap.DroidGap.access$300(DroidGap.java:159)</p>
<p>at com.phonegap.DroidGap$3.run(DroidGap.java:537)</p>
<p>at java.lang.Thread.run(Thread.java:1102)</p>
</blockquote>
<p>The same stacktrace is found under <a href="https://github.com/callback/callback-android/issues/23" target="_self">issue #23 for PhoneGap</a>.</p>
<p>Unfortunately PhoneGap 1.2 isn’t patched yet to accomodate the issue. So there’s 2 options if you hit this snag:</p>
<ol><li>Disable the splash screen on Android</li>
<li>Download the <a href="https://github.com/brycecurtis/phonegap-nightly/tree/master/Android-1.2.0-20111115-231626" target="_self">latest nightly PhoneGap build on Github</a> until PhoneGap 1.3 is released</li>
</ol><p>Hopefully this issue will be resolved soon with a new PhoneGap release (maybe a 1.2.1 release)?</p>https://mmakai.com/post/13832583171https://mmakai.com/post/13832583171Tue, 06 Dec 2011 13:16:26 -0500PhoneGapAndroidYou've Got 5-10 Years<p>Recent college grads and young professionals, listen up: you’ve got 5-10 years. The labor market has been changing for a couple of decades and will continue in its trajectory. Today’s reality is that large companies are willing to pay you a decent wage for your first 5-10 years worth of work. After that, the gig is up.</p>
<p>Depending on your industry, after your first 5-10 years, you need to prove you’re worth real money. You can do that in one of two ways, depending on your personal strengths and weaknesses (be honest with yourself about them). The two choices are:</p>
<ol><li>Start your own firm</li>
<li>Join an existing small firm where you can make a dramatic direct impact on the growth of the organization</li>
</ol><p>There will be no other <em>reliable </em>options. There will always be other options, but they won’t be reliable. They are mirages held out by large companies to trick you into continuing to work for them until they lay you off. For example, you could try to get into mid-management and “climb the ladder.” Chances are high you will be laid off in that position long before you ever reach the executive ranks. There’s simply not enough “executive” positions to go around.</p>
<p>So knowing you have 5-10 years, you need to prepare <strong>today</strong> for that inevitable future. Whether you work for a non-profit, a law firm, a tech firm, or even in government, you need to figure out how you can successfully start your own firm or join an existing firm and be directly responsible for its growth. That’s the reality for our generation. If we embrace it, we can make it work for us.</p>https://mmakai.com/post/13605811250https://mmakai.com/post/13605811250Thu, 01 Dec 2011 17:39:00 -0500entrepreneurshipThe Python Ecosystem - Great Read<p>I came across <a href="http://mirnazim.org/writings/python-ecosystem-introduction/" target="_self">this blog post on the Python Ecosystem</a> while reading Hacker News yesterday. What a fantastic post. Highly recommended reading for aspiring Python developers.</p>
<p>Link: <a href="http://mirnazim.org/writings/python-ecosystem-introduction/" target="_self">Python Ecosystem</a></p>https://mmakai.com/post/13505503848https://mmakai.com/post/13505503848Tue, 29 Nov 2011 13:00:26 -0500PythonA Brief History of Django Revisions<p>To understand Django, it helps to know its origins and how the framework has evolved. Django’s developers have added many features since the framework’s 1.0 release back in September 2008. Some of the major additions include aggregation support in the ORM, multi-database support, CSRF protection, a messaging framework, and many improvements to the models framework. This post outlines the major framework changes Django has gone through from 1.0 through the current stable 1.3 release. The intention for 1.x releases is that only minor code changes are necessary to transition Django projects from one version to another.</p>
<p><strong>Django 1.0</strong></p>
<p>(1.0 SVN Revision 8961, 1.0.4 SVN Revision 11613) [1]</p>
<p>Django 1.0 was released September 3, 2008 after a three year public incubation period and a total of five years of development [2]. Release 1.0 included features that are still core to the framework today, including the Model-Template-View (MTV) architecture, Object-Relational Mapper (ORM) models, explicit URL resolution with regular expression support, and a lightweight template system.</p>
<p><strong>Django 1.1 </strong></p>
<p>(1.1 SVN Revision 11366, 1.1.4 SVN Revision 15477)</p>
<p>Django 1.1 was released Jul 29, 2009, just shy of 11 months after the official 1.0 release [3]. Version 1.1 included the following new features:</p>
<ol><li>Aggregate query support in the built-in object relational mapper</li>
<li>Improvements to models</li>
<li>Better support for unit testing through client object’s support functions</li>
<li>URL namespaces</li>
</ol><p><strong>Django 1.2</strong></p>
<p>(1.2 SVN Revision 13285, 1.2.5 SVN Revision 15476)</p>
<p>Django 1.2 was released May 17, 2010, approximately 10 months after the 1.1 release [4]. Major features added to Django in this release:</p>
<ol><li>Mandatory Cross Site Request Forgery protection for POSTs</li>
<li>Support for more than one database in a single Django project</li>
<li>Model validation based on the existing Forms validation mechanism</li>
<li>User messages support through sessions and cookies</li>
<li>Configurable email backends</li>
</ol><p><strong>Django 1.3 </strong></p>
<p>(1.3 SVN Revision 15906, 1.3.1 SVN Revision 16771)</p>
<p>Django 1.3 was released on March 23, 2011 [5]. New features in Django 1.3 included:</p>
<ol><li>Class-based views</li>
<li>Support for Python’s standard logging mechanisms</li>
<li>A new contrib app for serving static files</li>
</ol><p><strong>Django 1.4 and Beyond</strong></p>
<p>There is currently no release date set for Django 1.4 although work continues in the public development branch. Django 1.4 will drop support for Python 2.4. The motivation behind the change is to use more context managers, a creation from Python 2.5, and make the internal Django code better. <a href="http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCQQFjAA&url=http%3A%2F%2Fmmakai.com%2Fpost%2F8732320824%2Fdjango-1-4-and-beyond&ei=7TTFTtWkHcbK2AWSiv3WDg&usg=AFQjCNHfPiJgBbs8fgndDziOW64t06Q6Rw" target="_self">I wrote a post on Django 1.4</a> and how one of the Django core committers, Alex Gaynor, sees Django 1.4.</p>
<p>[1] <a href="https://code.djangoproject.com/browser/django/tags/releases?rev=15906" target="_self">Django SVN Revision 8961</a></p>
<p>[2] <a href="https://www.djangoproject.com/weblog/2008/sep/03/1/" target="_self">Django 1.0 Release Announcement</a></p>
<p>[3] <a href="https://www.djangoproject.com/weblog/2009/jul/29/1-point-1/" target="_self">Django 1.1 Release Announcement</a></p>
<p>[4] <a href="https://www.djangoproject.com/weblog/2010/may/17/12/" target="_self">Django 1.2 Release Announcement</a></p>
<p>[5] <a href="https://www.djangoproject.com/weblog/2011/mar/23/13/" target="_self">Django 1.3 Release Announcement</a></p>https://mmakai.com/post/12985434524https://mmakai.com/post/12985434524Fri, 18 Nov 2011 18:27:06 -0500PythonDjangoHello JQuery Mobile 1.0!<p>JQuery Mobile 1.0 has been released! A big part of the release is the maturity of the project and speed up in page rendering time (a big previous complaint especially when creating mobile native apps wrapped with PhoneGap).</p>
<p><strong>A note of caution</strong>: JQuery Mobile 1.0 is only compatible with JQuery 1.6.4. JQuery 1.7 will be supported by JQuery Mobile 1.1.</p>
<p>Link: <a href="http://jquerymobile.com/blog/2011/11/16/announcing-jquery-mobile-1-0/" target="_self">JQuery Mobile 1.0 Release Announcement</a></p>https://mmakai.com/post/12928625303https://mmakai.com/post/12928625303Thu, 17 Nov 2011 11:55:55 -0500JQuery Mobile5 Great Django Deployment Links<p>I’m currently working on moving from my traditional Apache/mod_wsgi set up on Ubuntu to the new Django-serving community favorite, <a href="http://gunicorn.org/" target="_self">Gunicorn</a>/<a href="http://nginx.org/" target="_self">Nginx</a>.</p>
<p>I found the following links very beneficial for getting an initial set up going locally then moving over my production servers to the new configuration:</p>
<ol><li><a href="http://davidpoblador.com/run-django-apps-using-gunicorn-and-nginx/" target="_self">Run Django apps using Gunicorn and nginx</a> (Easy set up)</li>
<li><a href="http://ericholscher.com/blog/2010/aug/16/lessons-learned-dash-easy-django-deployment/" target="_self">Lessons Learned From The Dash: Easy Django Deployment</a> (Another easy set up post)</li>
<li><a href="http://rdegges.com/deploying-django" target="_self">Deploying Django</a> (more detailed post on Django deployments and the stages heavily trafficked sites go through)</li>
<li><a href="http://news.ycombinator.com/item?id=2910953" target="_self">Preferred Django Stacks</a> (Hacker News comments on what tools to use for a preferred stack)</li>
<li><a href="http://tech.yipit.com/2011/11/09/how-yipit-deploys-django/" target="_self">How Yipit Deploys Django</a> (this was really helpful for figuring out how Chef fits into Django deployment and it gave me another excuse to spend some time learning Ruby even though most of my work is done in Django)</li>
</ol>https://mmakai.com/post/12846963174https://mmakai.com/post/12846963174Tue, 15 Nov 2011 15:39:54 -0500PythonDjangodeploymentGunicornnginxPython Weekly - A Great Python/Django Resource<p><a target="_self" href="http://www.pythonweekly.com/">Python Weekly</a> has provided me a lot of value over the past couple of weeks. I originally found out about the newsletter on Hacker News. I thought, “I’ll try one newsletter then unsubscribe if it’s not worth my time.”</p>
<p>Boy have I been pleasantly surprised. There are loads of great articles on Django deployments, best practices for settings.py configurations, interesting pip packages, and tips on Python programming best practices.</p>
<p>Thanks to the curator for putting together what has quickly become a must-read for Python developers.</p>
<p>You can check out an example newsletter and sign up at <a href="http://www.pythonweekly.com/">http://www.pythonweekly.com/</a>.</p>https://mmakai.com/post/12605937012https://mmakai.com/post/12605937012Thu, 10 Nov 2011 14:11:08 -0500PythonDjangoMy Advice to Computer Science Majors<p>My primary piece of advice to college students who are computer science majors is this: double major.</p>
<p>Computer science is great for understanding how computers work, programming, and learning the theory of computation. But where it really matters is how you apply those principles to real world problems that exist <em>outside</em> the computer science field.</p>
<p>If you double major, you’ll be exposed to a different discipline and begin to understand its problems. Hopefully down the road you can use your computer science knowledge to create solutions to those problems and produce real value in that field.</p>
<p>That’s my 2 cents for college computer science majors coming from someone who’s far enough outside of school to have some perspective on how you can produce value.</p>https://mmakai.com/post/12558689889https://mmakai.com/post/12558689889Wed, 09 Nov 2011 11:16:30 -0500computer scienceAccessing a Django Server on a VirtualBox Ubuntu Instance<p>I do the majority of my development work on virtualized Ubuntu instances to closely mimic my production deployment environment. Today I needed to access a Django server running on the VirtualBox instance from my host operating system (Windows 7).</p>
<p>I was simply using the built-in Django server (manage.py runserver) running on a high-level port instead of deploying to Apache or gunicorn. To do a pass through with this set up, use the following 3 steps:</p>
<ol><li>Change the VirtualBox network adapter (Devices -> Network Adapter -> Adapter 1) to “Bridged Adapter” instead of NAT.</li>
<li>Inside the virtualized OS, run ifconfig -a to see the new inet addr (mine happened to be http://10.38.1.119.</li>
<li>Use the python manage.py runserver 10.38.1.119:8000 command (with your new IP address and the port above 1024 you want to run on) to run the Django server and allow external access</li>
</ol><p>Now you should be able to access the Django server from your host OS through the browser at 10.38.1.119:8000 (again, replace with your specific IP and port number).</p>
<p>References:</p>
<p>[1] <a target="_self" href="http://superuser.com/questions/172158/how-to-connect-from-windows-7-to-localhost-on-ubuntu-virtualbox">How to connect from Windows 7 to localhost on Ubuntu VirtualBox</a></p>
<p>[2] <a target="_self" href="http://ubuntuforums.org/showthread.php?t=682519">VirtualBox accessing ubuntu localhost thread</a></p>https://mmakai.com/post/12522482446https://mmakai.com/post/12522482446Tue, 08 Nov 2011 15:18:00 -0500VirtualBoxDjangoUrban Airship Android C2DM Push Notifications in the Python API<p>I needed push notification support for the Android C2DM platform for a Django project, but Urban Airship’s Python libraries only supported iOS push notifications.</p>
<p>So I forked the code on Github, modified it to <a target="_self" href="https://github.com/makaimc/python-library">incorporate support for C2DM APIDs</a>. There’s an <a target="_self" href="https://github.com/urbanairship/python-library/pull/3">outstanding pull request</a> (just issued) so hopefully it gets integrated back into Urban Airship’s <a target="_self" href="https://github.com/urbanairship/python-library">official original master branch</a>.</p>
<p>Thanks to <a target="_self" href="http://www.excella.com/">Excella Consulting</a> for allowing me to contribute this code back to the community!</p>https://mmakai.com/post/12487004174https://mmakai.com/post/12487004174Mon, 07 Nov 2011 18:35:00 -0500Urban AirshipPythonpush notificationsGithubMongoDB's Path to Maturity<p>There’s been a spat of links on Hacker News lately about the failings of MongoDB and 10gen (see links at the end). I see this as a <em>very good thing</em>, not because I want NoSQL in general and MongoDB in particular to fail, but because it is a sign of maturation. Developers are doing really interesting work with MongoDB and they are hitting the limits of the technology. There’s criticism of 10gen’s working process and concern over implementation choices.</p>
<p>If these concerns are addressed, MongoDB will be a much better, more mature product in the long run. We can only hope that CouchDB, Riak, and other document-oriented data stores receive the same amount of attention and feedback to address their unique sets of issues.</p>
<p>[1] <a target="_self" href="http://blog.schmichael.com/2011/11/05/failing-with-mongodb/">Failing with MongoDB</a></p>
<p>[2] <a target="_self" href="http://pastebin.com/raw.php?i=FD3xe6Jt">Don’t Use MongoDB</a></p>
<p>[3] <a target="_self" href="http://www.blue74.com/2010/06/scatter/were-back-so-long-mongodb/">We’re Back! …so long MongoDB</a></p>https://mmakai.com/post/12416218886https://mmakai.com/post/12416218886Sun, 06 Nov 2011 08:42:05 -0500MongoDBNoSQL10genFlow Junkie?<p>I recently realized I’m constantly looking for a fix. Not from an external drug or chemical substance, but from <a target="_self" href="http://en.wikipedia.org/wiki/Flow_(psychology)">flow</a>. I get flow most commonly from programming, although I’ve felt it before while writing and working out.</p>
<p>It’s scary though because I am constantly hungry for flow. If I haven’t had it in awhile I go looking for it. I browse <a target="_self" href="http://news.ycombinator.com/">Hacker News</a> and <a target="_self" href="http://www.reddit.com/r/programming">Reddit Programming</a> looking for new languages and libraries to learn. Recently I picked up <a target="_self" href="http://stripe.com/">Stripe</a> and it provided a fix for awhile, just like Clojure, Hadoop, and other tools and languages before them.</p>
<p>But on some level I feel like an addict. Wikipedia describes addiction as </p>
<blockquote>
<p>… a continued involvement with a substance or activity despite the negative consequences associated with it.</p>
</blockquote>
<p>Does the lack of (obvious) negative consequences make what feels like an addiction okay? Is the fact that I am constantly learning to try to get into flow make it alright since it makes me better at my software development job? On the surface these seem like good things to do, but maybe there’s something out of balance when you’re constantly looking for the fix.</p>https://mmakai.com/post/12344103559https://mmakai.com/post/12344103559Fri, 04 Nov 2011 19:18:31 -0400flowWhat Happened to CouchDB?<a href="http://news.ycombinator.com/item?id=3180397">What Happened to CouchDB?</a>: <p>There’s a great discussion going on over at Hacker News about people’s opinions on what happened to CouchDB’s popularity as compared to MongoDB (and other NoSQL data stores).</p>
<p>My guess is that MongoDB took off lately as 10gen really gained traction with their outreach to developers while CouchDB is still fragmented despite the backing of Cloudant and Couchbase. I also found MongoDB easier to get started with than CouchDB. It is possible developers who recently learned about NoSQL considered MongoDB to be a better starting point to learn than CouchDB.</p>
<p>Also, here’s my <a target="_self" href="http://mmakai.com/post/6520113090/mongodb-an-introduction-part-1">introduction to MongoDB</a>. Here’s my <a target="_self" href="http://mmakai.com/post/12031788529/installing-couchdb-1-1-0-on-ubuntu-10-04-lts-lucid">installation guide to CouchDB on Ubuntu</a> (introduction to functionality coming soon).</p>
<p>Link: <a target="_self" href="http://news.ycombinator.com/item?id=3180397">What Happened to CouchDB’s Popularity?</a></p>https://mmakai.com/post/12207089943https://mmakai.com/post/12207089943Tue, 01 Nov 2011 16:20:44 -0400CouchDBMongoDBNoSQLGreat Post on MongoDB versus CouchDB<a href="http://openmymind.net/2011/10/27/A-MongoDB-Guy-Learns-CouchDB/">Great Post on MongoDB versus CouchDB</a>: <p>I found this blog post really insightful for understanding the differences between <a target="_self" href="http://www.mongodb.org/">MongoDB</a> and <a target="_self" href="http://couchdb.apache.org/">CouchDB</a>. The key takeaways for me were in understanding the difference between the way querying works (views in CouchDB versus find queries in MongoDB) and availability versus replication (continuous availability during network partitions in CouchDB versus one master plus replication in MongoDB). This post is worth reading in its entirety.</p>
<p>Link: <a target="_self" href="http://openmymind.net/2011/10/27/A-MongoDB-Guy-Learns-CouchDB/">A MongoDB Guy Learns CouchDB</a></p>https://mmakai.com/post/12071806095https://mmakai.com/post/12071806095Sat, 29 Oct 2011 10:00:06 -0400CouchDBMongoDB