<?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>GoSquared - Blog &#187; Code</title>
	<atom:link href="http://www.gosquared.com/liquidicity/archives/category/code/feed" rel="self" type="application/rss+xml" />
	<link>http://www.gosquared.com/liquidicity</link>
	<description>The blog on design and technology by GoSquared</description>
	<lastBuildDate>Fri, 03 Feb 2012 14:17:32 +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>Resolve ELB connectivity issues</title>
		<link>http://www.gosquared.com/liquidicity/archives/2066</link>
		<comments>http://www.gosquared.com/liquidicity/archives/2066#comments</comments>
		<pubDate>Mon, 01 Aug 2011 17:00:48 +0000</pubDate>
		<dc:creator>Geoff Wagstaff</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[503]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[balancer]]></category>
		<category><![CDATA[connectivity]]></category>
		<category><![CDATA[elastic]]></category>
		<category><![CDATA[ELB]]></category>
		<category><![CDATA[latency]]></category>
		<category><![CDATA[load]]></category>
		<category><![CDATA[unavailable]]></category>

		<guid isPermaLink="false">http://www.gosquared.com/liquidicity/?p=2066</guid>
		<description><![CDATA[We&#8217;ve recently been running into a recurring issue with AWS&#8217; Elastic Load Balancing service. The problem manifests itself in vastly increased latency or eventual dropout of requests against the load balancer. We verified the health of our instances in each availability zone, and concluded that it was not a problem at the instance level. Second, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.gosquared.com/images/liquidicity/09_12_06_geoffdev_790x100.jpg" alt="Dev with Geoff - Development time with our CTO Geoff Wagstaff" width="790" height="100"/></p>
<p>We&#8217;ve recently been running into a recurring issue with AWS&#8217; Elastic Load Balancing service. The problem manifests itself in vastly increased latency or eventual dropout of requests against the load balancer.</p>
<p>We verified the health of our instances in each availability zone, and concluded that it was not a problem at the instance level. Second, we confirmed that our DNS queries were being routed to the ELB correctly. They were. So the issue was at the ELB level.</p>
<p>As it turns out, there appears to have been/still is a bug where ELB will suddenly decide that there are no available instances in a particular availability zone, or at least it will have trouble connecting to instances in that particular zone. Even if the instances are perfectly fine, and pass all health checks.</p>
<p>The solution was to try to identify the suspect zone, and de-register that zone and all of its instances from the ELB. Once re-registering the zone &#038; instances completed, the ELB was back up to full functionality again.</p>
<p>Hope this helps next time you run into any ELB issues!</p>
<p>P.S. We&#8217;re big fans of Amazon Web Services &#8211; if you haven&#8217;t already, check out our recent <a href="http://aws.typepad.com/aws/2011/07/summer-startups-gosquared.html" title="GoSquared and Amazon Web Services - real-time web analytics in the cloud" target="_blank">feature on the AWS Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gosquared.com/liquidicity/archives/2066/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3.2 in detail &#8211; Shiny new GoSquared Live API (and a competition!)</title>
		<link>http://www.gosquared.com/liquidicity/archives/2080</link>
		<comments>http://www.gosquared.com/liquidicity/archives/2080#comments</comments>
		<pubDate>Tue, 19 Jul 2011 11:06:38 +0000</pubDate>
		<dc:creator>Geoff Wagstaff</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[liquidicity]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Analytics]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Applications]]></category>
		<category><![CDATA[Apps]]></category>
		<category><![CDATA[Competition]]></category>
		<category><![CDATA[GoSquared]]></category>
		<category><![CDATA[Live]]></category>
		<category><![CDATA[Live API]]></category>
		<category><![CDATA[Real-Time]]></category>

		<guid isPermaLink="false">http://www.gosquared.com/liquidicity/?p=2080</guid>
		<description><![CDATA[We&#8217;re often told that that our real-time data is analytical gold for the decision makers behind all kinds of online establishments; from personal portfolio sites right up to the busiest e-commerce enterprises. We pour all our passion, blood, sweat and tears into making our applications as useful, intuitive, and beautiful as possible, so you benefit [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.gosquared.com/developer/" title="View the GoSquared Developer Documentation now"><img src="http://static.gosquared.com/images/liquidicity/11_07_19_liveapi_01_790x200.jpg" width="790" height="200" alt="The all new GoSquared Live API. Adapt your site in real-time." /></a></p>
<p>We&#8217;re often told that that our real-time data is analytical gold for the decision makers behind all kinds of online establishments; from personal portfolio sites right up to the busiest e-commerce enterprises. We pour all our passion, blood, sweat and tears into making our applications as useful, intuitive, and beautiful as possible, so you benefit from our continued efforts to make our data as insightful and actionable as possible.</p>
<p>But it gets better. We&#8217;ve opened the gates to our analytical gold mine, empowering developers with access to the same raw data that fuels our very own applications. With 3.2, we&#8217;ve announced the immediate availability of the new real-time <a href="http://www.gosquared.com/developer/">GoSquared Live API</a>.</p>
<h3>Calling all developers!</h3>
<p>We&#8217;re very excited about the possibilities. Using the API, you can write adaptive applications that display your sites&#8217; traffic in any number of interesting ways. These could range from epic visualisations that boldly showcase your Ãœber development talent, to adaptive modules on your website that respond to traffic changes in real-time. The best part is, it&#8217;s all platform and language agnostic, so you can use the languages and tools you love.</p>
<p>Head on over to the <a href="http://www.gosquared.com/developer/" title="GoSquared API developer documentation">developer documentation</a> to check out what this baby can do.</p>
<p><strong>Read on for details about our competition</strong> &#8211; win $150 of analytics by playing with our new API!</p>
<p><span id="more-2080"></span></p>
<p><a style="float: left;" href="http://www.gosquared.com/developer/demo/radar/" title="Radar"><img src="http://static.gosquared.com/images/liquidicity/11_07_19_liveapi_02_294x558.jpg" alt="GoSquared API Demos - Radar" width="294" height="558" /></a></p>
<h3 style="padding-top: 70px;">Example apps we&#8217;ve built with the GoSquared API.</h3>
<h4 style="padding-top: 10px;">(What we built in 2 days)</h4>
<p>We couldn&#8217;t wait to have a play ourselves, so we&#8217;ve whipped up a couple of example applications to help inspire your creative flair and show you what&#8217;s possible with the API. We&#8217;ve created two applications:</p>
<h4>Radar</h4>
<p>The radar shows you a dynamic real-time representation of your users&#8217; geographic location. Now you can view your websites&#8217; traffic through the eyes of a James Bond villain. Sound effects not included.</p>
<p><a href="http://www.gosquared.com/developer/demo/radar/" title="Try the GoSquared API Demo of Radar now">Try Radar now &rarr;</a></p>
<h4>Top Content</h4>
<p>The top content widget tells you what content on your site is the most popular, right now and over time, enabling you to effectively and adaptively funnel your audience to your hottest content without even lifting a finger.</p>
<p><a href="http://www.gosquared.com/developer/demo/topcontent/" title="Try the GoSquared API Demo of Top Content now">Try Top Content now &rarr;</a></p>
<h3 style="padding-top: 50px;">Competition time.</h3>
<p>The GoSquared API also facilitates seamless integration with 3rd party products and services, so platform developers can start integrating GoSquared analytics with their own systems.</p>
<p>I think this calls for a little competition. We&#8217;ll give away 6 months of the <a href="https://www.gosquared.com/plans/" title="View GoSquared plans and pricing">GoSquared Plus plan</a> to the 3 most impressive applications built using the GoSquared API. One entry per person please (but of course you can make as many apps as you like!) To enter the competition, start working on your apps and give us a shout (and a link) via Twitter (@<a href="http://twitter.com/GoSquared" title="GoSquared on Twitter" target="_blank">GoSquared</a>) or leave a comment on this post. </p>
<p>So, what are you waiting for? <a href="http://www.gosquared.com/developer/" title="View the GoSquared Developer Documentation now">Get to grips with the GoSquared API documentation now!</a></p>
<p>We can&#8217;t wait to see what you come up with.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gosquared.com/liquidicity/archives/2080/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook Like Button &#8211; Ignoring Duplicate Traffic</title>
		<link>http://www.gosquared.com/liquidicity/archives/1946</link>
		<comments>http://www.gosquared.com/liquidicity/archives/1946#comments</comments>
		<pubDate>Wed, 25 May 2011 16:10:26 +0000</pubDate>
		<dc:creator>JT</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[liquidicity]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Analytics]]></category>
		<category><![CDATA[Button]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Like]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[Real-Time]]></category>
		<category><![CDATA[Social]]></category>
		<category><![CDATA[Stats]]></category>
		<category><![CDATA[tracking]]></category>

		<guid isPermaLink="false">http://www.gosquared.com/liquidicity/?p=1946</guid>
		<description><![CDATA[We&#8217;ve noticed some odd things happening to some of our stats, and it&#8217;s been brought to our attention that some of you, our customers, are experiencing similar issues. The problem pertains to pages with Facebook&#8217;s &#8220;Like&#8221; button or any of their other social plugins. Quietly duplicating requests. Under certain circumstances, a page with a Like [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.gosquared.com/images/liquidicity/11_05_25_facebooklike_790x200.jpg" width="790" alt="Facebook Like Button - How to avoid duplicating your stats"/></p>
<div id="fb-root"></div>
<p><script src="http://connect.facebook.net/en_US/all.js#appId=227598200583807&amp;xfbml=1"></script><fb:like href="" send="false" width="450" show_faces="true" font="arial"></fb:like></p>
<p>We&#8217;ve noticed some odd things happening to some of our stats, and it&#8217;s been brought to our attention that some of you, our customers, are experiencing similar issues. The problem pertains to pages with Facebook&#8217;s &#8220;Like&#8221; button or any of their other <a href="http://developers.facebook.com/docs/plugins/">social plugins</a>.</p>
<h3>Quietly duplicating requests.</h3>
<p>Under certain circumstances, a page with a Like button can register one extra pageview for every button you have on the page. This is undesirable, because if you run a site with, say, ten like buttons on the homepage, you&#8217;ll see eleven pageviews for each and every time someone actually views the page, not one. Obviously this is going to completely throw off all your tracked stats and analytics. Not good.</p>
<p><span id="more-1946"></span></p>
<h3>Blame IE.</h3>
<p>It turns out this is a quirk of Facebook&#8217;s methods. For security reasons, AJAX requests typically aren&#8217;t allowed to be sent across domains (so, for example, a facebook plugin running on yourdomain.com wouldn&#8217;t be able to send an AJAX request to facebook.com). Most sensible browsers now implement a feature where a specific header (Access-Control-Allow-Origin) can be set to allow this behaviour. With one exception. Internet Explorer, being Internet Explorer, shuns all compatible web standards, so facebook have had to make a workaround. And for reasons we can&#8217;t quite fathom, they&#8217;ve decided to do that by loading your whole page again in an invisible iframe.</p>
<h3>How this may have been affecting you.</h3>
<p>This has a negative impact both server- and client-side. Not all sites have the tens of thousands of servers facebook has, and this method will multiply load levels by however many Like buttons you have on the page. And because of the way it&#8217;s implemented, it can slow the client-side browser down by a massive amount too. And for those of you who have auto-playing audio or video on your pages, you may have noticed you can&#8217;t put a like button on the page, because you sometimes end up heading a second audio stream coming apparently from nowhere. That&#8217;s all caused by this Facebook&#8217;s issue.</p>
<h3>What can you do about this?</h3>
<p>Firstly, we&#8217;ll be rolling out a new version of our tracker this week which won&#8217;t track these fake hits from Facebook. So you won&#8217;t get crazily distorted stats. But there are a couple of other things you can do to improve the situation further. Firstly, if you are using any other analytics services that allow you to filter out certain URLs, tell them to ignore any hits with the parameters &#8220;fb_xd_bust&#8221; or &#8220;fb_xd_fragment&#8221; in the URL. For example in Google Analytics you can <a href="http://www.google.com/support/analytics/bin/answer.py?answer=55492" target="_blank">set a custom filter</a> to exclude request URIs matching the pattern &#8220;fb_xd_bust|fb_xd_fragment&#8221;.</p>
<p>We&#8217;d also recommend you take a look at <a href="https: //developers.facebook.com/docs/reference/javascript/FB.init/" target="_blank"> this page on Facebook&#8217;s developer site</a>. They don&#8217;t draw much attention to it, but the &#8220;Custom Channel URL&#8221; section is extremely important to anyone who doesn&#8217;t want their stats to be completely thrown off by Facebook&#8217;s somewhat strange methods.</p>
<h3>To sum up.</h3>
<ul>
<li>Facebook use some strange method for their cross-domain ajax, which distorts all your stats and puts extra load on your servers, and they could do with drawing more attention to it.</li>
<li>We&#8217;re rolling out a new tracker that takes care of the fake hits on our end so your stats don&#8217;t get broken.</li>
<li>Check out ways to work around this so you don&#8217;t end up putting extra strain on your server, and ways to stop these fake hits showing up in your other analytics services.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.gosquared.com/liquidicity/archives/1946/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Panic Over! Node.JS Help Sheet is here.</title>
		<link>http://www.gosquared.com/liquidicity/archives/1930</link>
		<comments>http://www.gosquared.com/liquidicity/archives/1930#comments</comments>
		<pubDate>Wed, 18 May 2011 15:20:09 +0000</pubDate>
		<dc:creator>James Gill</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Help Sheets]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Backend]]></category>
		<category><![CDATA[Cheat Sheet]]></category>
		<category><![CDATA[Cheatsheet]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Help Sheet]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Node]]></category>
		<category><![CDATA[NodeJS]]></category>
		<category><![CDATA[Real-Time]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.gosquared.com/liquidicity/?p=1930</guid>
		<description><![CDATA[What&#8217;s this? A new GoSquared Help Sheet? Hell yeah! We&#8217;re pleased to bring you a brand new GoSquared Help Sheet for your Node.JS needs. What&#8217;s Node.JS? If you&#8217;ve read this far, you probably already know, but for those intrigued, Node.JS is an evented I/O framework for the V8 JavaScript engine. It&#8217;s ideal for writing scalable [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.gosquared.com/images/liquidicity/11_05_18_nodehelpsheet_790x400.jpg" alt="Node.JS Help Sheet from GoSquared" width="790"/></p>
<p>What&#8217;s this? A new GoSquared Help Sheet? Hell yeah!</p>
<p>We&#8217;re  pleased to bring you a brand new <a href="http://www.gosquared.com/liquidicity/archives/category/helpsheets">GoSquared Help Sheet</a> for your Node.JS needs.</p>
<h3>What&#8217;s Node.JS?</h3>
<p>If you&#8217;ve read this far, you probably already know, but for those intrigued, <a href="http://nodejs.org/">Node.JS</a> is an evented I/O framework for the <a href="http://code.google.com/p/v8/">V8 JavaScript engine</a>. It&#8217;s ideal for writing scalable network programs such as web servers.</p>
<p>We&#8217;ve been working on some exciting things with Node.JS, and we felt it was only fair to share our knowledge in the form of an easy-to-read Help Sheet.</p>
<p><span id="more-1930"></span></p>
<p>Feel free to print it out, stick it on your wall, and get developing!</p>
<p>As always, if you find any errors or typos or anything like that, please drop us a note in the comments.</p>
<p><a href="http://downloads.gosquared.com/help_sheets/11/Node%20Help%20Sheet.pdf" title="Download the Node.JS Help Sheet PDF" onClick="javascript: pageTracker._trackPageview('/images/help_sheets_node'); "><img src="http://static.gosquared.com/images/liquidicity/doc_pdf_48.png" alt="Node.JS Help Sheet PDF" height="48" width="48" /> Get the Node.JS Help Sheet PDF (530KB)</a></p>
<p><a href="http://downloads.gosquared.com/help_sheets/11/Node-Help-Sheet-large.jpg" title="Node.JS Help Sheet - Click to enlarge"><img src="http://downloads.gosquared.com/help_sheets/11/Node-Help-Sheet.jpg" alt="Node.JS Help Sheet Preview - Click to enlarge" width="790"/></a></p>
<h3>Want more?</h3>
<p>If you&#8217;re stuck, we also have some other helpful <a href="http://www.gosquared.com/liquidicity/archives/category/helpsheets">Help Sheets</a> &#8211; for <a href="http://www.gosquared.com/liquidicity/archives/1010">CSS2 and CSS3</a>, <a href="http://www.gosquared.com/liquidicity/archives/501">HTML</a>, <a href="http://www.gosquared.com/liquidicity/archives/501">PHP</a>, and <a href="http://www.gosquared.com/liquidicity/archives/1333">VI</a>, as well as handy <a href="http://www.gosquared.com/liquidicity/archives/172">OS X Character Reference sheets</a>. All available for FREE download now!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gosquared.com/liquidicity/archives/1930/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Memcache and persistence</title>
		<link>http://www.gosquared.com/liquidicity/archives/1806</link>
		<comments>http://www.gosquared.com/liquidicity/archives/1806#comments</comments>
		<pubDate>Tue, 29 Mar 2011 09:28:41 +0000</pubDate>
		<dc:creator>Geoff Wagstaff</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Geoff]]></category>
		<category><![CDATA[memcache]]></category>
		<category><![CDATA[Persistence]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Storage]]></category>

		<guid isPermaLink="false">http://www.gosquared.com/liquidicity/?p=1806</guid>
		<description><![CDATA[There are a lot of new database systems popping up that can be interpreted by the newbie as &#8220;memcache, but with persistence&#8221;: MemcacheDB, Membase, redis, Project Voldemort etc. I&#8217;ve seen the term &#8220;persistent Memcache&#8221; being thrown around a lot, which is an oxymoron in itself, as the term &#8220;persistent&#8221; undermines the implied ephemeral nature of [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.gosquared.com/images/liquidicity/09_12_06_geoffdev_790x100.jpg" alt="Develop with Geoff at GoSquared" title="Develop with Geoff at GoSquared" width="790" height="100" /></p>
<p>There are a lot of new database systems popping up that can be interpreted by the newbie as &#8220;memcache, but with persistence&#8221;: MemcacheDB, Membase, redis, Project Voldemort etc. I&#8217;ve seen the term &#8220;persistent Memcache&#8221; being thrown around a lot, which is an oxymoron in itself, as the term &#8220;persistent&#8221; undermines the implied ephemeral nature of a &#8220;memory cache&#8221;. We must be careful not to mislead those impressionable by buzzwords into adopting the wrong technology for the wrong uses.</p>
<p>It&#8217;s not uncommon to hear the comparison &#8220;like a persistent version of memcache&#8221; being thrown about, and it is understandable why it is used. While brave new ground is being covered by these new DBMs, this simile acts as a straightforward introduction to these new technologies and how they work. If you&#8217;ve worked with web development or MySQL for any tangible amount of time, chances are you&#8217;ve had experience with Memcache and its simple key/value data model. So it&#8217;s a great technique to help tame these wild and mysterious new technologies so that we understand them better in terms of what we already know.</p>
<p>However, we must be careful not to let this comparison transcend the fundamental differences between these systems. I fear that many regard &#8220;persistent Memcache&#8221; as a drop-in replacement for the original Memcache so that they don&#8217;t need to worry about cache timeouts or its ephemeral nature. Whereas the important distinction to make here is that these systems are <em>databases</em>, and Memcache is a <em>cache</em>, and nothing else. For best performance, it is important that both are still used in a way that complements their design and intended usage. I am worried this likeness will foster poor data model design, as developers feel more secure with interchangeably using their caches as databases, and vice versa, adopting the wrong technologies and software design paradigms on this premise. Sure, many of these &#8220;NoSQL&#8221; persistent databases can be used as a cache, but to engineers building high performance systems, it is important to keep the distinction in mind to avoid unnecessary overheads.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gosquared.com/liquidicity/archives/1806/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing Map View (beta)</title>
		<link>http://www.gosquared.com/liquidicity/archives/1828</link>
		<comments>http://www.gosquared.com/liquidicity/archives/1828#comments</comments>
		<pubDate>Thu, 10 Mar 2011 17:25:46 +0000</pubDate>
		<dc:creator>James Gill</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[liquidicity]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.gosquared.com/liquidicity/?p=1828</guid>
		<description><![CDATA[Today we&#8217;re releasing Map View (beta) into GoSquared&#8217;s Labs. Check it out. What is Map View? Map View is the same beautiful map that you will instantly recognise if you&#8217;ve been using GoSquared LiveStats. We&#8217;ve cut out everything else to leave just the map &#8211; allowing you to show off the locations of all your [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.gosquared.com/labs/map/"><img src="http://static.gosquared.com/images/liquidicity/11_03_10_mapview_01_790x200.jpg" alt="Map View - where are your site's visitors?" /></a></p>
<p>Today we&#8217;re releasing Map View (beta) into GoSquared&#8217;s <a href="http://www.gosquared.com/labs/">Labs</a>. <a href="http://www.gosquared.com/labs/map/">Check it out</a>.</p>
<h3>What is Map View?</h3>
<p>Map View is the same beautiful map that you will instantly recognise if you&#8217;ve been using GoSquared LiveStats. We&#8217;ve cut out everything else to leave just the map &#8211; allowing you to show off the locations of all your visitors to anyone you want without the worries of showing email addresses, user IDs and other personally identifiable information.</p>
<h3>How does this fit in with my business?</h3>
<p>Map View is ideal for large screens and projectors. We received a ton of feedback from customers who wanted to run just the map from LiveStats on a big screen in their office or their reception area. We also realised it&#8217;d be beneficial for everyone if we could offer Map View to those who wanted it, without the extra burden of all the extra information around visitors, pages, and referrers.</p>
<h3>Do I need a GoSquared Account to try out Map View?</h3>
<p>You sure will, if you don&#8217;t have one already. You can <a href="https://www.gosquared.com/plans/standard/">sign up for GoSquared</a> from just $9.99 per month, or have a play on the <a href="https://www.gosquared.com/plans/free/">free account</a> right now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gosquared.com/liquidicity/archives/1828/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developers &#8211; Using AWS tags for Instance Identification</title>
		<link>http://www.gosquared.com/liquidicity/archives/1772</link>
		<comments>http://www.gosquared.com/liquidicity/archives/1772#comments</comments>
		<pubDate>Mon, 28 Feb 2011 11:16:53 +0000</pubDate>
		<dc:creator>Geoff Wagstaff</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Help Sheets]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[bashrc]]></category>
		<category><![CDATA[EC2]]></category>
		<category><![CDATA[hostnames]]></category>
		<category><![CDATA[identification]]></category>
		<category><![CDATA[instance]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[tagging]]></category>
		<category><![CDATA[tags]]></category>

		<guid isPermaLink="false">http://www.gosquared.com/liquidicity/?p=1772</guid>
		<description><![CDATA[A few months ago, AWS introduced an extremely useful little feature to their consistently developing EC2 platform: Instance Tagging. Before tags, it was relatively tricky to define a clear instance nomenclature, forcing you to implement a vague approach using security groups if you wanted something close to the same functionality. Since there is also a [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://static.gosquared.com/images/liquidicity/09_12_06_geoffdev_790x100.jpg" alt="Develop with Geoff at GoSquared" title="Develop with Geoff at GoSquared" width="790" height="100" class="size-full wp-image-1105" /></p>
<p>A few months ago, AWS introduced an extremely useful little feature to their consistently developing EC2 platform: <a href="http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/Using_Tags.html">Instance Tagging</a>. Before tags, it was relatively tricky to define a clear instance nomenclature, forcing you to implement a vague approach using <a href="http://shlomoswidler.com/2009/06/tagging-ec2-instances-using-security_30.html">security groups</a> if you wanted something close to the same functionality. Since there is also a full API surrounding tags, they can be put to work in many useful ways.</p>
<h3>Naming instances</h3>
<p>Besides attaching up to ten custom nuggets of arbitrary data to instances, tags can be extremely handy when it comes to naming your EC2 instances, and more importantly, using these names to differentiate between instances and their roles. For example, you have three instances. One holds your master database and website, the second is a slave database in replication, and the third is a staging/test server. You&#8217;ll want to make pretty damn sure that when you&#8217;re SSH&#8217;d into all three of your instances, the commands you send are received by the intended recipient server.<br />
<span id="more-1772"></span><br />
In the EC2 management console, you can define a tag key for an instance which is then mapped to a value. There is a default tag key called &#8220;Name&#8221;. In the value for that &#8220;Name&#8221; key, you can type in the name you want to assign to that instance. For our servers in this example we can call the master server master-0, the slave server slave-0, and the staging server staging-0. I like this naming system because on the left of the hyphen you can define the type or classification of that server representing the role it performs, and the number following the hyphen can be incremented for each server of the same type, therefore acting as a unique ID for each server. </p>
<p>Conveniently, you can define which of these tags become a column in the table listing all of your instances. If you have a large number of instances, having this custom column for tags present can make it far quicker to find the instance you&#8217;re looking for at a glance, rather than trying to derive the right one from all of the other parameters displayed.</p>
<p><a href="http://www.gosquared.com/liquidicity/wp-content/uploads/2011/02/aws_columns.png"><img style="padding-left: 10px;" src="http://www.gosquared.com/liquidicity/wp-content/uploads/2011/02/aws_columns.png" alt="" title="aws_columns" width="637" height="380" class="alignnone size-full wp-image-1780" /></a></p>
<h3>Doing some magic with .bashrc</h3>
<p>I am a big fan of customising the bash prompt so that it displays only useful contextual information I need to know when I send commands. One of the problems I came across whilst working simultaneously on multiple instances is making sure I am sending commands to the correct one. Sure, most bash prompts include the server&#8217;s hostname in the prompt, but beware &#8211; there are flaws with this. For example, if you reboot an EBS-backed instance, the hostname it shows is not necessarily the one it is operating from. I needed something more definitive than that.</p>
<p>Here&#8217;s some example code you can place in your .bashrc file to display the instance ID and server name in the command prompt:</p>
<p><code>INSTANCEID=`curl -s http://169.254.169.254/latest/meta-data/instance-id`<br />
SERVER_IDENTIFIER=$INSTANCEID<br />
SERVER_TAG=0<br />
if [ -f /var/opt/server-tag ]; then<br />
    SERVER_TAG=`cat /var/opt/server-tag`<br />
    SERVER_IDENTIFIER="$SERVER_TAG:$SERVER_IDENTIFIER"<br />
fi<br />
if [ "$color_prompt" = yes ]; then<br />
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@${SERVER_IDENTIFIER}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '<br />
else<br />
    PS1='${debian_chroot:+($debian_chroot)}\u@${SERVER_IDENTIFIER}:\w\$ '<br />
fi<br />
unset color_prompt force_color_prompt</code></p>
<p>The great thing about this bashrc code is that if you have a file saved at /var/opt/server-tag which contains the server&#8217;s tagged name, the prompt will look something like this:</p>
<p><a href="http://www.gosquared.com/liquidicity/wp-content/uploads/2011/02/command_prompt.png"><img style="padding-left: 10px;" src="http://www.gosquared.com/liquidicity/wp-content/uploads/2011/02/command_prompt.png" alt="" title="command_prompt" width="237" height="19" class="alignnone size-full wp-image-1781" /></a></p>
<p>That prompt clearly defines that I am working as user Ubuntu on a server called Node#1 with instance ID of i-b92990d5, so I don&#8217;t need to think twice about that.</p>
<h3>Using tags as hostnames</h3>
<p>Now that we have named our instances using tags, we can turn them into hostnames so we can address them directly in our scripts, avoiding the need for expensive lookups against Amazon&#8217;s API to find server internal IPs. I&#8217;ve written a simple script to add entries to the /etc/hosts file for each of your instances that have a tag called &#8220;Name&#8221;. The value in this &#8220;Name&#8221; tag will become that server&#8217;s hostname, which then forwards to its internal IP address. While we&#8217;re at it, we also create the aforementioned /var/opt/server-tag file so our .bashrc script can display the server name in the command prompt. Note this script requires the <a href="http://docs.amazonwebservices.com/AWSSDKforPHP/latest/">AWS SDK for PHP</a> and because we&#8217;re modifying the /etc/hosts file, you need to run it as root.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #666666; font-style: italic;">// Install the AWS PHP SDK from http://docs.amazonwebservices.com/AWSSDKforPHP/latest/ and follow the setup instructions on that page.</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">&quot;aws-php-sdk/sdk.class.php&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SERVER_TAG'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/var/opt/server-tag'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
try<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Parse hosts file into an array</span>
	<span style="color: #000088;">$hosts_file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/etc/hosts'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$hosts_lines</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span>PHP_EOL<span style="color: #339933;">,</span> <span style="color: #000088;">$hosts_file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$hosts_lines</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$hlkey</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$hline</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$hline</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$host_lines</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$hlkey</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/\s/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$hline</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$hosts_updated</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$this_instance_id</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://169.254.169.254/latest/meta-data/instance-id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// Check server tag directory</span>
	<span style="color: #000088;">$server_tag_dir</span> <span style="color: #339933;">=</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span>SERVER_TAG<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$server_tag_dir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">mkdir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$server_tag_dir</span><span style="color: #339933;">,</span> <span style="color: #208080;">0777</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// Get the server tag</span>
	<span style="color: #000088;">$server_tag</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span>SERVER_TAG<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$EC2</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AmazonEC2<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$EC2</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">describe_instances</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isOK</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ec2-&gt;describe_instances failed&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// Each &quot;reservationSet&quot; is essentially an instance or compute &quot;reservation&quot;</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">body</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">reservationSet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$rset</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$iset</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$rset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">instancesSet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$iset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">instanceState</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">code</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Instance is not in &quot;running&quot; state, so ignore</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$iset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tagSet</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Server is tagged. We should note it down in the /etc/hosts file</span>
			<span style="color: #000088;">$tset</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$iset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tagSet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$server_identifier</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tset</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tset</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tset</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$tag</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tag</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">key</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'Name'</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$server_identifier</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><span style="color: #000088;">$tag</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">value</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">key</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'Name'</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$server_identifier</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><span style="color: #000088;">$tset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">value</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$server_identifier</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// This server is tagged with an identifier. Make sure we've got it recorded in the server-tag file if this is our server</span>
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><span style="color: #000088;">$iset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">instanceId</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$this_instance_id</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$server_tag</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$server_identifier</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">file_put_contents</span> <span style="color: #009900;">&#40;</span>SERVER_TAG<span style="color: #339933;">,</span> <span style="color: #000088;">$server_identifier</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #666666; font-style: italic;">// Now me ensure the correct host entry is written or up to date</span>
				<span style="color: #000088;">$nice_si</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$server_identifier</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Replace # with - to avoid conflicts</span>
				<span style="color: #000088;">$hosts_match</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$host_lines</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$hlkey</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$hline</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strstr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$hline</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'#'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Skip comment lines</span>
					<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$hostname</span> <span style="color: #339933;">=</span> <span style="color: #990000;">next</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$hline</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// Loop through the hostnames to see if this server exists in the host file</span>
						<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$hostname</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$nice_si</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// Found a hostname match, so check the mapped IP address</span>
							<span style="color: #000088;">$hosts_match</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
							<span style="color: #000088;">$ip_addr</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><span style="color: #000088;">$iset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">privateIpAddress</span><span style="color: #339933;">;</span>
							<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$hline</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$ip_addr</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
								<span style="color: #666666; font-style: italic;">// Private IP address has changed. Update it after a quick sanity check on IP address</span>
								<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip_addr</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip_addr</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$hline</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$ip_addr</span><span style="color: #339933;">;</span>
								<span style="color: #000088;">$host_lines</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$hlkey</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$hline</span><span style="color: #339933;">;</span>
								<span style="color: #000088;">$hosts_updated</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
							<span style="color: #009900;">&#125;</span>
						<span style="color: #009900;">&#125;</span>
					<span style="color: #009900;">&#125;</span>
				<span style="color: #009900;">&#125;</span>
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$hosts_match</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					<span style="color: #666666; font-style: italic;">// This server does not exist in the hosts list. Add it.</span>
					<span style="color: #000088;">$ip_addr</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><span style="color: #000088;">$iset</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">privateIpAddress</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip_addr</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip_addr</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
						<span style="color: #000088;">$host_lines</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip_addr</span><span style="color: #339933;">,</span> <span style="color: #000088;">$nice_si</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
						<span style="color: #000088;">$hosts_updated</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$hosts_updated</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$host_lines</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$hlkey</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$hline</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$host_lines</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$hlkey</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$hline</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_put_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/etc/hosts'</span><span style="color: #339933;">,</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$host_lines</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;/etc/hosts has been updated successfully<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Could not update /etc/hosts file<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;No changes to make<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
catch<span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>After running this script, we will have entries in our /etc/hosts file for all of our tagged servers, and because these are now defined as operating system hostnames, you can use these hostnames for connections between your servers (for example, if you were connecting to mysql from slave-0 to master-0 you could define the hostname for the connection as master-0:3306 and the connection will be made via Amazon&#8217;s internal DNS network. If you set this script to a regular cron job, you can ensure that the hostnames are kept updated and new ones are added as you tag new instances.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gosquared.com/liquidicity/archives/1772/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Introducing LiveStats 3</title>
		<link>http://www.gosquared.com/liquidicity/archives/1702</link>
		<comments>http://www.gosquared.com/liquidicity/archives/1702#comments</comments>
		<pubDate>Tue, 11 Jan 2011 13:45:10 +0000</pubDate>
		<dc:creator>James Gill</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[liquidicity]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[GoSquared]]></category>
		<category><![CDATA[LiveStats]]></category>

		<guid isPermaLink="false">http://www.gosquared.com/liquidicity/?p=1702</guid>
		<description><![CDATA[Today, we&#8217;re very excited to announce the latest version of GoSquared LiveStats &#8211; version 3. We&#8217;ve rewritten LiveStats from the ground up to focus around seeing which content is popular on your site at a glance. The centre of the interface shows a list of all the pages people are viewing on your site. The [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.gosquared.com/livestats/"><img alt="Introducing LiveStats 3" src="http://static.gosquared.com/images/liquidicity/11_01_11_ls3_01_790x300.jpg" title="Introducing LiveStats 3" class="alignnone" width="790" height="300" /></a></p>
<p>Today, we&#8217;re very excited to announce the latest version of GoSquared LiveStats &#8211; version 3.</p>
<p>We&#8217;ve rewritten LiveStats from the ground up to focus around seeing which content is popular on your site at a glance. The centre of the interface shows a list of all the pages people are viewing on your site.  The left side shows where your traffic is coming from &#8211; what people are tweeting, which sites are linking to you, and what people are searching for.</p>
<p>Learn more about the great <a href="http://www.gosquared.com/livestats/">new features of LiveStats 3</a>, and <a href="https://www.gosquared.com/plans/">sign up now</a>!</p>
<p><img src="http://static.gosquared.com/images/livestats/public/livestats_screenshot_05_inbrowser.png" alt="LiveStats 3 - see it in action" width="790" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gosquared.com/liquidicity/archives/1702/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Update to GoSquared Accounts and Settings</title>
		<link>http://www.gosquared.com/liquidicity/archives/1647</link>
		<comments>http://www.gosquared.com/liquidicity/archives/1647#comments</comments>
		<pubDate>Thu, 09 Dec 2010 20:18:30 +0000</pubDate>
		<dc:creator>James Gill</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[liquidicity]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Account]]></category>
		<category><![CDATA[Accounts]]></category>
		<category><![CDATA[Downgrade]]></category>
		<category><![CDATA[GoSquared]]></category>
		<category><![CDATA[LiveStats]]></category>
		<category><![CDATA[Member]]></category>
		<category><![CDATA[Plans]]></category>
		<category><![CDATA[Settings]]></category>
		<category><![CDATA[Trends]]></category>
		<category><![CDATA[Update]]></category>
		<category><![CDATA[Upgrade]]></category>
		<category><![CDATA[User]]></category>

		<guid isPermaLink="false">http://www.gosquared.com/liquidicity/?p=1647</guid>
		<description><![CDATA[Today we&#8217;re announcing two huge improvements to GoSquared. We&#8217;re introducing a new structure for user accounts and plans to make GoSquared more affordable, easier to join and simpler to upgrade. We&#8217;re also releasing an overhaul of the Site Manager application and renaming it Settings. The new Settings app Introducing a completely redesigned application for managing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://www.gosquared.com/settings/"><img src="http://static.gosquared.com/images/liquidicity/10_11_29_settings_790x250.jpg" alt="Introducing GoSquared Settings - Manage your GoSquared Account easier, faster, better" title="Introducing GoSquared Settings - Manage your GoSquared Account easier, faster, better" width="790" height="250" /></a></p>
<p>Today we&#8217;re announcing two huge improvements to <a href="http://www.gosquared.com/">GoSquared</a>. We&#8217;re introducing a new structure for user accounts and plans to make GoSquared more affordable, easier to <a href="https://www.gosquared.com/plans/">join</a> and simpler to upgrade. We&#8217;re also releasing an overhaul of the Site Manager application and renaming it <a href="http://www.gosquared.com/settings/">Settings</a>.</p>
<h3>The new Settings app</h3>
<p>Introducing a completely redesigned application for managing everything in your GoSquared Account, along with all the websites you&#8217;ve added to GoSquared.</p>
<p>Settings will look familiar if you&#8217;ve been using GoSquared for any period of time &#8211; it&#8217;s replacing what was previously known as Site Manager for managing the sites in your GoSquared Account. All the settings that were there before &#8211; editing of website name, URL, updating your site image preview, sharing options &#8211; are all still available.</p>
<p>Along with managing your websites, you can also edit your personal details, change your password, and upgrade your GoSquared Account (more on that shortly).</p>
<p><a href="http://static.gosquared.com/images/support/GoSquared%20-%20Settings%20-%20Plans%20-%20Upgrade.png"><img src="http://static.gosquared.com/images/support/GoSquared%20-%20Settings%20-%20Plans%20-%20Upgrade.png" alt="The new Settings - Upgrading and downgrading now easier than ever" width="790"/></a></p>
<h3>Updates to GoSquared Accounts</h3>
<p>The most notable change introduced with the Settings app is that there is a new option in the sidebar called &#8220;My Account&#8221; &#8211; head here to upgrade your GoSquared Account.</p>
<p>Until today, when you signed up for a plan (<a href="https://www.gosquared.com/plans/">see plans and pricing</a>), that plan would apply to a website on GoSquared. From now on, plans will apply to <b>user accounts</b> rather than to websites.</p>
<p>What does that mean? Before &#8211; if you signed up for a premium plan, that plan would only apply for one website, so even if you had 3 websites in your GoSquared account, you would only gain the increased pageview limit and additional features of the premium account for one website. We didn&#8217;t think that was fair &#8211; and a lot of people requested we change things so that the pageviews they were paying for could be shared across all sites in their account.</p>
<p>From today onwards when you sign up for a plan on GoSquared, the features and the number of pageviews on that plan will apply to all sites in your GoSquared account.</p>
<p>If you&#8217;re only on the free plan and you currently have multiple websites in your account then not too much will change except the pageview limit on the free plan &#8211; 10,000 pageviews monthly, will now be shared across all of your websites.</p>
<p>If you have any queries about the latest changes to GoSquared accounts, have a look at <a href="http://www.gosquared.com/support/wiki/update_to_accounts_December_2010">this support document</a>.</p>
<h3>Behind the scenes</h3>
<p>We&#8217;ve improved the functionality of the Settings app to be easier to use, and even faster than before by utilising the latest in HTML5, CSS3, and jQuery goodness. You won&#8217;t have to reload the screen at all &#8211; everything refreshes immediately, and tabs switch as soon as they&#8217;re clicked without any waiting.</p>
<p>Settings is there to be quick and easy &#8211; people want to jump in, change a detail, and get back to looking at their stats. That&#8217;s why we designed the URL structure to allow you to bookmark any screen in Settings and return to it at a later date. It&#8217;s also why you can jump straight to Settings from the sign in screen by clicking the Settings icon. Small things, but hopefully they&#8217;ll save you some valuable time.</p>
<h3>I don&#8217;t understand! Help me!</h3>
<p>We&#8217;ve put together a <a href="http://www.gosquared.com/support/wiki/update_to_accounts_December_2010">support document</a> outlining some of the top questions you may have regarding the changes to GoSquared accounts. Have a read of the <a href="http://www.gosquared.com/support/wiki/update_to_accounts_December_2010">support page</a>, and if you still have questions please feel free to <a href="http://www.gosquared.com/contact/">email us</a>, <a href="http://twitter.com/GoSquared">tweet us</a>, <a href="http://www.facebook.com/GoSquared">facebook us</a>, or leave a comment on <a href="http://getsatisfaction.com/gosquared">Get Satisfaction</a>.</p>
<p><b>Still not using GoSquared for real-time web analytics? <a href="https://www.gosquared.com/plans/" title="See plans, pricing, and free trial">Sign up now</a></b></p>
<p>This has been a huge project behind the scenes for the whole team, and we hope you like the changes. It&#8217;s very easy to keep adding new features when building software, but this is one of those occasions where we dedicated considerable time to simplifying, clarifying, and improving a core part of our offering. We look forward to your feedback!</p>
<p>Enjoy,</p>
<p>James Gill, Geoff Wagstaff, James Taylor<br />
A.K.A. The GoSquared Team</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gosquared.com/liquidicity/archives/1647/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speedy Sign In</title>
		<link>http://www.gosquared.com/liquidicity/archives/1630</link>
		<comments>http://www.gosquared.com/liquidicity/archives/1630#comments</comments>
		<pubDate>Fri, 19 Nov 2010 15:24:25 +0000</pubDate>
		<dc:creator>James Gill</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[liquidicity]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[GoSquared]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[LiveStats]]></category>
		<category><![CDATA[Login]]></category>
		<category><![CDATA[Member]]></category>
		<category><![CDATA[Resolution]]></category>
		<category><![CDATA[Responsive]]></category>
		<category><![CDATA[Screen]]></category>
		<category><![CDATA[Sign In]]></category>
		<category><![CDATA[Size]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[User]]></category>
		<category><![CDATA[UX]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.gosquared.com/liquidicity/?p=1630</guid>
		<description><![CDATA[A few days ago we released our new sign in screen. If you&#8217;re already a member of GoSquared you&#8217;ll probably have noticed it&#8217;s a whole lot better than what it replaces. Try it on iPhone There&#8217;s a few handy little things you may not have noticed, though. For example, if you&#8217;re on a desktop computer, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.gosquared.com/signin"><img src="http://static.gosquared.com/images/liquidicity/10_11_19_signin_790x400.jpg" alt="GoSquared Sign In - Works great on iPhone, iPad, and Desktop" title="GoSquared Sign In - Works great on iPhone, iPad, and Desktop" width="790" height="400" /></a></p>
<p>A few days ago we released our new <a href="http://www.gosquared.com/signin/">sign in screen</a>. If you&#8217;re already a member of <a href="https://www.gosquared.com/plans/">GoSquared</a> you&#8217;ll probably have noticed it&#8217;s a whole lot better than what it replaces.</p>
<h3>Try it on iPhone</h3>
<p>There&#8217;s a few handy little things you may not have noticed, though. For example, if you&#8217;re on a desktop computer, or anything with a fairly large screen size, you&#8217;ll see the default sign in screen &#8211; with icons for each of our <a href="http://www.gosquared.com/livestats/">main</a> <a href="http://www.gosquared.com/trends/">apps</a>, some handy links at the bottom of the screen, and of course the all important email and password fields. However, if you load the same page on your iPhone or any other small screen mobile device running a modern browser, you&#8217;ll get a specifically designed screen that cuts out everything you don&#8217;t need to see on a mobile device. That&#8217;s not all &#8211; we&#8217;ve gone an extra step and implemented an optimised design for when your mobile device in in landscape or portrait. We hope this will make it easier for people to keep up to date with the status of their site while on the go.</p>
<h3>Responsive Web Design</h3>
<p>For those web designers among you, we optimised for these different screen sizes by utilising some of the modern technologies available in CSS3. This is an increasingly popular method called &#8220;responsive&#8221; web design &#8211; pages adapt to suit the device they&#8217;re being shown on. There&#8217;s a great <a href="http://www.alistapart.com/articles/responsive-web-design/">article about responsive web design on A List Apart</a>.</p>
<p><span id="more-1630"></span></p>
<p><a href="http://www.gosquared.com/signin/" title="Go to the GoSquared Sign In Screen now"><img src="http://static.gosquared.com/images/liquidicity/GoSquared%20-%20Sign%20In.png" alt="GoSquared Sign In Screen - Responsive Web Design" width="790"/></a></p>
<h3>Form + Function</h3>
<p>Another little feature you may not have noticed &#8211; the app icons (for LiveStats, Trends and Settings) you see when using the <a href="http://www.gosquared.com/signin/">sign in screen</a> on the desktop are not just for looks. Simply click any of them while entering your email and password and you&#8217;ll be taken straight to the chosen app. It&#8217;s only a small thing but we hope it&#8217;ll save a second or two of your valuable time that could be spent watching your site&#8217;s traffic.</p>
<p>If you have any feedback, please drop us a line in the comments, get in touch on <a href="http://twitter.com/GoSquared">Twitter</a>, or give your feedback on <a href="http://getsatisfaction.com/gosquared">Get Satisfaction</a>.</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gosquared.com/liquidicity/archives/1630/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
