Tuesday, May 14, 2013

Developing ASP.NET MVC 4 Web Applications - passed.

I have successfully passed Exam 70-486: Developing ASP.NET MVC 4 Web Applications.

I used next sources for preparations:
From the other hand I filled problem with questions related to Azure and CSS. At least first one is topic for develop.

Sunday, March 24, 2013

10gen: M101P MongoDB for Developers - has been completed

I have successfully completed, with distinction, M101P, MongoDB for Developers (Python). My score puts me in the top 6% of all students who registered for the course.
My final grade: 95%.

Monday, July 16, 2012

How to force to update JavaScript and CSS files after deploying new version of ASP.NET MVC application.

Usually after each deployment my ASP.NET MVC (Razor view) site I have a little mess with cached JavaScript and CSS files. Sometimes user's browsers show unappropriated view or some client functionality doesn't work.
Yeah, it is very easy to fix - just clear browser cache or reload JavaScript and CSS files (press CTRL+F5). But I want user to avoid this annoying action moreover not all users are so familiar with PC to know this trick.
My friend Mykhailo found nice solution for this. If I add parameter to JavaScript's url and will change parameter's value after each deployment. Browser will recognize it as other script and will update file.
So now I should add something like "?v=xxxx" to all links of CSS and JavaScript files in my project and keep in mind it for future links. Looks not really smart solution doesn't it?
First of all I want to say that I set JavaScript and CSS files in "Razor" style. For instance:

Wednesday, June 13, 2012

Route of executing in Controller of ASP.NET MVC

Base classes of controller is ASP.NET MVC have number of methods for initialization before your code runs in an action. Lets review them.

  • First of all about constructor. You can't do a lot in it because most of properties aren't initialized yet and you will get NullReferenceException if try to use them.
  • Execute is inherited from IController interface and manages all other initialization methods. Usually you have to avoid override it.
  • Initialize sets ControllerContext. You should to override it if you need to set culture so on.
  • ExecuteCore is called to process request and responsible for loading TempData.
  • If I want to predefine some information (grab data from Session and so on) You should use OnActionExecuting. This methods is called just before executing your action method.
  • And finally you should use OnActionExecuted for any finalization after executing your code. 

PS: During preparing for this post I've used ILSpy. It is excellent free substitute for .NET Reflector (it is payment tool now).

Tuesday, December 27, 2011

Introduction to Artificial Intelligence

Introduction to AI
Some time ago I have joined to Introduction to Artificial Intelligence  it is online course that is based on Stanford CS221, Introduction to Artificial Intelligence.
This class introduced students to the basics of Artificial Intelligence, which included machine learning, probabilistic reasoning, robotics, and natural language processing.
My reason to join this class was simple I wanted to know more. I took 82% it isn't so bad for not native speaker.
If you want to get more you can join a lot of next online courses - http://www.class-central.com/

Tuesday, August 16, 2011

Trouble with resources in WP7

I started a few projects on WP7. It was done just for fun and for improving my skills (Fun was profitable - I won in Ukrainian WP7 competition). So I had completed my projects and tried to localize it.
I met some issues:
  1. If you have experience in developing for web silverlight - first isn't new for you. When I edit/add/remove a item in resources's file I need to open resources designer's file and change access modifiers of parameterless constructor from "internal" to "public".
    It is know issue and know fix - proof.
  2. Second was new for me. It is strange issue because it appeared only in one of my projects. I created resources file and added key in Resources section of app.xaml (for binding to resources in my xaml files). My project started to crash after this.
    I had spent some time and found source of the issue. I noticed that Resource class (auto generated) is internal. I checked "Custom tool" field in properties of resource file. It was filled "ResXFileCodeGenerator" value. In my other projects this field contained "PublicResXFileCodeGenerator" value. I didn't found detailed description of "ResXFileCodeGenerator" but looks like that it is obsolete tool. I no idea how to it was set in my project.
One more note: it is for WP7 without "Mango" update. I hope I will not meet such issues after this update.

Monday, February 7, 2011

Trimmed TextBlock for Windows Phone 7.

Unfortunately WP7 is based on Silverlight 3. So we can't use some nice features of Silverlight 4 i.e. dynamic key word or TextBlock's trimming. But I've solved issue with trimming for Silverlight 3. Solution is here. Let me explain which code I use in WP7 project:
  • Generic.xaml: File contains style and template for custom control. This file is located in Themes folder. WP7 tools doesn't contains Resources.xaml file template. So I created xml file and name it as "Generic.xaml".
  • TrimmedTextBlock.cs: It is implementation of custom control. I just copied this file. One more note: I decrement c_POINTS_COUNT to "1" because screen resolution of desktop and mobile versions are different.
Easy coding.