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.