Archive for the 'Programming' Category

Unix shell scripts

Lately I’ve been using my macbook and imac side by side with one shared keyboard and mouse using Synergy. It works an absolute treat. However, I am bored of typing in commands in Terminal to get Synergy going so I’ve made my first shell scripts to allow my usual double clicking behaviour.

I’ve used Textmate to make two files, synergys.sh and synergyc.sh.

To start the server on the imac:
#!/bin/bash

echo "Starting synergy server"
/Applications/synergy-1.3.1/synergys -f --config /Applications/synergy-1.3.1/synergy.conf

To start the client on the macbook:
#!/bin/bash

echo "Starting synergy client"
/Applications/synergy-1.3.1/synergyc -f computername

and don’t forget to make it executable:
chmod +x filename.sh

and/or if you want it to be double clickable just rename the script to filename.command

Thanks d3vo for the pointers!

Mindscape are dreaming

Our neighbours up here in Pipitea House, Mindscape, are in this weeks’ Infotech. Apparently they’ve just released BackgroundMotion, not so surprisingly (since all the content is for Vista Ultimate’s DreamScene), Microsoft is pleased about it. I wonder if I’d like having a subtle video as a desktop background? Might be soothing. Unfortunately as I don’t have Vista Ultimate installed on my lappie I can’t try it out. In any case, nice clean looking website - and you can download the website sourcecode by clicking View Code at the bottom. Cool.

It’s great how I hear about what they’re doing by reading the newspaper 15 metres from their office ;)

Finally trying out Silverstripe

So after knowing the team at Silverstripe for years and thinking for the same amount of time that I should try out their CMS, I am right now giving up my Saturday to do just that. It suddenly occurred to me that I should blog about it while I do it. Please remember that this is not so much a review as my log of my first encounter, I may well be an idiot (but if that be true, I could hardly figure it out for myself now could I), and by the time you read this, there could be a new version of Silverstripe. I am using 2.01.

I am going to rebuild the Spikefin website. Currently it has no CMS although in truth that is no big deal when you are both the developer and maintainer of a site. Something I expect to change over time as I have been the maintainer of the Spikefin site in name only (the “mechanic’s car” syndrome).

First, lets start with the reasons I have taken so long to give it a go:

  1. It’s written using PHP, I don’t know PHP, and PHP is a recursive anagram which makes me think there will be other things about it designed simply to confuse me so that other people can laugh at me.
  2. When I first found out about Silverstripe I honestly thought they were a little crazy for trying to build a world class CMS when there are so many others already. Also I didn’t want to pay a monthly fee for using it (even though they offered it to me free multiple times when we shared office space at Creative HQ, I didn’t want to be that annoying “customer” that doesn’t pay properly or at all but still expects top service).
  3. I really have been wanting a Java based CMS or some mythical perfect mix of Java and Flash that was custom built for me. Its been a case of not really knowing what I want but wanting something nonetheless, so ending up with nothing.

So why give it a go now?

  1. Because it is now open source. To me this signals a coming of age. It is a brave thing to open up your code to criticism from a very critical community.
  2. Because Spikefin really needs a new website and I don’t want to be the sole person maintaining it, so might as well use something that nobody at Spikefin knows so that we are all on equal footing when it comes to making a change.
  3. Because I am very interested in what other local companies are achieving and would like to whole heartedly support them. Also, I regularly refer people their way and need to validate that the product is any good if I am going to keep doing so ;)

Ok lets get moving.

INSTALLATION

First I downloaded the php-based installer and ran it on a linux server. I was highly impressed when it told me exactly what things were not up to scratch on that machine, namely I need to upgrade PHP and MySQL and allocate more RAM to PHP. These things are not an option right now on that box, so…

Second I downloaded the Windows installer and ran it on my XP laptop. All sweet (of course, I hear you say, but I am always wary of anything that installs servers, dbs and uses ports, presuming that I will end up spending hours scratching my head). I now have a default site accessible at http://localhost:3000/home/. My first question is whether I have to have that “home” bit there for the homepage? I’ll see about that later.

NOW LETS START USING IT

Log in using defaults. Not asked to change them, easy enough to do under Security. Tried to set up a name for my site and basic settings (whatever they might be) like that, can’t find where to do that though.

Everything looks very nice. The fading tooltip in the bottom right looks nice too, but it is a disparate rollover to which I am fundamentally opposed - good for status messages but bad for tooltips.

Went looking for presentation related settings. I guess I was expecting to find some sort of theme chooser. Clicked through the help docs but they don’t mention any presentation related topics in there. Found *a* theme on the silverstripe website and installed it. Having made no content changes the layout was screwy for the example homepage so I uninstalled it again for now.

Ok now following tutorial 1. Pretty much what I’ve done so far. Install the theme provided there. Looks the same as the default?

So I get that Page.ss is the template file. I’d like to have been recommended something to edit/view it with already and told how to configure that something so that I get code colouring. Presume ss stands for silverstripe. I thought it was stylesheet to begin with. I’ve chosen Notepad++ to edit the file for now. Added ss to the User Extensions for HTML under the Settings -> Styler Configurator and reopened the file. Colourful.

Making progress. Good tutorial btw. However, I have a problem. The home page has disappeared from the live site. I’ve made a few more pages and published everything, and visited with ?flush=1 to clear the template cache, but the Products page is behaving like the home page, actually it just seems like the navigation is screwed in general. AHA! I refreshed the whole admin page and found that actually the home page has become a child of the products page and some other page is a child of that in there. No wonder I was confused. How did that happen? Several pages now show as unpublished. Bit more drag and drop and now its ok. Is there no way to publish everything at once?

Getting my priorities straight, I am trying to make a page called Fish Fun where I want to put the Spikefin Slalom Game for now. Have put my swf in the assets folder and clicked the flash icon on the toolbar in the CMS. I’m told to choose a folder from a dropdown box but there’s nothing in the box to choose from. Stuck. Ok sorted for now, have just found the html button and put the flash object tag in there myself and that seems to have worked fine. Onward with the tutorial. New templates…

Having real trouble getting it to use my new template for the home page. Seems simple enough but it just isn’t changing. I’ve flushed the cache. I’ve triple checked my settings and the filenames. Stuck. Ok sorted now, it seems that I need to run the db build each time I add or remove .ss files (not just ?flush=1) which I didn’t gather from the tutorial, I thought it was just php code pages.

Tutorial 1 now complete. Time for a coffee.

Ok Tutorial 2 has gone without a hitch. Great news. Makes me think my father could be using this himself to build his new Mayfield Audio site that he’s been wanting for years… Looking forward to the blog plugin though. It seems a little silly to create a page for each news entry.

Tutorial 3 has been going well, except that I ticked “Email form on submit” which has given a bunch of problems. Guess I’ll leave that for now. Definitely want a contact form to be sending messages through as email though. Racing a bit now. Skipping the poll creation, looks pretty cool though.

Tutorial 4. Site Search.

There we go. I now have the basics of a new Spikefin website. Better write some content!

Conclusions thus far:

  1. Silverstripe is very good.

Project Day

For a long time now I have treated Sunday as Project Day. A lot of people do this actually, its the day around home that you embark on some project, most times you won’t finish it, and quite often its not a very big project. Putting up a new shelf in the kitchen, planting some herbs, building a lego robot, doing a painting… all qualify as long as they aren’t your normal work.

I have been thinking that I’d like to build a web application to manage and prioritise my list of Sunday Projects. Then, naturally I thought it could track anybody’s list of projects, and people could sign up and provide advice or feedback on others’ ideas; like “don’t use [blah] brand of [blah] to fix that [blah] because its no good.” or “make sure you put your herbs in a sunny spot that doesn’t get much wind or the dirt will dry out too quickly.” or whatever. And then I thought it might be cool if people could volunteer to help each other out on their Sunday Projects. Might be a fun way to meet people AND get stuff done.

So some day, some Sunday, maybe I’ll sit down and make my wonderful web application.

My life in my pocket

So I got a 4GB USB stick for xmas. In trying to come up with the most productive use for it (rather than simply storing a bunch of music etc) I have spent the past few hours installing a whole lot of Portable Apps for Windows onto it. This way I really won’t need to carry my laptop around. So far I’ve got working:

  • Portable OpenOffice, Firefox (with my fav extensions), Thunderbird, Sunbird, ClamWin, Suduko and Gaim from the PortableApps Suite
  • InstantRails (incl. Apache, MySql, phpMyAdmin) and RadRails (requires JRE on the USB stick or on host computer)
  • DSL 3.1 (Damn Small Linux - Embedded version, just download and run, what fun!)
  • Portable Skype (it works with Skype 3 even though the website hasn’t been updated yet)
  • Portable RSSOwl (it works with RSSOwl 1.2.3, just replace the main app folder)
  • Inkscape
  • IrfanView
  • GIMP Portable
  • Notepad++
  • NVU Portable
  • PortaPutty
  • WinSCP Portable Edition
  • 7-Zip Portable
  • CDex
  • And I still have more than 3GB remaining!!

Some apps required special “Portable” editions, mostly when they would normally make use of the Windows registry, and some you can simply decompress or install and then copy/paste onto the stick.

Initially I was planning to somehow squeeze Ubuntu onto it and then install all these (or equivalent) applications and run them that way, but this seems more sensible for the time being. The next trick will be setting up automated backups, data security, and virus protection (it has ClamWin already but I have to remember to use it).

Agile Web Development With Rails - updated

I just received my third update to the Agile Web Development With Rails book from the Pragmatic Programmers. I really like this whole beta thing that the world has gotten into, getting hold of things when they’re nearly ready is great. I get it earlier, I see the updates often and appreciate the little enhancements as they go in.

Spikefin on Wheels

Spikefin Lego Logo

Look how modular it is. I was able to have a prototype model working in under 5 minutes. Plug and Play. It even has a reflection. It must be Web2.0. I name it spikr.

Spikefin on Wheels.

Partnr Competition

So who has the fastest web development framework? A couple of local techos are willing to put their reputations on the line to find out… I’ve come up with the application concept, now they will race to provide the working technology. In line already we have Ben Nolan using Rails and Sam Minnee using Silverstripe. Can you beat them?

Ever found yourself floundering with too many partners to keep track of? (well, neither have I) If so, then this is the application you’ve been waiting for. Check out the competition rules. (Notice I’ve been playing with Google Docs. Works surprisingly well).

Andrew’s Simple UI Guidelines for Programmers

Screenshots are your friend
Follow them precisely as this will save you lots of time and tedious refinements later. It will also train the UI designer to give you exactly what you need.

Everything on the screen should visually line up with something else
Alignment is close to godliness. Well actually, it just has the same x position (to the pixel).

Consistency is King
This applies to margins, padding, colours, fonts, font sizes, font emphasis, text block locations, use of interface components (like dropdowns, checkboxes, radios etc), animation styles, button sizes… Consistent. CONSISTENT.

Use the prescribed colour palette

Colour approximations are NOT close enough. If you don’t know the correct colour, then just use something WAY OFF until you are provided with the correct colour hex number, which will be moments after the designer, manager or client sees bog standard magenta on the interface.

If the sentence or button label you are about to use is valid SQL then think again
It is difficult to think in English and in code on the same day. If the choice has been left to you, try to write something that will not insult, bore or frustrate the user, contains no “humour”, and then create a Trac ticket to get this wording reviewed when convenient.