We have an old Océ printer for our office. Unfortunately the official drivers I could find on the website of the producer do not work for Mac OS X 10.5. Luckily I found working drivers at the Hochschule Luzern.
Minimal program to create histograms from a file with root
We needed to create a histogram from some output of a python program. Therefore I wrote a minimal root program to read in the data from a file and save the histogram as a pdf.
The datafile should contain one entry per row. Save the following source code as e.g. histogram.c and then start root with
root -b -q 'histogram.C("filename")'
Here is the sourcecode:
#include <TCanvas.h>
#include <TH1.h>
#include <iostream.h>
#include <Riostream.h>
#include "Math/PdfFuncMathCore.h"
int main(){
histogram("test")
}
void histogram(char* fileName) {
gROOT->Reset();
TCanvas *c1 = new TCanvas("c1","c1",800,800);
TH1I *histo = readDataToHist(fileName);
c1->cd(1);
histo->Draw();
c1->Update();
c1->Print("histogram.pdf","Portrait pdf");
}
TH1I* readDataToHist(char* fileName)
{
ifstream in;
in.open(fileName);
Double_t bin;
Int_t nlines = 0;
Int_t x_min = 0;
Int_t x_max = 10;
TH1I *histo = new TH1I("h1","Histogram Title", 100,x_min,x_max);
while(1)
{
in >> bin;
if (!in.good()) break;
//cout << "bin: " << bin << '\n';
histo->Fill(bin);
nlines++;
}
in.close();
return histo;
}
Starting Mac OS X Applications (as root) from the console
I recently wanted to start Mac OS X Applications from the console. Sometimes it is possible to start an application directly if it’s possible to find the executable in the application folder. But sometimes, espaccially for application installers there is no executable. In this case it is possible to start the application (or installer) by using the open command. e.g. to start TextEdit:
open /Applications/TextEdit.app
The open command does the same as clicking on a file / application. So you could open a pdf document like this:
open document.pdf
Sometimes an installer requires to run as a superuser. Starting the installer with
sudo open /Applications/INSTALLER_APP
unfortunately does not work, because only open will run as a superuser, but not the installer itself. To start the installer as superuser the following might help:
- pkg installer:
sudo ./MyApplication.app/Contents/MacOS/Installer
sudo /System/Library/Frameworks/Carbon.framework/Versions/A/Support/LaunchCFMApp \ ./MyApplication.app/Contents/MacOS/application
Konzert am 27.01. um 20 Uhr
Pictures of the LHC incident
Yesterday we played board games in the CERN restaurant. Talking about an official event on friday one of the guys said, that he probably won’t be invited to official events for some times, because of a recent dispute with the CERN management. Surely we wanted to know what he did and he told us, that in his blog he pointed to a talk given by CERN Director-General Robert Aymar where one of the topics was the status of the LHC. The interesting thing about the talk was, that it contains pictures from the LHC incident on September 19. In his blog he pointed to the slides of the talk which were publicly accesible, but hidden deep inside the CERN Web.
Shortly after he posted the link to the slides, the access to the slides was restricted. So he contacted the CERN Press Office, why this was done. The official reply from the CERN Press Office was, that they wanted to inform the CERN community first, before publishing the pictures to the general public.
The incident has happend quite a while ago and it’s good to finally see some pictures of it, even if many members of CERN criticize the lack of openness regarding this topic.
Neues Programm – neue Mitspieler herzlich Willkommen!
Wir werden im Wintersemester 2008/09 die folgenden Stücke spielen:
- S. Barber: Adagio
- Aaron Copland: el salon mexico
- A. Dvořák: 8. Symphonie D-Dur
- sowie ein Stück von Ismail Bulut
Wir würden uns sehr über neue Mitspieler freuen. Kommt einfach Dienstags um 19 Uhr ins Audimax zu einer unserer Proben.
Tutorial: Kickstart for Ubuntu 8.04 with LDAP Authentication
We had to install a few Desktop computers with an up to date operating system like Ubuntu, because neither Scientific Linux 5.x, nor SUSE Linux Enterprise was supporting the chipset of our new workstations. But Ubuntu does.
To make life easier for the normal users and to have a homogeneous computing environment we decided to write a kickstart file for Ubuntu. Ubuntu has support for kickstart files, but the documentation is really outdated and quite incomplete:
We needed LDAP Authentication which is currently not working with Ubuntu kickstart. The trick is to include the LDAP configuration into the %post section of the kickstart file.
Creating a basic kickstart file
We started creating a kickstart file using the GUI utility on a working Ubuntu installation (you may use an Ubuntu Live CD for this)
system-config-kickstart
which can be installed on an Ubuntu system with
apt-get install system-config-kickstart
You need to add a meta package like ubuntu-desktop to the kickstart file created by system-config-kickstart in the %packages section and you might want to add other packages like nfs-common:
%packages ubuntu-desktop nfs-common
Configuration of LDAP in the kickstart file
The GUI utility provides some LDAP options which unfortunately do not work with Ubuntu 8.04. So we needed to add the LDAP configuration to the post section of the kickstart file.
During the LDAP installation (with apt-get install) some configuration options have to be filled in interactively. To do this automatically, you can use the preseed mechanism (see here for more information on preseed under Ubuntu 8.04).
At first you have to install LDAP on your own machine (or use a livecd) and configure it interactively:
apt-get install ldap-auth-client --assume-yes auth-client-config -a -p lac_ldap
After that run the followin command to get all the LDAP options
debconf-get-selections | grep ldap
Now you should see something like this:
ldap-auth-config ldap-auth-config/bindpw password ldap-auth-config ldap-auth-config/rootbindpw password ldap-auth-config ldap-auth-config/binddn string cn=proxyuser,dc=example,dc=net ldap-auth-config ldap-auth-config/dbrootlogin boolean false ldap-auth-config ldap-auth-config/rootbinddn string cn=manager,dc=example,dc=net ldap-auth-config ldap-auth-config/pam_password select md5 ldap-auth-config ldap-auth-config/move-to-debconf boolean true ldap-auth-config ldap-auth-config/ldapns/ldap-server string ldap_server_name ldap-auth-config ldap-auth-config/ldapns/base-dn string dc=your,dc=domain,dc=tld ldap-auth-config ldap-auth-config/override boolean true ldap-auth-config ldap-auth-config/ldapns/ldap_version select 3 ldap-auth-config ldap-auth-config/dblogin boolean false
Now include these information into your kickstart file with the preseed option. The result should look similar to this:
preseed --owner ldap-auth-config ldap-auth-config/bindpw password preseed --owner ldap-auth-config ldap-auth-config/rootbindpw password preseed --owner ldap-auth-config ldap-auth-config/binddn string cn=proxyuser,dc=example,dc=net preseed --owner ldap-auth-config ldap-auth-config/dbrootlogin boolean false preseed --owner ldap-auth-config ldap-auth-config/rootbinddn string cn=manager,dc=example,dc=net preseed --owner ldap-auth-config ldap-auth-config/pam_password select md5 preseed --owner ldap-auth-config ldap-auth-config/move-to-debconf boolean true preseed --owner ldap-auth-config ldap-auth-config/ldapns/ldap-server string ldap_server_name preseed --owner ldap-auth-config ldap-auth-config/ldapns/base-dn string dc=your,dc=domain,dc=tld preseed --owner ldap-auth-config ldap-auth-config/override boolean true preseed --owner ldap-auth-config ldap-auth-config/ldapns/ldap_version select 3 preseed --owner ldap-auth-config ldap-auth-config/dblogin boolean false
In the %post section of the kickstart file add the following to install and configure LDAP
%post --interpreter=/bin/bash apt-get install ldap-auth-client --assume-yes auth-client-config -a -p lac_ldap
Other useful stuff
There are some other useful things you can put into the %post section of the kickstart file:
You might want to moun the home directories like this:
echo "host:/export/home /home nfs defaults 0 0" >> /etc/fstab
If you want to enable auto update on a regular base you can use the package cron-apt
apt-get install cron-apt --assume-yes
By default the cron job just downloads the updates. To automatically install the updates you have to strip the -d option from the apt-get command. This can be done as following:
sed -e 's/ -d / /g' /etc/cron-apt/action.d/3-download > /etc/cron-apt/action.d/3-download2 mv /etc/cron-apt/action.d/3-download2 /etc/cron-apt/action.d/3-download
You might want to set the rootmail user or add users to the sudoers list:
### ROOTMAIL echo "root: rootmail@your.domain.de" >> /etc/aliases ### SUDOERS echo "username ALL=(ALL) ALL" >> /etc/sudoers
The final kickstart file
Manually create linux user password hashs
Manually creating a password under linux for e.g. /etc/shadow or kickstart isn’t really easy. I searched for a while until I found the userdbpw utility. On Debian Systems (including Ubuntu) it can be installed with
apt-get install courier-authlib-userdb
For most distributions the md5 algorithm is used to create passwords. The userdbpw command for md5 passwords is:
userdbpw -md5
More information on userdbpw can be found in its manpage.
Konzert am 24. Juni 2008
Das nächste Konzert des Universitäts-Orchester findet am 24. Juni um 20:00 statt. Das Uniorchester spielt das Notturno von Felix Mendelssohn Bartholdy, den Bolero von Maurice Ravel sowie das Stück Les Préludes von Franz Liszt. Das Programm wird ergänzt durch Kammermusik von den Komponisten Hübler, Danzi sowie Debussy.
