<?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>pogma &#187; computers</title>
	<atom:link href="http://pogma.com/category/computers/feed/" rel="self" type="application/rss+xml" />
	<link>http://pogma.com</link>
	<description>Pogma&#039;s blog</description>
	<lastBuildDate>Sat, 05 Mar 2011 18:01:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Lots and lots of xterms</title>
		<link>http://pogma.com/2010/11/14/lots-and-lots-of-xterms/</link>
		<comments>http://pogma.com/2010/11/14/lots-and-lots-of-xterms/#comments</comments>
		<pubDate>Sun, 14 Nov 2010 19:26:25 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[computers]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://pogma.com/?p=191</guid>
		<description><![CDATA[I use a lot of xterms &#8211; dozens of them, each one runs an ssh session. When I first started working for The Written Word, Inc. I used to start each xterm, manually place it on the screen on the desktop I wanted it on, type &#8216;exec ssh &#60;host&#62;&#8216; in each one, and start/resume a [...]]]></description>
			<content:encoded><![CDATA[<p>I use a lot of xterms &#8211; dozens of them, each one runs an ssh session. When I first started working for <a href="http://thewrittenword.com">The Written Word, Inc.</a> I used to start each xterm, manually place it on the screen on the desktop I wanted it on, type &#8216;<code>exec ssh &lt;host&gt;</code>&#8216; in each one, and start/resume a <a href="http://www.gnu.org/software/screen/">screen</a> session. Whenever the connection dropped, I had to do it all over again. What a pain. So I scripted part of it.</p>
<p>The first thing I scripted was starting all those xterms and running exec ssh in each. If you start an xterm with the <code>-ls</code> argument, it starts a login shell in the terminal. So your login scripts will get run. Using this idea, I edited my login script (<code>~/.bash_profile</code>) and appended:</p>
<pre>
if test -n "${_SSH_HOST}"; then
exec ssh ${_SSH_HOST}
fi
</pre>
<p>Then I wrote a quickie &#8220;<code>commute</code>&#8221; script:</p>
<pre>
#!/bin/bash
: ${_SSH_HOSTS="every host that I wanted to connect to"}
for _SSH_HOST in ${_SSH_HOSTS}; do
export _SSH_HOST
xterm +sb -ls -geometry 79x25 -title $_SSH_HOST &#038;
done
</pre>
<p>This script starts xterms with no scrollbar, running a login shell, 79 columns, 25 rows, and sets the window title to the host that the login script will <code>exec ssh</code> to. The strange geometry for the xterms is so that I can fit 12 terminals per virtual desktop. Using a more standard geometry would only allow 9, with a lot of unused space.</p>
<p>So things were improved, now I only had to manually place each xterm, and start the screen sessions in each one. For a little while I was ok, but then I thought to eliminate the manual screen session starting. Using <a href="http://expect.sourceforge.net/">expect</a> I was able to easily record these actions, and edit the generated script. Now all I had to do in the event of a network timeout, or reboot etc was to manually place all these xterms in the correct location, on the correct desktop.</p>
<p>Of course, I wasn&#8217;t happy with that either, so I changed the <code>-geometry</code> argument to xterm to note the screen location. With each xterm being 479&#215;349 pixels, it was easy to calculate where I wanted the next terminal to go. I had had to put in several &#8220;<code>sleep</code>&#8221; statements in my script previously to allow time for the terminals to actually appear on the screen etc. and some of these had to stay, but now all that was required to do manually was wait for the desktop to fill up with xterms, and click the mouse wheel to move to the next virtual desktop 4 or 5 times. Easy! <img src='http://pogma.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Last week, a switch decided it was time to die, dropping connections a couple of times a day, which meant I had connectivity problems for a couple of days until I discovered that it was the switch that was the problem and not the new router as I had assumed. This meant that I had to do the mouse wheel click to new desktop procedure 4 or 5 times over the course of two days. Doing it once a month or so was an acceptable imposition, but now it was again a pain.</p>
<p>At first, I installed the python bindings for libwnck and attempted to script the xterm window placement, however, I failed to get anything working as quickly as I had expected (would have been easier if I had found <a href="http://git.gnome.org/browse/gnome-python-desktop/tree/examples/wnck_example.py"> wnck_example.py</a>). Another quick google search led me to <a href="http://burtonini.com/blog/computers/devilspie/">devilspie</a>. This seemed perfect. Now, at the beginning of my commute script, I generate a devilspie config file:</p>
<pre>
# Initialize variables
_workspace=2
_col=0
_row=0
# Create new empty config file
:> /home/pogma/pies
# populate config file
for _SSH_HOST in ${_SSH_HOSTS}; do
 echo "(if (matches (window_name) \"${_SSH_HOST}\")\
 (begin (geometry \"479x329+$((480*_row))+$((350*_col))\")\
 (set_workspace ${_workspace})))" >>/home/pogma/pies
 _col=$((_col+1))
 if test ${_col} -gt 2; then
   _col=0
   _row=$((_row+1))
 fi
 if test ${_row} -gt 3; then
   _row=0;
   _workspace=$((_workspace+1))
 fi
done
devilspie /home/pogma/pies >/dev/null 2>&#038;1 &#038;
# We'll kill devilspie later
_pid=$!
...
[snip rest of file to start xterms, start/resume screen sessions etc]
</pre>
<p>The geometry is a little odd because the window height does not include the title bar. Now, I can start my dozens of xterms, ssh to all those hosts, start the screen sessions if necessary, place the xterms properly, all with one script.</p>
]]></content:encoded>
			<wfw:commentRss>http://pogma.com/2010/11/14/lots-and-lots-of-xterms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>history with timestamps</title>
		<link>http://pogma.com/2009/12/18/history-with-timestamps/</link>
		<comments>http://pogma.com/2009/12/18/history-with-timestamps/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 19:00:28 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[aside]]></category>
		<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://pogma.com/?p=154</guid>
		<description><![CDATA[The other day I wanted to know when I had done something in my shell history, I asked on irc, and dre^ answered -> fc -d for zsh Now I find myself looking at fc -l -d even when I don&#8217;t really need timestamps % fc -l -d [snip] 356 14:56 vim sem.c 357 18:09 [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I wanted to know when I had done something in my shell history, I asked on irc, and <a href="http://dreness.com">dre^</a> answered -> fc -d for zsh</p>
<p>Now I find myself looking at fc -l -d even when I don&#8217;t really need timestamps <img src='http://pogma.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
<code>
<pre>
% fc -l -d
[snip]
  356  14:56  vim sem.c
  357  18:09  gmake
  358  18:10  vim buffer.c
</pre>
<p></code></p>
<p>It is possible to get similar behavior with bash:<br />
<code>
<pre>
$ HISTTIMEFORMAT="%T " history 3
 1386  09:36:54 grep -rl afio .
 1387  09:37:55 vim ChangeLog
 1388  12:56:57 HISTTIMEFORMAT="%T " history 3
</pre>
<p></code></p>
<p>Where HISTTIMEFORMAT uses an strftime string.</p>
<p>Yet another useless bit of knowledge!</p>
]]></content:encoded>
			<wfw:commentRss>http://pogma.com/2009/12/18/history-with-timestamps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Libtool 2.2.6b released</title>
		<link>http://pogma.com/2009/11/16/libtool-2-2-6b-released/</link>
		<comments>http://pogma.com/2009/11/16/libtool-2-2-6b-released/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 17:15:44 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://pogma.com/?p=141</guid>
		<description><![CDATA[I released libtool 2.2.6b today. Yes, I have already taken flak for the stupid version numbering. I apologize. The release has only 2 real patches from 2.2.6, both for libltdl. See the announcement for slightly more detail. Some users may be stuck using an older libltdl for whatever reason, for those users the same changes [...]]]></description>
			<content:encoded><![CDATA[<p>I released libtool 2.2.6b today. Yes, I have already taken flak for the stupid version numbering. I apologize.</p>
<p>The release has only 2 real patches from 2.2.6, both for libltdl. See the <a href="http://lists.gnu.org/archive/html/libtool/2009-11/msg00059.html">announcement</a> for slightly more detail.</p>
<p>Some users may be stuck using an older libltdl for whatever reason, for those users the same changes are provided by <a href="http://git.savannah.gnu.org/cgit/libtool.git/patch/?id=29b48580df75f0c5baa2962548a4c101ec7ed7ec">this</a> untested patch.</p>
<p>[Update 2009-11-21]<br />
The change to libltdl to not search in the current working directory for modules when lt_dlopen() is called without an absolute path breaks at least <a href="http://www.mpg123.de/">mpg123</a>. <a href="http://paste.lisp.org/display/90875">This</a> patch should work around the problem until the mpg123 folks fix it.</p>
<p>[Update 2009-12-02]<br />
This release was to fix the now published <a href="http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2009-3736">CVE-2009-3736</a>. If you have not already updated, doing so soon is advisable.</p>
]]></content:encoded>
			<wfw:commentRss>http://pogma.com/2009/11/16/libtool-2-2-6b-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snow Leopard and offlineimap</title>
		<link>http://pogma.com/2009/09/09/snow-leopard-and-offlineimap/</link>
		<comments>http://pogma.com/2009/09/09/snow-leopard-and-offlineimap/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 13:58:41 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://pogma.com/?p=133</guid>
		<description><![CDATA[Yesterday tjcarter was complaining in #fink about offlineimap not working on Snow Leopard, so last night I thought I&#8217;d take a look. Indeed, it doesn&#8217;t work, and the reason is that &#8216;import locale&#8217; is being called on a thread, which loads _locale.so, which requires that the CoreFoundation framework also be loaded. A simple reproducer in [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday tjcarter was complaining in #fink about <a href="http://www.sturmnet.org/blog/2009/09/02/using-offlineimap-on-snow-leopard-the-re">offlineimap not working on Snow Leopard</a>, so last night I thought I&#8217;d take a look.</p>
<p>Indeed, it doesn&#8217;t work, and the reason is that &#8216;import locale&#8217; is being called on a thread, which loads _locale.so, which requires that the CoreFoundation framework also be loaded. A simple reproducer in python is:<br />
<code></p>
<pre>
import os, sys
import threading
class Foo(threading.Thread):
	def __init__(self):
		threading.Thread.__init__(self)
	def run(self):
		import locale

t = Foo()
t.start()
</pre>
<p></code></p>
<p>The CoreFoundation framework must be loaded on the &#8220;main&#8221; thread, its initialization expects that, if it is loaded on some other thread, then it causes the application to exit rather abruptly. You can reproduce the same thing easily in C with:<br />
<code></p>
<pre>
#include &lt;dlfcn.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;pthread.h&gt;

void* do_open(void* unused) {
        void * handle = dlopen("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", RTLD_GLOBAL);
        if (! handle) fprintf(stderr,"ERROR: %s\n",dlerror());
        pthread_exit(NULL);
}

int main() {
        pthread_t t;
        pthread_attr_t a;
        if (pthread_attr_init(&#038;a)) exit(1);
        if (pthread_create(&#038;t,&#038;a,do_open,NULL)) exit(2);
        pthread_attr_destroy(&#038;a);
        sleep(5);
        return 0;
}
</pre>
<p></code></p>
<p>The failure can be avoided/worked around by ensuring that CoreFoundation is loaded on the main thread. For offlineimap, a simple way to do this is to put &#8216;import locale&#8217; in the main script before init.startup is run. This will load _locale.so and thus CoreFoundation. CoreFoundation will run its initializers, and all will be well.</p>
<p>I am pretty sure that I have seen it documented somewhere that Apple&#8217;s frameworks must be loaded on the main thread, but I don&#8217;t seem to be able to find that documentation this morning (perhaps I just need more coffee?). In any case, loading any libraries that you need at application startup before you go spinning off threads is, in my opinion, a reasonable solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://pogma.com/2009/09/09/snow-leopard-and-offlineimap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>odcctools-20090808</title>
		<link>http://pogma.com/2009/08/08/odcctools-20090808/</link>
		<comments>http://pogma.com/2009/08/08/odcctools-20090808/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 21:28:48 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://pogma.com/?p=114</guid>
		<description><![CDATA[I released odcctools today, no changes for the last month or so, so I thought I had better put something out there. http://svn.macosforge.org/repository/odcctools/release/odcctools-20090808.tar.bz2]]></description>
			<content:encoded><![CDATA[<p>I released odcctools today, no changes for the last month or so, so I thought I had better put something out there.</p>
<p><a href="http://svn.macosforge.org/repository/odcctools/release/odcctools-20090808.tar.bz2">http://svn.macosforge.org/repository/odcctools/release/odcctools-20090808.tar.bz2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://pogma.com/2009/08/08/odcctools-20090808/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac for Linux Geeks</title>
		<link>http://pogma.com/2009/02/04/mac-for-linux-geeks/</link>
		<comments>http://pogma.com/2009/02/04/mac-for-linux-geeks/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 17:14:25 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://pogma.com/?p=87</guid>
		<description><![CDATA[I was the Technical Reviewer for the book Mac for Linux Geeks, from Apress, Inc. by Tony Steidler-Dennison. It was my first time to be a Technical Reviewer, it was interesting, but not something I plan on repeating, it simply took up too much time, with not enough pay. Getting paid by the page is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://apress.com/book/view/9781430216506"><img class="alignleft" title="Mac for Linux Geeks" src="http://apress.com/resource/bookcover/9781430216506?size=medium" alt="Cover of the book Mac for Linux Geeks" /></a>I was the Technical Reviewer for the book Mac for Linux Geeks, from Apress, Inc. by Tony  Steidler-Dennison. It was my first time to be a Technical Reviewer, it was interesting, but not something I plan on repeating, it simply took up too much time, with not enough pay. Getting paid by the page is not a good thing.</p>
<p>This is not a book review, I don&#8217;t think that I would be a good reviewer, being biased, as I am. Please find reviews elsewhere &#8211; although a quick look at amazon shows none there yet, unfortunately.</p>
<p>[EDIT June 22nd 2009] Found a review here <a href="http://hants.lug.org.uk/cgi-bin/wiki.pl?BookReviews/MacForLinuxGeeks">http://hants.lug.org.uk/cgi-bin/wiki.pl?BookReviews/MacForLinuxGeeks</a>. It&#8217;s the only one I could find.</p>
]]></content:encoded>
			<wfw:commentRss>http://pogma.com/2009/02/04/mac-for-linux-geeks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gcc commit bit</title>
		<link>http://pogma.com/2008/04/02/gcc-commit-bit/</link>
		<comments>http://pogma.com/2008/04/02/gcc-commit-bit/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 04:13:36 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[aside]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://pogma.com/2008/04/02/gcc-commit-bit/</guid>
		<description><![CDATA[I got a commit bit for the gcc subversion repository yesterday, and exercised it for the first time today with this commit. Even though the number of patches that we have for gcc is very small, doing the commit beats heck out of begging on the mailing list for someone to commit for us]]></description>
			<content:encoded><![CDATA[<p>I got a commit bit for the <a href="http://gcc.gnu.org">gcc</a> subversion repository yesterday, and exercised it for the first time today with <a href="http://gcc.gnu.org/viewcvs?view=rev&amp;revision=133842">this</a> commit. Even though the number of patches that we have for gcc is very small, doing the commit beats heck out of begging on the mailing list for someone to commit for us <img src='http://pogma.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://pogma.com/2008/04/02/gcc-commit-bit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Libtool-2.2 is released</title>
		<link>http://pogma.com/2008/03/02/libtool-22-is-released/</link>
		<comments>http://pogma.com/2008/03/02/libtool-22-is-released/#comments</comments>
		<pubDate>Sun, 02 Mar 2008 07:29:00 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[aside]]></category>
		<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://pogma.com/2008/03/02/libtool-22-is-released/</guid>
		<description><![CDATA[Only a little late &#8211; it has been promised to arrive in the next couple of weeks for 4 years now, Gary released libtool-2.2 today. Thanks Gary!]]></description>
			<content:encoded><![CDATA[<p>Only a little late &#8211; it has been promised to arrive in the next couple of weeks for 4 years now, <a href="http://blog.azazil.net/" title="Gary's blog">Gary</a> released <a href="http://www.gnu.org/software/libtool" title="Libtool home page">libtool-2.2</a> today. Thanks Gary!</p>
]]></content:encoded>
			<wfw:commentRss>http://pogma.com/2008/03/02/libtool-22-is-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nmedit, libtool, exported symbols</title>
		<link>http://pogma.com/2008/02/13/nmedit-libtool-exported-symbols/</link>
		<comments>http://pogma.com/2008/02/13/nmedit-libtool-exported-symbols/#comments</comments>
		<pubDate>Wed, 13 Feb 2008 06:09:55 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://pogma.com/2008/02/13/nmedit-libtool-exported-symbols/</guid>
		<description><![CDATA[One of the changes that we made in libtool-1.5.26 and cvs HEAD was to change the archive_expsym_cmds on darwin. With leopard the older method of creating the output and then using nmedit to reduce the exported symbols seems to work, but the dynamic linker then sometimes fails to load the resulting object. Both this apache [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">One of the changes that we made in libtool-1.5.26 and cvs HEAD was to change the archive_expsym_cmds on darwin. With leopard the older method of creating the output and then using nmedit to reduce the exported symbols seems to work, but the dynamic linker then sometimes fails to load the resulting object. Both this apache <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=44384">bug</a> and this <a href="http://bugzilla.gnome.org/show_bug.cgi?id=503114">gnome </a>bug are fixed by using ld&#8217;s -exported_symbols_list flag instead. I am glad the change made it into 1.5.26 <img src='http://pogma.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: left;">Of course the reason that libtool did not use  -exported_symbols_list in the first place is that Mac OS X 10.0 and 10.1 do not support it, and nmedit did the job just fine up to 10.5. Apple seems to have allowed nmedit to bitrot, it no longer does the same job that it did in 10.4. Filing a bug that you know in advance is just going to be closed with &#8220;use ld&#8217;s -exported_symbols_list flag&#8221; seems kind of pointless, but I guess I should do it anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://pogma.com/2008/02/13/nmedit-libtool-exported-symbols/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>libtool releases</title>
		<link>http://pogma.com/2008/02/02/libtool-releases/</link>
		<comments>http://pogma.com/2008/02/02/libtool-releases/#comments</comments>
		<pubDate>Sat, 02 Feb 2008 08:50:26 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[aside]]></category>
		<category><![CDATA[computers]]></category>

		<guid isPermaLink="false">http://pogma.com/2008/02/02/libtool-releases/</guid>
		<description><![CDATA[I released libtool-1.5.26 yesterday and Gary released 2.1b the day before. With any luck 2008 will be the year the 1.5 branch dies forever.]]></description>
			<content:encoded><![CDATA[<p>I released libtool-1.5.26 yesterday and Gary released 2.1b the day before. With any luck 2008 will be the year the 1.5 branch dies forever.</p>
]]></content:encoded>
			<wfw:commentRss>http://pogma.com/2008/02/02/libtool-releases/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

