Key Shortcuts in Windows XP

Key shortcuts in Windows XP frustrate me. For one thing, you can only assign key shortcuts to shortcut files (.lnk files) on the desktop. At least, that’s the consensus. It’s not completely true, though. You can also assign ‘certain’ key combination shortcuts to the shortcut files found in Programs > Accessories. The caveat is that the key combination must be of the form ‘ctrl + alt + …’, whereas shortcuts on the desktop can also be given key combinations with ‘ctrl + shift’.
So, not a perfect alternative to having a dedicated shortcut file on the desktop, but it could help you declutter a little.
To assign a key combination to a shortcut file, open the files Properties menu by right-clicking on it and choosing ‘Properties’, or press Alt+Enter when the file is selected. Now select the ‘Shortcut’ entry field, and press the keys you would like to use. Finally click Ok, and you’re all set.
Posted in Geen categorie | Leave a comment

Fullscreen with task bar

I like maximizing screen estate just as much as the next guy, but some things are just useful to have on-screen at all time. Like the Windows Task Bar for example. Most fullscreen-modes of software hide the task bar, however. This might be preferred sometimes, but when it’s not, change it!
The following C++ code uses the Windows API (formerly win32 API) to change the size of an Internet Explorer window (which will reveal the task bar when the window was in fullscreen-mode).

#include <stdio.h>
#include <Windows.h>
int WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){
   HWND lHwnd = FindWindow("IEFrame", NULL);
   MoveWindow(lHwnd,0,0,1280,770,TRUE);
   return 0;
}

Above code is quite crude, as the window name and desired window size are hard-coded in. ‘IEFrame’ is the name of an IE7 window (probably works for older/newer versions as well). My monitor’s resolution is 1280 × 800 and the task bar is 30 pixels high, which leads to the 1280 and 770 parameters.
If you want to change the code to target other programs, you’ll need to do some Googling for yourself (if you ask nicely in the comments, I might do it for you!). Remember that you need the Windows API (comes with the Microsoft Platform SDK) to compile, though.
 
A compiled version of the code above can be downloaded from here.
Posted in Computers en internet | Leave a comment

Yea vs. nay, yay vs. boo

 
‘Yea’ is a very old-fashioned formal way of saying ‘yes’, used mainly in voting. It’s the opposite of—and rhymes with—’nay’. When you want to write the common casual version of ‘yes’, the correct spelling is ‘yeah’ (sounds like ‘yeh’).
[Examples of yay:] When the third grade teacher announced a class trip to the zoo, we all yelled ‘yay!’ (the opposite of ‘boo’!). That was back when I was only yay high.
from Common Errors in English.

 
No way! Learn something everyday, eh?
Posted in Geen categorie | Leave a comment

Where I sing the praise of Sin & Punishment

 
Note: this post is a work in progress. It was published earlier than planned to bring news of Sin & Punishment 2
 
Ah, Sin & Punishment. The N64’s swansong that was never… sung. Well, not outside of Japan.
 
[This is where the praise-singing-part is going to be]
 
So imagine my delight and surprise when a sequel was announced; for the Nintendo Wii, no less! It was like they read my mind, took its contents, maybe read it again a few times, looked at each other, nodded contently for a while and then said: "Yes, this guy is right! We should do a sequel on Wii!". Yes, it must have been like that.
The sequel is currently titled Sin & Punishment 2 [insert obligatory joke about imagination of tentative title-thinker-upper here] and not much else is known about it. IGN has some images up and there is a brief glimpse of footage nestled in the Wii ‘sizzle’ reel from the conference (Update – new trailer here). The footage itself isn’t too special, but the thought of more S&P, this time with Wii pointer control, fills me with warm fuzzy feelings.
Posted in Geen categorie | Leave a comment

Convert CSV to KML (for Google Maps)

Update: my CSV to KML python script is now available as an online converter, right here:

http://csv2kml.appspot.com

Woah! This means I went through all the trouble of developing a Google App Engine App just so some of you can convert their POI data files! (You can thank me later.) However, it uses the same core code as posted below (which is very basic), so some problems might arise. I’m not saying they will! It’s just a warning. If you have any problems with the convertor or remarks, please post them in the comment section of this post.

Update #2: I revised the code for this project. It now no longer needs to replace characters that are unsupported in certain encodings! Additionally, the online convertor now lets you choose what encoding the CSV file is in. It will assume ISO-Latin 1 if you don’t provide an encoding type.

Let’s say you have a CSV (Comma Separated Values) file with locations that you want to add to Google Maps. Tough luck! Google Maps only swallows KML files.

After fruitlessly googling for “csv2kml” etc. for a while, I frustratingly put on my robe and wizard hat and said: “I’ll do it myself. DAMMIT!”. And so I did. (Well, minus the robe, hat and talking to myself parts.)
The following Python script takes a CSV file ‘file.csv’ and generates a brand spanking new ‘file.kml’, ready to be parsed by Google Maps.
f = open('file.csv')
a = f.read()
f.close()
b = a.split('\n')
r = '<?xml version="1.0" encoding="UTF-8"?>\n<kml xmlns="http://www.opengis.net/kml/2.2">'
for x in b:
  x = x.replace(', ',',').decode('latin-1','ignore')
  y = x.split(',')
  if len(y) < 3:
    break
  elif len(y) > 3:
    desc = ' '.join(y[3:])
  else:
    desc = 'No description'

  # Replacing non-XML-allowed characters here (add more if needed)
  y[2] = y[2].replace('&','&amp;')

  desc = desc.replace('&','&amp;')

  r += '\n<Placemark><name>'+y[2].encode('utf-8','xmlcharrefreplace')+'</name>' \
    '\n<description>'+desc.encode('utf-8','xmlcharrefreplace')+'</description>\n' \
    '<Point><coordinates>'+y[0]+','+y[1]+',0</coordinates></Point>\n</Placemark>'

r += '\n</kml>'
f = open('file.kml','w')
f.write(r)
f.close()
In order to use the resulting KML file, select ‘Create new map’, then ‘import’ in the ‘My Maps’ section. Note that after importing, Google might cut off the list of landmarks after a certain number. However, if you save the map and return to it later, you’ll find that it indeed included all data points.
I used the KML tutorial on code.google.com as a reference for this project. It mentions that you can add additional fields to the ones mentioned here, but for this code to work, the CSV file should have a format like: “latitude, longitude, name [,description]” (description is optional). Everything after ‘name’ will just be lumped together in the description field. Feel free to add your own fields where necessary.
Note how I’m replacing some characters like ‘&’ and ‘ë’, ‘ö’, etc. You will want to check your own CSV file for any special characters unsupported in XML (or just KML?) fields and replace those as well. Otherwise, Google will present you with a delightfully uninformative ‘Upload of file failed’-alert.
An example of a successfully imported converted CSV file, can be found here. It was made with this parking space data from ANWB.nl (Netherlands-only, and still disappointingly limited).
Note: I’m well aware that this post is quite Google-centric, as was the previous. This is purely coincidental. Google is evil, etc. etc., but it is also quite useful sometimes.
Posted in Geen categorie | 20 Comments

Google Chrome URL Queue Bookmarklet

 
As Google’s new Chrome browser (currently) lacks support for add-ons or user scripts, it’s back to good old bookmarklets! For those that don’t know what bookmarklets (a.k.a. favlets) are: they’re small pieces of JavaScript inside bookmarks (a.k.a. ‘favorites’) that add some functionality to a web page or the browser itself.

To make a bookmarklet, create a bookmark to a web site (any will do), right-click it and choose ‘edit’. Replace the URL of the bookmark with the JavaScript of your choosing. Take for instance the following code, which is a bookmarklet version of my favorite user script.
javascript: var queue = new Array('http://www.google.com','http://l0u15.spaces.live.com','http://kotaku.com'); try {var inx = parseInt(name); if (isNaN(inx)){throw(e);} name = ++inx; if (inx < queue.length){location = queue[inx]; }else{name = 'end';} } catch(e){name = 0; location = queue[0];}
(Notes: this code should all be on the one single line and the ‘javascript:’ part should indeed be included).
What this code does, is open a set of web sites, one by one, each time you click the bookmarklet. Right now, in the above code, this set of websites is defined as: Google, this here Space, and Kotaku, but it is very easy to change the URLs to those of other sites.
I use this code to cycle through all the websites I view every day. I never have to type the addresses of those websites again! 🙂
By the way, this code will also work in Internet Explorer 7, and probably some other browsers as well.
 
Oh, I almost forgot, the script doesn’t play well with certain websites, in particular those that mess with the window.name variable. One of those websites is hotmail.com, so don’t include it in your array of URLs! (Well, you could end the array with it. It only messes up the positio… You know, never mind. I doubt anyone will use this bookmark extensively anyway!)
 
 
P.s., I am well aware that this blog hadn’t been updated in… well, years! So don’t worry. I’m also aware that this post has nothing to do with games, other than the gratuituous mentioning of Kotaku.
Posted in Computers en internet | Leave a comment

I got myself a Wii

Yay! It’s finally here! My (European) Wii!
 
I like it!
 
Wii Sports is pretty cool, Wii Play has its ups and downs and Zelda is just… Zelda. I’m not really blown away by Zelda, but I guess that’s simply due to overanticipation on my part. I just got my Wii online, and it needs an update already. Either this update is MASSIVE or something is going wrong between the Wii and my router, for it is taking ages…
 
I’m gonna go fondle my Wii some more now. Yay!
Posted in Geen categorie | 2 Comments