<?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"
	>

<channel>
	<title>GeekyBoy.com</title>
	<atom:link href="http://www.geekyboy.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.geekyboy.com</link>
	<description>Yep, another Geek weblog</description>
	<pubDate>Sat, 22 Nov 2008 02:17:21 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>TinyMCE URL rewrite problem editing emails (kinda solved)</title>
		<link>http://www.geekyboy.com/archives/136</link>
		<comments>http://www.geekyboy.com/archives/136#comments</comments>
		<pubDate>Wed, 12 Nov 2008 14:49:40 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
		
		<category><![CDATA[Quick Tips]]></category>

		<category><![CDATA[applications]]></category>

		<category><![CDATA[email]]></category>

		<category><![CDATA[images]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[tinymce]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=136</guid>
		<description><![CDATA[TinyMCE has a habit of rewriting the URL for images, etc.  However, this becomes broken when using TinyMCE to edit things like emails.  The relative path is totally useless in an email because the email is not being viewed from the server like a webpage would be.
To fix this I searched the tiny_mcs.js and found [...]]]></description>
			<content:encoded><![CDATA[<p>TinyMCE has a habit of rewriting the URL for images, etc.  However, this becomes broken when using TinyMCE to edit things like emails.  The relative path is totally useless in an email because the email is not being viewed from the server like a webpage would be.</p>
<p>To fix this I searched the tiny_mcs.js and found that TinyMCE had <strong>two</strong> settings in the tiny_mce.js file that are boolean flags (true,false or 0,1) dealing with URL&#8217;s. The variables are <em><strong>relative_urls</strong></em> and <em><strong>convert_urls</strong></em>, and by default they are set to true, or 1.</p>
<p>After changing these setting to false (or zero) I have not had any further problems with using TinyMCE to edit email content.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/archives/136/feed</wfw:commentRss>
		</item>
		<item>
		<title>Hard disk usage from command line on Linux</title>
		<link>http://www.geekyboy.com/archives/133</link>
		<comments>http://www.geekyboy.com/archives/133#comments</comments>
		<pubDate>Mon, 13 Oct 2008 19:41:56 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
		
		<category><![CDATA[Hardware]]></category>

		<category><![CDATA[OS]]></category>

		<category><![CDATA[Quick Tips]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[servers]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=133</guid>
		<description><![CDATA[From the command line I have found many great tools for system management, but really needed to dig into ways of tracking hard disk usage on Linux without the aid of GUI tools.  Google to the rescue!  I found a few places with great tips and hints on how to do this, but [...]]]></description>
			<content:encoded><![CDATA[<p>From the command line I have found many great tools for system management, but really needed to dig into ways of tracking hard disk usage on Linux without the aid of GUI tools.  Google to the rescue!  I found a few places with great tips and hints on how to do this, but one article on Linux.com came in very handy.  Here were my findings:</p>
<p>The <code>df</code> utility displays the disk space usage on all mounted filesystems. The <code>-T</code> option prints the filesystem type as well. By default, <code>df</code> measures the size in 1K blocks, which could be a little difficult for a desktop user to decipher. Use the <code>-h</code> option to get more understandable output:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">df</span> <span style="color: #660033;">-h</span> <span style="color: #660033;">-T</span>
Filesystem    Type    Size  Used Avail Use<span style="color: #000000; font-weight: bold;">%</span> Mounted on
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>hda6     ext3     20G  9.3G  9.1G  <span style="color: #000000;">51</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>hda7 reiserfs     13G  2.1G   11G  <span style="color: #000000;">17</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>suse
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda1     vfat    241M  152M   90M  <span style="color: #000000;">63</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>usbdisk</pre></div></div>

<p>You can use the <code>du</code> command to determine which files or directories need to be deleted &#8212; or at least trimmed. A simple <code>du</code> will print usage for the present working directory and its subdirectories, along with the size of each directory.</p>
<p>If you want the size of an particular directory, specify it with <code>du directoryname</code>. For instance, <code>du -h /home/bodhi/podcasts</code> will print the size of the podcasts directory in a more readable format than the kilobytes used by default. The <code>-c</code> option prints the grand total size of the directory at the end. The <code>-a</code> option also displays the file names along with directories and can be of use when you want to see a list of files in a particular directory. The <code>-s</code> option will display a summary, without showing all of the subdirectories.</p>
<p>Running <code>du -ch | grep total</code> prints just one line with the total size of the directory. If there&#8217;s a particular type of file that you would like to be excluded while calculating a directory&#8217;s usage, specify it with the <code>--exclude=type</code> option. Here we&#8217;ll check the disk usage of the current directory, and display all file names with their disk usage, and then sort them numerically using the sort utility:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-ah</span> | <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-n</span>
4.2M    .<span style="color: #000000; font-weight: bold;">/</span>eweek.10.28.05.mp3
4.5M    .<span style="color: #000000; font-weight: bold;">/</span>LQ-Podcast-101105.mp3
4.8M    .<span style="color: #000000; font-weight: bold;">/</span>LQ-Podcast-110905.mp3
19M     .<span style="color: #000000; font-weight: bold;">/</span>LQRadio-Episode3.mp3
20M     .<span style="color: #000000; font-weight: bold;">/</span>LQRadio-Searls.mp3
36M     .<span style="color: #000000; font-weight: bold;">/</span>LQRadio-HiserAndAdelstein.mp3
197M    .</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/archives/133/feed</wfw:commentRss>
		</item>
		<item>
		<title>Background image generator - BgPatterns.com</title>
		<link>http://www.geekyboy.com/archives/127</link>
		<comments>http://www.geekyboy.com/archives/127#comments</comments>
		<pubDate>Fri, 19 Sep 2008 15:19:53 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
		
		<category><![CDATA[css]]></category>

		<category><![CDATA[graphics]]></category>

		<category><![CDATA[html]]></category>

		<category><![CDATA[images]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=127</guid>
		<description><![CDATA[After Ian posted this on his blog I thougth I would follow suit. (He always seems to find the cool stuff.)
This very nifty site allows you to create tiled background images for use wherever you may need them.  At first I thought &#8220;yuck, I stopped using backgrounds long ago&#8221;.  But after playing with [...]]]></description>
			<content:encoded><![CDATA[<p>After Ian posted this on <a href="http://www.gen-x-design.com">his blog</a> I thougth I would follow suit. (He always seems to find the cool stuff.)</p>
<p>This very nifty site allows you to create tiled background images for use wherever you may need them.  At first I thought &#8220;yuck, I stopped using backgrounds long ago&#8221;.  But after playing with rotation, colors, and opacity I found that a pretty nice tiled background can be useful when applied right.</p>
<p>It is very difficult to do a good job on tiled backgrounds, but this site makes it easy.<br />
<a href="http://www.bgpatterns.com">www.BgPatterns.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/archives/127/feed</wfw:commentRss>
		</item>
		<item>
		<title>MySQL not creating mysql.sock and broken on Hardy Heron</title>
		<link>http://www.geekyboy.com/archives/122</link>
		<comments>http://www.geekyboy.com/archives/122#comments</comments>
		<pubDate>Sat, 13 Sep 2008 20:29:57 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
		
		<category><![CDATA[Databases]]></category>

		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[OS]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=122</guid>
		<description><![CDATA[Recently I started receiving errors when I tried to connect to MySQL using command line or PHPMyAdmin.  In command line I would get &#8220;ERROR 2002 (HY000): Can&#8217;t connect to local MySQL server through socket &#8216;/tmp/mysql.sock&#8217; (2)&#8221;, and with PHPMyAdmin I would get &#8220;#2002 - The server is not responding (or the local MySQL server&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I started receiving errors when I tried to connect to MySQL using command line or PHPMyAdmin.  In command line I would get &#8220;ERROR 2002 (HY000): Can&#8217;t connect to local MySQL server through socket &#8216;/tmp/mysql.sock&#8217; (2)&#8221;, and with PHPMyAdmin I would get &#8220;#2002 - The server is not responding (or the local MySQL server&#8217;s socket is not correctly configured)&#8221;.</p>
<p>The system in question is my Dell Inspiron 1720 running Hardy Heron Ubuntu.  I knew of a few changes to my system, but none of them seemed to have caused the problem.  So I hunted for a few days trying to figure it out.  I performed multiple searches on the net, and each led me to a dead end.  Many said, &#8220;Set this &#8230; in your php.ini&#8221; or &#8220;Set that &#8230; in your my.cnf&#8221;, and some even said Apache was to blame.  However, I found the solution to be very simple.</p>
<p>MySQL was expecting the mysql.sock to be located in &#8216;/tmp/mysql.sock&#8217;.  However, for some reason it had moved or the symbolic link to it&#8217;s actual location was deleted by some update or install I did recently.</p>
<p>I fixed the problem by adding a symbolic link to the actual home of mysqld.sock, which was /var/run/mysqld/mysqld.sock.  Here is how I created the symbolic link: (at the command line)</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>mysqld<span style="color: #000000; font-weight: bold;">/</span>mysqld.sock <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>mysql.sock</pre></div></div>

<p>sudo puts us in super user mode, &#8220;ln -s&#8221; creates a symbolic link followed by the target the links sould point to and last by the location of the link.</p>
<p><strong>Edited on Sep. 26th with update below:</strong></p>
<p>The fix above did not work as a permanent fix.  I found that whenever I rebooted the OS it forced me to recreate the symbolic link.  MySQL was failing to recreate the symbolic link on it&#8217;s own.  To permanently fix the issue I needed to add the creation of the symbolic link to my SESSION startup.  Here is how I did that:</p>
<p>By going to the System->Preferences->Sessions to edit the Startup Programs.  I added an item that automatically issues the command above, but without the &#8220;sudo&#8221;.</p>
<p>Mission accomplished&#8230;permanently.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/archives/122/feed</wfw:commentRss>
		</item>
		<item>
		<title>Ubuntu Hardy Heron sound broken</title>
		<link>http://www.geekyboy.com/archives/118</link>
		<comments>http://www.geekyboy.com/archives/118#comments</comments>
		<pubDate>Wed, 03 Sep 2008 13:35:22 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
		
		<category><![CDATA[Hardware]]></category>

		<category><![CDATA[OS]]></category>

		<category><![CDATA[Quick Tips]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<category><![CDATA[bluetooth]]></category>

		<category><![CDATA[dell]]></category>

		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=118</guid>
		<description><![CDATA[Recently I was having a consistent problem with the sound on my Dell Inspiron 1720, which is running on Ubuntu Hardy Heron.  It would consistently stop working all together, and I had a terrible time finding the cause of the problem.  If I viewed a flash video on the web, the sound would [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was having a consistent problem with the sound on my Dell Inspiron 1720, which is running on Ubuntu Hardy Heron.  It would consistently stop working all together, and I had a terrible time finding the cause of the problem.  If I viewed a flash video on the web, the sound would die afterwards.  If I listened to streaming Internet radio, the sound would die.  If I received an emial or IM the sound would die.</p>
<p>Finally it dawned on me, and I am not sure why or how.  But a few weeks prior I had been toying with a Bluetooth stereo headset and had turned on the Audio service in the Bluetooth manager on the services tab.</p>
<p><strong>Problem fixed:</strong> I simply turned off the Audio service in the Bluetooth manager, and all is working normally again.  However, if I ever need the Audio service I suppose it will break my sound.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/archives/118/feed</wfw:commentRss>
		</item>
		<item>
		<title>Hiding an email address using Javascript</title>
		<link>http://www.geekyboy.com/archives/48</link>
		<comments>http://www.geekyboy.com/archives/48#comments</comments>
		<pubDate>Fri, 29 Aug 2008 15:18:02 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
		
		<category><![CDATA[Quick Tips]]></category>

		<category><![CDATA[email]]></category>

		<category><![CDATA[html]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/?p=48</guid>
		<description><![CDATA[Have you ever wondered why you suddenly started getting tons of spam?
Do you have, or did you recently post your email address on a website?
Then the reason is probably because you did not properly protect the email address, and spammers get most email addresses from robot script that harvest email addresses from websites.  It [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wondered why you suddenly started getting tons of spam?</p>
<p>Do you have, or did you recently post your email address on a website?</p>
<p>Then the reason is probably because you did not properly protect the email address, and spammers get most email addresses from robot script that harvest email addresses from websites.  It is pretty simple really.  The robot script hits the largest search engines for certain key words or phrases, to help the spammer hit the most relevent email addresses, and then systematically follows the links to websites.  Once the robot gets to the website it then searches all links on the page.  Each link it finds on the page that is a &#8220;mailto:&#8221; is an email address, and in a matter of minutes a robot script can harvest hundreds of emails.</p>
<p>So now you are asking, &#8220;What can be done to protect me from these vile robots?&#8221;.  Well that answer is also simple.  Most robot script are not smart enough, yet, to search Javascript code that scrambles an email address and form it back into a valid email address.  So here is how to do it:</p>
<p>First, you need to go into the HTML code and insert the Javascript as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> theuser <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;username&quot;</span>; <span style="color: #006600; font-style: italic;">// change this to be the username, or portion of the email to the left of the @</span>
<span style="color: #003366; font-weight: bold;">var</span> thehost <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;your-domain.com&quot;</span>; <span style="color: #006600; font-style: italic;">// change this to be your domain name</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> themessage <span style="color: #339933;">=</span> theuser <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;@&quot;</span> <span style="color: #339933;">+</span> thehost;
&nbsp;
<span style="color: #006600; font-style: italic;">// Now we tell Javascript to bring the pieces of the email address together visually on the screen as a link</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;a href=&quot;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;mail&quot;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;to:&quot;</span> <span style="color: #339933;">+</span> theuser <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;@&quot;</span> <span style="color: #339933;">+</span> thehost <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;&gt;&quot;</span> <span style="color: #339933;">+</span> themessage <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;&lt;/a&gt;&quot;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>Note: Be sure to substitute <code>username</code> and <code>your-domain.com</code> with your own information.</p>
<p>Now when you view your webpage in your favorite browser (<a href="http://www.getfirefox.com">Firefox</a>) you will see the email as a link like you wanted, and the robots will see a bunch of code that most of them cannot form into a valid email address.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/archives/48/feed</wfw:commentRss>
		</item>
		<item>
		<title>SSH port forwarding/tunneling for MySQL connection</title>
		<link>http://www.geekyboy.com/archives/47</link>
		<comments>http://www.geekyboy.com/archives/47#comments</comments>
		<pubDate>Wed, 02 Jan 2008 22:09:50 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
		
		<category><![CDATA[Databases]]></category>

		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[OS]]></category>

		<category><![CDATA[Quick Tips]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[networking]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/archives/47</guid>
		<description><![CDATA[Create an account on the remote MySQL database server.

useradd -s /bin/false remote_user
mkdir /home/remote_user/.ssh
touch /home/remote_user/.ssh/authorized_keys
chown -R remote_user:remote_user /home/remote_user/.ssh
chmod 755 /home/remote_user/.ssh
chmod 600 /home/remote_user/.ssh/authorized_keys

Add MySQL permissions in the remote MySQL database to allow user connections from localhost.

USE mysql;
GRANT ALL ON db.* TO database_user@127.0.0.1 IDENTIFIED BY 'database_pass';
FLUSH PRIVILEGES;

Now, on the local server (as root) create an RSA key pair [...]]]></description>
			<content:encoded><![CDATA[<p>Create an account on the remote MySQL database server.</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">useradd <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">false</span> remote_user
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>remote_user<span style="color: #000000; font-weight: bold;">/</span>.ssh
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>remote_user<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>authorized_keys
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> remote_user:remote_user <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>remote_user<span style="color: #000000; font-weight: bold;">/</span>.ssh
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>remote_user<span style="color: #000000; font-weight: bold;">/</span>.ssh
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">600</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>remote_user<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>authorized_keys</pre></div></div>

<p>Add MySQL permissions in the remote MySQL database to allow user connections from localhost.</p>

<div class="wp_syntax"><div class="code"><pre class="sql sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">USE</span> mysql;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">ALL</span> <span style="color: #993333; font-weight: bold;">ON</span> db<span style="color: #66cc66;">.*</span> <span style="color: #993333; font-weight: bold;">TO</span> database_user@127<span style="color: #66cc66;">.</span>0<span style="color: #66cc66;">.</span>0<span style="color: #66cc66;">.</span>1 <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'database_pass'</span>;
<span style="color: #993333; font-weight: bold;">FLUSH</span> PRIVILEGES;</pre></div></div>

<p>Now, on the local server (as root) create an RSA key pair to avoide the need for passwords for remote_user. (Simply hit enter for each question encountered.)</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-t</span> rsa</pre></div></div>

<p>Now transfer the public key file to the remote server from your local server.</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">scp</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.pub root<span style="color: #000000; font-weight: bold;">@</span>remote_server.com:<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>local_server.local_rsa.pub
<span style="color: #c20cb9; font-weight: bold;">ssh</span> remote_server.com
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>local_server.local_rsa.pub <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>remote_user<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>authorized_keys</pre></div></div>

<p>On the local server, create an SSH tunnel to the remote MySQL database server using the following command.</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-fNg</span> <span style="color: #660033;">-L</span> <span style="color: #000000;">3306</span>:127.0.0.1:<span style="color: #000000;">3306</span> remote_user<span style="color: #000000; font-weight: bold;">@</span>remote_server.com <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">9999</span></pre></div></div>

<p>To use this from PHP you would simply do this:</p>

<div class="wp_syntax"><div class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #000088;">$remote_server_mysql</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;127.0.0.1&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;database_user&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;database_pass&quot;</span> <span style="color: #009900;">&#41;</span>;
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;database&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$remote_server_mysql</span> <span style="color: #009900;">&#41;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/archives/47/feed</wfw:commentRss>
		</item>
		<item>
		<title>Using the UNIX tail -f command to watch log files</title>
		<link>http://www.geekyboy.com/archives/46</link>
		<comments>http://www.geekyboy.com/archives/46#comments</comments>
		<pubDate>Tue, 04 Dec 2007 20:26:12 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
		
		<category><![CDATA[OS]]></category>

		<category><![CDATA[Quick Tips]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[servers]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/archives/46</guid>
		<description><![CDATA[When troubleshooting a problem in Apache it is a pain to open the log file, find an error, close the log file, and then open it again after you perform some action.  This is why &#8216;tail&#8217; is so handy.
Simply use the command below to view the last 100 lines of a log file, and [...]]]></description>
			<content:encoded><![CDATA[<p>When troubleshooting a problem in Apache it is a pain to open the log file, find an error, close the log file, and then open it again after you perform some action.  This is why &#8216;tail&#8217; is so handy.</p>
<p>Simply use the command below to view the last 100 lines of a log file, and as new entries are added to the file they are automatically displayed on the screen.</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>the<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">file</span><span style="color: #000000; font-weight: bold;">/</span>name <span style="color: #660033;">-n</span> <span style="color: #660033;">-100</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/archives/46/feed</wfw:commentRss>
		</item>
		<item>
		<title>Plesk backup problem</title>
		<link>http://www.geekyboy.com/archives/45</link>
		<comments>http://www.geekyboy.com/archives/45#comments</comments>
		<pubDate>Tue, 27 Nov 2007 15:23:18 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
		
		<category><![CDATA[Plesk]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/archives/45</guid>
		<description><![CDATA[I had a problem backing up domains on a server and received the following error message:
Error: Unable to create backup session: Specified file is not accessible
Finally i solved this problem!!!! it was all about wrong permission in some folders!
check that the folders &#8216;/var/lib/psa/dumps&#8217; and &#8216;/var/lib/psa/dumps/tmp&#8217; are chmod to 777
]]></description>
			<content:encoded><![CDATA[<p>I had a problem backing up domains on a server and received the following error message:</p>
<p>Error: Unable to create backup session: Specified file is not accessible</p>
<p>Finally i solved this problem!!!! it was all about wrong permission in some folders!</p>
<p>check that the folders &#8216;/var/lib/psa/dumps&#8217; and &#8216;/var/lib/psa/dumps/tmp&#8217; are chmod to 777</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/archives/45/feed</wfw:commentRss>
		</item>
		<item>
		<title>Change/update time on Linux</title>
		<link>http://www.geekyboy.com/archives/44</link>
		<comments>http://www.geekyboy.com/archives/44#comments</comments>
		<pubDate>Fri, 09 Nov 2007 16:59:15 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
		
		<category><![CDATA[OS]]></category>

		<category><![CDATA[Quick Tips]]></category>

		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.geekyboy.com/archives/44</guid>
		<description><![CDATA[Sets whether the hardware clock is stored as UTC or local time.

/etc/sysconfig/clock

Symlink /etc/localtime to /usr/share/zoneinfo/&#8230; to set your timezone.
To set the current system date/time.

date MMDDhhmm

To set the hardware clock.

/sbin/hwclock --systohc

]]></description>
			<content:encoded><![CDATA[<p>Sets whether the hardware clock is stored as UTC or local time.</p>
<pre>
/etc/sysconfig/clock
</pre>
<p>Symlink /etc/localtime to /usr/share/zoneinfo/&#8230; to set your timezone.</p>
<p>To set the current system date/time.</p>
<pre>
date MMDDhhmm
</pre>
<p>To set the hardware clock.</p>
<pre>
/sbin/hwclock --systohc
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.geekyboy.com/archives/44/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
