Archive for June, 2010

How to create a csv file in javascript and get the “save as”-dialog

June 17, 2010

Long headline! Anyway, this is a problem I’ve encountered more than once. When exporting data from a webpage to a .csv file I usaually create it on the server side using a servlet.

However, If the data is already stored in the browser, you don’t want an extra server request (especially if you’ve manipulated the data on the client).

The first lead came from this post. It explains how to open a separate window with csv content. But how to get the “Save As” dialog? After some searching I found tips about using “data URL” and finally found the solution.

The essentials of my test code:

function loadLinkButton(){
  var btn = document.getElementById("linkButton");
  var axx = document.getElementById("ax");
  // I used this online encoder to create the data url.
  // axx.href = 'data:text/csv;base64,MTsyOzQ=';  // This was my first test, not having the encoder. 
  axx.href = 'data:text/csv;base64,'+Base64.encode("3;2;1");} // I used the javascript encoder from this page.

<a id="ax" href="">test</a>
<button id="linkButton" onclick="loadLinkButton();">asdf</button>

So basically, pressing the “asdf” button creates the data URL and then the link “test” opens the csv (with save-as dialog). Havn’t tried it in IE, but I’ve read that it’s not going to work.

Questions? Feedback? Feel free to comment!


silent computer – tyst stationär dator

June 8, 2010

For quite some time I have been searching for a new computer. I wanted it to have decent performance and be quiet but none of the stores I checked had any sound-preferences whatsoever. I didn’t want to build it myself so I went to a local store in Lund called itel and had them build me one. We chose the components together, after two days it was ready and the pricing was good. This is what I got:

  • Fractal Design Define R2 Black Pearl
  • Scythe 450W power supply
  • Asus P7H55, S-1156 DDR3 GbLAN HD-Audio
  • Intel Quad Core i5 2,66 GHz, S1156, 8Mb 14250
  • Noctua NH U12P SE1366 (CPU cooler)
  • Corsair Dominator DHX+ DDR3 1333MHz 4Gb(2*2Gb) XM
  • Seagate Barracuda 500Gb 16MB Cache S-ATA2
  • Asus Radeon HD 4350 512Mb Silent

Maybe all computers are fairly silent by now but I am really surprised by how quiet it is! I can really recommend this store! (Now I feel silly writing in English, clearly addressing Swedish people). Anyway, these are quiet components and they work good together (had the computer almost a week now, running Ubuntu Studio).

For a perfectly silent HTPC however, I can recommend the fit-PC2. It’s more like an industrial computers I work with. Slow, reliable, fanless, energy saving.. and it plays HD! I run ubuntu 8.04, but I hope for 10.40 support soon.

About EMU 0404 USB support for Ubuntu

June 7, 2010

For a few weeks I was searching for evidence that this particular sound card was supported in Ubuntu Studio 10.04. I found some evidence and clues, like this extensive thread and the ALSA page with beta drivers. I was still suspicious though, but since we (me and my boyfriend, he’s using the sound card for recording) really wanted to avoid windows, we decided to try.

So we downloaded Ubutu Studio 10.04 and installed it with all the suggested software bundles. We did the modprobing for drivers:

modprobe snd-emu10k1 ; modprobe snd-pcm-oss ; modprobe snd-mixer-oss ; modprobe snd-seq-oss

And then we started Audacity, chose EMU 0404 as playback & recording device in the preferences and we were up and running! Much faster than we would have been with windows. Just so awesome!! I’m not even sure I needed the modprobing. The quality was ok and recording and playback worked on both input channels (connected to a digital piano).

Enter key hangs

June 3, 2010

This is driving me crazy so I need to write it off!

A few days ago, a new problem started to interfere with my daily work. Every now and then the Enter- key keeps pressing itself (hangs) for no apparent reason. And  it stops when I press F2!

Of course I assumed it was a hardware problem, since several people around me had that problem with laptop keyboards (and solved it by replacing them). I’ve never been violent to my keyboard and don’t remember ever spilling liquid on it (I know, it’s a miracle since most of the stuff on my desk have been swimming in coffee at least once).

Anyway, I started looking into Linux forums and disabled my keyboard according to this post. I connected a usb-keyboard and started working again.

15 minutes later the same thing happened again! By pressing F2 on the usb-keyboard it stopped! So maybe it’s a software problem in Ubuntu?

I’ll get back when I’ve upgraded my OS. It’s time anyway, I’m running 9.04 and want to try 10.04 asap. Unfortunately I need a decent time span with low workload. If VMware (Server 2.0) fails me I can’t work.

Btw, I’m using a Dell Precision M90 anybody seen a similar problem with this laptop?


It seems like the problem is caused by Terminal Server Client. I stopped using it for VNC (connected to my virtual machine) and havn’t had the problem since.