Labels

3G (1) 8600GT (1) AI (4) amazon (1) API (1) apple (3) apple mail (1) atlassian (1) audio (1) bambo (1) Bamboo (1) bloat (1) boost (1) bugbear (1) C++ (5) calling conventions (1) cdecl (1) chromecast (1) CI (1) compiler (1) continuous integration (1) coursera (1) custom domain (1) debugging (1) deltanine (1) diagnosis (1) diy (5) DLL (1) dns (1) don't be evil (1) ec2 (1) education (1) electronics (1) express checkout (1) fail (6) fink (1) firewire (1) free hosting (1) GAE (1) google (1) Google App Engine (4) H170 (1) hackerx (1) hackintosh (1) Haskell (3) homebrew (2) i1394 (1) icloud (2) iOS 9 (1) ipad2 (2) jobhunting (2) lag (1) letsencrypt (2) libjpeg (1) linux (1) mac (2) mbcs (1) mechanic (1) memory (1) MFC (3) Microsoft (1) migration (1) ML (1) mobile (1) movi (1) MSBuild (1) music (1) naked domain (1) NLP (2) o2 sensor (1) obd (1) Optiplex960 (1) osx (1) outlook express (1) payments (1) paypal (1) photos (2) PIL (1) Project Euler (1) projectmix (1) python (2) raspberrypi (3) recruitment (1) renwal (1) skylake (1) soundcloud (1) ssl (2) stdcall (1) stripe (1) subaru (2) supermemo (1) supermemo anki java (1) sync (2) Telstra (1) tests (1) thunderbird (1) udacity (1) unicode (1) Uniform Cost Search (1) university (1) upgrade (2) vodafail (1) vodafone (1) VS2010 (1) vs2013 (1) VS6.0 (1) weather (1) win (1) Win32 (1) Z170 (1)

Monday, 31 December 2012

Upgrading the RAM in a 2006 MacBook Pro (Merom) - MacBookPro2,2

I just upgraded the RAM in a 2006 Macbook Pro with the Merom Chipset - the system identifier for this mac is MacBookPro2,2 ( About this Mac ->More Info->System Report).

The ram it comes with is DDR2 667 Mhz 5300 SO-DIMM - this ram is hard to come by these days and I heard conflicting reports about whether higher speed RAM would work. Apparently the later model Penryn chipsets machines would not downclock the RAM and fail to to boot.

Anyway, my local computer store had some Patriot 800Mhz RAM for much cheaper than the Mac spec RAM could be had on ebay, so I took a chance and bought some.

After a false start because I didn't seat the RAM properly, I can report that 800 Mhz RAM works on my MacBookPro2,2 just fine!

Wednesday, 7 November 2012

DLL hell


I have recently found myself working on a C++ MFC application written in MSVC 6.0 . After my initial despair about not being able to port it to VS2012, due to some legal issues – it is based on a third party product, and whilst we have the source code, and the changes required to get it to compile are minor we are required to engage the third party to make ANY code changes to their source code.
Anyway, I though the least I could do was upgrade the compiler to VS6SP6. This was mostly painless, just a few small code changes.
The most interesting compiler bug that was uncovered is illustrated below:

class foo
{
public:
     foo() {}

     static void bar();

protected:
     bool m_var;
};

void foo::bar()
{
     char * message;

     message = m_var ? "foo" : "bar";
     printf( message );
}


Note that a static function is able to reference an instance variable of a class so the above code should not compile... in fact, in this case it only compiles when used with the ternary operator - ? as 

if( m_var )
     printf("foo");
else
     printf("bar");

produces the compiler error. This bug was fixed in one of the service packs.
Anyway, after upgrading my machine to VS6SP6 I found that I would encounter COM registration errors with DEBUG code built on other machines without SP6... and bizarrely even code built with SP6. Code built on my machine was okay.
These errors manifested as debug asserts such as:

"File: Ctlreg.cpp Line:520"
"File: Olecli3.cpp Line:502”
"File: Olelink.cpp Line:288”
"File: Olelink.cpp Line:291”

As the code was written to link dynamically with MFC and the c runtime library – I suspected I was in DLL hell- I had the wrong versions of some obscure dll. The best way to diagnose this is with dependency walker –also known as depends.exe. This will load an executable or dll and tell you exactly what other dll files it depends on.
In this case I found:

MFC42D.DLL
MFCO42D.DLL
MFCD42D.DLL
MSVCP60D.DLL
MSVCRTD.DLL

When I replaced these DLLs with versions from machines without the problem, the problem resolved on my machine. The question was, which DLL was the culprit? I was suspicious of the MFC dlls, as the asserts were in MFC code. It turned out to be MFCO42D.dll – the version on my machine was dated 1998 version 6.0.8168.0. The SP6 version was dated 2004 and had version 6.0.9782.0.
For some reason, VS6SP6 failed to update this DLL when installed on my machine.

Anyway, the upshot is that the MFC debug DLLs are NOT binary compatible between versions of the compiler.

Plenty of people have stumbled across this problem in my google searches, so I thought I would post this for the next person! Hope it helps you

Wednesday, 24 October 2012

War On You

Obama has been in the news a lot lately due to the upcoming presidential election, so I took the opportunty to update an old track from my album Entheogenic with some Obama samples and additional production.

It's good an old skool vibe with 303 bass and 909 drums. It's on soundcloud!

Monday, 22 October 2012

RaspberryPi

Today I was excited to find my RaspberryPi in my mailbox months after I placed my order with RS.

I checked the serial and unfortunately I didn't score the upgraded chip with 512 Mb memory.
I also didn't realize that it needs a micro USB cable to connect the power... of the myriad of computer cables I have collected over the years, I had never managed to aquire one of those, so it had to wait for a trip to my local computer store.

Anyway, that gave me time to setup an SD card with linux so it would actually boot and when I finally I powered it up I had the joy of watching the linux boot sequence as she booted up. When running, these things draw only 3W of power and my big plan for this baby is for a remote internet enabled door opener, so my first step was to get an IO module with some relays off ebay.

More news as it follows

Tuesday, 18 September 2012

The Knights Travail

Recently I was challenged to solve the Knights Travail in C++ - its a fairly simple problem in finding the shortest path between two squares on a chess board that would be legal moves for a knight piece.

The knight can move 2 squares across and 1 square up or down and vice versa. The positions on the chess board are represented using algebraic notation. There are a number of ways to solve this problem, but I chose a simple uniform cost search - which is like a bredth first search with each move on the chess board being having an equal cost, so the shortest path will always have the least number of moves. 

Because this challenge was to demonstrate my knowledge of C++, of course my solution is object oriented and completely over engineered. Anyway, you can find my solution here: The Knights Travail.

It's hosted on ideone.com so you can even execute it and put your own travails in. Just type them in to the input box down the bottom, eg: A1 B2

Happy Travailing!

Sunday, 16 September 2012

Google weather api is dead... long live wunderground.com

Recently google retired their free weather api... it was never officially supported, and was always a private API, but nonetheless many, many applications came to rely on it, and were rudely broken last month when the api stopped working.

Anyway, this also broke http://sydneyinlinehockey.com, so after some research I settled on wunderground which has a pretty good replacent which is free for up to 500 requests a day. You have to apply for an api key to call it and the response can come back as xml or json. I prefer json as it is so easy to parse python.

It is this easy to call... what are you waiting for? Fix your apps with broken weather now!


Saturday, 25 August 2012

Migrating from Outlook Express to Apple Mail

The other day I arrived home to find my elderly neighbours lugging a rather large large box from their car - on closer inspection I could see it was a brand new iMac. Their 6 year old Dell had died and they had been convinced by their friends to crossover to the Apple ecosystem.

Unfortunately, the so called Apple Genii at the Bondi Junction store were incapable of transferring over their old files as promised so I offered to help. Although the screen was dead on their Dell, it made some whirring and booting noises so I pulled out the HDD to see if I could recover anything. Thankfully the disk seemed fine, I was able to mount it on my windows 7 box and copy off all the files (so much for the skills of the apple genii).

I was able to load the contacts into Windows 7 contacts and export them as vcd files so they could be imported into the mac. The path for the outlook files was a little more convoluted....

This is how I managed to do it.... basically the workflow was Outlook Express Data Files -> Windows Live Mail -> export to eml files -> Import eml files to Thunderbird -> export Thunderbird to mbox -> cleanup mbox files with clean_moz script -> import cleaned mbox files in to Apple Mail.

Here are the details:

I downloaded Windows Live Mail as Outlook Express is not supported on Windows 7. It was able to import the outlook data files once I was able to find them... their location varies depending on the version of windows and outlook express, but from memory I think they were in the Local Settings/ApplicationData directory (this is a hidden folder so you need to enable viewing of hidden files  to see it).

Next I exported the mail in Windows Live Mail format- from memory I think this stores the mail in a folder structure, with each email as an individual eml file

Then I imported the Windows Live mail into Thunderbird, using the thunderbird import export tools plugin.

Then I used the Thunderbird import export plugin to export the mail. Thunderbird stores its mail in the mbox format, which Apple Mail promises to import.

Next, I used the import feature on Apple Mail to import the data in thunderbird format. This took a long while, but somehow only managed to import a single email from each folder. Same result when I imported the mail in mbox format... after some google foo I discovered the Apple Mail import is a bit broken  and does not fully support the mbox format.  Thankfully Trevor Harmon had this problem back in 2004 and wrote an awesome python script to cleanup the mbox files so Apple Mail wouldn't choke.

After cleaning, the files imported perfectly- thanks Trev!