A world in dk(decay/denmark) » jar file http://rotand.dk Just another pointless weblog Sat, 30 Nov 2013 21:03:48 +0000 en-US hourly 1 https://wordpress.org/?v=4.3.18 DTMF dialer got new features http://rotand.dk/2009/06/27/dtmf-dialer-got-new-features/ http://rotand.dk/2009/06/27/dtmf-dialer-got-new-features/#comments Sat, 27 Jun 2009 17:14:29 +0000 http://rotand.dk/blog/?p=198 I got a comment from a reader who used my DTMF dialer but missed a feature.

It was the ability to change what prefix to remove. As i live in Denmark, whenever i make a call on a land-line there is no reason to dial +45, which is the danish country code. Actually the plus is converted into 00 as well.

But Eli needed the prefix 08 to be removed.

And i guess that there are a lot of other prefixes that could be removed and + shouldn’t always be converted to 00. So I decided to implement this feature.

Whats new

  • It now remembers your settings
  • It possible to choose a prefix to remove
  • its possible to decide what + should be replaced by.
  • I slapped a GPL V3 license on it

The files

dtmfdialer jad file

dtmfdialer jar file

dtmfdialer source code

Unfortunately it wasn’t just a 5 min hack. There were two major challenges.

Persistence

In J2me access to the filesystem is restricted and requires all sorts of security permissions, but every application has access to a “RecordStore”. The RecordStore (RMS) only allows byte[] to be stored, so you have to marshall/unmarshall every piece of data at quite a low level. I haven’t persisted any data in the first version, as this is indeed tedious to work with. But not having persistence for a prefix remover functionality wouldn’t be of any use. You would have to enter the same data every time you used the application and then it would be faster to just edit the number to call.

Netbeans mobility pack

It was supposed to be so eays.

But the floweditor somehow did mess up and didn’t generate the code, so the flow diagram and the sourcecode were out of sync, and i didn’t see any way to “resync”/”regenerate code/diagram”. This was cause for a lot of frustrations.

Originally i made it with netbeans so compiling and editing the generated code were best done in netbeans. But if i ever were to mess with it again i would seriosly consider “porting” it to J2me Polish or just “vanillia” j2me. As i really really don’t like the netbeans editor.

update : Eli found a bug in the prefix substitution, i fixed and uploaded the new version (June 27, 2009, 21:17)

]]>
http://rotand.dk/2009/06/27/dtmf-dialer-got-new-features/feed/ 0
Collection of Processing.org hacks http://rotand.dk/2009/02/27/collection-of-processingorg-hacks/ http://rotand.dk/2009/02/27/collection-of-processingorg-hacks/#comments Fri, 27 Feb 2009 20:07:06 +0000 http://rotand.dk/blog/?p=74 Its been quite a while since I last posted anything.

That doesn’t mean that i haven’t been coding small hacks, just that i haven’t posted them. But now is probably a good time to show some of the stuff.

As the title suggest it has something to do with processing.org. I have been using processing on and off for some time. Its is really nice when you want to make a quick hack, or as its called in processing a “sketch”.

In no particular order here is some of the fun stuff made using processing.

General remarks

The following sketches and their sourcecode have served as small hacks, hence don’t expect nice comments or optimal algorithms…

shrinkImage

It is possible to remove the line from a picture representing the least amount of information. The algorithm evaluates every pixels “weight” as the absolute difference between the different color channels (r,g,b). And then finds the “lightest path” from the bottom to the top.

This means that “prominent features” won’t be removed or change size when shrinking the image. Here the definition of “prominent features” is high difference in colors between the neighboring pixels.

Have a look at shrinkImage

Room for optimizations :

Eventhough its quite quick at calculating the weights and finding the lightest path, it does so in every iteration. Letting it use a bit more memory and just recalculate the changes when removing a line should speed it up. I found a huge speedup when just having an array with the weights from the last and current line, when calculation the path, so not only would saving all weights require a bit more memory it would also slow down the first calculation. But I’m sure it would give a significant speed up in the next iterations, and a lot of +-1 frustrations šŸ˜‰

helloFoo

There a some quick getting to know processing hacks, this is one off the. helloFoo

One of the very cool things about processing is the ability to use openGL, so originally this sketch uses openGL. But applets and openGL isn’t exactly the best combination. It can be done, but since it doesn’t work for me (firefox, linux openJDK JRE) i just converted it to standard java graphics. And the effort required to do this, is remove an import and don’t say setup(400,400, OPENGL) but just setup(400,400). This is trivially true the other way around. If you want to use openGL its quite easy.

The sketch is just bouncing balls, when going away from openGL I reduced the size and number of balls, in order to get a decent animation speed.

FooIII

Again used openGl originally FooIII

Some satellites rotating around some satellites rotating around some ….

sndHello

yes sketches tend to have silly names : sndHello

From Clifford PickoversĀ  book : Computers, Pattern, Chaos, and Beauty – graphics from an unseen world (p 39 section 4.3 snowflakes fromĀ Ā  sound)
Draw symmetrically and in “polar form” theĀ fft of the sound, hence creating snowflakes based on the sound.
Music by David Rovics
Choppy sound I had some problems with the sound when run as an applet. You might have better luck using the jar directly or by downloading the sourcecode and running it with processing

Slit-scanning

The former applet relied on an external library for the sound, ther are quite a few libraries available. I did use GSvideo to hook up my crappy webcam and do some video effects. I experimented with slit-scanning in different ways.Unfortunately this won’t run as an applet and it might only run on Linux.

By creating a cube of the images, where the z-axis represents time, its possible to play back different parts of the movie from different layers in time. Which makes for some quite interesting and dizzing effects.

For example a time buble where playback is delayed around a “bulge in the timespace continuum” :s (a video of some guy playing with it (timebuble1.avi) some sourcecode for a similar effect where the mouse pointer moves the buble (TimeCube.pde) another more “traditional slitscan” (CamWarpTime.pde) .

In general there is plenty of room to fiddle with the code, there a functions like selectSlice or initQueues where its decided how to slice time. its great fun to play with..

]]>
http://rotand.dk/2009/02/27/collection-of-processingorg-hacks/feed/ 0
Matrix Multiplication http://rotand.dk/2008/06/14/matrix-multiplication/ http://rotand.dk/2008/06/14/matrix-multiplication/#comments Sat, 14 Jun 2008 16:03:46 +0000 http://rotand.dk/blog/?p=69 Who would have thought that matrix multiplication could be beautiful ?

linear tranformation by matrix multiplication

The very short desctiption :

inspiration from an example of homogeneous coordinates in my linear algebra book and lectures about lineartransforms.

There is a jar, with sourcecode, if you want to se it “live” or twiddle with it.

tegneri

]]>
http://rotand.dk/2008/06/14/matrix-multiplication/feed/ 4
DTMF dialer http://rotand.dk/2008/03/20/dtmf-dialer/ http://rotand.dk/2008/03/20/dtmf-dialer/#comments Thu, 20 Mar 2008 20:23:54 +0000 http://rotand.dk/blog/2008/03/20/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.

]]>
http://rotand.dk/2008/03/20/dtmf-dialer/feed/ 1
FreeVibes http://rotand.dk/2007/06/27/freevibes/ http://rotand.dk/2007/06/27/freevibes/#comments Wed, 27 Jun 2007 11:57:33 +0000 http://rotand.dk/blog/2007/06/27/freevibes/ Finally the summer-holiday arrived, now its time to do some fun coding.

I bought myself a new mobile, a Nokia 6300, it’s got all the bells and whistles. Hmm well at least those I could afford. I choose this mobile because it has : Java, mp3 -player, bluetooth and memorycard.

I must admit that i might be a bit of a nerd, so I just had to code something for it. And after “hello world” I found a small and some would say useless application to code.

FreeVibes

I must say I got inspired by vibelet and the article in wired ( Hold the Phone, It’s a Sex Toy ). As the title suggest, its well vibrating. I think that vibelet – though i haven’t seen their program, must be making quite an profit. Because getting a java-enabled phone to vibrate constantly, is quite easy.

So now its Time for FreeVibes, a free software version.

FreeVibes splash ducky
That’s the fancy splash screen And when its in vibrating mode, this little duck is there. And now why a rubberduck ? ( answers )

If you want to try it out, here are the jar and jad files. Just put them on your java-enabled mobile phone. I have just tested it on my telephone, It should work on any new mobile (with java) :

Jad File
Jar File
Source code

Installation

  1. Download the jar and jad file and place them on the phone in the same directory.
  2. Run the applet
  3. Have fun

Technicalities

Getting things to work with ubuntu feisty fawn.

I use SUNs java 6 and the wireless toolkit for the J2me.

Nokia has a nice area with information about coding for their phones (forum.nokia.com). But i didn’t have any success using their eclipse plugin and carbide.j seems to be a windows application. But eclipseME worked like a charm.

When setting up a device for EclipseME i had to make sure that it was MIDP 2.0 and CLDC 1.1. It wasn’t the default and the Nokia 6300 can’t handle MIDP 2.1.

They code and design is inspired by Nokias tutorial on making MIDP 2.0 games.

The images I used are from the openclipart collection, hacked together with GiMP and Inkscape, and I use obexftp to transfer the files to the phone.

]]>
http://rotand.dk/2007/06/27/freevibes/feed/ 2