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.