<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Baldo's web log</title>
    <link>http://blog.baldiyo.com</link>
    <description>My personal Web log</description>
    <item>
      <title>New Live, New People</title>
      <link>http://blog.baldiyo.com/posts/new-live-new-people.html</link>
      <description>
&lt;p&gt;Recently I moved to Monterrey Mexico, I met a very nice girl and now I live with her, she is great (and pretty), her friends are great too (hehe, we  already got drunk) and also I've met many amazing people at work. It's great when I have many new people in my live, it's a fantastic feeling that is very difficult to describe. &lt;/p&gt;

&lt;p&gt;At the time of writing this post, I have no Internet access, I can't believe I been without Internet during the past three weeks, even more, I can't believe I'm survive, hehe!. Literally, I used to have my brain connected to an Access Point (AP), but now I'm learning to live without it. Now I use to do normal things, like listen to music, go to the supermarket, go for a walk, talk with people (of course, not in a chat room). By the way I'm learning to play guitar, it's very difficult and I can't play well, but as they say: &quot;I already win by try&quot;. &lt;/p&gt;

&lt;p&gt;Well, I hope to enjoy the best of this city and met many interesting people while I'm here.&lt;/p&gt;

&lt;p&gt;&lt;i&gt;I'm writing this on October 01 2009, It's a beautiful night, just stop raining and thundering.&lt;/i&gt;&lt;/p&gt;

&lt;br /&gt;

&lt;p&gt;&lt;i&gt;UPDATE 1 on Oct 18 2009: Now the enchant is GONE, the hope is GONE and everything seems to be GONE; and I'm starting to hate weekends. This place is really boring, probably this is not my place and I don't belong here...&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;i&gt;UPDATE 2 on Nov 10 2009: Brain connected to an Access Point again.&lt;/i&gt;&lt;/p&gt;


</description>
      <dc:creator>baldo</dc:creator>
      <dc:date>2009-10-20T19:06:00-05:00</dc:date>
    </item>
    <item>
      <title>Measures of distance between two n-dimensional points, Hamming distance and Euclidean distance</title>
      <link>http://blog.baldiyo.com/posts/measures-distance-between-two-n-dimensional-points-mamming-distance-euclidean-distance.html</link>
      <description>
&lt;p&gt;&lt;b&gt;Proposition&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Let  &lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-1.png&quot; alt=&quot;&quot;  /&gt;   and &lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-2.png&quot; alt=&quot;&quot;  /&gt; be two vectors in n-dimensional Euclidean space, subject to the condition &lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-3.png&quot; alt=&quot;&quot;  /&gt; ,  so that  both vectors x,y are also in Hamming space.&lt;/p&gt;

&lt;p&gt;Hamming space is defined by:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-4.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;i&gt;where:&lt;/i&gt;&lt;/p&gt;
 
&lt;p&gt;&lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-5.png&quot; alt=&quot;&quot;  /&gt;&lt;i&gt; is a set of n-dimensional vectors, each component is a real number &lt;/i&gt;&lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-6.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-7.png&quot; alt=&quot;&quot;  /&gt;&lt;i&gt; condition that each component is restricted to the values &lt;/i&gt;&lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-8.png&quot; alt=&quot;&quot;  /&gt; &lt;/p&gt;


&lt;p&gt;&lt;b&gt;Relationship&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The Hamming distance has a relationship to the Euclidean distance according to the following formulas:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-9.png&quot; alt=&quot;&quot; /&gt; &lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-10.png&quot; alt=&quot;&quot; /&gt; &lt;/p&gt;

&lt;p&gt;&lt;b&gt;Euclidean distance&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The Euclidean distance (d) between two n-dimensional vectors is given by:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-11.png&quot; alt=&quot;&quot; /&gt; &lt;/p&gt;

&lt;p&gt;Which can be reduced to:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-12.png&quot; alt=&quot;&quot; /&gt; &lt;/p&gt;

&lt;p&gt;&lt;i&gt;where:&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;i&gt;#dc is the number of components that are different between x  and y &lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;i&gt;Since:&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-13.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt; 

&lt;p&gt;Note: the Hamming distance can be determined according to the prior relationship&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Exercises:&lt;/b&gt;&lt;/p&gt;  

&lt;p&gt;1.-  Determine the Hamming distance between &lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-14.png&quot; alt=&quot;&quot; /&gt;, &lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-15.png&quot; alt=&quot;&quot;  /&gt;&lt;/p&gt;

&lt;p&gt;2.- Write a C/C++  program to determine the hamming distance between &lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-16.png&quot; alt=&quot;&quot;  /&gt;, &lt;img src=&quot;http://blog.baldiyo.com/img/math/hamming-euclidean-17.png&quot; alt=&quot;&quot;  /&gt;&lt;/p&gt;





</description>
      <dc:creator>baldo</dc:creator>
      <dc:date>2009-09-12T23:14:00-05:00</dc:date>
    </item>
    <item>
      <title>Quick guide to enable Graphics Acceleration on Mobile Intel® 945GM Express Chipset</title>
      <link>http://blog.baldiyo.com/posts/graphics-acceleration-mobile-intel-945GM-express-chipset.html</link>
      <description>
&lt;p&gt;&lt;b&gt;Checking if graphics acceleration already enabled&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Required package:&lt;/p&gt;
&lt;p&gt;* mesa-utls &lt;/p&gt;

&lt;pre&gt;
# glxgears
524 frames in 5.0 seconds = 104.564 FPS
486 frames in 5.1 seconds = 95.546 FPS
540 frames in 5.0 seconds = 107.794 FPS
420 frames in 5.0 seconds = 83.957 FPS
480 frames in 5.1 seconds = 93.990 FPS
&lt;/pre&gt;

&lt;p&gt;You can see the very poor rate of frames per second. It seems direct rendering is not enabled.&lt;/p&gt;

&lt;pre&gt;
# glxinfo | grep direct
direct rendering: No (If you want to find out why, try setting LIBGL_DEBUG=verbose)
OpenGL renderer string: Mesa GLX Indirect
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;Enabling graphics acceleration&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Required packages:&lt;/p&gt;

&lt;p&gt;* xserver-xorg-video-i810&lt;/p&gt; 
&lt;p&gt;* libgl1-mesa-dri&lt;/p&gt;

&lt;pre&gt;
# glxgears
3374 frames in 5.0 seconds = 674.634 FPS
3499 frames in 5.0 seconds = 699.728 FPS
2674 frames in 5.0 seconds = 534.604 FPS

# glxinfo | grep direct
direct rendering: Yes

&lt;/pre&gt;

&lt;p&gt;Now, with direct rendering enabled, I get a high rate of frames per second.&lt;/p&gt;


</description>
      <dc:creator>baldo</dc:creator>
      <dc:date>2009-09-02T01:16:00-05:00</dc:date>
    </item>
    <item>
      <title>Auto-complete with JQuery</title>
      <link>http://blog.baldiyo.com/posts/jquery-suggest-auto-complete-code-php-mysql-ajax.html</link>
      <description>
&lt;p&gt; Recently I coded a JQuery version of a feature I've been using in some projects. Basically this feature is a PHP script that queries a MySQL database and displays a list of possible input keywords using AJAX. It is based on the idea of Google suggest.&lt;/p&gt;

&lt;p&gt;Here is an example:&lt;/p&gt;

&lt;p style=&quot;text-align:center;&quot;&gt;&lt;img src=&quot;http://blog.baldiyo.com/img/ac-jquery.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here is the code to accomplish that fancy behaviour.&lt;/p&gt;

&lt;p&gt;Note: I´m using the world database, you can download it from &lt;a  href='http://dev.mysql.com/doc/' &gt;the MySql documentation&lt;/a&gt;&lt;/p&gt;

&lt;br /&gt;

&lt;p&gt;&lt;b&gt;autocomp.php&lt;/b&gt;&lt;/p&gt;

&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;    1 &lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;&amp;lt;&lt;/span&gt;?php
&lt;span class=&quot;line&quot;&gt;    2 &lt;/span&gt;   &lt;span class=&quot;kwb&quot;&gt;$USER&lt;/span&gt; &lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;someuser&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    3 &lt;/span&gt;   &lt;span class=&quot;kwb&quot;&gt;$PASS&lt;/span&gt; &lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;somepass&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    4 &lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    5 &lt;/span&gt;   &lt;span class=&quot;kwb&quot;&gt;$conn&lt;/span&gt; &lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;kwa&quot;&gt;mysql_connect&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;localhost&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kwb&quot;&gt;$USER&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kwb&quot;&gt;$PASS&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    6 &lt;/span&gt;  &lt;span class=&quot;slc&quot;&gt;// R�union  = Réunion&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    7 &lt;/span&gt;   &lt;span class=&quot;kwa&quot;&gt;mysql_query&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;SET NAMES 'utf8'&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    8 &lt;/span&gt;   &lt;span class=&quot;kwa&quot;&gt;mysql_select_db&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;world&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kwb&quot;&gt;$conn&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    9 &lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   10 &lt;/span&gt;   &lt;span class=&quot;slc&quot;&gt;//trim searchKeyword&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   11 &lt;/span&gt;   &lt;span class=&quot;kwb&quot;&gt;$searchKeyword&lt;/span&gt; &lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kwa&quot;&gt;trim&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwb&quot;&gt;$_POST&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;searchKeywordTmp&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;]);&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   12 &lt;/span&gt;  &lt;span class=&quot;slc&quot;&gt;//clean searchKeyword&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   13 &lt;/span&gt;   &lt;span class=&quot;kwb&quot;&gt;$searchKeyword&lt;/span&gt; &lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt; mysql_real_escape_string&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwb&quot;&gt;$searchKeyword&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kwb&quot;&gt;$conn&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   14 &lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   15 &lt;/span&gt;   &lt;span class=&quot;kwa&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;isset&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwb&quot;&gt;$searchKeyword&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;) &amp;amp;&amp;amp; (&lt;/span&gt;&lt;span class=&quot;kwb&quot;&gt;$searchKeyword&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;)){&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   16 &lt;/span&gt;       &lt;span class=&quot;kwb&quot;&gt;$query&lt;/span&gt; &lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;SELECT Name FROM Country&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   17 &lt;/span&gt;       &lt;span class=&quot;kwb&quot;&gt;$query&lt;/span&gt; .&lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot; WHERE Name LIKE '$searchKeyword%' LIMIT 5&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   18 &lt;/span&gt;       &lt;span class=&quot;kwa&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwb&quot;&gt;$result&lt;/span&gt; &lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kwa&quot;&gt;mysql_query&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwb&quot;&gt;$query&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;)){&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   19 &lt;/span&gt;            &lt;span class=&quot;kwb&quot;&gt;$flag&lt;/span&gt; &lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;num&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   20 &lt;/span&gt;            &lt;span class=&quot;kwa&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwb&quot;&gt;$dataArray&lt;/span&gt; &lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kwa&quot;&gt;mysql_fetch_array&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwb&quot;&gt;$result&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;)){&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   21 &lt;/span&gt;                 &lt;span class=&quot;kwb&quot;&gt;$data&lt;/span&gt; &lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kwb&quot;&gt;$dataArray&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;];&lt;/span&gt; ?&lt;span class=&quot;sym&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   22 &lt;/span&gt;                 &lt;span class=&quot;sym&quot;&gt;&amp;lt;&lt;/span&gt;li onclick&lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;fill('&amp;lt;?php echo $data; ?&amp;gt;');&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   23 &lt;/span&gt;			&lt;span class=&quot;sym&quot;&gt;&amp;lt;&lt;/span&gt;?php &lt;span class=&quot;kwa&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;kwb&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;;&lt;/span&gt; ?&lt;span class=&quot;sym&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   24 &lt;/span&gt;                 &lt;span class=&quot;sym&quot;&gt;&amp;lt;/&lt;/span&gt;li&lt;span class=&quot;sym&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;?php
&lt;span class=&quot;line&quot;&gt;   25 &lt;/span&gt;                 &lt;span class=&quot;kwb&quot;&gt;$flag&lt;/span&gt; &lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;num&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   26 &lt;/span&gt;              &lt;span class=&quot;sym&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   27 &lt;/span&gt;              &lt;span class=&quot;kwa&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwb&quot;&gt;$flag&lt;/span&gt; &lt;span class=&quot;sym&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;num&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   28 &lt;/span&gt;                 &lt;span class=&quot;kwa&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;Your search keyword is incorrect.&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;slc&quot;&gt;//empty query&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   29 &lt;/span&gt;        &lt;span class=&quot;sym&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;kwa&quot;&gt;else&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   30 &lt;/span&gt;             &lt;span class=&quot;kwa&quot;&gt;echo mysql_error&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   31 &lt;/span&gt;    &lt;span class=&quot;sym&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;else echo&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;ERR&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   32 &lt;/span&gt;?&lt;span class=&quot;sym&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;suggest.js&lt;/b&gt;&lt;/p&gt;

&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;    1 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;var&lt;/span&gt; flag &lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;num&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    2 &lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    3 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;kwd&quot;&gt;suggest&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;searchKeyword&lt;span class=&quot;sym&quot;&gt;){&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    4 &lt;/span&gt;   &lt;span class=&quot;slc&quot;&gt;//using ajax and jquery for asynchronous update&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    5 &lt;/span&gt;   $&lt;span class=&quot;sym&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;autocomp.php&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;, {&lt;/span&gt;searchKeywordTmp&lt;span class=&quot;sym&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;+&lt;/span&gt;searchKeyword&lt;span class=&quot;sym&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    6 &lt;/span&gt;       &lt;span class=&quot;kwa&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;data&lt;span class=&quot;sym&quot;&gt;){&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    7 &lt;/span&gt;          &lt;span class=&quot;kwa&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;data &lt;span class=&quot;sym&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;ERR&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    8 &lt;/span&gt;             $&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;#suggestions&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    9 &lt;/span&gt;          &lt;span class=&quot;kwa&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   10 &lt;/span&gt;		    $&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;#suggestions&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   11 &lt;/span&gt;		    $&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;#suggestionsList&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;data&lt;span class=&quot;sym&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   12 &lt;/span&gt;          &lt;span class=&quot;sym&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   13 &lt;/span&gt;       &lt;span class=&quot;sym&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   14 &lt;/span&gt;   &lt;span class=&quot;sym&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   15 &lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;slc&quot;&gt;//end function suggest&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   16 &lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   17 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;kwd&quot;&gt;fill&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;thisValue&lt;span class=&quot;sym&quot;&gt;) {&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   18 &lt;/span&gt;   $&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;#searchBox&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;thisValue&lt;span class=&quot;sym&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   19 &lt;/span&gt;   $&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;#suggestions&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   20 &lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;slc&quot;&gt;//end function fill&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   21 &lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   22 &lt;/span&gt;&lt;span class=&quot;slc&quot;&gt;//disable browser' auto-complete&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   23 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;kwd&quot;&gt;disAutoComplete&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;obj&lt;span class=&quot;sym&quot;&gt;){&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   24 &lt;/span&gt;    &lt;span class=&quot;kwa&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;flag&lt;span class=&quot;sym&quot;&gt;){&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   25 &lt;/span&gt;  	obj&lt;span class=&quot;sym&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;autocomplete&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;off&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   26 &lt;/span&gt;         flag &lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;num&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   27 &lt;/span&gt;    &lt;span class=&quot;sym&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   28 &lt;/span&gt;    &lt;span class=&quot;kwc&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kwc&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;sym&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;#tc&amp;quot;&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   29 &lt;/span&gt;    obj&lt;span class=&quot;sym&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kwc&quot;&gt;focus&lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   30 &lt;/span&gt;&lt;span class=&quot;sym&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;suggest.html&lt;/b&gt;&lt;/p&gt;

&lt;pre&gt;&lt;span class=&quot;line&quot;&gt;    1 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    2 &lt;/span&gt;    &lt;span class=&quot;str&quot;&gt;&amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&lt;/span&gt;&amp;gt;
&lt;span class=&quot;line&quot;&gt;    3 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;lt;html xmlns=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt; xml:lang=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;en&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt; lang=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;en&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt; dir=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;ltr&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    4 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    5 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;lt;meta http-equiv=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;Content-Type&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt; content=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;text/html; charset=utf-8&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    6 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;lt;link rel='stylesheet' type='text/css' href='style.css' media='screen'/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    7 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;lt;script src=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;js/jquery-1.3.2.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt; type=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    8 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;lt;script src=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;js/suggest.js&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt; type=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;    9 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   10 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   11 &lt;/span&gt;   &lt;span class=&quot;kwa&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   12 &lt;/span&gt;     &lt;span class=&quot;kwa&quot;&gt;&amp;lt;b&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   13 &lt;/span&gt;       &lt;span class=&quot;kwa&quot;&gt;&amp;lt;span id=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;tc&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;gt;&lt;/span&gt;Type a country name:&lt;span class=&quot;kwa&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   14 &lt;/span&gt;     &lt;span class=&quot;kwa&quot;&gt;&amp;lt;/b&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   15 &lt;/span&gt;   &lt;span class=&quot;kwa&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   16 &lt;/span&gt;   &lt;span class=&quot;kwa&quot;&gt;&amp;lt;input size=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;30&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt; type=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;text&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt; id=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;searchBox&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt; onkeyup=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;suggest(this.value);&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   17 &lt;/span&gt;    onclick=&lt;span class=&quot;str&quot;&gt;&amp;quot;disAutoComplete(this);&amp;quot;&lt;/span&gt; /&amp;gt;
&lt;span class=&quot;line&quot;&gt;   18 &lt;/span&gt;   &lt;span class=&quot;kwa&quot;&gt;&amp;lt;div class=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;suggestionsBox&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt; id=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;suggestions&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt; style=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;display: none;&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   19 &lt;/span&gt;	    &lt;span class=&quot;kwa&quot;&gt;&amp;lt;img src=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;img/upArrow.png&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt; alt=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;upArrow&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   20 &lt;/span&gt;        style=&lt;span class=&quot;str&quot;&gt;&amp;quot;position: relative; top: -10px; left: 30px&amp;quot;&lt;/span&gt; /&amp;gt;
&lt;span class=&quot;line&quot;&gt;   21 &lt;/span&gt;	    &lt;span class=&quot;kwa&quot;&gt;&amp;lt;div  class=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;suggestionsList&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt; id=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;suggestionsList&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   22 &lt;/span&gt;   &lt;span class=&quot;kwa&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   23 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;   24 &lt;/span&gt;&lt;span class=&quot;kwa&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The example has been changed to save resources in the new server, now I use a screenshot.&lt;/p&gt;

</description>
      <dc:creator>baldo</dc:creator>
      <dc:date>2009-08-25T00:41:00-05:00</dc:date>
    </item>
    <item>
      <title>Road-Warrior - Routing all client's internet traffic through the VPN</title>
      <link>http://blog.baldiyo.com/posts/openvpn-roadwarrior-routing-internet-traffic-through-vpn.html</link>
      <description>
&lt;p&gt;&lt;b&gt;Prerequisites&lt;/b&gt;&lt;/p&gt; 

&lt;p&gt;&lt;a href=&quot;http://blog.baldiyo.com/posts/road-warrior(host-to-net)-configuration-openvpn.html&quot;&gt;Road-Warrior(Host to Net) configuration with OpenVPN&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;IP forwarding&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;With IP forwarding you can set your Linux box to act as a router. To enable IP forwarding as root issue the following command.&lt;/p&gt;

&lt;pre&gt;# echo &quot;1&quot; &gt; /proc/sys/net/ipv4/ip_forward&lt;/pre&gt;

&lt;p&gt;Note: To enable by default when your system boots up edit the &quot;/etc/sysctl.conf&quot; (on a Debian system).&lt;/p&gt;

&lt;pre&gt;
# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;Masquerading or packet mangling&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Since Internet routers can not forward traffic from private IP addresses you need to invoke IP masquerading. Masquerading is when your Linux system rewrites the IP headers of network packets so the network packet appears to originate from a non-private IP address.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Iptables rules.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;This is the set of iptables rules that I use for IP forwarding and packet mangling.&lt;/p&gt;

&lt;pre&gt;
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i tun+ -j ACCEPT
-A FORWARD -i tun+ -j ACCEPT
-A FORWARD -o tun+ -j ACCEPT
.
.
*nat
:PREROUTING ACCEPT [244:17449]
:POSTROUTING ACCEPT [2:486]
:OUTPUT ACCEPT [2:486]
-A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
.
.
.
&lt;/pre&gt;

&lt;p&gt;Finally in your server configuration file, add the following line and restart the OpenVPN:&lt;/p&gt;

&lt;pre&gt;
push &quot;redirect-gateway def1&quot;
&lt;/pre&gt;

&lt;p&gt;Basically all traffic coming from the internal network(tun0) is forwarded to the Internet through the eth0 interface. Now all the Internet sites I visit record the IP of the OpenVPN server not the IP given by my ISP. One useful application for this configuration is that you can avoid the lack of security on wireless  networks, because you connect to the Internet through the VPN.&lt;/p&gt;

</description>
      <dc:creator>baldo</dc:creator>
      <dc:date>2009-08-11T03:16:00-05:00</dc:date>
    </item>
  </channel>
</rss>
