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

Facebook REST-API — (Part2/2 — Erlang)

March 15th, 2010 by snies

This is the second part of two minimal examples, on how to interact with the Facebook REST API. Last weeks part was in python, this time we do the exact same thing in erlang. (Note that there are python and erlang libs in various stages of completion, but my focus is on minimal examples and understanding here.)

The code below calls the function users.getinfo in the “call” method. The request send to the Facebook REST server has to be signed according to Facebook’s signing algorithm this is done in “get_rest_url”.

The result will be requested to be transmitted as JSON encoded text. I am using mochijson2 to decode the result.

-module(fb).
-export([call/1, test/0]).

-define(SECRET, "a1b1c1e1d1f1......"
-define(API_KEY, "a2b2c2e2d2f2......"
-define(REST_SERVER, "api.facebook.com").
-define(URL_START, "/restserver.php?").

get_rest_url(Args) ->
  % this implements the the facebook signing recipe
  % the link is in the text above
  SortedArgs = lists:sort(Args),
  Fun = fun({Key, Value}) -> Key ++ "=" ++ Value end,
  StringArgs = lists:map(Fun, SortedArgs),
  String = lists:flatten(StringArgs, ?SECRET),
  <<M:128>> = erlang:md5(String),
  Sig = lists:flatten(io_lib:format("~32.16.0b",[M])),  % string rep of hexdigest
  StringArgs2 = lists:map(fun(X) -> X ++ "&" end, StringArgs),
  lists:flatten(["http://", ?REST_SERVER, ?URL_START, StringArgs2, "sig=", Sig]).

call(Args) ->
  {Megaseconds,Seconds,Microseconds} = erlang:now(),
  CallId = integer_to_list(Megaseconds)
        ++ integer_to_list(Seconds)
        ++ integer_to_list(Microseconds),
  Args2 = lists:append(Args, [{"api_key", ?API_KEY},   % my application key
                             {"call_id", CallId},      % just any value that increases
                             {"format",  "JSON"}]),    % request JSON formatted reply
  Url = fb:get_rest_url(Args2),
  {ok, {{HttpVer, Code, Msg}, Headers, Body}} =
                    http:request(get, {Url, [{"User-Agent", "test "}]}, [], []),
  mochijson2:decode(Body).

test() ->
  call([{"method","users.getinfo"},
        {"v","1.0"},
        {"uids","1234567..."},
        {"fields","first_name"}]).

you would run the above like this:

erl -pa /some/path/to/mochiweb/ebin/
Erlang R13B04 (erts-5.7.5) [source] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false]

Eshell V5.7.5  (abort with ^G)
1> inets:start().
ok
2> c(fb).
./fb.erl:28: Warning: variable 'Code' is unused
./fb.erl:28: Warning: variable 'Headers' is unused
./fb.erl:28: Warning: variable 'HttpVer' is unused
./fb.erl:28: Warning: variable 'Msg' is unused
{ok,fb}
3> fb:test().
[{struct,[{<<"first_name">>,<<"Joe">>},
          {<<"uid">>,123456...}]}]
4>

Facebook REST-API — (Part1/2 — Python)

March 11th, 2010 by snies

This is the first part of 2 minimal examples, on how to interact with the Facebook REST API. This part will be an example in python, the next part will do the exact same thing in erlang. (Note that there are python and erlang libs in various stages of completion, but my focus is on minimal examples and understanding here.)

The code below calls the function users.getinfo in the “call” method. The request send to the Facebook REST server has to be signed according to Facebook’s signing algorithm this is done in “get_rest_url”.

The result will be requested to be transmitted as JSON encoded text. I am using cjson to decode the result, but you could use any of the python JSON libs (Note that from python 2.6 onward there is a json lib in the standard lib).

__secret__     = 'a1b1c1e1d1f1......'
__api_key__    = 'a2b2c2e2d2f2......'
__restserver__ = 'api.facebook.com'
__url_start__  = '/restserver.php?'

import time
import hashlib
import httplib
import cjson

def get_rest_url(d):
  # this implements the recipe you can find on this page:
  # http://wiki.developers.facebook.com/index.php/How_Facebook_Authenticates_Your_Application
  l = d.items()
  l.sort()
  l = [str(x[0])+'='+str(x[1]) for x in l]
  sig = hashlib.md5(''.join(l) + __secret__).hexdigest()
  url_list = [ __url_start__ ]
  url_list.extend([x+'&' for x in l])
  url_list.append('sig='+sig)
  return ''.join(url_list)

def call(d):
  # make sure certain keys are set
  d.update({'api_key': __api_key__,   # my application key
            'call_id': time.time(),   # just any value that increases
            'format' : 'JSON'})       # request JSON formatted reply
  url = get_rest_url(d)
  connection = httplib.HTTPConnection(__restserver__)
  connection.request('GET',url)
  response = connection.getresponse()
  return cjson.decode(response.read())

def main():
  d = {'method':'users.getinfo',
       'v':'1.0',
       'uids':'1234567...',    #use ur own userid for testing
       'fields':'contact_email,first_name',
      }
  print call(d)
if __name__ == '__main__':
  main()

Lecture hint: The operation of the LHC accelerator complex

March 10th, 2010 by Florian Feldhaus

Dr. Stefano Redaelli from CERN will hold two lectures on an overview of what happens when the LHC is in running mode. The lectures should be suitable for everyone with a bachelor or Vordiplom in physics or electrical engineering.They will take place in the CERN main auditorium at

  • April 7, 10am-11am
  • April 9, 10am-11am

More information can be found in the official announcement. If you happen to not be at CERN during that time, there will be also a webcast! As additional information on the webcast becomes available, I will post it here!