Monday, July 18, 2011

Dell Latitude Diagnostic Error Code 2000-0142 Hard Drive Failure

'Apparently' the hard drive on my laptop failed yesterday.  Out of the blue I got a couple of popup windows complaining about some dll not being able to load, and then the windows blue screen of death.  I thought maybe my machine got too hot, but I tried rebooting after letting it cool off and it didn't do anything after the Dell splash page during the boot.  So I ran a BIOS diagnostic and got the following error:
Msg: Error Code 2000-0142
Msg: Unit 1: Drive Self Test
Failed Status Byte=77
I called Dell and they basically confirmed what the diagnostic test said - my hard drive was fried.

Not wanting to give up on my hard drive that easily, I googled to see what I could do.  I discovered I could try to repair windows using the Windows Recovery Console.  So I found my Windows CD and booted from it and went to the Repair option.  Once I had entered the Admin password, I got a command prompt and after a bit of searching around I discovered that most of my hard drive seemed to be intact.  This, however, was still in the dos prompt of the Windows Recovery Console.  I couldn't back up my files to a USB from there.

I tried chkdsk, chkdsk /p, and chkdsk /r - those all worked successfully.  Yet my machine still wouldn't book.  So I preused the list of commands available to the Windows Recovery Console (here) and tried a few more - bootcfg, fixboot, and fixmbr.  In the end, it was fixmbr (which repairs the master boot record on the specified disk) that ended up working for me.

My laptop is 4 years old now.  I removed the battery a couple of months ago, and with problems like this starting to happen, I going to start shopping for a new one.  Hopefully this info helps someone out there though.

Sunday, June 12, 2011

Business Idea - Automated Lawn Mowers

Similar to my business idea regarding automated window washers, yet I think this one would potentially be even easier to implement. I was driving down our ring road here in Calgary and seeing all the grass growing very fast in the median and around the overpasses. I also saw a tractor/lawn mower left by the city over the weekend in one of the medians and it sparked a thought... Why couldn't lawn mowers be automated? It turns out somebody already has that idea. Check this link out: http://www.robomow.com/

These aren't industrial size/strength machines, though. I guess there are a couple of challenges with using an automated mower in an industrial/municipal context:
- Keeping them secure - they'd potentially be easy to steal. You could get around this by putting a GPS tracker on the unit something like this: http://www.gpspolice.com/
- More varied terrain - the mowers would have to content with steeper hills and soggy or muddy grass that they could get stuck in. The unit would have to be able to manage/mitigate these.
- Safety - The units would need to be well tested with emergency shut offs logic in a bunch of places to ensure the public's safety.

Thursday, May 26, 2011

Two more business ideas

I've got two more business ideas.

1. I've seen and heard of several companies here in Calgary that have tried to outsource their software development to India and have failed for one reason or another. I think it would be interesting to offer one's services as a liaison between a local client and an overseas outsourcing company to help with communication, expectation setting, and overall project management. It seems to me like there could be a big opportunity there - reasonable and talented software development, and clients looking for cheaper ways to build and implement their software. A boutique firm that acted as a 3rd party to help manage issues related to challenges with outsourcing projects like this overseas would be interesting to try.

2. On a totally different vein, (this is going to sound a bit silly, but...) it bothers me when I throw away a perfectly piece of good seran-wrap/cling-wrap. I doubt this would be a big money maker, but putting together a little utility/tool that stores the clean sheet of cling-wrap for re-use was my idea. :-)

Sunday, May 22, 2011

Access Denied - Windows Service - StreamWriter- VB.Net

I'm going to cut right to the chase on this one.  I didn't realize that Windows obfuscates error messages for security.  Without that gem of knowledge, I spent WAY more time than I should have last week trying to get a Windows Service to write a file to the local file system on a server.  (I have another post related to obfuscated error messages with Windows here, but it focuses on IIS).

I was continually getting an access denied message trying to programatically create and write a file using a StreamWriter in VB.Net.  My Windows Service was running as a particular service account, and I had  given that particular account Modify access to the parent folder where the file was supposed to be created - but it would not write.  I tried pushing to a different server to see if it would work there - still no dice.  I tried adding security policies (run as a service, run as a batch job, run as part of the OS) to the service account running the service - again, the annoying message 'Access Denied'.  For a while it was thought that maybe the file size was an issue - it was a little over a Mb.  I deployed another version that wrote just one line.  No luck.

In the end, I enlisted a colleague's help (thanks Dorina) and we discovered that the problem wasn't the user at all.  It was in the path that I was trying to write to.  I was using the Path.combine() method to put the path together which, in the debugger appeared to put the file name and path together correctly.  However when we used Procmon to look at the output it complained on a createFile command that the 'file' was 'isDirectory'.  Upon closer examination, it turned out that my Nunit test was calling one constructor that correctly used that Path.combine() method, and my Service called another constructor that did not use the Path.combine() method.

So in the end, my AccessDenied error, was really an incorrect path issue.  Windows (apparently) doesn't display the correct error message so as not to advertise potentially sensitive paths.  And I need to ensure that my Nunits exercise the same methods that my implementation classes use.

Wednesday, April 13, 2011

Hand-held application and smart board business ideas

I had a couple of new technology ideas recently.  In the last couple of weeks at work, all of our meeting rooms have been getting outfitted with Smart Boards - and quite a number of them with video conferencing features.  While we were trying to get set up for a meeting we were impressed to see the camera for the video conference realign itself after our PM had pointed it a different direction.  While he was continuing to get the display organized, I had the urge to help him from my seat using my fingers to zoom the image like it was an iPad or an iPhone.  Then I thought 'why couldn't I do that, given the Kinect technology now with the xbox?'  A touch-less touch screen?  Maybe in the future.....

It wouldn't surprise me if there is an app already for the other idea I had.  I was quickly going over a hard copy of a chart of geological formations looking for a particular name.  I thought 'wouldn't it be great if I could just hit ctrl-F and find the word I'm looking for?'  and then I realized that something like that would be a great app for an iPhone or similar hand held.  Take a picture of the document, and write some logic to parse the text in the image and then search for the search term entered.  The idea is similar to the 'Word Lens' app here, except that rather than translating text, your searching it.

Saturday, March 26, 2011

IIS and setting NTAuthenticationProviders and authNTLM

More than once now I've run into situations with the NTLM configuration in IIS where it seems that the GUI setting doesn't do all you need it to to properly configure integrated windows authentication for a web site. Earlier this week I was asked to look into a situation for a particular project team where Firefox wasn't prompting them to enter a username/password in one environment (they'd just get an http 401.2 error), and yet it was giving them the prompt in another environment.  (IE was running fine in both environments, by the way).

I went through all the IIS GUI configs in IIS and the two boxes looked identical.  Since this appeared to be an issue with integrated authentication, I ran this script:

cscript c:\inetpub\Adminscripts\adsutil.vbs GET W3SVC/WEB_SITE_Number/ROOT/NTAuthenticationProviders

which showed me that the working server had nothing set (wasn't set), while the server that was giving them problems returned with 'Negotiate,NTLM.'  I subsequently set NTAuthenticationProviders to '' and it worked by using 'set' instead of 'get' in the above script and providing an empty parameter.

Note:  I understand the above setting to be different than the one below.  In more than one instance at work I've had this issue and proven that this is the case.  The script below, from my understanding, the same as the Windows Integrated Authentication checkbox on the Directory Security tab in IIS.

cscript c:\inetpub\adminscripts\adsutil.vbs SET W3SVC/WEB_SITE_Number/ROOT/vDir_Name/authNTLM TRUE

Thursday, March 3, 2011

IT Professional - Know Thyself

What are you good at?  It pays to know - literally.  It will also make you happier and more productive on the job.

The more I work in IT, the more I see where I'm most effective. I also see in comparison where others blow past me in their individual skills.  It's important for multifunctional teams to have a good idea of different team member's areas of expertise.  Leveraging (knowing when and who to ask for a specific kind of help) these team skills can greatly improve the effectiveness of a team.

Here's some real life examples:

I'm rather weak on writing complex sql statements.  I can profile sql, and can get most sql work done.  But if I've got a difficult query I'm working on, I'll go ask my team mate who is an expert on putting together complex sql.  Later on, he'll ask me for help with a visual studio or server/service configuration related question.  Its a good, productive working relationship that keeps everyone happy.  The BA's are happy because the data looks right.  My PM is happy because my task was finished on time. And my team mate and I our happy because we both learned something and did it faster than trying to google for it on our own.

I'm great at problem solving software related issues - particularly in a domain I'm familiar with.  Whether it's missing permissions, configuration, network connectivity, everyone sitting around me will tell you I'm very, VERY persistent at solving problems that are brought to me.  My neighbor one cube west is fantastic at IIS/MSTDC/COM related bug/configuration debugging.   She also knows our software domain better than almost anyone else in the building - she seems to have it memorized.  When I have an issue with our software that I don't know how to fix, or a business related problem in the software,  I talk to her without hesitation.  Conversely, when she is stuck on an issue that she doesn't know how to solve, she will buzz it past me.  Again, a productive working relationship that makes everybody happy.  The business is happy they got their patch as fast as they did.  Once again our PM is happy, etc....

In meetings I will keep quiet and not say very much unless I feel there is an important point being missed.  I'm not super great at arguing a point.  I'm not the person that's always called on to go to a meeting to convince another group of people that 'our way is the right way'.  Part of this is my personality, part of it is my belief that there is multiple ways to get 'a good enough' answer for the problem we are looking to resolve.  However, we have another fellow in our group that will absolutely blow you away with his gift of logical persuasion.  He's the guy that gets sent to those 'convince the group' meetings.  On the other hand, I'm called on when diplomacy and a consensus is required.

Know what you are good at.  Seek to know what your team mate's strengths are.  Become a happier, more productive development team.

Monday, February 14, 2011

Excessive logging kills AppPool (log4net)

We had an issue where one of our Application Pools (IIS 6) was 'dying'.  The interesting thing about it was while the application itself was dead (error page, sometimes showing an outOfMemory exception, other times showing a meaningless exception), the appPool itself appeared in the GUI to be running.  The more troubleshooting I do with Windows OS's, the more I do not trust what the GUI says.  Appearances in Windows can be deceiving.  For several weeks - until we understood the root cause of the issue - are resolution to the dead application was to restart the 'running' appPool. 

A side note - this appPool was running on a Network Load-balanced server, on the dominant node.  The appPool for this particular application only ever failed on the dominant node.  It never failed on the other node of the cluster, so we had reason to believe that the 'load' had something to do with the root issue.

In the end, we discovered the root cause of our dying application by accident.  We were cleaning up our files on the prod servers when it became apparent to us that log4net on another application (and another appPool) was set to log 'ALL'.  This resulted in 1.5Mb of log created about every 5 minutes.  I had a hunch that all this logging was having a memory impact on the server - we certainly didn't want to be logging at the 'ALL' level anyway, so we created a change request and fixed that issue ASAP.  Then we crossed our fingers, hoping that our dying AppPool issue would go away as well. 

It's been more than two weeks since we implemented this log4net change and our flaky appPool hasn't died once.  Lessons learned:

- Watch for excessive logging on prod servers
- Excessive logging can apparently cause other appPools to through outOfMemory Exceptions!

Wednesday, February 9, 2011

Windows VM False Performance Monitor Stats

We almost exclusively run VM's now in most of our environments. Recently, we added two new Windows VM's in production for a particular solution.  Thinking we were being prudent, we asked to have the boxes provisioned with 4 Gigs of Memory since that's what the old 'hardware' boxes had. We deployed our solutions to the new boxes and tested them without a hitch.  So a week later a switch was flipped and the new VM's went live while the old boxes no longer took requests.  After a few days, we discovered (by looking at the task manager) that we were getting some conflicting and concerning readings for memory utilization. Check this out:

- the task manager graph said we were using 3.7 gigs of memory
- looking at the actual numbers below the graph, we only had 300Mb of memory available on the machine
- looking in the processes tab, none of the processes were using a significant amount of memory (several were using between 200-300MB, but that was within normal tolerances when compared with servers running the same system in other environments.  However these same processes where paging memory like they shouldn't have been!  Page faults were very high.
- Totaling the memory used in the individual processes, we were NOT using 3.7 Gigs of memory.

After doing some more investigation, we asked the team that built the server how the memory had been provisioned for these new boxes.  It turned out that they both had originally been given 1Gig of memory and then later (after they were running) 3 more Gigs were added.  At this point our hunch was that these  boxes weren't seeing the additional 3Gigs that had been subsequently added.  After doing a hard reboot on both boxes, this turned out to be the case.

Lesson learned: make sure you follow VM procedure (hard re-boots) for adding/removing resources to VM servers.  Short-cuts can create some pretty confusing statistics in the OS.

Friday, January 28, 2011

Debugging/Troubleshooting SQL performance/blocking issues

I picked up a good tip from one of our DBA's yesterday.  He uses sp_who2 to see which users have active threads/processes running against a particular database.  This stored proc returns the PIDs as well (Process ID number).  I had known about this previously.  What was new to me was he also used:

dbcc inputbuffer(pidNumberHere)

to get the database to tell him which stored proc was being executed by that PID.  That seems to me like a handy trick.  It certainly solved the problem I was having.

Thursday, January 27, 2011

WCF and Large Result sets

Dealing with oil resource data across several disparate systems and also trying to make our API's more generic and consistent, we use WCF a lot (web services with windows apps). We've had a couple of instances where we've had to tweak the config settings for either our publishers or our clients to return some large datasets over WCF.
For the most part, I have found the error messages relating to constrained WCF config settings refreshingly to the point.  They pretty much pointed me directly to the attribute in the file that I needed to change in order to fix my issue.
For memory related errors on the client, I found that juggling with the maxBufferPoolSize and maxReceivedMessageSize in my binding to help.  I moved the maxBufferPoolSize from 9999999 to 99999999, and changed the maxReceivedMessageSize to 350000000.  Sometimes after that I would get a timeout error on the client machine (depending on what kind of load the server was under).  So I'd have to make the timeout settings on the binding higher.
Obviously it helps when the publisher has the same values for the same attributes on its binding.

Tuesday, January 18, 2011

SMTP email issue with hosts file

I had an interesting issue last week.  I had a website with a contact page that uses SMTP sendmail to email a list of people whatever was entered on a form.  The curious thing about this issue was it would send emails to everyone in the list except email addresses that matched the domain name of the web site.  For example, it would send an email to perry.mckenzie@blah.com, but it wouldn't send an email to perry.mckenzie@continuouslylearning.blogspot.com, even though the server that was doing the sending was listed in the DNS as 'continuouslylearning.blogspot.com'.

I tried changing the email provider by pointing the Email Host to a server that I knew accepted anonymous email pushes, but it did the opposite - sending the emails successfully for users from blah@continuouslylearning.blogspot.com, but not sending them for blah@anyOtherAddress.com!

After looking through various logs (including /var/log/maillog), it seemed like sendmail was getting confused as the log was trying to associate the email address (someone@continuouslylearning.blogspot.com) with a user on the host and not finding the user.

sendmail failed error: localhost: someone@continuouslylearning.blogspot.com user not found

I tried removing an entry in the /etc/hosts file that pointed the IP address to continuouslylearning.blogspot.com, but that didn't seem to work.  What I didn't realize until later (with the help of my hosting provider) is that this was the correct change to make, I just needed to restart two services after I made the change:
service network restart
service sendmail restart
Then my email worked perfectly.