Wednesday, January 30, 2013

HP Printer on HP Windows 8 Furstration

We had bought an HP desktop computer with windows 7 a few months ago.
Using the Microsoft upgrade offer we upgraded to Windows 8 for something like $15.

Then we found the HP scanner/printer driver needed to be re-installed (among some other things).

So we got the latest driver for the printer from the HP website.
Unfortunately the driver kept telling us that there was a registry key missing, and forced us to re-boot.
After re-boot, it did the same thing again.

So I added the registry key as it described it, which made it go further, but in the end it said it failed, and when I told it to continue, it undid everything it had done.

ARGH!

After a few re-tries, I had an idea. I ran the install again until it said it failed, but before I let it continue to undo everything it had done, I opened up task manager and killed the install program.  Interestingly the spinning disk didn't go away, so I re-booted (after making sure there was nothing left in the Run registry key or my startup folder to make the install program run again).

After re-boot, the printer appeared as healthy in the printer and devices control panel applet (I was able to print a test page), and the HP solutions app works for scanning! Whew!

Boo to HP for the faulty driver install program and all the bloatware in it.

Wednesday, January 23, 2013

Debug PHP in Notepad++ and Windows IIS

Finally, I can debug my php code with breakpoints, watches, stepping through, etc from within Notepad++ in Windows with a website hosted in IIS on my local computer.  I have it working on Windows XP with IIS 5.1 and also on Windows 7 with IIS 7.5.

I have missed the ability to debug php for so long, having to resort to calling error_log(print_r($value, true)); all over the place when trying to locate bugs in my code er.. oops, I mean other people's code, got it?

I had to install xdebug into php, and install the DBGp plugin into Notepad++ . Just download DBGp from that link, extract and copy dbgpPlugin.dll into the plugins folder in the Notepad++ install folder (C:\Windows\Program Files\Notepad++\plugins for 32-bit systems, C:\Windows\Program Files (x86)\Notepad++\plugins for 64-bit systems).

I followed the detailed instructions here for setting it up and getting it going.

I had to change the path to the php extensions folder and the temp folder from the unix-like path to my correct Windows path. I set the xdebug output and remote log folders to the xdebug folder under the error_log folder which is defined elsewhere in the php.ini file. My php.ini on one of my PC's already had a zend section with some of the settings, so I just added the missing debug lines under that zend section.

Looks like you can use xdebug.remote_enable=On instead of xdebug.remote_enable=1. I didn't try changing the other 1's to on or 0's to off.

More details on turning debugger on and off:


Start debugging by attaching debug parameter ?XDEBUG_SESSION_START=<session name> to the test script like this:
  http://localhost/test.php?XDEBUG_SESSION_START=1

Doing so stores a cookie called XDEBUG_SESSION in the browser, which is good for one hour, and causes xdebug to try to connect to a debugger.

To stop xdebug from trying to connect to a debugger, add ?XDEBUG_SESSION_STOP parameter like this:
  http://localhost/test.php?XDEBUG_SESSION_STOP

Other Debugger Options
The xdebug website has other browser based debugger plugins, but I have not tried them yet.:

I hope this helps someone out there.