I'd like to share this post about time saving tips in Xcode. The ones I like the most (because I didn't know them) are the shortcuts:
command + shift + O
command + control + up arrow
Tuesday, August 6, 2013
Monday, July 8, 2013
Ninject with MVC4: No parameterless constructor defined for this object
I've been a big fan of StructureMap, but a few days ago I decided to investigate a simpler framework for DI. I heard about Ninject a long time ago and decided it was time to learn it by applying it to the controllers in MVC4. There are a lot of usefule posts out there that explain how to use it, just keep in mind 2 things:
1) Put your code in App_Start/NinjectWebCommon.cs instead of the global.asax
2) After finishing the tutorials, I got the error "No parameterless constructor defined for this object". This post from StackOverflow has the correct answer! Basically you need these 2 code snippets:
1) Put your code in App_Start/NinjectWebCommon.cs instead of the global.asax
2) After finishing the tutorials, I got the error "No parameterless constructor defined for this object". This post from StackOverflow has the correct answer! Basically you need these 2 code snippets:
public class NinjectControllerFactory : DefaultControllerFactory
{
private IKernel ninjectKernel;
public NinjectControllerFactory(IKernel kernel)
{
ninjectKernel = kernel;
}
protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
{
return (controllerType == null) ? null : (IController) ninjectKernel.Get(controllerType);
}
}
ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory(Kernel));
Friday, July 5, 2013
Setting the password for a Git repository in Continuous Integration systems
Continuous Integration systems like CC.NET or Hudson don't let you specify the username/password with which you'll connect to Git. But there's an easy way, just set the repository url to:
https://username:password@github.com/Test/MyProject.git
Sunday, May 19, 2013
Loading videos on the fly using video.js
Video.js doesn't have a lot of documentation when it comes to doing really cutom stuff. For example, loading videos using a partial postback and changing the subtitles. Fortunately I'm not the first one to run into this problem, and I found this link that shows how to do it. It works in Chrome and Firefox. IE 8/9 is different because it's Flash, so you have to check the browser type before executing the code.
Tuesday, May 14, 2013
Uncaught Error: ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node
This problem happens when you call applyBindings. The problem here is that your view is a jQuery object, not a DOM element. It can be fixed by appending [0], as described here.
Monday, May 13, 2013
Binding a partial view with knockout
If there's a part of your view which you don't want to bind right away, you can defer it very easily. The basic solution is to include this code:
You can also check out this detailed solution.
ko.bindingHandlers.stopBinding = {
init: function ()
{
return { controlsDescendantBindings: true };
}
};
<section>
<!-- ko stopBinding: true -->
<div></div>
<!-- /ko -->
</section>
You can also check out this detailed solution.
Monday, April 1, 2013
IIS ends debugging session because of a timeout
When debugging SharePoint code in Visual Studio, sometimes the debugging session will end unexpectedly. If the error is "Web site worker process has been terminated by IIS", then removing the timeout is really easy. You just need to set Ping Enabled to false and the Ping Maximum Response Time to a really large number. You can also follow these instructions.
Subscribe to:
Posts (Atom)