Thursday, March 20, 2008

Mediawiki on .NET - not just yet

Task of the day - run MediaWiki, the engine behind Wikipedia using .NET Phalanger project. Easier said then done.

Result so far: PHP5 is not supported by Phalanger, latest build can't even process "require()" PHP call. Waiting for the newer release...

Software
  • IIS with ASP.NET enabled
  • Visual Studio 2008 pro
  • Phalanger
  • MediaWiki source code
  • MySQL
Issues
  • The latest stable Phalanger build - March 2008 official release - is broken. It fails on
    require_once( "$preIP/includes/WebStart.php" );
    Unfortunately, Phalanger team does not have nightly builds setup yet, and building it is not as simple as I was hoping. IMHO, continuous integration is the key for this kinds of projects.
  • Beta 4 (2007) does not support VS2008, and does not implement any of the PHP5 features. I don't know if the final release has PHP5 support, but b4 definitely does not support the new XML DOM objects. I guess it should be possible to use older MediaWiki release for PHP4, but I haven't tried that yet.
Version-updated configuration file i used (taken from this forum post)

<configuration>

<phpNet>
<classLibrary>
<add assembly="PhpNetMySql, Version=2.0.0.0, Culture=neutral, PublicKeyToken=2771987119c16a03" section="mysql" />
<add assembly="php_curl.mng, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4ef6ed87c53048a3" section="curl" />
<add assembly="php_exif.mng, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4ef6ed87c53048a3" section="exif" />
<add assembly="php_gd2.mng, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4ef6ed87c53048a3" section="gd2" />
<add assembly="php_domxml.mng, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4ef6ed87c53048a3" section="domxml" />
<add assembly="php_xml.mng, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4ef6ed87c53048a3" section="xml" />
<add assembly="php_mbstring.mng, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4ef6ed87c53048a3" section="mbstring" />
</classLibrary>

<compiler>
<!-- Whether to compile scripts in debug mode. -->
<set name="Debug" value="true" />
</compiler>

<error-control>
<set name="ReportErrors" phpName="error_reporting">
<remove value="Warning,Notice,Strict"/>
</set>
</error-control>

<globalization>
<!--
Encoding used for converting source files to Unicode and for run-time binary data conversions.
The value should be one of the identifiers of the code-page supported by Windows OS.
These include e.g. values "Latin1", "Latin2", "Windows-1250" etc
An empty value means the default code-page used by OS used.
Option has application scope and cannot be changed in application sub-directories.
-->
<set name="PageEncoding" value="Windows-1250" />
</globalization>
</phpNet>

<system.web>
<!-- Encoding used by web server to encode output data sent to the client. -->
<globalization responseEncoding="Windows-1250" />
</system.web>

</configuration>

Wednesday, March 19, 2008

Building AnkhSVN

Random impulses create random results... This time the impulse was to build AnkhSVN. After talking on IRC #ankhsvn channel, jeremyw and other developers (thanks!!!) gave me some info to get up and running directly from Visual Studio.

Required software (in parenthesis - the versions I used)
Steps to get up and running
  • Download AnkhSVN source code from http://ankhsvn.open.collab.net/svn/ankhsvn/trunk User name "guest", no password.
  • Open src\AnkhSvn.2008.sln
  • Make Ankh.Package a startup project.
  • Right-click Ankh.Package and click "Properties".
  • Choose the "Debug" tab on the left.
  • Under "Start Action", select "start external application" and choose your devenv.exe.
  • For "Start Options", use "/rootSuffix Exp /RANU" without the quotes
  • Now can Run AnkhSVN by hitting F5
Enjoy!




As for the old package.py, it apparently no longer works nor is supported.
Here I will just keep my original notes, ignore...


* Python (2.5.2 - msi)
* Python for Windows Extensions (pywin32-210.win32-py2.5.exe)
* Perl (ActivePerl 5.10.0.1002)

* Made sure the path to python is set in the PATH env variable (c:\python25\)
* Run Visual Studio 2008 Command Prompt
* Executed the build with "package.py -d 2008" command from c:\projects\ankhsvn dir.

Kept getting this weird error from python:
Staging APR, APR-UTIL and APR-ICONV...
Traceback (most recent call last):
File "C:\projects\ankhsvn\package.py", line 1298, in
build_berkeley_db()
File "C:\projects\ankhsvn\package.py", line 257, in build_berkeley_db
print "Building Berkeley DB..."
IOError: [Errno 9] Bad file descriptor

Apparently, console output descriptor was getting corrupted somehow, so as a temp workaround I commented out all the print statements (ugly, I know): "print " --> "pass #print "

Rerunning it produced yet another error:
Traceback (most recent call last):
File "C:\projects\ankhsvn\package.py", line 1298, in
build_berkeley_db()
File "C:\projects\ankhsvn\package.py", line 264, in build_berkeley_db
convert_dsw_to_sln(bdb_dsw_file)
File "C:\projects\ankhsvn\package.py", line 638, in convert_dsw_to_sln
vsdte.ExecuteCommand("File.SaveAll")
File "", line 3, in ExecuteCommand
File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line 258, in _ApplyTypes_
result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes) + args)
pywintypes.com_error: (-2147418111, 'Call was rejected by callee.', None, None)
After getting stuck here I found out that package.py is now obsolete and should not be used :)))