<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0"><id>http://www.hampson.ca/blog/</id><title>Hampson.ca</title><updated>2010-03-28T14:11:10Z</updated><link href="http://www.hampson.ca/blog/" rel="alternate" /><author><name>Luke</name></author><author><name>Ryan</name></author><generator version="r33" uri="http://code.google.com/p/django-atompub/">django-atompub</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/Hampson" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="hampson" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry><id>http://www.hampson.ca/blog/2010/03/28/installing-gd2-linux-and-windows/</id><title type="html">Installing GD2 on Linux and Windows</title><updated>2010-03-28T14:11:10Z</updated><published>2010-03-28T08:32:38Z</published><category term="gd2" /><category term="linux" /><category term="windows" /><link href="http://www.hampson.ca/blog/2010/03/28/installing-gd2-linux-and-windows/" rel="self" /><link href="http://www.hampson.ca/blog/2010/03/28/installing-gd2-linux-and-windows/" rel="alternate" /><content type="html">&lt;p&gt;&lt;span class="caps"&gt;PHP&lt;/span&gt;: &lt;span class="caps"&gt;GD2&lt;/span&gt; Not installed:|| File and or directory is&amp;nbsp;invalid&lt;/p&gt;

&lt;p&gt;First you may be wondering what &lt;span class="caps"&gt;GD2&lt;/span&gt; is&amp;#8230; the official explanation is
this &amp;#8220;&lt;span class="caps"&gt;GD&lt;/span&gt; is an open source code library for the dynamic creation of
images by programmers.&amp;#8221;
If you have ever come across this error it is probably because you
have not installed the &lt;span class="caps"&gt;GD2&lt;/span&gt; extension in &lt;span class="caps"&gt;PHP&lt;/span&gt; when you first setup your
server. So I will let you know how install it in Linux and&amp;nbsp;Windows.&lt;/p&gt;

&lt;p&gt;Under Linux:
The easiest way is to use your package manager to install it.
For example in Debian&amp;#8230; &amp;#8220;apt-get install php5-gd&amp;#8221;
or Redhat&amp;#8230; &amp;#8220;&amp;#8212;with-libdir=lib64 &amp;#8212;with-gd  &amp;#8212;with-jpeg-dir&amp;nbsp;&amp;#8212;with-png-dir&lt;/p&gt;

&lt;p&gt;Under Windows:
You will have to download the .tar archive because the binary doesn&amp;#8217;t
include any extensions.
So first make sure that in the &amp;#8220;C:\&lt;span class="caps"&gt;PHP&lt;/span&gt;\ext&amp;#8221; direct that you see
&amp;#8220;php_gd2.dll&amp;#8221; if you do not see you will have to download it. You can
obtain a copy by downloading the &lt;span class="caps"&gt;PHP5&lt;/span&gt; .tar.
Next you have to open your &amp;#8220;php.ini&amp;#8221; file search for &amp;#8220;Dynamic
Extensions&amp;#8221; and just under that point &lt;span class="caps"&gt;PHP&lt;/span&gt; to the library file like
this&amp;nbsp;&amp;#8220;extension=php_gd2.dll&amp;#8221;&lt;/p&gt;

&lt;p&gt;Note: make sure that your php.ini file is configured to look in the
&amp;#8220;C:\&lt;span class="caps"&gt;PHP&lt;/span&gt;\ext&amp;#8221; folder for the extensions. Search in the file for&amp;nbsp;&amp;#8220;extension_dir&amp;#8221;.&lt;/p&gt;

&lt;p&gt;And there you have it you now have full &lt;span class="caps"&gt;GD2&lt;/span&gt; support for &lt;span class="caps"&gt;PHP&lt;/span&gt;. You can
now resize, scale, flip images on the&amp;nbsp;fly.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/qGiArlF7xz3sHEfGW6Y87h-9E0o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qGiArlF7xz3sHEfGW6Y87h-9E0o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/qGiArlF7xz3sHEfGW6Y87h-9E0o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qGiArlF7xz3sHEfGW6Y87h-9E0o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.hampson.ca/blog/2009/11/05/python-aix-61/</id><title type="html">Python on AIX 6.1</title><updated>2009-11-06T13:23:24Z</updated><published>2009-11-05T00:00:00Z</published><category term="aix" /><category term="python" /><link href="http://www.hampson.ca/blog/2009/11/05/python-aix-61/" rel="self" /><link href="http://www.hampson.ca/blog/2009/11/05/python-aix-61/" rel="alternate" /><content type="html">To start, I&amp;#39;m not an &lt;span class="caps"&gt;AIX&lt;/span&gt; expert. I&amp;#39;m just a hobbiest that wanted to get a python/django/apache/mysql (db2 down the road) environment  work in &lt;span class="caps"&gt;AIX&lt;/span&gt;.
&lt;br/&gt;

&lt;br/&gt;
Installing python:
&lt;br/&gt;
Download and compile the latest python source.
&lt;br/&gt;

&lt;br/&gt;
# cd ~/
&lt;br/&gt;
# wget http://www.python.org/ftp/python/2.6.4/Python-2.6.4.tgz
&lt;br/&gt;
# gunzip Python-2.6.4.tgz
&lt;br/&gt;
# tar -xvf Python-2.6.4.tgz
&lt;br/&gt;
# cd Python-2.6.4
&lt;br/&gt;
# export &lt;span class="caps"&gt;PATH&lt;/span&gt;=/usr/bin:/usr/vacpp/bin
&lt;br/&gt;

&lt;br/&gt;
for 32bit:
&lt;br/&gt;
# ./configure
&lt;br/&gt;

&lt;br/&gt;
for 64bit:
&lt;br/&gt;
# ./configure &amp;#8212;with-gcc=&amp;#8221;xlc_r -q64&amp;#8221; &amp;#8212;with-cxx=&amp;#8221;xlC_r -q64&amp;#8221;  &amp;#8212;disable-ipv6 &lt;span class="caps"&gt;AR&lt;/span&gt;=&amp;#8221;ar -X64&amp;#8221;
&lt;br/&gt;

&lt;br/&gt;
# make
&lt;br/&gt;
# su
&lt;br/&gt;
# make install
&lt;br/&gt;

&lt;br/&gt;

&lt;br/&gt;
If no problems crept up, the python executable should be available here:
&lt;br/&gt;
/usr/local/bin/python
&lt;br/&gt;

&lt;br/&gt;

&lt;br/&gt;
The apache installation to next to&amp;nbsp;come!
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/N79XE9_TNI44eVf_sf5QfFM0Lig/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/N79XE9_TNI44eVf_sf5QfFM0Lig/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/N79XE9_TNI44eVf_sf5QfFM0Lig/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/N79XE9_TNI44eVf_sf5QfFM0Lig/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.hampson.ca/blog/2009/09/30/html-pdf-django/</id><title type="html">HTML to PDF in Django</title><updated>2009-09-30T22:54:38Z</updated><published>2009-09-30T22:52:19Z</published><category term="django" /><category term="pdf" /><category term="pisa" /><category term="reportlab" /><link href="http://www.hampson.ca/blog/2009/09/30/html-pdf-django/" rel="self" /><link href="http://www.hampson.ca/blog/2009/09/30/html-pdf-django/" rel="alternate" /><content type="html">&lt;p&gt;I&amp;#8217;ve been involved in a number of project where I need to create pdf reports from a set of data using the Django framework. The easiest way for me to do this is generate the pdf directly from&amp;nbsp;html.&lt;/p&gt;

&lt;p&gt;I will provide a list of software required, and how to program a django view to generate the&amp;nbsp;pdf.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s the software you&amp;#8217;ll&amp;nbsp;need:&lt;/p&gt;

&lt;p&gt;pisa:&amp;nbsp;http://pypi.python.org/pypi/pisa/&lt;/p&gt;

&lt;p&gt;ReportLab:&amp;nbsp;http://www.reportlab.org/downloads.html&lt;/p&gt;

&lt;p&gt;html5lib:&amp;nbsp;http://code.google.com/p/html5lib/downloads/list&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s a simple view to generate the&amp;nbsp;pdf.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#view.py

import cStringIO as StringIO
import ho.pisa as pisa
from django.http import HttpResponse
from django.template.loader import render_to_string

def my_view(request, *args, **kwargs):

    html = render_to_string('some_template.html', RequestContext(request, {
        'title': 'This is a test PDF document'
    }))
    result = StringIO.StringIO()
    pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("ISO-8859-1")), result)
    response = HttpResponse(result.getvalue(), mimetype='application/pdf')
    response['Content-Disposition'] = 'attachment; filename=document.pdf'
    return response
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Enjoy&lt;/p&gt;

&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cokZ_XFLPo3YhcJ8EPj5cRyOg20/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cokZ_XFLPo3YhcJ8EPj5cRyOg20/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/cokZ_XFLPo3YhcJ8EPj5cRyOg20/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cokZ_XFLPo3YhcJ8EPj5cRyOg20/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.hampson.ca/blog/2009/09/08/setup-git-centos-53-and-make-public-over-ssh/</id><title type="html">Setup git on Centos 5.3, Centos 5.4 and make public over ssh</title><updated>2009-10-22T16:58:13Z</updated><published>2009-09-08T21:56:42Z</published><category term="centos" /><category term="git" /><category term="linux" /><link href="http://www.hampson.ca/blog/2009/09/08/setup-git-centos-53-and-make-public-over-ssh/" rel="self" /><link href="http://www.hampson.ca/blog/2009/09/08/setup-git-centos-53-and-make-public-over-ssh/" rel="alternate" /><content type="html">&lt;p&gt;update oct 22. 2009: 
This method also works in Centos 5.4. I&amp;#8217;ll post the epel think below once they&amp;#8217;re&amp;nbsp;available&lt;/p&gt;

&lt;p&gt;I setup git on a Centos 5.3 server the other day, accessible over ssh. Here are the steps I followed to get things up and&amp;nbsp;running.&lt;/p&gt;

&lt;p&gt;Centos&amp;#8217;s yum repository does not have git in it, so setup fedoras epel (Extra Packages for Enterprise Linux)&amp;nbsp;repo.&lt;/p&gt;

&lt;p&gt;i386:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;x86_64:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As root run this&amp;nbsp;command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    yum install git
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next I&amp;#8217;m going to setup a new repository and make it accessible over&amp;nbsp;ssh:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    mdkir /home/username/repo #create directory for new repository

    cd /home/username/repo

    git init
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We&amp;#8217;ll create a dummy file to get started. If you trying to clone (checkout) an empty git repository, you&amp;#8217;ll just get&amp;nbsp;errors:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    touch firstfile
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Add all files in this directory to your git&amp;nbsp;repository:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    git add .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Commit the changes you&amp;#8217;ve made to the&amp;nbsp;repo:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    git commit
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next we&amp;#8217;ll create a clone of the repo and configure it to be&amp;nbsp;public:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    cd /home/username

    git clone --bare ./repo repo.git

    touch  repo.git/git-daemon-export-ok
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;you can copy your repo.git directory to where you want to make the repo&amp;nbsp;public&lt;/p&gt;

&lt;p&gt;Now we want to checkout a copy of the new repository from a different&amp;nbsp;server.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    git clone ssh://yourserveraddress/home/username/repo.git
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You should now have a new directory labeled repo which contains the file&amp;nbsp;&amp;#8216;firstfile&amp;#8217;&lt;/p&gt;

&lt;p&gt;To add a new file to the&amp;nbsp;repo:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    cd repo

    touch secondfile

    git add .

    git commit
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now we want to submit the changes back to the git&amp;nbsp;server:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    git push
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You&amp;#8217;ll be prompted for your&amp;nbsp;password.&lt;/p&gt;

&lt;p&gt;Enjoy.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/fRZkCB_toC5YqS0a9AGTQCLuLW0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fRZkCB_toC5YqS0a9AGTQCLuLW0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/fRZkCB_toC5YqS0a9AGTQCLuLW0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fRZkCB_toC5YqS0a9AGTQCLuLW0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.hampson.ca/blog/2009/06/15/add-confirm-dialog-link-jquery/</id><title type="html">Add confirm dialog to a link with jQuery</title><updated>2009-06-23T11:21:35Z</updated><published>2009-06-15T17:39:59Z</published><category term="javascript" /><category term="jquery" /><link href="http://www.hampson.ca/blog/2009/06/15/add-confirm-dialog-link-jquery/" rel="self" /><link href="http://www.hampson.ca/blog/2009/06/15/add-confirm-dialog-link-jquery/" rel="alternate" /><content type="html">&lt;p&gt;Here&amp;#8217;s another simple jQuery snippet I like to add to my projects. This will allow you to present a javascript confirm dialog when a user clicks on a link or a submit button with a confirm attribute it. The value of the confirm attribute will be the text displayed in the confirm dialog box. I often use this for delete button so the user has a chance to back&amp;nbsp;out.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$(function() {
    $("a[confirm], input[type=submit][confirm]").click(function() {
        conf = confirm($(this).attr("confirm"));
        if(!conf)
            return false;
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/mAvxMSxJ1ty4QjAnJyPUmjgEI2I/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mAvxMSxJ1ty4QjAnJyPUmjgEI2I/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/mAvxMSxJ1ty4QjAnJyPUmjgEI2I/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mAvxMSxJ1ty4QjAnJyPUmjgEI2I/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content></entry></feed>

