Archive for the ‘I Have Learnt’ Category

IRPStackSize Registry Fix for “Not enough server storage space available to process this command”

I haven’t updated my website much lately – guess I’ve been really busy at work. I’m currently working on some Server 2003 projects and have been playing around with Group Policy, roaming profiles and redirected folders.

These are not new subjects to me but as I tend to do more development work nowadays, it usually means long periods between server work and the things you don’t do every day fall out of your memory.

I had a real grapple with what I initially thought was permissions issues the other day but turned out to be caused by poor allocation in Server 2003 by default.

The situation arose when I was trying to get client machines to create and update roaming profiles (all done in a test environment before going live). The actual error condition was “Not enough server storage space available to process this command” and after trawling about I found the fix to be something going back to Windows NT times and a resistry hack to enable or increase the IRPStackSize. Updated the registry and the problem was solved.

The fix is available here: IRPStackSize Registry Fix

AR

Unable to Evaluate Expression – explanation

Today was actually the first time (that I can remember) I have come across the following error message:

“Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack”

Unfortuntely, today also happened to be a very long day following a very long night (working until 5am last night).

So when this error appeared in a fresh page, based 90% on my previous code I was stumped, angry and frustrated.  Thankfully for me the error was simple to rectify, however it is important to note the error has a purpose rather than it being a bug.

This error crops up when terminating the Response to a page either through Response.End, Response.Redirect or Server.Trasnfer

You may not even notice the error 95% of the time that it occurs.

I had the lethal combination of a try-catch block and a Response.Redirect.  I think I’ll explain the significance of the error first and then the simple work-around.

Basically, the Response object is a .NET wrapped set of code that has a certain life-path.  This path is supposed to end with a Response.End (either explicit or implied) that passes execution to the Application_EndRequest method.  When the correct path is not followed, a ThreadAbortException is thrown.

I moved my Response.Redirect out of a try-catch block and appended the optional “terminate execution” parameter of “false” as follows:

Response.Redirect(“going-somewhere.aspx”, false);

This alleviated my problem and I was able to go back to swearing about something else that wasn’t working as expected.

Microsoft’s explanation and fixes are listed here: ThreadAbortException when using Response.Redirect

Using an image submit button in PHP

My colleague was getting frustrated earlier when trying to replicate the effects of a form from one website into a different website.  She was using a HTML input tag set to type=image, as follows:

<input type=”image” src=”images/image-name.gif” alt=”Send Message” value=”Submit” />

Now I don’t get involved in HTML that much anymore so I was curious when she said that although the form was posting back when she clicked on the image, the server-side PHP script wasn’t recognising the postback.  In fact, the page was just re-rendering.  My colleague has used this same simple HTML on numerous occassions before including a GET-based PHP form to another page.

After a trawl around Google we found suggestions from the HTML definition that you should specify the HTML action in the “value” attribute.  This we did as above to no avail.

Now since I am always suspicious of PHP (amongst other technologies) for handling things just that little bit different I looked for any PHP-related posts on the subject.

 Turns out this is actually because IE (from version 6 onwards at least) doesn’t send the value for a HTML input of type=image.  Not like Microsoft to adopt just part of a standard I hear you say with you tongue in your cheek.

Now since the type=image is supposed to return x & y co-ordinates from the browser there is a simple work around.

The server-side code would normally receive the following data from a HTML input tag where type=image:

control_name => value
control_name_x => x co-ord
control_name_y => y co-ord

Since with IE you don’t get the value returned you can simply test for the existence of x or y as follows:

 <?php
if (isset($_POST["control_name_x"]))
{
// form submitted 
}
?>

So there we go, PHP not to blame after all.  What was I thinking?

Open Excel files in a new window

I am used to viewing files in different windows and when I found Excel forcing me to view two spreadsheets inside the same MDI form I looked for an alternative.

Realistically I thought that an option would be available allowing me to choose how Excel opened multiple documents but I was wrong.

If you want to open two Excel files in different windows for whatever reason, you need to modify the File Association actions.

Since I use dual monitors on a daily basis, this "fix" is a must in order to take advantage of having a dual display.

The answer can be found in the following article: Open Excel in Different Window

AR

What I have learnt today…

I think the main reason I started this blog was to note to myself the things that I learn as I go on.

Coming from a MS Server background, each day I amass more knowledge and remember less of what I used to know.

Many times I have searched the web for an answer and ended up having to figure it out for myself. This blog will give me the opportunity to remember those things and pass on the experience

What I have learnt today

I think the main reason I started this blog was to note to myself the things that I learn as I go on.

Coming from a MS Server background, each day I amass more knowledge and remember less of what I used to know.

Many times I have searched the web for an answer and ended up having to figure it out for myself. This blog will give me the opportunity to remember those things and pass on the experience.

Return top