(Title)

(Title)

fordhurley  //  

Apr 30 / 5:18am

Installing ROOT on Ubuntu 11.04

UPDATE: There has been some discussion on the ROOT support forum about this issue. According to this thread, the solution is to install the latest version of ROOT, available from the subversion repository. After successfully installing, I still had a problem having to do with the some Adobe Helvetica font error. A solution was posted in this thread.

The latest version of Ubuntu was released this week, version 11.04. Installing ROOT proved to be a bit of a problem. On the previous version, it was available with apt-get, but for some reason it isn’t included in the repositories in 11.04. So, I downloaded the source and tried compile it the usual way. After installing the prerequisites listed here, I tried to do this:

./configure linux --prefix=/usr/local

Unfortunately, I got this:

configure: Checking for libX11 ... no
configure: libX11 MUST be installed

Evidently, it failed to find libX11, even though it was installed. It turns out that the library isn’t installed in the usual /usr/lib/X11, but instead in /usr/lib/i386-linux-gnu. Fix the configure script by adding the —with-x11-libdir option:

./configure linux --prefix=/usr/local --with-x11-libdir=/usr/lib/i386-linux-gnu

There were a few other libraries installed in this odd directory, so I had to add a few more of these options. In the end this command succeeded:

./configure linux --prefix=/usr/local --with-x11-libdir=/usr/lib/i386-linux-gnu --with-xext-libdir=/usr/lib/i386-linux-gnu --with-xft-libdir=/usr/lib/i386-linux-gnu

Finish up with a:

make
sudo make install

and you’re good to go. Now get back to work analyzing data!

Apr 21 / 12:27pm

The best reason to jailbreak your iPhone, ever

Well, that may be a bit of an overstatement. There are many good reasons to jailbreak and I'm sure a lot of people will have absolutely no need to do this particular thing, but it's my number one reason!

Accessory_connected

I have a 2010 Honda Civic with a built in USB port for iPod hookup. I love that feature and use it almost every day on my commute or any longer drive. One thing about it had always bugged the hell out of me, though: when an iPod or iPhone is connected, it disables all controls on the iPod itself, restricting you to use only the cars controls. It won't even show you the current track on the display. The entire screen is filled with "Accessory Connected." Unless you just want to skip to the next song, you have to unplug the iPod, select the track, then plug it back in!

On a jailbroken phone or ipod, you can install the NoAccessorySplash package (free on Cydia) and that stupid screen will be forever banished. As an added bonus, it gets rid of that "this accessory is not optimized for this iPhone" warning that pops up when you plug it into some speaker docks.

Mar 1 / 8:16am

Automatic code commenting in Xcode

When I'm programming, I love an editor that has an easy "comment/uncomment code" command. I've been using Xcode recently and love it, especially after I discovered how to get automatic commenting to work!

The command is up in the "scripts" menu:

Xcode_script_menu

There's even a nice shortcut for it: Command-/. Unfortunately, when I tried it on the python file I was working on, it tried to use c style comments! Double forward-slashes in a python file? That ain't gonna work.

Fortunately, I found a solution. At the bottom of the script menu, there's an "Edit User Scripts" option. Here you can see all of the scripts and edit them, or even add new ones. The cool thing is that the scripts are all perl or shell scripts, and easily editable.

To make comments work in python files, we need to change the line:

if ($fileString =~ m!^($perlCmt|$cCmt)?#\!\s*.*?/perl|^($perlCmt|$cCmt)?#\!\s*.*?/sh!) {

That line checks the first few lines of the file your working on and looks for a #! to figure out what type of file it is. Unfortunately, it only checks to see if it's a perl or a sh file. No worries, we can easily change it to recognize python (or whatever else you want, e.g. ruby). To do this, just change the last bit where it says "sh." My line looks like this now:

if ($fileString =~ m!^($perlCmt|$cCmt)?#\!\s*.*?/perl|^($perlCmt|$cCmt)?#\!\s*.*?/(sh|python)!) {

And it works like a charm!

Jan 15 / 10:42am

Using .netrc to automate FTP login

I just discovered a nice tool that makes my life much easier. I often need to connect to FTP servers using the command line and have been frustrated by the fact that I have to enter my user name and password every time. To make things worse, my user name for the server I use the most has an @ in it and my password is some long collection of numbers and symbols that I didn’t choose, so it takes me some time to remember it, and then I usually make a mistake

Because of the @ in my user name, I can’t do:

$ ftp username@server.com@server.com

which would at least save one step.

Fortunately, there’s a solution that’s been around for many years, I was just too dumb to find it until now. The solution is to create a .netrc file in your home directory.

This file should look like:

machine server.com login username@server.com password mypassword

The password will be stored as plain text, but to secure it you need to set the permissions on the file so that only the owner can read it.

Do this with the command:

$ chmod 600 .netrc

That should make the file permissions look like:

-rw------- 1 ford ford   84 Jan 15 10:22 .netrc

Hope this is as helpful to someone else as it was to me!

Filed under  //  dockstar   linux