Getting Debug Output From Scripts on ASPX Pages

Posted: May 18th, 2010 | Author: | Filed under: .Net, Debugging, Scripting, Visual Studio | Tags: , , , , , | No Comments »

To get some useful output when debugging C# or VB scripts on aspx
pages use the following statement in the script:

System.Diagnostics.Debug.WriteLine("We are here!");

In Visual Studio, attach the debugger to the process serving the
page containing the script (typically an IIS server process).
The debug text, “We are here!”, now appears in the output window
whenever the aforementioned statement in the script is executed!


Lazy Linking

Posted: May 18th, 2010 | Author: | Filed under: Google, Web | Tags: , , , | No Comments »

Imagine that you have accumulated a database of customers, businesess or some other kind of organisation (from here on: “entries”).
For each entry you have properties such as name, address and telephone number, but you are missing one essential thing: The URL for the homepage of the entry.
You could fix this the hard way and begin looking up the homepage for every single entry, but this quickly becomes time consuming (and extremely boring).

If the correctness of the link to the homepage is not mission critical, there is another, easier you could try: Google’s “I Feel Lucky” feature.

Chances are, that the names of the entries are pretty unique. This means that a Google search on the name will most likely render the homepage for the entry at the top of the search results. This also means, that had you pressed the “I Feel Lucky” button, you would have been taken directly to this homepage. The good news is that you are not restricted to using this feature by clicking the actual button on Google.com. It is also possible to use it programatically by constructing a simple query string for the Google server.

For example: The following link will take you to the homepage of the CodeIgniter framework:

http://www.google.com/search?q=CodeIgniter&btnI=3564

the btnI=3564& means that we want to use the “I Feel Lucky” feature and the string after q= is our search string, i.e. the name of our entry.

The obvious drawback of the Lazy Linking method is, that it is inherently inaccurate. There are two scenarios, where it will fail:

1: If the homepage of the entry in question is not ranked at the very top of the search results.
2: If the entry does not have a homepage at all, the user will be taken to a random page.

However, if these drawbacks can be accepted, the method is definitely a time saver.