Archive for August, 2011

AppDailySales, and running on Synology NAS Devices

Tuesday, August 23rd, 2011

Continuing my prior post where I talk about my server replacement, a Synology NAS (DS211j). In essence, a cheap, tiny dedicated Linux box featuring an ARM CPU and custom web UI specially designed for SUPER EASY RAID array maintenance and creation. There’s a 4 drive version, some many-more drive versions, but they cost more.

This time, I’m here to talk about a little tool for getting your daily sales data from Apple’s iTunes Connect website. AppDailySales!

This is a python script I was recommended some months back, but it needed a few things IMO. So in a shocking rare case of OSS justice, I added the features I wanted myself and submitted a patch:

Just a few days ago (nine months later), version 2.9 was released (sparked by Apple’s change to the system), now including my patches! 😀

To run the script, all you need is Python. Before I used to run this on Windows XP (Python installed in C:\Python2.7\, with PATH environment variable set to include this).

Now with the NAS, I SSH in to the device (Go download Putty if on Windows), login as root (same password as admin), and install the python package.

ipkg install python

Easy. Done.

Place the script somewhere on your computer, likely in the same folder you want your stats placed. Then simply invoke it with –help to get a list of arguments.

python --help

I run it from a batch file or script. My old Batch File Version looks like this:

The new, shockingly similar shell script version (i.e. only single %’s) is this:

This creates files like so:


Nice and easy to read names, unlike the default files generated by iTunes Connect.

In the next section, I’ll talk more about setting it up as a service. In other words, totally automated!


I am running a Synology NAS now

Tuesday, August 23rd, 2011

Last week, a drive in my server died. These drives weren’t really that old, but were Seagate’s from the drive failing epidemic a few years back. I bought 6 drives around this time, 4 for the server in a RAID 10 array, 2 for my workstation. I lost 1 to the failure problem, and the rest I managed to get updated firmwares installed in time.

Since then, I have been extremely leery of Seagate drives. My server ran Windows XP (yes), and used the on-board Intel SATA RAID controller of this MOBO. On several occasions, the RAID integrity would fail for no good reason upon bootup, that I simply stopped turning my server off.

My brother the “professional network admin” has been reminding me for years that Software Linux RAID is the best RAID. So after this tragic failure (no data lost, just some hair), it was time for something different.

My brother and I have been talking NAS (Network Attached Storage) devices for a while, he himself trying a few over the years, to really sub-par results. Generally, the prices were terrible for completely sub par hardware that couldn’t perform. Popular NAS like the Drobo start at like $700, yuck! The best bang for buck always seemed to be building a server.

Actually, bang for buck wise, building your own file server is still cheaper. But Linux is a delicate mistress. I am a coder, and dealing with game console development tools and Linux setups over the years has taught me how to live comfortably in Linux. I work on Windows though, just I do it with Cygwin and MinGW/MSys.

That aside, there is still too much sh*t to learn about Linux. Time is money. Building and maintaining another server, I’ll be honest, I don’t want to do it (FreeNAS was suggested on my Twitter, for anyone in a more adventurous mood).

It’s 2011, give me a drop in solution that’s cheap, small, fast and good!

Blam! Hello Synology DS211j!

This 2 drive consumer model rakes in at around $200, size not much larger than an eternal casing, and sporting a 1.2 GHz ARM processor. ARM! Hey! I know those!

It runs a breed of Linux, interfaces via gorgeous fast HTML UI, and support fancy Linux favorites like SSH out-of-the-box. Well not quite out-of-the-box, as you do need to download the latest firmware and a setup tool for your OS, but that’s easy.

Mine I filed with a pair of 3TB Hitachi Deskstar drives, spinning at 7200 RPMS with 64 MB of cache. Western Digital Caviar Green drives were $40 cheaper each, but are known to be slow and problematic on RAIDs (though there are fixes, a tool WDidle3 seems to address this). Again, time is da mon-nay, and wanted something I could just drop in. Benchmarks said these drives were better overall performers too, so hey, why not!

A stock image I borrowed from Synology. UI has lots of wild features like Music Player, Photo Viewer, and more, all built in (Java Plugins). The user interface is really great. Smooth like being right on the machine, but it's a virtual operating system that runs right in the browser, done in HTML+JS and PHP. You can actually try it online. Click the image.

Hardware setup was a matter of unboxing, opening it (sliding case sides front and back to unlock), plugging my drives in, screwing them in, and closing the casing (opposite of opening). I think I had this done in 5 minutes, max. Didn’t even need a manual.

Building the array I wanted (MODE 1) was extremely straightforward, that I wont both talking about it.

What I will talk about is some of the advanced stuff I wanted from it, and the configuring done to make it act accordingly. After all, this blog post is actually for me, so I can know what I did in case I need to reproduce it.


On the Journey to Live Coding

Saturday, August 13th, 2011

This past couple weeks I’ve been busily working on architecting many little things (super important things) for my new game. One of the big things I really didn’t set out to do initially, but once I realized my efforts were converging there, I decided to make it a priority: Live Coding.

I am using a scripting language Squirrel to handle the gameplay side of the programming. This is new for me, having hardcoded or written my own sub-par scripting and data entry dialects to make my prior games.

I opted for Squirrel over LUA due to its similarities to C and C++. It’s created by a fellow gamedev, so issues we have with the LUAs of the world are taken in to serious consideration. It counts from zero (!!), uses C/C++ style comments, has an integer type, uses float instead of double, uses reference counting instead of a GC, and most importantly: uses a file extension “.nut”… LET THE TOTALLY SILLY LATE NIGHT CODER JOKES BEGIN!

Performance benchmarks of Squirrel 3.0 place it on-par with the non-JIT LUAs. There’s a well known scripting benchmark that shows Squirrel doing poorly (Version 2.2), but a friend did his own benchmarking recently that shows things have dramatically improved. Another dev informed me that LUAs JITs are now available on ARM and PPC, and at least the ARM benchmarks are a huge improvement (PPC not so much). Apple still has their execution policy in place, making a JIT useless, but that aside I value my own sanity and prefer not-to have to switch my brain in to coding thinking too far away from my comfy C/C++, and admit there are elegance improvements to be made over that (I see working in Squirrel to be a potential improvement… maybe!).

On Live Coding again, I see it as more than just code. Right now it’s only script code, but very soon I plan to extend this to other forms of game content (textures, models, shaders, maps, etc).

My Live Coding setup is bound to the Window focus. When the game re-gains focus, a process of scanning content begins, and any assets found to have changed are reloaded. Pictures:

Script before modification. Showing a no-change refresh. Currently just text printing that AWESOME line.

An ALT+TAB, some munging with the Main.nut script file, an ALT+TAB back in:

After modification, things go from AWESOME to SILLY. Tom is an instrument.

Assuming there were no errors, script is recompiled and executed, so that it re-overloads the referenced functions.

I’ve given myself a relatively short timeline on this game, considering what I want from it, and considering all the distractions I have in the coming weeks (I am moving early September). I want something playable by IGF Submission time (October 17th), though I’m undecided if I am entering (unlikely far enough). I want it VERY playable for GDC (March 2012). I want to be shipping on the first platforms late Summer 2012, so roughly a 1 year timeline. Being able to SUPER-RAPIDLY do and test something in game is VITALLY important if I’m going to make it.

Currently the Live Code system is set up for Squirrel scripts, the language all gameplay code will be written in. Next up I need to add support for Shaders, Textures, and 3D models. Search paths are already set-up to pull files from the source folders first (unless a release build, then native/optimized content gets loaded first).

Next weekend is Ludum Dare, so I have a little bit of work to do there in the near term. I am hoping to have several forms of Live Code-able content ready to be used before we begin the event. Fun fun.