Technology


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…)

Mac& Music02 Jan 2007 06:17 pm

Perhaps it’s old news, but I had no idea that when you deleted some music which came from the iTunes Music Store from your iTunes library, you’d get the chance to restore it from your iPod.

copy_off_ipod

Nice touch , though not actually what I wanted in this case (I originally bought an album on iTMS which was corrupt, got a refund then bought the CD instead, and have now finally got to deleting the old corrupted songs).

There are a few question - If I check the ‘Don’t ask me again’ box, can I enable the feature again somehow later? Wouldn’t it be great if iTunes could somehow do this for all music (not unreasonable if both the iPod and iTunes have been authorised)? Why is iTunes using the word purchased only for iTunes Music Store music (the music from my CDs being just as purchased)?

Anyway, one way or another, it seemed like a cute feature.

Technorati Tags: , , , ,

Mac& Music30 Dec 2006 11:10 am

A while back, I was given a spoken word MP3 CD (by my girlfriend) as a present, and over Christmas I was lucky enough to be given an iPod nano (by my parents). I hadn’t put any serious effort into the iTunes audiobook thing into the past, but figured I should try to get everything in there so I could listen to it on the iPod. Surprisingly, it’s not obvious how to do, since when you import mp3s into iTunes, it assumes they are music, not audiobooks.

Anyway, after a bit of research, it turns out there is a not-too-painful way to pull it all together.

  1. The MP3s need to be translated into ACCs, ideally at a sensible spoken word bitrate, so jump into iTunes prefs -> Advanced -> Importing, and switch to ‘ACC Encoder’ and ‘Spoken Podcast’.
  2. Import all the MP3s (dragging them to iTunes), then select them all, and choose ‘Convert selection to ACC’ from the Advanced menu.
  3. Once they’re all converted, delete the MP3 versions.
  4. Install the ‘Make Bookmarkable’ script from Doug’s AppleScripts for iTunes.
  5. Select the converted ACC files, then pick ‘Make Bookmarkable’ from the scripts menu, which will change the file types so that iTunes thinks they are audiobooks.

(Unfortunatly the AppleScript part won’t work under Windows, but I believe changing the filename extensions from .m4a to .m4b and then removing and re-adding the file to iTunes should do the trick there).

Web22 Oct 2006 02:32 pm

It’s a real pity that none of the decent mapping sites in Australia seem to offer directions. (i.e. Zoom In or Google maps)

whereis.com does seem to give semi-decent directions, but has poor looking maps, and the interface is horrible by comparison (though they’re attempt at dynamic zooming is quite amusing). The other problem with whereis is that it’s impossibly to email someone a link to one of their maps without paying for it, which seems rather silly.

I imagine it would be quite challenging to generate good driving directions efficiently, but then, it would also be difficult to build the maps in the first place I imagine. Anyway, here’s hoping the other guys get the directions working sometime soon, or whereis gets it’s interface act together.

On the other hand, perhaps there’s one I haven’t heard about yet.

Web13 Sep 2006 06:40 pm

I’ve been running into some problems porting a perl based CGI program from Linux to windows lately. The key issue is that when running perl in taint mode, you must set the PATH environment variable to some known string prior to doing anything which executes another common (exec, system, backticks etc.). The problem is that clearing the path means that perl is then unable to find the cmd.exe shell when running on Windows.

I’m not all that up on Windows programming in perl, but it seems that adding in any particular path (say C:\WINDOWS\system32) isn’t likely to work if Windows is installed in some unusual location. Unfortunately avoiding the shell processing (by passing a list of arguments to system or exec rather than a string) isn’t looking like it’s a viable option either, at least in the short term, so I’m more or less stuck.

I’m sure there’s some sort for clever trick for solving this, but Google has not turned up anything obvious. Perhaps, as a last resort, there’s some way to find out where Windows is installed through the registry?

Update

Thanks to Victor for his suggestion about the registry. What I ended up doing was looking at the SystemRoot environment variable with some code along the lines of the following.

delete @ENV{qw(IFS CDPATH ENV BASH_ENV PATH)};
if ($^O =~ /win/i) {
            # Perl must be able to find cmd.exe, so add
            # C:\WINDOWS\system32 to the path
            $ENV{'SystemRoot'} =~ /([A-Z]:(\\[A-Za-z0-9_]+)+)/;
            my $system32_dir = catdir($1,'system32');
            $ENV{'PATH'} = $system32_dir;
}
exec($command);

If anyone has suggestion, or just knows for a fact that this will fail in some case, please let me know (in the comments).

Technorati Tags: , , ,

Technology25 Apr 2006 10:01 pm

One of the reasons for my switching to Windows was that I was hoping I’d be able to find a decent, free, RSS reader like NetNewsWire Lite (Though I’ve got the full version of it these days). FeedDemon sounds promising, but doesn’t seem to have a free version. I could, of course, run the now abandoned (though seemingly still for sale) Sauce Reader, which was quite usable back in the day, but it seems silly to commit to something which is no longer being developed. I might try out SharpReader but their website doesn’t make me confident about the likely level of polish.

I don’t suppose I’m expecting any better suggestions (though that would be great), but it seems really strange that there’s not an obvious choice. I once heard someone say that one of the big reasons for the popularity of web apps is that so many windows users have been made afraid of installing new software (particularly when it’s free and internet related). I was sceptical at the time (I suspect it’s more about unix developers not having any halfway decent GUI toolkit), but perhaps there is in fact something to it.

Technorati Tags: , ,

« Previous PageNext Page »