Friday, August 28, 2009

When Page Up and Page Down behave oddly in FireFox

I was viewing a web page with Firefox 3.5.2 the other day and I noticed the Page Up and Page Down keys were not behaving the right way.  Instead of scrolling, the page would flash a bit, but nothing really would happen.  I could still scroll with the mouse, but it bugged me.  Bugged me a lot.

I did a bit of searching and discovered an odd little feature.  Select “Options…” from the “Tools” menu.  On the “Advanced tab”, select “General”.  There is an option, “Always use the cursor keys to navigate within pages”.  If that option is set, the cursor keys can be used to select text on the page instead of navigating the page.

By default, that option is not set.  However, you can toggle it on and off by pressing the F7 key.  And I must have pressed that key at some point and toggled that feature on.  Once I cleared that setting, I could use the Page Up and Page Down keys to navigate the page again.

Thursday, August 27, 2009

Looking forward to Delphi 2010

I just got the email from Embarcadero with the access code to get my copy of RAD Studio 2010.  Almost all of our products that are Delphi based are compiled with Delphi 2007, I’m looking forward to working with 2010 flavor of Delphi.  We do a lot of .NET development, but there is still a need for WIn32 code and Delphi has been a really good development platform for us. 

I’ve had a software assurance contract since Delphi 7.  I don’t jump to next compiler just to get the next compiler, but I do want the new version to be able to evaluate the new version and see if the benefits out weigh the cost of porting to that version.  We chose not to use Delphi 2009.  We had just completed a painful upgrade to Delphi 2006 from Delphi 5 the year before.  The Delphi 7 port was easy because it supported Delphi 2006 components, but Delphi 2009 would have been major undertaking.  We still face the same porting challenges with Delphi 2010, but I still want to evaluate it and that port/no port decision.

Of course the fun part is waiting for the 3rd party vendors to release their updated controls.  We use a fair number of 3rd party packages.  The biggest ones are DevExpress, ReportBuilder, and JEDIDevExpress already put out a notice that they are a few days away from a release that will support RAD Studio 2010.  I’ll be able to do a lot more testing with.  There is no new information from Digital Metaphors about an update to ReportBuilder, but I would expect it fairly soon.  The roadmap page for the JEDI VCL shows that they intend on supporting Delphi 2010, but only sometime in 2009.  My guess would be that any component pack that supports Delphi 2009 should be fairly easy to port to Delphi 2010.

We have a fair number of components that have been either abandoned by the developer or we chose to keep at a specific version.  Those components, I had ported to Delphi 2006/2007 back a few years ago.  Delphi 2009 was a big change and it will probably take more work, but it shouldn’t be that bad.  I may make the decision to drop some of the lesser used components and replace them with equivalent components from DevExpress or JEDI.  We use Abbrevia library that was open sourced by TurboPower when they exited the market.  It has a Delphi 2009 port, that should be an easy one to port to Delphi 2010.

Wednesday, August 26, 2009

I haven’t seen gas that cheap since the Carter administration

Our local supermarket chain, Price Chopper, has been running a promotion this summer in combination with Sunoco.  The more you spend, the greater the discount will be on your next gas fill up.

This is how it works: For every $50 you spend, you earn 10¢ off per gallon of gas on the next fill up.  The nice thing is that they track all that you are spending.  If you spend $75.00, you get a 10¢ discount on the first $50.00 that you spent, plus you have $25.00 towards the next discount level.  When you get the fill up, the discount maxes out at 20 gallons, so you can’t take your fleet of Brunomobiles and fill them up in one shot.  But it can add up.  If you are paying by credit card, you just have to swipe your AdvantEdge card before you start pumping gas.  If you pay by cash, you just let them swipe the card at the time of payment.

I had been racking up the discount points this summer without paying too much attention to it.  A couple of weeks ago, I stopped into Price Chopper and bought some ice for a party. My current discount was printed on the receipt and it was $2.20 per gallon.  Some of the discount was due to expire at the end of the month, so it was time to cash in.  The discounts expire two months after they are earned, so it was use it or lose it.

The Stewart’s near my house sells Sunoco gas and the receipt here shows how much I paid to fill up my tank.  I paid 59.9¢ a gallon.  I paid a little bit over $8 to fill up a car.  That was just stunning.  That price takes us back to the year 1977.  On a side note: if you factor in the inflation rate, that price in 1977 is not that far off from what we are paying today.

Now I’m back to 0 on the discount, but since we usually buy all of our groceries at Price Chopper, it shouldn’t take too long to get that discount back up.  I don’t know how long they will be running this promotion, but it’s a pretty good one.

Monday, August 24, 2009

Why it can be good to build a PC instead of buying a prebuilt one.

After installing Windows 7, I wanted to install Windows Virtual PC.  Windows Virtual PC requires that your machine support hardware virtualization.  My home development machine is about two years old and I wasn’t sure it it support hardware virtualization.  I have an AMD X2 64 4800 with an Asus MSI-SLI Deluxe motherboard.  With AMD, the virtualization technology is called “AMD-V’.

AMD provides a tool that will tell you if your machine supports AMD-V.  I downloaded and ran it.  It gave me a message that my motherboard needed a BIOS patch to enable AMD-V.  On surface simple enough, patch the motherboard and off you go. 

I was hesitant on flashing the motherboard with a patch.  My motherboard’s BIOS was working just fine and there is some risk involved with flashing the BIOS to a new version.  If something goes wrong during the flash process, you can brick the motherboard.  Or you could find out the new BIOS makes your system worse.  Plus, I had no idea if a new version actually would enabled AMD-V.

Fortunately, Asus has a decent support forum and I was able to post a message asking about hardware virtualization.  Within an hour, I received a detailed response that the new BIOS versions did enable hardware virtualization and a list of steps on how to flash the BIOS.  I’ve flashed motherboard BIOS or two before and I pretty much know that drill, but it’s nice to get that level of support.  He did recommend clearing out the existing BIOS settings, which is always a good thing to do whenever you update the firmware of an electronic device.

I grabbed the latest BIOS from the Asus site.  I also grabbed the current version, just in case something went wrong wrong and I needed to go back to the old BIOS.  My motherboard had a flash tool built it and it could access a USB thumb drive before the booting the OS.  I copied the BIOS files to the thumb drive and rebooted. 

As it booted up, I pressed the Delete key to jump into the BIOS setup screen.  I selected the flash utility and picked the current BIOS file.  After a few minutes, the new BIOS was installed.  I cleared out the CMOS settings for the BIOS and rebooted.  I went into the BISO setup again and a had a few new options.  One of which was AMD Virtualization, which was enabled by default.

The next step was a reboot.  Windows came up and all was good.  I ran the AMD tool and it said that AMD Virtualization was good.  That was pretty painless.  When I got this machine 2 years ago, I had it built from a hand picked list of components.  I’ve had good luck with Asus motherboards and I wanted one where it would be easy to update and upgrade.  Plus I wanted a decent power supply.  When you buy an off the shelf PC, you don’t get to pick the components, other than the capacity and number of items. 

I used to do the actual assembly, but I’ve found it easier to have it assembled by the place where I buy it from.  That way they can make sure that all of the parts fit together and nothing is missing.  If something is DOA, they’ll find it when they assemble and test the system.

Sunday, August 23, 2009

Using uberOptions to extend the functionality of Logitech devices

A few weeks ago, I picked up some Logitech mice that were on sale as “dented box” items on the Logitech site.  They were new mice, but their boxes had some minor damage and they were half off.  I grabbed a VX Revolution and a MX Revolution.  The VX was for the family computer that the kids use, and the MX was for my home development machine.  The VX is a notebook model and it’s smaller size fits the kids hands quite nicely.

The MX Revolution was to replace my MX 700 mouse that I’ve had a few years. The 700 was one of the best mice I have ever used, but I had some issues with it.  First off, Logitech did not provide Vista drivers for it. While it worked just fine with Vista, it was only as a standard mouse and the extra buttons could not be used.  The other problem was that the rechargeable batteries had worn out to the point there they would only last for a few minutes.  I could easily find replacement batteries, but I missed the extra functionality of the 700.  Plus I wanted a mouse where the mouse wheel with the “tilt” support for left/right scrolling.

From time to time, Logitech runs “dented box” sales on various products.  If you have right coupon code, you can get a new product with a full warranty.  If you use the site techbargains.com, type “dented logitech” into the search box on the main page, you’ll get a list of the current dented box specials on the Logitech site, plus coupon codes for additional savings.

Both the VX and MX Revolution mice have a little button located just south of the scroll wheel.  By default, it’s mapped to a search function.  Select a word, press the button, and a new browser instance is launched with the selected word passed the search engine.  For some people that may be a cool feature, but I found it just maddening.  With the Logitech SetPoint software that comes with each mouse, you can reassign the mouse button functionality to other behavior.  On the VX, I was able to set the search button to be a middle click button.  I like being able to middle click a link on a web site and get that link opened in a new tab, leaving the existing web page right it I was reading it.

You would think that you could do the same thing with the MX Revolution as you could with the VX Revolution. Oddly enough, while you could assign the middle click function to many of the buttons on the MX, it was not an option for the search button.  I don’t know if that was by design or by error, but it was irritating.  Since the SetPoint configuration software is bundled with all of the current Logitech input devices, the button definitions are not hard coded into the application, but must be read from some set of configuration files.  If I could find where they are located, I should be able to copy the missing MX definitions from the VX settings.

I went on to Logitech’s support forums in search of tips for locating and editing the SetPoint files.  After doing some searching, I found references to something called uberOptions. Rich Owens put together a package called uberOptions, a new set of SetPoint configuration files that greatly expand the options that you can assign to the buttons.  He has modified the files for a large list of keyboards, mice, and trackballs.  The current list of devices plus the installer for uberOptions can be found at http://uberoptions.net/.  It installed and worked just fine with WIndows 7 64 bit.  After I installed it, his default setting for mouse had mapped the search button to the middle click function.  Well played Rich, well played indeed.

[Edited on 8/31/2009]
If Rich Owens’ main site is down, he has a mirror site.

[Edited on 9/8/2009]
Richard Owens sent in an updated link to his site, http://uberoptions.net/, this replaces http://www.mstarmetro.net/users/rlowens/.

Saturday, August 22, 2009

Offload TCP processing to the network controllers under Vista, Server 2008, and Windows 7

After upgrading my home PC to Windows 7, I was decided to see if my motherboard/CPU combination support hardware virtualization.  You need hardware virtualization support if you want to run Windows XP Mode or Windows Virtual PC.  I have an XMD Athlon X2 with an Asus M2N-SLI Deluxe and I’m not sure if that combination supports hardware virtualization.  I’m pretty sure the CPU does, but I don’t yet yet know about the motherboard.

I decided to check the  Asus support forum to see that motherboard supports hardware virtualization and while reading through the forum, I found an a post about tweaking the network settings for a boost in performance.  The TCP/IP stack in Vista has the ability to offload some of the network processing to the network controller, if the network controller has that capability.  Out of the box, Vista disables that feature to prevent problems with controllers that don’t support that feature.

From what was posted in the Asus forum, this motherboard does support that feature.  This motherboard is based on the NVIDIA nForce 570 chipset, which included dual Gigabit LAN controllers.  If you are doing CPU intensive tasks, you can gain some performance benefit by offloading the TCP processing to the network controllers.

Vista refers to this setting as the “Chimney Offload State”.  It’s easy to check and set this value.  if you have a newish motherboard with a Gigabit speed network controller, this should work for you.

To change this setting, do the following:

  1. Open an elevated command prompt.  Either right-click cmd.exe and select “Run as Administrator” or press the Start button, type “cmd” and then hold the left shift and left control keys while pressing the enter key.
  2. Check the current status of the Chimney Offload state by running the following command:
    netsh int tcp show global
    The possible values for that state are: disabled, enabled, default
  3. Run the following command to enable Chimney Offload state
    netsh int tcp set global chimney=enable

Before making the changes, check your current broadband speed.  I like the one at speedtest.net, but the others are fine.  Then after making the change, check it again.  If the performance takes a hit, set the state back to it’s original value.  Not only did it work for me, I did get a slight, but measurable, download speed increase.

Before enabling Chimney Offload:

546138390[1]

After:

546142573[1]

These tests were run a few times before and after the modification.  I picked the average score each time.  That helps even out any existing network traffic that would affect the results.  Going from 17.42 MB/s to 18.70 wasn’t a huge increase, about 7%; but I’ll take it.  There are other settings that you can tweak.  Some are mentioned in the forum posting, and they are also documented in an article in speedguide.net as well.  You don’t often get a free lunch, this is a good one to take.  This setting works for Vista, Server 2008, and Windows 7.  I still don’t know if I can get hardware virtualization, but this was an interesting diversion.

[edited on 8/24/09]
As it turns out, my CPU and motherboard do support hardware virtualization, it just took a little work.

Wednesday, August 19, 2009

A work around for Delphi 2007/2009 with Windows 7 64 bit

I just installed Windows 7, 64 bit edition so that I could code and test against this new operating system.  Visual Studio 2008 installed and ran without any incident, but I hit a snag with Delphi 2007.  Delphi 2007 installed just fine, but it would die when you ended a debugging session.  An assert error would get thrown and after you cleared the dialog, Delphi would be terminated.
The error was thrown by bordbk105N.dll and had the following text:
Assertion failure: "(!"SetThreadContext failed")"
in ..\win32src\thread32.cpp at line 412
Continue execution?
That was followed by a “Yes/No” set of buttons.  It didn’t matter which choice you made, it was pretty much game over for Delphi at this point. After getting this happen 3 times in a row (even with Delphi launched with “Run As Administrator”), I decided to check the Internet and see if this was unique to me and if there was a fix.
I checked Google and found a few hits.  One of them led me to a blog written by Olaf Monien, a German developer with close ties to the Delphi R & D department.  His post, “Delphi 2009 / Windows 7 / 64 bit Debugger Crash Workaround”, described the issue in great detail.  Apparently an incorrect call is being made to the SetThreadContext API call.  The debugger dll has an assert call based on the return value SetThreadContext().  It’s odd that production code went out with asserts enable, that’s usually used during testing.  Some people traced through the debugger code and found that if a single byte is changed in the dll, you could get by this error.  This byte changes the logic so it ignores the return code from SetThreadContext() and never hits the assert code.  You can read about how they came up with that idea here.
An enterprising programmer named “LordByte” wrote a handy little utility that will patch the debugger dll for both Delphi 2007 and Delphi 2009.  Olaf is hosting the patch tool on his blog and This file found a permanent home at Embarcadero and you can download it from Delphi_2007_2009_WOW64_Debugger_Fix.zip.  This works but you now have the added risk of actual errors being returned from that call to SetThreadContext() being ignored.  Since the alternative is an unusable Delphi, it’s a risk I’m going to have to take.

[Edited April 22nd, 2013]
While I no longer use Delphi, I hate to see a broken link.  I updated the download link for the debugger patch to it's current home at Embarcadero.