Thursday, November 14, 2013

Orange screen on Windows 8/8.1 Boot DVD/USB Load

This morning I was trying to install Windows 8.1 on my laptop and got with the following orange colour screen with vertical white colour just after a blank screen for around 3-5 minutes. The color variation is an optical illusion; it's actually all the same color as at the middle.
"Orange Screen of Death :)"

I was worried what is this all about for a while. But, later from the knowledge from different sources I got to resolve in this issue. As per my knowledge this can happen in case of two scenarios:

  1. If you hardware is having any problem.
    This is a case to worry about for you because you may have a great loss there as you may need to replace the faulty piece of hardware with a new one to get your system back up and running. It can be an issue similar to the one specified here in this 'superuser' post. Fortunately, my hardware was intact and it was not the cause for this issue. Thank God!
  2. If your boot disk (DVD or USB) is corrupted
    In this case of a corrupted DVD or USB boot disk for Windows 8/8.1 as well you can get the same symptom as this. In my case fortunately it was the cause for this issue and it got resolved by burning  a new boot DVD. If you are using USB booting, then you can wipe the USB boot device and recreate it to get this running.
MORE INFORMATION: The actual screen, though it looks like a plane screen with orange colour and white stripes, is a command prompt. If you have a close look at the top left corner of the screen once you get this screen, you can see a blinking white colour underscore cursor (_). But, I have no idea how it is going to help you out anyway. But, was a different experience on Windows 8/8.1 installation.

Tuesday, September 24, 2013

Console.WriteLine() from Your Web Application Pages.

Have you ever thought of doing a Console.WriteLine from your ASP.NET web application page? If possible what is the point in doing so?

The answer to the first question is that, it is possible.

I thought about this after seeing a Stack Overflow question on this, Where does Console.WriteLine go in ASP.NET?.

The answer to this question tells that:
"If you look at the Console class in Reflector, you'll find that if a process doesn't have an associated console, Console.Out and Console.Error are backed by Stream.Null (wrapped inside a TextWriter), which is a dummy implementation of Stream that basically ignores all input, and gives no output."

Yes, it will go to Stream.Null by default and you need to set it to the required Stream  by using Console.SetOut() and you can change the TextWriter by that.

So, let us try this out with a sample:

var fs = new System.IO.FileStream(@"D:\log.txt", System.IO.FileMode.Append);
var tr = new System.IO.StreamWriter(fs);
Console.SetOut(tr);
Console.WriteLine("My Default Debugging");
tr.Close();
fs.Close();

Here in this sample, my TextWriter object tr is set to a FileStream and it is writing to a file D:\log.txt. After that, I am setting my Console to that TextWriter object of tr.

Then, on each of the Console.WriteLine() call in my web page, it will write to the log file D:\log.txt.

Now, it answers the second question as well. What is the point in doing so?

Yes, as shown above, we can very well write logs using this in our web application. All you need is to set your console and call Console.WriteLine(). This makes logging easy from any simple web application.