2005 2006 2007 2008 2009 2010 2011 2015 2016 aspnet azure csharp debugging exceptions firefox javascriptajax linux llblgen powershell projects python security services silverlight training videos wcf wpf xag xhtmlcss

Firefox for ASP.NET 2.0 Developers Video Series

In September I recorded a video series I entitled the Firefox Web Developer Series. I've since renamed it to the Firefox for ASP.NET 2.0 Developers Video Series (clearly because the original title wasn't long enough). I put the project on hold because of the .NET 2.0 course I was teaching, which took almost all my time, but now I'm ready to take the time to get back into videos.

This series is for ASP.NET 2.0 developers who want to enhance their ECMAScript (JavaScript) skills and see how the powerful web development suite known as Firefox as simplify their lives as much as .NET 2.0 Framework does. In the series I use Beta 2 of Visual Web Developer 2005 and Firefox 1.0, but everything should be good for the final version of VWD2005 and for Firefox 1.5.

I will be releasing videos from this series over the next few weeks. For now, here is my introduction.

You can download the first video from the video below. You can download Visual Web Developer 2005 Express and Firefox 1.5 below as well.

.NET 2.0 trycatch and trycatch(Exception ex)

One thing that I found rather interesting about .NET 2 that's different from .NET v1 is how v2 handles non-exception throwables differently.

First, a little background...

In case you don't know, the following two pieces of code are completely different.

try {
    Thrower.Start( );
}
catch (System.Exception ex) {
    System.Console.Write("Error!");
}
try {
    Thrower.Start( );
}
catch {
    System.Console.Write("Error!");
}

The difference is not that the first catches exceptions from unmanaged code and the second second doesn't, the first actually does catch those exceptions. The difference is also a bit more important than the mere fact that in the first one case we capturing the exception data in an exception type and in the other we aren't. The real difference stems from the fact that that in .NET you can throw things other than exceptions and in v1 you used the latter code to catch those non-exception throwables.

Here's an example of how to throw a non-exception. Yeah, you basically have to use the IL, or a compiler that doesn't check for this stuff.

// ThrowerLib.il
.assembly ThrowerLib { }

.class public Thrower {
    .method static public void Start( ) {
        ldstr "Oops"
        throw
        ret
    }
}

Here we are throwing "Oops". That's obviously a string, not something derived from System.Exception. In v1 you could use try{}catch(Exception ex) {} as a catch all for all exceptions, but that would not catch this error as it's not an exception. To catch this, you would also have a catch{} at the end.

OK, so how's v2 different? In this world, the non-exception item thrown is wrapped up in a real exception. So, in .NET v2 you can actually use your normal try {} catch(Exception ex){ } to also catch these non-exception throwables as well.

They are actually thrown as a RuntimeWrappedException. So the following app compiled an run in .NET v1 would explode into pieces, but would would gracefully end in .NET v2.

// ThrowerLib.il
.assembly ThrowerLib { }

.class public Thrower {
     .method static public void ThrowException( ) {
         ldstr "ThrowException exception from the IL world!"
         newobj instance void [mscorlib]System.Exception::.ctor(string)
         throw
         ret
     }

     .method static public void ThrowString( ) {
         ldstr "Weird exception!"
         throw
         ret
     }
}
// ThrowerHarness.cs
namespace ThrowerExample
{
    class ThrowerHarness
    {
        static void Main(string[] args) {
            try {
                Thrower.ThrowException( );
            }
            catch (System.Exception ex) {
                System.Console.WriteLine("System.Exception error: " + ex.Message);
            }
            catch {
                System.Console.WriteLine("Non System.Exception based error.");
            }

            try {
                Thrower.ThrowString( );
            }
            catch (System.Exception ex) {
                System.Console.WriteLine("System.Exception error: " + ex.Message);
            }
            catch {
                System.Console.WriteLine("Non System.Exception based error.");
            }
        }
    }
}

Cool SMS/VS2005 Integration Feature

Today I discovered a very wierd feature regarding SQL Management Studio 2005 ("SMS") and Visual Studio 2005 (of course I'm using the FREE standards editions from the MSDN/Technet seminars)

OK so here it is...

  • Open SMS
  • Navigate to a table and modify it.
  • Copy the text of one of the columns
  • Go to an ASPX page in Visual Studio 2005 and paste.

If you did it right you will see the weirdest thing in the world: it pastes a GridView linked to a SqlDataSource, which it also pastes.

<asp:GridView ID="GridView1" runat="server"
     DataSourceID="SqlDataSource2"
     EmptyDataText="There are no data records to display."
     AutoGenerateColumns="False">
    <Columns>
        <asp:BoundField DataField="ContactID"
            SortExpression="ContactID"
            HeaderText="ContactID">
        </asp:BoundField>
    </Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
    SelectCommand="SELECT [ContactID] FROM [Employee]"
    ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString1 %>"
    ProviderName="<%$ConnectionStrings:AdventureWorksConnectionString1.ProviderName %>">
</asp:SqlDataSource>

You will also find that it pastes the appropriate connection string directly into your web.config.

<add
 name="AdventureWorksConnectionString1"
 connectionString="[string omitted;  it was LONG"
/>

Cool, huh?

p.s. If you want to paste that particular name, as I wanted to do, you can always do the old school paste-into-notepad-copy-out-of-notepad trick that is a tried and true way to strip off Web Browser formatting.

Video 2 (FWD) - "Introduction to the Firefox JavaScript Console"

Firefox comes with many incredible utilities right out of the box. One of these tools is the JavaScript console. Most developers who have done any web development at all utilizing Firefox has used this great tool, but few know of some of the more powerful features. In this video I touch lightly on a few features that you may have overlooked.

In the next video we will dive hard core into some code to see the Firefox Web Development suite in action.

New Blog

In addition to my WinFX blog I'm also going to be working on this new dynamics blog, called Dynamic Bliss. This blog will cover client-side topics such as XML based, out-of-band procedure calling ("Ajax" though I don't approve of that name), ECMAScript dynamics, dynamic graphics, widget creation, other topics from my book and a few other browser-related topics.

This blog is the replacement of a book I was working on regarding the same topic. I'm a strong believer that blogging is the new book (for technology at the moment). Parts of the blog will include video chapters from the my video book as well as my Firefox Web Development Suite videos.

You can get to the blog here, Dynamic Bliss.

Powered by
Python / Django / Elasticsearch / Azure / Nginx / CentOS 7

Mini-icons are part of the Silk Icons set of icons at famfamfam.com