Category: Software
Schedule iChat Status with Cron
My mac at work is left on all the time, and I kept forgetting to log in and out of iChat at the start and end of the day. I wanted to continue using iChat for it's simplicity, OS integration and stability, so I looked into how to schedule iChat to go online at the start of each weekday and offline again at the end.
Luckily this is pretty easy on OSX thanks to the power of Applescript and the good old-fashioned cron scheduler.
The first step is to fire up Applescript Editor from Applications > Utilities and make two scripts. Applescript is pretty readable and self explanatory:
tell application "iChat" set the status to available end tell
Save this to your home folder as iChat_available.scpt
tell application "iChat" set the status to offline end tell
Save this to your home folder as iChat_offline.scpt
Now to test that they work, open Terminal and type
osascript ~/iChat_offline.scpt
...which should take you offline.
Now you need to add this to cron by running:
crontab -e
and adding the following lines:
30 8 * * 1-5 osascript ~/iChat_available.scpt 30 17 * * 1-5 osascript ~/iChat_offline.scpt
This will put you in vi, so to edit the file press i to get in insert mode, type or paste the lines, then press Esc to get out of insert mode, followed by :x (colon then x), then Enter to save and close the file.
These cron directives will set iChat to available at 30 minutes past 8, every day of every month on days 1 to 5 of the week, then offline on the same days at five thirty. If you want, you could add lines to take you offline or 'away' over lunch. Or annoy your friends by going online and offline every five minutes over the weekend.
ASCII game 1
I completed my first playable sketch for the Experimental Gameplay Project ASCII in February challenge. After reading the short brief, the most obvious idea seemed to be to make a game using ASCII to recreate graphics, but given my recent conversion to loving scrabble, I chose to think about word games. A double-switchback of obviousness.
I also wanted to get into Processing a bit more, so this first sketch is a java applet.
Like with Rectangulous I have chosen to make a contemplative toy free of time-limits but with a specific goal.
Performance is not very efficient, but this is the point of the rapid-prototyping methods of the Experimental Gameplay Project. I did improve word lookup speed a bit by splitting the wordlists into separate arrays by initial letter and sorting them by word length offline. I admit it's not graphically advanced or pretty at this point either. However, I think it has some interesting gameplay points, like zero-tolerance of mistakes. It seems to be quite good for practicing certain scrabble skills, especially learning the valid two-letter words and making use of minimal vowels once you start to run out.
Obscenity bookmarklet
Because the idea amused me, I decided to make a jQuery bookmarklet to add the word "fucking" to online texts. Bookmarklets (Buttons) are links you add to your browser's Bookmarks Toolbar.
Drag this link to your bookmarks and click to add a bit of colour to any page: Fuckinator
If you're using Internet Explorer or don't have a Bookmarks Toolbar, right-click on the button and click "Add to Favorites"
The sound of a tweet
As a javascript experiment, I made a form that turns a tweet into a sound: http://www.apfrod.com/tweetsound.html
Rectangulous - The Making Of
In this longer piece I will outline the history and process of making Rectangulous, a puzzle game for Flash and iPhone. I will talk about the creative and design decisions as well as the technical implementation details in chronological order.
Inspiration and concept
After seeing the Van Doesberg exhibition at the Tate Modern I was thrilled by the persistence of the De Stijl movement in their investigations of such simple elements
and strict rules. Having recently got into the Rubik's cube again, I had an idea to devise a puzzle game based on the patterns and dynamism of really basic
geometry explored in the paintings of Van Doesberg and Sophie Taeuber.

Counter-Composition V by Theo van Doesburg
I am a fan of simple puzzle games on the iPhone like Trism, reMovem, Flood-it!, Unify, Bejeweled and LineUp. I like them best of all when I can play as quickly as possible. SameGame is perhaps the grandfather of many of the games mentioned. I prefer the games that are more like toys, the way the Rubik's cube is. There may be a goal, there may be scoring, and you may choose to play competitively, but there are no penalties built into the Rubik's cube. I like that I can spend as long as I want thinking about a move, be that very short or very long. I like games in general that I can enjoy thoughtfully, exploratively and playfully without the stress of impending imperatives - perhaps the very opposite of twitch gaming. I'm also very attracted to the way these games have simple, visual mechanisms that satisfyingly slot together in their consistent internal logic.
I wanted to make a puzzle game that combined all of these values: utterly simple, with a limited colour palette; a rigorous, clean visual logic; very quick to launch; no time limits, no penalties. Ideally I wanted to capture the feeling of the minimal De Stijl paintings - the feeling that I wanted to manipulate those shapes - push around those adjacent rectangles held in mutual tension. Ideally the game would equally be a kind of interactive painting, and the user would want to take a screenshot when the composition was particularly attractive.
Some months later, after playing a lot of these games and reclining to dream, I came up with the basic idea for Rectangulous: a grid of colours, where the user can move coloured squares into empty squares, and so combine "joined" areas into larger shapes. The working title was "Stijl".
Download all tweets to a file
I found a post on archiving twitter data with python that would download all old tweets into a file in either json or xml format. Alas it didn't work right away.
Here it is adapted for Python 3 and the new twitter API
import urllib.request
username = "username"
password = "password"
format = "xml" # json or xml
filename = "tweet_archive.xml" # filename of the archive
tweets = 700 # number of tweets
#pages = (int(float(tweets)/float(80)))+1
pages = 35
auth = urllib.request.HTTPPasswordMgrWithDefaultRealm()
auth.add_password(None, "http://api.twitter.com/", username, password)
authHandler = urllib.request.HTTPBasicAuthHandler(auth)
opener = urllib.request.build_opener(authHandler)
urllib.request.install_opener(opener)
i = 1
response = ""
print
print ("Downloading tweets. Note that this may take some time")
while i <= pages:
request = urllib.request.Request("http://api.twitter.com/1/statuses/user_timeline." \
+ format + "?page=" + str(i))
response = response + urllib.request.urlopen(request).read().decode('utf8')
i = i + 1
handle = open(filename,"w")
handle.write(response)
handle.close()
print ("Archived " + str(tweets) + " of " + username + \
"\'s tweets to " + filename)
ShapeSeq for iPhone and iPod Touch
ShapeSeq is a deceptively simple musical instrument built to encourage instant play.
There are four primitive shapes to choose from representing four oscillators. As each shape is moved around the screen, the pitch and volume moves with it.
Every shape has it's own loop, and every movement is recorded on the loop for instant playback. As the loop can be varied by size and number of steps while it is playing, all kinds of new sounds and effects emerge.
Low contrast colour schemes
My eyes were feeling a bit tired today so I installed the Stylish extension and an excellent style called "NightShift - eye care" that changes all colours and even dims images. Another reason to stick with Firefox.
SInce I'm forced to use XP at work right now, I also installed this Zenburn Windows XP Theme (zip) based on one by Jason McBrayer. Zenburn is a low contrast colour scheme originally for Vim.
Now it's like my eyes are resting in a pool of cooling grey.
7 Extensions that keep me rooted to Firefox
I continue to be addicted to Firefox largely because of the following extensions:
Adblock Plus - development of the original adblock stalled a long time ago. I have barely seen a banner since 2001, and wonder how others cope.
FireGestures - Once you learn gestures, everything else is too slow. I've been through several other gesture extensions, and this one is the current favourite, although I do have to switch off a lot of options.
British English Dictionary - It's easy to forget to install your language variant dictionary, as US English is so often the path of least resistance.
Custom Download Manager - I like downloads in a tab not in a separate window.
Undo Closed Tabs Button - A tiny change, but so useful. Other tab options are available.
NoScript - For security and annoyance avoidance, turning off javascript is often a good idea.
Firebug - the last word in web development awesomeness.
Honourable mention to Live HTTP Headers and User Agent Switcher which I install when called for.
RIP IE - meet Google Chrome
Google Chrome has arrived. They've used many of the best user interface features from Firefox 3 (for example the amazing address bar auto-completion) and combined it with an already highly impressive speed and finesse for a first beta, to rival that of Opera
Here's the five features I instantly miss from Firefox 3
- adblock plus
- noscript
- / keyboard shortcut for quick find
- the ability to move the bookmarks toolbar to next to the address bar (but that might change because you can hide the bookmarks toolbar for open tabs)
- delicious plugin
I would miss FireGestures, except I'm using StrokeIt which works with any application.

