Skip to Navigation | Skip to Content



Archive for the ‘rubyonrails’ Category

NitobiBug – JavaScript & DOM Inspector and Logger | May 25th, 2008

I wrote a fairly basic but handy JavaScript Object Inspector and Logger that works across different browsers. I call it “NitobiBug“.

Read all about it’s features here. I did a video tour also, which you can see here (turn down your volume – its loud!).

Check out the live demo here.

Essentially, what it does is provide a logging utility like Firebug’s console.log that properly inspects objects and shows you it’s members. If you log errors it formats them nicely too. If you inspect DOM elements with it, it attempts to show you where on the page they are and calculate their widths and heights and positions on the page. You can resize and drag NitobiBug around the page, and it tries to remember where you put it.

I use it all the time while I’m working on RobotReplay so I figured maybe other people would too. It’s certainly not the only such tool out there but I think it’s decent. Anyway, your comments are welcome!

Posted in User Interface, ajax, components, resources, rubyonrails, web development, web2.0 | 3 Comments » | Add to Delicious | Digg It

For Ruby: htmlentities, server.htmlencode, escape, uriencode | May 7th, 2008

Ever wanted to HTML encode strings in Ruby? I did. I found this. It works great!

http://htmlentities.rubyforge.org/

To install just go:

gem install -r htmlentities

Then to use:

require ‘htmlentities’
coder = HTMLEntities.new
string = “<ã ©lan>”
coder.encode(string)              # => “<élan>”
coder.encode(string, :named)      # => “<élan>”
coder.encode(string, :decimal)Â Â Â Â # => “<ã ©lan>”
coder.encode(string, :hexadecimal) # => “<ã ©lan>“Â

Posted in ruby, rubyonrails, web development | No Comments » | Add to Delicious | Digg It

The Business of Making Things Simple | April 17th, 2008

On the proverbial eve of our Q2 release I’m thinking about how far we’ve come with our components. We’ve been building components for 5 years or so now and I dont mind telling you that it took us a while to figure out that we are essentially in the business of making complicated things simple. That being the case I guess we have something in common with companies like Apple, Microsoft, Books for Dummies, Internet Dating sites, and the like. The hard part for all these guys is modeling complex real-world problems as software features, but their market success is driven by how well they package those features so they are in-turn, dead-simple (if not fun) to use. This isn’t an airy-fairy ‘do what feels good’ problem – but it’s a worthwhile place to invest your time if you’re a software or hardware vendor – I mean heck: Apple is selling almost 20,000 iPhones per day. They didn’t do that with entertaining commercials alone.

As anybody who has become a fan of how Apple (and indeed Microsoft to some extent) packages their software and hardware solutions will agree, communicating technical features is just as much a science as software development itself – even if the lines are blurred sometimes. You would also agree that Apple has made buckets of money focusing on this aspect of their products, and has even created a sort of ‘premium good’ effect around this experience. Apple products sell for more than their competition, and with some notable exceptions we just can’t get enough.

This advice applies also to many of our customers – who are also building software products. Here are some random examples from our (very niche) world of computers and programming in general to help make my point: invest in usability if you want your technical product to succeed.


NSite was a customer of ours from way back. These guys had built a product around allowing business users to rapidly assemble and customize web applications without writing a line of code. Everything was done through their web interface, and you could build spreadsheets, import Salesforce.com data, connect to web services, build forms, and generally run a lot of CRM data through their system in an easy to use web-app. They’ve since been snapped up by Business Objects although not until they racked up a whackload of customers. Of course, there are others doing a similar thing using newer technology like DabbleDB.

Why Conventional Wisdom Says it Should Have Failed

Why should developers be interested in hog-tying themselves to a proprietary web framework that doesn’t even let them get in and code? Why should non-technical users be interested in developing applications? Who has the time to learn their development paradigm and the imagination to see how it can be jury-rigged to suit real business problems?

Why It Succeeded Anyway

Who wants to pay a developer to write something in one year what I (as a business user) can set up in 3 days on NSite? The fact that they made the back-end open with lots of ways to get data in and out meant that real developers could extend and connect to other enterprise systems. Another thing they must have realized is that a lot of business users would love to get in and tinker with their business apps. It’s like customizing your hot-rod to get things just right for you. They combined that effect with a hefty sales force of their own to create a dynamite product concept that consumers loved. Hello Business Problems, meet Simplicity.

ruby_on_rails_logo.jpg

For those who don’t know, Ruby on Rails is a web development framework based on the Ruby language. If you really don’t know anything about it, read the Wikipedia page on the subject which is written for anyone to understand. Basically, it appeared on the scene in 2004/2005, and quickly formed a cult following in the web development community. It employed concepts from Model View Controller, package management, Ajax, and combined that with a scripting language known for its brevity or terseness. The result was a platform that was tailor-made for rapid prototyping of “Web 2.0″ applications – If you bought into it’s very radical view of the universe (more on this below). Fast-forward to 2008 – Ruby on Rails books are the fastest-growing book category. The movement has spawned a series of conferences, has gained a worldwide fan-base, and has influenced other frameworks (including .NET), probably making the founders quite rich in the process.

Why Conventional Wisdom Says it Should Have Failed

A question for software developers: How many times have you heard the following? Here is a brand new and very opinionated development framework that forces you to learn a new scripting language, and develop in a totally different way than you probably were before, with virtually no enterprise support? Sound like fun? Actually, a lot of critics point out that in some ways, RoR is a very restrictive way to program. You simply cannot build applications in the same lazy-ass way you did before in RoR, forcing you to re-learn your approach. Who has time for that? Also, problems with the web server, mongrel, meant that it was relatively more difficult to build large scalable apps owing to a lack of multi-threading in the software. Popular RoR apps like Twitter are infamous for continually going down at the worst possible time.

Why It Succeeded Anyway

The truth about RoR fanaticism is definitely more complex than I’m revealing here, but the essence of it is that RoR does more things right than wrong. Rails offers a way to build web applications that is ridiculously fast, and once the shroud was lifted, the early-adopters who stumbled onto it couldnt believe their eyes. It’s worth giving up a little bit of flexibility for the sheer power of being able to write features as quickly as you can imagine them. Want an Ajax-powered autocomplete? 5 minutes. Want some simple animation? Just a few simple lines of code. Want to connect to a database? You barely need to even think about it. Turns out, programming doesn’t need to be complicated to be powerful or worthwhile. If the stigma of being one of the ‘cool rails kids‘ doesn’t bother you, you’ll do yourself a favor by checking RoR out

apple_computer-01.jpg

This one is a little obvious, but hopefully I can spin it in an interesting way. Apple Computers are king for making things simple where they were previously complicated – and consumers are throwing themselves before the church of Jobs (Steve) begging them to open an Apple Store in their town or city – in which to worship. I think we all know a little about the history of Apple, but it’s the recent incarnation that has everyone foaming at the mouth. I’ll jump right into the bad:

Why Conventional Wisdom Says Apple Should be a Tumbleweed on the Plains of Computer History

Apple computers are expensive. In an age where you can by a brand new laptop computer from Dell for $500, why would you spend $2000 for something similar from Apple? On top of that, when you own a Mac, you pay for everything. Virtually none of the software is free. You cant even have a photo sharing account without paying for it. If you’re a gamer, you’re out of luck too because historically very few games were ported to the Mac. On top of all this – the operating system that Mac’s run on used to be thought of as something a child or non-computer-savvy person would want to use. What did this do? It left early-adopters out of the equation because those people are typically very tech-savvy. Finally, Mac’s are known to suck when it comes to interoperability. The file system was totally different, so while you could open a document on a Windows-formatted disc, you couldn’t do the opposite. On top of that, networking a PC and Mac together was tricky. All in all it was an IT Managers nightmare to have an employee on an Apple (unless they all were).

Why Its Succeeding Anyway

A couple of things work in Apple’s favor. One – people are increasingly fed up with Windows and Microsoft. Improved anti-piracy technology in Windows and on Windows-based software in general means the price gap is shrinking all the time. While that’s true, it doesn’t explain the meteoric rise in Apple fandom. The real secret is to do with how Apple has managed to make their machines the most powerful PC’s on the market at the same time as the easiest to use. Computer-illiterates love Mac OS because they’re elegant, functional, intuitive, and minimalistic. Geeks love them for the same reasons, but also because under the hood there is a lot of power and control available to those who want it. There is a legitimate premium built into the price because consumers know that when they want to connect to the Internet, or install new hardware, it will just work. When they want to build a photo album or burn a CD, it practically does it for you.

Conclusion

The point I wanted to make here is that there is a culture shift happening in software development, and it’s mirroring what is happening in the consumer marketplace too. I think that engineers used to think that if something isn’t complicated, it’s not valuable or worthwhile. I think people are starting to think differently – as we at Nitobi are with our components. There’s no reason why we can’t achieve both goals – power and simplicity, with some care and attention.

Posted in .net, Rich Internet Apps, ajax, apple, business, components, microsoft, rubyonrails, web development, web2.0 | 2 Comments » | Add to Delicious | Digg It

Easy Ruby and RubyGems install on CentOS 5 | March 18th, 2008

I found this resource today and it saved me heaps of time:

http://blog.simb.net/2007/08/21/installing-ruby-and-rubygems-on-centos-5/

The ‘meat and potatos’ of it is this:

yum install -y ruby
yum install -y ruby-devel ruby-docs ruby-ri ruby-irb ruby-rdoc

Posted in rubyonrails | No Comments » | Add to Delicious | Digg It

Huffman encoding (compression) in Ruby | January 9th, 2008

I stumbled onto a really interesting proof of concept today for doing Huffman-style tree compression in Ruby. The other popular symmetrical (ie: lossless) compression schemes being LZ77 (think: gZIP), and of course RLE (run length encoding.. think: GIF, PCX) Check out Building Huffman Compression in Ruby.

This may be somewhat academic because it’s worth noting that the core Ruby classes often include Zlib as part of their base compilation giving developers access to high-speed, robust gZip LZ77 compression out-of-the-box.

I’m going to do another post tomorrow on the theme of compression.

Posted in resources, rubyonrails, web development | 2 Comments » | Add to Delicious | Digg It

Write your own isNumeric in any language! | December 20th, 2007

I found this interesting article today. I was looking for an isNumeric equivilent in ruby and discovered someone had cobbled together the equivilent in every language he could think of:

http://www.rosettacode.org/rosettacode/w/index.php?title=IsNumeric

Posted in rubyonrails | 3 Comments » | Add to Delicious | Digg It

Ruby on Rails 2! | December 11th, 2007

Some exciting news last week.. Ruby on Rails 2 is now officially out! Read about it here: http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done

Instead of major changes to the framework, there are a lot of ‘maturation’ type changes.. improvements to the underlying code base, bug fixes, and a few new features. Here’s a snapshot of some of them:

  • Support for asset servers
  • Partial Layouts
  • HTTP Authentication
  • Native support for MIME types
  • Some improved exception handling and debugging features
  • Improvements to ActionPack and ActionMailer
  • Asset Caching
  • Improved ActiveRecord validations
  • and much much more..

Posted in rubyonrails, web development | No Comments » | Add to Delicious | Digg It

ActionMailer – Ruby on Rails | June 21st, 2007

Was stuggling with ActionMailer today (a little). Went to several online and offline resources. Found this tutorial to be among the better ones:

http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer

Posted in resources, rubyonrails, web development | 1 Comment » | Add to Delicious | Digg It

Ruby Captcha Alternative | June 18th, 2007

Having trouble with RMagic in Ruby on Rails? You can always do what I ended up doing today, and using the command line interface to ImageMagick instead of dealing with all the headaches I was having.

First, download ImageMagick. Compile it or get the binaries if on Win32.

Figure out your command line for convert to create an image, set the correct blurring and warbling filters. Eg:

convert -size 142x42 xc:white -font arial -pointsize 30 -tile pattern:checkerboard -annotate +10+30 MYSTRING -blur 0x1 -wave 1x3 -draw "line 20,50 90,10" captcha.jpg

Then, create a helper method to come up with a string and use system method to execute the command line and dump the file in the correct spot.

system(’convert -size 142×42 xc:white -font arial -pointsize 30 -tile pattern:checkerboard -annotate +10+30 ‘ + mystring + ‘ -blur 0×1 -wave 1×4 -draw “line ‘ + String((rand*142).round) + ‘,50 ‘ + String((rand*142).round) + ‘,0″ -draw “line ‘ + String((rand*142).round) + ‘,50 ‘ + String((rand*142).round) + ‘,0″ public/images/captcha/’ + filename + ‘.gif’)

resultstring = filename + “.gif”

Posted in User Interface, resources, rubyonrails, web development | 2 Comments » | Add to Delicious | Digg It


Search Posts

You are currently browsing the archives for the Uncategorized category.

Archives

Categories

LinkedIn Profile

  • My Profile


My ideal work culture:
[See my summary] [What's yours?]