<?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>Crawl, Walk, Run</title>
	<atom:link href="http://adam.yanalunas.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://adam.yanalunas.com/blog</link>
	<description>The complete &#38; uncut edition</description>
	<lastBuildDate>Fri, 28 Oct 2011 02:17:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Don&#8217;t tell me what to focus on, I&#8217;ll tell you!</title>
		<link>http://adam.yanalunas.com/blog/archives/149</link>
		<comments>http://adam.yanalunas.com/blog/archives/149#comments</comments>
		<pubDate>Fri, 28 Oct 2011 02:17:38 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://adam.yanalunas.com/blog/?p=149</guid>
		<description><![CDATA[After a frustrating interaction with a form I whipped up a quick jQuery plugin for developers who don&#8217;t want to think about form field focus. I present to you&#8230; Polite Focus! It&#8217;s a simple idea &#8211; use document.activeElement to determine if an existing field has focus. If not, give your field focus. Otherwise, leave the [...]]]></description>
			<content:encoded><![CDATA[<p>After a frustrating interaction with a form I whipped up a quick jQuery plugin for developers who don&#8217;t want to think about form field focus.</p>
<p>I present to you&hellip;</p>
<h3>Polite Focus!</h3>
<p>It&#8217;s a simple idea &ndash; use <code>document.activeElement</code> to determine if an existing field has focus. If not, give your field focus. Otherwise, leave the focus where it is, where someone else (user or previous programmer) decided it should be.</p>
<p>That&#8217;s it.</p>
<h3>Go forth and use wisely</h3>
<p>I&#8217;ve created a repo on GitHub so you kids can branch and comment as much as you like.</p>
<p><a href="https://github.com/adamyanalunas/Polite-Focus">Go clone the plugin on GitHub. Now.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://adam.yanalunas.com/blog/archives/149/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using document fragment when rendering a backbone view</title>
		<link>http://adam.yanalunas.com/blog/archives/189</link>
		<comments>http://adam.yanalunas.com/blog/archives/189#comments</comments>
		<pubDate>Thu, 27 Oct 2011 15:53:41 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[backbone]]></category>
		<category><![CDATA[dom]]></category>

		<guid isPermaLink="false">http://adam.yanalunas.com/blog/?p=189</guid>
		<description><![CDATA[Backbone.js is pretty fun to use. Right out of the box it makes app development quick and organized. Fully grokking how to adapt to using view controllers is a bit of a change and the event system is happily powerful, yet blending it with jQuery events doesn&#8217;t seem immediately obvious. All the same it does [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://documentcloud.github.com/backbone/">Backbone.js</a> is pretty fun to use. Right out of the box it makes app development quick and organized. Fully grokking how to adapt to using view controllers is a bit of a change and the event system is happily powerful, yet blending it with jQuery events doesn&#8217;t seem immediately obvious. All the same it does a great job of giving great tools for organization and structure while staying out of your way. I suggest having the <a href="http://documentcloud.github.com/backbone/docs/backbone.html">annotated source</a> open in one of your tabs at all times.</p>
<p>One drawback to using a library that does magic is that if you&#8217;re not careful you can miss some important details. In this case I&#8217;m talking about injecting your views into the DOM. Blindly following the create view/render into element pattern as <a href="http://documentcloud.github.com/backbone/#View-render">described in the documentation</a> is usually fine. However, if you are using a view to render a list of children the <code>$(this.el).append(view.render().el)</code> quickly becomes costly.</p>
<p>For my needs I wanted to add an arbitrarily-long list of elements to an ordered list. Instead of blindly looping over models, creating views and shoving them into the list one at a time I decided to add all rendered views into a document fragment in memory and then append that fragment on to my list. Clean code for rendering, only one DOM adjustment for speed.</p>
<h3>Example Code!</h3>
<pre class="brush: jscript; title: ; notranslate">
var containerView = Backbone.View.extend({
//... snip
	render: function() {
		var template = _.template($('#regular_ol_template').html()),
			self = this;

		$(self.el).html(template(self.model.toJSON()));

		self.list = $('.list', self.el);

		var frag = document.createDocumentFragment();
		_.each(self.model.things.models, function(thing) {
			frag.appendChild(self.createThing.call(this, question).render().el);
		});
		self.list.append(frag);

		return self;
	},

	createThing: function(thing) {
		return new ThingView({model:thing});
	}
//... snip
});
</pre>
<h3>But why make a separate function?</h3>
<p>What you&#8217;re not seeing is another method named <code>addThing</code> which uses <code>createThing</code> and does more work &ndash; to my model, spinning up other views, etcetera. It&#8217;s also good not to bind the creation of elements solely into your render method. You want to be able to add more things to your list without fully re-rendering it. That way, should someone else decide to use my model or view in the app, elements in the list can be adjusted without the performance overhead of creating the whole list again.</p>
<h3>Result</h3>
<p>There you have it! You have now rendered your Backbone.js views into memory and appended them to the DOM in one fell swoop. Instead of abusing the DOM in your loop cycle you&#8217;ve speedily created them in memory. Isn&#8217;t that much kinder to the DOM? The answer is yes, yes it is.</p>
<p>What do you think? How would you change this? Comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.yanalunas.com/blog/archives/189/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Your blog post is cool and imma let you finish but first&#8230;</title>
		<link>http://adam.yanalunas.com/blog/archives/185</link>
		<comments>http://adam.yanalunas.com/blog/archives/185#comments</comments>
		<pubDate>Thu, 20 Oct 2011 18:10:41 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://adam.yanalunas.com/blog/?p=185</guid>
		<description><![CDATA[Having great code but not being able to share it is rough. For many years I&#8217;ve either been working on boring enterprise integration stuff or amazing tech that I&#8217;m not allowed to yet share with the world. That makes for a fairly silent blog and twitter feed. Unless, of course, you want me to talk [...]]]></description>
			<content:encoded><![CDATA[<p>Having great code but not being able to share it is rough.</p>
<p>For many years I&#8217;ve either been working on boring enterprise integration stuff or amazing tech that I&#8217;m not allowed to yet share with the world. That makes for a fairly silent blog and <a href="https://twitter.com/#!/adamyanalunas">twitter feed</a>. Unless, of course, you want me to talk about the sandwich I had for lunch and omigod how annoying are drivers in [your local commute path]?</p>
<p>But things have changed! I&#8217;ve been working on some awesome code, projects and platforms lately and I have some neat code that I think should be shared with the programming community.</p>
<p>Thankfully I&#8217;m seeing some progress here from management towards openness and embracing the community. That means not only do I get to talk about some of the crazy stuff I&#8217;ve done here but also start open sourcing our code!</p>
<p>Bam. It&#8217;s going to be cool. But hold on to your knickers cause enterprises are slow moving beasts. Patience, kids&hellip;</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.yanalunas.com/blog/archives/185/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Emulating the native shadow on UIMenuController</title>
		<link>http://adam.yanalunas.com/blog/archives/178</link>
		<comments>http://adam.yanalunas.com/blog/archives/178#comments</comments>
		<pubDate>Mon, 22 Aug 2011 20:42:59 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://adam.yanalunas.com/blog/?p=178</guid>
		<description><![CDATA[I&#8217;m an iOS developer! I still love and will continue doing front-end dev for web but I&#8217;m adding another feather to my cap in the way of working on some pretty cool iOS apps. One app I&#8217;ve worked on is Constellation, an eBook reader developed for Ashford Education. It&#8217;s pretty cool. One of the things [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m an iOS developer! I still love and will continue doing front-end dev for web but I&#8217;m adding another feather to my cap in the way of working on some pretty cool iOS apps. One app I&#8217;ve worked on is <a href="http://itunes.apple.com/us/app/constellation-for-ashford/id444832035?mt=8">Constellation</a>, an eBook reader developed for <a href="http://ashford.edu">Ashford Education</a>. It&#8217;s pretty cool.</p>
<p>One of the things we do is emulate the UIMenuController with our own more powerful view controller. And one of the neat things about a UIMenuController is that you get a slick, subtle drop shadow wherever it is placed. Being the guy I am I spent some time to analyze the drop shadow in Photoshop and do my best to emulate it. Here&#8217;s what I came up with. Have a better solution? Tell me in the comments!</p>
<pre class="brush: objc; title: ; notranslate">
- (void) viewDidLoad
{
	[super viewDidLoad];

	self.view.layer.shadowColor = [[UIColor blackColor] CGColor];
	self.view.layer.shadowOffset = CGSizeMake(0, 2.0f);
	self.view.layer.shadowOpacity = .55f;
	self.view.layer.shadowRadius = 2.0f;
	self.view.layer.shouldRasterize = YES;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://adam.yanalunas.com/blog/archives/178/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using CSS transforms to mimic Safari&#8217;s find word selection</title>
		<link>http://adam.yanalunas.com/blog/archives/169</link>
		<comments>http://adam.yanalunas.com/blog/archives/169#comments</comments>
		<pubDate>Fri, 27 May 2011 03:56:17 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://adam.yanalunas.com/blog/?p=169</guid>
		<description><![CDATA[Here&#8217;s a quick one for you kids. I&#8217;ve just started playing with CSS3 and I needed something simple but useful to implement. Say what you will about Safari as a browser but I think its find feature has the best UI for showing matching results on the page and what item is currently selected. Wait, [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick one for you kids. I&#8217;ve just started playing with CSS3 and I needed something simple but useful to implement. Say what you will about Safari as a browser but I think its find feature has the best UI for showing matching results on the page and what item is currently selected. Wait, you don&#8217;t use Safari? Okay, check out the picture below.</p>
<p class="center"><a href="http://adam.yanalunas.com/blog/wp-content/uploads/2011/05/Safari-find-screnshot.png"><img src="http://adam.yanalunas.com/blog/wp-content/uploads/2011/05/Safari-find-screnshot.png" alt="" title="Safari find screnshot" width="454" height="186" class="alignnone size-full wp-image-171" /></a></p>
<p>See what I&#8217;m saying? Fade out what isn&#8217;t important, lighten all matches, put some special pizazz on the current item. As an added bonus each time you switch the current item it &#8220;pops&#8221; a bit to help pull your eye to where the next item is. Pretty slick. </p>
<p>I set out not to duplicate the styles but to get a feel for CSS3 animation and transitions. With that in mind the animation tweens and colors aren&#8217;t exact but they&#8217;ll work for the project I have in mind. If you have improvements go ahead and share them in the comments.</p>
<p><strong>[Ninja edit]</strong> I forgot to mention that in order for CSS transformations to be hardware accelerated by devices that do so you have to include the &#8220;translate3d&#8221; property. If you don&#8217;t need to translate, use the meaningless zeroed out setting like I did below.</p>
<p><strong>[Ninja edit 2}</strong> Also, I didn&#8217;t bother putting in all the different vendor prefixes. If you&#8217;re interested in this code your Google-fu will be strong enough to look up the different vendor settings and adjust accordingly.</p>
<pre class="brush: plain; title: ; notranslate">
@-webkit-keyframes pulseFocusedOverlay {
	0%, 100% {
		-webkit-transform: scale(1) translate3d(0px, 0px, 0px);;
	}
	15% {
		-webkit-transform: scale(1.35) translate3d(0px, 0px, 0px);;
	}
}

.searchMatch {
	display: inline-block;
	padding: 0 4px;
	margin: 0 -3px;
	-webkit-box-shadow: 0 1px 5px #333;
	box-shadow: 0 1px 5px #333;
	color: #222;
	background-image: -webkit-gradient(linear, left bottom, left top, color-stop(.5, rgb(222, 222, 222)), color-stop(1, rgb(255, 255, 255)));
}

.searchMatch_selected {
	display: inline-block;
	padding: 0 4px;
	border-radius: 5px;
	border: 1px solid #EFDB13;
	margin: -1px -4px;
	-webkit-box-shadow: 0 1px 3px #333;
	box-shadow: 0 1px 5px #333;
	color: #000;
	-webkit-animation: pulseFocusedOverlay 185ms ease-in-out 0;
	background-image: -webkit-gradient(linear, left bottom,left top,color-stop(.5, rgb(238, 207, 0)),color-stop(1, rgb(242, 237, 19)));
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://adam.yanalunas.com/blog/archives/169/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing the browser&#8217;s stylesheets with CSSelection</title>
		<link>http://adam.yanalunas.com/blog/archives/100</link>
		<comments>http://adam.yanalunas.com/blog/archives/100#comments</comments>
		<pubDate>Wed, 20 Oct 2010 19:11:11 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[dom]]></category>

		<guid isPermaLink="false">http://adam.yanalunas.com/blog/?p=100</guid>
		<description><![CDATA[When writing applications that modify the DOM there&#8217;s one thing to keep in mind: your code will not be the only code touching the DOM. Defensive code is good code. With defensive programming in mind there sometimes exists a need to peek into the CSS that is loaded into the browser. Say an application your [...]]]></description>
			<content:encoded><![CDATA[<p>When writing applications that modify the DOM there&#8217;s one thing to keep in mind: <em>your code will not be the only code touching the DOM</em>. Defensive code is good code.</p>
<p>With defensive programming in mind there sometimes exists a need to peek into the CSS that is loaded into the browser. Say an application your writing depends on user-based styles that are dynamically loaded in. It&#8217;d be nice to inject those styles into the document CSS and know you&#8217;re not overwriting anything. Perhaps your code is meant to take an existing style and modify it. </p>
<p>To this end I present a work-in-progress of my first jQuery plugin, CSSelection.</p>
<h3>Code: <a href="http://gist.github.com/637070"><strong>View CSSelection on GitHub</strong></a></h3>
<p><a href="http://gist.github.com/raw/637070/ac49be438f0b50f93818f45e0f3342be82bf2f3a/jquery.CSSelection.js">Download jquery.CSSelection.js</a></p>
<p>CSSelection start by accepting a jQuery selector. With that selector you can read the current styles applied to that selector, add new styles, create such a selector if one does not exist or even remove the current selector from the stylesheet. I tried to keep the interface predictable to jQuery users at the expense of a bit of extra code. Passing no arguments retrieves the current rules, if any, of the selector. Passing the string &#8220;remove&#8221; does as expected to first found matching selector in the style sheets. Finally passing an object literal with rules will either add them to the stylesheet or modify the matching selector. </p>
<p>While this code is used in production I&#8217;ll still call it beta as bugs are cropping up in IE9 and are sure to arrive in future revs of Safari and Firefox. Enjoy!</p>
<h2>Usage examples</h2>
<p>How to create a rule for HTML elements:</p>
<pre class="brush: jscript; title: ; notranslate">$('p').CSSelection({rules: {'font-size': '120%', 'color': 'red', 'background-color': '#fff'}});</pre>
<p>Modifying existing CSS rule/add new rule:</p>
<pre class="brush: jscript; title: ; notranslate">$('.important').CSSelection({rules: {'text-decoration': 'underline overline', 'background': 'yellow'}});</pre>
<p>Delete a CSS rule:</p>
<pre class="brush: jscript; title: ; notranslate">$('.annoyingDecoration').CSSeleciton('remove');</pre>
<p>Get attributes for existing rule:</p>
<pre class="brush: jscript; title: ; notranslate">var attrs = $('.wickedAwesomeClass').CSSelection();</pre>
]]></content:encoded>
			<wfw:commentRss>http://adam.yanalunas.com/blog/archives/100/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The subtle art of ranges &#8211; Intro</title>
		<link>http://adam.yanalunas.com/blog/archives/154</link>
		<comments>http://adam.yanalunas.com/blog/archives/154#comments</comments>
		<pubDate>Tue, 21 Sep 2010 17:50:48 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[ranges]]></category>

		<guid isPermaLink="false">http://adam.yanalunas.com/blog/?p=154</guid>
		<description><![CDATA[You're starting to see it more and more. You select some text on a website and -- woosh -- something happens. Sometimes you expect the action. Oftentimes you don't. Regardless, these things are possible due to DOM ranges. 

And DOM ranges are terrible.]]></description>
			<content:encoded><![CDATA[<p>You&#8217;re starting to see it more and more. You select some text on a website and &#8212; <em>woosh</em> &#8212; something happens. Sometimes you expect the action. Oftentimes you don&#8217;t. Regardless, these things are possible due to DOM ranges. </p>
<p>And DOM ranges are terrible.</p>
<p>I don&#8217;t mean they are a terrible idea. I mean they&#8217;re terrible to work with. Of course there is no single, standard API to work with. Of course Internet Explorer adds another level of challenge. And of course you&#8217;re going to at some point have to know how these things work if you expect to be a JavaScript ninja.</p>
<p>There are many reasons to deal with ranges. Some lame services will hijack your selection and inject in their own tags. If you&#8217;ve ever needed to hack around a WYSWYG editor then ranges will be on the docket. Or say you&#8217;re leading a team that allows users to select text on a page and do things like highlight it, make a note attached to it or even place a bookmark at that point in the page. That&#8217;d be <a href="https://content.ashford.edu/">my job</a>.</p>
<p>The default <a href="https://developer.mozilla.org/en/DOM/range">range object</a> seems good enough for a lot of tasks. Where it starts to show its weakness is interacting with the DOM outside of just the range. </p>
<p>You want to take what a user has selected and wrap it in a decorative <code>&lt;span&gt;</code>? That should be easy, right? What happens if that selection starts in the middle of an <code>&lt;li&gt;</code>, moves down a few paragraphs, enters a <code>&lt;div&gt;</code> and ends a few levels deeper in the node tree? Well, you can&#8217;t just wrap that in a single element. </p>
<p>The browsers all try to be helpful. Really, they do. If your range starts in the middle of an <code>&lt;em&gt;</code> tag but ends outside of it the range you get back from the browser will automatically split the tag properly if you wrap it. That&#8217;s nice. But if you remove that wrapper now you have a split tag that equates to more child nodes in memory than in code. That makes for bad assumptions later.</p>
<p>During my research into and development of this project I&#8217;ve found a stunning lack of comprehensive information (much less example code) for DOM ranges. Obviously <a href="http://www.quirksmode.org/dom/range_intro.html">PPK is the place to start</a> but his level of detail is light and &#8212; at best &#8212; beginner. I&#8217;ve worked with some guys at Google who are on the Closure Library team and are ridiculously smart. Even they didn&#8217;t plan for the basic needs I have. Or it could be I&#8217;m doing it wrong.</p>
<p>In any case, I&#8217;ll be working on a series of entries to this blog that will go through what I&#8217;ve learned, show some code, talk about common pitfalls, propose some best practices and hopefully shine some light on the dark corner that is DOM ranges.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.yanalunas.com/blog/archives/154/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Viewing VMware Fusion guest Cassini/Development Server on host</title>
		<link>http://adam.yanalunas.com/blog/archives/133</link>
		<comments>http://adam.yanalunas.com/blog/archives/133#comments</comments>
		<pubDate>Sun, 25 Apr 2010 07:25:45 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[fusion]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[vm]]></category>

		<guid isPermaLink="false">http://adam.yanalunas.com/blog/?p=133</guid>
		<description><![CDATA[Preamble Using a Mac is great. You can pry mine from my cold, dead hands. However, there are times I need to run things in a Windows VM. It&#8217;s easiest to do as much work as possible in VM but there&#8217;s the unavoidable need to connect remote machines to the guest server. In my specific [...]]]></description>
			<content:encoded><![CDATA[<h2>Preamble</h2>
<p>Using a Mac is great. You can pry mine from my cold, dead hands. However, there are times I need to run things in a Windows VM. It&#8217;s easiest to do as much work as possible in VM but there&#8217;s the unavoidable need to connect remote machines to the guest server. </p>
<p>In my specific case I am part of a team developing a C# app so that means Visual Studio 2008 and its built-in development server, Cassini. Microsoft added this lovely hard-coded trick to Cassini so that it listens only to requests from the loopback, localhost. This is supposedly to prevent developers from shipping apps with Cassini built in. I don&#8217;t care about the reason. I care that I can&#8217;t connect to my development VM on my Mac or any other remote machine. There is a fairly simple solution to that, though.</p>
<h2>My setup</h2>
<ul>
<li>OS X 10.6.3</li>
<li>VMware Fusion 3.0.2
<ul>
<li>Windows 7 Professional</li>
<li>Visual Studio 2008</li>
<li>VPN&#8217;d connection to the office</li>
</ul>
</li>
</ul>
<p>Yes, it&#8217;s wonky to VPN in my VM but I can&#8217;t VPN in my Mac and that&#8217;s a whole other story.</p>
<h2>What you&#8217;ll need</h2>
<ul>
<li><a href="http://www.fiddler2.com/fiddler2/">Fiddler</a></li>
</ul>
<p>That&#8217;s it.</p>
<h2>The Concept</h2>
<p>Fiddler is a debugging proxy but it also has the ability to be a <a href="http://en.wikipedia.org/wiki/Reverse_proxy">reverse proxy</a>. We&#8217;re going to use that feature to take requests to the guest VM on Fiddler&#8217;s port of <code>8888</code> and automatically reroute them to Cassini&#8217;s port.</p>
<h2>The Execution</h2>
<p>First thing&#8217;s first: my particular setup is probably unique and the tedious steps I&#8217;m about to list will likely never be needed by the average developer. However, if I need them that tells me someone else does as well so this is bound to help some lucky Googler.</p>
<ol>
<li>Make sure your VM&#8217;s network connection is running in Bridged mode</li>
<li>Start your Cassini server by going to Visual Studio in your guest VM and pressing ctrl+F5</li>
<li>Fire up Fiddler and open Tools->Options</li>
<li>In the Connections tab make sure &#8220;Allow remote computers to connect&#8221; is checked and hit OK to close the options window</li>
<li>Press ctrl+r to open the rules (defaults to opening it in notepad.exe)</li>
<li>Search for the <code>OnBeforeRequest</code> function and add the following condition:<br />
<blockquote><p>
<code>if (oSession.host.toLowerCase() == "192.168.1.108:8888") oSession.host = "localhost:5867";</code>
</p></blockquote>
<p>Just modify the <code>192.168.1.108</code> IP to be your VM&#8217;s IP and change <code>5867</code> to be Cassini&#8217;s port
</li>
<li>Fire up cmd.exe and renew your IP by doing an ipconfig/release followed by ipconfig/renew</li>
</ol>
<p>You&#8217;re done!</p>
<h2>Testing your work</h2>
<p>Now that Fiddler is set up to route requests to Cassini you can go to any machine on your local network, type in your VM&#8217;s IP followed by Fiddler&#8217;s port and Fiddler will accept your request, route it to Cassini and return back results. In case you need to copy and paste something the path in my browser is simply</p>
<blockquote><p>
<code>http://192.168.1.108:8888</code>
</p></blockquote>
<h2>Ways to improve this</h2>
<p>There&#8217;s an additional rule that can be added to Fiddler. In the <code>OnBeforeResponse</code> add the condition &#8220;<code>oSession.utilReplaceInResponse("localhost:5867","192.168.1.108:8888");</code>&#8220;. That does what it sounds like. You may have noted the magic numbers in the Fiddler rules. These will suck to maintain. You can right-click your web solution, go to properties, click the Web tab and assign a specific port. If you go to your Windows network settings and force in an IP you&#8217;ll never have to edit the rules file again. However, these are hack solutions around a weak implementation.</p>
<p> A potentially better route would be to ditch Cassini altogether and use <a href="http://www.ultidev.com/products/Cassini/">UltiDev</a>, a free .NET server. I may still. Should get around these headaches fairly well.</p>
<p>The best option would be to run IIS in your VM. For an as-yet-undiagnosed reason my web solution will not allow me to run it through IIS. I hope you, casual reader, have more luck.</p>
<h2>Closing</h2>
<p>There have to be more devs out there running a Windows VM in their Mac, needing to test their web apps in OS X, on their iPod Touch/iPhone/iPad, Blackberry, yada yada. Yes, this could all be solved by using the dev or QA server but those aren&#8217;t updated automatically and I can&#8217;t be bothered to make a build every time I want to tweak some JavaScript. I&#8217;m marking this down as an exercise in learning about VM networking types, reverse proxy functionality and the power of releasing and renewing your DHCP license.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.yanalunas.com/blog/archives/133/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Uninstalling Active Technology&#8217;s ODBC drivers</title>
		<link>http://adam.yanalunas.com/blog/archives/96</link>
		<comments>http://adam.yanalunas.com/blog/archives/96#comments</comments>
		<pubDate>Mon, 04 Jan 2010 18:21:07 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://adam.yanalunas.com/blog/?p=96</guid>
		<description><![CDATA[Since my upgrade to Snow Leopard I&#8217;ve been fighting a few very particular issues in my development environment. It should be noted that I think nearly all regular consumers and a large percentage of developers will be satisfied with the development environment provided by Apple. However, some developers need more. While able to run in [...]]]></description>
			<content:encoded><![CDATA[<p>Since my upgrade to Snow Leopard I&#8217;ve been fighting a few very particular issues in my development environment. It should be noted that I think nearly all regular consumers and a large percentage of developers will be satisfied with the development environment provided by Apple. However, some developers need more.</p>
<p>While able to run in 64-bit, I was running <a href="http://blog.dev360.com/2009/01/08/running-apache-in-32-bit-mode-on-mac-os-x/">Apache in 32-bit mode</a> under my Leopard install. This is because the ODBC drivers I was running from Actual Technologies only supported 32-bit Apache. In Leopard land that was fine. Now that I&#8217;m in Snow Leopard and <a href="http://adam.yanalunas.com/blog/archives/62">everything else</a> is in 64-bit I thought my ODBC drivers ought be as well. </p>
<p>My problem is that I had the 32-bit Actual Technologies drivers, compiled in the FreeTDS drivers for my MSSQL support when compiling PHP and then installed a 64-bit beta build from Actual Technologies. Somewhere between the Snow Leopard upgrade and all these other installs things have gone a bit wonky. Best bet is to clean out all ODBC drivers and start anew.</p>
<p>Small hiccup: Actual Technologies does not provide an uninstaller. Well, not that you&#8217;d be able to find. I emailed their support and received a link to a script bundled up in a dmg. By request I&#8217;m not going to post a link to the script or the script itself and I think that&#8217;s fair. Looking at the script it is no more than a series of <code>rm -rf</code> commands that blindly erase whole directories. Even existing iODBC data and settings you may have from other products or drivers. </p>
<p>I&#8217;m going to run the uninstaller, recompile FreeTDS, rebuild PHP and see where that gets me. Hopefully not towards a fresh Snow Leopard install.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.yanalunas.com/blog/archives/96/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Making friends with the DOM</title>
		<link>http://adam.yanalunas.com/blog/archives/91</link>
		<comments>http://adam.yanalunas.com/blog/archives/91#comments</comments>
		<pubDate>Thu, 19 Nov 2009 18:24:45 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://adam.yanalunas.com/blog/?p=91</guid>
		<description><![CDATA[Any JavaScript developer who spends more than a blink of an eye working with the DOM has probably come despise the API. It&#8217;s not that there&#8217;s a dearth of features (welll&#8230;.); I think it&#8217;s the verbosity that causes modern application development woes. For the one-off script that adds an onclick or modifies some text the [...]]]></description>
			<content:encoded><![CDATA[<p>Any JavaScript developer who spends more than a blink of an eye working with the DOM has probably come despise the API. It&#8217;s not that there&#8217;s a dearth of features (welll&#8230;.); I think it&#8217;s the verbosity that causes modern application development woes. For the one-off script that adds an <code>onclick</code> or modifies some text the DOM API is fine and dandy. Try scaling up to developing an application or, perhaps, <a href="http://adam.yanalunas.com/blog/archives/76">a framework</a> and things get annoying and messy right quick.</p>
<p>When <a href="http://blargh.tommymontgomery.com/">Tommy</a> finally gave jQuery a try and discovered there was no native DOM manipulation tools he decided to roll his own plug-in he calls <a href="http://blargh.tommymontgomery.com/2009/11/fluent-dom-manipulation-in-javascript/">FluentDom</a>. The code is clean and quality, as I&#8217;d expect from him, but the interface drives me bonkers.</p>
<p>I&#8217;m a fan of <a href="http://en.wikipedia.org/wiki/Convention_over_configuration">configuration over convention</a>, a concept which, when combined with my MooTools history, has lead me to favor using object literals as configuration &#8220;objects&#8221;. When I use MooTools to create a <a href="http://mootools.net/docs/core/Element/Element#Element:constructor">new element</a> the only arguments are the element type and an object literal with any configuration options. This is where Tommy&#8217;s code style differs. In FluentDom you set a specific attribute with specific methods with calls able to be chained together. This isn&#8217;t to say that FluentDom couldn&#8217;t be used with a configuration object, it&#8217;s just not as clean an implementation as I prefer.</p>
<p>In a message to him I said this:</p>
<blockquote><p>
The benefit to setting attributes via an object literal is that I can use one set of preset attribute values and pass that around. Quite handy if you’re doing something like iterating and creating a list of similar elements but particular ones might have subtle differences. Also easier to maintain and extend. Given your code it’d be a trivial modification to do this during a create call.
</p></blockquote>
<p>Which do readers prefer, specific, chainable method calls or ambiguous configuration object?</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.yanalunas.com/blog/archives/91/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

