<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>A Google App Engine and Unity 3D developer.(Probably available for short-term contracts.)contact  me
bitbucket
github
github gists
twitter
</description><title>The Dark Table</title><generator>Tumblr (3.0; @darktable)</generator><link>http://the.darktable.com/</link><item><title>Open Source Unity Plugin for Urban Airship</title><description>&lt;a href="https://bitbucket.org/darktable/unity3d-airship-plugin/overview"&gt;Open Source Unity Plugin for Urban Airship&lt;/a&gt;: &lt;p&gt;This is why I was trying to figure out how to modify Xcode projects with AppleScript.  The plugin needs some frameworks added, some resources added, a source file patched, etc.&lt;/p&gt;

&lt;p&gt;This now works well enough and patches clean enough that I thought people might want to use it.  It allows you to use &lt;a href="http://urbanairship.com/products/rich-push/" target="_blank"&gt;Urban Airship’s Rich Push&lt;/a&gt; and &lt;a href="http://urbanairship.com/products/in-app-purchase/" target="_blank"&gt;Urban Airship’s StoreFront&lt;/a&gt; in a Unity iOS project.&lt;/p&gt;

&lt;p&gt;Also, if you’re in a situation where you’re sick of adding stuff to the Unity Xcode project every time you build, you should take a look at the &lt;a href="https://bitbucket.org/darktable/unity3d-airship-plugin/src/962a7d521793/Assets/Editor/PostprocessBuildPlayer_Airship" target="_blank"&gt;PostProcessBuildPlayer_Airship&lt;/a&gt; script to see how I’m automating a bunch of project modifications.  I have a bunch of mods that need to be applied specified in a .projmods (JSON format) file that gets loaded, and applied.&lt;/p&gt;

&lt;p&gt;Could come in handy for some people.&lt;/p&gt;</description><link>http://the.darktable.com/post/17723162536</link><guid>http://the.darktable.com/post/17723162536</guid><pubDate>Thu, 16 Feb 2012 12:23:00 -0800</pubDate><category>Unity3D</category><category>gamedev</category><category>ios</category><category>urban airship</category><category>open source</category></item><item><title>Modifying an Xcode Project with AppleScript is BROKEN...Use Python Instead</title><description>&lt;p&gt;I hope this saves some future Google searcher some time.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;TL;DR&lt;/em&gt; I wrote a python module that can be used to modify an Xcode project.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&lt;a href="https://bitbucket.org/darktable/mod-pbxproj" target="_blank"&gt;https://bitbucket.org/darktable/mod-pbxproj&lt;/a&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I spent half a week trying to figure out how to modify an Xcode 4 project using AppleScript.  It seems that it worked in Xcode 3, but it’s been broken in Xcode 4 from the beginning.&lt;/p&gt;

&lt;p&gt;The wonderful part is that it’s not consistently broken.  Some stuff breaks loudly, some stuff fails silently, and some stuff works as documented.  This leads you into a spiral where you’re sure it’s just some little syntax error you’re making, and once you nail that it will all fall into place.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;NO. MODIFYING AN XCODE PROJECT WITH APPLESCRIPT IS BROKEN.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then you see a new beta of Xcode (4.3), and you think to yourself, “they must have gotten around to fixing this stuff now, it’s been like 2 years.”&lt;/p&gt;

&lt;p&gt;&lt;em&gt;NO. MODIFYING AN XCODE PROJECT WITH APPLESCRIPT IS BROKEN.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So, eventually I just sat there staring at the raw .pbxproj file that Xcode loads, and I noticed that once you remove all the comments the syntax is very similar to JSON.  I’ve monkeyed with JSON before, I’ve fixed JSON parsers before, so I decided to try parsing and manipulating the pbxproj file directly.&lt;/p&gt;

&lt;p&gt;It works.&lt;/p&gt;

&lt;p&gt;So if you have a situation where you need to programmatically modify an Xcode project, &lt;a href="https://bitbucket.org/darktable/mod-pbxproj" target="_blank"&gt;take a look at my script&lt;/a&gt;, it may save you a ton of time.&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/6022009/adding-files-via-applescript-to-an-xcode-project-target" target="_blank"&gt;http://stackoverflow.com/questions/6022009/adding-files-via-applescript-to-an-xcode-project-target&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/7574217/how-can-i-programmatically-add-build-files-to-xcode4/9123044" target="_blank"&gt;http://stackoverflow.com/questions/7574217/how-can-i-programmatically-add-build-files-to-xcode4/9123044&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/7557273/tutorial-or-guide-for-scripting-xcode-build-phases" target="_blank"&gt;http://stackoverflow.com/questions/7557273/tutorial-or-guide-for-scripting-xcode-build-phases&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://lists.apple.com/archives/xcode-users/2011/Sep/msg00333.html" target="_blank"&gt;http://lists.apple.com/archives/xcode-users/2011/Sep/msg00333.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;
I just learned that the file format the .pbxproj file uses is an OpenStep plist.  There’s a utility that comes with OS X called &lt;code&gt;plutil&lt;/code&gt; that can convert this file to JSON or XML.  This greatly simplifies the parsing of the file.&lt;/p&gt;</description><link>http://the.darktable.com/post/17700178147</link><guid>http://the.darktable.com/post/17700178147</guid><pubDate>Wed, 15 Feb 2012 21:34:00 -0800</pubDate><category>Xcode</category><category>AppleScript</category><category>gamedev</category><category>python</category><category>Unity3D</category><category>patching</category><category>aggravation</category></item><item><title>Synergy and MacOSX 10.7 (Lion)</title><description>&lt;a href="https://bitbucket.org/darktable/synergy/downloads"&gt;Synergy and MacOSX 10.7 (Lion)&lt;/a&gt;: &lt;p&gt;I recently changed my desk layout so my laptop is next to my mac mini’s monitor.  It’s awkward trying to cram two keyboards onto the desk, so I looked into some software I’d heard about that allows multiple machines to share one keyboard and mouse.&lt;/p&gt;

&lt;p&gt;It’s called &lt;a href="http://synergy-foss.org" target="_blank"&gt;Synergy&lt;/a&gt;, and I’d heard other game developers sing its praises.  The problem was that running the server or client on OSX Lion was barely working at all, bit rot and API changes had broken a lot of functionality.  The potential boon was large enough, and the bugs annoying enough, that I actually did the first C++ programming I’ve done in many years.&lt;/p&gt;

&lt;p&gt;The result is a greatly improved Mac client and server available at my &lt;a href="https://bitbucket.org/darktable/synergy/src" target="_blank"&gt;bitbucket repot&lt;/a&gt;.  There are &lt;a href="https://bitbucket.org/darktable/synergy/downloads" target="_blank"&gt;precompiled binaries&lt;/a&gt; too, but keep in mind, this code watches all your key presses, so you have reason to be paranoid and want to compile it yourself (I swear I’m not evil or a l33t hacker though).&lt;/p&gt;

&lt;p&gt;There are &lt;a href="http://synergy-foss.org/tracker/projects/synergy/wiki/Docs" target="_blank"&gt;extensive docs&lt;/a&gt; about how to setup and use the client and server on the Synergy site.  And hopefully they’ll integrate my patches at some point.&lt;/p&gt;

&lt;p&gt;p.s. They still use SVN and have to manually apply diff patches when they want to accept contributions from people!  If they’d migrate to Bitbucket or Github they could’ve integrated these patches in three clicks.&lt;/p&gt;</description><link>http://the.darktable.com/post/16533607628</link><guid>http://the.darktable.com/post/16533607628</guid><pubDate>Thu, 26 Jan 2012 12:04:00 -0800</pubDate></item><item><title>Unity Editor Lesser Known Features</title><description>&lt;a href="http://blog.almostlogical.com/2011/12/19/unity-editor-lesser-known-features/"&gt;Unity Editor Lesser Known Features&lt;/a&gt;: &lt;p&gt;Good tips from the guy who wrote the super handy PlayModePersist.&lt;/p&gt;</description><link>http://the.darktable.com/post/14490628977</link><guid>http://the.darktable.com/post/14490628977</guid><pubDate>Mon, 19 Dec 2011 19:03:00 -0800</pubDate><category>Unity3D</category></item><item><title>Chat in Unity 3D using PubNub</title><description>&lt;a href="http://unity3d-pubnub.appspot.com"&gt;Chat in Unity 3D using PubNub&lt;/a&gt;: &lt;p&gt;I’ve been working on a &lt;a href="https://bitbucket.org/darktable/unity3d-pubnub" target="_blank"&gt;port of the C# PubNub library&lt;/a&gt; that can be used from in Unity3d.  I put this together as a test for the library.&lt;/p&gt;</description><link>http://the.darktable.com/post/13606720661</link><guid>http://the.darktable.com/post/13606720661</guid><pubDate>Thu, 01 Dec 2011 14:58:00 -0800</pubDate><category>CSharp</category><category>PubNub</category><category>Unity3D</category><category>gamedev</category></item><item><title>Updated MiniJSON Script</title><description>&lt;a href="https://gist.github.com/1411710"&gt;Updated MiniJSON Script&lt;/a&gt;: &lt;p&gt;&lt;a href="https://gist.github.com/1411710" target="_blank"&gt;MiniJSON.cs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ages ago I found a script for encoding and decoding JSON and popped it up on the &lt;a href="http://forum.unity3d.com/threads/35484-MiniJSON-script-for-parsing-JSON-data" target="_blank"&gt;Unity forums&lt;/a&gt;.  Wasn’t great, but it did the job.  Yesterday I took a look at it and spotted a bunch of ways it could be cleaned up and optimized.&lt;/p&gt;

&lt;p&gt;Even though I still recommend using &lt;a href="https://bitbucket.org/darktable/jsonfx-for-unity3d/downloads" target="_blank"&gt;JsonFX&lt;/a&gt;, MiniJSON can still be useful for situations where you just want something really simple (Array, Dictionary, etc.) encoded and decoded and size is a consideration.&lt;/p&gt;

&lt;p&gt;Careful though, this script has changed a lot, so it isn’t a drop-in replacement for the old version.&lt;/p&gt;</description><link>http://the.darktable.com/post/13602789894</link><guid>http://the.darktable.com/post/13602789894</guid><pubDate>Thu, 01 Dec 2011 13:35:00 -0800</pubDate><category>CSharp</category><category>JSON</category><category>Unity3D</category><category>gamedev</category></item><item><title>Quick demo of JsonFx usage in Unity.</title><description>&lt;a href="https://bitbucket.org/darktable/jsonfx-for-unity3d/downloads/JsonFxDemo.unitypackage"&gt;Quick demo of JsonFx usage in Unity.&lt;/a&gt;: &lt;p&gt;A couple of people have asked how to use the JsonFx library that I put up on &lt;a href="https://bitbucket.org/darktable/jsonfx-for-unity3d/downloads" target="_blank"&gt;bitbucket&lt;/a&gt;.  The version I’m using is 1.4 from &lt;a href="http://jsonfx.net" target="_blank"&gt;JsonFx.net&lt;/a&gt;, and it is poorly documented.&lt;/p&gt;

&lt;p&gt;The two key methods are:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;JsonReader.Deserialize&lt;T&gt;(string json);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;JsonWriter.Serialize(object src);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;With Deserialize you need to specify the type (T) you want to unpack to.  This can be almost any C# class that has public variables or properties.  In the example unitypackage linked above, I created two quick classes for Twitter search results, and an individual tweet.&lt;/p&gt;

&lt;p&gt;What’s great about JsonFx is that it can deserialize nested classes, so the array of Tweets that is returned in search results gets deserialized too.  This is something that I had issues with in most other libraries I evaluated.&lt;/p&gt;

&lt;p&gt;The Serialize method just take the object you want to turn into a JSON string and does its thing.&lt;/p&gt;

&lt;p&gt;You then have a string you can post to a web server, using the WWWForm and WWW classes in Unity.&lt;/p&gt;

&lt;p&gt;If you don’t want to create your own classes for Serialization/Deserialization, you can just use &lt;code&gt;Dictionary&lt;string,object&gt;&lt;/code&gt;, or an Array, or whatever.&lt;/p&gt;

&lt;p&gt;There are some other things that are hidden inside JsonFx, like a JsonFx.IgnoreAttribute for public fields that you don’t want to be serialized, etc.  You’ll have to root around in the assembly or source code for the exact syntax for that stuff.  Remember, I didn’t write JsonFx, I just commented out a couple lines to make it work better in Unity.&lt;/p&gt;

&lt;p&gt;Here’s the C# script that’s in the above Unity package:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using DB = UnityEngine.Debug;
using DC = DebugConsole;
using JsonFx.Json;

public class Tweet {
    public System.DateTime created_at;
    public string from_user;
    public long from_user_id;
    public string from_user_id_str;
    public string from_user_name;
    public string geo;
    public long id;
    public string id_str;
    public string iso_language_code;
    public Dictionary&lt;string, string&gt; metadata;
    public string profile_image_url;
    public string source;
    public string text;
    public long to_user_id;
    public string to_user_id_str;
}

public class TwitterSearchResults {
    public float completed_in;
    public long max_id;
    public string max_id_str;
    public string next_page;
    public int page;
    public string query;
    public string refresh_url;
    public Tweet[] results;
    public int results_per_page;
    public long since_id;
    public string since_id_str;
}

public class JsonFxDemo : MonoBehaviour {

    public string query = "#Unity3d";

    // Use this for initialization
    void Start () {
        DC.IsOpen = true;

        StartCoroutine(PerformSearch(query));
    }

    void PrintResults(string rawJson) {
        // Raw output:
        DB.Log(DC.Log("******** raw string from Twitter ********"));
        DB.Log(DC.Log(rawJson));

        // Turn the JSON into C# objects
        var search = JsonReader.Deserialize&lt;TwitterSearchResults&gt;(rawJson);

        // iterate through the array of results;
        DB.Log(DC.Log("******** search results ********"));


        foreach (var tweet in search.results) {
            DB.Log(DC.Log(tweet.from_user_name + " : " + tweet.text));
        }

        DB.Log(DC.Log("******** serialize an entity ********"));

        // this turns a C# object into a JSON string.
        string json = JsonWriter.Serialize(search.results[0]);

        DB.Log(DC.Log(json));
    }

    IEnumerator PerformSearch(string query) {
        query = &lt;a href="http://WWW.EscapeURL" target="_blank"&gt;WWW.EscapeURL&lt;/a&gt;(query);

        using (var www = new WWW(string.Format("http://search.twitter.com/search.json?q={0}", query))) {
            while (!www.isDone) {
                yield return null;
            }

            PrintResults(&lt;a href="http://www.text" target="_blank"&gt;www.text&lt;/a&gt;);
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;</description><link>http://the.darktable.com/post/13105524184</link><guid>http://the.darktable.com/post/13105524184</guid><pubDate>Mon, 21 Nov 2011 00:23:00 -0800</pubDate><category>CSharp</category><category>Example</category><category>JSON</category><category>Unity3D</category><category>gamedev</category></item><item><title>MonoDevelop Code Templates for Unity 3D</title><description>&lt;a href="https://bitbucket.org/darktable/unity3d-monodevelop-templates/src"&gt;MonoDevelop Code Templates for Unity 3D&lt;/a&gt;: &lt;p&gt;&lt;a href="https://bitbucket.org/darktable/unity3d-monodevelop-templates/src" target="_blank"&gt;templates&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Big day, right?  I’m having a little staycation and finally had the time to commit some repositories and write some posts.  Tomorrow it’ll be back to playing games (gotta finish Arkham City).&lt;/p&gt;

&lt;p&gt;It always annoyed me that MonoDevelop didn’t offer code completion for OnGUI, OnEnable, OnCollision, etc. events.  Then I discovered that MonoDevelop had support for code snippets.&lt;/p&gt;

&lt;p&gt;On the Mac you put these templates into &lt;code&gt;~/.config/MonoDevelop-Unity/templates/code/&lt;/code&gt;.  Not sure where they live on PC.  Then when you start typing the beginning of a Unity event (&lt;code&gt;On...&lt;/code&gt;) it will show you a list of methods to insert.  Select one and hit tab to insert it, and then tab again to insert the snippet.&lt;/p&gt;

&lt;p&gt;This is only set up for C# Unity files.&lt;/p&gt;</description><link>http://the.darktable.com/post/12874587927</link><guid>http://the.darktable.com/post/12874587927</guid><pubDate>Tue, 15 Nov 2011 23:36:00 -0800</pubDate><category>CSharp</category><category>MonoDevelop</category><category>Unity3D</category><category>gamedev</category></item><item><title>Unity 3D Mercurial (hg) Automation Script</title><description>&lt;a href="https://bitbucket.org/darktable/unityhg/downloads"&gt;Unity 3D Mercurial (hg) Automation Script&lt;/a&gt;: &lt;p&gt;Unity Pro has a function that enables external version control. It’s great because you don’t have to pay $500 for a Unity Asset Server license, but it’s kind of a mess because it adds a ton of .meta files, and if you don’t commit the .meta file with the regular file you’ve broken version control.&lt;/p&gt;

&lt;p&gt;Unity Pro also has some powerful asset post processor functions that let you customize the importing pipeline.  Maybe these could work together (hint).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://bitbucket.org/darktable/unityhg/downloads" target="_blank"&gt;This script&lt;/a&gt; uses an &lt;a href="http://unity3d.com/support/documentation/ScriptReference/AssetPostprocessor.OnPostprocessAllAssets.html" target="_blank"&gt;asset post processor&lt;/a&gt; function to find added/deleted/moved files and correctly apply those changes to a local Mercurial (hg) repository (including the associated .meta files).&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mercurial.selenic.com/" target="_blank"&gt;Mercurial&lt;/a&gt; is a great distributed version control system that can have large binary support enabled.  &lt;a href="http://mercurialnet.codeplex.com/" target="_blank"&gt;Mercurial.net&lt;/a&gt; is an awesome .net library that lets you interact with Mercurial repositories in C#. I mixed that chocolate and peanut butter with a Unity script to automate some of the grunt work of keeping a Unity repository in sync.&lt;/p&gt;

&lt;p&gt;The script doesn’t do push/pull/commit/merge (yet), so you’ll still need to use the command line or GUI client to do that stuff.  I use &lt;a href="http://jasonfharris.com/machg/" target="_blank"&gt;MacHg&lt;/a&gt;, &lt;a href="http://www.sourcetreeapp.com/" target="_blank"&gt;SourceTree&lt;/a&gt;, and &lt;a href="http://tortoisehg.bitbucket.org/" target="_blank"&gt;TortoiseHg&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I don’t know if there’s a similar .net library for git, but if there is it should be relatively easy to do the same thing for a git repot. SVN and Perforce integration might be possible too, but since those are coming in Unity 3.5 anyway, it’s probably not worth the effort.&lt;/p&gt;

&lt;p&gt;I don’t know if I’ll have time to support this script, but hopefully it can be a useful starting place for other developers.&lt;/p&gt;</description><link>http://the.darktable.com/post/12873571451</link><guid>http://the.darktable.com/post/12873571451</guid><pubDate>Tue, 15 Nov 2011 22:48:00 -0800</pubDate><category>CSharp</category><category>Mercurial</category><category>Unity3D</category><category>hg</category><category>gamedev</category></item><item><title>Script for Auto-saving Assets in Unity 3D.</title><description>&lt;a href="https://gist.github.com/1368845"&gt;Script for Auto-saving Assets in Unity 3D.&lt;/a&gt;: &lt;p&gt;&lt;a href="https://gist.github.com/1368845" target="_blank"&gt;AutoSaveAssets.cs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ummm…I think this works.  It waits &lt;code&gt;interval&lt;/code&gt; seconds and then saves any modified assets.&lt;/p&gt;

&lt;p&gt;This may not seem like a big deal to you, but frequently prefabs and materials in a Unity 3D project aren’t saved until you either quit Unity or select “Save Project” from the File menu.  This script sorta fixes that.  This can be important if you’re using version control.&lt;/p&gt;</description><link>http://the.darktable.com/post/12871710230</link><guid>http://the.darktable.com/post/12871710230</guid><pubDate>Tue, 15 Nov 2011 21:37:00 -0800</pubDate><category>CSharp</category><category>Unity3D</category><category>gamedev</category></item><item><title>Here's my modified version of DebugConsole.cs (for Unity)</title><description>&lt;a href="https://gist.github.com/1412228"&gt;Here's my modified version of DebugConsole.cs (for Unity)&lt;/a&gt;: &lt;p&gt;&lt;a href="https://gist.github.com/1412228" target="_blank"&gt;DebugConsole.cs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DebugConsole.cs has been really useful to me.  Especially when I’ve been trying to debug iPhone or standalone builds of Unity projects.&lt;/p&gt;

&lt;p&gt;When I first added the DebugConsole to my project I didn’t understand a lot of the magic it contained.  I’m pretty sure it was my first introduction to C# delegates.  Since then I’ve leveled up a few times and add a ton of stuff to the DebugConsole script.&lt;/p&gt;

&lt;p&gt;I’m sharing my modifications to the DebugConsole, because learning how it worked was so helpful to me.&lt;/p&gt;

&lt;p&gt;Here are a couple of the changes that I’ve made, you’ll have to scour the source and learn some stuff to discover all of it.&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;Generic WatchVar&lt;t&gt;.  This should let people watch any object that has a ToString() method.&lt;/t&gt;&lt;/li&gt;
&lt;li&gt;Added an FPS counter.  This is based off one of the scripts in UnifyCommunity.com&lt;/li&gt;
&lt;li&gt;Removed GUILayout stuff.  This should let it work better on mobile devices (haven’t tried in a while though).&lt;/li&gt;
&lt;li&gt;Console Command delegate returns an object which will be printed to the console, so the functions can return info to the console.&lt;/li&gt;
&lt;li&gt;Hitting &lt;code&gt;&lt;enter&gt;&lt;/code&gt; now submits the command line if it has focus.&lt;/li&gt;
&lt;li&gt;Added a toggle key that shows/hides the console (default is “`”, same as the Quake console).&lt;/li&gt;
&lt;li&gt;Pressing up arrow goes back through command history (like a Unix prompt).&lt;/li&gt;
&lt;li&gt;Log functions return the object that they were sent.  This lets you double up logging ( Debug.Log(DebugConsole.Log(“blah”)); )  This is useful because in the editor you can continue to get log messages that can be double clicked on to take you into the source file.&lt;/li&gt;
&lt;/ul&gt;</description><link>http://the.darktable.com/post/12869685344</link><guid>http://the.darktable.com/post/12869685344</guid><pubDate>Tue, 15 Nov 2011 20:35:00 -0800</pubDate><category>CSharp</category><category>Debug</category><category>Unity3D</category><category>gamedev</category></item><item><title>You got tipfy in my h5bp! You got h5bp in my tipfy!</title><description>&lt;a href="https://bitbucket.org/darktable/dark-tipfy"&gt;You got tipfy in my h5bp! You got h5bp in my tipfy!&lt;/a&gt;: &lt;p&gt;I just forked &lt;a href="http://www.tipfy.org/" target="_blank"&gt;tipfy&lt;/a&gt; on bitbucket and committed a bunch of changes that I make every time I start a new project.  This includes a base &lt;a href="http://jinja.pocoo.org/docs/templates/" target="_blank"&gt;jinja&lt;/a&gt; template that is derived from &lt;a href="http://h5bp.com" target="_blank"&gt;h5bp.com&lt;/a&gt;’s settings, and a crapload of mimetypes added to app.yaml, taken from h5bp’s server-config repository.&lt;/p&gt;

&lt;p&gt;The hello_world.html has been updated to inherit from h5bp.html, to give an example of how to use template inheritance.&lt;/p&gt;

&lt;p&gt;h5bp’s build script is included, which minifies css and js files, with modifications to work with the default app configuration.&lt;/p&gt;

&lt;p&gt;And to make it more user-friendly I added an Apache Ant build.xml script to simplify some common tasks.&lt;/p&gt;

&lt;p&gt;First, install Apache Ant.  If you’re running a Mac or Linux you probably already have it.  Then download or clone the repot and go into the “app/project” directory using terminal or a command prompt.  Type &lt;code&gt;ant setup&lt;/code&gt; and it should download and install all the extensions needed to run tipfy (takes a few minutes).&lt;/p&gt;

&lt;p&gt;After that’s done you can type &lt;code&gt;ant compile-publish&lt;/code&gt; and the script will create a publish directory, minify your css and js scripts, optimize your images (if you have optipng and jpegtran installed), compile your templates, and leave you with a publish directory that you can upload to App Engine.  Pre-compiling templates is usually an optional step that speeds up page rendering.  Normally templates are dynamically compiled when they are viewed.&lt;/p&gt;

&lt;p&gt;You can also type &lt;code&gt;ant deploy-publish&lt;/code&gt; and it will do all of the above AND upload it to App Engine (after prompting you for email and password).  Note: don’t make any changes you want to keep in the publish directory.  It gets deleted and recreated every time you run “deploy-publish”.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ant deploy-dev&lt;/code&gt; will just upload the working app directory, without any minification or compilation.&lt;/p&gt;

&lt;p&gt;In “build/config” there are a couple of property files that you can use to customize the behavior of the build scripts.  Should be self explanatory, but might require some experimentation. Paul Irish has a &lt;a href="http://www.youtube.com/watch?v=OXpCB3U_4Ig&amp;feature=player_embedded" target="_blank"&gt;video walkthrough&lt;/a&gt; of the build script that explains what it does and some of what these config files can do.&lt;/p&gt;

&lt;p&gt;If you’ve been curious about App Engine, or Python web development, I highly recommend tipfy.&lt;/p&gt;</description><link>http://the.darktable.com/post/6370075186</link><guid>http://the.darktable.com/post/6370075186</guid><pubDate>Thu, 09 Jun 2011 18:19:33 -0700</pubDate><category>h5bp</category><category>tipfy</category><category>app engine</category><category>python</category><category>google</category></item><item><title>Today, We Are Brothers.</title><description>&lt;a href="https://twitter.com/moishel/status/78438882223464448"&gt;Today, We Are Brothers.&lt;/a&gt;</description><link>http://the.darktable.com/post/6336693849</link><guid>http://the.darktable.com/post/6336693849</guid><pubDate>Wed, 08 Jun 2011 17:22:11 -0700</pubDate></item><item><title>And Good Riddance You Fuckers</title><description>&lt;a href="http://gmailblog.blogspot.com/2011/06/our-plans-to-support-modern-browsers.html"&gt;And Good Riddance You Fuckers&lt;/a&gt;: &lt;p&gt;Google is ending support for older browsers.  I’m really glad they’ve taken this step, because it will encourage others to do the same.&lt;/p&gt;

&lt;p&gt;My philosophy for a while has been if you’re too dim to update your browser you should just go back to the MSN homepage and shut up.&lt;/p&gt;

&lt;p&gt;And if you’re in a corporate environment where you aren’t allowed to install or update your browser, then quit slacking off by looking at my site.&lt;/p&gt;</description><link>http://the.darktable.com/post/6336639678</link><guid>http://the.darktable.com/post/6336639678</guid><pubDate>Wed, 08 Jun 2011 17:20:28 -0700</pubDate></item><item><title>I Love Distributed Version Control</title><description>&lt;p&gt;In the past I’d alway been afraid to contribute to open source projects because creating diff patches, and asking some stranger to incorporate them into their project was daunting.&lt;/p&gt;

&lt;p&gt;Over the past month I’ve contributed tiny patches (a couple of lines) to three different open source projects, all of them as pull requests via github, and all of them accepted by the owners in under 24 hours.  Two of them were accepted in under an hour.&lt;/p&gt;

&lt;p&gt;I’m usually not a charitable guy, but DVCS makes it too easy to help.&lt;/p&gt;</description><link>http://the.darktable.com/post/5836909508</link><guid>http://the.darktable.com/post/5836909508</guid><pubDate>Wed, 25 May 2011 10:28:45 -0700</pubDate></item><item><title>Top 6 Misconceptions About Unity Dev</title><description>&lt;a href="http://altdevblogaday.org/2011/05/23/the-top-6-misconceptions-i-had-about-unity/"&gt;Top 6 Misconceptions About Unity Dev&lt;/a&gt;</description><link>http://the.darktable.com/post/5794175331</link><guid>http://the.darktable.com/post/5794175331</guid><pubDate>Mon, 23 May 2011 23:17:00 -0700</pubDate><category>Unity3D</category><category>gamedev</category></item><item><title>A Family of GAE Loggers</title><description>&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_llm29eJCEZ1qfkmet.jpg" alt=""/&gt;&lt;/p&gt;

&lt;p&gt;I’ve created a family of custom logging handlers for use with Google App Engine.  These can be used when you need to watch the logging messages generated by your app in real time, after it’s been deployed (watching logs locally is a piece of cake).&lt;/p&gt;

&lt;p&gt;You can always go to the dashboard and keep refreshing it, or download logs periodically, but with these utilities you can have log events sent in real time to a web page, a command line app, or a chat application.  This is a concept similar to the Unix &lt;code&gt;tail&lt;/code&gt; command.  There are some situations where this is really convenient and speeds up debugging in the production environment a lot.&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;&lt;p&gt;This one uses the &lt;a href="http://code.google.com/appengine/docs/python/channel/overview.html" target="_blank"&gt;Channel API&lt;/a&gt;, and is the easiest to set up:
&lt;br/&gt;&lt;a href="https://bitbucket.org/darktable/gae-channel-logger/src" target="_blank"&gt;https://bitbucket.org/darktable/gae-channel-logger/src&lt;/a&gt;
(&lt;a href="https://groups.google.com/d/topic/google-appengine-python/aaX8j7-uA6c/discussion" target="_blank"&gt;Google Group Post&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This one uses &lt;a href="http://www.pubnub.com/" target="_blank"&gt;PubNub’s&lt;/a&gt; publish and subscribe system. PubNub is very cool, and surprisingly easy to setup and use.  I’m now considering using it for a multi-user game.:
&lt;br/&gt;&lt;a href="https://bitbucket.org/darktable/gae-pubnub-logger/src" target="_blank"&gt;https://bitbucket.org/darktable/gae-pubnub-logger/src&lt;/a&gt;
(&lt;a href="https://groups.google.com/d/topic/google-appengine-python/JcksEHkIR24/discussion" target="_blank"&gt;Google Group Post&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This one uses &lt;a href="http://code.google.com/appengine/articles/using_xmpp.html" target="_blank"&gt;App Engine’s XMPP&lt;/a&gt; send system.  It can be used with any Jabber chat client, but  takes a bit of setup.:
&lt;br/&gt;&lt;a href="https://bitbucket.org/darktable/gae-xmpp-logger-python/src" target="_blank"&gt;https://bitbucket.org/darktable/gae-xmpp-logger-python/src&lt;/a&gt;
(&lt;a href="https://groups.google.com/d/topic/google-appengine-python/Syu4uV84UPA/discussion" target="_blank"&gt;Google Group Post&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;</description><link>http://the.darktable.com/post/5740576964</link><guid>http://the.darktable.com/post/5740576964</guid><pubDate>Sun, 22 May 2011 12:19:00 -0700</pubDate><category>python,</category><category>Google</category><category>App Engine</category><category>Channel API</category><category>hobbies</category><category>utility</category></item><item><title>Gendarme can improve your Unity code.</title><description>&lt;ol&gt;&lt;li&gt;Download gendarme (may need the latest mono too): &lt;a href="http://www.mono-project.com/Gendarme" target="_blank"&gt;http://www.mono-project.com/Gendarme&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Put it somewhere on your path. &lt;/li&gt;
&lt;li&gt;Open a command prompt and go to your Unity project’s directory. &lt;/li&gt;
&lt;li&gt;type in: &lt;code&gt;mono gendarme.exe --html mistakes.html Library/ScriptAssemblies/*.dll&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Open the mistakes.html file that was just created and see some of the bad things you are doing in your scripts. &lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;There will be tons of warnings that you can safely ignore, but it can help you spot suboptimal things you are doing in your code.  Since Unity MonoBehaviors can’t be in namespaces, and there are tons of private methods that get called directly from native code, there are some rules you can safely ignore.&lt;/p&gt;

&lt;p&gt;Here’s the ruleset I’m using:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&lt;ruleset name="default"&gt;
    &lt;rules include="*" from="Gendarme.Rules.BadPractice.dll"/&gt;
    &lt;rules include="*" from="Gendarme.Rules.Concurrency.dll"/&gt;
    &lt;rules include="*" from="Gendarme.Rules.Correctness.dll"/&gt;
    &lt;rules include="*"
           exclude="PreferUriOverStringRule | TypesShouldBeInsideNamespacesRule | AvoidVisibleFieldsRule | MarkAssemblyWithComVisibleRule | MarkAssemblyWithCLSCompliantRule"
           from="Gendarme.Rules.Design.dll"/&gt;
    &lt;rules include="*" from="Gendarme.Rules.Design.Generic.dll"/&gt;
    &lt;rules include="*" from="Gendarme.Rules.Design.Linq.dll"/&gt;
    &lt;rules include="*" from="Gendarme.Rules.Exceptions.dll"/&gt;
    &lt;rules include="*" from="Gendarme.Rules.Interoperability.dll"/&gt;
    &lt;rules include="*"
           exclude="UsePreferredTermsRule | UseCorrectCasingRule | AvoidNonAlphanumericIdentifierRule | UseSingularNameInEnumsUnlessAreFlagsRule"
           from="Gendarme.Rules.Naming.dll"/&gt;
    &lt;rules include="*" exclude="AvoidUncalledPrivateCodeRule | PreferLiteralOverInitOnlyFieldsRule"
           from="Gendarme.Rules.Performance.dll"/&gt;
    &lt;rules include="*" exclude="NewLineLiteralRule" from="Gendarme.Rules.Portability.dll"/&gt;
    &lt;rules include="*" from="Gendarme.Rules.Security.dll"/&gt;
    &lt;rules include="*" from="Gendarme.Rules.Security.Cas.dll"/&gt;
    &lt;rules include="*" exclude="MarkEnumerationsAsSerializableRule" from="Gendarme.Rules.Serialization.dll"/&gt;
    &lt;rules include="*" from="Gendarme.Rules.Ui.dll"/&gt;
    &lt;rules include="*" from="Gendarme.Rules.Maintainability.dll"/&gt;
    &lt;rules include="*" from="Gendarme.Rules.Globalization.dll"/&gt;
    &lt;rules include="*" from="Gendarme.Rules.Smells.dll"/&gt;
&lt;/ruleset&gt;
&lt;/code&gt;&lt;/pre&gt;</description><link>http://the.darktable.com/post/5627452728</link><guid>http://the.darktable.com/post/5627452728</guid><pubDate>Wed, 18 May 2011 20:06:00 -0700</pubDate><category>gendarme</category><category>csharp</category><category>mono</category><category>unity3d</category><category>gamedev</category></item><item><title>Static Site Hosted on App Engine? Easy.</title><description>&lt;p&gt;Here’s a little app.yaml gist that allows you to host a static html site on Google App Engine.  This could be useful if you’re too cheap to buy your own domain, or if you are worried about having to serve an insane amount of traffic.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://gist.github.com/873098" target="_blank"&gt;&lt;a href="https://gist.github.com/873098" target="_blank"&gt;https://gist.github.com/873098&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It copies a lot of the mime types and suggested expiration times from the .htaccess file included with the &lt;a href="http://html5boilerplate.com/" target="_blank"&gt;HTML5 Boilerplate&lt;/a&gt;.  I also contributed this to h5bp’s server configs repository (so don’t say I never give to charity).&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/paulirish/html5-boilerplate-server-configs" target="_blank"&gt;&lt;a href="https://github.com/paulirish/html5-boilerplate-server-configs" target="_blank"&gt;https://github.com/paulirish/html5-boilerplate-server-configs&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://the.darktable.com/post/5616555364</link><guid>http://the.darktable.com/post/5616555364</guid><pubDate>Wed, 18 May 2011 14:40:32 -0700</pubDate><category>html5,</category><category>h5bp</category><category>app engine</category><category>html</category></item><item><title>Synchronize Swatches</title><description>&lt;p&gt;&lt;img src="http://25.media.tumblr.com/tumblr_ljb41cvCKV1qz9xwco1_500.jpg" width="500" height="380"/&gt;&lt;/p&gt;
&lt;p&gt;An issue came up on the App Engine Google Group a while ago where people were seeing clocks out of sync across instances.  It now appears that this was probably coming from module caching, and not bad instances.  In any case I came up with a hacky way to synchronize clocks across App Engine instances.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://gist.github.com/836228" target="_blank"&gt;&lt;a href="https://gist.github.com/836228" target="_blank"&gt;https://gist.github.com/836228&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I called the file “swatch.py” and the method “synchronize” in honor of “Parker Lewis Can’t Lose.”  Also because it’s only really able to synchronize within a second, and I doubt synchronized swatches could offer much more accuracy.&lt;/p&gt;
&lt;p&gt;What it does is compare the instance’s time to the timestamp from the headers provided by various websites.  I figured that major sites like Amazon, Facebook, and Google would (almost) always be available and would probably try to keep their web server clocks closely synced to some time server.&lt;/p&gt;</description><link>http://the.darktable.com/post/5615761778</link><guid>http://the.darktable.com/post/5615761778</guid><pubDate>Wed, 18 May 2011 14:15:00 -0700</pubDate><category>synchronize swatches</category><category>parker lewis</category><category>app engine</category><category>python</category><category>utility</category><category>programming</category></item></channel></rss>

