<?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>klkl &#187; Mac</title>
	<atom:link href="http://klkl.co.uk/category/mac/feed/" rel="self" type="application/rss+xml" />
	<link>http://klkl.co.uk</link>
	<description>it's easy to type</description>
	<lastBuildDate>Mon, 14 May 2012 22:39:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>HowTo: Mac OS X Flush DNS Cache</title>
		<link>http://klkl.co.uk/2010/04/11/howto-mac-os-x-flush-dns-cache/</link>
		<comments>http://klkl.co.uk/2010/04/11/howto-mac-os-x-flush-dns-cache/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 13:40:24 +0000</pubDate>
		<dc:creator>klkl</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[flush]]></category>

		<guid isPermaLink="false">http://klkl.co.uk/?p=257</guid>
		<description><![CDATA[<p>While playing with my /etc/hosts file for testing a new server setup I needed to flush my DNS cache. As ever, terminal came to my aid.</p>
<h4 style="padding-left: 30px;"><strong>dscacheutil -flushcache</strong></h4>
<p>Now all is well in the world of DNS.</p>
]]></description>
			<content:encoded><![CDATA[<p>While playing with my /etc/hosts file for testing a new server setup I needed to flush my DNS cache. As ever, terminal came to my aid.</p>
<h4 style="padding-left: 30px;"><strong>dscacheutil -flushcache</strong></h4>
<p>Now all is well in the world of DNS.</p>
]]></content:encoded>
			<wfw:commentRss>http://klkl.co.uk/2010/04/11/howto-mac-os-x-flush-dns-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connecting to MySQL Over SSH</title>
		<link>http://klkl.co.uk/2010/03/21/connecting-to-mysql-over-ssh/</link>
		<comments>http://klkl.co.uk/2010/03/21/connecting-to-mysql-over-ssh/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 14:06:56 +0000</pubDate>
		<dc:creator>klkl</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[tunnel]]></category>

		<guid isPermaLink="false">http://klkl.co.uk/?p=251</guid>
		<description><![CDATA[<p>The last couple of days I&#8217;ve been thinking about setting up a local copy of my websites on my laptop so that I can develop them before I make them live.</p>
<p>Last night I enabled PHP on the apache server built into Mac OSX on my new laptop and installed MySQL on it. I also set up some bash aliases to rsync commands so that I could synchronise the websites from the server to the laptop and back again.</p>
<p>Now that I had local copies of the sites that are synchronised it was time to turn my attention to synchronising the databases between the server and my local machine. I could of configured the server&#8217;s MySQL installation to allow remote connections, however, I did not want to do this for security reasons. I decided that I would connect to the MySQL server over SSH by forwarding a port on my local machine to a remote port on the server.</p>
<p>First I needed to create an SSH tunnel using the following command</p>
<p style="padding-left: 30px;">ssh -fNg -L 3307:127.0.0.1:3306 server.host.name<span id="more-251"></span></p>
<p>The options for SSH are</p>
<ul>
<li>f
<ul>
<li>Requests SSH to background so that you do not have to keep a terminal connected to the server open</li>
</ul>
</li>
<li>N
<ul>
<li>Does not execute a remote command (useful for just forwarding ports)</li>
</ul>
</li>
<li>g
<ul>
<li>Allows remote hosts to connect to local forwarded ports</li>
</ul>
</li>
<li>L
<ul>
<li>Specifies that a local port (3307) is forwarded to the given host (server.host.name) and port (3306)</li>
</ul>
</li>
</ul>
<p>I created an alias to that command for easy use in future but I&#8217;ll need to make sure the tunnel is active before trying to connect to the remote server.</p>
<p>Next its time to turn our attention to actually connecting to the remote MySQL server.</p>
<p style="padding-left: 30px;">mysql -h 127.0.0.1 -P 3307 -u username -p</p>
<p>The Options:</p>
<ul>
<li>h specifies the host to connect to (must be 127.0.0.1)</li>
<li>P specifies the port to connect to (your locally forwarded port)</li>
<li>u specifies the username to connect with</li>
<li>p will prompt you for your password (&#8211;password=passtext can be used to give the password)</li>
</ul>
<p>Thats if I wanted to connect to the remote MySQL server on the command line. The latest phpmyadmin has an option for syncronizing databases in which case you can put the above details and it will compare the databases and allow you to choose what to synchronise.</p>
]]></description>
			<content:encoded><![CDATA[<p>The last couple of days I&#8217;ve been thinking about setting up a local copy of my websites on my laptop so that I can develop them before I make them live.</p>
<p>Last night I enabled PHP on the apache server built into Mac OSX on my new laptop and installed MySQL on it. I also set up some bash aliases to rsync commands so that I could synchronise the websites from the server to the laptop and back again.</p>
<p>Now that I had local copies of the sites that are synchronised it was time to turn my attention to synchronising the databases between the server and my local machine. I could of configured the server&#8217;s MySQL installation to allow remote connections, however, I did not want to do this for security reasons. I decided that I would connect to the MySQL server over SSH by forwarding a port on my local machine to a remote port on the server.</p>
<p>First I needed to create an SSH tunnel using the following command</p>
<p style="padding-left: 30px;">ssh -fNg -L 3307:127.0.0.1:3306 server.host.name<span id="more-251"></span></p>
<p>The options for SSH are</p>
<ul>
<li>f
<ul>
<li>Requests SSH to background so that you do not have to keep a terminal connected to the server open</li>
</ul>
</li>
<li>N
<ul>
<li>Does not execute a remote command (useful for just forwarding ports)</li>
</ul>
</li>
<li>g
<ul>
<li>Allows remote hosts to connect to local forwarded ports</li>
</ul>
</li>
<li>L
<ul>
<li>Specifies that a local port (3307) is forwarded to the given host (server.host.name) and port (3306)</li>
</ul>
</li>
</ul>
<p>I created an alias to that command for easy use in future but I&#8217;ll need to make sure the tunnel is active before trying to connect to the remote server.</p>
<p>Next its time to turn our attention to actually connecting to the remote MySQL server.</p>
<p style="padding-left: 30px;">mysql -h 127.0.0.1 -P 3307 -u username -p</p>
<p>The Options:</p>
<ul>
<li>h specifies the host to connect to (must be 127.0.0.1)</li>
<li>P specifies the port to connect to (your locally forwarded port)</li>
<li>u specifies the username to connect with</li>
<li>p will prompt you for your password (&#8211;password=passtext can be used to give the password)</li>
</ul>
<p>Thats if I wanted to connect to the remote MySQL server on the command line. The latest phpmyadmin has an option for syncronizing databases in which case you can put the above details and it will compare the databases and allow you to choose what to synchronise.</p>
]]></content:encoded>
			<wfw:commentRss>http://klkl.co.uk/2010/03/21/connecting-to-mysql-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo: Change a User&#8217;s Default Shell</title>
		<link>http://klkl.co.uk/2010/03/18/howto-change-a-users-default-shell/</link>
		<comments>http://klkl.co.uk/2010/03/18/howto-change-a-users-default-shell/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 01:28:06 +0000</pubDate>
		<dc:creator>klkl</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://klkl.co.uk/?p=243</guid>
		<description><![CDATA[<p>At the beginning of the week I purchased a new MacBook Pro In between working I&#8217;m in the process of configuring it as I like it and one of the things that was bugging me was the default shell for the root user. I was foolishly trying to set the the prompt PS1 value in .bash_profile when the default root shell isn&#8217;t even bash.</p>
<p>The solution is to switch to the superuser (root) and issue the following command&#8230;</p>
<p style="padding-left: 30px;"><strong>chsh -s /bin/bash</strong></p>
<p>That will change the default shell to bash and the prompt will change as per your configuration.<br />
Just for information my root PS1 is&#8230;</p>
<p style="padding-left: 30px;"><strong>PS1=&#8217;\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] &#8216;</strong></p>
<p>Happy Configuring!</p>
]]></description>
			<content:encoded><![CDATA[<p>At the beginning of the week I purchased a new MacBook Pro In between working I&#8217;m in the process of configuring it as I like it and one of the things that was bugging me was the default shell for the root user. I was foolishly trying to set the the prompt PS1 value in .bash_profile when the default root shell isn&#8217;t even bash.</p>
<p>The solution is to switch to the superuser (root) and issue the following command&#8230;</p>
<p style="padding-left: 30px;"><strong>chsh -s /bin/bash</strong></p>
<p>That will change the default shell to bash and the prompt will change as per your configuration.<br />
Just for information my root PS1 is&#8230;</p>
<p style="padding-left: 30px;"><strong>PS1=&#8217;\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] &#8216;</strong></p>
<p>Happy Configuring!</p>
]]></content:encoded>
			<wfw:commentRss>http://klkl.co.uk/2010/03/18/howto-change-a-users-default-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac Firewall: Do You Want the Application Vuze.app to Accept Incoming Network Connections</title>
		<link>http://klkl.co.uk/2009/12/22/mac-firewall-do-you-want-the-application-vuze-app-to-accept-incoming-network-connections/</link>
		<comments>http://klkl.co.uk/2009/12/22/mac-firewall-do-you-want-the-application-vuze-app-to-accept-incoming-network-connections/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 16:37:15 +0000</pubDate>
		<dc:creator>klkl</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[vuze]]></category>

		<guid isPermaLink="false">http://klkl.co.uk/?p=240</guid>
		<description><![CDATA[<p>Recently I&#8217;ve had a bother with the Mac firewall asking me if I want it to accept incomming network connections every time I open a particular application.</p>
<p>The appropriate setting can be found under:</p>
<p style="padding-left: 30px;"><strong>System Preferences : Personal &gt; Security &gt; Firewall</strong></p>
<p>I have mine configured to &#8220;Set access for specific services and applications&#8221; which normally asks me if I want to allow an application to accept incoming connections<strong> </strong>the first time I run it and that&#8217;s normally the end of it. The trouble comes when you try and update certain applications using <strong>Software Update</strong>. I&#8217;m not exactly sure what causes the problem but for some reason with specific applications the firewall then proceeds to ask you, each time, if you would like it to accept incoming network connections. This you can imagine is superlatively tedious.</p>
<p>The answer though is to just delete the application from you applications folder and reinstall it. The first time you open the freshly installed application it will ask the question and then bug you no more. Then all you have to worry about is not updating it via software update again.</p>
]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve had a bother with the Mac firewall asking me if I want it to accept incomming network connections every time I open a particular application.</p>
<p>The appropriate setting can be found under:</p>
<p style="padding-left: 30px;"><strong>System Preferences : Personal &gt; Security &gt; Firewall</strong></p>
<p>I have mine configured to &#8220;Set access for specific services and applications&#8221; which normally asks me if I want to allow an application to accept incoming connections<strong> </strong>the first time I run it and that&#8217;s normally the end of it. The trouble comes when you try and update certain applications using <strong>Software Update</strong>. I&#8217;m not exactly sure what causes the problem but for some reason with specific applications the firewall then proceeds to ask you, each time, if you would like it to accept incoming network connections. This you can imagine is superlatively tedious.</p>
<p>The answer though is to just delete the application from you applications folder and reinstall it. The first time you open the freshly installed application it will ask the question and then bug you no more. Then all you have to worry about is not updating it via software update again.</p>
]]></content:encoded>
			<wfw:commentRss>http://klkl.co.uk/2009/12/22/mac-firewall-do-you-want-the-application-vuze-app-to-accept-incoming-network-connections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GIMP on Mac OS Focus Double Click Fix</title>
		<link>http://klkl.co.uk/2009/10/08/gimp-on-mac-os-focus-double-click-fix/</link>
		<comments>http://klkl.co.uk/2009/10/08/gimp-on-mac-os-focus-double-click-fix/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 19:53:20 +0000</pubDate>
		<dc:creator>klkl</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[GIMP]]></category>
		<category><![CDATA[X11]]></category>

		<guid isPermaLink="false">http://klkl.co.uk/?p=218</guid>
		<description><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-220 aligncenter" title="Wilber" src="http://klkl.co.uk/wp-content/uploads/2009/10/gimp.png" alt="GIMP Mascot" width="200" height="145" /></p>
<p>If you&#8217;ve ever used the great GNU Image Manipulation Program, GIMP, on a Mac then you&#8217;ll no doubt have been frustrated with the way X11 seems to handle window focus. Fortunately there is a solution and its just a couple of simple terminal commands away&#8230;</p>
<p>When selecting tools from their dialog in GIMP on your Mac then you are required to click once to give that window focus and again to actually select the tool you require. The same two clicks are required again to actually use your tool.  You can either imagine or know first hand how annoying this becomes and its a shame for such a great piece of software to be blighted by this issue so lets fix it.</p>
<p>Firstly you&#8217;ll want to open your terminal (who could live without it&#8230; mine&#8217;s almost always open!). Then you want to enter either of the following commands depending on whether you&#8217;ve got XQuartz updates (and if you&#8217;re not sure just do both sets).</p>
<p><span id="more-218"></span></p>
<p><strong>Without XQuartz updates:</strong></p>
<ul>
<li>defaults write com.apple.x11 wm_ffm -bool false</li>
<li>defaults write com.apple.x11 wm_click_through -bool true</li>
</ul>
<p><strong>With XQuartz updates:</strong></p>
<ul>
<li>defaults write org.x.x11 wm_ffm -bool false</li>
<li>defaults write org.x.x11 wm_click_through -bool true</li>
</ul>
<p>You should now find that you only need the proper amount (2) of clicks to select and use your tool of choice. This leaves you free to spend your time bothering about something else that annoys you like having to Cmd-Tab to X11 instead of GIMP when you&#8217;ve been switching between apps!</p>
]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-220 aligncenter" title="Wilber" src="http://klkl.co.uk/wp-content/uploads/2009/10/gimp.png" alt="GIMP Mascot" width="200" height="145" /></p>
<p>If you&#8217;ve ever used the great GNU Image Manipulation Program, GIMP, on a Mac then you&#8217;ll no doubt have been frustrated with the way X11 seems to handle window focus. Fortunately there is a solution and its just a couple of simple terminal commands away&#8230;</p>
<p>When selecting tools from their dialog in GIMP on your Mac then you are required to click once to give that window focus and again to actually select the tool you require. The same two clicks are required again to actually use your tool.  You can either imagine or know first hand how annoying this becomes and its a shame for such a great piece of software to be blighted by this issue so lets fix it.</p>
<p>Firstly you&#8217;ll want to open your terminal (who could live without it&#8230; mine&#8217;s almost always open!). Then you want to enter either of the following commands depending on whether you&#8217;ve got XQuartz updates (and if you&#8217;re not sure just do both sets).</p>
<p><span id="more-218"></span></p>
<p><strong>Without XQuartz updates:</strong></p>
<ul>
<li>defaults write com.apple.x11 wm_ffm -bool false</li>
<li>defaults write com.apple.x11 wm_click_through -bool true</li>
</ul>
<p><strong>With XQuartz updates:</strong></p>
<ul>
<li>defaults write org.x.x11 wm_ffm -bool false</li>
<li>defaults write org.x.x11 wm_click_through -bool true</li>
</ul>
<p>You should now find that you only need the proper amount (2) of clicks to select and use your tool of choice. This leaves you free to spend your time bothering about something else that annoys you like having to Cmd-Tab to X11 instead of GIMP when you&#8217;ve been switching between apps!</p>
]]></content:encoded>
			<wfw:commentRss>http://klkl.co.uk/2009/10/08/gimp-on-mac-os-focus-double-click-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo: Fill Down In Excel Mac</title>
		<link>http://klkl.co.uk/2009/07/30/howto-fill-down-in-excel-mac/</link>
		<comments>http://klkl.co.uk/2009/07/30/howto-fill-down-in-excel-mac/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 17:29:59 +0000</pubDate>
		<dc:creator>klkl</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[shortcut]]></category>

		<guid isPermaLink="false">http://klkl.co.uk/?p=213</guid>
		<description><![CDATA[<h1 style="text-align: center;"><span style="color: #333333;">Ctrl + D</span></h1>
]]></description>
			<content:encoded><![CDATA[<h1 style="text-align: center;"><span style="color: #333333;">Ctrl + D</span></h1>
]]></content:encoded>
			<wfw:commentRss>http://klkl.co.uk/2009/07/30/howto-fill-down-in-excel-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Excel Mac Equivalent to F2 In Windows</title>
		<link>http://klkl.co.uk/2009/07/19/excel-mac-equivalent-to-f2-in-windows/</link>
		<comments>http://klkl.co.uk/2009/07/19/excel-mac-equivalent-to-f2-in-windows/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 19:54:39 +0000</pubDate>
		<dc:creator>klkl</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[F2]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[shortcut]]></category>

		<guid isPermaLink="false">http://klkl.co.uk/?p=209</guid>
		<description><![CDATA[<h1 style="text-align: center;"><strong><span style="color: #333333;">Ctrl + U</span></strong></h1>
]]></description>
			<content:encoded><![CDATA[<h1 style="text-align: center;"><strong><span style="color: #333333;">Ctrl + U</span></strong></h1>
]]></content:encoded>
			<wfw:commentRss>http://klkl.co.uk/2009/07/19/excel-mac-equivalent-to-f2-in-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing the Tilde (~) Character From the Address of Locally Hosted Sites on Mac OS X</title>
		<link>http://klkl.co.uk/2009/07/17/removing-the-tilde-character-from-the-address-of-locally-hosted-sites-on-mac-os-x/</link>
		<comments>http://klkl.co.uk/2009/07/17/removing-the-tilde-character-from-the-address-of-locally-hosted-sites-on-mac-os-x/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 19:08:42 +0000</pubDate>
		<dc:creator>klkl</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[ln]]></category>
		<category><![CDATA[tilde]]></category>
		<category><![CDATA[webserver]]></category>

		<guid isPermaLink="false">http://klkl.co.uk/?p=194</guid>
		<description><![CDATA[<p>I&#8217;ve been working on some sites locally on my Mac but by default the files are stored in a directory in the individuals user account called Sites and the address you&#8217;ve got to type into your browser is http://localhost/~username/etc&#8230; this annoyed me because I didn&#8217;t want to have to type the tilde character in the address and also that I had to have the files showing in a subdirectories of my user. I couldn&#8217;t be doing with it, I wanted to have addresses like &#8216;http://localhost/subdomain/&#8217; and the solution of course is to use symbolic links.</p>
<p><span id="more-194"></span></p>
<p>The way I did it was to have various directories in the /Users/username/Sites directory as is the normal set up but to have a symbolic link for each project that I wanted to have a better looking URL for so for example if my PHP My Admin was contained in the directory /Users/username/Sites/phpma then I would create a symbolic link to the directory /Library/WebServer/Documents/ using the command&#8230;</p>
<ul>
<li><strong>ln -s /Users/username/Sites/phpma /Library/WebServer/Documents/phpma</strong></li>
</ul>
<p>Et Voila&#8230; I can now use and bookmark a shorter and less visually offensive URL to the sites I&#8217;m working on.</p>
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on some sites locally on my Mac but by default the files are stored in a directory in the individuals user account called Sites and the address you&#8217;ve got to type into your browser is http://localhost/~username/etc&#8230; this annoyed me because I didn&#8217;t want to have to type the tilde character in the address and also that I had to have the files showing in a subdirectories of my user. I couldn&#8217;t be doing with it, I wanted to have addresses like &#8216;http://localhost/subdomain/&#8217; and the solution of course is to use symbolic links.</p>
<p><span id="more-194"></span></p>
<p>The way I did it was to have various directories in the /Users/username/Sites directory as is the normal set up but to have a symbolic link for each project that I wanted to have a better looking URL for so for example if my PHP My Admin was contained in the directory /Users/username/Sites/phpma then I would create a symbolic link to the directory /Library/WebServer/Documents/ using the command&#8230;</p>
<ul>
<li><strong>ln -s /Users/username/Sites/phpma /Library/WebServer/Documents/phpma</strong></li>
</ul>
<p>Et Voila&#8230; I can now use and bookmark a shorter and less visually offensive URL to the sites I&#8217;m working on.</p>
]]></content:encoded>
			<wfw:commentRss>http://klkl.co.uk/2009/07/17/removing-the-tilde-character-from-the-address-of-locally-hosted-sites-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To: Indent XML Quickly</title>
		<link>http://klkl.co.uk/2009/07/14/how-to-indent-xml-quickly/</link>
		<comments>http://klkl.co.uk/2009/07/14/how-to-indent-xml-quickly/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 19:42:51 +0000</pubDate>
		<dc:creator>klkl</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Pharmacy]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[dm+d]]></category>
		<category><![CDATA[indent]]></category>
		<category><![CDATA[libxml]]></category>
		<category><![CDATA[nhsbsa]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://klkl.co.uk/?p=189</guid>
		<description><![CDATA[<p>I&#8217;ve recently registered for accesss to the NHS&#8217;s dictionary of medicines and devices (dm+d). This was primarily to see what format the data was stored in and then to see if there was a way of utilising it in a cool webapp.</p>
<p>I downloaded the current release (its updated weekly) and unpacked the 5MB archive to reveal some XML and related files. Some of the files are huge (up to 32MB each and ~70MB in total) and there was no way a traditional program was going to mannage. I tried a few in fact and they all devastated my 2GB RAM and were generally unusable.</p>
<p>Time for a command line solution&#8230; VIM the open source text editor. Its extremely powerful and customisable but using it takes a little getting used to. VIM was able to open with only a slight delay and navigate these huge files. The next problem for me was being able to read them.</p>
<p>In theory it shouldn&#8217;t matter what indenting there is in an XML file as it doesn&#8217;t contain any data but I find its a lot easier to read the files if they&#8217;re &#8216;cleanly&#8217; indented. I began wondering how I was going to solve the problem and thought of a few ideas&#8230; a script (PERL, PHP, shell, other&#8230;) but none of those came to fruition. After some searching I came across <a href="http://xmlsoft.org/">libxml</a>.</p>
<p>You can download and compile from source if you wish but I decided to download a pre-built version from <a href="http://www.explain.com.au/oss/libxml2xslt.html">explain.com</a> it was pretty good and another page I came across on <a href="http://www.entropy.ch/blog/Developer/2008/04/23/XML-Pretty-Printing-in-BBEdit-and-vi-With-xmllint.html">entropy.ch</a> explained how to use it within Vim to indent my files super quick.</p>
<p>Here&#8217;s what you do&#8230;</p>
<ul>
<li>To format type this sequence
<ul>
<li>:%!xmllint &#8211;format -</li>
</ul>
</li>
<li>Or mark the area visually and then type
<ul>
<li>!xmllint &#8211;format -</li>
</ul>
</li>
</ul>
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently registered for accesss to the NHS&#8217;s dictionary of medicines and devices (dm+d). This was primarily to see what format the data was stored in and then to see if there was a way of utilising it in a cool webapp.</p>
<p>I downloaded the current release (its updated weekly) and unpacked the 5MB archive to reveal some XML and related files. Some of the files are huge (up to 32MB each and ~70MB in total) and there was no way a traditional program was going to mannage. I tried a few in fact and they all devastated my 2GB RAM and were generally unusable.</p>
<p>Time for a command line solution&#8230; VIM the open source text editor. Its extremely powerful and customisable but using it takes a little getting used to. VIM was able to open with only a slight delay and navigate these huge files. The next problem for me was being able to read them.</p>
<p>In theory it shouldn&#8217;t matter what indenting there is in an XML file as it doesn&#8217;t contain any data but I find its a lot easier to read the files if they&#8217;re &#8216;cleanly&#8217; indented. I began wondering how I was going to solve the problem and thought of a few ideas&#8230; a script (PERL, PHP, shell, other&#8230;) but none of those came to fruition. After some searching I came across <a href="http://xmlsoft.org/">libxml</a>.</p>
<p>You can download and compile from source if you wish but I decided to download a pre-built version from <a href="http://www.explain.com.au/oss/libxml2xslt.html">explain.com</a> it was pretty good and another page I came across on <a href="http://www.entropy.ch/blog/Developer/2008/04/23/XML-Pretty-Printing-in-BBEdit-and-vi-With-xmllint.html">entropy.ch</a> explained how to use it within Vim to indent my files super quick.</p>
<p>Here&#8217;s what you do&#8230;</p>
<ul>
<li>To format type this sequence
<ul>
<li>:%!xmllint &#8211;format -</li>
</ul>
</li>
<li>Or mark the area visually and then type
<ul>
<li>!xmllint &#8211;format -</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://klkl.co.uk/2009/07/14/how-to-indent-xml-quickly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To: Tunnel Connections Over SSH</title>
		<link>http://klkl.co.uk/2008/12/30/how-to-tunnel-connections-over-ssh/</link>
		<comments>http://klkl.co.uk/2008/12/30/how-to-tunnel-connections-over-ssh/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 19:24:07 +0000</pubDate>
		<dc:creator>klkl</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[tunnel]]></category>

		<guid isPermaLink="false">http://klkl.co.uk/?p=131</guid>
		<description><![CDATA[<p>I&#8217;ve been doing some work involving an application that needs to query databases on separate servers however one of the servers will only accept mysql connections locally so the way round it is to forward connections from a port on one system to a port on a remote system. That way the connection to the remote database will appear as though it originated locally and be accepted.</p>
<p>To set up a tunneled connection you issue the following command on any client:</p>
<p style="padding-left: 30px;"><strong>ssh -fNg -L 3307:127.0.0.1:3306 myuser@remotehost.com</strong></p>
<p>The first command tells ssh to log in to remotehost.com as myuser, go into the background (-f) and not execute any remote command (-N), and set up port-forwarding (-L localport:localhost:remoteport ). In this case, we forward port 3307 on localhost to port 3306 on remotehost.com.</p>
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing some work involving an application that needs to query databases on separate servers however one of the servers will only accept mysql connections locally so the way round it is to forward connections from a port on one system to a port on a remote system. That way the connection to the remote database will appear as though it originated locally and be accepted.</p>
<p>To set up a tunneled connection you issue the following command on any client:</p>
<p style="padding-left: 30px;"><strong>ssh -fNg -L 3307:127.0.0.1:3306 myuser@remotehost.com</strong></p>
<p>The first command tells ssh to log in to remotehost.com as myuser, go into the background (-f) and not execute any remote command (-N), and set up port-forwarding (-L localport:localhost:remoteport ). In this case, we forward port 3307 on localhost to port 3306 on remotehost.com.</p>
]]></content:encoded>
			<wfw:commentRss>http://klkl.co.uk/2008/12/30/how-to-tunnel-connections-over-ssh/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

