Wednesday, 14th October 2009, 1001hrs
jw
Linux
What is the UUID?
The UUID library, present in all Linux systems, is used to generate unique identifiers for objects that may be accessible beyond the local system. The UUIDs generated by this library can be reasonably expected to be unique within a system, and unique across all systems. They could be used, for instance, to generate unique HTTP cookies across multiple web servers without communication between the servers, and without fear of a name clash. The UUIDs are also used to identify the hard disks on your Linux box.
Retrieve the UUID of your disk using blkid
The blkid program can be used to determine the type of content (e.g. filesystem, swap) a block device holds, and also attributes (tokens, NAME=value pairs) from the content metadata (e.g. LABEL or UUID fields).
[email protected]:~$ blkid /dev/sda5
/dev/sda5: UUID="21fb314a-b170-42b4-960a-07d7930b693f" TYPE="ext3"
The UUIDs of your disks can also be found in /dev/disk
[email protected]:~$ ls -al /dev/disk/by-uuid
total 0
drwxr-xr-x 2 root root 120 2009-10-14 10:31 .
drwxr-xr-x 5 root root 100 2009-10-14 10:31 ..
lrwxrwxrwx 1 root root 10 2009-10-14 10:31 0B7E-3FC3 -> ../../sda7
lrwxrwxrwx 1 root root 10 2009-10-14 10:31 21fb314a-b170-42b4-960a-07d7930b693f -> ../../sda5
lrwxrwxrwx 1 root root 10 2009-10-14 10:31 50340AA1340A8A64 -> ../../sda1
lrwxrwxrwx 1 root root 10 2009-10-14 10:31 9e83c2fe-b180-4b46-8b1c-b21eb1634895 -> ../../sda6
Use the vol_id
command...
...when you want to see even more info on the hard disk:
[email protected]:~$ sudo vol_id /dev/sda5
ID_FS_USAGE=filesystem
ID_FS_TYPE=ext3
ID_FS_VERSION=1.0
ID_FS_UUID=21fb314a-b170-42b4-960a-07d7930b693f
ID_FS_UUID_ENC=21fb314a-b170-42b4-960a-07d7930b693f
ID_FS_LABEL=
ID_FS_LABEL_ENC=
Friday, 25th September 2009, 1538hrs
jw
Linux
|
Debian
|
PDF
It is very simple to merge serveral PDF documents together into one PDF document. Just make sure that the gs
package is installed on your system.
[email protected]:~$ gs -dNOPAUSE -sDEVICE=pdfwrite \
> -sOUTPUTFILE=result.pdf \
> -dBATCH one.pdf two.pdf three.pdf
This command will merge the thee PDF documents one.pdf
, two.pdf
and three.pdf
into the resulting result.pdf
document.
Friday, 11th September 2009, 2025hrs
jw
Linux
|
Debian
Ubuntu and Debian packages are all bundled in something what is called a repository. Some people, like me, create their own:
Note
My repository links with the Jaunty distribution (that is Ubuntu 9.04). Your can connect yours to any other, like Debians experimental repository.
First create your own repository.
My repository is accessible over the web, so I installed it on my web server:
In this /var/www/packages
we will create a pool, the 'jaunty' distribution and the cache directories:
Now two files need to be created. The first one is the apt-release.conf
. Make sure that it looks like:
APT::FTPArchive::Release::Codename "jaunty";
APT::FTPArchive::Release::Origin "elevenbits.com";
APT::FTPArchive::Release::Components "main";
APT::FTPArchive::Release::Label "ElevenBits Ubuntu Repository";
APT::FTPArchive::Release::Architectures "i386";
APT::FTPArchive::Release::Suite "jaunty;
The second file is called apt-ftparchive.conf
. This one should look like:
Dir {
ArchiveDir ".";
CacheDir "./.cache";
};
Default {
Packages::Compress ". gzip bzip2";
Contents::Compress ". gzip bzip2";
};
TreeDefault {
BinCacheDB "packages-$(SECTION)-$(ARCH).db";
Directory "pool/$(SECTION)";
Packages "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages";
Contents "$(DIST)/Contents-$(ARCH)";
};
Tree "dists/jaunty" {
Sections "main";
Architectures "i386";
}
After you'd created these files your system should look like this:
[email protected]:/var/www/packages$ ls -al
total 28
drwxr-xr-x 5 root root 4096 Aug 14 13:32 .
drwxr-xr-x 3 root root 4096 Aug 14 13:22 ..
drwxr-xr-x 2 root root 4096 Aug 14 13:26 .cache
-rw-r--r-- 1 root root 427 Aug 14 13:32 apt-ftparchive.conf
-rw-r--r-- 1 root root 282 Aug 14 13:30 apt-release.conf
drwxr-xr-x 3 root root 4096 Aug 14 13:26 dists
drwxr-xr-x 3 root root 4096 Aug 14 13:26 pool
Add your own packages and update the repository.
Here the yourpackage
package version 1.0 is copied into the new (empty) repository:
Now the repo needs to be initialized. This you can do using these commands:
[email protected]:~$ cd /var/www/packages
[email protected]:/var/www/packages$ sudo apt-ftparchive generate apt-ftparchive.conf
pool/main: 1 files 9900B 0s
Done Packages, Starting contents.
dists/jaunty/Contents-i386: 1 files 9900B 0s
Done. 9900B in 1 archives. Took 0s
[email protected]:/var/www/packages$ apt-ftparchive -c apt-release.conf release dists/jaunty | sudo tee dists/jaunty/Release
Architectures: i386
Codename: jaunty
Components: main
Date: Mon, 17 Aug 2009 14:16:41 UTC
Label: ElevenBits Ubuntu Repository
Origin: elevenbits.com
Suite: jaunty
MD5Sum:
1d25efc884e5bbfc32eeba74771e322e 536 main/binary-i386/Packages
574c2e304fb14272b8f70355e93fbe80 416 main/binary-i386/Packages.bz2
3a0cbc2e4a38e40c8182451c85de1251 390 main/binary-i386/Packages.gz
SHA1:
949b9e9045f7698cd64abd4c1fa2261eb5d22f82 536 main/binary-i386/Packages
6d5d5c841a8890b4491650f4f360d53158d16cc0 416 main/binary-i386/Packages.bz2
eda59ba70dc9e9d65cf92076e33cb589a07de564 390 main/binary-i386/Packages.gz
SHA256:
b30b4e68d8928785d132dbdc6bb4158e75e907e07f00a3b8d206030236b8f94a 536 main/binary-i386/Packages
38b855ab6e0ce3111f986f26347871827e5e461af9b29b8ccf12773560f63caf 416 main/binary-i386/Packages.bz2
1d1aec4f2cff1a3b71212083aabfc3f2003c88b70f1f0a2ef32bfbb94c2aa879 390 main/binary-i386/Packages.gz
After this, the repository is ready to be used. See http://localhost/packages
to make sure.
Note
Remember to re-initialize the repo each time the /var/www/packages
is altered.
Enable the repository on your client machines.
On the Ubuntu machines that need access to your repository, use
sudo vim /etc/apt/sources.list
to add in the repository address:
deb http://ww.xx.yy.zz/packages jaunty main
where ww.xx.yy.zz is the address where your server lives.
From now on the system has access to our own private repository. Cool, no?
Tuesday, 21st July 2009, 1558hrs
jw
Django
|
Python
|
Eclipse
To develop Django applications, I use Eclipse with the Pydev plugin with some other extras. Here is a small how-to on my setup:
Download and install these different components:
Django
I'm using Django 1.0.2 final but I guess that Django's 1.1 beta or the development release would also work fine.
Eclipse
Just download the eclipse platform release and install it.
Pydev
Then download the Python IDE plugin and install it through the update manager, using these guidelines. Then you can use this page to configure the Python interpreter.
Subversion
A project is never complete when it is not version controlled. So install Subversion and the Subversion plugin. When installing the plugin, take care to select the correct features. The SVN Team Provider is required, together with at least one SVN Connector. I selected the SVNKit as my connector.
Then create your own Django projects. This can be done using the Eclipse Run -> Run configurations
. Here are the settings to start the lightweight development web server through the manage.py
:

Then specify runserver
as program argument:

Happy coding!
Friday, 26th June 2009, 0851hrs
jw
Django
|
ElevenBits
|
Linux
|
Python
This is my first blog entry ever :-)