Saturday, 14 September 2013

Getting Started with Bloomberg Standard Library

A quick guide to getting started with the Bloomberg standard library from their github repo:

Let's say for now I'm installing to ~/bsl on my linux machine with GNUMake:

Linux 3.11.0+ x86_64 x86_64 x86_64 GNU/Linux

For other flavours, see the official wiki.
  • cd ~/
  • git clone https://github.com/bloomberg/bsl.wiki.git
  • cd bsl
  • python tools/bsl_gyp.py
  • cd build
  • make all
  • ...have a coffee..
 Done!

Now you want to write your first program using bsl. Simple:

  • cd ~/test
  • Write a test program:
#include <bsl_vector.h>

int main()
{
    // A simple program illustrating bsl
    bsl::vector<int> v;
    v.push_back(4);
    return 0;
}
  • compile: gcc main.cpp -I~/bsl/build/include -L~/bsl/build/Release/lib -lbsl -lstdc++

Monday, 26 August 2013

Breaking Change to Realtek r8168 drivers

If you have ever installed the linux kernel manually you might have encountered an issue with the r8168 drivers for your ethernet port. Specifically my
3:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 06)

I found that I have to download and install them directly from realtek since - perhaps - my .config wasn't correct. I downloaded version r8168-8.036.00.

Nevertheless, when I tried to install the drivers for 3.11.0-rc7 I found that they didn't compile:


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
r8168-8.036.00/src/r8168_n.c: In function ‘rtl8168_rx_vlan_skb’:
r8168-8.036.00/src/r8168_n.c:2237:9: error: too few arguments to function ‘__vlan_hwaccel_put_tag’
In file included from r8168-8.036.00/src/r8168_n.c:46:0:
include/linux/if_vlan.h:236:31: note: declared here
r8168-8.036.00/src/r8168_n.c: In function ‘rtl8168_hw_set_features’:
8168-8.036.00/src/r8168_n.c:2298:25: error: ‘NETIF_F_HW_VLAN_RX’ undeclared (first use in this function)
r8168-8.036.00/src/r8168_n.c:2298:25: note: each undeclared identifier is reported only once for each function it appears in
r8168-8.036.00/src/r8168_n.c: In function ‘rtl8168_init_one’:
r8168-8.036.00/src/r8168_n.c:16198:26: error: ‘NETIF_F_HW_VLAN_TX’ undeclared (first use in this function)
r8168-8.036.00/src/r8168_n.c:16198:47: error: ‘NETIF_F_HW_VLAN_RX’ undeclared (first use in this function)
make[3]: *** [r8168-8.036.00/src/r8168_n.o] Error 1

So it appears there are 2 issues.

  1. The first is that the number of arugments for __vlan_hwaccel_put_tag is wrong. This appears to be a breaking change to if_vlan.h in the kernel introduced here. So AFAIK the quick fix is just to add an extra parameter indicating the protocol. Here, I think you put  htons(ETH_P_8021Q) but someone much wiser can correct me there. That's what I put and it seemed to work for me.
  2. The second issue is that a #define has been renamed. The NETIF_F_HW_VLAN_{R,T}X defines have been changed to NETIF_F_HW_VLAN_CTAG_{R,T}X in this change.
The patch can be found here.

This isn't the most scalable of fixes since it's not backwards compatible so I guess the vendor will have to apply to kung-foo using the KERNEL_VERSION macro. I didn't bother to look at exactly which kernel version this was broken in.

HTH.

Installing Linux kernel from source

I thought I would try my hand at a little bit of linux kernel programming.

So, I followed the instructions found here: http://kernelnewbies.org/KernelBuild

Everything went pretty smoothly for the install part. git clone and then compile and install. This was all fine.

I then did a reboot and have since then, come across two problems.

  1. No ethernet. That is, my eth0 interface would not appear with a `sudo ifconfig -a`.
  2. No FUSE (can't mount ntfs file-system)

The fixes are:

No ethernet: for some reason the wrong driver comes installed for me. I have (from lspci):
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 06)

but the 8169 drivers apparently got installed. I thus followed the guide listed at: http://ubuntuforums.org/showthread.php?t=1634291
Which involved downloading an installing the proper driver from the realtek website.

For problem two, it turns out that the default config for the linux kernel decides that FUSE should not be loaded at boot. To fix this, you simply edit /boot/config-xxxx for your running kernel and add the line
CONFIG_FUSE_FS=y
and that fixes it.

Undoubtedly more to come...

Sunday, 16 June 2013

Citrix Receiver Segfaulting under Kubuntu Raring

The other weekend I updated Kubuntu through 2 releases to the latest raring.
The upgrade was a painless process - a simple do-release-upgrade or something so I thought all was merry.

Not so fast. One of the few application I use is Citrix XenApp receiver to work from home. For some reason when I clicked the icon from the web interface I was getting zero response. Zero, nada, zilch.

(I did manage to work out how to get the raw ICA file through from the citrix xenapp web interface: in firefox simply disable the Citrix receiver plugin and it pops up with the file itself which you can run through wfica manually! :) ).

I ran the program through a lot of stuff - strace, checked the ldd, valgrind, changed my window manager, and nothing fixed it! I couldn't even see the problem since the code is proprietary. Though it did seem to be happening somewhere gtk_main.

Still segfaulting.

Then I went on a bit of a rampage and deleted everything listed under `gtkorphan` which was fun but not helpful.

Then I force removed gtk3 down to 2 using: http://askubuntu.com/questions/18631/how-to-downgrade-gtk2-0-package-to-workaround-bug-693758

Then I removed the oxygen them: http://askubuntu.com/questions/177909/restore-gtk-integration-after-removing-kde

And bingo!
Not sure exactly what it was. My tests seem to indicate the oxygen theme but that wouldn't explain why it still wasn't working under xfce. So maybe it was that in combination with the gtk downgrade.

Anyway, please let me know if you face a similar problem and write a comment - I can probably help you out. This was such a difficult one to fix (without reinstalling!).

Peace out.

Restoring Linux Ubuntu Citrix Receiver Keyboard Shortcuts

Recently I did a complete upgrade of my Kubuntu OS which managed to break one of my few useful utilities - Citrix Xenapp receiver.

First it segfault'ed all the time (more to come) but secondly it also got rid of all my keyboard shortcuts!

I couldn't quit Xenapp when it was full screen without forcibly killing the application (killall `pidof wfica`). The Ctrl-F2 shortcut had been wiped.

So the fix was as follows.

Check to make sure both your ~/.ICAClient/appsrv.ini and ~/.ICAClient/wfclient.ini both have the following shortcut mappings right after the [WFCLIENT] tag:


 Hotkey1Char=F1  
 Hotkey1Shift=Shift  
 Hotkey2Char=F3  
 Hotkey2Shift=Shift  
 Hotkey3Char=F2  
 Hotkey3Shift=Shift  
 Hotkey4Char=F1  
 Hotkey4Shift=Ctrl  
 Hotkey5Char=F2  
 Hotkey5Shift=Ctrl  
 Hotkey6Char=F2  
 Hotkey6Shift=Alt  
 Hotkey7Char=plus  
 Hotkey7Shift=Alt  
 Hotkey8Char=minus  
 Hotkey8Shift=Alt  
 Hotkey9Char=F3  
 HotKey9Shift=Ctrl  
 Hotkey10Char=F5  
 HotKey10Shift=Ctrl  
 Hotkey11Char=plus  
 Hotkey11Shift=Ctrl  
 Hotkey12Char=plus  
 Hotkey12Shift=Ctrl  
 Hotkey13Char=plus  
 Hotkey13Shift=Ctrl  
Now I can Ctrl-F2 and Alt-Tab to my next local application REF: http://support.citrix.com/article/CTX140219

Saturday, 18 May 2013

Convert a folder of flacs to mp3

Convert a folder full of flac files to mp3 files with the same name but mp3 extension. Requires ffmpeg (sudo apt-get install ffmpeg)

 for i in `ls *.flac`; do res=`echo $i | awk '{sub(/flac/,"mp3"); print }'`; `(nohup ffmpeg -i $i -ab 196k -ac 2 -ar 48000 $res;) &`; done;  

Tuesday, 9 April 2013

Citrix MultiMonitor Pass Config Parameters From Web Interface

Clearly I don't post on here any more but here is a useful thing I found the other day.

Whenever I want to work from home I have to the citrix web interface to launch a remote session. At home I have a dual monitor linux ubuntu setup using my gtx 560 and the standard (for now) nvidia drivers that come with kubuntu - using twinview.

When I open my citrix connection from the browser (uses xendesktop) I cant get the remote session to span all my screens. I can expand and stretch but not achieve full fullscreen.

I fixed this by doing the following to my bashrc, adding:

export WFICA_OPTS="-span a"

This is a useful environment variable that is passed in when you load citrix from the web interface - otherwise there is no mechanism to pass args in.

This caused my citrix session to span both my monitors when I configured it to fullscreen seamless from the web UI (this is a vital step).

Perfect.

Can we just autofill city and state? Please!

Coming from a country that is not the US where zip/postal codes are hyper specific, it always drives me nuts when you are filling in a form ...