Thursday, November 28, 2013

My first MVP summit

Back in Denmark after an awesome mvpsummit.



This was my first time attending the MVP Summit, first trip to the USA and first time experience what jet-lags is all about. This was pretty energized consuming!

I arrived at the Seattle airport Saturday after a 14 hour flight, and took a cab directly to Hilton Hotel in Bellevue. When I arrived to the hotel my roommate Thomas has already chosen a bed and left the building.

I went downtown Bellevue to checkout the city for a few hours, then I went back to the hotel lobby and drank a few beers and saw some american football (this I don't understand).



The MVP summit was really great and inspirational, sadly I can't say much about the session's, but did talked to Anders Hejlsberg and Mads Kristensen and some other cool guys from Microsoft.
Unfortunately I did only shortly meet with my MVP Community Lead William Jansen who is just doing and awesome job, hopefully I would meet him again in the future.

MVP Summit is not only about technical sessions and the future of Microsoft products, but also about connecting with other MVP's, and that was amazing to geek and have fun with fellow MVP's.

I met to MVP's from Denmark Thomas Martinsen and Morten Nielsen who both were Client Developer MVPs.
Later I bumped into Mariano Gomez, great guy who quickly found out that I was having a Dynamics AX 2012 issue, and invited me to talk with the rest of the Dynamics MVP's pretty cool, here I met Murray Fife who knew a lot about the Product Configurator.
Later I met Azure MVP Magnus Mårtensson who got me drunk - pretty funny guy from sweden.

The last day me and my roommate took a cab to the Space Needle here we helped a guy to take pictures while he purposed to his girlfriend, After that we played tourist downtown Seattle.

Thomas and I at the great wheel

Last we went to the Rockbottom Brewery in Bellevue and drank a few beer's


All in all a great first time MVP summit, hopefully I will have the opportunity to attend again next year!





Friday, September 20, 2013

My Talk at brewww on TypeScript, TDD and code kata’s.

I did my first "real" talk last Friday 13th. "TypeScript Kata: The TDD style"
I think it went pretty well, in the light of it was Friday 13th, and the lack of my presentation just finished 30 min. before I had to go to the event. So I didn't have the time to do any review or rehearse.

My talk was meant to be a lightning talk that is max. 15 min. long, so that was, what I prepared for.
The other speaker couldn't make it, so I could talk for as long as I wanted – Great! I forgot Time and Space and don’t know for how long I talked.….

The attendee’s was very good to ask question, and we had some great discussions back and forth. Some of the guy’s said that I was pretty brave. In the light of, that all the attendees were drinking beers, and Open Source PHP/APACHE/LINUX/APPLE guy’s and in the fact that I’m a "Microsoft" man, showing of code in Visual Studio.


Hopefully I inspired a few people to dig into TypeScript, TDD or start making code kata’s.- And Basim realize that TypeScript is way better designed than CoffeeScript ;-p

Even though @mortendk and @christianjul, got inspired to make a bitch fight on Text editors and IDE's later this year, and of cause they want's me or somebody I know to defend Visual Studio! 

Thanks people @Brewww to give me an awesome night, this is not the last time I attend @Brewww or given talks, - I think Im already addicted :-)
What is Brewww?
Brewww is for web developers, designers, nerds, geeks and all others from the web industry. The people is primary Open Source PHP/APACHE/LINUX/APPLE guys. The meetups is quarterly for lightning talks / beer tasting and in copenhagen. Brewww is the brainchild of @mortendk and @christianjul. 

Wednesday, August 21, 2013

TypeScript v0.9 enum bug

/*
Update, after upgrading to v.0.9.1 it works as it should!
*/

I think I found a bug in the TypeScript enum. in the below example the WindeDirections.None should automatically be assigned the value 4, but it's actually 0.

TypeScript code
enum WindeDirections {
    North = 0,
    South = 1,
    West = 2,
    East = 3,
    None      
}

compiled code:
var WindeDirections;
(function (WindeDirections) {
    WindeDirections[WindeDirections["North"] = 0] = "North";
    WindeDirections[WindeDirections["South"] = 1] = "South";
    WindeDirections[WindeDirections["West"] = 2] = "West";
    WindeDirections[WindeDirections["East"] = 3] = "East";

    WindeDirections[WindeDirections["None"] = 0] = "None";
})(WindeDirections || (WindeDirections = {}));

I will write about TypeScript enum in details later :-)



Friday, August 2, 2013

TypeScript : Generics, < T > is for Type

Finally we got generics in TypeScript version 0.9, I have patiently waited for that feature, and now it's here, great!

There is already a few that have ben blogging about TypeScript Generics and give some examples. This is cool, though they haven't ben telling the fundemental of generics in TypeScript. So I have trited to do that, instead of another cool example :-)

What are Generics

Generics was introduced in version 0.9. Generic types allow for code reuse with type safety. The Internal algorithm remains the same, only the type changes and disappears again on compilation and generates no artifacts to the resulting JavaScript.

Why use generics

Generics provide quality to your solution by giving your type-safe at compile-time, and reduce repetitive programming tasks, by creating generic type-safe abstractions to classes and methods.

Generic type parameters

Specifies when they instantiate a variable of the generic type.
Type parameter name commonly starts with T. Consider not just give the parameter the name T For example, call it TThing as below:
In a generic type or method definition, a type parameter is a placeholder for a specific type that a client specifies when they instantiate a variable of the generic type.

class ItemCollection< TThing >
{
    private _things: Array< TThing >;

    Add(thing: TThing) {
        this._things.push(thing);
    }
}


Generic constrains

When you define a generic class, you can apply restrictions to the kinds of types that client code can use for type arguments when it instantiates your class. If client code tries to instantiate your class by using a type that is not allowed by a constraint, the result is a compile-time error. These restrictions are called constraints. Constraints are specified by using the extends keyword. You can define constrains with an interface or a specific class. Example below by making a constrain to IAnimal.

class AnimalCollection< TAnimal extends IAnimal >
{
    private itemArray: Array< TAnimal >;
   
    constructor() {
        this.itemArray = [];
    }
   
    FeedAll() {
        this.itemArray.forEach(
            (item) => item.Feed()
        );                   
    }       
}


Generic classes

Generic classes encapsulate operations that are not specific to a particular data type. The most common use for generic classes is with collections like the Array. A simple example of a generic class could be a class as follows:

class ItemCollection< T >
{
    private itemArray: Array< T >;
   
    constructor() {
        this.itemArray = [];
    }
   
    Add(item: T) {
        this.itemArray.push(item);       
    }
   
    GetFirst(): T {
        return this.itemArray[0];
    }
}


Generic methods

A generic method is a method that is declared with type parameters, as follows:

    Add(item: T) {
        this.itemArray.push(item);       
    }

You can also specify constrains on Type parameter, the below tells you that the parameter animal should implement the interface of IAnimal as follows:

function Add< T extends IAnimal >(animal: T)
{
    //...
}

Conclusion

TypeScript generics ensure type-safety and quality, reduce repetitive programming tasks, simplify the overall programming model, and do so with elegant, readable syntax. Generics is a compile-time only concept that disappears on compilation and generates no artifacts in the resulting JavaScript.

Thursday, July 25, 2013

Visual Studio RavenDB DataSource Explorer

Helping other developers being more productive at their daily work, is something that I enjoy. The last idea I got was trying to extend Visual Studio, by making a RavebDB DataSource Explorer prototype. This was fairly easy thanks to the documentation on msdn http://msdn.microsoft.com/en-us/library/bb165051(v=vs.100).aspx

It is still just a prototype, it needs validation and code cleaning. For now I can register new data sources by clicking on 

and the below dialog opens to create the datasource.


When RavenDB explorer is open I can right click on a datasource and connect to the server, or remove it from the explorer window.












When I have connected to the server it list all the databases




























When I double click on an item it opens an internet explorer window and goes directly to that document in the RavenDB Management Tool.
I have a bunch of ideas to this project, basic management options like, create new Database etc.
If you have any ideas/feature you think could be valuable, please let me know, I will love trying to implement them.

Sunday, July 14, 2013

Simple TypeScript Unit Test Project Templates

Inspired by John V. Petersen's latest post http://codebetter.com/johnvpetersen/2013/07/05/a-simple-jquery-qunit-based-javascript-unit-test-project-template/ I thought that TypeScript needed Unit Test project templates to.

I prefer using the Jasmine test framework, but knows that Qunit is popular, so I decided to make a project template for each of them. I have published them on the visualstudiogallery.

TypeScript Qunit Test Project
TypeScript Jasmine Test Project

After installing your preferred Test Project you can find it by choosing new project and go to "other langauges => TypeScript"














The basic structure for the jasmine project looks like this:



The Quint look almost the same, the only different is that I have installed the qunit.d.ts file via nuget instead of the jasmine.d.ts.
The reason for the d.ts files is placed in this structure "Scripts/typings/jasmine/jasmine.d.ts" is that, this is the basic structure when you install TypeScript definition files from nuget.

To get it working you also needs to install the chutzpah javascript runner

When this is done, the test will show up in the VS test explorer window.


Thanks John, for the inspiration. I now don't need to copy paste my TypeScript test projects.

Wednesday, July 3, 2013

2013 Microsoft® MVP Award! in Visual C#

A couple of month’s back I’ve got an email from Microsoft that I have been nominated for a MVP award, the only thing I should do was to fill out a word document. First I thought it was a spam mail and reread the mail. When I was sure it wasn’t spam I filled out the document, and then forgot all about it.
Then a few days ago I’ve got an email “Congratulations 2013 Microsoft MVP!”



I couldn’t believe it! And I still really can’t!.. But my MVP award should arrive on Monday, and when I have the award in my hand I’m sure that I believe it :o)

Today, there are more than 4,000 MVPs worldwide. They represent more than 90 countries, speak over 40 languages, answer more than 10 million questions a year, and are awarded in almost 90 Microsoft technologies.

And I must thanks for those that have nominated me and how proud I am to be a MVP.