Archive for April, 2007

Youtube Ripper: Collector’s Edition

Sunday, April 8th, 2007

Unfortunately, this script is broken now. Youtube changed things internally and the script broke. For a working script, see this post

Today I had an interesting conversation with my fellow blogger themak and he asked if it would be possible to download a bunch of videos that he knew followed a regular naming scheme and that were uploaded by two different users. After some coding I came up with a script that will download all videos uploaded by a specific Youtube user where the title matches a pattern (regexp compatible). The final output is flash videos named after the unique video ID.

$ sh youtube-user.sh rpoland "Andy Mckee"

Would download all videos with Andy Mckee in the title listed on the user rpoland’s profile page.

Update: Mike wrote a PHP port!

Update again: Regarding the Digg comments, the script now works with all profile pages and I re-wrote it to feature functions instead of one big one-liner.

Hopefully last update: Fixed the last regexp flaws and removed a flag to xargs that stopped it from running on OS X. Also added a dry-run mode.

Another Attempt To Get WordPress Going With Atom 1.0

Thursday, April 5th, 2007

The previous post included a patch that turned out to be invalid for the newer wp-atom.php shipped with the 2.0.x versions so I decided to fix my own feed to validate correctly a long with publishing the whole file this time. One remaining issue is that the validator will complain about inline CSS and other things it thinks might be dangerous or mess up the feed reader.

Escaped HTML in titles are still not functional, the original file tried to put the title attribute mode to escaped but that didn’t seem to follow the Atom standard.

Rewriting My Database Object

Wednesday, April 4th, 2007

As part of my combined programming and database course I decided to approach the remaining exercises in a more object oriented way by using a database class to handle the connection towards the database. The first version was somewhat clumsy since I wanted to put in so many features into it. Tonight I sat down again and re-wrote the whole thing from scratch with simplicity in mind and the result was 300 lines less code even though I added some remarkable features the previous incarnation didn’t have.

If you’re interested in what it looks like the source code is available on a subdomain of mine along with another file showing off some example usage

Write Your Own Square Root Function

Wednesday, April 4th, 2007

Ever wondered how your calculator calculates the square root for a given number? It probably uses power series but an easier to grasp approach is the following:

Take a number t Let r be your guess of what the square root might be After that repeat the following a few times: r = (r+t/r)/2.0 r will now be a number pretty close to the square root of t

Below are two version of what this would look like in Python and C++. The initial guess is half the number t.

(more…)

Parallels Workstation Emulated Hardware Details

Tuesday, April 3rd, 2007

An annoying thing about emulators is that most emulators emulating PC hardware aren’t that detailed about what hardware they are actually emulating. This post summarizes the hardware emulated by a typical Parallels Workstation 2.2 installation by listing the output of various utilities.

(more…)

Algorithm For Polygonal Numbers

Sunday, April 1st, 2007

Today I decided to put together a PDF-document of something I have been playing with for quite some time. Just like the title of this post suggests the paper is on the topic of polygonal numbers, or to be more specific on the topic of testing numbers to see whether they are polygonal or not. The paper starts with a clumsy rewrite of the traditional definition of a polygonal number and ends with Python source code for testing any integer for s-gonal properties!

(more…)



You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser