<?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</title>
	<atom:link href="http://pogma.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://pogma.com</link>
	<description>Pogma&#039;s blog</description>
	<lastBuildDate>Fri, 18 Dec 2009 19:07:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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
  [...]]]></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>Moved to prgmr.com</title>
		<link>http://pogma.com/2009/12/14/moved-to-prgmr-com/</link>
		<comments>http://pogma.com/2009/12/14/moved-to-prgmr-com/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 03:07:33 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://pogma.com/?p=148</guid>
		<description><![CDATA[For nearly 9 years this site has been hosted at pair.com, and I have had no problems there. Any time I have contacted pair support, I have had excellent response, they host everything on FreeBSD, and have, in the past, made monetary contributions to the FreeBSD project. They seem to be very professional, and uptime [...]]]></description>
			<content:encoded><![CDATA[<p>For nearly 9 years this site has been hosted at <a href="http://pair.com">pair.com</a>, and I have had no problems there. Any time I have contacted pair support, I have had excellent response, they host everything on <a href="http://freebsd.org">FreeBSD</a>, and have, in the past, made monetary contributions to the FreeBSD project. They seem to be very professional, and uptime has been fantastic.</p>
<p>I have become more and more unhappy with their pricing though. I have been using pairs <a href="http://www.pair.com/services/web_hosting/">Advanced</a> account, which provides 1.5GB of disk space and 80GB/month bandwidth, and paying $20/month for it. A few years ago pair introduced a <a href="http://www.pairlite.com/hosting/">pairlite</a> service which would have suited my needs better, but I had already been a customer for years, and moving was harder than doing nothing, so I did nothing <img src='http://pogma.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p> I kept an eye on webhost pricing though, and finally my stinginess exceeded my laziness, and I decided to move. I looked at <a href="http://dreamhost.com">dreamhost</a>, tried a trial, liked it, but wanted more control, so I began to look for a VPS. Eventually I stumbled on  <a href="http://prgmr.com">Prgmr.com</a>. I don&#8217;t care if uptime is a little lower than it has been, it&#8217;s only a blog, a collection of random crap, and email. Prgmr is cheap, dirt cheap. For my same $20, I get a VPS with 22GB of disk space, 1024MB of memory, and 160GB/month bandwidth. Of course, it is no longer managed hosting, it is entirely DIY hosting. And that&#8217;s just fine <img src='http://pogma.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Not everything is moved to prgmr yet, web site is moved, so is DNS, email not yet. Will move that in a few days, and then finally cancel my account with pair.</p>
]]></content:encoded>
			<wfw:commentRss>http://pogma.com/2009/12/14/moved-to-prgmr-com/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 are provided [...]]]></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://pogma.com/misc/backport_libltdl_changes_to_1_5.patch">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 python [...]]]></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>Road Trip 2009</title>
		<link>http://pogma.com/2009/09/04/road-trip-2009/</link>
		<comments>http://pogma.com/2009/09/04/road-trip-2009/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 19:47:23 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Road Trip]]></category>

		<guid isPermaLink="false">http://pogma.com/?p=125</guid>
		<description><![CDATA[
August 18th. Left home late, drove to the border, and on to Fargo. Bought a disposable phone in case we needed it for emergencies etc. (we didn&#8217;t) and then on to Montana. We had planned to make it all the way to Billings, MT the first day, but due to leaving late etc. instead planned [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://pogma.com/misc/roadtrip.jpg" alt="Google Earth route of roadtrip" width="500" /><br />
August 18th. Left home late, drove to the border, and on to Fargo. Bought a disposable phone in case we needed it for emergencies etc. (we didn&#8217;t) and then on to Montana. We had planned to make it all the way to Billings, MT the first day, but due to leaving late etc. instead planned on staying in Glendive.</p>
<p>Got to Glendive late, and all the hotels were full of road construction workers, so drove on to Miles City. Stayed in Motel 6. It was ok, clean, wifi worked at night, but not in the morning.</p>
<p>August 19th, drove to Pocatello, ID. 531 miles, 9 and a half hours. Drove through the north west corner of Yellowstone park. Lots of roadworks, but it was ok as the scenery was worth looking at.</p>
<p>Stayed at the Best Western Cottontree Inn, very nice room. Internet worked well, good breakfast included.</p>
<p>Next day, drove to Las Vegas. Shannon drove for a hundred miles or so, the only time she drove this trip. The road south from Salt Lake City is extremely boring, nobody bothered going the speed limit, unlike North Dakota, Montana and Idaho, where most drivers seemed to stay at or under it. In fact, Utah, Nevada, California, and Oregon seemed to require speeding.</p>
<p>Arrived at Circus Circus, cheap room, old, internet was $12/day extra (and was incapable, at times, of streaming video from Hulu, or Disney.com). 110F, we walked down the strip a little, too hot. Jessica&#8217;s crocs began to melt.</p>
<p>Next day was hotter, we went to Hoover Dam. The tour inside the dam was nice and cool, but outside was almost unbearable. The afternoon and evening were at the pool, or in the Casino.</p>
<p>Another boring drive across the desert to Anaheim. Stayed at another Best Western for three nights. Disneyland, 2 days. Compromise is sometimes necessary.</p>
<p>August 25th &#8211; drove to Monterey. Tried to stay on the coast highway, but our GPS (&#8220;Nancy the Navigator&#8221;) wanted us on the interstate, so we sometimes strayed. Stayed at the Monterey Surf Inn. Very nice room. Internet was acceptable.</p>
<p>August 26th, went to the Monterey Aquarium, it was fantastic. We were there for 3 hours and still missed stuff.</p>
<p>Drove to Boulder Creek for lunch on highway 9. Two beers, hot dog, and 2 burgers and fries for $15. Don&#8217;t know how much the new brakes for the minivan will be yet.</p>
<p>Stopped in at Apple and said &#8220;Hi&#8221;, then drove to San Francisco. We had planned to stay at the Travelodge, but the bulletproof glass, and the police tape put us off (though $39 for a room was tempting), so we stayed at yet another Best Western instead. The free wifi was barely usable, but the room was again, very nice. No free breakfast.</p>
<p>Next day, bought 3 one-day passes for the Muni, and did a few touristy things, rode the streetcar and the cable car, went to chinatown, took a &#8220;rocket boat&#8221; tour of the bay. We had wanted to visit alcatraz, but the tours were sold out 4 days in advance.</p>
<p>The next day, drove over the Golden Gate bridge, and did the winery thing. Went to Benziger winery and did the tour, tasted some wine, and bought a $40 bottle of Merlot. Then went to Kaz winery, paid $5 and tried 6 wines, bought none. St Francis winery, I did note taste, they thoughtfully provided Jessica with crayons and paper, Shannon tasted everything and bought a $20 bottle of Cabernet Sauvignon. On our way back to the coast we stopped in at Yorkville Cellars and bought a $25 bottle of Malbec.</p>
<p>We drove to Fort Bragg and stayed in the Travelodge. The room was ok, internet was not. One WAP that (speculation) could maybe handle 5 simultaneous clients, and a single residential comcast connection for the entire hotel. Glass beach was interesting the next morning.</p>
<p>Next day continued up the coast to Oregon, and the Pacific Beach resort in Gold Beach. This place also had &#8220;free wifi&#8221; &#8211; as long as you connected to the next door hotel&#8217;s access point. Unsurprisingly that was overloaded. Wandered along the beach, looking at driftwood.</p>
<p>Started heading back the next day. Put &#8220;Coeur D&#8217;Alene&#8221; as the destination into the GPS, and it took us over some interesting mountain pass. Shannon was mad (and scared). We did make it all the way, with few stops, and stayed at the Motel 6 in Coeur D&#8217;Alene. Hotel wifi was $3/24 hours, but was excellent.</p>
<p>Long drive to Glendive next day. Stayed in another Best Western. Good. Nice breakfast, pool. Glendive is a small place, not a lot there.</p>
<p>Next day, to Grand Forks, and the CanadInn, with the water slide park etc. Jessica enjoyed it. Then a little shopping, and home.</p>
<p>A compressed gps log of the trip is <a href="http://pogma.com/misc/roadtrip.gpx.gz">here</a>, if you are so inclined, you can download it, decompress it and load it into google earth.</p>
<p>Photos are<a href="http://pogma.com/gallery/v/roadtrip/">here</a> though we have not uploaded all of them (and I haven&#8217;t bothered GPS tagging them).</p>
<p>In case you&#8217;re wondering what the heck I was using the hotel wifi for everywhere, it was to plan the next days trip. We did not have much of a plan in advance, and had to figure it out as we went. In some cases (Circus Circus), the hotel did not provide kids TV channels, so we used the internet to watch TV. Also, I can&#8217;t go very long without checking my email <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/2009/09/04/road-trip-2009/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>Alignment</title>
		<link>http://pogma.com/2009/04/05/alignment/</link>
		<comments>http://pogma.com/2009/04/05/alignment/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 04:20:17 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://pogma.com/?p=95</guid>
		<description><![CDATA[Due to some recent bus errors, I have been thinking a bit about alignment lately.
When the compiler lays out a struct it will generally ensure that the members of the struct are aligned on the required boundaries for the target architecture. For example, given:
struct foo {
int32_t a;
int16_t b;
};
A compiler may lay it out something like [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Due to some recent bus errors, I have been thinking a bit about alignment lately.</p>
<p style="text-align: justify;">When the compiler lays out a struct it will generally ensure that the members of the struct are aligned on the required boundaries for the target architecture. For example, given:</p>
<p><code>struct foo {<br />
int32_t a;<br />
int16_t b;<br />
};</code><br />
A compiler may lay it out something like this:</p>
<table style="text-align: center; color: black; border: thin solid #000000;" border="0" cellspacing="0" cellpadding="0" width="200" align="center">
<tbody>
<tr>
<td style="background:green; border: thin solid #000000;" width="120">0x??????04</td>
<td style="background:orange; text-align: center;border: thin solid #000000;" rowspan="4">a</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????05</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????06</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????07</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????08</td>
<td style="background:red; text-align: center;border: thin solid #000000;" rowspan="2">b</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????09</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0A</td>
<td style="background: yellow; text-align: center;border: thin solid #000000;" rowspan="2">pad</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0B</td>
</tr>
</tbody>
</table>
<p style="text-align: justify;">The entire struct will likely be placed at an address aligned on a 4 byte boundary because the largest struct member is 4 bytes long, and the int16 type will be followed by a 2 byte pad. Why? So that an array of structs will have the &#8216;a&#8217; member for all array elements aligned on a 4 byte boundary. All is good, right?</p>
<p style="text-align: justify;">If we add a char to the struct:</p>
<p><code>struct foo {<br />
int32_t a;<br />
char c;<br />
int16_t b;<br />
};</code></p>
<table style="text-align: center; color: black; border: thin solid #000000;" border="0" cellspacing="0" cellpadding="0" width="200" align="center">
<tbody>
<tr>
<td style="background:green; border: thin solid #000000;" width="120">0x??????04</td>
<td style="background:orange; text-align: center;border: thin solid #000000;" rowspan="4">a</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????05</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????06</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????07</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????08</td>
<td style="background: pink; text-align: center;border: thin solid #000000;">c</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????09</td>
<td style="background: yellow; text-align: center;border: thin solid #000000;">pad</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0A</td>
<td style="background:red; text-align: center;border: thin solid #000000;" rowspan="2">b</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0B</td>
</tr>
</tbody>
</table>
<p style="text-align: justify;">Changing our char type to a 64 bit type may result in something like this:</p>
<p><code>struct foo {<br />
int32_t a;<br />
int64_t c;<br />
int16_t b;<br />
};</code></p>
<table style="text-align: center; color: black; border: thin solid #000000;" border="0" cellspacing="0" cellpadding="0" width="200" align="center">
<tbody>
<tr>
<td style="background:green; border: thin solid #000000;" width="120">0x??????00</td>
<td style="background:orange; text-align: center;border: thin solid #000000;" rowspan="4">a</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????01</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????02</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????03</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????04</td>
<td style="background: yellow; text-align: center;border: thin solid #000000;" rowspan="4">pad</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????05</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????06</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????07</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????08</td>
<td style="background: pink; text-align: center;border: thin solid #000000;" rowspan="8">c</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????09</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0A</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0B</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0C</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0D</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0E</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0F</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????10</td>
<td style="background:red; text-align: center;border: thin solid #000000;" rowspan="2">b</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????11</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????12</td>
<td style="background: yellow; text-align: center;border: thin solid #000000;" rowspan="6">pad</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????13</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????14</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????15</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????16</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????17</td>
</tr>
</tbody>
</table>
<p style="text-align: justify;">In this case (for this imaginary compiler) the entire struct is aligned on an 8 byte boundary, with the 8 byte member also aligned on an 8 byte boundary. So we can still create an array of struct foo, and things will be properly aligned. Of course, even though the individual members of the structure are 4, 8 and 2 bytes long, the entire structure with padding is 24 bytes long, so 10 bytes are &#8220;wasted&#8221;, it is best to design structs with this in mind, so that my imaginary compiler does not waste space. In the above case, changing the order of the elements is helpful:</p>
<p><code>struct foo {<br />
int32_t a;<br />
int16_t b;<br />
int64_t c;<br />
};</code></p>
<table style="text-align: center; color: black; border: thin solid #000000;" border="0" cellspacing="0" cellpadding="0" width="200" align="center">
<tbody>
<tr>
<td style="background:green; border: thin solid #000000;" width="120">0x??????00</td>
<td style="background:orange; text-align: center;border: thin solid #000000;" rowspan="4">a</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????01</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????02</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????03</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????04</td>
<td style="background:red; text-align: center;border: thin solid #000000;" rowspan="2">b</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????05</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????06</td>
<td style="background: yellow; text-align: center;border: thin solid #000000;" rowspan="2">pad</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????07</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????08</td>
<td style="background: pink; text-align: center;border: thin solid #000000;" rowspan="8">c</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????09</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0A</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0B</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0C</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0D</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0E</td>
</tr>
<tr height="13">
<td style="background:green;border: thin solid #000000;">0x??????0F</td>
</tr>
</tbody>
</table>
<p>Now, on some systems a program will run faster if types are aligned &#8220;properly&#8221;, on others a bus error will occur for misaligned access. Misaligned access will often occur in cases like this:<code><br />
char array[1024];<br />
...<br />
struct foo * bar = (struct foo *)array;<br />
bar-&gt;c = 1;<br />
</code></p>
<p style="text-align: justify;">In the above case, although the array certainly is large enough to hold a foo structure, there is no guarantee that a char will be aligned on an 8 byte boundary, it is a 1 byte type, so there is no need for the compiler to align it. Because of this bar-&gt;c = 1; could cause a bus error. Other  bus errors can occur casting structs of the same size, but with different alignment requirements, etc.</p>
<p style="text-align: justify;">At least firefox works for us on HP-UX now <img src='http://pogma.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: justify;">Shantonu noted that for gcc, using -Wcast-align will at least warn about this issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://pogma.com/2009/04/05/alignment/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 [...]]]></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>Have a magical day!</title>
		<link>http://pogma.com/2008/05/13/have-a-magical-day/</link>
		<comments>http://pogma.com/2008/05/13/have-a-magical-day/#comments</comments>
		<pubDate>Wed, 14 May 2008 02:37:54 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://pogma.com/2008/05/13/have-a-magical-day/</guid>
		<description><![CDATA[Well, at the end of a week in Disney we got tired of hearing &#8220;Have a magical day&#8221;, had very sore feet and legs, and were sunburned. We did have fun though, despite the heat and all the happy helpful people that we encountered.
When we lived in Japan we went to Tokyo Disney once, and [...]]]></description>
			<content:encoded><![CDATA[<p>Well, at the end of a week in Disney we got tired of hearing &#8220;Have a magical day&#8221;, had very sore feet and legs, and were sunburned. We did have fun though, despite the heat and all the happy helpful people that we encountered.</p>
<p>When we lived in Japan we went to Tokyo Disney once, and to Universal Studios Japan several times. At Tokyo Disney, even though we went in the off-season on a school day, the wait times for most rides were over 60 minutes. At Universal  Studios Japan (unless you purchase their  &#8220;Express Pass Booklet&#8221;  which allows you to go into a faster queue) we have seen wait times of 180 minutes for popular rides.  We also went to Disney Paris a couple of times in January, snow and freezing rain tend to keep the visitor numbers down, so we did not have to wait at all for most rides. My expectations for Florida&#8217;s Disney world were wait times similar to  Japan. I was very pleasantly surprised.  The longest wait times we saw were 60 minutes, and for those rides that did have longer wait times, we got the &#8220;Fast Pass&#8221; and went back to them. <img src="http://pogma.com/gallery/d/1015-2/DSC00339.JPG" alt="Jessica at a slide in " align="right" border="0" height="240" hspace="3" vspace="3" width="320" /></p>
<p>The flights were fine and we were able to get to the &#8220;All Star Music Resort&#8221; on the Disney coach fairly easily. Little did we realize that escape from Disney would be impossible for the next 7 days. This had us paying $14 for a six-pack of beer, and $2 for a bottle of water for the week. The $10 a day extra for a fridge in the room and $9.95 a day for internet access also made me feel that we were being gouged.</p>
<p>The food was better than I had expected. I had thought that we would be eating burgers and fries for a week, but there were delicious alternatives &#8211; the kids meals all came with a choice of 2 sides, Jessica usually chose carrot sticks to go along with her fries, and there were delicious salads available too.</p>
<p>Jessica loved the rides, especially the scarier, faster ones. Space Mountain 5 times, Thunder Mountain 4 times, Splash Mountain 3 times, Everest adventure 3 times, Tower of Terror 4 times, Fast Track twice and Mission: Space. Unfortunately she did not quite make the 48 inch height requirement for some of the water slides at Typhoon Lagoon.</p>
<p>I am glad to be back at work &#8211; now I do not have to walk miles every day in 90+ F temperatures <img src='http://pogma.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Hopefully we can avoid theme parks for a couple of years.</p>
]]></content:encoded>
			<wfw:commentRss>http://pogma.com/2008/05/13/have-a-magical-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Whatever!</title>
		<link>http://pogma.com/2008/04/08/whatever/</link>
		<comments>http://pogma.com/2008/04/08/whatever/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 06:34:55 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Canada]]></category>
		<category><![CDATA[jessica]]></category>

		<guid isPermaLink="false">http://pogma.com/2008/04/08/whatever/</guid>
		<description><![CDATA[
I love this picture. We have to slick back her hair and put it into a bun for her ballet class. Of course, I have no experience in putting hair into a bun, so we decided to practice the other night. There were tears as I pulled at her hair, but afterwards she said &#8220;It&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center"><img src="http://pogma.com/gallery/d/886-2/DSC00183.JPG" alt="Jessica with attitude" border="1" height="240" hspace="20" width="320" /></p>
<p>I love this picture. We have to slick back her hair and put it into a bun for her ballet class. Of course, I have no experience in putting hair into a bun, so we decided to practice the other night. There were tears as I pulled at her hair, but afterwards she said &#8220;It&#8217;s ok, I have stopped crying now, and I really like my hair!&#8221;.</p>
<p>Hmm.</p>
]]></content:encoded>
			<wfw:commentRss>http://pogma.com/2008/04/08/whatever/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
