Easy start for OpenPetra developers October 18th, 2013
Steps to reproduce the video tutorial:
- See full instructions in OpenPetra Wiki
- Make sure .Net 4 is installed
- Install SharpDevelop
- Install NAnt
- Install 7zip
- Download and unzip nightly build of OpenPetra
Update August 2015: the nightly build is now hosted at Github, we are not using Sourceforge for this anymore - Start the Developers Assistant: Start the server, start the client, build OpenPetra
- Open the solution file delivery\projects\sharpdevelop4\OpenPetra.Server.sln in SharpDevelop
Ext.Net 1.2 and Mono 2.10 on Ubuntu Oneiric February 3rd, 2012
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"
/>
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
Deny from all
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.
Ext.Net and Mono March 15th, 2011
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.
compile ext.net: There is no implicit reference conversion from `Ext.Net.ComboBox’ to `Ext.Net.ComboBoxBase‘ fixed in master https://bugzilla.novell.com/show_bug.cgi?id=653832Running ext.net on Mono 2.8: get the error: Cannot add a Ext.Net.Parameter to System.String
<%@ 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
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
Posted in Software Development | 2 Comments »
CruiseControl.net and Mono May 10th, 2010
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:
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…
DTAUS with C# October 28th, 2008
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.
Use the CSParser to process C# files August 29th, 2008
I wanted to generate code but at the same time parse the target file first to see if any changes have been manually made or with the graphical designer.
I found the following parser for c# code: http://www.codeplex.com/csparser; it seems very active at the moment, and it parsed my test cs file without any problems.
I had some issues first understanding how to look for the current line number and how to know the name of the classes and methods etc. But a look at the sample file cmc.cs helped a lot.
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using DDW.Collections;
using DDW;
using Microsoft.CSharp;
namespace test
{
class Program
{
private static void PrintErrors(IEnumerableerrors)
{
foreach (Parser.Error error in errors)
{
if(error.Token.ID == TokenID.Eof && error.Line == -1)
{
Console.WriteLine(error.Message + "\nFile: " + error.FileName + "\n");
}
else
{
Console.WriteLine(error.Message + " in token " + error.Token.ID
+ "\nline: " + error.Line + ", column: " + error.Column
+ "\nin file: " + error.FileName + "\n");
}
}
}
private static CompilationUnitNode ParseUnit(string fileName, Listerrors)
{
Console.Write("\nParsing " + fileName);
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fs, true);
Lexer l = new Lexer(sr);
TokenCollection toks = l.Lex();
Parser p = null;
CompilationUnitNode cu = null;
p = new Parser(fileName);
cu = p.Parse(toks, l.StringLiterals);
if(p.Errors.Count != 0)
{
Console.WriteLine();
PrintErrors(p.Errors);
errors.AddRange(p.Errors);
return null;
}
return cu;
}
public static void Main(string[] args)
{
string filename = "c:\\myfile.cs";
Listerrors = new List ();
CompilationUnitNode cu = ParseUnit(filename, errors);
StringBuilder sb = new StringBuilder();
cu.ToSource(sb);
Console.WriteLine(sb.ToString());
foreach (NamespaceNode nnode in cu.Namespaces)
{
foreach (ClassNode cnode in nnode.Classes)
{
Console.WriteLine("class name: " + cnode.Name.Identifier.ToString());
foreach (FieldNode fnode in cnode.Fields)
{
foreach (QualifiedIdentifierExpression qexpr in fnode.Names)
{
sb = new StringBuilder();
qexpr.Expressions.ToSource(sb);
Console.WriteLine("Field: " + sb.ToString());
}
}
foreach (MethodNode mnode in cnode.Methods)
{
sb = new StringBuilder();
mnode.Names.ToSource(sb);
if (sb.ToString() == "InitializeComponent")
{
Console.WriteLine("Line number of InitializeComponent starting: " +
mnode.RelatedToken.Line.ToString());
int firstLine = -1;
int lastLine = -1;
foreach (StatementNode snode in mnode.StatementBlock.Statements)
{
if (firstLine == -1)
{
firstLine = snode.RelatedToken.Line;
}
lastLine = snode.RelatedToken.Line;
sb = new StringBuilder();
snode.ToSource(sb);
string line = sb.ToString();
Console.Write(snode.RelatedToken.Line.ToString() + ": " + line);
}
}
}
}
}
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
}
}
Free Visual C++ Toolkit November 18th, 2007
http://msdn.microsoft.com/visualc/vctoolkit2003/
copy nmake.exe from .net SDK into bin directory
use the shortcut to start a cmd box with the environment variables set
Blog about it
http://blogs.msdn.com/brianjo/archive/2004/04/17/115335.aspx
Manual from Microsoft about nmake.exe
review from a linux point of view:
llg.cubic.org
If you have a Visual C++ 6 IDE, just copy over the bin, lib, and include directory, and compiling works. Debugging does not.
BsDiff for Windows and .net November 18th, 2007
This program is based on the excellent unix tool bsdiff from Colin Percival.
I made some adjustments, so that it would compile in C++ mode in Dev-C++ IDE (mingw compiler), using the libbzip2 package.
This version is based on bsdiff 4.1. The difference between 4.1 and 4.2 is only in the patch program, instead of using lseek and read he now uses pread, which I find this text about it:
source
Another thing to take note of is that Linux 2.2 introduces the pread() and pwrite() system calls. These allow a process to read and write from a specified position in a file. This is similar, but not identical, to using the lseek() system call followed by an ordinary read() or write() system call. In particular, concurrent access to a file (required for asynchronous I/O (AIO) support) requires the pread() and pwrite() system calls.
In the windows version, I had to adjust the code anyway, because I am not using pipes, but keep the file open for reading. I guess the bug of the official bsdiff had to do with the concurrent access of the several forks of the program to the file. That does not happen in the windows version at all, the file is opened only once.
For questions, write to Timotheus Pokorra.
Here are the sources (including the .dev files for Dev-C++): bsdiff_win_src.zip
Here are the 2 executables: bsdiff_win_exe.zip
The code is licensed under the BSD Protection License (see the original LICENSE file in bsdiff-4.1.tar.gz).
See also Andreas John’s bsdiff for Visual C++.
May 2007: I have ported the program to Delphi.net, and with small modifications (make it a proper dll) you can use it even with C# programs. If anyone is interested in the code, I will be happy to share it. Drop me an email…
June 2007: Ok, someone has dropped me an email, and here is the delphi.net version, with all required dlls. also read the readme.txt included in the archive, and the documentation in bsdiff.pas. If you have questions, ask!
bsdiff.net.zip
Posted in Software Development | 2 Comments »
SQL2Diagram November 18th, 2007
SQL2Diagram: A sourceforge project that I am involved in; we use that program at work to keep track of our database structure, consisting of 250+ tables in several modules.
It basically parses the SQL Create Table statements and generates both HTML documentation and diagrams in XML format that can be displayed with the program Dia.
Posted in Software Development | Comments Closed