Monday, March 26, 2007

zsh resources

I'm so happy that I switched to zsh, it's like how I live inside Emacs, you might not need all the features, but you know if you ever need something, that you can do it. It's really nice to know that the things I'm learning now I'll be able to use 20 years from now, the constant relearning process really sucks when it comes to things like your shell and editor.
Emacs Keybindings for Firefox

It's easy, just add the following line to your ~/.gtkrc-2.0 file:


gtk-key-theme-name = "Emacs"


Essential goodness for Firefox.
A big chart of the history of operating systems. Neat.
I've had Emacs running for weeks on-end with buffer lists in the dozens. I love Emacs and I am ready to be more than just friends.
A couple tiny window managers:

dwm - A hardcore little window manager in 2000 lines of C. Looks really cool, but doesn't support the multiple desktops and multiple virtual desktops, which I need.
xmonad - 400 lines of Haskell (a window manager in Haskell, that's just perverse!)

Sunday, March 25, 2007

A great series of articles on IBM Developer Works about SSH Key management:

Part 1
Part 2
Part 3


and, to go with that, a page about keychain, a program to manage your SSH keys for you.

Thursday, March 22, 2007

FedExNet - Transferring huge amounts of data, turns out that the best way currently is to get a bunch of big cheap SATA disks, put them in a cheap PC and FedEx the whole thing. Very interesting.

We did a similar thing as crystallographers when we went to synchrotrons, besides the crystals, we'd often bring a USB or Firewire harddrive and hook it up to their servers.

I wonder, with the new infrastructure Google is putting into place with all those huge datacenters, why don't they just put in a fat pipe into the universities they're collaborating with?

Sunday, March 18, 2007


The first lettuce sprouts of the year have just appeared!
S3 on Rails - A neat little sample Rails application that uses S3 for storage. A nice article because it gives lots of sample code as well.
wz_tooltip.js - The Walter Zorn (wz) tooltip library for javascript.

I've tried a number of different tooltip libraries for Javascript, and this seems to be one of the better ones.
How to use an index in your database - Some really important information here.

Indexes are a way to speed up access to certain rows in your database. Indexed keys are stored in a special datastructure, usually something like a B-tree which allows quick lookup of columns in a SELECT.
How Prototype extends the DOM. I find Prototype essential to using Javascript, I have come to really rely on things like the $() selector, and now with the enhanced performance of $$() in Prototype 1.5.1, I'll be using it even more.
SQL injection cheatsheet - Good things to know to help you secure your server.

I'm really lucky, I use Ruby on Rails, and if you use it right, it'll protect you from most SQL injection attacks. It's still really good to be aware of these attacks, though.
Easy Clearing - How to clear floats in an enclosing container, the easy way.

It's basically saying that they don't like the current way of doing the following to clear a float in a container:


<div> <!-- float container -->
<div style="float:left; width:30%;"><p>Some content</p></div>
<p>Text not inside the float</p>
<div style="clear:both;"></div>
</div>


and instead they recommend you put a ".clearfix" class in each float you want to clear, and put the following in your CSS file.


.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}


Well, I think this is pretty ugly, and as well, you still have to put a ".clearfix" attribute in the container you want to fix, so I will still be doing it the old way, myself.
How to use S3InfiniDisk from Amazon Developer Connection
S3InfiDisk for EC2 - A distributed caching system for EC2 with backend storage on S3.

This is a really interesting concept, and is going to be really useful for deploying applications on EC2. Right now, it's a little tricky, because each EC2 node isn't persistant, so you have to store all your permanent data on S3.

Now, we need something like this to be GPLed, and perhaps something more like Gluster, so that we could use those huge 160GB disks on each EC2 instance for fast access and caching, and then use S3 for permanent storage.


From the really wonderful online comic The Devil's Panties.

Wednesday, March 14, 2007

It was finally getting to me how I would have to press the "o" key four
times just to see where I was in the program. So, I hacked the
source. This is why free software is so important, sometimes, your
freedom includes not having to type the "o" key four times. Your
freedom is also how you interact with the world, and having to do that
over and over was getting to me. Ok, rant over, code begins:

I looked through the code until I found the code that deals with the
keypresses and found the relvant section, and just hacked it brutally
to do what I want. osd_level can be 0..3, and I wanted it to cycle
between level 1, which is the osd enabled, and level 3, which is full
osd display. So I changed the code to say:


if(v < 0)
if (osd_level == 1) {
osd_level = 3;
} else {
osd_level = 1;
}


Then, I didn't want the "OSD:enabled" message to display when I went
back to OSD mode, so I just commented out the offending code:


/* if (v == -1 && osd_level <= 1)
set_osd_msg(OSD_MSG_OSD_STATUS,0,osd_duration,
MSGTR_OSDosd, osd_level ? MSGTR_OSDenabled :
MSGTR_OSDdisabled);
else
rm_osd_msg(OSD_MSG_OSD_STATUS); */


Simple. No fuss, no muss. I was in and out in 10 minutes. It could have
been prettier, but part of the beauty was that it does exactly what I want
and it took almost no time to code.
:counter_cache - A way to do counting in Rails without having to query the database. Instead, a counter is kept updated when new items are added and removed from the database. Sweet.
I love this plugin: annotated models - It puts your schema definition at the top of your app/model/*.rb files. This is really sweet since you then don't have to have your schema.rb and your model.rb file open at the same time.


wow, so sweet, a big picture showing the http response codes.

Saturday, March 10, 2007

25 Code Snippets for Web Designers - Really sweet tips and tricks for CSS.

Friday, March 09, 2007

For yarn.sness.org, I need to slurp a bunch of data into a database,
and I remembered doing this for lovemygarden as well. The trick is to
put the data in a yaml file and use load_from_file to load the data.

First, install the plugin:


./script/plugin install http://topfunky.net/svn/plugins/ar_fixtures


Then, for example, if you have the following data in a file:


---
- !ruby/object:Amendment
attributes:
updated_at: 2006-07-07 11:56:10.086189
id: "1"
entry: Added 1 big bag of peat moss
user_id: "1"
created_at: 2006-04-16 12:40:00
- !ruby/object:Amendment
attributes:
updated_at: 2006-07-07 11:56:10.295888
id: "2"
entry: Added 3 shovel fulls of compost
user_id: "1"
created_at: 2006-04-18 12:40:00


You could put the following into a file in the db/migrate directory, like db/migrate/insert_data_001.rb


Amendment.load_from_file


And then run it with:


script/runner db/migrate/insert_data_001.rb



I learned this from:

nubyonrails - dump-or-slurp-yaml-reference-data

mmm tasty... edible turing machines...

Thursday, March 08, 2007

The Page Paradigm:

- - - - - - - - - - The Page Paradigm - - - - - - - - - -

On any given Web page, users will either...

- click something that appears to take them closer
to the fulfillment of their goal,

- or click the Back button on their Web browser.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Google spreadsheets go Camping - Some code to show how to integrate Google Spreadsheets with Why's great little Microplatform, Camping.

Wednesday, March 07, 2007

Monday, March 05, 2007

Wow, this would really rock, if I could get it running: An Emacs client for Google services

With it you can post directly to your blog from Emacs. Now that just rocks.

Another similar blog post about it

Also, a really nice mode for editting HTML/XML in Emacs is nxml-mode. I'm personally doing all my HTML with Ruby on Rails, even for static sites, I use RoR and generate static content, and for all my Rails interaction I use rinari.

Some info on the Google Data API

Also, this is just sweet: AWS::S3 - This is a Ruby library to interact with Amazons S3 (Simple Storage Service). If you're not into S3, EC2 and SQS yet, you need to be, it's so the future.
I think I used to know this, but I just learned this again:

How to open a tab in an existing Firefox window:


firefox -remote "openurl(http://www.mozilla.org)"

Friday, March 02, 2007

Performance tuning Apache:

Tuning Apache - Some links and general information
Perl tuning with ApacheBench - contains other good information as well
tuning Apache