Bitwise Evolution

Musings of a Portland-area hacker bent on improving digital lifestyles.

Playing With Deepest Sender

I ran across Deepest Sender, a firefox extension used for posting to a blog, today and thought I’d give it a shot. It supports a small, but reasonable set of blog apps (Wordpress, LJ, … two or three others that escape me at the moment, and I can’t find the list right now..) Setup was easy, and it wasn’t difficult to connect to my wordpress install , but I don’t see how to add multiple blogs, or choose a blog to post to that isn’t the default. I’m also a bit mystified at how it manages drafts (you can save to a local file, but that doesn’t quite cut it – I want to take advantage of the draft capabilities of the blog app, so I’m not tied to one machine).

I wonder if it will let me use code tags in the rich editor..

1
2
3
4
5
 
-- haskell?
foo :: Int -> Int
foo x = x * x
 
1
2
3
4
5
6
 
// Java test
public static int foo(int x){
    return x * x;
}
 

…not really… (although, there is a source view, and it’s just a click of a tab to switch back and forth, which is how I entered the c# sample below, although it look horrible in the rich editor.) There are some interesting fields under the options menu, including a text area to enter a stylesheet, but no indication of what it does. I may need to dig into the help docs later, but I’ll probably look into emacs extensions first. For now, the jury is out. /// /// Sample c# /// public static int Foo(int x){ return x * x; }

Ah, when posting, I discovered how the draft works. There is a checkbox marked “draft” which publishes content as a draft, rather than to the site. It would be much clearer to just have two buttons: “Publish” and “Save as draft”, it would take up the same amount of space, and require fewer clicks, but I suppose you could accidentally publish to the main site when you really wanted to click on draft. In any case, it ruined the formatting on the code snippet, so for my purposes it will not work.

Home Is Where .emacs Is…

I finally found a way to quickly navigate to my home directory in windows today. Being a long-time (well, 8-10 years) Linux user, when I started working in windows 40 hours a week, I had to adapt a bit, but most of that adaptation meant installing cygwin utilities, bblean, and emacs. Unfortunately, it’s most natural to put all the configuration files for these apps in my home directory – a concept that is almost completely alien to a windows system. As you probably know, in Win XP you do have a home dir, conveniently located at c:Documents and Settingsusername which is not extremely easy to navigate to, and there are no simple shortcuts to get there as there are in Linux / unix environments.

This has been annoying me for some time. Everything goes into that directory – I’ve moved firefox downloads, Visual Studio projects, symlinked My Documents to there, etc… Now before you shout out that I brought this upon my self, consider that:

  • I needed everything to be in the same location, for what should be obvious reasons. (but if the reason’s arent obvious, try backing up all your crap from a multi-year old windows machine where you didn’t keep everything in one place)
  • More things were already using this location than were not (remember, most of what I use is cygwin).
  • Cygwin makes it mildly painful to access things that don’t fit nicely into the cygwin virtual filesystem thing.

Today, however, I found a solution. Oddly enough, the integration between IE and Windows is why this works.

  1. Open the Windows Explorer
  2. Select View-Toolbars-customize
  3. Add the “Home” button to the toolbar
  4. Click on it. (This changes the Explorer “mode” to web-browser, and allows access to configure that button.)
  5. Select Tools-Internet Options
  6. Set your IE home page to c:Documents and Settingsusername
  7. Voila! Click on the home button again, and there you are :)

foreach(What?)

I’ve been adapting to Java 1.5 and c# (and c#, with .NET 2.0), all of which feature a new construct: the foreach loop. The syntax is relatively similar to the construct in numerous other languages, such as perl’s:

1
2
3
4
5
 
foreach $var (@list){
    # ...
}
 

In c# (or java, the syntax is the same), to loop over an array or IEnumerable collection, you just do:

1
2
3
4
5
 
foreach(int x in indices){
   // ....
}
 

Unfortunately, as I found today, the c# version shares something else with the Perl version: An absence of type checking. Despite the explicit types in the loop construct, and the presence of generics (although these are missing in .NET foreach in c# is not type safe. The end result is that you can do fun things like this with out the slightest hint of a warning:

1
2
3
4
5
6
7
 
double[] values = new double[]{....};
/* snip */
foreach(int v in values){
   // guess what? v == Math.Floor(values[i]) !
}
 

I find this particularly vexing because if you simply re-write the foreach to be a standard for loop, then the type checker will jump in and complain about the loss of precision:

1
2
3
4
5
6
 
for(int i=0; i 

With collections this becomes slightly more complex, and in .NET pre-2.0, Enumerators were not typed (they would simply return Objects, making it impossible to perform compile time type checking), with .NET 2.0, however these constructs could be parametrized, eg:

 

“`

foreach(T id in IEnumerable){ // body }

1
2
3
4

Why this isn't done is a mystery to me.  At the very least a rewrite rule could be used to turn each foreach into an equivalent for loop.  (There are plenty of ways around any performance problems this would cause at run time, and I'm happy to pay a compile-time penalty if it prevents run-time bugs!)

<em>Edit: Just for completeness, Java 1.5 does not exhibit this behavior, either when itterating over generic collections or arrays of basic data types:</em>

double[] values = new double[]{0.5, 0.6, 0.7};

for (int v : values){ // causes compile time error. System.out.println(“v=”+v); }

“` Note that it is actually an error in java, not a warning even. I would assume this has something to do with the requirements Sun placed on backwards compatability with older JREs – much, if not all, of the java Generics changes are simply rewrite rules. C#, however, has no such constraints and can take advantage of a number of performance improvements that are not available to the java compiler. I still don’t see that as an excuse for discarding type saftey. –ERC

Licensed to Invent?

My background in software development was built up on a strong belief that software should be freely available. This belief led me to start using GNU/Linux and various GPL’d projects as an undergrad at Oregon State University. Changing from the norm was painful - I had previously been on a window-only operating system diet, and while I could use Emacs, I was not yet zealous about it. Numerous times I tried to go back to Windows, but the 2-4 week reinstall cycle that I had convinced myself was required (and may have been… this was in the early Win 98 days) drove me back to open solutions.

I eventually came to love the ability to customize everything. I have always been a “power user”, and I spent many hours crawling through the NT registry when I was in High school. Linux, with the countless window managers and themeing sites drew me in like WinHack never could. As I became more skilled in software development, I began customizing apps to my liking, hacking out bug fixes and adding features as I wanted them. (Find a new game that looks cool, but can’t stand playing it with the keyboard? Add joystick support!) All of this was made possible, or at least heavily benefitted from, open source licenses (Particularly the GPL).

The intricacies of the various licenses were generally opaque to me, but I understood the gist of it:

  • The GPL let you release source code that was free but could not be made non-free by anyone but the author.
  • BSD-like licenses were less restrictive.

That was about all I knew, or cared. I was happy with the GPL, and I’ve scoffed at the complaint that Viral licenses are evil. Recently, I started developing an application to assist with photograph management (back to the: customize everything point above… there are now to many applications to find exactly what I want, so I’m building my own–great solution, right?). I settled on Java for the programming language, and intended to use the SWT (released under the Eclipse Public License) as the widget toolkit, since it is a visually attractive cross-platform solution. However, I also want to make use of some GPL libraries. If you’ve read through the mentioned licenses, you probably see the problem already. It is not at all clear whether or not the SWT can be used with GPL applications. Azureus seems to be doing this, and releasing their code under the GPL. However, no one I’ve talked to can clearly state whether this is ok or not, and reference the relevant portions of legalese to support the claim. All this confusion has meant that the only “safe” route to either not release my program at all (I consider this unacceptable), or to settle on one of the two licenses above and only use compatible code, which means the GPL, simply because there is more GPL’d content available than EPL’d content. The depressing end is that the viral nature of the GPL is the reason there was a conflict, because the SWT cannot be re-released under an SWT-incompatible license (and it is not clear that I can do this and meet the GPL requirements that all source code be released as well.).

I doubt that either the Gnu foundation or IBM would chase me down for voiding a license for my personal photo manager, but the open source movement relies on the copyleft licenses to stay afloat, to a certain degree. Without respecting those licenses we become hypocrits.

I wonder if OCaml would work…

2005 in Cities

Copying an idea seen on Join-The-Dots:

  • Portland, OR
  • Corvallis, OR
  • Seattle, WA
  • Los Angeles, CA
  • San Diego, CA
  • Twin Falls, ID
  • Jackson Hole, WY
  • Lincoln, NE
  • Chicago, IL
  • DeBois, PA
  • New York, NY
  • Toledo, OH
  • Ogden, UT

One or more nights in each city. Now, if only I had some ground-breaking reason for being in Ogden, UT and DeBois, PA :).

Putting Social Networks to Work

In the post on mapping the intern, I briefly discussed how having a map of interns across the US would be a cool thing. However, there are obviously some privacy concerns with that. In the comments, Tessa mentions using instant messengers as a conduit for personal info. The appearance of Google Talk completed the connection, and got me thinking.

Google has all the infrastructure to do exactly what I want, and more. Unfortunately, as the Google tools are now, everything is disconnected. It is as if someone needs a meta-20% project to tie all these cool 20% projects together. (Sidebar: Google engineers are given 20% of their time to work on any side project the want. The idea is that some of these ideas will flourish and turn into the next great thing. Orkut started this way.)

The particular Google aspects I’m thinking of are: Google Maps, Google Talk and / or Gmail, and Orkut. (gah, no more links from me. Blogspot’s editor is either horrible with regard to adding links, or it uses some paradigm I’m completely unfamiliar with.–this is somewhat resolved by using WordPress now… but who knows if it’s actually better.) Personal info could be added to any of the three “personal” services (by which I mean workout, small, and googol talk) and shared through some friend-flagging mechanism in Orkut. From there, it’s trivial to build maps on a per-person basis. Google could probably do this now, but it would help to have all their tools tied together (things seem to be going in that direction, with the unified accounts between Gmail and Google talk.)

I consider the above a proof-of-concept for the usefulness of social networks (I’ve been somewhat skeptical about their employ for some time). Are there other similar uses? At some levels, social networks seem a bit like a collaborative filtering approach to finding interesting people, but what do you do from there? Personally, I would find it odd if someone three links detached on Orkut contacted me just to say “hi”, however, there isn’t enough information about me readily available on Orkut to start a more interesting conversation out of the blue.

Mapping the Intern

For the last two summers I have been interning for IBM in Westchester county, NY. While here, I’ve met a very wide distribution of interesting people (distributed across many axes, one of which is geographic – well, perhaps two of them ;). I think the community that we have formed is interesting for a number of reasons: One, as I have already mentioned, we are widely distributed across the globe; I think we are also likely to appear in each-other’s lives again, irrespective of our personal ties and attempts. There is no accident that we are a community – IBM already filtered us, and we all have a deeply rooted interest in technology. I fully expect (and hope!) to randomly run into interns from IBM in the years to come, simply because we walk similar lives in a relatively small global community of researchers. Everyone I have met has also proven to be extremely interesting, artistic and inventive.

The problem, then, is that we don’t have an easy way to interact outside of IBM. Currently, we are only connected by an email list that doesn’t serve as a very precise means of communication. As an example: Earlier this year, my partner and I drove across the United States, and we didn’t have anything planned for the night we would be in Pennsylvania. Eventually, I sent an email to the interns list asking simply “is anyone in Pennsylvania? (or do you know if there is anything to do there?)”. This just seemed crude, although it would have worked if I had tried it sooner. It would have been nice to have some idea of who may be there, and where about they were. This need not be accurate, the granularity of cities would be fine, it would still help with trip planning. (Apologies if you were expecting something profound, this is all I’ve got today.)

Today, out of the blue I realized how to do this, with the Google Maps API. If you aren’t familiar with the API, it lets you use the same technology on http://maps.google.com but with your own markers or whatever you want (within reason). You also get the scrolling / zooming and satellite imagery as well. I’d like to use this to map interns. The implementation would be pretty straightforward, but the privacy / legal implications aren’t clear-cut. Ideally, intern marks would have actual street addresses (and potentially other contact info as well), or at least mailing addresses associated with them. Common sense dictates that such a page should be private, and the Google terms of service supports this, after a manner:

“We also want to respect people’s privacy, so the API should not be used to identify private information about private individuals.”

An opt-in policy or click-through would probably remedy this, but I’m also not clear on whether Google is happy with a Google map being password-protected. The answers to this aren’t very pressing – I have a number of projects on my stack that need work first, but if anyone has input, I’d like to hear it :)

The US in Pictures

I’ve posted photos from my drive across the US this spring, along with a host of other shots that I’ve been meaning to share for ages. I realized the other day that when driving through the midwest, despite being in awe of the scenery, and miles upon miles of picturesque fields, I never took any pictures. I do believe I was waiting for a high point to take them from, to get a full sweeping view of the surrounding area, but alas, I was in the Midwest.

http://www.minnen.org/rogan/photos/

Playing It by Ear…

Those who know me well know that I am almost always listening to music of some sort. When I’m working you will usually find me with a set of headphones plugged into my ears, or speakers blasting (if that doesn’t bother anyone else nearby). Similarly, I always have the car radio on when it doesn’t interfere with conversation or intense driving, and I usually queue up some mp3s on the stereo before I start cooking dinner, cleaning, etc.

My taste in music is about as diverse as the situations above. I don’t particularly enjoy country western, or rap / hip-hop, but pretty much everything else will show up on a playlist at some point. This is somewhat of a problem; while in general I will enjoy listening to anything, at any specific time I’d prefer to stay within a certain genre.

The issue is that to achieve this level of filtering I need to do it manually. With a couple thousand tracks (with much missing meta-data, such as the “official” genre) this becomes a huge task. Also, keep in mind that some artists cross a number of genres – A Perfect Circle and Nine Inch Nails are two good examples. Some NIN tracks are nearly symphonic while others are very industrial, this prevents bagging by artist in enough instances to be annoying.

Recently a number of music management programs have cropped up that provide more filtering tools than a plain player such as winamp or xmms. iTunes is probably the best known of these programs – and I used iTunes for nearly two years and the searching it provides is much better than what I used before, but it still doesn’t do the level of filtering I want.

About a week ago I began using amarok. Amarok is similar to iTunes, but it makes use of a service called Audioscrobbler to provide suggestions on what to play. Audioscrobbler uses collaborative filtering techniques to recommend songs based on what you are listening to. I’ll come back to this, but first a sidebar on collaborative filtering:

The idea behind collaborative filtering is that people have similar tastes in “things”. If you like a given movie, say Star Wars: Episode 3, then you may like Star Wars: Episode 4, because many people who liked the first movie also liked the second. MovieLens (http://movielens.umn.edu/login) does exactly this. As you rate movies, it compares your preferences with those of thousands of other people, and predicts how you will rate movies you haven’t seen. I’ve had good experiences with using MovieLens, but I put significantly more thought into choosing a movie to see than I put into choosing a song to listen to. This makes sense when you consider the time commitment – 5 minutes spent choosing a song is wasted time, you could have just listened to it in that time. (Choosing an album to buy is a different scenario also, and seems to share many aspects with choosing a movie.)

Now, back to amarok and audioscrobbler. The problem here is that I want a specific genre, and I want it right now. This is in stark contrast to choosing a movie, which I could wait to see later if I’m not in the mood for that particular movie – I can control the context in which I watch a movie, but I’m not willing to dedicate that effort to choosing a song. Music is a background task for me, and it shouldn’t dictate very much attention. When I’m listening my attention has other targets: research, writing, driving, etc. However, I am not so involved in these tasks (usually) that I don’t notice the background music.

Audioscrobbler actually does pretty good. (The parts of amarok that take advantage of it are another story…) There are, however three (or more?) problems with audioscrobbler: 1) you must have a network connection to get suggestions, 2) your meta-data on each song must be correct, and 3) if you have diverse input to the system, you will get diverse output. To explain #3: The input I provide to audioscrobbler is of very limited use. The range of music I listen to is to large to provide information on what music “sounds” alike – Knowing that I like Bach and some tracks by Scooter (a rave artist) doesn’t help when I’m listening to Back or Scooter, since I probably don’t want Bach to pop on while I’m in a rave mood, or vice-versa. This has happened a number of times recently with amarok – it suggested a set of U2, Dave Matthews, Tool, and one of the tracks I used to program my iTrip. (The iTrip is a FM transmitter for an iPod, and the tracks are 6 seconds long, consisting only of a couple beeps that represent a new frequency to broadcast on.)

The solution to this, I think, is to make recommendations based on the actual waveform of the music. This should be able to detect things such as tempo, average amplitude, the change in amplitude (and the frequency of that change…) and so on. It seems reasonable that this would provide a more accurate representation of what a song “sounds” like. I have done some minor experimentation with this idea in the past, and I had some success. It is something I’d like to get back to, but until then, I’ll see if I can fix some amarok bugs…

Task Management

One of the ever present things on my mental to-do list is to find, or create, a good task manager. A number of years back I became painfully aware that I can’t remember everything I need to do unless I write it down. I’ve tried a number of things, although I haven’t exhausted all the possibilities, by any means.

The first attempt at solving this was a perl cgi scripted todo manager based on sample code for a guestbook in Learning_Perl. It worked great :) but the whole experience was a little unfulfilling (you could never delete things ;( ). I tried a number of other things – iCal, kalendar, and devtodo (a nice program, worth checking out if you’re interested in a filesystem-based console tool). But recently I stumbled on an approach that hadn’t occurred to me in the past.

I’ve started using a vector-drawing program called Inkscape to manage tasks at work. It started when I started using Inkscape to sketch portions of a software system I am implementing. Once the design phase was somewhat solidified and implementation began I started marking things off right on the document. Inkscape is handy for this because you can just create a new layer of the document and put transparent shapes on top of the portions that are done. I’ll try to get a screenshot up soon, but I don’t have a usable scenario right now).

The result is a very spatially-dependent interface that is not inherently linked to time. For some domains I think these are desirable features, but in many cases they are not – I’m not sure if this is something that could be adapted to general task management or not, but so far I’ve found it to be very easy to use. It doesn’t take many cognitive cycles to gauge your progress, which is the greatest immediate reward I’ve found for a task manager, and adding tasks is only a problem if you feel strongly about the location.

It is also trivial to add comments to individual or multiple tasks, or just as a sticky-note, just make them yellow :)