Browsed by
Category: Technical

iPhone programming – Learnings

iPhone programming – Learnings

From the wayback machine…

I found a half-completed post on when I was first learning to program on the iPhone.  I think these things are all still valid…
So, I’ve embarked on an ambitious programming project.  One that is now 1/3 of the way complete (first third was the ‘heaviest lifting’ part of the project – took about a month of outsourced grunt work).  The next 1/3 involves programming an app on the iPhone/iTouch.  I thought that would be the easy part, but as it turns out – there is a substantial learning curve that one should be aware of before starting this endeavor.  Here are some of the learnings I’ve found so far after having just got the bare bones of my own app up and running.

  1. Apple’s documentation is very robust – but frustratingly ‘useless’ at times.  They provide many very detailed and excellent vertical stacks of information.  Want to learn about pooled allocators?  They have a document that gives you all the information you could ever want.  But not in the context of how you’d actually use them – or why you hit various problems you hit.   You’ll find yourself sifting around from document to document trying to find out why your NSString object is throwing an exception when returning from a function – only to find the real reason is buried in the memory management section of the Cocoa programming guide – not anywhere near the NSString documentation or their samples. 
  2. You need to learn Objective C and Cocoa. – and learn them in THAT order.  It’s annoying, but try to find a good Objective C book first.  There aren’t many of them.  There are lots of bad ones though.  Learn how to write a class, add functions with multiple calling parameters, how to make calls to classes, and how allocation works.  That last one is key.  Really spend time learning why:
    [[NSString alloc] init]
    is the right way to allocate and initialize an object and then learn why:
    NSString *s = [[NSString alloc] initFromString:@”hello”];
    [s appendString:@”this string now leaks”];
    leaks memory.  And how the autoAllocator pools work/don’t work.  This is all huge and the first biggest gotcha’s your get hit with right off the bat.
  3. You’ll struggle to get even a 5 line program working at first.  Your first Objective C/Cocoa programs will be very painful.  The simplest things will feel like fighting a brick wall.  I tried to do a simple enum, and kept getting burned by an invalid class definition.  Wha?  The objective C compiler on the iPhone requires you typedef your enums and structs:
    enum newEnum { a, b, c, d }; (NOPE – will cause a compiler error in whatever line follows this definition)
    typedef enum { a, b, c, d } newEnum; (yes – works)
    Just millions of little things like that.  Again, logical if you put your old C/gcc hat on, but it’s been a bit since I last had that hat on and it had some dust on it…
  4. The GUI IDE is great – if you do things they way THEY want them and only for straight-forward designs.  The interfaces for GUI controls holds very much like Win32/X programming philosophies, albeit the syntax is very different.  X Code comes with it’s own WYSIWYG GUI editor, but I found it very limited if you’re going to come up with any kind of innovative interface.  If you just want some standard buttons/etc – you’re probably fine.  But if you want to have some interesting scrolling effects/etc – you best be ready to spend another few days learning how the UI control systems work underneath and experimenting.  The built-in GUI editor reminds me of the old VS2005 GUI editor that you could drag-n-drop controls, compile, and you’d see the results.  If you want any dynamic elements – I haven’t found a way to do that using their gui editor.  And if you want to embed controls on scrolling panels and some other more modern effects – you’ll be tossing the GUI editor altogether.  Trouble is, you spend a good bit of time learning how the built-in GUI system works, find out it won’t do the thing you need without tons of digging through forums and ‘tricking’ the thing to do what you want, then give up and have to learn a bunch of NEW stuff when you give up and decide to just dynamically/hand-generate the controls yourself.  Frustrating.



							
Windows 7 blue-screens due to stdriver64.sys

Windows 7 blue-screens due to stdriver64.sys

I recently started getting blue-screens with stdriver64.sys. In doing my blue-screen debug, very little useful information was given:


SYSTEM_THREAD_EXCEPTION_NOT_HANDLED (7e)
This is a very common bugcheck.  Usually the exception address pinpoints
the driver/function that caused the problem.  Always note this address
as well as the link date of the driver/image that contains this address.
Arguments:
Arg1: ffffffffc0000005, The exception code that was not handled
Arg2: fffff8800970bbe8, The address that the exception occurred at
Arg3: fffff8800676d7f8, Exception Record Address
Arg4: fffff8800676d050, Context Record Address

Debugging Details:
------------------

EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s.

FAULTING_IP:
stdriver64+1be8
fffff880`0970bbe8 49              dec     ecx

EXCEPTION_RECORD:  fffff8800676d7f8 -- (.exr 0xfffff8800676d7f8)
ExceptionAddress: 0000000000000000
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 158383080
Parameter[0]: fffffffffffff880
Parameter[1]: 0000000000000002
Parameter[2]: 0000000000000000
Parameter[3]: 0000000000000000
Parameter[4]: 0000000000000000
Parameter[5]: 000000000022dba8
Parameter[6]: 0000000000000000
Parameter[7]: 0000000000000000
Parameter[8]: 0000000000000000
Parameter[9]: 0000000000000018
Parameter[10]: 0000000000000000
Parameter[11]: ffffffffffffffff
Parameter[12]: 000000000000007f
Parameter[13]: 0000000000000000
Parameter[14]: 0000000000000000
Attempt to execute non-executable address 0000000000000002

CONTEXT:  fffff8800676d050 -- (.cxr 0xfffff8800676d050)
Unable to read context, NTSTATUS 0xC0000147

DEFAULT_BUCKET_ID:  VISTA_DRIVER_FAULT

BUGCHECK_STR:  0x7E

CURRENT_IRQL:  0

LAST_CONTROL_TRANSFER:  from 0000000000000000 to 0000000000000000

STACK_TEXT:
00000000 00000000 00000000 00000000 00000000 0x0

STACK_COMMAND:  .bugcheck ; kb

FOLLOWUP_IP:
stdriver64+1be8
fffff880`0970bbe8 49              dec     ecx

SYMBOL_NAME:  stdriver64+1be8
FOLLOWUP_NAME:  MachineOwner
MODULE_NAME: Unknown_Module
IMAGE_NAME:  Unknown_Image
DEBUG_FLR_IMAGE_TIMESTAMP:  0

BUCKET_ID:  INVALID_KERNEL_CONTEXT

I dug around on my support forums, and exception 7E has been related to loads of different problems: bad logitech mice drivers, cardbus adapters, audio drivers, failed USB drivers when it happens on awake from hibernate, etc.  Basically, any and all services seem to be known to cause it.  Also, having the module and image names completely unknown wasn’t very hopeful either.  I considered the idea of stepping into the memory location specificed until I found this write-up.  It mentions the program SoundTap as a very common source.  I had recently got Soundtap as part of a kit including the excellent Switch sound converter.  I uninstalled Sound Tap and sure enough – bluescreens went away.  Soundtap installs an audio driver to divert playback so you can do raw rips of anything you play on your pc (think sound ripper for youtube/shoutcast streams/shockwave players/etc).

So, it’s always a good idea to keep track of what you’ve changed on your pc and suspect even the unlikely things such as a simple software install.  That and googling for others with the same problems. 🙂

Successful iPhone 3GS battery replacement

Successful iPhone 3GS battery replacement

Well, just shy of 2 years, the battery in my iPhone 3GS had gotten pretty sad.  While it would charge up to 100%, it would run down really fast.  I wasn’t able to get more than half a day of good use out of it before it needed recharging.  Even sitting on my desk at work doing nothing it would lose 20% in an 8 hour stretch and seem to be getting worse every day.

Call up an Apple store, and ask them.  Battery replacement on a iPhone 3GS?  $199.  Really?  $199 sir.  Hangup.  I look around on the internet.  Lots of folks selling iPhone batteries, and most for $5-$15.  I start looking around for the most reputable guys, and find iFixIt.com.  They have lots of great step-by-step diagrams, descriptions, videos, and pictures.   Even better, they have a comments section that has literally hundreds of folks who put tips/gotchas/etc. This is looking good.

They sell a 3GS battery kit with all the tools you need for $15 – which includes a tiny screwdriver and a small plastic pry tool that they claim is the same one made for Apple.  You can also buy other helpful tools like a suction cup for removing the 3GS screen.  I decide to take the risk and have it all shipped – $25 total.

Kit comes in the mail and looks pretty well packaged and has all the tools I need.  I open it up and go to the website for instructions.

I follow the instructions pretty closely.  This isn’t like swapping the battery in your remote.  Mine has 16 different steps with no less than the removal of 10 different tiny screws and 7 different tiny ribbon cables.  You need to remove the screen, logic board, camera, and …well… basically everything because the battery is on the very bottom *glued* to the back plastic panel.  I remove it all, install the new battery, and reverse the 16 steps.

I flip it on, *blip!* it makes the normal startup sound – the screen backlights – but NO image/icons/etc.  🙁 I plug it into my computer and it syncs and sees the phone just fine.  I can even see my pictures and music on it – but no image.  I take it apart 2 more times and try re-seating the 3 display cables.  Same result.  Ugh.  I go to check iFixIt.com’s forums, but the site is now down for maintenance – right in the middle!  I remember from a previous look on the forum where one guy had to restore the factory defaults to fix a problem with his phone not charging properly.  I figured what the heck and tell iTunes to restore to factory defaults.   Turns out there was an update due, so it took 30 minutes to download the patch and another 15-20 to restore the defaults.  Shesh.  But right after the restore of factory defaults – I get my display back!  WOOT!  I restore everything, then make a phone call – works like a champ!

I make a phone call, test the buttons, test the camera/screen/music/etc, and everything seems to work great.  Why a software reset is needed to have your display come back after a simple battery replacement is beyond me – but there it is.

So, I don’t recommend the procedure to everyone.  It took about 30 minutes of steady concentration and a equally steady hands – but it seems to be working like a total champ.  It just finished charging to 100%, so we’ll see how well this battery lasts, but it already seems much better.

My own market direction speculation from GDC 2011

My own market direction speculation from GDC 2011

Here’s are my guesses/market trends based just on what I’ve been seeing/hearing/guessing:

  • Mobile computing (i.e. smartphones) is a powerful new force that is here to stay and is really pushing computing and gaming in new directions.  Since mobile is now entering into its ‘teenage’ years, there is still a lot of rushing around and ‘land-grabbing’ going on trying to align markets, business models, programming models, distribution, and revenue streams.  There is very good money to be made for the savvy, but it’s also more risky.  Those software companies that enter and establish a good name/brand will likely do very well, but almost certainly will be smaller, more nimble companies.  Nobody is making a killing on phone apps and very few can quit their day jobs and live off what they make solely from that revenue stream until things settle more.
  • Consoles will continue to be developers’ target platform because they have a stable user base, known revenue stream/model – but are in severe danger of being rendered impotent.  They need to solve:
    • Aging graphics.  With no new consoles in the works for a few years, things are already looking dated and it will only get worse.  There was absolutely no talk of any new consoles – which means it’s at least 2+ years away.  Microsoft appears to be trying to figure out it’s own strategy as there was no info for a new version of DirectX and a lot of effort clearly trying to get Winphone 7 adoption/features/devs going.
    • Terrible loading times, frequent updates, etc are all a terrible experience and hindrance to keeping people using their consoles.  I already know several people to whom their XBox 360 is really just a Netflix box.  And with the advent of all those features in smart TV’s coming – that selling point will soon disappear.
    • There were a number of rants about 40+ hour games and how people simply don’t finish them or want to play one game that long anymore (except for AAA titles like Call of Duty/etc).
    • Not as solid of a digital distribution of whole games like on PC/Mac where you can get whole games online (Steam/etc)
    • Higher entry bar for indie developers to develop for vs PC/Mac
    • No instant on/off features like every laptop and phone has.  Waiting 5 minutes to boot your console and scan past splashes/intro crap/etc is intolerable in an age they will be competing against smartphone games.
  • Smaller, faster casual games will grow like wildfire but generating a sustainable (and livable) revenue stream from them will still be getting hammered out for the next few years.  Studios that develop them will stay smaller and live leaner – but likely deliver a lot of the innovative new gameplay for casual markets.  We’re in the exuberant pre-teen days of this movement, so it’s direction is still very malleable.  Yet, there will be a point at time at which the limitations are felt out and they get their stride.  It’s already happening and the signs are very positive.
  • The indie developers will continue to come out with buckets of games.  Following the 80/20 rule, 80% of them will be garbage, but 20% will do well.  The top 1-5% will be phenomenons (i.e. Minecraft) and those 1-5% will really move gaming in a newer direction. That direction being:
    • Game developers will develop with off-the-shelf engines and middleware, not programming stuff themselves.
    • Games will focus on simpler and more creative elements.
    • It will keep the industry from going into stagnation and death, but take it in a new direction very different than the old guard.
  • Big houses will become fewer, but get more powerful and likely be lonelier at the top (ala movie studios).  As the cost of AAA games rises each year, consolidation and shake-out will happen.  Which means they’ll likely be more and more conservative and get more entrenched in their franchises – which probably means less innovation on the IP front, but they will be cutting-edge beautiful.
  • PSP’s and handheld gaming will just about disappear in the next 5 years as smart-phones will become so ubiquitous and be just as powerful with many more options.  Nobody will pay for two wireless plans to connect their PSP’s/DS’s.  This is bad news for Nintendo, and somewhat Sony, who have a large portion of their revenue stream from their handheld gaming devices.  It’s unclear whether they see this threat – but Sony appears to be seeing this threat with a ‘certification’ program for mobile devices.
GDC 2011 Trip report

GDC 2011 Trip report

It’s been about 4 years since I last attended GDC, but some interesting trendlines seem to have solidified/gone away since last time I was there.  Winning mobile developers was THE topic for the show. Sessions continued to be very good – but I noticed that almost (if not more than) half of them are now related to art, gameplay, or business concerns (not technical).  The Indie game scene appears to be moving beyond just closet developers and becoming a big and energetic movement in the industry.    Hiring appears to be back judging by the energy and sheer number of interviewing/companies interviewing on the show floor.  Attendance seemed to be at record levels at 19,000 attendees.

 Details:

  • Attended Wednesday thru mid-Friday sessions on my own accord – so no booth duty/official duties on that front.
  • Notable sessions I attended:

1.       Data Management For Modern Game Pipelines – Two fellows from Autodesk/Maya went over the state of current content pipelines from Maya to game engine.  They are apparently hard at work at Autodesk trying to make these converters and content back-and-forth between engine and Maya easier with a project called DNA.  It is a system of metadata and a database that, once integrated into your engine, allows you to quickly get assets out of Maya into your game engine, and back into Maya quickly.  It was likely too cumbersome for most game developers, but it was a good recognition on their part of the needs of the industry. 

2.       Noon poster sessions.  Real-time music generation was well done (for what it was) and the ’10 things to know about usability testing’ was a good list of resources for those trying to understand what doing usability testing was.

3.       One hour 10 speakers talk had a lot of great ideas.  One of best was why consoles are failing: 1. In age of instant-on mobile/PSP-type devices, waiting 15 minutes to get into a game is intolerable.  2. Too many cutscenes, license agreements, booting, etc.  Want instant-on wake-from-sleep into my game just like a laptop.  3. Wants no more 40+ hour games – they’re just too long. 4. Update sizes and frequency are just ridiculous – you only should have 1 update per quarter.  Period.  Many other good thoughts if we ever want to go into that realm.

4.       Multicore Memory management in Mortal Kombat.  EXCELLLENT talk on a multi-threaded memory manager.  Takeaway is that it took them 11 months to get it done (3 months of that was just to get the multi-threaded/lockfree library built they needed), but it’s a really fantastic system they are using in all their games going forward and shows some amazing speed, efficiency, and debugging features.

5.       Dice talk about Data Oriented Design.  Very good talk with good analysis and results.  Takeaway: throw away all your fancy data structures and line up your data for SSE manipulation.  It’s much more performant than non-cache friendly data structures, orders faster, and can easily be threaded.

6.       Kinect skeletal tracking deep Dive.  Very interesting talk on the problems (and solutions) unique to skeletal tracking/Kinect given by Microsoft AE.  Some good general solutions for multi-threaded timing issues.

7.       Halo Reach Effects. Excellent talk on the special effects in Halo Reach.  Excellent new way to do dynamic particle systems that interact with geometry in the real world, shield effects, and a few other really visually stunning, and very realtime, techniques. 

8.       Mega-Meshes – modeling/rendering worlds of 100 billion polygons.  Very interesting talk that seems to be along the lines of last year’s ID siggraph talk on streaming massive geometry.  The second half had to do with getting pretty decent spherical harmonic lighting techniques on Xbox and other consoles.  Lots to digest in the talk – so I’ll likely look at the slides when published.

9.       Experimental gameplay – 10 or so people positing or showing interesting gameplay techniques and ideas.  This session really showed what the Indie scene is about – trying to create unique experiences.

10.    Marble Madness, Pitfall, and Doom postmortems
       

  • Trend speculations based on what I saw:

1.       Mobile – the real energy this year was clearly behind winning developers into each camp’s mobile and tablets.  Unity showed extensively.  Free hardware galore, tons of sessions, and big parties were being thrown.   With years left to go before another console refresh – it was mostly just quiet, incremental changes from the big players like Xbox, Sony, and Nintendo.  With smartphones getting such sophisticated graphics hardware, it does make me seriously wonder if the days of PSP or DS-like gaming devices are limited, which could spell big problems for console companies that see such large revenue streams from them.

2.       Monitizing – Lots of financial companies on the show floor and session talks focused on micropayments and new revenue streams.  The fact there were old-school financial and credit card companies on the show floor was a real shock.

3.       Indie culture – The indie area of the show floor was packed every time I went by it.  Lots of young energy and it’s more than just hype judging by the awards Minecraft won.  Attended 2 classic game post-mortems which really clarified in my own mind the shift in game dev culture.  Used to be programmers ruled the roost in developing games, but now I think we’re seeing that most of the current game developers in the indie scene are content with using off-the-shelf engines/tools and focus 90% their attention on the gameplay and creating unique experiences as opposed to focusing on the newest/greatest tech. 

4.       Hard-core technical talks seemed to be diminishing in number, but not quality.  Still excellent work being done, but I wonder if this large trend towards younger developers just using more off-the-shelf engines and simpler mechanics will create a two-tiered system in which the majority of smaller Indie games will use low-end/runs on just about anything techniques, while AAA titles will always continue but just get more technically impressive, but (with fewer studios able to afford it) smaller in quantity and more insular.  Do we turn into a world where there are a few engine makers and game houses are primarily programmers that write games in scripts on top of them?

SQLite on iPhone is byte compatible with Windows

SQLite on iPhone is byte compatible with Windows

I was working on a good write-up on how to use SQLite in C# (since the most popular package install for SQLite on C# is kinda broken in Visual Studio 2010), but thought this might be a good data point for folks.

So, the short answer?  Yes, you can build SQLite databases on Windows, copy them across to your Mac, and then use them in iPhone applications without any issues.
You should open the database with the proper character formatting  ( sqlite3_open([dbPath UTF8String], &database)),
but other than that the SQL files can be just copied straight across the devices from Win 7->Mac->iPhone and the same select/delete/etc commands work like a champ.

How do I know?  I did it last night. 🙂

O’Reilly book list contest

O’Reilly book list contest

O’Reilly publishes a lot of nerdy books, and right now they’re having a contest to win up to $500 of their books.  You register on their website and publish your wish list to your blog (like this), and you get entered into a chance to win those books!

Here’s my list (which adds up to $497.83) 🙂  I sure hope I win!

  • Programming Interactivity, 1Ed
  • Intel Threading Building Blocks, 1Ed
  • The Art of Concurrency, 1Ed
  • Building Embedded Linux Systems, 2Ed
  • Designing BSD Rootkits, 1Ed
  • Linux System Administration, 1Ed
  • Linux Kernel in a Nutshell, 1Ed
  • Unicode Explained, 1Ed
  • flex & bison, 1Ed
  • Learning SQL, 2Ed
  • Getting Started with Arduino, 1Ed
  • Mastering Regular Expressions, 3Ed
  • Regular Expression Pocket Reference, 2Ed
Fedora Core 14 on VMWare

Fedora Core 14 on VMWare

Error during Install:
If you try to install Fedora Core 14 on VMWare and use the wizard which automatically sets up the VMWare settings, shortly after booting the install DVD, you’ll get a fatal error:

Section does not end with %%end

Go to VMWare, and for the Fedora list VM:
Go to settings -> CD’s and DVD’s->  (here will be two CD/DVD setup) delete or unset the cd/dvd whose disc image is autoinst.iso

Reboot the install, and all should go as expected.

VMTools

Also, VMWare Tools (VMTools) won’t install correctly by default.  You’ll need to follow this procedure:
http://www.sysprobs.com/fedora-14-vmware-install-vmware-tools-fedora-14

How to debug a Bluescreen minidump

How to debug a Bluescreen minidump

So, your machine is bluescreen-ing on a semi-regular basis.  It’s annoying the @#$% out of you, but you can’t find anything in the system logs that indicates what’s causing it.  Maybe (like in my case) the computer in question is your DVR box and sometime during the night Media Center is waking up, trying to update a program guide, and then blue-screening.  Nothing helpful is left in the logs, but you did get a minidump file.  If you get a minidump, my friend, you are in business!

  1. Make sure you have a minidump file with your bluescreen.  You should see a numbered file with the .dmp extension with the date/time for the bluescreen located in  C:\Windows\Minidump
  2. Download a handy free tool called BlueScreenView by Nirsoft.  This handy tool will automatically decipher a minidump file and you can verify that it matched what you saw on the blue-screen.  It won’t give you everything you need, but it will tell you if you have the right mini-dump for the crash you saw. It also shows you the codes thrown so you don’t have to write them down by hand at the bluescreen.  You’ll note that often BlueScreenView reports a source of the error (ntkrnl.exe in my case) but this is usually NOT the real root cause.  As we’ll soon find out, the high-level source it cites isn’t always the real problem, but was a module loaded BY that source or the module in which the source was loaded.
  3. Do these one-time setup steps.  In order to make sense of the minidumps, you need some tools provided by Microsoft:
    1. Download and install the Debugging Tools for Windows pack.  Make sure it gives you the right version for your OS (win7 x64, vista x32, etc).  This pack contains the kernel debugging tools you’ll need.
    2. windbg.exe will likely be installed in c:\program files\Debugging Tools for Windows (x64) (or whatever x32/x64 you have)
    3. Open a command prompt as administrator, CD to the windbg.exe directory
    4. run:
      windbg.exe -IA
      windbg will start up, and inform you that it is now the registered file association handler for all dump files. Close windbg.exe
    5. Restart windbg, and go to file->Symbol File Path
    6. Enter:
      SRV*C:\Development\SymCache*http://msdl.microsoft.com/download/symbols
      You can set the local directory ('C:\Development\symcache' in my case) to whatever you want, but everything following the rest must be exact.  This instructs windbg to load the needed symbols from Microsoft’s internet site (release modules usually don’t have symbols, and letting you recompile your own kernel by giving the source out isn’t something MS usually lets you do. :)) Whenever you debug something and windbg needs the symbols, it checks your cache location first and downloads the needed symbols if they are not found and stores them in the cache.  So the more you debug the more symbols you build up and faster future debugging will go.  Exit windbg and save the settings.
  4. Open windbg.exe (again), and do a file->open dump and open the minidump in c:\windows\minidump that corresponds to the bluescreen you’re trying to debug.  You might need to be administrator when starting windbg.
  5. Windbg will automatically start downloading symbols, and doing some basic analysis.  It may look like it’s done/just sitting there sometimes, but don’t do anything until you see it’s ‘diagnosis’.  Usually looking like this:
    Use !analyze -v to get detailed debugging information.
    BugCheck 9F, {3, fffffa800af7f440, fffff80000b9c4d8, fffffa800745f860}
    Probably caused by : usbhub.sys
  6. But don’t take this as the final word on the crash source and send nasty letters to the usbhub.sys driver writer!  Type !analyze -v as it suggest, and you’ll likely get a more detailed analysis, like this:
    DRIVER_POWER_STATE_FAILURE (9f)
    A driver is causing an inconsistent power state.
    Arguments:
    Arg1: 0000000000000003, A device object has been blocking an Irp for too long a time
    Arg2: fffffa800af7f440, Physical Device Object of the stack
    Arg3: fffff80000b9c4d8, Functional Device Object of the stack
    Arg4: fffffa800745f860, The blocked IRP
    Debugging Details:
    ------------------
    DRVPOWERSTATE_SUBCODE: 3 IMAGE_NAME: usbhub.sys
    DEBUG_FLR_IMAGE_TIMESTAMP: 4a5bcc2d
    MODULE_NAME: usbhub
    FAULTING_MODULE: fffff8800767a000 usbhub
    CUSTOMER_CRASH_COUNT: 1
    DEFAULT_BUCKET_ID: VISTA_DRIVER_FAULT
    BUGCHECK_STR: 0x9F
    PROCESS_NAME: System
    CURRENT_IRQL: 2


    STACK_TEXT:
    fffff800`00b9c488 fffff800`02ef3273 : 00000000`0000009f 00000000`00000003 fffffa80`0af7f440 fffff800`00b9c4d8 : nt!KeBugCheckEx
    fffff800`00b9c490 fffff800`02e9029e : fffff800`00b9c5c0 fffff800`00b9c5c0 00000000`00000001 00000000`00000000 : nt! ?? ::FNODOBFM::`string'+0x292b0
    fffff800`00b9c530 fffff800`02e8fdd6 : fffff800`03034700 00000000`00146bde 00000000`00000000 00000000`00000000 : nt!KiProcessTimerDpcTable+0x66
    fffff800`00b9c5a0 fffff800`02e904be : 00000030`9c591870 fffff800`00b9cc18 00000000`00146bde fffff800`03002e48 : nt!KiProcessExpiredTimerList+0xc6
    fffff800`00b9cbf0 fffff800`02e8fcb7 : 00000010`31b602c1 00000010`00146bde 00000010`31b602f2 00000000`000000de : nt!KiTimerExpiration+0x1be
    fffff800`00b9cc90 fffff800`02e8ceea : fffff800`02ffee80 fffff800`0300cc40 00000000`00000002 fffff880`00000000 : nt!KiRetireDpcList+0x277
    fffff800`00b9cd40 00000000`00000000 : fffff800`00b9d000 fffff800`00b97000 fffff800`00b9cd00 00000000`00000000 : nt!KiIdleLoop+0x5a

    STACK_COMMAND: kb
    FOLLOWUP_NAME: MachineOwner
    FAILURE_BUCKET_ID: X64_0x9F_3_AiCharger_IMAGE_usbhub.sys
    BUCKET_ID: X64_0x9F_3_AiCharger_IMAGE_usbhub.sys

Now we see the whole story.  We see that in the usbhub.sys device driver, something listed in it’s ‘DPC’ table failed to respond in time to some request the usbhub.sys made.  That process was put on the timer expiration list which threw the bluescreen.  Since usbhub.sys is a hub with many things plugged into it, odds are good that the DPC list is the list of device drivers for each device plugged into the hub, a list of events that need handling, or a list of devices themselves.  When we look at the ‘failure bucket’ we see the AiCharger_IMAGE_usbhub.sys device was the source of the failure.  Odds are good the usbhub.sys is loading ‘images’ that contain the device’s driver for each of the devices plugged into the hub; and the one that failed in this case has the name AiCharger.   If I look in my Device Manager in Windows, I find a driver called AiCharger.sys – under the USB devices.  Ah ha!  A quick Google reveals this is a driver that enables smart/high-speed USB charging of iPhone/iPod devices on my Asus motherboard. If I go one step further, I can speculate that the bug is in the portion of the driver that is supposed to respond to sleep/wake/power events and that somehow the call to wake up the iPhone I have plugged in isn’t responding.  Dang – Asus owes me a donut for doing all the work for them.

So, now you know who’s really responsible.  You send a bug note to Asus with the dump results and un-install the AiCharger tool/stop leaving your iPhone connected at night to the machine when it’s asleep until they get a fix for AiCharger.  You also find out that someone else already had the same problem…
There are many other debugging commands you can also use, and those are all outlined here.  Hopefully this will help YOU out the next time some crazy bluescreen you can’t figure out; and you won’t be re-installing the OS to get rid of it.

Protips: 99% of the time, bluescreens are usually a driver and not something in the actual Windows system.  Especially if they are repeatable.  Always get the latest drivers first.
When the crashes are wake/sleep/resume/power related, often you should go to the device driver in the Device Manager and uncheck any ‘allow system to turn off the power of this device’ as a second step if the latest driver doesn’t solve it.  This prevents Windows from making calls into possibly faulty driver code.  Power mangament issues are very common with drivers still.
If you get dumps and the crashes are different places every time or random in timing – then you might have bad memory or a bad motherboard that’s corrupting things.  Check heat sinks or temps and possibly change ram/mb’s.

Other resources:
-The official Microsoft list of bluescreen failure codes with documentation on each one:
http://msdn.microsoft.com/en-us/library/ff542347%28v=VS.85%29.aspx

-Another list of the various bluescreen failure codes and their plaintext sub-code descriptions with some notes from external folks:
http://www.faultwire.com/solutions_index/fatal_error-1.html#IssueList

-Microsoft Answers forum that has really responsive and informative threads on just about every blue-screen investigation ever done.  These guys chew up minidumps all day and can help you track down just about anything that’s going on (if just searching the forum doesn’t do it for you automatically):
http://social.answers.microsoft.com/Forums/en-US/w7repair/threads

-Another Microsoft forum that seems to do a fair amount of this kind of debug work:
http://social.technet.microsoft.com/Forums/en/w7itproperf/threads

Using TWAIN driver for your Canon CanoScan LIDE 25 on Windows 7 x64

Using TWAIN driver for your Canon CanoScan LIDE 25 on Windows 7 x64

Yeah, so you automatically got the newest driver for your Canoscan when upgrading to Windows 7.  However, when you go into Photoshop CS5, you no longer see TWAIN devices listed(!).  Unfortunately, in Adobe’s infinite wisdom, they have discontinued installing TWAIN support by default.  You need to go here:

http://www.adobe.com/support/downloads/detail.jsp?ftpID=4688

to download the ‘Photoshop CS5 Optional Plugins’ free download.

Edit: Note – this ONLY works with 32-bit version of Photoshop CS5.  There still is no TWAIN support on 64-bit Photoshop.

Unzip the file, then copy Twain_32.8BA from the zip’s
\PSCS5OptionalPlugins_Win_en_US\Optional Plug-Ins\Win32

directory, and copy it into your Photoshop CS5 32-bit plugins folder:

C:Program Files (x86)\Adobe\Adobe Photoshop CS5\Plug-ins\
directory.  Restart Photoshop and you should see your TWAIN capture option again.