Older blog entries for kwa (starting at number 10)

Here at Linden Lab, I'm sometimes forced to make sure my code still works on Windows :P. Today I needed to install greenlet on Vista, and of course easy_install bailed since it requires Visual Studio 2003. As luck has it, 2003 doesn't work on Vista. I miss my shiny Ubuntu laptop!

The workaround I found with a little googling was to use MinGW to build the extension module.

  1. Download http://downloads.sourceforge.net/mingw/MinGW-5.1.4.exe and install it. Check g++ when asked to select components to install.
  2. Create C:\Python25\Lib\distutils\distutils.cfg with the following contents
    compiler = mingw32
  3. Open a cmd shell and add C:\MinGW\bin to your path
    set PATH=C:\MinGW\bin;%PATH%
  4. Install greenlet!
    C:\Python25\Scripts\easy_install.exe -U


Brandon and I are going to Lugradio Live USA 2008 on April 11th and 12th. It is going to kick ass! If you are anywhere near California, you must go. You don’t have any excuses.

As an added birthday bonus, I’ll be attending as a new LindenLab employee! For those of you who might not have heard of them, LindenLab is the creator of the online virtual world Second Life. I was recently offered the position of Release Engineer, and my first day is on the 7th of April. Joy! I am so excited to start that I can hardly think about anything else. It looks like my new avitar is going to be Ambroff Linden, so come see me in-world!

PS: I can’t wait to see abock all oiled up in a thong.

Syndicated 2008-03-28 02:57:00 from Code walking

Source code licencing == term paper policy

Something Luis Villa posted today reminded me of an experience I had recently with a group of students. I am reminded of a phrase that I heard while discussing software licensing. “If we change 60% of the code, it’s ours.”

I am about to graduate with a BS in Computer Science from CSU Sacramento, which means that I’m currently working on my senior project.

My department’s senior project course is a little different at other schools I suspect, since it is a group project with 3 to 6 members per team, and spans two semesters. Also, rather than just coming up with a proposal for an interesting problem to solve, students compete to get a fake contract with one of several local businesses and government agencies. It’s good I guess, but I’d rather be hacking on GNOME or some other free software than write yet-another-boring-crm for tracking form submissions :-). It usually feels more like an exercise in paper pushing than designing software anyway, since the projects are quite simple and boring.

Anyway, me and a fellow teammate were discussing plans for a rather complicated custom widget we needed to create for this project. He found an example that some Joe Schmo had posted on the Internet without any license information, and wanted to just start with that and modify it where necessary.

My first thought was to ask if he knew anything about the license that the code was released under. His first reaction was to stare blankly at me, which I can understand, but this next part shocked me. I said, “Well, if he didn’t explicitly grant any rights to use and redistribute this code, the safe thing to ask him to release it under MIT X11, GPL, or any other license compatible with our codebase.”

He responded, “Why do we need to do that. If we change more than 60% of it then the code is ours.”

My jaw hit the floor. I didn’t even know how to respond to this. After a discussion about U.S. Copyright law, licensing, Copyleft and the four freedoms, etc., we had things straightened out. But I was still troubled.

I think that he may have been confusing one of his instructor’s plagiarism policies with copyright law. I find this especially disturbing because as a computer science student, he is required to take a course that explicitly covers Copyright, Patent and Trademark law. What is even more disappointing is that he is not alone. From my experience, many, many students in this department make the same mistake.

Maybe a question involving this topic would be a good weed-out question when hiring developers who will be working on free software? I would love to see the responses.

Syndicated 2008-03-28 02:49:13 from Code walking

Fun with Lisp on Python

I’ve been hacking on a useless little project lately. My friend Brandon and I have been toying with the idea of designing a new programming language over the last couple of years. We are both compiler nerds, and many of our conversations usually lead to to a discussion about why this feature is great and why that language

I’m a pretty big Python fan, and have been using it for years. It is still my go-to language when I just want to get something done. Unfortunately, the more I learn about programming languages like Common Lisp, Scheme, Haskell, etc., the more I run up against the restrictions that Python has.

Unfortunately, many of these are deliberate. It seams that Guido and many others resist features like continuations, macros, non-broken lambdas and proper tail recursion because they like to think of Python as a single-paradigm language. Adding these features means that some Python code could seem foreign or unfamiliar for some programmers.

I understand this argument, but on the other hand I find it extremely frustrating when I have an elegant, easy to understand solution to a problem that I just can’t use because of a seemingly arbitrary restriction.

So I thought I would kill two birds with one stone. I could start designing a language for fun (not profit :-)), and when I am ready to write the compiler, I can just emit Python bytecodes, so that I will have a huge set of libraries to experiment with, and have something usable right away.

This turned out to be extremely easy. Within a few days I had a working compiler that was near feature parity with Python, and some nice features added on. It is still pretty basic at the moment, I don’t have many of the features implemented that I have planned. For now it’s just a simple lisp-like language with similar semantics to
Python. After a couple of afternoons work, I did a google search for similar projects, and it turns out that there are about 10 people that have done something similar. I don’t really care though, this is just for fun.

One of the decisions that I made early on is that Python’s modules are a good idea. I think the module and namespace semantics are extremely well thought out in Python, and have encouraged a lot of really great patterns and idioms. So this language is definitely going to mirror that behavior.

One of the things I struggled with was under what circumstances should I allow myself to add syntactic sugar. I’m usually not a fan of such features, but there is one case where I made a compromise, and that is accessing attributes of an object. I tried to avoid this for as long as I could, but I tended to write a lot of code like this:

(set (getattr (getattr someobject 'propertya) 'propertyb) value)

In this case, I ended up settling for:

(set someobject:propertya:propertyb value)

I’m not really satisfied with that at the moment, but at least it is about the only such compromise I’ve made.

Another thing that is pretty important to me is avoiding any special operators. This is something that really bugs me about common lisp, I hate having to write code like this:

(reduce #'(lambda (x y) (* x y)) '(1 2 3))

Why can’t ‘*’ be a function? Scheme gets this right in most cases, but there are still around 10 special operators. I want zero special operators, or at least as few as possible. I ended up accomplishing this by allowing special operators to behave like functions in contexts where that made sense, and otherwise treating them like special operators. For example, the situations below would generate very different code:

(reduce * '(1 2 3))

This would simply map to a built in function for multiplication, that is only used when ‘*’ is used as a symbol. Otherwise:

(* 1 2)

This emits a normal BINARY_MULTIPLY instruction. This way it appears to have no special operators, but the code that is generated is as efficient as possible. I’ve tried to do this where ever I can.

At this point, it is possible to write just about any program you would write with Python, with a few minor exceptions that would be trivial to fix. Here is a simple pygtk program:

(import gtk)
(set my-window (gtk:Window))
(my-window:set_title "Hello, World!")
(my-window:connect "delete-event"
                   (lambda (w event)
                     (println "Goodbye, world!")

It really is remarkable how much Python resembles a Lisp internally. In some cases, what I thought would take days of hacking turned out to only take 1/2 hour. An example was loops. I wanted to implement something like the Common Lisp loop macro, only not as terrifying :-). It turns out that the behavior isn’t much different from Python list comprehensions, so implementing something like this was pretty trivial:

  for x in (range 10)
  for y in (range 10 20)
  if (not (= x y))
  collect (x y))

Although in the end I simplified loop a great deal, it was fun to see it work with so little effort.

I don’t know if I will actually release this code. It isn’t really that useful, it’s just a fun little project to tinker with and an easy way to try out new experimental language features. But if you want to play with what I have now, you can get it from my Bazaar branch.

bzr branch http://codewalking.com/bzr/sketchy.dev

My plan is to continue experimenting with this, and eventually weed out all of the unnecessary features. At some point I imagine having something that would be worth rewriting, maybe targeting another VM with a JIT like the LLVM, the CLR or Java, or writing my own JIT (that would be fun!).

Syndicated 2008-03-23 01:24:29 from Code walking

GUADEC 2007 videos available

<p>Awesome, <a href="http://ftp.gnome.org/pub/GNOME/teams/guadec/2007/videos/">videos</a> from <a href="http://www.guadec.org">GUADEC</a> 2007 are <a href="http://ftp.gnome.org/pub/GNOME/teams/guadec/2007/videos/">available</a>! Guess I'm not going to get any sleep tonight. </p>

Syndicated 2007-12-07 11:12:16 from Codewalking.Com

28 May 2006 (updated 28 May 2006 at 22:49 UTC) »

Well, I spent most of my Saturday trying to figure out how to use the mono bindings for Avahi. They aren't that complicated, but no one has written any documentation yet. Today I've been experimenting with a Zeroconf plugin for beagled.

Currently beagled will publish its index, and will keep track of any remote indexes it finds in the log file. It's a start!

24 May 2006 (updated 24 May 2006 at 08:35 UTC) »

Holy crap!!! My extremely half-ass summer of code proposal was accepted?!? I have to say that I'm a little surprised. I submitted a proposal to the Beagle project entitled Networked Searches in Beagle. Here are the details:


I would lovepost to extend Beagle to use Avahi to advertise beagle running on a workstation, and allow other computers to search its indexes in a fashion similar to music sharing in Rhythmbox.


  • Extension of Beagle's XML-RPC system for secure communication on a local area network.
  • Automagic Beagle service discovery via Avahi.
  • Integration of Remote Searches into Holmes.


  • June 26, 2006:
    Avahi service discovery implementation complete. Design completed for remote message passing interface, and partial implementation.
  • August 21, 2006
    Message passing interface completed. Holmes extended to perform remote queries and fetch data from remote hosts.

Authentication and Setup

Authentication would be comprised of a cryptographic challenge/response system using pass-phrases and keys. Once two nodes have been paired up, they will automatically talk to one another when they are on the same network. A "Sharing" or "Network" tab could be added to beagle-settings, which would allow the user to enable searching on the local network, and sharing local indexes with other computers.

When beagled finds another host sharing its indexes, the user would be notified, and given the opportunity to perform an initial authentication. If the automatic notification is too annoying, then the user could have some means of finding other computers to pair up with. Beagle daemons on remote machines will communicate via XML-RPC.


When searching in beagle-search, a query is sent to beagled, and beagled forwards the search to any hosts on the network that have been authenticated in the past and are currently available with shared indexes. Any nodes that require no authentication will automatically be searched.

For live queries, any nodes that leave the network or are no longer available will be removed from the results. Any new node that becomes available during a live query will be sent the query and any results will reported. Remote Beagle daemons will treat these live queries just like a local live query on that machine, and will send new results to the node that made the initial query until the remote live query ends, or the node that made the initial query becomes unavailable.

User Interface

Any remote hits will be displayed in such a way to indicate that they are from a remote machine. They can also be hidden by a disclosure triangle, and will only be shown if there are available results. For example:

Double clicking on a hit from another computer might be tricky. Maybe using HTTP to download the file from one host to another. The file could either be copied to a /tmp directory, showing some progress dialog until it is copied and then opened, or just using GnomeVFS. Itwould also be useful if the user could also drag and drop any remoteresults to a nautilus window or the desktop, which would copy it tothe local disk.

Non-file Data

The original webservices implementation for Beagle only handled file queries. It would be interesting to find a way to handle remote chatlogs, webpages and emails.


I am finishing my third year of undergraduate studies at California State University, Sacramento, where I am majoring in Computer Science. I've been using GNU/Linux on the Desktop since 1999, and am passionate about free software. See my resume for more information.

As for my .NET experience, I have been using Mono since its 1.0-beta release, have been loving it ever since. I used Mono to develop several in-house Gtk# applications at work, and a charity raffle system for a large annual charity event in California.

As a casual GNOME contributor, and a Beagle user since 0.0.[89] ish, I would love to have the opportunity to hack on Beaglefull time this summer. Beagle is one of the most interesting components of the GNOME Desktop, and I would love nothing more than to help make it more useful for the community.

Congratulations to all of you other students out there who were also accepted, and thank you so much Google for working so hard to make this happen. And most of all, thank you Joe Shaw and any other mentors for the Beagle project for giving my proposal a high ranking.

2 Sep 2005 (updated 31 May 2006 at 02:03 UTC) »


24 Aug 2005 (updated 25 Aug 2005 at 07:36 UTC) »

Various things
This makes me sick to my stomach.

Found this very amusing quiz on p.g.o. I did recognize a few, but only got 6 out of 10 correct. Apparently, I should "avoid a career in either law enforcement or IT recruitment."

And finally, Chris Dibona has posted some awesome photos taken at Foo Camp with a high speed camera. They feature attendees, including Gnome Hacker Nat Friedmen, popping balloons.

Google Talk
While I am extremely pleased that a corporation as powerful as Google is supporting a free, open standard like Jabber, I'm sort of annoyed that their new Jabber service doesn't allow traffic from other Jabber servers. I have had a jabber id (kwa@jabber.org) for quite some time, and was hoping that this announcement would inspire a good number of my friends who use Gmail to switch to Jabber. It seems that this will change. The sooner, the better.

I finally got around to posting the pictures from our road trip to Vancouver a couple of months ago. The latest version of F-Spot is broken in the Flickr department, so I used F-Spot to generate a static HTML web gallery. Nothing on bugzilla or the mailing list. I'll have to look into it.

Alright, I'm pissed! I just started to upload some files, mostly python scripts and various other things so anyone who is interested can download and use them. Since CSUS provides web hosting for their students, I decided to host these files there. So far, everything is fine.

About 1/2 hour ago, I was chatting with a friend of mine named Jason Ralphs. I tried to show him the blogrip.py script that I had just uploaded, and we both got 404 errors. Startled and confused, I went to upload the files again thinking that I had just forgotten to do so. But of course, they were still there.

Unfortunately, my university uses IIS on a Windows server to serve its webpages. After some experimentation, I realized that IIS would only serve files that matched a registered mimetype on the server itself. So when you try to download a file like a python script, a c header file or a tarball, it just pretends that the file isn't there. BRILLIANT!!! I'm sending an angry email right now. Of course, it wouln't solve anything, but I'm just curious to see what those helpdesk monkeys have to say.

1 older entry...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!