Jonathan's Pancheria

dotcom Thousandaire

technical

...And we shall call it NetBlub

Paul Graham first wrote about a strawman hypothetical programming language blub that examined the constraints that people who choose to stay firmly embedded in only one language seem to impose upon themselves and their programming capabilities and creativity.

Steve Vinoski, who has been writing a bunch about some of the failures of RPC-style distributed systems technologies (and should know, having been involved in CORBA), I think just extended the theme to distributed systems programming here.

Published on 02/07/2008 at 06:07AM under . Tags , , , , ,

Running Rails Apps on a Nokia N810

Goaded on by requests for screenshots of Tracks running on my n810, I decided to instead document to the best of my recollection what I did to get Tracks and Instiki running on my n810.

Table of Contents

1. Preface: Why?

2. Screenshots

3. Prerequisites

4. Tracks and Instiki

5. Wrapping Up

DISCLAIMER: I am going to show you how to do some things that can probably badly mess up your device if you get them wrong, and maybe even if you follow these instructions to the letter. I do not promise that these instructions are even complete or accurate anymore; I am nearly positive the instructions below are incomplete regarding what to install. You follow these instructions at your OWN RISK. This worked for me, it may or may not work for you, with or without additional steps. I did this about 3 months ago and was not taking good notes because I figured over time apt packages would catch up and this would not be necessary to repeat. If you follow and you get warnings you need to install additional stuff to continue, you should probably assume that is correct.

Preface: Why?

So one of the main reasons I actually got a Nokia n810 internet table (Linux/gnome-based tablet) was because:

  • It had a keyboard
  • It ran Linux and was reasonably powerful enough to possibly run some interesting things
  • It might let me replace my horrible system of “engineering notebook” plus wiki on my personal laptop plus complete lack of organizational system for keeping track of tasks with a single device that could provide all of that in a small, portable package

To get this, however, I was going to have to be able to install 2 Rails apps that I liked:

  • Instiki, for wiki
  • Tracks, for GTD (Getting Things Done) task management

I pre-ordered my n810 directly from Nokia (with a very nice discount) before it was available, and received mine I think within the first week of its being generally available in the United States. So to preface this description of how I got things working, I did all this in late November, 2007. Some packages may have moved around, and there may be better ways to do things than what I had to do. But Chinook (OS2008) ported packages were fairly slim at that time.

I should also point out that I was not interested in developing Rails apps on this machine, just installing and using them. Once I got things to an acceptable level of “done” for me, I did not investigate some pecularities further. So some things that you will not have after this are:

  • The ruby gem system is not installed. I did get it installed, but could not get it to actually read the gem catalog, so I see no reason to describe how to install it. Could it be made to work? Don’t know and I don’t care for my purposes on this box. I have gem working lots of other places on different chip architectures, but the n810 was not a target I needed it working on at this time
  • I did absolutely no investigation on how to have Rails apps start when you boot up the n810. I have a shell script I use to start my apps, and anybody who wants to take that to the next level and get this autostarted, please document it and I will gladly use it. But my shell script works for me since I reboot the thing maybe once every 3 weeks
  • This does not get you the Rails gem installed anywhere in your site_ruby, nor ActiveRecord, nor anything else. Most packaged Rails apps seem to freeze their Rails install into railsapp/vendor anyway these days, so installing a pre-packaged app works just fine. So my instructions may not work for some Rails apps, and it certainly won’t work for you to start making your own new Rails app on your n810

Screenshots

So without further ado, as a tease, here are screenshots of Tracks running on my n810. As you can see by the lateness of many actions, I have been better about getting Tracks set up than in actually having it improve my personal organization!

"Home" screen in Tracks"
h4. The Tracks “Home” view. David Allen would be appalled!

Adding a next action
h4. Adding an action. Notice that the Ajax calendar works just fine.

Prerequisites

These are the steps to take to get the basics set up on your n810 to even put a Rails app like Tracks or Instiki on it.

Turn on Red Pill Mode

I am not sure this is strictly necessary, but I had it on while I was doing this,and I suspect it’s necessary. This is the first but not the last dangerous part of these instructions. Instructions on doing so, and what it does for you, are on the Maemo wiki here

Libsqlite3-0

libsqlite3-0 appears to already be installed, so there is nothing to do. But you might want to confirm in the Application manager that it is already installed.

Install Ruby and Ruby Sqlite3 Bindings

-I got the packages from http://maemo.rubyx.co.uk/ruby-maemo/ however the site appears to have been down for a while now.- The ruby packages I installed appear to now live at http://gplsystems.com/apt/dists/chinook/main/binary-armel/Packages (thank you friend and coworker who wishes to remain anonymous). The packages I installed, which I recall all coming from there, were:

  • libruby1.8
  • libruby1.8-dev (not sure it’s necessary, but I grabbed it)
  • ruby1.8 (1.8.6-p110-1)
  • ruby1.8-libxml (I don’t think it’s necessary, but I do a lot of stuff with XML)
  • ruby1.8-maemo (again, not sure it’s necessary)
  • ruby1.8-sdl (nearly positive I did not need this)
  • ruby1.8-sqlite3 – definitely required

I found and installed rubygems from somewhere, but I could never get it to do anything but hang trying to update catalog. Both Instiki and Tracks releases ship “complete” so there’s no gems needed, so I skipped this.

Add the Maemo Repository to Application Manager

Add the maemo stable repository at http://repository.maemo.org/. When you are done, the apt.sources line ends up looking like “deb http://repository.maemo.org/ chinook free non-free” for those of you that like to look at the raw apt package configuration files.

I also added the Maemo extras repository and maemo-hackers.org repository

Install p7Zip, gcc, make and some needed Libs

Since rubygems didn’t work for me, I decided to install mongrel from source. You need gcc, and I think make. You also need something to unpack tar/zip archives, and at the time the only maemo package I could find was p7zip. These are in the maemo repository/repositories you added earlier. I have

  • p7zip 4.42.maemo-1
  • make 3.80-9osso
  • gcc 3.4.4
  • libc6-dev if you don’t already have it

There may have been some other pieces needed too.

Download and Install Mongrel

Webrick runs on the n810, for values of run equal to a geriatric snail. You will not be happy with a Rails app running under webrick. Mongrel is, while not exactly instantaneous, at least responsive enough to run an AJAX-y Rails app.

Download the mongrel source tarball from http://mongrel.rubyforge.org/. 1.1.1 was the latest at the time but they are on 1.1.3 as of February 5, 2008. Untar to a directory (using p7zip). Then do ruby setup.rb which should configure, build, and install mongrel. You should now have /usr/bin/mongrel_rails.

Tracks and Instiki

Where to Install

You will be installing Tracks and Instiki from source tarballs or zipfiles. After you download them, you will need to unpack them somewhere, using p7zip. I put them on my removable media card, which is /media/mmc1 because I was concerned about the GPS/mapping software filling up the fixed 2GB memory card /media/mmc2. If you plan to swap out memory cards often that might be a bad decision for you, but I am happy with it.

Tracks
  • Download a Tracks tarball/zipfile. I used Tracks 1.043 which was the latest “release” drop on their site, but I am sure you could grab trunk out of the Tracks source repository and turn that into a tarball too
  • Untar/unzip the source archive and cd to the top directory of Tracks. In my case that was /media/mmc1/tracks-1.043. You may lay it down differently, but if so remember to alter your paths throughout the rest of these instructions appropriately.
  • cd into the tracks directory you just unpacked
  • Make sure that the database.yml in the config subdir is set up the way you like. I left mine using db/filename.db as it shipped
  • Now the moment of truth: start up Tracks. From the main directory you could do ruby script/server just to test (it might start up webrick instead of mongrel, for values of might equal to probably). If it starts up without error, point your web browser at your Tracks instance: http://localhost:3000/
  • Once you have it up and running, you can stop Tracks with ctrl-c
  • Now try mongrel. /usr/bin/ruby /usr/bin/mongrel_rails start -c /media/mmc1/tracks-1.043 -e production -a 127.0.0.1 -p 3000 is what I use in my environment. You might need to adjust the path after -c to match how you laid down Tracks. It should start up, and you should be able to point your web browser at it. If so, go ahead and stop Tracks by typing ctrl-c.

Congratulations, you’ve installed Tracks on your n810!

Instiki

  • Download Instiki 0.12.0 (or newer if it exists and you want it). I would avoid earlier versions of Instiki that use Madeleine for persistence. 0.12.0 uses sqlite3 for persistence, and that seems safer than using Madeleine on the n810
  • Untar the source archive and cd to the top directory of Tracks. In my case that was /media/mmc1/instiki-0.12.0. You may lay it down differently, but if so remember to alter your paths throughout the rest of these instructions appropriately.
  • cd into the instiki directory you just unpacked
  • Make sure that the database.yml in the config subdir is set up the way you like. I left mine using db/filename.db as it shipped
  • Now the moment of truth: start up Instiki. From the main directory you could do ruby script/server just to test (it might start up webrick instead of mongrel, for values of might equal to probably). If it starts up without error, point your web browser at your Instiki instance: http://localhost:2500/
  • Once you have it up and running, you can stop Tracks with ctrl-c
  • Now try mongrel. /usr/bin/ruby /usr/bin/mongrel_rails start -c /media/mmc1/instiki-0.12.0 -e production -a 127.0.0.1 -p 2500 is what I use in my environment. You might need to adjust the path after -c to match how you laid down Instiki. It should start up, and you should be able to point your web browser at it. If so, go ahead and stop Instiki by typing ctrl-c.

Congratulations, you have installed Instiki on your n810.

Wrapping Up

Now that you have Tracks and/or Instiki up and running, what next? I left my apps running on their default ports of 3000 and 2500, but you could run them on different ports if you chose. I saw no reason to do that, nor to find a webserver to proxy them to so they are off the “main” webserver. That’s just overhead the n810 really does not need.

Starting up Rails Apps

Once I was happy with my install, I made myself a little shell script to fire them both off. When I boot up, I start up an XTerm and fire off the script. Here are its contents (sorry for the iframe, it was easier):

Stopping Rails Apps

The easiest way I stop both my apps if I need to, like if I want to hook up the USB cable or otherwise want to make sure the Rails apps shut down cleanly, I just issue a killall ruby and that kills the mongrel processes given how I start them. Before you just do that, make sure you know what ruby processes are running on your n810 and that you’re ok to kill them all.

Note that it can take a good few seconds, from 15-20 up to maybe 30, for all the Rails apps to respond to the kill signal. Just be patient. I also highly recommend aliasing ps -ef | grep in the shell to pgrep because inputting the pipe symbol on an n810 is fairly cumbersome.

Published on 13/02/2008 at 05:28AM under . Tags , , , , , ,

Switch (back)

Well, after 12 years I have switched (back) to Macs.

Switch (back)

My first computer was an original 128k Mac, one of the very first ones. My mouse actually had a 5-digit serial number, IIRC. I gave up in 1995 swearing I would never buy another Mac:

  • I bought a Powerbook Duo 210-possibly the worst Mac ever engineered- right when it came out, shortly before Steve Jobs cut the price in half, and then shortly after that discontinued it. And no, he didn’t give me any funny money to go spend in his stores after he did it
  • The various unixes, which is how I made my living at the time, all had reasonable PC-based implementations that were free and open source. Linux was viable, and FreeBSD 2.2 was a really nice, stable OS
  • The Mac just did not have interesting software that I wanted to play with, and I could run systems I could get paid to play with on x86 pc hardware
  • Oh yeah, did I mention the turd of a computer that the Powerbook Duo 210 was?

The Good

So why the switch back? It comes down to things Just Working. I’ve been using various Linux distros, most recently Ubuntu, at home for a while. I will continue to run Ubuntu on my home laptop. But for a computer for the rest of the family to use, and for certain things for me, the Mac is just easier:

  • It is just about as easy to manage software on the Mac as on Ubuntu. I am convinced that the debian apt system (or possibly similar like yum or rpms) are the way to go for maintaining systems. But Apple’s installation system has so far been very easy to work with to get things on here.
  • Most importantly, once software and drivers are installed, the hardware and software Just Works

As a quick example, I installed the iSync plugin for my Nokia N95. I then used the iMac’s bluetooth wizard to connect to the phone, it found it and paired properly (no extra credit, most things do these days), but then iSync popped up and within 10 minutes of starting I had downloaded the plugin, installed it, connected my phone, and synced my phone into iCal and the address book

*Unix-y goodness. I like being able to pop into a shell and do things, and having rsync and friends around is nice

The Bad

So everybody touts the awesome OSX GUI. But here’s the deal, much of it is still the best that 1983 has to offer.

  • The single menu bar at the top of the screen that switches as you change apps has got to go. I have had the computer running less than a day and I’ve already thought I’ve closed an app about 20 times only to remember that closing the last window…closes the last window. It is too hard to get into and out of apps
  • I’m not thrilled about the dock showing both open and available apps. I would prefer one list of open apps and another of apps I frequently use to click on. I know there is a visual indicator of what’s open or not, but my dock is cluttered because I am used to using a strip of icons for apps I start frequently

Overall

Overall, I am happy with the switch back, but I think I’m jaded enough not to become too much of an Apple fan boy. There are too many usability nits left in the OS from 20 years ago.

I’m using firefox and thunderbird for mail because at the base of it I want an OS to run my apps on top off, and I like that I have the same apps on Windows, linux, and OSX.

Finally, I am sure I have said something in here to anger Mac, Windows, and Linux/Debian/Ubuntu fans everywhere. Remember, this is my choice. I use all 3 OSes now every day (Windows at work, Ubuntu on my personal machine, and OSX on the family computer). I use what works for me out of each of them, and none of them does exactly what I want for every single thing. Linux→Debian→Ubuntu and OSX each have their strong points, and I like each for what they can do. But each has downsides too. Remember, this is all IMHO, with the emphasis on my and opinion. You are free to have yours, and have them not be the same as mine.

Published on 25/11/2007 at 07:20PM under , . Tags , , , ,

Initial Lockdown of a Joyent Accelerator

Here are some quick steps I did to do initial lockdown of a freshly created Joyent Accelerator:

Change passwords

  • Sign in as admin via secure shell to the default account, change its password
  • su to root and change the root password
  • Go into virtualmin→webmin→Webmin Users→Click on the admin user. Then set Password Authentication to Unix Authentication in the dropdown box, like in this screenshot: Hit the Save button at the bottom of the page. After you do this, you will have to log back in to webmin. Alternately, you could just set the password to be the same as the one you used for the admin user you secure shell’ed in, if you are worried about webmin having access to the Solaris password authentication system. But then you also have to worry about keeping the passwords in sync.

Shut off unnecessary services

  • Disable apache: I am not ready to run a webserver yet, so I shut off apache by su’ing to root and running # svcadm disable cswapache2
  • Make postfix only accept mail from localhost: Webmin→Server→Postfix Configuration→General. Set the text box on “Network interfaces for receiving mail” to localhost, like in this image: then save. Then stop and restart postfix

When I was done, my netstat -a -f inet display showed only the following listening ports:

  • *.s s h: s s h daemon
  • *.10000: webmin
  • localhost.smtp: smtp, but can only be accessed via localhost
  • localhost.3306: mysql daemon

Published on 25/05/2007 at 04:37AM under . Tags , , , , , , ,

IT versus software development

Having worked at some places with what I would call “restrictive access policies” regarding internet sites and ports that can be accessed, as well as the software and configuration of computers issued to employees, I am led to the following question for companies that develop software:

If you do not trust your software developers with their own computer, how can you trust them to write the software products you sell?

If you are worried about me setting up my own printers, or installing software on my computer, or where I browse, then how can you trust the commercial software that I write for you? Sure, there are criminal penalties for the latter, but are you saying that the only way I will behave in a lawful manner is under pain of imprisonment?

Published on 03/10/2006 at 08:38PM under . Tags , , ,

Sound Bite for Rest/non-object serialization web services

I have posted several times about it, made a bunch of different arguments, and anybody who has talked to me about web services has heard me try and make the argument not to force a web service to be the serialized transfer of object artifacts. But here’s the summary in a nice single sentence from the post CommonRESTquestions:

REST can be seen a documented-oriented subset of Object-Orientation. It deliberately reduces the expressiveness of Objects down to the capabilities of resources to ensure compatability and interoperability between components of the architecture.

The rest of that paragraph goes on to say

Object-Orientation allows too great a scope of variation for internet-scale software systems such as the world-wide-web to develop, and doesn’t evolve well as demands on the feature set change. REST is Object-Orientation that works between agencies, between opposing interests. For that you need to make compromises rather than doing things your own way.

So there you go, someone said in a paragraph exactly what it has taken me 2 years to try and say.

Published on 02/10/2006 at 02:17AM under . Tags , , , , ,

Font hinting in Ubuntu

Courtesy of Sean McGrath, who found it elsewhere.

Put this in .fonts.conf in your home directory:


<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="font">
    <edit name="autohint" mode="assign">
      <bool>true</bool>
    </edit>
  </match>
</fontconfig>

Published on 09/06/2006 at 02:39PM under . Tags , , , , ,

Evolution versus Design in Economics

Found this wonderful article today
with the following excerpt:
bq. In the world of economics, it is the U.S. that believes in natural selection, and it is Europe, specifically the EU and its leading countries, which clings to an outmoded ideology of intelligent design.

I bet this economic argument at the macro level also works at much smaller business cycles as well, including computer software development. Here is another quote from the link above:
bq. The problem with intelligent design is that it is rarely intelligent enough to out-perform self-organizing systems shaped by natural selection.

Agile Programming is natural selection: short cycles that produce output that can be tested for validity and if it doesn’t survive then it wasn’t fit. On the other hand, you have not invested much into it and it can go away or be replaced by a more suitable design based on the results of the previous design mistakes. Each iteration has fewer equations and fewer unknowns, to use an algebra analogy. Biologically, Agile is a colony of beetles. Lots of offspring appearing quickly.

By contrast, long product cycles with a heavy emphasis on planning, product management, large design documentation and so forth are intelligent design. The effort and time that implies means that you are trying to make intelligent feedback over a long time with no input from your environment. When the result is finally born it turns out that it probably does not meet your needs on many fronts, and if it does not the problem is that you have invested too much time and energy into bringing it to fruition that nobody has the will to let it die. More equations, more unknowns. Long cycle, “high ceremony” processes are dinosaurs. Long gestation period, few offspring.

Which one survived until the present day, and which one ended up so out of touch with its environment and/or so unable to adapt that it perished?

Published on 08/02/2006 at 10:03PM under .

SOA for managers

Finally, a description of good web service/SOA design that even pointy haired bosses can understand :-)

The graphics are designed to make it clear to non-technical users how to go about designing the boundaries of your web services/SOA!

Published on 06/02/2006 at 05:21PM under . Tags , , , ,

More on toolkits reducing impedance mismatch by working with raw XML

Earlier, I posted about how not forcing all access to web services to go through objects that were serialized into and back out of XML but instead were XML documents that were designed to stand on their own made it easier to implement both web services and web services clients.

Elliotte Rusty Harold sets out a nice short example of the nature of the problem. He summarizes the problem nicely in this quote

“don’t “help” users out by changing XML into something else, especially not objects. Don’t assume you know what they’re going to want to do with the data. Give them the XML and let them use the classes and objects that fit their needs, not the ones that fit your needs. XML is exchangeable. Objects are not."

Again, for the record: if I work with your web service, you do not know what data, data structures, or code artifacts I will have in place to access your web service. Please don’t try to guess by forcing me through your view of how the software artifacts should look. Let me figure out how to make the raw message, and how to interpret what you send back. SOAP toolkits that closely map XML to particular language-specific data structure constructs and back make this hard.

Published on 09/12/2005 at 07:47PM under . Tags , , , , , , , ,

Powered by Typo – Thème Frédéric de Villamil | Photo L. Lemos