2013-10-29

Design Change

I just discovered that Blogger's dynamic layout broke Readability. So, it's back to a basic layout.

2013-08-23

Exchange email support for Evolution on Ubuntu 13.04 Raring Ringtail

First, a little personal update: I have just left Wake Forest University, and joined Drexel University as a senior systems administrator in charge of the high performance computing University Research Computing Facility.

There are some dependencies which have not been properly encoded into the Exchange MAPI plugin for Evolution in Ubuntu 13.04. To get MAPI support, you must install: evolution-mapi and python-samba.

I was not able to get Exchange MAPI to work with Drexel's Exchange server: the issue was during the authentication step. However, using Exchange Web Services works. This uses Exchange's web service, which presents all the data in XML. To use this, the evolution-ews package has to be installed. Then, for the Host URL, use the usual web access address, appended with /EWS/Exchange.asmx So, if the webmail address is https://exchangeweb.myorganization.com/ the Host URL for Evolution will be https://exchangeweb.myorganization.com/EWS/Exchange.asmx

UPDATE: There is a bug in the exchange-ews package: there is an issue with sending mail. To fix, edit the the file in  ~/.config/evolution/mail/sources/  that contains a line that starts "Email=", and change it to Email=myemail@myorganization.com

2013-07-16

Backing out a Subversion Commit

A useful how-to from T. Kim Nguyen. I made a commit to my repository:
$ svn commit -m "changed something"
resulting in revision 989, and discovered it didn't work. D'oh!

To undo this commit, and go back to the state of the code in revision 988:
$ svn update
$ svn merge -c -989 https://svn.myserver.org/svn/myproject
$ svn stat
$ svn commit -m "undid the previous change"
This results in revision 990, but with the state of the code as in 988.

2013-04-11

rpmbuild, SPEC files, and prerequisites

At some point or other, you may try to build an RPM from a SPEC file and find that you are missing some dependencies:
$ rpmbuild -ba rt4.spec
error: Failed build dependencies:
        /usr/share/fonts/google-droid/DroidSansFallback.ttf is needed by rt4-4.0.8-0.20121228.0.el6.noarch
        /usr/share/fonts/google-droid/DroidSans.ttf is needed by rt4-4.0.8-0.20121228.0.el6.noarch
You may think (at least, I did) that all you need to do is to make sure those files exist. Unfortunately, no: you will need to install packages which provide those files (or capabilities, in the RPM jargon). In this case:

$ yum whatprovides /usr/share/fonts/google-droid/DroidSans.ttf
...
google-droid-sans-fonts-20100409-1.el6.noarch : A humanist sans serif typeface
Repo        : myownrepo-6-x86_64-server
Matched from:
Filename    : /usr/share/fonts/google-droid/DroidSans.ttf
If you look in the SPEC file:
Requires:  /usr/share/fonts/google-droid/DroidSansFallback.ttf
Requires:  /usr/share/fonts/google-droid/DroidSans.ttf
BuildRequires:  /usr/share/fonts/google-droid/DroidSansFallback.ttf
BuildRequires:  /usr/share/fonts/google-droid/DroidSans.ttf
As described in the link about capabilities above, those lines do not just specify package names but capabilities, which then mean that the package you are working on will require packages which provide the listed capabilities.

2013-04-08

Python tip - converting HH:MM:SS time into more understandable format

The Torque resource manager for clusters prints out amounts of time -- CPU time, or walltime -- in HH:MM:SS format. For small numbers, it's easy enough to understand: 04:00:00 = 4 hours. But for larger numbers, I wanted the time amount specified in days, hours, minutes, and seconds. Here's a quick way to do it using the datetime module. (I'm working with Python 2.6 here, which is what comes with RHEL6.) It uses a list comprehension to split up the HH:MM:SS time string. (BTW, I am using ipython as the interactive Python shell.)

In [4]: import re, datetime

In [5]: def timedeltastr(timestr):
   ...:     dayspat = re.compile(r'\ days?,')
   ...:     t = [int(i) for i in timestr.split(':')]
   ...:     td = datetime.timedelta(hours=t[0], minutes=t[1], seconds=t[2])
   ...:     return dayspat.sub('d', str(td))
   ...:
In [6]: timestr = '3400:00:00'

In [7]: timedeltastr(timestr)
Out[7]: '141d 16:00:00'

2013-04-05

Small Python tip - sorted iterating over dictionary

Python dictionaries are great. However, iterating over dictionaries results in an unsorted order:
In [1]: d = {'a':10, 'b': 20, 'c': 30}

In [2]: for key,value in d.iteritems():
   ...:     print key, value
   ...:
a 10
c 30
b 20
The fix is to use sorted():

In [3]: for key,value in sorted(d.iteritems()):
   ...:     print value
   ...:
a 10
b 20
c 30