Archive for the 'personal' Category

Weekend Rails Hacking

Monday, May 5th, 2008

For the past 4 years I’ve been using evite to manage the RSVPs for our memorial day weekend party. Given that it’s a pretty large scale pot luck event, it’s helpful to have a system where people can respond with a message that others can see. The reduces my need to field “what should we bring” questions, as you can easily see what everyone else is bringing and react accordingly.

Evite sucks. While it doesn’t force attendees to make accounts, it makes it look like it does. The evite.com emails tend to catch as spam. And the interface is now dubious under firefox. The idea is still good, but it hasn’t really ramped with the trends in the rest of the service web application space.

One of the key things I wanted in an evite replacement is getting rid of user logins. Given an event, and an email address, you can come up with a unique key that qualifies that person for that event. That means the user just follows a link, and they are in. Links are unique for people. If you make the key a hash of the person’s email and some secret seed key for the event, you’ve got something cryptographically strong as well. No one can modify another person’s entry because the key needs to match before you get any info.

Saturday was a rainy day, so I built this system. By Saturday night I had most of it working, and had rolled this out live by Sunday afternoon. This was my first rails 2.0 app, so I needed to catch up on a few things along the way. Things I learned:

  • Rails 2 creates scaffolds in a slightly new way. That threw me for a bit, as I had already built models for most of my objects before creating scaffolds. The new way (putting attributes on the command line) looks like it is designed to make rails tooling easier.
  • ActionMailer is crazy easy. It even does multipart mixed emails really easily. My mhvlug mailer script for month announcements is going to need to be converted to this at some point.
  • Rails has a word_wrap function in the view context. Of course it does, why did I even doubt that.
  • The google maps API is impressive. I had maps based on event location within 60 minutes of signing up for my Google Maps API key.
  • The f= param on maps.google.com is which fuction to drive. q: location query, d: directions. That took a little bit of reading urls to realize.
  • It’s pretty easy to integrate mercurial push to auto restart a rails app if it’s running under passenger.
  • If you are running multiple versions of rails applicatoins under passenger, delete all the rails links in vendor/ so that it picks up the right rails environment.
  • arround_filter in rails is really handy to catch generic exceptions and dump people off to an error page that isn’t the default rails one.

All in all, I was really happy how this turned out. As soon as I get some free time I’ll genericize the bits of the app that I coded just for our event, and get this out on rubyforge. I only wish there was a rails equiv of gems, as I’ve still found that it isn’t entirely clear how to best package a rails application as an easy to download open source component.

Popularity: 13% [?]

Dague.net move

Wednesday, April 30th, 2008

Once upon a time I said I would never host my own email (or email in general), as it was a pain I didn’t want. Then, I ended up hosting email for mhvlug.org because it turned out to be the simplest solution. A week later I installed postgrey, and watched the spam rates drop by 80%. And it was good.

A couple things changed in the last year. Linode went from UML to Xen, which definitely makes each linode more powerful. My shared hosting company stopped being helpful. I had a couple of small outages. They had moved from a knowledgable support staff, to a support pool that was clueless, and never seemed to understand the ways in which their system was broken. And, after hosting mhvlug email for a while with no issues, it seemed reasonable that dague.net email would be safe there as well.

Backups (thanks to backuppc) have been ramped up from every 24 hrs to every 6 hrs on the box, to narrow my window in which I can screw things up. Only one set of email delays so far, mostly because I set a wrong postfix param over the weekend, which may have been blocking mhvlug.org email as well. But that is resolved now. Dan will at least thing I’m a real man now. ;)

Popularity: 22% [?]

Mono 1.9 install script

Saturday, March 29th, 2008

Unfortunately no one has made ubuntu packages yet, however here is a script that I built based on Dirk’s post to automate mono 1.9 installation onto Ubuntu environments.

#!/bin/sh

# This is needed to pick up our built mono for commands
export PATH=/usr/local/bin:$PATH 

apt-get install build-essential bison gawk
apt-get install libglib2.0-dev
apt-get install libpng12-dev libx11-dev libfontconfig1-dev
apt-get install libfreetype6-dev libjpeg62-dev libtiff4-dev
apt-get install libungif4-dev libexif-dev libcairo2-dev
apt-get install libpango1.0-dev libgtk2.0-dev libglade2-dev
apt-get install libgnome2-dev libgnomecanvas2-dev libgnomeui-dev
apt-get install libgnomeprint2.2-dev libgnomeprintui2.2-dev
apt-get install libpanel-applet2-dev libgtksourceview-dev
apt-get install libgtkhtml3.14-dev

BUILDDIR=~/mono-build
mkdir -p $BUILDDIR
cd $BUILDDIR

wget http://go-mono.com/sources/libgdiplus/libgdiplus-1.9.tar.bz2
tar xvf libgdiplus-1.9.tar.bz2
cd libgdiplus-1.9
./configure --prefix=/usr/local
make
make install
cd ..

wget http://go-mono.com/sources/mono/mono-1.9.1.tar.bz2
tar xvf mono-1.9.1.tar.bz2
cd mono-1.9.1
./configure --prefix=/usr/local
make
make install
cd ..

wget http://switch.dl.sourceforge.net/sourceforge/nant/nant-0.86-beta1-src.tar.gz
tar xvf nant-0.86-beta1-src.tar.gz
cd nant-0.86-beta1
make install --prefix=/usr/local
cd ..

wget http://go-mono.com/sources/gtk-sharp210/gtk-sharp-2.10.4.tar.bz2
tar xvf gtk-sharp-2.10.4.tar.bz2
cd gtk-sharp-2.10.4
./configure --prefix=/usr/local
make
make install
cd ..

wget http://go-mono.com/sources/gnome-sharp2/gnome-sharp-2.16.1.tar.gz
tar xvf gnome-sharp-2.16.1.tar.gz
cd gnome-sharp-2.16.1
./configure --prefix=/usr/local
make
make install
cd ..

wget http://go-mono.com/sources/gtksourceview-sharp2/gtksourceview-sharp-2.0-0.12.tar.bz2
tar xvf gtksourceview-sharp-2.0-0.12.tar.bz2
cd gtksourceview-sharp-2.0-0.12
./configure --prefix=/usr/local
make
make install
cd ..

cd mono-1.9
wget  http://go-mono.com/sources/monodoc/monodoc-1.9.zip
unzip monodoc-1.9.zip
cd monodoc-1.9
./configure --prefix=/usr/local
make
make install
cd ../..

wget http://go-mono.com/sources/mono-tools/mono-tools-1.9.tar.bz2
tar xvf mono-tools-1.9.tar.bz2
cd mono-tools-1.9
./configure --prefix=/usr/local
make
make install
cd ..

wget http://ftp.novell.com/pub/mono/sources/mono-debugger/mono-debugger-0.60.tar.bz2
tar xvf mono-debugger-0.60.tar.bz2
cd mono-debugger-0.60
./configure --prefix=/usr/local
make
make install
cd ..

wget http://ftp.novell.com/pub/mono/sources/heap-buddy/heap-buddy-0.2.tar.gz
tar xvf heap-buddy-0.2.tar.gz
cd heap-buddy-0.2
./configure --prefix=/usr/local
make
make install
cd ..

wget http://ftp.novell.com/pub/mono/sources/mono-addins/mono-addins-0.3.1.tar.bz2
tar xvf mono-addins-0.3.1.tar.bz2
cd mono-addins-0.3.1
./configure --prefix=/usr/local
make
make install
cd ..

wget http://ftp.novell.com/pub/mono/sources/monodevelop/monodevelop-1.0.tar.bz2
tar xvf monodevelop-1.0.tar.bz2
cd monodevelop-1.0
./configure --prefix=/usr/local
make
make install
cd ..

Popularity: 100% [?]

Passing of Gygax

Friday, March 7th, 2008

I remember very vividly being introduced to D&D at the age of 12.  A friend of mine from junior high, Travis Dudley, had all five 1st edition boxed sets.  Our first coupld of days with them were mostly creating level 55 characters and fighting Dragons.  Not high art, but incredibly fun.

A year later 2nd Edition came out, and we started being interested in things besides just battles with dragons.  I remember getting issues of Dungeon Magazine, and DMing adventures out of there.  D&D lead off into other RPGs, like the teenage mutant ninja turtles universe, shadow runner, cyberpunk, and a range of table top games.  It even lead to my friend Chris and I writing our own table top game (85 page rule book), that had 3 generations of game play mechanics at the age of 15.  Yes, at 15 we spent our spare hours writing an 85 page rule book, printing out drafts on my dot matrix printer (which took about 3 hrs), and doing play testing and editing.

But it all started with cracking open Gygax’s D&D and a realization: with a few well crafted rules your imagination can take you to places you never imagined.

RIP Gary.

Popularity: 16% [?]

Graphing with Gruff

Sunday, February 17th, 2008

The house monitoring project has made a little bit of progress, as I’ve now got data being collected into a rails app using backgroundrb, and can get that data back out into very pretty graphs with gruff.  (I also looked a little bit a sparklines, but that’s specifically for graphs without labels.)
 

We’re running above target temp as it’s the weekend, so the wood stove is on.  As is the furnace fan to spread the heat through the house.  I’m overloading the values for heat on an fan on to be either the bottom of the graph or a specific small value.  I need to sort out a better way to put that into the graph, which may require some hacking on gruff itself.

Popularity: 24% [?]

Early working thermostat code

Sunday, February 17th, 2008

I definitely don’t have this anywhere near I like it, but I did manage to just dump out a bunch of info from my thermostat and turn off the fan with this script:

#!/usr/bin/ruby

require ‘thermostat’
require ‘pdp_constants’
include Proliphix

t = Thermostat.new("192.168.1.30","admin","XXXXXXXX")
t.set_senors(ThermHvacMode, ThermHvacState, ThermFanState, ThermFanMode, ThermAverageTemp, ThermHeat1Usage)
t.fetch_data

# dump out what we have
puts t

# turn off the fan
t.set_data(ThermFanMode, 1)
 

I need some nicer symbolic constants for state setting, and pull together a rails site just to keep track of thermostat data over the course of the day.  All this code is going on my newly registered rubyforge project.

Popularity: 21% [?]

The Earth in OpenSim

Friday, February 15th, 2008

Xplanet is this great program on Linux that does projections of the earth (including all kinds of possible overlays to include things like real time clouds, earthquake activity, and major storms.)  For years I’ve used it as the background image on my Linux desktop.  On the way home last night, while chatting with my friend Trey, it occured to me that through creative use of OpenSim, we could easily do this this in world with dramatic effect.

Below is a couple of screen shots of my 10m globe.  I had to modify the code paths for osSetDynamicTextureURL to get 1024×1024 textures into the pipe, as 512×512 doesn’t actually look good wrapped on a 10m globe.  There is still a bit of work to make this really good (like completing osSetDynamicTextureURL so we don’t need another timing loop in LSL to do refresh), but the initial results are quite nice. :)

The circles with numbers are earthquakes in the last 24 hours plus magnitudes (this information comes from the TotalMarker project).

Here you can see the storm track of the named storm Ivan (also from TotalMarker).

Popularity: 21% [?]

Tuning the HD Set

Monday, February 4th, 2008

John came over prior to the game bringing his HD-DVD Video Essentials, and given that we had some time prior to the game, we spent some time tuning the set.  Honestly, most things were pretty good, though we had to tune down the color and up the brightness just a bit.  There was one adjustment we made that I can tell immediately made a difference, which was tuning the sharpness down to nothing.  One thing that had always bothered me was how Jack’s beard in lost seemed to shimmer in odd ways, though I was never really sure what caused it.  It turns out that sharpness on digital TVs pretty much just takes the digital artifacting and makes it 10 times worse.  The image looks a little softer now, but there are no annoying random artifacts on thin lines throughout the picture.

Thanks to John for bringing that over.  I still have the kit as I’m going to do audio balancing this week (as we didn’t quite have the time to do it before people showed up).  While my living room is only so tunable, I’m still looking forward to actually trying to balance in the sub woofer in a reasonable way.  I think it will be amusing to see how off my course grained adjustments are.

Popularity: 21% [?]

Thoughts on a smarter home

Sunday, January 13th, 2008

While our new woodstove insert is really great, and is definitely reducing our oil usage, it causes a bit of an issue when it comes to distributing the heat through the house.  When running on wood heat we get warmth right up the center of the house.  The office at the end of the upstairs hallway ends up being the warmest room in the house.  It is far too easy to make the upstairs unlivably warm, while the rest of the house is quite cool still.

Fortunately, we have a central air HVAC system, so the solution is to just turn on the furnace fan to redistribute the heat through the house.  This works pretty well, and at least mellows out the hot spots.  Ideally we wouldn’t run the fan all the time, but would duty cycle it on for some portion of an hour.  Honeywell makes a thermostat that has a cyrc fan mode, which runs the fan 35% of each hour, which was an option, but something else caught my eye.

The Proliphix Internet Thermostat NT20e is quite a nifty device.  It has a bit more programing than our current thermostat and has the advantage of having a web interface.  You plug the device into your ethernet network and get a web interface for all the controls and programming for the device.  What’s even better is that Proliphix designed this with further customization in mind by publishing an HTTP API to the device as well.  This makes is very easy to have a computer create further logic for the device, like forcing the fan on for certain hours of the day, while leaving the defaults for programming in the device itself.

I’ve now ordered mine, and it is on it’s way.  I can’t wait to get this thing hooked up.

Popularity: 13% [?]

Fighting jetlag

Sunday, January 6th, 2008

Just a quick post, as my body thinks it’s currently 2 AM. Susan and I are back from our India adventure, which should provide some solid material over the next couple of weeks as I manage to digest it all.

Popularity: 7% [?]