Archive for the ‘code’ Category

Supporting different languages

Sunday, December 3rd, 2006

I got an email on Friday from a German guy called Bernard. He uses my wiki note-taking app that I wrote to play with the Windows Mobile SDK (that in itself was a surprise!).

He asked if I’d add support for accented characters to it, as he (unsurprisingly, being German!) wanted to use German characters in his notes. That was an easy enough fix – just add a lookup table to the wiki markup parser which replaces characters with their HTML code equivalent.

Hurrah – I could feel suitably smug for making it a little less English-centric.

A guy called Alex brought me back down to earth on Saturday morning with an email pointing out that when he uses my wiki note-taking app (wow – how many people are using this??), it displays the wrong Chinese characters in ‘View’ mode to the ones he enters in ‘Edit’ mode. Chinese? Eeek… this isn’t something I knew about.

(more…)

Google Maps mash-ups are easy

Wednesday, November 29th, 2006

A colleague from dare2, a youth development charity based in Woking, asked where the nearest IBM location to him was. I didn’t know.

The IBM UK website gives a list of UK locations. But there are two small problems. One – my geography is so bad that I don’t know where Woking actually is. Two – my geography is so bad that I don’t know where each of the IBM locations on the IBM list are. Okay, it’s really one reason, but it’s embarrassing enough that it’s worth mentioning twice 🙂

So, I thought this would be a good enough excuse to try creating my first Google Maps mash-up.

(more…)

Windows Command Line has got smarter

Friday, November 24th, 2006

Most die-hard command-line fans tend to agree that the Windows Command Prompt isn’t great. When you consider how old it is, it isn’t all that powerful. This isn’t the end of the world, as there is always cygwin.

But now Microsoft have released their new command prompt PowerShell. I tried downloading it this evening, and so far, I really like it.

(more…)

I can be a C-numptie

Wednesday, November 22nd, 2006

This might not be earth-shatteringly new to those who have seen my code before, but I was a little surprised. 🙂

A C program that I wrote a little while ago (and has previously worked fine on Windows, Linux, Solaris and HP) failed horribly on AIX. A little digging showed that I had written:

char* thisIsSupposedToBeAString[256];

I guess that at the time I wrote it (presumably early in the morning, and caffeine-fuelled) I had a string (char thisIsSupposedToBeAString[256];) and wanted a pointer to it, so went back and stuck a * on it without thinking.

(more…)

Using Scheduled Tasks and batch files to do automatic backups

Friday, November 17th, 2006

As I’ve started storing all of my project work and GTD notes in my Wiki program, I thought it might be a good idea to take regular backups of the text files it uses for data. And being a geek, I thought I’d automate it. 🙂

@ECHO OFF
REM this makes the batch file less noisy - dont 
REM  output commands to screen

REM limit scope for environment variables created here REM to within this batch file only SETLOCAL
REM make a note of where the current directory is REM so we can go back there afterwards REM (useful when running this batch file manually) set DIR_TO_RESTORE=%CD%
REM run the 'date /t' command REM this outputs in the format: REM 19/11/2006 REM (probably different for people with non-UK regional REM settings)
REM Using for to look at bits of date individually... REM FOR /F ["options"] %variable IN ('command1') DO command REM options - REM tokens - identify which bits of the date output I want REM (3 tokens - day month year), REM delimiters - how they are separated ('/') REM (users with non-UK regional settings might REM need to change this - e.g. for '-') REM command - REM 1) date /t - show date without prompting to change it REM 2) set - set environment variables to store each token FOR /f "tokens=1-3 delims=/ " %%G IN ('date /t') DO ( REM set environment variables to store individual date values REM (assumes date/month/year - users with non-UK regional REM settings might want to switch date and month) set dd=%%G set mm=%%H set yy=%%I)
REM this gives us a numeric date - in the format yyyyMMdd REM which is useful in filenames for sorting set TODAY=%yy%%mm%%dd%
REM go to first directory containing something to backup REM tar it up, and move it to a backups directory cd "C:\\Documents And Settings\\Administrator\\My Documents\\bLADE My Documents\\" "C:\\cygwin\\bin\\tar.exe" -cvf %TODAY%_gtd.tar WM_Wiki_Pages move %TODAY%_gtd.tar "..\\My Personal\\WMWiki Backups\\."
REM repeat as required cd "C:\\Documents and Settings\\Administrator\\My Documents\\My Personal\\" "C:\\cygwin\\bin\\tar.exe" -cvf %TODAY%_ref.tar "My WM Wikis" move %TODAY%_ref.tar "..\\My Personal\\WMWiki Backups\\."
REM finished! go back to where we started cd %DIR_TO_RESTORE%
REM end scope for environment variables ENDLOCAL

(more…)

Using IContextMenu to extend Windows apps

Sunday, November 12th, 2006

I read a couple of weeks ago about Google acknowledging that they’d released too many products, and deciding to focus on developing features for existing products where possible in future. screenshotWith this in mind, this evening’s idea for Windows Mobile development is an extension to one of the core applications rather than a new application.

‘Email Triage’ is my extension to Pocket Outlook. Pocket Outlook comes with Tasks, Calendar and Messaging (for emails, SMS, and MMS). Despite the way the ‘Pocket Outlook’ sounds, these are more or less separate applications, which don’t interact other than sharing a common database to store information. As a user, the common name feels like mainly a branding thing. So I thought I’d try bringing them a bit closer together.

(more…)

I can actually finish stuff! (sort of)

Sunday, November 5th, 2006

My Thinkpad is full of random bits and pieces of unfinished code. Typically, I’ll have an idea for something, and do enough of it to convince myself that I’d be able to do it. Something like a coding magpie, I then get distracted by something else and never get round to going back and finishing it. Given that, I’m all the more impressed that I got round to finishing the Windows Mobile wiki-based notetaking app that I started last Sunday.

I know about a few little kinks in the code, and I’m sure there are many more. So maybe not completely finished, but it’s in a state where I can start using it, and have made it available to a few other people to use it as well.

(more…)

Using .NET WebBrowser to create a mobile wiki

Sunday, October 29th, 2006

Wrote another Windows Mobile app tonight – this time I even tried it out on my phone and not just the emulator!

The idea of this one is an alternative to the built-in Windows Mobile “Notes” application. Instead of single ‘post-it-style’ notes, the idea is to use a wiki approach – a personal wiki, entirely hosted on the PDA. (Partly because it is quicker to use local files, but mainly because I’m too skint to pay the mobile data fees to access an online wiki :-))

I prefer the wiki approach to note-taking – mainly for the quick and easy formatting and the hyperlinks between pages. I’ve used something similar before on Palm OS for a couple of years now – ‘NoteStudio‘ by DogMelon. This is a brilliant app, which I really miss since moving to Windows Mobile as my main PDA. (There has been some talk of a Windows Mobile for a while now, but this is looking a little like vaporware).

When I saw that the .NET compact framework included a web browser widget, I thought I’d see how hard it would be to knock together a wiki tool tonight.

(more…)