Friday, 26 July 2013

Moved to my own wordpress installation

This blog has now been moved with all history to my own Wordpress installation, at http://www.pokorra.de/blog/

This way I can include more plugins, for example for formatting source code.

Friday, 12 July 2013

Notify all users logged in over X2Go on their graphical desktop

I am providing now a server for development of OpenPetra, with X2Go desktop remoting.
See more details at https://sourceforge.net/apps/mediawiki/openpetraorg/index.php?title=Hosted_development_workstation

To save costs, I am running the server on a jiffybox, which costs less when you freeze it.

So I am providing a php script that allows starting the machine, and to refresh it. After the last start or refresh, the machine will be stopped and frozen.

Now it would be good to remind the users once in an hour to do visit the refresh link.
I am using zenity to display the message.
This script will get all users logged in over X2Go, and display the message on their desktops:

message="Server will shutdown soon, please refresh if you still need it by visiting http://jb.solidcharity.com"
for display in `ps xaf | grep x2goagent | grep -v grep | awk '{ print ( $(NF) ) }'`
do
  user=`ps xaf | grep x2goagent | grep -v grep | grep "$display$" | awk ' { print ( $(NF-5) ) }' | awk ' { print ( $3 ) }' FS='/'`
  echo "$user $display"
  su - $user -c "zenity --info --display=$display --text='$message'&"

done
(for better layout, see https://gist.github.com/tpokorra/5984248#file-zenity-sh)

The crontab looks like this, to run it every hour:
0 */1 * * * /root/zenity.sh

The php script looks like this:

see https://gist.github.com/tpokorra/5984248#file-_jiffybox-php
The script is installed on a separate machine, that is always running.
The users can call jiffybox.php/?operation=refresh to start or refresh the machine.
The cronjob for stopping the machine looks like this:
*/15 * * * * cd ~/subs/jb; php jiffybox.php


Wednesday, 29 May 2013

Install Kolab3 on Jiffybox

When running setup-kolab, after a timeout during the set up of the 389 Directory Server, see /var/log/kolab/setup.error.log:
Failed to create semaphore for stats file (/var/run/dirsrv/slapd-kolab.stats). Error 13.(Permission denied)
There was already a mounted tmpfs, but the directory /dev/shm was not writeable for user nobody.

So, before you run setup-kolab, you might want to run:
chmod a+rwx /dev/shm

Monday, 27 February 2012

Ubuntu Oneiric and X2Go with LXDE for Remote Desktop

For OpenPetra, we want to provide a preconfigured Linux machine, so that interested developers can have a quick start, and don't need to spend so much time on installing a development environment.

I looked at FreeNX, NeatX, OpenNX, and X2Go.
NeatX does not seem to be continued.

FreeNX with OpenNX works, but I had problems with the sound.
To install FreeNX on Ubuntu Oneiric, follow the instructions at Ubuntu Forums. This avoids the problem with esound and libesd0 packages.


Finally, I have to say that X2Go works best for me. Sound is played, and access from Windows and Linux works fine to my Linux Remote Desktop.


To install the X2Go server on Ubuntu Oneiric:

 apt-add-repository ppa:x2go/stable
 add universe to /etc/apt/sources.list
 apt-get update
 apt-get install x2goserver


You get the client from http://code.x2go.org/releases/binary-win32/x2goclient/


One thing I had problems with: there was a blank or black screen, after logging in.
To debug this: I searched the log files, but could not find any clues. Then I remembered this: use the terminal as login shell, which works. There you can start your desktop manager, in my case /usr/bin/startlxde.
The error that came up was: missing libNX_Xext.so.6
I then found on the mailing list a discussion: http://www.mail-archive.com/x2go-dev@lists.berlios.de/msg03254.html
So I added the line 

 LD_LIBRARY_PATH=/usr/lib/nx/X11



at the top of /usr/bin/startlxde, and everything works now.


I also installed libjpeg-turbo, which should make the remote desktop even faster:

wget 'http://sourceforge.net/projects/libjpeg-turbo/files/1.2.0/libjpeg-turbo_1.2.0_i386.deb/download' -O libjpeg-turbo_1.2.0_i386.deb
dpkg -i ...
rm /usr/lib/i386-linux-gnu/libjpeg.so.62
ln -s /opt/libjpeg-turbo/lib/libjpeg.so.62.0.0 /usr/lib/i386-linux-gnu/libjpeg.so.62



One useful key combination is ctrl alt t, which allows you to terminate or to suspend the current session.
It seems ctrl alt k does not work with X2Go, which would allow the task switching with Alt Tab to be inside the Linux workstation.
The shortcuts available from NoMachine are listed here: http://www.nomachine.com/ar/view.php?ar_id=AR03C00172


By the way, I got X2Go work fine on virtual machines running on VMWare ESXi, and also on OpenVZ.

Friday, 3 February 2012

Ext.Net 1.2 and Mono 2.10 on Ubuntu Oneiric

We have upgraded all the code of OpenPetra to .net 4.0.
We also upgraded to Ext.Net 1.2.

There were two bugs in Mono 2.10, which were show-stoppers:
http://bugzilla.xamarin.com/show_bug.cgi?id=2505 was a problem with the mono compiler, in Mono 2.10.x
This was fixed in mono master.

So I tried to build mono from master, but then I had problems with fastcgi, while xsp4 was serving the content correctly:
http://bugzilla.xamarin.com/show_bug.cgi?id=2876
This was also fixed in mono master.

Below is a link to a tar.gz file, that contains the build of Mono, with mod_mono and xsp, at the beginning of February 2012.

I wanted to use lighttpd and fastcgi with Mono and Ext.Net, but that did not work.
The error that I got was similar as to described here, but without a solution that works for me:
http://forums.ext.net/showthread.php?14040-All-DirectEvents-Is-Error
It works fine with xsp4.

I then tried with mod_mono and apache2:
I came across this issue http://forums.ext.net/showthread.php?12348-404-Not-Found-for-a-few-resources-requests, that the resources cannot be loaded. The solution from that thread also helped me:
Add CleanResourceUrl = "false" to your .aspx file:
<ext:ResourceManager  runat="server" CleanResourceUrl="false" />

So here are my configuration steps for Ext.Net with Mono and Apache2:

This works with Ubuntu Oneiric 64 bit (11.04). But it might work on other Ubuntu/Debian version as well. I have also used it on CentOS.

apt-get install apache2
cd /opt
wget http://download.pokorra.de/mono/ubuntu/mono.tar.gz
for 32 bit: wget http://download.pokorra.de/mono/ubuntu32/mono.tar.gz
tar xzf mono.tar.gz
cd /usr/lib/apache2/modules/
wget http://download.pokorra.de/mono/ubuntu/mod_mono.so
for 32 bit: wget http://download.pokorra.de/mono/ubuntu32/mod_mono.so
cd /etc/apache2/mods-enabled
wget http://download.pokorra.de/mono/ubuntu/mod_mono.conf
# note that mod_mono.conf contains this line:
# MonoServerPath /opt/mono-2.10-git/bin/mod-mono-server4
vi /etc/init.d/apache2
# search for LANG, and replace with this line:
ENV="env -i LANG=en_GB PATH=/opt/mono-2.10-git/bin:/usr/local/bin:/usr/bin:/bin"
Mono will create a directory /var/www/.mono which should not be public.
In your apache site configuration file, add just before  <Directory /var/www/>
<directorymatch \.mono>

           Deny from all
</directorymatch>
cd /var/www
wget http://download.pokorra.de/mono/ubuntu/extnet-sample-mono.tar.gz
tar xzf extnet-sample-mono.tar.gz
chown -R www-data:www-data /var/www
/etc/init.d/apache2 restart

See the result here:
http://demo.openpetra.org/DemoDesktop

This is the demo for the Desktop from Ext.Net 1.2, with a slight modification in Default.aspx and Desktop.aspx for the ResourceManager as described above.

Friday, 11 November 2011

Windows Installer for NAnt

In the OpenPetra project, we completely depend on NAnt, which works out very well for us.
But we have had now several problems with permissions for executing nant on Windows, from the Program Files directory. Also the creation of the nant.bat was not trivial, and could cause problems with permissions.

The easy solution was to create a small InnoSetup Installer.
You can download it from our files section at SourceForge: http://sourceforge.net/projects/openpetraorg/files/openpetraorg/Tools/NAnt-Setup-0.91.exe/download

The script file for InnoSetup looks like this:

[Setup]
AppName=NAnt
AppVerName=NAnt 0.91
DefaultDirName={pf}\NAnt
DefaultGroupName=NAnt
LicenseFile=nant-0.91\COPYING.txt
OutputBaseFilename=NAnt-Setup-0.91
[Files]
Source: nant-0.91\*.*; DestDir: {app}; Flags: recursesubdirs createallsubdirs
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep=ssPostInstall then
  begin
    SaveStringToFile(ExpandConstant('{win}/nant.bat'), ExpandConstant('@"{app}\bin\NAnt.exe" %*'), False);
  end;
end;
If you have trouble with your old NAnt installation, you should delete the folder first from the Program Files, before you run the installer!

Thursday, 29 September 2011

Use Case OpenPetra for TeenStreet 2011


Intro

For TeenStreet 2011 in Germany, we have extended and used OpenPetra.
TeenStreet (http://www.teenstreet.om.org/) is an International Christian Teenager Event that happens all over the world.
Teenagers, group leaders (aka coaches) and service crew from about 18 European countries, and even further abroad, register for the TeenStreet conference in Germany. The registration is processed through the home office of each country. The home office is responsible for payment and accepting or denying registrations.
The organising office does all the logistics for the conference, eg. printing the badges.
The software ran fine on a Debian Linux on a virtual server. We have had about 3600 applications altogether.

Development

Functionality

The functionality can be separated into the part that was seen by the participants, and the part that was used by the registration offices and the organising office.

Registration

  • There is a base yaml file with general data, eg. photo upload
  • A javascript file contains all the texts, and should be translated by the home office.
  • There are several roles, eg. Teenagers, Coaches, Service people. The questions and fields to fill in are different for each role.
  • The home office can request customizations for the yaml file, which is derived from the base yaml file.
  • An Email is sent to the home office and the applicant, when the registration is submitted. A PDF file is generated and provided as a download and as an attachment to that email.
    • the email and the pdf are based on HTML templates. The PDF can also embed other PDF files, which is helpful for more detailed questionnaires for the adults.
  • The applicant has to print the PDF, sign the paper, teenagers have to let the parents sign as well.
    • If payment is done by direct debit, there is an additional signature for that on the paper as well.
    • the paper is sent as a normal letter to the home office

Backend

  • The home office receives the letter, searches for the applicant, and reviews the application. If the applicant is accepted, the state of the application is changed from "On Hold" to "Accepted". The acceptance date is recorded.
  • If an applicant is cancelled and the application status is set to cancelled, the cancellation date will be recorded.
  • Early applicants will receive a free T-Shirt. There is a special report that tells how many T-Shirts and sizes need to be ordered.
  • Badges can be printed for all applicants, with different layout, defined in HTML, for each role. Photos for the applicants and bar codes can be printed.
    • Lost Badges can be reprinted on demand.
  • Export all data of participants to an Excel file to process the data further.
  • Print reports for medical needs, vegetarians for the kitchen.
  • Print a report to know how many people are on site on each day.
  • Print a report for the children and families on the site, for their special programme.
  • Print reports for the home offices. They tick off who has actually arrived.
  • Print reports for the service crew, or other teams, to know who is supposed to be on their team.
  • Rebukes: allow the "Boundaries Team" to make notes for applicants who violate the rules on site, and print reports for the coaches or home office representatives
  • Medical team: the medical people can see the relevant information and emergency contact information of the participants, and store information about diagnosis and therapy.
  • Import applications from Petra 2.x for offices that did not take part in the online registration.
  • Late and manual registrations have also been processed through the backend.
  • Export applicants into the local Petra 2.x for the home offices.
  • Export gift batches for Petra 2.x to easily process the application and registration fee. This has only been used by the German office this year.
  • Print reports for the organising finance office, to charge the home offices for the participants that come from their country. Consider siblings, and early/late/accepted cancellations. Order participants by role.
  • User management is currently not done in the web interface, but through the OpenPetra fat client. Everything else runs in a web interface.
  • User rights can be limited for the home office representatives to the applicants for their country. The medical team and the boundaries team and the finance office get special permissions.

possible improvements

  • For next year, the applicants should be able to retrieve and update the information they have entered last year
  • Allow applicants to login later again, and register for workshops and seminars
  • Provide a list of all people that are currently on site. Need to record the actual arrival date.
  • Group assignments for the fellowship groups need to be semi automated.
  • The administration of users should be available in the web interface as well.
  • When creating the gift batch file, also create a DTAUS file at the same time.
  • head set distribution for the translation, scan the badges, home offices can get a report to see who has used a headset. check which headsets were not returned after the session.
  • upgrade ext.net and ext.js to the latest version, so that IE 9 can be fully supported

Tuesday, 15 March 2011

Ext.Net and Mono

I like ext.js/Sencha for having a rich client in the browser.

On the other hand, we are using Mono for running our .Net server.

ext.net is a good library that helps you to easily write web applications, based on your .net libraries.

For OpenPetra, I have created an online application system, and the backend for the registration office is written with ext.net.

Here are some problems I came across, and how I solved them:

First, I had to recompile the ext.net dlls and also the Newtonsoft.Json.Net20.dll.

The Newtonsoft.Json.Net20.dll has been compiled with the latest compiler built from Mono 2.8 trunk. This was necessary so that no Microsoft dlls were linked in.
The ext.net dll was built against the Mono compiled Newtonsoft.Json.Net20.dll on Windows with SharpDevelop. The mono compiler crashed on Linux when trying to build the ext.net solution.
The resulting files are available from the online source repository of OpenPetra, eg. http://bazaar.launchpad.net/~openpetracore/openpetraorg/trunkhosted/files/head:/csharp/ThirdParty/ext.net/

I was not able to get Ext.Net to run with the latest Mono 2.8, but it is working fine with 2.6.7.
I had to build it from the sources.
Some links related to the problems I had with Mono 2.8 and Ext.Net:
compile ext.net: There is no implicit reference conversion from `Ext.Net.ComboBox' to `Ext.Net.ComboBoxBase'

Running ext.net on Mono 2.8: get the error: Cannot add a Ext.Net.Parameter to System.String
For the moment, the solution for me was to use Mono 2.6.7.

The examples of ext.net only show the c# code inside the aspx file, but with growing size of the code it would be good to be able to split the code behind code from the UI code.
This is possible, but you need to define all controls in the .cs file, at least those you want to use in your code behind code.
In the aspx file, make sure you have at the top:
<%@ Page Language="C#"
Inherits="Ict.Petra.WebServer.MConference.TPageOnlineApplication"
src="Desktop.aspx.cs" %>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
see the whole file here: OnlineRegistrationBackend/Desktop.aspx

Now I ran into errors like this when Mono was compiling the code on the fly:
Compiler Error Message: CS1644: Feature `anonymous types' cannot be used because it is not part of the C# 2.0 language specification
I found on the Internet this page: http://www.4guysfromrolla.com/articles/121207-1.aspx
linked from http://web.archiveorange.com/archive/v/c2PM7RMRJf7Ti7PP7uVb, where they discuss how to use "extension methods" and "collection initializers" with Mono.

I have added all those settings to my web.config, see the result here:

You can see a running demo here: http://demo.openpetra.org:8009/

Monday, 7 March 2011

Knowledge Tree and PHP 5.3.3

We have got the latest PHP version on Hostsharing, and Knowledge Tree 3.7.0.2 did not work anymore.
I got a long list of deprecated warnings, and the session would not even start, so not even a login screen is displayed.

Deprecated: Assigning the return value of new by reference is deprecated
Warning: The magic method __get() must have public visibility and cannot be static
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent

The solution is to edit config/dmsDefaults.php, find the lines containing
error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
Below that, add the following line:
error_reporting(0);
Now Knowledge Tree 3.7.0.2 will work again, and hopefully the next version of Knowledge Tree will have fixed all the deprecated PHP things.

Saturday, 13 November 2010

Digest for phpBB Forum without plugin

I am very glad for the hosted apps that Sourceforge provides. It is excellent to have only one login, and not to need to worry about updating the apps.

The problem with the phpBB forum is that the notification emails, when you watch a forum, do not include the message. On Sourceforge you are also not able to install a digest modification, eg. http://phpbbservices.com/digests/

Therefore I thought it would be good to have an external script, that regularly checks for new posts and sends an email with the contents.

In the end, it was not too hard.
This only works for a public forum, where all posts are accessible by non-registered users.
There is the page search.php (eg.http://sourceforge.net/apps/phpbb/openpetraorg/search.php?&sr=topics&search_id=newposts) that shows all new posts.
I store each post that has been sent as an email with the post number in a text file.
Then the script fetches the page of the new posts, and checks each post if it has been sent already.
The script sends HTML emails, and even quoting blocks appear quite alright in my email client (google mail).
The script is also able to parse the posts of a thread that spreads across several pages.

You also might find the functions interesting to get the HTML code and to parse for code between the beginning and the end tag.

Feel free to use the script and to modify it.

Wednesday, 25 August 2010

Install Smoothwall from bootable USB memory stick

Today I wanted to install Smoothwall on a fan-less device, Lex Light LG8302.

There is the tool UNetbootin http://unetbootin.sourceforge.net/, but it does not support the Smoothwall iso image, and even if it copies to iso file to USB, when you boot from it you get the UNetbootin default option, but that does not do anything.

I used 7zip to extract the iso image of Smoothwall, which gives me the [Boot] directory.
It seems that UNetbootin is not able to extract the boot files from the iso image, from Bootable_2.88M.img, even though it does attempt it.

I used RawWrite for Windows (http://www.chrysocome.net/rawwrite) to extract the files from Bootable_2.88M.img. The partition size of the USB stick will be only 2 MB, but that is ok for the moment. Copy the files initrd.img, vmlinuz und syslinux.cfg to your local harddrive. Change the names from capital to lower case letters. Reformat the USB stick to its normal size. Then run again UNetbootin, and use the Smoothwall iso image as the source. Then copy the 3 files initrd.img, vmlinuz und syslinux.cfg to the USB stick, you will need to overwrite the existing syslinux.cfg.

To test the USB stick with VMWare, I followed the instructions at http://www.pendrivelinux.com/boot-a-usb-flash-drive-in-virtualbox/.

Then on the fan-less device, I first was not sure how to get it to boot from the usb stick. Then the hint was on http://nion.modprobe.de/blog/archives/343-My-new-Lex-Light-CV860A.html where it tells that you have to change the boot order to use USB-ZIP which will boot from the USB stick.

UPDATE:

it seems I rejoiced too early...

The installer does start from the USB stick, and does format the harddrive, but then it does not seem to find the file smoothwall.tgz and does not install all the network card drivers. So even the network install does not work.

The function findharddiskorcdrom looks for CDROM or harddrive, but I could not figure out why it does not find the USB stick. It only seems to check /dev/scd0, but no other device.

Sunday, 6 June 2010

VirtualBox PUEL on OpenSUSE on 64 bit machine

It took me a while to solve this problem, therefore here is the solution for everyone...

I installed the PUEL version of VirtualBox from the virtualbox.org website, the version for personal use and evaluation.
There is the OSE version included in OpenSUSE, but that does not support USB connections.

Now for the PUEL version, you need to build the kernel module for VirtualBox.
You might need to install gcc and make, and also the kernel sources.
I will come to the details of the kernel sources later.

When I ran /etc/init.d/vboxdrv setup, I got the error in /var/log/vbox-install.log:
make -f /usr/src/linux-2.6.31.12-0.2/scripts/Makefile.modpost
scripts/mod/modpost -m -a -i /usr/src/linux-2.6.31.12-0.2-obj/i386/desktop/Module.symvers -I /tmp/vbox.3/Module.symvers -o /tmp/vbox.3/Module.symvers -S -K /usr/src/linux-2.6.31.12-0.2-obj/i386/desktop/Module.markers -M /tmp/vbox.3/Module.markers -w -c -s
FATAL: /tmp/vbox.3/vboxdrv.o has no symtab?
I looked for symtab on the Internet, and found that it has to do with conflicts in the architecture.

It took me a while to have a look at the versions of kernel packages I had installed:
rpm -qa | grep kernel
This showed for my system, that the package for kernel-syms was not for x86_64, but for 586. This caused the error with symtab.

Solution (please check the result of rpm above to know which exact version of the kernel you are using):
zypper install kernel-syms-2.6.31.12-0.2.1.x86_64
As an example, here is what rpm -qa | grep kernel shows after I installed the correct packages:
kernel-xen-devel-2.6.31.12-0.2.1.x86_64
kernel-syms-2.6.31.12-0.2.1.x86_64
kernel-desktop-2.6.31.12-0.2.1.x86_64
kernel-debug-devel-2.6.31.12-0.2.1.x86_64
kernel-desktop-devel-2.6.31.12-0.2.1.x86_64
linux-kernel-headers-2.6.31-3.4.noarch
kernel-default-devel-2.6.31.12-0.2.1.x86_64
kernel-source-2.6.31.12-0.2.1.noarch
Then building the kernel module for VirtualBox worked.

Monday, 10 May 2010

CruiseControl.net and Mono

I have set up CruiseControl.net (http://sourceforge.net/projects/ccnet/) on Mono for building our OpenPetra.org project, which is quite a big project.

Here are the steps I followed, and my config files so that people can benefit from it:

Here is some advice how to change the ccnet.exe.config to make it work for Mono: http://markmail.org/message/uyfqysd55u4xqhfs; main things are to change the xsl paths' backslash to forward slash, and to replace ColoredConsoleAppender with ConsoleAppender, and to remove mappings for the ConsoleAppender.

You can see my modified ccnet.exe.config, and also the ccnet.config for OpenPetra here in the online git repository:

http://openpetraorg.git.sourceforge.net/git/gitweb.cgi?p=openpetraorg/openpetraorg;a=tree;f=csharp/ICT/PetraTools/ContinuousIntegration

You will also find a cruisecontrol.sh which I use as a init.d script for starting and stopping my CruiseControl server.

I had to install Mono XSP from the Lenny backports repository, to get Mono 2.x. It was also important to install sendmail, otherwise the EmailProvider would obviously not work (which took me quite a while to notice).
apt-get -t lenny-backports install mono-xsp
apt-get install sendmail sendmail-bin

Then I had a nasty problem with the logging. After a failed build, I had this exception:

[OpenPetraOrg:ERROR] Publisher threw exception: ThoughtWorks.CruiseControl.Core.CruiseControlException: Unable to read the contents of the file: /home/timop/CruiseControl.NET/Server/OpenPetraOrg/Artifacts/nant-results-b2f2a299-05c5-42a6-a311-24df30a59b9a.xml ---> System.NotImplementedException: The requested feature is not implemented.
at ThoughtWorks.CruiseControl.Core.Tasks.FileTaskResult.ReadFileContents () [0x00000]
--- End of inner exception stack trace ---
at ThoughtWorks.CruiseControl.Core.Tasks.FileTaskResult.ReadFileContents () [0x00000]
at ThoughtWorks.CruiseControl.Core.Tasks.FileTaskResult.get_Data () [0x00000]
at ThoughtWorks.CruiseControl.Core.Publishers.XmlIntegrationResultWriter.WriteTaskResults (IIntegrationResult result) [0x00000]
at ThoughtWorks.CruiseControl.Core.Publishers.XmlIntegrationResultWriter.WriteBuildElement (IIntegrationResult result) [0x00000]
at ThoughtWorks.CruiseControl.Core.Publishers.XmlIntegrationResultWriter.Write (IIntegrationResult result) [0x00000]
at ThoughtWorks.CruiseControl.Core.Publishers.XmlLogPublisher.Execute (IIntegrationResult result) [0x00000]
at ThoughtWorks.CruiseControl.Core.Tasks.TaskBase.Run (IIntegrationResult result) [0x00000]
[OpenPetraOrg:ERROR] Unable to build email message: ThoughtWorks.CruiseControl.Core.CruiseControlException: Unable to read the contents of the file: /home/timop/CruiseControl.NET/Server/OpenPetraOrg/Artifacts/nant-results-b2f2a299-05c5-42a6-a311-24df30a59b9a.xml ---> System.NotImplementedException: The requested feature is not implemented.
After some searching, I realised that the log file had become quite big, and in the CruiseControl.net code in FileTaskResult.cs the function ReadFileContents would call MemoryFailPoint, but this class has not been implemented yet in Mono 2.x (http://anonsvn.mono-project.com/viewvc/tags/mono-2-4-2-2/mcs/class/corlib/System.Runtime/MemoryFailPoint.cs).

My solution was to download the sources of Mono, and modify MemoryFailPoint.cs to not throw that NotImplementedException, but just stay quiet. I then copied the resulting file (eg. mono-2.4.2.3/mcs/class/lib/net_2_0/mscorlib.dll) to my server with the CruiseControl.net, to /usr/lib/mono/2.0/mscorlib.dll

Now CruiseControl.net works quite nicely, though I have not played with NUnit yet, and there are more things to explore...

Monday, 1 March 2010

Charity Resource Planning - CRP and ERP

After some attempts to explain what my work is all about, I have come to the conclusion that the description "Charity Resource Planning" might fit best.

Previous attempts were "Administration Software", but then people think about administration of computers, etc. And I have not read about anyone calling any software "Administration software".

Other people call it "Back Office Software".
Wikipedia describes Back office in these words:
"A back office is a part of most corporations where tasks dedicated to running the company itself take place. The term comes from the building layout of early companies where the front office would contain the sales and other customer-facing staff and the back office would be those manufacturing or developing the products or involved in administration but without being seen by customers. Although the operations of a back office are usually not given a lot of consideration, they are a major contributor to a business."
But does a charity have a front office and a back office? It is usually quite a small team of dedicated people. I remember once a funny bookkeeper in one of our smallest offices, telling me he would ask the system administrator to do something for him... it took me a few seconds to realise he was speaking of himself in the third person...
To some degree, the work of a charity, helping people in need, empower the people without rights, telling the Good News, could be called the "front office".
But even in normal companies and enterprises, no one calls their software "Back Office Software". You want it all integrated. The salesman in the front office needs to know the addresses of the customer, etc.

This is where the term "Enterprise Resource Planning (ERP)" comes to mind.

Again the definition from Wikipedia: Enterprise Resource Planning
"Enterprise resource planning (ERP) is a term usually used in conjunction with ERP software or an ERP system which is intended to manage all the information and functions of a business or company from shared data stores.
It is a commercial software package that promotes seamless integration of all the information flowing through a company.
[...]
[The term ERP] was introduced by research and analysis firm Gartner in 1990. ERP systems now attempt to cover all core functions of an enterprise, regardless of the organization's business or charter. These systems can now be found in non-manufacturing businesses, non-profit organizations and governments."
For a while I thought about using the term ERP for the things I do. But then it sounded strange. Can you run a charity like an enterprise? On the one hand, many concepts can be brought over from the enterprise experience, and a charity can benefit from the lessons learned in business. Some charities even are run as an enterprise, and their goal is to grow and move more and more money. They pay salaries etc.

But I am not talking about those huge well-known charities that you see on TV ads. My background are mission organisations. They and many other charities work mostly on a low profile. They live from dedicated workers who are willing to work for a small salary or even raise their own support, and such organisations could not exist without their dedicated supporters that not only back the work financially but also with prayer.

There are quite a number of Open Source ERP systems around. The question is how hard it would be to modify them by adding modules to turn these software packages into "Charity Resource Planning" tools.
There is a good example of Medical, which is an Electronic Medical Record (EMR) and Hospital Information System, and it is based on OpenERP, an Open Source Enterprise Management solution.

So it would work to adjust an ERP system to work for charities. I wish there were such initiatives to use the benefit of Open Source for charities in this area.
The question will be how close the ERP system will match the processes of a charity. How far can you modify the software, and how much do you have to change your own processes?

Therefore my goal is to make a real "Charity Resource Planning (CRP)" software.
  • CRP software has to be easy to use, since charities often have much higher staff turnover than normal businesses, due to short term commitments etc
  • CRP software should center on managing relations with supporters and workers and the people involved in the projects in a way that is right and honourable.
  • CRP software should provide tools for most of the office tasks, eg. Personnel department, Donor contact management, Financial Planning, Accounting
  • CRP software has to be available in all sorts of languages and support many currencies, so that it can be used across a multi-national organisation, in such a diversity of countries that companies of the size of a usual charity normally would never work in because they don't have the manpower.
  • Such a CRP software has to allow easy integration with other software, eg. Payroll which is probably too difficult to adapt to the laws of each country. It should also provide many plugin interfaces that allow localisation of the tools, eg. for processing bank statements etc.
  • CRP software has be available at justifiable costs, considering the personal effort of supporters and workers to keep the charity going.
There is already a small number of software systems around that fit well into the category of "Charity Resource Planning". And I think there is certainly a need for more developers and IT specialists working in this area, both voluntarily and to earn their living. I think it would benefit many charities if we use Open Source software for this in order to be able to share solutions even if we are using different technology or emphasize different management/organisational styles.

My personal aim is to make OpenPetra.org one of the first choices in Charity Resource Planning systems.



Disclosure
Timotheus Pokorra is currently working as a software developer for OM, a christian charity working in many countries. OM owns the OpenPetra.org project which aims to provide a free software solution for the administration of charities.

Saturday, 20 February 2010

KnowledgeTree and Versioning of documents uploaded by WebDAV

The advantage of KnowledgeTree is that it keeps versions of each document that you upload. Unfortunately, this does not seem to work in version 3.7.0.2, when uploading a new version of an existing file via WebDAV. The file is overwritten with the new version, but there is no version history.

There might be good reasons for that behaviour, which are explained in this issue?

Here is a solution that works for me, but of course, I do not know the interna of Knowledge Tree, therefore please use it at your own risk...

In file ktwebdav/lib/KTWebDAVServer.inc.php, find the lines:
// Modified - 25/10/07 - changed add to overwrite
// $oDocument =& KTDocumentUtil::add($oParentFolder, $name, $oUser, $aOptions);
$oDocument =& KTDocumentUtil::overwrite($oDocument, $name, $sTempFilename, $oUser, $aOptions);
It seems, with the add method a new file would be created, with a unique filename. So uploading a new version of test.txt would result in two files, test.txt would stay, and the new file would be test(1).txt. This is not really what you want.

To get real versioning, comment that line with "overwrite", and add these lines:
$aOptions['newfilename'] = $name;
$oDocument =& KTDocumentUtil::checkin($oDocument, $sTempFilename, 'WebDAV upload', $oUser, $aOptions);
This should do the trick. You will only have one file in your folder, and when you click on "Version History" in your webinterface, you will see the old versions and the current version. The file you download via WebDAV is always the latest version. This makes sense to me...

Sunday, 14 February 2010

A look at charities and Open Source ERP software

I want to look at several articles and initiatives that I have found on the web, and address some of the questions and risks and benefits.

Why can't you just use commercial software to manage your administration?
This really depends on the type of charity.

For example a representative from Christian Aid says in this BBC article (
http://news.bbc.co.uk/1/hi/technology/6124582.stm), which I will refer to again later:
"We are a funding organisation that ships £90m around the world ..."
[...]
"We spend one pence in the pound on administration, and that means we've got to be as effective and efficient as we can, and software is one way to do that."

Reading this, that means that they are still spending £900.000 on administration.

I would like to list different goals that a charity has:
  • deliver a message
  • provide material help
  • provide training or practical help through people

Therefore an organisation that ships a lot of money around the world, it is much easier to spend quite big amounts on software, and this saves them all sorts of trouble with technical support etc.

But if your organisation is more about highly motivated workers working alongside the people you want to help, and your main motivation is the message you deliver, the picture is different. You will probably not "ship vast amounts of money around the world", and the percentage you use for overall administration is more critical. The amounts you can spend on IT is probably quite small. It will be difficult to subscribe to proprietary software licenses which you will be depend on for the next decade or so.

We should also not forget cultural differences. It seems it is much more acceptable in the US to invest into administration than it is in Europe.

The BBC article about Christian Aid also mentions the use of standard office software, e.g. Windows XP and MS Office licenses. They are very happy with the good charity discounts from Microsoft. I will not address this topic here, because I am not discussing Operating Systems or Office Software, but Administrative software.

A charity is no software company, why should we invest into OpenSource and develop our own software?
I want to introduce the idea that has been formed by the Collaborative Software Initiative (CSI) (see
http://www.csinitiative.com/).
I quote from their website:
"The Collaborative Software Initiative (CSI) brings together like-minded companies to build software applications at a fraction of the cost of traditional methods. CSI introduces a market-changing process that applies open source methodologies to building Collaborative Software.
For applications that don't enable competitive advantage or are associated with non-value added activities such as compliance, regulatory, and industry standards, Collaborative Software empowers customer core team members to provide control and direction over a project while leveraging the efficiencies of using the same software and reducing costs."
They are thinking of banks and insurances and the automobile industry. I think we can easily apply the same to mission organisations and charities. We don't want to develop software for the sake of it, and we don't want a competitive advantage over other mission organisations or charities. Therefore it would make much sense to coordinate the efforts, and let others benefit from our work, and even encourage them to contribute.


Open Source is not as good as the best of breed

First of all, the best of breed software will probably cost more. In case it is cheaper or you can afford it anyways, and you have also calculated the cost of training etc, then it might well be that the best of breed is better for you.
Regarding the issue that the users know the best of breed and it is more difficult training them on an Open Source system because it is unknown to them: This might be more an issue for Operating Systems and Office packages. Although the introduction of Office 2007 has shown how easy it is to force users to suddenly use ribbons instead of menus.
The advantage of an Open Source administration suite should be that it is easy because it can be customized to the specific needs. Can your workers cope with the complexity of the best of breed, fits-all system? Most of the time you don't need all functionality of the best of breed software.
In the case that you have to train your workers on the best of breed software, make sure you know how often you have to train new staff, and how expensive that is, depending if it is possible to provide your own in-house training, or you have to pay expensive courses.

With Open Source you don't get what you really need
This is generally true for all software. But with Open Source you have a chance, to change the software much easierly, either by doing it yourself or get someone to do it for you.
If you have a good reason, you can convince a developer to do it, and it can benefit others as well.
Depending on the size of differences of expectation, you need to be able and willing to invest into adaption yourself; but you will own the change and don't need to pay license fees for it in the future.

There are too many updates to install for Open Source software
see also the article "
How open source is losing the charity battle" at ZDNet.

Security nowadays requires updates anyways, even Microsoft have a monthly patch day.
Nowadays updates should become much more easy to install.
The more users there are, the quicker a solution is provided; frequent updates prevent a bug from annoying you for a longer time.

Who will provide support for us? Is there a guarantuee of service and continued development?
You should look for a contract with a software engineer, and the greater the community for an Open Source software, the more people are willing to help. It is not all for free, but that is a good thing for you, because when you pay you have rights. On the other hand, you might find IT people that specifically want to support your organisation as volunteers. Because of the free nature of Open Source, it will be much easier for them to accustom themselves to the software.
There should also be general support of the users amongst each other, therefore leaving only serious extensions to paid or volunteering developers.

More Links
Most of the Links don't relate to Open Source regarding office administration. But they might give the interested reader an overview of opinions and possibilities.
Case Studies:
http://news.bbc.co.uk/1/hi/technology/6124582.stm
Charity shuns open source code

http://www.cafamily.org.uk/opensource.html
A charity using open source

http://news.zdnet.co.uk/software/0,1000000121,39166840,00.htm
London-based charity which saved more than £28,000 by using Linux Terminal Server to build its network.

Articles:
http://www.linux.com/feature/33378
Article: Help introduce open source software to charities

http://www.uwnyc.org/technews/v5_n6_a1.html
How "Open Source" Can Open Doors for Nonprofits

comparison Office vs Open Office for nonprofits

article from the year 1999, from Danny Yee: "Development, Ethical Trading, and Free Software"

Initiatives:
http://www.donortec.org/
DonorTec provides donated software and hardware from companies such as Microsoft and Cisco to eligible Australian non profit groups with Income Tax Exempt Status (ITE).

http://charityware.info/
Charityware (c-ware) is any software that supports charity. Some developers ask that proceeds from the sale of software be donated to charity, while others license or donate their software directly to charity.

http://www.socialsource.org.uk/
Last update in 2005.
This wiki is a central point for an advocacy initiative
("SocialSource") seeking to promote and assist the practical use of Free/Open Source Software (FOSS) within the UK Voluntary and Community Sector (VCS)*.

http://www.volresource.org.uk/swit/miscsw.htm
information for voluntary and community organisations

http://www.it4communities.org.uk/it4c/home/index.jsp
We are the UK's leading national IT volunteering programme.
iT4Comunities can help
charities, community groups and social enterprises access free IT support from IT professional volunteers and make substantial savings

http://www.nosi.net/projects/primer
Nonprofit Open Source Initiative
"Choosing and Using Free and Open Source Software: A Primer for Nonprofits" describes what open source software is and what impact this type of software may have on the nonprofit sector.

http://www.benetech.org/
technology serving humanity

http://www.ngogeeks.com/
To evaluate Open Source Software in an effort to reduce the IT costs of Non-Government and Not for Profit Organisations

http://www.ngopulse.org/article/ngo-ict-management-toolkit
The Southern African NGO Network (SANGONeT)

http://ngoinabox.mahiti.org/
This is the website of the South Asian hub of NGO-in-a-box, a collection of Free and Open Source Software (FOSS) tools selected for use by non-profit organisations.

http://www.codn.net/plugins/content/content.php?content.10
Christian Open Development Network

On the FSF's High Priority Projects list there is a call for the creation of a donor transaction and contact system.

http://www.lightsys.org/
LightSys is dedicated to equipping Christian missions and ministries with the computer technology correct for them, including the knowledge and contacts needed to support that technology. As a result they can serve with greater efficiency, keeping their mind on their task, not their computers, thus redeeming technology -- for God's Kingdom.
latest update on Kardia/Centrallix: http://lan.lightsys.org/blogs/?id=4470&one

Disclosure
Timotheus Pokorra is currently working as a software developer for OM, a christian charity working in many countries. OM owns the OpenPetra.org project which aims to provide a free software solution for the administration of charities.

Thursday, 15 January 2009

Request Tracker scrip that involves the Category of a Custom Field

Our Request Tracker works for users in many countries, which are all assigned to areas. There is an IT administrator for each area, which should be added to the CC list for the request that is from one of the countries in his/her area.

We have created a custom field, and used the category to group the countries by areas.

We needed a scrip with an action that needs to know the category of the currently selected value of a custom field.


Condition: User Defined
Action: User Defined
Template: Global Template: Blank
Stage: TransactionCreate


Custom condition:
my $CFName = 'Field/Country';

my $CF = RT::CustomField->new( $RT::SystemUser );
$CF->LoadByNameAndQueue( Name => $CFName, Queue => $self->TicketObj->Queue );

if ( (($self->TransactionObj->Type eq "CustomField" && $self->TransactionObj->Field == $CF->id)
||
$self->TransactionObj->Type eq "Create" ) &&
($self->TicketObj->FirstCustomFieldValue('Field/Country')) )
{
return 1;
}
return 0;


Custom action preparation code:
my $CFName = 'Field/Country';
# for FirstCustomFieldValue see in Record.pm
my $fieldcountryVal = $self->TicketObj->FirstCustomFieldValue($CFName);
my $aita_email = '';
my $area = '';

#see CustomFieldValue_Overlay.pm, sub Category

my $CFObj = new RT::CustomField($RT::SystemUser);
$CFObj->Load($CFName);
my $valuesObj = $CFObj->ValuesObj();
while (my $myValue = $valuesObj->Next) {
if ($myValue->Name eq $fieldcountryVal)
{
#$RT::Logger->info($fieldcountryVal." belongs to area ".$myValue->Category);
$area = $myValue->Category;
}
}

if ($area eq "Some Area")
{
$aita_email = 'admin@somearea.ourdomain.org';
}
elsif ($area eq "Another Area")
{
$aita_email = 'admin@anotherarea.ourdomain.org';
}
#if ($aita_email ne '')
{
my ($ret, $msg) = $self->TicketObj->AddWatcher( Type => "Cc", Email => $aita_email);

if ($ret) {
#$RT::Logger->info("scrip: New watcher added to ticket");

} else {
#$RT::Logger->error("scrip: Failed to add new watcher to ticket");
}
}

return 1;

Custom action cleanup code:
return 1;

Friday, 21 November 2008

BestPractical RT: Request Tracker on CentOS 5 with PostgreSQL

see also http://www.ptitov.net/2008/07/request-tracker-installation-o.html

Here are the steps how to install Request Tracker on CentOS 5 with PostgreSQL:

Install RPM packages

yum install postgresql postgresql-server postgresql-libs
yum install httpd perl-BSD-Resource perl-FCGI perl-Apache-DBI mod_perl
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uhv rpmforge-release*.rpm
yum install perl-Digest-HMAC perl-Apache-Session perl-Class-Container perl-Class-Data-Inheritable perl-Crypt-DES perl-Devel-StackTrace perl-Exception-Class perl-GD \
perl-GD-Graph perl-GD-Text-Util perl-Hook-LexWrap perl-HTML-Mason perl-HTTP-Server-Simple perl-HTTP-Server-Simple-Mason perl-IO-Socket-INET6 \
perl-Net-SNMP perl-Params-Validate perl-Socket6 perl-UNIVERSAL-require perl-HTML-scrubber perl-Text-WikiFormat perl-XML-RSS perl-Tree-Simple \
perl-Text-Wrapper perl-Module-Versions-Report perl-CSS-Squish \
perl-Term-ReadKey perl-Class-ReturnValue perl-Text-Quoted perl-Calendar-Simple perl-DBIx-SearchBuilder perl-Text-Autoformat \
perl-MailTools perl-Regexp-Common perl-Locale-Maketext-Lexicon perl-Locale-Maketext-Fuzzy perl-Time-HiRes perl-Time-modules perl-TimeDate \
perl-Log-Dispatch perl-Text-Template perl-HTML-Tree perl-HTML-Format \
perl-HTML-Scrubber perl-libwww-perl perl-MIME-tools perl-DBD-mysql



Configuration of Perl modules
To see if all required perl modules have been installed, run this:
/usr/bin/perl -MCPAN -e shell
make testdeps
/usr/bin/perl ./sbin/rt-test-dependencies --verbose --with-pgsql


Also, make sure you have newer versions of IO::File (1.14) and File-Temp (1.21).
Otherwise you get in trouble. More details follow here:

Fixes:
cat testemail.txt | /usr/bin/rt-mailgate --queue MyQueue --action correspond --url http://rt.mydomain.org/
Can't locate object method "seek" via package "File::Temp"


check currently installed version of File::Temp:
perl -le 'use File::Temp; print File::Temp->VERSION'

install the latest version 0.21:
cpan
# for reinitialising cpan:
o conf init
i /MIME-tools/
test D/DO/DONEILL/MIME-tools-5.425.tar.gz
i /file-temp/
install T/TJ/TJENNESS/File-Temp-0.21.tar.gz


Problem with attachements:
cat rttestmailatt.txt | /usr/bin/rt-mailgate --debug --queue myQueue --action correspond --url http://rt.mydomain.org
Connecting to http://rt.mydomain.org/REST/1.0/NoAuth/mail-gateway at /usr/bin/rt-mailgate line 102, <> line 1.
hello http://rt.mydomain.org/REST/1.0/NoAuth/mail-gateway
not ok - Failed to parse this message. Something is likely badly wrong with the message at /usr/bin/rt-mailgate line 112, <> line 1
another problem:
Can't locate object method "binmode" via package "IO::File" at /usr/lib/perl5/vendor_perl/5.8.5/MIME/Body.pm line 437.


We need version 1.14 of IO::File

perl -le 'use IO::File; print IO::File->VERSION'

requires: yum install gcc
cpan
i /IO-1.2301/
install G/GB/GBARR/IO-1.2301.tar.gz


IMPORTANT: need to reload the apache server, otherwise the new perl packages have no effect:
/etc/init.d/httpd reload

I came once across a Cpan problem:
Going to read /root/.cpan/sources/modules/03modlist.data.gz
Unrecognized character \x88 at (eval 29) line 1.

The solution was: delete 03modlist.data.gz, and just run cpan again

Install RT
Download the latest tar.gz file from http://bestpractical.com/rt/download.html
In a tmp directory, not the destination directory:
cd /home/timop
tar xvzf rt-3.6.6.tar.gz
cd rt-3.6.6
./configure --prefix=/usr --enable-layout=RH \
--with-db-host=localhost \
--with-db-dba=rt --with-db-rt-user=rt \
--with-db-database=rt --with-pgsql

Check to see if all dependancies are installed:
make testdeps | grep MISSING
make install

You then need to configure /etc/rt/RT_SiteConfig.pm
e.g. if you want to use Postgresql, it could look like this:
# {{{ Database Configuration

# Database driver beeing used. Case matters
# Valid types are "mysql", "Oracle" and "Pg"

Set($DatabaseType , 'Pg');

# The domain name of your database server
# If you're running mysql and it's on localhost,
# leave it blank for enhanced performance
Set($DatabaseHost , 'localhost');
Set($DatabaseRTHost , 'localhost');

# The port that your database server is running on. Ignored unless it's
# a positive integer. It's usually safe to leave this blank
Set($DatabasePort , '');

#The name of the database user (inside the database)
Set($DatabaseUser , 'rt');

# Password the DatabaseUser should use to access the database
Set($DatabasePassword , 'secret');

# The name of the RT's database on your database server
Set($DatabaseName , 'rt');

# If you're using Postgres and have compiled in SSL support,
# set DatabaseRequireSSL to 1 to turn on SSL communication
Set($DatabaseRequireSSL , undef);

# }}}


Configuration of PostgreSQL
vi /var/lib/pgsql/data/postgresql.conf;
For PostgreSQL 7.x: add line: tcpip_socket=true;
For PostgreSQL 8.x: listen_addresses = 'localhost'

vi /var/lib/pgsql/data/pg_hba.conf; it should contain:
local all all ident sameuser
host template1 rt 127.0.0.1/32 md5
host rt rt 127.0.0.1/32 md5
host all postgres 127.0.0.1/32 trust

/etc/init.d/postgresql start
postgresql logfile if db does not start: /var/lib/pgsql/pgstartup.log
chkconfig postgresql on
make initialize-database: problem: user rt does not exist; need to use dba postgres
/usr/bin/perl //usr/sbin/rt-setup-database --action init --dba postgres --prompt-for-dba-password

For a nightly backup of your database, you can use this command:
su - postgres -c "umask 0077; pg_dumpall | gzip > /var/lib/pgsql/data/backup.sql.gz"
To restore a database, e.g. when moving from one server to another:
su - postgres
psql template1
drop database rt;
create database rt;
\q
psql rt < /var/tmp/rt-20071210.sql

HTTPD configuration
/etc/httpd/conf.d/rt.conf should contain:
<VirtualHost *:80>
ServerName rt.mysupport.com
DocumentRoot /var/rt/html
AddDefaultCharset UTF-8

ServerAdmin Timotheus.Pokorra@mysupport.com
PerlModule Apache::DBI
PerlRequire /usr/bin/webmux.pl

<Location />
Options None
SetHandler perl-script
PerlHandler RT::Mason
<IfDefine PerlDProf>
<IfDefine PerlSmallProf>
PerlFixupHandler Apache::SmallProf
</IfDefine>
</IfDefine>
</Location>

<Location /NoAuth/images>
SetHandler default-handler
</Location>
# To use this you have to start apache with -DPerlStatus.
#
# In RHEL, add the following line to /etc/sysconfig/httpd:
#
# OPTIONS=-DPerlStatus
<IfDefine PerlStatus>
<Location /perl-status>
SetHandler perl-script
PerlHandler Apache2::Status
PerlSetVar StatusOptionsAll On
PerlSetVar StatusTerse On
PerlSetVar StatusTerseSize On
PerlSetVar StatusTerseSizeMainSummary On
PerlSetVar StatusLexInfo On
</Location>
</IfDefine>

To solve issues with "Can't change ownership of files written by interp object: Permission denied" when running Apache:
chcon -Rt httpd_sys_content_t /var/rt/mason_data/obj

chown -R apache /var/rt/mason_data/obj
chgrp -R apache /var/rt/mason_data/obj
chcon -Rt httpd_sys_content_t /var/rt/html
not: chcon -Rt httpd_sys_script_t /var/rt/html
/etc/init.d/httpd restart

To solve issues after upgrading RT, I had to do this sometimes:

rm -fr /var/rt/mason_data/obj
mkdir /var/rt/mason_data/obj
touch /var/rt/mason_data/obj/.__obj_create_marker
chmod -R a+w /var/rt/mason_data/obj
/etc/init.d/httpd restart
Configure Sendmail
The goal is to receive new requests via email.

You need to create a symbolic link, to avoid errors like "DSN: Service unavailable" or "write error: Broken pipe" in /var/log/maillog
ln -s /usr/bin/rt-mailgate /etc/smrsh
I have these lines in my /etc/aliases file:
my-support-comment: "|/etc/smrsh/rt-mailgate --queue MySupport --action comment --url http://rt.mysupport.com/"
my-support: "|/etc/smrsh/rt-mailgate --queue MySupport --action correspond --url http://rt.mysupport.com/"

Make sure that your server knows about rt.mysupport.com, you might need to add it to /etc/hosts.

You can test the delivery of emails:
echo "test" | mail my-support@rt.mysupport.com -s "test rt"
tail -f /var/log/maillog
or even more directly:
cat testemail.txt |/etc/smrsh/rt-mailgate --queue MySupport --action correspond --url http://rt.mysupport.com/
One other error I got was: "Relaying denied. IP name lookup failed" in /var/log/maillog
The problem was that emails were delivered to ticket.mycompany.com, and the rt server was at rt.mysupport.com.
I had to edit the file /etc/mail/local-host-names
and add the line ticket.mycompany.com

Tuesday, 28 October 2008

DTAUS with C#

I needed to export Lastschriften (instructions for direct debit) for our german office, and after looking for some solutions, I realised that it is not that hard to write it yourself...

Here is the result: http://download.pokorra.de/coding/Dtaus.cs
Please feel free to use the code any way you like.
I read the input data from an XML file, of course this needs to be modified to your specific situation.

A good help was this documentation of the german DTAUS bank file format:
http://www.infodrom.org/projects/dtaus/dtaus.html

Another useful tool was the JDTAUS editor, a java editor that can process and create DTAUS files:
http://www.jdtaus.de/de/
I use this to validate and test the files written with my C# program.

Monday, 20 October 2008

Building a mono 2.0 RPM for RHEL4/CentOS4

When I noticed that Novell does not offer RPMS of Mono 2.0 for RedHat Linux, I had a look at the Fedora 10 Beta and found that there is a Mono 2.0 Source RPM:
mono-2.0-6.fc10.src.rpm
Update: mono-2.0.1-12.fc10.src.rpm

Because we work with CentOS4/RedHat Enterprise Linux 4, I installed the source package on that system, and tried to build the rpms.

Building the code was fine after I deactivated a couple of dependencies.
But I ran into some problems at the file checking stage. I wondered if I can prevent the build stage to happen again and again. That way I should be able to debug the file list check etc.

Reading the man page, these parameters are interesting:
--short-circuit
--nobuild
-bi
-bl
So with rpmbuild -bl mono.spec I was able to just run the file checking stage.

The errors I got were like this:
rpm build errors: File not found: /var/tmp/mono-2.0-6-root-root/usr/bin/certmgr/usr/bin/chktrust/usr/bin/gacutil/usr/bin/gmcs/usr/bin/mcs/usr/bin/mcs1

But the files do exist in the /var/tmp/mono-2.0-6-root-root/ directory

I finally realised that the problem was caused by the Macros.
see also http://rpm.org/wiki/PackagerDocs/Macros
I had to first add curly brackets to each Macro call:
%{macro parameters}
But even then only the first line of the Macro had an effect.
This command was helpful in the files section to see that the Macros just were not resolved correctly:
%{echo: %{your_macro_here}}

In the end, I ended up adding the missing files to my own mono.spec file.
I also had a look at the last available RedHat spec file from Novell for Mono 1.9.x, and I guess there is a different rpm version for RHEL 4 and RHEL 5.

Here is my modified mono.spec file that works for RHEL4/CentOS4 for Mono 2.0:
http://download.pokorra.de/mono/mono.spec

Please download the src.rpm file from the Fedora 10 Beta, or later, and install it:
rpm -i mono-2.0-6.fc10.src.rpm
Then copy my modified mono.spec to /usr/src/redhat/SPECS, and build the packages:
rpmbuild -ba mono.spec

Alternatively, here is a zip file with the compiled RPM files for CentOS4/RHEL4:
mono-2.0-6.i386.rhel4.rpm.zip
I cannot guarantuee that it actually works, but feel free to use it for your own experiments!