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

<channel>
	<title>from the desk of stinkpot</title>
	<atom:link href="http://desk.stinkpot.org/tricks/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://desk.stinkpot.org:8080/tricks</link>
	<description>tricks!</description>
	<pubDate>Thu, 22 Jul 2010 21:15:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>best linear fit through the origin in matlab</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2010/07/best-linear-fit-through-the-origin-in-matlab/</link>
		<comments>http://desk.stinkpot.org:8080/tricks/index.php/2010/07/best-linear-fit-through-the-origin-in-matlab/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 21:15:01 +0000</pubDate>
		<dc:creator>Lawrence David</dc:creator>
		
		<category><![CDATA[Matlab]]></category>

		<guid isPermaLink="false">http://desk.stinkpot.org:8080/tricks/?p=324</guid>
		<description><![CDATA[if you&#8217;re trying to solve for m in the equation y = mx, simply:
matlab &#62;&#62; m = x(:) \ y(:)
[found on matlabcentral.]
]]></description>
			<content:encoded><![CDATA[<p>if you&#8217;re trying to solve for m in the equation y = mx, simply:</p>
<p>matlab &gt;&gt; m = x(:) \ y(:)</p>
<p>[found on <a href="http://www.mathworks.com/matlabcentral/newsreader/view_thread/172430">matlabcentral</a>.]</p>
]]></content:encoded>
			<wfw:commentRss>http://desk.stinkpot.org:8080/tricks/index.php/2010/07/best-linear-fit-through-the-origin-in-matlab/feed/</wfw:commentRss>
		</item>
		<item>
		<title>add section or chapter numbers to figure numbers</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2010/06/add-section-or-chapter-numbers-to-figure-numbers/</link>
		<comments>http://desk.stinkpot.org:8080/tricks/index.php/2010/06/add-section-or-chapter-numbers-to-figure-numbers/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 20:25:58 +0000</pubDate>
		<dc:creator>Lawrence David</dc:creator>
		
		<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://desk.stinkpot.org:8080/tricks/?p=322</guid>
		<description><![CDATA[Despite having multiple sections and chapters in my document, my figures were only numbered: Figure 1, Figure, 2, etc.
To change their naming to Figure 1.1, Figure 1.2, etc, I simply included the following code:
\usepackage{amsmath}
\numberwithin{figure}{section}
]]></description>
			<content:encoded><![CDATA[<p>Despite having multiple sections and chapters in my document, my figures were only numbered: Figure 1, Figure, 2, etc.</p>
<p>To change their naming to Figure 1.1, Figure 1.2, etc, I simply included the following code:</p>
<blockquote><p>\usepackage{amsmath}</p>
<p>\numberwithin{figure}{section}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://desk.stinkpot.org:8080/tricks/index.php/2010/06/add-section-or-chapter-numbers-to-figure-numbers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>add hyperlinks in latex document</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2010/06/add-hyperlinks-in-latex-document/</link>
		<comments>http://desk.stinkpot.org:8080/tricks/index.php/2010/06/add-hyperlinks-in-latex-document/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 20:23:24 +0000</pubDate>
		<dc:creator>Lawrence David</dc:creator>
		
		<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://desk.stinkpot.org:8080/tricks/?p=320</guid>
		<description><![CDATA[to have hyperlinks between references in your document and figures or sections, simply load:
\usepackage{hyperref}
once this package is loaded, you can also embed webpage hyperlinks:
\url{http//www.google.com}
]]></description>
			<content:encoded><![CDATA[<p>to have hyperlinks between references in your document and figures or sections, simply load:</p>
<blockquote><p>\usepackage{hyperref}</p></blockquote>
<p>once this package is loaded, you can also embed webpage hyperlinks:</p>
<blockquote><p>\url{http//www.google.com}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://desk.stinkpot.org:8080/tricks/index.php/2010/06/add-hyperlinks-in-latex-document/feed/</wfw:commentRss>
		</item>
		<item>
		<title>repairing my time machine backup</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2010/04/repairing-my-time-machine-backup/</link>
		<comments>http://desk.stinkpot.org:8080/tricks/index.php/2010/04/repairing-my-time-machine-backup/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 19:07:47 +0000</pubDate>
		<dc:creator>Lawrence David</dc:creator>
		
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://desk.stinkpot.org:8080/tricks/?p=318</guid>
		<description><![CDATA[my time machine backup is stored on a linux file server which i connect to wirelessly.  lately, my time machine backups have been extremely slow; my recent attempt to run disk utility on the drive failed with the error: &#8220;Disk Utility cannot repair Time Machine.&#8221;
here&#8217;s a solution that i found on jthon&#8217;s place, which i&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>my time machine backup is stored on a linux file server which i connect to wirelessly.  lately, my time machine backups have been extremely slow; my recent attempt to run disk utility on the drive failed with the error: &#8220;Disk Utility cannot repair Time Machine.&#8221;</p>
<p>here&#8217;s a solution that i found on jthon&#8217;s place, which i&#8217;m currently trying out:</p>
<ol>
<li>connect to my linux server using the Finder</li>
<li>running hdiutil:  /Users/foo/hdiutil attach -nomount -readwrite /Volumes/TimeMachine/foo.sparsebundle</li>
<li>running fsck_hfs:  /Users/foo/fsck_hfs -rf /dev/disk1s2</li>
</ol>
<p>fingers crossed this works!</p>
]]></content:encoded>
			<wfw:commentRss>http://desk.stinkpot.org:8080/tricks/index.php/2010/04/repairing-my-time-machine-backup/feed/</wfw:commentRss>
		</item>
		<item>
		<title>strip all non-alphanumerics or all non-letters from a string in python</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2010/03/strip-all-non-alphanumerics-or-all-non-letters-from-a-string-in-python/</link>
		<comments>http://desk.stinkpot.org:8080/tricks/index.php/2010/03/strip-all-non-alphanumerics-or-all-non-letters-from-a-string-in-python/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 15:38:29 +0000</pubDate>
		<dc:creator>Lawrence David</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://desk.stinkpot.org:8080/tricks/?p=316</guid>
		<description><![CDATA[to strip all the non-letters from a python string named &#8216;my_str&#8217;, you can use the following one-liner:
&#8221;.join([c for c in my_str if c.isalpha()])
to strip all the non-alphanumeric characters from that python string, use the slightly modified:
&#8221;.join([c for c in my_str if c.isalnum()])
]]></description>
			<content:encoded><![CDATA[<p>to strip all the non-letters from a python string named &#8216;my_str&#8217;, you can use the following one-liner:</p>
<blockquote><p>&#8221;.join([c for c in my_str if c.isalpha()])</p></blockquote>
<p>to strip all the non-alphanumeric characters from that python string, use the slightly modified:</p>
<blockquote><p>&#8221;.join([c for c in my_str if c.isalnum()])</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://desk.stinkpot.org:8080/tricks/index.php/2010/03/strip-all-non-alphanumerics-or-all-non-letters-from-a-string-in-python/feed/</wfw:commentRss>
		</item>
		<item>
		<title>use fast fourier transform (fft) to perform low-pass filtering</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2009/12/use-fast-fourier-transform-fft-to-perform-low-pass-filtering/</link>
		<comments>http://desk.stinkpot.org:8080/tricks/index.php/2009/12/use-fast-fourier-transform-fft-to-perform-low-pass-filtering/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 22:27:23 +0000</pubDate>
		<dc:creator>Lawrence David</dc:creator>
		
		<category><![CDATA[Matlab]]></category>

		<guid isPermaLink="false">http://desk.stinkpot.org:8080/tricks/?p=313</guid>
		<description><![CDATA[here&#8217;s an easy way to do low-pass signal filtering in matlab:
function [s_data_v] = fftsmooth(data_v,freq_n)
% use fft low pass filter to smoothen out a signal
fft_data_v = fft(data_v);
s_fft_data_v = zeros(1,length(data_v));
s_fft_data_v(1:freq_n) = fft_data_v(1:freq_n);
s_fft_data_v(end-freq_n:end) = fft_data_v(end-freq_n:end);
s_data_v = real(ifft(s_fft_data_v));
]]></description>
			<content:encoded><![CDATA[<p>here&#8217;s an easy way to do low-pass signal filtering in matlab:</p>
<blockquote><p>function [s_data_v] = fftsmooth(data_v,freq_n)<br />
% use fft low pass filter to smoothen out a signal</p>
<p>fft_data_v = fft(data_v);<br />
s_fft_data_v = zeros(1,length(data_v));<br />
s_fft_data_v(1:freq_n) = fft_data_v(1:freq_n);<br />
s_fft_data_v(end-freq_n:end) = fft_data_v(end-freq_n:end);<br />
s_data_v = real(ifft(s_fft_data_v));</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://desk.stinkpot.org:8080/tricks/index.php/2009/12/use-fast-fourier-transform-fft-to-perform-low-pass-filtering/feed/</wfw:commentRss>
		</item>
		<item>
		<title>move x-axis to top of matlab figure</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2009/12/move-x-axis-to-top-of-matlab-figure/</link>
		<comments>http://desk.stinkpot.org:8080/tricks/index.php/2009/12/move-x-axis-to-top-of-matlab-figure/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 23:35:54 +0000</pubDate>
		<dc:creator>Lawrence David</dc:creator>
		
		<category><![CDATA[Matlab]]></category>

		<guid isPermaLink="false">http://desk.stinkpot.org:8080/tricks/?p=310</guid>
		<description><![CDATA[to move the x-axis on a figure from the bottom of your plot to the top, adjust the &#8216;xaxislocation&#8217; variable of your current axis handle:
matlab&#62;&#62; set(gca,&#8217;XAxisLocation&#8217;,'top&#8217;)
]]></description>
			<content:encoded><![CDATA[<p>to move the x-axis on a figure from the bottom of your plot to the top, adjust the &#8216;xaxislocation&#8217; variable of your current axis handle:</p>
<blockquote><p>matlab&gt;&gt; set(gca,&#8217;XAxisLocation&#8217;,'top&#8217;)</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://desk.stinkpot.org:8080/tricks/index.php/2009/12/move-x-axis-to-top-of-matlab-figure/feed/</wfw:commentRss>
		</item>
		<item>
		<title>install macports emacs in snow leopard</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2009/11/install-macports-emacs-in-snow-leopard/</link>
		<comments>http://desk.stinkpot.org:8080/tricks/index.php/2009/11/install-macports-emacs-in-snow-leopard/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 18:14:32 +0000</pubDate>
		<dc:creator>Lawrence David</dc:creator>
		
		<category><![CDATA[Emacs]]></category>

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

		<guid isPermaLink="false">http://desk.stinkpot.org:8080/tricks/?p=308</guid>
		<description><![CDATA[when trying to install emacs using macports on my new snow leopard install, i got the following error:
foo://opt/local/sudo port install emacs
&#8212;&#62;  Computing dependencies for emacs
&#8212;&#62;  Fetching emacs
&#8212;&#62;  Verifying checksum(s) for emacs
&#8212;&#62;  Extracting emacs
&#8212;&#62;  Applying patches to emacs
&#8212;&#62;  Configuring emacs
&#8212;&#62;  Building emacs
Error: Target org.macports.build returned: shell command &#8221; cd &#8220;/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_editors_emacs/work/emacs-22.3&#8243; &#38;&#38; /usr/bin/make -j2 all &#8221; returned [...]]]></description>
			<content:encoded><![CDATA[<p>when trying to install emacs using macports on my new snow leopard install, i got the following error:</p>
<blockquote><p>foo://opt/local/sudo port install emacs<br />
&#8212;&gt;  Computing dependencies for emacs<br />
&#8212;&gt;  Fetching emacs<br />
&#8212;&gt;  Verifying checksum(s) for emacs<br />
&#8212;&gt;  Extracting emacs<br />
&#8212;&gt;  Applying patches to emacs<br />
&#8212;&gt;  Configuring emacs<br />
&#8212;&gt;  Building emacs<br />
Error: Target org.macports.build returned: shell command &#8221; cd &#8220;/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_editors_emacs/work/emacs-22.3&#8243; &amp;&amp; /usr/bin/make -j2 all &#8221; returned error 2<br />
Command output:                            __la_symbol_ptr  0&#215;100152070    0&#215;628<br />
__program_vars   0&#215;1001526a0     0&#215;28<br />
__const          0&#215;1001526e0    0&#215;730<br />
__data           0&#215;100152e20 0&#215;1df3e8<br />
__bss            0&#215;100332220  0&#215;51830<br />
__common         0&#215;100383a60  0&#215;103f9<br />
3 LC_SEGMENT_64          72 __LINKEDIT       0&#215;100394000  0&#215;46000<br />
4 unknown                48<br />
5 LC_SYMTAB              24<br />
6 LC_DYSYMTAB            80<br />
7 LC_LOAD_DYLINKER       32<br />
8 LC_UUID                24<br />
9 LC_UNIXTHREAD         184<br />
10 LC_LOAD_DYLIB          64<br />
11 LC_LOAD_DYLIB          56<br />
0&#215;100dfc080 (sz:   0&#215;3f24/  0&#215;3f28)<br />
0&#215;100d00000 (sz:  0&#215;4a6d5/ 0xfc080)<br />
0&#215;100afc080 (sz:   0&#215;3f25/  0&#215;3f28)<br />
0&#215;100a00000 (sz:  0xfc07f/ 0xfc080)<br />
0&#215;1017f8000 (sz:   0&#215;26ca/  0&#215;7fa0)<br />
0&#215;101000000 (sz: 0&#215;26a7fd/0&#215;7f8000)<br />
0&#215;10044c000 (sz:        0/  0&#215;1000)<br />
&#8212; Load Commands written to Output File &#8212;<br />
Writing segment __PAGEZERO       @        0 (       0/0&#215;100000000 @          0)<br />
Writing segment __TEXT           @        0 (0&#215;152000/0&#215;152000 @ 0&#215;100000000)<br />
Writing segment __DATA           @ 0&#215;152000 (0&#215;242000/0&#215;242000 @ 0&#215;100152000)<br />
section __nl_symbol_ptr  at 0&#215;152000 - 0&#215;152070 (sz:     0&#215;70)<br />
section __la_symbol_ptr  at 0&#215;152070 - 0&#215;152698 (sz:    0&#215;628)<br />
make[1]: *** [emacs] Error 1<br />
make: *** [src] Error 2</p>
<p>Error: Status 1 encountered during processing.</p></blockquote>
<p><strong>to resolve</strong>:</p>
<ol>
<li>download the patch file found <a href="http://trac.macports.org/ticket/21335">here</a>.</li>
<li>install the patch: foo://opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_editors_emacs/work/emacs-22.3/sudo patch -p0 &lt; ~/Downloads/emacs-snow-leopard.patch</li>
<li>sudo port install emacs</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://desk.stinkpot.org:8080/tricks/index.php/2009/11/install-macports-emacs-in-snow-leopard/feed/</wfw:commentRss>
		</item>
		<item>
		<title>get aac playback working in squeezeboxcenter in debian</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2009/11/get-aac-playback-working-in-squeezeboxcenter-in-debian/</link>
		<comments>http://desk.stinkpot.org:8080/tricks/index.php/2009/11/get-aac-playback-working-in-squeezeboxcenter-in-debian/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 02:44:46 +0000</pubDate>
		<dc:creator>Lawrence David</dc:creator>
		
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://desk.stinkpot.org:8080/tricks/?p=305</guid>
		<description><![CDATA[upgraded from squeezebox center 7.1 to 7.4 today and my aac playback broke.
to fix, i had to add the following lines to my convert.conf file:
mov mp3 * *
# FB:{BITRATE=-B %B}
[faad] -w -f 2 $FILE$ &#124; [lame] &#8211;resample 44100 &#8211;silent -q $QUALITY$ $BITRATE$ -x -r - -
mov wav * *
# F
[faad] -w -f 2 $FILE$
mp4 mp3 [...]]]></description>
			<content:encoded><![CDATA[<p>upgraded from squeezebox center 7.1 to 7.4 today and my aac playback broke.</p>
<p>to fix, i had to add the following lines to my convert.conf file:</p>
<blockquote><p>mov mp3 * *<br />
# FB:{BITRATE=-B %B}<br />
[faad] -w -f 2 $FILE$ | [lame] &#8211;resample 44100 &#8211;silent -q $QUALITY$ $BITRATE$ -x -r - -</p>
<p>mov wav * *<br />
# F<br />
[faad] -w -f 2 $FILE$</p>
<p>mp4 mp3 * *<br />
# FB:{BITRATE=-B %B}<br />
[faad] -w -f 2 $FILE$ | [lame] &#8211;resample 44100 &#8211;silent -q $QUALITY$ $BITRATE$ -x -r - -</p>
<p>aac mp3 * *<br />
# FB:{BITRATE=-B %B}<br />
[faad] -w -f 2 $FILE$ | [lame] &#8211;resample 44100 &#8211;silent -q $QUALITY$ $BITRATE$ -x -r - -</p></blockquote>
<p>aac playback still wasn&#8217;t working, so i went to:</p>
<p>settings -&gt; advanced -&gt;logging</p>
<p>and enabled &#8220;debug&#8221; logging for player.source.</p>
<p>parsing the logfile output revealed the following line:</p>
<blockquote><p>[09-11-10 21:20:08.1582] Slim::Player::Song::open (548) Tokenized command &#8220;/usr/share/squeezeboxserver/Bin/i386-linux/faad&#8221; -w -f 2 &#8220;/home/lad/Music/iTunes/iTunes Music/A Fine Frenzy/One Cell In The Sea/04 You Picked Me 1.m4a&#8221; | &#8220;/usr/local/bin/lame&#8221; &#8211;resample 44100 &#8211;silent -q 9 -B 320 -x -r - - &amp; |</p></blockquote>
<p>strangely, trying to execute:</p>
<p>&gt; /usr/share/squeezeboxserver/Bin/i386-linux/faad</p>
<p>led to an error where linux claimed the file faad didn&#8217;t exist.  removing the faad file from /usr/share/squeezeboxserver/Bin/i386-linux/ caused squeezebox center to search for faad in the default linux location (/usr/bin).</p>
<p>i reloaded and suddenly, angels sang.</p>
]]></content:encoded>
			<wfw:commentRss>http://desk.stinkpot.org:8080/tricks/index.php/2009/11/get-aac-playback-working-in-squeezeboxcenter-in-debian/feed/</wfw:commentRss>
		</item>
		<item>
		<title>how to restore from a time machine smartbundle</title>
		<link>http://desk.stinkpot.org:8080/tricks/index.php/2009/11/how-to-restore-from-a-time-machine-smartbundle/</link>
		<comments>http://desk.stinkpot.org:8080/tricks/index.php/2009/11/how-to-restore-from-a-time-machine-smartbundle/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 22:15:47 +0000</pubDate>
		<dc:creator>Lawrence David</dc:creator>
		
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://desk.stinkpot.org:8080/tricks/?p=303</guid>
		<description><![CDATA[let&#8217;s say you&#8217;ve gone and done something rash and created a DIY time capsule.   how do you restore from the backup if your hard drive goes belly up?

get a working hard drive and install a fresh copy of os x
create a new user (try and give that user a username different from your [...]]]></description>
			<content:encoded><![CDATA[<p>let&#8217;s say you&#8217;ve gone and done something rash and <a href="http://desk.stinkpot.org:8080/tricks/index.php/2009/01/how-to-get-time-machine-working-to-a-networked-hard-drive/" target="_blank">created a DIY time capsule</a>.   how do you restore from the backup if your hard drive goes belly up?</p>
<ol>
<li>get a working hard drive and install a fresh copy of os x</li>
<li>create a new user (try and give that user a username different from your old user name)</li>
<li>log on as the new user.  connect to the server hosting your smartbundle backup.</li>
<li>drag the smart bundle to disk utility&#8217;s left pane.  double click to mount.</li>
<li>open &#8220;migration assistant&#8221; and select restore from a &#8220;time machine backup.&#8221;</li>
<li>cross your fingers and hope for the best!</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://desk.stinkpot.org:8080/tricks/index.php/2009/11/how-to-restore-from-a-time-machine-smartbundle/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
