Skip to main content

Posts

Showing posts from 2014

Microsoft Threat Modeling Tool

Security is a hot topic today(certainly with the recent Sony hack ). Integrating security into an application cannot be an afterthought but should be an integrated part of the software development lifecycle. One approach to tackle this problem is the Security Development Lifecycle as adopted by Microsoft: The Security Development Lifecycle (SDL) is a software development process that helps developers build more secure software and address security compliance requirements while reducing development cost. Threat modeling is an invaluable part of the Security Development Lifecycle (SDL) process. By applying a structured approach to threat scenarios during the design phase of development helps teams more effectively and less expensively identify security vulnerabilities, determine risks from those threats, and establish appropriate mitigations. One tool to help you do this is – Microsoft Threat Modeling Tool 2014 . It’s available as a free download from Microsoft Download Cent

Visual Studio 2013–SQL Server Data Tools error: SQL71501: User: [user] has an unresolved reference to Login [user]

After importing a database using the SQL Server Data Tools in Visual Studio, I got a compilation error on my database project: SQL71501: User: [user] has an unresolved reference to Login [user] The SQL Server Data Tools by default only import the database specific objects. A database login, which is a global database server object, is not imported. This explains the error. But how can we fix this? In previous versions of the SQL Server Data Tools, you had 2 types of Database Projects; the normal Database Project and also a Database Server project. However in VS 2013, the Database Server project no longer exists. So we need a different solution. I first tried to solve it using Schema Compare.  I clicked on the 'Options' button in the Schema Compare window and selected the "Object Types" tab. There I choose to include logins. But when I ran the Schema Compare, it didn’t made any difference.  I probably did something wrong, but as I was short on time, I took

LabManager VMM Server Background Synchronization Job Failing

The Team Foundation Server logs of a client was filling up with errors about a failing job: LabManager VMM Server Background Synchronization . This runs every few minutes and tries to keep the LabManager server up to date.   The reason why this job fails on our system is because the Lab Management functionality is no longer in use. We used it when we were still on Team Foundation Server 2012. But when we moved to Team Foundation Server 2013, we didn’t upgrade the Lab Management part as well. So the Lab Management parts were gone and we didn’t de-register it first. I wanted to get rid of these errors and decided to look for a solution. First thing I tried was using the tfsconfig command and ask TFS to delete the lab management part: tfsconfig lab /delete /collectionName:<collectionname> But this failed with a TF255384 error complaining that the Virtual Machine Manager Administration Console could not be found on the application server. I didn’t want to install it

Use Hangfire to schedule jobs in ASP.NET

Hangfire is a great library to schedule and execute asynchronous work in a web application. One of the things I like about this library is that you can start with a simple background process inside the Application Pool and when your jobs get larger(and take more time) you can move them to a separate process. Here are the steps to move your Hangfire jobs outside your web application: Step 1 – Change the Hangfire configuration inside your web app to disable the Hangfire server functionality(note that the job information is stored inside a database): Step 2 –Schedule your jobs(like you did before): Step 3 – Inside another project, a console application in this case, you can host the Hangfire server:

Team based vs Project based

As a certified Scrum Master, I do most of my projects using Scrum (or Scrum but… ). I really like the transparency and continuous feedback that Scrum brings to the table. But I also notice that Scrum isn’t the perfect fit for all kinds of projects. It’s suited well for Green-Field/Brown-Field projects but I struggle applying Scrum to a Maintenance project or where one team is working on multiple projects at the same time(which is not done in Scrum). After reading the following article – No projects, Beyond projects – I stopped trying to use Scrum as the hammer that works for every nail(and screw). In this article, the author promotes an alternative model to think about work. He calls this the Beyond Projects model or more descriptive Continuous Work, or Steady State Work Model, or Work Streams. The author doesn’t mention it, but it sounds familiar to Kanban …

Angular.js 1.3: bindToController

I keep finding new stuff inside Angular 1.3. One of the things I found is the bindToController attribute. I’m an advocate of using the controllerAs syntax to get rid of the $scope variable. The only problem before is that in a directive you still had to use $scope…until now. Let’s first have a look at what the AngularJS documentation has to say about the bindToController attribute: When an isolate scope is used for a component (see above), and controllerAs is used, bindToController: true will allow a component to have its properties bound to the controller, rather than to scope. When the controller is instantiated, the initial values of the isolate scope bindings are already available Before scope variables were not included in the controller scope when controllerAs was used. This means that the directive's scope variables were not bound to the object created by controllerAs.  The bindToController attribute fixes this. Enough talk, show me the code:

Woops! Angular suddenly stopped working… and it was Batarangs fault

Last week I encountered a strange problem. Without changing anything to my code, my Angular application started failing. I had no clue why… until I noticed that Batarang , a Chrome Extension for Angular.Js had been updated. It looked completely different and injected some custom JavaScript into my application. As far as I could remember, it did not do that before. Could it be? I disabled the extension in Chrome and yes, my Angular.js application started to work again. Anyone who had the same problem with the latest AngularJS Batarang extension? Note: I’m using Angular 1.3 but a colleague had the same issue with Angular 1.2

WPF Performance Tips

With the recent announcements about new WPF features , it’s time to re-introduce some WPF related blog posts. When browsing through the CodeProject articles, I noticed this great post about WPF performance: http://www.codeproject.com/Articles/784529/Solutions-for-WPF-Performance-Issue This is one of the most complete performance guides I’ve ever seen and certainly useful for every WPF (and even XAML) developer. Here is the list of topics covered: Basic knowledges of WPF rendering. Pixel Snapping in WPF Application WPF Visual Rendering Detect issues with WPF performance suite - Performance Profiling Tools for WPF Detect Software Render Detect Undesired Rendering Make a trade-off between graphique's quality and performance. Disable Pixel Snapping and Anti-Aliased option RenderOption UIElement.CacheMode and BitmapCache Make a trade-off between architecture and performance

Microsoft Azure–A/B testing

A/B testing is a technique whereby different users get a different version of an application of website. This allows you test new features ‘in the wild’ and allows to check which experience or functionality is preferred. Facebook uses this technique a lot, but it’s also a useful technique for the ‘non-facebooks’ of the world. Doing A/B testing in Azure Websites is really easy. It is supported out-of-the-box by using multiple deployment slots. Let’s walk through the steps: Open the Azure Management Portal. Use the new portal available at https://portal.azure.com/ . The A/B testing functionality can only be configured there. Create a new Website. Choose a URL, Web Hosting Plan(Deployment slots are only available when you use a Standard plan), Resource Group, Subscription and Location(or just use the defaults ). Click on Create . Once the website is created, open the blade of the site and look for the Deployment slots section. Click on Deployment Slots to load the

TypeScript build server error: "tsc.exe" exited with code 1.

After configuring a Continuous Integration build for a TypeScript enabled web application, the build turned red with the following error message: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\TypeScript\Microsoft.TypeScript.targets (118): "tsc.exe" exited with code 1. On the build server I had installed the TypeScript components for Visual Studio 2013 , but for this particular project we were still using Visual Studio 2012. I was able to fix the problem by installing the TypeScript 1.0 Tools for Visual Studio 2012 on the build server.

Angular.js templates inside Visual Studio: SideWaffle Template Pack

If you want to save some time when building Angular.js applications, have a look at SideWaffle . SideWaffle is an extension for Visual Studio. It contains both item- and project templates suitable for building websites, Windows apps, Windows Phone apps, WPF, Visual Studio extensibilty project and a lot more.  More information can be found at the official website: http://sidewaffle.com/

Azure Websites–Site Extensions

Site Extensions allow to enhance the management experience of Azure Websites. There is already a small set of extensions out there, but nothings stops you from creating your own(you have to create them as NuGet packages). The list of available extensions can be found at http://www.siteextensions.net/ . This is also the place where you can upload your own extensions and share them with the rest of the world.

ASP.NET Web API–Return 401 when using OWIN cookie authentication middleware

Wen using the OWIN cookie authentication middleware inside ASP.NET Web API, I noticed that I didn’t got an unauthorized (401) HTTP code when I was not authenticated. Instead the response was a 200 status code with a JSON response body: {"Message":"Authorization has been denied for this request."} This is not what I want. To change this you have to reconfigure the CookieAuthenticationProvider on the cookie authentication middleware:

SpecFlow Assist Helpers

If you are a SpecFlow user certainly check out the Helper classes inside the TechTalk.SpecFlow.Assist namespace. The helpers offer a wide range of functionality. I use it most of the time to translate the parameter table to a typed object: More information can be found here: http://www.specflow.org/documentation/SpecFlow-Assist-Helpers/

SpecFlow: Visual Studio does not recognize steps in another assembly

On my current project we are using SpecFlow to create our BDD style tests. I really like the experience so far. One of the things that you have to understand when using SpecFlow is that the end goal is a set of re-usable steps that allow you to specify new scenario’s (and tests) fast. In our case we already have a set of steps that we want to re-use in multiple test projects. Therefore I created a separate assembly where I put some of my shared steps classes.This is a supported scenario inside Specflow, the only thing you need to do is to specify the assembly name inside your app.config: <specFlow>     <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->     <stepAssemblies>       <stepAssembly assembly="Tests.SharedSteps" />     </stepAssemblies>     <unitTestProvider name="MsTest" />   </specFlow> However when I opened

Use JavaScript to write Macros in Visual Studio

The Visual Studio Platform team released a new extension for Visual Studio 2013; Macros for Visual Studio 2013 . From the documentation : Macros for Visual Studio 2013 is an extension for Visual Studio 2013 that enables the use of macros to automate repetitive tasks in the IDE. The extension can record most of the commands in Visual Studio including text editing operations. Features Record and playback active document operations and Visual Studio IDE commands Playback multiple times Manage and persist macros with a Macro Explorer Assign keyboard bindings to any macro Macros recorded as JavaScript files that call VS DTE APIs Macro editing in Visual Studio with DTE IntelliSense Stop playback Sample macros

LocalDb error: Cannot attach the file ‘sample.mdf’ as database ‘sample.mdf’

In a demo app I  used the LocalDB functionality to host my database files. This should have saved me some time. However when I ran the application, I ended up with the following error message: {"Cannot attach the file 'C:\\Projects\\SampleApp\\App_Data\\sample.mdf' as database 'sample'."} Looking at my connection string data inside my web.config, everything looked fine: <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=Sample;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\Sample.mdf" providerName="System.Data.SqlClient" /> But when I opened up the App_Data folder, I found an empty folder. Aha! It seems like you have to create the database file yourself. I opened up the solution, right clicked on the App_Data folder and choose Add –> New item…

Angular.js performance tip: Disabling Debug Data

While reading through the Angular.js documentation I stumbled over the following great performance tip: By default AngularJS attaches information about scopes to DOM nodes, and adds CSS classes to data-bound elements. The information that is not included is: As a result of ngBind, ngBindHtml or {{...}} interpolations, binding data and CSS class ng-class is attached to the corresponding element. Where the compiler has created a new scope, the scope and either ng-scope or ng-isolated-scope CSS class are attached to the corresponding element. These scope references can then be accessed via element.scope() and element.isolateScope(). Tools like Protractor and Batarang need this information to run, but you can disable this in production for a significant performance boost with: myApp.config(['$compileProvider', function ($compileProvider) { $compileProvider.debugInfoEnabled(false); }]); If you wish to debug an application with this information then you should open up a d

Team Foundation Best Practices Analyzer - "%TFSServerURLValidated% error

When running the Team Foundation Best Practices Analyzer , it failed immediately with the following message: Cannot validate the URL provided The scan was generated using the corrected URL "%TFSServerURLValidated%". I never seen this issue before. On the Internet I found some related blog posts here and here . But in my case the solution was a lot simpler: I ran the tool again with the ‘Run as Administrator’ option. This time everything was working as expected.

Upgrading to Caliburn.Micro 2.0

As Microsoft announced some new WPF features , I found a good excuse to do a WPF blog post . Recently I had to do some changes to an WPF application I built some time ago. While implementing the change, I noticed that a new version of Caliburn.Micro was available. I always loved Caliburn.Micro , it is still one of the best MVVM frameworks out there. Now doing this upgrade wasn’t that hard but wasn’t a walk in the park either. Here are some of the problems I encountered: Bootstrapper<T> no longer exists. Instead you have to inherit from BootstrapperBase . Inside the Bootstrapper override the OnStartup method and call the DisplayRootViewFor<> method: protected override void OnStartup(object sender, StartupEventArgs e) {            DisplayRootViewFor<IShell>();  } EventAggregator.Publish now takes an action to marshal the event. You can still use the EventAggregator.PublishOnUIThread if you want the original behaviour. Message.

Integrating Google Analytics in your Single Page Application

If you want to learn the ins and outs of the Google Analytics API and understand how to integrate it inside a Single Page Application, try the ‘Poses by Khalil’ tutorial(for anyone wondering, Khalil is a cat). ‘Poses by Khalil’ is is a tutorial single page application (SPA) to show you how to track common interactions using the latest incarnation of Google Analytics, Universal Analytics.

Linq in your browser: underscore.js

While working on an Angular application, I ended in a situation where I had to add another tool in my toolbox: underscore.js . It not only offers over 100 functions that support functional helpers like map , filter , invoke — but also has a fluent API that allows to create LINQ style queries. An example:

Angular.js ui-router: Focus on view

In an Angular.js application we are building, we use the great ui-router module as a replacement for the default ngRoute module. From the documentation: AngularUI Router is a routing framework for AngularJS , which allows you to organize the parts of your interface into a state machine . Unlike the $route service in the Angular ngRoute module, which is organized around URL routes, UI-Router is organized around states , which may optionally have routes, as well as other behavior, attached. States are bound to named, nested and parallel views, allowing you to powerfully manage your application's interface. It offers a lot more flexibility than ngRoute and is our default choice when building Angular.js applications. This doesn’t mean that everything is perfect. Last week we got a bug from a user mentioning that the page scrolled down when loading the Angular.js application. We discovered that this is caused by the ui-route module which has autoscroll enabled by defa

Free ebook – Perspectives on Agile Software Testing

In celebration of the 10th anniversary of Selenium, the guys from Thoughtworks created a small ebook available for free: It's been 10 years since Selenium was born and the industry has changed tremendously since then. In honor of Selenium's first decade, we put together some our greatest hits and new pieces on software testing. How has testing evolved in the past decade? How do we adapt to the new challenges that mobile testing has to offer? Can testing in an agile environment lead to faster feedback? Download this free e-book and read more about the big developments in testing methods and tools, while looking closely at the advent of mobile testing and what the future holds for QAs.   The book can be downloaded here: http://info.thoughtworks.com/ebook-agile-software-testing . Remark: Be aware that you have to register first.

Microsoft is going Open Source… for real!

The last years Microsoft is making more and more stuff Open Source. So last week at the Connect() event, it was no surprise when they announced that they have open sourced the .NET Core Runtime and Libraries. If you still think that Microsoft isn’t serious about this whole Open Source move, have a look at their GitHub landing page and see the whole list of technologies and tools that they are creating in the open:

Windows Azure Readiness: Azure Website Migration Assistent

You have an existing web application running on premise and you are interested in moving to Windows Azure? Then go check out https://www.movemetothecloud.net/ . In 3 steps this website will guide you through the process to get your website to the cloud. Step 1. Install MS Open Tech Migration Assistant Tool This small ClickOnce application should be installed on your local machine. It scans your local or remote IIS server for a bunch of information. Click on Install Tool to get going… Step 2. Run the Readiness Assessment. Once the installation has completed, the tool will start up and give you the option to either scan a local or remote IIS server. Click Continue to start the scanning process. It will scan through all your websites and give you a list with possible migration candidates. Check the ones you want to be evaluated and click Next . A Readiness Report is generated. You can now upload this report by clicking Upload . Step 3. Migrate your website.

Connect() on demand(in case you missed it)

In case you missed all the announcements at Connect() , it’s time to lock yourself up in your room and start watching all the videos .

DevIntersection 2014 – Interviewing developers

At the moment I’m in Las Vegas attending DevIntersection . Next to all the technical sessions, there was a whole track dedicated to leadership. One of the sessions in the Leadership track was ‘Interviewing Developers’ by Billy Hollis. Here are some of the notes I made during the session: Keep a professional attitude. You are here to find the perfect match for your team not to get new friends. Don’t try to become friends with the candidate. If you hire him (or her) you get time enough to get acquainted. It’s a good idea to ask the candidate to send some code up front. This should not be a whole project but just some files the developer can share. Unfortunately some developers work on proprietary projects and cannot provide any code. Do a review of the application letter. Chances are high that the candidate did write this letter himself, which could not be the case for his CV. Don’t be merciful on spelling mistakes! Do

DevIntersection 2014 – Visual Studio Announcements

At the moment I’m in Las Vegas attending DevIntersection . During the keynote by Steven Guggenheimer this morning, they shared some news about .NET and Visual Studio that was later repeated during the Connect conference. Here are some of the highlights: Visual Studio and Team Foundation Server 2013 Update 4 are available.  Release notes… The first public preview of Visual Studio 2015 and .NET 2015 are available.  Release notes… The .NET Framework is going open source and cross platform A free Visual Studio Community 2013 – a new edition of Visual Studio that combines everything in all the Express products and adds extensibility support.  Learn more… Enough announcements to keep us busy for a while… More information can be found at: Brian Harry’s blog: http://blogs.msdn.com/b/bharry/archive/2014/11/12/news-from-connect.aspx The Visual Studio blog: http://blogs.msdn.com/b/visualstudio/archive/2014/11/12/visual-studio-2015-preview-visual-studio-commun

DevIntersection 2014 – Cross platform mobile development and MacInCloud

At the moment I’m in Las Vegas attending DevIntersection . During the mobile development workshop I attended, the presenter mentioned MacInCloud , an online service to remote access a Mac in the Cloud. I’m a cross platform mobile developer, why should I care? If you are doing cross-platform development(with for example Xamarin), you’ll need a Mac sooner or later. Apple Licensing Terms doesn’t allow you to design and build your application on non-Apple hardware. So don’t think that creating a Virtual Machine and installing OS X on it, is a feasible solution. Now you would think that the only option left is to buy a Mac, but Macs are expensive. Thanks to MacInCloud , you can use a Mac and only pay for the time you are using it.

DevIntersection 2014 - MobiZen

At the moment I’m in Las Vegas attending DevIntersection . During the mobile development workshop I attended, the presenter was using a great tool called MobiZen . MobiZen allows you to share the screen of your Android device on your desktop or inside a web browser. You can even control your Android from your pc or laptop. This is the perfect tool not only during development but also when you want to demo some functionality to your client. And best of all, it’s free! From the documentation : Using your smartphone from your PC becomes a reality with Mobizen. Type using your keyboard, view photos and videos stored on your phone, and use mobile apps. Photo: Share your special moments on a larger screen. Music: The songs you listen to on-the-go can be enjoyed anywhere. Videos: Watch videos and movies stored on your smartphone. Files: Use drag and drop to transfer files between your smartphone and PC. This will certainly become a new tool in my m

Free Azure and Office 365 Exams

To accelerate the adoption of their cloud technologies, Microsoft made the following MCP exams available for free: 532: Developing Microsoft Azure Solutions 533: Implementing Azure Infrastructure Solutions 346: Managing Office 365 Identities and Requirements 347: Enabling Office 365 Services This offer is only valid until December 31, 2013 or while supplies last. So be quick and register for one or more of these exams. Get your voucher here: http://borntolearn.mslearn.net/goodstuff/p/mcp.aspx Good luck!

Angular AtScript

I heard some colleagues discuss if Angular.js will ever be written using TypeScript . The answer is no. In fact, the Angular.js team is using their own language AtScript to build Angular 2.0. The goal of AtScript is similar to the goal of TypeScript, it enhances the JavaScript language with some missing features without infringing upon its current capabilities. Here are some of the enhancements and the philosophy behind the language from the Angular.js team design documents : Enhancements Type Annotations: Types allow us to explicitly express contracts between different parts of the system and to give these contracts names. For large teams with large codebases, where no single person knows the whole codebase, types become a key way to discuss and reason about the collaboration between different components of the system. Field Annotations: Types are not only about contracts (API) but also about structure. In JavaScript the fields are implicit;

ASP.NET Custom Headers–X-UA-Compatible=‘IE=Edge’

If you are building a ‘modern’ web application for Internet Explorer, I would recommend to enable the following header inside your web.config: Using this header will enable ‘Edge mode’ inside IE. It represents the highest support for modern standards available to the browser. In other words, it tells Internet Explorer to use the highest mode available to that version of IE; e.g. Internet Explorer 8 can support up to IE8 modes, IE9 can support IE9 modes and so on. Edge mode was introduced in Internet Explorer 8 and has been available in each subsequent release. Note that the features supported by edge mode are limited to those supported by the specific version of the browser rendering the content. Remark: Starting with IE11, Edge mode is the default mode. Other document modes are deprecated and should no longer be used, except on a temporary basis. Make sure to update sites that rely on legacy features and document modes to reflect modern standards. 

Building cross-platform mobile apps in Visual Studio

Interested in building cross-platform mobile apps using Visual Studio? Microsoft made this easy thanks to the Multi-Device Hybrid Apps Visual Studio extension . This extension allows you to combine Visual Studio and Apache Cordova to easily build hybrid apps that run on iOS, Android, Windows, and Windows Phone using a single project based on HTML and JavaScript. The extension is available for download here . Remark: Be aware that the extension will download and install some additional dependencies, including Joyent Node.js Git CLI Google Chrome Apache Ant Oracle Java JDK 7 Android SDK SQLLite for Windows Runtime Apple iTunes More information can be found at http://www.visualstudio.com/en-us/explore/cordova-vs.aspx .

Internet Explorer–What’s coming next?

Do you want to know what HTML/JavaScript/CSS features will be supported in future versions of Internet Explorer? https://status.modern.ie/ brings you the answer. You see all the features that the IE team is considering to support(and you even can see the support for other browsers).

ASP.NET MVC–CS0234: The type or namespace name ‘’ does not exist in the namespace ‘System.Web.Mvc’

Sometimes you have these issues that always appear randomly. You know you have seen these issues before, but you can’t remember how you fixed them . Today I opened up the project I was working on for the last month to see the following error: CS0234: The type or namespace name ‘’ does not exist in the namespace ‘System.Web.Mvc’ I first tried all the obvious things when you have such an unexpected error: Clean the solution and rebuild the project… Didn’t help Restarting Visual Studio… Didn’t help Delete everything from the Temporary ASP.NET Files folder… Didn’t help Got another coffee at the coffee corner… Didn’t help but I felt a little bit better Finally I noticed that I had switched between configuration modes. Inside the Debug configuration mode, I noticed that Copy Local was set to False for System.Web.MVC . When I changed Copy Local to True everything was working again. Wasted one hour…

TFS Performance Tips

Last week I noticed the following blog post by Cory House; Two Quick TFS Performance Tips . It’s a small post, but one with great value… In his post, he shares one of the greatest performance tips ever about TFS; create a separate workspace for each Team Project . How many times I heard a developer complain that TFS was slow and cumbersome to use… And when I took a look at his Visual Studio solution I had to discover that his 5 years of developer work was all sitting in the same workspace. Ugh…

Announcing Microsoft Connect event

On November 12th,  Microsoft is hosting an online developer event called Connect(); .  Connect(); will be a chance to have a conversation with developers about what’s coming next for developer tools, developer services and application platforms across Microsoft. From the website : “ Connect(); is a cloud-first, mobile-first, code-first virtual event focused on current and future Microsoft technologies for developers. Build on your current skills, unleash your creativity, and expand what's possible to deliver unprecedented innovations.” So if you have any questions about what’s coming next in ASP.NET, this is a great opportunity to get some answers…

Angular.js: Using ngAnnotate inside Visual Studio

Last week I discovered a great NPM module; ‘ ng-annotate ’.It adds and removes AngularJS dependency injection annotations. The great thing is that allows you to use implicit dependencies in Angular.js and ng-annotate will automatically make the switch to the Inline Array annotation. This means that you write  the following code: And that it gets rewritten automatically to: The only problem is that I have to run ngAnnotate from the commandline. As a Visual Studio user, I would like to have an integrated solution. Let’s see how we get this done… Integrate ngAnnotate into Visual Studio To make integration possible, we’ll use some Visual Studio Extensions. So let’s install them first. Start with installing(or upgrading) to the latest version of Web Essentials . Also install node.js on your system. Now it’s time to install Task Runner Explorer . This will allow you to run Grunt and Gulp tasks directly from within Visual Studio. You can also install the Pack

Angular.js 1.3: The ng-strict-di directive

Angular.js 1.3 introduces a new directive: ‘ng-strict-di’. <div ng-app="myApp" ng-strict-di> From the documentation : if this attribute is present on the app element, the injector will be created in "strict-di" mode. This means that the application will fail to invoke functions which do not use explicit function annotation (and are thus unsuitable for minification), as described in the Dependency Injection guide , and useful debugging info will assist in tracking down the root of these bugs. To explain this a little bit more; Angular.js does (implicit) dependency injection based on the name of the object you try to inject. So if you specify a parameter as ‘$scope’ it will look for an object called ‘$scope’. This works great until you start using minification. When you minify your JavaScript, the function parameters are shortened to a random letter, e.g. ‘d’. When the injector runs this minifies JavaScript it no longer searches for a ‘$scope’ object

Another free Xamarin e-book

There is really no excuse anymore to at least read one book about Xamarin. After the free ‘Master Cross-Platform Mobile Development with Xamarin ebook’ I mentioned last week, there is now another free ebook: Creating Mobile Apps with Xamarin.Forms, Preview Edition : Cross-platform C# programming for iOS, Android, and Windows Phone , by Charles Petzold. This ebook was created jointly by Xamarin and Microsoft Press. This Preview Edition ebook is about writing applications for Xamarin.Forms, the new mobile development platform for iOS, Android, and Windows Phone unveiled by Xamarin in May 2014. Xamarin.Forms lets you write shared user-interface code in C# and XAML (the eXtensible Application Markup Language) that maps to native controls on these three platforms. This ebook is a Preview Edition because it's not complete. It has only six chapters. We anticipate that the final version of the book will have at least half a dozen additional chapters and that the chapters in thi

Fake asynchrony: Avoid the JSON.NET async APIs

As a developer I frequently build my own libraries or re-use existing ones. In the new async/await world, you have to consider if you implement an async version of your library.  However one thing that is important is to avoid “fake asynchrony”. Fake asynchrony is when a component has an async API, but it’s implemented by just wrapping the synchronous API within a task or thread. This will lead to unexpected behavior and can decrease performance. One example of fake asynchrony is Newtonsoft JSON.NET , the known (and great) JSON serialization library. The creators of JSON.NET are already aware of this issue and made the async API’s obsolete:

Angular.js and ASP.NET MVC: IsAjaxRequest returns false when using $http

In an application we are combining Angular.js on the client and ASP.NET MVC on the server. This all works great until we added a call to Request.IsAjaxRequest inside our MVC controller: Inside the controller action we check if we have an AJAX request. If this is the case we return a JSON result otherwise we return an HTML view.  We’ve used similar code(in combination with jQuery) in previous projects without any issues. But when calling the MVC action method through Angular’s $http service, we noticed that the Request.IsAjaxRequest() method returned false . When comparing the requests issued by Angular $http versus jQuery $.get() we noticed one small difference. The xhr call initiated by Angular doesn’t contain the X-Requested-With header. And this is exactly the header ASP.NET MVC is looking for to detect if it’s an AJAX request or not. We can easily fix this by changing the $httpProvider configuration to include this header with every request:

Master Cross-Platform Mobile Development with Xamarin

The guys from Falafel are offering a free e-book about Cross-Platform Mobile development with Xamarin. Go download your copy here (registration required).