School is done! On to Reports, and something else ;)

Well, it's official.  Assuming I pass the two courses I haven't received grades from, I completed my final day of continuous education (well, except for the summer breaks/internships) for 18 straight years (K-12 + 5 years of post-secondary) today.  I've already got marks for 3 of the 5 courses I took this year, and they were pretty good (couple of A's and a B).  This semester has been a bit of a strange one, since I had only one computing science course and it was a "Writing for Computer Scientists" course which involved no programming! (Despite that, it was one of my favorite courses this semester :D).  I took introductory courses in Communications, Linguistics and Nutrition as well as a intro to the Physics of Sound and Music entitled "Logarithm and Blues" taught by a two-man team of a musician and a physicist (sorry "Writing for Computing Scientists", this one takes the top slot this semester :)).

Now that I'm finished school, probably for a while (still eying a part-time masters at University of Washington when I've been at Microsoft for a while), I can settle down and finish up a few side-projects and some DNN Reports work.  Reports Module version 5.1 is finished from a code perspective and contains a number of bugfixes (details to come) as well as two new features:
  • XSLT Extension Objects - The XSLT Visualizer now allows you to provide a list of .Net Types which are constructed at runtime and mapped into the XSLT file as XML namespaces.
  • Experimental and mostly hacky support for QueryString parameters in Report Queries - A number of people have been asking for this, and it's a relatively simple feature in the Reports Module architecture.  On the settings page, you can provide a comma-separated list of QueryString parameters which will be passed to the Report Query.  The parameters are prefixed with "url_" in the query to distinguish them from the existing parameters.  NOTE: Don't forget that many Databases use still another prefix, such as SQL Server ("@"), so for example, the full name of the SQL Server parameter mapped to "foobar" QueryString parameter is "@url_foobar".  This is only a stopgap solution to allow for some linking into Reports with parameters, so expect the next version to include a more detailed system (which may include breaking changes which will require that you update your queries). I'll do my best to support an upgrade path, but no promises, so use at your own risk
I just need to do some testing and then I'll put 5.1 into the release process.  I expect to do that this week, so depending on how long it takes the diligent reviewers in the release process to make sure that the new version won't obliterate your existing site (and believe me, you don't want to rush that!), it should be out very soon!

Moving on to a new project...  I've been hinting to some of the people in the internal project forums at DotNetNuke that I've been working on a top-secret project involving MVC.  (This is a pure side-project, not part of the DNN Project at all).  I'm very close to releasing something which, I think, is pretty cool.  I'll keep the secret for now, but let's say this: I've been working on/with DotNetNuke for a few years, and I've a huge fan of ASP.Net MVC.  I've learned a lot from DNN and I think MVC users can benefit from some of that experience ;).  I'm hoping to have something ready on this secret project, which I call "MaVeriCk", in the next week or two (but Reports 5.1 is my priority at the moment).

Hope that teased you just enough to stay tuned :P

I’m still here… just cramming… and working

Hello avid readers!  It’s been over a week since I blogged, I know, but I’ve been cramming for exams.  The CMPT 376 assignment I mentioned a while ago has finished, so I’m no longer required to blog for grades.  Having said that, after exams, I plan to keep blogging, so keep watching the feed :).

Just to tease you a bit: I’ve got a cool little ASP.Net MVC side-project well underway that I’m just dying to show off on the blog, so stick around :P

Also, to the Reports Module users out there, 5.1 is very close to being finished.  There may be a surprise new feature in there too.  Details to follow later :D.

Quantum Computing in .Net “Looflirpa”

Microsoft is really taking major strides in terms of improving the programming experience for developers on all current and future computing platforms.  That’s why, earlier today, Microsoft released a beta of the new “System.QuantumEntanglement” library.  This library, being considered for integration with .Net 4.1 (which, my sources say, is codenamed “Looflirpa”), provides features for developers working on quantum computers.  I won’t go in to too much detail, but this essentially means working in an environment where objects can be in many different states (possibly an infinite number) and where observation may change the state of an object.  Microsoft has proposed a few options, but I have some additional ideas.

Microsoft’s Proposal

Eilon Lipton, of the ASP.Net MVC team, is proposing a number of new additions to the .Net BCL in 4.1.  The first, is a class called “StringOr<T>” which has the following API:

namespace System.QuantumEntanglement {
    public class StringOr<TOther> {
        public StringOr(string stringValue, TOther otherValue);

        public string StringValue { get; }
        public TOther OtherValue { get; }
    }
}

This class is used to encapsulate a value which may be a string, but may be another value.  This is a common user-input scenario, since almost all user input arrives as strings, but will usually be converted to another data type.  He also proposes a more general class called “SchrodingOr<TDead, TAlive>”

namespace System.QuantumEntanglement {
    public class SchrodingOr<TDead, TAlive> {
        public SchrodingOr(TDead dead, TAlive alive);

        public TAlive Alive { get; }
        public TDead Dead { get; }
    }
}

This generalizes StringOr<T> to support any two types. 

Eilon’s not the only one talking about this, Scott Hanselman (well known Microsoft blogger), and Rob Conery (Author of the .Net Object-Relational Mapper: SubSonic) have also posted on this topic.  So I figured I’d add my comments to the blogosphere.

StringOr and SchrodingOr are great starts, but what if we need to represent objects which may be in 2 states? What about 3 states? Infinite states?  That’s where my proposals come in.  I propose the following additions to Eilon’s library:

Generalizing SchrodingOr

The first is SchrodingOr<T1, T2, T3, T4, T5, … , Tn> (for infinite n).  This allows the developer to represent objects in as many states as they want. 

C# 5.0 Compiler Support

I’m also proposing the following language syntax to help developers work with these types.  Similar to the way the C# compiler converts “int?” to “Nullable<int>” (which would now be replaced with “SchrodingOr<int, Void>” as it more accurately represents the concept of a type which may or may not have a value), the new syntax takes the following:

int?string?bool?DateTime? foo = GetUserInput(...);

And produces output code which looks like this:

SchrodingOr<int, DateTime, bool, string> foo = GetUserInput(...);

Then, we can defer observation until a later time, using the AsA<T>/AsAn<T> method (since Eilon's Alive and Dead properties no longer work in an infinite state environment). If we just want to observe the type and then make a decision, we can use IsA<T>/IsAn<T> methods (of course, both are required, just in case the type starts with a vowel), which returns a boolean indicating if the object is of the type T. For example:

if(foo.IsA<string>()) { return foo.AsA<string;>; }

Probabilistic Observation

Sometimes, we may want to observe an object only if there is a high probability of it being in the right state, to avoid additional quantum variations. To do this, we can use the CouldBeA<T>/CouldBeA<T> methods. These can, optionally, accept a probability threshold beyond which a object is considered in the right state.

Quantum Snapshots

Unfortunately, in between a call to IsA/An/CouldBeA/An and AsA/An, the state of the object may change.  So, we may wish to observe an object and record the state of the object at the time of observation.  Since in observing the object we may change its state, our observations must be recorded in “Snapshots”.  The snapshot is an instance of QuantumSnapshotOf<TSchrodingOr> (where TSchrodingOr must be one of the SchrodingOr<T1, ..., Tn> types), and has a property "Taken", which is a DateTimeOffset (after all, we need precise timing here) containing the exact time that the snapshot was taken.

Here’s an example combining Probabilistic Observation and Snapshots:

if(foo.CouldBeA<string>()) {
	QuantumSnapshotOf<SchrodingOr<int, string>> snapshot = foo.Observe();
	if(snapshot.Taken.Day == 1 && snapshot.Taken.Month == 4) {
		throw new UnreliableObservationException(snapshot, "The data is unreliable");
	}
	return snapshot.AsA<string>();
}

Summary

I think this is really interesting, forward-thinking, stuff from Microsoft. Eilon has done some fantastic work getting the ball rolling, and its up to us to give our feedback! Microsoft has created a section on MSDN for discussion on these new features: http://msdn.microsoft.com/en-US/QuantumEntanglement/Default.aspx