Adam Howitt's Blog

Feb 08
2012

Seeking Android Developer

I'm the CEO of WalkJogRun.net, a Chicago based startup in the Ravenswood Corridor. Our site gets over 16,000 visitors a day from around the world from runners looking to map a route, download a training plan or log their training to our diary. Our iPhone app has generated over $70,000 since it's launch 2 years ago and we're looking to replicate that success on the Android platform.

We're in search of a talented Android Developer and wondered if you know any devs that fit the bill. If so, please have them send over a letter of introduction. I'm looking for people with a passion and a talent, not a resume 18 pages long ;-)

We're looking for an intern looking to get their feet wet in a real world project that generates real revenue. I fully expect that the developer who can get this done would be hired to work full time on all of our platforms dabbling in the iPhone app and the website built on ColdFusion and MySQL. A passion for running would be ideal.

I see this as a great final year project or internship for the right candidate with some amazing opportunities with WalkJogRun at the end of the project.

Does location matter? Preferably greater Chicago area for the sake of simplicity but we're definitely not looking to offshore this project. I want someone who can grow with the company.

Jan 06
2012

User does not have permission to run DBCC TRACEON

I ran into an issue with a Microsoft Query based Excel work sheet a month ago and again just yesterday so I thought I'd share the workaround/fix here for my own sake and anyone else who is butting their head against a wall! The exact error message is as follows:

Connection failed:
SQLState: '37000'
SQL Server Error: 2571
[Microsoft][ODBC SQL Server Driver][SQL Server]User 'username' does not have permission to run DBCC "TRACEON".

The issue, as I understand it, is that Microsoft Query uses Microsoft Excel or Microsoft® Excel as the app name in the query string when it tries to connect which causes SQL Server to check for DBCC permissions (permission to run commands in the console). This request to turn TRACEON for a production server is actually frowned upon in favor of a system wide setting at startup so we need a workaround.

In Excel 2010 for PC you can edit the connection string by going to the data tab > connections > edit your connection and then the second tab of that dialog box lets you edit the connection string. Replace APP=Microsoft® Excel; with your own app name e.g. APP=Workaround; and hit OK and close the connection manager. Refresh your data, enter your password and Bob's yer Uncle.

Oct 19
2011

Getting Started with iCloud - Entitlement Issues

After battling through what seemed like a simple procedure to setup WalkJogRun for iCloud I figured I'd share the fix that worked for me.

The procedure as I understood it was as follows

  1. Enable iCloud for your fully qualified appId in the provisioning portal
  2. Regenerate and download your development provisioning profile and install it on your device and in Xcode
  3. Click my project in Xcode (4.2) and view the summary page for my target
  4. Scroll to the bottom and check the box to enable entitlements. It prepopulates the entitlement file and sets the two keys to match my app id
  5. Call
    NSString *containerId = @"com.mycompany.myapp";
    NSURL *iCloudURL = [[fileManager URLForUbiquityContainerIdentifier:containerId];
    NSLog(@"%@", [iCloudURL absoluteString]);
  6. Build and run on the device

The requested container identifier is not permitted by the client's com.apple.developer.ubiquity-container-identifiers entitlement

If I didn't see this error message the actual device would start to throw up in debug mode so I had to restart the phone to try again. I found an article that mentioned that you need the Team ID too for this approach so if you open the provisioning profile you'll find the team ID listed
<key>Entitlements</key>
    <dict>
        <key>application-identifier</key>
        <string>XXXXXXXXX.com.mycompany.myapp</string>
        <key>aps-environment</key>
        <string>development</string>
        <key>com.apple.developer.ubiquity-container-identifiers</key>
        <array>
            <string>YYYYYYYYY.*</string>
        </array>
You'll notice that the actual com.apple.developer.ubiquity-container-identifiers key is a wildcard so that any apps you develop can use iCloud as long as you use your Team-ID (the YYYYYYYY part). So the fix to my code is
NSString *containerId = @"YYYYYYY.com.mycompany.myapp";
NSURL *iCloudURL = [[fileManager URLForUbiquityContainerIdentifier:containerId];
NSLog(@"%@", [iCloudURL absoluteString]);

Build and run that and you should have success. However, I don't think I did, initially.

After some frustrating hours of trial and error I noticed the innocuous statement that specifying the containerId as nil will use the first one listed in your entitlements file. Huh. I tried it, built and run. Tada! NSLog shows the local fileURL my app can write to to send stuff to the cloud.

Now here's where it gets a little cloudy. Having seen that success I went back to my snippet code above with the YYYYYYY prefixed container ID and it seemed to work now. I'm not sure if I was missing a step when I first tried that but it's certainly working after the edit to pass nil instead.

Hope this helps!

Oct 17
2011

Cisco VPN on Lion Workaround Update

After a few months of booting into 32 bit mode, that got tiresome too. Shutting everything down, rebooting and then doing the work I needed before rebooting to go back to 64 bit again. Yawn. So two updates for you.

Faster switching

The first is that there is an easier way to switch between 32 and 64 bit mode without sitting holding keys down. You'll need to create a file called 32bit.sh in your home folder containing the two lines:
systemsetup -setkernelbootarchitecture i386
reboot
This simply tells your mac to set the boot architecture to 32 bit and then starts the reboot. To use this make it executable by typing
chmod +x 32bit.sh
in a terminal window when you're in your home directory. You'll want to add a corresponding 64bit.sh file too
systemsetup -setkernelbootarchitecture x86_64
reboot
and, again, make it executable.

To go to 32 bit mode, make sure you've saved everything you have open and then at the terminal type

./32bit.sh
If all has gone to plan you'll see it flash the commands on the screen and then your machine will reboot in 32 bit mode so you can start your VPN. Once you're done reverse the operation by running the 64bit.sh script.

No switches necessary

This one is a little more complicated but if you're looking for info about VPN fixes/workarounds I'm certain you'll keep up. You'll need the VPN remote desktop workaround I mentioned in the last post about VPNs. Once you have that working and have tested using the VPN while logged in remotely on RDC come back here for the next steps.

Okay, still with me. Next you'll need to install Cygwin on the Windows box and include the openSSH option from the list of packages. Lifehacker has a great setup guide for that.

Once you've got thru that install, test logging into the machine from your mac terminal window. You'll need the local IP address of the box running cygwin and your username. If your username has a space in it, at the command line you'll need to add a backslash before the space as an escape character e.g.

ssh My\ Username@192.168.1.110
If that works you're almost there.

The final step in connecting your mac to the VPN is to find out which ports on the VPN machines you're trying to hit. In my case, the client has MySQL and SQL Server databases so that's 3306 and 1433 respectively. To connect to SQL Server I created another shell script in my home directory on the mac called clientNameSQLServer.sh and made it executable. The contents

ssh -L 1433:xxx.xxx.xxx.xxx:1433 My\ Username@192.168.1.110
obviously replacing xxx.xxx.xxx.xxx with the IP Address for the remote VPN SQL Server, replacing "My\ Username" with your username and the local IP address with your own IP for the machine with Cygwin. This script forwards any requests on localhost:1433 to the remote VPN IP address you provided.

To fire it all up you'll remote desktop to the windows box. Start the VPN and reconnect to the remote desktop if it boots you. If you don't get back to the desktop, something wasn't right. As long as you see the remote desktop launch cygwin to make sure it's up and running. On your mac, go to the command line in terminal and execute the shell script

clientNameSQLServer.sh
. Now you can use your local Mac SQL Server client of choice, or even Microsoft Excel / Query to connect to the server. The only change to the way you would expect is that instead of setting the servername of the SQL server in your tool to the actual remote IP you use localhost:1433.

You're welcome.

Aug 04
2011

Cisco VPN on Lion Workaround

I found out the hard way that Cisco's VPN doesn't like Lions. Specifically as I began testing Lion developer previews without the safety net of a testing machine (big mistake) I was unable to get on the VPN for one of my clients.

I installed the VPN client on my old Windows XP box but felt like a stranger in a strange land. Remoting into the box was a problem because when I initiated the Cisco VPN client it locked down remote connections (due to a clash on local network IPs vs remote) and I couldn't get back in.

I found a workaround for that - typing

route delete 192.168.1.0
at the command prompt while sat at the Windows machine removed the conflicting route and I was able to get in over remote desktop from my mac. This has to be run each time you connect to the VPN so I wrote a batch file to initiate the VPN and run the required command (since as soon as the VPN connects you can't see or operate that machine). Type this into a text file and save it as launchvpn.bat
"c:\progra~1\Cisco Systems\VPN Client\vpnclient" connect connectionname
route delete 192.168.1.0
I put that on the desktop. Remote into the machine without the VPN running, double-click your batch file and hey-presto, you're on VPN and connected. You may get booted off RDC initially but just reconnect and you'll be fine. This of course assumes your router is 192.168.1.0 and your client is located where I said it was ;-)

This still isn't ideal though. I love my Mac and XP remoting makes me feel dirty so I searched some more this morning and came up with the right way to do this. It's ridiculously simple - reboot your Mac holding down the 3 and 2 key while it is shutting down and coming back up. This throws the Mac into 32 bit mode which you can confirm by going to About this mac > More Info > System Report > Software. You should see 64 bit kernel and extensions = NO.

Obviously running your Mac in 32 bit mode isn't a full time solution but for the sake of my sanity at least now I can VPN in to do the work directly on my Mac instead of all the other jiggery pokery.

May 18
2011

Virtually Home

This site has been shifted around over the years from host to host and so it has moved again. We're up on Amazon's EC2 servers for much better stability.

I had previously been on a dedicated VPC solution from a small hosting company but kept running into issues with bad VPS nodes, Windows web server attacks replacing operating system files and a general lack of stability. So I'm back to running the boxes myself so if we're down, it's my fault.

New Focus

I'm hoping to spend more time talking about the technical aspects of the work I do in my consulting business Adam Howitt Consulting, specifically our iPhone and iPad development services. I'll be talking about some of the hurdles involved and showcasing some of the projects. I've always been a big believer of sharing the solutions to development challenges I face as I go along. It's not necessarily going to be 100% original Adam Howitt code but the blog posts will typically combine all the research I did to fix something into a consolidated tutorial you won't find anywhere else.

Q&A

I would also like to open the floor to anyone with iOS development questions. If you need help I'd like to incorporate a mailbag blog post theme each week answering someone's questions publicly for all to learn from so feel free to email me through the contact form at AHC if you want me to answer a question.

All that said, enough dreaming and let's get down to business! The next blog post will talk about the recently launched ForestXplorer iPhone app I built for the Forestry Commission of England. I've also just wrapped an ad-hoc iPad app build for Coors Light but I'll need to figure out how much or little I can say about that since it's not live yet...

Jan 06
2011

Run a Linux process on a remote server and disconnect terminal session

I've been writing some nifty python scripts lately as we (WalkJogRun) migrate our route data from XML files to Google Maps encoded polylines. I finally whipped the script into shape and started pulling our route data from Amazon S3, encoding as SQL update statements and then rinse and repeat for nearly 500,000 legacy XML files. Trouble is, 500,000 files on my local machine would take about 20 hours.

Amazon AWS to the rescue! I span up a new Amazon EC2 medium size instance (high CPU) and pushed my script up to the cloud. The beauty of this is that the bandwidth between EC2 and S3 is free whereas my local machine relied on a crappy network connection and incurs the bandwidth charge on our S3 account. Ordinarily S3 bandwidth is pretty cheap but the script running on our EC2 machine is pulling down 5gb of data per minute and processing 1,000 files per minute. In around 8 hours we should have every legacy file processed and converted to a SQL statement we can run against our MySQL database.

But wait. My terminal timed out. Doh. If I login to the server over terminal and start the python script it is connected to my shell so if the connection breaks (on my crappy internet connection) the process is terminated on the server. The batch isn't as smart as it could be so it doesn't gracefully restart where it left off so I called on my friendly linux whiz Scott Frazer for a solution.

Scott directed me to the NOHUP command and after a few minutes of reading, a little typing and restarting my first batch I was able to disconnect my session thanks to this helpful command:

nohup ./myprogram > foo.out 2> foo.err < /dev/null &
Roughly, nohup says don't hangup when I do but because my script outputs to the terminal as it runs the rest of the output needs to be redirected to files instead of the console.

If you run this command, exit and log back in you'll see the PTS/1 replaced by ? when you run the ps -fe command. I'm able to track the progress of my script because each iteration/file writes a line to the sql file it generates and the handy wc -l command tells me how many lines are in that file.

So thanks to Scott I'll have all my new shiny encoded polylines for our database and we can start to eliminate the need for the legacy XML files. The background there is that Google Maps on the iPhone and in the browser both support polyline encoding such that instead of a large xml file of latitude and longitude coordinates (some as big as 40kb!) I get an encoded string I can insert into the database each no more than 1000 characters.

Nov 17
2010

Calculate Week of Year starting on a Monday

I am putting together a training log for WalkJogRun members to log their training data and ran into a spot with ColdFusion 8 showing Sunday as the first day of the week. Exercise training plans generally start on a Monday so I had to find a way around it.

The US starts it's week on a Sunday, the UK and a lot of other countries use Monday as the first day. For the most part Java is hiding that detail from you since java servers in the US will use Sunday as the first day of the week, whereas in the UK it will use Monday. I assume (rightly or wrongly) that the same is true for ColdFusion since it is built on Java.

To be explicit in ColdFusion you can construct a Java calendar object, set the first day of the week with setFirstDayOfWeek and then use a dateformat object to generate a week number starting on a Monday.

However, I realized after looking into these options my problem was the week() function of MySql. Arg. It turns out that date_format() for mysql has a format specifier %u for week of year beginning on a Monday or %U for week of year beginning on a Sunday. Perfect:

SELECT date_format(training_date,"%u"), sum(miles) as totmiles
FROM training_data
GROUP BY date_format(training_date,"%u")
ORDER BY date_format(training_date,"%u") DESC

Apr 09
2010

Apple is Doing the Right Thing Blocking Flash

I just read Joa Ebert's theoretical conversation parodying the move by Apple to block Flash code-generation tools and thought I'd repost my argument here. The argument is that Apple is being petty or childish by preventing developers from using code generation tools to develop apps.

I think the author and the flash devs who agree are selfishly angry. They think this is a move to block them and make things harder for THEM but it's not about being childish. It's about a track record, mobile development and maintaining the reputation of the app ecosystem.

Track Record.

I (and many of my mac cohorts) have seen Flash spike CPU on brand new hardware with fast processors and 8GB RAM so how will my poor little iPhone perform? Sure there is an argument that enabling flash on the devices reduces the demand for native apps but hybrid apps and jQuery are all options now but the native apps continue to flourish.

Mobile Development.

How big is your SWF? For every flash developer who knows that an optimized lightweight SWF loads faster there are hundreds who build and deploy massive SWF files that take a lot longer to load even on broadband, let alone filtering that through AT&T's "reliable" network. From a user experience if I wander onto a page with a bloated flash movie I risk crashing my device or at least locking up my bandwidth.

Code generation.

I've been a ColdFusion developer for over 10 years and have written code generation apps from scratch but always with the understanding it gets me 80% of the way there even when I'm generating ColdFusion apps! Imagine the idea of trying to write codegen in one language for another?!

It took me over 200 hours of development to release the first version of WalkJogRun Running Routes - and another 200 for each subsequent release. It's just that hard.

If the developers using the generated code don't learn Objective C it puts pressure on the review process. Just to correct the point in the blog post - review time is less than a week and has been for some time with my record turnaround at 3 days recently. Starting with this 80% code developers either never submit because they can't get it working or do submit it and have multiple app rejections because they don't understand why it breaks.

A plethora of CS5 generated apps could therefore put a huge strain on the review resources based on these multiple rejections. Even if an app sneaks through the likelyhood of an app continuing to crash would threaten the reputation of the developer and the app store.

A solution.

I think that if Adobe would be willing to sponsor the addition of a team of Apple Appstore reviewers dedicated to apps built with Adobe's codegen tools the situation would be very different. It's easy for Adobe to say their tools would be perfect but until they pay the salaries of the review team it's hard to accept responsibility for the consequences of their actions.

Jan 19
2010

Run your ass off this year!

After another 200 hour programming marathon spread over 4 months I'm thrilled to announce the release of version 3 of WalkJogRun's iPhone App "WalkJogRun Running Routes".

What does it do?

The most significant change version 2 was the addition of 23 training plans created by Coach Jenny Hadfield of Runners World fame. Once you sign up for a training plan and pick a start date you'll get alerts every morning at 6am (silent so they don't wake you) to tell you how far to run, how fast and give you motivation. Tap the find routes button to find a training route in your neighborhood from the 600,000 routes at WalkJogRun.net

What if I've never run before?

We've got plans for beginners, intermediate and advanced runners including one called "Run your first 5k" designed to take you from the sofa to being able to run a 5k race in 10 weeks. We've also got 10k training plans, half marathon training plans and full marathon training plans.

Gimme the nerdy stuff

The programs themselves are delivered as in-app purchases using the StoreKit framework on the device to process payments and then send receipts to the ColdFusion server to register the subscription and begin delivery of the alerts.

The alerts are delivered as Apple Push Notifications generated by ColdFusion. No mean feat I can tell you using Java in ColdFusion to connect to a streaming data socket to send and receive the bytes and then drop the encoded JSON packets off on your phone. The phone gets the alert, opens the app and takes you to the training session for the day to show you your training tip.

Download a copy of "WalkJogRun Running Routes" before it gets too late!

More Entries