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

Friday, December 5, 2008

Func Users Module v0.3 is released!

A new version of the func users & groups management module has been released for public user and/or review. The updated module can be found here: Func Users Module v0.3.

This release includes some coding style alterations to the already extant informational methods, as well as a boatload of new methods that will allow you to:

- Create, delete, and modify groups.
- Create, delete, and modify users.
- Manage the memberships of users within groups

To do:

The current implementation of user_add has very few options, and incorporating these options is most of what's on the feature list for v0.4. In the mean time, most sorts of users you would like to create can be created by first creating a user with relatively default settings using user_add, and subsequently modifying any properties you'd like changed. It would be nice if these additional steps could be cut out and the user be instantiated with the desired options with one method call.

Enjoy!

Tuesday, December 2, 2008

LPT730 Assignment #2

LPT Assignment 2: Converting a DV video to distribution formats using open source tools on Linux


Step 1: Exporting the video from Quicktime to DVD:



First, I took the provided file and converted it to DV. This was accomplished by loading the file in Kino and selecting 'export' on the vertical tab bar, followed by 'DV file' on the horizontal tab bar, and then proceeding to hit the 'export' button and select the desired output filename.


Step 2: Improving the audio quality:



The provided audio file had several problems - it was recorded in stereo, but it appears to actually be two mics, one worn by the speaker, and one worn by an announcer who speaks only briefly at the beginning. To correct this, I used Kino to export the audio track from the DV file and loaded it up in Audacity. In eh editor, I amplified the brief period of conversation from the announcer, mixed it over the speaker's track in the other channel, and then copied that channel over both, creating a mono mix where both speakers are clearly visible. Noise reduction was then applied to reduce some of the ambient noise, after which the file was normalized to 0 db.




Step 3: Replacing the audio in the original DV file with the corrected audio



To replace the audio with our new, cleaned up version of the track, I launched Cinelerra, imported both the video from the DV file and the audio file produced by audacity and selected the 'render' option from the file menu to produce a new DV file with the new audio.


Step 4: Transcoding to Theora



To transcode the DV file to theora, I install the ffmpeg2theora package and it's dependencies and, after reading the man page to determine the syntax, ran the script shown above. This actually produces many more files than we need at a variety of quality settings. To select the final files, each produced file was checked with the 'ogginfo' command and those with bitrates closest to the desired bitrates were selected.


Step 5: Transcoding to MPEG2



To transcode the video to MPEG2, the following commands are saved to a file, 'trans', and then executed:

transcode -i Out.dv -o out.avi -V -J smartyuv,hqdn3d,msharpen -Z 640x480 -y null -w 1800 -b 256 -R 1;
transcode -i Out.dv -o out.avi -V -J smartyuv,hqdn3d,msharpen -Z 640x480 -y -w 1800 -b 256 -R 2


Step 6: Transcoding to H264



To transcode the video to H264, I installed Mark Pilgrim's podencode python script and ran it on the AVI file (unfortunately, I could find no working tool to convert this directly from the DV file).

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.