Archive for July, 2006

-image-Mollie Ballantine

Mollie Ballantine, originally uploaded by timc3.

The newest member of our family Mollie Ballantine. She went to sleep as soon as she got to her new home, and being a Basset Hound I am sure its a pose that we will get used to!

Shes so cute!


-image-Creating with iLife

One of the things that I wanted to do when I came back from my holiday (vacation to those Americans) was to take all the footage and photos and put them in something more structured and what better way than to create a DVD with everything.  This is how I did it (if you are reading this through RSS you might want to go to the site as the structure will be better).
Jeanette and I had been to two weddings, and these would form the structure.  So I decided to tackle the first one first, but instead of using lots of different tools and creating all the graphics myself, I wanted to see how easy it would be to use the built in themes of the Apple iLife 06 product.

iLife06

Apple iLife contains several products, and for this project I decided to use iMovie HD to ingest the video from the camera, edit the video, create transistions, titles and the credits.

iMovie

Then use iDVD to create the DVD menus, image slideshows and the menus to jump straight into various parts of the movie.

iDVD
iPhoto would be used to select the images, and iTunes to select the sound track that I wanted to use.

The great thing about using Apple iLife is all the products are selfcontained, but can also interact with one another, for instance one click can take a project from iMovie straight into iDVD and setup the DVD correctly with menu to each of the Chapters created in iMovie.  That can save hours.

One thing that did set me back was the Audio stopped working on my Apple Powerbook G4, which I believe to be a Hardware issue, so I was basically operating without audio.  I don’t advise this at all, the finished product will be much better know what is going on with Audio.

This is the list of steps that I took to build my movie:

  1. Create some space on your Mac.  I needed about 20GB of space for this DVD, so if you don’t have the space then you are going to have to make some.
  2. Look through the source footage and photos and decide what you like and what you can edit out.  Even after editting, I found that my movie was 2 hours long, and the slideshow was 45 minutes.  Looking back on it, I wish I cut even more.
  3. Load all the photos that you want to use into iPhoto, this way you can easily use them in your project later.
  4. Load all the music you want into iTunes.
  5. Connect your camera to you Mac.  Firewire is the best way to do this because with iMovie launched and the camera connected you can control the camera from iMovie.
  6. Start ingesting.  This is the easy step and you just have to step back and watch as iMovie takes in the video in realtime.  One thing I like to do at this point, is not to take it in one big step but to do rough edits.  That way the video is already in smaller components and easier to deal with.  It also gives you something to do in the 2+ hours it takes to ingest, and saves time later on.
  7. Once you have ingested, all the files should be on your Mac.  Disconnect the camera, and store the tape somewhere safe.
  8. Now you can start editing the movie.  As any one that has done this before it is good to have a rough story to tell through the editing process, so first draft on paper what is going to happen.  If like me you can split things up in to chapters, all the better.  For instance, I had chapters that went like this:  Intro movie, Wedding, After Wedding, In the Hotel, Around the island, On the beach, at the nature reserve, and credits.
  9. Once I knew the general running order, I can start to create the movie.  I decided upon using one of the built in themes as I had never used them before and they looked like they could do the job well.  The nice thing about these themes is they have drop zones in which you can drop stills, motion, music and titles to further personalise you movie.  Once I had selected a theme I liked, I could then start choosing what elements of the theme I wanted to use.
  10. Firstly, I decided to create a title sequence.  I dropped the theme sequence into the time line and then started putting content into the drop zones.  I have already loaded up iPhoto and iTunes, so it is easy to navigate to pictures and start dropping stills into the drop zones.  You can even take stills from your ingested movie and drop it in here.
  11. Once this is done, iMovie will start to render the title sequence.  But this will happen in the background.  Even on my old Powerbook I could keep on working, and that I did, finding the first video I want to put in and dropping it into the timeline.  If there are sections that you don’t like in your video, you can use the tools to cut it out, crop the section of video and even paste sections around.  Its best to play around with these tools so that you get the hang off what is happening.
  12. Once you have dropped this section in, you can create chapters by dragging the chapter icon over the start of the video that you have just put in.  Naming it will insure that once you take the video to iDVD your chapter menus will be created automatically.
  13. Keep dropping video, editing the video, and cropping it.  You can play back at any time to see whether you like what you are doing.  I also put in the chapter markers at these points to know where I am.
  14. Once you have done this, you can start putting in other elements from the themes in.  These can create natural breaks between your chapters and can be used as an introduction to a new scene or area.
  15. Now you have your basic edits, you might want to disolve between them.  If you have cut up the video you can just drag transitions down inbetween the clips on the time line quite easily.  If not I found I had to cut up the clip and put transitions in. I am not a big fan of many of the transitions that I found, so I tended to use a disolve effect.

-image-Securing Debian

One thing I do when I have installed Debian is to tighten it down slightly. There are some great scripts to do this, such as bastille and also the securing Debian howto but here is my top 10 lockdowns:

  1. Secure users home directories
    chmod -R 700 /home
    vi /etc/adduser.conf
  2. Disable all services not used and make sure that sshd is running on protocol2.
  3. Disable ftp (use
    ftpd-ssl or scp instead

    ) and telnet (you should be using ssh)

  4. Disable root from accessing sshd, so only a normal user can log on then su.
  5. Configure logcheck to send logs to an outside email address.
    apt-get install logcheck
    vi /etc/logcheck/logcheck.conf

    If you need to change the frequency, edit the cron file here:

    vi /etc/cron.d/logcheck
  6. Get regular updates from your apt sources
  7. Restrict system reboots/shutdown on the console:
    vi /etc/inittab
    ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
    vi /etc/shutdown.allow
    Add your users in that are allowed to shutdown the system when logged in
  8. Edit pam.d security files to match your security policy:
    cd /etc/security
  9. Consider using tripwire to monitor any changes in binaries on your system.
  10. Take a backup of the system. Always a good policy.
    
    

-image-Joining Debian to AD

These are some really good instructions to joining a Debian box to an Active Directory domain using winbind.

http://www.ccs.neu.edu/home/battista/documentation/winbind/

The only step it didn’t say was to create a directory under /home with the name of the AD domain that you are joining so that pam.d can create the user directory when a user logs on for the first time.


-image-django with apache2

One thing that I feel is harder than it should be with django is getting it working with Apache2. Sure the built in webserver is nice for development, but there comes a time when you need to step up and use a webserver for development that you can also deploy the site upon.

I have used Apache a lot in the past, but recently I have decided to move over to installing everything the Debian way, and this will reflect that. I am going to use python2.3, Apache2 and the version of mod_python that is in stable. You can follow the instructions if you have installed Apache2 and mod_python in otherways after this step if you wish.
To get Apache2 on Debian with mod_python, simply:

  1. apt-get install apache2
  2. apt-get install libapache2-mod-python

For the rest of the tutorial, I am assuming that you have Django setup correctly, and working with your database. If not, I recommend installing the development version. It is easy to update using svn and there are some features that are better than the stable version I find. Once you have done this you can start to build your site. From then on you can create your apache virtualhost file:

I have decided to run my django site on a different port, but of course you can run it on different ipaddresses, and with different hostheaders. All you need to do is follow the apache 2 documentation for this. I feel this is already well documented so I will just show how I did it by running on different ports:

  1. Edit the ports file for apache2 to tell it to listen on more than one port:
    vi /etc/apache2/ports.conf
  2. Add this line to tell it to listen on port 8000:
    Listen 8000
  3. Create a new sites file for this new virtual host:
    vi /etc/apache2/sites-available/djangosite
  4. Now we need to put in the configuration details:
    <VirtualHost *:8000>

    <Location "/">
    SetHandler mod_python
    PythonHandler django.core.handlers.modpython
    PythonPath "['/home/tim/dev/projects/'] + sys.path"
    SetEnv DJANGO_SETTINGS_MODULE djangosite.settings
    PythonDebug On
    </Location>

    Alias /media "/var/www/djangosite/media"
    <Location "/media/">
    SetHandler None
    </Location>

    <LocationMatch "\.(jpg|gif|png)$">
    SetHandler None
    </LocationMatch>

    </VirtualHost>

    This gives us several things:

    • Sets up a virtualhost to listen on port 8000.
    • For the virtual host use mod_python.
    • PythonHandler is told to use Django.
    • Our PythonPath is updated with our site files, in my case my django projects are located in /home/tim/dev/projects/ so this is what I use. Point this to where your django files are kept.
    • Let django know to use the settings file for this project
    • The we setup an alias to serve the media files, as they don’t need to be served through mod_python we turn the handler off for the /media/ location. I will setup my media files in /var/www/djangosite/media
    • Finally tell apache2 not to use mod_python to serve image files.

  5. Now save this file, and enable the site:
    a2ensite djangosite
  6. Now create the webhosting directory, and the symbolic link for the admin directory, and check the permissions:
    mkdir /var/www/djangosite/
    cd /var/www/djangosite/
    ln -s /usr/lib/python2.3/site-packages/django/contrib/admin/media/
    chmod -R 755 /var/www/djangosite
  7. The stop and start apache2 on your server (this is for Debian using init.d scripts, but whatever you do stopping then starting is better than a simple reload).
    /etc/init.d/apache2 stop; /etc/init.d/apache2 start

Once you have done that, check your site by point a webbrowser to the the machine that you have apache2 running on, but at port 8000 for instance if it is a localhost, tryhttp://127.0.0.1:8000.

One thing that I haven’t talked about is where it is best to place all the files used in creating a django site, and I have yet to read any documentation about this. This is why in the above I am point it to a dev subdirectory from my home directory. I don’t think this is a good idea for a production site, and perhaps it should go in somewhere off /var.

One thing is for sure, creating seperate directories for media and the actual files is a good idea, and you if you follow the django instructions you can take them up on the recommendation of using a seperate lightweight webserver to just serve these files.


-image-Top 30 Django Tutorials and Articles

Here’s a list of 30 helpful tutorials and/or articles on the Django web framework. This was written as an answer to the Top 30 Ruby on Rails tutorials and it is really helpful when you are learning Django. Hopefully this will help it get even more support.

read more | digg story


-image-hellahella on Apache 2

I have been using hellahella using paster serve and I must say the performance was terrible. I don’t think that it is mean’t to be run for any length of time which is at odds with hellahella, the web interface to hellanzb, which is.

I have documented before that I am using hellanzb to manage my nzb files, and hellahella makes it even easier and with integration with http://www.newzbin.com it is even better (how about one click downloads, unrar, par, and ready to view – yes I have it!)

So I wanted to run hellahella using Apache2 on my Debian box. Luckly just as I wanted to do this a new FAQ was put up on the Pylons web site on how to achieve this using mod_python (which I also wanted to use). Pylons is a web framework for python and it seems quite good too and I got alot of help from the very helpful pylons-discuss group on groups.google.com.
So I setup Apache2 or rather Debian did using apt-get, and I got a fairly normal install. If you haven’t used version2 of apache before the configuration has changed somewhat and all the config files are now split. At the same time I also installed mod_python using apt-get and as this is rather well documented I am not going to write it down here. Now all we need do is follow the first part of the instructions on the Pylons site:

  1. Install hellahella (I assume you are running hellanzb already otherwise go and download and install it) and make sure it works with paster serve hella.ini
  2. Make sure mod_python is installed and enabled.
  3. Save the http://projects.amor.org/misc/svn/modpython_gateway.py script as wsgi.py in your mod_python python directory which is /usr/lib/python2.3/site-packages/mod_python/ on my system.
  4. Create a project directory. I used /www/hellahella
  5. Create startup.py file in this directory with the following information:from paste.deploy import loadapp
    app = loadapp(“config:/www/hellahella/hella.ini”)
  6. Create a link to your hella.ini file: ln -s /etc/hella.ini hella.ini
  7. Go into your apache2 sites directory: cd /etc/apache2/sites-available/
  8. Create a new site: vi hellahellaSite
  9. And input the following information:

    VirtualHost 127.0.0.1
    ServerAdmin tim@timc3.com
    DocumentRoot /www/hellahella/
    SetHandler mod_python
    PythonHandler mod_python.wsgi
    PythonPath "['/www/hellahella/'] + sys.path"
    PythonOption wsgi.application startup::app
    PythonOption SCRIPT_NAME /
    ErrorLog /var/log/apache2/error.log
    Alias /stylesheets/ "/www/hellahellaMedia/stylesheets/"
    Alias /javascripts/ "/www/hellahellaMedia/javascripts/"
    Alias /images/ "/www/hellahellaMedia/images/"
    LogLevel warn
    CustomLog /var/log/apache2/access.log combined
    /VirtualHost
  10. Remember to change the ipaddress 127.0.0.1 to whatever ipaddress or domain name you need.
  11. The to a level above your doc root: cd /www
  12. Then create a link from the public media files for hellahella to a directory here: ln -s /usr/lib/python2.3/site-packages/hellahella-0.1dev_r782-py2.3.egg/hellahella/public
  13. Rename public: mv public hellahellaMedia
  14. You might need to chgrp and chown the files under this directory.
  15. Then enable this site: a2ensite hellahellaSite
  16. Restart apache2: /etc/init.d/apache2 stop; /etc/init.d/apache2 start
  17. Then test.
  18. And it should work aslong as hellanzb.py is running and hellahella is setup correctly.

And I must say it is looking good!


-image-What have I been doing

Well it seems to me like quite alot, so much so that I haven’t made much time to put updates in here so I will probably have more posts to follow this one when the time is right. But here is a quick list:

  • Spring cleaning the house – better late than never I support
  • Learning more about Django and getting it setup on 3 servers..
  • Setting up hellanzb in a daemon
  • Setting up the hellahella interface in Apache.
  • Creating a DVD and the associated movie of my holiday using the Apple iLife tools
  • Getting my proper visa from the Norwegian Police (finally!)
  • At work doing lots of work, and learning Oracle at the same time.
  • Installing ActiveCollab to hold my personal projects in one place.
  • Setting up subversion on dreamhost.
  • Upgrading XBMC to the latest version – and its fantastic.

All in all seems like I have been quite busy, and I still haven’t managed to tackle most of the sites on my list that I wanted to finish by the end of the year. Still there is plenty of time left at the moment, even with adding more to the list!


-image-Django setup

Over the last few days I have been playing with Django quite alot, installing it on a couple of machines and on dreamhost. The dreamhost configuration is now well documented by Jeff Croft in his post: http://www2.jeffcroft.com/2006/may/11/django-dreamhost/ and the on dreamhost Wiki here: http://wiki.dreamhost.com/index.php/Django

I did seem to use a few different settings on the file:

django.fcgi:

 #!/usr/bin/env python import sys sys.path += ['/home/timc3/django/django_src'] sys.path += ['/home/timc3/django/django_projects'] from fcgi import WSGIServer from django.core.handlers.wsgi import WSGIHandler import os os.environ['DJANGO_SETTINGS_MODULE'] = 'drunkonpetrol.settings' WSGIServer(WSGIHandler()).run()

Which seemed to help no end in getting it working.

On my own development machines I have had to set the PYTHONPATH environmental variable in .profile which is what python uses to search along when doing its imports. This is also set when using Mod_Python in the VirtualHost settings of Apache.

DJANGO_SETTINGS_MODULE is another env var that can be set this time for django itself. I haven’t yet configured it on my machines at the moment but I will do no doubt.

The base configuration that django gives via its admin tools is very good, but it has been extended by this project: Nesh DjangoUtils , which helps when setting up a djangoproject to do everything from creating the directories to creating the fcgi and modpython entries.  I haven’t needed to use it yet as I already started my django project before using it, but it is one to try in the future for sure.

So far I am finding django quite rapid in development, but I am spending alot of time looking for documentation on things, but the IRC channel is proving invaluable for help.  I will be putting up alot more articles as I go forward.


-image-SSH tricks

The article describes in a human language some of the powerful, yet very useful (even for total newbies) capabilities of OpenSSH, such as passwordless login, automatic execution of commands on a remote system or even mounting a remote folder using SSH.

read more | digg story