Monday, December 25, 2006

For christmas I gave my Dad his own website www.randolphness.com. He creates amazing things out of wrought iron, and we're going to build a website to sell his ironwork.

He's an ironman! He's a really amazing guy, I'm so blessed to have him as a Dad.

Saturday, December 23, 2006

Computing in the Cloud with EC2.

When I first started learning about EC2, I wasn't so sure, but I'm a total convert now, it's just so beautiful.

EC2 is Amazon's new service, still in beta, that lets you deploy pay-as-you-go servers. You pay 10 cents per hour, which works out to about $70 a month. For this you get the equivalent of a 1.7GHz Xeon with 1.75GB RAM and a 160MB hard disk. This is pretty close to equivalent with other dedicated servers that you can get.

However, what makes EC2 so sweet is that this is all virtual and pay-as-you-go, so you could run one server for a month for $70, or run 700 servers for an hour for $70. It's really hard to decide how many servers to get for a website, and with most current systems, it's quite a chore to get your new computers online and configured. With EC2, it's just a simple command, and your new instance is deployed.

We're using EC2 for the startup that I'm currently involved in, we should be launching publically very soon, I'll give you more details then.

Thursday, December 21, 2006

Tuesday, December 19, 2006

A great idea to handle a wide variety of screen sizes for your webpages, Switchy McLayout.

This little trick uses a variety of different stylesheets, each optimized for a particular page size, for example, 240px for a handheld device, 1024px for most web users, and 1600px for users with really big screens.

Then, a little bit of Javascript is used to get the screensize with "onresize", and the relevant CSS styles are used.

Pretty neat and tricky, but whoa, that would be a lot of work to generate those three different layouts.
Taking ARES out for a test drive.

ActiveResource looks really cool, it allows you to use Rails goodness to create an API for your website pretty easily. XML consumers and producers to talk in a nice RESTful way.

You know, I used to be all about SOAP, and had grand plans to hook all programs in crystallography together with SOAP, but SOAP just got too big and crazy, too many big players in there. I think with this new RESTful way of doing things, you could have some really practical, useful and beautiful ways to hook a whole bunch of crystallography resources together.

Anybody want to pay me to do this? CCP4? Rigaku? PHENIX? Taverna? A synchrotron somewhere? Just let me know, it could be beautiful.
Test::Unit::Assertions in Ruby on Rails.
CSS Box Model Hack
One common problem in CSS that causes warnings in validators is to have a color property with no matching background-color property.

Here's a good article about this.

At first blush, this might seem to be a pretty superfluous warning message, but if the user has a user-defined CSS that is overriding your CSS, for example, a visually impaired user, specifying one or the other and not both can cause some big headaches.

Imagine, for example, that you set "background-color" to black, and don't have a "color" set. If the user overrides your "color" object with the color black, they won't be able to see the text.

So, I went through and made pairs of all my background-color and color specifications, and cleared up a whole bunch of warning messages.
Ruby is nice:

Enumerable - collect - a very useful method that returns an Array that is the result of running the block once for every member in the Enumerable object
Exception handling - Some of the nicest exception handling code I've seen in any language.
- Convert Ruby objects into a byte-stream. Really useful for sending large amounts of data to a webserver. assert_valid_asset uses it to send data to the w3 HTML/CSS validation server.


The Spitzer Space Telescope has just seen the first light in the universe. This is a really neat story, the first light in the universe has been red-shifted so much that it is in the infra-red spectrum, which is the wavelengths of light that Spitzer Space Telescope looks at. The team that found the first light used the left-over data from other teams, and removed the foreground galaxies from it, leaving the glow of the first stars and galaxies in the universe.
If you get the following error when trying to run script/console in Ruby on Rails:


Loading development environment.
/usr/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
from /usr/lib/ruby/1.8/irb/completion.rb:10
from /usr/lib/ruby/1.8/irb/init.rb:252:in `require'
from /usr/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
from /usr/lib/ruby/1.8/irb/init.rb:250:in `each'
from /usr/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
from /usr/lib/ruby/1.8/irb/init.rb:21:in `setup'
from /usr/lib/ruby/1.8/irb.rb:54:in `start'
from /usr/bin/irb:13


You need to install the readline-devel package and compile the readline extension:


cd /path/to/ruby_source/ext/readline
ruby extconf.rb
make
make install [do this as root/admin]
To run the Ruby on Rails console in production mode:

script/console production

Monday, December 18, 2006

If you have a favicon for your site, if you put the following code in the >head< section of your HTML, you can just put the favicon in the root directory of your website:

>link rel="shortcut icon" href="http://example.com/favicon.ico" type="image/x-icon"<

Sunday, December 17, 2006

I'm working on making my CSS stylesheets validate completely with the w3c css validator. This means no errors and no warning messages.

I'm using the excellent assert_valid_asset plugin for Ruby on Rails to do my validation. It's really easy to use, just go:


assert_valid_css_files 'lmg'


Substituting your stylesheet name for 'lmg'.

However, it currently just looks for error messages. I added the following little snippet to look for warnings as well:


# Check for warnings
warning_messages = []
REXML::XPath.each( REXML::Document.new(response.body).root, "//div[@id='warnings']/div/ul/li") do |element|
warning_messages << element.to_s.gsub(/>[^<]+>/,' ').gsub(/\n/,' ').gsub(/\s+/, ' ')
end
if warning_messages.length > 0
warning_message = warning_messages.join("\n")
flunk("CSS Validation warning:\n#{warning_message}")
end





Some beautiful graphic design at potionfactory.
reset.css - A neat looking CSS stylesheet that creates a level playing field for starting your CSS, it sets margins and borders to zero and does other nice things, like setting list-style to none.

I already do this in most of my stylesheets, but I think I might use this one instead, it should simplify things quite a bit.
Make pretty rounded corners with cornershop.

The Task Analysis Grid

This looks like a great way to communicate what your application is going to do to all members of your team, from the business end, through marketing and sales, to the development and testing teams. I really like how it is focussing on telling a story of your end user and what she wants to do.

This is even more powerful than those user interaction diagrams popular in UML, I never found those to be very clear, just lots of arrows pointing to different labels. Instead, we should look back to this ancient tradition of story telling, we are wired to understand stories, and by framing our discourse in a story, we can communicate to a wide variety of people.

Here's to more storytelling in computer programming!
Great Works in Computer Programming

A list of some of the all time classic papers in Computer Science.

Saturday, December 16, 2006

"keep in mind that nowadays search engines reward sweat-of-the-brow work on content that bait natural links given by choice."

From the Google Webmaster Central blog.
Parsing XHL with Hpricot
Environment variables in Rails

Friday, December 15, 2006

How the web works: HTTP and CGI explained
Getting Started with CGI Programming in C
I heart Emacs.
It would be really neat to be able to post to the new Blogger Beta with Emacs. Here's some links that might help:

backpack.el - Interact with Backpack from 37signals with Emacs
rest-api.el - A REST API in Emacs
org-mode todo list
- Google Data APIs (Beta) Developer's Guide
How the web works: HTTP and CGI explained

Right now, telepathytest.com already works, and has worked for a number of months. However, I have very limited server resources, and it's going to take a dedicated Rails server for each Sender and Receiver, which is going to add up to a lot of memory use for a decent amount of people.

The way I'm thinking of doing it is to have a custom C server that listens on a port and talks to the Javascript clients, starting the test, checking to see if the two clients are still around, perhaps getting intermediate results back from the Receiver, and then storing the results in the database.

Another way to do it would be to just write the C server as a really simple CGI script that would talk to the Postgres database. However, this really doesn't appeal to me from a coder point of view, since if we just could keep the data in memory, it could be so fast and cool.

I'll keep you informed as to my progress. :)
Beej's Guide to Network Programming Using Internet Sockets
How to write a server
sample code for writing a TCP/IP server in C.

fractal flames

map of the internet

Saturday, December 09, 2006

“ Ruby’s the only language I’ve ever used that feels like it was designed by a programmer, and not by a hardware engineer (Java, C, C++), an academic theorist (Lisp, Haskell, OCaml), or an editor of PC World (Python). ”

William Morgan

I tend to agree, and would add that Ruby is really nice at making code easy for humans to understand. Anyone who knows me knows that I put a *lot* of comments in code, but I find I do this less with Ruby on Rails, it's pretty redundant to say:


# Make an Array with the names of all the users
@users = User.find(:all)


Nowadays, I tend not to comment these common Ruby idioms, but instead have comments for each method as to what the overall plan for the method is.

I heart Ruby.
rinari.el is a really cool new way to interact with Rails from Emacs. To install it from SVN:


svn co svn://rubyforge.org/var/svn/rinari/trunk rinari

Friday, December 08, 2006

Hi friends, this is sness, your host here at "The Blog Of sness".

I just wanted to tell you that I've just launched my new website : lovemygarden.net. It's a site where you can journal (or blog) about your garden, post pictures, design your garden (with AJAX!), keep reminders, have your garden inventories online and do a whole bunch of other neat stuff.

Please do visit it, and let me know what you think.

xoxoxo,
sness.

Wednesday, December 06, 2006

Friday, December 01, 2006




I participated in Nethack Tournament 2006 this year, it was a lot of fun! The old school game Nethack is definitely my favorite computer game of all time, I remember playing it back in 1987 on my Mac Plus. Back then, I loved it, but the version I had would crash at random times.

Then, years later, probably in 1994 or so, I found Nethack again on Linux, and promptly fell in love.

It took me years to ascend that first time, my first ascension was in 1999, I was so proud I posted it on rec.games.nethack.rougelike. She was a Valkyrie named sness.

After finishing Nethack, I went on to ascend a character in Slashem, which is an enhanced version of Nethack.

In 2004, I participated in the Nethack Tournament, a really cool competition where many of the best Nethack players in the world have one month to try to ascend as many games as they can. In 2004, I got 2 ascensions, and got the trophy for the Birdie.

This year, I wanted to try again, and had a fun month playing. In the end, I ascended four characters:

Chaotic Elven Wizard
Neutral Human Tourist
Lawful Dwarvish Valkyrie
Neutral Gnomish Healer.

I had a promising Chaotic Orcish Barbarian, but I was running out of time and dove for the castle, and as I was killing the water creatures in the moat, something snuck up on me and got me. I'm almost glad, because it was already 9pm on November 30th, and I only had 3 hours to finish it, which for me was probably not quite enough time. I'm quite a careful player, but not as careful as Marvin.

So, here are my trophies for this year:

The Double Top
The Birdie
and First Runner Up for highest Healer score

Yay!