<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>fusi0n</title>
	
	<link>http://fusi0n.org</link>
	<description>pL's blog on tech/mobile</description>
	<lastBuildDate>Tue, 31 Jan 2012 10:29:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/fusi0nv2" /><feedburner:info uri="fusi0nv2" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Canadian Postal Codes Database</title>
		<link>http://feedproxy.google.com/~r/fusi0nv2/~3/mQam0YDmnos/canadian-postal-codes-database</link>
		<comments>http://fusi0n.org/coding/canadian-postal-codes-database#comments</comments>
		<pubDate>Tue, 31 Jan 2012 10:29:45 +0000</pubDate>
		<dc:creator>pluc</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://fusi0n.org/?p=2006</guid>
		<description><![CDATA[I needed some data on Canadian Postal Codes for a project I'm working on. In context, I will have an user's postal code, but no way to validate it or use it as an index to get more location data. I started looking for free lists of Canadian postal codes I could merge in my [...]]]></description>
			<content:encoded><![CDATA[<p>I needed some data on Canadian Postal Codes for a project I'm working on. In context, I will have an user's postal code, but no way to validate it or use it as an index to get more location data. I started looking for free lists of Canadian postal codes I could merge in my application to achieve what I wanted. The first place I looked was obviously Canada Post, but it seems they're still in the mindset that selling public data is okay and only offer to license validation data... for 5,500$ a year. Mind you, it <em>does</em> seem include every Canadian addresses, not only postal code/city association.</p>
<p>Next in line was PopularData.com who offers a free database of 765,345 postal codes and their geographic data (city, province, latitude, longitude). Such data seems to be something recurring in various projects, so I figured I'd post here once and for all to tell you (and make sure I remember) how to get that data and inject it into a MySQL database on a remote server. Here goes.<span id="more-2006"></span></p>
<p>Log into the server and fetch the data</p>
<pre class="brush: bash; title: ; notranslate">$ wget -qO- www.populardata.com/downloads/postal_codes.zip | funzip &gt; /tmp/postal_codes.csv | sed -i 1d /tmp/postal_codes.csv</pre>
<p>Create the MySQL database/table to inject the data in</p>
<pre class="brush: bash; title: ; notranslate">$ wget -qO  /tmp/postal_codes.sql  www.fusi0n.org/data/postal_codes.sql | mysql -u USER -p DATABASE /tmp/postal_codes.sql</pre>
<p>Then run the import:</p>
<pre class="brush: bash; title: ; notranslate">$ mysqlimport --fields-terminated-by=&quot;|&quot; --lines-terminated-by=&quot;\r\n&quot; --user=USER --password DATABASE /tmp/postal_codes.csv</pre>
<p>Voila. Records: 765345  Deleted: 0  Skipped: 0  Warnings: 5</pre>
<img src="http://feeds.feedburner.com/~r/fusi0nv2/~4/mQam0YDmnos" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fusi0n.org/coding/canadian-postal-codes-database/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fusi0n.org/coding/canadian-postal-codes-database</feedburner:origLink></item>
		<item>
		<title>#Newnewtwitter Keyboard Shortcuts</title>
		<link>http://feedproxy.google.com/~r/fusi0nv2/~3/LrBQrVQShII/newnewtwitter-keyboard-shortcuts</link>
		<comments>http://fusi0n.org/internets/newnewtwitter-keyboard-shortcuts#comments</comments>
		<pubDate>Sun, 15 Jan 2012 08:28:49 +0000</pubDate>
		<dc:creator>pluc</dc:creator>
				<category><![CDATA[From the Intenets]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://fusi0n.org/?p=2004</guid>
		<description><![CDATA[Twitter's new design, the second one since the mass adoption of the platform, lovingly called #newnewtwitter was just enabled on my account. You can get a nicer output than what's below by pressing '?' in #newnewtwitter. They're pretty useful keyboard shortcuts - if you, like me, find yourself using the Web version more often than [...]]]></description>
			<content:encoded><![CDATA[<p>Twitter's new design, the second one since the mass adoption of the platform, lovingly called #newnewtwitter was just enabled on my account. You can get a nicer output than what's below by pressing '?' in #newnewtwitter. They're pretty useful keyboard shortcuts - if you, like me, find yourself using the Web version more often than anything else.</p>
<table>
<thead>
<tr>
<th colspan="2">Actions</th>
<th colspan="2">Navigation</th>
<th colspan="2">Timelines</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>F</strong></td>
<td>Favorite</td>
<td><strong>?</strong></td>
<td>This menu</td>
<td><strong>G</strong> <strong>H</strong></td>
<td>Home</td>
</tr>
<tr>
<td><strong>R</strong></td>
<td>Reply</td>
<td><strong>J</strong></td>
<td>Next Tweet</td>
<td><strong>G</strong> <strong>C</strong></td>
<td>Connect</td>
</tr>
<tr>
<td><strong>T</strong></td>
<td>Retweet</td>
<td><strong>K</strong></td>
<td>Previous Tweet</td>
<td><strong>G</strong> <strong>A</strong></td>
<td>Activity</td>
</tr>
<tr>
<td><strong>M</strong></td>
<td>Direct message</td>
<td><strong>Space</strong></td>
<td>Page down</td>
<td><strong>G</strong> <strong>R</strong></td>
<td>Mentions</td>
</tr>
<tr>
<td><strong>N</strong></td>
<td>New Tweet</td>
<td><strong>/</strong></td>
<td>Search</td>
<td><strong>G</strong> <strong>D</strong></td>
<td>Discover</td>
</tr>
<tr>
<td><strong>Enter</strong></td>
<td>Open Tweet details</td>
<td><strong>.</strong></td>
<td>Load new Tweets</td>
<td><strong>G</strong> <strong>P</strong></td>
<td>Profile</td>
</tr>
<tr>
<td><strong>L</strong></td>
<td>Close all open Tweets</td>
<td><strong>G</strong> <strong>F</strong></td>
<td>Favorites</td>
<td><strong>G</strong> <strong>M</strong></td>
<td>Messages</td>
</tr>
<tr>
<td colspan="4"></td>
<td><strong>G</strong> <strong>U</strong></td>
<td>Go to user...</td>
</tr>
</tbody>
</table>
<img src="http://feeds.feedburner.com/~r/fusi0nv2/~4/LrBQrVQShII" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fusi0n.org/internets/newnewtwitter-keyboard-shortcuts/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fusi0n.org/internets/newnewtwitter-keyboard-shortcuts</feedburner:origLink></item>
		<item>
		<title>Fanboy Advices</title>
		<link>http://feedproxy.google.com/~r/fusi0nv2/~3/v2So-chC5pE/fanboy-advices</link>
		<comments>http://fusi0n.org/internets/fanboy-advices#comments</comments>
		<pubDate>Wed, 14 Dec 2011 17:06:03 +0000</pubDate>
		<dc:creator>pluc</dc:creator>
				<category><![CDATA[From the Intenets]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://fusi0n.org/?p=1999</guid>
		<description><![CDATA[I realize the impending irony of writing this post right after my small hommage to Steve Jobs.. but somebody on the Internet is wrong. You know how that goes. Jim Darlymple recently blogged about his definition of an 'Apple fanboy': Someone who is tired of technology being difficult and knows there is something better; someone [...]]]></description>
			<content:encoded><![CDATA[<p>I realize the impending irony of writing this post right after my small hommage to Steve Jobs.. but somebody on the Internet is wrong. You know how that goes. Jim Darlymple <a href="http://www.loopinsight.com/2011/12/12/definition-of-an-apple-fanboy-and-those-that-use-the-term/" target="_blank">recently blogged</a> about his definition of an 'Apple fanboy':</p>
<blockquote><p><em>Someone who is tired of technology being difficult and knows there is something better; someone that loves to get the job done instead of working on their machine; a person that isn’t afraid of breaking the status quo; someone that appreciates quality design and workmanship; a person that realizes cheapest isn’t always best. Apple fanboys are commonly confused with the sensible people of society.<br />
</em></p></blockquote>
<p>I don't care much about his argument for quality design and workmanship, his affirmation that cheapest isn't always best or his stab at societal common sense. What transpires from the rest of his 'definition' is what I don't want to see happen with the world. Telling people to get an Apple product if they think technology is too difficult is how we'll end up enslaved to the fruit-people. It's supremely important in this day and age not to let technology become overwhelming. Technology, in the state it's in, is meant to be understood and played with, not merely consumed. If you have no understanding of what you're using, well first you're going to be in a world of hurt, then you'll have to rely on somebody who actually understands to help your sorry ass out. Technology isn't kind to neophytes. For every Apple fanboy there is, there's a geek who knows better.<span id="more-1999"></span></p>
<h3>'there is something better'</h3>
<p>If you buy a Mac because the alternatives (namely <a title="Windows" href="http://windows.microsoft.com/en-US/windows/home" target="_blank">Windows</a> and <a title="Linux" href="http://en.wikipedia.org/wiki/Linux" target="_blank">Linux</a>) are too complicated for you, you have no clue what you're talking about and you should go back to studying technology for a bit. Windows is just as easy as Mac, but has numerous downsides due to its popularity so I won't delve into that. Linux? Well, Linux isn't for everyone. I'd still recommend to try (yes, you can <em>just try</em> Linux without installing it) an easily-accesible distro such as <a title="Ubuntu" href="http://ubuntu.com" target="_blank">Ubuntu</a> on your old machine before I suggest dishing out over a thousand dollars for a new machine.  Calling Apple products better than the alternatives because they're more automated is like calling automatic cars better than standard. If you want technology that will do it for you, come back in a decade or two. Right now, we're trying to understand it and see what we can do with it. Once we have that figured out, we'll let you fanboys know so you can line-up 3 days in advance.</p>
<h3>'love to get the job done instead of working on their machines'</h3>
<p>Jim forgets that everything from the keyboard he's typing on to the software he uses to post his rants were made by people who preferred to 'work on their machines'. The world needs hackers, people who refuse to settle for what they're given and want to do and learn more. Jim is saying to buy Apple instead, as it's a lot easier to get around while being completely oblivious to what's actually going on. What do you do when your beloved glowing Apple doesn't heed your command? What if you want to achieve something the engineers didn't expect or design? Settling for automation is the death of innovation and right now, that's the worst thing you could possibly do.</p>
<h3>'break the status quo'</h3>
<p>That's just silly. The only thing that's breaking the status quo when it comes to computer OSes is using Linux. Go in any conference/tech meetup and after you're done counting all the Macs and iPhones, tell me how many people you notice using Linux. The iPod came out 11 years ago. Ever since, Apple has been the status quo. Just look at the units sold, and the math is fairly simple.</p>
<p>Don't settle for a shiny gadget. Technology is beautiful and opens up a near-unlimited number of opportunities. Don't let fanboys scare you from embracing it, and don't let them advise you on what you buy. Evaluatuat the possibilities in front of you and make a choice for yourself. That's the first step to learning technology.</p>
<img src="http://feeds.feedburner.com/~r/fusi0nv2/~4/v2So-chC5pE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fusi0n.org/internets/fanboy-advices/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fusi0n.org/internets/fanboy-advices</feedburner:origLink></item>
		<item>
		<title>Here’s to the crazy ones</title>
		<link>http://feedproxy.google.com/~r/fusi0nv2/~3/o-QeN6vmZTQ/heres-to-the-crazy-ones</link>
		<comments>http://fusi0n.org/rants/heres-to-the-crazy-ones#comments</comments>
		<pubDate>Thu, 06 Oct 2011 12:04:51 +0000</pubDate>
		<dc:creator>pluc</dc:creator>
				<category><![CDATA[Rants]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://fusi0n.org/?p=1990</guid>
		<description><![CDATA[An Era ended yesterday as the mighty Steve Jobs, who recently stepped down as CEO of Apple, passed away at 56 years old after a long battle with cancer. It's sad. It's really fucking sad. For Mac, iPod, iPhone and iPad lovers it's sad. For compulsive audiophiles, digital historians and designers, it's sad. For the [...]]]></description>
			<content:encoded><![CDATA[<p>An Era ended yesterday as the mighty Steve Jobs, who recently stepped down as CEO of Apple, passed away at 56 years old after a long battle with cancer. It's sad. It's <em>really</em> fucking sad. For Mac, iPod, iPhone and iPad lovers it's sad. For compulsive audiophiles, digital historians and designers, it's sad. For the millions of people he and his disciples championed and inspired, the tech reporters and the business analysts, it's sad... But most of all, we've lost a a pioneer, a leader and an icon.<span id="more-1990"></span><br />
<img class="size-full wp-image-1995 alignright" title="apple-half-mast" src="http://fusi0n.org/wp-content/uploads/2011/10/apple-half-mast.png" alt="yeah... that's half masted by the way." width="161" height="327" /><br />
You cannot help to be humbled before Jobs' many accomplishments. While at Apple, he gave Microsoft its fiercest competition in personal computing for decades - the <em>only one</em> that <em>really</em> must've given Gates sleepless nights. He also stood behind a UNIX kernel that really must not have been much to look at back then and used it at the core of Apple's every computer and spent years  perfecting every little detail with such efficiency and attention that modern-day UNIX-based platforms <em>still</em> pale in comparison. He's largely responsible for my generation moving from <a href="http://fusi0n.org/wp-content/uploads/2011/10/discman_1175537c.jpg" rel="wp-prettyPhoto[g1990]">this dinosaur</a>  to <a href="https://www.apple.com/ipod/">these puppies</a>. In his forties, he completely and irrevocably transformed enormous markets, cultures, technology and paved the way for countless new innovations.</p>
<p>Back when people were still walking around with <a href="http://fusi0n.org/wp-content/uploads/2011/10/Treo_300.jpg" rel="wp-prettyPhoto[g1990]">Treos</a> and <a href="http://fusi0n.org/wp-content/uploads/2011/10/BlackBerry_7230.jpg" rel="wp-prettyPhoto[g1990]">BlackBerrys</a> that looked like they were fresh out of a <em>Tamagotchi</em> factory, Jobs and his pirates were taking every manufacturer to school with Apple's  iPhone line, leaving the rest of us dizzy over the mere implications of the technology. And he did it again with Apple's tablets, the iPads, a few years later, always opening the trail.</p>
<p>We have a lot to be grateful for from Steve Jobs. He was a truly brilliant man - the kind that surface two or three times in  <em>your</em> lifetime. A ferocious and determined businessman - a true a visionary who shepherded society itself into a <em>concrete</em> bigger and better future <em>for everyone</em>. Steve's legacy most certainly lives on, with over 100 million iPhones, 300 million iPods, nearly 10 million iPads and 10 million Mac computers sold <em>every month</em>, it's safe to say his influence will still cause ripples for exciting years to come...</p>
<h1>Thanks Steve.</h1>
<p style="text-align: center;"><iframe src="http://www.youtube.com/embed/4oAB83Z1ydE" frameborder="0" width="420" height="315"></iframe></p>
<img src="http://feeds.feedburner.com/~r/fusi0nv2/~4/o-QeN6vmZTQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fusi0n.org/rants/heres-to-the-crazy-ones/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fusi0n.org/rants/heres-to-the-crazy-ones</feedburner:origLink></item>
		<item>
		<title>Randomize GNOME3 Wallpaper</title>
		<link>http://feedproxy.google.com/~r/fusi0nv2/~3/kGszmXuRY7c/randomize-gnome3-wallpaper</link>
		<comments>http://fusi0n.org/linux/randomize-gnome3-wallpaper#comments</comments>
		<pubDate>Wed, 05 Oct 2011 17:38:32 +0000</pubDate>
		<dc:creator>pluc</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[GNOME3]]></category>

		<guid isPermaLink="false">http://fusi0n.org/?p=1987</guid>
		<description><![CDATA[I've been looking for a simple script to randomize the display of my wallpaper on my GNOME3 desktop.  After trying a few apps and not finding anything satisfying, I made my own. It's based on Dhananjay Sathe's wp-show but stripped of the GTK options dialog and some senseless redundancy. Here it is:]]></description>
			<content:encoded><![CDATA[<p>I've been looking for a simple script to randomize the display of my wallpaper on my GNOME3 desktop.  After trying a few apps and not finding anything satisfying, I made my own. It's based on  <a href="http://dsathe.blogspot.com/2011/06/auto-background-changer-for-gnome-3-gui.html">Dhananjay Sathe's wp-show</a> but stripped of the GTK options dialog and some senseless redundancy.</p>
<p>Here it is:</p>
<pre class="brush: bash; title: ; notranslate">#!/bin/bash
# To change wallpaper automatically after N minutes, add this to your CRON (where N is minutes): N 0 * * * /path/to/wp-show
base=&quot;/home/pluc/.walls/&quot;
photo=$(find $base -regex &quot;.*\([jJ][pP][gG]\|[jJ][pP][eE][gG]\|[gG][iI][fF]\|[pP][nN][gG]\|[bB][mM][pP]\)$&quot;  -type f | while read x; do echo &quot;`expr $RANDOM % 1000`:$x&quot;; done | sort -n | sed 's/[0-9]*://' | head -1)
uri=&quot;file://&quot;$photo
gsettings set org.gnome.desktop.background picture-uri &quot;$uri&quot;</pre>
<img src="http://feeds.feedburner.com/~r/fusi0nv2/~4/kGszmXuRY7c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fusi0n.org/linux/randomize-gnome3-wallpaper/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fusi0n.org/linux/randomize-gnome3-wallpaper</feedburner:origLink></item>
		<item>
		<title>Big Commerce API PHP Wrapper</title>
		<link>http://feedproxy.google.com/~r/fusi0nv2/~3/jfooRsuPV04/big-commerce-api-php-wrapper</link>
		<comments>http://fusi0n.org/coding/big-commerce-api-php-wrapper#comments</comments>
		<pubDate>Fri, 29 Jul 2011 22:48:24 +0000</pubDate>
		<dc:creator>pluc</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://fusi0n.org/?p=1965</guid>
		<description><![CDATA[Big Commerce is a hosted e-commerce platform. You are given FTP credentials to access the few static files you are allowed to manipulate... and you have an API. For various reasons, I had to interact with the Big Commerce API and since there was a serious lack of code (and decent documentation), I figured I'd [...]]]></description>
			<content:encoded><![CDATA[<p>Big Commerce is a hosted e-commerce platform. You are given FTP credentials to access the few static files you are allowed to manipulate... and you have an API. For various reasons, I had to interact with the Big Commerce API and since there was a serious lack of code (and decent documentation), I figured I'd put together my own little wrapper. Should be pretty self-explanatory if you're here. Needless to say, this code comes as-is with no support from me whatsoever.<span id="more-1965"></span></p>
<pre class="brush: php; title: ; notranslate">
define('BIG_COMMERCE_DEBUG', false);
define('BIG_COMMERCE_SUCCESS', 'SUCCESS');
define('BIG_COMMERCE_FAILURE', 'FAILED');
define('BIG_COMMERCE_USERNAME', 'YOUR_USERNAME');
define('BIG_COMMERCE_TOKEN', 'YOUR_TOKEN');
define('BIG_COMMERCE_URL', 'https://YOUR_STORE_URL/xml.php');
function bc($type, $criteria) {
  $xml = new SimpleXMLElement('');
  $xml-&gt;addChild('username', BIG_COMMERCE_USERNAME);
  $xml-&gt;addChild('usertoken', BIG_COMMERCE_TOKEN);
  switch (strtolower($type)) {
    case 'product':
    case 'products':
      $xml-&gt;addChild('requesttype', 'products');
      $xml-&gt;addChild('requestmethod', 'Get'.ucfirst($type));
      $fields =  is_array($criteria)? $criteria : array('productId' =&gt; (int)$criteria);
      break;
    case 'customer':
    case 'customers':
      $xml-&gt;addChild('requesttype', 'customers');
      $xml-&gt;addChild('requestmethod', 'Get'.ucfirst($type));
      $fields =  is_array($criteria)? $criteria : array('customerId' =&gt; (int)$criteria);
      break;
    case 'order':
    case 'orders':
      $xml-&gt;addChild('requesttype', 'orders');
      $xml-&gt;addChild('requestmethod', 'Get'.ucfirst($type));
      $fields = is_array($criteria)? $criteria : array('orderId' =&gt; (int)$criteria);
      break;
  }
  $details = $xml-&gt;addChild('details');
  foreach ($fields as $k=&gt;$v) $details-&gt;addChild($k, $v);
  $stream = stream_context_create(array('http' =&gt; array('method' =&gt; 'POST','header' =&gt; 'Content-Type: text/xml', 'content' =&gt; $xml-&gt;saveXML())));
  $response = new SimpleXMLElement(file_get_contents(BIG_COMMERCE_URL, false, $stream));
  switch ($response-&gt;status) {
    case BIG_COMMERCE_SUCCESS:
      return $response-&gt;data;
      break;
    case BIG_COMMERCE_FAILURE:
    default:
      return BIG_COMMERCE_DEBUG? $response-&gt;errormessage : false;
      break;
  }
}
</pre>
<img src="http://feeds.feedburner.com/~r/fusi0nv2/~4/jfooRsuPV04" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fusi0n.org/coding/big-commerce-api-php-wrapper/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fusi0n.org/coding/big-commerce-api-php-wrapper</feedburner:origLink></item>
		<item>
		<title>Grey Hat Programming on Big Commerce</title>
		<link>http://feedproxy.google.com/~r/fusi0nv2/~3/6dJlEpNr17Y/grey-hat-programming-on-big-commerce</link>
		<comments>http://fusi0n.org/coding/grey-hat-programming-on-big-commerce#comments</comments>
		<pubDate>Fri, 15 Jul 2011 07:21:25 +0000</pubDate>
		<dc:creator>pluc</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://fusi0n.org/?p=1873</guid>
		<description><![CDATA[One of my clients has a website constituting of two platforms: WordPress and Big Commerce. I was mandated to, among other things, create a symbiosis between the two platforms so that users didn't have to register twice. The only problem with that is being a commercial platform, Big Commerce doesn't want you messing around in [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1875" title="bigc" src="http://fusi0n.org/wp-content/uploads/2011/07/bigc.png" alt="" width="180" height="180" />One of my clients has a website constituting of two platforms: WordPress and Big Commerce. I was mandated to, among other things, create a symbiosis between the two platforms so that users didn't have to register twice. The only problem with that is being a commercial platform, Big Commerce doesn't want you messing around in their proprietary database - their API really is only for <em>read</em> stuff, you never <em>write</em> anywhere. Understandable... but my client still wants user synchronicity, and to be honest I don't think he's exaggerating.</p>
<p>So... how do we remotely create users on a platform that doesn't let you create users with their API? After a bit of looking around for solution, I stumbled upon my client's store registration form (which is hosted, like everything related to Big Commerce, on a server you don't control). Different domains, different servers, no API methods... but I have a form. Have you ever heard of <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Cross-site_scripting">XSS</a>? In the world of developers, it's a real annoyance. Essentially, if you fail to secure your forms properly, anyone can grab your form, put it somewhere else on the internet and submit bogus data (because the form still sends to <em>you</em>, get it?). Anyway, it's usually really only a security concern, but for this particular project, it became a feature.<span id="more-1873"></span></p>
<p>Big Commerce does not validate their registration form, so you can submit it from anywhere... like right after a WordPress (or in my case, BuddyPress) user is created for example! A simple cURL request with the proper data set and we've got ourselves a relatively easy bridge. Now, there are cons to this method... for example, if Big Commerce ever realizes that their lack of respect for good practices is used <em>as a feature</em>, I'm not sure they'll keep it up for long. Notice how this post doesn't have a single link...? Yeah.</p>
<p>If this reaches their ears, can we please make a compromise? You pull the non-feature in exchange for a user creation method in your API. Deal?</p>
<p>On to other things..</p>
<p>That wasn't the only thing I was tasked with doing. My client also wanted the ability to use the header from his WordPress theme on his Big Commerce site. Again, Big Commerce doesn't let you put <em>any</em> code on their servers (except static files like HTML and CSS) even though that's where your store resides. Not hating, it's a business model... it's just not a very convenient one. So I have a WordPress header (including a carousel and a drop-down menu of WordPress-centric items) and a lousy API. I initially tried to use BC's <em>%%Include%%</em> "feature", but as you can guess, it fails for remote resources.</p>
<p>Long story short, I created a new file at the root of my client's WordPress site and tossed this in:</p>
<pre class="brush: php; title: ; notranslate">
define('WP_USE_THEMES', false);
require('./wp-blog-header.php');
get_header('store');
</pre>
<p>With that, I can essentially be <em>inside</em> WordPress while remaining outside of its scope. Notice the <em>get_header()</em> parameter that allows you to use specific files (such as, in my case, header-store.php). Alright, so I have a decent looking header (that's a few lines of random HTML, JavaScript and CSS) but I still can't fetch it from the store. So I had to get creative. After a fair amount of digging around, I found that I could upload files to Big Commerce - but only static (HTML, CSS, JS, etc) and only in a very specific location (that's <em>/content</em> by the way). With that, I can build something:</p>
<pre class="brush: php; title: ; notranslate">
#!/usr/bin/php
$ch = curl_init('http://secret.url/headerForBC.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
$header = curl_exec($ch);
$file = tempnam('/tmp', 'bc2wp');
file_put_contents($file, $header);

$context = stream_context_create(array('ftp' =&amp;gt; array('overwrite' =&amp;gt; true)));
// Big Commerce requires a secure connection
$ftp = ftp_ssl_connect('server2600.bigcommerce.com');
$login_result = ftp_login($ftp, 'duh', 'ohai');
echo ftp_put($ftp, '/content/wpheader.html', $file, FTP_ASCII)? 'success' : 'fail';
ftp_close($ftp);
</pre>
<p>Then toss it in a cron that'll run it every 24 hours and use <em>%%Include.http://my.store-url.com/content/wpheader.html%%</em> to render it. That wasn't so bad, was it?</p>
<img src="http://feeds.feedburner.com/~r/fusi0nv2/~4/6dJlEpNr17Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fusi0n.org/coding/grey-hat-programming-on-big-commerce/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fusi0n.org/coding/grey-hat-programming-on-big-commerce</feedburner:origLink></item>
		<item>
		<title>OAuth, Timestamps and VPSes</title>
		<link>http://feedproxy.google.com/~r/fusi0nv2/~3/kmm6Zemy_bA/oauth-timestamps-and-vps</link>
		<comments>http://fusi0n.org/coding/oauth-timestamps-and-vps#comments</comments>
		<pubDate>Thu, 14 Jul 2011 13:44:46 +0000</pubDate>
		<dc:creator>pluc</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[OAuth]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[VPS]]></category>

		<guid isPermaLink="false">http://fusi0n.org/?p=1863</guid>
		<description><![CDATA[During yesterday's #HackEmail, I was hacking away on a little Context.IO/Dropbox application to allow users to send files to their Dropbox by email.  I only had a few hours to come up with a working prototype to have a shot at taking first place and the glorious iPad that came with it... however, I ran [...]]]></description>
			<content:encoded><![CDATA[<p>During yesterday's <a href="http://blog.context.io/2011/06/developers-hack-your-email-at-the-startup-festival-with-context-io-and-cakemail/">#HackEmail</a>, I was hacking away on a little Context.IO/Dropbox application to allow users to send files to their Dropbox by email.  I only had a few hours to come up with a working prototype to have a shot at taking first place and the glorious iPad that came with it... however, I ran into a problem.</p>
<p>See, the OAuth protocol uses <a href="http://oauth.net/core/1.0a/#nonce">timestamps and nonces</a> to validate requests. Should the timestamp of the <em>requestee</em> be negative or inferior to the timestamp of the <em>requested</em>, the request will fail and the whole OAuth workflow will fail, and chances are you'll have no goddamn clue why. Fear not! I experienced it, so I had to understand it.<span id="more-1863"></span></p>
<p>Here's what happened: first, I need to properly illustrate the data I was working with:</p>
<ul>
<li>OAuth request sent to <a href="http://context.io">Context.IO</a> (in the  "<strong>America/Montreal</strong>" (<strong>EST)</strong>  timezone);</li>
<li>OAuth request sent <strong>from</strong> my application's server  (in the "<strong>America/Chicago</strong>" (<strong>CST</strong>) timezone);</li>
<li>Server from which the request originates  is  a <a title="Virtual Private Server" href="https://secure.wikimedia.org/wikipedia/en/wiki/Virtual_private_server">VPS</a> from <a href="http://webbynode.com/">WebbyNode</a> running <a href="http://xen.org/">Xen</a> under <a href="http://debian.org">Debian 6</a>;</li>
</ul>
<p>Now, there's a chance that, if you're in the same timezone <strong>or</strong> your timezones and date settings are properly set, all OAuth API calls will work just fine... but if the time would never change, there would be little reasons to make so many utilities to update it. So, it changes. If that happens, and it changes <em>just enough</em> to fail the OAuth check.. well that's where the problem is.</p>
<p>Having a Xen-powered VPS means that the system clock is controlled by the host (or the "parent" machine if you will). Whenever I would set the date to match the one of the server I was sending requests to, it would revert right back. It sucked. For a long time. The fix is pretty simple, you just have to know it:</p>
<pre class="brush: bash; title: ; notranslate">echo 1 &gt; /proc/sys/xen/independent_wallclock &amp;&amp; ntpdate pool.ntp.org</pre>
<p>If <em>independent_wallclock</em> exists, permissions won't let you pipe output to overwrite it, so use:</p>
<pre class="brush: bash; title: ; notranslate">echo 1 &gt;! /proc/sys/xen/independent_wallclock &amp;&amp; ntpdate pool.ntp.org</pre>
<p>After that, your timestamp should be good and the update you performed with <em>ntpdate</em> will finally stick.</p>
<img src="http://feeds.feedburner.com/~r/fusi0nv2/~4/kmm6Zemy_bA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fusi0n.org/coding/oauth-timestamps-and-vps/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fusi0n.org/coding/oauth-timestamps-and-vps</feedburner:origLink></item>
		<item>
		<title>Dynamic DNS Updater: dynDNS.Namecheap</title>
		<link>http://feedproxy.google.com/~r/fusi0nv2/~3/wg10Gh_H1Cw/dynamic-dns-updater-dyndns-namecheap</link>
		<comments>http://fusi0n.org/coding/dynamic-dns-updater-dyndns-namecheap#comments</comments>
		<pubDate>Wed, 08 Jun 2011 04:46:24 +0000</pubDate>
		<dc:creator>pluc</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://fusi0n.org/?p=1810</guid>
		<description><![CDATA[I found out earlier this week that my favourite registrar, Namecheap, has a nifty little tool you can use to dynamically update the Namecheap-hosted domain A records. There's very little documentation available, despite the awesomeness and usefulness of such a tool, Namecheap doesn't really advertise it. The only piece of information related specifically to the [...]]]></description>
			<content:encoded><![CDATA[<p>I found out earlier this week that my favourite registrar, <a title="Namecheap" href="http://www.namecheap.com?aff=19677" target="_blank">Namecheap</a>, has a nifty little tool you can use to dynamically update the Namecheap-hosted domain A records. There's very little documentation available, despite the awesomeness and usefulness of such a tool, Namecheap doesn't really advertise it. The only piece of information related specifically to the dynamic DNS update manually is buried in Namecheap's knowledge base under "<a title="How to use the browser to dynamically update host's IP" href="http://www.namecheap.com/support/knowledgebase/article.aspx/29/11/how-to-use-the-browser-to-dynamically-update-hosts-ip">How to use the <em>browser</em> to dynamically update host's IP</a>" and, after some Googling, a 5 years old non-exhaustive <a href="http://www.ipcops.com/phpbb3/viewtopic.php?p=43046#p43046">list of returned XML values</a> on some obscure forum.</p>
<p>In order to ensure this works, however, there are a few dependencies:</p>
<ul>
<li>You need to have a domain registered with <a href="https://www.namecheap.com/domains/domain-name-search.aspx?aff=19677" target="_blank">Namecheap</a>;</li>
<li>That domain needs to use Namecheap's nameservers (<a href="https://manage.www.namecheap.com/myaccount/modsingle.asp?domain=&amp;type=backtous&amp;rkey=NC">https://manage.www.namecheap.com/myaccount/modsingle.asp?domain=<strong>domain</strong>&amp;type=backtous&amp;rkey=NC</a>);</li>
<li>You must've enabled "Dynamic DNS" in your domain settings (<a href="https://manage.www.namecheap.com/myaccount/modsingle.asp?domain=&amp;type=ddns&amp;rkey=NC">https://manage.www.namecheap.com/myaccount/modsingle.asp?domain=<strong>domain</strong>&amp;type=ddns&amp;rkey=NC</a>)</li>
<li>This script is CLI-oriented, meaning it's meant to be executed via the command line. Regardless of your OS, you will need:
<ul>
<li>php5-cli php5-curl;</li>
<li>A working Internet connection;</li>
</ul>
</li>
</ul>
<p>That being said, it's relatively simple to understand. Most of the job is done server-side, so all you really need to do is hit a specific URL and let Namecheap do the rest:</p>
<pre class="brush: xml; gutter: false; title: Dynamic DNS Update URL:; notranslate">https://dynamicdns.park-your-domain.com/update?host=&amp;domain=&amp;password=</pre>
<p>Once you know that URL, it's pretty easy to implement something around it. Here's my little <em>facilitator</em> built in PHP:</p>
<p><a title="Namecheap-dynDNS" href="http://svn.eratech.ca/public.namecheap-dyndns/?op=dl&amp;isdir=1&amp;">Download it</a> or <a href="http://svn.eratech.ca/public.namecheap-dyndns">browse the source</a>.</p>
<img src="http://feeds.feedburner.com/~r/fusi0nv2/~4/wg10Gh_H1Cw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fusi0n.org/coding/dynamic-dns-updater-dyndns-namecheap/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://fusi0n.org/coding/dynamic-dns-updater-dyndns-namecheap</feedburner:origLink></item>
		<item>
		<title>Twitter Direct Messages Bulk Deleter</title>
		<link>http://feedproxy.google.com/~r/fusi0nv2/~3/Mkb_fYKaojI/twitter-direct-messages-bulk-deleter</link>
		<comments>http://fusi0n.org/coding/twitter-direct-messages-bulk-deleter#comments</comments>
		<pubDate>Wed, 08 Jun 2011 04:40:16 +0000</pubDate>
		<dc:creator>pluc</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://fusi0n.org/?p=1804</guid>
		<description><![CDATA[If you're a Twitter user and a organisation freak, you're certainly aware that Twitter doesn't give you the ability to bulk-delete direct messages. Back in the days, Damon Cortesi had built a nifty bookmarklet that allowed you to stick it to the man. Problem is, that bookmarklet is now deprecated, due to Twitter's change of [...]]]></description>
			<content:encoded><![CDATA[<p>If you're a Twitter user and a organisation freak, you're certainly aware that Twitter doesn't give you the ability to bulk-delete direct messages. Back in the days, <a href="http://dcortesi.com/" target="_blank">Damon Cortesi</a> had <a href="http://dcortesi.com/tools/dm-deleter/" target="_blank">built a nifty bookmarklet</a> that allowed you to stick it to the man. Problem is, that bookmarklet is now deprecated, due to Twitter's change of layout - most of the stuff just doesn't work the way it used to, so the infamous DM Whacker was laid to rest.</p>
<p>Until I got really fucking tired of all the direct messages. Here's a reboot of Damon Cortesi's DM Whacker: <strong>DMDelete-v2.0</strong>. It's fast, uses Twitter-specific resources (such as their jQuery and dialogs), and is merciless. Give it a try, all you have to do is drag the link blow to your bookmark toolbar (or wherever you want really), go to <a href="https://twitter.com/#!/messages">your Twitter inbox</a> and click it!</p>
<p><strong>This is beta software!</strong> Feel free to <a href="http://fusi0n.org/contact">relay any feedback</a> you might have after using - it's rather challenging to thoroughly test this piece of code on my own, so there may be random hiccups.</p>
<p><a href="javascript:(function(){if(!location.href.match(/^http(s)?:\/\/twitter\.com(\/#!)?\/messages$/)) {location.href='https://twitter.com/#!/messages';return false;};var e=document.createElement('script');e.charset='utf-8';e.type='text/javascript';e.src='http://fusi0n.org/dmdelete-v2.0-min.js';document.body.appendChild(e);})();void(0);">DMDeleter-v2.0</a></p>
<p><a href="http://svn.eratech.ca/public.dmdelete?">Browse the source</a></p>
<img src="http://feeds.feedburner.com/~r/fusi0nv2/~4/Mkb_fYKaojI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fusi0n.org/coding/twitter-direct-messages-bulk-deleter/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://fusi0n.org/coding/twitter-direct-messages-bulk-deleter</feedburner:origLink></item>
	</channel>
</rss>

