Posts from Gary Blessington...
Posted by garyblessington 192 days ago
After finally upgrading to Leopard on Monday, I ran into some problems when updating my version of Mongrel. The gem update was proceeding even though part of it was failing, when building http11.so.
I spent some time searching around and trying a few things, until we realised the one difference between my Leopard upgrade and that of the other team members. I had not installed the latest Xcode tools from the installation DVD. Sure enough, after installing, my gem update completed fine.
Posted by garyblessington 439 days ago
With over two months under my belt I now feel a little more qualified to make some observations about my change of platform, from Windows XP to OSX.
When I first started out in the industry, the place I worked at was finally getting rid of their old IBM mainframe, complete with the many 20 MB disk drives that were the size of refrigerators. They were switching over to a UNIX mainframe running Informix. Another competitor at the time, Oracle, was not seen as the right choice. A few years later, I began the more long term relationship that I’ve had with various Microsoft tools, and it has been that way for a number of years now.
Going back to a UNIX based system has been funny in a strange way. I’m suddenly remembering a lot of little things that have been stored somewhere in the dark recesses of my mind. Its like having some form of past life regression. Not very exciting, as I’d rather a past life had involved being a 007-style spy, but, still its rather strange when I remember some odd shell command.
One of the first things that is different (not necessarily something that I’m missing) is developing without a dedicated IDE. I’ve heard that Radrails is coming along nicely, but I’m trusting my peers, and other community members by using Textmate. It seems to be the tool of choice, and I’d rather be open to the opinions of people I respect than stick to my old ways of doing things. Stepping outside the bounds of the familiar is always interesting. My opinions on IDEs vary, from them being good for a beginner (Intellisense was a good prompter, especially for a framework as huge as .NET), but they can also be a resource hog (VS2005 seems kinda sluggish at times – even on a modern system). The integrated debugger of .NET was also nice, but I’m expecting that the different approach I’m taking with Rails will mean I may not be using breakpoints as much anyway.
As for OSX, I’ve been pleasantly surprised. Its not perfect, but I like it. There seems to be a lot of applications out there that tie back into the core OSX ones (Mail, iCal, etc.), which gives a more cohesive feel to your work. Due to this, I’m now at a point where I’m using my home PC less, and considering moving over personal info (contacts etc.) to my Macbook. Even some of my more recreational activities have improving support on the Mac. For example, music software. Although it still runs under Rosetta, the fantastic Tracktion has been on the Mac for some time now and there seems to be an increasing number of developers working on Mac versions of their VSTIs.
Overall, I’d say it has been a fairly positive experience…...
Posted by garyblessington 440 days ago
I’ve often wondered why more companies don’t look towards open-source solutions, as the costs for software licenses can be extremely high. Taking a Microsoft team, for example, who will probably need Visual Studio, SQL Server, various OS’s (XP, Server 2003), 3rd party tools and possibly Team System, the costs quickly mount up.
Although there are many other promising frameworks around, I’ll use Rails as an example in this post simply because it is what we use at PLANET ARGON. There is a fair amount of buzz around Rails right now and the cost of checking it out is limited to your time and whatever that costs. Easier said than done as, in the past, my time has been somewhat limited due to the workload I had and the need to continue improving in that area (.NET). Therefore, the idea of branching off into a brand new area was exciting but also daunting. I was first introduced to Rails almost two years ago and dabbled with it on various occasions. However, I never found the chunk of time that was needed to get beyond the “oh, this looks interesting” part and would have to refresh my memory of certain things each time I returned to it. Now I don’t know if this is typical, but I’m hoping that some part of it is and that I’m not some kind of lazy anomaly. If it is typical then it might be one indication of why more companies don’t adopt open-source. Without the ground level excitement from employees, why would a manager choose to go in this direction?
All of the companies I have worked for have had some downtime (in varying degrees) between projects and this has, typically, been used for internal development. For any smaller work, this would seem like the ideal time to explore other platforms. Taking the Microsoft team as an example, Rails can connect to SQL Server and can also be hosted (with some trickery) on IIS too. A number of these mini-projects could serve as a feasibility study and reduce the risks associated to suddenly jumping to a whole new platform and framework.
Without some proof of what an alternative platform/framework can do, there will always be lingering doubts in the minds of decision makers. The cost savings may be great but they’re unlikely to change without proof that it can work and satisfy them in some key areas. Amongst these areas I would include security and scalability. The former is a hot topic in larger companies and would be a major consideration. However, in searching around for Rails security flaws I found only one. Rails scalability is something that has had much more discussion and has been countered by DHH.
One of the last points that I’ll touch on is the availability of developers for an open-source framework. If a company commits to using Rails then, at the moment, it seems like they will have a smaller pool of talent to choose from (than, say, .NET), and finding somebody local narrows the choices even further. This may result in increased costs which then begins to counter one of the initial pluses of cost-saving. I’m hoping, and expecting, that this will not be the case with Rails, in particular. Railsconf is one of the fastest selling O’Reilly conferences, and combined with their book sales figures it suggests a rapidly growing community.
Of course, maybe people are just happy with what they’re doing, they’re profitable and their clients are happy. In which case, why change the formula that is working for them? :-)
Posted by garyblessington 454 days ago
As I learn more about Rails, it appears that there is a lot of freedom to place certain sections of code wherever you please. For example, I’m free to place my ‘has_many’ declarations before, or after, the validators in my models. While I’m still at the naive stage with Rails, I would imagine that some conventions would help with code readability and organisation. Maybe as I get to play with other people’s code I’ll start to notice some standards.
At this early stage, I’m also hopping around in the application a lot more than I expect I eventually will. One thing I’ve noticed is not having easy access to the columns for a model. The choices appeared to be either searching through migrations, or taking a look at the db/schema.rb. Neither of these seem ideal, and once a system becomes fairly large it seemed like remembering these would become more of an issue. At least for my currently addled brain. I was pointed to Dave Thomas’ Annotate plugin last week, and just got the chance to install it.
script/plugin install http://svn.pragprog.com/Public/plugins/annotate_models
Running ‘rake annotate_models’ now gives me the following at the top of my models/animal.rb:
# Table name: animals
#
# id :integer not null, primary key
# animal_type_id :integer not null
# name :text not null
# date_of_birth :date
# gender :string(255)
# weight :integer
# description :string(255)
Posted by garyblessington 454 days ago
In the spirit of the Which RubyGems are you sporting? question, I decided to reveal my Ruby inadequacies for all to see…...
Of those listed, I think I have installed only three or four myself. In a few months time, I’m sure I’ll have stumbled across many more.
actionmailer (1.2.5)
actionpack (1.12.5)
actionwebservice (1.1.6)
activerecord (1.14.4)
activesupport (1.3.1)
cheat (1.2.1)
daemons (1.0.3)
diff-lcs (1.1.2)
gem_plugin (0.2.1)
mime-types (1.15)
mongrel (0.3.13.4)
postgres (0.7.1)
rails (1.1.6)
rake (0.7.1)
RedCloth (3.0.4)
rflickr (2006.02.01)
rmagick (1.14.1)
rspec (0.7.5.1, 0.7.5, 0.7.4)
sources (0.0.1)
syntax (1.0.0)
xhtmldiff (1.0.0)
Posted by garyblessington 461 days ago
While working my way up the gentle slope of Mt Rails, one of the distant, cloud-covered peaks I’ve been observing from afar has been Behaviour Driven Development. The use of this has now become standard at PLANET ARGON, and I’ve been intrigued as to why it is a more natural way to “test” your application than using unit testing. Hopefully, I won’t mention the “test” word again, as this is not the purpose of BDD or, for that matter, TDD.
I got to spend a little time with Robby last week doing some pair programming for one of our clients, and, luckily enough, he happened to be writing some model specs. The first thing that struck me was the natural sounding syntax, which reflects the language that you are likely to be using when discussing expected behaviour with a client. Also, the focus is on specifying behaviour that should exist in your application. I’m probably one of the 95% of developers that Dave Astels said were doing unit testing incorrectly, and felt like I was burying myself in code, focusing far too much on individual methods instead of trying to identify behaviour.
The idea of writing a specification of what your code should do is encouraged by the syntax, which I briefly touched on. Dave Astels has a brief essay, A New Look At Test Driven Development, which I would highly encourage you to read, in which he talks about the effect that language has upon our thinking. The following example is fairly simple, but it does demonstrate the emphasis on the specified behaviour, rather than a specific method.
context "A new note" do
setup do
@note = Note.new
end
specify "should not save without a valid customer id" do
@note.customer_id = 999999
@note.save.should_be false
@note.should_have(1).error_on(:customer_id)
end
end
I’ll be posting more on the subject, but, for now, my brief introduction has opened my eyes to an alternate way of developing that looks to be much more effective for that unlucky 95%.....
Posted by garyblessington 482 days ago
I read a good article on Robby’s blog a few days ago. He highlighted the work done by the Err team with their excellent cheat gem. After consuming this information, I thought it was relevant enough, at my current stage with Rails, to regurgitate it here. So, here it is. My metaphorical sick-bag of information.
I’m relatively knew to both Ruby/Rails and have so far been collecting various cheat sheets (here, and some by Amy Hoy). These are great resources and they’ll continue to have a place to stay if they drop by my desk. They just can’t stay the night any longer. Why? It can be a little long-winded to open a PDF or try to find the printed sheet that is hidden somewhere amongst the piles of junk on my desk. Before I know it, I’m distracted by finding last week’s lunch, which appears to be trying to digest the papers that were hiding it from my view. Anyway, it seems to be a little long-winded to me now, since discovering cheat, which gives you your cheat sheet right in your terminal window. Pretty cool, huh?
Once installed, this gem allows you to list all of the sheets available with:
cheat sheets
Selecting the ‘has_many’ sheet I can then view this with:
cheat has_many
Another great thing is the variety of sheets included, as they do not all deal directly with Ruby or Rails. For example. the following command will give you a sheet for the bash shell.
cheat bash
This last point is important to me, as the coverage of these sheets is very beneficial for people making the switch from other platforms and languages. As a former .NET developer, it is something I can very much relate to.
Posted by garyblessington 489 days ago
So, you’ve just signed up for a PLANET ARGON hosting package and are now looking for information on how to get Mephisto up and running? Look no further!
The first thing that you will need is the hosting account information emailed to you by PLANET ARGON. This will give you some DNS info, how to login to VHCS, ssh into the system etc.
- Login to VHCS.
- Create a database in VHCS. Click ‘Manage SQL’ in the sidebar, ‘Add SQL database’ and set the database name to be ‘mephisto’ (or whatever you want to call it).
- From the ‘Manage SQL’ page, click ‘Add SQL user’ to create a user account for your new database.
- Exit VHCS.
Now we need to download Mephisto and connect it to the database we just created…
The application should now be setup correctly…
If all is running ok, you now need to setup your rc.local. This will ensure that when the server next starts, Mephisto will too. For a little more info on this take a look here. The line you add into your rc.local will be something like:
( cd ~/mephisto && mongrel_rails start -d -e production -p PORTNUMBER)
...and that is it!