2008-04-14

create an installer dmg of a program

Open the PackageMaker program.
Click "Assist me..."
Add the files you want to install and give them a destination on the destination drive.
Select files appropriate for a Welcome page, README, license, and conclusion.
Add a bg image if so desired.



Save and move to the directory in a terminal then


$hdiutil create Subversion-1.4.3 -srcFolder ~/projects/Subversion-1.4.3.mpkg


viola!

Aquamacs and Python

Aquamacs with Python completion and ipython

  1. Install Pymacs (python setup.py install)
  2. Make sure you have pymac-services and rebox in your PATH. They install where the python binaries are.
  3. Install python-mode.el in your site-lisp (/Library/Application\ Support/Emacs/site-lisp (create if necessary))

    1. from the python mode folder copy pycomplete.py to your python site-packages (or otherwise add it to your python path.) and the .el files to your site-lisp directory

  4. Install ipython
  5. edit your .emacs

(your path may differ, as well as your mileage)


(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist (cons '("python" . python-mode) interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
(autoload 'pymacs-load "pymacs" nil t)
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(require 'pycomplete)
(setq ipython-command "/Library/Frameworks/Python.framework/Versions/Current/bin/ipython")
(require 'ipython)




2008-04-08

Mapping specific requests to a single ZEO client instance

As a follow up to Apache Round Robin for ZeoClients:

we needed to send session specific things to a single instance.

An example of why this is necessary is for collective.captcha. If the connections are being round robin-ed you get audio and image files from different instances. That is BAD. It doesn't work.

First make sure varnish doesn't cache the captcha images and audio or your captcha protected form page.
In varnish.vcl add:

# Do NOT cache captcha image, audio, request
if ( req.url ~ "/@@captcha"
|| req.url ~ "/contact-info"
) {
pipe;
}


Next we need to map a server to do our captcha stuff.
In zopeservers.map add the line:


CAPTCHA localhost:6970


I will leave it to you to think of how to creatively balance requests to the other instances. Perhaps remove teh one that does some captcha and other special work from ALL, or maybe add the other instances more than once... OK I didn't leave much, but there are probably smarter ways to do it.

Finally we need to add a rule for mapping captcha requests to the correct instance.
To the appropriate apache.conf (http.conf) add:


RewriteRule ^/(@@captcha/(audio|image)|contact-info) \
http://${zopeservers:CAPTCHA}/VirtualHostBase/http/%{SERVER_NAME}:80/msrd/VirtualHostRoot/$1 [L,P]


Don't forget to restart apache and varnish!!

Thanks to Chris Shenton for suggesting the solution.