Make Me Smile - Steve Harley and Cockney Rebel
Make Me Smile - Steve Harley & Cockney Rebel
[v1] [chorus] [v2] [chorus] [solo] [v3] [fill] [chorus] {Repeat from Fill to fade}
[Verse 1] || [Verse 2] || [Verse 3] ||
|| || ||
N.C. F C G F || N.C. F C G F || N.C. F C G F ||
You've done it all, you've broken every code || There's nothing left, all gone and run away || There ain't no more, you've taken everything ||
|| || ||
C G || C G || C G ||
And pulled the Rebel to the floor || Maybe you'll tarry for a while? || From my belief in Mother Earth ||
|| || ||
F C G F || F C G F || F C G F ||
You've spoilt the game, no matter what you say || It's just a test, a game for us to play || Can you ignore my faith in everything ||
|| || ||
C G || C G || C G ||
For only metal, what a bore || Win or lose, it's hard to smile || Cos I know what faith is and what it's worth ||
|| || ||
F C || F C || F C ||
Blue eyes, blue eyes || Resist, resist, || Away, away ||
|| || ||
F C G || F C G || F C G ||
How can you tell so many lies? || It's from yourself you have to hide || And don't say maybe you'll try ||
|| || ||
[Chorus] || [Chorus] || [Chorus] ||
=================================================================================================================================================================||
[Chorus} || [Fill] ||
|| ||
Dm F C G || F C ||
Come up and see me, make me smile || ooh-ooh la-la-la ||
|| F C ||
Dm F C G || ooh-ooh la-la-la ||
I'll do what you want, running wild || G ||
|| Oooooooooaaaaaah ||
[Guitar Solo :] || ||
(The Chords are F /Em/F /Am/ Em/Em/G /G / Dm/F /C /G / Dm/F /C /G / || ||
|| ||
=================================================================================================================================================================||
[SOLO]
(No Chord) F Em F Am Em Em G G
E|----------------|----------------|--------------|-----------------|--------|-----------|--------------|------------12-12-12-|--12-13-15--|
B|----------------|----------------|--------------|-----------------|--------|-----------|------8-10-10-|-10-8/10\8-----------|------------|
G|----------------|----------------|--------------|-----------------|--------|-----------|--7-9---------|---------------------|------------|
D|----------7-5-7-|-7-5-7-7--5-7-5-|-5--5-3-2-3-5-|-3-2-0-3---2-0-0-|0-------|-------5-7-|-9------------|---------------------|------------|
A|----------------|----------------|--------------|-----------------|--3-3---|---5/7-----|--------------|---------------------|------------|
E|----------------|----------------|--------------|-----------------|--------|-----------|--------------|---------------------|------------|
Dm F C G Dm F C G G (Stop dead)
E|-15...13-12-|-13-12-------------|--------------------|--------------------|-13-12-----------------|------------------|-----------|---------------|-----------|
B|------------|-------13-13-12----|--------------------|--------------------|-------14-13-12/13\12--|------------------|-----------|---------------|-----------|
G|------------|----------------14-|-12--12-10-9-10-12--|-12-10-9------------|-----------------------|-14-12-10-9-10-12-|-12...10-9-|-7-5\4/5-5-4-0-|-0---------|
D|------------|-------------------|--------------------|---------12-10-9-12-|-----------------------|------------------|-----------|---------------|-----------|
A|------------|-------------------|--------------------|--------------------|-----------------------|------------------|-----------|---------------|-----------|
E|------------|-------------------|--------------------|--------------------|-----------------------|------------------|-----------|---------------|-----------|
trailing whitespace
One of the little things that is annoying me at the moment is getting commits in git that are only about whitespace. This is pure noise and makes the commit harder to work with. I've looked at a number of ways of fixing this, but have mostly failed.
Chameleon Bootloader
Just spent several hours pooching around with Chameleon Bootloader on my Hackintosh. I know have working bootloaders on two different disks, which is reassuring. Still got a long way to go. Want to summarise what I've learnt so far.
Features, Specs and Maps
The Map is Not The Territory
I first came across General Semantics in the works of A.E. Van Vogt. His stories from sci-fi's 'golden age' had a common theme about the infinite potential of 'the human nervous system' which was very appealing to a brainy weedy kid. Part of the development of human kind, in these stories, involved a rejection of Aristotelian thinking. This Non-Aristotelian thinking is based upon Korzybski's General Semantics. But wait a minute what has this to do with code and RSpec and Cucumber?
Vendoring rails using a symlink
Been meaning to do this for ages!
First of all clone rails from git hub into a suitable folder
git clone git://github.com/rails/rails.git rails.git
I like to give repositories like this a .git extension so can easily differentiate from local things, but you can call the folder whatever you want.
After the repository is cloned be sure to checkout the branch you want, in my case git checkout origin/2-3-stable
Now you can vendor your rails projects by going into the root folder of the project and running
ln -s /path_to/rails.git vendor/rails
Adjust the path as required.
Updating Passenger
Updating the passenger gem is a bit of a pain. Its dead easy to just to the gem update and forget to do the other stuff you need to do, especially if you update lots of gems at the same time.
Anyhow after updating passenger be sure to run passenger-install-apache2-module as root. Follow the instructions and update the passenger config (in/etc/apache2/other/passenger.conf on my work box)
Searching for empty form fields using rspec
Took me far to long to work out how to do this!
To find an empty input field we can look for
"input[type=text][value='']"
e.g.
response.body.should have_tag("input[type=text][value='']")
This is useful when filling in forms badly to make sure your bad values still remain when you return to the form to edit them.
Contextual Controllers
I've been struggling alot recently with controllers and with code written by my colleagues. During this period I think I've been making quite a few mistakes. One of the rules I generally like to make about things particularly in software is that if its stupid or doesn't work its probably your fault. This is a really important rule which is real easy to apply to anyone but yourself. So its really easy for me to spot others making mistakes by not applying this rule. When I hear people say Selenium doesn't work, or SASS is rubbish I can comfortably be a wise old owl and think, "ah they should just take a little more time and they will realise that these judgements are made hastily.
Another rule I like to apply is that we (human beings) are mostly ignorant about everything. Socrates (who at the time was considered the wisest of the Greeks) used to tell people seeking his wisdom that he knew nothing. This wasn't some glib bit of rhetoric to reinforce his social status. All his years of study had made him fundamentally aware of how vast knowledge is, how much depth any subject can have, and how little he really did know and understand. This ignorance goes far deeper than just a lack of factual knowledge and goes from the global to the intimate. Using this rule is really dangerous, its so easy to apply it to others and to forget to apply it to yourself, doing this results in smug ignorance. In fact the only value of this rule is self application. It is perhaps a more dangerous expression of the buddhist concept of a "begginers mind"
So what does this have to do with controllers
Well I've been struggling with existing code in our application and in particular with trying to keep code out of controllers. I don't want code in controllers for a number of reasons
- They seem to be much harder to spec than models
- It seems real easy for various bits of business logic to end up in them - where it is really hard to test
- Its real easy for important things like error messages to end up in controllers, and again it feels that this is the wrong place for them
- I'm just not comfortable with them, they don't feel like good objects.
Now I've recently been dealing with alot of existing code in controllers that I've not been happy with. In our application we are now treating addresses as a polymorphic nested entity that other entities can have. In addition we have introduced the concept of NamedAddress, which are special in the fact that they have a name and also in the way they persist. Both our controller and views; and our features and steps have struggled to isolate the addressable bit from the relationship with the particular parent.
During this process I've been learning lots, improving the code and generally working really hard on improving quality. Trouble with working really hard is that its really easy to work really stupidly and I've been doing that too. I've also been assuming that existing code is stupid. Take the following code in the index method of the OrdersController
def index
@pending_orders = @customer.pending_orders
@completed_orders = @customer.completed_orders
end
I broke this code (well actually the view it shows) by the following refactoring of routes
map.resources :customers do |customers|
customers.resources :addresses
customers.resources :orders
end
to
map.resources :customers, :has_many :addresses, :shallow => true
map.resources :customers, :has_many :orders, :shallow => true
This is a really stupid refactoring. Why?
So back to this index method which I'm now having to look at because my features are broken. Well its obviously wrong, because its an Order controller with customer code in it. I've just spent ages making sure that my Address controller doesn't have code that refers to a specific parent, and refactored lots of features and in particular steps that should have been Addressable not Customer/Address or Order/Address. And now on top of that there are all these Order features and in particular steps that have @customer in them. So now I'm peeved and am about to start to work even harder to get this stuff sorted when ... I have to go home.
Time passes ... and I realise that "its my fault" and that "I am stupid"
Remember "if its stupid and it doesn't work its probably your fault". Remember that stupid refactoring! and the fact that your added shallow routes to the customer order relationship at the same time as to the customer address relationship. Understand that applying shallow routing will change/break numerous named routes and url generation methods. Realise how stupid it is to do this in for two relationships at the same time. Realise that doing this refactoring for one relationship should be a seperate issue and commit - and here I am trying to do this for two relationships in the middle of doing something else!! Realise that I shouldn't even be looking at the OrdersController never mind making flawed judgements about the code in it. Understand that in the 'shop' part of this application that orders fundamentally belong to a customer and cannot exist without them. Realise that my colleagues implicitly get this possibly due to their greater experience with ecommerce. Realise that if the index method in the OrdersController is flawed its only very minor (perhaps just the customer needs to made available to the view). Realise that controllers are more contextual than models; and that the implied one to one relationship between controllers and models is a figment of my misunderstanding. Realise that a simple one line before filter can express a controllers context and allow a controller to fulfill a significantly different role.
There is lots more, but I'm really tired now.
So once again programming provides that wonderful opportunity to learn, and reinforces the need for my to keep my little rules and diligently apply them to myself.
RDOC + Hanna + gem update all = pants
Been bitten by this multiple times. I've been using Hanna as my default rdoc template following this article. This works fine with rdoc 2.3. Unfortunately rdoc seems to be undergoing some drastic changes at the moment and rdoc 2.4 breaks this lovely stuff.
So I probably have to do something like (all with sudo)
gem update --no-rdoc --no-ri
gem uninstall rdoc # choose 2.4
gem rdoc --all --no-ri
That last command can take ages to run so this is a real gem pain at the moment
Alternative
Go with the flow and use darkfish.
Change rdoc line in .gemrc to
rdoc: --line-numbers --format=darkfish
Then
gem update --no-rdoc --no-ri
gem rdoc --all --no-ri
Using semantic meaning in features and user interfaces
WORK IN PROGRESS
This explains why I need to fork webrat, and why I believe features should rely upon css classes and id's.