Software Engineering


Software Engineering20 Jun 2007 07:29 pm

Thanks to Eric for point out that the two marbles solution I presented previously isn’t optimal. I’m pretty confident that allowing the first pass windows size to vary will fix it up, but haven’t found the time to site down and work it through.

On the other hand, it crossed my mind this morning that the question didn’t state what we should optimise for. I imagine the number of marble drops is what’s expected, but if you took into account the running up and down stairs involved that may well affect the solution…

Hmmmm…

Software Engineering& Technology& Web31 May 2007 01:37 pm

Google Gears (Google’s toolkit for off-line web applications) looks really cool (thought it’s a pity it has to be installed as a plug-in and there are a lot of “We have nothing to announce at this time” type responses floating around. A lot of people seem to be asking about things like conflict resolution etc. which is being left as an application concern for now. The few web developers around seem to be underestimating the amount of rework which would be required, but for new web applications it looks like it will be quite easy to produce a radically better off-line experience.

Maplets look cute, but I’ve not really played with maps much, so it doesn’t seem to radical to me. The ‘coming soon’ mention of AdSense for maps is interesting - looks like you’ll be able to make a call with your id and a number of ads to display and have them shown along with whatever other map content your maplet/mashup is adding.

Food’s been pretty good, got a very cool notepad which has a picture of the earth on the cover then zooms in as you tilt it forward.

…And why do they always have conference name tags designed so they turn backwards accidentally so easily. Surely it would be simple to attach it to the lanyard at two corners rather than just at the centre…

Technorati Tags: , , , ,

Mac& Software Engineering19 May 2007 11:46 pm

Getting the following error when you try to run html tidy from TextMate?

html tidy failed assertion `option_defs[ optId ].type == TidyInteger’

You’ve probably got the current (as of 19 May 2007) binary version installed by fink. If you install the one built by fink from source, or the one from the html tidy website, then it should start working.

(For what it’s worth, it seems the binary package fails with that error whenever it’s given the ‘-i’ flag to ask it to perform indentation.)

Software Engineering& Technology13 May 2007 10:18 am

This is another question I saw around the place somewhere, attributed to Google. It goes along the following lines…

You are given two marbles, and told that they will break when dropped from some certain height (and presumably suffer no damage if dropped from below that height). You’re then taken to a 100 story building (presumably higher than the certain height), and asked to find the highest floor your can drop a marble from without breaking it as efficiently as possible.
(more…)

Software Engineering& Technology16 Apr 2007 08:10 pm

A couple of days ago I noticed a link on del.icio.us popular to a list of programming interview questions from, allegedly, Google and Microsoft. Anyway, for the sake of having something to put up here, I’m going to post my solutions to a few…Hopefully someone will tell me if I’ve gone wrong along the way :)
Stack Growth : How would you find out if a machine’s stack grows up or down in memory?

Well, it’s fairly simple to write a C program to test this. Obviously I’m assuming that a C compiler is available. The following program creates an integer (a) on the stack, then passes a pointer to a down to the function sub. sub creates another integer on the stack (b), then compares the address of a to the address of b. If b’s address is greater then a’s, then the stack is growing up, if it’s less, then it’s growing down.

#include <stdio .h>

void sub(int *a) {
	int b;

	if (&b > a) {
		printf("Stack grows up.");
	} else {
		printf("Stack grows down.");
	}
}

main () {
	int a;
	sub(&a);
}

That said, perhaps there’s an easier way. I’m not aware of any standard tool which could tell me directly, though I wouldn’t be surprised if there were one. A bit of searching turned up a shell script which does the same thing but does the compilation for you, which is cute (but obviously OS dependent). Wikipedia tells me that most modern OSes grow the stack down which is odd given the security advantages of doing it up.

For what it’s worth, it goes down both on my Mac and a Linux box I have an account on. I’ll have to check Windows next time I have a chance.

Software Engineering& Technology12 Jan 2007 09:47 pm


List<string> sl = new List</string><string>();
List<object> ol = new List</object><object>();
ol = sl;

Bzzzt…

Cannot implicitly convert type ‘System.Collections.Generic.List<string>’ to ‘System.Collections.Generic.List<object>’

(more…)

Software Engineering19 Apr 2006 09:51 pm

I found myself restoring a subversion repository from a backup earlier today, and discovered it’s not as simple as one might imagine.

Our repository had been up to about revision 7600, but the backup was back around 7560, which wasn’t exactly a disaster as all the changes still existed in the working copies. However, trying to do anything with the working copies results in a subversion error saying, in effect, that revision 7600 (which is what the working copies were up to) doesn’t exist.

Unfortunately, since we’re using subversion to manage the configuration of a number of servers, messing directly with the working copies isn’t really an option, so I’m left with he rather painful task of trying to hack things back together. I’ve got most of a perl script to checkout a new working copy then slam all the .svn directories in the real working copy. In my tests, that’s allowed me to re-check in all the changes again without any major drama, so assuming that all goes smoothly on the real systems, I’ll see if the perl script can be pulled into a distributable state.

You would imagine this is the sort of thing that there would be a standard solution for though, but google was only able to pull up suggestions along the lines of what I’m doing here. I’ve not tried it, but someone at work did suggest making a bunch of fake revisions to bring the revision number back in line. I suspect that wouldn’t work correctly, but I’d love to hear if anyone’s tried it.

Technorati Tags: , , ,

Software Engineering18 Apr 2006 06:44 pm


mysqldump: Got error: 1146: Table 'wikidb.archive' doesn't exist when using LOCK TABLES

Anyone ever seen this sort of error from MySQL?

We got a whole stack of them from our automated backup process over Easter, eventually bringing the whole box down. A little concerning, though it doesn’t seem to have reoccurred so far.

[Update - Looks like it was being caused by a script which was supposed to sync the database to a live backup server. Due to a mis-reconfiguration, it ended up boiling down to mysqldump -uYYY -pXXX wikidb | mysql -uYYY -pXXX wikidb; which would probably be expected to cause locking problems.]

Technorati Tags: , , , ,

Software Engineering14 Apr 2006 10:51 pm

It’s been a rather software patent related day.

I spent a few hours reworking some code to avoid infringing some patents we recently discovered, and also found myself reading a post entitled ‘Are Software Patents Evil?‘ by Paul Graham (via stillhq).

Paul makes some very interesting points. I’ve always believed the the patents vs secrecy argument, but his argument that software patents should not be considered any different to other patents is interesting and quite persuasive. The problem of ‘patent trolls’ will certainly be something which will have to be resolved as he suggests, but I suspect it will prove much more difficult than we can imagine. The most interesting point, however, is that the only group actually trying to enforce software patents are the trolls. This would argue for abolishing them abolishing them altogether, except that Paul illustrates a number of favourable side effects - which brings us back to the patents vs secrecy argument.

My own experience for the day was less enlightening. Take a piece of code which does something in one order, and rearrange it slightly so the implementation no longer exactly matches the patent’s description. The whole thing feels a little like refactoring without the whole ’simplify the code’ goal. Anyway, it was a decent excuse for me to play with a bit of code I hadn’t touched before, but the whole thing doesn’t really feel like useful work.

Technorati Tags: , , , ,

Software Engineering13 Apr 2006 10:20 pm

Joel (of Joel on software) posted an interesting article titled ‘The development abstraction layer’ earlier today. The premise is basically that the best software companies expend a lot of their effort insulating their developers from the broader software development process so they can focus on developing software.

What I find interesting is that his description of the other two types of companies (engineering driven and sales driven) strike me as pretty spot on. I worked in the past at a company which I’d describe as engineering driven, and am currently working with one which I greatly fear is going to turn out to be very much as Joel describes a sales driven company.

Unfortunately, there’s not much advice out there about how to develop the sort of abstraction layer Joel describes from inside an engineering team. Of late, a great deal of my time has been spent on system administration, setting up things like subversion repositories. Though I’m reasonably competent at this sort of stuff, I doubt it’s really what I should be doing, which is why I’ve been pushing to outsource things like email hosting etc. as much as possible. In the end, however, I doubt it’s really possible to outsource enough to actually achieve a working development abstraction layer as described.

Anyway, this feels like it will be a useful model to keep in mind as the company I’m working with develops.

Technorati Tags: , ,

« Previous PageNext Page »