Sencha Touch SDK per-environment build configuration

Here is a patch for the Sencha Touch 2.0.0b3 sdk that allow you to specify different configuration (anything in app.json) for the Sencha SDK build tool depending on the configuration. For example, I want to include phonegap.js when I run

sencha app build package

but not when I run

sencha app build production.

The SDK doesn’t support this out of the box, so I wrote a patch that extends it. I added a file called app-package.json to my app directory with the following contents:

    "indexHtmlPath": "index-phonegap.html",
    "js": [
            "path": "lib/cordova-2.0.0.js"
            "path": "sdk/sencha-touch.js"
            "path": "app.js",
            "bundle": true, 
            "update": "delta"
            "path": "config/phonegap.js"

This will tell the modified Sencha SDK that when I build for the “package” environment, I want to include phonegap’s JS and also another javascript file I wrote that sets a few config options. The key is that this will not be included when I deploy to production for the web. The Sencha SDK doesn’t support this behavior (maybe they will if they read this), but this patch will enable this functionality.

Here’s the patch, apply to the sdk directory of your project.

diff --git a/public/TCMobile/sdk/command/src/module/Application.js b/public/TCMobile/sdk/command/src/module/Application.js
index a694b8d..01f28dd 100644
--- a/public/TCMobile/sdk/command/src/module/Application.js
+++ b/public/TCMobile/sdk/command/src/module/Application.js
@@ -176,8 +176,17 @@ Ext.define('Command.module.Application', {
         var path = require('path'),
             fs = this.getModule('fs'),
             sdk = path.resolve(src,'.senchasdk').trim()),
-            config = fs.readJson(path.join(src, 'app.json')),
-            jsAssets = config.js || [],
+            config = fs.readJson(path.join(src, 'app.json'));
+        //Modified by BS for environment specific configuration
+        //try {
+            var envConfig = fs.readJson(path.join(src, 'app-' + environment + '.json'));
+            config = Ext.apply(config, envConfig);
+        /*} catch (ignore_excepttion) {
+        }*/
+        var jsAssets = config.js || [],
             cssAssets = config.css || [],
             extras = config.extras || config.resources,
             ignore = Ext.Array.from(config.ignore),

Phonegap 1.0.0 Released: Update your plugins

Phonegap 1.0.0 was released today. It’s a good update with a lot of improvements, and it’s finally out of prerelease stage.

However, I had some problems with the ChildBrowser plugin not being recognized on iOS. I kept getting this error message, even though I had ChildBrowserCommand defined in PhoneGap.plist:

ERROR: Plugin 'ChildBrowserCommand' not found, or is not a PGPlugin. Check your plugin mapping in PhoneGap.plist.

After looking at it for quite a while, I found the problem in PhoneGapDelegate.m

// first, we try to find the pluginName in the pluginsMap
// (acts as a whitelist as well) if it does not exist, we return nil
// NOTE: plugin names are matched as lowercase to avoid problems - however, a
// possible issue is there can be duplicates possible if you had:
// "com.phonegap.Foo" and "" - only the lower-cased entry will match
NSString* className = [self.pluginsMap objectForKey:[pluginName lowercaseString]];

Phonegap now requires the plugin identifiers in PhoneGap.plist to be in lowercase, so instead of
“ChildBrowserCommand” as the key, you need to change that to “childbrowsercommand” and it will start working again. Also make sure your plugin is up to date as they’ve made some changes in the last week or two.

I hope this helps anybody who ran into this message, and it was pretty frustrating for me on a Friday afternoon.

Mobile Webapp Development in Chrome

View this post without restrictions

What do Safari, Chrome, iPhone, and Android all have in common? They use Webkit as their html rendering engine. This has a bunch of nice side effects for mobile developers, the nicest of which is you can do at least 80% of your mobile web development on the desktop if you use Chrome or Safari.  Since I’m on linux, I use Chrome, and it’s awesome that all the mobile libraries (like Sencha Touch, jqTouch, etc).

I wrote a proof of concept Sencha Touch app that works almost exactly the same in Chrome as it does on my Nexus 1.  However one of the things that bugs me is that the browsers don’t honor the META viewport directives, and I seem to always get weird scrollbars showing up and ruining everything.  so I wrote a little scriptlet that will pop up a window with the current page in 320×480 and without scrollbars.

Usually to install a bookmarklet, you just drag a link from a page to your bookmark bar, but doesn’t allow me to put javascript on a page (or iframes). So you can either view this post as it was meant to be viewed or you can manually add a bookmark with the following javascript as its destination:


Why Higher Rates are Better (for everyone)

As owner of an independent software firm , I apply for a lot of  contract jobs.  I probably talk to 20 potential clients for every one that I actually and up billing.  Many of these potential clients don’t even let me write up an estimate because they get scared away by my “high” hourly rate.

Now whether or not my rate is actually that “high” (it’s not), I do know for a fact that there are literally thousands of other programmers who charge much much less.  Just go take a look at vworker or craigslist and you’ll see tons of offers for programming gigs that pay as low as $15/hour.

Or look at my inbox last week: “I have talked with a couple other developers and they have been around $40/hour.  Just wondering why you are so much more?”

Or at this post I saw on HN from a guy who is very excited about some very low rates.

Here’s a reddit thread recommending anywhere from $15-$100

And another one in which the first post kindof has the right idea, and is the first big reason you should charge (or pay) a higher software consulting rate:

If you price yourself like garbage you will be treated like garbage. 

As the saying goes, time is money, but many businesses seem to forget this, and your rate is a good way to remind them.

A previous client of mine, during my first week of work, told me I should let them know when would be a good time for my “mandatory, 2-day on-site HR training.”  I told them I would be available whenever they liked, but that I would bill that time at my full rate.  It turns out that training wasn’t nearly as mandatory as the HR department initially thought.

But aren’t I just throwing away money? No.  I’m in the business of writing software, not the business of wasting people’s money.  I want to write great software and a higher rate allows me to concentrate on what I do best, since it isn’t worth it for a client to waste my time.  Those 2 days I didn’t spend in pointless meetings were instead 2 good productive days of coding.

As a client as well, I highly doubt you are in the business of purchasing garbage.  You would certainly be skeptical of a 60-80% discount on a new company car, so why aren’t you skeptical of bargain-bin software?

It just isn’t worth it

Freelance development is a much different beast from a working a 9-5.  If you are working for $40/hour, the absolute most you can make in a year, if you bill 40 hours per week (which you won’t), is around $83k before taxes. (about the median for an experienced softare engineer in phoenix) And what about all the non-billable time you spend finding clients, invoicing, meeting, planning, etc.

If you want to work 50-60 hours per week for $83k a year, I think you’re better off in a office where you get free equipment, vacation time, health insurance and retirement benefits on top of your salary for only 40 hours of work.  Which reminds me:

Full Time != 40 hours

At least in my variety of contact work, I bill incredibly tight.  I stop the clock for bathroom breaks, on the job training, phone calls, etc.  I bill actual time I work on actual code for an actual client.

I’ve worked a lot of “9-5” jobs where the software guys show up at 9:30, take an hour lunch, watch a bunch of youtube, leave early on Friday, and call that 40 hours.  On my own, not only do I still watch youtube, read blogs and hang out in IRC, but I have meetings, lunches, accounting, and other unbillable “work.” A 25-billable-hour week is good for me, and I’ve never actually billed more than 40.

And yet I produce as much if not more than many people who claim to do 40.  If you are paying a “cheap” software developer for 40 hours per week, I’m almost certain he isn’t actually doing 40 hours of work.  What if I produce the same amount of code in the same amount of calendar time (1 week) for the same total price, but I only bill you 20 hours for it? Is my rate really double, or am I just being more honest with how I spend my time?

You get what you pay for

There is a great post on Jeff Atwood’s blog from a few years ago that described the disparity in the skill level of programmers. This post is probably more true today than when he wrote it in 2004.  Programming in general has been getting much more accessible because of noob-friendly frameworks, screencasts, books, and the open source community.  That doesn’t mean it’s gotten any easier.

Sure you can create a weblog in 15 minutes but what happens when something breaks and there’s no 15 minute screencast to help you fix it?  What happens is you end up spending 10 times as long fixing it as someone who charges only 3 times as much per hour.  Or maybe you don’t pay the “higher cost” contractor anything at all:

Warranty your code 

All code contains bugs, but well designed, DRY code will contain fewer bugs than a $15/hour copy-paste job, and the bugs it does contain will be easier to fix.  You might even consider warrantying your code.  Your clients expect your code to work, but none of them will ever agree to pay for testing.  You can wrap cost of testing into your rate and you end up delivering a higher-quality product.

Nobody likes being nickel-and-dimed, especially when the client has to pay for your mistakes.  Occasionally I’ll bill for a really complex, time-consuming bugfix(never without warning), but your clients will love seeing “Fixed rendering issues in IE – 1 hour – $0.00” on their invoice.

Preventing feature-creep

Feature creep is the bane of software projects.  It’s a major cause of going over budget (both in time and money) and very often leads to bloated, bug-filled software.  It is also the reason you should never, ever do a “fixed-bid” project, which is basically equivalent to charing $0/hour.   If the client can buy features for pennies, he will, and more features are not always better.

As a freelancer, shouldn’t I want more work?  Shouldn’t I encourage more features? No.  I should write an entire post on this topic, but a big reason I went into business for myself was to have more creative control over what I write.  Good software is important to me, and clients are notorious for not knowing what good software looks like.  I’d rather have a website I’m proud to show off than one I’m embarrassed of that made me a few extra dollars. A higher rate can disincentivize the hasty addition of features, and ensure that both sides of the project are thinking about how to get the most value out of everyone’s time (and money).

Programming != IT

I know there is a lot of buzz about so-called “devops” positions, but that’s not what I do.

Your client needs a new webserver configured? They can get an entire month of high-quality, dedicated service from a managed hosting provider for the same amount they would have to pay me to reinstall ubuntu and run ‘apt-get upgrade”.  Or you can make an extra $40 staring at the console window of the cheapest linode server for half an afternoon.  It’s up to you.

And when the server goes down in the middle of the night, if you ding them $25 for a 3am phone call, I guarantee you’ll receive that call.  If it costs them $200 then maybe they just call the nice people at rackspace instead.

Hourly rates don’t even matter

As a client, you absolutely need to get an estimate from your freelancers before you can judge.  This sounds obvious, but a lot of people apparently get sticker shock when they hear 3-digit hourly rates.  But if the “expensive” programmer and the “cheap” rogrammer both quote you $5000 for the project, I would bet the former has a better chance of finishing on time and on budget than the latter.

This is probably the most important point here.  Having a higher hourly rates doesn’t even mean you make more money, or that you would be more expensive for any particular project.  Your rate really just signals  how good your work is, how high the client’s expectations should be, and how you expect to be treated.

If the client is worried about cost, there are ways to negotiate that don’t involve changing your rate.  Higher-value code, limited scope, better responsiveness, creative control, and a slew of other factors are all more important than what rate you charge.

Of course this post assumes you’re good at what you do.  If you’re happy copy-pasting code from google into a vworker job, by all means continue charging $10/hour.  But if you are a great software developer with a good reputation and happy former clients, do yourself a favor and raise the rate.  You will feel more valued, and that feeling will manifest in the your work.  You will get to do more of what you like, less of what you don’t, and that will let you provide much more value for you clients.

And if you are looking for great software developers, concentrate on the big picture, not on the big (hourly) figure.

Has it been a year already?

It looks like it’s been over a year since I blogged. That’s probably because I’ve been absurdly busy starting my own company!Brian Samson Software Consulting

I plan on updating this site more frequently from now on, and I’m going to start with a shameless plug.  Although business is good at the moment, I’m always looking for new clients.  If you or anyone you know needs some outstanding software written, whether it be Ruby on Rails, Android, Java, or even *shudder* PHP, shoot me an e-mail.  Anything (at) will get delivered.

Also you can take a look at my online résumé which I recently updated to have a mobile version if you visit on your phone.

The iPhone is not Facebook

The iPhone is a great, magical, revolutionary device. I owned first-gen one for 2 years and loved everything about it (except AT&T). I think it’s great how many apps are out, and how much emphasis the platform has put on software development in general. Without the iPhone I’m sure my Nexus One wouldn’t even exist.


Shaq released an iPhone app today: The Shaq App. The entire point, as far as I can tell, is to watch shaq’s twitter feed. There are about a thousand ways you could have done that already, the easiest of which is going to his twitter page. There is no reason for this.

But Shaq is rich. And social. If he wants to pay somebody to write The Shaq App, that’s fine by me. What spurred this post was a spam I got from with this in it: spam

“Our new LensGauge™ iPhone App makes it easy. It prompts you when to change your contact lenses. It maintains all pertinent information about your contacts. And it makes re-ordering a snap.”

This LensGauge ™ app is so dumb it is hard for me to properly articulate it. It is dumber than the fart app(s). It is dumber than the “I am Rich” app. It is maybe even dumber than The Shaq App. From the reviews on that page, it sounds like it doesn’t even work (how that is possible is beyond me).

This isn’t new. Lots of companies seem to be “promoting their brand” through “new business channels” by “having a presense” on a “social platform.”

So listen up, all you pillars of industry. You probably don’t need an iPhone app. If your best idea for an iPhone app can be used at most once a year, you definitely don’t need one. If it doesn’t do more than your website, just make your website work on mobile devices. If you just yearn for virtual friends to “like” you, go get a facebook page or open a twitter account. If all you desire is to be “social,” you should probably quit your job, because you are terrible at it.

The iPhone isn’t Facebook, although with 100,000 apps its starting to get pretty close.

New from! Really like this blog post? Take it with you! With the new iPhone app, it’s like having Brian Samson in your pocket at all times! You can re-read all your favorite posts, and be the first of your friends to know when there is a new post! Download the iPhone app today! (Coming soon to Android and iPad)

The worst comment I’ve ever written

I’m sitting here trying to debug a very complex piece of “meta” code. This code generates web forms that have fields that automatically show/hide based on the selections in other fields. It’s usually very nice to work in, and it makes creating dynamic forms easy, but it is insanely complex under the hood. I finally find the source of the bug is a hip, railsey, ruby one-liner. It’s not to hard to figure out what that line does (adds some kind of prefix to each key). However I have no idea why it would do that. Luckily when I wrote this code I knew this was confusing, so I included a comment:

if (@if)
#in case this is being rendered in a subsection, the key
@if.each {|andor, array| array.each {|h| h[:key] = field_name_prefix + h[:key] }}

Except I forgot to finish it. The key…. the key….. WHAT ABOUT THE KEY YOU IDIOT?? This is the worst comment I’ve ever written. It is worse than no comment. No comment wouldn’t have got my hopes up….and then crushed them. Why isn’t it lunch time yet?


Get every new post delivered to your Inbox.