Showing posts with label Open Source on Windows. Show all posts
Showing posts with label Open Source on Windows. Show all posts

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!

Saturday, 17 November 2007

BsDiff for Windows and .net

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

Installing Java Stored Procedures on PostgreSQL 8.0 (Win)

February 2005

look at the page PL Java Website.
change the file C:\Program Files\PostgreSQL\8.0\data\postgresql.conf:
dynamic_library_path = '$libdir;C:/Program Files/PostgreSQL/8.0/pljava'
custom_variable_classes = 'pljava'
pljava.classpath = 'C:/Program Files/PostgreSQL/8.0/pljava/pljava.jar'
Set the classpath:
set CLASSPATH=%CLASSPATH%;deploy.jar;..\jdbc\postgresql-8.0.309.jdbc2.jar;pljava.jar
change into directory "Program Files\PostgreSQL\8.0\pljava" and execute
java org.postgresql.pljava.deploy.Deployer -install -database mydatabase -user somesuperuser -password mypasswd
I got the error:
java.sql.SQLException: ERROR: could not load library "C:/Programme/PostgreSQL/8.0/lib/libpljava.dll": dynamic load error
This page helped me a lot: Debugging PostgreSQL.
runas /user:postgres cmd.exe
postmaster -d 5 -D ../data/
I started postmaster in one command line box, and then psql in another DOS box. That told me that jvm.dll could not be found. Finally I realised, that the path needs to be set before the postmaster is started.

GIMP, Gaim, GTK

Install gimp 2.0 and gaim 0.79 on Windows, problems with GTK 2.4:
according to the gimpwin-users list, do this:
Install Gaim's GTK+- 2.2.4, then Gaim, then uninstall Gaim's GTK+-, and install GTK+- 2.4.1 and Gimp. Gaim should still work with GTK+- 2.4.1.
You also need to copy the file Program Files\Common Files\GTK\2.0\bin\zlib1.dll to zlib-1.dll.

Download websites with dynamically generated content (question mark in URL)

You should use the Windows version of wget, because that converts the ? nicely to the @ character.
wget http://www.somewebpage.org --recursive \
--level=5 --relative --tries=1 --convert-links