<?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>confusion &#187; technical</title>
	<atom:link href="http://confusion.cc/categories/technical/feed/" rel="self" type="application/rss+xml" />
	<link>http://confusion.cc</link>
	<description>&#34;I contradict myself? Very well then I contradict myself. I am large, I contain multitudes.&#34; -- Uncle Walt</description>
	<lastBuildDate>Sun, 05 Feb 2012 16:09:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>A silver lining</title>
		<link>http://confusion.cc/2011/07/28/a-silver-lining/</link>
		<comments>http://confusion.cc/2011/07/28/a-silver-lining/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 16:00:42 +0000</pubDate>
		<dc:creator>beggs</dc:creator>
				<category><![CDATA[ranting]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://confusion.cc/?p=1998</guid>
		<description><![CDATA[Building on our previous rant on data caps killing The Cloud [confusion.cc]; I do think there is an opportunity for service providers in The Cloud, but it&#8217;s not really about them offering anything new or exciting in terms of technology. It&#8217;s about utility. The thing that the service providers have that over-the-top (OTT) players, like [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Building on our previous rant on <a class="internal" href="http://confusion.cc/2011/04/12/the-cloud-is-useless/">data caps killing The Cloud</a> [confusion.cc]; I do think there is an opportunity for service providers in The Cloud, but it&#8217;s not really about them offering anything new or exciting in terms of technology.  It&#8217;s about utility.  The thing that the service providers have that over-the-top (OTT) players, like Apple, Google and Microsoft, don&#8217;t have is how close they are to the consumer.  For my data to get to Apple or Google or Microsoft it has to traverse the service providers network and then some backbone providers network before ending up in some Microsoft, Google or Apple data center half way around the world.  On the other hand The Cloud operated by my service provider is just down the road (in internet terms).  This is where the opportunity lies.</p>
<p>If I was a service provider I&#8217;d put together a cloud service that was designed around using that advantage.  Rather than trying to be the be-all-end-all provider of the content itself &mdash; a nasty low margin business (which has <a class="internal" href="http://confusion.cc/2009/12/01/subliminal-messages/">sidetracked me before</a> [confusion.cc] &mdash; I&#8217;d be the best cloud for the consumers.  Since I&#8217;m close and own the network, transmission quality is within my control for streaming media.  So I&#8217;d sell the customer a cloud service that allowed unlimited upload, download and streaming of any data they want; I don&#8217;t care where it came from.  My cloud cost you a flat rate and you can do what you want with that data over my network.  At the same time there is still a cap on your out-of-network data traffic, so using someone else&#8217;s cloud could cost you, and if you want to stream a lot of data it could cost you a lot.  One more thing that is needed to make this work, at least for me, is a guarantee that I can take my media back out as easily as I can put it in, so there is not data lock-in only the typical commercial lock-in of a contract.</p>
<p>This is the cloud service I want &#8211; open (in terms of where I buy the content does not matter; unlimited upload/download and streaming, high speed and good quality.  I would pay for that.</p>
<div class="shr-publisher-1998"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://confusion.cc/2011/07/28/a-silver-lining/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Social Graphing for fun and profit</title>
		<link>http://confusion.cc/2011/04/23/social-graphing-for-fun-and-profit/</link>
		<comments>http://confusion.cc/2011/04/23/social-graphing-for-fun-and-profit/#comments</comments>
		<pubDate>Sat, 23 Apr 2011 16:53:46 +0000</pubDate>
		<dc:creator>beggs</dc:creator>
				<category><![CDATA[ranting]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://confusion.cc/?p=1949</guid>
		<description><![CDATA[The whole &#8216;iSpy&#8217; issue (iPhone&#8217;s logging your location &#8212; see here [confusion.cc]) reminded me about the data. What good is the data? According to Gizmodo; Security expert, Kevin Mitnick says he&#8217;s &#8220;Quite shocked and disturbed&#8221; by the revelation, noting that the logged data could be of great interest to a variety of entities—prying spouses, private [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>The whole &#8216;iSpy&#8217; issue (iPhone&#8217;s logging your location &mdash; <a class="internal" href="http://confusion.cc/2011/04/23/the-stalker-in-your-pocket-part-two/">see here</a> [confusion.cc]) reminded me about the data.  What good is the data?</p>
<p>According to Gizmodo;</p>
<blockquote><p>Security expert, Kevin Mitnick says he&#8217;s &#8220;Quite shocked and disturbed&#8221; by the revelation, noting that the logged data could be of great interest to a variety of entities—prying spouses, private investigators, and, he reckons, the government. He speculates that the existence of the log itself &#8220;could have been at the request of the government,&#8221; as such data &#8220;can&#8217;t be used for advertisements. It seems to me more to be a governmental request.&#8221;</p></blockquote>
<p><cite><a class="external" href="http://gizmodo.com/#!5793925/your-iphone-is-secretly-tracking-everywhere-youve-been">Gizmodo</a> [gizmodo.com]</cite></p>
<p>The story has defused somewhat since a few <a class="external" href="http://gizmodo.com/5794457/why-your-iphone-is-secretly-tracking-you-a-very-probable-explanation">people have suggested that the logging of location data is a bug</a> [gizmodo.com].</p>
<p>But&#8230; let&#8217;s say it&#8217;s not a bug.  Lets say it&#8217;s invitational.  Let&#8217;s go further and say that there are similar files showing who you called and who you messaged.  All of this can be correlated with the timestamps so we can see who you called, when you called them and where you were.  Now Apple has the same data that your phone service provider has about you (well, they have billing address too if you&#8217;re not pre-paid.  The again Apple most likely has a credit card on file for iTunes or the App Store so they know where you live too&#8230;)</p>
<p>Why would someone want all this data?  I said it was most likely for advertising before.  But Mitnick says that can&#8217;t be what it&#8217;s for.  I disagree.  First of all because location is one of the basic data points for traditional ad selling; Age, Sex and Location or ASL is the triumvirate of advertising.  It&#8217;s the minimum info you need to attract advertisers.  So if Apple could get your Age and Sex &mdash; maybe from your credit card data &mdash; and combine that with your location (I know that your credit card gives them an address but they can make a more detailed determination of where you actually frequent from the log data than just your home address. For example; if you live in Brooklyn but are actually in Manhattan from 8AM to 8PM every day then maybe your a better target for Starbucks in Manhattan than Einstein Brothers Bagels in Brighten Beach.)</p>
<p>The second and more compelling reason I think the data could be good for advertising is related to Social Graphs.  A Social Graph is basically a digital representation of you, the people you know, the people they know and so on.  Facebook, and all social networks are Social Graphs.  And the reason Facebook launched Places is because it can add location to the graph.  And every additional data point added to the graph allows it to profile users better and sell more targeted advertisements.  The better the targeting the more it can charge for ads.</p>
<p>Facebook&#8217;s Social Graph is founded on the friends that each user has.  Then Facebook adds additional layers of data on top of this; everything your &#8216;Like&#8217;, every place you check in to, etc. etc.  All of this is used to provide a richer set of profiling data to improve the targeting of ads.  But all of it is based on who you <em>say</em> your &#8216;friends&#8217; are.  This is the <strong>Explicit</strong> Social Graph.</p>
<p>There is another type of Social Graph however, the <strong>Implicit</strong> Social Graph.  This would be a Graph built up not by who you <em>say</em> your &#8216;friends&#8217; are but by who you actually interact with.  This Graph would be developed not by asking you but by observing you, and while hiring a PI to follow everyone around would be expensive there are more passive ways of getting this data.  Your phone service provider knows who you call and message and who calls and messages you, as well as were you where any time your phone is turned on.  This data could be used to create an Implicit Social Graph showing who you actually interact with in the real work better than who you &#8216;friend&#8217; online.  This Implicit Social Graph could be augmented by other data in the same way that Facebook augments their Social Graph and for the same purpose, better profiling; better advertising.</p>
<p>So maybe Apple is not using the location data and it&#8217;s all just a bug.  But I think they will want it if they can get it, and they want those call logs and messaging logs.  Once they build their Implicit Social Graph for you they will augment it with purchase data from iTunes and maybe Safari Browser history and <em>any other data point they can get</em> no matter who trivial it seems.  All to sell more ads.</p>
<p>One final note; To get this data Apple would have to jump through some hoops; collecting it on the handset and sending it back to them from time to time.  And I don&#8217;t doubt that they or some one else will do it at some point.  Your phone service provider has the data already, it&#8217;s a byproduct of providing your mobile phone service.  They don&#8217;t seem to be doing anything with it.  I&#8217;ve seen several project discussed over the past few years about how to use it, how to create these Explicit Social Graphs and sell advertising, but I am not aware of any that have come to fruition yet.  I think it&#8217;s only a matter of time till someone like Apple beats the phone companies to the prize.  As usual the culture of phone companies will get in the way and they will let another revenue stream slip past them because they just can&#8217;t do it.  They&#8217;re too risk averse, to cheap and to old-fashion.  Silicon Valley is going to have their lunch and the ISPization of the phone companies will be one step closer.</p>
<div class="shr-publisher-1949"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://confusion.cc/2011/04/23/social-graphing-for-fun-and-profit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The stalker in your pocket part two</title>
		<link>http://confusion.cc/2011/04/23/the-stalker-in-your-pocket-part-two/</link>
		<comments>http://confusion.cc/2011/04/23/the-stalker-in-your-pocket-part-two/#comments</comments>
		<pubDate>Sat, 23 Apr 2011 15:52:37 +0000</pubDate>
		<dc:creator>beggs</dc:creator>
				<category><![CDATA[ranting]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://confusion.cc/?p=1941</guid>
		<description><![CDATA[What&#8217;s the difference between the image on the left and the image on the right? The image on the left is the recently posted map [gizmodo.com] of the data that is being stored in your iPhone (and your computer where that your iPhone syncs to). That data amounts to all the locations you have taken [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="http://confusion.cc/wp/wp-content/uploads/2011/04/stalkme.png"><img src="http://confusion.cc/wp/wp-content/uploads/2011/04/stalkme.png" alt="Stalker in our pockets" title="Stalker in our pockets" width="690" class="centered" /></a></p>
<p>What&#8217;s the difference between the image on the left and the image on the right?</p>
<p>The image on the left is the <a class="external" href="http://gizmodo.com/5793925/your-iphone-is-secretly-tracking-everywhere-youve-been">recently posted map</a> [gizmodo.com] of the data that is being stored in your iPhone (and your computer where that your iPhone syncs to).  That data amounts to all the locations you have taken your phone since you upgraded it to iOS 4.</p>
<p>The image on the right is basically the same type of data &mdash; though it&#8217;s presented as an animation so you only see one spot in the image above.  That data is from the your phone company &mdash; and it does not matter what phone you have, just having a phone on the network is enough for the operator to collect the data, and in many places they are required by law to keep this data for some period of time.  (The map on the right also shows all the calls and messages to and from the phone; in this case stripped of the details but be assured the raw data that your phone company has does show who you are calling, I wonder if Apple is creating a log of this data on your iPhone too?  I bet they are.)  <a class="internal" href="http://confusion.cc/2011/03/31/the-stalker-in-your-pocket/">I ranted about this map a while back</a> [confusion.cc].</p>
<p>There seems to be a lot of concern about the fact that your iPhone is logging this type of data.  The FCC want&#8217;s to know why.  Congress wants to know why. (<a class="external" href="http://www.politico.com/news/stories/0411/53500.html">See here</a> [politico.com]).  But there does not seem to be anywhere near as much concern about the fact the your phone company has the same data, more detailed data in fact.  There should be.  In fact, if privacy is your concern, or fear of Big Brother, you should be much more concerned about what your phone company knows than what Apple might know.</p>
<p>The big difference to me between the two is that the historical data that Apple is collecting is on the device and backed up to your computer.  While the data that is collected by your phone service provider is on their servers and therefore subject to Lawful Intercept.  According to Wikipedia Lawful Intercept is:</p>
<blockquote><p>obtaining communications network data pursuant to lawful authority for the purpose of analysis or evidence.</p></blockquote>
<p><cite><a class="external" href="http://en.wikipedia.org/wiki/Lawful_interception">Wikipedia</a> [wikipedia.org]</cite></p>
<p>That means that all that data; including locations, calls made, calls received, messages sent and received, as well as who those calls and messages where to or from, is available to law enforcement if needed.  This is generally a good thing; if it helps to catch murders or sexual predators or other criminal types.  It&#8217;s not hard to image it being used for less savory purposes like tracking dissidents or in more authoritarian places tracking political opponents or protesters.  This is the kind of data that warrant-less wire tapping was collecting, and it&#8217;s done by just making a request to your phone service provider &#8212; if the provider or the government is good enough they could collect this data in real time.  Meaning we are all carrying around Big Brother approved &#8220;bugs&#8221; in our pockets.</p>
<p>It&#8217;s also worth noting that the data collected by your phone company is required for it to provide the service you are paying for.  There has been speculation about what Apple wants this data for; I imagine it will come down to advertising or something, some way to make more money off of iPhone owners; in the end Apple is a company interested in making money.  In this case consumers will quickly forget the issue while privacy advocates piss into the wind about for much longer.</p>
<div class="shr-publisher-1941"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://confusion.cc/2011/04/23/the-stalker-in-your-pocket-part-two/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The cloud is useless</title>
		<link>http://confusion.cc/2011/04/12/the-cloud-is-useless/</link>
		<comments>http://confusion.cc/2011/04/12/the-cloud-is-useless/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 02:58:24 +0000</pubDate>
		<dc:creator>beggs</dc:creator>
				<category><![CDATA[ranting]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://confusion.cc/?p=1938</guid>
		<description><![CDATA[What good is the cloud? I don&#8217;t get it. this article on PC Mag [pcmag.com] talks about how all the new cloud services will change our concept of content ownership but I think it&#8217;s bullshit. I don&#8217;t disagree with anything in the article but I think it&#8217;s all a dream, a crack dream, until one [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>What good is the cloud?   I don&#8217;t get it.  <a class="external" href="http://www.pcmag.com/article2/0,2817,2383373,00.asp">this article on PC Mag</a> [pcmag.com] talks about how all the new cloud services will change our concept of content ownership but I think it&#8217;s bullshit.  I don&#8217;t disagree with anything in the article but I think it&#8217;s all a dream, a crack dream, until one issue is solved.  One issue which is outside the scope of the cloud service providers: bandwidth!</p>
<p>At the same time as we are seeing all these new cloud services providing us storage and access to our purchased content 24/7 streaming to any device, anywhere, any time, we are also seeing the death of unlimited bandwidth.  Even for home access.  How am I supposed to stream my content all over the place if I don&#8217;t have any bandwidth?</p>
<p>Take this scenario from the PC Mag article:</p>
<blockquote><p>
The parent whose child wants to watch &#8220;Dora the Explorer: Big Sister Dora&#8221; over and over and over again doesn&#8217;t have to own the DVD or even the digital file. Cloud-based ownership and access means that their child can see Dora play big sister at home, on the iPad, in the car, and on mommy&#8217;s smartphone. They own the movie or, more likely, have an all-you-can eat subscription service, so <strong>each viewing costs nothing except the price of Internet access</strong>.
</p></blockquote>
<p>The emphasis is mine, because it&#8217;s the part that kills the whole scenario.</p>
<p>I might be a strange consumer by today&#8217;s measure &mdash; I&#8217;ve digitized all my content.  I&#8217;ve got more then 1200 CDs that I digitized before I started buying digital music; 200+ DVDs that I have digitized and 7 years worth of digital photos and video that alone amount to more then 12 gigs worth of keepers.  All in all I have more than a terabyte of digital content.  All happily sitting on my 8TB NAS server mirrored and stripped high up on the shelf in the back room.</p>
<p>To get streaming access to all this content today I can jump through a bunch of hoops and make it work.  But&#8230; I would max out my mobile data plan every month &mdash; 12GB &mdash; due to my daughter streaming Dora, and Toy Story 3 and Kai-Lan and whatever new, or old, show it was this week (actually currently it&#8217;s My Neighbor Totoro), to the iPad while we are driving or shopping or wherever.  So for now she is restricted to the content that is actually on the device, and I fill up the devices quickly.  I can&#8217;t even put all the Pixar movies on the iPad and have the family photos on there, 64GB is just not enough.</p>
<p>While I may be the exception today this will be normal one day when every piece of content we ever buy is stored on the cloud, ready for on-demand download or streaming to any device over any network.  But until the bandwidth issue is solved it will be any network accept the mobile one and only till the service provider throttles me or cuts me off for exceeding my bandwidth cap for the month.  Bottom line; the scenario from the PC Mag article is pointless without unlimited bandwidth.  Memory is cheap &mdash; bandwidth is the new memory.</p>
<div class="shr-publisher-1938"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://confusion.cc/2011/04/12/the-cloud-is-useless/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why cloud backup for your mobile will not be provided by your operator</title>
		<link>http://confusion.cc/2011/03/31/why-cloud-backup-for-your-mobile-will-not-be-provided-by-your-operator/</link>
		<comments>http://confusion.cc/2011/03/31/why-cloud-backup-for-your-mobile-will-not-be-provided-by-your-operator/#comments</comments>
		<pubDate>Thu, 31 Mar 2011 06:43:26 +0000</pubDate>
		<dc:creator>beggs</dc:creator>
				<category><![CDATA[ranting]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://confusion.cc/?p=1924</guid>
		<description><![CDATA[This article [zdnet.com] and several others making the rounds in the past few days point to Microsoft re-branding the cloud backup service it included with its’ short lived Kin line of mobiles. The cloud backup – Kin Studio – was the coolest feature of the Kin phones, maybe not the most sexy but the most [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a class="external" href="http://www.zdnet.com/blog/microsoft/windows-phone-mobile-studio-a-reincarnated-and-de-hipsterized-kin-studio/9048">This article</a> [zdnet.com] and several others making the rounds in the past few days point to Microsoft re-branding the cloud backup service it included with its’ short lived Kin line of mobiles.   The cloud backup – Kin Studio – was the coolest feature of the Kin phones, maybe not the most sexy but the most useful.  Now it looks like Microsoft may add it to Windows Phone 7 handsets – if they combine it with the Windows Live service, providing 25GB of free cloud storage connected to the users Hotmail/Windows Live and Office Live accounts then they may have a compelling offer.</p>
<p>Of course Microsoft is not the only mover, Apple has long had its’ MobileMe service which has significant overlap.  To date this product has only attracted hardcore Apple fan-boys, but for over a year now there has been a rumor that Apple will drop the subscription fee  and include as a free service for all iOS devices (more recently there has been a rumor that Apple will drop the subscription fee to $20 a year, I think maybe it will be free for 1 year with your iOS device and then $20 a year unless you buy a new iOS device).  Link this to the rumored iTunes media cloud service that will run out of the billion dollar datacenter Apple has built in North Carolina.  Again this could be a very useful service providing automated backup and streaming of all media (movies, photos, music, contacts, messages) to the cloud.</p>
<p>Google wouldn’t have to move very far to offer the same sort of service with Android.</p>
<p>In my time in the telco industry I&#8217;ve seen several projects at mobile operators around the world try to provide this type of data backup service.  Unfortunately I&#8217;m not aware of any that actually succeeded.  They died for many reasons &#038;mdash customers not willing to pay for the service, limited features, crippled features, lack of marketing, lack of handset support&#8230; </p>
<p>All in all I think the data-backup-as-a-service boat has already set sail and the telcos will be left behind due to their own dithering on how to make money on the offering.  The same thing that happened to them with Location Based Services &#038;mdash they could not figure out how to make money on it so they never launched it, the phone makes opened the on-device location services (initially mandated for emergency number calling) to application developers and they figured out how to make money from it  well &#038;mdask more or less.  So the telcos are left with LBS systems that cost them money but generate no revenue and don&#8217;t provide any value even in generating &#8216;customer stickiness&#8217;.</p>
<p>C&#8217;est la vie.  Real consumer service innovation in the mobile market continues to move away from the telcos and towards the internet.  It&#8217;s one more step on the road to mobile dumb pipe networks.</p>
<div class="shr-publisher-1924"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://confusion.cc/2011/03/31/why-cloud-backup-for-your-mobile-will-not-be-provided-by-your-operator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No calls please</title>
		<link>http://confusion.cc/2010/08/11/no-calls-please/</link>
		<comments>http://confusion.cc/2010/08/11/no-calls-please/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 10:10:16 +0000</pubDate>
		<dc:creator>beggs</dc:creator>
				<category><![CDATA[quotes]]></category>
		<category><![CDATA[ranting]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://confusion.cc/?p=1365</guid>
		<description><![CDATA[We’re moving, in other words, toward a fascinating cultural transition: the death of the telephone call. This shift is particularly stark among the young. Some college students I know go days without talking into their smartphones at all. Clive Thompson, in The Death of the Phone Call [wired.com], from Wired August 2010 [wired.com]. Yep, that [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><blockquote><p>We’re moving, in other words, toward a fascinating cultural transition: the death of the telephone call. This shift is particularly stark among the young. Some college students I know go days without talking into their smartphones at all.</p></blockquote>
<p><cite>Clive Thompson, in <a class="external" href="http://www.wired.com/magazine/2010/07/st_thompson_deadphone/"><em>The Death of the Phone Call</em></a> [wired.com], from <a class="external" href="http://www.wired.com/magazine/18-08/">Wired August 2010</a> [wired.com].</p>
<p>Yep, that would be me.  I loath the phone, always have.  The only times I have ever gotten into calling someone is the infatuation stage of new relationships (which were few and far between for me, and think you very much I&#8217;m married now,) during which I fell asleep way to many times with the phone off the hook, thankfully this was mostly before cell phones or after I moved to a place which had unlimited calling plans, otherwise I&#8217;d still be paying off that debt along with the whole going to college debt.</p>
<p>But really, I average less than one call a day and regularly go three or four days without a call.  My iPhone&#8217;s call list currently looks like this:</p>
<dl>
<dt>C&#8212;&#8212; L&#8211;</dt>
<dd>14:10 (today)</dd>
<dt>J&#8212;- L&#8211;</dt>
<dd>Yesterday</dd>
<dt>S&#8212;&#8212;&#8211; P&#8212;-</dt>
<dd>Monday</dd>
<dt>C&#8212;&#8212; L&#8211;</dt>
<dd>Sunday</dd>
<dt>C&#8212;&#8212; L&#8211; (3)</dt>
<dd>Friday</dd>
<dt>C&#8212;&#8212; L&#8211;</dt>
<dd>Thursday</dd>
<dt>N&#8211; S&#8212;- (2)</dt>
<dd>4/8/10</dd>
<dt>C&#8212;&#8212; L&#8211;</dt>
<dd>4/8/10</dd>
<dt>N&#8211; S&#8212;- (1)</dt>
<dd>4/7/10</dd>
</dl>
<p>Looking at that you&#8217;d assume I have no friends.  And while I have few friends, few is greater than zero.  I usually communicate via SMS.  I count 8 people who I&#8217;ve messaged with in the past three days and close to 60 messages.</p>
<p>Message come naturally for several reasons: first; as mentioned I don&#8217;t like the phone, second; and most likely related &mdash; I&#8217;m a geek, and third; I was in college during the late `90&#8242;s and early `00&#8242;s in the US.</p>
<p>The dates are important because they coincide with a few monumental events:</p>
<ul>
<li>Free (useful) internet on college campuses</li>
<li>Everyone had a desktop in college (at least in the technical/science fields, laptops where just coming into their own)</li>
<li>ICQ and AOL IM clients were new and exciting</li>
<li>Only drug dealers and business people has cell/mobile phones in the US</li>
</ul>
<p>All this added up to a lot of people like me who had a computer in their dorm rooms, running ICQ or AOL all the time with an always on, free, internet connection.  It was like a personal secretary while you where in class or at ciao or there was a sock on the door handle and you could not get it &mdash; yea I was always on the outside looking at the sock&#8230; at least at my own dorm room :-)  You&#8217;d get back from class (and into your dorm) to find these little, often out-of-context or hours old, messages from all kinds of people and, importantly, you could choose to respond or not as you wished.</p>
<p>IM served as both a real-time communication mechanism and a message taking system.  You could safely ignore it if you were studying (or leeching off Napster or gaming or browsing Pr0n!) and these little love notes would be waiting to fill your emotional void or provide that elusive answer to the take home exam when you were ready for them.</p>
<p>Anyway, all of this experience with both real-time and asynchronous communication over IM in college proved a good training ground for SMS.  I moved to Europe in 2001 and landed smack dab in the middle of the SMS revolution.  And being a poor college student I was a pre-paid customer (such thing didn&#8217;t even exist in the US till long after I returned) so when I went to London I used very, very&#8230; very, little voice.  It cost as much to say hello on a voice call as it did to have an entire conversation on SMS!  I got so used to using text to communicate with people that when I got back to the US and joined a company working in SMS interoperability I was one of only two people in the company who had ever sent an SMS before starting there (the other guy was German so he head start at it.)</p>
<p>So, yea, I&#8217;m a thirty-something and I don&#8217;t talk on the phone. </cite></p>
<div class="shr-publisher-1365"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://confusion.cc/2010/08/11/no-calls-please/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Ad Serving</title>
		<link>http://confusion.cc/2010/02/22/mobile-ad-serving/</link>
		<comments>http://confusion.cc/2010/02/22/mobile-ad-serving/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 06:35:45 +0000</pubDate>
		<dc:creator>beggs</dc:creator>
				<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://confusion.cc/?p=1165</guid>
		<description><![CDATA[I&#8217;ve seen a lot of AdMob [admob.com] ads in iPhone applications over the past two years. But recently I downloaded two free &#8212; i.e. ad supported &#8212; applications that appear to use a Google ad server (of course Google purchased AdMob but I don&#8217;t think it&#8217;s just a re-branding I think it&#8217;s a different service.) [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I&#8217;ve seen a lot of <a class="external" href="http://admob.com">AdMob</a> [admob.com] ads in iPhone applications over the past two years.  But recently I downloaded two free &mdash; i.e. ad supported &mdash; applications that appear to use a Google ad server (of course Google purchased AdMob but I don&#8217;t think it&#8217;s just a re-branding I think it&#8217;s a different service.)</p>
<p>I noticed this for two reasons.  First; for the past few years I have been working in the mobile advertising space, so this stuff stands out.  Second; the ads were odd.</p>
<p>Why odd?  Well, as I mentioned these were ads in iPhone applications.  Keep that in mind and take a look at the ads:</p>
<p><img src="http://confusion.cc/wp/wp-content/uploads/2010/02/google_mobile_ads_4.png" alt="Google mobile ads banner for SingTel Mobile SME services" title="google_mobile_ads_4" width="320" height="75" class="centered size-full wp-image-1164" /><br />
<img src="http://confusion.cc/wp/wp-content/uploads/2010/02/google_mobile_ads_3.png" alt="Google mobile ads banner for Android" title="google_mobile_ads_3" width="320" height="75" class="centered size-full wp-image-1163" /><br />
<img src="http://confusion.cc/wp/wp-content/uploads/2010/02/google_mobile_ads_2.png" alt="Google mobile ads banner for Nokia 5530 Apps Store" title="google_mobile_ads_2" width="320" height="75" class="centered  size-full wp-image-1162" /><br />
<img src="http://confusion.cc/wp/wp-content/uploads/2010/02/google_mobile_ads_1.png" alt="Google mobile ads banner for Nokia E63 Apps Store" title="google_mobile_ads_1" width="320" height="75" class="centered size-full wp-image-1161" /></p>
<p>The issue, I think, with these ads is they are all for competitors.  I can excuse the SingTel ad, I&#8217;m a Starhub customer but this is an add for enterprise services and the ad was served while I was on a WiFi network, so there is not much chance that Google could have determined my operator.</p>
<p>However, the ad for Android and the two ads for the Ovi store &mdash; which sells applications that work on Nokia handsets are not useful to me as a consumer and most likely a waste of the advertisers money.  The odds that I am going to patronize either of these services from my iPhone is next to zero.</p>
<p>And there is little excuse for this.  When I was working on requirements for a mobile advertising system the product team was adamant that it include basic relevance filtering.  Now relevance filtering is complex and the simple business rule &#8220;the advertisement should be relevant and useful to the consumer&#8221; actually breaks down to a lot of technical requirements.  The technical requirements of significance here are:</p>
<div class="technical requirement">
<dl>
<dt>Requirement 1</dt>
<dd>
<p>The system shall attempt to retrieve the <code>User-Agent</code> header from the HTTP request.  The header should be used to reduce the pool of relevant banners by removing banners that:</p>
<ol>
<li>have a User-Agent whitelist that <em>does not</em> include the User-Agent retrieved from the HTTP request</li>
<li>have a User-Agent blacklist that <em>does</em> include the User-Agent retrieved from the HTTP request</li>
</ol>
</dd>
</dl>
<dl>
<dt>Requirement 2</dt>
<dd>They system shall allow buyers to construct a whitelist or a blacklist of User-Agent strings which for specific campaigns or banners in a campaign.</dd>
</dl>
<dl>
<dt>Requirement 3</dt>
<dd>User-Agent lists (white- or black-) should be constructed of strings entered by buyers by selecting full User-Agents or pre-coded regular expression from a list or entering an arbitrary regular expression.</dd>
</dl>
</div>
<p>(Obviously there are a lot more details and other requirements that need to be clarified before you can actually implement this.)  Here&#8217;s a use case that would prevent the issue of the Ovi banners being shown to me on my iPhone.</p>
<div class="technical use-case">
<dl>
<dt>Use Case:</dt>
<dd>Setting up a campaign level whitelist, to filter out non-Nokia handsets.</dd>
<dt>Pre-Condition:</dt>
<dd>The buyer has created a campaign</dd>
<dd>The buyer selects <em>Relevance Filtering</em> from the interface</dd>
<dt>Post-Condition:</dt>
<dd>A new filter is added to the campaign level whitelist for the selected campaign</dd>
<dt>Scenario:</dt>
<dd>
<ol>
<li>The Buyer selects <em>Create/Edit Whitelist</em> from the <em>Relevance Filtering</em> menu.</li>
<li>The System loads the <em>Relevance Whitelist</em> interface</li>
<li>The Buyer selects the <em>Filter Campaign</em> checkbox</li>
<li>The Buyer clicks on the <em>Add Filter</em> button</li>
<li>The Buyer selects the <em>Manual Filter</em> filtering method</li>
<li>The Buyer enters <code>*nokia*</code> in the <em>Manual Filter</em> textbox and clicks the <em>Case Insensitive</em> checkbox</li>
<li>The Buyer clicks on the <em>Test Filter</em> button</li>
<li>The System displays a list of all matching User-Agent Strings, highlighting the match(s)</li>
<li>The Buyer clicks on <em>Confirm Filter</em> button</li>
<li>The System adds the filter to the campaign level whitelist in the Database for the selected campaign</li>
</ol>
</dd>
</dl>
</div>
<p>So now the Buyer (in this case Nokia or an agent acting on Nokia&#8217;s behalf to setup the ad campaign) has created a campaign level whitelist (i.e. all banners in the campaign will be filtered by this whitelist) which includes a filter of <code>*nokia*</code> that is case insensitive.  This means that, based on the requirements enumerated above, that no ad request that includes a User-Agent string that does not includes the word <code>nokia</code> in it will be served any banner from this campaign.  The effect?  Ovi store ads will only be shown to users who are using Nokia handsets (or who&#8217;s requesting user agent does not include a User-Agent string or is using an incorrect User-Agent string that includes the word <code>nokia</code>.</p>
<p>Lets look at two use cases for requesting an ad.  One where the requesting handset is Nokia N95 and one where it is an iPhone 3GS.</p>
<div class="technical use-case">
<dl>
<dt>Use Case:</dt>
<dd>A Apple iPhone 3GS makes an Ad Request from an application running the Ad Server SDK.</dd>
<dt>Pre-Condition:</dt>
<dd>The application is using the provided Ad Server SDK</dd>
<dd>The application makes an ad request</dd>
<dt>Post-Condition:</dt>
<dd>A banner is served</dd>
<dt>Scenario:</dt>
<dd>
<ol>
<li>The application sends a well-formed HTTP GET Request to the Ad Request Handler URL including an Ad Request payload and the Device User-Agent Header (<code>Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.11 (KHTML, like Gecko) Version/3.1.1 Mobile/7A238j Safari/525.20</code>)</li>
<li>The Ad Request Handler Thread retrieves the Ad Request Payload and the HTTP User-Agent Header constructs an Ad Request, sets it&#8217;s state to <code>New</code> and pushes the Ad Request onto the Inbound Ad Request Queue</li>
<li>The Ad Request Handler Thread registers with the Ad Dispatcher to wait for it&#8217;s Ad.</li>
<li>The Ad Request Processing Thread pops the next Ad Request off of the Inbound Ad Request Queue</li>
<li>The Ad Request Processing Thread checks the Ad Request state</li>
<li>The Ad Request Processing Thread finds the Ad Request state is <code>New</code></li>
<li>The Ad Request Processing Thread pushes all ads in its Recycle Ad Queue onto the Active Ad Queue</li>
<li>The Ad Request Processing Thread sets the Ad Request state to <code>Unfulfilled</code></li>
<li>The Ad Request Processing Thread pops the first add off the Active Ad Queue</li>
<li>The Ad Request Processing Thread checks the selected ad for White- and Black- lists</li>
<li>The Ad Request Processing Thread finds an active Campaign Level User-Agent Whitelist</li>
<li>The Ad Request Processing Thread attempts to match each string in the Campaign Level User-Agent Whitelist against the Device User-Agent String in the Ad Request</li>
<li>The Ad Request Processing Thread finds no match for the string <code>*nokia*</code> (case insensitive) in the Device User-Agent String;<code>Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.11 (KHTML, like Gecko) Version/3.1.1 Mobile/7A238j Safari/525.20</code></li>
<li>The Ad Request Processing Thread rejects the ad for this request placing it on the Recycle Ad Queue</li>
<li>The Ad Request Processing Thread pushes the Ad Request back on the Inbound Ad Request Queue</li>
<li>The Ad Request Processing Thread monitors the Ad Request Queue</li>
<li>The Ad Request Processing Thread pops the next Ad Request off of the Inbound Ad Request Queue</li>
<li>The Ad Request Processing Thread checks the Ad Request state</li>
<li>The Ad Request Processing Thread finds the Ad Request state is <code>Unfulfilled</code></li>
<li>The Ad Request Processing Thread pops the first add off the Active Ad Queue</li>
<li>The Ad Request Processing Thread checks the selected ad for White- and Black- lists</li>
<li>The Ad Request Processing Thread finds no active White- or Black- lists for the ad</li>
<li>The Ad Request Processing Thread selects the Ad for this Ad Request attaches the Ad to the Ad Request and updates the Ad Request state to Pending</li>
<li>The Ad Request Processing Thread pushes the Ad Request onto the Outbound Ad Request Queue</li>
<li>The Ad Request Processing Thread pushes all ads in its Recycle Ad Queue onto the Active Ad Queue</li>
<li>The Ad Request Processing Thread Monitors the Ad Request Queue</li>
<li>The Ad Dispatcher pops the Ad Request off the Outbound Ad Request Queue</li>
<li>The Ad Dispatcher reads the Ad Handler Thread Id from the Ad Request and passes the Ad Request to the corresponding Ad Handler Thread</li>
<li>The Ad Dispatcher Monitors the Outbound Ad Request Queue</li>
<li>The Ad Handler Thread parses the Ad Request and retrieves the ad</li>
<li>The Ad Handler Thread constructs an HTTP Response with the Ad Response Payload including the Ad</li>
<li>The Ad Handle Thread sends the HTTP Response to the requesting application</li>
</ol>
</dd>
</dl>
</div>
<p>A few explanations/notes:</p>
<p>The looping nature of the Ad Request Processing Thread makes it hard to write an efficient and clear Use Case but I&#8217;m not getting paid to do this (any more) so I&#8217;m not going to spend the time to do the work to make it clearer.</p>
<p>This use case leaves out details of filters other than the Whilelist filter, such as Logged In/Logged Out Ad Queue selection, Ad Unit size, etc. for simplicity.</p>
<p>There would be multiple Ad Request Processors/Threads running, so when the first thread that retrieved the Ad Request and found the request was in the <code>New</code> state it pushed all the ads in it&#8217;s internal Recycle Ad Queue back onto the Active Ad Queue because those banners still need to be served and may be suitable for this Ad Request.  The second time the Ad Request Processing Thread finds the Ad Request in the <code>Unfulfilled</code> state it does not empty it&#8217;s Recycle Ad Queue to avoid endlessly looping over the same unsuitable ad.   (Writing this I think I need to think more about this &#8212; there could be a condition where a thread only ever sees Ad Requests in the <code>Unfulfilled</code> state and would therefore never empty its Recycle Ad Queue&#8230;)</p>
<p>I&#8217;ve included a lot of stuff that would actually go to other use cases and just be referenced as <em>Include X Use Case</em>, again I hope this makes it clearer (at least to the techies) what is happening.</p>
<p>Anyway&#8230;  Here is what would happen when an Nokia N95 made a request:</p>
<div class="technical use-case">
<dl>
<dt>Use Case:</dt>
<dd>A Nokia N95 makes an Ad Request from an application running the Ad Server SDK.</dd>
<dt>Pre-Condition:</dt>
<dd>The application is using the provided Ad Server SDK</dd>
<dd>The application makes an ad request</dd>
<dt>Post-Condition:</dt>
<dd>A banner is served</dd>
<dt>Scenario:</dt>
<dd>
<ol>
<li>The application sends a well-formed HTTP GET Request to the Ad Request Handler URL including an Ad Request payload and the Device User-Agent Header (<code>Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95/10.0.018; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413</code>)</li>
<li>The Ad Request Handler Thread retrieves the Ad Request Payload and the HTTP User-Agent Header constructs an Ad Request, sets it&#8217;s state to <code>New</code> and pushes the Ad Request onto the Inbound Ad Request Queue</li>
<li>The Ad Request Handler Thread registers with the Ad Dispatcher to wait for it&#8217;s Ad.</li>
<li>The Ad Request Processing Thread pops the next Ad Request off of the Inbound Ad Request Queue</li>
<li>The Ad Request Processing Thread checks the Ad Request state</li>
<li>The Ad Request Processing Thread finds the Ad Request state is <code>New</code></li>
<li>The Ad Request Processing Thread pushes all ads in its Recycle Ad Queue onto the Active Ad Queue</li>
<li>The Ad Request Processing Thread sets the Ad Request state to <code>Unfulfilled</code></li>
<li>The Ad Request Processing Thread pops the first add off the Active Ad Queue</li>
<li>The Ad Request Processing Thread checks the selected ad for White- and Black- lists</li>
<li>The Ad Request Processing Thread finds an active Campaign Level User-Agent Whitelist</li>
<li>The Ad Request Processing Thread attempts to match each string in the Campaign Level User-Agent Whitelist against the Device User-Agent String in the Ad Request</li>
<li>The Ad Request Processing Thread finds a match for the string <code>*nokia*</code> (case insensitive) in the Device User-Agent String;<code>Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 <strong><span style="color:#f00;">Nokia</span></strong>N95/10.0.018; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413</code></li>
<li>The Ad Request Processing Thread selects the Ad for this Ad Request attaches the Ad to the Ad Request and updates the Ad Request state to <code>Pending</code></li>
<li>The Ad Request Processing Thread pushes the Ad Request onto the Outbound Ad Request Queue</li>
<li>The Ad Request Processing Thread pushes all ads in its Recycle Ad Queue onto the Active Ad Queue</li>
<li>The Ad Request Processing Thread Monitors the Inbound Ad Request Queue</li>
<li>The Ad Dispatcher pops the Ad Request off the Outbound Ad Request Queue</li>
<li>The Ad Dispatcher reads the Ad Handler Thread Id from the Ad Request and passes the Ad Request to the corresponding Ad Handler Thread</li>
<li>The Ad Dispatcher Monitors the Outbound Ad Request Queue</li>
<li>The Ad Handler Thread parses the Ad Request and retrieves the ad</li>
<li>The Ad Handler Thread constructs an HTTP Response with the Ad Response Payload including the Ad</li>
<li>The Ad Handle Thread sends the HTTP Response to the requesting application</li>
</ol>
</dd>
</dl>
</div>
<p>This type of White- and Black- list filtering would prevent me from seeing ads for the Ovi store on my iPhone (assuming the people provisioning the ads or campaigns used, and used correctly, the filtering options mentioned above &mdash; but that&#8217;s a business problem not a technical one.)</p>
<p>The ad serving space is complicated but have been surprised to see a number of examples like this on my phone over the past few days.  In fact most of the ads I receive in the applications that use the Google system over the AdMob system seem to fall into this category.  I have notices a lack of relevant ads in general for Singapore in the Google Web system.  On some sites I see very relevant ads; global companies doing brand building or selling online.  But on a lot of sites, and I mean <em>a lot</em> I see the same ads for the same service &#8212; a Singapore specific company so at least the location filtering is working.  Or I see public service ads (invariably for <a class="external" href="http://kiva.org">Kiva</a> [kiva.org].)  So either there are not enough relevant ads for Singapore or these local guys are spending a lot of money to spam everyone. </p>
<p>The people at Google are a lot smarter than me, so I wonder if there is something I am missing in all this?  Were my product people wrong?  Are the users who are creating the campaigns not using some feature of the Google system that would filter these ads from me?  Am I completely nuts?  Do I have too much time on my hands?</p>
<div class="shr-publisher-1165"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://confusion.cc/2010/02/22/mobile-ad-serving/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Concerning Color Algorithms</title>
		<link>http://confusion.cc/2009/07/30/concerning-color-algorithms/</link>
		<comments>http://confusion.cc/2009/07/30/concerning-color-algorithms/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 04:43:07 +0000</pubDate>
		<dc:creator>beggs</dc:creator>
				<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://confusion.cc/?p=887</guid>
		<description><![CDATA[Long ago I worked on an interface for a reporting system that displayed transaction volume data as a large table; days on one axis and hours on the other.  To improve the readability of this densely packed data we wrote a coloring algorithm to change the background color of the table cell.  The algorithm colored [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Long ago I worked on an interface for a reporting system that displayed transaction volume data as a large table; days on one axis and hours on the other.  To improve the readability of this densely packed data we wrote a coloring algorithm to change the background color of the table cell.  The algorithm colored each cell in relation to every other cell using the minimum and maximum values of the displayed data.  The effect was quite good.  Users could instantly see patterns in the data without having to read the actual number in the cells.  This data display, though simple was one of the main selling points of the system.  End-users like the sexy packaging, the unseen technology that actually makes the system a wonder is only of interest to the developers &#8212; unless of course it does not work.</p>
<p>I spent a lot of time improving the UI of the system as a project once, and when my CTO asked me what I was going one day I said &#8220;optimizing the color algorithm&#8221; &#8212; that was a mistake.  I didn&#8217;t sleep for the next 6 months as I was assigned the new, high priority, has-to-be-done-now project.  For a new technology, that I had no idea how it worked.  It was fun, but that&#8217;s a story for another day.  The reason I raise this here is that I never finished the intended work on the color algorithm.  One of the major goals that I never got to was to fix the color range.  The algorithm as implemented ended up with colors that transitioned from purple to yellow.  I wanted to improve the algorithm to output colors that transitioned from red through yellow to green.  Never got done.</p>
<p>Recently I was working on a project that required some visual UI work.  One of the elements was a bar chart that displayed volume over time.  So I used the same-old, same-old color algorithm (in PHP):</p>
<pre class="brush: php; title: ; notranslate">
/*
* getColor()
* $max := the highest value in the set to be colored.
* $min := the lowest value in the set to be colored.
* $c := the current item's value.
*
* Returns a string; the HEX representation of an RGB color.
*/
function getColor( $max, $min, $c) {
$j=0;
$r=0;
$g=0;
$b=0;

$j = $max != $min ? ( $c - $min ) * 20 / ( $max - $min) : 0;
$j = $j &amp;gt; 20 ? 20 : $j;

$r = 5 + $j;
$r = $r &amp;gt; 15 ? 15 : $r;

$g = 5 + $j/2;
$g = $g &amp;gt; 15 ? 15 : $g;

$b = 10 - $j/2;
$b = $b &amp;lt; 0 ? 0 : $b;

return sprintf( &quot;%01x%01x%01x%01x%01x%01x&quot;, $r,$r,$g,0,$b,0 );
}
</pre>
<p>Simple right?  Well using that you end up with this:<br />
<img class="centered" src="http://img.confusion.cc/entries/old_color_alg_output.png" alt="Old getColor output" width="567" /></p>
<p>So I started scratching my itch to <em>fix</em> the colors.</p>
<p>My first thought was to just ask a question over at <a class="external" href="http://stackoverflow.com">StackOverflow</a> [stackoverflow.com].  As I was typing in my question the system suggested existing questions&#8230; and since it&#8217;s an SO faux pas to repeat questions I started looking at them.  It didn&#8217;t take long before I found two questions that seemed to be pointing me in the right direction:  1. <a class="external" href="http://stackoverflow.com/questions/340209/generate-colors-between-red-and-green-for-a-power-meter">Generate colors between red and green for a power meter</a> [stackoverflow.com] and 2. <a class="external" href="http://stackoverflow.com/questions/168838/color-scaling-function">Color scaling function</a> [stackoverflow.com].</p>
<p>Reading the answers to those questions it took about 30 minutes to do this:</p>
<pre class="brush: php; title: ; notranslate">
/*
* getColor()
*
* $max := the highest value in the set to be colored.
* $min := the lowest value in the set to be colored.
* $c := the current item's value.
*
* Returns a string; the RGB representation of a color (eg. &quot;rgb(255, 255, 255)&quot;).
*/
function getColor( $max, $min, $c) {
   $h = (.33 / ($max - $min)) * ($c - $min);
   $s = .8;
   $v = 1;

   $rgb = hsv2rgb($h, $s, $v);

   return(sprintf(&quot;rgb(%d,%d,%d)&quot;, $rgb['r'], $rgb['g'], $rgb['b']));
}

/*
* hsv2rgb()
*
* $h := the hue, normalized to 0-1.
* $s := the saturation, normalized to 0-1.
* $v := the value, normalized to 0-1.
*
* Returns an associative array containing the red ('r'), green ('g') and blue ('b') values in the range 0-255.
*/
function hsv2rgb ($h, $s, $v){
   $rgb = array();

   if($s == 0){
      $r = $g = $b = $v * 255;
   } else {
      $var_h = $h * 6;
      $var_i = floor( $var_h );
      $var_1 = $v * ( 1 - $s );
      $var_2 = $v * ( 1 - $s * ( $var_h - $var_i ) );
      $var_3 = $v * ( 1 - $s * (1 - ( $var_h - $var_i ) ) );

      if ($var_i == 0) { $var_r = $v ; $var_g = $var_3 ; $var_b = $var_1 ; }
      else if ($var_i == 1) { $var_r = $var_2 ; $var_g = $v ; $var_b = $var_1 ; }
      else if ($var_i == 2) { $var_r = $var_1 ; $var_g = $v ; $var_b = $var_3 ; }
      else if ($var_i == 3) { $var_r = $var_1 ; $var_g = $var_2 ; $var_b = $v ; }
      else if ($var_i == 4) { $var_r = $var_3 ; $var_g = $var_1 ; $var_b = $v ; }
      else { $var_r = $v ; $var_g = $var_1 ; $var_b = $var_2 ; }

      $r = $var_r * 255;
      $g = $var_g * 255;
      $b = $var_b * 255;
   }

   $rgb['r'] = $r;
   $rgb['g'] = $g;
   $rgb['b'] = $b;

   return $rgb;
}</pre>
<p><img class="centered" src="http://img.confusion.cc/entries/new_color_alg_output.png" alt="New getColor output" width="567"/></p>
<p>That&#8217;s great!  Now maybe I&#8217;ll play with the hue bounds, the saturation and the value, but it looks fairly good on my first try.</p>
<p>Moral of the story: this is what StackOverflow is for; getting an answer to a question without even asking it&#8230; Because you are not re-inventing the wheel, someone had your problem before, and maybe someone found the answer already.  SO, thanks to <a class="external" href="http://stackoverflow.com/users/6521/paul-dixon">Paul Dixon</a> [stackoverflow.com] (also <a class="external" href="http://blog.dixo.net/about/">here</a> [blog.dixo.net]) and <a class="external" href="http://stackoverflow.com/users/6899/">ΤΖΩΤΖΙΟΥ</a> [stackoverflow.com] for their answers!</p>
<div class="shr-publisher-887"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://confusion.cc/2009/07/30/concerning-color-algorithms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

