SQL to CSV tool – Export properly formatted CSV from an SQL query

SQLtoCSV produces well formatted CSV documents from SQL queries, even where the data results contain line breaks, speech marks, quotes and commas.

Latest Release: https://github.com/deeja/SQLtoCSV/releases/latest


The reason this thing exists: SSMS’s export doesn’t work.

SMSS = Microsoft’s SQLServer Management Studio

If we have basic data (no line breaks or commas), then we can use MSSQL Management Studio to export basic data to CSV:

export as csv

There is also the option of the copy/paste functionality to copy data into Microsoft Excel or another spreadsheet application.


These both work alright and most of the time you can get away with them without issue.

The problem is when the data starts to get tricky. If you have line breaks, it starts to mess with the output, and the CSV ends up broken.

Kind of how this seeming innocent data:


Produces this catastrophe using the “Save As [CSV]” built into MSSQL:

csv broken

Whereas, if you use the SQLtoCSV tool above, it produces:


Now go use it!


Thanks to Josh Close for maintaining CsvHelper and for effortlessly handling all the awful CSV I have to deal with regularly.


Olympus PEN E-PL3 – Changing battery loses settings workaround

The Olympus PEN series seems to be afflicted with a malfunctioning (or incorrectly set up) capacitor. This capacitor holds enough power in the system to keep the settings, such as date and time, while the battery is being changed. Except that it isn’t working for me.

For me, upon taking out the battery out of my E-PL3, the date resets. Googling this issue I found this comment on Flicker:

EnzoLopardoPictures says:

Hi ransome2012 – just had the same problem and I solved it accidentally!
Try to remove the SD-card first and then change the battery. With my camera this saved date & time.

Greeting from Switzerland, Enzo

So the workaround is: Remove the SD Card before changing the battery! 

With the SD card removed, the settings are persisted greater than 10mins.

My simple theory here is that the SD card (or a system that monitors the SD card) is being powered when the camera is off. That seems odd to me, but no doubt there is a reason. The result is too much power being used for the capacitor to handle. Perhaps, while being designed, the camera went through settings persistence testing with no SD card in place.

Still, the issue is ridiculous really.

New Zealander going to the Netherlands on a Working Holiday Scheme (NL WHS)

If you want anymore info on this, send me an email.

  1. You will need the current prerequisites. 
  2. Get the visa. I am not sure if you need current residency in the country you are in, which is the usual situation for visas. Apply before you leave and you will save yourself so much stress. You can apply in London, which I did. It took about a week. You DON’T need an appointment for the visa IN London (I know it says you do, but you don’t), but you do have to turn up at a certain time; before 9.30 when I did it. Call them. Yes it is a pain in the ass.
  3. When you get there, register at a police station. Well, you can try and infact you should be able to, but it seems impossible as noone at the police station knows about this type of visa. I ended up going to the foreigners police (Vreemdelingenpolitie) and registering there. They will say you don’t have to go there and you can do it at any police station, but good luck with that. It will take about 1-2 hours depending on the number of people.
  4. Get an address to send mail. Somewhere, anywhere in the Netherlands. You need it to do anything with the authorities. Find a long lost Dutch friend or anyone you know (you must know someone Dutch) and get an address. Write it down. Carry it in your wallet.
  5. Get a mobile phone number. Memorise it.
  6. Make an appointment with the IND. Take the Visa fee in CASH. If you can, go to the centre in Hoofdorp. It is almost immediately outside the station. Look for the IND sign. You go up some stairs. It takes about an hour and you get your passport back immediately. No waiting for it in the mail. Now you have another sticker in there.
    You will need all your evidence of money, travel insurance, and flights!
  7. Ignore people that say you need a work permit. You don’t. It is in the visa.
  8. Make an appointment with the Tax Department directly and apply for a SOFI (a kind of temporary, but somehow lifelong, tax number) The longer term number which you get if you register with a city is called a BSN number, which is the same thing really.
    When you get there, they might say you need a work permit. Tell them it is included. Show them the letters you received or got when you applied. Point to somewhere in the middle of your new visa from the IND and say “it says here I don’t need one” even though you clearly have no idea. It does say it there somewhere. Don’t worry, they will probably lose your booking and you will have to wait 2 hours there giving you enough time to sort it out. Don’t make phone calls  in the waiting area. They don’t like it.
  9. Don’t worry about registering with the city / town hall. This is a difficult thing to do unless you are paying rent where you have a rental agreement and are likely to stay more than 4 months. As you basically have a free pass with the WHS to wander around, you won’t be staying in the same place. If you don’t “register”, you also don’t need to “de-register” as you never technically were in a city. Makes things easier when you leave.
  10. Get a bank account. You need a SOFI or BSN for this, so you will need to have gone through the hoops to get here. You won’t get paid in the Netherlands without a bank account. Most places will not take credit cards. Almost all will take cash except for some annoyingly poncy places like the fancy supermarket “Marqt”.
  11. Remember you are there, by the terms of the visa, to explore the culture of the Dutch. Take some lessons in basic pronunciation. It will help you significantly getting about.

There are somethings to note.
Dutch customer service is questionable at best. I am not against the Dutch, it’s just that many shops or government departments appear to see you as a hindrance rather than a customer / client.  This doesn’t always apply. Many of the local pubs and restaurants have the most “keen to impress” owners. I had a Roti restaurant owner go out and buy some meat from the supermarket because they had run out of the one I wanted.

In regards to the requirements of the visa, they say you need a birth certificate. I never actually used mine, even though I have it. It cost $70 (Certificate + Dutch Authentication/Translation done in Wellington). Supposedly you use it when you register in a city. I never did, so never used it. I think you should probably get one. Just in case. Can be useful if you lose your passport too.

If you have any questions, just ask in a comment, or email me at dann@this sites address.

Home button doesn’t work on your Motorola Xoom running Android CyanogenMod?

So I rooted my Motorola Xoom MZ601 with UTMS (Everest) and installed the latest Cyanogen build (10.1 at the time I did it).

I start playing around with my new desktop, when I hit the home button to return to, well… home,  and nothing happens. It indicatively flashed at me, but nothing else; no action.

The fix is in the device_provisioned setting that is not turned on for some weird reason. This apparently kills other functionality as well, such as lock screen and other things.Read More »

Using Git with XpDev

I have an account over at www.xp-dev.com for my “self projects”.  Recently I was trying to get Git to work. This cost me more hair being pulled out than I was expecting.

Leave any good/bad comments at the bottom, and click the cookies please. They help me out in knowing I helped you. Cheers.

1. Generate a key using PuttyGen


2. Save the private and public keys somewhere safe.

3. Open up the public key file and cut the “Key” out.


4. On the XPDev website:  “Account” –> “Profile”  and find the “Add a new Public Key”. Paste it in there without any of the Comments or BEGIN/END stuff. Save it.


If you get this message then you have added something you shouldn’t have:

Unexpected Error
An error has just occured. It has been logged and will be dealt with shortly.
If it is urgent, please contact our administrators.

5. Add a remote repository to your local repository using the GitExtensions UI or

NOTE:  Your Git repository URL is:



GitExtensions UI:


Command Line:
git remote add –mirror==PUSH  xpdev ssh://USERNAME@git.xp-dev.com/YOUR-REPO-NAME

6. Load the SSH key (or add it directly using PAgent), entering a password if you have one, then test the connection. It should say Shell logins are disabled. This is another way of saying you have authenticated, but you are not allowed to do anything via the Shell.


7. Push – Push it up. This should be the last time you use this specific local repo as you will clone one down in a second to replace it and doing so test the end result.

8. Clone – Clone the remote repo and use this new clone as your working repo.


1. Unable to open connection: host does not exist


2. Cloning into ‘X’…
error: cannot spawn C:Program Files (x86)Git ExtentionsPuTTYplink.exe: No such file or directory
fatal: unable to fork

I think the answer to this is the Program Files (x86) part. I think the shell script doesn’t handle this very well. I have no issues through GitExtensions UI so I won’t look for an answer.

IIS Websockets (for SignalR) do not work on Windows 7 (Even with IISExpress 8)

As Windows 7 is a “Down Level” OS for the IISExpress 8 webserver, there are three things that are not supported. One of them happens to be WebSockets:

There are a few features which require architecture that is specific to Windows Server 2012 and Windows 8 Client that will not work down-level when you install IIS 8.0 Express on earlier operating systems:

  • Server Name Indication (SNI)
  • Central Certificate Store
  • WebSocket Functionality

Using TortoiseGit with GitHub– A checklist rather than tutorial

UPDATE: Forget everything in this article -> Just go get Git for Windows v1

    1. Install msysGit  http://code.google.com/p/msysgit/
    2. Create a SSH key using Bash (id_rsa and id_rsa.pub)
    3. Install TortoiseSVN
        1. Use plink


    1. Use puttyGEN, which comes with TortoiseGit, to create a Putty private key from id_rsa like so:
      puttyGen –>
      Conversions –>
      Import Key –>
      Open %userprofile%.sshid_rsa –>
      Save Private Key
      as private.ppk (or whatever you want)
    2. Register your Public Key (id_rsa.pub) with GitHub i.e. Copy/paste the text inside the file into your Github account SSH Key (https://github.com/account –> SSH Public Keys)


  • Set your details from the Git Bash command line. The token is available from your Github Account Settings.

    git config –global user.name “Your Name”
    git config –global user.email “your@email.com”
    git config –global github.user your-github-name
    git conf
    ig –global github.token your-github-token
  • Get the Repository’s Read + Write SSH URL
  • Clone the repository to a folder using TortoiseGit


  1. Load the putty key %userprofile%.sshprivate.ppk  if that is where you saved it.


This is a rough summary of what to do, and more of a reminder to my future self. If you have any suggestions, let me know.