Tag Archive for 'perl'

Building Apache and Mod Perl on Mac OS X

I’ve finally had my work laptop upgraded to Leopard!!! :)

As such, I’ve just spent the last couple of days getting things all set-up nicely so that I can get on with my work. Most of the work that I do is web development orientated, and mainly using Perl and Catalyst, so an install of Apache and mod_perl is needed.

OS X does come with a complete install of Apache (even with mod_perl!) out of the box and ready to go (info on using this set-up can be found here), but I’m also working on another project that may involve the use of Jaxer, and this requires a newer build of Apache than the one shipped with Leopard. :(

Thankfully building these tools isn’t too complicated, here’s a quick dump of my notes on getting this done. Note, I’m installing them into /usr/local so that I don’t mess with any of the OS X internals that I shouldn’t be touching - this is completely removable.

First, make a work area for building:

sudo mkdir -p /usr/local/src
sudo chgrp admin /usr/local/src
sudo chmod -R 775 /usr/local/src
cd /usr/local/src

Apache

curl -O http://apache.mirror.infiniteconflict.com/httpd/httpd-2.2.11.tar.gz
tar zxvf httpd-2.2.11.tar.gz
cd httpd-2.2.11

Now here’s the big one - the Apache configuration. This compiles a heap of modules I probably don’t need, but it’s nice to have them there in case I do ever need them…

CFLAGS="-O3" CXXFLAGS="-O3" \
./configure --prefix=/usr/local/apache2 \
--enable-autoindex \
--enable-cache \
--enable-cgi \
--enable-deflate \
--enable-dir \
--enable-disk_cache \
--enable-fastcgi \
--enable-file_cache \
--enable-headers \
--enable-include \
--enable-info \
--enable-log_config \
--enable-log_forensic \
--enable-logio \
--enable-mem_cache \
--enable-mime \
--enable-mime_magic \
--enable-negotiation \
--enable-perl \
--enable-proxy \
--enable-proxy-balancer \
--enable-proxy-http \
--enable-rewrite \
--enable-speling \
--enable-status \
--enable-suexec \
--enable-userdir \
--enable-usertrack \
--enable-version \
--enable-vhost_alias \
--enable-so \
--enable-mods-shared=all

Then the standard make and install:

make
make test
sudo make install

Now to add some configuration so that Apache starts on system boot, first we need to create a startup script:

cd /System/Library/StartupItems/
sudo mkdir Apache
cd Apache
sudo touch Apache
sudo chmod a+x Apache
mate Apache

Paste this content into the file:

#!/bin/sh
 
##
# Apache HTTP Server
##
 
. /etc/rc.common
 
StartService () {
	ConsoleMessage "Starting Apache web server"
	/usr/local/apache2/bin/apachectl start
}
 
StopService () {
	ConsoleMessage "Stopping Apache web server"
	/usr/local/apache2/bin/apachectl stop
}
 
RestartService () {
	ConsoleMessage "Restarting Apache web server"
	/usr/local/apache2/bin/apachectl restart
}
 
RunService "$1"

Then a configuration file:

sudo touch StartupParameters.plist
mate StartupParameters.plist

Paste this content into the file:

{
  Description     = "Apache web server";
  Provides        = ("Web Server");
  Requires        = ("DirectoryServices");
  Uses            = ("Disks","Network Time");
  OrderPreference = "None";
}

Then reboot and open up http://localhost to make sure things have worked.

Mod Perl

This is a lot more straight forward:

cd /usr/local/src
curl -O http://perl.apache.org/dist/mod_perl-2.0-current.tar.gz
tar zxvf mod_perl-2.0-current.tar.gz
cd mod_perl-2.0.4
perl Makefile.PL MP_AP_PREFIX=/usr/local/apache2
make
make test
sudo make install

Now all you have to do is add the following line to your Apache httpd.conf (/usr/local/apache2/conf/httpd.conf) with all of the LoadModule entries:

LoadModule perl_module modules/mod_perl.so

All done! :)

Buy My Book!

Was I really involved in writing something that sounds this classy?!?!

“Modern bioinformatics encompasses a broad and ever-changing range of activities involved with the management and analysis of data from molecular biology experiments. Despite the diversity of activities and applications, the basic methodology and core tools needed to tackle bioinformatics problems is common to many projects. Building Bioinformatics Solutions provides a comprehensive introduction to this methodology, explaining how to acquire and use the most popular development tools, how to apply them to build processing pipelines, and how to make the results available through visualisations and web-based services for deployment either locally or via the Internet. The main development tools covered in this book are the MySQL database management system, the Perl programming language, and the R language for statistical computing. These industry standard open source tools form the core of many bioinformatics projects, both in academia and industry. The methodologies introduced are platform independent, and all the examples that feature have been tested on Windows, Linux and Mac OS. This advanced textbook is suitable for graduate students and researchers in the life sciences who wish to automate analyses or create their own databases and web-based tools. No prior knowledge of software development is assumed. Having worked through the book, the reader should have the necessary core skills to develop computational solutions for their specific research programmes. The book will also help the reader overcome the inertia associated with penetrating this field, and provide them with the confidence and understanding required to go on to develop more advanced bioinformatics skills.”

The book that I am a co-author on, Building Bioinformatics Solutions is shortly going to be available on Amazon (UK) and Amazon (US) as well as other countries.

If you’re looking for an introduction to some of the tools used in the field of Bioinformatics (programming, databases, data analysis) or even just looking for a general introduction to Perl programming, MySQL or R why not check it out. :)

Still here and after more?!?! Why not head on over to bixsolutions.net - the companion site for the book, and take a peek at what’s on offer.

Now get off my lawn! ;)

Ack, a Grep Replacement

Ack is a grep alternative, written in pure Perl, using Perl’s regular expressions to do your searches (just one of the long list of reasons to use this over grep). I think i’ll be using this then…

ack is a tool like grep, aimed at programmers with large trees of heterogeneous source code. ack is written purely in Perl, and takes advantage of the power of Perl’s regular expressions.

via

(0)

Adding/Deleting Rows in TableKit Tables Revisited

TableKit is a great javascript library for making your HTML tables fully editable. However, one problem is that you can’t add or delete rows from the tables…

I came up with a solution to this not so long ago, but it still had a problem - TableKit caches the tables on loading, so after we update the table body (adding or deleting a row) the sorting and editing of the table is completely screwed! :( However, with a little more work, and some help from one of the guys in the office - we’ve finally got this cracked! :)

Continue reading ‘Adding/Deleting Rows in TableKit Tables Revisited’

Visualizing Your DBIC Schema

What a great idea - will give this a bash next week…

If you want a somewhat pretty picture of your DBIC schema (with relationships drawn, of course), install GraphViz, SQL::Translator, and DBICx::Deploy from the CPAN, and then run:

$ dbicdeploy -Ilib MyApp::Schema ~/graphs GraphViz

~/graphs will then contain a .sql file that is actually a png of your schema. Rename it and see your schema in your favorite png viewing application.

via

Remove Case-Sensitivity in Oracle

Oracle is a great RDBMS, but the fact that searches against the database are case-sensitive can be a pain in the butt. Here’s how you can make searches case-insensitive…

Continue reading ‘Remove Case-Sensitivity in Oracle’

Adding/Deleting Rows in TableKit Tables

This post has now been updated. Please head over to the new post for something better…

Following on from my previous post on how to integrate the excellent TableKit into your Catalyst webapp (to make your data tables dynamically editable), here’s how i’ve gone about adding ajax inserts and deletes so that you can add and remove data rows in your tables.1

Continue reading ‘Adding/Deleting Rows in TableKit Tables’


  1. You’ll need the code from the previous post to follow along. 

Some Useful Catalyst Tips

Found this small selection of tips that can come in use whilst working with Catalyst…

read more

(0)

Making Editable Tables With Catalyst and TableKit

Catalyst is an MVC web-development framework for Perl, very similar in concepts, ideas (and even some of the implementation) to Ruby on Rails. I’m using Catalyst a lot in my job now, and one of the first challenges that i’ve had to go through is making dynamically editable tables for some of the views we are using (in other words, Ajax driven edit-in-place tables).

Following a short Google, there seemed to be only two ready-made options I could see: one, using the Catalyst controller module Catalyst::Controller::ROSE::EIP; or two, by integrating and using the stand-alone javascript package TableKit.

Continue reading ‘Making Editable Tables With Catalyst and TableKit’