((lambda (x) (x x)) (lambda (x) (x x)))

Saturday, November 22, 2008

Virt-manager Lab

So, I was finally able to find some time to complete the FreeBSD virtual machine lab for SYA710. I wasn't able to do it in the lab, as I wasn't able to get it done while on campus, so ended up doing the lab using our China machine remotely. This didn't really require much serious modification to the lab - the only change was the use of a regular file for the main disk rather than a physical disk, as there weren't any partitions to spare on China.

After a few initial failed attempts to install the ports collection from an FTP server, I ended up redownloading the ISO images and using those to get the ports collection installed. Getting X and a copy of the emacs text editor running was relatively simple, though compiling emacs on FreeBSD turned out to be a startlingly lengthy process.



I'm quite impressed with the capabilities of the virsh and virt-manager pairing alongside KVM. The ability to have virtual machines start on boot certainly is a handy one to have around.

Tuesday, November 18, 2008

SPR720 Number Game Lab

So, I just finished the number guessing game for SPR720... most of the conceptual material was pretty old hat, but it provided a convenient excuse to familiarize myself with a little bit more of the Python syntax surrounding classes, initialization of objects, custom exceptions, etc.

Without further ado, here's the code...

Clicky

LPT730 Lab #7 -- Magnet Links vs. Torrents

Magnet Links vs. Torrents

A torrent file is a small file which can be downloaded and, by providing the torrent to a compatible client (Azureus, uTorrent, Transmission, etc.), then used to download the file described by the torrent file in question. In the scheme used by torrents, the file to be distributed is segmented into a number of pieces, to each of which is applied the SHA1 hashing algorithm. The hash value for each piece is stored within the torrent file, and it is this series of hash values that is used to identify, recover, and reassemble the segments described.

Magnet links are an open standard for a URI scheme accomplishing a similar goal through slightly different means. In this case, the user is offered a specially formatted URI containing a hash value that will be used to identify the correct file. The idea behind a magnet link is that some external P2P program (such as Vuze, Bearshare, or DC++, among others) will be used to locate the file whose hash corresponds with that in the URI. Magnet links may use a variety of hash algorithms, but unlike torrent files, the file is not segmented before being hashed, and it is the entirety of the file that is used in the production of the hash value used.

Even before any technical factors are considered, the advantage rests solidly with the BitTorrent protocol, due largely to it's popularity among the general public: the use of torrent files to acquire a variety of forms of media has become popular even among non-technical users, and as such, the chances of a given reciever having the required software installed to handle a torrent file are higher than the chances of them having software compatible with the magnet link scheme.

When technical aspects are considered, the advantages posessed by the BitTorrent profile become even more apparent. The technique used by BitTorrent of segmenting files before hashing them means that a peer node need not possess the entirety of the desired file to begin providing it to a requesting client: posessing only some segments of the file in question, the peer node will nonetheless register a match when the hash of the requested file is presented to it, and can immediately begin transfer of the segment it posesses to the requesting client.

Secondly, the use of BitTorrent continues to make things simpler for the distributer as it can be guaranteed that clients seeking to access their file will be making use of a particular protocol (specifically, BitTorrent), unlike in the magnet link scheme (in which a client may be using any of a number of protocols to transfer the file in question). For the distributor, that makes it easier to reinforce the group of seeders with nodes under their own control simply by configuring them to seed the file over the BitTorrent protocol: there is no need to create a set of seed nodes for each of the possible protocols a client may turn out to be using.

To conlcude, I believe this one to be a clear win for BitTorrent.

Friday, November 14, 2008

Write Perl? You want this module.

The other day, I discovered a great, easy-to-use profiling tool that anyone who writes Perl is bound to love. The tool is called Devel::NYTProf, and you'd definately be doing yourself a favour by checking it out. It'll provide you with beautifully readable, comprehensive reports (in a variety of formats - I haven't tried them all yet, but so far I like HTML) on Perl programs of your choice, in which you'll find all sorts of useful information about what your program actually spends it's time doing.


To get ahold of it, just run the following command:

'perl -MCPAN -e 'install Devel::NYTProf''


To try it out on a Perl program of your own (let's say it's called 'example.pl'), just run...

'perl -d:NYTProf example.pl'


This will result in the creation of a file called 'nytprof.out' in your current directory. You can output a human readable HTML version of the report using a command like:

'nytprofhtml nytprof.out'


The 'nytprofhtml' command will have produced a directory called 'nytprof' in your current directory containing the report in an HTML format. You can open the report in your web browser of choice with the following command:

'xdg-open nytprof/index.html'


If you'd like to see an example of the sort of output it produces, you can check out the output it gave while profiling some of my code here:

'http://matrix.senecac.on.ca/~gjmasseau/nytprof-example/index.html'


From here, you can navigate through the report to view all sorts of useful information to help you optimize your program.


Until next we speak, happy profiling!

Monday, November 10, 2008

Func Users Module v0.2 is released.

So, after some brief discussion with alikens and showing him the work that has been done so far, I've decided that version 0.2 of the Func users and groups module is now released. It's been mailed to the project lead, submitted on the mailing list and is available for general download here

Features on the list for version 0.3:
- User creation.
- Group creation.
- Deletion of either of the above.
- Managing group membership of users.

Possible for v0.3, but maybe in 0.4 depending on time:
- Implementation of the remainder of the possibilities offered by usermod and groupmod.

At this rate, the users and groups module should probably be completed well before the end of the year - in that case, I'm going to take a look at what other holes remain in the module selection and see what looks most interesting. Maybe the crontab module, as it'd give me an opportunity to fiddle with mangling files from Python in more detail.