Otaqui.Com

Pete Otaqui’s blog about web development and everything else

Archive for the ‘blogging’ tag

BBC Standards Ruby Gem

leave a comment

Thanks to some brilliant tidying up of my work by my good friend Patrick, there is now a bbc_standards ruby gem which you can use to validate pages against some of the BBC Technical Guidelines (more specifically the “Semantic Mark-up” and “XHTML Integrity” standards).

This gem was originally designed to work with Cucumber, and initially was intended to just validate pages against the XHTML Strict doctype that BBC pages are usually required to use. Since it uses Nokogiri for validation – against the XML Schema rather than the Doctype for what it’s worth – the testing is a) strict and b) *fast*. There are no external webservice calls, so it is fine to test all page loads within Cucumber, even testing the same URI many times over (since the bottleneck will almost certainly be your app by some margin.

I’m currently working on a post about using the gem for the BBC Web Developer blog, but I thought I’d point any interested parties at the code here and now.

Written by pete

February 18th, 2010 at 6:19 am

Posted in Professional

Tagged with , , ,

Yahoo Pipe for Wikipedia Contribution Comments

one comment

If you edit Wikipedia and have any kind of tumblog or lifestream, you might have found that the RSS feed that the MediaWiki software gives you is not especially useful, listing as it does the entire edited page, making each item potentially huge.

To fix this, I created a Yahoo Pipe showing Wikipedia Contributions – comments only which strips out the page content, leaving only the comment that was left. I’ve also given it a URL parameter (“target”) so you can use it for your own (or any other) Wikipedia username.

The idea is relatively simple, but I’ll list the process if you are interested in learning about the power of Pipes:

  1. Add a “Text Input” and give it a name of “target” (which is the same as the URL parameter required for the Wikipedia Contributions feed for a given user)
  2. Add a “URL Builder” with the basic URL for contributions and query parameters for name (which is “Special:Contributions”), feed (which is “rss”) and then one for target.
  3. Connect the output of the Text Input to the target parameter in the URL Builder – now you can add &target=MyUserName to pipe URL to change user
  4. Add a “Fetch Feed” and connect it’s URL to the output of the URL Builder
  5. Wikipedia pages can be long, too long in fact for Pipes’ regular expression parser, so add a “Loop” and then drag a “Subtring” into it. I trimmed the comments to 1024 in length, which I think is a reasonable amount in that it should be more than the length of the comment (actually limited to 200 characters) and any leading “junk” that we don’t want. the Loop should work on, and assign results, to “item.description”
  6. Now to strip out everything except the comment, add a Regex and connect the Loop’s output to it. We need two rules running on item.description, the first to strip newlines (find: “\n”, replace with “”, “g” option) and then find the comment (find: “[^:]+:(.*)<\/p>.*”, replace with “$1″, no options).
  7. Connect the Regex output to the Feed output … and you’re done!

Written by pete

January 3rd, 2009 at 11:48 am

Posted in Professional

Tagged with ,