Archive for the ‘Programming’ Category.

Strange Attractor Wars

Strange Attractors are quite pretty.

I made have generated quite some random attractors.

Now I need to find the most beautiful ones, and I need your help!

I have created a voting system, where 3 attractors line up and you select the best one. The votes are then accumulated and and overall top 10 is generated.

Strange Attractor wars

It is heavily inspired by kittenwars.com.

I have been hacking away on this far to long. But expect an article with more details on Strange attractors and probably more features in the “war” application. (like top 100, biggest looser, most victorious etc).

Now just go and make some votes :)

DTMF dialer

UPDATE : see  dtmf-dialer-got-new-features

I got around to hacking some code together for a simple DTMF dialer on the mobile.

Its functional and simple. Enter a number, click ok and it will play the correct sequence of tones. It’s even possible to tweak the duration and pauses.

I have only tested it on my own Nokia 6300, but as far as I can tell it should run on most java enabled mobile phones.

dtmf logo

Here are the jad and jar files. If you want to run the program download them to your mobile and have fun.

At the moment it converts + to 00 and removes +45, as this is appropriate for a danish setting.

Here is the sourcecode if you need to make changes.

DTMF sourcecode

Using Netbeans

I used netbeans 6.0.1 and it was a mixed pleasure. Creating the the flow using a drag’n’drop interface, is well nice for something small and simple as this, but I found that it soon got frustrating. There’s no API to look in, and you have to use the mouse all the time.

dtfmFlow

This is the basic flow of the midlet. It was very quick to set this up, and it were indeed a pleasure to start with. Somewhere along the way a made a mistake, which the flowdesigner and codegenerator couldn’t handle. And no matter what I tried I couldn’t get rid of it, I knew exactly what i was. I had misnamed a variable and managed to let the generated code go into a never-ending recursion. (something along the lines of: private TextField foo() { return new TextField(Foo);} ). But no matter what I tried it just wouldn’t get back to normal. In the end I just created a new project, remade the flow stuff to what you see above, and copied a few functions over.

And the flowdesigner is quick to work with, but I get a nagging suspicion that if you are going to make something a little more complicated than this it will be an annoyance. You might know exactly where and what to change in the source code, but do you remember where to point, click and edit in the designerinterface? Another critique is that even when you know what to do, your workflow gets abruptted by having to constantly shift hands between keyboard and mouse.

To Netbeans defence i must say that I am used to using Eclipse, and changing to another IDE is in it self a frustrating experience. Whats the shortcut for blah, where do I set this. And its quite possible that I just didn’t know enough about Netbeans structure and shortcuts to feel at home.

Credit goes out to : openclipart.org for the image of the phone and dialabc for the soundfiles.

Retro insane asylum telephone

I recently bought an oldskool rotary phone. I saw it at an auction and it looked nice, but its history was even more fascinating. In its youth it was doing service at the local insane asylum.

insane asylum

image from the museum.

From the leaflet: “Welcome as a patient to the Psychiatric Hospital”
About the Psychiatric Hospital

The highly regarded Copenhagen architect, Gotlieb Bindsboll, built the Jyske Asylum in the middle of the 19th Century. The inspiration for the building, with its crow step gables and many beautiful courtrooms, was taken from the typical Danish manor houses. Its position, with views over the Århus bay was in keeping with the contemporary view of the healing benefits of beauty. The hospital became known as a model institution for the treatment of the mentally ill, also on a European scale. The first part of the hospital was completed in 1852 and it was extended several times over the next fifty years.

kirk phone

The phone is from 1951 1955 and the “electronics” looks aged but in surprisingly good condition. My first plan for it were to gut it, and put a more modern telephone inside, so I could use it for voip. But when I saw that it were in good condition, I thought it would be a shame to kill it entirely.

So I wanted to see whether it would be possible to use it as it is.

For the voip connection i have a PAP2T linksys adaptor (pap), its quite simple to work with. Plug in power and ethernet cable and configure it with a voip service-provider. Initially I used a normal phone to make sure that i had a working setup, before trying to get the rotary phone to work. The normal phone were quite easy to setup and it “just works”.

For the rotary phone there is still some difficulties. But i have managed to get something to work, and I am working on the rest.

First of all i had to change to paps power output to maximum, else it wouldn’t ring the bells. I am still in the process of fiddling with settings for impedance and/or input gain. The problem is that the microphone volume is very low, and if I just turn the input gain up it turns up for the noise as well. It isn’t a problem for me as i have a crisp and clear sound, but apparently it’s a pain to whomever I am talking to. So something has to be done.

Then there is the dialing. A rotary phone dials by using pulse dialing, which in essence means that it disconnects/hangs up, in short intervals as a method of counting the numbers. But any modern voip-adaptor (at least a cheap one) can only function using DTMF. That’s were sending different tones means different numbers. Which basically means that it is enough to send the correct sequence of tones into the microphone in order to dial a number.

I had seen some applets for dialling they did work with the modern telephone, but the rotary phone with its microphone troubles had to get something more. I had success using “DTMF-dial” (from the ubuntu repositories), because it was possible to tweak the duration of tones and pauses.

Next step, as holding the phone to the PC-speaker every time i need to make a phone call, is not an option, were to make a midlet, that’s a mobile applet. A java program for the mobile. Using the mobile as a dialer may seem awkward, but it already holds all my contacts and the voip is a great deal cheaper. I have a midlet at the moment that is at the proof of concept stage. It can dial and I am able to take a number from my address-book dial it using DTMF. It still needs a bit of polishing, but its mostly cosmetic, maybe a list of recent calls would be a nice feature to implement.

soon to come:

  • Nice pictures of the phone, and the electronics.
  • Some software for DTMF dialing on the mobile and a bit about devolping a simple mobile application in netbeans.