Fleeting Thoughts

For anything greater than 140 characters...

Jul 14

Apr 26

First test for the RockHopper!

Took the Specialized RockHopper SL 2011 on its first proper test today - a beautiful offroad adventure in the ‘wilds’ of Couldson’s Happy Valley. Great fun - the bike performed well, especially on the final (fast) descent back into the valley…love my front suspension!

Medium Happy Valley Route - from The Fox, via Farthing Downs, Chaldon Church and Alderstead Heath Share your bike routes @ Bikely.com


Dec 8

Reputation Systems for Good Causes


Recently, Facebook profiles have been awash with cartoon character avatars - designed to raise awareness of the NSPCC (a UK-based children’s charity). 

Although apparently nothing to do with the NSPCC officially (http://www.dailymail.co.uk/news/article-1336035/Facebook-cartoon-character-campaign-NSPCC-charity-says.html) the online campaign has polarised many Facebook users, with many changing their avatars in support and many more refusing to do so. 

My take on the whole event tends to follow the latter opinion, and more generally, the opinion of Malcolm Gladwell on social network ‘revolutions’ (http://www.newyorker.com/reporting/2010/10/04/101004fa_fact_gladwell). In the case of the NSPCC campaign, what ‘social effect’ does simply changing one’s avatar actually have? I’d argue ‘none’ other than to promote a Facebook meme. More disturbingly, I believe that most people who’ve changed their avatar actually believe (to some degree) that they’ve made a change.

Just like puffing on a placebo nicotine inhaler gives the ex-smoker the illusion of smoking, so too does a charity avatar change (be it a children’s cartoon, a green Twitter icon for an Iranian election or a poppy icon during Remembrance week) give the social networker a ‘charity placebo’ effect. The feeling of ‘doing something good’ is provided by making a change to a profile setting and the middle-class pang of guilt is temporarily appeased. 

Real change, particularly change that worthwhile charities attempt to deliver requires real donations from people who are influential within their networks. 

Isn’t it about time that charity sites such as Justgiving.com tapped into this general intention to do good that expresses itself through customised avatars?

How about JustGiving taking micropayments through Facebook and Twitter and giving those donators the capability to update their profiles/avatars in a unique way, specific to the cause? The nearest analogy I could think of is military ribbons - awarded to combatants who participated in key events during a campaign.

How about a micropayment donation that automatically triggers an updated (time-limited) avatar ribbon to be displayed on the user’s social network homepage? Heck, how about adding a medal cabinet to a user’s facebook profile containing ribbons for all the good causes that have been supported?

Not only can social networks show off their ‘limited edition’ pins and ribbons in this way, but charities genuinely get the chance to leverage the generosity of competitive donators. 

Could this be implemented using Facebook credits? Micropayment systems such as Flattr.com? Farmville coins? Or is there another way?


Nov 13

Looking into the RCA Secret 2010

Some of my early favourites from the annual secret postcard sales from the Royal College of Art in London.

Image 3

80

83

(possible Tracey Emin?)

95

(from my old Printmaking teacher - Antony Lee)

Too obvious for a Hirst?

Another Emin?


Jul 4

Rails Part 3: Creating a Cart

Had a bit of an absolute nightmare here - one of those ‘oh yeah, I think I’ve followed the code carefully, but…’ moments. Just couldn’t get the darned thing to run without errors

Eventually decided that the only way I was going to make progress was by (sadly) trashing my earlier code and stepping through the sample PragProg code provided on their website… a clash of Rails versions later (2.3.5 versus 2.2.2 - resolvable via the environment.rb file) and we’re back up and running…phew!

Creating a cart showed me how to create user sessions on the database using the rake db:sessions:create command (and then migrating the new DB code). I also created a cart as a class (strictly, a ‘Cart’, I suppose) and learnt about the use of attr_reader to make properties of my class available to the system. I defined a couple of methods in the class and learnt how to call them from a button that was defined in the index.html.erb view.

I went through a couple of iterations to ‘smarten up’ the cart (mainly by introducing a CartItem class) and made sure that users would see a clean display of their chosen items.

I learnt some error trapping using the Flash process as well as controlling error flow with redirect_to :action => ‘index’. The errors were displayed nicely by further fiddling with the CSS. 

Finally, I added functionality to ‘empty’ the cart in several places (add_to_cart.html.erb and store_controller.rb). Again - pretty easy, just a button of the form:

<%= button_to ‘Empty Cart’, :action => ‘empty_cart’ %>

and the appropriate 

def empty_cart

end

definition in the store_controller…nice!

Hopefully - back on track…just in time for the Ajax-ification of the website in the next installment!


Jun 28

Rails Part 2: Adding a Catalog Display

So - on to Part 2 - and I’ve covered the following ground…

  • Created a new controller to handle customer interactions

Using the ruby script/generate command again, but this time adding a controller rather than a scaffold.

  • Implemented the default index action.

In the script/generate command, to implement the index action, simple add the word ‘index’ after the controller name (‘store’)

  • Added a class method to the Product model to provide a list of items for sale.

Back over in Products.rb, a small method was added (using self.methodname to ensure that it is a class method rather than an instance method) to list out the products.

  • Implemented a view (via a .html.erb file) and a layout that contains it

The index.html.erb view was the main way to create specific ‘index’ content, but by creating a store.html.erb file in the app/views/layout folder I managed to create an overall layout for the component that uses the expression <% yield: layout %> to include other pages within this layout. 

  • Use a helper to format prices the way I want

Nice and easy to implement via <%= number_to_currency() %> - seems to default to US Dollars, so I’m not sure how that would work if you want to work with e.g. GBP….but I guess we’ll see?

  • Added a button to each item to allow people to add it to the cart.

A simple modification to the index.html.erb template with a rails helper <%= button_to ‘Add to Cart’ %> making things easy.

  • Made a simple modification to a stylesheet.

Using Dreamweaver (to make CSS modifications easy), updates to the provided depot.css allowed me to make a nice clean template, and to orientate the buttons within the main page. CSS - so powerful, but incredibly dull to learn, eh?

Also completed the ‘extra’ exercises - adding time/date to the side bar was straightforward using <%= Time.now %> in the store.html.erb. 

Adding a hyperlink to the book’s image was a little bit more tricky and required a deeper look at the link_to syntax:

<%= link_to image_tag(product.image_url),

      { :action  => :add_to_cart, :id => product },

      :post  => true %>

Finally, tinkering around with the number_to_currency() helper method allowed me to add GBP and other currency types to the formatting. Options are available to specify :unit, :separator, and :delimiter .

So - that’s the second part of the tutorial completed. In the next lesson, I’m learning how to create the shopping cart itself! See you then!


Jun 27

Learning Rails. Again.

I’ve decided to remind myself of how good Rails is as a development and prototyping framework after my 6-month dalliance with the Semantic Web.

Picking up my dusty PragProg tome (Agile Web Development with Rails, Third Edition) I got down to business with hacking together their example of a web site cart, which will hopefully refresh my knowledge of all the Rails essentials whilst building something vaguely useful.

Task A was building a product maintenance screen - took me about an hour. 

The steps included:

  • Creating a development database (SQLLite3) and configuring the Rails application to access it.

This step was almost trivial - I’ve forgotten how easy a Rails scaffold is to implement, although I’m still thinking that its main purpose is to convince newbie Rails developers that ‘Hey, Rails is easy’! 

  • Used migrations to create and modify the schema in my development database and to load test data.

Already, I can sense that migrations are a really cool way of tracking change in a development - the Rails framework ‘knows’ how to apply changes based on the UTC timestamp on the migration file. Using a migration script to load in test data is really handy, as all entered data gets wiped upon each reload.

  • Created a products table and used the scaffold generator to write an application to maintain it.

With Rails, it’s a one-line script to generate the scaffold, which does 90% of the work. However, then you spend the next 30 mins editing the scripts…is it faster to create from scratch…?

  • Augmented the generated code with validation.

Since Rails is MVC (Model-View-Controller)-based, all of the validation so far is in the model (products.rb) - again, adding checks for presence, ‘numericality’ (love that) and custom logic is really nice and straightforward…custom functions dip into hand-coded Ruby so it’s nice to get a refresher on that too.

  • Rewrote the generic view code with something prettier.

Well…copied some files from the Pragprog.com website…not sure *I* did much here, but it sure does look purrrrty! :-)

Will update more when I move onto the next task - Catalog display.


Apr 26
spirited away (by cloudy images)
Here&#8217;s my recommendation for a great pinhole effort as part of World Pinhole Photography Day (thanks for the heads up Photojojo!

spirited away (by cloudy images)

Here’s my recommendation for a great pinhole effort as part of World Pinhole Photography Day (thanks for the heads up Photojojo!


Nov 25

Serendipity and O’Reilly

Over the course of a short number of weeks, I’ve come to realise that Tim O’Reilly is one of the most important people that I follow on Twitter. Important, influencial and potentially life-changing.

I noticed a tweet from @timoreilly

RT @mattcutts How did I miss out on this blog and upcoming O’Reilly book? http://bit.ly/14eucg “Building Web Reputation Systems”—what fun!

which resonated because I’ve been interested in web-based reputation systems since a former colleague @paulmjoyce discussed with me the various options he considered for reputation on his home-brew project http://www.thebuzz.at.

Little did I know the journey I was about to take…

Following the bit.ly link took me to a work-in-progress blog and companion site for the upcoming O’Reilly book ‘Building Web Reputation Systems’ from a team with a close involvement to the Yahoo! Answers portal. Without searching too hard, I came across a ‘beta’ version of the full book available for critical ‘crowdsource’ review and comment - it captured my imagination and I spent most of the following weekend devouring its advice and reviews.

And then the O’Reilly ‘intertwingling’ began to take hold - Building Web Reputation Systems contained references and links to several other O’Reilly titles - Web 2.0 Architectures and Designing Social Interfaces. Somewhat serendipitously, I received an e-voucher from O’Reilly at the same time offering Buy 2, Get 1 Free on E-Books - an offer I immediately took up on both of these (along with the Facebook Cookbook - for when I have a few spare hours to play!).

Web 2.0 Architectures was a fascinating read - covering the major architectural patterns such as Declarative Living, Tag Gardening and other key topics that make the most popular web-sites really tick. Designing Social Interfaces led me to gain a greater appreciation of design patterns, how they work, WHY they work and how they can be reused.

Designing Social Interfaces and Web 2.0 Architectures both had several references to ‘Ambient Findability’ - a 4-year-old study by Information Architect Peter Morville regarding how we search and how what we find changes what we are. The final link (for now!) led me to Gavin Bell's fantastic 'Building Social Web Applications' - another great page-turner for anyone who wants to understand what makes great social software.

In short, O’Reilly’s tweets have led me down an intellectual path that, in the space of weeks, means that I’ve accumulated more knowledge than I would have through possibly an entire year of a Master’s post-graduate degree. I’m astounded how much I’ve learned and I’m pleasantly surprised by how much I’ve retained. So much so that I’ve become very actively involved in Social Computing projects in my own company (a major investment bank) and am building a reputation as something of a subject matter expert.

A career change in the making? Thank you Tim O’Reilly - you’re inspiring. You have managed to produce a stable full of keen young technology writers who have produced a series of very readable, very relevant and highly engaging books on subjects that (although actively changing in the marketplace) will remain the gold-standard for some years to come.