Thursday, June 3, 2010

The Meaning of SPAM

At last! I'm done with my philosophy term paper! It's an investigation of if  computers can represent semantic contents. If you are interested, here is a link to the paper: The Meaning of SPAM.

From the abstract:
I argue that the the Chinese room thought experiment, invented by John R. Searle, does not show that a computer can not represent semantic contents. By analogy with a spam filter, I use Putnam's 4-tuple normal form definition of meaning to show that a spam filter actually does represent meaning (semantic contents).

Wednesday, May 19, 2010

Iolaus Include Incinerator (i3)


When I first heard about the new GCC plugin support I knew I had to try it out. To that effect I've been playing around with the nifty Dehydra plugin, creating a tool called i3 to analyze C++ code looking for buggy and un-optimized include directives.

If you want to try it, you can download the beta here.

By the way, the i3 project is in no way connected with the development of the Dehydra software or the Dehydra project; it just uses the plugin.

The Analysis
There are two basic cases that the i3 analysis will search for.

1) Unnecessary includes:
This is just what it sounds like. You are including a file that you don't have to. This is (in most cases) considered poor design, since it adds unnecessary coupling between different files. The practical benefits of reducing the number of unnecessary includes is that you get faster builds and that less code has to be re-built if you make a change.

2) Indirect includes:
This is often a bug. It is considered good practice to include all the header files required by a particular compilation unit (cpp-file) directly.

It's not finished yet
This is an early beta release and there are a number of limitations to the analysis that i3 can perform.

It can't interpret preprocessor directives properly. If you use #ifdef's etc. to conditionally include files, i3 isn't going to get it. It will interpret every #include statement found in a file as really including a file.

About the name
The name "Iolaus Include Incinerator" is an homage to the Dehydra project. From your Greek mythology class, you may recall that Heracles companion Iolaus helped the hero in slaying the Lernaean Hydra. Every time Heracles cut of one of the Hydras heads, Iolaus scorched the neck stump to stop a new one from growing out. This program, i3, is also a helpful companion; and like any good side kick it lets you, the programmer hero, take all the credit.

Saturday, March 27, 2010

Last Judgement

Here is a (Swedish) text I've written on an existentialist theme.

You can access the text here

It's about Gilgamesh, the hero of old Mesopotamian mythology, and the thought that all men will judge them selves on the threshold between life and death.

Print the pdf on a double-sided A4 and fold it 8 times. This makes for a convenient, truly pocket sized, short story format.

Wednesday, March 24, 2010

Don't be evil; Be Harmless!



Ok, I admit it. I'm one of those people who think that peace, love and understanding isn't so bad after all.
Since I occasionally share free (libre) source code on the Internets, the question of how to license it naturally arises.

To that end I've developed the Harm-Less Permissive License (HPL). It's a permissive, non copyleft, software license. It is based on the FreeBSD license but with one additional restriction; the "harm-less" clause. It prevents software, licensed under the HPL, to be used for harming humans or animals.

Check out the link above for more information about the license. The license text is available here.

Update 1: I've started a collaboration with the organization People for the Ethical Threatment of Animals (PETA). They are running a story on the HPL and are helping me host the HPL document.

Update 2: The land slide has started. Slashdot.org has the story: PETA Creates New Animal-Friendly Software License. This is my first on Slashdot...

Update 3: The news have made it to the Ubuntu Forums: Move over GPL - meet the HPL! 

Update 4: HPL has recently made an appearance in Osqledaren; the student magazine of the Swedish Royal Academy of Science. Read the (Swedish) article: För dig som inte vill döda

Sunday, March 14, 2010

Newton vs Kalman; Estimating Motion

Surprisingly often I'm faced with estimating the position of something that moves according to Newtonian laws of motion in one dimension and with random acceleration.

A fast and pretty accurate way of doing this is to use a Kalman filter. I've finally gotten around to implementing a specialized version of this general method, dedicated to my simple estimations needs. You are welcome to use it (it's HPL licensed).

Have a look at the image if you want to see how it performs in a sample case.

Saturday, March 13, 2010

How I lost my SMT virginity...

Finally! My first PCBs from Batch PCB were delivered yesterday. This one is a double sided USB / serial converter, with solder masks and silksceen and it looks good! Very good.

The design is a FT232 IC breakout board. If it works good, I'm going to use it to add USB support to many of my future designs.

Well, how does it look when all the components have been soldered in place? Have a look at the second image. Not bad ey?

SMT soldering was a bit harder than I had anticipated. Mostly because the components are really tiny. The 100nF caps were almost impossible to place; I need to get me a new pair of really pointy tweezers.

Saturday, February 27, 2010

Smoke Detector and Burglar Alarm in One

Update: I'm proud to announce that this project has made it to Hack-a-day, one of my all time favorite blogs.

Three weeks ago some burglars broke in to our ground floor flat in central Stockholm. I was coming home from work and surprised the vile wantons going through our stuff. I can ensure you it was quite an unpleasant experience. Anyway, I managed to chase the despicable degenerates out of the apartment.

Since then I've been pondering various ways to improve my home security. I looked at a 127dB motor siren to hook up to a window alarm; that would surely deafen, and quite possibly kill, anyone trying to break in. For reference, hearing damage will occur around 120dB and the human pain threshold is ~130dB. The problem with this solution, aside from my neighbors discomfort while trying it out, is that I have cats; and I don't want them to get hurt in any way. This pretty much rules out my other ideas, like smearing neurotoxin on the window frame.

But I still felt I had to do something. How about hacking a smoke detector and using it as a window burglar alarm? Those things are loud, but not loud enough to cause damage to the cats. Just loud enough to catch the attention of my neighbors and anyone passing by on the street outside.



So, today I started hacking away. It would be great if the new burglar alarm functionality didn't interfere with the original smoke detecting function; that way I would get another smoke detector as well and you can't have to many of those.

This smoke detector has a test button that, when pushed, will cause the device to emit a loud hi-pitched sound and flash a red LED. I figured that this switch could be piggypiggybacked for the alarm functionality. I couldn't use the switch directly since it closed when pushed and you normally want a signal when the alarm "switch" opens. Besides, I still want a test switch for the detector. I decided that I also want a bypass switch to turn the alarm part of the detector of (if you for instance want to open the window yourself). You can see the very basic old and new circuits in the image.

In the next step, a pull-up was soldered across the old, now obsolete, test switch. A ground and signal wire was also soldered in place. In the next image you can see the new test and bypass switches mounted and the white wires to the alarm "switch" sticking out.

I'm using a paper clip as the alarm breaker. This is classic. I love the MacGyvery look of this solution.

In the last two images you can see how it looks when it's mounted. The paper clip is attached to the window and the wires are pinned to the window frame, causing the circuit to break if anyone attempts to open the window.

I love tinkering with microprocessors and computers, but it feels good to do something really simple and quite useful for a change. There you have it, a smoke detector and burglar alarm in one!

And yes, I know the image quality is awful, but I can't seem to find my real camera so I had to make due with my cellphone. Sorry about that.

Friday, February 26, 2010

Circuit Transplant

A couple of days ago I was destroying a Seagate USB harddrive. It was one of a set that my company uses for backups. After it stopped working I decided to take my frustration out on it and at the same time make sure that no one would be able to recreate any data stored on the disk.


After smashing it up a bit with a hammer and crushing it in a bench vice I started to feel re-connected with my, rather naïve, sinister side. But the PCB peeking out of the metal enclosure gave me pause. My curiosity got the better of me and I decided to take the disk apart in a more controlled manner so that I could try to figure out how it was made.

As you can see from the second image, the USB disk is really just a regular SATA disk in a metal enclosure with a small controller card to handle the SATA USB interface. I knew for sure that the disk was broken but perhaps the controller card would still work? I had to test it.

I plugged the controller cards surface mounted, female SATA connector into a good Hitachi disk. I connected a USB and power cable to the card and sure enough, the disk started spinning up and I could access it from my computer.

This little card is a universal SATA to USB bridge. Perhaps not that surprising, but at least now I don't have to buy one if I want to check the content of a disk from my laptop.

Sunday, January 24, 2010

Paladiochanics: Translation of Rotational Motion

I've always been fascinated by ancient cultures. I wrote my term paper in art history about the revival of Mesopotamian architecture during the 19th century. But, like most classicist buffs, I'm hooked on ancient Greece.

As you may or may not know, the ancient Greek architecture of temples (and to some degree other buildings) come in three basic styles: Doric, Ionian, Corinthian. These are the three classical Greek orders of architecture.

These three basic building blocks have since then been adapted and re-used by the western culture a number of times. First by the Romans. They started copying the Greek orders and added two new ones them selves. Then, during the renaissance, the ancient orders experienced a... well, a renaissances. E.g. the  Palazzo Chiericati by 16th century architect Andrea Palladio has both Doric and Ionian columns. Then there was the Greek revival of the late 18th, early 19th century (think: Brandenburger Tor). During the 1980ies there was time for a new dusting of of the old Greeks as the post modern movement started using and mixing different parts ("quoting") ancient architecture in new ways. The most well known example of this is probably Piazza d'Italia by Charles Moore.

Inspired by this perpetual repetition and the configuration of the ancient orders in new ways, I made 9 drawings during the summer of 2009. The drawings show a mechanical design that can be used to translate a rotating axis, but where the axis has been replaced by a column. I did 9 different to capture all combinations of the classical orders. I think that the translation of a rotational motion has a poetic ring to it and it is a fitting metaphor for aesthetic development over the ages.

I would like to frame all nine and hang them in a 3 by 3 matrix. But right now we don't have enough wall space for that, so it will have to wait.


Saturday, January 23, 2010

Northern light? yeah right!

Ever heard of northern light? Well, right now all we have is northern darkness. The sun barely comes up before it descends again. Even though I'm born here I'm never going to get used to it.

Anyways... dreaming of summer I went through my drawings from the summer of 2009. Here are a couple of pictures that I did during some warm, lazy days. I hope you will enjoy them and that they bring back memories of sitting in a park on a sunny day with nothing to do.






Game of Life

This is a project I built in October 2009.
 
It all started when I got the beautiful black frame you can see in the photo. Since the picture in the frame wasn't equally beautiful, I got the idea to replace it with a game of life simulation on a dot-matrix. The whole thing is actually quite hypnotic to watch, and it sure is pretty.

The design is based on an ATMega8 that runs the simulation and four 8x8 dot LED matrices from electrokit.se. To drive the dot matrices, I'm using four daisy chained MAX7221 (serially interfaced led display drivers). I needed the serial interface since the atmega obviously doesn't have 256 i/o pins to turn LED's on and off. Below are two images of the controller card; drawing and actual.




I also added a LM2940 5V low dropout voltage regulator (top left corner), to be able to power it reliably with a battery.

This is the initial configuration of the simulation. I think alpha and omega is fitting in a game of life simulation, don't you?



Playing with Persistence

Since my croquis class was unexpectedly canceled today, I found myself with a couple of hours of spare time. I've been wanting to build a POV-gadget (Persistence of Vision) since I first saw the one by ladyada (http://www.ladyada.net/make/minipov3/) and with nothing else to do, I started going through my electronic supplies.

The design is really basic. Take one attiny84, 8 LEDs and 8 resistors (to limit the current through the LEDs). The idea is to flash the diodes at 400Hz to create an image (using the persistence of human vision). The image will appear if you quickly move the LEDs (or yourself) back and forth.

I created an image in GIMP and used the "save as .h-file" to get a C-style array. It needed some minor post processing, like transposing, but it was fairly straight forward.

The C-code to control the LED's turning on and off is inspired by the ladyada implementation. It uses a timer interrupt every 1/400 second to set the LEDs to show the next column of the image. I'm using the internal RC-resonator on the avr chip since precision timing is not important here, so there is no need for a crystal.

So how did it come out? Well, it's kind of hard to get an image of it... but by rapidly moving the camera I managed to get a decent picture.

I'm such a h4x00r :)