Changelog:
Detailed Description:
A problem was pointed out by a user that existed with the ezRSS search link. There is a discrepancy between the show name displayed by Calendar for TV and ezRSS. Shows like Law & Order: SVU are actually displayed as Law & Order: Special Victims Unit on ezRSS. What this means is the ezRSS search link my script would produce would insert the show name Law & Order: SVU, which would yield no results on ezRSS. A secondary problem was also found where instead of the ampersand sign (&) the script would retrieve (&) which is the HTML code for the ampersand used in order for the actual symbol to be displayed on the webpage. For this and the problem before I came up with a few fixes. To fix the ampersand symbol a new HTMLSymbol "class" was made consisting of two variables. html represented the HTML code (e.g. &) and symbol represented the actual symbol (e.g. &):
function HTMLSymbol ()
{
this.html = "";
this.symbol = "";
}
On startup a new array would be created of type HTMLSymbol and populated:var htmlNameToSymbol = new Array(); htmlNameToSymbol[htmlNameToSymbol.length] = new HTMLSymbol(); htmlNameToSymbol[htmlNameToSymbol.length - 1].html = "&"; htmlNameToSymbol[htmlNameToSymbol.length - 1].symbol = "&";From there just after the show name is retrieved a for loop would run and replace all HTML codes that should really be symbols:
for (k = 0; k < htmlNameToSymbol.length; k++)
{
showName = showName.replace(htmlNameToSymbol[k].html, htmlNameToSymbol[k].symbol);
episodeName = episodeName.replace(htmlNameToSymbol[k].html, htmlNameToSymbol[k].symbol);
}
To fix the first problem of different show names I used a very similar method to the above problem. Firstly I created a ShowSearchAlias "class" with two variables. tvCalendar which is the show named displayed by Calendar for TV and search which is the show name displayed by ezRSS:
function ShowSearchAlias ()
{
this.tvCalendar = "";
this.search = "";
}
Again on startup a new array is created of type ShowSearchAlias and populated with shows with name discrepancies:
var showSearchAlias = new Array() showSearchAlias[showSearchAlias.length] = new ShowSearchAlias(); showSearchAlias[showSearchAlias.length - 1].tvCalendar = "Law & Order: SVU"; showSearchAlias[showSearchAlias.length - 1].search = "Law & Order: Special Victums Unit"; showSearchAlias[showSearchAlias.length] = new ShowSearchAlias(); showSearchAlias[showSearchAlias.length - 1].tvCalendar = "Law & Order: CI"; showSearchAlias[showSearchAlias.length - 1].search = "Law & Order: Criminal Intent";Then it's a simple matter of running a for loop and replacing the show name from Calendar for TV with the show name for ezRSS:
for (var i = 0; i < showSearchAlias.length; i++)
{
if (showSearchAlias[i].tvCalendar == showName)
{
showName = showSearchAlias[i].search;
break;
}
}
ThanksTV Calendar Reloaded Now a multi tool for www.pogdesign.co.uk/cat. Cleans up the website removing links and text, adds torrent search links and formatted file names for each episode for easy copy and renaming.
Changelog:
searchButton.focus();But because this new homepage removed the search button the script would crash firstly at trying to set the buttons value to match the search site but secondly after fixing that error in some of the previous 1.7 beta versions it would still search using Google's I'm Feeling Lucky. After some time I came up with a simple workaround. Instead of changing the focus to another object on the screen (I even tried setting it to the logo which didn't work) I simple removed the focus from the search box completely.
searchBox.blur();It was simple and effective. The search box no longer had the focus and I didn't have to worry about the search button being present or not.ThanksGoogle Homepage Reloaded Modifies the Google homepage to imitate go.infinise.com giving the user the ability to click the Google logo or press the UP key and change the website they search (i.e. Bing, Wikipedia, Twitter and YouTube)
Changelog:
Detailed Description:
This was a minor release with a simple fix to a problem I had found. Really it wasn't that big of a problem. Just when I removed videos from the list and left only the ones that matched the users search query sometimes you wouldn't have the same pattern of alternating colours that YouTube had in the first place (i.e. every even numbered video has a grey background, every odd numbered video has a white background).The fix was a simple one. A variable was defined and set to the CSS class "video even" which gives the movie a grey background. Then every time a movie is a successful match to the search query its CSS class would be changed to either "video even" if the previous one was "video odd" or "video odd" if the previous line was "video even".
//Variable decleration
var videoCSSClass = "video even";
//more code here...
//Remaining code
videos[i].setAttribute("class", videoCSSClass);
if (videoCSSClass == "video even")
{
videoCSSClass = "video odd";
}
else
{
videoCSSClass = "video even";
}
Thanks
YouTube Favourites Search Allows users to search their favoured YouTube videos from the Favourites pageThe goal here is to set up a local cache to use with TangoGPS or other apps like that. I don't have 3G neither WiMax (and there isn't a great coverage anyway...) so I like to grab my tiles before a trip.
Here is a little bash script which help doing this. You just have to know the coordinates of the first tile you want to get. Example for the Finistère (France, Brittany)You get it with a right click on the wanted tile, and "show picture", then you get : Here this is the path from the URL which we are interested in : 8/124/88.
There is a little algorithm to do a recursive download. I tried to sketch it by a small sample based on Brest Area.

Yesterday I was a little bored so I decided to finally make a script to obtain a feature I had wanted on YouTube for some time now. So I made my own Greasemonkey script that allows users to search their YouTube Favourites.
I've been looking around for something like this and haven't found anything, but I know this feature is one that people are looking for. If you use favourite videos on YouTube then you'd appreciate this script. Enjoy: YouTube Favourites SearchThanksI recently wrote a document on http://jon.spriggs.org.uk/blog explaining how to monitor the interface of a McAfee sidewinder to see when it failed over. I don't know why I didn't write it on Posterous, but if you're following me on Posterous, and you think that you might want to know how to use Perl to repeatedly loop over the same command, and show the results with a date stamp underneath it (a bit like the watch command) then you'll find this page really useful. In the mean time, I've also written the same script for the CSH shell, which is used, amongst other places, on Nokia Firewalls.
A little while ago I was tasked with migrating about hundred Trac instances from SQLite to MySQL. Unfortunately SQLites schema definitions is not compatible with MySQL. So I had to write some scripts to handle it. After a little bit of experimenting everything worked perfectly.
The Strategy I employed was like this:
Here is the shell script I made:
MYSQL_USER=username MYSQL_PSWD=password SQLITECMD=sqlite3 TRACBASE=/path/to/tracreps # loop through all trac instances in tracreps for d in $( ls $TRACBASE ) do if [ -d "$TRACBASE/$d" ]; then echo $d TRACNAME=$d # create database in mysql echo "creating database for $TRACNAME..." mysqladmin --user $MYSQL_USER -p$MYSQL_PSWD create $TRACNAME # dump sqlite db structure + data echo "dumping data from sqlite..." $SQLITECMD $TRACBASE/$TRACNAME/db/trac.db .dump > trac.sqlite.sql # remove database definitions from dump using a custom python script echo "cleaning database definition from dump..." `./cleansql.py < trac.sqlite.sql > trac.sqlite.sql.dataonly` # concatenate mysql database definitions and sqlite data cat trac.mysql.sql trac.sqlite.sql.dataonly > trac.sql echo "loading data into mysql..." mysql --user $MYSQL_USER -p$MYSQL_PSWD --default_character_set utf8 $TRACNAME < trac.sql # edit database connection string in trac.ini sed -i "s?sqlite:db/trac.db?mysql://$MYSQL_USER:$MYSQL_PSWD@localhost:3306/$TRACNAME?" $TRACBASE/$TRACNAME/conf/trac.ini echo "upgrading mysql database..." trac-admin $TRACBASE/$TRACNAME upgrade --no-backup
To remove schema definitions from the sqlite dump and fix some incompatibilities I made this python script referenced above as cleansql.py:
#!/usr/bin/env python import sys import re file = sys.stdin.read() file = re.sub(r'(CREATE (TABLE|INDEX)[^;]*|COMMIT|BEGIN TRANSACTION);', '', file) file = re.sub(r'INSERT INTO "([^"]+)"', lambda m: 'INSERT INTO `%s`' % m.groups(1), file) # fix sql for reports file = re.sub(r'CAST\((.+) AS int\)', lambda m: 'CAST(%s AS signed)' % m.groups(1), file) sys.stdout.write(file)
And that's it. I hope this will benefit someone tasked with the same job.