Monday, September 21, 2009

Snow Leopard 64 bit kernel on a MacBook5,1

I was playing around with Snow Leopard today and for no better reason than "It's neat" I decided to try and boot into the 64 bit kernel. Apple has left the default kernel, on non server editions, to default to 32 bit. Many people have complained about this stating it's slower and can't access > 4GB of memory and can't run 64 bit apps correctly etc etc. Well it's all a little bit of FUD. Apple also included the 64 bit kernel ability but defaulted it to 32 mainly to avoid 3rd party software/drivers/kexts that rely on the 32 bit kernel. Windows Vista 64 had similar issues with drivers etc. And while in 32 bit kernel mode applications can still run in 64 bit mode just fine, without any type of 64 to 32 virtualization. So right now there really is no reason, for most, to run in 64 kernel mode other than "It's neat".

If you'd like to try, and have a 64 bit cpu with 64 bit EFI (Core 2 duo / Xeon), simply reboot/turn-on and hold down the '6' and '4' keys. If it works your computer will boot a little bit slower as it makes the switch (if you set it to always boot in 64 bit mode you wont see this delay). You can check wether it worked or not by either checking the kernel process in the Activity Monitor or type
  uname -a
in the terminal. The result will end in 'x86_64' if it worked. Or you can also click the 'Apple' and go to 'About This Mac' and click the 'More Info...' button. From there click the 'Software' group towards the bottom. The line that says '64-bit Kernel and Extensions' should say 'Yes'.

If it didn't work then you may be lucky like me and have a MacBook or Air etc. Apple has black-listed these and deemed it an option only available for the elite Pros (MacBook Pros, MacPros...and XServes). But you can still try it thanks to this guy, Amit Singh. It's been a while since I've had to use a hex-editor for something like this but it was fun :)

0xED, and Hex Fiend are both good...

Basically I followed his post pretty close. Simply made a copy of /usr/standalone/i386/boot.efi (I called it boot64.egi) as   /System/Library/CoreServices/boot64.efi
Then opened it with a hex editor and adjusted the 'black-flag' bit value for my corresponding machine.
(I didn't have to chown the file or chflags as my copy was already set)
Then blessed it with
  sudo bless --folder /System/Library/CoreServices --file /System/Library/CoreServices/boot64.efi
This sets the newly modified .efi to be used during boot.

After that you can now use the '6' + '4' and the '3' + '2' options while booting/restarting.

I also set mine to always load using the 64 bit kernel, again for no better reason than "it's neat-o". This can be done by editing the file
And change this
  <key>Kernel Flags</key>

to this
  <key>Kernel Flags</key>

Now Snow Leopard will boot by default with the 64 bit kernel, you can still hold down the '3' + '2' to boot using the 32 bit kernel.

I'm running on a pretty fresh install of Snow Leopard and haven't done a whole lot of testing yet. But so far most things run great. 32 bit applications still function fine in their 32 bit modes as well. The only application that hasn't worked so far is VMWare Fusion, but this may change with the next version or so. VirtualBox does indeed work with the 64 bit kernel though so I will be trying that out with Windows 7 in the next few days.

Friday, September 18, 2009

Windows 7 and Visual Studio SLN files.... uggh

My 2003 server VM went out the other day at work so I figured I try out the new Windows 7 that I've been hearing so much goodness about.

I downloaded the ISO and began the install (installing within Fusion). I left to go get a drink thinking it would take no less than an hour. I came back to my desk and was very nicely surprised to see that the install had finished. I think this was the fastest Windows install I've ever done.

Another nice thing I've noticed so far is how much easier it is on my system. Before 2003 was always using some of my cpu doing whatever it is that it does. 7 on the other hand lets my system idle at around 3.5% (running in Fusion). It also seems snappier as well. So far I was really quite impressed, well first impressions anyway.

Then some ugliness started shining through. The "Yes I really really really do want to run this application" UAC stuff isn't as bad as it is in Vista, but it's still pretty annoying at best. I began loading my work projects over and tried to double click a web solution. Well, it threw up about 4 dialogs that I had to click whatever on to make them go away. These where all UAC related dialogs. I then set VS to always run as administrator, so much for the UAC protection eh. Then all seemed to be good in the world, until I tried to double click the solution again. I watched as the little loading spinner briefly popped up and then went away. Then I waited... and waited... Nothing, no error message, no UAC.... NOTHING. So I took the option to always run as admin off and I was back to where I started.

I found this 'feature' according to MS
That is quite frankly, stupid.
I guess you can set .sln files to always load with VS2008, or whatever, and that fixes it. But it's just kinda ugly. The sad thing is that the bug was reported back in 2007 so I don't think it will be resolved any time soon.

I guess I'll hope that I love everything else about it and that nothing else is wrong..

Tuesday, September 08, 2009

I guess after six years I can't complain

I was a little late paying my internet bill this month to Comcast, as they kinda screwed it up the month before.... It went out today and I thought it may have been just because the bill was late.

For the last six years I've had two cable modems on a single account. Comcast hadn't ever quite figured it out. It's been nice having Vonage on one modem with a wireless router and everything else on the other modem.

Well when I finally called in today to see if it had just been disabled because of my bill the support person informed me that they had removed a 'rogue' modem that had been on my account.

It's been there for six years so I can't complain I guess. But I sure will miss the thing

Monday, September 07, 2009

IE8 document.compatMode

With all the proliferate hacks out there for IE browsers, IE8 stacks some more on top.

During our last release cycle our QA department started sending back issues revolving around the new IE8 browser. Many of these where related to javascript. One simple fix to get this out the door was to just force IE8 into compatibility mode until we had more time to deduce all the little issues. Unfortunately this fixed some issues while creating others, ugh.

Basically it boiled down to this. Our ASP application says that the browser is IE8, and in javascript it will also say that it is version eight, while in normal mode. The issue, when in compatibility mode, is that it still registers in ASP as IE version eight, but in javascript it now says it is version seven, or whatever compatibility mode is used. So additional IE specific code was added on top of already IE specific code to now check document.documentMode as well.

I do like working with IE8 much more than it's predecessors, but it is still not quite up to par which just adds more development time to now make things work in all the different, very different, flavors of IE.

Here's a good summary of things IE8 finally got right and others that are still not.

And VML also took a hit with the new browser.

Another issue with VML that I noticed the other day was that IE8 now supports element.hasAttribute/getAttribute. But I guess the support is not that great, at-least for VML.
I had a simple script that works with both SVG, the standard, and VML, the non-standard.
There was a method that did something like

if(elem.hasAttribute) { do standard SVG stuff here }
else { do non-standard VML here }

With IE8 the first condition will now be hit, which is good but also bad since IE doesn't support SVG. So yet more IE code was added to resolve this issue. I figured I'd take advantage of the newly getAttribute functionality in IE8 to get the 'fillColor' attribute of a VML element.

Well, this didn't quite exactly work. The attribute was never found. IE8 seems to only report a single attribute for every VML element regardless of how many are actually in the XML. So I could get the first attribute using the new 'getAttribute' in IE8, but unfortunately 'fillColor' was not the first attribute within my VML, so it was back to changing the code yet again for IE to ignore the newly added 'getAttribute' and go back to elem['attrib'] instead, since this would actually give me ALL of the attributes per element.

I guess this is what we have to look forward to until ver. 9 :)

The Way It Should Be

Upgrading/Moving from one computer to another is always painful and usually the only thing that makes it worthwhile is if you're moving to a newer, much nicer, machine. I recently got a MacBook 13.3" (3 weeks before the pro was released, sad) and have been living partially on that. My tower, Mac Pro, has been feeling somewhat neglected. My wife has been doing more video editing lately and needed something a bit faster. I decided to give her my tower, gulp, since I haven't been using it much anyhow.

I was already partially up on my laptop so it was just a matter of copying over any remaining items. After this was done I did a fresh install on the tower. I've seen the 'MIgration Assistant' application before but had never really given it much thought. I had made the basic assumption that it wouldn't do exactly what I wanted and there would be a bunch of manual intervention as well. I had installed the new Snow Leopard on the tower while her old laptop was running the previous Leopard. I decided to give the Migration Assistant a try, expecting a lot of additional work afterwards. I hooked up the computers via Firewire and started the Migration....

The assistant started up and located the old mac right away. Then it searched through it and gave me a check box list of items I could move/leave. I left everything default and let it run. My wife has our whole family album all digitized in iPhoto, about 130 Gigs not including videos, so you can imagine that it did take some time.

Once this was all finished I was very surprised by the results. It actually migrated over her user from the old computer. It kept her login items, login image etc. It even set her wallpaper to what it was before with all the same settings. Screen saver was the same, along with settings. "That's pretty neat" I thought as I opened up iTunes. Wow, iTunes kept everything just as it was on the old machine, ratings etc. Next I opened up her email. All her emails where setup and it even moved over her existing inbox emails! Her calendar kept all her events and so did Address Book. Then I looked down in her application bar. It was setup just as it was on her previous computer. It even moved over applications that hadn't been installed yet!

When everything was said and done the only thing she noticed after the move was that her computer was faster. There was nothing else that she noticed different from the day before.