January 6, 2010

IE Protected Mode and Networked HP Printers Hang

Filed under: Error,Solutions — Kevmar @ 2:53 pm

I ran into a problem printing from IE8 protected mode to a networked HP printer where it would freeze IE and lockup printing.  I had 2 computers act differently with this problem.

The first one where the issue was reported would lock up not only IE but also other printing.  After the crash, the print queue would not act correctly.  Printing test pages would give me an error saying that the server was not responding and that I needed to reboot it.  Other people could still print and test prints originating from the print server would print.  I also could not add new printers while this was happening.  Relogging did nothing.  a full reboot would return things to normal until it locked up later.

After a few crashes, we connected it to IE8 printing.  With a little more testing I discovered it would print fine with protected mode off but failed with it on.  We are trying our hardest to run secure by default so we want this protection.  Too bad it protected us from printing.

I returned to my computer and mapped the printer to my computer.  I was easily able to reproduce the problem.  My print spooler recovered better and I could print other things, but IE crashed hard every time.  I did a little hunting on the web and had a hard time finding content on topic.  Here is what I did find.

When IE runs in protected mode, it runs with limited privileges.  In my case the print driver wanted to run an exe from a location that is restricted by those privileges.   With that in mind, here are your options when faced with this problem.

1) Turn protected mode off
2) Run IE as administrator
3) Reinstall with a basic driver
4) Install printer locally (skip print server)
3) Don’t print to that printer
4) Create rules to elevate the processes

Some people are able to install more basic drivers but that is hit or miss.  On my computer I was able to install it locally avoiding the print server and it worked fine.  That was an interesting detail.  Our print server is server 2003. 

I was able to resolve the issue by creating a rule to elevate the processes needed for printing.  The post that gave me this idea is here. I did exactly what was suggested and it fixed the problem.  There are registry keys for IE that tell it what to elevate under protected mode.  I created a rule for the same 3 files mentioned: HP1006MC.EXE, HP1006SM.exe, P1006SSL.exe.  After closing IE one more time, it picked up those rules and it worked fine.

I exported those keys to reg files for more testing and it worked on the original computer that the problem was reported on.  I merged those settings into our domain policy and I hope that’s the last I have to deal with that. 

I found those files in the C:\Windows\System32\spool\drivers\w32x86\3 folder.  If I have more problems like this, my plan is to create a rule for all the exe files in that folder.  I was able to do the exact same 3 that the other guy mentioned.  If the problem continued, I was prepared to make rules for all 10 files I found.

November 19, 2009

Extracting a MSI from a EXE

Filed under: Solutions — Kevmar @ 4:19 pm

I ran into a situation where the vendor would only provide a exe as an installer and not a MSI.  If you work with Active Directory for software deployment, you know how important a MSI can be.  We also want to customize a few options and make it silent.  Our goal is something we can deploy to machines and not have to install or configure by hand.

When I run the EXE, I see that it is running a standard Microsoft installer.  After looking around I saw lots of comments that indicate that some EXE files like I had could be holding the MSI inside it.  So I started my search for ways to extract the MSI. 

My early search results pointed me to a Universal Extractor.  It did indicate that it was a Windows Installer package but both of its methods failed to extract any usable files.  I also found that the Windows SDK had some scripts that could export from Microsoft Installer files.  After I installed the SDK, I discovered that it didn’t work so well on a EXE. 

I did find a very easy way to get the MSI out of the EXE though.  I cleared out the temp folder and ran the install.  It first decompressed the files into the temp folder.  The MSI I needed was one of them.   There were a few MSI files so I made a copy of all of them.  One of them was important later.

When I tried to run the MSI directly, it gave the message that I had to run setup.exe to start the install.  It looks like it requires the shell EXE to run because it verifies the environment.  One thing it does is check to make sure the correct Microsoft Installer is loaded.  ISScript9.msi was the MSI file it ran when the environment was not correct.  I did end up needing to install that, but I still got the error about needing to run the EXE first.

I saw was to add ISSETUPDRIVEN=1 to the command line or into a transform.  I ended up adding it to the transform and it solved that issue.  Creating the transform was a lot more involved that I expected.  The largest problem was the lack of information on it.  I am going to do another write up on that.

June 27, 2009

rrdtool data resolution

Filed under: Solutions,rrdtool — Kevmar @ 6:13 am

One concept I had to adjust to was deciding on the resolution of the data I wanted to collect. By resolution I mean how detailed the data is. Let us use the example of CPU usage. If I intend to look at the last 1 hour vs the last 30 days, I would see the data at different details. My 1 hour window may show me every single data point (@5 sec). Every peak and dip is exactly what it was. Each pixel is 5 sec and I have 720 data points (60 min, 12 points a min).

Now when we look at the 30 days we will not be able to include that much detail on the screen at once. My 30 day window will show data points @60 minute ticks. If the CPU slowly goes up and down, that’s not an issue. But that is not often the case. It is very spiky, up and down very quickly at times. If you only take a reading every 60 min, its any ones guess if you read a spike or a dip.

In this case I would record the min,max, and average values. When you chart that, the max will be the spikes to show you how hard it gets pushed. The min will show you if it ever gets to idle. The average is metric that gives you the most value when looking at 30 day window.

When you create a rrdtool database, you define all those options. You can define multiple counters to the same thing at different resolutions. You define a database and indicate how often the value will be recorded. Then you can define different resolutions of that data. You will still just record the CPU every 5 sec and the rrdtool will keep track of those data windows and resolutions.

We can define a database that gets a value every 5 sec for our CPU dataset. We can define a detailed resolution of 1 hour and a second one of 30 days. The first RRA records a value every tick for 720 ticks. each tick is 5 sec, so that’s 1 hour. The RRA would be “RRA:AVERAGE:0.5:1:720″. The second RRA averages the values of 720 values (1 hour) over 30 days (720 ticks). That RRA is “RRA:AVERAGE:0.5:720:720″.

Let us pick some new numbers. What if we want 30 sec average for 2 days. 30 sec is 6 values of data. 2 days is 5760 intervals of 30 sec. So the RRA is “RRA:AVERAGE:0.5:6:5760″.

So our final rrdtool database is this:

rrdtool create temp.rrd -s 5
DS:cpu:GAUGE:30:0:100
RRA:AVERAGE:0.5:1:720
RRA:AVERAGE:0.5:720:720
RRA:AVERAGE:0.5:6:5760

What I want you to do is read over this and then return to the examples on the rrdtool’s website. Once this information clicks, come back here and read it again. I know the RRA code is over your head if this is your intro, but when you return it will be a very solid example.

June 24, 2009

Intro to rrdtool

Filed under: Solutions,rrdtool — Kevmar @ 6:52 am

I recently discovered a simple tool that has lots of power behind it. rrdtool is a round robin database that stores time dependant values and easily graphs them. It is a database where you insert values at consistent intervals and the query results are in the form of a graph. It is a round robin database because it only saves a set number of values and overwrites the oldest one every time.

Now that I pointed out what it is, let us talk about what we can do with that. The first thing that jumps out (and what it was designed for) is performance monitoring. You can set up a task to save the CPU, network, disk, and ram activity to this file every 5 sec and then generate charts to display it. Any thing you can get a counter on. Computer temperature, event log errors, ping times, terminal server connections, and anything else you can think of. Things like the daily temperature, number of visitors to your office, spam messages, or even your daily bank balance.

This is great for performance monitoring because the database automatically discards old data. To put it another way, it only keeps the data for as long as you think its important. Once you define how much you want to store and at what resolution, the database is then set in size. It never grows or shrinks.

May 5, 2009

RemoteApp Disconnected Because of a protocol error in Windows 7 RC1

Filed under: Solutions,Uncategorized — Kevmar @ 1:43 pm

The first thing I did after installing Windows 7 RC1 was to toss on my remote apps off of a test server. I have a 2008 Terminal Server that publishes a few common apps for seamless integration. I received a few dissconnects to the remote apps on both windows 7 RC1 boxes that I set up. Here is that message:

RemoteApp Disconnected: Because of a protocol error, this session will be disconnected. Please try connecting to the remote computer again.

It is too soon for me to pin this on the release canidate because I have only spot tested my terminal server set up. But a quick search of the message did not give me many results. As I get more details, I will update this post.

April 17, 2009

Creating the Cho’gall Ninja list

Filed under: Solutions,Uncategorized — Kevmar @ 6:46 am

With my weekly raffle starting to pick up I decided to look for another service that I could provide. Something the community needs and that I can use to promote my raffle. Our server has a huge problem with people taking loot that they should not take. We call them ninjas.

I spent a little bit of time looking at past reports and screenshots of ninjas on our server that people have ran into. I tossed them all on one page with links to the forums post and to the screenshot. I skiped over any report where I did not have a screenshot to back it up.

Here is the Cho’gall Ninja list. Its a simple page that I am maintaining by hand, but it should get the job done. If you are looking to get a name added to the ninja list, then make a forum post and include a good screenshot of what happened. I will try to check on this every few days to keep the list up to date.

April 4, 2009

VB.Net Auto grow Textbox as text changes

Filed under: .NET,Solutions — Tags: — Kevmar @ 6:43 am

I have several textboxes on a form that I would like them to grow as the user types text into them. Sometimes they will only put in a few words, other times it can be several lines of text. I expected this to be a very simple process but had a hard time finding a solution.

Several people did talk about using the TextBox.lines.count to figure out how tall to make the box. The problem with that is you must turn word wrap off for that to work. Sometimes you can do that. In my case, I needed the lines to wrap.

I did find references to Graphics.MeasurString(String,Font) as SizeF to figure out how long a string would be with a given font. I was about to overlook the effect different fonts and sizes would have had but it looks like this will solve both.

In the end, I took each line in the txt box. I calculated how many times each line would wrap and add that to my line count. Then used the Textbox.Font.Height to figure out how high each line would be. I also added 10 pixels to account for any padding at the top and bottom of the text box.

Here is the code I ended up with:

Dim numberOfLines As Integer = 0
Dim e As Graphics = Graphics.FromImage(New Bitmap(300, 300))
Dim StringSize As New SizeF
For Each item As String In tBox.Lines
StringSize = e.MeasureString(item, tBox.Font)
numberOfLines += Math.Floor(StringSize.Width / tBox.Width) + 1
Next
tBox.Height = numberOfLines * tBox.Font.Height + 10

I added a call to that to the TextChanged event handler for each text box. Don’t forget that you have to adjust the other items on your form if you make the text box grow. It will overlap other elements if left unchecked.

April 3, 2009

Creating the Bad Anatomy raffle for Warcraft

Filed under: Personal,Solutions,Thoughts — Kevmar @ 7:09 am

Recently Blizzard changed some rules to Warcraft that now allows people to run casinos in game. They are crude and the operators fill the city spam. You don’t know who you can trust but people still play.

An idea I had worked on in the past was to create a lottery for players in wow. We had a lot of it planned but ended not doing because the rules were unclear if it was allowed or not. Now that the rules have changed and we are ready to start it up. So I present to you Bad Anatomy’s Cho’gall weekly raffle.

Our initial idea was for a lottery where people could pick numbers and we use real world event to pick the numbers (like the multi-state lottery numbers). But our biggest issue with that is it could take a long time for a winner. In the end we decided on a raffle.

For every 10G someone donates, we will give them one raffle ticket. The ticket is given just so the purchaser knows what his numbers are and adds to the realism of it. A character was created just to handle the raffle. So every message in and out from him is kept separate from all our other mail.

There are 2 parts that make this work. First is the in-game mod I had to develop to receive gold, issue tickets and track tickets, and to pick the winner. It initially started out easier then I thought it should be and ended slightly more challenging then I thought it would be. I may go into those details in a later post. I can run my character up to the mail box and issue a command that will allow him to open every message, collect the gold, calculate how many tickets someone gets, and then send each of them a message with their numbers.

The second part is the supporting website Bad Anatomy’s Cho’gall weekly raffle . This is the feature that makes it real. People can check the site to see when the next raffle starts or ends, see the winners, and all the rules to the game. We took a domain name we already had (Bad Anatomy) and re purposed it for the raffle. I tried to give it a simple and clean look. I tried to look at lottery sites for examples and they all felt overwhelming with all the stuff they tried to pack onto one page. In the end, I created the look I wanted.

This experiment is just getting started so I cannot tell you how well people are liking it or even how long I will run it. Head over to Bad Anatomy’s Cho’gall weekly raffle to see how its going.

March 31, 2009

Tracking Down RTE: 35601 Element Not Found

Filed under: Database,Error,Solutions — Tags: , — Kevmar @ 6:43 am

We recently turned on some new features of a product we were using and would get this RTE on a few records within the application. The number of problem records were small, the total number of records worked with in a day made them a regular occurrence.

I went over to our test environment. It was up to current patch levels, but the data was a few months old. Almost all of my broken records in live were broken in test. That gave me hope that its an existing data issue and not something actively breaking records.

The nice thing about our test environment is that I am usually the only person using it. That makes it easy to toss the SQL Profiler on with out having to filter it to just my traffic. I started the profiler at the point just before clicking the button that generated the RTE and paused it just after the message came up. I closed the app and repeated this process a few times for both working and broken records.

Looking at the queries that each ran, the broken records all stopped at the same point after the same query was run. That tells me that the application is processing the queries as it runs them and the last one before it stopped is my suspect query. If both the broken and the working records had the same full list of queries I would have had to check them all. That would have indicated to me that it pre-loads most of the data before processing it. I was in luck.

The query was a large one but the only difference between all records was the record ID. So it is the same query running for both working and non-working records. Running the query for all of them gave me different sized record sets. Some had more a lot of records and some had very few. One thing did jump out at me as I looked at the raw data.

A few null values jumped out to me in a column that looked like it should have a value. With my experience with the data I knew it should have had a value. I saw one column that had data in it directly related to reference I expected instead of that null value. Because this looked like a complicated query, my first guess was a bad join.

That column was not the only one with nulls in it but every time it had a null the 3 columns to the right also had nulls. That’s what I expect a bad join to look like. So I started reformatting the query with proper indents and white space. It did contain a few union calls. The first query in the union practically returned the same results. It looked the same except for a few less rows. My null values were still mixed into the good data.

I focused on the table columns that were null and the one column that contained directly related information. The joins between them looked correct. Exactly how I would have written them. After rewriting the query as simple 2 table join that used the same logic, I ended up with the same results. It was a join that I expected to be valid every time but in this case there are times where its not.

It turned out to be a flaw in the application logic where it allowed some changes to one set of tables that should have enforced changes in another. But they were enforcing them at the application level instead. Other parts of the system enforced it correctly, this one point in the application did not. It overlooked the fact that it needed to enforce it and I almost expect the developer to make the same assumption I made.

I know this is a little different from my usual problem/solution posts but this was mostly an internal product and I wanted to document the process I took to solve it.

March 27, 2009

Quiet/Loud Game

Filed under: Family,Parenting,Personal,Solutions — Kevmar @ 6:12 am

I posted this in another forum and got a lot of good feedback on it. Here is a more formal write up on a game I play with my kids at home. The Quiet Loud Game.

I have 2 young kids at home. One is almost 4 and the other is 17 months. The 4 year old would often make lots on noise like kids do and our attempts to quiet her down were not working very well. Our problem was she didn’t truly understand the concept of quiet. She knew she was doing something wrong, but had no idea what. That did not work very well for either of us. I came up with a new game to play.

I turn the radio on to some music and turn the volume up a bit. We run around the house being loud. I yell the work loud or noisy several times and we all jump, and stomp, and scream, and yell, and slam doors, and bang on the floor. Then we start a loud count down from 3, 2, 1 and then I whisper the word quiet as I turn the volume on the radio way down.

Then we all whisper, and tip toe, and sneak, and shush, and softly open and close doors. Only making quiet sounds. Then we start a soft count down from 3, 2, 1 and then I yell the work loud as I turn the radio back up.

We repeat this process several times until someone starts to wear out (usually me) and we end it while we are all quiet. I tell them they did a great job and we all give each other high fives.

Not only does this help teach them the concept of loud and quiet, it also gives them an outlet for that noise. And we all had a lot of fun doing it. I made a special point to do all the stuff we consider loud when doing the loud part.

Older Posts »

Powered by WordPress