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

Firefox 1.5 released!

The last 32 days rocked! The release of .NET 2.0 and now Firefox 1.5. Both are absolutely revolutionary in their technology.

So, go get it! Woohoo!!! The link is in the list below.

Also, I remind everybody about my "What's new in Firefox 1.5" video, which is also in the list of links below.

...and yes, Chris Pederick's Web Developer Toolbar works great with Firefox 1.5. His page link is also below...

Learn WCF via MSDN Nuggets

Want to learn WCF (a.k.a. Indigo)? If so, you should head on over to MSDN UK to see Mike Taulty's latest MSDN Nuggets.

http://www.microsoft.com/uk/msdn/events/nuggets.aspx

Currently there are three videos:

  • Hello World
  • Type Serialization
  • Bindings

You will find that WCF looks much like old-school COM, but has the power of MSMQ, COM+, remoting, Web Services and the simplicity of .NET. Awesome!

For more information on WCF check out this great MSDN article: http://msdn.microsoft.com/library/en-us/dnlong/html/introtowcf.asp.

.NET Wikipedia Entry Edit

OK so I got SICK of the horrible midunderstandings written about .NET on Wikipedia...so much so that I rewrote much of it.

As of right now, 95% .NET 2.0 material written at http://en.wikipedia.org/wiki/Microsoft_.NET was written by me. The only parts I didn't write were the top two 'changes in 2.0' bullets. I added all other .NET 2.0 content.

Here are some snippets I added regarding .NET 2.0

".NET 2.0 is a severe redesign of not only the technology, but also the model of Microsoft's .NET agenda. While .NET v1.x was considered more of a Rapid Application Development (RAD) model and was often compared with Sun's Java. C# 2.0, part of the .NET 2.0 model, is now compared more closely with C++, so much so infact, that large portions of Microsoft's Windows Vista are written in C# and the .NET framework."

I also added information about how .NET was NOT the competition for Java, but was infact originally intended to be COM+ 2.5 by one team and "Next-Generation Web Services" by another. In addition, I removed anything about .NET 2.0 betas and updated the information about the express editions to be more proper.

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.

WSE3 MTOM

OK, so this week I found out that that there currently is no support the the Jet database provider on the x64 platform. That didn't change the fact that I was determined to do it (or create the illusion of it). I had to create a user-approachable report generator which exported the data into Excel and sent it on to the user all via a web interface. I also didn't want to use the XML version of Excel spreadsheets (it surprises me how many times people think I'm talking about Excel 12 when I say that. You can do XML-based sheets in old Excel versions too!) So I wanted this done via ADO.NET and the Jet provider creating a "real" xls file. Obviously what I wanted to do isn't even work with the framework, but...doing it on x64 is.

The solution? Simple, WSE3 provides you with the ability to use SOAP Message Transmission Optimization Mechanism (MTOM) very seamlessly. MTOM is a new W3C recommendation used to optimize messaging scenarios that involve transmitting binary data. Technical gibberish aside, MTOM is just AWESOME. Using WSE3/MTOM, all I had to do was create a WSE3 service on a different server which created the XLS binary data and returned to back to the caller which then sent it on to the client.

Want specifics? MSDN has a document which provides you with the hands-on training you sufficient to propel you into WSE3 services: WSE3 Hands-on Lab: Messaging. MTOM is the third lab, but basically all you do is enable WSE3 (and MTOM) on the client and server, set the server up to return a byte array to the caller, call the server, and stream that byte array into a file. In my case I then sent it out to the user...

Here's my code for sending the Excel worksheet out to the user...

Response.Buffer = true;
Response.Clear( );
Response.ClearContent( );
Response.ClearHeaders( );

Response.AddHeader("Content-Disposition", "attachment; filename=" +
 "AutoGeneratedReport.xls");
Response.AddHeader("Content-Length", file.Length.ToString( ));
Response.ContentType = "application/vnd.ms-excel";
Response.WriteFile(fullpath);
Response.Flush( );

I'll have to beef up on WSE3 a bit for a future SOA lecture in my WinFX/.NET course.

C# 2.0 Self-Test

In the .NET course I'm teaching (".NET Complete") I gave a little project to the class, of which all of them are new to OO design, C#, .NET, and all the related items. The project requirement was for them to study the example and see what it does. The point of the project was to allow them to test their knowledge of C# syntax, collections, generics, and nullable types

It's almost as useless as "Hello World". Or,rather, hello world is almost as useless as this.

You simply type in string and it tokenized it into characters...but they didn't know that.  Anyhow here you go...

using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;

namespace CodeExamples
{
    class Program
    {
        class Storage<T> where T : ICollection<Char>, new( )
        {
            private Dictionary<String, T> list = new Dictionary<String, T>( );

            public void ShowLines( ){
                Int32? i;
                foreach(KeyValuePair<String, T> collection in list) {
                    i = null;
                    if(collection.Key.Length > 2) {
                        i = collection.Key.Length;
                    }

                    Console.Write((i ?? -1) + " : " + collection.Key + " : ");
                    foreach(Char thing in collection.Value) {
                        Console.Write(thing);
                    }


                    Console.WriteLine();
                }
            }

            public void Save(String text) {
                T parts = new T( );
                foreach(Char c in text.ToCharArray( )) {
                    parts.Add(c);
                }

                if(!list.ContainsKey(text)) {
                    list.Add(text, parts);
                }
            }
        }

        static void Main(String[] args) {
            Storage<Collection<Char>> storage = new Storage<Collection<Char>>( );

            Boolean done = false;

            while(!done) {
                String text = Console.ReadLine( );

                if(text == "end") {
                    done = true;
                    continue;
                }

                storage.Save(text);
            }

            storage.ShowLines( );
            Console.ReadLine( );
        }
    }
}

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.

Gosh I hate SPs/SQL (a.k.a. LLBLGen Rocks!)

...well at least in my C# code. That stuff belongs in the world of reporting, integration services, and other places which are NOT IN CODE. You couldn't get me to use ADO.NET anymore; it's such a pain for large projects. I love it for mass importing and when I do extremely dynamics such as report generation and a few other things, but for a static data access teir it's PATHETIC.

Not only is everything you type not strongly typed and therefore prone to error and has no color syntax; SQL (including SP calls) is just abrupt. You are doing this beautiful array of C# 2.0 greatness. Generic collections all over and BAM you see "select * from Person where..." Yuck!

Long live LLBLGen! If you don't know what LLBLGen is, you are completely missing out. I've been using it for months on all my projects and it's just downright awesome. It's basically LINQ...NOW. It allows you to use strongly typed .NET code to access your data WITHOUT writing any data tier code yourself. Not only that, the full blown enterprise edition is only $300. There is NO reason to ever write any data access layer yourself. It will pay for itself in about a DAY. I recommending getting a copy of LLBLGen even for your HOME projects!

All you have to do is point the LLBLGen app to the database, select the tables (and other entities) you want, and hit generate. It automatically creates a Visual Studio 2005 (or 2003 if you HAVE to use that icky thing) project for you. You can either include that project into your solution or compile the assembly and just us the compiled files. You only need to use LLBLGen again when you schema changes, which, as every architect knows...shouldn't be happening that often.

This rant is brought to you by the following sponsor...

DataSet dataSet1 = new DataSet( );
SqlDataAdapter sqlDataAdapter1 = new SqlDataAdapter( );

SqlConn1 = new SqlConnection(connString);
SqlConn1.Open( );

SqlCommData = new SqlCommand("GetDraftBox", SqlConn1);
SqlCommData.CommandType = CommandType.StoredProcedure;

sqlDataAdapter1.SelectCommand = SqlCommData;
sqlDataAdapter1.Fill(dataSet1, "MailList");

return dataSet1;
I was porting this old app from .NET 1.x to .NET 2.0 and I kept seeing stupid garbage like this. I got SO sick of it I decided to disconnect the logic tier and connect it to the LLBLGen access layer. Here's what I have now...
DraftMailCollection draftMailBox = new DraftMailCollection( );
draftMailBox.GetMulti(null);
return draftMailBox;

THAT'S IT!!! Short, sweet, strongly-typed, intellisense LOVES it, it's pretty (you gotta LOVE the VS2005 color scheme), and it's VERY easy to extend.

As another quick example here's how you would translate the following code into LLBLGEN code. First, the SQL code...

select *
from Person
where
PersonUserName = username and
PersonPassword = password;

Now the LLBLGen code...

   
PersonCollection people = new PersonCollection( );
IPredicateExpression filter = new PredicateExpression( );
filter.Add(PredicateFactory.CompareValue(PersonFieldIndex.PersonUserName, ComparisonOperator.Equal, username));
filter.AddWithAnd(PredicateFactory.CompareValue(PersonFieldIndex.PersonPassword, ComparisonOperator.Equal, password));
people.GetMulti(filter);

Yes, joining is also BEYOND easy and, yes, it databinds to GridViews with no extra work. I use it all the time in my ObjectDataSources.

OK one last example... well two. This one should be the straw that breaks...something. Look at this ADO.NET code (I'll leave some of it out though)

sqlCommand = new SqlCommand();
sqlCommand.Connection = sqlConnection;
sqlCommand.CommandText = "insert into Customers (CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax )values(@CompanyName, @ContactName, @ContactTitle, @Address, @City, @Region, @PostalCode, @Country, @Phone, @Fax)";
sqlCommand.Parameters.AddWithValue("@CompanyName", companyName);
sqlCommand.Parameters.AddWithValue("@ContactName", contactName);
sqlCommand.Parameters.AddWithValue("@ContactTitle", contactTitle);
sqlCommand.Parameters.AddWithValue("@Address", address);
sqlCommand.Parameters.AddWithValue("@City", city);
sqlCommand.Parameters.AddWithValue("@Region", region);
sqlCommand.Parameters.AddWithValue("@PostalCode", postalCode);
sqlCommand.Parameters.AddWithValue("@Country", country);
sqlCommand.Parameters.AddWithValue("@Phone", phone);
sqlCommand.Parameters.AddWithValue("@Fax", fax);

sqlConnection.Open();

string id = (string)sqlCommand.ExecuteScalar();

sqlConnection.Close();

Some would say that it would not look so bad if the insert was in an SP. Um, ok...so you want to code in more than one place? No thank you. Also, what happens if there is no id to return? I've noticed that .NET 2.0 doesn't like that too much.

Now heres the LLBLGen code...

CustomersEntity customer = CustomersEntity( );
customer.CompanyName = companyName;
customer.ContactName = contactName;
customer.ContactTitle = contactTitle;
customer.Address = address;
customer.City = city;
customer.Region = region;
customer.PostalCode = postalCode;
customer.Country = country;
customer.Phone = phone;
customer.Fax = fax;
customer.Save( );

string id = customer.CustomerId;

Yeah...wow. Not only that, but in the SQL code you also have to do all that ADO.NET stuff. Not with LLBLGen, it's all in one!

I've been using LLBLGen for almost a year now and I have to say that my productivity has SOARED because of it. LLBLGen + .NET 2.0 + Firefox is a smart, er..., GENIUS match that should not be ignored, but rather ran towards!

To get a 30-day trial copy of LLBLGen follow the below link. I'm sure you will love it and for only $300, your manager will as well.

MSDN Nuggets WCF Mania!

I just did my weekly check of the MSDN nuggets page and found that Mike Taulty has been hard at work. He just released 6 more WCF videos.

  • Message Encoding
  • Message Patterns
  • Sessions
  • Instancing
  • Concurrency
  • Exceptions

Given the great quantity and quality of videos out there on WinFX technologies there is absolutely no reason people can't learn these new technologies. You don't need to read books, study whitepapers, or listen to those Geneva-convention-violating boring webcasts, all you have to do it click and pay attention. It's as if osmosis truely is a viable way of learning!

You can access these videos at the below link.

MSDN Nuggets

trycatch in .NET 2.0 - Note

Here is a comment Joe made about my previous post.

... One additional facet that will probably go (mostly) unnoticed is that you can throw exceptions across assembly boundaries, and the wrapping will occur based on the assembly-level attribute on the assembly whose catch block is being evaluated. This makes interoperability with code that isn't on the wrapping plan, e.g. COBOL or Eiffel, work seamlessly as you would expect.

...

This comment is rather hidden in how I have my page designed, but I thought it worthy of it's own posting anyhow.