Thursday, May 26, 2011

.NET Framework 4 offers great multi threads tools and new API to handle the usage of it. One of them is the Parallel.Foreach method, which executes a foreach (For Each in Visual Basic) operation in which iterations may run in parallel. (You can see a good example of usage here on the MSDN website).

This method “makes life easy” in order to enable data parallelism over any System.Collections.IEnumerable or System.Collections.Generic.IEnumerable<T> data source.

On the other side, I am still working and maintaining some projects that had been coded using .NET 3 (C# 3.5) and in order to perform multi-threading processes there is a need to use some other complex API and manage it, such as: ThreadPool (in order to manage a pool of threads that can be used to post work items, process asynchronous I/O, wait on behalf of other threads, and process timers), WaitHandle which encapsulates operating system–specific objects that wait for exclusive access to shared resources, etc…

While reading some tech posts lately, I bumped into a great post that outline an implementation of this Parallel.Foreach method. You can find it in the link below and I think that it could make your life much more easier in order to perform and take advantage of multi-core processors and execute foreach loops in parallel.

Get it from here.

.NET 4 | C# | C# 3.5
Posted by: Eran Nachum (c)
Post Date: 5/26/2011 5:05:00 PM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #
 Sunday, April 10, 2011

Hi,

Scott Guthrie revealed these days the IIS Express that comes along the VS 2010 Service Pack 1.

I found very good things and improvements under this SP, but no doubt IIS Express is the best one of all the improvements list.

IIS Express is coming to replace the ASP.NET Development Server that enables you a local (VS env) we application hosting in order to server your ASP.NET code application.

The major improvements are:

  • It’s lightweight and easy to install (less than 5Mb download and a quick install)
  • It does not require an administrator account to run/debug applications from Visual Studio
  • It enables a full web-server feature set – including SSL, URL Rewrite, and other IIS 7.x modules
  • It supports and enables the same extensibility model and web.config file settings that IIS 7.x support
  • It can be installed side-by-side with the full IIS web server as well as the ASP.NET Development Server (they do not conflict at all)
  • It works on Windows XP and higher operating systems – giving you a full IIS 7.x developer feature-set on all Windows OS platforms

My best one is the SSL support improvement. IIS Express enables you to provide an SSL based application and doesn’t ask you to install the SSL certificate because it uses the self signed certificate that comes with the IIS Express setup.

More details here.

VS 2010 | IIS
Posted by: Eran Nachum (c)
Post Date: 4/10/2011 4:31:00 PM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #
 Monday, April 04, 2011

Hi,

I read a great post in the ADO.NET team blog in regards using the new EF 4 as a Unit of Work design pattern.

The main idea under this solution is to maintain all data manipulations against the DataBase easily and transactional, by encapsulating all data manipulation on POCO objects under a single DataContext and a single Save method.

This mechanism is usually recommended when working with asp.net MVC patterns, which each of the views is working with its specific controller that communicates with its model that implemented as a Repository pattern that exposes an interface of all methods signatures.

You can impress the post here.

Posted by: Eran Nachum (c)
Post Date: 4/4/2011 8:16:00 PM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #
 Monday, June 28, 2010

Great post in regards asp.net & Json.

I wasn’t familiar with System.Web.Script.Serialization.JavaScriptSerializer which provides serialization and deserialization functionality for AJAX-enabled applications.

While searching the web in regards this issue, I bumped into a great post that outlines the usage of this namespace.

You can check it out here.

Good Luck.

ASP.NET | C# | JSON
Posted by: Eran Nachum (c)
Post Date: 6/28/2010 4:34:00 PM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #
 Tuesday, June 22, 2010

A great post that stands over the subtleties regards these two iteration possibilities here.

At the end of the day it seems that if you want to store objects of structs (primitive types such int, long etc…), in a generic List, you should use normal foreach (or for) instead if you want to avoid problems. Also removing items in the ForEach method is a thing which should be avoided also when it is possible. Otherwise i promise, the time will come when someone copies you code uses the ForEach to add items instead of removing it!

C#
Posted by: Eran Nachum (c)
Post Date: 6/22/2010 7:45:00 PM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #
 Monday, June 21, 2010

It’s almost a year I didn’t post here something, I know – I has lots of things over my head – mostly work…

As I posted here earlier, we used asp.net MVC 1.0 framework to develop the BackOffice web application of out product at work, and these days I am doing some POC regards the new MVC version (#2) that came official like 2 months ago to check out if there are some improvements to the previous version and if there’s a way to assimilate it easily.

I have to say that developing with asp.net MVC (1.0) is different than classic asp.net webforms, and mostly has benefits over it, especially the Unit testing that became very easy to write and test the controller BL actions and logic.

Until the next post regards asp.net MVC 2, I am attaching a great link that will make order to whom is new to MVC.

http://www.howmvcworks.net/Home/Topics

I will post you soon with asp.net MVC 2 post.

Posted by: Eran Nachum (c)
Post Date: 6/21/2010 5:50:00 PM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #
 Sunday, August 02, 2009

Come and read and post in regards this issue at allrise.com.

There are some nice arguments there.

This is the Previewed case widget:

Posted by: Eran Nachum (c)
Post Date: 8/2/2009 11:29:00 AM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #
 Thursday, June 25, 2009

To all of you that are new to NHibernate or just curious about this question, the quick answer to that question is because we need members to be virtual in order to do lazy loading action.

More detailed post is here: Must Everything Be Virtual With NHibernate?

Posted by: Eran Nachum (c)
Post Date: 6/25/2009 8:29:00 PM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #