Friday, December 17, 2010

rspec and object assignment

In rails console I can say

ob = JoinObject.new(:join_a => @a, :join_b => @b)

And all is well.
In rspec (I have: gem 'rspec-rails', '>=2.2.0' in my Gemfile) I need to use the _id to make it work

ob = JoinObject.new(:join_a_id => @a.id, :join_b_id => @b.id)

Any light to be shed?

the order of javascript_include_tag

I had this in my main layouts

= javascript_include_tag :defaults, "jquery", "jquery-ui", "json", "custom_helpers"

and everything was find in development environment. However in production things where wrong. rails.js was throwing an error about jquery not existing. So I changed it to this

= javascript_include_tag "jquery", "jquery-ui", "json", "custom_helpers"
= javascript_include_tag :defaults

And all was good again.

Wednesday, August 19, 2009

@_why the long face

Today an event most strange occured on the net. A true inspiration and genius simply vanished. Why the lucky stiff, a querky, prolific coder and guru has been throughly deleted from the net. All his sites and projects are now only available through mirrors.

No reason and no farewell, just gone. There is talk that someone disclosed his identity against his will. If that Is the case then that person is responsible for the loss we all feel. They should be shunned, possibly injured.

Out of the seathing mass of mediocraty that is humanity there are so few who make a difference. Why was one of the rare people who worked to improve the world in which they opperate, and did so largely selflessly.

It is a great saddness to loose him.


Itouch testing

Have been trying to find an app for the itouch that is good for blogging. Lots of people rave about BlogPress and I shelled out for it. Nice looking, concerning functionality. It is not able to list all the posts, at best it shows two (out of 18) and none of the existing drafts. So now I'm experimenting with the free version of BlogWriter, which so far is more truthful.

Monday, August 3, 2009

A strange day in HL2

For no particular reason, I decided that one of the combine turrets (from the last defence point before Alex catches up with you) might like to come with me and add its support whilst waiting on the transporter. It had a somewhat game-breaking effect.

Having got the turret to where you see Judith it goes ape trying to kill her through the glass. It does not have a problem with Alex though.




Once in the same room with Judith it continues to try to kill her, perhaps it doesn’t trust her either. After a while though it unsuccessfully gives up. From then on it seems to consider her a friend.


After that all seemed to be going fine and I had one extra turret to help fend of combine while the transporter warmed up, great. I set it up to cover the two npc's while they bickered at each other and waited for Alex to unlock the other turrets.

However all did not go to plan.....

You all remember Eli Vance and how un-killable he is. I'd forgotten that he gets delivered to the transporter area. The turret was more on the ball and as soon as the pod Eli was in came into range it opened fire.

Poor fellow was dead before the pod doors opened and just fell to the ground!

Alex and Judith just stood there in what can only be described as npc shock! In other words total lack of script.
But isn't just like human shock, total lack of script?


They just stood in silence either side of his contorted figure, exchanging worried glances and generally looking lost. And that is where it ended, without Eli the game could not progress.

I reloaded and this time aimed the bloodthirsty turret somewhere else, but still all was not right. The presence of this turret obviously upset the other turrets as they started shooting at me as well as the combine. Something was wrong with them too, scared perhaps, because they just did not come. One or two showed up but it was no more tense than waiting for a lift in a 5 star hotel lobby.

STUPID TURRET

Monday, July 20, 2009

#{rails}

Well Strike me down and call me a noob
in a haml file:
:javascript
$(function(){$("#div_id_#{my_rails_object.id}").somefunc()});

Wow, the above works!

Monday, July 6, 2009

installing rails on ubuntu

After installing rubygems I ran
sudo gem install rails
- as per the instructions on the rails site.

However 'rails my_project' did not run, computer said 'no', well more specifically that rails was not installed and helpfully suggested 'sudo apt-get install rails'. I told it that I did not want to do that and edited etc/profile, adding the following line after the first set of comments:
PATH=$PATH:/var/lib/gems/1.8/bin
'rails my_project' now works.

rake still fails and in order to fix that the gem 'sqlite3-ruby' must be installed
sudo gem install sqlite3-ruby
That may grumble at first => 'checking for sqlite3.h... no'
In which case it needs a lib to be installed:
sudo apt-get install libsqlite3-dev