Windows 8 still can't set your timezone for you

Written on 27 Mar 2013

After setting up a handful of Windows 8 laptops it dawned on me that the much debated operating system still refuses to set your timezone based on your region selection.

You'd think by now that when you tell Windows you are in the UK and would like a UK keyboard layout, it might be able to then set the timezone to London/GMT/BST.  Nope.  Still defaults to the US West Coast.

The [Ramaze] flash isn't just for messages

Written on 24 Aug 2012

Interesing piece on The Pug Automatic about creative uses for the Rails `flash` function.  Although the implementations differ, the Ramaze version of `flash` will enable you to do much the same things.

I particularly like the idea of passing down "one off" event data to a JavaScript embed, so you can potentially fire of Google Analytics (or other) tracking messages on a one-off basis, without having to embed excessive controller style logic in your views.

A good reminder in the comments, as well, about not caching any views where you are likely to be using this, as people will either end up with other people's flashes, or stuck with the same flash for X minutes/hours.

Read more...  

Ruby Hash Fetch and Default

Written on 21 Aug 2012

I've been subscribed to Rubyflow for a while now, and it yields a few gems (sorry) every now and then.  Today is Dan Watsons' quick post on setting a default value for an empty hash key value:

order = hash.fetch(:order, :desc)

And of course, the comments give us another great tip on setting the default value accross the entire Hash:

h = {} ; h.defaut('my_default_value')

Which can then be shorthanded again in the initialiser:

irb(main):003:0> x ='my_default_value')
=> {}
irb(main):004:0> x.keys
=> []
irb(main):005:0> x['no_keys_but_default_value']
=> "my_default_value"

Handy indeed.

Dan's site here...

Ramaze on AppFog

Written on 20 Aug 2012

Ramaze is documented to work on Heroku without too much issue, and I wanted to see if you can easily deploy a Ramaze based web application to the new PaaS kid on the block, AppFog.

AppFog is documented to support Sinatra and Rails, so it was never going to take much to get another Rack based framework (as Ramaze is) up and running. The only real consideration is the Gemfile, which perhaps we are not so used to using in Ramaze land, because bundler is not avidly advocated here as it might be for Rails or Sinatra.

Deploying a vanilla Ramaze app to AppFog

Before you can do anything on AppFog, you need an account - so go and signup if haven’t done so yet. You will also need to Ruby-powered command line utilities to provision and deploy your apps:

gem install af

Now we are done with that, the next step is to create a new Ramaze app:

ramaze create ramaze-appfog && cd ramaze-appfog

Now we need to create a valid Gemfile in the root of the new application, the file should contain:

gem 'ramaze'

Now the relevant gems need to be packaged up for the af AppFog command line tool:

bundle package

Now we can deploy this puppy! It really can be as simple as:

af push

Make sure you are in the root directory of the app for this, as the af utility is able to determine a few things about the type of app you are deploying. You will need to either accept the defaults or give some sensible answers to the following guided wizard:

af push
Would you like to deploy from the current directory? [Yn]: 
Application Name: ramaze-appfog
Detected a Rack Application, is this correct? [Yn]: 
1: AWS US East - Virginia
2: AWS EU West - Ireland
3: AWS Asia SE - Singapore
4: Rackspace AZ 1 - Dallas
Select Infrastructure: 2
Application Deployed URL []: 
Memory reservation (128M, 256M, 512M, 1G, 2G) [128M]: 
How many instances? [1]: 
Create services to bind to 'ramaze-appfog'? [yN]: 
Would you like to save this configuration? [yN]: Y
Manifest written to manifest.yml.
Creating Application: OK
Uploading Application:
  Checking for available resources: OK
  Processing resources: OK
  Packing application: OK
  Uploading (1K): OK   
Push Status: OK
Staging Application 'ramaze-appfog': OK                                       
Starting Application 'ramaze-appfog': OK 

Most significantly, you will have to change your app name (if you are deploying on the same infrastructure zone). Other than that I went with defaults, apart from writing out the manifest.yml configuration information to file for future use.

And then you are done - you can see the fruits of this labour over here: - remember that, as with Heroku, there is no persistent file storage (at the moment), so any app/user generated files need to be stored elsewhere, or in a database on AppFog.

Now you can knock yourself out with the deployment tool docs: here. Enjoy!

The Ramaze Wiki Lives

Written on 18 Aug 2012

Following some discussion on the Ramaze group (Google Groups), I am thrilled to see the Ramaze Wiki is being rekindled under the Github Wiki banner.

The old Ramaze wiki had some great content in, stuff that never quite found a place in the official docs.  There has already been a surge of contributions to the new one, and I am hoping to add a few pages over the next week or so (specifically unicorn deployments, and integrating rack cache on your actions).

Check out the new Wiki on Github

Copyright © 2006 - 2019 Kester Dobson