Tuesday, April 17, 2007

Hey fellows...

I wanted to share you with an event that happened these days, my friend - Oded Balilty won the Pulitzer Prize for his photograph.

This is a great honor also to Oded and as well to Israel state of course.

This photograph displays a lone settler woman defying Israeli security forces, so take a look:

Well done Oded, keep successing alive...

With regards,
Eran

Posted by: Eran Nachum (c)
Post Date: 4/17/2007 11:23:20 AM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #
 Wednesday, April 11, 2007

You can download it, it is ready, right from the oven...

The best thing that I found there is the Validation Application Blocks, which is new and wasn't in the earlier versions.
"Developers can use this application block to create validation rules for business objects that can be used across different layers of their applications." (quoted form the msdn site).

You can find it here: http://msdn2.microsoft.com/en-us/library/aa480453.aspx

Enjoy...

Posted by: Eran Nachum (c)
Post Date: 4/11/2007 10:40:47 AM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #

Hello!

Some intro:
I am starting to migrate a classic asp web application (quite complicated) to .NET 2.0 environment and in the begining (of course) I am starting to learn the functionality of the existing web app.

This morning I came to work and started to rrun the asp web app, but my IIS (5.0) seemed to be dead. I couldn't run anything, even the localhost help page to get some information.

I disabled the "Show friendly HTTP error messages" from the explorer advanced options, and | got this messgae: "The server has encountered an error while loading an application during the processing of your request" - Interesting...

After doing some actions in the IIS, I succeeded solving the problem myself, I just changed the application protection to Low in the virtual directory folder properties.

Some info:
The Application Protection drop-down determines if this IIS Application is to be isolated in its own process, pooled with other apps, or in-process with IIS. This feature comes to give us the ability of isolating applications, configuring them to run in a process (memory space) that is separate from the Web server and other applications. You can configure applications to have one of three levels of application protection: Low, Medium, High.

Another thing is: The application protection determines how memory resources are allocated for ASP pages:

  • Low (IIS Process): this level runs ASP pages using the same resources as the web service. The advantage of the low level is that you are given the most permissions and access. The disadvantage is that if the ASP service fails, the web service will be impacted as well.
  • Medium (Pooled): this level allocates a pool of memory resources used by all ASP pages. The advantage of the medium level is that you control the amount of resources allocated. In addition, if an ASP page causes the ASP service to fail, it does not affect the web service. The disadvantage is that if one site causes the ASP service to fail, all of the ASP pages will fail.
  • High (Isolated): this level allocates a specific amount of memory resources for each ASP application. The advantage to the high level is that if an ASP page causes the ASP service to fail, only that specific site will fail and not the other sites. The disadvantage is that additional resources are used by each individual application pool.

Hope I helped someone...

Posted by: Eran Nachum (c)
Post Date: 4/11/2007 10:34:41 AM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #
 Sunday, March 25, 2007

Hey guys how are you?

I wanted to share you with nice dillema that was raised by one of our team leaders, called: Boaz Davidoff.
He encountered with a situation that he wanted to create new instance of an object that inherits from a parent object (which is no problem right...?), BUT firstly he wanted to initiate some members in the child object before of creating the parent object and just after it to call the parent object constructor.

It turns out that this situation is quite impossible in .NET, because by default, you must call the base ctor firstly and just after it to do your stuff, for an example:

public class A
{
    int a1, a2;

    public A(int a1, int a2)
    {
        this.a1 = a1;
        this.a2 = a2;

        // Do your stuff
    }
}

public class B : A
{
    public B(int b1, int b2) : base(b1, b2)
    {
        // Do your stuff
    }
}

I wanted here, by calling B ctor, to make some manipulations over b1 and b2 (before calling the base ctor), but encountered with a PROBLEM.

So, take a look on this solution:

public static B CreateBObject(int c1, int c2)
{
    // Do some manipulation over c1 and c2

    return new B(c1, c2);
}

private B(int b1, int b2) : base(b1, b2)
{
    // Do the rest of your stuff
}

Some explanations:
I created again B ctor, which the only different from the other B ctor is by that it is private (in other words: this object cannot be initialize from outside this class).
Now, the addition... I added a static method called CreateBObject, which receives the same params, does some manipulation over them, after it calls the B's private ctor and returns B object like we wanted in the first time.

Nice, huhh? I would like to have some comments

p.s.
Thanks Boaz

Posted by: Eran Nachum (c)
Post Date: 3/25/2007 5:33:02 PM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #
 Monday, March 19, 2007

Hello guys, how are you?

In this post I wanted to talk about some code managing. As we all know (the Microsoft environment developers of course...) the 'natural' way, that Microsoft pushes into, that exists (if you are working with Visual Studio) is to work against Visual Source Safe. In all my (3 years) career progress I was working against this tool, which was not so bad, but in fact, it has some disadvantages and problems (do not mention the incidents of code losting and lack of doing merging between code files).

So, let's talk about the SubVersion control system and give some overview about this open source and free product.
'The goal of the Subversion project is to build a version control system that is a compelling replacement for CVS in the open source community. The software is released under an Apache/BSD-style open source license.' (taken from the SubVersion site).

OK, some basics facts:

  1. FREE FREE FREE - As they claims (in the above paragraph) this product is free to use, so you don't need to buy this kind of a tool (if you are lack of money... :))
  2. Directories, renames, and file meta-data are versioned. Lack of these features is one of the most common complaints against each source control. Subversion versions not only file contents and file existence, but also directories, copies, and renames. It also allows arbitrary metadata ("properties") to be versioned along with any file or directory, and provides a mechanism for versioning the `execute' permission flag on files.
  3. Apache network server option, with WebDAV/DeltaV protocol. Subversion can use the HTTP-based WebDAV/DeltaV protocol for network communications, and the Apache web server to provide repository-side network service. This gives Subversion an advantage over CVS in interoperability, and provides various key features for free: authentication, wire compression, and basic repository browsing.

and more...

I found this tool best to use now, because in the existing project that I am working on, the work is also overseas (I am working commonly with developers in the US), and the only tool that provides that is the SubVersion.
Another good thing is that I can get as much as I want a file to work on, and even if another developer is working on it in the same time, at the end of the work SubVersion will know to merge the code in a smart way, which Visual Source Safe run into problems occasionally.

So, if you want to explore some more details about it and download it you can go to the SubVersion site at: http://subversion.tigris.org/

Comments will be appriciated.

Posted by: Eran Nachum (c)
Post Date: 3/19/2007 10:57:22 AM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #
 Thursday, February 15, 2007

Hello!

Long time no seen, yes I know...
It's because I am quite busy at work, we worked at full time job on a very large web project to one of the government offices, but this project is coming to its end.

Now, to our issue...
Firstable some words about the application architecture - the application is devided and built as N-Tier layers, every tier is isolated from the other and lives as a single and separate assembly (.dll).
The tiers are:

  • Entities Layer -  This layer holds and represents the entities of the application, for each database table there is an entity class which holds all its fields as properties by each field specification. This class is a Typed Dataset, that holds all the data and being generated automatically, in addition there is another class that represents a filter in purpose to hold values to filter if necessary.
  • Data Access Layer - Every entity class has a DAL class which implements the main CRUD (create, read, update and delete) methods against the database. For easyer and comfortable working, we are using the SqlHelper of Data Application Blocks v.2.0.
  • Business Logic Layer - This layer holds business logic classes that holds the flows of more comlpexed actions, like transactions, and a working with several tables.
  • Presentation Layer - This layer holds the presentation web pages. All the pages are AJAX fully supported to grant the user the best surfing experience.

OK, after I told you about the architecture I will approach the problem I bumped into.

When I wanted to fill my Typed DataSet using SqlHelper I thought to use the classic method:

UsersDS ds = SqlHelper.ExecuteDataset(con, CommandType.StoredProcedure, StoredProcedures.GetUserById, idParam);

But I encountered with a problem to fill the typed DataSet - UsersDS, this method knows to return a generic DataSet with no specification of the Typed DataSet and it was a problem (but little one... :))

The new change of the Data Application Blocks v.2.0 is that there is the ability of using FillDataSet method which knows to fill the exact Typed DataSet and DataTables that exists in it, and this is going like that:

SqlHelper.FillDataset(con, StoredProcedures.GetUserById, ds, new string[] { "E_Users" }, idParam);

Here, you must specify the Typed DataTable that exist in the Typed DataSet that you want to fill. As you see, we must send it via the method as a string's array, and by that you can send several tables to fill by sending their names.

That's it folks, as usually I will be glad to hear some additions and comments.

Posted by: Eran Nachum (c)
Post Date: 2/15/2007 10:48:22 AM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #
 Thursday, December 28, 2006

Some of the impovments with that service pack are:

1. Refactoring performance in ASP.NET WebSites projects like:
    Before determining if an .aspx page should be loaded, the refactoring operation will:

      Perform a lexical search on the element that is being refactored to determine if it exists in an .aspx page.
      •

Determine if a reference is accessible from the current scope.

2. Web Site Projects and Web Application Projects general issues:
    The Web Applications project system does not detect missing web.config files. Adding a control that requires configuration information will cause a false folder to appear in Solution Explorer. The workaround is to add a web.config file manually before you add any controls to a Web Application project.

   Web Application projects that contain subprojects that reference controls in the root project may hang the IDE.

   If a Web site solution that contains .pdb and .xml files is added to TFS source control, the .pdb files and .xml files may not be added correctly.

   Visual Studio will leak memory when you operate a Wizard inside a View inside a Multiview. The workaround is to save the solution and then restart Visual Studio.

   Changes to the bin folder in Web site and Web Application projects can cause Visual Studio to create a shadow copy of the entire bin folder. This copying can slow the performance of Visual Studio and consume disk space.

   If your page and user controls exist in different namespaces that are under the same root namespace, the generated code will not compile because the namespace that the designer creates for the declaration of the user control inside the page is wrong. The workaround is to delete the declaration from the designer file and then put it in the code-behind file. Once it is moved to the code-behind file, it will remain there unaltered even if you change the page.

You can download it by pressing this link: http://www.microsoft.com/downloads/details.aspx?familyid=BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&displaylang=en

Posted by: Eran Nachum (c)
Post Date: 12/28/2006 12:29:42 PM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #
 Thursday, November 23, 2006

Hey guys how are you?

After long conversation with my work colleague, I thought that I need to sharpen the evidences about Application Domains - aka AppDomain.

By .NET environment, the concept of an application domain, or AppDomain known as a process. The AppDomain is both a container and a boundary. The .NET runtime uses an AppDomain as a container for code and data, just like the operating system uses a process as a container for code and data. As the operating system uses a process to isolate misbehaving code, the .NET runtime uses an AppDomain to isolate code inside of a secure boundary.

An AppDomain belongs to only a single process, but single process can hold multiple AppDomains. An AppDomain is relatively cheap to create (compared to a process), and has relatively less overhead to maintain than a process. For these reasons, an AppDomain is a great solution for the ISP who is hosting hundreds of applications. Each application can exist inside an isolated AppDomain, and many of these AppDomains can exist inside of a single process – a cost savings.

Lets take an example from the REAL life:
Assume that you had created 2 ASP.NET aplpications in the same server, what will happen intior the system?

Firstable, the ASP.NET process that runs the web application will run both the applications (you can find the process name in the task manager as aspnet_wp.exe in Windows XP or as w3wp.exe in Windows 2003. Each application will have its own AppDomain including its Cache, Application, and Session objects.
BUT, the code of the same application runs under the same process!

What about static members or shared classes? In this case, each ApDomain will have its own copy of the static members (fields), but of course, the data and code is not shared and will be held safely isolated and inside of a boundary provided by the AppDomain.

Load some new assemblies..
Suppose you want to load an updated dll into the application folder or subdirectory, the ASP.NET runtime will recognize it and and will start a new AppDomain because it cannot insert it to the running AppDomain, the result is that running requests will finish its work and after it they will work against the new AppDomain that holds the new dll and executing code.

Last word...
I think that one of the good adventages of the AppDomain is that you can allocate the wanted memory for your application (under its AppDomain) as much as you want (bounded by the process capability of course) and if there is a runtime crash, the rest of the applciations that runs over the current process will not crash.

I will glad to hear some comments and additions... :)

Posted by: Eran Nachum (c)
Post Date: 11/23/2006 3:03:00 PM (Jerusalem Standard Time, UTC+02:00)
Disclaimer | | Trackback   #