tag:blogger.com,1999:blog-9488688519719072652024-03-05T23:24:25.299+11:00Stuff I needed to knowA collection of stuff that I probably found out the hard way.Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.comBlogger30125tag:blogger.com,1999:blog-948868851971907265.post-59066835804280929732020-01-12T22:20:00.001+11:002020-01-12T22:20:10.684+11:00Siebenstein Master Puzzle (16pc jigsaw)I picked my copy of <a href="http://www.ultragadgets.be/contents/nl/p1689_Masterpuzzel-siebenstein.html" target="_blank">Siebenstein's Master Puzzle</a> at Essen Spiel 2019.<br />
<br />
I'm not sure if this is the expected solution, it didn't come with any rules.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGLAp-8aGZZPMBa1idLR4UqiXAoL5xBzh42gnhy_m0vef2xp8QWsNGc8DbqrA-DWDk-PUe-syAfYE5WDUtZQyW7_yYRuqlGyRkttj7R1iv2MZftF3ilm1URwTGi_pkalN15trPe-kos4U/s1600/siebenstein-master.jpg" imageanchor="1"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGLAp-8aGZZPMBa1idLR4UqiXAoL5xBzh42gnhy_m0vef2xp8QWsNGc8DbqrA-DWDk-PUe-syAfYE5WDUtZQyW7_yYRuqlGyRkttj7R1iv2MZftF3ilm1URwTGi_pkalN15trPe-kos4U/s400/siebenstein-master.jpg" width="300" /></a><br />
<br />
A couple of the fits are a bit snug but I put that down to laser cutting tolerances.Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-23409871526260970152019-04-07T19:18:00.001+10:002019-04-08T12:13:24.846+10:00Nifty FiftyAnother puzzle from Paris (I was sure I got this at <a href="http://www.variantes.com/" target="_blank">Variantes</a> but Pauline assures me it was Tumbleweed) that has sat in the drawer for years without being solved.<br />
<br />
Till today.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhomlPrjiFZRknXJT6w6xn9Gqk6Z2D1cOVR2VOYqi6EvV2xzV15a44ilpb8AQ3KRLJj7m8zLX6uiOTOrQ3lcuVLQEEbUYHnkXfPGxpNYEOlesDMTMONYi7DAQJCQPCGzrJLnH1MI64jeIE/s1600/nifty-fifty.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhomlPrjiFZRknXJT6w6xn9Gqk6Z2D1cOVR2VOYqi6EvV2xzV15a44ilpb8AQ3KRLJj7m8zLX6uiOTOrQ3lcuVLQEEbUYHnkXfPGxpNYEOlesDMTMONYi7DAQJCQPCGzrJLnH1MI64jeIE/s320/nifty-fifty.jpg" width="320" /></a></div>
<br />Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-52000215951325880092018-02-17T10:47:00.000+11:002018-02-17T10:47:33.491+11:00This isn't how two factor authentication is supposed to workDear Apple,<br />
<br />
I feel so much more secure now that I have <a href="https://support.apple.com/en-au/HT204915" target="_blank">two factor authentication enabled</a>.<br />
<br />
End Sarcasm.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUT3jfAJiA7FgDRbpJrew4COgdbkvHcED3fGMeREoAINxpUDqXc-oDshzNBIOYx9GQ4MM35Ab4GfSUlSl_7gFMkESSZKN8Ea_2-pFmP8qk7AaOalH7_XjpeY-dEQWBQp7UaofZvEmHZv8/s1600/appletwofactor.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="992" data-original-width="1528" height="258" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUT3jfAJiA7FgDRbpJrew4COgdbkvHcED3fGMeREoAINxpUDqXc-oDshzNBIOYx9GQ4MM35Ab4GfSUlSl_7gFMkESSZKN8Ea_2-pFmP8qk7AaOalH7_XjpeY-dEQWBQp7UaofZvEmHZv8/s400/appletwofactor.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">For those who don't get it,<br />it's sending the passcode to the actual device that is attempting access</td></tr>
</tbody></table>
Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-40757439884312453652017-11-28T09:42:00.001+11:002017-11-28T09:42:51.226+11:00The 2x2 BoxI bought this on a recent trip to Paris (from <a href="https://www.facebook.com/tumbleweedmarais/" target="_blank">Tumbleweed</a> - recommended highly) and it took enough time to solve that I'm happy with the purchase.<br />
<br />
If you examine all the pieces, you'll see that there seem to be four pairs of pieces, one of which is the reflection of the other. I spent a lot of time trying to form those pairs into shapes and then assembling those shapes.<br />
<br />
That didn't help.<br />
<br />
In the end, this is what it looks like, with the pieces carefully pulled apart.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZaqzG-LbtQcJQ0kdcGuzGzJmX8asyZ9eH9pehGUQ7X-rRp26ZCHdR19YYRnGRWPIV94mS5X_akkGuN05irGB20Pa25d4R76hgnN4eCYT0zaz_mm5Q5NrXdfqZBAnrRvXV_Yz6J7mjvYg/s1600/IMG_0672.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZaqzG-LbtQcJQ0kdcGuzGzJmX8asyZ9eH9pehGUQ7X-rRp26ZCHdR19YYRnGRWPIV94mS5X_akkGuN05irGB20Pa25d4R76hgnN4eCYT0zaz_mm5Q5NrXdfqZBAnrRvXV_Yz6J7mjvYg/s320/IMG_0672.JPG" width="320" /></a></div>
<br />
The cube was a bit tight getting it into the box one way, but when I rotated it 90 degrees it slipped in just fine - obviously just a tolerance error.<br />
<br />
All told, a fun puzzle that definitely took me more than a few days of trying on and off.Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-89819013765650358262017-11-28T09:35:00.000+11:002017-11-28T09:35:39.269+11:00Flexera Operations Portal startup problemsIf you run a FlexNet Operations Portal and it uses an Oracle database on the same Windows server, you may find that it fails to startup correctly when your host restarts.<br />
<br />
The problem I found was that insufficient dependencies are set up between the two Windows services, and they get into a race at startup. The FlexNet service always seems to get there before Oracle, gets locked up and never recovers.<br />
<br />
My fix was to add a dependency between the two services, using:<br />
<br />
<span style="font-size: small;"><span style="font-family: "Courier New", Courier, monospace;"><span id="j_id0:j_id3:pnlActivity"><span id="j_id0:j_id3:j_id78:j_id95"><span id="j_id0:j_id3:j_id78:j_id96:3:j_id100">sc config FlexNetOperations depend= Tcpip/Afd/MyOracleInstanceService</span></span></span></span></span><br />
<br />
This makes the FNO wait until the Oracle service is started, which has fixed the problem for me at least.<br />
<br />
Note, you need to reapply this fix every time you re-deploy the FNO software.Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-42884044746454319442017-06-06T09:07:00.000+10:002017-06-06T09:07:05.213+10:00Cryptic Crossword Helpers<div>
Trying to do <a href="http://www.crypticallstars.com/" target="_blank">American Cryptic Crosswords</a> can occasionally require snippets of US pop culture that few Australians recognise, so I'm going to start collecting them here so that others I try to turn on to cryptics don't give up in despair. This blog entry, more than any of my others, is likely to see edits as I encounter new references that need explaining:</div>
<br />
<table border="1">
<tbody>
<tr><td>letters</td>
<td>clued as</td>
</tr>
<tr>
<td>EL</td>
<td>Train, Railway</td>
<td><a href="https://en.wikipedia.org/wiki/Market%E2%80%93Frankford_Line" target="_blank">why?</a></td>
</tr>
<tr>
<td>OTT</td>
<td>Baseball player, Mel</td>
<td><a href="https://en.wikipedia.org/wiki/Mel_Ott" target="_blank">why?</a></td>
</tr>
<tr>
<td>TY</td>
<td>Baseball player, Cobb</td>
<td><a href="https://en.wikipedia.org/wiki/Ty_Cobb" target="_blank">why?</a></td>
</tr>
<tr>
<td>A, A's</td>
<td>Baseball team, Oakland team</td>
<td><a href="https://en.wikipedia.org/wiki/Oakland_Athletics" target="_blank">why?</a></td>
</tr>
</tbody></table>
<br />
And some, perhaps obvious, common clue indicators
<br />
<br />
<table border="1">
<tbody>
<tr>
<td>clue</td>
<td>suggests</td>
</tr>
<tr>
<td>!</td>
<td>An exclamation mark usually means that the entire clue should be read two different
ways, rather than looking to seperate it into two clauses</td>
</tr>
<tr>
<td>?</td>
<td>An question mark usually means that the wordplay in the answer may be even
more groan-worthy in terms of punnishness.</td>
</tr>
<tr>
<td>Reverend Spooner</td>
<td>Two words will have their prefixes phonetically switched.<br />
To shout across the harbour might be a "Bay Hail" which is also clued as a "Hay Bale".</td>
<td><a href="https://en.wikipedia.org/wiki/William_Archibald_Spooner" target="_blank">why?</a></td>
</tr>
<tr>
</tr>
</tbody></table>
<br />Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-5002837815717766192017-06-06T09:02:00.000+10:002017-06-06T09:02:30.521+10:00Siebenstein-Spiele 5-L BoxI bought this on a recent trip to Paris (from <a href="https://www.facebook.com/tumbleweedmarais/" target="_blank">Tumbleweed</a> - recommended highly) and it took enough time to solve that I'm happy with the purchase.<br />
<br />
If you search for solutions in Google, they turn up quite quickly - but I only searched after I had independently arrived at this one:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwtdSGZL9GL3jcBYQuWmlNnxdUZiVUbbZgZfnGToBwaU9N6bmtQXE8-mnmVgJGDYUQpYGXVmwZRn94B49yeMIr-_ZCGuc-yREpdnNgFPxTLNGpLibULwEDD7vWG_wcsBJd5sISna0JRNk/s1600/IMG_0670.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1200" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwtdSGZL9GL3jcBYQuWmlNnxdUZiVUbbZgZfnGToBwaU9N6bmtQXE8-mnmVgJGDYUQpYGXVmwZRn94B49yeMIr-_ZCGuc-yREpdnNgFPxTLNGpLibULwEDD7vWG_wcsBJd5sISna0JRNk/s320/IMG_0670.JPG" width="240" /></a></div>
<br />
However, #1 son had previously beaten me to it with this one:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPBN9jNF5IdVeR-O7qCC2mOtez0FKfM-WPkqLcoHoUHQh6RiFdjZNnLfsbuxIgSWImBUS3NtzKrwHtd0SdqCYMR1KSWuOg-twNVP3-xaigIcboFv-d7WVPL08_KNnlPy65K4z6HfxVZ_g/s1600/IMG_0674.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1200" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPBN9jNF5IdVeR-O7qCC2mOtez0FKfM-WPkqLcoHoUHQh6RiFdjZNnLfsbuxIgSWImBUS3NtzKrwHtd0SdqCYMR1KSWuOg-twNVP3-xaigIcboFv-d7WVPL08_KNnlPy65K4z6HfxVZ_g/s320/IMG_0674.JPG" width="240" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
which is obviously not what the designer intended but is just as legitimate a solution. All the pieces move freely, nothing has been jammed in - in fact many of the pieces have a bit of wiggle room - note the gaps at bottom-right and bottom-left.</div>
<br />Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com1tag:blogger.com,1999:blog-948868851971907265.post-90185729122827019052016-10-19T20:17:00.000+11:002016-11-02T20:40:39.977+11:00Error -50 when trying to write to an HFS+ Journaled file system<span font-family:="" inherit="">First, credit where credit is due. The answer came from <a href="https://discussions.apple.com/thread/563465?start=0&tstart=0" target="_blank">https://discussions.apple.com/</a></span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">One of my Seagate drives suddenly started acting really weird. It wouldn't let me delete files from it, copy new files on to it, etc. Copying files off the drive seemed to work fine, but when I tried to run Disk Utility to validate the file system, it gave an error complaining about being unable to dismount the file system - someone had it busy.</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Quick trip to the Terminal and tried:</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;"><i style="background-color: white;">$ sudo lsof | grep VOLUMENAME</i></span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">and that showed a couple of issues, OneDrive, GoogleDrive, etc keeping files open, so I quit those apps and tried again. Same dismount problem, even though there were no open files that the system would tell me about. Hmmm, real Unix fsck can run on a mounted filesystem, surely the hfs variant can? Yep. First, work out the device name with mount ...</span><br />
<span style="font-family: inherit;"><br /></span>
<br />
<div style="line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;"><span style="font-family: inherit;"><i style="background-color: white;">$ mount</i></span></span></div>
<div style="line-height: normal;">
<span font-family:="" inherit="" style="background-color: white;">/dev/disk0s2 on / (hfs, local, journaled)</span></div>
<div style="line-height: normal;">
<span font-family:="" inherit="" style="background-color: white;">devfs on /dev (devfs, local, nobrowse)</span></div>
<div style="line-height: normal;">
<span font-family:="" inherit="" style="background-color: white;">map auto_home on /home (autofs, automounted, nobrowse)</span></div>
<div style="line-height: normal;">
<span font-family:="" inherit="" style="background-color: white;"><span style="color: red;">/dev/disk2s2</span> on /Volumes/VOLUMENAME (hfs, local, journaled)</span></div>
<br />
<br />
<div>
<span font-family:="" inherit="">... then run the HFS checker using that device name</span></div>
<span style="font-family: inherit;"><br /></span>
<br />
<div style="line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;"><span style="font-family: inherit;"><i style="background-color: white;">$ sudo fsck_hfs -ld <span style="color: red;">/dev/disk2s2</span></i></span></span></div>
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">... and that claimed that the file system was fine.</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Back to Google, found the thread at discussions.apple.com which suggested that the problem might be a corrupted journal. His solution was more complicated than I needed because I don't have a hardware failure to contend with, so I tried doing it online.</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Turn off journaling with Apple's hidden <span style="font-family: "courier new" , "courier" , monospace;">hfs.util</span> tool:</span><br />
<span font-family:="" inherit=""><br /><i style="background-color: white;">$ sudo /System/Library/Filesystems/hfs.fs/Contents/Resources/hfs.util \</i></span><br />
<div>
<span style="font-family: inherit;"><i style="background-color: white;"> -N /Volumes/VOLUMENAME</i></span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">and try Disk Utility again. Lo and behold, now it can unmount. Let it run through the check and it gives the drive the thumbs up. Turn journaling back on:</span><br />
<span style="font-family: inherit;"><br /></span>
<br />
<div style="line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;"><span style="font-family: inherit;"><i style="background-color: white;">$ sudo /System/Library/Filesystems/hfs.fs/Contents/Resources/hfs.util \</i></span></span></div>
<div style="line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;"><span style="font-family: inherit;"><i style="background-color: white;"> -J /Volumes/VOLUMENAME/</i></span></span></div>
<div style="line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;"><span font-family:="" inherit="" style="background-color: white;">Allocated 229376K for journal file.</span></span></div>
<div style="line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;"><span font-family:="" inherit=""><br /></span></span></div>
<span font-family:="" inherit="">And we are back in business. No idea why the journal went bad, and I'll make sure my backups of all the stuff on that drive are up to date. </span><br />
<span font-family:="" inherit=""><br /></span>
<span font-family:="" inherit="">P.S. The crappy fonts and colouring in this post are a function of this wysiwyg editor that blogger.com provides.</span><br />
<br />
<span font-family:="" inherit="">P.P.S Less than two weeks later, the same disk has died again but this time with an error that fsck does not seem to be able to fix. Sigh.</span></div>
Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-30589922072680129842016-10-10T20:16:00.001+11:002016-10-10T20:16:48.282+11:00iTunes RantsDear Apple,<br />
<br />
when people tell you that iTunes is a piece of crap, this is what they mean.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcMRAmjqcwRKhkeL7OoPf-PUPE9UcUMIJOcm7Mf9jg-IWOSIY39IslDA1dTrRPg6aZGWQ5nQqMLlYogMnoS-QOtL03GumgB7QMbUFqGdBLScwrH4_iNeW80wLyLKjAIHQ7Y_EjwDbA_tY/s1600/iTunes.tiff" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcMRAmjqcwRKhkeL7OoPf-PUPE9UcUMIJOcm7Mf9jg-IWOSIY39IslDA1dTrRPg6aZGWQ5nQqMLlYogMnoS-QOtL03GumgB7QMbUFqGdBLScwrH4_iNeW80wLyLKjAIHQ7Y_EjwDbA_tY/s1600/iTunes.tiff" /></a></div>
<br />
I'm sure one of those numbers is correct ...Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-49025769272648391152016-10-10T20:15:00.004+11:002016-10-10T20:15:48.202+11:00Useful Mac HacksIf it gets in here, it has to be pretty useful. I didn't work it out, I'm just trying to hold on to it for posterity. Always look to the original link for details.<br />
<br />
<b>Add a "recent apps" icon to the dock.</b><br />
<blockquote class="tr_bq">
<span style="background-color: white; color: #222222; font-family: monospace; font-size: 14.819999694824219px;">defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = {"list-type" = 1; }; "tile-type" = "recents-tile";}' && \</span><span style="background-color: white; color: #222222; font-family: monospace; font-size: 14.819999694824219px;">killall Dock</span></blockquote>
Credit: <a href="http://www.howtogeek.com/273187/quickly-open-recent-apps-and-documents-with-this-hidden-mac-feature/" target="_blank">http://www.howtogeek.com/273187/quickly-open-recent-apps-and-documents-with-this-hidden-mac-feature/</a><br />
<br />
<span style="font-size: x-small;">Note: I don't know why they include the <span style="font-family: Courier New, Courier, monospace;">\ </span>in front of <span style="font-family: Courier New, Courier, monospace;">killall</span> - it isn't needed, it merely escapes the 'k'. If you wanna avoid PATH issues, use <span style="font-family: Courier New, Courier, monospace;">/usr/bin/killall</span>.</span>Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-24970296760795477562015-08-29T14:21:00.001+10:002015-08-29T14:21:22.292+10:0016 blocks making up circular patternsHere's another that I must have gotten years ago, and I've lost the instructions. The sticker on the only remaining part of the packaging says "Attempt to arrange the tiles so that different colours never touch!". That seems too easy - here are two solutions that only took about ten minutes to find.<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWeoGmkCGL5c6WaCIdtR-Wx0wKw-jcjugykbICwWWVzh2CQaA4AHCx8FxQBaSch5nOnA9oGPfPVO-u8dNQTgm3IoAgv5lj8YnC4G2lUozPiEjV-mlJisv4jQPIA0AVOycffYKQ78EqQrM/s1600/IMG_0344.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWeoGmkCGL5c6WaCIdtR-Wx0wKw-jcjugykbICwWWVzh2CQaA4AHCx8FxQBaSch5nOnA9oGPfPVO-u8dNQTgm3IoAgv5lj8YnC4G2lUozPiEjV-mlJisv4jQPIA0AVOycffYKQ78EqQrM/s320/IMG_0344.JPG" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: small; text-align: start;">all the circles the same colour scheme, but no two colours touch anywhere</span></td></tr>
</tbody></table>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdOGr8tK2rsTD2pc8oKRrhPnh5QHW0Kmq3gx_lYlwyz6AV6rFZHyZnXF1jRiqA3ny9fY3xQaW-4xOJmu4u8PA2AKUqQDbJ4PfDpNmeSA56n9omojvxklsRnUbRq4sEOAtbC7IibQL2jXU/s1600/IMG_0345.JPG" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto; text-align: left;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdOGr8tK2rsTD2pc8oKRrhPnh5QHW0Kmq3gx_lYlwyz6AV6rFZHyZnXF1jRiqA3ny9fY3xQaW-4xOJmu4u8PA2AKUqQDbJ4PfDpNmeSA56n9omojvxklsRnUbRq4sEOAtbC7IibQL2jXU/s320/IMG_0345.JPG" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: small; text-align: left;">all of the tiles connected in a single loop, again no colours touching anywhere</span></td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdOGr8tK2rsTD2pc8oKRrhPnh5QHW0Kmq3gx_lYlwyz6AV6rFZHyZnXF1jRiqA3ny9fY3xQaW-4xOJmu4u8PA2AKUqQDbJ4PfDpNmeSA56n9omojvxklsRnUbRq4sEOAtbC7IibQL2jXU/s1600/IMG_0345.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: left;"><br /></a></div>
Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-78932480590001045232015-05-27T18:25:00.000+10:002015-05-27T18:34:50.949+10:00The PLEXi Iamond Hex solutionSince I'm recording the nice way to put the puzzles away, here is the pretty solution to the <a href="http://www.brainwright.com/products/display/8304-2" target="_blank">PLEXi Iamond Hex</a> puzzle (which is apparently a licensed version of <a href="http://www.gamepuzzles.com/esspoly.htm#IH" target="_blank">Kadon's original</a>).<br />
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG5vWfhyKt023RcuwVl15vqfDsl684Ct1vZoDSdY_ukyKywtdr98rYRaa6w4nBsl-23aN69t2WYdnqQWiVkm0T50c829QbgeYXNvoPk_Evacjvrl1SDqrqGN6wTBraCztxDjuGL0U2GSQ/s1600/Photo+27-05-2015+6+16+30+pm.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG5vWfhyKt023RcuwVl15vqfDsl684Ct1vZoDSdY_ukyKywtdr98rYRaa6w4nBsl-23aN69t2WYdnqQWiVkm0T50c829QbgeYXNvoPk_Evacjvrl1SDqrqGN6wTBraCztxDjuGL0U2GSQ/s320/Photo+27-05-2015+6+16+30+pm.jpg" width="240" /></a></div>
<br />Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-33555225901511592582015-05-27T15:18:00.000+10:002015-05-27T18:25:14.611+10:00The Pentomino Square SolutionI keep having to rediscover the solution to the <a href="http://en.wikipedia.org/wiki/Pentomino" target="_blank">pentomino </a>square puzzle that's so hard to put away nicely otherwise, so here it is.<br />
<div>
<div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRYQPcQhymJDhxDIIzijiwBdWuFtg4HLVHaLmaQeHh0mlCme_Um2C1GLUVTYss2AdLpmo9Ln2rUhZyxAoNxxSNbJ6Y9A0UYXSakwUxALDUd6czS5BUjZcnJbaYxkb0j3qg-EjkC3lFenM/s1600/2012-09-06+20.38.47.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRYQPcQhymJDhxDIIzijiwBdWuFtg4HLVHaLmaQeHh0mlCme_Um2C1GLUVTYss2AdLpmo9Ln2rUhZyxAoNxxSNbJ6Y9A0UYXSakwUxALDUd6czS5BUjZcnJbaYxkb0j3qg-EjkC3lFenM/s320/2012-09-06+20.38.47.jpg" width="240" /></a></div>
<div>
<br /></div>
</div>
</div>
Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-88305850078107074212015-04-25T12:22:00.000+10:002015-04-25T15:29:15.972+10:00Google Calendar not syncing to Nana's Nexus 7For some reason, Google Calendar on Mum's Nexus 7 has a long-standing bug where it spontaneously forgets how to sync her calendar data. Since I'm on the other side of the country, and I don't use Android at all these days, here are the notes on how to fix the issue.<br />
<ul>
<li>Open Settings</li>
<li>Select Storage</li>
<li>Select Apps Data and Media</li>
<li>Sort Apps By Name (using the right-hand menu)</li>
<li>Scroll down to Calendar</li>
<li>Remove Data</li>
<li>Scroll down to Calendar Storage (this should be the next one on from Calendar)</li>
<li>Remove Data</li>
</ul>
Make sure you do both Calendar and Calendar Storage!<br />
<ul>
<li>Go back to top of Settings</li>
<li>Under Accounts, go to Google Accounts</li>
<li>Select Sync (using right-hand menu)</li>
</ul>
Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-10335088762094425712014-11-21T12:33:00.000+11:002014-11-21T12:35:53.833+11:00The human brain is really good at seeing patterns...<strike>Dear Penthouse, I would never have thought something like this might happen to me.</strike><br />
<br />
I got into work this morning, and I had forgotten to rinse out my coffee cup the night before so I needed to clean it. Imagine my surprise, however, when I looked down into it and saw someone looking sternly back at me.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9fBycplXHu9EQP5iKg9Bqtq3qJe8n9_Al_bVGjV4Cb_mzwiBLTdWUQktqLBxXm7u_E_w28ypZ7KFP1NiVixt8mlJ5RqDL4MDy7fp7Kr1xXNlPvurziWjJSaVB_rYTVyVBAbA-ry37HvE/s1600/Photo+20-11-2014+8+01+09+am.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9fBycplXHu9EQP5iKg9Bqtq3qJe8n9_Al_bVGjV4Cb_mzwiBLTdWUQktqLBxXm7u_E_w28ypZ7KFP1NiVixt8mlJ5RqDL4MDy7fp7Kr1xXNlPvurziWjJSaVB_rYTVyVBAbA-ry37HvE/s1600/Photo+20-11-2014+8+01+09+am.jpg" height="400" width="298" /></a></div>
<br />
Don't take my word for it, though. Here is iPhoto agreeing that there is a face in there, you can't argue with computer software...<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGwmwlZvYY1EPQTLtXNbJtKXBGSjagnkn9BoV03yxn3ANhPoMMon8LZWp-ifg7WXVlttEYbwqxCznCkad9DNsNN84rPpiUgTH6D6_ABgEr5glVOdRCQblCna2M08YyeG3EKpirZGXodGw/s1600/Screen+Shot+2014-11-21+at+12.07.03+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGwmwlZvYY1EPQTLtXNbJtKXBGSjagnkn9BoV03yxn3ANhPoMMon8LZWp-ifg7WXVlttEYbwqxCznCkad9DNsNN84rPpiUgTH6D6_ABgEr5glVOdRCQblCna2M08YyeG3EKpirZGXodGw/s1600/Screen+Shot+2014-11-21+at+12.07.03+pm.png" height="213" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I'm pretty sure its Alan Moore, famed comic artist and well known magician. Go take a look at him on <a href="http://en.wikipedia.org/wiki/Alan_Moore" target="_blank">Wikipedia</a>. But what is the author of <i>V for Vendetta</i> doing in my <i>C for Coffee Cup</i>? Sadly, we'll never know. His unnerving visage made me feel so guilty that I washed the cup immediately, well immediately after taking a few photos. Here's one more close-up.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7Yqe3UsZaNnADIxsBZxviBkXk_K-SyoKlGG0QagiwCa3An5wjc4rtjz6zawIPD9PnZPxtbOLR6xsqgQ_1d10bSh-DqYw4iqr0Mjh2Z3byri1uMBR_b0QF4qui3ZBdhVeQnlCYgQg0q9g/s1600/Photo+20-11-2014+8+01+44+am.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7Yqe3UsZaNnADIxsBZxviBkXk_K-SyoKlGG0QagiwCa3An5wjc4rtjz6zawIPD9PnZPxtbOLR6xsqgQ_1d10bSh-DqYw4iqr0Mjh2Z3byri1uMBR_b0QF4qui3ZBdhVeQnlCYgQg0q9g/s1600/Photo+20-11-2014+8+01+44+am.jpg" height="640" width="478" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-46612945987876568712013-10-17T19:59:00.003+11:002013-10-17T19:59:55.960+11:00I owe Optus an apologyWe just switched our Optus Cable service across to their "speed pack" which supposedly gives us 10x the bandwidth. To do so, we needed to upgrade the modem from the old Motorola Surfboard 3100 to a Netgear CG3000 which has a built-in router and does Wifi.<br />
<br />
Our home network is more complicated than normal but I copied across all the appropriate config, rebooted all the computers and it all just worked. Well, almost all.<br />
<br />
For some reason, Pauline's email would not connect. Nor would Catriona's. It didn't matter how I tried, it just wouldn't work. When I tried configuring new accounts, they wouldn't work either.<br />
<br />
I probably spent half an hour (over a few nights) ranting to the guy on support that "I do networking for a living, I can see that its your mail server not responding to POP/SMTP when I use TELNET to the appropriate servers and do the protocol by hand".<br />
<br />
Today, sheepishly, I realise that "hmmm, the IP address we are using is a class-B, but the subnet mask we have configured is a class-C". Surely that couldn't cause this symptom, it didn't upset the old modem. Hmmm, this is a modem *and* a router. Oh dear...<br />
<br />
So, I fixed our network config to use legitimate class C IP addresses, Pauline pushed the Get Mail button and down came her mail. Problem solved.<br />
<br />
My only excuse is that my old router allowed me to configure a proper class-B subnet mask - the Netgear has the subnet mask locked at class C, but I didn't pay attention when I was entering the numbers. Tomorrow, when Optus Support rings me back, I have to take hat in hand and admit my error.<br />
<br />
The moral: if you want to use anything other than the default 192.168.1.* network that your modem manufacturer, or your ISP expects you to use, make triply sure that you have configured it right. Because getting it wrong is hellishly difficult to debug, especially for the poor bastard at the other end of the phone that doesn't know how clever you think you've been.Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-6318753611387336902013-07-19T14:00:00.000+10:002015-05-27T18:40:14.392+10:00unexpected precompiled header, simply rerunning the compiler might fix this problemThis post is about Microsoft's answer to the <a href="http://www.imdb.com/title/tt0487831/" target="_blank">IT Crowd</a> and their "did you try turning it off and on" running gag.<br />
<br />
For years, we (at work) have been plagued with this particular error that seemed to happen spontaneously, hang around for a while then disappear, and today (with the help of Google) I've been able to track down an actual answer.<br />
<br />
Microsoft explains the embarrassing truth <a href="http://blogs.msdn.com/b/vcblog/archive/2009/11/12/visual-c-precompiled-header-errors-on-windows-7.aspx" target="_blank">here</a>.<br />
<br />
In a nutshell, precompiled headers are implemented cheaply as a straight memory dump complete with physical memory addresses. When the compiler subsequently tries to read them back, ASLR has potentially scrambled it's little brain.<br />
<br />
There are lots of fixes mentioned around the net, of varying levels of quality and security. Microsoft has a <a href="http://archive.msdn.microsoft.com/KB976656" target="_blank">hotfix </a>but it only solves the problem for Visual Studio installs - we build using the Platform SDK.<br />
<br />
For me, the sanest approach was:<br />
<ul>
<li>download and install EMET from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=39273" target="_blank">here</a></li>
<li>use EMET to disable "MandatoryASLR" and "BottomUpASLR" on the C compiler (cl.exe)</li>
</ul>
This leaves you with ASLR enabled for everything but the C compiler which doesn't cope.<br />
<br />
Note, this has no impact on the output of the compiler - your programs will still be ASLR-enabled or not, depending on what switches you pass on the command line. All we are doing here is fixing the actual compiler itself...<br />
<br />
<hr />
<br />
I hoped I'd never have to revisit this post, but today I had to. Looks like EMET can cause quite a bit of damage when you run it.<br />
<br />
I tried using EMET 5.2 and it did resolve my problems with the C compiler. As collateral damage, however, it took out Microsoft Office, AutoCAD 2011-2016, and even Internet Explorer. Every one of them reported a vanilla error message "Attempt to access invalid address".<br />
<br />
This looked to me to be related to either Data Execution Protection or perhaps to ASLR. However, even though I completely disabled both of those features (through EMET), it didnt' help. I've restarted so many times today you would not believe it. Uninstalling EMET changed nothing. I sat and manually uninstalled every Windows Update that had been applied in the last 48 hours and still no joy.<br />
<br />
Eventually <a href="https://social.technet.microsoft.com/Forums/ie/en-US/8ee171ae-e14f-4253-920b-12e63e4d51a3/attempt-to-access-invalid-address-error-after-june-2014-updates-all-ie-versions?forum=ieitprocurrentver" rel="nofollow" target="_blank">this post</a> on the Microsoft Forums pointed me at an obscure registry entry and lo, it fixed the problem. It would appear that EMET automatically puts in registry entries when it is installed, and does not remove them when it is uninstalled (no surprise there).<br />
<br />
So, the fix was to go to<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options</span><br />
<br />
and locate the application I was trying to use. I removed the troublesome keys and voila, my apps work again. (Actually, for many, I just removed the value for <span style="font-family: Courier New, Courier, monospace;">MitigationOptions </span>which was <span style="font-family: Courier New, Courier, monospace;">0x0000100</span>)<br />
<br />
Note: this is not something that you should attempt lightly. No warranty implied or assumed.<br />
<br />
<hr />
<br />
Take Three.<br />
<br />
It looks like the damage that EMET does is like herpes. Every time I update Microsoft Office (ie, apply office updates), I need to go back in and patch up the registry settings again. No idea why. This must be that "<i>my PC is so broken it needs to be reformatted and start again</i>" that everyone talked about in the 80s.Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-18166043515902579572013-05-01T09:45:00.000+10:002014-03-01T16:15:01.855+11:00Nexus 7 vs iPad MiniYet another comparison between the Nexus 7 and the iPad Mini. This is going to be my collection of notes to myself of stuff I notice as time goes by.<br />
<h3>
Physical Size</h3>
<div>
A number of people have commented that "its much bigger" (the iPad) seeing two devices side by side with their screens on, and it feels like the aspect ratio (width/height) of the iPad is more pleasing than the Nexus.</div>
<h3>
Screen</h3>
The screen on the iPad seems larger, which is no surprise because it is about 3cm wider and 2cm taller. However, I think the secret is that the iPad only shows 4 rows of 5 icons whereas the Nexus crams in 6 rows of 6 icons.<br />
<br />
In terms of resolution, my old eyes aren't really picking a difference.<br />
<br />
What is odd is that the iPad feels more natural to hold in landscape where the Nexus feels better in portrait. Perhaps that's because it was only recently that Android coped properly with a portrait orientation launcher. Or it could be the slight different in screen proportions. The iPad Mini really feels like the bottom half of a "real" iPad, and for the most part, that feels like enough.<br />
<h3>
Keyboard</h3>
Both devices have context-specific keyboards that they flip in as required. Only the Nexus is stupid enough to leave the '@' key off the URL keyboard, making it impossible to search for, say, steve@apple.com in the Google Chrome browser. This is still true at Android 4.2<br />
<h3>
Maps+GPS</h3>
<div>
Big win for the Nexus - because it has a GPS chip on-board, and Google Maps can make large chunks of the mapbase available offline, you can prepare for a days walk around Paris by pre-caching the map, then relying on the on-board GPS to let you know where you are.<br />
<br />
Stop press: I took it out for a walk today and it looks like the offline'd maps had un-offlined themselves. I stood in the Camberwell Market waiting for the Maps app to wake up, and it never did.<br />
<br />
And it looks like Apple have done something spooky where they seem to be able to get location *without* a GPS chip onboard, if you are in sight of civilisation. This probably depends on how well they have mapped the area you are in, but for wandering Paris, I'm wondering if the iPod Touch won't be sufficient.<br />
<h3>
Wifi</h3>
Comparing the iPad Mini against both my iPad1 and the Nexus, the Mini does not seem to have the same range as the others. There are rooms in the house where the Mini sees no signal while the other two get enough to work.<br />
<br />
Stop press: buying an Airport Extreme made it possible for the Mini to see the farther rooms in the house. However, the Nexus does not see the 5GHz bands, only the 2GHz ones, whereas the Mini is fine with both.<br />
<h3>
Calendar Application</h3>
To be fair, by the time I wrote this section, I don't own the Nexus any more, it moved on to my mother who is 80% happy with it, except when it goes stupid for no apparent reason.<br />
<br />
iCloud synchronises all my contacts & calendars without causing any grief whatsoever across multiple devices. (iPod/iPad/iPad Mini)<br />
<br />
Android has dropped all knowledge of Mums Google Calendar multiple times now, and Internet Wisdom<b style="background-color: white; font-family: sans-serif; font-size: 13px; line-height: 19px;">™</b> suggests that the fix is to "delete the local calendar data, disconnect syncing, reconnect syncing and wait". Not something that the novice user wants to do. In fact, there are a disturbing number of posts that suggest that when these things go wrong, "reset the device and reinstall everything from scratch".</div>
Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com1tag:blogger.com,1999:blog-948868851971907265.post-3355739750092095012013-01-26T10:19:00.001+11:002013-01-26T13:58:29.780+11:00mDNSResponder running rampantSo, this morning I took at look at my Mac and noticed that Little Snitch shows that someone is doing almost constant network traffic out. Looking in the Network Monitor, it appears that mDNSResponder is sending almost constantly to our DNS server.<br />
<br />
Useful tip 1: To debug what mDNSResponder is doing, use the following:<br />
<br />
<span style="background-color: #eeeeee; font-family: Courier New, Courier, monospace;">sudo killall -SIGUSR1 mDNSResponder</span><br />
<br />
and then take a look in the Console log. This is a toggle so do the same command to disable the extended logging. (Thanks to <a href="http://krypted.com/mac-os-x/mdnsresponder-mdns-and-dns-sd/" target="_blank">http://krypted.com/mac-os-x/mdnsresponder-mdns-and-dns-sd/</a> - I could have just read the man page (<span style="font-family: Courier New, Courier, monospace;">man mDNSResponder</span>) but who has time to read local documents when you have Google?)<br />
<br />
Some internet pages suggest you can get this symptom if you have a misconfigured DNS server that does not report errors correctly. This does not appear to be the problem for my ISP (Optus).<br />
<br />
In my case, the log showed messages like this:<br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">26/01/13 9:55:50.819 AM mDNSResponder[40]: 24: DNSServiceQueryRecord(35000, 0, 1.0.0.127.in-addr.arpa., PTR) START PID[264](<span style="color: red;">LogMeInGUI</span>)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">26/01/13 9:55:50.820 AM mDNSResponder[40]: 24: Error socket 72 closed 00000000 00001005 (0)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">26/01/13 9:55:50.820 AM mDNSResponder[40]: 24: Error socket 72 created 00000000 00001006</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">26/01/13 9:55:50.820 AM mDNSResponder[40]: 24: DNSServiceQueryRecord(35000, 0, 1.0.0.127.in-addr.arpa., PTR) START PID[264](<span style="color: red;">LogMeInGUI</span>)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">26/01/13 9:55:50.820 AM mDNSResponder[40]: 24: Error socket 72 closed 00000000 00001006 (0)</span><br />
<div>
<br /></div>
<div>
<i>Hmmm, LogMeIn? Don't I have that switched off?</i></div>
<div>
<br /></div>
<div>
I checked the LogMeIn control application and yes, it definitely shows as "Off" - that's the normal state for me. On a hunch, I turned it "On" and immediately the mDNSResponder traffic ceased. Turn if "Off" and mDNSResponder again starts sending.</div>
<div>
<br /></div>
<div>
So, LogMeIn, when turned off, generates more network traffic than when it is turned on and idle.</div>
<div>
<br /></div>
<div>
I've reported it to LogMeIn.com - we'll see what happens. For now, I'll probably uninstall.</div>
Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com2tag:blogger.com,1999:blog-948868851971907265.post-73191145308161553042012-07-18T20:27:00.003+10:002012-07-19T22:12:46.426+10:00Never fly Philippine AirlinesIt took some doing, but Philippine Airlines have supplanted United in the "I will never fly them again unless there is no other choice" stakes.<br />
<br />
On our most recent trip, three out of four legs of the journey were just too unpleasant, and while the last helped to smooth over the annoyance, the sum total was best summed up by Catriona who said "Dad, next time we fly, can we *not* go with the cheap airline?"<br />
<br />
Picture this: You get onto a plane, about to take a 10 hour flight, expecting to see those in-seat monitors. What you get is a poorly focussed overhead screen. And a bunch of children looking really disappointed already.<br />
<br />
The announcement comes over to "please close your windows - if you want to read, turn on your overhead lights". You push the button. Nothing happens. You sit in the dark with your Kindle wondering how you're going to kill the next 10 hours.<br />
<br />
You open the window and let the light in. A flight attendant comes and asks you to close it. You explain that the light doesn't work. She goes away.<br />
<br />
The purser comes and asks you to close it. You explain that the light doesn't work. He shrugs. You show him that in fact the light control actually comes out of the seat showing exposed wiring. He laughs and goes away. You hope that the wiring in the cockpit is in better condition.<br />
<br />
Repeat for two more flight attendants.<br />
<br />
For an hour you try to watch the blotchy screen showing some movie. The movie stops. And restarts from the beginning. This happens several times during the flight. They do show snippets of an insane American game show where people get hurt trying to climb over/under/through a watery obstacle course.<br />
<br />
After 10 hours, you get off in Manila. You are escorted up to the departures lounge, and go through security having your bags and shoes X-rayed, and being patted down. Loo break, have a tiny ice-cream, then go to the gate (approximately 20m away from where you were last scanned) where you have to go through security again, having your bags X-rayed and being patted down. Presumably this is because you might have visited the gun dealer in the departure lounge. At least, you can keep your shoes on this time.<br />
<br />
So, now you are in the "secure area" - that is, a part of the same floor that's cordoned off with those ribbons you see in bank queues. Once inside the "secure area", you realise that there are no seats left so you sit on the marble floor, only to realise that the airport roof is leaking and the floor is wet. But it's ok, that's to make sure you don't dehydrate -- it must be, after all, it's the only source of water you have access to until your flight. Unless you want to go through security again. Remember, you can't bring more than 100ml into the "secure area" so don't think about going out and buying drinks for the kids.<br />
<br />
Still, at least this next Manila to Los Angeles flight will have personal screens, won't it? No, you probably only wanted to just sleep anyway. This time we're split across three rows, with me behind the three kids and Pauline somewhere up frontish. I get to share the row with a couple who were, well, large. For the entire trip, the voice in my head was that of the male hippo in Madagascar 2 saying "Girl, you're large. You're chunky!"<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
(realise that I've been switching from second person to first person - give up dreams of being a novelist)</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
But you're in LA now - have a holiday, and try not to think about the flight home. If you have to think about Manila, think about how cheap the ice-creams were.<br />
<br />
Legoland.<br />
Disneyland.<br />
Fireworks in a carpark on July 4th.<br />
Universal Studios.<br />
Legoland again.<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Fly to Washington.</div>
Smithsonian x 2<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Too many burgers, too many cokes, this is holiday living.</div>
Drive to Pennsylvania<br />
Climbed on by niece and nephew<br />
<br />
Too soon it's over and you are winging back from Washington to LAX arriving at about 2:30pm and having to wait till 10:30pm, thinking "I'll check the suitcases and then grab a bus somewhere outside the airport". Bzzzt, sorry, Philippine Airlines don't begin checking in until 6:45pm. Ok, this one isn't completely their fault but if the whole trip had been with them, I'd have been able to check the bags in in Washington.<br />
<br />
Ok, we're back - side trip was acceptable though it was a little tricky dragging 3 suitcases and 5 people each with backpacks onto a peak-hour city bus. Again, can't blame the airline for that.<br />
<br />
At about 10:45, learn that "because the plane is lighter than we thought, we don't want to stop in Guam to refuel". "Hooray" shouts the crowd. "... so, we'll be delaying the flight until 1:30am so that when we get to Manila Airport it will actually be open." "Boo!" shouts the crowd. "... so, here is a $12 voucher that you can use at any of two eateries here in no-mans-land behind security -- no, they won't work anywhere else".<br />
<br />
(Hmmm, and yet the <a href="https://www.facebook.com/pages/Philippine-AirlinesNaia-Terminal-2/215967181774884">airports Facebook page</a> says "always open" - sigh)<br />
<br />
Get on the plane and discover that the little man at checkin who told us that the last side-row of seats reclines, was lying. They don't. They would block the exit door. He had deliberately moved us there to keep us altogether and we explicitly said that we would only go there if they reclined. So he said "sure they do". First rule of airlines - get the passenger to be someone else's problem, preferably at another airport.<br />
<br />
We complain to the purser and get the girls moved forward about 40 rows, leaving us boys at the back. Next to a walrus. I don't know what else to say, just try to imagine someone who can snore loud enough to be heard over an airplane engine. Thomas can't take it and moves forward with the girls, leaving Jonathan and I with more room. And a noisy walrus who, to be fair, eventually shut the hell up. But that just made it easier to hear the scary rattling noises from above.<br />
<br />
Try to lift the arm rest to use that extra space? Aha, no, they have that covered too, they only raise about 2/3 of the way making it impossible to spread out.<br />
<br />
Well, at least this time the plane has those little screens. Look, Movies and TV. Hmmm, movies aren't anything special, what do they have on the TV - <i>*one*</i> program. One! And for irony, it's "a documentary on aviation technology". After the flight, you learn that in fact the people over on the right hand side of the plane had dozens of TV shows to watch. Or perhaps it was "front" vs "back".<br />
<br />
Watch a couple of movies. This part was ok. But it's what we were expecting on every leg.<br />
<br />
When the flight is just about over, we discover that in fact when they moved the girls, there were three empty seats behind them - they could have moved us all, they just didn't think we'd want to.<br />
<br />
Back at Manila. Back to double-goes on the security ride. At least, this time it wasn't raining.<br />
<br />
Notice that the security area has been set up so that the guy looking at the X-ray screen has to shade it with his hand the entire day, because they placed the screen such that the sun shines directly on it through wall-to-ceiling windows - what a shame they couldn't have anticipated, while designing the airport, that the sun actually shines. This just reinforces the notion that all of this security crap is based on the notion that the guy before you was incompetent. Not to mention the tautological sign that justifies it by saying "Philippine law requires that all bags be inspected when passing through inspection points". So, if they hadn't put an inspection point in, there would have been no need for an inspection point. "It's a bypass, ya gotta build bypasses".<br />
<br />
One last plane. One last chance for reasonable entertainment. Why does the screen say TV but doesn't mention Movies? And why is there so much "Glee" in the TV section? After four reboots (did you know those things run Linux? We do now), the Movies actually show up. So, the final leg of the trip is tolerable. Not surprisingly, it was the shortest of the bunch at less than eight hours (Manila to Sydney is faster because it's downhill all the way).<br />
<br />
Oh, by the way, you know how nice a warm pork bun can be? Not surprisingly, the "warm" isn't optional - a cold pork bun snack really doesn't do anything for me, but they served it anyway.<br />
<br />
All told, there weren't any catastrophes, no lost bags, no falling out of the sky. Just a series of unpleasant experiences which left you with the feeling that "this is an airline that is just a bit manky".<br />
<br />
Your mileage may vary. But I've flown Singapore Airlines, I've flown Air New Zealand, I know it can be done a lot better than Philippine Airlines did on four flights out of four.Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-82932360409694290902012-04-06T10:57:00.003+10:002012-04-06T11:16:42.571+10:00AutoCAD 2013 and LiteHtml.dll<i>Installing AutoCAD 2013 is complaining about <span class="Apple-style-span" style="font-family:'courier new';">LiteHtml.dll</span>. Whats the story?</i><div><br /></div><div>I can't say for sure, but I think you'll find that you have an over zealous system administrator who decided to deploy a security system that can only have been designed by chimps, then implemented by the most idiotic intern at Microsoft.</div><div><br /></div><div>Go read this Knowledge Base article: http://support.microsoft.com/kb/2264107</div><div><br /></div><div>Can you believe that? Some idiot thinks that DLLs are always completely self-contained, that no-one other than Microsoft might build an application where DLL1 depends on DLL2 which happens to be delivered as part of the same product.</div><div><br /></div><div>This wouldn't be so bad if the numb nuts that actually implemented the security feature actually knew what they were doing. It appears that setting the <span class="Apple-style-span" style="font-family:'courier new';">CWDIllegalInDllSearch</span> entry does not "omit the current directory from the search". Instead, it changes the order it considers directories. If a matching DLL is in the current directory, it halts the scan immediately. Doesn't check that the DLL would have been found via the official path strategy - it just stops.</div><div><br /></div><div>Now, it's fine to say "but this is a vector for malware". Sure it is, but if someone can install a DLL into your application directory, then they can change your application as well, so this hack prevents *nothing*.</div><div><br /></div><div>In case one of the afore-mentioned chimps is listening, they should find someone smarter than they are and ask what the letters in DLL mean. Dynamic <b>Link</b> Library. Suggesting that you can work around the problems this security setting causes by explicitly (and manually) loading the libraries you need with<span class="Apple-style-span" style="font-family:'courier new';"> LoadLibrary()</span> misses the point that there are no published APIs that tell you what libraries a specific DLL needs. If I have to write my app so that it analyses every DLL it loads, then every DLL that *they* load, recursing till I hit metal, then there is no point in actually *linking* against those libraries.</div>Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-50442948132245273122011-05-19T18:00:00.001+10:002011-05-19T18:04:28.280+10:00Grandma's Apple Pie (as dictated by Mum)<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span style="text-decoration: underline">Short Crust Pastry</span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><br /></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">Blend 125g butter, 125g plain flour and 125g self raising flour in a kitchen whiz.</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">Add 2 tablespoons of caster sugar and blend.</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">Add 1 egg yolk and combine.</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">Add 2-3 tablespoons of ice water (until the pastry <i>almost</i> combines)</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">Press pastry into a ball, then separate into 2/3 and 1/3 disks flattened out.</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">Wrap in plastic and chill for 60 minutes.</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><br /></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"><span style="text-decoration: underline">Apple Filling</span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><br /></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">Peel, core and slice 5-6 large Granny Smith Apples. Add 1 lemon, cut into quarters. Add 1/4 cup water (up to 1/2 cup).</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">Bring to boil and cook till softened. Add 1/2 cup sugar and stir until dissolved. Leave till cold.</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">Put pastry in tin and add cold apple, being sure to remove lemon. Cover with pastry. Brush the top with egg white, then sprinkle with caster sugar.</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><br /></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">Cook at 220C for 10-15 minutes.</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica">Turn oven down to 180C and cook for 25-20 minutes (ie, make the total oven time about 35 minutes).</p>Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com2tag:blogger.com,1999:blog-948868851971907265.post-49932511972893040742011-02-27T19:15:00.007+11:002011-06-22T22:52:15.079+10:00Samba NAS and error code -36<div>I just bought a Seagate GoFlex Home NAS and was wanting to backup a bunch of files to it. I ran their installer, installed all their recommended tools, configured the server, and got a Folder on my desktop representing the "GoFlex Home Public" folder on the server.</div><div><br /></div><div>The first thing I tried to backup was their installation software, and I got this:</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">The Finder can’t complete the operation because some data in “some folder” can’t be read or written.</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">(Error code -36)</span></div><div><br /></div><div>It's taken me several hours and lots of unsuccessful internet trawling to finally work out what the workaround is, so I figure its worth a post here where Google can find it for the next guy.</div><div><br /></div><div>The problem appears to be related to the use of extended attributes, which Snow Leopard loves to attach to files these days. I believe that there is some sort of problem writing files with the <span class="Apple-style-span" style="font-family:'courier new';">com.apple.quarantine</span> attribute to Samba mounted disks. Whilst you can try to use <span class="Apple-style-span" style="font-family:'courier new';">xattr -d </span>to remove those attributes from your files, its tedious and very error prone.</div><div><br /></div><div>Similarly, I found that sometimes files got stuck on the drive - you couldn't remove them, if you tried (in the terminal) you'd get permission errors. Nothing, <span class="Apple-style-span" style="font-family:'courier new';">sudo</span> included, would allow you to fix the permissions. Yet looking in a terminal window with <span class="Apple-style-span" style="font-family:'courier new';">/bin/ls</span>, they looked fine.</div><div><br /></div><div>Short answer: Don't use the GoFlex Home Agent to mount network folders.</div><div><br /></div><div>This always uses the <span class="Apple-style-span" style="font-family:'courier new';">smb:</span> protocol to access the server. Instead, use the "Connect to server..." command on the "Go" menu in the finder, and explicitly specify that you want to use the <span class="Apple-style-span" style="font-family:'courier new';">afp:</span> protocol instead.</div><div><br /></div><div>Once I switched to using <span class="Apple-style-span" style="font-family:'courier new';">afp:</span>, all of the spurious errors went away. I was able to delete all the temporarily stuck files, and I could copy whatever I liked onto the drive, regardless of the extra attributes.</div><div><br /></div><div>Strangely enough, when I then tried out the Memeo Backup that Seagate include in the package, it warned me that my backup volume is <span class="Apple-style-span" style="font-family:'courier new';">afp:</span> and I should use <span class="Apple-style-span" style="font-family:'courier new';">smb: </span>instead. Yeah right. However, it looks like one reason they recommend <span class="Apple-style-span" style="font-family:'courier new';">smb:</span> is that the <span class="Apple-style-span" style="font-family:'courier new';">afp: </span>volume didn't seem to auto-mount when I went back in - I had to mount it for them.</div><div><br /></div><div><b>Update: </b></div><div><br /></div><div>Alternately, you can just wait for Apple to release OSX 10.6.7 which "<span class="Apple-style-span" style="color: rgb(85, 85, 85); font-style: italic; line-height: 24px; ">resolves an issue when transferring files to certain SMB servers</span>". Clearly, this blog post blowing the whole issue wide open had them scared and they realised they had to fix it pronto, or face my scathing posts.</div><div><br /></div><div><b>Update 2:</b></div><div><br /></div><div>Hmmm, despite it "mostly" working, I keep getting errors from Time Machine saying it was unable to complete the backup - it looks to me like it fails if it has to mount the drive itself.</div><div><br /></div><div>Moral: do not buy this drive if you want to use it for Time Machine backups.</div>Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-53804687473351172682010-11-27T13:37:00.007+11:002019-04-08T20:24:43.880+10:00Why are my zeroes behaving like ones?<div>
Guess the output of this program:</div>
<div>
<br /></div>
<div>
<div>
<span class="Apple-style-span" style="font-family: Courier New, Courier, monospace;"> C:\><b>type x.c</b></span></div>
<div>
<span class="Apple-style-span" style="font-family: Courier New, Courier, monospace;"> #include <stdio.h></span></div>
<div>
<span class="Apple-style-span" style="font-family: Courier New, Courier, monospace;"> #define ZERO 0</span></div>
<div>
<span class="Apple-style-span" style="font-family: Courier New, Courier, monospace;"> #define P(x) printf("x=%d",x)</span></div>
<div>
<span class="Apple-style-span" style="font-family: Courier New, Courier, monospace;"> main()</span></div>
<div>
<span class="Apple-style-span" style="font-family: Courier New, Courier, monospace;"> {</span></div>
<div>
<span class="Apple-style-span" style="font-family: Courier New, Courier, monospace;"> P(ZERO);</span></div>
<div>
<span class="Apple-style-span" style="font-family: Courier New, Courier, monospace;"> }</span></div>
<div>
<br /></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";"> C:\><b>.\x.exe</b></span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";"> x=1</span></div>
</div>
<div>
<br /></div>
<div>
Duh, what?</div>
<div>
<br /></div>
<div>
Ok, I cheated, I didn't show you the stupid compiler option I managed to pass through the use of a slightly buggy makefile.</div>
<div>
<br /></div>
<div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";"></span><br />
<div>
<span class="Apple-style-span" style="font-family: "courier new";">C:\><b>cl </b><span class="Apple-style-span" style="color: red;"><b>/D0</b></span><b> x.c</b></span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86</span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">Copyright (C) Microsoft Corporation. All rights reserved.</span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">x.c</span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">Microsoft (R) Incremental Linker Version 9.00.30729.01</span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">Copyright (C) Microsoft Corporation. All rights reserved.</span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">/out:x.exe</span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">x.obj</span></div>
</div>
<div>
<br /></div>
</div>
<div>
For those who don't memorise command-lines, that <span class="Apple-style-span" style="font-family: "courier new";"><b>/D0</b></span> essentially is instructing the compiler to "define a value for the symbol <span class="Apple-style-span" style="font-family: "courier new";"><b>0</b></span>" and the default value for definitions is "<span class="Apple-style-span" style="font-family: "courier new";"><b>1</b></span>".</div>
<div>
<br /></div>
<div>
Yes, the Microsoft VC90 compiler actually allows you to redefine the value of INTEGER tokens in your source code. Same thing happens at VC100.</div>
<div>
<br /></div>
<div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">C:\><b>cl /D0 x.c</b></span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";"></span></div>
<span class="Apple-style-span" style="font-family: "courier new";">Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86</span><br />
<div>
<span class="Apple-style-span" style="font-family: "courier new";">Copyright (C) Microsoft Corporation. All rights reserved.</span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">x.c</span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">Microsoft (R) Incremental Linker Version 10.00.30319.01</span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">Copyright (C) Microsoft Corporation. All rights reserved.</span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">/out:x.exe</span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">x.obj</span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">C:\><b>.\x.exe</b></span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">x=1</span></div>
</div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";"><br /></span></div>
<div>
It could be argued that it only shows up if you have one preprocessor macro using the value of another preprocessor macro, and you have to use an unlikely command-line option, so its not that tragic. But seriously guys, Apple catches you doing that sort of stupid thing at command-line parsing time...</div>
<div>
<br /></div>
<div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">jeff$ <b>cc -D0 x.c</b></span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";"><command-line><command-line>: error: macro names must be identifiers</command-line></span></div>
</div>
<div>
<br /></div>
<div>
... and those of that that grew up with ANSI-C use macros like this all the time.</div>
<div>
<br /></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">#define NAME(l)</span><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: "courier new";"> </span></span><span class="Apple-style-span" style="font-family: "courier new";">l[0]</span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">#define ADDR(l) l[1]</span></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">#define TYPE(l) l[2]</span></div>
<div>
<br /></div>
<div>
Having those 0, 1 and 2 become subject to the whim of the command-line is unthinkable.</div>
<div>
<br /></div>
<div>
This all came about because of a Python-generated command line. I thought I was creating</div>
<div>
<br /></div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">CL <b>/DOPTION0</b> x.c</span></div>
<div>
<br /></div>
<div>
but a bug meant I created this instead:</div>
<div>
<br /></div>
<div>
<div>
<span class="Apple-style-span" style="font-family: "courier new";">CL <b>/DO /DP /DT /DI /DO /DN </b><span class="Apple-style-span" style="color: red;"><b>/D0</b></span> x.c</span></div>
</div>
<div>
<br /></div>
<div>
So I'm a lot more careful now.</div>
<div>
<br /></div>
<div>
Someone did point out to me that<i> "All computer programs are just 0s and 1s. Looks like this one was just 1s"</i>.</div>
<div>
<br /></div>
<div>
Computer geek humor.</div>
Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0tag:blogger.com,1999:blog-948868851971907265.post-379364568486398582009-07-02T15:45:00.010+10:002009-07-09T16:30:15.841+10:00.NET corrupts heap when marshalling LPSTR(Hi Lizzie)<br /><br />I've just spent the best part of a week trying to track down why my bridge from C# to C++ was working on Windows XP but crashing sporadically on Windows 7, and the answer is that .NET marshalling is trickier than you think for strings.<br /><br />Essentially, I had this:<br /><br /><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">[DllImport("mydll.dll",CharSet=Ansi,CallingConvention=Cdecl)]<br />[MarshalAs(UnmanagedType.LPStr)]<br />private static extern String LookupCorrespondingString(Int32 key);</span></span><span class="Apple-style-span" style="font-size:small;"><br /></span><br />and in the DLL, I had<br /><br /><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">__declspec(dllexport) const char *LookupCorrespondingString(int key);</span></span><br /><br />Whenever I called this, it would get all the way into my DLL, I could tell it was going to return a value, but during the return operation, it would crash. When I ran it in the debugger, I got output messages about how memory was being free'd into the wrong heap.<br /><br />Eventually I found this article:<br /><a href="https://blogs.msdn.com/dsvc/archive/2009/06/22/troubleshooting-pinvoke-related-issues.aspx">https://blogs.msdn.com/dsvc/archive/2009/06/22/troubleshooting-pinvoke-related-issues.aspx</a><br />which contained the useful quote (emphasis mine):<br /><blockquote><i>When a string buffer allocated by native code is marshaled to managed code, CLR Interop marshaller will allocate a managed string object and copy the contents of native buffer to the managed string object. Now <b>in order to prevent a potential memory leak, CLR Interop Marshaller will try to free allocated native memory. It does so by calling CoTaskMemFree. The decision to call CoTaskMemFree is by-design. This can at times lead to crash</b>, if memory was allocated by the called-native function using any API other than CoTaskMemAlloc family of API’s as custom allocators may allocate on different heaps.</i></blockquote>And there was the answer. .NET was freeing the block of memory I had passed to it to help me "prevent a potential leak". The problem being the lack of ability to communicate the 'const-ness' of the underlying DLL entry point's return value in the MarshalAs() attribute.<br /><br />The solution was to declare the entry point differently:<br /><br /><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">[DllImport("mydll.dll",CharSet=Ansi,CallingConvention=Cdecl)]<br />private static extern <span class="Apple-style-span" style="color:#FF0000;">IntPtr </span>LookupCorrespondingString(Int32 key);</span></span><br /><br />and then when I call it, do the marshalling explicitly.<br /><br /><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="font-size:small;">String s = <span class="Apple-style-span" style="color:#FF0000;">Marshal.PtrToStringAnsi(</span> LookupCorrespondingString(k) <span class="Apple-style-span" style="color:#FF0000;">)</span>;</span></span><br /><div><span class="Apple-style-span" style="font-family:'courier new';"><br /></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style=" ;font-family:Georgia;">After I bitched and moaned about how this stuff isn't documented anywhere, Manish Jawa kindly pointed out that it is, in fact, documented in the very first sentence on this page: <a href="http://msdn.microsoft.com/en-us/library/f1cf4kkz.aspx" style="text-decoration: none;">http://msdn.microsoft.com/en-us/library/f1cf4kkz.aspx</a> - you can't ask for more than that.</span></span></div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style=" ;font-family:Georgia;">Actually, you can and they give it to you here: <a href="http://msdn.microsoft.com/en-us/library/x3txb6xc.aspx">http://msdn.microsoft.com/en-us/library/x3txb6xc.aspx</a> - the problem I was experiencing and its solution spelled out.</span></span></div><div><br /></div><div>So, the moral of the story is: if you pass native strings to .NET via the marshalling interface, make sure you use IntPtr and PtrToStringAnsi() unless you want them to be free'd for you.</div>Jeff Lainghttp://www.blogger.com/profile/17500974943434382108noreply@blogger.com0