Archive for December, 2006

Trac install notes

December 31st, 2006

0. Follow the directions in various places – they work well, thus I’ll not be rewriting them.

1. Run the right version of apache 2.0.54 to 2.0.59

2. Follow the installer at http://trac.edgewall.org/wiki/Trac0.9/TracOnWindows *** Caveat – see #4

3. The URL for making the directory – because I am using Cygwin was trac/project (not trac\project) – the backslash was breaking things.

4. Mod python: http://trac.edgewall.org/wiki/TracModPython

4. Have your svn repository permissions set right. I had the error in the pic. On my system apache runs as “SYSTEM” so I had to add “SYSTEM” as a user with some rights to my repository. I used taskmgr to see what the user was.
Trac error - could not access the project/format directory
5. My viewing of php docs was not working. Google’d and see this ticket: http://trac.edgewall.org/ticket/3886
My trac.ini entry was: `php_path = “C:/Program Files/php-5.1.4-Win32/php.exe”`
6. Added some security – in the apache config, instead of `trac/project/login` I used `trac/project` so the project is not visible to the world.

Apache dies after a while

December 29th, 2006

Apache was crashing and in the error log was:

[warn] (OS 995)The I/O operation has been aborted because of either a thread exit or an application request.  : winnt_accept: Asynchronous AcceptEx failed 

The solution from here was increasing the max requests per child from 30 (I set this) to 10000.

Here is the section in `httpd.conf` that was edited.

# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum  number of requests a server process serves

ThreadsPerChild 250
MaxRequestsPerChild  10000

CVS – set up and patching

December 26th, 2006

I recently started using cvs for my web design work – because its the most popular and though subversion is improved, I’ll gain to learn CVS.

References:

http://cvsbook.red-bean.com/ – online CVS manual – excellent

http://developer.gnome.org/tools/cvs.html – more notes

http://durak.org/cvswebsites/howto-cvs/node38.html – cvswrappers file

http://www-bcl.cs.unm.edu/computers/cvs.html – notes

#####Starting things up

add this to .bashrc

export CVSROOT=/home/cvsuser/cvsroot

add this to .cshrc

setenv CVSROOT /home/cvsuser/cvsroot

Initialize cvs – in the directory specified by $CVSROOT

# cvs init

Import projects

# cvs import -m "vtiger codebase import" websitecom_CRM Inspiriat start

Checkout a project for editing

# cvs checkout websitecom_CRM

#####Connect to a remote CVS repository

set CVSROOT and remote shell

# export CVSROOT=":ext:user@some.remote.host.tld:/home/user/cvsrepo"
# export CVS_RSH="ssh"

#####Status commands

Log for a file – see who and related code

# cvs log foo.php

Get status of every file – quite long….

# cvs status

Show status of foo.php

# cvs status foo.php

#####Add/remove/rename files and directories

Add a file

# cvs add newfoo.php
# cvs ci -m "added newfoo.php to project" newfoo.php

Add a binary file

# cvs add -kb binary.exe
# cvs ci -m "added a binary.exe file" binary.exe

Add a directory

# cvs add subdir

Remove file

# rm file.php
# cvs remove file.php

Remove a directory

# cd dir
# rm file1 file2 file3
# cvs ci -m "removed file1 file2 file3"
# cd ..
# cvs update -P    (prune empty directories from the working copy, not the repository)  

Move a file

# mv oldname newname
# cvs remove oldname
# cvs add newname
# cvs ci -m "renamed oldname to newname" oldname newname

#####Before commit

Look at differences between checked-out and repository copy

# cvs -Q diff -c foo.php

Create a patch of these differences

# cvs -Q diff -c -u -p > newpatchfile.diff

Replace the local copy with one from the repository

# rm file.php ; cvs update file.php

#####Commit / Updates

Commit a specific file

# cvs commit -m "Added sorting by other columns" foo.php

Update your code with others contributions

# cvs update foo.php

#####After Commit

Show difference in revisions 1.1 and 1.2

# cvs diff -c -r 1.1 -r 1.2 foo.php

This command will now show little or nothing – working and repo has same copy

# cvs diff -u -p foo.php

#####Creating patches

Create a patch

# cvs diff -u -p -r 1.1 -r 1.2 foo.php > foo.php.patch

Create patch for using files not in CVS – (the -u -p outputs diff in patch format)
format: `diff -u -p oldfile newfile > patchfile`

# diff -u -p development/foo/fighter.php production/foo/fighter.php > fighter.php.patch

Apply patch to a file

# patch < patchfile

#####Binary files

CVS works fine with binary files and preserving permissions.
Format for binary files and permissions::
* Binary file: `*.jpg -k 'b'` (for a jpg file)
* Preserve permissions: `*.php -ko` (for a php file)

This is part of my cvswrappers file (in CVSROOT).

*.CLASS   -k 'b'
*.DOC   -k 'b'
*.AVI   -k 'b'
*.EAR   -k 'b
*.GIF   -k 'b'
*.PNG   -k 'b'
*.JPG   -k 'b'
*.PDF   -k 'b'
*.TAR   -k 'b'
*.WAR   -k 'b'
*.ZIP   -k 'b'
*.avi   -k 'b'
*.bin   -k 'b'
*.bz    -k 'b'
*.db    -k 'b'
*.bz2   -k 'b'
*.class   -k 'b'
*.doc   -k 'b'
*.ear   -k 'b'
*.exe   -k 'b'
*.gif   -k 'b'
*.gz    -k 'b'
*.hqx   -k 'b'
*.ico   -k 'b'
*.jar   -k 'b'
*.jpeg  -k 'b'
*.jpg   -k 'b'
*.msi   -k 'b'
*.mov   -k 'b'
*.mp3   -k 'b'
*.mpg   -k 'b'
*.pdf   -k 'b'
*.png   -k 'b'
*.ppt   -k 'b'
*.rpm   -k 'b'
*.sit   -k 'b'
*.srpm  -k 'b'
*.swf   -k 'b'
*.tar   -k 'b'
*.tbz   -k 'b'
*.tgz   -k 'b'
*.tif   -k 'b'
*.tiff  -k 'b'
*.war   -k 'b'
*.xbm   -k 'b'
*.xls   -k 'b'
*.zip   -k 'b'
*.sh      -ko
*.php      -ko
*.ini      -ko
*.txt   -ko
*.log     -ko
*.properties  -ko
*.html     -ko
*.htaccess    -ko
*.js    -ko   

Anything to add - please leave a comment. This is a work in progress.

Installing subversion

December 15th, 2006

1. If you want to use Apache 2.2.x with Trac + Subversion get 1.3.2, you’ll need this binary: http://www.tomdonovan.net/download/mod_dav_svn-1.3.2.x-w32.zip

2. http://trac.edgewall.org/wiki/TracOnWindows#Method2:UsingInstallers – follow it verbatim – does not explicitly say the obvious – get subversion command line tools – http://subversion.tigris.org/files/documents/15/35379/svn-1.4.2-setup.exe3. Python info here – http://www.imladris.com/Scripts/PythonForWindows.html

3. I did not set up Trac + Apache yet because I chose to install Subverion 1.4.2 (many bug fixes compared to 1.3.2) was used. Its some work to get Apache and TRac working am using Trac standalone – set up here

4. Until I get the Apache Trac working, I’ll use the tracd web daemon – here’s the script I use to start it -

#!/bin/bash
#
# the below command should be on one line
#
C:/Python24/python.exe c:/Python24/Scripts/tracd.py -p8000 \
c:/Python24/Scripts/trac/projects

5. Commands that work:

# mkidr c:\svn
# svn create c:\SVN\repos
# /cygdrive/c/Python24/Scripts/trac.sh
# svn import vtiger file:///c:/SVN/projects -m "Initial import"

* Note: / and \ and how they are used. the svn import wants forward slashes…

6. Security – secure a repository by editing the /conf/svnserve.conf file. Mine looks like this:

[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### and "none".  The sample settings below are the defaults.
anon-access = none
auth-access = write
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the conf directory.
### Uncomment the line below to use the default password file.
password-db = ../../Another-repo-dir/conf/accounts
### The authz-db option controls the location of the authorization

Then entries in the accounts file look like:

name = password
johnny = PaSSWerde
geri = MillWaukEE

Worpdress upgrade notes

December 9th, 2006

Cygwin is installed on this system, thus the command line work. You can do this with the command console perhaps, but I have never seen the value of learning the windows command line when unix is more mature and stable (since the late 1960′s).

1] Backup the database:
Format: `mysqldump -u -p -h > `

# mysqldump -u wpuser -pDBpass wordpress2 > wordpress-dec12.sql

2] Copy the entire wordpress folder in windows to another place as a backup.

3] Copy the zip file from here to somewhere and copy the files (not dirs) over by clicking away

4] The diff file works, but the ACL’s get broken.

# patch -p0 --dry-run < patchfile.diff

If the dry run looks good - no error/log messages then run w/o the `--dry-run` flag.

# patch -p0 < patchfile.diff

5] Added the andyblue theme and edited left-sidebar.php to include `optioncount=1` in the line that looks like this:

< ?php wp_list_cats('sort_column=name&optioncount=1&children=1'); ?>

Mochabomb is Digg proof thanks to caching by WP Super Cache