<?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>Christian Varga</title>
	<atom:link href="http://christianvarga.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://christianvarga.com/blog</link>
	<description>Cat lover; Rails, PHP, &#38; jQuery developer.</description>
	<lastBuildDate>Sat, 19 May 2012 14:24:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>My experience with Google Drive</title>
		<link>http://christianvarga.com/blog/2012/05/my-experience-with-google-drive/</link>
		<comments>http://christianvarga.com/blog/2012/05/my-experience-with-google-drive/#comments</comments>
		<pubDate>Sat, 19 May 2012 14:19:09 +0000</pubDate>
		<dc:creator>Christian Varga</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://christianvarga.com/blog/?p=98</guid>
		<description><![CDATA[I&#8217;ve been a loyal Dropbox user for over 2 years, and I&#8217;ve found it invaluable for managing files between multiple users and machines. It&#8217;s been a great product &#8211; I don&#8217;t recall ever having any issues with it, everything just always seemed to work™. I&#8217;ve always wanted a Dropbox account for personal use, however a <a href="http://christianvarga.com/blog/2012/05/my-experience-with-google-drive/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a loyal Dropbox user for over 2 years, and I&#8217;ve found it invaluable for managing files between multiple users and machines. It&#8217;s been a great product &#8211; I don&#8217;t recall ever having any issues with it, everything just always seemed to work™.</p>
<p>I&#8217;ve always wanted a Dropbox account for personal use, however a limitation of Dropbox is that you can only have one copy running at any one time. So with my work account set up, I&#8217;ve had to make do without it. With the release of Google Drive I thought I&#8217;d test it out for my personal use to see how it faired up. At 1/4 of Dropbox&#8217;s price point I must say I was pretty intrigued to see what it had to offer.</p>
<p>Downloading and installing it was easy enough and the familiar Google docs interface is quite functional. I uploaded my library of pictures, but noticed that Drive doesn&#8217;t give any indication of upload status or speed &#8211; it only states that it&#8217;s syncing. Needless to say my network was hammered for a good few hours while my files were being uploaded, with Drive providing no way to cap the upload. Occasionally there was issue connecting to the server, but I don&#8217;t think it affected the sync that much. Then I found an interesting issue &#8211; midway through sync I realised I had a 40mb file uploading that I didn&#8217;t even want. I&#8217;ve got a slow upload, so thinking in Dropbox terms I&#8217;d just delete the file and the sync should stop. However Google Drive continued to sync the file even after deletion and just kept copying it back into the folder. I was forced to quit Drive, delete the file, and restart it to stop the syncing of the file. Not a great start.</p>
<p>When that was done I installed Drive on my Macbook. It had to download all the pictures via the internet &#8211; no lan sync (as we already knew, still a disappointment though). Then I realised I had put the Drive folder in the wrong location, but Drive doesn&#8217;t have the ability to move the folder. My only option was to deauthorise my account to change the location. So I did that and copied all the synced files across to the new location, but Drive can only be initialised in a blank folder. So I moved all the files out and created a blank folder for Drive, copied all the files back in so it wouldn&#8217;t have to download them all again, and started syncing. But instead of smartly figuring out that all the files were the same, Drive tried to re-upload all the files I copied AND download all the files off the server (creating duplicates of every file). Not impressed. Contrast this to Dropbox, which would simply do a checksum on every file to determine that the entire folder was already synced. So the syncing functionality of Drive (which is what you&#8217;re using it for, right?!) is sub-par.</p>
<p>This is only my first day with Drive but I felt compelled to write this article. I was ready to pay for the premium account before I&#8217;d even used it, but now I&#8217;m not convinced. I think I&#8217;ll just stick with Dropbox &#8211; it&#8217;s a <em>much</em> more solid product.</p>
]]></content:encoded>
			<wfw:commentRss>http://christianvarga.com/blog/2012/05/my-experience-with-google-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vhosts and MAMP</title>
		<link>http://christianvarga.com/blog/2012/05/vhosts-and-mamp/</link>
		<comments>http://christianvarga.com/blog/2012/05/vhosts-and-mamp/#comments</comments>
		<pubDate>Fri, 04 May 2012 15:01:36 +0000</pubDate>
		<dc:creator>Christian Varga</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[mamp]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[vhosts]]></category>

		<guid isPermaLink="false">http://christianvarga.com/blog/?p=94</guid>
		<description><![CDATA[I&#8217;ve been using MAMP for a while now, and I really love the ease of use it provides in setting up a container for PHP/MySQL related projects. Setting up vhosts is a really neat way of managing projects; using subfolders is quite messy and is poor development practice. It&#8217;s pretty easy to set up vhosts <a href="http://christianvarga.com/blog/2012/05/vhosts-and-mamp/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using MAMP for a while now, and I really love the ease of use it provides in setting up a container for PHP/MySQL related projects. Setting up vhosts is a really neat way of managing projects; using subfolders is quite messy and is poor development practice. It&#8217;s pretty easy to set up vhosts with MAMP, and there are a few guides out there, but I found that I needed to combine a few of them to get it to really work properly. So here&#8217;s a full guide of what you need to do to get vhosts working with MAMP.</p>
<p><strong>Step 1</strong> (from <a href="http://sawmac.com/mamp/virtual/" target="_blank">http://sawmac.com/mamp/virtual/</a>)</p>
<p>Open up /etc/hosts in your favourite text editor, and add your projects to the end of the file like so:</p>
<pre class="brush:plain">127.0.0.1 project1.dev
127.0.0.1 project2.dev</pre>
<p><strong>Step 2</strong> (additional settings from <a href="http://forum.mamp.info/viewtopic.php?f=2&amp;t=4459" target="_blank">http://forum.mamp.info/viewtopic.php?f=2&amp;t=4459</a>)<strong><br />
</strong></p>
<p><strong></strong>Open up /Applications/MAMP/conf/apache/httpd.conf in your favourite text editor, scroll to the bottom, and add the following (customise to your specific installation):</p>
<pre class="brush:applescript">NameVirtualHost *
&lt;VirtualHost *&gt;
DocumentRoot "/Users/your-username/sites/"
ServerName localhost
&lt;/VirtualHost&gt;
&lt;VirtualHost *&gt;
DocumentRoot "/Users/your-username/sites/project1/"
ServerName project1.dev
&lt;/VirtualHost&gt;
&lt;VirtualHost *&gt;
DocumentRoot "/Users/your-username/sites/project2/"
ServerName project2.dev
&lt;/VirtualHost&gt;
&lt;Directory /&gt;
Options FollowSymLinks
AllowOverride All
&lt;/Directory&gt;</pre>
<p>The difference between this and the instructions in the above URL is the Directory configuration (AllowOverride All). Without this, .htaccess files won&#8217;t work, which isn&#8217;t desirable. For each additional project, you just copy and paste this one bit:</p>
<pre class="brush:applescript">&lt;VirtualHost *&gt;
DocumentRoot "/Users/your-username/sites/project2/"
ServerName project2.dev
&lt;/VirtualHost&gt;</pre>
<p><strong>Step 3 </strong>(from <a href="http://timneill.net/2012/02/reclaiming-your-favicons-using-mamp/" target="_blank">http://timneill.net/2012/02/reclaiming-your-favicons-using-mamp/</a>)<strong><br />
</strong></p>
<p>With httpd.conf still open, search for a line that says Alias /favicon.ico &#8220;/Applications/MAMP/bin/favicon.ico&#8221; and comment it out by putting a # infront of it. You may also want to comment out a line beneath it which is an alias for the /icons/ directory. These aliases override the favicon and icons directory for all sites &#8211; which again is quite annoying &#8211; so you&#8217;ll want these lines commented out.</p>
<p><strong>Step 4</strong></p>
<p>Open up MAMP, click on Preferences, click on the Ports tab, and click Set to default Apache and MySQL ports. This allows you to open up your project.dev URLs without specifying a port at the end (like :8888 as MAMP defaults to).</p>
<p>Start the MAMP server, and you&#8217;re done! You should have beautiful vhosts, with favicons and .htaccess working as desired.</p>
<p><em><strong>A note on using the .local suffix</strong></em>: You may be tempted to use .local as your suffix as it makes logical sense and many tutorials recommend it. However, you will experience slow page loads when using .local as apparently the bonjour service interferes with the .local domain (<a href="http://www.bram.us/2011/12/12/mamp-pro-slow-name-resolving-with-local-vhosts-in-lion-fix/" target="_blank">reference</a>). So you&#8217;re better off using .dev, or any other suffix you can think of apart from .local to get the fastest development experience.</p>
]]></content:encoded>
			<wfw:commentRss>http://christianvarga.com/blog/2012/05/vhosts-and-mamp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The power of clear: both</title>
		<link>http://christianvarga.com/blog/2012/04/the-power-of-clear-both/</link>
		<comments>http://christianvarga.com/blog/2012/04/the-power-of-clear-both/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 10:04:53 +0000</pubDate>
		<dc:creator>Christian Varga</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://www.christianvarga.com/blog/?p=75</guid>
		<description><![CDATA[I&#8217;ve been a front end developer for 2 years, and been dabbling with HTML and CSS for over 6. So you could say that I&#8217;m super late to the party. But it&#8217;s finally happened, I&#8217;ve had an epiphany and now understand the power of empty &#8216;clear&#8217; elements. No doubt there&#8217;s tons of posts out there <a href="http://christianvarga.com/blog/2012/04/the-power-of-clear-both/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a front end developer for 2 years, and been dabbling with HTML and CSS for over 6. So you could say that I&#8217;m super late to the party. But it&#8217;s finally happened, I&#8217;ve had an epiphany and now understand the power of empty &#8216;clear&#8217; elements. No doubt there&#8217;s tons of posts out there explaining why you&#8217;d use them, but here&#8217;s one more.</p>
<p>The scenario is simple, you have a page div, with a content and sidebar inside it. Like so (excuse the inline styles, it&#8217;s just for readability and demonstration purposes):</p>
<pre class="brush:xml">&lt;div id="page"&gt;
    &lt;div id="content" style="float: left"&gt;
        ...
    &lt;/div&gt;
    &lt;div id="sidebar" style="float: right"&gt;
        ...
    &lt;/div&gt;
&lt;/div&gt;</pre>
<p>Now, say you want the page div to expand to the height of it&#8217;s children. Of course, with floated children, the height of page is 0. You could use overflow: auto, but this continuously causes weird bugs and generally seems pretty hacky. Enter the clear div.</p>
<pre class="brush:xml">&lt;div id="page"&gt;
    &lt;div id="content" style="float: left"&gt;
        ...
    &lt;/div&gt;
    &lt;div id="sidebar" style="float: right"&gt;
        ...
    &lt;/div&gt;
    &lt;div class="clear" style="clear: both"&gt;&lt;/div&gt;
&lt;/div&gt;</pre>
<p>It clears both of it&#8217;s previous siblings, and because it&#8217;s not floated itself, expands the height of the page to the height of content. And if you don&#8217;t care about older browsers (&lt; IE7), you can even do it better using the :after pseuo-selector:</p>
<pre class="brush:css">.clearfix:after {
   content: " ";
   visibility: hidden;
   display: block;
   height: 0;
   clear: both;
}</pre>
<p>Using this method you can just apply the clearfix class to the sidebar div, and you won&#8217;t require any additional markup to make it work. Much more semantic.</p>
]]></content:encoded>
			<wfw:commentRss>http://christianvarga.com/blog/2012/04/the-power-of-clear-both/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Motivation</title>
		<link>http://christianvarga.com/blog/2012/03/motivation/</link>
		<comments>http://christianvarga.com/blog/2012/03/motivation/#comments</comments>
		<pubDate>Wed, 07 Mar 2012 13:23:30 +0000</pubDate>
		<dc:creator>Christian Varga</dc:creator>
				<category><![CDATA[30 Day Blog Challenge]]></category>

		<guid isPermaLink="false">http://www.christianvarga.com/blog/?p=53</guid>
		<description><![CDATA[My last post touched on doing things you want to do without hesitation and procrastination. In theory this idea sounds good, but there&#8217;s still another piece to the puzzle. Motivation. To be able to do anything, you need motivation. Think you don&#8217;t have it? Think again. You&#8217;re reading this post, which requires motivation. You got <a href="http://christianvarga.com/blog/2012/03/motivation/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>My <a href="http://www.christianvarga.com/blog/2012/03/just-do-it/">last post</a> touched on doing things you want to do without hesitation and procrastination. In theory this idea sounds good, but there&#8217;s still another piece to the puzzle. Motivation.</p>
<p>To be able to do <em>anything</em>, you need motivation. Think you don&#8217;t have it? Think again. You&#8217;re reading this post, which requires motivation. You got out of bed (hopefully), that also requires motivation. But the harder things are, the more motivation you need to do them. And sometimes it can be really hard to get motivated.</p>
<p>While there&#8217;s countless ways to get motivated, I&#8217;ve found three things that seem to really work well together. It may seem simple, but <a href="http://en.wikipedia.org/wiki/Occam%27s_razor">as we know</a> the simplest answers are usually the best. As a quick scenario so we can apply this knowledge, let&#8217;s take an example of someone wanting to start working out and changing their body for good.</p>
<p>The first type of motivator is called a <strong>towards</strong> motivator, also known as pleasure. This type of motivation lets you set goals targeted towards desirable outcomes. These are things you want to get to. Some goals in our example could be to have a certain level of visible fitness, be able to run a certain distance, reach a certain desired weight etc.</p>
<p>The second type is called an<strong> away from</strong> motivator, also known as pain. This type of motivation sees you moving away from certain things that cause you grief, so for example, you might want to not be the fat person any more, or you might not want to be the person who always gets puffed out first etc.</p>
<p>Does this matter? You bet. There are quite a few things we need to consider about both. Some people are highly motivated by pain, because pain is such a strong feeling that we as humans tend to remember for much longer than pleasure (and with greater intensity too). So the idea of moving away from pain can really push people. However, towards motivators allow you to set clear &amp; positive goals, which would otherwise be quite difficult and fluffy when using away-from motivators. And when you&#8217;re moving towards a clear cut goal, it can be extremely rewarding feeling that sense of achievement when you finally do hit the goal.</p>
<p>But the mother of all motivation strategies is <strong>accountability</strong>. Accountability means becoming responsible for your actions in the eyes of others. If you don&#8217;t tell anyone you want to start working out, you&#8217;re only letting yourself down if you don&#8217;t (and as I&#8217;ve previously mentioned, we&#8217;re very good at justifying missed opportunities). But holding yourself accountable, posting about it on a forum, or even better on Facebook, is really going to push you. Because not many people can stand the shame of not even trying after they&#8217;ve told people they&#8217;re going to do something.</p>
<p>Being accountable might just be the motivation that pushes you over the edge. Post something you want to do on your facebook/blog/twitter/fridge right now. Unless you enjoy letting your friends down, there&#8217;s no turning back.</p>
]]></content:encoded>
			<wfw:commentRss>http://christianvarga.com/blog/2012/03/motivation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Just do it™</title>
		<link>http://christianvarga.com/blog/2012/03/just-do-it/</link>
		<comments>http://christianvarga.com/blog/2012/03/just-do-it/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 14:03:40 +0000</pubDate>
		<dc:creator>Christian Varga</dc:creator>
				<category><![CDATA[30 Day Blog Challenge]]></category>

		<guid isPermaLink="false">http://www.christianvarga.com/blog/?p=47</guid>
		<description><![CDATA[Just do it. Whatever you&#8217;re thinking about doing, do it now. So many people have so many excuses for not doing amazing things. You&#8217;ve all heard it before, someone suggests they&#8217;d like to do something a little out there, then comes the &#8220;I would do it, but&#8230;&#8221;. &#8220;It&#8217;s raining&#8221;. &#8220;It&#8217;s too difficult&#8221;. &#8220;I just can&#8217;t <a href="http://christianvarga.com/blog/2012/03/just-do-it/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Just do it. Whatever you&#8217;re thinking about doing, do it now.</p>
<p>So many people have so many excuses for not doing amazing things. You&#8217;ve all heard it before, someone suggests they&#8217;d like to do something a little out there, then comes the <em>&#8220;I would do it, but&#8230;&#8221;</em>. <em>&#8220;It&#8217;s raining&#8221;</em>. <em>&#8220;It&#8217;s too difficult&#8221;</em>. <em>&#8220;I just can&#8217;t right now&#8221;</em>. The list goes on, you know the drill. And there you are, thinking that they should do it or shut up and stop complaining. Then you get home at 10pm and say to yourself <em>&#8220;Oh, it&#8217;s 10pm, probably too late to go for a run. Might just watch some TV instead&#8221;</em>. And somehow, in your mind, that&#8217;s justified. It shouldn&#8217;t be.</p>
<p>If you want to do something, just do it. Don&#8217;t ever hesitate. Don&#8217;t ever overthink it. Just do it. Want to visit a new country? Just pack up and go. The old you would still be &#8220;<em>trying to decide</em>&#8221; by the time you get back and put your life back together in better condition than when you left. Planned to go for a run but got home 3 hours late? Don&#8217;t sit there and think about whether you still have time, get out there and you&#8217;ll be back before you watched 2 episodes of Futurama. Wanted to do Steve Hopkins <a href="http://thesquigglyline.com/blog/uncategorized/join-me-in-blogging-every-day-of-march/">blog a day</a> challenge in March but you&#8217;re 5 days late, it&#8217;s 1am and you need to be up at 7? You&#8217;ve already missed out. Might as well not do it all, right? Nice try, but you&#8217;re not getting away that easy.</p>
<p>Now, I know it&#8217;s easy to say just do whatever you want, but when it comes down to it, actually making that choice and performing an action without procrastination is still extremely difficult. For something like packing up and visiting a new country, ok, I understand, that&#8217;s not easy. But going for a run? Talking to someone new? Changing your career? Deciding to go to the gym? Why is it so hard to do things that for the most part have positives that massively outweigh the negatives? And what allows us to live with ourselves when we constantly miss out on great opportunities? Well, the answer probably isn&#8217;t far off what you&#8217;re thinking. Whatever it is you want to do, it&#8217;s easier not to do it, and that&#8217;s the cold hard fact. After all, we are creatures of habit, so the more often we procrastinate, the longer we do it for, and the more situations we apply it to. Until nearly every task is met with procrastination, and your mind is conditioned to not want to try new things. And after you&#8217;ve seen an opportunity, let the procrastination take over, and missed a chance, your mind tries justify the act of not doing it with excuse,<em> &#8220;oh it was too late&#8221;</em>. <em>&#8220;oh the job probably wouldn&#8217;t have been that good&#8221;</em>. <em>&#8220;oh the gym costs too much anyway&#8221;</em>. Fluff. Lies that make you feel better, but are still lies. Or at best mistruths, because you truly never know what you&#8217;ve missed out on.</p>
<p>What you have to consider is the potential cost of <em>not</em> doing something. I&#8217;m not just talking pure monetary value, but an overall cost of lifestyle, happiness, and opportunity. Take a hypothetical networking event where you could be talking to a big name in the industry. You&#8217;re comfortable where you are, with the people you know, so you don&#8217;t have to do it. The cost of doing it is perhaps anywhere from 5-30 minutes of your time. The potential cost of not doing it is missing out on one of the biggest contracts you have ever got for your business; the one that sets you off on your way to becoming a multi-million dollar company. Or  lets take the simple example of going to the gym. The cost is ~$20 and 4 hours a week. The potential cost of not doing it is being unfit and unhealthy with a less-than-average body, not sleeping well, not being happy with yourself, and not meeting amazing people who are there to make the most out of their body and life.</p>
<p>For most situations a simple cost/benefit analysis will prove to yourself that most things you want to do in life &#8212; but constantly make excuses for &#8212; have far greater positive outcomes than negatives. You&#8217;ll even find that many situations don&#8217;t have any real negatives at all, just <em>perceived</em> negatives. This is something I might touch on in a later post. For now, stop procrastinating on all the things you want to do, remind yourself what you&#8217;re potentially missing out on, and get to it!</p>
]]></content:encoded>
			<wfw:commentRss>http://christianvarga.com/blog/2012/03/just-do-it/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to stop jQuery Tools Scrollable from buffering clicks</title>
		<link>http://christianvarga.com/blog/2011/09/how-to-stop-jquery-tools-scrollable-from-buffering-clicks/</link>
		<comments>http://christianvarga.com/blog/2011/09/how-to-stop-jquery-tools-scrollable-from-buffering-clicks/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 03:33:03 +0000</pubDate>
		<dc:creator>Christian Varga</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[jQuery Tools]]></category>
		<category><![CDATA[Scrollable]]></category>

		<guid isPermaLink="false">http://www.christianvarga.com/blog/?p=43</guid>
		<description><![CDATA[jQuery Tools Scrollable is an awesome plugin for creating scrollable image &#38; content galleries. We used it for the portfolio and footer sections on peacock.st. The only gripe I had with it is that it buffers clicks on navigation elements, which might be ok for some people but wasn&#8217;t desirable behaviour in our case. Thankfully <a href="http://christianvarga.com/blog/2011/09/how-to-stop-jquery-tools-scrollable-from-buffering-clicks/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>jQuery Tools Scrollable is an awesome plugin for creating scrollable image &amp; content galleries. We used it for the portfolio and footer sections on <a title="http://peacock.st/" href="http://peacock.st/">peacock.st</a>. The only gripe I had with it is that it buffers clicks on navigation elements, which might be ok for some people but wasn&#8217;t desirable behaviour in our case. Thankfully it&#8217;s quite easy to change this behaviour so that any clicks on the navigation will automatically complete the current animation and animate to the next element in the scrollable.</p>
<p>All you need to do is open up the js file that contains scrollable (you can do this with the minified file, you don&#8217;t need the source), and find the part that says &#8220;<strong>h.animate(n,c,e.easing,k</strong>&#8220;. Replace this with &#8220;<strong>h.stop(true,true).animate(n,c,e.easing,k</strong>&#8220;. So just before  the animate, you are putting a .stop(true,true) in. As you may already know, .stop() stops the current animation in it&#8217;s tracks (so it doesn&#8217;t complete). This isn&#8217;t always useful, in our case we do want the animation to complete but we want it to jump to the end instead of waiting for animation to complete. The second argument <strong>true</strong> tells .stop() to complete the animation immediately which is what we want. The first argument tells it to clear the animation queue. You can read more about jQuery .stop() here: <a title="http://api.jquery.com/stop/" href="http://api.jquery.com/stop/">api.jquery.com/stop/</a></p>
<p>I&#8217;m sure this will be of use to many people. If you have any questions about this post, please feel free to leave a comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://christianvarga.com/blog/2011/09/how-to-stop-jquery-tools-scrollable-from-buffering-clicks/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>What I don&#8217;t like about Mac App Store</title>
		<link>http://christianvarga.com/blog/2011/08/what-i-dont-like-about-mac-app-store/</link>
		<comments>http://christianvarga.com/blog/2011/08/what-i-dont-like-about-mac-app-store/#comments</comments>
		<pubDate>Sat, 06 Aug 2011 06:22:19 +0000</pubDate>
		<dc:creator>Christian Varga</dc:creator>
				<category><![CDATA[Operating Systems]]></category>

		<guid isPermaLink="false">http://www.christianvarga.com/blog/?p=38</guid>
		<description><![CDATA[When OSX Lion came out, everyone in the office needed a copy of the latest xcode. Instead of 20 people downloading the same file individually, one person downloaded xcode via the app store and shared the installer with us. It all went fine, we were able to install it and it worked, however when it <a href="http://christianvarga.com/blog/2011/08/what-i-dont-like-about-mac-app-store/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When OSX Lion came out, everyone in the office needed a copy of the latest xcode. Instead of 20 people downloading the same file individually, one person downloaded xcode via the app store and shared the installer with us. It all went fine, we were able to install it and it worked, however when it comes time to update, trouble arises. Basically the only way to update is if the original person signs in to their Apple account on your computer. You can&#8217;t update via Software Update. The only way to get updates without getting the original person to sign in is to uninstall xcode, redownload it, and reinstall it.</p>
<p>That&#8217;s right. To obtain updates, I need to uninstall an app I already have installed, and download an installer I already have. That &#8211; to me &#8211; seems like a big waste of bandwidth. I&#8217;ll go back to using serials so installers can be shared instead of being linked to accounts.</p>
]]></content:encoded>
			<wfw:commentRss>http://christianvarga.com/blog/2011/08/what-i-dont-like-about-mac-app-store/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CMSO4GX3M1A1333C9 in 2011 MacBook Pro</title>
		<link>http://christianvarga.com/blog/2011/05/cmso4gx3m1a1333c9-in-2011-macbook-pro/</link>
		<comments>http://christianvarga.com/blog/2011/05/cmso4gx3m1a1333c9-in-2011-macbook-pro/#comments</comments>
		<pubDate>Fri, 27 May 2011 11:34:04 +0000</pubDate>
		<dc:creator>Christian Varga</dc:creator>
				<category><![CDATA[MacBook]]></category>
		<category><![CDATA[CMSO4GX3M1A1333C9]]></category>
		<category><![CDATA[corsair]]></category>
		<category><![CDATA[macbook pro]]></category>

		<guid isPermaLink="false">http://www.christianvarga.com/blog/?p=35</guid>
		<description><![CDATA[There didn&#8217;t appear to be many people talking about Corsair CMSO4GX3M1A1333C9 4GB PC-10600 and it&#8217;s compatibility with 2011 MacBook Pros, so I thought I&#8217;d write a quick post about it. I bought 4 of these sticks, 2 for my 13&#8243; 2.7GHz i7 MacBook Pro (8,1), and 2 for another 15&#8243; 2.2GHz i7 Macbook Pro. We <a href="http://christianvarga.com/blog/2011/05/cmso4gx3m1a1333c9-in-2011-macbook-pro/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There didn&#8217;t appear to be many people talking about Corsair CMSO4GX3M1A1333C9 4GB PC-10600 and it&#8217;s compatibility with 2011 MacBook Pros, so I thought I&#8217;d write a quick post about it. I bought 4 of these sticks, 2 for my 13&#8243; 2.7GHz i7 MacBook Pro (8,1), and 2 for another 15&#8243; 2.2GHz i7 Macbook Pro. We put them in and our MacBooks booted perfectly, neither machines have had any issues, so I&#8217;m confident to say that these modules work great in 2011 MacBook Pros. Despite the fact I never actually reached 4GB usage on the standard RAM, my MacBook feels snappier and quicker to boot. It&#8217;s probably just a placebo though. Either way, at $45 AUD a pop (so, $90 AUD to upgrade to 8GB), these modules are great value and well worth the upgrade.</p>
<div id="_mcePaste" class="mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;"><a class="prodcart" href="http://www.pccasegear.com/index.php?main_page=product_info&amp;cPath=186_218_1126&amp;products_id=15427">CMSO4GX3M1A1333C9 4GB PC-10600 SODIMM</a></div>
]]></content:encoded>
			<wfw:commentRss>http://christianvarga.com/blog/2011/05/cmso4gx3m1a1333c9-in-2011-macbook-pro/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>jQuery &#8211; Resize image to parent container plugin</title>
		<link>http://christianvarga.com/blog/2011/05/jquery-resize-image-to-parent-container-plugin/</link>
		<comments>http://christianvarga.com/blog/2011/05/jquery-resize-image-to-parent-container-plugin/#comments</comments>
		<pubDate>Wed, 11 May 2011 12:51:15 +0000</pubDate>
		<dc:creator>Christian Varga</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Image Resizing]]></category>

		<guid isPermaLink="false">http://www.christianvarga.com/blog/?p=30</guid>
		<description><![CDATA[Recently I came across a problem whereby I had to dynamically resize an image to fill it&#8217;s parent container. The requirements are pretty straight forward &#8211; upscale if the image is too small, downscale if it&#8217;s too large, and always resize based on the smallest dimension in relation to the aspect ratio of the parent <a href="http://christianvarga.com/blog/2011/05/jquery-resize-image-to-parent-container-plugin/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently I came across a problem whereby I had to dynamically resize an image to fill it&#8217;s parent container. The requirements are pretty straight forward &#8211; upscale if the image is too small, downscale if it&#8217;s too large, and always resize based on the smallest dimension in relation to the aspect ratio of the parent container (which means that you&#8217;ll never see any whitespace, the image will always overflow on either height or width). Strangely enough I couldn&#8217;t find a jQuery plugin to do quite what I wanted, so I created one.</p>
<p>Check out the <a title="demo" href="http://christianvarga.com/demos/jQuery/resizeToParent/">demo</a>.</p>
<p>The plugin is as follows:</p>
<pre class="brush:js">/*
 * Plugin Name: Resize Image to Parent Container
 *
 * Author: Christian Varga
 * Author URI: http://christianvarga.com
 *
 */

jQuery.fn.resizeToParent = function(options) {
  var defaults = {
   parent: 'div'
  }

  var options = jQuery.extend(defaults, options);

  return this.each(function() {
    var o = options;
    var obj = jQuery(this);

    // bind to load of image
    obj.load(function() {
      // dimensions of the parent
      var parentWidth = obj.parents(o.parent).width();
      var parentHeight = obj.parents(o.parent).height();

      // dimensions of the image
      var imageWidth = obj.width();
      var imageHeight = obj.height();

      // step 1 - calculate the percentage difference between image width and container width
      var diff = imageWidth / parentWidth;

      // step 2 - if height divided by difference is smaller than container height, resize by height. otherwise resize by width
      if ((imageHeight / diff) &lt; parentHeight) {
       obj.css({'width': 'auto', 'height': parentHeight});

       // set image variables to new dimensions
       imageWidth = imageWidth / (imageHeight / parentHeight);
       imageHeight = parentHeight;
      }
      else {
       obj.css({'height': 'auto', 'width': parentWidth});

       // set image variables to new dimensions
       imageWidth = parentWidth;
       imageHeight = imageHeight / diff;
      }

      // step 3 - center image in container
      var leftOffset = (imageWidth - parentWidth) / -2;
      var topOffset = (imageHeight - parentHeight) / -2;

      obj.css({'left': leftOffset, 'top': topOffset});
    });

    // force ie to run the load function if the image is cached
    if (this.complete) {
      obj.trigger('load');
    }
  });
}</pre>
<p>And to use it, simply call resizeToParent on your image, like so:</p>
<pre class="brush:js">$('#myImage').resizeToParent();</pre>
<p>The plugin will automatically resize the image as soon as it&#8217;s finished loading. By default, the image will get resized to the nearest parent div. If you want to target a specific parent, simply pass a selector to the function as the &#8216;parent&#8217; parameter, like so:</p>
<pre class="brush:js">$('#myImage').resizeToParent({parent: '.parentContainer'});</pre>
<p>Also, don&#8217;t forget that the parent container must have &#8216;overflow: hidden&#8217; so that the image doesn&#8217;t spill out of the parent, and the image must be positioned relatively or absolutely for it to be centered correctly.</p>
<p>Please feel free to leave any questions, comments, or suggestions in the comments below <img src='http://christianvarga.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://christianvarga.com/blog/2011/05/jquery-resize-image-to-parent-container-plugin/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to calculate driving distance between 2 locations with Google Maps API</title>
		<link>http://christianvarga.com/blog/2010/12/how-to-calculate-driving-distance-between-2-locations-with-google-maps-api/</link>
		<comments>http://christianvarga.com/blog/2010/12/how-to-calculate-driving-distance-between-2-locations-with-google-maps-api/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 11:47:24 +0000</pubDate>
		<dc:creator>Christian Varga</dc:creator>
				<category><![CDATA[Google API]]></category>

		<guid isPermaLink="false">http://www.christianvarga.com/blog/?p=15</guid>
		<description><![CDATA[Although this is quite a common question, the majority of tutorials seem to be over-complicating the solution which may confuse people who are new to the Google Maps API. This tutorial is designed to show you an easy way to geocode 2 addresses and get the driving distance between them. We are going to base <a href="http://christianvarga.com/blog/2010/12/how-to-calculate-driving-distance-between-2-locations-with-google-maps-api/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Although this is quite a common question, the majority of tutorials seem to be over-complicating the solution which may confuse people who are new to the Google Maps API. This tutorial is designed to show you an easy way to geocode 2 addresses and get the driving distance between them.</p>
<p>We are going to base our app off the <a href="http://code.google.com/apis/maps/documentation/javascript/examples/directions-simple.html" target="_blank">directions-simple.html</a> sample that Google provides. We only need to change a few things to make it display the driving distance.</p>
<p>The first thing we&#8217;ll do is create the HTML file. You can use the following code as a guide:</p>
<pre class="brush:xml">&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;Distance Calculator&lt;/title&gt;
		&lt;style type="text/css"&gt;
			#map_canvas {
				height: 100%;
			}
		&lt;/style&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;div&gt;
			&lt;p&gt;
				&lt;label for="start"&gt;Start: &lt;/label&gt;
				&lt;input type="text" name="start" id="start" /&gt;

				&lt;label for="end"&gt;End: &lt;/label&gt;
				&lt;input type="text" name="end" id="end" /&gt;

				&lt;input type="submit" value="Calculate Route" /&gt;
			&lt;/p&gt;
			&lt;p&gt;
				&lt;label for="distance"&gt;Distance (km): &lt;/label&gt;
				&lt;input type="text" name="distance" id="distance" readonly="true" /&gt;
			&lt;/p&gt;
		&lt;/div&gt;
		&lt;div id="map_canvas"&gt;&lt;/div&gt;
	&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Next, we&#8217;ll add the map to the page. Include the following 2 lines in your head tag:</p>
<pre class="brush:xml">&lt;meta name="viewport" content="initial-scale=1.0, user-scalable=no"/&gt;
&lt;script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"&gt;&lt;/script&gt;</pre>
<p>Then add a script tag to your head with the initialize function to set up the map:</p>
<pre class="brush:js">&lt;script type="text/javascript"&gt;
var directionDisplay;
var map;

function initialize() {
	directionsDisplay = new google.maps.DirectionsRenderer();
	var melbourne = new google.maps.LatLng(-37.813187, 144.96298);
	var myOptions = {
		zoom:12,
		mapTypeId: google.maps.MapTypeId.ROADMAP,
		center: melbourne
	}

	map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	directionsDisplay.setMap(map);
}
&lt;/script&gt;</pre>
<p>Finally, add the initialize function to the body onload, like so:</p>
<pre class="brush:xml">&lt;body onload="initialize()"&gt;</pre>
<p>If you load up your page, you should see a nice big Google map that doesn&#8217;t do much. Let&#8217;s change that.</p>
<p>Add a new variable called directionsService and a function called calcRoute() to your script, like so:</p>
<pre class="brush:js">var directionsService = new google.maps.DirectionsService();

function calcRoute() {
	var start = document.getElementById("start").value;
	var end = document.getElementById("end").value;

	var request = {
		origin:start,
		destination:end,
		travelMode: google.maps.DirectionsTravelMode.DRIVING
	};

	directionsService.route(request, function(response, status) {
		if (status == google.maps.DirectionsStatus.OK) {
			directionsDisplay.setDirections(response);
		}
	});
}</pre>
<p>Then change your submit button to call the function:</p>
<pre class="brush:xml">&lt;input type="submit" value="Calculate Route" onclick="calcRoute()" /&gt;</pre>
<p>If you save and reload your page, you should be able to enter 2 locations and the Google Maps API will geocode them and display the route on the map.</p>
<p>But of course,  what you&#8217;ve really been waiting for is to get the distance of the trip. Let&#8217;s do it!</p>
<p>Inside the calcRoute() function, add a new variable called distanceInput (add it under the existing variables):</p>
<pre class="brush:js">var distanceInput = document.getElementById("distance");</pre>
<p>Last but not least, add the following line of code inside the directionsService response&#8217;s anonymous function (add it under the &#8220;<em>directionsDisplay.setDirections(response);</em>&#8221; line):</p>
<pre class="brush:js">distanceInput.value = response.routes[0].legs[0].distance.value / 1000;</pre>
<p>Save and reload your page. When you click Calculate Route, not only will the route be shown on the map, but the distance will be calculated too. Congratulations! If your code doesn&#8217;t seem to be working, you can view my working example at <a href="http://www.christianvarga.com/driving_distance.html">http://www.christianvarga.com/driving_distance.html</a> to see what went wrong.</p>
<p>Let&#8217;s quickly discuss what we&#8217;re actually doing here so we can understand why we refer to the response like this.</p>
<p>The directions result object we receive from Google contains a routes array. Multiple routes can be returned if a request is sent with the provideRouteAlternatives field set to true (this is set in the request parameters), but  this field defaults to false, and because we don&#8217;t set it, we are only ever dealing with one route so we refer to <strong><em>routes[0]</em></strong>.</p>
<p>Inside the routes array is another array called legs, which contains details relating to each leg of the journey. A leg is defined as the trip from one waypoint to another. Waypoints can be set in the request parameters (these force the route to pass through the waypoint), however because we don&#8217;t set any waypoints, there is only one leg in the journey which is from the start location to the end location, so we refer to<em> <strong>legs[0]</strong></em>.</p>
<p>Finally, each leg of the journey contains a distance field, which you can either get the value of (in metres) by referring to <em>.value</em>, or you can get a textual representation in the locale&#8217;s units by referring to <em>.text</em>. I prefer to get the exact value in metres and then perform my own calculation (divide by 1000) to convert it into kilometres, so I call<em> <strong>distance.value / 1000</strong></em>.</p>
<p>There&#8217;s a lot more to the Google Maps API, to get the most out of it you can have a look at the directions request/response documentation at <a href="http://code.google.com/apis/maps/documentation/javascript/services.html#Directions">http://code.google.com/apis/maps/documentation/javascript/services.html#Directions</a>. This should get you started with extending the functionality of our little app.</p>
<p>If you have any questions or comments, please don&#8217;t hesitate to leave them below.</p>
]]></content:encoded>
			<wfw:commentRss>http://christianvarga.com/blog/2010/12/how-to-calculate-driving-distance-between-2-locations-with-google-maps-api/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

