Using mercurial with eclipse to edit actionscript files on os x

We have recently switched to use mercurial as our DVCS. We’re hosting our many repositories on bitbucket.

I love it.

When it comes to actionscript files, flash has always had odd newlines. For some reason, it has always used r as it’s newline. Mercurial, beeing a unix tool, likes it’s newlines to be n. So what better to do, than to make mercurial encode/decode the files for us.

To do that, we can simply add the following to our .hgrc file:

[encode]
*.as = perl -pe 's/r/n/g'
[decode]
*.as = perl -pe 's/r/n/g'

I don’t really know wether the decode part is necessary, but I like to keep it around (if someone should commit poison).

DNS management done right (and without the crappy attitude)

I’ve been using GratisDNS A free danish dns provider to manage my dns for a long time. Using their management interface is no walk in the park. It also has a bat habit of sending the username and password as a hidden form variable for every page request, in cleartext mind you. Nothing like examining the source of a page (for instance, if you wanted to make an python api) and seeing your password in cleartext.

As far as their interface goes, I can deal with that. It works, and it seems to do what it’s supposed to do fairly easy. A thing that has pushed me over the top, is the admins inability to help diagnostic a technical issue related to using their system as a secondary dns in front of a hidden primary.

Yesterday a good friend of mine told me that there was a new player in the dns game, one started by some people that seem to care about usability, exciting features (multiple dns templates per domain) and external api’s (goodbuy BeautifulSoup). It’s called QuickDNS.

So I rushed to their site, created myself a user and started tinkering around. Let’s just say, the it was actually a pleasant experience to do, things just workedtm. So I setup a few templates and now have transfered a handful of my domains over there. Seems to work very well, just as expected.

So a very big congratulations to the whole QuickDNS team, you’ve done an excellent job, and made me a happy customer.

I seem to have agreed to give them a case of cola once they start implementing the axfr / hidden primary feature, and another one on completion. Can’t wait!

Mercurial trac commit hook

Having searched a lot around google, it does not seem that anyone has published their trac commit hooks for mercurial. Since I had to use just that, I’ve cooked up a little hook which is based on the hook from the timingandestimationplugin. I’ve created it as a changegroup hook, and it’s probably filled with bugs, but it seems to work and it catches the fixes #42 and such.

To use the hook you must place it somewhere inside your PYTHONPATH and tell mercurial to use it (I placed it in a module called trachook — don’t call your module trac):

[hooks]
changegroup = python:trachook.hook

And tell the hook where to find your trac installation:

[trac-hook]
root = /path/to/trac
url = http://url/to/trac

Grab your own copy of the source, and happy coding. And a big thank you to Jesper Nøhr.

Also, if you need a place to host your mercurial repository but don’t wan’t to set it up yourself, check out bitbucket.

What open source and dentists have in common

So this morning I went to the dentist. I have the most fair and lovely dentist in the whole world, but today, there were a new dentist in town. Now I really don’t mind dentists, going to the dentist or doctors in general, but what i don’t like is not being informed about what is going to happen next. The same goes for open source projects.

Continue reading

5 simple rules for café trips

So yestoday Seph, Rune and me went to work. Apparently i came at the exact right moment, as the first question I was met with was “Hey, we talked about going to the downstairs café for brunch. You in?”.

Seeing as this is the thrid time we went down there in the last 3 weeks, we came up with a little ruleset for when we are allowed to ditch work, and have a relaxing cup of coffee.

Rules for café going for the Coniuro denmark office are:

  • If it’s very hot outside
  • If it’s very cold outside
  • If it’s very windy outside
  • If it became a habbit
  • If it has been a while since the last time we went

If any of the rules should become true, we are allowed to go.

Having an office in the center of copenhagen has it’s advantages!

Porting normalvariate from python to C

Seeing as bromer needed a normalvariate function in C for some cluster project at DIKU, I thought it might be a good deal of fun to port it from python. That plus I have no clue what so ever about what the function does.

Without further delay, here is my first C code for a long time.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <math.h>
#include <stdlib.h>
 
#define NV_MAGICCONST 1.7155277699214135 /* (4 * exp(-0.5) / sqrt(2.0)); */
#define MAX_RANDOM 2147483647 /* (2 ** 31) - 1; */
 
/*
 * normalvariate ported from python's stdlib (random.normalvariate).
 * released under the same licence as that (python license).
 *
 * remember to initialize the random engine before calling this function.
 */
double normalvariate(double mu, double sigma) {
	double u1, u2, z, zz;
	for (;;) {
		u1 = ((float)random()) / MAX_RANDOM;
		u2 = 1.0 - (((float)random()) / MAX_RANDOM);
 
		z = NV_MAGICCONST * (u1 - 0.5) / u2;
		zz = z * z / 4.0;
 
		if (zz <= -(log(u2))) {
			break;
		}
	}
 
	return mu + z * sigma;
}

Time pases

It seems it has been a while since I’ve written anything here. Well, I’ve been busy moving, painting, working and such. In deed, I’ve moved to my new home at Godsbanegade 18 which is about 5 minutes from work on a bicycle. Very, very nice. Also, my new place has a gas stove which I’m looking forward to start using. I’ve been showing it off to quite a few people but never actually used it yet.

Oh yes, and the new place is just about 250 meters away from Morten Reinholdt.

There, hope you feel updated now.

Stress a pigeon – the game

Seeing as Copenhagen (the city where I live) has a whole lot of fat, lazy pigeons, what better to use them for, than a little game giving them exercise and entertainment for yourself.

The pigeon’s of Copenhagen are quite lazy and probably won’t even move unless you are very close to stepping on them. You can easily walk very close to most of them, and you could hand feed them if you thought that was fun. I don’t. I’m more into stressing them.

Continue reading