Sour Code Sour Code


Building a quadcopter – Part 1

Published on February 17th, 2014

I’m building a basic quadcopter. Through these blog posts I’ll try and report what I’m working on. I’ve ordered some of the things I need through HobbyKing and we’re halfway done building the frame.

A good friend of mine is helping me out with the frame by CNC milling it for me out off plate aluminium. We picked 4mm (0.157 inch) and 2mm (0.078 inch) thick aluminium for the optimal weight/strength combination.

Cutting the arms to the right length.

The frame with bolt holes.

Finished bottom plate

Testing the battery mount (with simple velcro straps)

Monkey Must Run: Dev Diary #02 – First draft of the icon

Published on January 24th, 2013

While we’re busy experimenting with the basics of the physics: jumping, double-jumping and the actual speed of the monkey I’ve also started making some drafts for a icon. Pre-mature for sure, but a lot of fun.

Monkey Must Run - Icon Draft 1

Slowly adding more separate components to the main game view. Like these hand-drawn clouds.


Next time I’ll try and post a video of the current state of the game.

My friend made a short film. You should watch it.

Published on December 20th, 2012

The title says it all. It’s 5 minutes and 38 seconds and it’s great. The only thing I can think of as criticism is that it’s too short. 😉 Have fun.

Also visit the official site LoganShort.com.

Monkey Must Run: Dev Diary #01

Published on December 16th, 2012

I’ve decided to keep a developer diary for the iOS game I’m developing with @beerdeaap. We’ve started work on it about 20 days ago.

Tonight, I redid the logo. Here’s a sketch of the intro screen (missing animated objects ect). I’m going for a 90’s action game vibe.

Monkey Must Run - Intro Screen

Screen is shown at 400% pixel size (so, basically 4 times the size I’m working at). This size is similar to the size we display on the iPhone screen, although the PPI is most likely much higher on mobile devices.

Xcode 4 – Hide the status bar

Published on July 19th, 2011

I was looking for a quick way to fully hide the iPhone – or rather, iOS – status bar from my App. This method has changed from Xcode 3 to 4. The new method is adding a line to your info.plist file.

Add a new line by clicking the plus symbol on the last variable, a new line will be added. Enter the key value UIStatusBarHidden. This key will automatically convert to Status bar is initially hidden. Change the type to Boolean and change the value to YES.

Your status bar is now hidden from startup. You can always get the status bar back with setStatusBarHidden:withAnimation: which belongs to the UIApplication Class.

Export groups to files in Photoshop

Published on June 30th, 2011

At this point the latest version of Photoshop (CS5) only offers to export layers to files. If you’re using groups (folders) in Photoshop there’s no option available to export those.

Use the following script to export all groups to high quality .png files. Copy the script below or download the script directly.

#target photoshop
function main(){
if(!documents.length) return;
var doc = activeDocument;
var oldPath = activeDocument.path;
for(var a=0;a<doc .layerSets.length;a++){
activeDocument.activeLayer = activeDocument.layers.getByName(doc.layerSets[a].name);
var saveFile= File(oldPath +"/"+doc.layerSets[a].name +".png");
function dupLayers() { 
    var desc143 = new ActionDescriptor();
        var ref73 = new ActionReference();
        ref73.putClass( charIDToTypeID('Dcmn') );
    desc143.putReference( charIDToTypeID('null'), ref73 );
    desc143.putString( charIDToTypeID('Nm  '), activeDocument.activeLayer.name );
        var ref74 = new ActionReference();
        ref74.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
    desc143.putReference( charIDToTypeID('Usng'), ref74 );
    executeAction( charIDToTypeID('Mk  '), desc143, DialogModes.NO );
function SavePNG(saveFile){
var pngOpts = new ExportOptionsSaveForWeb; 
pngOpts.format = SaveDocumentType.PNG
pngOpts.PNG8 = false; 
pngOpts.transparency = true; 
pngOpts.interlaced = false; 
pngOpts.quality = 100;
activeDocument.exportDocument(new File(saveFile),ExportType.SAVEFORWEB,pngOpts); 

How to use this script

Copy the script and save it as a .jsx file (ExtendScript Script) anywhere on your system. In Photoshop go to the following menu item: File > Scripts > Browse… Now select the .jsx file in the file browser. Photoshop will now start exporting all your groups to files. It will save the files in the directory the .psd is located in.

Known limitations

  • Empty groups give back an error message and stop the exporting proces.
  • Not tested below Photoshop version CS5 (might work in lower versions).

Let me know if you find this script useful or if you run into any problems.

One Day for Design

Published on April 13th, 2011

Today was One Day for Design (#1D4D on Twitter). One Day for Design is a open, global discussion about the meaning and future of professional design associations. There we’re a lot of interesting discussions going on on Twitter. Some of the highlights.

“Designers take things apart, evaluate them & put them back together, in a different order. That is how we understand product & process.”

— Erik Spiekermann

“There are those who talk about creating, and those who create.”

— James White

Interesting train of thought going on here by James but I can’t say I agree. Communication about creation should be parallel with creation as creation is a way of communication (albeit mostly non-verbal).

“I tell my clients that it’s impossible to redesign anything without upsetting somebody.”

— David Hillman

Although I didn’t join in today (busy day at work) I really enjoyed some of the insights. I hope you do as well.

Magento: Disable notifications

Published on June 19th, 2010

Some users have trouble handling the the updates or the notifications themselves. For these users you need to disable the notifications, to let them concentrate on what they need to do within Magento. As far as I know there are 2 methods to disable notifications: creating a new user role that doesn’t see notifications or changing the administration XML templates so it won’t show notifications. I will show you both methods.

Disable notifications for a specific user role

Create a new custom user role that you give to users that you don’t want to see notifications. Access the user role page (System > Web Services > Roles) to create a new user role.

In general it’s smart to do this step right from the start of the project so you can give the users the correct roles right away. Of course, it’s also possible to change the settings of a user role later on.

Disable notifications for all users

Access the administration html templates trough either SSH or FTP and delete the following two lines from the file located at: app/design/adminhtml/default/default/layout/main.xml.

<block type="adminhtml/notification_window" name="notification_window" 
as="notification_window" acl="system/adminnotification/show_toolbar" 
template="notification/window.phtml" />
<block type="adminhtml/notification_toolbar" name="notification_toolbar" 
as="notification_toolbar" acl="system/adminnotification/show_toolbar" 

The next and final step is to change a block of code in one of Magento’s module files. Open the xml file located at: app/etc/modules/Mage_All.xml and change the following code:

<mage_core />


<mage_core />

That’s it. You’re done. Notifications are now disabled for all user roles (including administrators). Be sure to make back up’s of your files before you make any changes.

5 common lies a web developer will tell you

Published on August 18th, 2009

This blog post is supposed to be funny. If you’re a web developer and it doesn’t strike you as funny after the first few lines you better stop reading or prepare to be annoyed.

1. This was how the functionality was described in the requirements

It probably wasn’t like that in the requirements. He either didn’t read the requirements or he was drunk (or both).

2. I have no problems with flexible hours

What the web developer means by this is that he has no trouble staying up till 4 AM playing Counter Strike. Work doesn’t necessarily come into this picture.

3. I could probably have this up and running within a day

He probably could, but it won’t work. If you get a breakdown from a web developer feel free to thank him and triple the hours he has given you for the actual planning. It’s not their fault, it’s just how they roll.

4. I’ll start on the documentation when development is finished

He won’t. Documentation is a pain for developers, they will have to write actual words (which can’t be generated by a script). You either get him to do the documentation at gun point or you won’t get any at all.

5. Development will be finished this week

Now, there’s a small chance this isn’t a lie. It depends on how many times you have heard this line before. Around the 3rd or 4th time it could be true. Most of the time it’s not.

Rewriting files to directories with Mod_Rewrite

Published on August 14th, 2009

Let’s say you have all your pages in flat files in the same directory. In this example the files have .php extensions but they could be any kind of files. For instance:


These files end up looking like this in your browsers address bar:


Let’s take these file names and turn them in to directories, this makes URI guessing easier (no file extensions) and some would say it would look better. These files showing up like directories would look like this:


If you would do this by hand it would mean making directories by hand and placing the files in those directories. Depending of the amount of pages in your website this could mean a lot of work.

Rewriting to directories

Luckily there’s and easy method to replace URI’s with mod_rewrite. The following lines in your .htaccess document will do the trick:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteRule ^([0-9A-Za-z]*)/$ http://www.domain.com/$1.php
RewriteRule ^([0-9A-Za-z]*)/([0-9A-Za-z]*)/$
RewriteRule ^([0-9A-Za-z]*)/([0-9A-Za-z]*)/([0-9A-Za-z]*)/$
http://www.domain.com/$1-$2-$3.php [L]

Make sure to change the .php extension in this code to the extension of your choice. You could also use multiple rewrite rules for multiple extensions.

Maximum directory depth

This rewrite takes up to three words per file name into account. Longer file names such as lorem-ipsum-dolor-sit.php would be rendered without any rewriting. A fourth (or more) directory rewrite could be handled by adding extra lines for each word/directory:

RewriteRule ^([0-9A-Za-z]*)/([0-9A-Za-z]*)/([0-9A-Za-z]*)/([0-9A-Za-z]*)/$

SEO Drawbacks?

Some SEO’s would argue that file names carry more weight (in search engine algorithms) then directory’s. Other SEO’s claim that the directory carries more weight, especially without the use of a file name. Both arguments sound valid but there’s no real way to say which is true.

However, it’s a good idea too use a maximum depth of three directory’s so you don’t spread the keyword focus over too many words.