I don't want to get off on a rant here, but....

Avatar

Technology, Programming, Complaints, etc.

Articles from the year 2014

Ember.js confusing errors and "magic" functionality

If in ember.js you're getting errors like "TypeError: Cannot call method 'unchain' of undefined" and you get them when you try to navigate away from a route to another route. The problem may be this feature which makes model properties that start with capital letters lookup on the Ember.lookup which is basically the window object, making them act like a global property.


The confusing part is it works to build the view, data is there, behavior is as expected, it just blows up when you try to leave the route. This may just be when using the property in an if block helper. 

With Go as my JSON source all my properties are coming capitalized from the server, and only one Route had this issue.

So the solution is to make the property be lower case.  This can just be a dynamic property that aliases the Uppercase to uppercase, since it's a handlebars feature, it wouldn't impact your JS code using Ember.

And credit to this Stack Overflow answer that got me to the change and the solution.

MS tooling loves to break stuff in new, random, and unexpected ways

If you are getting an error starting with "$(ReplacableToken" then some string identifier from your code then finishing "-Web.config Connection String_0)" it means that the deploy task is is maiming your Web.config trying to customize it for the environment.  To disable this pointless on by default behavior that makes no sense for MS to do when no replacements have been defined for the tokens it's creating.... do the following;

Don't fall for the trick of creating more files to make MS leave your existing files alone, just add the flag to the existing csproj file 

Prevent tokenizing connection strings

If you want to prevent your web.config connection strings from being tokenized it’s pretty easy. All we need to do is the add a property to the build/package/publish process. We can do that in 2 ways. Edit the project file itself or create a file with the name {ProjectName}.wpp.targets where {ProjectName} is the name of your project. The second approach is easier so I use that. In my case it would be MvcApplication1.wpp.targets. The contents of the file are shown below...

http://blogs.msdn.com/b/webdev/archive/2010/11/10/asp-net-web-application-publish-package-tokenizing-parameters.aspx