<?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>MySQL &#8211; James Lin&#039;s Blog</title>
	<atom:link href="https://james.lin.net.nz/category/technology/database/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>https://james.lin.net.nz</link>
	<description>Just bits and pieces of my life</description>
	<lastBuildDate>Fri, 19 Jan 2018 22:42:50 +0000</lastBuildDate>
	<language>en-NZ</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.9.2</generator>
<site xmlns="com-wordpress:feed-additions:1">22801464</site>	<item>
		<title>New technology to crack down on house-flipping</title>
		<link>https://james.lin.net.nz/2017/03/10/new-technology-to-crack-down-on-house-flipping/</link>
		<comments>https://james.lin.net.nz/2017/03/10/new-technology-to-crack-down-on-house-flipping/#respond</comments>
		<pubDate>Thu, 09 Mar 2017 20:44:22 +0000</pubDate>
		<dc:creator><![CDATA[James Lin]]></dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://james.lin.net.nz/?p=3930</guid>
		<description><![CDATA[Just read an article on cracking down house flipping in NZ, it says &#8220;New Zealand&#8217;s real estate watchdog is ramping up its crackdown on house-flipping by investing in new technology which allows it to track when properties have been quickly re-sold for huge profits.&#8221; So what&#8217;s the new technology is about? You would have thought… <span class="read-more"><a href="https://james.lin.net.nz/2017/03/10/new-technology-to-crack-down-on-house-flipping/">Read More &#187;</a></span>]]></description>
				<content:encoded><![CDATA[<p>Just read an article on cracking down house flipping in NZ, it says &#8220;New Zealand&#8217;s real estate watchdog is ramping up its crackdown on house-flipping by investing in new technology which allows it to track when properties have been quickly re-sold for huge profits.&#8221;</p>
<p>So what&#8217;s the new technology is about? You would have thought there is a database table with a simple SQL query like this:</p><pre class="crayon-plain-tag">select * from sales_record r1 left join sales_record r2 on r1.title_no = r2.title_no and r1.id &lt; r2.id where datediff(r2.sales_date, r1.sales_date) &lt; 30;</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://james.lin.net.nz/2017/03/10/new-technology-to-crack-down-on-house-flipping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<post-id xmlns="com-wordpress:feed-additions:1">3930</post-id>	</item>
		<item>
		<title>Installing Python Mysql Adapter On Mac OSX</title>
		<link>https://james.lin.net.nz/2013/02/12/installing-python-mysql-adapter-on-mac-osx/</link>
		<comments>https://james.lin.net.nz/2013/02/12/installing-python-mysql-adapter-on-mac-osx/#comments</comments>
		<pubDate>Mon, 11 Feb 2013 18:40:42 +0000</pubDate>
		<dc:creator><![CDATA[James Lin]]></dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://james.lin.net.nz/?p=1310</guid>
		<description><![CDATA[First download and install mysql for Mac OSX Install virtualenv, create a virtualenv and activate it Pip install mysql-python, and you will see an error &#8220;EnvironmentError: mysql_config not found&#8221; Find the mysql_config by running &#8220;sudo find / -name &#8216;mysql_config'&#8221; Go to your /path to virtualenv/build/mysql-python Edit site.cfg Uncomment this line &#8220;#mysql_config = /usr/local/bin/mysql_config&#8221; and change… <span class="read-more"><a href="https://james.lin.net.nz/2013/02/12/installing-python-mysql-adapter-on-mac-osx/">Read More &#187;</a></span>]]></description>
				<content:encoded><![CDATA[<p><a href="https://i1.wp.com/james.lin.net.nz/wp-content/uploads/2013/02/python-logo.gif"><img class="alignnone size-full wp-image-1316" alt="python-logo" src="https://i1.wp.com/james.lin.net.nz/wp-content/uploads/2013/02/python-logo.gif?resize=211%2C71" data-recalc-dims="1" /></a><img class="alignnone size-full wp-image-1313" alt="logo-mysql-110x57" src="https://i1.wp.com/james.lin.net.nz/wp-content/uploads/2013/02/logo-mysql-110x57.png?resize=110%2C57" data-recalc-dims="1" /></p>
<ol>
<li>First download and install mysql for Mac OSX</li>
<li>Install virtualenv, create a virtualenv and activate it</li>
<li>Pip install mysql-python, and you will see an error &#8220;EnvironmentError: mysql_config not found&#8221;</li>
<li>Find the mysql_config by running &#8220;sudo find / -name &#8216;mysql_config'&#8221;</li>
<li>Go to your /path to virtualenv/build/mysql-python</li>
<li>Edit site.cfg</li>
<li>Uncomment this line &#8220;#mysql_config = /usr/local/bin/mysql_config&#8221; and change the path to what you found in step 4</li>
<li>Then run &#8220;python setup.py install&#8221;</li>
<li>if you get &#8220;Library not loaded: libmysqlclient.18.dylib&#8221; when using the adapter</li>
<li>Then symlink this file: &#8220;sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib&#8221;</li>
</ol>
<p>To control the server:</p><pre class="crayon-plain-tag">sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart</pre><p></p>
]]></content:encoded>
			<wfw:commentRss>https://james.lin.net.nz/2013/02/12/installing-python-mysql-adapter-on-mac-osx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<post-id xmlns="com-wordpress:feed-additions:1">1310</post-id>	</item>
		<item>
		<title>MySQL locate function</title>
		<link>https://james.lin.net.nz/2012/03/01/mysql-locate-function/</link>
		<comments>https://james.lin.net.nz/2012/03/01/mysql-locate-function/#respond</comments>
		<pubDate>Wed, 29 Feb 2012 20:28:32 +0000</pubDate>
		<dc:creator><![CDATA[James Lin]]></dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://james.lin.net.nz/?p=1010</guid>
		<description><![CDATA[So everyone knows sql LIKE to search wildcard matches the criteria. How about in a situation that you need to return all the rows that has value is part of the criteria string. eg. given a full URL http://www.abc.com/bl/abcdefg/, return all the rows with uri_part field that values are part of the URL string. [crayon-5a652d7f936e4347127934/]… <span class="read-more"><a href="https://james.lin.net.nz/2012/03/01/mysql-locate-function/">Read More &#187;</a></span>]]></description>
				<content:encoded><![CDATA[<p>So everyone knows sql LIKE to search wildcard matches the criteria. How about in a situation that you need to return all the rows that has value is part of the criteria string.</p>
<p>eg. given a full URL http://www.abc.com/bl/abcdefg/, return all the rows with uri_part field that values are part of the URL string.</p>
<p></p><pre class="crayon-plain-tag">+------------+
|uri_part    |
+------------+
|/bl/&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;  |
|/bl/abc/    |
|/ba/abc/    |
+------------+</pre><p></p>
<p>Normally LIKE statement works on the other way around, so you need to use LOCATE function. So in this example would be:</p>
<p></p><pre class="crayon-plain-tag">SELECT uri_part FROM table WHERE locate(uri_part, 'http://www.abc.com/bl/abcdefg/');</pre><p></p>
]]></content:encoded>
			<wfw:commentRss>https://james.lin.net.nz/2012/03/01/mysql-locate-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<post-id xmlns="com-wordpress:feed-additions:1">1010</post-id>	</item>
	</channel>
</rss>
