<?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>Sniptools</title>
	<atom:link href="http://sniptools.com/feed" rel="self" type="application/rss+xml" />
	<link>http://sniptools.com</link>
	<description>Design &#38; Technology Observations</description>
	<lastBuildDate>Mon, 10 Oct 2011 02:12:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Fix slow network file transfers across Mac OSX Lion</title>
		<link>http://sniptools.com/mac-osx/fix-slow-network-file-transfers-across-mac-osx-lion</link>
		<comments>http://sniptools.com/mac-osx/fix-slow-network-file-transfers-across-mac-osx-lion#comments</comments>
		<pubDate>Mon, 10 Oct 2011 01:54:28 +0000</pubDate>
		<dc:creator>Shanx</dc:creator>
				<category><![CDATA[Mac OSX]]></category>
		<category><![CDATA[lan]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[wifi]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://sniptools.com/?p=567</guid>
		<description><![CDATA[Suddenly, after the upgrade from Snow Leopard to the much vaunted OSX Lion, my wireless transfers over a home LAN network became sluggish. It was taking a few *minutes* to transfer a simple file. Apparently I am not the only one with these issues. I tried a few fixes gleaned from a bunch of separate [...]]]></description>
			<content:encoded><![CDATA[<p>Suddenly, after the upgrade from Snow Leopard to the much vaunted OSX Lion, my wireless transfers over a home LAN network became sluggish. It was taking a few *minutes* to transfer a simple file. </p>
<p>Apparently I am <a href="https://discussions.apple.com/message/6676691?messageID=6676691#6676691" title="Apple Support Discussion about slow network speed ">not the only one</a> with these issues. </p>
<p>I tried a few fixes gleaned from a bunch of separate threads on the Apple forum, and off the web. Not everything is a smart suggestion. Here's what finally works, so hope this saves some people with similar problems the time:   </p>
<p>[You need root access for the "<code>sudo</code>" bits of the following code to work, of course.]</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;echo 'net.inet.tcp.delayed_ack=0' &gt;&gt; /etc/sysctl.conf&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;echo 'net.inet.tcp.recvspace=40960' &gt;&gt; /etc/sysctl.conf&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;echo 'net.inet.tcp.rfc1323=0' &gt;&gt; /etc/sysctl.conf&quot;</span></pre></td></tr></table></div>

<p></p>
<p>Make sure the single quotes remain single quotes in the above code share. These new <code>sysctl</code> settings will take effect <strong>after a reboot</strong>. </p>
<p>Another useful suggestion is to disable the IPV6 stuff. Not needed for now. Done using: </p>
<p><code><br />
System Preferences -><br />
Network -><br />
Airport (or your WiFi listing) -><br />
Advanced (button) -><br />
TCP/IP (tab)<br />
</code></p>
<p>Change the IPV6 to "Link — Local". </p>
]]></content:encoded>
			<wfw:commentRss>http://sniptools.com/mac-osx/fix-slow-network-file-transfers-across-mac-osx-lion/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Java work in browsers on Mac OSX Lion</title>
		<link>http://sniptools.com/mac-osx/making-java-work-in-browsers-on-mac-osx-lion</link>
		<comments>http://sniptools.com/mac-osx/making-java-work-in-browsers-on-mac-osx-lion#comments</comments>
		<pubDate>Fri, 29 Jul 2011 10:02:47 +0000</pubDate>
		<dc:creator>Shanx</dc:creator>
				<category><![CDATA[Mac OSX]]></category>

		<guid isPermaLink="false">http://sniptools.com/?p=555</guid>
		<description><![CDATA[So I updated to OSX Lion 10.7. Very cool, especially with the easy gestures. Biggest problem: my bank website, which uses Java applets for secure logins, stopped working. In the area where the login form should have been I saw a message that said: "Inactive Plug-in". Same problem across Firefox, Safari, Chrome — all updated [...]]]></description>
			<content:encoded><![CDATA[<p>So I updated to OSX Lion 10.7. Very cool, especially with the easy gestures. </p>
<p>Biggest problem: my bank website, which uses Java applets for secure logins, stopped working. In the area where the login form should have been I saw a message that said: "Inactive Plug-in". Same problem across Firefox, Safari, Chrome — all updated to their latest versions. </p>
<p>I installed the <a href="http://support.apple.com/kb/DL1421">latest Java for OSX Lion</a> from the Apple website. In hindsight, this was not necessary as the "Software Update" from the Apple menu, as usual, takes care of everything including updating the latest Java. </p>
<p>So the problem was clearly not with the browsers. The listing of plugins in Firefox showed me that "Java Applet Plugin" is in fact active.  </p>
<p>The problem was annoyingly simple: the update to OSX Lion 10.7 and above often (not always, apparently) disables Java inside browsers for some odd security reason. </p>
<p>All I had to do was go into "Java Preferences" and enable this back again. Apple hasn't made it easy, but it's a simple command in Terminal:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>Applications<span style="color: #000000; font-weight: bold;">/</span>Utilities<span style="color: #000000; font-weight: bold;">/</span>Java\ Preferences.app<span style="color: #000000; font-weight: bold;">/</span>Contents<span style="color: #000000; font-weight: bold;">/</span>MacOS<span style="color: #000000; font-weight: bold;">/</span>Java\ Preferences</pre></div></div>

<p>This will bring up a window as in the screenshot below. Just enable the bit that says to allow applets in browsers, and you're all set. (It will work when you restart your browser.) </p>
<p><img src="/cms/wp-content/uploads/2011/07/java_pref.png" alt="Java Preferences on Mac OSX Lion" title="Java Preferences on Mac OSX Lion"  /></p>
<p>(Edit: You can also search in Spotlight for "Java Preferences".) </p>
]]></content:encoded>
			<wfw:commentRss>http://sniptools.com/mac-osx/making-java-work-in-browsers-on-mac-osx-lion/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Create ringtones for iPhone on Mac OSX (for free)</title>
		<link>http://sniptools.com/mac-osx/create-ringtones-for-iphone-for-free</link>
		<comments>http://sniptools.com/mac-osx/create-ringtones-for-iphone-for-free#comments</comments>
		<pubDate>Fri, 11 Dec 2009 17:59:30 +0000</pubDate>
		<dc:creator>Shanx</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac OSX]]></category>

		<guid isPermaLink="false">http://sniptools.com/?p=540</guid>
		<description><![CDATA[A simple app ought to do it. Download iRinger. It used to be a Windows app, but is now available for Mac OSX! A very intuitive application. Select a song (mp3 for example), it clips it and shows you the ringtone-worthy segment of it, you basically export it as a ".m4r" file. When done, just [...]]]></description>
			<content:encoded><![CDATA[<p>A simple app ought to do it. </p>
<p><a href="http://www.iringer.net/"><img src="http://www.iringer.net/img/mainss.png" alt="iRinger - Free app" /></a></p>
<p>Download <a href="http://www.iringer.net/">iRinger</a>. It used to be a Windows app, but is now <a href="http://www.macupdate.com/info.php/id/31517/ringer">available for Mac OSX</a>! </p>
<p>A very intuitive application. Select a song (mp3 for example), it clips it and shows you the ringtone-worthy segment of it, you basically export it as a ".m4r" file. </p>
<p>When done, just open the file and iTunes will automatically open it. Done. </p>
]]></content:encoded>
			<wfw:commentRss>http://sniptools.com/mac-osx/create-ringtones-for-iphone-for-free/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Finding non-UTF8 values in PostgreSQL</title>
		<link>http://sniptools.com/databases/finding-non-utf8-values-in-postgresql</link>
		<comments>http://sniptools.com/databases/finding-non-utf8-values-in-postgresql#comments</comments>
		<pubDate>Thu, 23 Jul 2009 01:56:02 +0000</pubDate>
		<dc:creator>Shanx</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://sniptools.com/?p=528</guid>
		<description><![CDATA[This regexp worked for me. 1 2 3 4 5 6 7 8 9 10 11 12 SELECT * FROM TABLE WHERE NOT COLUMN ~ &#40; '^('&#124;&#124; $$&#91;\09\0A\0D\x20-\x7E&#93;&#124;$$&#124;&#124; -- ASCII $$&#91;\xC2-\xDF&#93;&#91;\x80-\xBF&#93;&#124;$$&#124;&#124; -- non-overlong 2-byte $$\xE0&#91;\xA0-\xBF&#93;&#91;\x80-\xBF&#93;&#124;$$&#124;&#124; -- excluding overlongs $$&#91;\xE1-\xEC\xEE\xEF&#93;&#91;\x80-\xBF&#93;&#123;2&#125;&#124;$$&#124;&#124; -- straight 3-byte $$\xED&#91;\x80-\x9F&#93;&#91;\x80-\xBF&#93;&#124;$$&#124;&#124; -- excluding surrogates $$\xF0&#91;\x90-\xBF&#93;&#91;\x80-\xBF&#93;&#123;2&#125;&#124;$$&#124;&#124; -- planes 1-3 $$&#91;\xF1-\xF3&#93;&#91;\x80-\xBF&#93;&#123;3&#125;&#124;$$&#124;&#124; -- planes 4-15 $$\xF4&#91;\x80-\x8F&#93;&#91;\x80-\xBF&#93;&#123;2&#125;$$&#124;&#124; [...]]]></description>
			<content:encoded><![CDATA[<p>This regexp worked for me.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #993333; font-weight: bold;">TABLE</span>
<span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">COLUMN</span> ~ <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'^('</span><span style="color: #66cc66;">||</span>
 $$<span style="color: #66cc66;">&#91;</span>\09\0A\0D\x20<span style="color: #66cc66;">-</span>\x7E<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">|</span>$$<span style="color: #66cc66;">||</span>               <span style="color: #808080; font-style: italic;">-- ASCII</span>
 $$<span style="color: #66cc66;">&#91;</span>\xC2<span style="color: #66cc66;">-</span>\xDF<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>\x80<span style="color: #66cc66;">-</span>\xBF<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">|</span>$$<span style="color: #66cc66;">||</span>             <span style="color: #808080; font-style: italic;">-- non-overlong 2-byte</span>
  $$\xE0<span style="color: #66cc66;">&#91;</span>\xA0<span style="color: #66cc66;">-</span>\xBF<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>\x80<span style="color: #66cc66;">-</span>\xBF<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">|</span>$$<span style="color: #66cc66;">||</span>        <span style="color: #808080; font-style: italic;">-- excluding overlongs</span>
 $$<span style="color: #66cc66;">&#91;</span>\xE1<span style="color: #66cc66;">-</span>\xEC\xEE\xEF<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>\x80<span style="color: #66cc66;">-</span>\xBF<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#123;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">|</span>$$<span style="color: #66cc66;">||</span>  <span style="color: #808080; font-style: italic;">-- straight 3-byte</span>
  $$\xED<span style="color: #66cc66;">&#91;</span>\x80<span style="color: #66cc66;">-</span>\x9F<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>\x80<span style="color: #66cc66;">-</span>\xBF<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">|</span>$$<span style="color: #66cc66;">||</span>        <span style="color: #808080; font-style: italic;">-- excluding surrogates</span>
  $$\xF0<span style="color: #66cc66;">&#91;</span>\x90<span style="color: #66cc66;">-</span>\xBF<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>\x80<span style="color: #66cc66;">-</span>\xBF<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#123;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">|</span>$$<span style="color: #66cc66;">||</span>     <span style="color: #808080; font-style: italic;">-- planes 1-3</span>
 $$<span style="color: #66cc66;">&#91;</span>\xF1<span style="color: #66cc66;">-</span>\xF3<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>\x80<span style="color: #66cc66;">-</span>\xBF<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#123;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">|</span>$$<span style="color: #66cc66;">||</span>          <span style="color: #808080; font-style: italic;">-- planes 4-15</span>
  $$\xF4<span style="color: #66cc66;">&#91;</span>\x80<span style="color: #66cc66;">-</span>\x8F<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>\x80<span style="color: #66cc66;">-</span>\xBF<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#123;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#125;</span>$$<span style="color: #66cc66;">||</span>      <span style="color: #808080; font-style: italic;">-- plane 16</span>
 <span style="color: #ff0000;">')*$'</span> <span style="color: #66cc66;">&#41;</span>
;</pre></td></tr></table></div>

<p>Or, if you have iconv on your system, as most UNIX variants do, you can pg_dumpall a database and run the following command on it:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">@</span>iconv<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$input</span>, <span style="color: #ff0000;">'UTF-8'</span>, <span style="color: #ff0000;">'UTF-8'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> == <span style="color: #007800;">$input</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Good UTF-8!&quot;</span>; <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Nope.&quot;</span></pre></div></div>

<p>Then take a plain text pg_dump of the database in UTF-8. Let's call it "db.orig.dmp". Strip all problem characters:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">iconv <span style="color: #660033;">-f</span> UTF-<span style="color: #000000;">8</span> <span style="color: #660033;">-t</span> UTF-<span style="color: #000000;">8</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">&lt;</span>db .orig.dmp <span style="color: #000000; font-weight: bold;">&gt;</span>db.stripped.sql
<span style="color: #000000; font-weight: bold;">&lt;/</span>db<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>Compare both files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">diff</span> <span style="color: #660033;">-u</span> db.orig.dmp db.stripped.sql</pre></div></div>

<p>That output will show all lines containing a problem character. Now the tedious part: Use "db.orig.dmp" to find out which tables they belong to, locate the records in the database by primary key and fix them. Alternatively, you can use iconv's auto-repair if you know which bytes give you a problem.</p>
<p>For example, if you know that the trouble stems only from 0x80 bytes that should be Euro symbols, you could:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">iconv <span style="color: #660033;">-f</span> UTF-<span style="color: #000000;">8</span> <span style="color: #660033;">-t</span> UTF-<span style="color: #000000;">8</span> <span style="color: #660033;">--byte-subst</span>=<span style="color: #ff0000;">&quot;&amp;lt;0x%x&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> db.orig.sql <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/&amp;lt;0x80&gt;/EUR/g'</span> <span style="color: #000000; font-weight: bold;">&gt;</span>db.fixed.sql</pre></div></div>

<p>The resulting "db.fixed.sql" could then be loaded into the new database.</p>
]]></content:encoded>
			<wfw:commentRss>http://sniptools.com/databases/finding-non-utf8-values-in-postgresql/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>KeepVid: saving videos from Youtube or Vimeo, from anywhere</title>
		<link>http://sniptools.com/webtools/keepvid-saving-videos-from-youtube-or-vimeo-from-anywhere</link>
		<comments>http://sniptools.com/webtools/keepvid-saving-videos-from-youtube-or-vimeo-from-anywhere#comments</comments>
		<pubDate>Mon, 02 Feb 2009 04:54:06 +0000</pubDate>
		<dc:creator>Shanx</dc:creator>
				<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[Tips/Tricks]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://sniptools.com/?p=455</guid>
		<description><![CDATA[If you use Firefox (and if not, what are you waiting for?) you are familiar with useful extensions such as Video Downloader, which allow you to save local copies of the videos you watch on websites such as Youtube or Vimeo. You can then watch these videos whenever you please. But this doesn't account for [...]]]></description>
			<content:encoded><![CDATA[<p>If you use Firefox (and if not, what are you waiting for?) you are familiar with <a href="https://addons.mozilla.org/en-US/firefox/search?q=video++downloader&#038;cat=all">useful extensions</a> such as Video Downloader, which allow you to save local copies of the videos you watch on websites such as Youtube or Vimeo. You can then watch these videos whenever you please. </p>
<p>But this doesn't account for those rare but possible times when you are not on your machine, or don't have access to a browser set up to your tastes. No extensions available. </p>
<p>That's where "<a href="http://keepvid.com/">KeepVid</a>" comes in. Just enter your URL and it automatically extracts any video(s) found on that website and allows you to download in both FLV and MP4 formats. The MP4 would play on your Nokia, iPhone, or Blackberry too. The FLV file is a flash viewer file, and easily played using common video players–if you don't have <a href="http://www.videolan.org/vlc/">VLC</a>, get it pronto. </p>
<p>Here's a straightforward screenshot: </p>
<p><img src="http://farm4.static.flickr.com/3299/3246681630_d42704b048.jpg" alt="KeepVid screenshot saving a Youtube video" /></p>
]]></content:encoded>
			<wfw:commentRss>http://sniptools.com/webtools/keepvid-saving-videos-from-youtube-or-vimeo-from-anywhere/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Resize a column in a PostgreSQL table without changing data</title>
		<link>http://sniptools.com/databases/resize-a-column-in-a-postgresql-table-without-changing-data</link>
		<comments>http://sniptools.com/databases/resize-a-column-in-a-postgresql-table-without-changing-data#comments</comments>
		<pubDate>Tue, 13 Jan 2009 05:49:21 +0000</pubDate>
		<dc:creator>Shanx</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[postgresql sql databases]]></category>

		<guid isPermaLink="false">http://sniptools.com/?p=432</guid>
		<description><![CDATA[You use PostgreSQL. You find that a column you have in a table is of a smaller length than you now wish. In my case, this was a varchar(20) that I now wished to make varchar(35). Nothing else. I just want to change the size, keeping the data intact. The ALTER TABLE ...ALTER COLUMN...TYPE... command [...]]]></description>
			<content:encoded><![CDATA[<p>You use PostgreSQL. You find that a column you have in a table is of a smaller length than you now wish. In my case, this was a <code>varchar(20)</code> that I now wished to make <code>varchar(35)</code>. Nothing else. I just want to change the size, keeping the data intact.</p>
<p>The <code>ALTER TABLE ...ALTER COLUMN...TYPE...</code> <a href="http://www.postgresql.org/docs/current/interactive/sql-altertable.html">command</a> is useful only if you want to alter the data somehow, or change the data type. Otherwise, it'll be an aeon before this finishes even inside a transaction on a database of any meaningful size.</p>
<p>Until now, I was not familiar with any sensible mechanism to simply change the size in PG. But yesterday, Tom Lane himself suggested something ubercool in the list.</p>
<p>Let's assume for the sake of simplicity that your table is called "<code>TABLE1</code>" and your column is "COL1". You can find the size of your "<code>COL1</code>" column by issuing the following query on the system tables:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> atttypmod <span style="color: #993333; font-weight: bold;">FROM</span> pg_attribute
<span style="color: #993333; font-weight: bold;">WHERE</span> attrelid <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'TABLE1'</span>::regclass
<span style="color: #993333; font-weight: bold;">AND</span> attname <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'COL1'</span>;
&nbsp;
atttypmod
<span style="color: #808080; font-style: italic;">-----------</span>
<span style="color: #cc66cc;">24</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">ROW</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>This means that the size is 20 (4 is added for legacy reasons, we're told). You can now conveniently change this to a <code>varchar(35)</code> size by issuing this command:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">UPDATE</span> pg_attribute <span style="color: #993333; font-weight: bold;">SET</span> atttypmod <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">35</span><span style="color: #66cc66;">+</span><span style="color: #cc66cc;">4</span>
<span style="color: #993333; font-weight: bold;">WHERE</span> attrelid <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'TABLE1'</span>::regclass
<span style="color: #993333; font-weight: bold;">AND</span> attname <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'COL1'</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #cc66cc;">1</span></pre></div></div>

<p>Note that I manually added the 4 to the desired size of 35..again, for some legacy reasons inside PG. Done. That's it. Should we check?</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">d TABLE1
&nbsp;
<span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">&quot;public.TABLE1&quot;</span>
<span style="color: #993333; font-weight: bold;">COLUMN</span>  <span style="color: #66cc66;">|</span>  <span style="color: #993333; font-weight: bold;">TYPE</span>                 <span style="color: #66cc66;">|</span> Modifiers
<span style="color: #808080; font-style: italic;">--------+-----------------------+-----------</span>
COL1    <span style="color: #66cc66;">|</span> <span style="color: #993333; font-weight: bold;">CHARACTER</span> <span style="color: #993333; font-weight: bold;">VARYING</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">35</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">|</span></pre></div></div>

<p>Such a simple yet effective trick. Of course it'd be nicer if this is somehow included in a more proper way in the database, but this does the job.</p>
]]></content:encoded>
			<wfw:commentRss>http://sniptools.com/databases/resize-a-column-in-a-postgresql-table-without-changing-data/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Recovering Bad Hard Disks (CRC on Windows, Error –36 on Mac OSX)</title>
		<link>http://sniptools.com/windows/fix-crc-hard-disk-error-recover-data</link>
		<comments>http://sniptools.com/windows/fix-crc-hard-disk-error-recover-data#comments</comments>
		<pubDate>Sun, 05 Oct 2008 02:58:23 +0000</pubDate>
		<dc:creator>Shanx</dc:creator>
				<category><![CDATA[Mac OSX]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[hard disk]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[storage]]></category>

		<guid isPermaLink="false">http://sniptools.com/?p=423</guid>
		<description><![CDATA[So you've been visited by the much dreaded CRC — Cyclical Redundancy Check error, most likely encountered while copying files between hard disks. On Mac OSX, this will usually appear as some cryptic permissions message with an Error –36. To cut the geek-speak, this simply means that you hard disk may have certain files that [...]]]></description>
			<content:encoded><![CDATA[<p>So you've been visited by the much dreaded CRC — <a href="http://en.wikipedia.org/wiki/Cyclic_redundancy_check">Cyclical Redundancy Check error</a>, most likely encountered while copying files between hard disks. On Mac OSX, this will usually appear as some cryptic permissions message with an <a href="http://support.apple.com/kb/HT1618">Error –36</a>.</p>
<p>To cut the geek-speak, this simply means that you hard disk may have certain files that may have "bad sectors", or are corrupted in other words.</p>
<p>Fortunately, this is a common enough problem in our technically advanced world of external storage. I recommend solving this on Windows (I use both XP and OSX Leopard at the time of this writing).</p>
<h3>Step 1: CHKDSK</h3>
<p>Use what Windows offers you by default. The <code>chkdsk</code> command. Just open an MS-DOS command prompt window and go to the drive you wish to check (I'm hoping you already know your way around a command prompt; if you don't please consider Step 2 below). With the command prompt showing the drive letter of the disk you wish to check, enter this command:</p>
<pre>e:&gt; chkdsk /R</pre>
<p>Here, "<code>e:</code>" is my drive to be checked. The "<code>/R</code>" attribute asks the <code>chkdsk</code> command to "recover" whatever bad sectors it finds during its scan. In most cases, and if you're lucky, this ought to do it.</p>
<h3>Step 2: CDCheck (Free)</h3>
<p>Only if the problem you were facing still remains after you have run the chkdsk command, should you consider doing this. This is <a href="http://www.kvipu.com/CDCheck/helplink.php?helpfn=overview">a freeware program</a> that makes it super-easy to check/recover your disk. It can be any disk–your current hard disk, a CD or a DVD, or even an external hard disk. The interface is pretty simple as you can see in the <a href="http://www.kvipu.com/CDCheck/helplink.php?helpfn=screenshots">screenshots here</a>.</p>
<h3>Step 3: SpinRite (US$ 90)</h3>
<p>If all else has failed, just save yourself some heartburn and go straight to SpinRite. This is hands-down the <a href="http://www.grc.com/sr/spinrite.htm">best software for this purpose</a>, as anyone in a dire need of data recovery will confirm. I would trust any piece of software from GRC. Only catch: it's not free, but when you use it you know why it's worth every last cent. It gives you a simple option to save an ISO file, which you can then easily burn on to a CD using any CD writer tool (including Windows' own right-click). Then reboot your machine so it starts from the CD. SpinRite will automatically report and recover whatever is recoverable.</p>
<h2>Next Steps</h2>
<p>Basically, a CRC error is the beginning of the end. If this is on an external hard disk, I highly recommend that you consider backing up the data immediately.</p>
]]></content:encoded>
			<wfw:commentRss>http://sniptools.com/windows/fix-crc-hard-disk-error-recover-data/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Disable auto completion in Firefox address bar</title>
		<link>http://sniptools.com/webtools/disable-auto-completion-in-firefox-address-bar</link>
		<comments>http://sniptools.com/webtools/disable-auto-completion-in-firefox-address-bar#comments</comments>
		<pubDate>Wed, 27 Aug 2008 09:50:57 +0000</pubDate>
		<dc:creator>Shanx</dc:creator>
				<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[Browser]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Tips/Tricks]]></category>

		<guid isPermaLink="false">http://sniptools.com/?p=370</guid>
		<description><![CDATA[Firefox 3 has a "feature" that auto-fills a website that you wish to go to as you're typing in the Location bar. I wanted to turn this off, but without turning off other auto complete functionality: I want to retain the autocomplete in forms (which can be managed from Tools -&#62; Options -&#62; Privacy) I [...]]]></description>
			<content:encoded><![CDATA[<p>Firefox 3 has a "feature" that auto-fills a website that you wish to go to as you're typing in the Location bar.</p>
<p>I wanted to turn this off, but <span style="text-decoration: underline;">without</span> turning off other auto complete functionality:</p>
<ul>
<li>I want to retain the autocomplete in forms (which can be managed from <code>Tools -&gt; Options -&gt; Privacy</code>)</li>
<li>I also want to retain the autocomplete in the search box on the right (which can be turned off by right-clicking inside the box, and then checking off "<code>Show Suggestions</code>")</li>
</ul>
<p>But the Location Bar is a somewhat more involved beast. After hunting in the innards of "<code>about:config</code>" I discovered that this was possible. Just follow these steps:</p>
<ol>
<li>In the location bar, type <code>about:config</code>. The location bar is of course the place where you type URLs. Note that this is your internal Firefox configuration. Don't mess with it.</li>
<li>In the text box that appears at the top of this page, enter <code>browser.urlbar.maxRichResults </code>as the preference name. (Tip: copy it from here and paste it into that box.)</li>
<li>Set the value to 0 if you wish to disable the auto-complete altogether. I have it set to 2 so I get some suggestions but it doesn't crowd up the experience.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://sniptools.com/webtools/disable-auto-completion-in-firefox-address-bar/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Uninstall Saft. For good. Really.</title>
		<link>http://sniptools.com/webtools/uninstall-saft-delete-saft-from-safari</link>
		<comments>http://sniptools.com/webtools/uninstall-saft-delete-saft-from-safari#comments</comments>
		<pubDate>Mon, 04 Aug 2008 08:38:56 +0000</pubDate>
		<dc:creator>Shanx</dc:creator>
				<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Safari]]></category>

		<guid isPermaLink="false">http://sniptools.com/?p=405</guid>
		<description><![CDATA[If you're here, you know what I'm talking about. The Safari plugin sounds like a neat little tool but is a pesky customer on any computer. Not the way to win hearts. Deleting it doesn't work, not do the instructions on their website. Here is how I did. First, close Safari. This is VERY important, [...]]]></description>
			<content:encoded><![CDATA[<p>If you're here, you know what I'm talking about. The Safari plugin sounds like a neat little tool but is a pesky customer on any computer. Not the way to win hearts. Deleting it doesn't work, not do the instructions on their website.</p>
<p>Here is how I did.</p>
<ol>
<li>First, close Safari. This is VERY important, as it does not work otherwise.</li>
<li>Start Terminal. (Go to Applications -&gt; Utilities -&gt; Terminal, or type Terminal in Spotlight).</li>
<li>Under Terminal type "sudo –s" without the quotation marks to log in as root.</li>
<li>Then enter:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">defaults <span style="color: #c20cb9; font-weight: bold;">write</span> com.apple.finder AppleShowAllFiles TRUE</pre></div></div>

</li>
<li>Go to the blue (or gray) apple at the top left of the screen, then select Force Quit. From the menu of items, click on "Saft" and click on the Force Quit button.</li>
<li>Then, in the same Force Quit window, click on "Finder" and click the "Relaunch" button.</li>
<li>In the Finder window, on the top right bar (the Filter spotlight bar), type "saft" without the quotes. Delete with delight any file called Saft. Note: This may reveal a few other files that may contain the word "Saft" such as threads.py in my case (a Python file). Naturally, you want to NOT delete these. Just get rid of the Saft files.</li>
<li>Empty the trash. If there is a file that won't delete because it's in use, then Force Quit "Saft" again as in Step 5 above, and then Empty Trash again.</li>
<li>Go back into Terminal, and type "sudo –s" again without quotation marks. Then enter:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> defaults <span style="color: #c20cb9; font-weight: bold;">write</span> com.apple.finder AppleShowAllFiles FALSE</pre></div></div>

<p>This will set the Finder back to the way it was before. Then type "exit" and it will exit out of the root.</li>
<li>Now navigate to the folder: <code>/Library/InputManagers</code>. Note that this is NOT the "Library" folder in your Users folder. This is the Library folder from the root. Inside InputManagers is the "saft" folder — get rid of it.</li>
<li>Empty Trash (again). If it says Saft is in use, reboot the machine and empty it then. Or if you use some excellent utility like <a href="/vault/osx-utilities-power-users">MainMenu</a> you can "Force Empty Trash".</li>
</ol>
<p>Go back to your happy, problem free Mac!Â  <img src='http://sniptools.com/cms/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://sniptools.com/webtools/uninstall-saft-delete-saft-from-safari/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Remember WEP wireless password on Nokia e61i (any e-Series)</title>
		<link>http://sniptools.com/vault/remember-wep-wireless-password-on-nokia-e61i</link>
		<comments>http://sniptools.com/vault/remember-wep-wireless-password-on-nokia-e61i#comments</comments>
		<pubDate>Sat, 02 Aug 2008 14:23:16 +0000</pubDate>
		<dc:creator>Shanx</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[System Maintenance]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Nokia]]></category>
		<category><![CDATA[Tips/Tricks]]></category>
		<category><![CDATA[wireless]]></category>
		<category><![CDATA[wlan]]></category>

		<guid isPermaLink="false">http://sniptools.com/?p=338</guid>
		<description><![CDATA[I use the Nokia e61i as my mobile. Instead of my telco's data plan (which offers me a meagre 1GB per month) I simply prefer to use my home wireless LAN when I am at home. Until recently I used the wireless "access point" without any secure settings, but have had to move to WEP [...]]]></description>
			<content:encoded><![CDATA[<p>I use the Nokia e61i as my mobile. Instead of my telco's data plan (which offers me a meagre 1GB per month) I simply prefer to use my home wireless LAN when I am at home. Until recently I used the wireless "access point" without any secure settings, but have had to move to WEP now due to cheeky neighbors.</p>
<p>Problem: Nokia's WLAN option kept prompting me for the WEP key *everytime* I would connect to my email or any website.</p>
<p>After googling for a good many days and bumbling around on Nokia's forums, I have finally figured out how to make Nokia remember the cotton-picking password. Simple answer: you need to lose your cached WLAN entry, which may be stored as a non-WEP access point.</p>
<p>Here are the more detailed steps:</p>
<ol>
<li>Delete your current WLAN access point you've created for the E61i. This is the secret sauce.</li>
<li>Now, under
<p><code>Tools &gt; Settings &gt; Connection &gt; Access Points<br />
</code><br />
Select Options and create a new access point using "default settings". We'll tweak them below.</li>
<li>Under <strong><em>Connection Name</em></strong>, pick a name for your connection. This doesn't have to be your wireless network's SSID, but you can keep it under the same name.</li>
<li>Under <strong><em>Data Bearer</em></strong>, select WLAN.</li>
<li>Under <em>WLAN Network Name</em>, select manual entry and type in your SSID name.</li>
<li>Under <strong><em>Network Status</em></strong> mark "Hidden".</li>
<li><strong><em>Network Mode</em></strong> will be the default: "Infrastructure".</li>
<li>Under <strong><em>WLAN Security Mode</em></strong>, choose your security type. For instance, mine is WEP, so that's what I selected.</li>
<li>Under <strong><em>WLAN Security Settings</em></strong>, go to WEP key settings and define your encryption level, format, and key. For instance, for WEP you might have 64 bit, ASCII, and "xyzabc" as your level, format, and key respectively. If you don't know this stuff, this entire tutorial is perhaps not for you, otherwise you know what these values are. (You can always login as admin user into your wireless router and reconfirm these settings for your specific case.)</li>
</ol>
<p>That's it. You can now connect to some website or your email server on your mobile phone, select the WLAN with the name you chose in Step 3 above, and your Nokia e-series phone will remember your WEP password for good. Finally.</p>
]]></content:encoded>
			<wfw:commentRss>http://sniptools.com/vault/remember-wep-wireless-password-on-nokia-e61i/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

