<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Dan Newcome, blog</title>
	<atom:link href="http://newcome.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://newcome.wordpress.com</link>
	<description>I&#039;m bringing cyber back</description>
	<lastBuildDate>Tue, 24 Jan 2012 22:53:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='newcome.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Dan Newcome, blog</title>
		<link>http://newcome.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://newcome.wordpress.com/osd.xml" title="Dan Newcome, blog" />
	<atom:link rel='hub' href='http://newcome.wordpress.com/?pushpress=hub'/>
		<item>
		<title>We&#8217;re witnessing Internet history today</title>
		<link>http://newcome.wordpress.com/2012/01/18/were-witnessing-internet-history-today/</link>
		<comments>http://newcome.wordpress.com/2012/01/18/were-witnessing-internet-history-today/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 00:16:47 +0000</pubDate>
		<dc:creator>newcome</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newcome.wordpress.com/?p=1530</guid>
		<description><![CDATA[With the mass Web site blackouts protesting SOPA today, I think we&#8217;re seeing a real watershed moment for lobbying and activism on the Web. I&#8217;ve been a part of various Hacktivism movements and campaigns in the past, but I always knew that these fights were localized and very much under the radar of most people. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1530&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>With the mass Web site blackouts protesting SOPA today, I think we&#8217;re seeing a real watershed moment for lobbying and activism on the Web. I&#8217;ve been a part of various Hacktivism movements and campaigns in the past, but I always knew that these fights were localized and very much under the radar of most people.</p>
<p>But now, when the stakes are high and big Web sites are willing to put skin in the game, the amount of awareness that can be raised is amazing. It didn&#8217;t hit me until I actually experienced a Wikipedia blackout how momentous this day really is. Twitter is absolutely on fire with #sopa tweets, and the major news outlets are covering the Google and Wikipedia blackouts.</p>
<p>The amount of awareness that can be generated online is astounding. Compared to physical protests in the streets, the potential of an online protest or strike is a huge force multiplier.</p>
<p>Lobbyist groups typically have had unparalleled power in influencing Washington, and I think that what we are seeing here with the SOPA blackouts is a first step toward matching and countering the lobbyist&#8217;s power.</p>
<p>I think that SOPA will set a precedent for things to come. Stay tuned.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/newcome.wordpress.com/1530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/newcome.wordpress.com/1530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/newcome.wordpress.com/1530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/newcome.wordpress.com/1530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/newcome.wordpress.com/1530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/newcome.wordpress.com/1530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/newcome.wordpress.com/1530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/newcome.wordpress.com/1530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/newcome.wordpress.com/1530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/newcome.wordpress.com/1530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/newcome.wordpress.com/1530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/newcome.wordpress.com/1530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/newcome.wordpress.com/1530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/newcome.wordpress.com/1530/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1530&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://newcome.wordpress.com/2012/01/18/were-witnessing-internet-history-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">newcome</media:title>
		</media:content>
	</item>
		<item>
		<title>The state of Javascript documentation on the Web</title>
		<link>http://newcome.wordpress.com/2012/01/18/the-state-of-javascript-documentation-on-the-web/</link>
		<comments>http://newcome.wordpress.com/2012/01/18/the-state-of-javascript-documentation-on-the-web/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 08:51:26 +0000</pubDate>
		<dc:creator>newcome</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newcome.wordpress.com/?p=1526</guid>
		<description><![CDATA[I just wanted to show an example of a Google search that I did on a common Javascript topic. I&#8217;ve written about JS documentation on the Web in the past, but I didn&#8217;t have too many specifics in that post. I&#8217;ve linked to the PromoteJS movement, trying to get Mozilla docs to rank higher in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1526&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I just wanted to show an example of a Google search that I did on a common Javascript topic. I&#8217;ve <a href="http://newcome.wordpress.com/2012/01/04/js-documentation-is-still-sort-of-a-ghetto-promote-js/">written about JS documentation</a> on the Web in the past, but I didn&#8217;t have too many specifics in that post. I&#8217;ve linked to the <a href="http://promotejs.com/">PromoteJS</a> movement, trying to get Mozilla docs to rank higher in search engines.</p>
<p>This was a valiant effort but unfortunately there is still a long way to go. Web standards are evolving rapidly, and having the first few search results for some simple task be basically links to content farms is frustrating.</p>
<p>Here is a screenshot of the Google results for &#8220;Javascript refresh page&#8221;:</p>
<p><a href="http://newcome.files.wordpress.com/2012/01/js-search.png"><img src="http://newcome.files.wordpress.com/2012/01/js-search.png?w=700&#038;h=696" alt="" title="js-search" width="700" height="696" class="aligncenter size-full wp-image-1527" /></a></p>
<p>Notice that the first several domains are quackit.com, mediacollege.com, grizzlyweb, etc. These are not very solid sources!</p>
<p>Maybe I&#8217;m idealizing the way that the Web should be functioning, and that the real answer to this is good reference books. I think that even with a ready reference book it would take more time to find these sorts of things than it would if search worked better with this stuff. Lots of these things are little facts that I know but I&#8217;m paranoid about and want to double-check quickly in the documentation. Or something that I&#8217;ve done 100 times but for some reason I go brain-dead and I need to jog my memory quickly.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/newcome.wordpress.com/1526/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/newcome.wordpress.com/1526/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/newcome.wordpress.com/1526/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/newcome.wordpress.com/1526/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/newcome.wordpress.com/1526/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/newcome.wordpress.com/1526/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/newcome.wordpress.com/1526/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/newcome.wordpress.com/1526/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/newcome.wordpress.com/1526/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/newcome.wordpress.com/1526/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/newcome.wordpress.com/1526/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/newcome.wordpress.com/1526/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/newcome.wordpress.com/1526/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/newcome.wordpress.com/1526/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1526&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://newcome.wordpress.com/2012/01/18/the-state-of-javascript-documentation-on-the-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">newcome</media:title>
		</media:content>

		<media:content url="http://newcome.files.wordpress.com/2012/01/js-search.png" medium="image">
			<media:title type="html">js-search</media:title>
		</media:content>
	</item>
		<item>
		<title>Hack the Web your way with userjs</title>
		<link>http://newcome.wordpress.com/2012/01/14/hack-the-web-your-way-with-userjs/</link>
		<comments>http://newcome.wordpress.com/2012/01/14/hack-the-web-your-way-with-userjs/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 23:32:18 +0000</pubDate>
		<dc:creator>newcome</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newcome.wordpress.com/?p=1524</guid>
		<description><![CDATA[Few people realize how much their experiences on the web can be tweaked. Sure some savvy users can change the default font size and maybe block ads with an extension. However, the fact that the front-end code of any Web site or application is executed right in the browser makes it possible to intercept and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1524&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Few people realize how much their experiences on the web can be tweaked. Sure some savvy users can change the default font size and maybe block ads with an extension. However, the fact that the front-end code of any Web site or application is executed right in the browser makes it possible to intercept and tweak just about anything on the page, and even add functionality. This idea has been around for a long time, and many of you will remember using GreaseMonkey scripts. However browsers like Opera and Firefox have this ability natively now and it is really simple to get started with. Chrome can do the same thing, but you&#8217;ll have to install the script as an extension using the Chrome extensions mechanism.</p>
<p>I read the Hacker News site several times a day. Recently I&#8217;ve been getting annoyed with skimming over stories that I don&#8217;t care about each time I check the site. I figured that a good way around this was to treat the front page like an email inbox, and use the &#8220;one touch&#8221; principle to either read it or kill it. Or both.</p>
<p>So I fired up my favorite Web agent (Opera) and started fiddling around with the page. I started by writing some code to highlight a particular story, and then I wrote some code that let me move the selection up and down on the page. Once I had that working, I implemented code to remove the selection from the page entirely.</p>
<p>That was a good start, but what I really wanted was for the removals to be persistent &#8211; for them to be remembered for the next time I checked the site. To do this, I used HTML5 local storage to store the IDs of the stories that I didn&#8217;t want to see anymore. The next time the page loads, the code checks each story on the front page and removes it if it exists in the local store.</p>
<p>I&#8217;m still tweaking this script, but it has already saved me a ton of time and made my experience with the site tremendously better, so I thought I&#8217;d write it up now rather than later. If you are using Opera all you have to do is drop the code into your UserJS folder, which can be set in the user options dialog in the browser.</p>
<p>I&#8217;m going to expand this into a series of articles probably, creating a case study on tweaking the user experience of common web pages.</p>
<p>I&#8217;m posting the code here as it exists currently. If I end up hacking in support for more browsers I&#8217;ll put it on GitHub eventually.</p>
<p><pre class="brush: jscript;">
// ==UserScript==
// @match news.ycombinator.com 
// ==/UserScript==

/***
 * User script for navigating Hacker News. Moving up and down
 *  between stories uses vim key bindings j,k. Kill a story
 *  and never see it again using x. Killed stories are tracked in 
 *  HTML5 LocalStorage, so clearing it will bring back all stories.
 *  Open c,enter browses to comments/link respectively.
 *
 * TODO: precache selected stories?
 * TODO: open stuff async in iframes?
 * TODO: remember highlighted position?
 *  this makes it easier when browsing to read an article and then
 *  hit the browser back button to return to HN
 * TODO: killfile - kill stories via regex, eg, no SOPA, etc.
 * TODO: abstract DOM traversals a bit more, move to functions
 *
 * other scripts that do this:
 * http://news.ycombinator.com/item?id=277099
 * http://www.hnsearch.com/search#request/submissions&amp;q=hacker+bookmarklet&amp;start=0
 * 
 * BUG: can't remove articles that have been voted up. Also affects
 *  stories that are 'system' and can't be voted on.
 * BUG: browsing to articles that have been upvoted results in 
 *  viewing the submitter's profile rather than the intended action
 * BUG: Voting a story up and then trying to browse to another story
 *  results in trying to vote for the same story again.
 */

/**
 * Main 
 *
 * Set up key handler and run the kill process for stories that 
 * have been killed previously. Take care of highlighting the 
 * and setting the current row to the first visible story
 */
document.addEventListener( 'keypress', onKeydown, false ); 

// the row that is in focus for operations
var currentrow;

killstories();
currentrow = findFirstRow();
highlight( currentrow );

/**
 * remove items from the page when first loaded. We assume 30 items
 * per page. Look up the story id and see if it exists in the local
 * storage data.
 */
function killstories() {
	// start at the top
	currentrow = findFirstRow();

	for( var i=0; i&lt;30; i++ ) {
		var killrow = currentrow;
		moveDown();
		var id = killrow.getElementsByTagName( 'a' )[0].id;
		var item = localStorage.getItem( id );
		if( item ) {
			console.log( 'removing ' + id );
			removeRow( killrow );			
		}
	}
}

/**
 * Dumb item traversal functions that just jump up or down
 * 3 &lt;tr&gt;s at a time, highlighting the proper element
 */
function moveDown() {
	unhighlight( currentrow );
	currentrow = currentrow.nextSibling.nextSibling.nextSibling;
	highlight( currentrow );
}
function moveUp() {
	unhighlight( currentrow );
	currentrow = currentrow.previousSibling.previousSibling.previousSibling;
	highlight( currentrow );
}

/**
 * Abstract the act of highlighting and unhighlighting
 * a DOM element somewhat
 */
function highlight( el ) {
	el.style.backgroundColor = 'white';
}
function unhighlight( el ) {
	el.style.backgroundColor = null;
}

/**
 * Clear list of killed pages so that all stories show again
 * This is not used anywhere yet. TODO: put a button on the page
 */
function resetList() {
	localStorage.clear();
}

/**
 * return the &lt;tr&gt; element that represents the top of
 *  the stories list
 */
function findFirstRow() {
	var tables = document.getElementsByTagName( 'table' );
	return tables[2].firstChild.firstChild;
}

/**
 * Handler for key commands, currently j,k,x
 */
function onKeydown( evt ) {
	// TODO: in opera the keycodes are funny
	console.log( evt.keyCode );
	
	// j - move down
	if( evt.keyCode == 106 ) {
		// TODO: logic for detecting end of page doesn't work 
		if( currentrow.nextSibling.nextSibling.nextSibling != null ) {
			moveDown();
		}
	}
	
	// k - move up
	else if( evt.keyCode == 107 ) {
		// check if we are at the top
		if( currentrow.previousSibling != null ) {
			moveUp();
		}
	}

	// x - kill story
	else if( evt.keyCode == 120) {
		kill();
	}

	// enter - browse to story 
	else if( evt.keyCode == 13 ) {
		browse();
	}

	// 'c' - read comments 
	else if( evt.keyCode == 99 ) {
		comments();
	}
}

/**
 * Used by 'x' command to kill a story
 */
function kill() {
	var id = currentrow.getElementsByTagName( 'a' )[0].id;
	// using 'true' here - this is arbitrary, all
	// we check is existence of the key in the store
	localStorage.setItem( id, 'true' );

	// move current row position down before deleting anything 
	if( currentrow.nextSibling != null ) {
		moveDown();
	}
	// TODO: use removeRow() to keep things DRY
	currentrow.parentNode.removeChild( currentrow.previousSibling );
	currentrow.parentNode.removeChild( currentrow.previousSibling );
	currentrow.parentNode.removeChild( currentrow.previousSibling );
}

/**
 * Used by 'enter' command to browse to a story 
 */
function browse() {
	// big hairy dom traversal - we have to go specifically to third 
	// child rather than just pulling all anchor elements since if a 
	// story is voted up, the link count will be off.
	var link = currentrow.children[2].getElementsByTagName( 'a' )[0].href;
	window.location = link;
}

/**
 * Used by 'c' command to browse to comments 
 */
function comments() {
	// the comments are in the 'subtext' line, which immediately follows
	// the main subject line and consists
	// of 3 links always (I think, if you flag a story, the link is replaced
	// by an 'unflag' option, so the number of links is consistent.)
	// the third link goes to the comments for the story.
	var link = currentrow.nextSibling.getElementsByTagName( 'a' )[2].href;
	window.location = link;
}

/**
 * row removal method used by killstories(). 
 * TODO: merge the method used by 'x' command to keep it DRY
 */
function removeRow( el ) {
	el.parentNode.removeChild( el.nextSibling.nextSibling );
	el.parentNode.removeChild( el.nextSibling );
	el.parentNode.removeChild( el );
}


</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/newcome.wordpress.com/1524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/newcome.wordpress.com/1524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/newcome.wordpress.com/1524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/newcome.wordpress.com/1524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/newcome.wordpress.com/1524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/newcome.wordpress.com/1524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/newcome.wordpress.com/1524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/newcome.wordpress.com/1524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/newcome.wordpress.com/1524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/newcome.wordpress.com/1524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/newcome.wordpress.com/1524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/newcome.wordpress.com/1524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/newcome.wordpress.com/1524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/newcome.wordpress.com/1524/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1524&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://newcome.wordpress.com/2012/01/14/hack-the-web-your-way-with-userjs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">newcome</media:title>
		</media:content>
	</item>
		<item>
		<title>JS documentation is still sort of a ghetto &#8211; promote JS</title>
		<link>http://newcome.wordpress.com/2012/01/04/js-documentation-is-still-sort-of-a-ghetto-promote-js/</link>
		<comments>http://newcome.wordpress.com/2012/01/04/js-documentation-is-still-sort-of-a-ghetto-promote-js/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 01:01:27 +0000</pubDate>
		<dc:creator>newcome</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newcome.wordpress.com/?p=1521</guid>
		<description><![CDATA[Way back in 2006 when I started working on Ubernote, there were basically three different places that I went to for documentation on Javascript in the browser &#8211; MSDN, MDN, and w3schools. Microsoft MSDN actually was pretty good back then, but now I don&#8217;t care about IE so much. MDN was excellent but it was [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1521&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Way back in 2006 when I started working on Ubernote, there were basically three different places that I went to for documentation on Javascript in the browser &#8211; MSDN, MDN, and w3schools. Microsoft MSDN actually was pretty good back then, but now I don&#8217;t care about IE so much. MDN was excellent but it was tricky to get just the right page you were looking for. I remember spelunking around and after hitting a bunch of placeholder pages, I&#8217;d suddenly hit pay dirt after a little while.</p>
<p>I know that w3schools is basically a ghetto code-snippet site but in many cases it is still the only reliable source of simple examples of how to get something done in JS. Unfortunately, now that I have some more experience, I realize that a lot of the examples they give are outdated or browser-specific.</p>
<p>I&#8217;m a little concerned now when I look something up like XML support in the browsers and come up with more w3schools content even after all of the <a href="http://promotejs.com/">movements</a> toward getting other results up in search results.</p>
<p>I think that there are now plenty of sites that teach basic JS fundamentals, but examples of how to do specific things in the browser using various browser APIs is still sorely lacking.</p>
<p>Sorry this is a random rant, hopefully I can collect my thoughts on this a little better soon.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/newcome.wordpress.com/1521/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/newcome.wordpress.com/1521/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/newcome.wordpress.com/1521/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/newcome.wordpress.com/1521/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/newcome.wordpress.com/1521/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/newcome.wordpress.com/1521/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/newcome.wordpress.com/1521/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/newcome.wordpress.com/1521/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/newcome.wordpress.com/1521/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/newcome.wordpress.com/1521/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/newcome.wordpress.com/1521/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/newcome.wordpress.com/1521/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/newcome.wordpress.com/1521/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/newcome.wordpress.com/1521/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1521&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://newcome.wordpress.com/2012/01/04/js-documentation-is-still-sort-of-a-ghetto-promote-js/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">newcome</media:title>
		</media:content>
	</item>
		<item>
		<title>Basics of CSS 3D transforms</title>
		<link>http://newcome.wordpress.com/2011/12/25/basics-of-css-3d-transforms/</link>
		<comments>http://newcome.wordpress.com/2011/12/25/basics-of-css-3d-transforms/#comments</comments>
		<pubDate>Sun, 25 Dec 2011 11:59:34 +0000</pubDate>
		<dc:creator>newcome</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newcome.wordpress.com/?p=1512</guid>
		<description><![CDATA[CSS is getting more and more powerful these days, and now that CSS3 supports 3D transforms, we can do quite a lot without resorting to WebGL or some complex 3D drawing library. However, visualizing how 3D works in CSS can still be tricky, and it isn&#8217;t as flexible or rigorous as something like OpenGL. I&#8217;ve [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1512&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>CSS is getting more and more powerful these days, and now that CSS3 supports 3D transforms, we can do quite a lot without resorting to WebGL or some complex 3D drawing library. However, visualizing how 3D works in CSS can still be tricky, and it isn&#8217;t as flexible or rigorous as something like OpenGL. I&#8217;ve just started digging into 3D for possible extensions to the <a href="https://github.com/dnewcome/Donatello">Donatello</a> drawing library, so I thought I&#8217;d jot down a few initial notes here.</p>
<p>We&#8217;ll be using the Firefox nightly for the examples. They should work in Webkit also by modifying the CSS property prefixes, but I won&#8217;t cover that here. I&#8217;m going to start out with a very basic code example to get started. There don&#8217;t seem to be many explanations on the Web concerning what the bare minimum is to get things working. </p>
<p>The way the 3D transforms work is that there is a DOM element that sets the perspective reference, and elements that are to be rendered using 3D transforms are contained within this element. The reference element is not a viewport in the sense of typical 3D applications. Think of it more along the lines of the world scene graph. Elements may be outside of this container as is the case normally with CSS positioning using, say, a negative offset. There are other ways that content may appear outside of the parent element by way of the 3D transforms themselves as well.</p>
<p>Ok, let&#8217;s cut to the most basic example: a perspective view of a square div element that has been positioned perpendicular to the view reference plane.</p>
<p>To start with, let&#8217;s create a green square centered inside of a black-bordered &#8220;viewport&#8221; using standard CSS positioning and nothing fancy:</p>
<p><pre class="brush: xml;">

&lt;div class=&quot;view&quot;&gt;
    &lt;div class=&quot;square&quot;&gt;
    &lt;/div&gt;
&lt;/div&gt;

</pre></p>
<p><pre class="brush: css;">
.view {
    border: 1px solid black;
    width: 300px;
    height: 300px;
}
.square {
    background-color: green;
    position: absolute;
    top: 100px;
    left: 100px;
    width: 100px;
    height: 100px;
}   
</pre></p>
<p>Firefox renders this like so:</p>
<p><a href="http://newcome.files.wordpress.com/2011/12/no-3d1.png"><img src="http://newcome.files.wordpress.com/2011/12/no-3d1.png?w=700" alt="" title="no-3d"   class="aligncenter size-full wp-image-1514" /></a></p>
<p>Now in order to establish the 3D viewport and flip the square up onto its top edge, we need to do a few things. We&#8217;ll add the following CSS to the &#8220;view&#8221; class in order to put the observer over the center of the viewport element, 200 pixels overhead:</p>
<p><pre class="brush: css;">
-moz-perspective: 200px;
-moz-transform-style: preserve-3d;
-moz-perspective-origin: 50% 50%;

</pre></p>
<p>Note that we need to use the vendor-specific &#8220;-moz&#8221; prefixes for the new CSS attributes. The W3C spec defines these without vendor prefixes, but for now, we need the prefixes if we want our code to work in any current real-world production Web browsers. Also keep in mind that the transform-style should be set to &#8220;preserve-3d&#8221;, since the default is &#8220;flat&#8221; and will effectively turn the 3D scene into a flat 2D projection, which will be very confusing to figure out if you don&#8217;t know what is going on. For example, our green square will end up just squashed into a shorter rectangle without this setting enabled.</p>
<p>In order to stand the green square up on end, we use the following CSS:</p>
<p><pre class="brush: css;">
-moz-transform-origin: 0% 0%;  
-moz-transform: rotateX( 90deg ); 
</pre></p>
<p>Here we set the origin to the top left of the square and rotate it 90 degrees along the X axis (which is now aligned along the top edge of the green square courtesy of transform-origin).</p>
<p>The result looks like this:</p>
<p><a href="http://newcome.files.wordpress.com/2011/12/3d.png"><img src="http://newcome.files.wordpress.com/2011/12/3d.png?w=700" alt="" title="3d"   class="aligncenter size-full wp-image-1516" /></a></p>
<p>Something to note if things don&#8217;t work as you&#8217;d expect is that the entire object must be beyond the viewer&#8217;s perspective. That is, if we stand a 100 pixel object up as we have done, and the perspective is set to 99 pixels, the object will disappear entirely from view. This caused me some pain early on in this exploration. Also, the position of the object in the scene doesn&#8217;t seem to affect its perspective rendering, but moving the perspective origin does. I&#8217;m not sure if this is intentional, but it is pretty confusing as you&#8217;d expect that moving either the camera or the object would have the same effect, but it doesn&#8217;t seem to. I could be mistaken on this, I&#8217;d love to hear from you if you have any more detail on how this works.</p>
<p>For more complex 3D examples check out the <a href="https://developer.mozilla.org/en/CSS/Using_CSS_transforms">Mozilla Developer Network</a><br />
However beware that they aren&#8217;t very well explained so if you didn&#8217;t quite get what I showed above, I&#8217;d try to figure out the simple case first before looking at the Mozilla examples.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/newcome.wordpress.com/1512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/newcome.wordpress.com/1512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/newcome.wordpress.com/1512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/newcome.wordpress.com/1512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/newcome.wordpress.com/1512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/newcome.wordpress.com/1512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/newcome.wordpress.com/1512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/newcome.wordpress.com/1512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/newcome.wordpress.com/1512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/newcome.wordpress.com/1512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/newcome.wordpress.com/1512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/newcome.wordpress.com/1512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/newcome.wordpress.com/1512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/newcome.wordpress.com/1512/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1512&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://newcome.wordpress.com/2011/12/25/basics-of-css-3d-transforms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">newcome</media:title>
		</media:content>

		<media:content url="http://newcome.files.wordpress.com/2011/12/no-3d1.png" medium="image">
			<media:title type="html">no-3d</media:title>
		</media:content>

		<media:content url="http://newcome.files.wordpress.com/2011/12/3d.png" medium="image">
			<media:title type="html">3d</media:title>
		</media:content>
	</item>
		<item>
		<title>Static method patterns</title>
		<link>http://newcome.wordpress.com/2011/12/14/static-method-patterns/</link>
		<comments>http://newcome.wordpress.com/2011/12/14/static-method-patterns/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 10:32:10 +0000</pubDate>
		<dc:creator>newcome</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newcome.wordpress.com/?p=1508</guid>
		<description><![CDATA[When programming with statically-typed OO languages we all have the temptation sooner or later to implement some functionality using static methods. Static methods are &#8220;class&#8221; methods, which are called on the data types themselves rather than on an instance of a class. In Microsoft .NET, Static methods are shared among all code that exists within [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1508&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When programming with statically-typed OO languages we all have the temptation sooner or later to implement some functionality using static methods. Static methods are &#8220;class&#8221; methods, which are called on the data types themselves rather than on an instance of a class.</p>
<p>In Microsoft .NET, Static methods are shared among all code that exists within a given application domain (appdomain). Static methods are very convenient for creating code that doesn&#8217;t need to deal with any external state, since we don&#8217;t have to create an instance of any class in order to call the code.</p>
<p>However, static methods do not participate in inheritance. They exist largely outside of the mechanisms that make object-oriented programming attractive. In light of this fact, I think that most of the time, static methods are an anti-pattern.</p>
<p>Static methods can make code hard to test since it is impossible to replace the static methods with alternative implementations such as mocks or stubs.</p>
<p>There is one workaround that I&#8217;ve found which I call the Static Adapter pattern. I have seen some references to this same pattern, and I don&#8217;t claim to have invented it, but I don&#8217;t see it listed in most classic design patterns books.</p>
<p>A static proxy is just like a classic proxy pattern but the methods on the proxy are static. For example, in a traditional proxy pattern we&#8217;d have something like this:</p>
<p><pre class="brush: csharp;">
// proxied class
public class Service 
{
    public void DoSomething() {
        // something happens here
    }
}

public class ServiceProxy 
{
    // internally we have an instance of proxied class
    private Service m_service = new Service();

    // proxy the call to DoSomething()
    public void DoSomething() {
        m_service.DoSomething();
    }
}
</pre></p>
<p>In order to use the proxy, we do something like the following:</p>
<p><pre class="brush: csharp;">
ServiceProxy proxy = new ServiceProxy();
proxy.DoSomething();
</pre></p>
<p>Notice that we have to create an instance of the proxy in order to work with it. Now there are two things that I want to extend this code to do. One is to allow me to avoid creating an instance of the proxy, and the other is to allow me to give the proxy a different internal service:</p>
<p><pre class="brush: csharp;">
public class ServiceProxy 
{
    // internally we have an instance of proxied class
    public static Service m_service;

    // proxy the call to DoSomething()
    public static void DoSomething() {
        m_service.DoSomething();
    }
}
</pre></p>
<p>So now we have a static constructor that allows us to give the proxy its service implementation. The method DoSomething() can also now be called directly as:</p>
<p><pre class="brush: csharp;">
ServiceProxy.m_service = new Service();
ServiceProxy.DoSomething();
</pre></p>
<p>We still have to specify the internal service for this to work. If we can get away with doing a default instantiation of the service we can do</p>
<p><pre class="brush: csharp;">
ServiceProxy.DoSomething();
</pre></p>
<p>These static classes cannot implement an interface, but their internal services can. In order to provide a test implementation of some class we can plug in a dummy or test double as the internal service.</p>
<p>That&#8217;s enough for this post. I&#8217;ll have more to say about static classes and methods later.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/newcome.wordpress.com/1508/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/newcome.wordpress.com/1508/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/newcome.wordpress.com/1508/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/newcome.wordpress.com/1508/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/newcome.wordpress.com/1508/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/newcome.wordpress.com/1508/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/newcome.wordpress.com/1508/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/newcome.wordpress.com/1508/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/newcome.wordpress.com/1508/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/newcome.wordpress.com/1508/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/newcome.wordpress.com/1508/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/newcome.wordpress.com/1508/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/newcome.wordpress.com/1508/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/newcome.wordpress.com/1508/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1508&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://newcome.wordpress.com/2011/12/14/static-method-patterns/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">newcome</media:title>
		</media:content>
	</item>
		<item>
		<title>When to write a library</title>
		<link>http://newcome.wordpress.com/2011/12/13/when-to-write-a-library/</link>
		<comments>http://newcome.wordpress.com/2011/12/13/when-to-write-a-library/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 06:30:39 +0000</pubDate>
		<dc:creator>newcome</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newcome.wordpress.com/?p=1505</guid>
		<description><![CDATA[I&#8217;ve been meaning to write this post for a while. There have been a lot of instances in my work where the debate comes up about when to start abstracting code. There inevitably comes a time where a bit of code gets copied and tweaked enough times that it screams out to be put into [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1505&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been meaning to write this post for a while. There have been a lot of instances in my work where the debate comes up about when to start abstracting code. There inevitably comes a time where a bit of code gets copied and tweaked enough times that it screams out to be put into a common library. However it has been my experience that programmers are still reluctant to take on the task of creating a common code base. Actually I&#8217;ve also noticed that many times programmers think that &#8220;code reuse&#8221; means just copying some of the files out of a previous project when starting a new one.</p>
<p>Some of these quick and dirty techniques are expedient initially, but we need to move past them to make any real progress on the problems that we work on. In my experience, creating modular code allows the code to be reasoned about more easily.</p>
<p>However, there are some downsides to creating libraries. It takes a non-trivial amount of work to create and maintain a piece of shared code. Once a piece of code is used in many places, it becomes nearly impossible to test the code without dedicated tests that cover all intended use cases. This means that even if the code is already written as a de facto library, lots of supporting code needs to be written in order to make the library maintainable.</p>
<p>Existing client code needs to be re-factored to use the new library going forward. This step is not totally necessary, as many times older code bases can be maintained as legacy code bases separately and only upgraded if other changes are necessary later on.</p>
<p>So this leads us to the question, when does it make sense to write a library? I&#8217;d say that when the pain of not having the code centrally located becomes significant. In the past I was a purist and I would have created some library right away, but I think that it takes some time to even figure out what the API should be so I think it makes sense now to intentionally experience some pain of having maybe three or four different versions of the code before consolidating the code. </p>
<p>Unfortunately, I think some languages make the unit of code deployment too large and cumbersome. In the .NET framework I&#8217;d argue that the Assembly is too cumbersome for many things. There are many times where I want a single interface to be independent and available separately but I would have to put it in its own assembly in order to reference it separately. It&#8217;s easy to fall into DLL hell with tens or even hundreds of assemblies. Each assembly carries the overhead of a separate build file or Visual Studio project file. I think there needs to be a lighter weight way of sharing code in .NET. </p>
<p>This post rambled on a bit, but I&#8217;m getting started on a series of posts on software engineering, so I wanted to kick things off with some problems that I have faced in the past, of which this is one of the most difficult.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/newcome.wordpress.com/1505/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/newcome.wordpress.com/1505/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/newcome.wordpress.com/1505/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/newcome.wordpress.com/1505/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/newcome.wordpress.com/1505/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/newcome.wordpress.com/1505/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/newcome.wordpress.com/1505/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/newcome.wordpress.com/1505/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/newcome.wordpress.com/1505/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/newcome.wordpress.com/1505/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/newcome.wordpress.com/1505/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/newcome.wordpress.com/1505/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/newcome.wordpress.com/1505/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/newcome.wordpress.com/1505/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1505&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://newcome.wordpress.com/2011/12/13/when-to-write-a-library/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">newcome</media:title>
		</media:content>
	</item>
		<item>
		<title>Full-stack programming case study</title>
		<link>http://newcome.wordpress.com/2011/12/04/full-stack-programming-case-study/</link>
		<comments>http://newcome.wordpress.com/2011/12/04/full-stack-programming-case-study/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 06:51:04 +0000</pubDate>
		<dc:creator>newcome</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newcome.wordpress.com/?p=1501</guid>
		<description><![CDATA[There has been a lot of talk about &#8220;full-stack&#8221; programmers in the tech press recently. Along with the concept of &#8220;devops&#8221; this is an important distinction to make between pure coders and people who are capable of systems thinking. Generally speaking, in addition to a deep understanding of their core programming skills, they understand other [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1501&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There has been a lot of talk about &#8220;full-stack&#8221; programmers in the tech press recently. Along with the concept of &#8220;devops&#8221; this is an important distinction to make between pure coders and people who are capable of systems thinking. Generally speaking, in addition to a deep understanding of their core programming skills, they understand other parts of the IT stack like hardware, networking and operations.</p>
<p>I&#8217;m going to recount a story from a previous job I had where I was a programmer. We had a network team that was proficient in maintaining the existing network, but as the data center grew, things started to get unmanageable. The team argued about how to extend the network from the current single-subnet design to a multi-subnet network implemented with vlan-capable switches. </p>
<p>After many meetings and delays the network team had finally procured new equipment and thrown the stuff into the racks in the data center. However, no real thought had been given to how the migration would take place. Everyone was afraid to unplug anything and the data center couldn&#8217;t be down for more than a few hours, so any cut over would have to be prepared well in advance.</p>
<p>The network team wasn&#8217;t making any progress on the problem, so the CTO came to me to figure out if there was some solution to the migration problem. I&#8217;ve designed some pretty big networks in the past and I&#8217;ve dealt with some seriously big datacenter iron, so I figured that this network wouldn&#8217;t be too complex.</p>
<p>Since I had done some low level network programming in the past, I knew how multiple subnets could be subsumed in a larger subnet, and that asymmetrical routes could be created even though it is not a best practice to do so. The solution that I came up with would allow each machine on the network to be moved one at a time by setting up some asymmetric routes ahead of time. Once the routes were in place, machines could be moved without any of the other clients on the network noticing that they were actually on a new network. This allowed the network team to spread the migration out over several days without any outage at all. Once all machines were moved, the temporary routes were removed and everything was in order with networking best practices.</p>
<p>I found a diagram that I created for this project and redacted the IP addresses so that you can see the full solution. </p>
<p><a href="http://newcome.files.wordpress.com/2011/12/asym-network-redacted.png"><img src="http://newcome.files.wordpress.com/2011/12/asym-network-redacted.png?w=700&#038;h=520" alt="" title="asym-network-redacted" width="700" height="520" class="aligncenter size-full wp-image-1503" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/newcome.wordpress.com/1501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/newcome.wordpress.com/1501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/newcome.wordpress.com/1501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/newcome.wordpress.com/1501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/newcome.wordpress.com/1501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/newcome.wordpress.com/1501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/newcome.wordpress.com/1501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/newcome.wordpress.com/1501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/newcome.wordpress.com/1501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/newcome.wordpress.com/1501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/newcome.wordpress.com/1501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/newcome.wordpress.com/1501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/newcome.wordpress.com/1501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/newcome.wordpress.com/1501/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1501&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://newcome.wordpress.com/2011/12/04/full-stack-programming-case-study/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">newcome</media:title>
		</media:content>

		<media:content url="http://newcome.files.wordpress.com/2011/12/asym-network-redacted.png" medium="image">
			<media:title type="html">asym-network-redacted</media:title>
		</media:content>
	</item>
		<item>
		<title>Why compiled regular expressions are awesome</title>
		<link>http://newcome.wordpress.com/2011/12/04/why-compiled-regular-expressions-are-awesome/</link>
		<comments>http://newcome.wordpress.com/2011/12/04/why-compiled-regular-expressions-are-awesome/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 06:07:20 +0000</pubDate>
		<dc:creator>newcome</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newcome.wordpress.com/?p=1499</guid>
		<description><![CDATA[I was doing a little code spelunking recently and found this gem of a macro in the University of Washington IMAP server code. It does some validation of various date formats in email headers. The code was written this way for performance, but I wonder if regexps in modern languages would be up to the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1499&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was doing a little code spelunking recently and found this gem of a macro in the University of Washington IMAP server code. It does some validation of various date formats in email headers. The code was written this way for performance, but I wonder if regexps in modern languages would be up to the task? Anyway, I have posted the code here for your enjoyment.</p>
<p><pre class="brush: cpp;">

/* ========================================================================
 * Copyright 1988-2006 University of Washington
 *
 * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * 
 * ========================================================================
 */

/*
 * Program:	UNIX mail routines
 *
 * Author:	Mark Crispin
 *		Networks and Distributed Computing
 *		Computing &amp; Communications
 *		University of Washington
 *		Administration Building, AG-44
 *		Seattle, WA  98195
 *		Internet: MRC@CAC.Washington.EDU
 *
 * Date:	20 December 1989
 * Last Edited:	30 August 2006
 */


/*				DEDICATION
 *
 *  This file is dedicated to my dog, Unix, also known as Yun-chan and
 * Unix J. Terwilliker Jehosophat Aloysius Monstrosity Animal Beast.  Unix
 * passed away at the age of 11 1/2 on September 14, 1996, 12:18 PM PDT, after
 * a two-month bout with cirrhosis of the liver.
 *
 *  He was a dear friend, and I miss him terribly.
 *
 *  Lift a leg, Yunie.  Luv ya forever!!!!
 */

/* Validate line
 * Accepts: pointer to candidate string to validate as a From header
 *	    return pointer to end of date/time field
 *	    return pointer to offset from t of time (hours of ``mmm dd hh:mm'')
 *	    return pointer to offset from t of time zone (if non-zero)
 * Returns: t,ti,zn set if valid From string, else ti is NIL
 */

#define VALID(s,x,ti,zn) {						\
  ti = 0;								\
  if ((*s == 'F') &amp;&amp; (s[1] == 'r') &amp;&amp; (s[2] == 'o') &amp;&amp; (s[3] == 'm') &amp;&amp;	\
      (s[4] == ' ')) {							\
    for (x = s + 5; *x &amp;&amp; *x != '&#092;&#048;12'; x++);				\
    if (*x) {								\
      if (x[-1] == '&#092;&#048;15') --x;						\
      if (x - s &gt;= 41) {						\
	for (zn = -1; x[zn] != ' '; zn--);				\
	if ((x[zn-1] == 'm') &amp;&amp; (x[zn-2] == 'o') &amp;&amp; (x[zn-3] == 'r') &amp;&amp;	\
	    (x[zn-4] == 'f') &amp;&amp; (x[zn-5] == ' ') &amp;&amp; (x[zn-6] == 'e') &amp;&amp;	\
	    (x[zn-7] == 't') &amp;&amp; (x[zn-8] == 'o') &amp;&amp; (x[zn-9] == 'm') &amp;&amp;	\
	    (x[zn-10] == 'e') &amp;&amp; (x[zn-11] == 'r') &amp;&amp; (x[zn-12] == ' '))\
	  x += zn - 12;							\
      }									\
      if (x - s &gt;= 27) {						\
	if (x[-5] == ' ') {						\
	  if (x[-8] == ':') zn = 0,ti = -5;				\
	  else if (x[-9] == ' ') ti = zn = -9;				\
	  else if ((x[-11] == ' ') &amp;&amp; ((x[-10]=='+') || (x[-10]=='-')))	\
	    ti = zn = -11;						\
	}								\
	else if (x[-4] == ' ') {					\
	  if (x[-9] == ' ') zn = -4,ti = -9;				\
	}								\
	else if (x[-6] == ' ') {					\
	  if ((x[-11] == ' ') &amp;&amp; ((x[-5] == '+') || (x[-5] == '-')))	\
	    zn = -6,ti = -11;						\
	}								\
	if (ti &amp;&amp; !((x[ti - 3] == ':') &amp;&amp;				\
		    (x[ti -= ((x[ti - 6] == ':') ? 9 : 6)] == ' ') &amp;&amp;	\
		    (x[ti - 3] == ' ') &amp;&amp; (x[ti - 7] == ' ') &amp;&amp;		\
		    (x[ti - 11] == ' '))) ti = 0;			\
      }									\
    }									\
  }									\
}

/* You are not expected to understand this macro, but read the next page if
 * you are not faint of heart.
 *
 * Known formats to the VALID macro are:
 *		From user Wed Dec  2 05:53 1992
 * BSD		From user Wed Dec  2 05:53:22 1992
 * SysV		From user Wed Dec  2 05:53 PST 1992
 * rn		From user Wed Dec  2 05:53:22 PST 1992
 *		From user Wed Dec  2 05:53 -0700 1992
 * emacs	From user Wed Dec  2 05:53:22 -0700 1992
 *		From user Wed Dec  2 05:53 1992 PST
 *		From user Wed Dec  2 05:53:22 1992 PST
 *		From user Wed Dec  2 05:53 1992 -0700
 * Solaris	From user Wed Dec  2 05:53:22 1992 -0700
 *
 * Plus all of the above with `` remote from xxx'' after it. Thank you very
 * much, smail and Solaris, for making my life considerably more complicated.
 */

/*
 * What?  You want to understand the VALID macro anyway?  Alright, since you
 * insist.  Actually, it isn't really all that difficult, provided that you
 * take it step by step.
 *
 * Line 1	Initializes the return ti value to failure (0);
 * Lines 2-3	Validates that the 1st-5th characters are ``From ''.
 * Lines 4-6	Validates that there is an end of line and points x at it.
 * Lines 7-14	First checks to see if the line is at least 41 characters long.
 *		If so, it scans backwards to find the rightmost space.  From
 *		that point, it scans backwards to see if the string matches
 *		`` remote from''.  If so, it sets x to point to the space at
 *		the start of the string.
 * Line 15	Makes sure that there are at least 27 characters in the line.
 * Lines 16-21	Checks if the date/time ends with the year (there is a space
 *		five characters back).  If there is a colon three characters
 *		further back, there is no timezone field, so zn is set to 0
 *		and ti is set in front of the year.  Otherwise, there must
 *		either to be a space four characters back for a three-letter
 *		timezone, or a space six characters back followed by a + or -
 *		for a numeric timezone; in either case, zn and ti become the
 *		offset of the space immediately before it.
 * Lines 22-24	Are the failure case for line 14.  If there is a space four
 *		characters back, it is a three-letter timezone; there must be a
 *		space for the year nine characters back.  zn is the zone
 *		offset; ti is the offset of the space.
 * Lines 25-28	Are the failure case for line 20.  If there is a space six
 *		characters back, it is a numeric timezone; there must be a
 *		space eleven characters back and a + or - five characters back.
 *		zn is the zone offset; ti is the offset of the space.
 * Line 29-32	If ti is valid, make sure that the string before ti is of the
 *		form www mmm dd hh:mm or www mmm dd hh:mm:ss, otherwise
 *		invalidate ti.  There must be a colon three characters back
 *		and a space six or nine	characters back (depending upon
 *		whether or not the character six characters back is a colon).
 *		There must be a space three characters further back (in front
 *		of the day), one seven characters back (in front of the month),
 *		and one eleven characters back (in front of the day of week).
 *		ti is set to be the offset of the space before the time.
 *
 * Why a macro?  It gets invoked a *lot* in a tight loop.  On some of the
 * newer pipelined machines it is faster being open-coded than it would be if
 * subroutines are called.
 *
 * Why does it scan backwards from the end of the line, instead of doing the
 * much easier forward scan?  There is no deterministic way to parse the
 * ``user'' field, because it may contain unquoted spaces!  Yes, I tested it to
 * see if unquoted spaces were possible.  They are, and I've encountered enough
 * evil mail to be totally unwilling to trust that ``it will never happen''.
 */

/* Build parameters */

#define KODRETRY 15		/* kiss-of-death retry in seconds */
#define LOCKTIMEOUT 5		/* lock timeout in minutes */

</pre> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/newcome.wordpress.com/1499/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/newcome.wordpress.com/1499/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/newcome.wordpress.com/1499/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/newcome.wordpress.com/1499/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/newcome.wordpress.com/1499/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/newcome.wordpress.com/1499/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/newcome.wordpress.com/1499/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/newcome.wordpress.com/1499/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/newcome.wordpress.com/1499/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/newcome.wordpress.com/1499/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/newcome.wordpress.com/1499/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/newcome.wordpress.com/1499/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/newcome.wordpress.com/1499/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/newcome.wordpress.com/1499/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1499&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://newcome.wordpress.com/2011/12/04/why-compiled-regular-expressions-are-awesome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">newcome</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating softened CSS callouts</title>
		<link>http://newcome.wordpress.com/2011/11/01/creating-softened-css-callouts/</link>
		<comments>http://newcome.wordpress.com/2011/11/01/creating-softened-css-callouts/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 10:41:16 +0000</pubDate>
		<dc:creator>newcome</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://newcome.wordpress.com/?p=1479</guid>
		<description><![CDATA[Although I haven&#8217;t had much time to post on my blog, I&#8217;ve been doing a few things with CSS lately. One question someone asked me recently was how to get a nice soft callout triangle done using just CSS. I came up with three different basic solutions to this: Duplicate the element, changing the color [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1479&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Although I haven&#8217;t had much time to post on my blog, I&#8217;ve been doing a <a href="https://github.com/dnewcome/Donatello">few things with CSS</a> lately. One question someone asked me recently was how to get a nice soft callout triangle done using just CSS.</p>
<p>I came up with three different basic solutions to this:</p>
<ul>
<li>Duplicate the element, changing the color and scaling the elements to create a layered gradient edge</li>
<li>Rotate and clip using gradient</li>
<li>Rotate and clip using box-shadow</li>
</ul>
<p>My friend&#8217;s solution was like my first solution but nicer since he thought to adjust the opacity of the layers instead of messing with the color.</p>
<p>There is one other thing that I thought about later on, but didn&#8217;t get a chance to test, was to use <a href="https://developer.mozilla.org/En/Applying_SVG_effects_to_HTML_content">SVG filtering</a> applied as a mask to the DOM element.</p>
<p>So, just to clarify what we are talking about, we want to end up with those <a href="http://www.dailycoding.com/Posts/purely_css_callouts.aspx">little triangles</a> that mark the tab or page that we are on or form the little speech balloons that are everywhere on social networks these days. The traditional way of doing these was with images, but as we all know, lots of little images in our design is a drag.</p>
<p>The main technique for doing them in HTML DOM is to use the <a href="http://mrcoles.com/blog/callout-box-css-border-triangles-cross-browser/">transparent border trick</a>. We can give an element a border on one side and a zero width and height in order to get a triangle.</p>
<p>I&#8217;m going to show an alternative way of doing this using a rotated block element along with a rectangular clipping region. In order to show the steps I&#8217;ve made the clipping region visible until the end of the process so that you can see what is going on.</p>
<p>For the first cut at the problem, we&#8217;ll create a rotated block inside of a black-bordered div. We want to set a box shadow on the element, as that is what will give us the nice soft edge to our callout. Note that we are only showing the CSS for Webkit here. For full compatibility we&#8217;ll want to also include other browser-specific elements.</p>
<p>The following HTML will be used throughout the example so I&#8217;ll show it here only once:</p>
<p><pre class="brush: xml;">
&lt;div class='clip'&gt;
  &lt;div class='triangle'&gt;&lt;/div&gt;
&lt;/div&gt;
</pre></p>
<p>The CSS goes thusly:</p>
<p><pre class="brush: css;">
.triangle {
  position: absolute;
  width: 10px;
  height: 10px;
  left: 4px;
  top: -5px;
  background-color: black;
  -webkit-transform: rotate(45deg);
  -webkit-box-shadow: 0px 0px 1px 1px #a0a0a0;
}
.clip {
  height: 16px;
  width: 18px;
  border: 1px solid black;
  position: relative;
}

</pre></p>
<p>Giving us the following figure:</p>
<p><a href="http://newcome.files.wordpress.com/2011/11/shadow-tri-1.png"><img src="http://newcome.files.wordpress.com/2011/11/shadow-tri-1.png?w=700" alt="" title="shadow-tri-1"   class="aligncenter size-full wp-image-1480" /></a></p>
<p>Once we have this in place, we want to arrange the actual element outside of what will be the visible area, that is, above the clipping region. At the same time we&#8217;ll want to move the offset of the box shadow further down into the visible part of the clipping region so that half of the box shadow is inside of the visible part of the region. The reason that we want to get the element totally out of the way is that some browsers display a thin line between the rotated object and its shadow, which is an ugly artifact that we want to get rid of.  </p>
<p><pre class="brush: css;">
.triangle {
   position: absolute;
   width: 10px;
   height: 10px;
   left: 4px;
   top: -15px;
   background-color: black;
   -webkit-transform: rotate(45deg);
   -webkit-box-shadow: 6px 6px 1px 1px #a0a0a0;
}
.clip {
   height: 16px;
   width: 18px;
   border: 1px solid black;
   position: relative;
}

</pre></p>
<p>One tricky thing to note here is that the CSS top property is not affected by rotation, but the box-shadow offsets are relative to the rotated figure. This means that we have to adjust both the x and y values of the box-shadow offset while only changing the CSS top value of the div element.</p>
<p>The final position with all of the elements still visible looks like the following: </p>
<p><a href="http://newcome.files.wordpress.com/2011/11/shadow-tri-21.png"><img src="http://newcome.files.wordpress.com/2011/11/shadow-tri-21.png?w=700" alt="" title="shadow-tri-2"   class="aligncenter size-full wp-image-1485" /></a></p>
<p>Finally, let&#8217;s remove the training wheels. Remove the black border and set the overflow so the clipping region actually does its job of clipping.</p>
<p><pre class="brush: css;">
    .clip {
                height: 16px;
                width: 18px;
                position: relative;
                overflow: hidden;
            }
</pre></p>
<p>The final figure looks like this:</p>
<p><a href="http://newcome.files.wordpress.com/2011/11/shadow-tri-finsish.png"><img src="http://newcome.files.wordpress.com/2011/11/shadow-tri-finsish.png?w=700" alt="" title="shadow-tri-finsish"   class="aligncenter size-full wp-image-1482" /></a></p>
<p>Note the soft edges of the triangle. Presumably the top edge will be adjacent to some other element in the composition, so we don&#8217;t need to worry too much about softening that edge. </p>
<p>There are some other fun things we can do using this technique including gradient triangles, but I&#8217;ll leave that to another post.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/newcome.wordpress.com/1479/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/newcome.wordpress.com/1479/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/newcome.wordpress.com/1479/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/newcome.wordpress.com/1479/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/newcome.wordpress.com/1479/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/newcome.wordpress.com/1479/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/newcome.wordpress.com/1479/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/newcome.wordpress.com/1479/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/newcome.wordpress.com/1479/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/newcome.wordpress.com/1479/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/newcome.wordpress.com/1479/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/newcome.wordpress.com/1479/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/newcome.wordpress.com/1479/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/newcome.wordpress.com/1479/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=newcome.wordpress.com&amp;blog=2420329&amp;post=1479&amp;subd=newcome&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://newcome.wordpress.com/2011/11/01/creating-softened-css-callouts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">newcome</media:title>
		</media:content>

		<media:content url="http://newcome.files.wordpress.com/2011/11/shadow-tri-1.png" medium="image">
			<media:title type="html">shadow-tri-1</media:title>
		</media:content>

		<media:content url="http://newcome.files.wordpress.com/2011/11/shadow-tri-21.png" medium="image">
			<media:title type="html">shadow-tri-2</media:title>
		</media:content>

		<media:content url="http://newcome.files.wordpress.com/2011/11/shadow-tri-finsish.png" medium="image">
			<media:title type="html">shadow-tri-finsish</media:title>
		</media:content>
	</item>
	</channel>
</rss>
