Friday, September 14, 2012

The HP Printer Display Hack (with financial goodness)

The HP Printer Display Hack article has been posted to the Coding4Fun site.  This is an article and application that I wrote that lets you display a stock price on the display panel of an HP (or compatible) laser printer.

The app is written in C# with WPF and it periodically checks the current price of your favorite stock and sends a PJL command to the printer to put that price on the display.  It comes with a Windows Installer, written with WiX.

 

You can read the article at Coding4Fun.  The source code and a precompiled installer are up on CodePlex,  I would like to thank Brian Peek for letting me steal borrow some of the TweeVo code for the UI bits.

Tuesday, August 21, 2012

Taking Office 365 for a spin

As the leader of the Tech Valley .NET Users Group (TVUG), I have the opportunity to use Office 365 for a year.  I’ve become gypsy like in my use of PC’s for working on documents and now seemed like the right time to give it Office 365 a shot.  Stay tuned…

Monday, July 16, 2012

Every 30 seconds, the cursor would turning into the spinning donut of death

I was working from home today when I kept seeing something strange.  About every 30 seconds, the cursor would go from normal to busy.  It would last for a second or two and then go back to normal.  30 seconds later, the cycle would repeat.  I didn’t matter if I was doing anything or not, nothing interfered with the cycle.

This drove me nuts.  First thought was a virus or some other nasty.  Did a full Microsoft Security Essentials scan and a full scan with Malwarebytes Anti-Malware.  Both were clean.


I even took Roy’s advice to no effect.

Nothing showed under Windows Task Manager, so I pulled out the big gun.  The Sysinternals Process Explorer.  Process Explorer will show you a whole lot more than Task Manager.   In addition to the currently active processes, you can see the stuff that each process will load.  I left the process window open for a few minutes on the second monitor.  I immediately saw a pattern.  An app named ScanToPCActivationApp was loading another app named HPNetworkCommunicator over and over again.  HPNetworkCommunicator would load, the donut would spin, then the process would exit.

I recently bought a HP Officejet 6700, a printer with a mind boggling amount of tech for a sub $170 price.  It’s wired and wifi network ready out of the box and that’s how I have it hooked up.  On a wired connection.  When I first powered up the printer, it connected to my wifi network and grabbed the IP address 192.168.2.34.  After switching over to the wired connection, it kept that IP address. I didn’t have any quarrel with that choice so I installed the printer drivers and the PC’s all connected to it at 192.168.2.34.

This printer has the ability to let you scan at the printer and send it to a PC.  It’s a neat trick, but requires an app running in the background.  That would be the ScanToPCActivationApp app.  Something was causing it to constantly check to see if that printer was available.  So it was time to check our connection.

One of the 8 billion features of this printer is it’s very own web server.  It lets you manage the printer, allow printing from other devices (iOS, Android, etc), check the ink levels, and probably order pizza.  It also provides a quick and simple way to verify that the network connection is valid.

I opened up a browser and typed in the 192.168.2.34 IP address.  It timed out.  That’s not good.  I went over the printer and checked the network settings.  It reported back that it was on 192.168.2.34.  So it looks like a conflict of some sort with that IP address.   I checked around and could not find any devices on that IP address.  Which means the offending device is probably turned off at the moment.  I’m going to have to keep an eye out for the device with that IP address, it will be back.

So I decided to change the IP address of the printer and have the router make that a static assignment.  Since I already have a laser printer using 192.168.2.99, I gave the HP the next one down, 192.168.2.98.  First I changed it on the printer, then I changed it on my router. The Netgear WNDR3700 Router that I use lets you assign a static IP address via the MAC address.  Getting the MAC from the printer is easy, it will display it on it’s touch screen or give you the option to print out the network settings.

The last step was to tell each PC that the printer was on a new IP address.  HP has a simple utility called “Change IP Address”, which I ran on my PC’s.  On this machine, I had to type in the new IP address, on the others it discovered the printer again.  All in all, about 5 minutes to make the change.  After making those changes, a quick peek at Process Explorer showed that ScanToPCActivationApp had loaded HPNetworkCommunicator just once and everything was back to normal.

If you take your printer offline or remove it from your network, you will want to disable the ScanToPCActivationApp app from running.  Otherwise it will be constantly checking for a connection to the printer and firing up the HPNetworkCommunicator process over and over again.  To deactivate ScanToPCActivationApp, do the following:

  1. Open the HP printer app.  There are multiple ways of doing this.  You can double click on the printer icon in the “Devices and Printers” dialog if you have Windows 7.  From the “All Programs” menu, select “HP”, then the folder for your printer, then the icon for the printer.
  2. Under “Scanner Actions”, click “Manage Scan to Computer”.
  3. When the “Scan to Computer” dialog opens, click the “Disable” button and the clear the checkbox “Automatically start Scan to Computer when I log on to Windows”.

Those steps may vary slightly, based on your OS and HP printer model, but the actions should be roughly the same.

Friday, June 22, 2012

Thinking about Windows Phone 8

I watched Microsoft’s Windows Phone 8 Summit on Monday and I came away impressed.  My phone contract is up and I have been holding off on getting a new phone.  I knew that Windows Phone 8 was coming and I didn’t have an urgent need to get a new phone. Between that and the Surface tablet, it’s good to see MSFT putting some skin into the game.

The new screen resolutions and shared code base with Windows 8 are very attractive features.  I like how multitasking has been enhanced but not in the wild west flavor of Android.  My Droid 2 can slow to a crawl, depending on what is running.  I would like to avoid that user experience.

I also like the redesign of the start screen.  They had wasted real screen estate in WP7, the live tiles are defining feature of the OS – more is better.  The extra files will look noisy.  You can use a blank tile to create some space between tiles, that may be easier on the eyes.

If you are existing Windows Phone 7 owner, you get a facelift of the new start screen with the 7.8 update, but you don’t get new OS.  People are pretty ticked off about that.  It is the nature of the business, just ask anyone who bought an Android phone a year ago.  Some of them will get Android 4, most will not.

The Nokia’s Lumia 900 looks like a decent enough phone, but I’m on Verizon Wireless and they really are not playing in the Windows Phone arena.  That phone was never an option for me.  Verizon has stated publicly that they will carry Windows Phone 8 devices.  They wont be out until the end of the year, so I’ll have to live with an aging Droid 2 for a while longer.  Having Verizon be a serious player will really open up the market for WP8.

As a developer, I want to get my hands on a WP8 device and writing some code for it.  I’ve played around with Android development, but I would prefer to use C# and XAML over java.  I hope that MSFT can pull this one off.

Tuesday, May 01, 2012

Need to kick my Windows Home Server every now and then

For some reason, my HP MediaSmart Server EX495 seems to be locking up.  It's very infrequent, but when it happens, I can no longer access it and I have to boot it with severe prejudice.  Something is crashing, but I have not been able to determine what is the culprit.
.
I need to spend some quality time with my WHS box to figure out what the problem is.  In the mean time, I'll use the Roy Trenneman method, except via software control.  I want to get the box to reboot itself, once a week.

Ultimately, WHS is a child of NT.  I don't need anything fancy to schedule a restart.  The tried and true "AT" command will do the job.  This AT, not that AT.  What I need to do is pretty basic, I want to reboot the server  every monday morning at 6:00am.  To do this, I followed the following steps

  1. Open a Remote Desktop connection to the WHS, using the administrator account.
  2. Launch a command prompt (Start -> command).
  3. After the command prompt opens up, type the following text:
    at 06:00 /every:Monday "shutdown /r /t 0"
  4. Logout
We have created a scheduled task that will execute the shutdown command.  The "/r" parameter is what forces the restart.  The "/t 0" means no wait before restarting.  That should bandaid my server until I have some time to track down the root cause of the problem.  It will give me more time to ponder the question that every WHS user thinks about: "Why can't Microsoft market Windows Home Server?"

Wednesday, April 25, 2012

Kill all the SQL connections for a DB or app

One of customers needed to be able to clear all of the connections to a database before running some maintenance tasks on the database.  So the question came my way and after searching the Internets, I ended up with the following T-SQL code

DECLARE @spid INT    
DECLARE @getspid CURSOR
declare @KillCmd nvarchar(128)

-- create a table variable to hold the results of the call to sp_who
declare @k TABLE (spid INT,
ecid INT,
STATUS VARCHAR(150),
loginame VARCHAR(150),
hostname VARCHAR(150),
blk INT,
dbname VARCHAR(150),
cmd VARCHAR(150),
RequestID int)

-- fill the table variable
INSERT INTO @k EXEC sp_who

-- Create a cursor to use to walk through the table variable
-- that matches the database we want to filter on
SET @getspid = CURSOR FOR
SELECT spid
FROM @k
where dbname = 'YourDatabaseNameHere'

OPEN @getspid

FETCH NEXT FROM @getspid INTO @spid

-- For each row in the table, create a kill command
-- kill does not work with variables, we need to
-- execute it with sp_executeSQL
WHILE @@FETCH_STATUS = 0
BEGIN
SET @KillCmd = 'KILL ' + CAST(@SPId as nvarchar(10))
print @KillCmd
EXEC sp_executeSQL @KillCmd
FETCH NEXT FROM @getspid INTO @spid
END

-- cleanup
CLOSE @getspid

DEALLOCATE @getspid


The way it works is that we call the sp_who system stored procedure.  This procedure returns a set that lists current users, sessions, and processs.  From that set, we can get a list of all of the connections for a database. 



Since we need to work with the rows of that set, we create a table variable named @k and populate it with the result set returned from sp_who.  You need to match the number of fields and the field types (or pick field types that SQL can convert automatically).



Next, we create a cursor and iterate through the rows that match the database name that we want to kill the connections on.  We are using the kill command to kill the connection.  You basically call kill with the session id to kill, and that session is terminated. In this example, we are matching on the dbname column.  You could easily match by loginame or hostname, depending on your needs.



The kill command has a slight little kink, where you have to pass a literal value to the kill command.  It doesn’t work with variables.  If you try it, you’ll get an “incorrect syntax near…” error message.



To get around this, we fill a string variable with the kill command and the session id.  We then call sp_executesql to execute our dynamically generated SQL statement. It looks somewhat less than elegant, but it works just fine.



This was written as inline SQL so the customer could add it to his maintenance script.  You could easily make sproc out of it and toss it into the master database.

Tuesday, March 13, 2012

I’m bothered by the idea of using the homeless as office infrastructure

There has been a lot of comments regarding the use the of homeless people at the SxSW Interactive conference as roving hotspotsBBH Labs, a NYC based marketing company, did an experiment where they sent out homeless people carrying 4G wireless hotspots.  They wore shirts that said “I’m XXX, a 4G hotspot”.  You paid what you were felt was fair, and the proceeds would go to that homeless person.

homeless-hotspot

Part of me thinks it was a great idea.  That homeless person was providing a service to you and some money was put in their pocket.  But it just doesn’t feel right to me. You are basically using a human being as office furniture.  It’s too close to the scene in the movie “Bruno”, where the Bruno character has hired Mexican workers to be human chairs.

humanchair

One of the things that bothered me was how they were labeled.  “I’m Clarence, a 4G hotspot” is dehumanizing.  A subtle change of the wording to “I’m Clarence and I’m carrying a 4G hotspot” and you have a very different meaning to the service provide. Instead of using Clarence as the service, you are using the services provided by Clarence.

BBH was inspired by Street Newspapers, run by North American Street Newspaper Association (NASNA).  A street newspaper is a newspaper that is focused on the homeless and and poverty issues.  The vendors are poor and/or homeless and they go out into the street and sell the papers.  The vendor gets a cut of the proceeds.  The harder they work, the more money they can make.  They are contributing towards their own income.  And they are telling their own story.  When you buy a street paper, you are buying content written by poor and homeless people.  There is a connection between the vendor and the content.

The human hotspot is a different experience.  It’s a passive role, you basically just stand there or follow people around.  There is no connection between the human hotspot and the Wi-Fi service.  That business model is much closer to the human furniture of “Bruno” and than it is to street vendors selling newspapers.

I think BBH had good intentions, but the implementation was flawed.  They might have been better off having a set of fixed 4G hotspot stations that was manned by poor or homeless people.  You still get your Wi-Fi, but they could set a table with literature and presentations about how the poor and homeless are suffering and what we could to help.  Instead of a homeless person following you around like a feudal serf, you could have bought an access pass that provided coverage from each hotspot table.  Instead of being a passive piece of the conference, the homeless would have been active participants.  That’s better for everyone.

I wouldn’t condemn BBH, they at least tried something to help out the homeless. It was an experiment, they can take the feedback and retool the project for another festival.  This is something that would work at other festivals or large scale conferences.  You would still man the stations with homeless people. They could talk about their issues while signing people up for the Internet coverage.  Verizon Wireless and AT&T could provide the 4G hotspots. They would sell timed access at a discount and provide a portion to the homeless or poverty program that they would sponsor. 

Monday, January 23, 2012

Ratcheting up the scroll with my Logitech mouse

With the PC that gets used by the family, we use a wireless Logitech mouse. It’s the VX Revolution. It’s a few years old, but it has all the functionality that we need.

vx-revolutionI was using it tonight and the scrolling was, for the lack of a better word, wrong.  The wheel usually scrolled with a nice ratchet.  You moved the wheel, and you would feel a nice soft click as it scroll.

Tonight, it had stopped clicking and the scrolling was too sensitive.  You would scroll down a page and when you lifted your finger off the mouse wheel, it would roll back a tiny bit.  This would cause the page on the screen to jump back a bit.  It was very jarring and annoying.  What did I do to this thing and how do I fix it?

On my home dev box, I have a Logitech MX Revolution.  Kind of like the big brother to the VX.  On the MX, I could switch the wheel between the free spinning mode and the ratchet mode by clicking on the wheel.  That didn’t work on the VX.  I tried playing with the Logitech SetPoint utility that allows you to tweak the mouse settings.  No dice, nothing jumped out.

When in doubt, see if there is an updated mouse driver from Logitech.  I had 6.2 installed, the current version is 6.3.  So I grabbed the general Windows 7 setup exe for SetPoint and installed.  And that’s when the Logitech driver fell down.  Their all in one installer installed the 32 bit driver instead of the 64 bit driver.  Usually that’s not a huge deal, but it looked like they installed the 32 driver AS the 64 bit driver.  It crashed as soon as I loaded it.

OK, back to square one.  I uninstalled the newly broken driver and when back to the Logitech site.  Sure enough, I saw a link for the 64 bit only version.  I grabbed it, installed it, and it ran with out crashing.  It didn’t let me change the scroll wheel behavior, so I was back to square one again.

When in doubt, RTFM.  I took a peek at the user guide for the VX, from the Logitech site.  Guess what gang, on the bottom of the mouse, there’s an oddly shaped switch control.

OddlyShapedFigure 1 – An oddly shaped control

It’s hard to see in this picture, but the smooth circle at the top right of the switch puts the mouse into free wheel mode.  The gear shape at the bottom left, puts the mouse in ratchet.  Somehow the switch had been changed to free rolling mode.  I flicked back to ratchet mode and life was good again.

Saturday, January 14, 2012

An open letter to Newport Television

This is a copy of an email that I just sent to Newport Television, owners of WXXA-FOX23

Please forward to Michael DiPasquale, Vice-President/Asst. General Counsel at Newport Television

Dear Mr. DiPasquale,

I am a Verizon FiOS subscriber in the Albany, NY area.  I have noticed that you have pulled WXXA-FOX23 from Verizon FiOS TV because your carriage agreement expired on January 12, 2012.  My understanding of this is that your company, Newport Television, and Verizon could not come to an agreement over the rates.

As someone who watches WXXA, I am one of your customers.  As such, I would like to share my opinion.  I don't know the details of your carriage rate negotiations, but I think you should settle with Verizon. 

I don't want to pay more for a channel that I can get over the air (OTA).  The FOX network programming that I watch is mostly available via the FiOS Video On Demand (VOD) service.  I won't get to see the show when it airs, but I'll see it within a week.  And it will be commercial free.  I like my DVR, I watch TV on my schedule. 

With your channel being OTA only, the only time I'm going to watch it is going to be for sports. I liked watching the FOX23 news, that was one of the few shows you had my attention through commercials.  And that was the same for FOX sports.  I can put up with the annoyance of switching to the OTA signal for the sports, but for the rest of your coverage, I'll just skip it.

FiOS coverage is still small in the Albany area, but the areas with FiOS availability tend to be the higher income areas.  We are the people that your advertisers want to reach.  You have better access to the subscriber numbers, but I would expect that you are no longer available in 10,000 household in middle to upper middle class neighborhoods in this area.  If I were an advertiser with you, I would be negotiating for a lower rate on commercial air time.

I don't know the detail of your negotiations with Verizon, but if you are asking for a higher rate, I really think that you should reconsider your terms.  I don't know the state of the local economy is in Kansas City, MO; but it's not that great here.  Please consider this during your negotiations with Verizon FiOS.

sincerely,
Chris Miller
Slingerlands, NY