How to install wxPython 2.9.4 on Fedora

Install the dependencies

sudo yum install make automake gcc gcc-c++ kernel-devel gtk2-devel gtkglext-devel gstreamer-plugins-base-devel python-devel webkitgtk

Download the source

wget http://downloads.sourceforge.net/project/wxpython/wxPython/2.9.4.0/wxPython-src-2.9.4.0.tar.bz2
tar xvjf wxPython-src-2.9.4.0.tar.bz2

Download and apply the wxPython 2.9.4.1 patch

http://downloads.sourceforge.net/project/wxpython/wxPython/2.9.4.0/wxPython-src-2.9.4.1.patch
patch -p 0 -d wxPython-src-2.9.4.0/ < wxPython-src-2.9.4.1.patch

Configure and Build wxWidgets

cd ~/wxPython-src-2.9.4.0/bld
../configure --prefix=/usr/local

Build wxPython

sudo python build-wxpython.py --build_dir=../bld --wxpy_installdir=/usr --installdir=/usr

Set your PYTHONPATH variable to ~/wxPython-src-2.9.4.0/wxPython
Set your LD_LIBRARY_PATH to ~/wxPython-src-2.9.4.0/bld/lib

Note: This setup has been tested to work on Fedora 17.

Zend Framework quickstart – Part 1

Here are the links that I followed while getting started with the Zend Framework:

So far, Zend Framework looks pretty much like CodeIgniter in a way that I can use loosely-coupled component libraries at will and I have a lot of control over the architecture. It also provides an MVC implementation similar to CodeIgniter.

When I was reading the links above, I noticed that some of the details were missing in order to successfully complete a small project using Zend Framework without pulling my hair a couple of times. So I wrote my own so I can just look this post up if ever I forget some of the important details and perhaps some other ZF n00b out there can benefit from this post as well. Here it is…

Get a copy of the Zend Framework

I downloaded the latest version of Zend Framework from the Latest Release of ZF page instead of installing Zend Server (which contains Zend Framework with a complete PHP stack) on my development machine since I don’t have a production server where I can install the Zend Server, because Zend Server will replace your Linux distro’s PHP that may cause conflict between RPM packages. I’d rather setup my development environment similar to the setup of the servers that I have right now so don’t have to worry much about package incompatibilities during deployment.

In the Latest Release of ZF page, choose the full framework which doesn’t require registration. In my case, I downloaded Zend Framework 1.10.8 Full (released 2010-08-25). Extract the contents of the archive. In my (Fedora) Linux machine, I extracted it under /home/randell/ZendFramework-1.10.8. In Windows, I extracted it under C:/ZendFramework-1.10.8.

Setup the zf command line tool

We’ll be using the zf command line tool to create our new project. For that, we need to properly setup our environment variables for both PHP and the zf tool. The zf command line tools (zf.bat for Windows and zf.sh for Unix-based OSes) are located in the /bin directory of your Zend Framework installation.

Create the project

After setting-up the command line tool, we can now create our project. From the command line, navigate to the directory where we will create your project. In my Linux machine, I created it under /var/www/html/. In Windows, I created it under C:/xampp-1.7.1/htdocs. Both directories is where I run all my other PHP projects. To create the project, execute the following command:

zf create project quickstart

Running this command will create your basic site structure, including your initial controllers and views. Both in Windows and in Linux, you could get a message similar to this after executing the command:

Note: This command created a web project, for more information setting up your VHOST, please see docs/README

The tree structure of the generated project looks something like this:

quickstart
|-- application
|    |-- configs
|    |    `-- application.ini
|    |-- controllers
|    |    |-- ErrorController.php
|    |    `-- IndexController.php
|    |-- models
|    |-- views
|    |    |-- helpers
|    |    |-- scripts
|    |         |-- error
|    |         |    `-- error.phtml
|    |         |-- index
|    |              `-- index.phtml
|    `-- Bootstrap.php
|-- docs
|    `-- README.txt
|-- library
|-- public
|    |-- .htaccess
|    `-- index.php
|-- tests
|    |-- application
|    |    `-- bootstrap.php
|    |-- library
|    |    `-- bootstrap.php
|    `-- phpunit.xml
`-- .zfproject.xml

Don’t worry about the contents of those files yet because I will try to explain the important ones as detailed as possible in my next post. For now, let’s just get the basic setup up and running.

Next step is to copy the Zend library (library/Zend)from our extracted Zend Framework archive to the library directory of our project. We’re doing this so that our project has a copy of the Zend Framework whenever we decide to deploy it on a different server.

Create a virtual host

Let’s modify our httpd.conf and hosts files using any text editor.

Append the following lines at the end of httpd.conf file (/etc/httpd/conf/httpd.conf and /etc/hosts in Fedora):

NameVirtualHost *:80

&lt;VirtualHost *:80&gt;
    ServerName quickstart.local
    DocumentRoot /var/www/html/quickstart/public

    SetEnv APPLICATION_ENV "development"

    &lt;Directory /var/www/html/quickstart/public&gt;
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    &lt;/Directory&gt;
&lt;VirtualHost&gt;

DocumentRoot specifies the public subdirectory of our project (only files under that directory can ever be served directly by the server). Take note of the public. Most people tend to forget that part, especially when coming from other frameworks where the index.php doesn’t reside on a directory other than the root. The SetEnv directive sets an environment variable for our virtual host and will be picked up by index.php (in the public directory) and set the APPLICATION_ENV constant for our application.

Append the following to the hosts file (/etc/hosts in Fedora and C:/WINDOWS/system32/drivers/etc/hosts in Windows XP):

127.0.0.1 quickstart.local

Then restart our server. We can now access our application from http://quickstart.local and see something like this from our browser:

Welcome to the Zend Framework

Welcome to the Zend Framework

Got questions or suggestions about this post? Feel free to post a comment or drop me an email.

Setup Zend Command Line Console Tool in Fedora Linux

The CLI, or command line tool (internally known as the console tool), is currently the primary interface for dispatching Zend_Tool requests. With the CLI tool, developers can issue tooling requests inside the “command line windows”, also commonly known as a “terminal” window.

Some examples of actions that you can perform with the Zend Framework Command Line Console Tool (a.k.a. Zend CLI Tool) are the following:

zf create project path-to-project name-of-profile file-of-profile
zf create model name module
zf create view controller-name action-name-or-simple-name

Assuming that we have already downloaded and extracted the Zend Framework archive, we would want to be able to issue the zf command from the command line from any directory. It means we need to make <path/to/zend>/bin/zf.sh reachable from our system path, wherein zf.sh is the *nix-specific wrapper. This wrapper is responsible for finding the proper php.exe and zf.phpzf.php in turn is the responsible for handling understanding our environment, constructing the proper include_path, and passing what is provided on the command line to the proper library component for dispatching.

Issuing the command

echo $PATH

tells me that /home/randell/bin is part of the PATH environment variable, so we simply need to create a link from that location to zf.sh.

To do that, issue a command similar to this (replacing my username with your username, of course):

ln -s /home/randell/lib/ZendFramework-1.10.8/bin/zf.sh /home/randell/bin/zf

To test it, execute the following command:

zf show version

It should print a message similar to

Zend Framework Version: 1.10.8

We can also just execute zf to check out the other actions you can perform with the Zend Tool.

Install HandBrake on Fedora 12

Yes, I’m still using Fedora 12 even though there’s already Fedora 13 and Fedora 14 alpha release. It’s not easy for me to upgrade my OS since a lot of my projects depend on my current environment. I’ll probably try out Fedora 13 or 14 when I already have a spare machine so I can gradually migrate my projects to that machine one by one.

Anyway, just a quick update on installing HandBrake on Fedora. The last time I installed HandBrake on Fedora 11, there were several steps that would discourage linux newbies from proceeding. This time, it’s as easy as downloading and double-clicking the installer (.rpm) from the HandBrake download page for Fedora. Make sure to download the GUI build.

HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded video transcoder, available for MacOS X, Linux and Windows.

update.locale file doesn’t exist in either the XCurProcD or GreD directories

I have been getting this error from my Firebug’s console:

[Exception… “update.locale file doesn’t exist in either the XCurProcD or GreD directories” nsresult: “0x80520012 (NS_ERROR_FILE_NOT_FOUND)” location: “JS frame :: file:///usr/lib64/xulrunner-1.9.1/components/nsUpdateService.js :: getLocale :: line 608” data: no]
file:///usr/lib64/xulrunner-1.9.1/components/nsUpdateService.js
Line 608

At first I thought it was some mysterious bug from one of my projects, but then I noticed that it appears on the simplest web pages that I’m working on, so I figured out that the problem is coming from either Firefox or Firebug. I found a solution here. The solution simply says to execute the following command (as root):

touch /usr/lib64/firefox-3.5/update.locale

True enough, my Firefox application directory is missing the file. I also checked my Firefox installation in Windows XP to check the contents of the file, which contains en-US so I appended the same content.

The error no longer appears so it probably solved the problem. I’ll just update this post if the error appears again.

Note: This error appeared in Firefox 3.5.11 on Fedora 12.

Convert CHM to PDF in (Fedora) Linux

I’ve been looking for a way to print CHM files in (Fedora) Linux, since my CHM file viewer, chmsee, doesn’t have a print option (and probably all other CHM file viewers as well). Searching for CHM to PDF converters in Fedora led me to chm2pdf.

chm2pdf has a couple of requirements:

  • chmlib
  • pychm
  • htmldoc

To install the necessary packages, execute this command in your terminal as root:

yum install chmlib python-chm htmldoc

To install chm2pdf:

  1. Download the archive from it’s Google Code project hosting page.
  2. Extract the archive
  3. As root, type
    python setup.py install

    from the directory extracted from the archive

I got the following message after running the last command:

running install
running build
running build_scripts
creating build
creating build/scripts-2.6
copying and adjusting chm2pdf -&gt; build/scripts-2.6
changing mode of build/scripts-2.6/chm2pdf from 644 to 755
running install_scripts
copying build/scripts-2.6/chm2pdf -&gt; /usr/bin
changing mode of /usr/bin/chm2pdf to 755
running install_egg_info
Writing /usr/lib/python2.6/site-packages/chm2pdf-0.9-py2.6.egg-info

I tested the installation with the following command and it produced the PDF file:

chm2pdf --webpage somefile.chm

Install SQLite Database Browser on Fedora

What is SQLite Database Browser?

From the SQLite Database browser home page:

SQLite Database Browser is a freeware, public domain, open source visual tool used to create, design and edit database files compatible with SQLite. It is meant to be used for users and developers that want to create databases, edit and search data using a familiar spreadsheet-like interface, without the need to learn complicated SQL commands. Controls and wizards are available for users to:

  • Create and compact database files
  • Create, define, modify and delete tables
  • Create, define and delete indexes
  • Browse, edit, add and delete records
  • Search records
  • Import and export records as text
  • Import and export tables from/to CSV files
  • Import and export databases from/to SQL dump files
  • Issue SQL queries and inspect the results
  • Examine a log of all SQL commands issued by the application

Continue reading