VPN Problems with Mac OS X

April 14th, 2011 by Florian Feldhaus

From time to time the VPN client integrated in Mac OS X keeps on failing to connect to our university VPN server. I searched for a long time and today I found the solution to restart the service without restarting my Mac (origin of the solution is here):

  1. Open a Terminal and search for the racoon process
    Florian-Feldhauss-MacBook-Pro:~ ffeldhaus$ ps aux | grep racoon
    root     10495   0,0  0,0  2447088    672   ??  Ss   So11am    0:02.27 /usr/sbin/racoon
  2. Now kill the racoon process
    Florian-Feldhauss-MacBook-Pro:~ ffeldhaus$ sudo kill 10495
  3. At last, restart racoon
    Florian-Feldhauss-MacBook-Pro:~ ffeldhaus$ sudo /usr/sbin/racoon

Retrieve (personal) certificates from Firefox profile

October 12th, 2010 by Florian Feldhaus

Recently my harddisk crashed and I used this opportunity to reinstall my system. Everything went fine, but getting my user certificates back turned out to be a bit tricky. For Grid Computing and administrating a Grid Site I need my certificates to be stored in the browser. As I recently renewed them, I haven’t done a backup of them (shame on me) so I couldn’t just reimport them in my newly installed Firefox 4 (beta). Here is what I did to get the certificates back from my old Firefox profile:

  1. Find out where your profile folder is located. This Mozillazine Page might help.
  2. Quit Firefox if it is still running
  3. Go to the profile folder of your new Firefox installation and backup the files cert8.db and key3.db
  4. Copy key3.db from your old profile folder to your new one if you want to restore your private/user certificates
  5. Copy cert8.db from your old profile folder to your new one if you want to restore all other certificates you had installed in Firefox (e.g. root certificates and host certificates)

Find out number of cores / CPUs for a linux system

September 7th, 2010 by Florian Feldhaus

If you need to find out the number of CPUs or CPU cores or cores per CPU of your system, you could look it up in /proc/cpuinfo but it’s quite hard to figure out the right parameters. A good overview on the parameters for different system configurations can be found here. If you want to put the actual numbers in variables, here is a nice way to do it:

export CORES_PER_CPU=`grep -c "physical id.*: 0" /proc/cpuinfo`
export CPU_TOTAL=`grep -c "core id.*: 0" /proc/cpuinfo`
export CORE_TOTAL=`grep -c processor /proc/cpuinfo`

/proc/cpuinfo shows an entry for each CPU core. The physical id is incremented for each physical CPU. If the entry has the same physical id as another core, the core belongs to the same CPU. Therefore counting the number of entries with physical id set to 0 results in the number of cores per CPU. The core id is incremented for each core on a physical CPU. Therefore counting the number of entries with core id set to 0 results in the number of physical CPUs. The total number of cores can be retrieved quite easily by counting the number of processor entries.

Unfortunately the above method does not work on all systems. I noticed on some systems with single core processors, that the values core id and physical id are not present.

I searched for official documentation on the proc filesystem, but only found the following document which doesn’t describe the cpuinfo values:

If someone happens to know a better documentation I would be glad if he/she would share it with me!

Apple moved “Create MP3 Version” to Advanced in iTunes 9.1 (Edited 11:30pm)

April 3rd, 2010 by snies

EDIT: As reader Wes points out, it is still possible, but hidden under “Advanced”
So i apologize for being too harsh and too fast with my critic of Apple.

wrong statement but left for documentation:
Apple starts to seriously suck. When You update iTunes to 9.1 you will loose the ability to convert your purchased songs (aka the ones you paid for) into mp3s. Just one more of Apples secret feature removes (like search for iMixes).
For everybody pissed like i am i suggest:

Using Tune4Mac – Burn any iTunes audio content to virtual cd and rip it as mp3.

Downloading Music from Amazon , where you get mp3s.

Start using Songbird.

Fix wireless at Edwards Dortmund

March 30th, 2010 by snies

The Edwards coffeehouse in Dortmund is a nice place to work with some friends, while having a beer or a coffee due to it’s huge tables, free wireless and central location.

Unfortunately their wireless network router is quite old and apparently gets confused by something in the OSX network stack (probably some bonjour packets). Whatever the reason is, the net effect is that you can connect to the network “edwardsnet” but you don’t get an IP address from it’s router. So the only way to solve this is to assign yourself a valid ip and configure the gateway and DNS by hand.

IPv6 Adress: 192.168.2.XXX  (best guess XXX in the range from 50 to 100)
Subnet Mask: 255.255.0.0
Router:      192.168.2.1
DNS:         8.8.8.8        (one of Googles public DNS servers)

Please note that you kind of have to guess a free ip. So please try to be polite and change your address if strange network behaviour occurs. Maybe best thing is to guess an ip use that one to scan the network using some pings and than use one of the ips that seem to be free.

LHC first physics webcast

March 26th, 2010 by Florian Feldhaus

After the successfull restart of the LHC, the first collisions with two 3.5 TeV beams colliding at 7 TeV will take place on march 30th. From 8:30 till 18:00 (UTC+01) there will be a live webcast at

http://webcast.cern.ch/lhcfirstphysics/

The first collisions will probably take place between 9:00 and 11:00. The tentative schedule can be found here.

Update: An interesting page to watch the beam is the LHC Operations beam status page.

Automate pdf preview when using vi to edit latex on OSX.

March 26th, 2010 by snies

You can add the following to your .vimrc in order to have vi automaticly update and show the pdf version of the LaTex .tex file you are currently editing. The CursorHold part triggers updating after a set amount of inactivity, while the BufWritePost part triggers an update before each save (when you type :w ). This is based on a post doing the same for ubunu.

Note (deprecated now due to the edit below): the ” !open -a Terminal” is just a work-around since i didn’t find a way to make Preview.app update in the background (aka not steal the focus).

EDIT 2010-03-29: Since Guillermo pointed out how to do the update properly i changed my .vimrc entry. But i left the old line in as a comment.

""""""""""""""""""""""""""""""""""""""""""""""""""
" for LaTeX files
""""""""""""""""""""""""""""""""""""""""""""""""""
au BufEnter *.tex set autowrite "save before making PDF"
au BufEnter *.tex set updatetime=500 "wait ms"
au BufEnter *.tex set makeprg=pdflatex\ -halt-on-error\ %\ >&\ /dev/null

"make the file after specified time of not moving and after every save"
au CursorHold *.tex call UpdateFile()
au BufWritePost *.tex call UpdateFile()

function! UpdateFile()
  silent make
    !open -g %<.pdf  "update view in preview"
    " following comment line was needed before i learned about the -g option "
    " !open -a Terminal   switch back to vi assuming you run it in Termial"
    redraw! "remove artifacts during save"
    endfunction

au BufRead *.tex silent !open -g -a preview %<.pdf

Debugging an SSL connection

March 22nd, 2010 by Florian Feldhaus

Debugging the SSL handshake can be lots of pain, especially if the SSL commands are done by components not under your control. Fortunately there is a tool called ssldump which lets you monitor the complete SSL handshake. The following command prints out detailed information about the SSL handshake (on interface eth0):

ssldump -a -A -H -i eth0

If you want to sneak at the encrypted traffic you need to tell ssldump where to find the hostkey (e.g. hostkey.pem or similar) of the machine

ssldump -N -d -k $PATH_TO_HOSTKEY/hostkey.pem -A -H -i eth0

Replace $PATH_TO_HOSTKEY and hostkey.pem accordingly.

More information can be found here or in the manpage of ssldump.

Building GTK on OSX and Problems with libiconv

March 21st, 2010 by Jesko Merkel

Ok, this i maybe a bit special, but maybe it helps someone out there. I am on the way to build GTK+ on OSX using “jhbuild”, following a good instruction:

http://live.gnome.org/GTK%2B/OSX/BuildInstructions

Coming to the point where to build glib, the process exits with following error message:

gconvert.c:55:2: error: #error GNU libiconv not in use but included iconv.h is from libiconv

First the library is on the system; we can find it easily with

$ locate libiconv

Trying to link the system library to the one found provided by xcode failed into strange error messages. So i decided to re-build the libiconv by hand as “root” from source:

$ cd /usr/local/src/

Getting from http://www.gnu.org/software/libiconv/ the latest version (currently 1.13.1) with

$ wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
$ tar zxvf libiconv-1.13.1.tar.gz

Now the configuring, make and install phase:

$ ./configure
$ make
$ make install

This builds the latest version of libiconv for me. Final step was to replace the current version in

/usr/lib

and to go on with the GTK+ process.

How to use gdb inside LHCb environment

March 16th, 2010 by snies

If you run a python script that imports GaudiPython (or any LHCb modules for that matter) inside gdb on any lxplus node, you will run into an error like this:


[lxplus223] ~ > gdb python
GNU gdb Red Hat Linux (6.3.0.0-1.162.el4rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"
   ...Using host libthread_db library "/lib64/tls/libthread_db.so.1".

(gdb) set args test.py
(gdb) run
Starting program:
   /afs/cern.ch/sw/lcg/external/Python/2.5.4p2/slc4_amd64_gcc34/bin/python test.py
[Thread debugging using libthread_db enabled]
[New Thread 182894205120 (LWP 11117)]
Traceback (most recent call last):
  File "test.py", line 1, in
    import GaudiPython
ImportError: No module named GaudiPython

Program exited with code 01.
(gdb)

This is due to our group-login script (including the “rc” one)
using LbLogin and that reshuffles the paths. When gdb starts
the process to be debugged and if a SHELL variable is present,
it is started with “$SHELL -c”.
When it is perfectly legal for bash (it only starts a new shell),
with (t)csh it starts a new *login* shell corrupting the already
setup paths (PATH, LD_LIBRARY_PATH, PYTHONPATH etc).

So in order to solve this you have to unset SHELL inside
gdb (maybe best to place that in .gdbinit):

unset environment SHELL