Archive for the 'Övrigt' Category

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

Nedräkningar

2009-04-20

Kodare presenterar Countdown!

Jag hade en idé om en enkel sida för att göra nedräkningar som man kunde dela med sig av, ha som startsida, etc. Nu i helgen satte Möller sig och kodade upp den första versionen.

Skapa en nedräknare till något kul som du har planerat, så ger Countdown dig en adress att dela med dig av till alla andra som ska titta på samma TV-programheja på samma match eller fira samma nyår. Snabbt och enkelt.

– Sebastian

Formatera kod på nätet

2009-04-11

Jag la upp en liten web-tjänst för att fixa syntax highlighting av kod i HTML. Adressen är http://kodare.com/syntax_highlight/. CSS:et som krävs för att få det att se vettigt ut ligger på http://kodare.com/site-media/code.css. Exempel:

def split_and_trim(s, separator=','):
    if s == '':
        return []
    
    result = []
    for x in s.split(','):
        foo = x.strip()
        if foo != '':
            result.append(foo)
    return result
– Möller