Archive for June, 2009

More gold is required

Adelaide Now, April 27th, 2009 – Woman sues AAMI for policy breach
Adelaide Now, June 11th, 2009 – Woman accused of staging ‘gold theft’

I’m following the story of Adelaide resident Kristina Fincham, who is claiming that 74 bars of gold bullion, purchased with money earnt playing World of Warcraft, was stolen from her house in March 2008. Apparently she is claiming the loss on her AAMI house and contents insurance policy, and the insurance company is refusing to pay. It seems that she registered the bullion with AAMI when she purchased it. The Adelaide Now stories written by Sean Fewster imply (from Kristina’s comments) that AAMI initially refused to accept that she had the bars in the first instance. The latest write-up suggests that AAMI is accusing Kristina of having planned the whole thing to rip them off. Apparently it’s going back to court in July, so stay tuned.

Edit February 25th, 2010: Unfortunately, this story has not come up again in the news, so we may never know how this wrapped up. In fact, when I checked google, this post ranked highest after the original Adelaide Now stories. My curiosity remains, ungratified.

Uncomfortably Entertaining

So along with a bunch of mates, I run this LAN, StreetGeek. We have an annual “StreetGeek Viral” video competition, with a cash prize of AU$400. This one by DrFrag took out the top prize in 2008. Sweet stuff. Check it out.

Tags: , , ,

Chocolate Rain

I didn’t know about this one before Pork and Beans. I must confess, I never thought it was that good, **but** it met the memetic criteria, so here it is.

This ones the same guy. He’s got a bunch of them on youtube, imo these are the best two.

Tags: , ,

Charlie the Unicorn

Can’t miss Charlie the Unicorn

Tags: , ,

Let’s get this Genocide Started!

If you’re like me, you can’t get enough of Battlestar Galactica. Well, our prayers are answered! It looks like another 2-hour tv movie special is coming real soon! This one tells the story from the Cylon side, featuring the unforgettable line “let’s get this genocide started”!

Tags: , ,

Swig namespace collision

Swig is a lifesaver for using native C++ libraries in a higher level language. One problem I came across this morning, though, if you are referencing two swig-generated libraries in one application, you can get name collisions for similar types. My problem arose out of my use of the %pointer_functions macro. The generated types, SWIGTYPE_p_int, SWIGTYPE_p_long, SWIGTYPE_p_double and SWIGTYPE_p_float were all generated in the root namespace. So, when my .NET application referenced two libraries generated this way, no joy! Unfortunately, it took me a while to work out how to put the swig-generated types into an appropriate namespace, so I thought I’d document it here for you to find. The answer was to be found here, on the SWIG and C# page of the documentation. Simply add -namespace whatever.namespace.you.want to the commandline arguments. too easy!

swig.exe -c++ -csharp -namespace MyCSNamespace -outdir "swig" "script.i"

Tags: , , ,

Translate VB.NET to and from C#

This article once referred to the CarlosAg.net VB.NET to C# (both ways) code translator, which was an awesome tool.

Last time I went to use it, however, it seemed to be broken. I found this alternative.

Tags: , , ,

Determine .NET Assembly Build Date

I needed to get the Build date of an assembly to write a Really Insecureā„¢ time-limited demo for a client. Simply put, the software should only run within 45 days of being built.

Suggestions from other developers included using Visual Studio’s automated build numbering, and converting the build numbers to a date. Jeff Atwood blogged about a better solution he got from another (now 404ed) source.

He reads the Portable Executable file header, reads out the linker timestamp, and converts it to local time. Easy! Below is the code in C#. See here for a VB.NET version.

private static DateTime RetrieveLinkerTimestamp(string filePath)
{
const int PeHeaderOffset = 60;
const int LinkerTimestampOffset = 8;
byte[] b = new byte[2048];
Stream s = new FileStream(filePath, FileMode.Open, FileAccess.Read);
s.Read(b, 0, 2048);
s.Close();
int i = BitConverter.ToInt32(b, PeHeaderOffset);
int SecondsSince1970 = BitConverter.ToInt32(b, (i + LinkerTimestampOffset));
DateTime dt = new DateTime(1970, 1, 1, 0, 0, 0);
dt = dt.AddSeconds(SecondsSince1970);
dt = dt + TimeZone.CurrentTimeZone.GetUtcOffset(dt);
return dt;
}

Other authors have used the interpreted version number technique, including Kevin Gearing and this article on CodeProject. Still others have simply used the file modification date. Another possibility is embedding the build date in the description of your assembly. This strategy seemed a little more reliable than the others. After all, this is serious business.

Tags: ,