Installing Trac 1.0.1 on Windows 8.1 + configuring Subversion repository

Submitted by Jochus on Sun, 03/08/2014 - 00:02 | Posted in: Windows
Posted in


Introduction

To install Trac 1.0.1 on a Windows 8.1 installation, I used the following dependencies:

Apache HTTPD 2.2.25 (32bit)
Python 2.7.8 (32bit)
setuptools 5.4.1
mod_wsgi 3.5.ap22.win32-py2.7 (32 bit)
Subversion 1.8.9 (r1591380)
Python Subversion bindings svn-win32-1.8.9
  • Be sure to keep the same architecture (32 or 64 bit) for all components. Don't mix them up, as you will get conflicts. In this tutorial, I used 32 bit installers.
  • I assumed Subversion is already installed, and your repository is located on the same machine of the Trac server (repository created in C:\SVN). Authentication is performed based on HTTPD Basic auth file (file located at C:\SVN\conf\svn-auth-file)


Installing Python

  • Python is required to startup Trac as Trac is built on top of Python
  • Download from: https://www.python.org/download/
  • Choose version: 2.7.8 - 32 bit
  • When installing, make sure you select: Install for all users, and not the current user. If you don't do this, the Apache service will not be able to access Python eggs
  • When installing, also check Add python.exe to Path
  • After installation, restart your machine so the new system variable Path will be in memory. Otherwise, you cannot use the python.exe command from whatever folder you're currently working in


Installing setuptools

  • setuptools is required to install a Python package like Trac. setuptools will have a look at the dependencies, and will automatically download/install the dependencies for you (e.g.: Genshi)
  • Download from: https://pypi.python.org/pypi/setuptools
  • Choose version: 5.4.2 - Windows 7
  • Download the file ez_setup.py
  • When downloaded, double click the file to install setuptools
  • Add C:\Python27\Scripts to Path variable
  • After installation, restart your machine so the new system variable Path will be in memory. Otherwise, you cannot use the easy_install.exe command from whatever folder you're currently working in (and also later on trac-admin.exe)


Installing trac

  • Open command prompt and type: $ easy_install trac
  • The command prompt will install Trac and its dependencies. At the end, a message Congratulations! will be visible in the command prompt


Create trac environment

  • Open command prompt and type: $ trac-admin C:\Trac initenv
  • Follow steps to create your project


Configuring mod_wsgi

  • mod_wsgi is used to connect Trac with Apache HTTPD. In this case, you won't need to run Trac on a specific port like 8000
  • Download from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi
  • Choose version: mod_wsgi‑3.5.ap22.win32‑py2.7.zip
  • Unzip and move contents to C:/Program Files/Apache Software Foundation/Apache2.2/modules/. Make sure the Apache service can read this .so file
  • Create Apache HTTPD directories by executing the command: $ trac-admin C:\Trac deploy C:\Temp
  • Copy C:\Temp\cgi-bin and C:\Temp\htdocs to C:\Trac
  • Enable module mod_wsgi.so in Apache HTTPD by adding the following the line in the load modules section: LoadModule wsgi_module modules/mod_wsgi.so
  • Add the following configuration at the bottom of the httpd.conf file
    WSGIScriptAlias /trac C:\Trac\cgi-bin\trac.wsgi               # Process Trac requets
    Alias /trac/chrome/common C:\Trac\htdocs\common               # Serve static content directly from disk (don't send to .cgi script)
    Alias /trac/chrome/site C:\Trac\htdocs\site                   # Serve static content directly from disk (don't send to .cgi script)
     
    <Directory C:\Trac\cgi-bin>
        WSGIApplicationGroup %{GLOBAL}
        Order allow,deny
        Allow from all
    </Directory>
     
    <Directory C:\Trac\htdocs>
      Order allow,deny
      Allow from all
    </Directory>
     
    <Location "/trac/login">
      AuthType Basic
      AuthName "Trac"
      AuthUserFile C:\SVN\conf\svn-auth-file
      Require valid-user
    </Location>
  • Restart Apache HTTPD and check if you can access: http://localhost/trac/
Remark on choosing the version of mod_wsgi. Don't use the ap24 version. I cannot explain why, but it gave me the following exception when starting up Apache HTTD. By downgrading to ap22, the exception disappeared:

Cannot load C:/Program Files/Apache Software Foundation/Apache2.2/modules/mod_wsgi.so into server: The specified module could not be found


Providing a user admin permissions

  • It would be better to create groups, but for this simple tutorial, I use a command to make 1 user admin: $ trac-admin C:\Trac permission add #USERNAME# TRAC_ADMIN


Configuring Subversion as a repository (browser)

  • To be able to let Trac communicate with Subversion, you need the Python SVN bindings
  • Download from: http://alagazam.net/
  • Choose version: svn-win32-1.8.9_py27.zip
  • Extract contents of ZIP file to C:\Python27\Lib\site-packages
  • Create a components section add the following lines to enable the SVN bindings:
    [components]
    tracopt.versioncontrol.svn.* = enabled
  • Login to Trac with an admin account and go to Admin > Repositories and add your SVN repository
  • Open a command prompt and execute the following command to resync previous changesets: $ trac-admin C:\Trac repository resync #REPOSITORYNAME# (required for Timeline)
  • You should also set up a post-commit hook on the repository to keep Trac in sync with your Subversion repository (required for Timeline). Go to C:\SVN\hooks and create a file post-commit.bat (copy it from the existing template). Add the following line at the bottom of the script: trac-admin C:\Trac changeset added #REPOSITORYNAME# $REV. File should look like:
    #!/bin/sh
     
    REPOS="$1"
    REV="$2"
    TXN_NAME="$3"
     
    trac-admin C:\Trac changeset added #REPOSITORYNAME# $REV
  • When you now click Browse source in Trac, you should be able to see your source code. The timeline will also be updated every time you make a commit

Fixing slow queries running on SQL server using JPA (Hibernate) and jTDS

Submitted by Jochus on Thu, 01/05/2014 - 07:40 | Posted in: Java
Posted in



Some JPA queries, especially the ones with a LIKE operator, can run very slow on a SQL server using jTDS.

The issue is in the way the jTDS drivers send the parameter strings to the SQL server. Apparently Java will attempt to send the parameters Unicode by default, and SQL server will translate it to ASCII. It can take some seconds because it changes each column value to Unicode before comparing against your parameter. This means it can't take full advantage of any index on the field leading to much slower performance.

If you add the following parameter sendStringParametersAsUnicode=false to your connection string in the datasource, this conversion step can be skipped and it can speed up the performance of your queries:

jdbc:sqlserver://localhost\SQLEXPRESS;DatabaseName=TESTDB;sendStringParametersAsUnicode=false

How to disable phone number linking in Safari on an iOS device?

Submitted by Jochus on Thu, 01/05/2014 - 07:33 | Posted in: Mac
Posted in



I recently got a question from somebody who has a personal site on the web and he wanted to disable the phone number linking on his own site (which is rendered automatically in the Safari application of an iPad). I first assumed that such request could not be answered, but I came across following solution:

If you include the following meta tag at the top of your page:

<meta name="format-detection" content="telephone=no">

... phone linking will be disabled. More information can be found on the developer pages of Apple: https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/PhoneLinks/PhoneLinks.html

How to completely remove Office for Mac 2011 from you Mac OS X installation

Submitted by Jochus on Thu, 01/05/2014 - 07:26 | Posted in: Mac
Posted in



I recently had a problem with an update of Office on my Macbook Pro. The only solution was to remove everything (but really EVERYTHING) from Office for Mac. Afterwards, the installation + update went fluently.

A very good tutorial on removing Office for Mac can be found here: http://support.microsoft.com/kb/2398768

Disable FileZilla server interface from popping up on server logon

Submitted by Jochus on Thu, 01/05/2014 - 07:22 | Posted in: Windows
Posted in



When I logon to a server which is running a FileZilla server (as a service), I always get a popup which connects to the FileZilla server. It's a bit annoying as you can only disable this popup while installing the server. There's no GUI configuration to disable it after post install.

Luckily, there's a small fix in the windows registry which disables the popup, but still keeps the FileZilla server service running in the background:

  • Navigate to the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\
  • Remove FileZilla Server Interface entry