Monthly Archives: April 2012

Install Citrix Receiver on Ubuntu 12.04

Update 2014-01-03: Installing Citrix in Linux is still a hazzle. Please have a look at my new post: Install Citrix Reciever 13 on Ubuntu 13.10. The below post applies to the older Citrix Client version 12.

Installing Citrix in Linux is always a hazzle. The following worked for me on a fresh installation of Ubuntu 12.04.

Prerequisites (amd64):

$ sudo apt-get install ia32-libs-multiarch:i386
$ sudo apt-get install libmotif4:i386

Prerequisites (i386):

$ sudo apt-get install libmotif4

Now choosing Citrix version was not so easy… I found:

icaclient_12.0.0_amd64.deb     (failed to meet dependencies)
icaclient_12.1.0_amd64.deb     (failed to meet dependencies)
icaclient_12.0.0_i386.deb      (OK! - both i386 & amd64)
icaclient_12.1.0_i386.deb      (broken gzip!!!)
linuxx86-  (did not test)
linuxx86-  (broken gzip!!!)

The amd64 bit packages do not seem to contain a 64-bit Citrix client. They are just built to install cleanly on a 64-bit system, but it doesn’t on Ubuntu 12.04 (perhaps better luck in Debian). The broken gzip-errors were really weird.

amd64 specific plugin issues
Now when Citrix is installed it can be useful to know that it ends up in /opt/Citrix. That is, on amd64, you need to tell Firefox to open ica-files with /opt/Citrix/ICAClient/wfica. The plugin /opt/Citrix/ICAClient/ appears to be i386 (no suprise) and will not work with amd64. I tried to install firefox:i386 instead of the amd64-version, but then none of the other plugins worked. It is probably possible to fix, but I will not.

Also, you (may) need to fix certificates:

zo0ok@oden:/opt/Citrix/ICAClient/keystore$ ls
zo0ok@oden:/opt/Citrix/ICAClient/keystore$ sudo mv cacerts cacerts.orig
zo0ok@oden:/opt/Citrix/ICAClient/keystore$ sudo ln -s /usr/share/ca-certificates/mozilla cacerts

Finally, Citrix receiver 12.0 works nicely in Unity and Ubuntu 12.04. This was not the case a few versions ago.

Problem with Pagefile on second drive in Windows 7

My Windows 7 computer has 4GB of RAM and a 128GB SSD drive. I dont want to page on my SSD drive (because I believe it will shorten the life of it, and I dont believe in paging anyway), so I disabled paging. However, occationally Windows claimed it ran out of memory and killed my applications. I am very suspicious it really ran out of memory (4GB should have been plenty for what I did), but nevertheless it killed my applications.

I decided to install a second drive, an old rotating hard drive, that I assigned the drive letter b: and named backup. That is where I want my pagefile.sys (and some backups).

When configuring Windows the way I wanted, I got the error:
Windows created a temporary paging file on your computer because of a problem that occured with your paging file configuration when you started your computer. The total paging file size for all drives may be somewhat larger than the size you specified
What this really meant was that I got a pagefile on c: anyway. And the error message popped up every time i started my computer.

Like many other people who have written about similar problems, I tried all combinations of disabling and enabling pagefile for the different drives, but very very hard to get it the way I wanted.

Finally it worked – and as usual with Windows it is impossible to know what really made the difference. And I dont want to break the configuration just to fix it again to learn!

Anyway, these are things I did that MIGHT have had anything to do with it (perhaps it had to do with the stars or something):

  1. I renamed b: to q: (in case Windows 7 does not believe in paging on its second floppy drive) (Most Likely This One!)
  2. I first obtained a working configuration with pagefile on both c: and q:, both of them using an interval, none of them System managed
  3. I reduced c: in steps, first to 16-256, next to 16-16
  4. I finally effectively disabled pagefile on c: by setting “initial size”, to 0 (not by using No Pagefile)

I recommend that you change your folder view setting so you can see systems/hidden/protected files along the way.

Sometimes people say Windows is good. Sometimes I say, “well, yes, Windows 7 is ok, they got it right now”. But the truth is that Windows f***ing sucks. This reconfigure/reboot/pray-way of solving problems is so braindead. And it is impossible to learn or understand.

Install Ubuntu 12.04 on Eee 701

Update: Have a look at installing 13.04 first.

Summary: add an 8GB SD card to your Eee 701 an install Ubuntu 12.04 on it! I believe Ubuntu has improved for this netbook with every release and now it is really nice.
Ubuntu 12.04 is the best Linux distribution and operating system for the Eee 701. This is with 1GB RAM. Not so sure about running with original 512Mb.

You need to make a little fix to run the CPU at 900MHz instead of 630MHz (if you want to).

$ sudo apt-get update
$ sudo apt-get install cpufreqd cpufrequtils
$ sudo modprobe p4_clockmod

$ cat /proc/cpuinfo
(should tell you CPU runs 900MHz)

$ sudo vi /etc/modules
(add p4_clockmod on a line, to make it work after reboot)

On disk usage and partitioning
I choose to partition putting /var on a 1.5GB partition on the SD card, and use the rest of the SD card for /usr. The root partition (/) goes on the internal SSD, giving me more than 3GB for fast /home (also on /, to be clear). No swap. I use ext2 for all filesystems (journaling can hardly be faster than not journaling).

The great thing compared to earlier versions of Ubuntu, is that with final 12.04 Ubuntu recognizes the SD card as installable media. It will not complain that the 4GB SSD is not enough as it used to!

Python vs C

A few days ago I wrote a post about how to convert a csv list to a table. I spent some time writing my program in C (for fun and for performance).

Now I have written an equivalent program in Python, and I am going to present the differences.
First the sourcecode: csv-list2table.c and

About the C implementation
The C implementation uses only standard C library (stdlib.h, stdio.h, string.h). The good thing is that the program is very portable and easy to compile. The bad thing is that I do not have access to powerful datatypes (hash tables, balanced trees, sets). This basically means wasting time reinventing the wheel, and not getting a perfect wheel anyway. My estimation is that the C implementation is O(n) for suitable input (fairly sorted data) and O(n)Sqrt(n) for unsuitable data (reversely sorted). This is for fairly “square” matrices. The C implementation is not really optimized (perhaps a later excercise).

About the python implementation
The python implementation was written after the C implementation, and very nicely utilizes the python built in set and dict datatypes. Should be O(n) or O(n)log(n) depending on Python dict implementation.

The machine
The benchmarks are performed using the time command on an AMD Athlon II X2 250 machine with 4GB of RAM. The machine runs x64 Xubuntu 11.10.

The tests

C Python
Environment gcc 4.6.1, -O2 Python 2.7.2+
Lines of code
(excl help text)
355 lines 53 lines
Coding time 8h 1h
Input size Execution time
Sorted data: 0.014s
Reversed data: 0.027s
0.039s – 0.052s 0.18s
0.16s – 0.25s 0.64s
0.57s – 1.2s 2.6s
2.4s – 7.8s 10s
9.7s – 51s 41s
40s – 337s Not enough RAM
RAM usage for
152Mb 1.4Gb

I draw the following conclusions:

  • Python is a very efficient language compared to C, when it comes to producing code fast, in this case about 10x faster
  • Python is impressively fast, even startup overhead is reasonable
  • Python can beat C on performance, when C programmer has not found optimal data type/algorithm. The Python datatypes makes it easy to write code that is fast even for large data
  • A well written C program uses 10% the RAM of Python, and is at least 5x faster. Especially the small RAM requirement is very powerful and valuable for many applications

It is tempting to optimize the C program to see if I can get 2x, 3x or 5x speedup.
It is also tempting to write a C program that uses Glib, and have access to well implemented data types. How would it compare?

CSV file: convert list to table/matrix

Update 2014-05-04: Added -N1/-N2 flags for sorting rows/columns numerically, and uploaded a windows binary.

I found myself having data in CSV-files with three columns; two dimensions and a value. It could look like:


Data typically looks like this because it is very easy to output transactions on this format. That is very nice if you want to load it into a database. But for other purposes (like plotting a graph using LibreOffice Calc or even Excel) it would be much nicer with a table/matrix-layout:


I could not find a standard tool for this. I thought about different options, and finally decided it was quite easy to just write a little program. So I did. You use it like this:

$ ./csv-list2table -t < list.csv > table.csv

There are a few things to think about:

  • The switches -t or -T decides if column 1 or 2 will be rows
  • -N1 and -N2 can be used to treat/sort column 1 and 2 numerically
  • Rows and columns are outputed sorted
  • Holes/missing values outputed as ,,
  • Comma is the only accepted delimiter
  • Input must have exactly 3 columns
  • Pre/post-process data with sed and cut

As the last item mentions, sed can fix a file with other delimiters than comma, and cut can pick the columns you need from a list with more data than you need.

Finally, the code written in standard C: csv-list2table-1.1.c.
Old version: csv-list2table-1.0.c
Windows binary: csv-list2table-1.1.exe (should be no tricky dependencies)
Test file: csv-list2table-test.txt

Building should be trivial:

gcc -O2 -o csv-list2table csv-list2table.c

I dont think the code contains anything that should confuse any c-compiler on any reasonable platform.

Remote Desktop & Windows 7 Home Premium

Windows 7 Home Premium seems to be the right version of Windows for home usage, right? I mean for media, gaming, communication and casual work. And it is the version MS ships with a PC you can buy in a store. Well, Microsoft believes that Remote Desktop (the server part) is not a Home Premium feature, but a Professional feature. I think there are plenty of home-related uses for Remote Desktop (supporting a relative remotely, sitting in the sofa with your tablet while controlling your PC, access your computer from work or when traveling).

The upgrade to Professional is 180 Euros, and requires some work. This is simply Microsoft making their products suck for their paying customers! I’d say people who buy a PC in a store really don’t have the choice to pick Professional or Ultimate. The wares people are probably smart enough to not bother with anything less than Ultimate.

Luckily, there is a simple hack for Home Premium, and this one works today (well, yesterday), despite SP1 and everything.

Railworks 3 Trainsimulator 2012 UKTS problems

There is a great site for trains simulator content: UKTS. However, everything does not work perfectly, unfortunately.

I am keeping track of my problems in this post. I have another post for problems with original DCL.

I have found that the Freeware packs released in 2011 and updated in 2012 generally have high quality. I recommend those ones!

However, downloading and installing single assets and scenarios often does not give the expected result. I managed to break some of my routes (the 2D map stopped working, even for orignal scenarios) and had to reinstall from Steam to repair.

Sometimes if you get the error “Broken Consist”, it helps to open the scenario in the editor and just save it.

Bath to Templecombe: [Q1] Coal to Shepton (Q1 pack from Pete Gillam)
Bath to Templecombe: [Q1] Slow Freight Train (UKTS 25052 v1.0)
Very hard to couple the wagons. Getting rid of the Brake car (the last car) using the scenario editor does not fix the problem. 2D map does not work with switches and route.

Bath to Templecombe: Norton Hill Special Service (UKTS 21640 v0.91)
Switches and paths dont work on 2D map. Tried to play anyway, but derailed…

Great Western Mainline: A Day on the WR (part 1 of 2)
Completed everything fine, still got red crosses on some via-points. The last post in this discussion indicates that no points may be passed below 60mph (and this is just a mistake by the scenario-creator). I will perhaps try another day and confirm if this is the case. However, not the funniest scenario ever.

Great Western Mainline: HSTs and Handcuffs
Can not pick up passengers at first stop, Paddington 3, where the train starts from the beginning.

Port Road: 1980s – C1 Preps : Shunting tanks (UKTS 25836 v11-02-1)
The 2D map does not seem to work. No blue marking/line around train, and can not operate switches from 2D map. Possible to run scenario and manually handle all switches not using the map, but scenario crashed when almost completed.

Port Road: Freight Extra Down (UKTS 24843 v1.0)
The 2D map does not seem to work. I do not get any blue marking/line in front of the train. Going into scenario editor I find plenty of “Static consist clash”. Saving the scenario does not repair it.

Port Road: Night Ballast Port Road (UKTS 24890 v1.0)
I refuel at Dumfries P3 water loader. I get my water, but the scenario never continues to the next waypoint. The red bar never shows up indicating refuel progress. I made some attempts to fix the scenario, no success.

Trainsimulator 2013 Broken DLC scenarios

I have problems with some orginal DLC scenarios in Train Simulator 2013 (2012 when I first wrote this post, but I allow myself to keep it updated). I will keep track of the problems here – mostly for myself, but perhaps it helps someone.

I have a separate post for problems with UKTS scenarios.

Castle Rock Railroad: Feeling the Heat
This scenario is not broken. It is very hard to reach Lark Spur in time. Obey the signals.

East Coast Mainline: Cathedral Special
Early in the scenario, just before picking up the passenger cars, I need to pass a red signal. I try TAB, but neither approve/denied. Much later, when almost in Durham, at around 1700, I have an AI-collision Game Over incident. I tried avoiding the red signal by, after dropping off the engines, driving all the way forward, and then reverse not through one of the sidings. But there is another red signal, and after passing that one, I derailed. Other people seems to have problems too.

Falmouth Branch: The Little Things Count
This is a nice scenario with some little problems.

First, on your way to collect your cars in Truro, there is a switch and a cross that are problematic to pass. At too low speed (4 mph) I cant pass. At too high speed (9 mph) I may derail or the locomotive jumps losing score. Fortunately, this is in the beginning of the scenario.

Second, in Penryn you need to put your last four cars to the side, to deliver two cars. When collecing the four cars again I get a -500 score for invalid consist (or something) – I am not the only one. I tried a few strategies that dont work:

  1. Rearranging already in Truro – gives immediately -500 points.
  2. Dropping the four cars in Penryn Up Platforms – immediately -500 points.
  3. In Penryn, putting four cars in siding 1, then two cars in siding 2, then collecting the four cars again (with the intention of then putting the two cars in siding 1) – gives -500 points, and jumps to the next task, thus failing the scenario

Third and finaly, when I have just the last four cars to take to Falmouth Siding 1, in Penryn, the switch never switches back from Penryn Headshunt to Penryn South Approach. Thus, how can I continue to Falmouth and complete the mission? It seems it is not the switch, but the cross that will switch. Drive slowly towards Falmouth, and the cross will switch to the line (not the side tracks) when you approach it.

Grandfield Branch: Branch Workhorse
Fantastic and beautiful scenario, and now I have figured out how to complete it. It is a bit broken.

  1. Thenhill: problem to uncouple wagons directly after Tender (this is a “new” problem). Do not use the HUD, find the physical coupling in the simulator itself, click it.
  2. Weedon Quarry: a red signal, hitting TAB just gives Denied reply. Save, quit, resume. Then try TAB and have a little patience. Good luck.
  3. Crossing right after Sellafiend Yard Northe Gate: You may need to switch the crossing twice – despite the message that the path is laid for you, you may derail here.

No Career XP for Career scenarios in Granfiend Branch 🙁

Great Western Mainline: Duff Coal
Scenario is good. But I get no star/score upon completion.

Isle of Wight: After the Flood
After the first stop there is a tunnel. Right after the tunnel comes a Warning Signal – that indicates Warning. But passing it gives me SPOD. I should be allowed to pass a yellow signal without SPOD. I press tab and is granted permission to pass. Later, when leaving Sundown, there is a message saying “You have been given permission to pass the red signal”. So I do, but again SPOD (guess I should have pressed tab despite the message, but it didnt say so).

Isle of Wight: Lights! Camera! Action
Worked second time I tried!
Can not go around the train in Smallbrook. I drop off the cars, continue, reverse, but there is a red signal before getting back to the main line. TAB does not work for me. Perhaps I made a few extra stops/starts in Smallbrook with the northern switch in the wrong position that confused the signalman.

Hagen to Siegen: Part by Part
AI error well into the scenario. I have tried to be faster and slower, and to leave switches in different ways, but so far no success.

Sherman Hill: Big Boy Sherman Hill Part 1 (CS)
AI collision 09:41:22. At that point I am 0.91 miles away from Dale Main 1. There are other reports of the same problem. Only the Career Scenario seems to be affected.

There is a strategy: make it to Bufort Ex Outfit Track before 09:40. That will require some serious speeding and it is going to give you 0XP. The Boiler Pressure etc are confusing (not working properly) for Big Boy. The F4 view gives you a lower Boiler Level than the HUD. Be careful to not run out of water. Anyway, I kept a steady speed of 64mph uphill, until I decided to save water. Scenario completed at 09:38, and with -5.3M points. However, I did not make it to the Ranking list with 0 points 🙁

Sherman Hill: Big Boy on Sherman Hill Part 2 (CS)
About 10 miles before Borie Main 2 East is a red signal and permission denied, that does not turn green. However, if you save as you approach the signal, quit the scenario, and resume, the problem should go away.

Sherman Hill: Midnight Magnet
The good thing with the scenario is the story. The bad thing: Timing is very sensitive and the story can get in the way. It is all about the timing to Dale. Even if you complete the second last timecheck (Dale) with full bonus you may still be out of luck for the last stretch down to Laramie. But if you get to Dale too early, you can cause a deadlock and the scenario can not be completed at all. Dont wait for Tom – just leave him in the darkness with the gangsters. And, there is at least one switch to fix before your train stops at the right track in the yard in Laramie: the switch is shortly after the 15mph, at that time you still have far to go.

Somerset Dorset Joint Railway: Bank On It (4F DCL)
I get an error when dropping off the freight train at the designated place. And on my way back to Bath I have to pass a red signal. So, if game settings allow passing Danger Signals, the scenario can be completed with a failure.

Somerset Dorset Joint Railway: Bath Time
AI collision problem at about 14:08:42. Other people have described it here. I have not tried the workaround mentioned.

Somerset Dorset Joint Railway: Calm Under Pressure
AI collision problem at about 17:24:18.

WCML North: Palmadie Hop
AI collision (4552 Long=-4.21522 Lat=55.83014) & (2522 Long=21717 Lat=55.83023). I drove twice, and got the same error att 17:48:56 and 17:48:58.

Woodhead Line: Night Freight (O4)
A few minutes after the summit, it was about 19:25 I think, I got an AI Collision. Luckily, I had saved a few minutes before and decided to resume to get the exact AI Collision message. But, after resuming everything went fine, and I ended up in Wath. The scenario is supposed to take 90 min, but I completed it in 60 minutes. The AI collision could perhaps be caused by me being ahead of schedule. Also, there were very few AI trains out this evening (which I find boring), perhaps my fast driving was to blame.

Railworks 3 Trainsimulator 2012 Recommended hardware

I have written here and here about performance tuning for Railworks 3 Trainsimulator 2012. Well, I decided now was a good moment to get improved hardware so I have upgraded. I now run the simulation on a Windows 7 computer with i5-2400 CPU, 4GB RAM and a Radeon HD 6950 with 1GB of RAM. I use basic settings at High, in game Master settings at Highest, and run in 1280×1024 full screen mode. It works perfectly. The load on the 4 cpu cores are typically 70/30/30/0 when I play, and the GPU is around 50% load.