Monday, November 25, 2013

Ireland English dictionary for the non-Irish

Random musings on living in Ireland:

As a South-African who's been living in Ireland for over 4 years, let me show you some of the Irish lingo (I think) I've learned so far. Please feel free to add/correct as necessary.

First the Irish-English phrase and then the "international" English phrase would be understood by South-Africans and Americans alike (I would hope).
  • It's half eight = It's half past eight.
    • This one I especially used to find confusing because in Afrikaans the direct translation "half agt" actually means the equivalent of "half to eight" i.e. "half past seven".
  • What's the craic? = Hey, what's up?
  • What's the craic and all? = Hey, what's up? (as said by an Indian living in Ireland - hi Ramesh :-)
  • Just call in to pick it up. = Just come in and pick it up. (I still keep falling for this one and actually CALL people on the phone, only to discover I didn't have to call but only have to call in, duh!)
  • evening = afternoon
    • example: Yesterday evening I worked on...
    • translation: Yesterday afternoon I worked on...
  • Did you enjoy that dinner? = Did you enjoy that lunch? (I think 'supper' is reserved for 'dinner'..?)
  • Do you want to come over for tea? = Do you want to come over for dinner? (Not sure about this one...?)
  • Runners = tekkies (South-African), sneakers (American)
  • Pants = underwear / underpants
  • Cheers! = Thanks! (Not 'bye'!)
  • So I told yer man = So I told the guy
  • Jumper = Jersey
  • Are you dosed? = Do you have the flu?
  • I'm wile dosed = I'm very sick
  • Bap = bun (bread)
  • At the minute = At the moment
I admit that some of these might not necessarily be purely Irish words/phrases but may be influenced by British-English, which is possibly slightly closer to South-African English, but not quite. I'd say South-African English is, when spoken, perhaps the closest to US-English (but closer in spelling to UK-English).

Also, just a silly story to add:

I've been in love with Ireland my whole life, so on previous occasions (before moving to Ireland) I've bought some Irish wool caps and a very nice (and expensive I want to add) jersey. Then we moved to Ireland in 2009. I got a little book about Ireland and Irish culture. In this book I learned about the concept "More Irish than the Irish"... I realised that if I wore my Irish-made wool cap, which I bought in the same county that I live in now, but years ago (around 2000 or so), then I'll just seem like an idiot tourirst who's trying to look Irish. For the same reason I'm reluctant to wear any Irish-branded stuff (like a nice Ireland t-shirt I also bought years ago) for the fear of looking like a silly foreigner trying to look Irish :-)

I must admit, occasionally when I visit a neighbouring town in Donegal, and a shop-keeper doesn't understand my weird accent, it is convenient to pretend that I'm just visiting from SA. It does get weird when you keep pretending to be a visitor from SA every time you visit the same store though (like that from the lovely Mr. McGinty's in Donegal Town - hi Mr. McGinty, I love your shop, but I've bought lots of stuff from your shop over the years and I expect a discount next time... haha ;.)

Sometimes when people in Letterkenny don't understand this crazy unfamiliar accent, they assume that I'm Polish. Not sure why. In the US people thought I'm either Scottish or Australian...?

I hope this post doesn't cause any offense to the occasional Irish or Western-European visitor :-)

Friday, November 22, 2013

The correct way to read a text file in Python

When you search for examples of reading a file on the web, most examples you see show:

with open('file') as f:
  text =

But it's quite hard to find examples of the "correct" or "proper" way to read text files in Python. Of course correct/proper is a matter of opinion and depends on what you're trying to accomplish. In many cases you really want to slurp the full file into memory as above, but in my case I more often need to process one line at a time (perhaps in conjunction with a generator), in which case this is what I need:

with open('file') as f:
  for line in f:
    yield line

Not to mention that you'd deal with binary files in a different way as well...

Friday, November 08, 2013

Automated install of PowerShell on Windows XP

The problem: I want a batch script to perform an unattended/silent install of PowerShell on Windows XP.

We need to download the PowerShell installer from Microsoft, but it needs to be downloaded from an HTTP server. I'm not aware of an easy way to download files from the command-line or script in Windows XP, other than the FTP command. But what we can do easily, is to download cURL via FTP first.

So we need to download 4 things from the batch script:
  1. We need to get 7-Zip to extract cURL.
  2. We need to get cURL (or wget) to download PowerShell.
  3. Download and install .NET Framework 2 since it's required by PowerShell.
  4. Finally we download PowerShell itself from Microsoft via HTTP.
Step 1: download 7-Zip archiver's command-line version (7za.exe) from an FTP server. You need to search for any FTP server that hosts 7za.exe.

This FTP script would work to get 7za:

get 7za.exe
Step 2: download curl from one of the official FTP mirrors if you can. I didn't have any luck with the official mirrors so I just searched around until I found an older version.

This FTP script would work to get curl 7.19.3: 

cd /pub/net/ftp/curl/
Now we can use 7za.exe to extract the curl zip file.

Step 3: download .NET Framework 2.0 and install it silently:
curl -O
start /wait "Installing .NET" NetFx20SP2_x86.exe /qb
Step 4: download PowerShell for Winfows XP and install it silently:
curl -O
start /wait "Installing PowerShell" WindowsXP-KB968930-x86-ENG.exe /passive /log:powershell-install.log
The final batch file to put it all together is here.

If you're curious why I'd be using Windows XP: I sometimes need to test old software. In this case, I want to install Visual C++ 6 to see if some old C++ code compiles without warnings before I start the process of converting it to a newer Visual Studio.

Note: I used to search for FTP servers that host the 7-Zip command-line tool (7za.exe) and cURL.