I’ve finally found a great use for Google Wave that DOESN’T require all your friends to be on it.

It’s this, a to-do list!

Ash-Google-Wave

It has been a great tool to synchronize the day-to-day activities of the family.  @MrsAngell and I have been using it to help manage the kids, and the household and the general stuffs needed, in preparation for Christmas, for example. Traditionally, we’d use IM clients such as Skype to communicate messages and synchronize our activities, using Outlook and Google Calendar only when absolutely necessary.

But for some reason, despite being massive email users, we very seldom email each other.  But the problem with this is that its difficult to read history and if we don’t have access to our computers – we cant read our histories and re-read what was discussed.  We made it work, but it had its problems.

Even though Wave is so much more capable than this very small and isolated use-case, I have to admit, it does do this very very well.

Since the only people who need to collaborate on this topic is myself and my lovely wife, the collaboration “issues” people have been complaining about with Google Wave doesn’t really apply. If you’re not familiar with what I am talking about, check this out:

zVn91

In either case, we’ve been using Wave to manage our daily lives and to make notes and comments to each other about various needs of the household and the family – and so far, it’s working just great.

It might seem weird to other people that my wife and I even need a tool like this, but as an organizationally challenged individual like myself, I find it’s making life just that little bit easier.

Form Select Helper in Ruby on Rails

It’s crazy how little documentation there is on using selects (drop down lists) inside form-helpers in Rails.  So, it can get quite confusing when it comes to using the different select helpers; select, select_tag and collection_select.

In order to address this inadequate documentation and examples, I thought I would post here, some of the differnces between them with some examples so you can choose for yourself, the best one to use.

The selection box has some key parts, the name, which is required, and used by the browser when submitting the <select> choices to the server. The option tags, each of which are made up from a “value” and “text” pair, the “value” to identify the select item in the server, and the “text” which will be displayed to the screen.

There are three different select form helpers in ruby on rails, “Select”, “select_tag” and “collection_select”. Let’s compare them.

 

select(object, method, choices, options = {}, html_options = {})
Defined in ActionView::Helpers::FormOptionsHelper

 

<%= select( "payment", "id", { "Male" => "1", "Female" => "2"}) %>

Select can be used in conjunction with a model object as seen in this example, an instance variable is passed into choices, but is being converted into an array of arrays.

<%= f.select :gender_id, @genders.map {|r| [r.name,r.id] } %>

Use select_tag when you require a drop-down selection box populated with data not sourced from a database, and are happy to hard code the default selected option tag. Select_tag should also be used when you want to process your form as a GET, rather than a POST.

<%= select_tag "payment", options_for_select([ "Male", "Female" ], "Male") %>

or

<%= select_tag "payment", options_for_select(%w{ Male Female }) %>

You can also do multi-select boxes:

<%= select_tag 'payment[]', options_for_select(@genders),
  :multiple => true, :size => 3 %>

(where the controller defines @genders as a hash of values).

In this example the gender methods are being added to the select box via a model object, notice how we use the option, :prompt to add an additional option tag to the select box, which will be selected by default. Note that if @object.method matches one of the option tags, this will be selected by default, and :prompt wont appear in the list.

<%= collection_select(:gender, :id, @genders, :id, :name,
  options ={:prompt => "-Select a gender"}, :class =>"gender") %>

In sum:

Use select when you require a basic drop-down selection box populated with data not sourced from a database.

  • The object is the name of an instance variable. This is typically a model object (singular name of the table whose data your displaying, or in other words, the table record).
  • The method is the attribute of that instance variable. This is typically a field/column of the table whose data your displaying (really an ActiveRecord method).
  • Together the object and method specify the name of the select statement in the generated html choices can be any enumerable object e.g arrays and hashes and results of database queries, and contains the option tags for the select box.
  • The optional options argument takes various “options” some of which are listed below in the examples.
  • The optional html_options argument allows css to be used for styling the select box.
  • If one of the option tags in choices matches @object.method, that option tag will be selected.

Use collection_select when you require a drop-down selection box, whose source is a model/object

  • The object is the singular name of the table whose data your displaying (the table record).
  • The method is the field/column of the the relevant data (really an ActiveRecord method).
  • Together the object and method specify the name of the select statement in the generated html collection takes the option tags for the select box, this can be a hash or array.
  • The value_method is the field/column to use for the value of the option tags in your html.
  • The text_method is the field/column to use for the visible text of the option tags in your html.
  • The optional options argument takes various “options” some of which are listed below in the examples.
  • The optional html_options argument allows css to be used for styling the select box.
  • If one of the option tags in collection matches @object.method, that option tag will be selected.

Some of the content for this post came from here – check it out for a more detailed explaination of the differences between the 3 select form helpers.

Disabling Censorship in the Aussie Version of the L4D2 Demo

left-4-dead-2-logo-600x307

buy levitra in france

If, like me your a slave to the ignorance and intollerance of Michael Atkinson and are stuck with the borked, “censored”, Aussie version of Left4Dead 2 – have hope.  As expected, I don’t think Valve has gone to extreme lengths to “lockdown” the censroship of L4D2.

It’s as simple as changing a single character in 2 files.

  1. First, download and then run the Left4Dead 2 demo.
  2. Quit (you don’t have to play it, the menu is enough.
  3. Goto your “steamappscommonleft 4 dead 2 demo” directory.  On my machine this folder is in “C:Program Files (x86)Steamsteamappscommonleft 4 dead 2 demo”.
  4. Edit the steam_appid.txt file and change “590” to “510”.
  5. Goto your “steamappscommonleft 4 dead 2 demoleft4dead2” folder.
  6. Edit the steam.inf file in notepad (or text editor of your choice) and change the “appID=590” line to “appID=510”.
  7. Go back to the “steamappscommonleft 4 dead 2 demo” folder and run the “left4dead2.exe” file.

You will need to run the game from the exe directly for this hack to work, and steam will report the game as “Left4Dead Dedicated Server” but, despite these, you should have a 100% bona-fide proper version.

Now while this works (and I am grateful that it does) I should never have had to do it.  Australia needs a R rating for video games.  We are one of the few countries that don’t.  And its not about getting raunchy or violent games – its about responsibility.  15 year old children shouldn’t be playing even the censored version of the game – plain and simple.  There are many other examples of games which are marketed and sold to 15+ year old children which simply shouldn’t be (Doom 3 for example).

And the fact is we would have an R rating except for the illinformed and rediculous stance that the Office of Film and Literature Classification has taken with video games. Video game classification in Australia is the most strict in the Western World in terms of not having an adult’s rating (R18+). Currently only Michael Atkinson, South Australian Attorney-General opposes the R18 classification introduction and is also blocking the release of a public paper that canvasses the opinion of the Australian public on whether or not an R18 classification should be introduced.

It staggers me that 1 person can get so much power to effect so many people through inaction.

It’s unconscionable.   Immoral.  And Irresponsible.