This was written to strip local domains from hyperlinks in text files, e.g., www.geoffstratton.com/mylink.html will become /mylink.html.
On my Amazon reading list page I wanted to add a progress bar and ahead/behind schedule counter similar to that on Goodreads. For their reading progress meter, you enter how many books you plan to read, and then your account page shows you a progress bar indicating how many books you’ve read and how far […]
An old Bash script that uses awk to construct an index with hyperlinks from the .html files in a web tree. Attempts to use the <title> tag to name each link. To use, change your directories in the ‘for dir’ line to the directories you want to scan, then run the script: ./myscript.sh > myfile.html.
Simple jQuery script for summarizing the results of my Amazon book listing. Since jQuery is already included in Drupal, I figured I’d use it to summarize the ratings and values. Note that in Drupal (and WordPress), jQuery defaults to noconflict mode so the “$” shortcut isn’t available. You can override this by setting jQuery.noConflict(false) or […]
Internationalization is frequently the bane of a developer’s existence. Fortunately, .NET provides a useful namespace called System.Globalization that contains most of the internationalization data you’ll ever need. Simple usage of this for displaying each culture, calendar, and currency is shown here. Obviously, the Windows command interpreter (cmd.exe) doesn’t do Unicode, so running this as a […]
Some experiments in website scraping using Python 2.7 with BeautifulSoup 3.2. The first function here shows various manipulations of an HTML page, including saving a scrubbed file to disk. The second function shows a simple crawler that attempts to traverse a domain and build a sitemap from hyperlinks encountered in the pages. Includes some commentary […]
A simple console application that downloads and processes JSON data using .NET 4.0 with the Newtonsoft Json.NET library. The sample data is a list of kings and queens of England and the UK from http://mysafeinfo.com/api/data?list=englishmonarchs&format=json. This uses simple LINQ but the Newstonsoft LINQ to JSON API will be more efficient in many cases. Mysafeinfo.com returns […]
PDO, or PHP Data Objects, is a database abstraction extension that allows you to use a common set of commands to access any database for which PDO has a driver. This includes MySQL and compatibles (e.g., MariaDB), PostgreSQL, Oracle, Microsoft SQL Server, IBM DB2, SQLite, and others. While it’s nice not having to rewrite all […]