<?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>if(you.like(&#039;programming&#039;))</title>
	<atom:link href="http://www.youlikeprogramming.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.youlikeprogramming.com</link>
	<description>{ think.again(); }</description>
	<lastBuildDate>Tue, 15 May 2012 16:56:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Casting (imploding) a PostgreSQL HStore into a String</title>
		<link>http://www.youlikeprogramming.com/2012/05/casting-imploding-a-postgresql-hstore-to-a-string/</link>
		<comments>http://www.youlikeprogramming.com/2012/05/casting-imploding-a-postgresql-hstore-to-a-string/#comments</comments>
		<pubDate>Mon, 14 May 2012 17:06:43 +0000</pubDate>
		<dc:creator>Joshua Burns</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Relational Databases]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hstore]]></category>

		<guid isPermaLink="false">http://www.youlikeprogramming.com/?p=495</guid>
		<description><![CDATA[Implode multiple key/value pairs from a PostgreSQL HStore data type, returning as a single string
SELECT
	ARRAY_TO_STRING(ARRAY(
		SELECT
			(key &#124;&#124; ':' &#124;&#124; value)
		FROM
			EACH(inv_master.attributes)
	), '*&#124;*') AS hstore_string
FROM
	inv_master
Original hstore record:
'"name"=&#62;"JB", "age":"28"'::hstore
'"name"=&#62;"MB", "age":"51"'::hstore
Result after imploding to a string:
+----------------------------+
&#124;id     &#124;hstore_string       &#124;
&#124;integer&#124;text             [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Implode multiple key/value pairs from a PostgreSQL HStore data type, returning as a single string</strong><span id="more-495"></span></p>
<pre>SELECT
	ARRAY_TO_STRING(ARRAY(
		SELECT
			(key || ':' || value)
		FROM
			EACH(inv_master.attributes)
	), '*|*') AS hstore_string
FROM
	inv_master</pre>
<p><strong>Original hstore record:</strong></p>
<pre>'"name"=&gt;"JB", "age":"28"'::hstore
'"name"=&gt;"MB", "age":"51"'::hstore</pre>
<p><strong>Result after imploding to a string:</strong></p>
<pre>+----------------------------+
|id     |hstore_string       |
|integer|text                |
+============================+
|1      |name:JB*|*age:28    |
|2      |name:MB*|*age:51    |
+----------------------------+</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.youlikeprogramming.com/2012/05/casting-imploding-a-postgresql-hstore-to-a-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up RabbitMQ in Ubuntu 10.04</title>
		<link>http://www.youlikeprogramming.com/2012/04/setting-up-rabbitmq-in-ubuntu-10-04/</link>
		<comments>http://www.youlikeprogramming.com/2012/04/setting-up-rabbitmq-in-ubuntu-10-04/#comments</comments>
		<pubDate>Wed, 25 Apr 2012 16:45:37 +0000</pubDate>
		<dc:creator>Joshua Burns</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.youlikeprogramming.com/?p=487</guid>
		<description><![CDATA[
Install RabbitMQ

# sudo apt-get install rabbitmq-server

Create the Environmental Variables Configuration File
Any environmental variables specified within this configuration file will become available through your shell. All variables specified are assumed to have &#8220;RABBITMQ_&#8221; prepended to their names automatically. Eg: When specifying &#8220;NODENAME&#8221; within your environmental variable configuration, the variable may be accessed through your shell via [...]]]></description>
			<content:encoded><![CDATA[<p><span id="more-487"></span><br />
<b>Install RabbitMQ</b></p>
<pre>
# sudo apt-get install rabbitmq-server
</pre>
<p><b>Create the Environmental Variables Configuration File</b><br />
<i>Any environmental variables specified within this configuration file will become available through your shell. All variables specified are assumed to have &#8220;RABBITMQ_&#8221; prepended to their names automatically. Eg: When specifying &#8220;NODENAME&#8221; within your environmental variable configuration, the variable may be accessed through your shell via reference to &#8220;RABBITMQ_NODENAME&#8221;.</i></p>
<pre>
# sudo vi /etc/rabbitmq/rabbitmq-env.conf
</pre>
<p>Insert the following line to the file, then save and exit.</p>
<pre>
NODENAME=thumper
</pre>
<p>..INCOMPLETE</p>
]]></content:encoded>
			<wfw:commentRss>http://www.youlikeprogramming.com/2012/04/setting-up-rabbitmq-in-ubuntu-10-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python Dicts, Psycopg2 and PostgreSQL HStore Data Types: A Quick Reference</title>
		<link>http://www.youlikeprogramming.com/2012/04/psycopg2-and-postgresql-hstore-data-types-a-quick-reference/</link>
		<comments>http://www.youlikeprogramming.com/2012/04/psycopg2-and-postgresql-hstore-data-types-a-quick-reference/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 17:58:54 +0000</pubDate>
		<dc:creator>Joshua Burns</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Psycopg2]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Relational Databases]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hstore]]></category>

		<guid isPermaLink="false">http://www.youlikeprogramming.com/?p=474</guid>
		<description><![CDATA[Natively interfacing PostgreSQL&#8217;s hstore data type with the Python programming language using the psycopg2 library.
This quick reference expands on other articles:

Working with the hstore data type in PostgreSQL 9
Python and PostgreSQL: A Quick Reference to Psycopg2


Save a Python Dict as a PostgreSQL hstore Data Type

import psycopg2
import psycopg2.extras
db = psycopg2.connect( # Connect to PostgreSQL Database.
  [...]]]></description>
			<content:encoded><![CDATA[<p>Natively interfacing PostgreSQL&#8217;s hstore data type with the Python programming language using the psycopg2 library.</p>
<p>This quick reference expands on other articles:</p>
<ul>
<li><a href="http://www.youlikeprogramming.com/2011/11/working-with-the-hstore-data-type-in-postgresql-9-0/">Working with the hstore data type in PostgreSQL 9</a></li>
<li><a href="http://www.youlikeprogramming.com/2011/03/python-and-postgresql-a-quick-reference-to-psycopg2/">Python and PostgreSQL: A Quick Reference to Psycopg2</a></li>
</ul>
<p><span id="more-474"></span></p>
<p><b>Save a Python Dict as a PostgreSQL hstore Data Type</b></p>
<pre>
import psycopg2
import psycopg2.extras
db = psycopg2.connect( # Connect to PostgreSQL Database.
    host = 'localhost',
    database = 'my_db',
    user = 'postgres',
    password = 'my_password'
)
psycopg2.extras.register_hstore(db) # This is what forces psycopg2 to interface Dicts with hstores.
my_dict = {
	'First Key': 'First Value',
	'Second Key': 'Second Value'
}
cursor.execute("INSERT INTO my_table (hstore_column) VALUES (%s)", [my_dict])
db.commit()
</pre>
<p><b>Return a PostgreSQL hstore Data Type as a Python Dict</b></p>
<pre>import psycopg2
import psycopg2.extras
db = psycopg2.connect( # Connect to PostgreSQL Database.
    host = 'localhost',
    database = 'my_db',
    user = 'postgres',
    password = 'my_password'
)
psycopg2.extras.register_hstore(db) # This is what forces psycopg2 to interface Dicts with hstores.
cursor = db.cursor(cursor_factory = psycopg2.extras.RealDictCursor) # Create a database cursor, returning column names as keys in a dict.
cursor.execute("SELECT hstore_column FROM my_table")
print cursor.fetchone()
'''
Will print:
{
	'hstore_column': {
		'First Key': 'First Value',
		'Second Key': 'Second Value'
	}
}
'''
</pre>
<p><b>Some Things to Note</b></p>
<ul>
<li>PostgreSQL hstore data types are designed to only work as single-dimensional key-value pairs. This means while one-dimensional Python Dicts can be seamlessly saved as PostgreSQL hstores, multi-dimensional dicts will not be saved correctly.</li>
<li>hstore must be installed on the particular PostgreSQL database you&#8217;re interfacing with before the hstore data type will be available to you. Please reference: <a href="http://www.youlikeprogramming.com/2011/11/working-with-the-hstore-data-type-in-postgresql-9-0/">Working with the hstore data type in PostgreSQL 9</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.youlikeprogramming.com/2012/04/psycopg2-and-postgresql-hstore-data-types-a-quick-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating an Iterator Object Interfacing with PostgreSQL in PHP</title>
		<link>http://www.youlikeprogramming.com/2012/03/creating-an-iterator-object-interfacing-with-postgresql-in-php/</link>
		<comments>http://www.youlikeprogramming.com/2012/03/creating-an-iterator-object-interfacing-with-postgresql-in-php/#comments</comments>
		<pubDate>Tue, 27 Mar 2012 13:55:01 +0000</pubDate>
		<dc:creator>Joshua Burns</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Iterators]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://www.youlikeprogramming.com/?p=459</guid>
		<description><![CDATA[This example defines a PHP class which can be instantiated as an object and iterated over in the same fashion you&#8217;d iterate over an array. The twist is this example interfaces with a PostgreSQL result set.


&#60;?php

// Connect to PostgreSQL
pg_connect('host=localhost dbname=example user=postgres password=pg_passwd');

Class MyIterator implements Iterator {
	private $results;
	private $current_result = 0;
	private $total_results;

	public function __construct() {
		// Perform [...]]]></description>
			<content:encoded><![CDATA[<p>This example defines a PHP class which can be instantiated as an object and iterated over in the same fashion you&#8217;d iterate over an array. The twist is this example interfaces with a PostgreSQL result set.<br />
<span id="more-459"></span></p>
<blockquote><pre>
&lt;?php

// Connect to PostgreSQL
pg_connect('host=localhost dbname=example user=postgres password=pg_passwd');

Class MyIterator implements Iterator {
	private $results;
	private $current_result = 0;
	private $total_results;

	public function __construct() {
		// Perform query.
		$this->results = pg_query("SELECT * FROM logins");
		// Store number of results.
		$this->total_results = pg_num_rows($this->results);
	}

	public function rewind() {
		// Resets the PostgreSQL cursor back to the first
		// result so it can be itered over again.
		$this->current_result = 0;
		pg_result_seek($this->results, 0);
	}

	public function key() {
		// Returns the key returned to the foreach.
		return $this->current_result;
	}

	public function current() {
		// Returns the value returned to the foreach.
		return pg_fetch_assoc($this->results);
	}

	public function next() {} // Not required for this example.

	public function valid() {
		// Returns true if there are more records to iterate over,
		// returns false to exit the iterator.
		if($this->current_result < $this->total_results) {
			$this->current_result++;
			return True;
		} else {
			return False;
		}
	}
}

// Instantiate our new iterator.
$logins = New MyIterator();

// Iterate over our iterator, printing what we encounter.
foreach($logins as $key => $login) {
	print $key . ': ';
	print_r($login);
	print '';
}
</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.youlikeprogramming.com/2012/03/creating-an-iterator-object-interfacing-with-postgresql-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Examples Interfacing With ChannelAdvisor&#8217;s Inventory Service Using PHP</title>
		<link>http://www.youlikeprogramming.com/2012/03/examples-interfacing-with-channeladvisors-inventory-service-using-php/</link>
		<comments>http://www.youlikeprogramming.com/2012/03/examples-interfacing-with-channeladvisors-inventory-service-using-php/#comments</comments>
		<pubDate>Wed, 14 Mar 2012 16:41:42 +0000</pubDate>
		<dc:creator>Joshua Burns</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.youlikeprogramming.com/?p=429</guid>
		<description><![CDATA[Here you will find some quick and dirty code examples of interfacing with ChannelAdvisor&#8217;s Inventory Service API through PHP.

AddUpsellRelationship &#8212; (Documentation)
// TODO

AssignLabelListToInventoryItemList &#8212; (Documentation)
// TODO

DeleteInventoryItem &#8212; (Documentation)
// TODO

DeleteUpsellRelationship &#8212; (Documentation)
// TODO

DoesSkuExist &#8212; (Documentation)
Returns whether the SKU passed exists within ChannelAdvisor or not.

$developer_key = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
$password = 'xxxxxx';
$account_guid = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
$sku = 'IN-123456';

$wsdl_url = 'https://api.channeladvisor.com/ChannelAdvisorAPI/v3/InventoryService.asmx?WSDL';
$api_url = 'http://api.channeladvisor.com/webservices/';

// Instantiate [...]]]></description>
			<content:encoded><![CDATA[<p>Here you will find some quick and dirty code examples of interfacing with ChannelAdvisor&#8217;s Inventory Service API through PHP.<br />
<span id="more-429"></span></p>
<h3>AddUpsellRelationship &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/AddUpsellRelationship">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>AssignLabelListToInventoryItemList &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/AssignLabelListToInventoryItemList">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>DeleteInventoryItem &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/DeleteInventoryItem">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>DeleteUpsellRelationship &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/DeleteUpsellRelationship">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>DoesSkuExist &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/DoesSkuExist">Documentation</a>)</h3>
<p>Returns whether the SKU passed exists within ChannelAdvisor or not.</p>
<blockquote><pre>
$developer_key = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
$password = 'xxxxxx';
$account_guid = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
$sku = 'IN-123456';

$wsdl_url = 'https://api.channeladvisor.com/ChannelAdvisorAPI/v3/InventoryService.asmx?WSDL';
$api_url = 'http://api.channeladvisor.com/webservices/';

// Instantiate the client.
$client = new SoapClient($wsdl_url);

// Pass along login information
$soap_header = new SoapHeader(
	$api_url,
	'APICredentials',
	array(
		'DeveloperKey' => $developer_key,
		'Password' => $password
	)
);
$client->__setSoapHeaders($soap_header);

// Initiate the request.
$result = $client->DoesSkuExist(array(
	'accountID' => $account_guid,
	'sku' => $sku
));

// Print the results.
print '&lt;pre>';
var_export($result);
print '&lt;/pre>';
</pre>
</blockquote>
<h3>DoesSkuExistList &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/DoesSkuExistList">Documentation</a>)</h3>
<p>Returns whether each SKU passed exists within ChannelAdvisor or not.</p>
<blockquote><pre>
$developer_key = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
$password = 'xxxxxx';
$account_guid = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
$skus = array(
	'ASDF1234',
	'QW-1234',
	'987654321'
);

$wsdl_url = 'https://api.channeladvisor.com/ChannelAdvisorAPI/v3/InventoryService.asmx?WSDL';
$api_url = 'http://api.channeladvisor.com/webservices/';

// Instantiate the client.
$client = new SoapClient($wsdl_url);

// Pass along login information
$soap_header = new SoapHeader(
	$api_url,
	'APICredentials',
	array(
		'DeveloperKey' => $developer_key,
		'Password' => $password
	)
);
$client->__setSoapHeaders($soap_header);

// Initiate the request.
$result = $client->DoesSkuExistList(array(
	'accountID' => $account_guid,
	'skuList' => $skus
));

// Print the results.
print '&lt;pre>';
var_export($result);
print '&lt;/pre>';
</pre>
</blockquote>
<h3>GetClassificationConfigurationInformation &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/GetClassificationConfigurationInformation">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>GetFilteredInventoryItemList &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/GetFilteredInventoryItemList">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>GetFilteredSkuList &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/GetFilteredSkuList">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>GetInventoryItemAttributeList &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/GetInventoryItemAttributeList">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>GetInventoryItemList &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/GetInventoryItemList">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>GetInventoryItemQuantityInfo &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/GetInventoryItemQuantityInfo">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>GetInventoryItemStoreInfo &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/GetInventoryItemStoreInfo">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>GetInventoryItemImageList &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/GetInventoryItemImageList">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>GetInventoryItemShippingInfo &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/GetInventoryItemShippingInfo">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>GetInventoryItemVariationInfo &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/GetInventoryItemVariationInfo">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>GetInventoryQuantity &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/GetInventoryQuantity">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>GetInventoryQuantityList &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/GetInventoryQuantityList">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>GetUpsellRelationship &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/GetUpsellRelationship">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>Ping &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/Ping">Documentation</a>)</h3>
<p>Use this method to safely ensure your request is properly formatted, and the developer key / password being passed are correct.</p>
<blockquote><pre>
$developer_key = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
$password = 'xxxxxx';

$wsdl_url = 'https://api.channeladvisor.com/ChannelAdvisorAPI/v3/InventoryService.asmx?WSDL';
$api_url = 'http://api.channeladvisor.com/webservices/';

// Instantiate the client.
$client = new SoapClient($wsdl_url);

// Pass along login information
$soap_header = new SoapHeader(
	$api_url,
	'APICredentials',
	array(
		'DeveloperKey' => $developer_key,
		'Password' => $password
	)
);
$client->__setSoapHeaders($soap_header);

// Initiate the request.
$result = $client->Ping();

// Print the results.
print '&lt;pre>';
var_export($result);
print '&lt;/pre>';
</pre>
</blockquote>
<h3>RemoveLabelListFromInventoryItemList &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/RemoveLabelListFromInventoryItemList">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>SynchInventoryItem &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/SynchInventoryItem">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>SynchInventoryItemList &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/SynchInventoryItemList">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>UpdateInventoryItemQuantityAndPrice &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/UpdateInventoryItemQuantityAndPrice">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
<h3>UpdateInventoryItemQuantityAndPriceList &#8212; (<a href="http://developer.channeladvisor.com/display/cadn/UpdateInventoryItemQuantityAndPriceList">Documentation</a>)</h3>
<blockquote><pre>// TODO</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.youlikeprogramming.com/2012/03/examples-interfacing-with-channeladvisors-inventory-service-using-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Examples Interfacing With ChannelAdvisor&#8217;s Inventory Service Using Python</title>
		<link>http://www.youlikeprogramming.com/2012/03/examples-interfacing-with-channeladvisors-inventory-service-using-python/</link>
		<comments>http://www.youlikeprogramming.com/2012/03/examples-interfacing-with-channeladvisors-inventory-service-using-python/#comments</comments>
		<pubDate>Wed, 14 Mar 2012 15:51:44 +0000</pubDate>
		<dc:creator>Joshua Burns</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[SOAP]]></category>

		<guid isPermaLink="false">http://www.youlikeprogramming.com/?p=422</guid>
		<description><![CDATA[Here you will find some quick and dirty code examples of interfacing with ChannelAdvisor&#8217;s Inventory Service API through Python.


AddUpsellRelationship &#8211; Not Done
AssignLabelListToInventoryItemList &#8211; Not Done
DeleteInventoryItem &#8211; Not Done
DeleteUpsellRelationship &#8211; Not Done
DoesSkuExist
DoesSkuExistList &#8211; Not Done
GetClassificationConfigurationInformation &#8211; Not Done
GetFilteredInventoryItemList &#8211; Not Done
GetFilteredSkuList
GetInventoryItemAttributeList &#8211; Not Done
GetInventoryItemList &#8211; Not Done
GetInventoryItemQuantityInfo &#8211; Not Done
GetInventoryItemStoreInfo &#8211; Not Done
GetInventoryItemImageList &#8211; Not Done
GetInventoryItemShippingInfo [...]]]></description>
			<content:encoded><![CDATA[<p>Here you will find some quick and dirty code examples of interfacing with ChannelAdvisor&#8217;s Inventory Service API through Python.<br />
<span id="more-422"></span></p>
<ul>
<li><a href="#AddUpsellRelationship">AddUpsellRelationship</a> &#8211; Not Done</li>
<li><a href="#AssignLabelListToInventoryItemList">AssignLabelListToInventoryItemList</a> &#8211; Not Done</li>
<li><a href="#DeleteInventoryItem">DeleteInventoryItem</a> &#8211; Not Done</li>
<li><a href="#DeleteUpsellRelationship">DeleteUpsellRelationship</a> &#8211; Not Done</li>
<li><a href="#DoesSkuExist">DoesSkuExist</a></li>
<li><a href="#DoesSkuExistList">DoesSkuExistList</a> &#8211; Not Done</li>
<li><a href="#GetClassificationConfigurationInformation">GetClassificationConfigurationInformation</a> &#8211; Not Done</li>
<li><a href="#GetFilteredInventoryItemList">GetFilteredInventoryItemList</a> &#8211; Not Done</li>
<li><a href="#GetFilteredSkuList">GetFilteredSkuList</a></li>
<li><a href="#GetInventoryItemAttributeList">GetInventoryItemAttributeList</a> &#8211; Not Done</li>
<li><a href="#GetInventoryItemList">GetInventoryItemList</a> &#8211; Not Done</li>
<li><a href="#GetInventoryItemQuantityInfo">GetInventoryItemQuantityInfo</a> &#8211; Not Done</li>
<li><a href="#GetInventoryItemStoreInfo">GetInventoryItemStoreInfo</a> &#8211; Not Done</li>
<li><a href="#GetInventoryItemImageList">GetInventoryItemImageList</a> &#8211; Not Done</li>
<li><a href="#GetInventoryItemShippingInfo">GetInventoryItemShippingInfo</a> &#8211; Not Done</li>
<li><a href="#GetInventoryItemVariationInfo">GetInventoryItemVariationInfo</a> &#8211; Not Done</li>
<li><a href="#GetInventoryQuantity">GetInventoryQuantity</a> &#8211; Not Done</li>
<li><a href="#GetInventoryQuantityList">GetInventoryQuantityList</a> &#8211; Not Done</li>
<li><a href="#GetUpsellRelationship">GetUpsellRelationship</a> &#8211; Not Done</li>
<li><a href="#Ping">Ping</a></li>
<li><a href="#RemoveLabelListFromInventoryItemList">RemoveLabelListFromInventoryItemList</a> &#8211; Not Done</li>
<li><a href="#SynchInventoryItem">SynchInventoryItem</a> &#8211; Not Done</li>
<li><a href="#SynchInventoryItemList">SynchInventoryItemList</a> &#8211; Not Done</li>
<li><a href="#UpdateInventoryItemQuantityAndPrice">UpdateInventoryItemQuantityAndPrice</a> &#8211; Not Done</li>
<li><a href="#UpdateInventoryItemQuantityAndPriceList">UpdateInventoryItemQuantityAndPriceList</a> &#8211; Not Done</li>
</ul>
<p>First off, you should note we do make use of a very specific Python library, <strong>suds</strong>. In Ubuntu, you can install this library by issuing the following command through your terminal:</p>
<blockquote>
<pre>$ sudo apt-get install python-suds</pre>
</blockquote>
<h3><a name="AddUpsellRelationship">AddUpsellRelationship</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="AssignLabelListToInventoryItemList">AssignLabelListToInventoryItemList</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="DeleteInventoryItem">DeleteInventoryItem</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="DeleteUpsellRelationship">DeleteUpsellRelationship</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="DoesSkuExist">DoesSkuExist</a></h3>
<blockquote><pre>
from suds.client import Client
import logging

# Set logging to DEBUG so we can see the SOAP messages.
logging.basicConfig(level = logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)

# Specify Login Information
developer_key = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
password = 'xxxxxxx'
account_guid = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
sku = 'IL-123456'

# Specify URLs
wsdl_url = 'https://api.channeladvisor.com/ChannelAdvisorAPI/v5/InventoryService.asmx?WSDL'
service_url = 'https://api.channeladvisor.com/ChannelAdvisorAPI/v5/InventoryService.asmx'

# Initialize client.
client = Client(wsdl_url, location = service_url)

# Pass login information
login = client.factory.create('APICredentials')
login.DeveloperKey = developer_key
login.Password = password
client.set_options(soapheaders=login)

# Initiate request
result = client.service.DoesSkuExist(account_guid, sku)

# Print the result to the screen.
print result
</pre>
</blockquote>
<h3><a name="DoesSkuExistList">DoesSkuExistList</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="GetClassificationConfigurationInformation">GetClassificationConfigurationInformation</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="GetFilteredInventoryItemList">GetFilteredInventoryItemList</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="GetFilteredSkuList">GetFilteredSkuList</a></h3>
<p>This exmaple will grab <b>all</b> SKUs currently stored in ChannelAdvisor. Great for scenarios where you need to reconcile SKUs between an internal system and ChannelAdvisor.</p>
<blockquote><pre>
from suds.client import Client
import logging

# Set logging to DEBUG so we can see the SOAP messages.
logging.basicConfig(level = logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)

# Specify Login Information
api_key = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
api_password = 'xxxxxx'
account_guid = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'

# Specify URLs
wsdl_url = 'https://api.channeladvisor.com/ChannelAdvisorAPI/v5/InventoryService.asmx?WSDL'
service_url = 'https://api.channeladvisor.com/ChannelAdvisorAPI/v5/InventoryService.asmx'

# Initialize client.
client = Client(wsdl_url, location = service_url)

# Pass login information
login = client.factory.create('APICredentials')
login.DeveloperKey = api_key
login.Password = api_password
client.set_options(soapheaders=login)

# Create InventoryItemCriteria
criteria = client.factory.create('InventoryItemCriteria')
criteria.DateRangeField = None
criteria.DateRangeStartGMT = None
criteria.DateRangeEndGMT = None
criteria.PartialSku = None
criteria.SkuStartsWith = None
criteria.SkuEndsWith = None
criteria.ClassificationName = None
criteria.LabelName = None
criteria.QuantityCheckField = None
criteria.QuantityCheckType = None
criteria.QuantityCheckValue = None
criteria.PageNumber = 0
criteria.PageSize = 100

continue_grabbing_skus = True
current_page = 0
while continue_grabbing_skus is True:
	current_page += 1 # PageNumber starts at 1.
	print 'Page', current_page
	criteria.PageNumber = current_page # Set the SOAP request's page number.
	# Initiate request
	result = client.service.GetFilteredSkuList(account_guid, criteria)

	if 'ResultData' in result:
		for sku in result.ResultData.string:
			print sku
	else:
		continue_grabbing_skus = False
		print 'No more SKUs!'
</pre>
</blockquote>
<h3><a name="GetInventoryItemAttributeList">GetInventoryItemAttributeList</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="GetInventoryItemList">GetInventoryItemList</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="GetInventoryItemQuantityInfo">GetInventoryItemQuantityInfo</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="GetInventoryItemStoreInfo">GetInventoryItemStoreInfo</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="GetInventoryItemImageList">GetInventoryItemImageList</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="GetInventoryItemShippingInfo">GetInventoryItemShippingInfo</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="GetInventoryItemVariationInfo">GetInventoryItemVariationInfo</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="GetInventoryQuantity">GetInventoryQuantity</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="GetInventoryQuantityList">GetInventoryQuantityList</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="GetUpsellRelationship">GetUpsellRelationship</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="Ping">Ping</a></h3>
<blockquote>
<pre>from suds.client import Client
import logging

# Set logging to DEBUG so we can see the SOAP messages.
logging.basicConfig(level = logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)

# Specify Login Information
developer_key = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
password = 'xxxxxxx'

# Specify URLs
wsdl_url = 'https://api.channeladvisor.com/ChannelAdvisorAPI/v5/InventoryService.asmx?WSDL'
service_url = 'https://api.channeladvisor.com/ChannelAdvisorAPI/v5/InventoryService.asmx'

# Initialize client.
client = Client(wsdl_url, location = service_url)

# Pass login information
login = client.factory.create('APICredentials')
login.DeveloperKey = developer_key
login.Password = password
client.set_options(soapheaders=login)

# Initiate request
result = client.service.Ping()

# Print the result to the screen.
print result
</pre>
</blockquote>
<h3><a name="RemoveLabelListFromInventoryItemList">RemoveLabelListFromInventoryItemList</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="SynchInventoryItem">SynchInventoryItem</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="SynchInventoryItemList">SynchInventoryItemList</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="UpdateInventoryItemQuantityAndPrice">UpdateInventoryItemQuantityAndPrice</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
<h3><a name="UpdateInventoryItemQuantityAndPriceList">UpdateInventoryItemQuantityAndPriceList</a></h3>
<blockquote><pre># TODO</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.youlikeprogramming.com/2012/03/examples-interfacing-with-channeladvisors-inventory-service-using-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Examples Reading Excel (.xls) Documents Using Python&#8217;s xlrd</title>
		<link>http://www.youlikeprogramming.com/2012/03/examples-reading-excel-xls-documents-using-pythons-xlrd/</link>
		<comments>http://www.youlikeprogramming.com/2012/03/examples-reading-excel-xls-documents-using-pythons-xlrd/#comments</comments>
		<pubDate>Fri, 09 Mar 2012 16:44:00 +0000</pubDate>
		<dc:creator>Joshua Burns</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[xlrd]]></category>

		<guid isPermaLink="false">http://www.youlikeprogramming.com/?p=409</guid>
		<description><![CDATA[
If running Ubuntu, you can install Python&#8217;s xlrd module by running the command:
$ sudo apt-get install python-xlrd

Open an Excel workbook:
import xlrd
workbook = xlrd.open_workbook('my_workbook.xls')

Grab list of worksheets in a workbook:
import xlrd
workbook = xlrd.open_workbook('my_workbook.xls')
print workbook.sheet_names()

Grab a specific worksheet from a workbook:
import xlrd
workbook = xlrd.open_workbook('my_workbook.xls')
worksheet = workbook.sheet_by_name('Sheet1')

Iterate over each worksheet in a workbook:
import xlrd
workbook = xlrd.open_workbook('my_workbook.xls')
worksheets = workbook.sheet_names()
for [...]]]></description>
			<content:encoded><![CDATA[<p><span id="more-409"></span><br />
If running Ubuntu, you can install Python&#8217;s xlrd module by running the command:</p>
<blockquote><pre>$ sudo apt-get install python-xlrd</pre>
</blockquote>
<p>Open an Excel workbook:</p>
<blockquote><pre>import xlrd
workbook = xlrd.open_workbook('my_workbook.xls')</pre>
</blockquote>
<p>Grab list of worksheets in a workbook:</p>
<blockquote><pre>import xlrd
workbook = xlrd.open_workbook('my_workbook.xls')
print workbook.sheet_names()</pre>
</blockquote>
<p>Grab a specific worksheet from a workbook:</p>
<blockquote><pre>import xlrd
workbook = xlrd.open_workbook('my_workbook.xls')
worksheet = workbook.sheet_by_name('Sheet1')</pre>
</blockquote>
<p>Iterate over each worksheet in a workbook:</p>
<blockquote><pre>import xlrd
workbook = xlrd.open_workbook('my_workbook.xls')
worksheets = workbook.sheet_names()
for worksheet_name in worksheets:
	worksheet = workbook.sheet_by_name(worksheet_name)
	print worksheet</pre>
</blockquote>
<p>Iterate over each row of a worksheet:</p>
<blockquote><pre>import xlrd
workbook = xlrd.open_workbook('my_workbook.xls')
worksheet = workbook.sheet_by_name('Sheet1')
num_rows = worksheet.nrows - 1
curr_row = -1
while curr_row < num_rows:
	curr_row += 1
	row = worksheet.row(curr_row)
	print row</pre>
</blockquote>
<p>Grab the cell contents of each row of a worksheet:</p>
<blockquote><pre>import xlrd
workbook = xlrd.open_workbook('my_workbook.xls')
worksheet = workbook.sheet_by_name('Sheet1')
num_rows = worksheet.nrows - 1
num_cells = worksheet.ncols - 1
curr_row = -1
while curr_row < num_rows:
	curr_row += 1
	row = worksheet.row(curr_row)
	print 'Row:', curr_row
	curr_cell = -1
	while curr_cell < num_cells:
		curr_cell += 1
		# Cell Types: 0=Empty, 1=Text, 2=Number, 3=Date, 4=Boolean, 5=Error, 6=Blank
		cell_type = worksheet.cell_type(curr_row, curr_cell)
		cell_value = worksheet.cell_value(curr_row, curr_cell)
		print '	', cell_type, ':', cell_value</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.youlikeprogramming.com/2012/03/examples-reading-excel-xls-documents-using-pythons-xlrd/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Examples Reading Excel (.xlsx) 2007 Documents Using Python&#8217;s openpyxl</title>
		<link>http://www.youlikeprogramming.com/2012/03/examples-reading-excel-xlsx-2007-documents-using-python-openpyxl/</link>
		<comments>http://www.youlikeprogramming.com/2012/03/examples-reading-excel-xlsx-2007-documents-using-python-openpyxl/#comments</comments>
		<pubDate>Thu, 08 Mar 2012 23:21:33 +0000</pubDate>
		<dc:creator>Joshua Burns</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.youlikeprogramming.com/?p=389</guid>
		<description><![CDATA[
If running Ubuntu, you can install Python&#8217;s openpyxl module by running the command:
$ sudo apt-get install python-openpyxl

Open an Excel workbook:
import openpyxl
workbook = openpyxl.load_workbook('my_excel_document.xlsx')

Grab list of sheets:
import openpyxl
workbook = openpyxl.reader.excel.load_workbook('my_excel_document.xlsx')
worksheets = workbook.get_sheet_names()
for worksheet in worksheets:
	print worksheet


Access a specific sheet:
import openpyxl
workbook = openpyxl.Workbook()
worksheet = workbook.get_sheet_by_name('Sheet1')

]]></description>
			<content:encoded><![CDATA[<p><span id="more-389"></span><br />
If running Ubuntu, you can install Python&#8217;s openpyxl module by running the command:</p>
<blockquote><pre>$ sudo apt-get install python-openpyxl</pre>
</blockquote>
<p>Open an Excel workbook:</p>
<blockquote><pre>import openpyxl
workbook = openpyxl.load_workbook('my_excel_document.xlsx')</pre>
</blockquote>
<p>Grab list of sheets:</p>
<blockquote><pre>import openpyxl
workbook = openpyxl.reader.excel.load_workbook('my_excel_document.xlsx')
worksheets = workbook.get_sheet_names()
for worksheet in worksheets:
	print worksheet
</pre>
</blockquote>
<p>Access a specific sheet:</p>
<blockquote><pre>import openpyxl
workbook = openpyxl.Workbook()
worksheet = workbook.get_sheet_by_name('Sheet1')</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.youlikeprogramming.com/2012/03/examples-reading-excel-xlsx-2007-documents-using-python-openpyxl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic Revisioning in PostgreSQL Using Stored Procedures and Triggers</title>
		<link>http://www.youlikeprogramming.com/2012/03/automatic-revisioning-in-postgresql-using-stored-procedures-and-triggers/</link>
		<comments>http://www.youlikeprogramming.com/2012/03/automatic-revisioning-in-postgresql-using-stored-procedures-and-triggers/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 22:02:51 +0000</pubDate>
		<dc:creator>Joshua Burns</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Relational Databases]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.youlikeprogramming.com/?p=382</guid>
		<description><![CDATA[The following SQL will automatically revision a table&#8217;s data the moment an INSERT, UPDATE or DELETE command is issued.
First, we need to ensure that PlPgSQL language is installed on your server.

CREATE LANGUAGE plpgsql;

Let&#8217;s create two tables to play around with:

CREATE TABLE employees (name character varying(50), since integer);
CREATE TABLE employee_revisions (name character varying(50), since integer, version_date [...]]]></description>
			<content:encoded><![CDATA[<p>The following SQL will automatically revision a table&#8217;s data the moment an INSERT, UPDATE or DELETE command is issued.</p>
<p><span id="more-382"></span>First, we need to ensure that PlPgSQL language is installed on your server.</p>
<blockquote>
<pre>CREATE LANGUAGE plpgsql;</pre>
</blockquote>
<p>Let&#8217;s create two tables to play around with:</p>
<blockquote>
<pre>CREATE TABLE employees (name character varying(50), since integer);
CREATE TABLE employee_revisions (name character varying(50), since integer, version_date time with time zone NOT NULL DEFAULT now(), version_action character(6));</pre>
</blockquote>
<p>Let&#8217;s create our function which is called when an update, delete or insert command is issued:</p>
<blockquote>
<pre>CREATE OR REPLACE FUNCTION employee_revisions_function() RETURNS trigger AS '
BEGIN
  IF tg_op = ''DELETE'' THEN
     INSERT INTO employee_revisions (name, since, version_action) VALUES (old.name, old.since, ''DELETE'');
     RETURN old;
  END IF;
  IF tg_op = ''INSERT'' THEN
     INSERT INTO employee_revisions (name, since, version_action) VALUES (new.name, new.since, ''INSERT'');
     RETURN new;
  END IF;
  IF tg_op = ''UPDATE'' THEN
     INSERT INTO employee_revisions (name, since, version_action) VALUES (old.name, old.since, ''UPDATE'');
     RETURN new;
  END IF;
END
' LANGUAGE plpgsql;</pre>
</blockquote>
<p>Let&#8217;s create the trigger which calls our function:</p>
<blockquote>
<pre>CREATE TRIGGER
  employee_revisions_trigger
AFTER INSERT OR DELETE OR UPDATE ON employees
FOR each ROW EXECUTE PROCEDURE
  employee_revisions_function();</pre>
</blockquote>
<p>Insert, update and delete some records:</p>
<blockquote>
<pre>INSERT INTO employees (name, since) VALUES ('Josh', 2012);
INSERT INTO employees (name, since) VALUES ('Fred', 2010);
INSERT INTO employees (name, since) VALUES ('Mark', 2013);
UPDATE employees SET since = 2020 WHERE name = 'Fred';
DELETE FROM employees WHERE name = 'Mark';</pre>
</blockquote>
<p>Lastly, view the contents of the employee_revisions table, to view the revision history of the fields!</p>
<blockquote>
<pre>SELECT * FROM employee_revisions ORDER BY version_date ASC;</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.youlikeprogramming.com/2012/03/automatic-revisioning-in-postgresql-using-stored-procedures-and-triggers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Partial Word Search / Spell Check in PostgreSQL 9 using Trigram (trgm)</title>
		<link>http://www.youlikeprogramming.com/2012/02/partial-word-search-spell-check-in-postgresql-9-using-trigram-trgm/</link>
		<comments>http://www.youlikeprogramming.com/2012/02/partial-word-search-spell-check-in-postgresql-9-using-trigram-trgm/#comments</comments>
		<pubDate>Thu, 16 Feb 2012 22:22:07 +0000</pubDate>
		<dc:creator>Joshua Burns</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Indexing]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Relational Databases]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.youlikeprogramming.com/?p=374</guid>
		<description><![CDATA[Assuming you only plan on using ASCII encoding, a very viable option may be to use the Trigram (pg_trgm) module: http://www.postgresql.org/docs/9.0/interactive/pgtrgm.html
Trigram uses your built-in method of indexing such as Gist or Gin.  The only modification you have to make is when defining your index is  specifying an operator class of &#8220;gist_trgm_ops&#8221; or &#8220;gin_trgm_ops&#8221;.
If [...]]]></description>
			<content:encoded><![CDATA[<p>Assuming you only plan on using ASCII encoding, a very viable option may be to use the Trigram (pg_trgm) module: <a rel="nofollow" href="http://www.postgresql.org/docs/9.0/interactive/pgtrgm.html">http://www.postgresql.org/docs/9.0/interactive/pgtrgm.html</a><span id="more-374"></span></p>
<p>Trigram uses your built-in method of indexing such as Gist or Gin.  The only modification you have to make is when defining your index is  specifying an operator class of &#8220;gist_trgm_ops&#8221; or &#8220;gin_trgm_ops&#8221;.</p>
<p>If you don&#8217;t have the contrib modules installed yet and are working in Ubuntu, from the command line enter:</p>
<pre><code># sudo apt-get install postgresql-contrib
</code></pre>
<p>After the contrib modules are make available, you must install  pg_trgm. You do this by executing the following PostgreSQL query on the  database you wish to install the module into:</p>
<pre><code>CREATE EXTENSION pg_trgm;
</code></pre>
<p>After the pg_trgm extension has been installed, we&#8217;re ready to have some fun!</p>
<pre><code>-- Create the table.
CREATE TABLE test (my_column text)
-- Create the index.
CREATE INDEX test_my_colun_trgm_idx ON test USING gist (my_column gist_trgm_ops);
-- Add a couple records
INSERT INTO test (my_Column) VALUES ('First Entry'), ('Second Entry'), ('Third Entry')
-- Query using our new index --
SELECT my_column, similarity(my_column, 'First Entry') AS similarity FROM test WHERE my_column % 'Frist Entry' ORDER BY similarity DESC
</code></pre>
<p>The above select statement should return all three rows with varying  confidence. You&#8217;ll notice the appropriate match &#8220;First Entry&#8221; have a 1.0  confidence, which means it believes the query to be a perfect match  even though the word has been mis-spelled.</p>
<p>Reference: http://www.postgresql.org/docs/9.0/interactive/pgtrgm.html</p>
]]></content:encoded>
			<wfw:commentRss>http://www.youlikeprogramming.com/2012/02/partial-word-search-spell-check-in-postgresql-9-using-trigram-trgm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

