This is a nice extension for VS2010 to allow you to change the default browser on debugging mode
http://visualstudiogallery.msdn.microsoft.com/bb424812-f742-41ef-974a-cdac607df921
This is a nice extension for VS2010 to allow you to change the default browser on debugging mode
http://visualstudiogallery.msdn.microsoft.com/bb424812-f742-41ef-974a-cdac607df921
My manager recommended us to check this website in order to help us keep tracking of what need to be done
What I like is the simple UI and easy to use. It helps people to manage their projects and resources or even it helps you to organise your daily activities. It is free to use as well
Before I was thinking of rewriting my own logging for my application but after having a careful thought, I decided just to get one from NuGet package instead of reinventing the wheel. I heard a lot about Log4Net and decided to try that out. It’s really simple to get this logging up and running on your application
This is what you need to do:
1. install Log4Net from NuGet
2. Modify your web.config to add a new section and new configuration – In this case, I decided to use FileLogger. but you can have different type logger if you want (e.g event log, console, etc) or you can even build your own one that implemented ILog, this configuration allow you to create a new log file when the log file already reached the limit
3. Code implementation – in this case I decided to register it in my global container and retrieve it later. You need to call log4net.Config.XmlConfigurator.Configure in order for Log4Net to get the settings from web.config – This is very important otherwise you will find that there is no log being generated
calling the logger from my code (controller in this context)
PS: if you want to implement your own logger, then I’d recommend you to have your logger to implement ILog interface and change it through web.config but don’t wrap/call Log4Net inside your custom logger because you don’t want to limit the rich functionality of Log4Net with your custom logger
Another tips, is when you started to add logging in your application then there should be some performance overhead eventhough it is minor. In the example below MyFunctionOutput function will still be called eventhough you disabled the logging on the config, in order to make sure the debugging code only executed
When you want to have the debug/logging omitting the log whenever the logging is enabled then you can wrap around the logging with this property (there are another properties IsErrorEnabled, IsInfoEnabled, etc)
Initially, I always pass individual object properties through JSON and form the model in the controller as I wasn’t sure how to pass/form a model from Javascript to controller
Controller
Javascript
the code above is working just fine but I still feel that there is room for improvement. Below is the code that shows how you can still have your controller accepting the model instead of expanding the properties in the model as the parameters to the controller. The solution is just to have the model being assigned to a variable (in this context called as data) before passing it to the JSON, my previous code was forming the actual object in the JSON code
Controller
Javascript
Normally, when you used HttpPost/Form submission to post the view through the controller then you can have the model validation applied automatically through @Html.ValidationSummary()
But how do you get the ModelState errors through Json? You can still use LINQ to get the model errors from the ModelState and pass it through JSON
This is the cloud version of Microsoft Power Point. It is created by the company that I’m working for at the moment. I’m blogging this not because I’m working for them but I’m blogging this based on my personal opinion
It is a powerful web application and It really works as it allows you to use Slide Rocket to share and collaborate your presentation slides with everyone and you don’t need to carry your power point slides file or your laptop. It supports mobile device as well such as an iPad. You just need a connection to the internet
For the standard functionality (Create a presentation slides), it is FREE for life but when you want to use versioning for your presentation, or when you want to have more security control over your presentation, or even to analyse who has accessed your slide and when was it then you need to have monthly subscription. Check it out guys
ps: some guy is using this web application for their resume! and it’s impressive!
This is a simple tutorial in how to use Dependency Injection using SimpleInjector (You can get this package from NuGet)
In this case, I use SimpleInjector to manage my Data Context – I want my Data Context to be per request (Unit of Work per request). The concept of this dependency Injection is to have a global container where you can resolve your object from
1. Create an extension method to the Simple Injector
2. Modify Global.asax – The class name will be MvcApplication in MVC Project
3. Consume it from the controller – Call the container in the Global.asax to resolve the object (GetInstance function)
I found this benchmark for different IoC in .NET. Personally I’ve been using Unity, Ninject and SimpleInjector. I like SimpleInjector because it is very simple and surprisingly it is quite fast compared with the rest. Performance is just one of the aspect of IoC but it doesn’t always mean everything
http://www.palmmedia.de/Blog/2011/8/30/ioc-container-benchmark-performance-comparison
I’ve been learning Knockout recently and I found that sometimes it is hard to find out how your View Model is being formed especially when you create the view from Model in MVC
To inspect your view model, you can use firebug console and run below command, this will give you a full navigated View Model and allow you to drill down
console.group(“Dumping view model”);
console.dir(ko.toJS(new JobResultViewModel()));
console.groupEnd();
alternatively you can also put this code in your template
<div data-bind=”text: ko.toJSON($data)”></div>
Feel free to let me know if you have any other way to debug
1. Change the app.config/web.config of your application that calls the WCF service by adding System.diagnostics detail as below
2. Run your application as usual until it throws the error or until the stage where you can reproduce your issue, once you are done, quit your application or take out the diagnostics section from the config file straight away so your log will not be growing too quickly/massively
3. The log file will be called as MyWCFTraceLog.svclog (as we define in the config file) and it will be located on the same folder as the executable – normally it is in the bin folder
4. How to open svclog file? Go to your program files (x86) or program files/Microsoft SDKs/Windows/v7.0A/Bin/SvcTraceViewer.exe
5. SVCTraceViewer will display you the story line of your WCF and it will help you to pinpoint the underlying issue
Powered by WordPress & Theme by Anders Norén