Thu, 10 Aug 2006

Using sqlobject in cherryPy

from sqlobject import *

conn = 'mysql://dbuser:dbpass@host/dbname'

class NameOfTable(SQLObject):
    _connection = conn
    _fromDatabase = True
    _style = MixedCaseStyle(longID=False)

class Newspage(Page):
    def index(self):
        article = NameOfTable.select(NameOfTable.q.field=='Joe', orderBy=-NameOfTable.q.dateAdded)


Notes:
    _fromDatabase = True means sqlobject will simply take column names from
    the DB.  It won't create any, which it is capable of doing.

    MixedCaseStyle - sqlobject uses pythonic names like my_name.  This allows
    the use of names like myName.

    longID=False - prevents sqlobject from automatically creating an ID column

    - in front of NameOfTable.q.dateAdded means reverse sort

Posted at: 21:38 | category: /database | Comments ()

Compile a kernel the Debian way

apt-get install gcc kernel-package libc6-dev tk8.3 libncurses5-dev fakeroot

adduser kevin src

cd /usr/src

apt-get source kernel-soource-2.6.9
    [dpkg will automatically unpack it for you]

ln -s  kernel-source-2.6.9_2.6.9  linux

cd /usr/src/linux

rm -rf /debian

cd /usr/src/linux/scripts

./ver_linux
    [to see if you've got everything you need]

cd /usr/src/linux

cp /boot/config-2.4.23 .config

make menuconfig
    [do your config selection stuff]

make-kpkg clean

make-kpkg --revision $(date +'%Y%m%d') --append-to-version $(hostname) --rootcmd fakeroot clean

make-kpkg --revision $(date +'%Y%m%d') --append-to-version $(hostname) --rootcmd fakeroot kernel_image modules_image;

cd /usr/src

ls -l
    ...
    kernel-image-2.6.9chilkoot_20041220_i386.deb
    ...

dpkg -i kernel-image-2.6.9chilkoot_20041220_i386.deb

    [ if using initrd do the following ]

cd /boot

mkinitrd -o initrd.img-2.6.9chilkoot 2.6.9chilkoot

update-grub

check /boot/grub/menu.lst for correct entries of initrd and vmlinuz

reboot

Posted at: 21:36 | category: /configure | Comments ()

Create a new SSL certificate for Apache

Go to /etc/apache-ssl and backup apache.pem before you do anything else.  The
location of this file may be different depending upon your Apache setup.

Install the Debian package ssl-cert.

Check to make sure you have the standard template file:
    /usr/share/ssl-cert/ssleay.cnf

If you don't, make sure you have openssl installed.

cd over to a temporary working directory that you have write access to.

Run the command:
    make-ssl-cert /usr/share/ssl-cert/ssleay.cnf privkey.pem

This will create a private key for the server named privkey.pem.  
When complete with this process, store this file off site.

Next run the command:

    openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095

This will create a server certificate called cacert.pem, good for 3 years.

Next run the command:

    cat privkey.pem cacert.pem > apache.pem

This will create the complete certificate needed for apache.  Copy it over to
the directory where the pre-existing apache.pem was that you backed up
eariler.

Don't forget to move the privkey.pem off site.

Posted at: 21:36 | category: /configure | Comments ()

To set up CUPS based printing

apt-get install hplip hpijs

This will install quite a few other things as well, including CUPS

Then go to:
    
    http://localhost:631

and add a printer.

Present configurations include:

    HP_Laserjet_2100TN
        Device:  AppSocket/HP JetDirect
        Device URI: socket://10.10.10.99:9100
        Make:   HP (HPLIP)
        Model:  HP Laserjet 2100 Foomatic/hpijs
                or
                HP Laserjet 2100 Series Postscript

    HP_Photosmart_7960
        Device: Internet Printing Protocal (http)
        Device URL: http://10.10.10.98:631/ipp/lpt2
        Make:   HP (HPLIP)
        Model:  HP Photosmart 7960 Foomatic/hpijs

Check by going to Printers/Manage Printers/Print Test Page.

Posted at: 21:36 | category: /configure | Comments ()

Configure xterm

edit ~/.Xdefaults as appropriate

look at /etc/X11/app-defaults/XTerm for ideas about what and how to change

run 'xrdb -merge .Xdefaults' after editing to implement the changes

Posted at: 21:36 | category: /configure | Comments ()

Settings for uploads using PHP/Apache

In Apache httpd.conf, add the following:

    ..... other directives .....
   
       
           php_value post_max_size "71M"
           php_value upload_max_filesize "70M"
           php_value memory_limit "70M"
       
   

Posted at: 21:36 | category: /configure | Comments ()

Install Debian Source Packages

Debian can be a bit tricky if you're not familiar with its method of building
source packages.   Although this is covered in their faq somewhere, here is the
information.

    apt-get build-dep fluxbox
    apt-get source fluxbox
    apt-get install fakeroot
    apt-get install dpkg-dev
    apt-get install automake

(You may already have fakeroot and dpkg-dev installed). Although apt-get
build-dep fluxbox should also install all necessary tools, I have found that I
also have to get automake.

This will bring you three files (version number correct as of January 2004)
fluxbox_0.1.14-2.orig.tar.gz, fluxbox_0.1.14-2.diff.gz and
fluxbox_0.1.14-2.dsc. You will also have a fluxbox-0.1.14 directory.

The next step is

dpkg-source -x fluxbox_0.1.14-2.dsc

I'm assuming you have wget or something similar, if not do a quick

apt-get install wget

Now, we patch

cd fluxbox-0.1.14/src
wget kitaj.no-ip.com/files/fluxbox/fluxbox-0.1.14-menukey.patch
patch < fluxbox-0.1.14-menukey.patch


Now to build and install the package. You are in the fluxbox-0.1.14/src directory

cd ../
dpkg-buildpackage -rfakeroot -b


This will take some time. When it's done

dpkg -i ../fluxbox_0.1.14-2_i386.deb

Posted at: 21:36 | category: /configure | Comments ()

Mailman using Postfix on Debian

    The following is a description on how to set up the list manager Mailman
    on a Debian system that uses Postfix-MySQL-Apache for virtual websites and
    email.  It uses a Python script that makes it unnecessary to make entries
    into /etc/aliases.  But for this Python script to work, you must be
    willing to prefix the FQDN portion of your listname with "lists"...

        correct:  mylist@lists.virtdomain1.org

        incorrect:  mylist@virtdomain1.org

    While this may seem a sacrifice, it can easily be overcome later by simply
    creating an alias in your MySQL table from mylist@virtdomain1.org to
    mylist@list.virtdomain1.org.  This is far easier than adding in all of the
    Mailman aliases that would normally have to be added to /etc/aliases if
    you were not using the Python script.

    1.  Make sure your virtual websites and virtual email setups are all
    working before doing anything with Mailman.

    2.  Install Mailman via apt-get using normal defaults for the base website
    that runs on the server.

    3.  Edit /etc/mailman/mm_cfg.py
        
        add:
            VIRTUAL_HOSTS.clear()
            add_virtualhost('virtdomain1.org','lists.virtdomain1.org')
            add_virtualhost('virtdomain2.org','lists.virtdomain2.org')

        change DEFAULT_EMAIL_HOST to include the prefix 'lists' to the FQDN
        as in:
            DEFAULT_EMAIL_HOST = 'lists.rustybear.com'

        change IMAGE_LOGOS from whatever default is to:
            IMAGE_LOGOS = /'icons'/ 

    4.  copy Mailman images over to default /icons/ directory for Apache

            cp /usr/share/images/mailman/*  /usr/share/apache/icons/.

    5.  Edit /etc/apache/httpd.conf

        for any  you have configured, add in:
            ScriptAlias /mailman/  /usr/lib/cgi-bin/mailman/
        in the  section.

        and in an appropriate place (not within a VirtualHost directive) in
        httpd.conf add in:

            
                Options +FollowSymLinks
            

        you'll need the above to get pipermail (archives) working.

    6.  Get this python script:

        If you are installing via Debian apt-get this section is probably
        mostly done for you, but check anyway.

        http://www.gurulabs.com/files/postfix-to-mailman-2.1.py

        and drop it in /etc/mailman/ and rename it without the version number

            mv postfix-to-mailman-x.xx.py  postfix-to-mailman.py

        edit it by changing the entry for MailmanHome
             MailmanHome = "/var/lib/mailman"; 
        
        the Mailman home directory is where the lists are kept.

        Then cd to /usr/lib/mailman/bin and symlink back to
        postfix-to-mailman.py

            cd /usr/lib/mailman/bin
            ln -s /etc/mailman/postfix-to-mailman.py

    7.  Next go to /etc/mailman/postfix-to-mailman.py and read all of the
        comments/instructions.

        Note that in the recommended changes to /etc/postfix/master.cf, that
        you must set the uid:gid as list:list, not as mailman:mailman.
        This is probably specific to Debian only as the deb package has
        Mailman using 'list' as UID/GID where source versions of Mailman
        probably have 'mailman' as a default UID.

        Note also that in the changes to master.cf, you need to change the
        argv argument to point to /etc/mailman/postfix-to-mailman.py.

        This is also a good time to:

            chmod 755 /etc/mailman/postfix-to-mailman.py
            chown root:list /etc/mailman/postfix-to-mailman.py

        The instructions in postfix-to-mailman.py point out how to set up
        /etc/postfix/tranport and mail.cf.  You can do it that way, or more
        simply, just make an entry in your existing transport setup for MySQL.
        In my case I have a table called transport, where normally I put a
        domain name (i.e. xyz.com) and transport type (usually either virtual:
        or local: ).  However, in this case, the entry I make is:

            domain:     lists.virtdomain1.org
            transport:  mailman:

        Alternatively, you could follow the instructions and make the changes
        to main.cf and transport as that works too.  If you do it that way,
        don't forget to execute

            postmap /etc/postfix/transport

        after making changes to transport to regenerate its data.

    8.  Make sure you have a DNS entry in your DNS server for
        lists.virtdomain1.org, or at least a wildcard entry, that resolves to
        virtdomain1.org.

    9.  Restart Apache and Mailman (/etc/init.d/mailman restart).

    10. To create a new list for one of the virtual websites, at the prompt
        execute:

        newlist myNewList@lists.virtdomain1.org

        It will prompt you for a couple things that are obvious.  Make sure
        you include the 'lists' prefix before the FQDN, as having 'lists'
        there is what makes this whole thing work via the python script we put
        in -- /etc/mailman/postfix-to-mailman.py.

        You should get an email regarding the newly created list you
        just made.

        Note also that simply executing 'newlist --help' gives some help too.
        Also, reading the docs at /usr/share/docs/mailman is a good idea too.
        
        You should now be able to see your admin page at:
        http://lists.virtdomain1.org/cgi-bin/mailman/admin/myNewList

    11. Thing should be working and you should be able to subscribe new users
        and send emails to be posted, etc.  Try sending test posts and
        watching /var/log/syslog or wherever you have you email logs set up
        and watching for errors as the test posts go through Postfix.  It's
        best to watch this live using 'tail -f /var/log/syslog'.

    12. Good luck!

Posted at: 21:36 | category: /configure | Comments ()

samba config

# Global parameters
[global]
        workgroup = HAWKWOOD
        server string = %h server (Samba %v)
        obey pam restrictions = Yes
        passdb backend = tdbsam, guest
        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n .
        log level = 5
        syslog = 0
        log file = /var/log/samba/log.%m
        max log size = 1000
        socket options = TCP_NODELAY  SO_RCVBUF=8192  SO_SNDBUF=819
        domain logons = Yes
        os level = 65
        domain master = Yes
        dns proxy = No
        panic action = /usr/share/samba/panic-action %d
        printing = lprng
        printer name = HP_Laserjet
[homes]
        comment = Home Directories
        read only = No
        create mask = 0775
        directory mask = 0775
        guest ok = Yes
[printers]
        comment = All Printers
        path = /tmp
        create mask = 0700
        printable = Yes
        browseable = No
[cdrom]
        comment = Samba sakura's CD-ROM
        path = /cdrom
        guest ok = Yes
        locking = No
        exec = /bin/mount /cdrom
        postexec = /bin/umount /cdrom
[kevin]
        path = /home/kevin
        write list = kosuke,akiko,kevin
        read only = No
        create mask = 0777
        directory mask = 0777
[lp]
        comment = HP_Laserjet
        path = /usr/bin/lp
        read only = No
        create mask = 0700
        guest ok = Yes
        printable = Yes
        printing = bsd
        printer name = lp
        share modes = No
    

Posted at: 21:36 | category: /configure | Comments ()

cygwin + ssh


Download and install cygwin to c:\cygwin.  Select the packages that
make sense, but make sure to include cygrunsrv and openssh packages.

Right click 'My Computer' and under Environment Variables of the Advanced tab,
in the section System variables, add 'CYGWIN' for variable, and 'ntsec tty' for
value.

Also add on to the end of the PATH variable the following: 'c:\cygwin\bin'.

Edit c:\cygwin\cygwin.bat. Make sure it contains these lines - 
you will need to add the line setting the CYGWIN environment variable.

	@echo off
	set CYGWIN=binmode tty ntsec
	C:
	chdir \cygwin\bin
	bash --login -i

Test cygwin to make sure it works. 

	 ls /bin  // to see the cygwin bin directory
	 dir c:   // to see the contents of the C: directory

Type "control d" or 'logout' to exit the shell.


If you get a message saying 'cannot create /home/userid', 
run this command from the cygwin window "mkpasswd -l >/etc/passwd".

Run ssh-host-config to set up the ssh host keys and create the 
sshd_config file in /etc/. You should see output like this:

	$ ssh-host-config
	Generating /etc/ssh_host_key
	Generating /etc/ssh_host_rsa_key
	Generating /etc/ssh_host_dsa_key
	Generating /etc/ssh_config file
	Generating /etc/sshd_config file
	Added ssh to /cygdrive/c/WINNT/system32/drivers/etc/services

Do you want to install sshd as service?
(Say "no" if it's already installed as service) (yes/no)

Answer 'yes' to the prompt. Press 'Return' to accept the default 
at the CYGWIN environment question (default = binmode tty ntsec). 
The service name is CYGWIN sshd.

Type 'cd' to go to your account's home directory. Run ssh-user-config 
to setup your ssh keys. Create only an SSH2 RSA identity (use a null 
passphrase - just press return). Output should be similar to this :

   $ ssh-user-config
   Shall I create an SSH1 RSA identity file for you? (yes/no) no
   Shall I create an SSH2 RSA identity file for you? (yes/no)  (yes/no) yes
   Generating /home/pswander/.ssh/id_rsa
   Enter passphrase (empty for no passphrase):
   Enter same passphrase again:
   Do you want to use this identity to login to this machine? (yes/no) yes
   Shall I create an SSH2 DSA identity file for you? (yes/no)  (yes/no) no


You will probably want to change permissions and ownership on some files:

	cd /; chmod -R og-w .    // note the period
	chmod og+w /tmp
	touch /var/log/sshd.log  // may already be there
	chown SYSTEM:SYSTEM /var/log/sshd.log
	chown SYSTEM:SYSTEM /var/empty
	chown SYSTEM:SYSTEM /etc/ssh_h*
	chmod 755 /var/empty


At the prompt type the following to install sshd as a service:

	cygrunsrv -I sshd -p /usr/sbin/sshd -a '-D' -d 'CYGWIN sshd'

And then the following to start the service:

	cygrunsrv -S sshd

And then test it with:

	ssh localhost

And then test it from another machine.

And if necessary, the following to remove the service

	cygrunsrv -R sshd

There is also more documentation at /usr/doc/Cygwin.

Posted at: 21:36 | category: /configure | Comments ()

Mounting USB devices

lsmod to see what is loaded.  You potentially need:
	usb-storage
	usbcore
	scsi_mod
	sd_mod
	usb-uhci
	input
	sr_mod

If using Debian, apt-get install sg3-utils and then use:

	sg_scan -i		// to see scsi type devices
	sg_map			// to see device associations

Mount the drive found (should be a SCSI drive):

	mount -t vfat   /dev/sdc1   /home/kevin/mnt/usbdevice

Alternatively, make an /etc/fstab entry:

	/dev/sdc1   /home/kevin/mnt/usbdevice  vfat  noauto,user 0 0

Diagnose by checking:

	/var/log/messages
	/var/log/syslog
	/proc/bus/usb		// shows what's been seen
	/proc/scsi/scsi		// to see what scsi devices are there

Notes:  Like any other hard drive, you can use other commands
on your mounted USB storage device:

	fdisk /dev/sdc1			// play with partitions
	mkfs -t vfat /dev/sdc1		// format the partition(s) in FAT
	mkfs -t ext3 /dev/sdc1		// format in Linux ext3 but not a good
					// idea for digital camera disks

Posted at: 21:36 | category: /configure | Comments ()

Nagios configuration

To add a host:
    1.  add the new host to hosts.cfg 
    2.  add the new host to a group in hostgroups.cfg
    3.  make sure the host group has a contact group
    4.  make sure contacts are separate from the site
        being checked  
    5.  check contactgroups.cfg
    6.  make selections in services.cfg 
    7.  add the new host to dependencies.cfg if it
        has any dependencies

To check config settings run
    nagios -v /etc/nagios/nagios.cfg

Posted at: 21:36 | category: /configure | Comments ()

Remap that CapsLock key to Control

Hate the Windows keyboard?  Like the Unix keyboard?
Then remap that CapsLock key.

If using Xfree86 add the following to the InputDevice section of /etc/X11/XF86Config-4

Option "XkbOptions" "ctrl:nocaps"

Also note that Ctrl-[ is the same as hitting the Esc key.

Posted at: 21:28 | category: /vi | Comments ()

Embedding vim option settings in a file

You can use modelines to add Vim option settings to the contents of a file.
For example, in a C file, you can add the following line to the top or the
bottom of the file:

    /* vim: set textwidth=76 nopaste: */

This will set the 'textwidth' option to 76 and not allow pasting, when editing
that C file.  For this to work, the 'modeline' option should be set. By
default, the 'modeline' option is set.

Posted at: 21:28 | category: /vi | Comments ()

Create a thumbnail tack sheet from a directory of pictures

     convert 'vid:*.jpg' thumbnail.png

Posted at: 21:28 | category: /graphics | Comments ()

convert

convert -size 600x480 orig-pic.jpg -resize 600x480 new-pic.jpg

Posted at: 21:28 | category: /graphics | Comments ()

qiv

qiv -fm somepicture.jpg     // view a single picture
        // -f fullscreen on/off
        // -m scale to screen on/off

qiv -fmsd 3 *.jpg           // slideshow
        // -s slideshow on/off
        // -d 3  three second delay

// while viewing, hitting 'd' will send the pic
// to the .qiv-trash directory

Posted at: 21:28 | category: /graphics | Comments ()

import


// to take a screenshot using imagemagick

import myfilename.jpg

// then with cursor either click a window or select a region

Posted at: 21:28 | category: /graphics | Comments ()

mogrify

mogrify -format xpm -geometry 32x32 -map /usr/share/pixmaps/cmap.xpm fileToConvert
	// creates a standardized icon from a pre-existing image


** To create a directory of email-able pics or thumbnails:

cd /path/to/picfolder
cd ..						// back up one level
cp -R picfolder smallpicfolder			// create a duplicate folder
cd smallpicfolder
mogrify -size 800x600 -resize 800x600 *.jpg	// mogrify to email size

Note:  the mogrify operation will overwrite the existing imgages, hence it is
important to make a duplicate folder with all of the images.

Posted at: 21:28 | category: /graphics | Comments ()

Cartoonize A Photo With Gimp

Layer->Duplicate Layer
Select the new layer, the Filters->Edge-Detect->Edge, select Sobel, Amount
should be 2.0, and Black should be checked.
Invert the edge-mask layer ... it's in Layers->Colors->Invert
Back in the Layers Dialog, change the Layer Mode to Divide

Play around with Layer mode settings.  Desaturate the top layer, blue or
otherwise mess up the bottom layer.

Posted at: 21:28 | category: /gimp | Comments ()

Add different fonts to the Gimp

Gimp uses fonts from the fontconfig program.

So simply put the new fonts in your ~/.fonts directory
and then run, as root, dpkg-reconfigure fontconfig.

Posted at: 21:28 | category: /gimp | Comments ()

Mouse double-click in Apple Gimp

If you find that you need to click a window twice to activate it when
moving from window to window in Apple Gimp, then open a terminal and
enter the following:

    defaults write com.apple.x11 wm_ffm true

This will enable "focus follows mouse.  X11 must be restarted for the
change to take effect.

Posted at: 21:28 | category: /gimp | Comments ()

Upgrade a Debian Package with new source using svn-upgrade


download a copy of the new source tarball and place it in /debian-dev/tarballs

cd /debian-dev/calcurse  (just above /debian.  this is the WC [working copy])

svn-upgrade ../tarballs/calcurse-1.2.tar.gz

You'll now have a copy of calcurse in /debian-dev/calcurse that is updated to
the latest source.

You can check changes with

    svn diff

or specific files with

    svn diff TODO

Check the status of the svn repository for calcurse with

    svn status

Go ahead and make changes to things like the debian/changelog file.  Once
you've made all your changes you can commit the changes to the svn repository
with 

    svn commit

You can also do this by specific file

    svn commit src/util.c

Once everything is committed, you can build the package with

    svn-buildpackage -k8CE11941 -rfakeroot

which is executed in the WC (just above /debian).

The packages that are built will show up in /debian-dev/build-area.  You
should linda and lintian check them.

You should also run pbuilder on the WC.  Start this process by executing

    sudo pbuilder update
    sudo pbuilder clean

Then, from the WC, run

    pdebuild

You can then go to /var/cache/pbuilder/results to linda/lintian check the
files that were created by pdebuild.

Once you are satisfied that everything is o.k. and have tested it by
installing, upgrading, etc, then from the WC, run 

    svn-buildpackage -k8CE11941 -rfakeroot --svn-tag
or
    svn-buildpackage -k8CE11941 -rfakeroot --svn-tag-only

This will prepare for the next source release by making an entry in
debian/changelog.

Send the following files to the uploader:

    calcurse_1.2-1.diff.gz
    calcurse_1.2-1.dsc
    calcurse_1.2-1_i386.changes
    calcurse_1.2.orig.tar.gz

That's it.

Posted at: 21:27 | category: /dev | Comments ()

Working with svn-buildpackage

Start by creating a svn repository.  I'm presuming you'll be working from your
home directory --

    svnadmin create svn-repo 
    
... where svn-repo can be any name you want.

Note that this repository [svn-repo or whatever you name it] will be where 
svn manages all of its work.  It is not an area that you will edit.

Next, create a directory where you will do your work.   For me it was --

    mkdir debian-dev
    cd debian-dev

Download the appropriate files:  package.dsc, package.orig.tar.gz, and
package.diff.gz

Now we'll inject an existing source file into the repository --

    svn-inject bbtime_0.1.5-9.dsc file:///home/kevin/svn-repo

You'll see a lot of stuff scroll by, the last line of which should say
something like 

"Your working directory is /home/kevin/debian-dev/bbtime - have fun!"

The svn-inject command actually makes your working directory for you.

For most purposes you'll want to work out of the directory, although you can
create other working directories if you like with the command --

    svn co file:///home/kevin/svn-repo/bbtime

Wherever you execute this command is where the working directory will be
built.  When it is built, you'll see the following tree built:

    bbtime
      |----- branches
      |----- tags
      |----- trunk

You'll want to descend into trunk, where you'll see all of the source files
and a debian/ directory with all of the rules/control files.  Later, when you
execute the svn-buildpackage command, you'll want to do so from this trunk
directory. 

Return back to /home/kevin/debian-dev (or your equivalent).  Make a directory
in here as follows --

    mkdir tarballs
    
... so you should now have:

    home/kevin/debian-dev
        |------------------- bbtime
        |------------------- tarballs

Into the tarballs directory copy the original source tarballs, which should
have a name like bbtime_0.1.5.orig.tar.gz.  You should have been able to
download a copy of this file from the same place you downloaded the .dsc file
(most likely the Package area on Debian.org).

At this point you are ready to do some work.   Remember that svn-inject did
the original checking out of the bbtime working files for you, so you can
simply go to them and start your editing --

    cd /home/kevin/debian-dev/bbtime

... and do your work, most of which will probably be in the debian/ directory.

Once you've done your editing, you'll need to execute various svn commands,
all of which should be executed from the working directory, which is
/home/kevin/debian-dev/bbtime.  Examples of some of these commands:

    svn add debian/newfile
    svn delete debian/oldfile
    svn status
    svn log
    svn diff
    svn commit

This last command - svn commit - must be executed before you can do any
building.  As you execute it, you'll be given a chance to write notes about
the changes you made.

The next step is the actual building.  The command is --

    svn-buildpackage -k8CE11941 -rfakeroot

where -k is your GnuPG key ID and -r sets up fakeroot, which you should have
installed.  

You'll see plenty of screen action, which should end with a few lines that
tell you where everything was built.  If you move up a level in the directory,
you'll now find a new sub-directory called build-area.  This is where all of
the built files are put.  So you should now have a tree like this:

    home/kevin/debian-dev
        |------------------- bbtime
        |--------------------build-area
        |------------------- tarballs

In the build-area you'll find all of your newly generated files:

    bbtime_0.8.3-3.diff.gz
    bbtime_0.8.3-3.dsc
    bbtime_0.8.3-3_i386.changes
    bbtime_0.8.3-3_i386.deb
    bbtime_0.8.3.orig.tar.gz

Obviously you'll want to test everything, including running lintian and linda.

You'll probably want to build a few times as you work out your bugs.  Each
time you change something in bbtime/debian, you'll have to svn commit it to
the repository before you can execute svn-buildpackage again.  And each time
you build, svn-buildpackage will automatically overwrite the files in the
build-area directory, so don't worrying about cleaning that out.

When you are finally happy with your results, you need to tag it as a final
build.  You can do this with one of two commands --

    svn-buildpackage -k8CE11941 -rfakeroot --svn-tag
    or
    svn-buildpackage -k8CE11941 -rfakeroot --svn-tag-only

The first command will build the package and tag it, while the latter command
will just tag it (presumes your earlier builds were satisfactory).

When you tag it, you'll also be making a new debian/changelog entry, which
essentially is preparation for the next time you rebuild the package and
release a new version.

At this point you are basically done.  Make sure you don't delete the working
copy of your package that you have in /home/kevin/debian-dev.  Leave it there
for future versions. 

Before ending this, here's a couple more things to think about that may hang
you up.

First, let's say you've just finished building, are happy with the package,
and you've tagged it, which puts a copy into the repository trunk.  You
send it to your upload sponsor, but he spots a bug and wants you to correct
it.  But you've already finalized and tagged your build.  No problem.  Go to
your working copy - /home/kevin/debian-dev/bbtime - and execute the command --

    svn update

This will refresh your working copy from the repository.  It probably already
is the latest copy, but just in case, update it anyway.  Next go into
debian/changelog and remove the next version entry that the tagging process
created for you.  Make any other bug corrections.  And then execute your svn
commit and then you can build again and eventually tag it.  Your versioning
will still be preserved.

The second hang up that may get you is if you checkout a copy of a package
into a different working area.  Say for instance that you are in /tmp and you
execute --

    svn co file:///home/kevin/svn-repo/bbtime

This will create the following tree for you:

    /tmp/bbtime
        |------- branches
        |------- tags
        |------- trunk

You can descend into trunk, where you'll find all the source files and the
debian/ directory.  You can do all the editing you need and commit all of the
changes back to the repository.  And you can even build a deb by executing the
svn-buildpackage command from the trunk/ directory.  It will create a
build-area directory for like this:

    /tmp/bbtime
        |------- branches
        |------- build-area
        |------- tags
        |------- trunk

... and in this build-area directory you'll find the results of your build.
What you won't find is a .diff.gz file.  That file is only generated if you
are working from the originally created working directory from when you
executed svn-inject.

If you, or someone else, works on a copy of the package checked out from the
repository to a working area not in the original /home/kevin/debian-dev and
commits changes, then make sure next time you work in the original work area -
/home/kevin/debian-dev/bbtime - that you execute svn update to incorporate
their changes into your working copy.   This is basic svn stuff but may be
helpful to those new to all of this.

Good luck!

Posted at: 21:27 | category: /dev | Comments ()

Subversion: new project/repository configuration and some basic commands

As root:
    svn mkdir /var/svn/repo/newproject
    chown -R myUser:svnusers /var/svn/repo/newproject
    (presumes you have a svnusers group)

As a user/owner (myUser) of the newproject:
    svnadmin create /var/svn/repo/newproject

As root:
    chown -R myUser:svnusers /var/svn/repo/newproject
    chmod 664 /var/svn/repo/newproject/db/*

As a user/owner (myUser) of the newproject:
    cd /tmp
    mkdir -p newproject/trunk
    mkdir -p newproject/branches
    mkdir -p newproject/tags

    cd /tmp/newproject/trunk
    cp -pvr /home/newproject/www .

    svn import /tmp/newproject file:///var/svn/repo/newproject -m "initial import"

    cd /tmp
    rm -rf newproject/

To verify results of the import:

    svn list --verbose file:///var/svn/repo/newproject

To export the project without .svn files

    cd [to target export directory]
    svn export file:///var/svn/repo/newproject/trunk/www [option name]

To checkout the project with .svn files

    cd [to target working copy directory]
    svn checkout file:///var/svn/repo/newproject/trunk/www [option name]

svn status [file:///var/svn/repo/newproject]
    prints the status of working copy files and directories

svn diff
    shows changes to the working copy

svn update [file:///var/svn/repo/newproject]
    brings changes from the repository to your working copy
        A == added
        D == deleted
        U == updated
        C == conflict
        G == merged

svn add PATH
    adds files/directories to your working copy and schedules them for
    addition to the repository.  will be uploaded and added to the repository
    during the next commit.  when adding a directory, the default behavior is
    to recurse

svn delete PATH
    schedules PATH for deletion on the next commit.  if PATH is a URL, it will
    immediately delete and a log message must be supplied.  

svn copy SRC DST
    copy a file/directory in your working copy or repository.

svn move SRC DST
    move a file/directory in your working copy or repository.  equivalent to
    svn copy/svn delete.  

    example:  svn move foo.c bar.c

svn commit [--message] [PATH]
    sends changes from working copy to the repository.  alias == ci.

    example:  svn commit -F message foo.c
        this only commits the foo.c file and a message

    svn commit without any args will commit everything

svn log [PATH]
    display all of the commit messages

Posted at: 21:27 | category: /dev | Comments ()

qmake - compiling

To compile a C++ application you need to create a makefile. The easiest way to
create a makefile is to use the qmake build tool supplied with Qt. If you've
saved main.cpp in its own directory, all you have to do is: 

qmake -project -o main.pro      // this creates a project file main.pro

qmake                           // this creates the Makefile

make                            // this creates the executable

The first command tells qmake to create a .pro (project) file. The second
command tells it to create a (platform-specific) makefile based on the project
file. You should now be able to type make (or nmake if you're using Visual
Studio).

Posted at: 21:27 | category: /dev | Comments ()

Important pbuilder commands

sudo pbuilder create --distribution sarge
sudo pbuilder update --override-config --distribution sid

pdebuild
   // run this in the directory with source files (above debian/)
   // it builds a deb in /var/cache/pbuilder/results

note that presently pbuilder (sid) uses gcc-4.0 and g++-4.0, which may not be
appropriate for your package.

sudo pbuilder clean

------

piuparts - to check for proper dependencies and whether package install
properly in unstable after completing the build process

cd to the source build directory (above debian/)

    piuparts ../bbmail-0.8.3_i386.deb

------

Building the final package:

// check which complier is default

cd to the source build directory (above debian/)

    dpkg-buildpackage -rfakeroot -k8CE11941

Posted at: 21:27 | category: /dev | Comments ()

ezcounter.php -- counter for webpages



The above page should be added to the target webpage via an include.  
The include needs to be before any echo/print statements as headers 
cannot be sent twice.
Print out the counter value later on the page  with:

Posted at: 21:27 | category: /dev | Comments ()