<?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>Streaky&#039;s Blog &#187; Work</title>
	<atom:link href="http://mybrokenlogic.com/category/work/feed/" rel="self" type="application/rss+xml" />
	<link>http://mybrokenlogic.com</link>
	<description>Nothing is impossible until I say it can&#039;t be done.</description>
	<lastBuildDate>Sat, 08 Jan 2011 23:07:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>What&#8217;s Taking So Long, Damnit?</title>
		<link>http://mybrokenlogic.com/2010/09/13/whats-taking-so-long-damnit/</link>
		<comments>http://mybrokenlogic.com/2010/09/13/whats-taking-so-long-damnit/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 21:22:49 +0000</pubDate>
		<dc:creator>streaky</dc:creator>
				<category><![CDATA[Paste2.org]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://mybrokenlogic.com/?p=96</guid>
		<description><![CDATA[Aside from Paste2.org I have a full time development job, for UK2 Group; which takes precedence because, simply; it pays the bills. What that job tends to do is make me want to not write code at the end of the day because I&#8217;ve been doing it all day. That slows me down but it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Aside from Paste2.org I have a full time development job, for <a href="http://www.uk2group.com/#content">UK2 Group</a>; which takes precedence because, simply; it pays the bills. What that job tends to do is make me want to not write code at the end of the day because I&#8217;ve been doing it all day.</p>
<p>That slows me down but it&#8217;s not currently the main issue with paste2.org.<span id="more-96"></span></p>
<p>The issue I&#8217;m having right now is a design nightmare. I&#8217;m not a designer, a long way off it, I like to work on complex backend problems and design work doesn&#8217;t suit me in any way. I did the current design for paste2.org originally, back in 2006. The problem is it&#8217;s not really holding it&#8217;s own now, and it needs replacing.</p>
<p>I did a new design for the new code but quite a lot of people who saw it complained that the design was too bright when they&#8217;re working with consoles mainly &#8211; the white/grey design that everybody but paste2 uses &#8211; it seems isn&#8217;t up to scratch for people who spend most of their time in a white on black console.</p>
<p>I didn&#8217;t know this at the time I first put paste2 together, don&#8217;t think for a second it was a genius design decision &#8211; it just seems like it may have been a happy accident.</p>
<p>So anyway, I&#8217;m trying to put together a design that works and is dark but isn&#8217;t a catastrophe like the current one is, ideally I&#8217;d like a dark and light design so people can have a choice, like the new highlighter offers a choice of colours too.</p>
<p>The good news is that actually the code is actually fairly close to done, then I&#8217;ll need to write a migration script. Once I have this new code done and running on the site I&#8217;ll be happier about adding new features, like the collaborative editing I&#8217;ve been talking about for so long now!</p>
<p>One of the obvious changes between the old code and new will be the URLs, which will change from a sequential number system to an 8 (+ if ever needed) case-sensitive alphanumeric system that is randomly generated. This means a bigger key space (shorter URLs because there will be 6,000,000,000 possible pastes instead of 99,999,999 possible pastes in 8 chars) and it will stop people from trawling for pastes so much.</p>
<p>The other change with URLs will be the removal of the /p/ from paste URLs. All pastes will be accessed by http://paste2.org/&lt;tag&gt; rather than http://paste2.org/p/&lt;number&gt;. Old pastes will redirect (301) to the new URLs, so there will be no need for users to change anything.</p>
<p>The next update here I&#8217;m planning related to paste2 will be a public beta test.</p>
]]></content:encoded>
			<wfw:commentRss>http://mybrokenlogic.com/2010/09/13/whats-taking-so-long-damnit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Validating Email w/PHP</title>
		<link>http://mybrokenlogic.com/2010/07/15/validating-email-wphp/</link>
		<comments>http://mybrokenlogic.com/2010/07/15/validating-email-wphp/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 13:44:58 +0000</pubDate>
		<dc:creator>streaky</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://mybrokenlogic.com/?p=91</guid>
		<description><![CDATA[Just came up with a fairly smart way to validate email that removes a few issues generally caused by this sort of stuff. It&#8217;s not totally complete and it&#8217;s obviously part of a validation class &#8211; anybody planning on using it will need to modify it to make it work to their needs. I return [...]]]></description>
			<content:encoded><![CDATA[<p>Just came up with a fairly smart way to validate email that removes a few issues generally caused by this sort of stuff. It&#8217;s not totally complete and it&#8217;s obviously part of a validation class &#8211; anybody planning on using it will need to modify it to make it work to their needs.<span id="more-91"></span></p>
<p>I return a value so the class which calls this can replace the value back in the form if there is an error, and it actually replaces it in the data that is used (sent to the DB or whatever), I also use a custom validation exception class, these are all things that will need to be considered if anybody who sees it plans on using. Caveat emptor and whatnot.</p>
<p>What it does is sends the value to the PHP filter functions for validating as looking remotely like an email address, which is handy but it will validate local addresses and for domains that don&#8217;t exist.</p>
<p>What my code does is check if there is a remote address part and then if it is an IP just allows it, if it&#8217;s a domain it checks if the domain has MX records using <a href="http://php.net/manual/en/function.checkdnsrr.php" target="_blank">checkdnsrr()</a> &#8211; if that&#8217;s all good it allows it.</p>
<p>What could be improved? It doesn&#8217;t work so well at preventing local IP addresses going through. It also won&#8217;t tell you if the user is legit at a given domain or if the user has any association at all, so address validation will be a must in some circumstances, but it will prevent the standard dfgdf@dfdgdf.com type stuff. At least you&#8217;ll know if the domain part looks even close to reasonable, which is one of the &#8216;failings&#8217; (read: missing features?) of FILTER_VALIDATE_EMAIL if you want internet-only addresses entering.</p>
<pre class="brush: php; title: ; notranslate">	public function email_address($value) {
		$result = filter_var($value, FILTER_VALIDATE_EMAIL);
		if($result == false) {
			throw new validateException(&quot;Invalid email address&quot;);
		}
		$domain = explode(&quot;@&quot;, $value, 2);
		if(filter_var($domain[1], FILTER_VALIDATE_IP) !== false) {
			return $value;
		}
		if(checkdnsrr($domain[1]) == false) {
			throw new validateException(&quot;Email domain doesn't seem to exist or is incapable of recieving mail&quot;);
		}
		return $value;
	}</pre>
]]></content:encoded>
			<wfw:commentRss>http://mybrokenlogic.com/2010/07/15/validating-email-wphp/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

