<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brad Rees &#187; Web Development</title>
	<atom:link href="http://bradleyrees.com/blog/category/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://bradleyrees.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 18 Jul 2011 08:01:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Rules Engine for HTTP Requests</title>
		<link>http://bradleyrees.com/blog/2011/07/rules-engine-for-http/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rules-engine-for-http</link>
		<comments>http://bradleyrees.com/blog/2011/07/rules-engine-for-http/#comments</comments>
		<pubDate>Sun, 10 Jul 2011 09:40:10 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Application]]></category>
		<category><![CDATA[HTTP]]></category>

		<guid isPermaLink="false">http://bradleyrees.com/blog/?p=214</guid>
		<description><![CDATA[Inspired by the power of Fiddler, I wanted to create a user friendly interface and rules engine to monitor and filter requests made by my computer when browsing the web. Fiddler itself is a great tool, however it is definitely aimed at technical people. Luckily Eric Lawrence, author of Fiddler, offers the core engine as [...]]]></description>
			<content:encoded><![CDATA[<p>Inspired by the power of <a title="Fiddler" href="http://www.fiddler2.com/fiddler2/">Fiddler</a>, I wanted to create a user friendly interface and rules engine to monitor and filter requests made by my computer when browsing the web. Fiddler itself is a great tool, however it is definitely aimed at technical people. Luckily Eric Lawrence, author of Fiddler, offers the core engine as a separate library, ready for other developers to customise and extend as they see fit.</p>
<p>Last year I began work on a Windows based application for monitoring the requests that are made by a computer over HTTP and then apply a rules engine to modify those requests before being send to the server. It is also able to modify the responses before being passed on to the web browser. Based on <a title="FiddlerCore" href="http://www.fiddler2.com/fiddler/Core/" target="_blank">FiddlerCore</a> and WPF, the application sits in the system tray displaying information on the recent HTTP requests and any rules that have been applied. Rules can be enabled and disabled via the user interface and customised by the use of a simple XML file.</p>
<p>The application sets itself as the system proxy, so all browsers that are set to use the system proxy will start issuing requests via the application. A word of warning, if the process is forcefully closed it will not have an opportunity to clean up, this may result in all web connections being blocked, as the system proxy will not be set to an address that is listening for requests. A quick fix is to restart the application and close it cleanly via the menu.</p>
<h2>Screenshots</h2>
<div id="attachment_229" class="wp-caption alignnone" style="width: 410px"><img class="size-full wp-image-229" title="Log of rules" src="http://bradleyrees.com/blog/wp-content/uploads/2011/07/Rule-log-list.png" alt="Log of rules screenshot" width="400" height="235" /><p class="wp-caption-text">Log of matched rules and URL that triggered the rule</p></div>
<p>&nbsp;</p>
<div id="attachment_228" class="wp-caption alignnone" style="width: 410px"><img class="size-full wp-image-228 " title="List of requests" src="http://bradleyrees.com/blog/wp-content/uploads/2011/07/Request-list.png" alt="List of requests screenshot" width="400" height="235" /><p class="wp-caption-text">A list of the requests that have been issued by the computer</p></div>
<p>&nbsp;</p>
<div id="attachment_230" class="wp-caption alignnone" style="width: 410px"><img class="size-full wp-image-230" title="List of rules" src="http://bradleyrees.com/blog/wp-content/uploads/2011/07/Rule-list.png" alt="List of rules screenshot" width="400" height="235" /><p class="wp-caption-text">A list of the rules and that status of each rule</p></div>
<h2>Provided rules</h2>
<ul>
<li><strong>Block request</strong> &#8211; Each request can be blocked from being sent to the server.</li>
<li><strong><a title="AdBlock Plus" href="http://adblockplus.org" target="_blank">AdBlock Plus</a> implementation</strong> &#8211; A cut down version of the AdBlock Plus for blocking advertising and tracking content. See below for more information.</li>
<li><strong><a title="Https Everywhere" href="https://www.eff.org/https-everywhere" target="_blank">Https Everywhere</a> </strong><strong>implementation </strong>- Send requests over HTTPS instead of HTTP for popular sites.</li>
<li><strong>Python script</strong> &#8211; Run custom code for each request. This is provided to give extensible functionality.</li>
<li><strong>Modify header</strong> &#8211; Modify a header before it is sent to the server or returned to the browser, including removing it.</li>
<li><strong>Modify cookie</strong> &#8211; Similar to the modify header rule, with support for individual cookie values.</li>
<li><strong>Break action</strong> &#8211; Prevent any other rules from running for the request or response.</li>
<li><strong>Save file</strong> &#8211; Save request content to the disk if matching a pattern.</li>
<li><strong>Age filter</strong> &#8211; Implementation of my proposed header for restricting content that is inappropriate for minors.</li>
</ul>
<h2>AdBlock Plus rule</h2>
<p>Included is a version of AdBlock Plus that can potentially give support to Internet Explorer, as well as other applications that issue HTTP requests via the system proxy. Since it does not run inside a browser only rules that are based on URL patterns are supported, all requests that work by hiding HTML elements will not run.</p>
<p>I&#8217;m not advocating the use of an ad blocker, as most websites are funded by advertising revenue, resulting in much of what we read on the internet being &#8216;free&#8217;. This was built mainly as a technical exercise for me to see any false positives that are preventing my pages from rendering properly when running the real AdBlock extension. It is extremely useful in that role, so I thought other web developers would benefit too.</p>
<p>I also built this as a way to write my own basic regular expression implementation, and as such it may not perform as well as a version based on the optimised Regex classes within the .NET framework. I was curious to see how hard it would be to write a simple regular expression parser and matcher, and the opportunity presented it quite nicely in the form of the AdBlock Plus rules engine.</p>
<p>The Firefox plugin, on which this is based, converts each rule to a regular expression, then runs it using the optimised engine within Firefox. I wanted to circumvent this step and see if I could directly parse and interpret each rule, as this would give me an insight into how a regular expression engine works. While I am very pleased with the results, it is still not up to the performance of the standard regular expression engine, and all the optimisations that have been added over the years. I may work on optimising my engine in the future, but only if time permits.</p>
<h2>Performance</h2>
<p>To put it bluntly, this will not speed up your system, quite the opposite in fact. On my Core i5 system the overhead is not great, however my Core 2 Duo laptop has a noticeable delay before requests are sent. Generally, the large sets of URL patterns by the AdBlock Plus rule are the culprit, so if performance is an issue try disabling that first. Additionally the Https Everywhere rule will cause a significant slowdown on sites that are forced to use HTTPS, due to the additional overhead of using a secure connection.</p>
<h2>Download</h2>
<p>I have just added the application to GitHub as an open source project. You can <a title="HttpRules - Github" href="https://github.com/bradrees/HttpRules" target="_blank">download the installer here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradleyrees.com/blog/2011/07/rules-engine-for-http/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Baby name recommendations using the names of 170 million facebook users</title>
		<link>http://bradleyrees.com/blog/2011/07/baby-name-recommendations-using-the-names-of-170-million-facebook-users/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=baby-name-recommendations-using-the-names-of-170-million-facebook-users</link>
		<comments>http://bradleyrees.com/blog/2011/07/baby-name-recommendations-using-the-names-of-170-million-facebook-users/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 14:23:58 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://bradleyrees.com/blog/?p=200</guid>
		<description><![CDATA[I had a little spare time a few weekends ago, and had an idea to write a recommendation engine for finding names that are related to each other. I got off to a great start with a fantastic data source, the list of 170 million facebook users provided by a security researcher. Starting with this, [...]]]></description>
			<content:encoded><![CDATA[<p>I had a little spare time a few weekends ago, and had an idea to write a recommendation engine for finding names that are related to each other. I got off to a great start with a fantastic data source, the list of 170 million facebook users provided by a security researcher.</p>
<p>Starting with this, I wrote an engine that finds related names, using common surnames as a base. Each name is calculated to find all the related names, then ranks them using 4 separate methods. The main problem that I faced what that the most popular names are the most related names for everyone – most people seem to have a Michael in their family. Each ranking method tries to find the names that are more common in the related name set compared to the global list of names, which are hence the most related.</p>
<p>I found that the results were initially a little bit inconsistent, for example the name <em>Brad</em> would be related to <em>Brett</em>, however the inverse wasn’t true. So counter this, I added a reverse lookup table and factored that into the ranking alorithm, which helped clean up the data and remove the odd combinations. This ensures that both names need to be related to each other, and removes names that are only related in one direction.</p>
<p>The results were better than I had hoped for, with over 25,000 of the most common names being computed and stored. I can see there are clear trends amongst regions, religions, similar sounding names, and even real world items, such as colours, fruits and emotions. I hope someone finds this useful, especially for trying to find odd or obscure baby names.</p>
<p><a title="Name Dropper" href="http://www.namedrop.it" target="_blank">http://www.namedrop.it </a></p>
]]></content:encoded>
			<wfw:commentRss>http://bradleyrees.com/blog/2011/07/baby-name-recommendations-using-the-names-of-170-million-facebook-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Version of blinkbox.com Live</title>
		<link>http://bradleyrees.com/blog/2009/12/new-version-of-blinkbox-com-live/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=new-version-of-blinkbox-com-live</link>
		<comments>http://bradleyrees.com/blog/2009/12/new-version-of-blinkbox-com-live/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 15:52:32 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[blinkbox]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[rental]]></category>

		<guid isPermaLink="false">http://bradleyrees.com/blog/?p=78</guid>
		<description><![CDATA[Recently blinkbox pushed a new release of the site onto the live environment which adds a number of quite cool features that we have been working on over the last few months. As the UI lead engineer I&#8217;m quite excited by these so I thought I would share. Perhaps my favourite change is that now [...]]]></description>
			<content:encoded><![CDATA[<p>Recently <a title="blinkbox.com" href="http://www.blinkbox.com" target="_blank">blinkbox</a> pushed a new release of the site onto the live environment which adds a number of quite cool features that we have been working on over the last few months. As the UI lead engineer I&#8217;m quite excited by these so I thought I would share.</p>
<p>Perhaps my favourite change is that now any of the <a title="Free movies on blinkbox" href="http://www.blinkbox.com/Movies/Featured/FREE-Movies" target="_blank">free movies</a> or <a title="Free TV on blinkbox" href="http://www.blinkbox.com/TV/Featured/FREE-TV" target="_blank">TV</a> icons have a &#8216;Free&#8217; overlay applied to them automatically. This is great at calling out how much free content we have, which is actually quite a lot now (loving the snowboarding titles we have)! We also are using the same system for showing off <a title="Trailers on blinkbox" href="http://www.blinkbox.com/Movies/Featured/In-Cinemas" target="_blank">trailers</a>, in case you notice the similarity. Additionally for trailer titles we also show the date they are to be released in the cinemas, or if they are currently showing, underneath the player (for example <a title="Avatar" href="http://www.blinkbox.com/Movies/31868/Avatar" target="_blank">Avatar</a>).</p>
<div id="attachment_84" class="wp-caption aligncenter" style="width: 610px"><a href="http://bradleyrees.com/blog/wp-content/uploads/2009/12/R33-Free-Overlay-Small.jpg" rel="lightbox[78]"><img class="size-full wp-image-84 " title="Free Overlay" src="http://bradleyrees.com/blog/wp-content/uploads/2009/12/R33-Free-Overlay-Small.jpg" alt="Free titles shown with a blue overlay" width="600" height="243" /></a><p class="wp-caption-text">Free titles shown with a blue overlay</p></div>
<p>For those wanting more than free content we have a number of improvements for purchasing our premium content. Firstly the browse catalogue now supports <a title="Movies between 1 and 5 pounds" href="http://www.blinkbox.com/Movies/Browse/1-5" target="_blank">price filters</a>, which is quite handy for finding cheap flicks. Secondly we now have box sets and bundles – so you can buy a whole <a title="Friends Season 10 box set" href="http://www.blinkbox.com/TV/Series/274/Friends" target="_blank">TV season</a> or a movie bundle (Godfather Trilogy perhaps?). And lastly we are now securely storing credit card details for repeat purchases, much like Amazon. Using this I think you can go from browsing to watching in under a minute if the title is available for streaming – which is much quicker than trekking to the local rental store.</p>
<p>We have also updated the Games area and added a new <a title="Video jigsaw game" href="http://www.blinkbox.com/Games/Jigsaw" target="_blank">video jigsaw</a>. This is good fun on the easy a medium skills, although the hard setting can take a little while – you’ve been warned. All the current competitions are now listed on a dedicated <a title="Movie and TV competitions" href="http://www.blinkbox.com/Competitions" target="_blank">competition page</a> for all the competition junkies.</p>
<p>Last but by no means least is the member referral system – pass on your invite code after a purchase and you’ll get £1, while your mates will get £5 credit each! That is more than enough for even the <a title="The Hangover - love that movie!" href="http://www.blinkbox.com/Movies/30648/The-Hangover" target="_blank">latest rentals</a>. I think this is a great deal for everyone so get it while it&#8217;s hot.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradleyrees.com/blog/2009/12/new-version-of-blinkbox-com-live/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Playstation 3 Javascript Support</title>
		<link>http://bradleyrees.com/blog/2009/12/playstation-3-javascript-support/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=playstation-3-javascript-support</link>
		<comments>http://bradleyrees.com/blog/2009/12/playstation-3-javascript-support/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 12:43:43 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Playstation 3]]></category>

		<guid isPermaLink="false">http://bradleyrees.com/blog/?p=17</guid>
		<description><![CDATA[Recently I have been investigating the web capabilities of the Playstation 3 NetFront browser, and for the most part it works as expected. There are a few caveats however, and in my case this was enough to prevent the Prototype JavaScript library from loading. So far I have discovered the following issues: Ajax works, however it will only [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have been investigating the web capabilities of the Playstation 3 NetFront browser, and for the most part it works as expected. There are a few caveats however, and in my case this was enough to prevent the <a href="http://www.prototypejs.org/" target="_blank">Prototype JavaScript library</a> from loading.  So far I have discovered the following issues:</p>
<ul>
<li>Ajax works, however it will only do a GET request &#8211; POST returns immediately with no data supplied.</li>
<li>General browser model most closely follows Internet Explorer, however the accessors for the CSS opacity is like other browsers (Mozilla).</li>
<li>Currently can&#8217;t read the opacity, gives a value of 1.0 always.</li>
<li>Can&#8217;t fire custom events as the method for creating an event does not work (<code>document.createEventObject</code>).</li>
<li>Since there are no custom events some functions do not work, such as Prototype&#8217;s <code>document.observe('dom:loaded')</code>.</li>
</ul>
<p>The event firing issue is a bit of a nasty one if you rely on custom event for updating page elements. To work around Prototype&#8217;s dom:loaded issue I have added a new method: <code>Event.domLoaded(),</code> that takes a function and stores it in an array. Once the DOM is ready the array is iterated through and each function is called. I have also enhanced the method to call the function parameter if the DOM has already been marked as ready, thereby preventing race conditions caused by a delayed function call. In other words it makes it safe to register a function to be called as soon as possible, regardless of the present state of the page.</p>
<p>I have uploaded an updated version of Prototype with the fixes applied &#8211; <a title="Prototype patched for PS3" href="http://bradleyrees.com/Files/prototype.js">download here</a>. Let me know if there are any issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradleyrees.com/blog/2009/12/playstation-3-javascript-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Performance issue with IE7 caused by background images</title>
		<link>http://bradleyrees.com/blog/2009/11/performance-issue-with-ie7-backgrounds/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=performance-issue-with-ie7-backgrounds</link>
		<comments>http://bradleyrees.com/blog/2009/11/performance-issue-with-ie7-backgrounds/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 19:17:14 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[IE7]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://bradleyrees.com/blog/?p=6</guid>
		<description><![CDATA[There an issue with IE7 whereby if you use a large number of repeating gradients the page slows down very noticeably.]]></description>
			<content:encoded><![CDATA[<p>While updating the visual design of <a href="http://www.blinkbox.com">blinkbox.com</a> a few months back we noticed something wasn&#8217;t right in IE7 &#8211; the performance was terrible. IE 7 has been around a lot longer than many of the other browsers we currently support in our level 1 tier, and is starting to show its signs of age.</p>
<p>The problem manifested itself mainly as a one second or more delay when hovering over images. Typically this would be a trivial operation for a browser, as it was simply applying the :hover classes for the element.</p>
<p>A bug was raised and I started the investigation by checking the usual culprits, such as incorrect binding of javascript events, HTML issues, CSS selectors that had run wild, and so on. A search on Google yielded no usable results that helped, either. Since none of these had improved the performance of the page, I started to get a bit more aggressive with my bug hunting.</p>
<p>I removed all the images from the page and this worked, although that wasn&#8217;t a solution that we could use. After carefully working through it, it turned out to be an issue with only the background images that we were using.</p>
<p>Now there was nothing really special about the background images, just simple PNGs, 1 pixel wide with repeat-x on them, which are then used to form a gradient. Standard stuff for a web page.</p>
<div id="attachment_9" class="wp-caption alignnone" style="width: 524px"><a href="http://bradleyrees.com/blog/wp-content/uploads/2009/11/IE7-Performance-Issues.png" rel="lightbox[6]"><img class="size-full wp-image-9 " title="IE7-Performance-Issues" src="http://bradleyrees.com/blog/wp-content/uploads/2009/11/IE7-Performance-Issues.png" alt="Notice the hover state on the Fast and Furious icon - that was were it was most noticable." width="514" height="358" /></a><p class="wp-caption-text">Notice the hover state on the Fast and Furious icon - that was where it was most noticable.</p></div>
<p>Technically, all of our gradients are bundled together into one image and then positioned using CSS, so I checked to see if that was the cause of the problem. One of the options of our image bundling system is the ability to have the images split up and served as separate files. After giving that a go it was apparent that it had no effect.</p>
<p>My next thought was that perhaps the number of repeating images were to blame. I made a quick check by disabling the repeat-x, and the site started running like normal. Realising that this was the issue I used the gradient generator to output wider images (20px), and voilà, the performance issues were sorted for good. So, if you are going to use a lot of gradients, and would like to keep your site running smoothly, then make sure they are more than 1px wide, as IE7 just can&#8217;t handle it.</p>
<p>*Of note blinkbox.com uses over 4ooo pixels of vertical gradients site wide, so this might be an extreme case <img src='http://bradleyrees.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://bradleyrees.com/blog/2009/11/performance-issue-with-ie7-backgrounds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

