Blog moved

2011-03-18

We’ve moved the blog to our own hosting at kodare.net/blog. It’s nicer to have it integrated :P

– Möller


Python As You Type

2010-07-16

There are some pieces of code that have a million little details that you get wrong while developing. The workflow becomes: write some code, run, fix some trivial error, run, fix another trivial error, run, fix, run, fix, ad nauseum.

For these things it helps to get immediate feedback, so I wrote PythonAsYouType which runs your code for every keystroke and gives you any printed output in realtime. Of course there are some limitations, like the code you are working on needs to be fairly fast to execute or it becomes annoying. To alleviate this there’s a field to do any heavy setup you might have up front like reading files, etc.

You have to try it to really understand how it can change some problems from boring and annoying to just a joy to code.

– Möller


ParserBuilder 1.1

2010-06-28

I’ve posted an update to ParserBuilder with two changes:

  • The two fields (data and expression) are now persisted, so if you restart the app, it will take you back to exactly where you were when you left it.
  • Support for un-named/indexed groups. You still can’t mix and match, but for simple things and for fast prototyping it’s simpler to just write (.*?) than to write (?<a>.*?) until you have something that works and then add the name for easier to read code

Those two small things actually makes quite a bit of difference I think you’ll find.

– Möller


Easy Statefulness for Your iPhone App

2010-06-15

During development of Citihaiq we spent a lot of energy manually writing support for NSCoder into various classes. After a while it came to me that statefulness of an iPhone app should be easy. I did a bit of digging into the reflection system of Objective-C and came up with a 90% solution. Basically you inherit from a class supplied by my library and name all members you want to be stateful by naming them with the prefix ”stateful_” and now all you have to do is save and load state with two simple method calls when it is appropriate. Versioning and timeout for state is included.

More details can be found at the project page on google code.

– Möller


Ny design för Mammon

2010-03-07

Idag publicerade jag en ny design för Mammon. Den är lite mer minimalistisk och den ska också fixa några konstigheter som fanns förut med layouten. Fixade också så att den klagar lite smartare om man klistrar in rader den inte förstår. Om man går in på Nordas internetbank och markerar hela sidan och klistrar in så varnar den nu bara för 4 rader som den inte kan tolka.

-Möller


ParserBuilder

2010-02-08

I’ve often been annoyed at how creating regular expressions should be a quick process but there’s always some minor problems that seem double (or more) the development time. To solve this problem I made ParserBuilder. It’s a simple program that has one input box where you put the text you want to test your regexp on, one where you put the regexp itself, and an output table that shows the matched groups of the test text and the cool thing is that the parsing is done as you type, so you have instant feedback.

– Möller


Music Player for Dancers

2009-11-24

I’ve been annoyed at how crappy normal music players are when you’re training choreography. What you want is a way to set specific checkpoints in the music that you can go back to over and over again and jump between to train on different sections. So this sunday I decided that hey, it can’t be that hard to code it up! A few hours later and here’s my first beta: ChoreographPlayer (for Mac). Some key features:

  1. Select music from filesystem or directly from your iTunes library
  2. Apple Remote support!
  3. Checkpoints are displayed in a font that automatically fits the window so you can maximize the window to get a nice fullscreen view that can be seen across the room
  4. Store multiple choreographies with multiple checkpoints to easily go back and forth between several active projects

– Möller


A little word of warning on timers

2009-11-24

There’s some really nice utility functions in Cocoa that can make life a lot easier. Take performSelector:withObject:afterDelay: for example. It will call a function for you after a specified delay. But beware! It is the amount of time experienced by the main thread, not real time. Say you say to cocoa to call you back in 8 hours, but you put your machine to sleep for 4 hours in that period. In this scenario your selector will be called in 8+4 hours.

The moral of this story? Only use performSelector:withObject:afterDelay: for short delays.

– Möller


Objective-C to Python converter

2009-10-13

I’ve been doing a lot of PyObjC lately and I’m always annoyed at having to convert small snippets from Objective-C to Python. After some time I decided enough was enough so I spent some time coding it up finally. I present to you the Objective-C to Python converter! It will only convert the new style for loops and it has some other limitations, so you have to look over it to see that it’s correct, but it’s WAY smoother than doing it all manually. If you give it your entire .m file it will be pretty close to complete. Try this example code:

// create a new instance
Fraction *frac = [[Fraction alloc] init];
if (foo){ // set the values
[frac setNumerator: 1];  [frac setDenominator: 3];
}
else {
    // print it
    printf( "The fraction is: " );
    [frac print];
    printf( "\n" );
}
// free memory
[frac release];

return 0;

The source code is public domain.

– Möller


Liten Mammon-uppdatering

2009-10-12

Fixade så man kan ställa tillbaka kontot på en transaktion till standard-kontot (dvs till ”ingenting”), och gjorde lite snyggare hantering av rader som Mammon inte kan förstå. Nu kommer den lägga till transaktioner för alla rader den förstår, och sen spotta tillbaka dom den inte förstår med ett litet felmeddelande. Det är rätt trevligt om man gör något litet fånigt misstag när man copypaste:ar.

– Möller