Installing Ubuntu on the Via Artigo
Posted on: 2008-04-06 08:41:09

The Via Artigo was just too cute to pass up. The videos don't do its size justice. When I unpacked it, it was even smaller than I expected. I was looking for a system to replace my home web server, on which this blog is hosted.

By the time I put it all together, I was so impressed that I began to use it as my full desktop system. It consumes so little power that I can just leave it on all the time without feeling pangs of guilt.

Here are some notes about my experiences.

More...

Why are all my lines fuzzy in cairo?
Posted on: 2008-04-04 13:50:07

Cairo is the hot new cross platform graphics library. It is becoming very popular, because it solves two outstanding problems in a portable way:

  1. Path based drawing
  2. Antialiasing

Both of these problems are astoundingly hard. You would have to read a whole graphics textbook in order to implement basic drawing, and antialising. Before cairo, your choices were Win32 GDI based drawing, or whatever GTK uses. In addition, cairo is supported in Python.

The problem is that cairo has something that's not obvious for some people. A lot of users might write a program to draw a line and get this:

#!/usr/bin/python
import cairo

def drawLine( ctx, x1, y1, x2, y2 ):    
    ctx.move_to( x1, y1 )
    ctx.line_to( x2, y2 )
    ctx.set_line_width( 1.0 )
    ctx.stroke()    

surface = cairo.ImageSurface(cairo.FORMAT_RGB24, 32, 32)
ctx = cairo.Context( surface ) 
ctx.set_source_rgb( 1.0, 1.0, 1.0 )
drawLine( ctx, 2, 16, 30, 16 )    
drawLine( ctx, 16, 2, 16, 30 )    
surface.write_to_png( "out.png" )


(Magnified 4 times)

The lines are all fuzzy! Even Inkscape, an otherwise well-polished graphics program, has this naive implementation, and it frustrates users to no end, because all of their lines are fuzzy.

More...

Handling Unicode Form Data in PHP and Python
Posted on: 2008-03-23 16:17:13

Recently on www.websequencediagrams.com, I noticed that I had a link from a Japanese web site. So I decided to check how my web application worked with Japanese. Of course it didn't work. So I had to figure out how php and python use unicode.

More...

A simple command line calculator
Posted on: 2008-03-23 15:28:15
How many times have you needed to calculate something, for example the value of 0x398A3BB, so you pop up windows calculator to convert it? I did lots of times. The problem is I hate to use the mouse. It takes precious deciseconds away from software development time to remove my hands from the keyboard and use the mouse. That's why I created calc.exe. Its a simple command line calculator (and its also an example of recursive decent parsing).

Examples

C:\>calc 5+5*5
30.000000

c:\>calc 0x30
48.000000

c:\>calc (123456 % 51)/12
3.000000

More...

Tool for Creating UML Sequence Diagrams
Posted on: 2008-03-03 19:51:21

If you have to draw something called "UML Sequence Diagrams" for work or school, you already know that it can take hours to get a diagram to look right. Here's a web site that will save you some time:

www.websequencediagams.com

You can just write the diagram out in text, click "Draw", and the web site will spit out an image. Then you can tell your boss that you slaved for hours in MS Visio perfecting every line...

More...

A Class Library for Windows
Posted on: 2008-01-16 20:24:22
I am pleased to announce the release of my utils C++ class library for win32. I would like to release open source applications on www.hanovsolutions.com, but prior to this release, they would be useless to anyone because I use this huge undocumented library of classes that nobody else would understand. That is, until today. I have used doxygen to document all of the classes, so anyone can understand them.

More...

Exploring sound with Wavelets
Posted on: 2007-12-27 22:39:00
Here's a program to create scalograms of sound files. Pictured below is the "windows xp startup sound". See how the individual frequencies have been isolated visually.

I have created a separate web page for this project... please go there.


Download Installer

More...

A Fast Calorie Calculator for Windows
Posted on: 2007-11-15 19:10:58
I haven't written anything in a while, so here's a treat: This is a small application I whipped up last year when I was into calorie counting. I downloaded the US official database of over 6000 foods, compressed them down to a 600 K memory blob, and made this dialog to search them.

Download Installer now.

More...

UMA and free long distance
Posted on: 2007-07-29 21:47:40

UMA and free long distance

Last time, I talked about the UMA technology used in some newer cell phones. Some of you might be thinking, these new cell phones work over the Internet. What's to stop me from travelling to another continent, and then making free long distance calls to local numbers back home?

More...

UMA's dirty secrets
Posted on: 2007-07-24 19:57:10

What's UMA?

Recently, many carriers have started offering UMA, or WiFi phones. These are cell phones with WiFi capabilites. Don't be fooled -- you won't be able to get free calls and run skype on them. The UMA technology is meant to extend the carrier's cellular network into your home using your broadband internet connection.

How does UMA work?

An UMA phone operates just like a regular cell phone. It can talk to cellular base stations. But it is dual mode, and it also has a WiFi radio on board. When it finds a WiFi access point, it will attempt to connect to your carrier's servers over the Internet. If the connection is successful, it will "Rove in" and begin sending everything over the Internet.

More...

Creating a Todo list in Ajax
Posted on: 2007-05-19 16:19:59
Javascript is fun to work with. You don't have to worry about memory, declaring variables, or missing semicolons, and browsers are very forgiving if you don't do everything exactly right. Last night, my wife was out of town. Free of any distaction from my nerdy interests, I tried creating a Web 2.0 application: a Todo list.

Go to http://gandolf.homelinux.org/~smhanov/todo/ to try it out.

Here's the php source code.

More...

Installing the Latest Debian on an Ancient Laptop
Posted on: 2007-05-19 16:09:36

The challenge: Install Linux on a really old laptop. The catch: It has only 32 MB of RAM, no network ports, no CD-ROM, and the floppy drive makes creaking noises. Is it possible? Yes. Is it easy? No. Is is useful? Maybe...

Motivation

Why? Like mountain climbers say: because it's there. As an environmental nut, I don't like to throw away things that still work. But I have a PCMCIA network card and I would rather not have to hunt down and install 10 year old drivers to get it to work with Windows 95. The latest Linux definitely supports more hardware out of the box than Windows 95.

More...

How to make the MSDN style tree view in Javascript
Posted on: 2007-05-08 23:58:32
If you look at the MSDN library documentation you will see the nice treeview control on the left side. You can click on items to expand the tree. The tree contains the entire msdn library, but loads instantly. It's not too difficult to duplicate this in Javascript and Ajax.

More...

Dissecting Adsense
Posted on: 2007-04-28 09:55:52
A lot of the Internet uses Google Adsense, and yet very little is known about how it works. I downloaded the show_ads.js script that every adsense page references, and analyzed it to try to see how it works. I found lots of hidden features along the way.

The google show_ads.js script has been optimized for quick loading. Google has removed all whitespace, and renamed variables and funcitons to have single letter names. While this is good for fast page loading, it is not so good for understanding what it does. So I ran this through my Javascript PrettyPrinter, and then renamed the functions and some variables based on what I think they do.

More...

HTML/Javascript/CSS Pretty Printer
Posted on: 2007-04-26 20:26:38
I've been learning a lot of web programming lately. One way to learn is to look at other people's code. Unfortunately, to save space a lot of the web pages out there have all the white space removed. So I wrote this java program to format any web page so that you can study it.
  • It handles HTML, embedded javascript and CSS
  • It uses syntax highlighting for keywords and punctuation.
  • It adds links to Javascript function calls so you can click on them to jump to their definition.

Enter Url (Beginning with http://)

More...

Comment Spam
Posted on: 2007-04-23 08:53:00
Silly me. I thought that by writing my own blog software, those nasty comment spammers wouldn't be able to penetrate my fortress of php spaghetti code. But since I have added an atom feed, I have been getting a couple of automatically generated comment spams per week.

More...

Web Comic Aggregator
Posted on: 2007-04-21 19:50:09
Here's a python script that scrapes your favourite comics, and assembles them all onto one page. It also archives them on your server with back/forward buttons.

Many web sites today have rss feeds. RSS stands for "really simple syndication". Basically, it is a link to an ever-changing XML file with a list of articles. Even web sites like www.gocomics.com syndicate their content online, but what they include is pretty useless -- for each day, it's just the name of the comic and the date. Obviously, the content creators want you to visit their web sites and click on ads (and I encourage you to do so).

Technically inclined people (and their spouses) don't have to deal with these web sites, because now you can install this python script on your server. It will automatically scrape the latest comics from any web page you specify, and make them all available on a single page. All you have to do is come up with a regular expression for the filename of the comic.

More...

Experiments in making money online
Posted on: 2007-04-18 19:04:30
Is it possible to make money on the internet, if you try really hard? I want to find out. I have always been interested in getting money for doing nothing. In an ideal business, you would do some initial work to get a system set up, and then wait for cash to come in. Here are some results, including revenue earned, from:
  • Shareware
  • Adware
  • Adsense
  • Donations

More...

How much cash do celebrities make?
Posted on: 2007-04-12 19:07:33
Compare your per-second income with various celebrities. It only works with Firefox.

Your weekly income:
You:
Compare to:

More...

Draw waveforms and hear them
Posted on: 2007-04-11 19:18:09
A while back I thought it would be interesting to be able to draw arbitrary waveforms and then listen to how they sound. I had an audio engine just laying around, so I whipped up a quick application to do that.


download WaveStudio.exe

More...

Cell Phones on Airplanes
Posted on: 2007-04-08 20:22:03
Much ink has been spilled about the use of cell phones on airplanes. Here's the truth, which will be disappointing to conspiracy theorists: Cell phone signals most definately have an effect on other electronic equipment. Read on for more.

More...

Detecting C++ memory leaks
Posted on: 2007-04-07 19:38:11
A while ago I had the problem of detecting memory leaks in my code, and I didn't want to spend lots of money on a brittle software package to do that. It's fairly simple to redefine malloc() and free() to your own functions, to track the file and line number of memory leaks. But what about the new() and delete() operators? It's a little more difficult with C++, if you want to figure out the exact line number of a resource leak.

In this article, I'll explain how you can get a stack trace for where your resource leaks occur.

More...

What does your phone number spell?
Posted on: 2007-04-07 18:35:22

Type it in here and see.
This article was actually written in 2002. Here, I explain a technique for figuring out which words are in which phone numbers. Full C source code is included.

More...

A Rhyming Engine
Posted on: 2007-04-06 10:31:11
Here's a rhyming engine, written in 1000 lines of C++ code. It uses the freely available Moby dictionary, and full source code is provided. Give it a try. Read on for technical information.



Results:

More...

Rules for Effective C++
Posted on: 2007-04-06 10:25:28
I used to be a strong supporter of C++. It was the perfect language. In C++, if you want to influence how the hardware instructions are generated, you can do that. If you want to program without pointers and without caring about how memory is allocated, you can do that.

Recently, however, my views have changed after reading Scott Meyer's book, Effective C++. In Meyer's book, he goes through every feature of C++ and shows you how you have to program with extreme care to avoid undefined behaviour. It seems like every modern feature that C++ has was specifically designed to help you shoot yourself in the foot.

I never realized this before, because I simply never use these dangerous features. In this article, I'll show you how to program in C++ safely.

More...

How to loose big money in stocks
Posted on: 2007-04-06 10:08:37
I've been reading a lot of books about the stock market recently, and from them I've gathered together a few tips. Hopefully they can help you loose big in the stock market:

More...

Cell Phones and Sterility
Posted on: 2007-04-04 18:27:27
On an episode of Mythbusters, the American television show where they prove or disprove myths by making things explode, they recently visited the myth of a cell phone ringing that creates a spark and then triggers a gas explosion. Of course this was proven to be impossible. It just shows how much misinformation there is about cell phone signals.

Allow me to correct this misinformation.

More...

Cell Phone Secrets
Posted on: 2007-04-03 17:00:27
I am a mobile telecommunications engineer, and I thought I'd explain what to look for in a cell phone. Most guides will review phones on their user interface, but pay little attention to one of the most important pieces: the radio. The radio on GSM cell phones is very mysterious to most people, so here is a guide on how to decode the features of cell phones.

More...