Archive for July, 2006

Ruby, Rails and RJS

So, today I learned about RJS for Rails… RJS, or Remote Javascript, is a method which allows you to write complex AJAX scripts using Ruby syntax etc. Using RJS templates, it is possible to create extensive effects.

Now Rails has for a long time naturally includes some built-in functionality for AJAX, via the PrototypeHelper and ScriptaculousHelper libraries. Unfortunately, these two helpers would only allow one element in the DOM to be updated in an AJAX operation. That did not suit for what I wanted to do. Luckily, since Rails 1.0, RJS has been including. In addition to providing a simpler way to write AJAX functionality into your project, it also allows you to modify as many parts of the DOM as you wish per AJAX operation.

Of course, there doesn’t seem to be any good tutorials concerning RJS on the Internet. After looking for a while, RyanB from the Rails Forum suggested purchasing RJS Templates for Rails from O’Reilly. This is a great book - it comes as a PDF, and is only 60 pages or so, but is jam-packed with information on RJS, with code examples, and everything.

Because of this, I have been able to start implementing some AJAX functionality on a project for my employer. The visual effects from script.aculo.us are pretty cool, but the real benefits come from the increase of useability for the end-user. No longer does a user have to wait for page reloads etc. everytime he changes a vaue on the page. Plus, it is simple to link the AJAX pieces into your database, yielding an extremely ‘live’ page.
So, the moral of the story is, if you utilize Rails together with AJAX in any way, look into RJS - it can and will save you tons of time and energy, while vastly improcing your site design and useability!

Answers from the Great Programmers

I was just recently reading an article on the Sztywny Blog where the author sent a number a questions to a variety of today’s famous and great programmers. While he did not get replies from all the people he asked, he did get responses from

  • Linus Torvalds - Linux Kernel
  • Dave Thomas - Author of Pragmattic Programming, other great books
  • David Heinemeier Hansson - creator of Rails
  • Steve Yegge - Author of Wyvern, has a great programming blog
  • Peter Norvig - Research Director at Google
  • Guido Van Rossum - Creator of Python
  • James Gosling - Java language creator
  • Tim Bray - author of the Atom and XML specifications, as well as a blogger.

Many questions are asked, including where these guys learned programming, important skills, the value of math and physics with regards to programming, the future of programming, their favourite technology, their favourite tools, books and much more - a great read!

One thing that does come across while reading the article is that David Heinemeier Hansson is a very different breed of programmer from the rest of the people interviewed. At least, it seems to me that his answers stand out from the rest. He seems to be less of an academic, as a practicing programmer. That may not be the most accurate way to state the difference, but it is the best I can do.

Regardless, these are some of the top minds in the business, and there is a lot of interesting points they make. Very good reading for any programmer or Computer Science student. If nothing else, read the section where they describe their favourite tools - You may find a better environment than what you currently use!

John Tory, Liberal Spending, OLGC Rebranding, and Defacing the Trillium

Usually, I try not to talk politics too much in anything I write. However, this morning on my way into work, John Tory was on the ‘Derringer in the Morning’ morning show in Q107, out of Toronto. Tory, who is the head of the Ontario PC party, made some comments that really got me thinking.

Tory spoke for a part on two projects recently taken on by Dalton McGuinty’s government, the rebranding of the OLGC and the redesign of the Trillium. Being somewhat interested in his comments, I took the time to look further into this. These projects are a huge waste of government money, pointless, and serving no purpose except to keep a few contributing Liberal advertising companies in the big bucks.

The first project, paid for by Ontario tax dollars, is a rebranding of the Ontario Lottery and Gaming Corporation. The OLGC was the governement run corporation responsible for all the casinos, lottery sales etc. in the province of Ontario. Well, the visionaries at the OLGC decided that it would be smart to rebrand themselves as, you guessed it, OLG.

Yes, all they have done is drop the ‘C’ off of the end of the name. All the logos and whatnot have remained essentially the same; Apart from the removal of the ‘C’ from the logos, nothing has changed.

Of course, hundreds of thousands of dolalrs have been spent on logo redesigns, and hundreds of thousands more have been spent on television advertising campaigns which will serve no purpose other than to promote the rebranding. This cost, of course, doesn’t cover yet the cost of reprinting promotional and other materials that need to be replaced in thousands of lottery retailers across the province. That cost is projected to be in the millions, all paid for by the taxpayers… You can read more about it on the Ontario PC Party website here and here.

Of course, this is following up on a move by the McGuinty Liberals to redesign and rethink the trillium logo for Ontario. Apparently, the trillium in use today just isn’t good enough, so tens of millions of our taxpayer dollars should be thrown at it. Haven’t I seen this before? At any rate, I have yet to see any reason why the current symbol is insufficient. It’s been a part of Ontario’s identity for fifty years. Why are we changing it? Why is so much money being spent on it?

Here is a graphic from the ‘Save the Trillium’ campaign illustrating the change that will be made. Again, remember that this is costing tens of millions of dollars!

Yes - that beauty on the far right is worth millions. It looks to me like poison ivy. What a waste.

Now, I am not too concerned over the actual rebrandings. Neither one will affect me that much. I am a little concerned by the millions of dollars that are going to waste as a result of this. This comes in a time when the Ontario Government claims it has no money to help pay for treatments of autistic children. This comes at a time when they have cut funding for physiotherapy, chiropractic and eye exams. Of course, this isn’t the first time they have done this.

These last couple of campaigns appear to have gone to Bensimon-Byrne, a Liberal-friendly advertising company which has recieved nearly $20 million worth of advertising contracts since the McGuinty government came into power in late October, 2003. Is there is a bit of reciprocal back-scratching going on between the Liberal Party and Bensimon-Byrne? It appears so - Bensimon-Byrne has been known to make sizeable contributions to the provincial liberals’ war chest come election time.

This is a waste of our money, and just the latest in a string of irresponsible moves by the McGuinty government. What’s next?

OpenOffice in Microsoft’s Turf…

I just came across this story on Digg -

OpenOffice’s anti-MSFT bus ads in Redmond

“Sun Microsystems has posted extremely pointed OpenOffice.org ads on the sides of transit buses that serve Redmond. Slogans include, ‘Stop giving a bully your lunch money,’ ‘Compatible with expensive, closed, memory-loving software,’ and ‘Prehistoric reptilians welcome.’ Booya!”

Well, I really thought this was great. Wade Rockett posted on ‘The New Marketing‘ that this morning, he began to see a variety of ads for OpenOffice.org’s Office suite posted by Sun Microsystems on busses across the city of Bellavue, which is very close to Redmond.

The ads, which appear to be targetted at local business people, and possibly even microsoft employees, focus on the many of the benefits of OpenOffice.org over the defacto standard, Microsoft Office.

Of course, this move hasn’t gone unnoticed by Microsoft. On ‘The .NET Sweatshop’, Microsoft Developer SandyK fires back with some cutting remarks about Sun.

The ads have been posted below. These are from the flickr gallery by Wade Rockett. If you want any of the T-Shirts shown in the ads, you can get them from Sun Microsystems’ Sun Open Source Store.

.PNG support and Internet Explorer…

So, in the latest website I’ve been building at http://www.outfrontps.com, I just ran into an issue previously unknown to me…

Usually, when I work with graphics, I like to use the .PNG format. Now, I am not a graphics designer, so it’s not like I regularily use transparencies and whatnot for graphics. Anyways, I created a nice-looking header that relied on it’s transparent background to site over the current header background. Unfortunately, because IE is retarded, it cannot display the transparencies correctly. In fact, it does an amazingly horrible job of it.

So, I tried it in a .GIF, and that was unacceptably poor quality. So the final solution was to overlay it over an imitation of the existing background. That is barely satisfactory….

Why can’t IE just get with the rest of the world on standards? Without even bringing up CSS, IE has failed in many departments. Of course, this is no surprise to any web developer. Everyone has designed a page that they then have to butcher with all kinds of hacks just to get it to work right on IE.

Luckily, IE7 is supposed to be alot better, at least in terms of CSS implementation. The thing I am most excited  about is the fact that according to the IEBlog, there is going to be a complete implementation of the .PNG standard in IE7. So, hopefully within a few months, that problem is one that can just rest in the annals of history.

This is the one thing I can be thankful about Microsoft - once IE7 is out, most Windows XP users will automatically upgrade to it. Of course, there will always be legacy users, but if the majority finally supports the format, I see no reason not to go with it.

Stallman on Source Distribution and the GNU GPL

Richard Stallman just wrote this article today describing the latest modifications to the GPL3 draft. It’s an interesting read:
The goal of the GNU GPL is to ensure that all users have the four essential freedoms — (0) to run the program, (1) to study and change it, (2) to redistribute it, and (3) to distribute modified versions. Access to the source code is essential for freedom 1 and freedom 3. Thus, we designed the GNU GPL to insist that all redistributors make the source code available to their users. This requires them to do a little extra work, but that work is generally necessary for the sake of the users’ freedom. Keeping source code conveniently and reliably available for the users is more important than saving distributors a little effort.

Under GPL version 2, distributors who release binaries through a network server have to release the corresponding source code in the same way. This requirement is the only way to assure that users can get the source, and the that it is the right source.

The simplest way to fulfill this requirement is to put them both on the same server. This requires extra work, but not much. The distibutor needs server space for the source as well as the binary, and has to upload both. Anyone that does these things for the binary can manage to do them for the source as well.

GPL version 3 (current draft) keeps these requirements basically unchanged. We clarified the fact that binaries on physical media require sources on physical media, but this isn’t really a change.

The current draft does propose two small substantive changes to these requirements. One requires those who sell products with embedded software to continue providing source by mail order for as long as they provide other customer support for the product. This won’t affect GNU/Linux distributors. The other allows distributors to charge a higher price for mail order sources (but we’ve since decided to revert that change).

However, we’re now considering a major change in this policy. The coming draft of GPL version 3 will propose a new alternative allowing, for the first time, distribution of binaries on physical media and providing the source code over the network. This will require a commitment to keep the corresponding source code version available on a network server for three years.

I rejected that option in the past because downloading the sources corresponding to a binary CD was an insupportable burden for nearly all users. I’m amenable to it now because that situation has changed. If no one shows substantial problems with this option, it will be part of the official GPL version 3.

Copyright 2006 Richard Stallman
Verbatim copying and distribution of this entire article are permitted without royalty provided this notice and the copyright notice are preserved.
.

Review My Review of ‘The Odyssey Gene’ by Kfir Luzzatto…

Just recently, I reviewed Kfir Luzzatto’s new book The Odyssey Gene for one of my other projects. I run ‘The Science Fiction Review’ as a side project. I just review books, and post interesting articles I come across.

Anyways, If anyone is interested in reading the review, and critiqueing my reviewing style, well, I would appreciate the comments. So, without more boring talk on my part, please review my review!

Next Page »