DevelopMentor is Now Part of Global Knowledge

To all our customers,

Today, we’re pleased to announce that we are joining the Global Knowledge team. For 22 years, DevelopMentor has delivered the industry’s most in-depth hands-on developer training. We will continue that tradition on a larger scale as part of Global Knowledge through expanded offerings and services.

Global Knowledge is the world’s leading learning services provider and an existing training partner for many of you. Global Knowledge is committed to the application development space, and together we will provide DevelopMentor customers with expanded curriculum in both the classroom and online.

DevelopMentor has also been an innovator in online learning with our instructor-supported LearningLine platform. As part of Global Knowledge, we will be adding to our online curriculum and will continue to enhance your web learning experience. Traditional classroom students will benefit from an expanded schedule with courses available in more locations with improved services for virtual participants.

Global Knowledge and the DevelopMentor technical team will build the world’s best learning services for developers. The curriculum will provide skills development in emerging web, mobile and cloud application development practices and techniques. The application development portfolio will include expanded support for developer teams – beyond classroom – ranging from trouble-shooting and guidance on workday issues, to enhanced project specific-capability support, and comprehensive career-shaping skills.

As part of Global Knowledge, we will be better equipped to support our customer’s learning requirements. We will deliver world-class training options so you can choose the format that suits you best: classroom, virtual, asynchronous and video – all with our shared values of technical depth, hands-on engagement and instructor quality.

We are looking forward to new opportunities together and to being of greater value to all of you.

Mike

Mike Abercrombie
CEO

Advertisements

New webcasts from DevelopMentor: MongoDB, iOS, and Bootstrap

We are excited to announce three upcoming webcasts at DevelopMentor in November:

     webcast-mark-smith-iOS-and-dotnet-Xamarin webcast-michael-kennedy-bootstrap-beautiful-websites

Register for these now:

Getting started with MongoDB and NoSQL in .NET and C#
b
y Pierre Nallet

The world of data offers new choices and MongoDB is the most popular alternative to SQL databases today. In this one hour webinar, we’ll look at the reasons developers turn to NoSql databases and what makes MongoDB special. Then we’ll look at how to manipulate MongoDB data from C# efficiently and safely by leveraging Linq.

 Building data-driven applications for iOS in C#
by Mark Smith

Creating a dynamic UI for data display and navigation takes time – in this 1 hour webinar, we’ll look at using C# and Xamarin.iOS to pull data from the web and display it in a quick, easy fashion in table views using the cool services of DialogViewController.  With this technique, you can quickly build data-driven applications to display almost any form of data and be positioned to port that code to other platforms like Windows Phone and Android easily.

Building beautiful websites with Bootstrap: A case study
b
y Michael Kennedy

Bootstrap has literally changed the game when it comes to web design. This is especially true for developers who have traditionally struggled to build beautiful and engaging sites. With Bootstrap, developers can now start from a good design and evolved. This webcast look at how we at DevelopMentor have used bootstrap to completely redesign our website. We’ll take you through a quick introduction to bootstrap and then look at the various ways we have made use of it’s simple and productive design foundation.

Recorded webcasts
 
We have also published about 50 hours of free webcasts at http://www.develop.com/webcasts. Come check them out!
 
 
 

Enabling Tincr on Windows 8

Some time ago I posted a blog post on Tincr and live reloading of CSS/JavaScript in Google Chrome. This works really well with one exception, on Windows 8 it will not install. When you try Chrome shows the following error message:

This application is not supported on this computer. Installation has been disabled.

The Chromium team has acknowledged this as a bug but it still needs to be fixed.

The interim solution

Fortunately Lauricio Su came up with a nice workaround and posted it in the Tincr discussion group. Basically his solution is to run Chrome in Windows 7 compatibility mode and install Tincr. After that Chrome can be started in the normal way and Tincr will work just fine.

This worked just fine for me with one addition. I had to keep once instance of Chrome running before starting a new instance in compatibility mode. Without that Chrome would not get a connection to the Internet.


DotNed podcast: Marcel Meijer over Windows Azure

In deze podcast spreekt Maurice de Beijer met Marcel Meijer over huidige stand van zaken bij Windows Azure. Ze blikken even terug op de eerste versie van Azure en wat je toen allemaal wel en niet kon. Het grootste deel van de podcast gaat over hoe Azure veranderd is en wat je tegenwoordig allemaal kan doen. Windows Azure is een dynamisch platform en er is dus veel nieuws te melden. Daarom komt niet alles aan bod en gaan we binnenkort een vervolg podcast opnemen.

Links:

 

Met dank aan onze sponsor RedGate.


Tips for optional parameters to ASP.NET MVC action methods

Here’s a quick ASP.NET MVC tip to help you be more productive and write cleaner code. We will see how to leverage C# 4′s optional and default parameters in our action methods for greatly simplifying our code while keeping it fully functional and error free.

Often you want to pass data to your controllers based on URL parameters. This can either be part of the URL itself in the case of route data or it can be part of the query string. In fact, this tip even works for input forms.

Let’s take a basic method which shows some census data, potentially filtered and sorted if that information is passed along, otherwise we’ll just show everything with a default sort.

value-types

This looks great, right? If you had a URL such as

    /census/detailsvaltype/1?sortAscending=false

It would work perfectly. But what if we omit sortAscending? Well, bool is a value type and doesn’t like missing data much:

crash

I’m just guessing, but most users don’t love this page.

So we can make the parameters strings (no MVC conversion required, missing data can be detected, etc.) like this. But notice how ugly and complex the code becomesnullables-with-convert

Yikes, we went from 1 line of code to many! However, (here’s the point of this post), let’s try that again with optional parameters:

optinoal-params

Almost as simple as the naive version. However, you see making the request with and without data works perfectly! In fact, the data passed to GetDataAndResult are the same here as for the complex variant.

With Data (filtered and ordered):
/census/detailsoptionaldefault/1?sortAscending=false

filtered-data

Without Data (unfiltered and default order):
/census/detailsoptionaldefault

with-no-data

How about that? Hope you find that useful! You can download the code and try it for yourself here: OptionalParamsKennedy.zip

Using RavenDB with Azure websites

In a previous post I explored various options of hosting RavenDB. While using RavenDB as a Windows Service or hosted in IIS is probably the best way to go in most cases there are a number of cases where the embedded option is great. And one of the places where I really like the embedded option of hosting RavenDB is when doing simple standalone websites. And with the new Azure website option that is a great way to host them.

The code is real straightforward and just like before. I am using a DataDirectory option when creating the EmbeddableDocumentStore here but that does the same thing as I did before using the connection string.

 1: public static DocumentStore DocumentStore { get; private set; }

 2:  

 3: private void CreateRavenDB()

 4: {

 5:     DocumentStore = new EmbeddableDocumentStore()

 6:     {

 7:         DataDirectory = @"~App_Datadb"

 8:     };

 9:     DocumentStore.Initialize();

 10: }

RavenDB Configuration

The example code from my previous blog posts will just work except for one gotcha. By default RavenDB will search for a post to use by itself. However that means scanning the available posts and that isn’t permitted by default. The result is an exception:

System.Net.NetworkInformation.NetworkInformationException: Access is denied

With a stack trace like this:

[NetworkInformationException (0x5): Access is denied]
System.Net.NetworkInformation.SystemIPGlobalProperties.GetAllTcpConnections() +1570717
System.Net.NetworkInformation.SystemIPGlobalProperties.GetActiveTcpListeners() +74
Raven.Database.Util.PortUtil.FindPort() +79
Raven.Database.Util.PortUtil.GetPort(String portStr) +133
Raven.Database.Config.InMemoryRavenConfiguration.Initialize() +4355
Raven.Database.Config.RavenConfiguration.LoadConfigurationAndInitialize(IEnumerable`1 values) +307
Raven.Database.Config.RavenConfiguration..ctor() +196
Raven.Client.Embedded.EmbeddableDocumentStore.get_Configuration() +87
Raven.Client.Embedded.EmbeddableDocumentStore.set_DataDirectory(String value) +40
MvcApplication3.MvcApplication.CreateRavenDB() +57
MvcApplication3.MvcApplication.Application_Start() +169

The fix is simple. Instead of letting RavenDB search for a port by itself just specify one in the web.config. The setting required is “Raven/Port”.

 1: <configuration>

 2:   <appSettings>

 3:     <add key="Raven/Port"

 4:          value="9090"/>

 5:     ....

 6:   </appSettings>

 7: ....

That is all there is to it :-)

Want to see for yourself?

I have a simple page using RavenDB as the backend store hosted on Azure right here.

Enjoy!


Querying RavenDB databases

As we have seen in previous blog posts getting data from a RavenDB database is easy. Either use the IDocumentSession.Query<T>() function to load a series of documents or the IDocumentSession..Load<T>() function to load a document using its identity. However sometimes we want more control over what we want to load. It turns out this is rather easy as the IDocumentSession.Query<T>() function returns an IQueryable<T>, actually it returns a IRavenQueryable<T> to be exact but more about that another time.

Querying the database

As IDocumentSession.Query<T>() return an IQueryable<T> we can just start composing queries just as we can with EntityFramework or another ORM. In my original online example you might have noticed that the books aren’t ordered. As with any query this is easy to correct. All we need to do is add an order by clause.

 1: public ActionResult Index()

 2: {

 3:     using (var session = MvcApplication.DocumentStore.OpenSession())

 4:     {

 5:         var books = session.Query<Book>()

 6:             .OrderBy(b => b.Title)

 7:             .ToList();

 8:         

 9:         return View(books);

 10:     }

 11: }

If you prefer the full LINQ syntax that is no problem as it produced exactly the same result±

 1: public ActionResult Index()

 2: {

 3:     using (var session = MvcApplication.DocumentStore.OpenSession())

 4:     {

 5:         var books = from book in  session.Query<Book>()

 6:                     orderby book.Title

 7:                     select book;

 8:             

 9:         return View(books.ToList());

 10:     }

 11: }

Filtering data

In this case I am only ordering the result set but you can also use other operators if you like. Just want books from an author starting with “A”? No problem, just add the filter and it works. The following view search for books where the title or author starts with the passed string.

 1: public ActionResult BooksByAuthor(string author)

 2: {

 3:     using (var session = MvcApplication.DocumentStore.OpenSession())

 4:     {

 5:         var books = session.Query<Book>()

 6:             .Where(b => b.Author.StartsWith(author) || b.Title.StartsWith(author))

 7:             .OrderBy(b => b.Title)

 8:             .ToList();

 9:  

 10:         return View("Index", books);

 11:     }

 12: }

Lucene.Net indexes

If you try this you might notice one big difference from EntityFramework or in memory LINQ queries. If you search for books starting with a lowercase “the” both “The Hitchhiker’s Guide to the Galaxy” and “The RavenDB Book” are returned. And in the query I am not doing anything about making this a case insensitive search. It turns out RavenDB does so by default as it uses Lucene.Net to create indexes. As we didn’t create any indexes you might be wondering where this comes from. It turns out that RavenDB always uses an index when you do a query. You can explicitly create them if you want to. However if you do not, as is the case here, RavenDB will try to find a matching index or create a temporary index if a marching one isn’t found. If the same temporary index is used frequently RavenDB will automatically promote it to a permanent index. That might sound like a bad idea, after all in SQL Server index help with querying but can also slow updates down. In RavenDB this isn’t the case as indexes are update asynchronously so we get the query benefits without the update penalties. Of course there is no such thing as a free lunch and in the case of RavenDB this can mean we use a stale index for the query. That might sounds bad but isn’t quite as bad as it sounds as the data is never stale, just the index, and we can easily control when we want to wait for a non stale index.

Want to try? I have this example running on Windows Azure here.


Use NuGet package restore to simplify code sharing

Here’s a quick post on how and why you want to consider using NuGet package restore.

First, if you’re unfamiliar with NuGet, it’s basically “add reference” to external software projects (typically open source ones such as jQuery, but also for Microsoft ones such as Entity Framework). You definitely need to check out David Ebbo’s post introducing it. NuGet will change the way you develop.

Now when using NuGet it maintains a packages folder near your solution file. For things like ASP.NET MVC that heavily leverage NuGet, you’ll see this folder is very large. It’s usually much larger than your project itself in the beginning.

If you write small projects and share them out as compressed files (e.g. zip’s), and size matters to you, you might want to consider enabling NuGet package restore (off by default) for those projects and delete the packages folder before zipping and sending it out.

As an example, with a typical MVC 4 project, the “raw” content is 680 KB. After doing a build and counting the packages folder you’ll see it jumps to 16.9 MB. If that helps you significantly, then it’s probably a good idea to use package restore.

Three things have to happen to use NuGet package restore.

First, you’ll need to make sure everyone who downloads your zip file has “Allow NuGet to download packages during build” enabled in Visual Studio under Tools>Options>Package Manager.

enable-global

The next set of steps are only done by the you – the one sharing the code. Right-click on the solution file and choose enable package restore:

enable

After doing this, you’ll see 3 new files in your solution:

sol2

Finally, when you zip and share your code, be sure to include the .nuget folder but not the packages folder (and maybe not the bin and obj either).

Now I did say at the beginning why to consider this, not just you should use it as a blanket statement. This whole workflow was introduced for simplifying source code management. Two reasons that come to mind right away to not use package restore are:

  1. If not many of your users / readers / downloaders have package restore enabled globally it might be more effort than its worth.
  2. In the source code scenario, you are dependent on NuGet keeping the right version around forever. Suppose you want to roll-back to the way the code was 2 years ago (some time in the future). It might be safer to have the packages folder just checked in so you’re sure it gets versioned and labeled exactly right.

Hope that’s useful to you!

Cheers,
@mkennedy

DotNed Podcast: Willem Meints over Mono for Android

In deze podcast spreekt Maurice de Beijer met Willem Meints over wat je precies kan met Mono for Android. Verder hebben ze het over de geschiedenis van het open source Mono framework.

Link:

Met dank aan onze sponsor RedGate.