Ben Wong is a Web/iOS Developer from Brisbane, Australia. When he's working he is usually coding in HTML, CSS, Javascript, ASP.NET (C#/VB.NET) or SQL. He enjoys working with Umbraco CMS. When he's not coding he's probably on a basketball court.

Workaround to enable scrolling in overflowing divs in Android browsers

The other day while working on a mobile website at work we discovered an odd issue that affects Android users. On one of the mobile website’s pages there is a modal popup that has a scrollable div. In Mobile Safari you can scroll the contents of the div as expected, but it did not scroll in the Android browser.

After some research I discovered a Javascript workaround in a blog post by Chris Barr.

Scrolling a overflow:auto; element on a touch screen device

I added the Javascript to the page and it fixed the problem. In future though, I would probably avoid having scrollable divs in mobile web pages to avoid the issue. I also think they can cause some confusion when you scroll to the end of the content within the div and begin scrolling the page.

How to restore the Windows MBR after removing Linux

I’ve been dual booting Windows 7 and Ubuntu Linux on my desktop PC for a while. Today I decided to delete Ubuntu to free up space for Windows as I’ll be dedicating more time to ASP.NET development.

So, I downloaded a free partition manager and deleted the LInux partitions from my HD and resized my Windows partition to fill the hard drive. When I restarted I was presented with an “error: unknown filesystem” or some such message and the “grub rescue” prompt. From experience I knew immediately it was MBR related. Unfortunately, I always forget what to do.

I did some research and eventually found the solution. Here’s how you fix the issue.

  1. Find your Windows installation disc and insert it into your optical drive.
  2. Restart your PC and boot from the installation disc. This will start the Windows installation interface.
  3. Select the region, language and keyboard type.
  4. Click “Repair my computer”, then select your Windows installation.
  5. Select “Command prompt”.
  6. Enter the following commands at the prompt:
    bootrec.exe /FixBoot
    bootrec.exe /FixMbr
  7. Restart.
  8. Done.

IE Bug Workaround – Unclickable absolute positioned hyperlink over absolute positioned image

I had to fix an IE9 bug today where an absolute positioned hyperlink over an absolute positioned image was not clickable. Here’s an example of the code in question to give you a better idea of the problem.

At first I thought it was a z-index problem. But adding a z-index didn’t fix it.

I found a solution recommending the background-color of the hyperlink be set to an almost transparent colour with using RGBa. Unfortunately RGBa only works in IE9 for certain conditions and the page wasn’t going to meet those conditions without a lot of work.

In the end I resorted to using a transparent 1 pixel png image for background-image on the hyperlink. Not the cleanest solution, but it works.

How to unit test asynchronous methods in iOS using SenTestingKit

I’ve found the best way of unit testing asynchronous code in iOS using SenTestingKit (OCUnit) is by using a dispatch semaphore.

Here’s an example of how to use it:

What’s a dispatch semaphore? I’ve added some links below with explanations.

Related Links

Expectations for the March 2012 Apple media event

It’s the eve of another Apple media event. There’s lots of speculation about what will be announced. I try to ignore most of it because I know most of it is just link bait and plain ridiculous. So, I’ve decided to write my own list of expectations.

So here goes.

  • New iPad
    • iOS 5.1
    • retina display
    • more powerful processor
    • more powerful graphics processor
    • better cameras
    • larger storage capacities
    • about the same battery life, but maybe a little less
    • probably a new 4G/LTE version
    • iPad 2 will shift to low cost model like iPhone 3GS and 4
  • New AppleTV
    • 1080p support
    • Mac AirPlay Mirroring support
    • maybe iCloud features
  • Maybe one or more new AirPort products
  • Maybe a new TV product

Anything else is a bonus.