<?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>Teguh Eko Budiarto &#187; Javascript</title>
	<atom:link href="http://teguheko.echodess.com/category/programming/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://teguheko.echodess.com</link>
	<description>Web Programming and Sharing Experience</description>
	<lastBuildDate>Tue, 23 Aug 2011 03:58:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>How to make Python enable to download package from internet</title>
		<link>http://teguheko.echodess.com/2009/10/how-to-make-python-enable-to-download-package-from-internet/</link>
		<comments>http://teguheko.echodess.com/2009/10/how-to-make-python-enable-to-download-package-from-internet/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 01:25:41 +0000</pubDate>
		<dc:creator>Teguh Eko Budiarto</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[setuptools]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://teguheko.echodess.com/?p=68</guid>
		<description><![CDATA[This tip is for windows XP user ( some other windows version will also have similar procedure). If you are using an automatic configuration script for your internet setting, most probably, Python will not be able to connect to internet. This is troublesome if you want to install some packages which has dependencies which need [...]]]></description>
			<content:encoded><![CDATA[<p>This tip is for windows XP user ( some other windows version will also have similar procedure).</p>
<p>If you are using an automatic configuration script for your internet setting, most probably, Python will not be able to connect to internet. This is troublesome if you want to install some packages which has dependencies which need to be fetched from the net. You need to change your internet options setting to use the proxy address directly.</p>
<p>Below is how to do that:</p>
<ul>
<li>Go to Control Panel</li>
<li>Open Internet Options</li>
<li>Open Connection Tab</li>
<li>Click on <strong>LAN Settings</strong> button</li>
<li>Check the <em>Use a proxy server for your LAN&#8230;</em></li>
<li>Enter the <strong>proxy IP Address </strong>and its <strong>port</strong>. If you do not know where it is, ask your network administrator or just open the configuration script to find out where is the IP you need to use.</li>
<li>Press OK until all the setting windows are closed.</li>
</ul>
<p>Below is the screen shot of the internet options screen.</p>
<div id="attachment_69" class="wp-caption aligncenter" style="width: 544px"><img class="size-full wp-image-69" title="Internet Options Setting" src="http://teguheko.echodess.com/wp-content/uploads/2009/10/internetoptions.jpg" alt="Windows XP Professional Internet Options Screen" width="534" height="539" /><p class="wp-caption-text">Windows XP Professional Internet Options Screen</p></div>
]]></content:encoded>
			<wfw:commentRss>http://teguheko.echodess.com/2009/10/how-to-make-python-enable-to-download-package-from-internet/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>JQuery AutoComplete Search per Word</title>
		<link>http://teguheko.echodess.com/2009/09/jquery-autocomplete-search-per-word/</link>
		<comments>http://teguheko.echodess.com/2009/09/jquery-autocomplete-search-per-word/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 08:42:17 +0000</pubDate>
		<dc:creator>Teguh Eko Budiarto</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://teguheko.echodess.com/?p=35</guid>
		<description><![CDATA[I was using JQuery autocomplete from Jörn Zaefferer to finish a small project for Computer Telephony &#8211; IPX PBX user interface. I think this is an awesome plugin ad it is suited very well for my project. For the project, I need the autocomplete to be able to search all data containing words which begins [...]]]></description>
			<content:encoded><![CDATA[<p>I was using JQuery autocomplete from <a href="http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/">Jörn Zaefferer</a> to finish a small project for Computer Telephony &#8211; IPX PBX user interface. I think this is an awesome plugin ad it is suited very well for my project. </p>
<p>For the project, I need the autocomplete to be able to search all data containing words which begins with the text being typed in the input textbox. However, after browsing through the documentation and try the possible combination of <strong>matchContains</strong> and <strong>matchSubset</strong> options of the plugin, it seems that it was not able to do what I want it to do. So, I decided to debug the javascript and go into the code to modify the search algorithm. </p>
<p>When I look into the code, I found this part of code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> matchSubset<span style="color: #009900;">&#40;</span>s<span style="color: #339933;">,</span> sub<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>options.<span style="color: #660066;">matchCase</span><span style="color: #009900;">&#41;</span> 
        s <span style="color: #339933;">=</span> s.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> s.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>sub<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">matchContains</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;word&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        i <span style="color: #339933;">=</span> s.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">search</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>b&quot;</span> <span style="color: #339933;">+</span> sub.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> i <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">||</span> options.<span style="color: #660066;">matchContains</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>In the fifth line of the function, there is a value check for <strong>matchContains</strong> option which implies that it received &#8220;word&#8221; value besides boolean true or false. The code uses the javascript search function with regex using <strong>\b</strong> tag which means word boundary. This means that it already have the functionality to search for subset contained in each word of the search data.<br />
I immediately changed my code to try to use the option by adding this line:</p>
<p><code>matchContains:"word"</code></p>
<p>So, the whole code to activate the autocomplete textbox is as below:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#searchInput&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">autocomplete</span><span style="color: #009900;">&#40;</span>json.<span style="color: #660066;">Data</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
    cacheLength<span style="color: #339933;">:</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span>
    delay<span style="color: #339933;">:</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>
    formatItem<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> sShow <span style="color: #339933;">=</span> row.<span style="color: #000066;">Name</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; - (&quot;</span> <span style="color: #339933;">+</span> row.<span style="color: #660066;">TypePhone</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;) &quot;</span> <span style="color: #339933;">+</span> row.<span style="color: #660066;">Phone</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> sShow<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    matchContains<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;word&quot;</span><span style="color: #339933;">,</span>
    matchSubset<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
    max<span style="color: #339933;">:</span><span style="color: #CC0000;">100</span><span style="color: #339933;">,</span>
    minChars<span style="color: #339933;">:</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span>
    width<span style="color: #339933;">:</span><span style="color: #CC0000;">285</span><span style="color: #339933;">,</span>
    selectFirst<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
    scrollHeight<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;100px&quot;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>After that, I try to find in the author&#8217;s website and <a href="http://docs.jquery.com/Plugins/Autocomplete">JQuery documentation </a>where in the world that option is being documented. At last I found it in the <a href="http://jquery.bassistance.de/autocomplete/changelog.txt">change log</a> for the latest version 1.1 (per this post date). It should be also written in the JQuery plugin documentation, since it is a very useful feature, at least for me at the time <img src='http://teguheko.echodess.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . I hope the author would update the documentation accordingly soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://teguheko.echodess.com/2009/09/jquery-autocomplete-search-per-word/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

