# Development World

New Development Technologies , Computer Last News , Tips & Tricks , UI , CSS , HTML , ASP , C# , .net Framework , Patterns & Practices & etc

## Top 100 Best Software Engineering Books, Ever

In this post I proudly present the Top 100 of Best Software Engineering Books, Ever. I have created this list using four different criteria: 1) number of Amazon reviews, 2) average Amazon rating, 3) number of Google hits and 4) Jolt awards. Please refer to the bottom of this post to find out how I performed the calculations, how to receive the full top 100 list in PDF MS Word, and why that obscure and silly little publication of yours has not made it on my list.

1 Steve McConnell
Code Complete: A Practical Handbook of Software Construction

2 Elisabeth Freeman, etc.

3 Steve McConnell
Rapid Development

6 Robert C. Martin
Agile Software Development: Principles, Patterns and Practices

7 Joel Spolsky
Joel on Software

8 Tom DeMarco, Timothy Lister
Peopleware: Productive Projects and Teams (2nd Edition)

9 Frederick P. Brooks
The Mythical Man-Month, Anniversary Edition (2nd Edition)

10 Martin Fowler
Refactoring: Improving the Design of Existing Code

11 Mike Cohn
Agile Estimating and Planning

12 Alistair Cockburn
Writing Effective Use Cases

13 Bertrand Meyer
Object-Oriented Software Construction (2nd Edition)

14 Steve McConnell
Software Estimation: Demystifying the Black Art

17 Martin Fowler
Patterns of Enterprise Application Architecture

18 Jeffrey Friedl
Mastering Regular Expressions

19 Andrew Hunt, David Thomas
The Pragmatic Programmer: From Journeyman to Master

20 Karl E. Wiegers
Software Requirements (2nd Edition)

21 Craig Larman
Applying UML and Patterns (3rd Edition)

22 Alistair Cockburn
Agile Software Development: The Cooperative Game (2nd Edition)

23 Gary McGraw
Software Security: Building Security In

24 Gregor Hohpe, Bobby Woolf
Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions

25 Tom DeMarco

26 Craig Larman
Agile and Iterative Development: A Manager's Guide

27 Eric A. Marks, Michael Bell
Service-Oriented Architecture: A Planning and Implementation Guide for Business and Technology

28 Thomas H. Cormen, etc.
Introduction to Algorithms, Second Edition

32 Alan Shalloway, James Trott
Design Patterns Explained: A New Perspective on Object-Oriented Design (2nd Edition)

Object-Oriented Analysis and Design with Applications (3rd Edition)

34 Jim Highsmith
Agile Project Management: Creating Innovative Products

35 Scott Berkun
Making Things Happen: Mastering Project Management

36 Jon Bentley
Programming Pearls (2nd Edition)

37 Paul Duvall, etc.
Continuous Integration: Improving Software Quality and Reducing Risk

38 Andrew Stellman, Jennifer Greene
Applied Software Project Management

39 Clemens Szyperski
Component Software: Beyond Object-Oriented Programming

40 Arthur J. Riel
Object-Oriented Design Heuristics

41 Thomas Erl
SOA Principles of Service Design

42 Mary Poppendieck, Tom Poppendieck
Lean Software Development: An Agile Toolkit

43 Ken Schwaber
Agile Project Management with Scrum

44 Ken Schwaber, Mike Beedle
Agile Software Development with Scrum

45 Joshua Kerievsky
Refactoring to Patterns

46 Alistair Cockburn
Crystal Clear: A Human-Powered Methodology for Small Teams

47 Steve McConnell
Software Project Survival Guide

48 Tom DeMarco, Timothy Lister
Waltzing With Bears: Managing Risk on Software Projects

49 Venkat Subramaniam, Andy Hunt
Practices of an Agile Developer: Working in the Real World

50 Kathy Schwalbe
Information Technology Project Management

51 Randall Hyde
Write Great Code: Volume 1: Understanding the Machine

53 Cem Kaner, etc.
Lessons Learned in Software Testing

54 Andy Oram, Greg Wilson
Beautiful Code: Leading Programmers Explain How They Think

58 Michael Feathers
Working Effectively with Legacy Code

59 Kent Beck
Test Driven Development: By Example

60 Per Kroll, Philippe Kruchten
The Rational Unified Process Made Easy: A Practitioner's Guide to the RUP

62 Cem Kaner, etc.
Testing Computer Software (2nd Edition)

63 Frank Buschmann, etc.
Pattern-Oriented Software Architecture Volume 1: A System of Patterns

64 Harold Abelson, Gerald Jay Sussman
Structure and Interpretation of Computer Programs - 2nd Edition

65 Dan Pilone
UML 2.0 in a Nutshell

66 Brett D. McLaughlin, etc.
Head First Object-Oriented Analysis and Design

67 Johanna Rothman
Manage It!: Your Guide to Modern, Pragmatic Project Management

68 James Shore, Shane Warden
The Art of Agile Development

69 Brian W. Kernighan, Rob Pike
The Practice of Programming

70 Ron Jeffries, etc.
Extreme Programming Installed

71 Scott W. Ambler, Pramodkumar J. Sadalage
Refactoring Databases: Evolutionary Database Design

72 Jared Richardson, William Gwaltney
Ship it! A Practical Guide to Successful Software Projects

73 Greg Hoglund, Gary McGraw
Exploiting Software: How to Break Code

74 Michael Nygard
Release It!: Design and Deploy Production-Ready Software

75 Edward Yourdon
Death March (2nd Edition)

76 ???
Alright, I tricked you. Shame on me! The remaining 25 positions of the list are only available when you request the full PDF MS Word version. Don't worry, it's free! See below...

Scope of the Project
For this Top 100 list I have included only books covering subjects found in the Software Engineering Body of Knowledge (SWEBOK). This means that I have left out books with main topics such as web design, computer science, business management and system administration. The main reason being that I had to limit the scope, or I would never be able to finish the bloody thing. It means you will not find classics such as About Face, Don't Make Me Think!, Machine Learning, Neural Networks, Business Dynamics, Data Mining, Secrets and Lies and Hacking. (Sorry people, maybe some other idiot with time on his hands wants to pick that up...)

I also excluded all books that dealt with specific technologies, such as Java, .NET, Ruby, PHP, and BoogieWoogie 3.1. I was only interested in the potentially timeless software engineering classics. Technology books don't fall into that category. And I did include books on project management (as project management is one of the competences in SWEBOK) but only when those books explicitly dealt with managing software development. (That's why you won't see any generic PMP-related stuff on the list.)

Finding the Books
To find all these potentially timeless classics, I checked the best-selling books in these five Amazon categories:

After I found all best-selling software engineering books, I subsequently found many other books through the "Customers Who Bought This Item Also Bought" cross-reference thingy. That's how I finally ended up with a list of 250 books, and a headache the size of one of Jupiter's moons.

Doing the Calculations
Then it was time to do the calculations. I checked the number of customer reviews on Amazon, and I ranked the books according to these numbers (= a measure of quantity). I also calculated the average Amazon ratings, and I ranked the books according to these ratings (= a measure of quality). I then checked the number of Google hits for each of the books, and I ranked them accordingly (= a measure of popularity). Finally, I took the three rankings, added extra points for all winners of Jolt awards, and then re-calculated it into a final ranking. This resulted in the list you now have before you.

I can guarantee that the system I used is scientifically incorrect and artistically atrocious! Nevertheless, the results are quite interesting, and I'm sure this list can be of great help if you want to broaden your knowledge of the field of software engineering, in all its exciting dimensions. I suggest you start with number 1, and then slowly work you way down. It shouldn't take you more than a couple of years.

Now, I'm sure you will understand that the creation of this list cost me many hours of work, some sleepless nights, and a couple of broken relationships. If you think the list is interesting, or even valuable, then I suggest you digg, stumble and bookmark the hell out of it! This is the first time I honestly think I deserve it. On the other hand, if you don't like the outcome, and you've got something to complain about, don't hesitate to let me know. I'll do my best to think of some innovative ways of ignoring you.

Furthermore, if you want to receive a PDF MS Word version with the full Top 100 list, including ISBN-numbers, release dates, Amazon ratings and Jolt awards, then you can send me an email and simply ask for it. I like getting email. And it will help your request tremendously if you told me that you've subscribed to my blog/feed. And don't you dare lying about it! I'll be monitoring the feed statistics actively, so I know it when you people are playing me false.

(Oh, and please allow me at least 24 hours to reply to your mail. I might be trying to recover from the hours of sleep I lost...)

نویسنده : Nasser Hajloo : ۱۱:۱۳ ‎ق.ظ ; ۱۳۸٧/٥/٢٩
پيام هاي ديگران ()      لینک دائم

## How To Create a Custom Control for Geting and Setting Browser Scrollbar Position

In Part 1 of this article we looked at the client-side JavaScript necessary for maintaining scroll position across postbacks. In this second and final part, we'll see how to create a custom server control to emit the proper JavaScript.

Generating the Appropriate JavaScript with a Custom Server Control
At this point we've seen what client-side JavaScript code is needed in order to persist scroll position across postbacks. One option would be to manually add this JavaScript code to each and every page that needed to maintain scroll position. However, by wrapping this markup in a custom, compiled server control, we can easily reuse this functionality by simply plopping down the server control on those pages that need to utilize this functionality. To make this vision a reality, I created a control called SmartScroller (whose code is available at the end of this article).

I decided to place my SmartScroller control in a namespace called sstchur.web.SmartNav. Since this control does not have any visual display, but rather just emits JavaScript and a couple of hidden <input> fields, I had SmartScroller derive from System.Web.UI.Control rather than System.Web.UI.WebControls.WebControl. The following shell of my code shows this, along with SmartScroller's single member variable, m_theForm, which we'll discuss in more detail shortly.

  using System; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI; namespace sstchur.web.SmartNav { public class SmartScroller : System.Web.UI.Control { private HtmlForm m_theForm = new HtmlForm(); public SmartScroller() { } ... } } 

As you'll recall from our examination of the JavaScript code, we need to be able to reference the ID of the Web Form in order to access the values of the hidden <input> fields in script. Therefore, from our server-side code we need to be able to determine the Web Form's ID, meaning we have to first find the Web Form. To my knowledge, there's no way to easily access the HtmlForm class instance in a WebForm short of recursing through the control hierarchy. The SmartScroller control contains a GetServerForm() method that does just this:

  private HtmlForm GetServerForm(ControlCollection parent) { foreach (Control child in parent) { Type t = child.GetType(); if (t == typeof(System.Web.UI.HtmlControls.HtmlForm)) return (HtmlForm)child; if (child.HasControls()) return GetServerForm(child.Controls); } return new HtmlForm(); } 

This method is called from the OnInit() method like so: m_theForm = GetServerForm(Page.Controls); This will start searching for the HtmlForm starting from the top of the control hierarchy. Once it is found, it is assigned to the private member variable m_theForm. (GetServerForm() works via a process known as recursion; for more information on recursion be sure to read Recursion, Why It's Cool.)

The next thing we need to do is override the OnInit() method, which is where we emit some Javascript code responsible for handling the smart scrolling. You'll notice the JavaScript emitted in OnInit() is the same as we examined earlier in this article.

  protected override void OnInit(EventArgs e) { m_theForm = GetServerForm(Page.Controls); HtmlInputHidden hidScrollLeft = new HtmlInputHidden(); hidScrollLeft.ID = "scrollLeft"; HtmlInputHidden hidScrollTop = new HtmlInputHidden(); hidScrollTop.ID = "scrollTop"; this.Controls.Add(hidScrollLeft); this.Controls.Add(hidScrollTop); string scriptString = @" "; Page.RegisterStartupScript("SmartScroller", scriptString); } 

The first step in this function is to grab the server side form, and we do this by calling our recursive GetServerForm() function, passing in the Page.Controls collection. This tells the function to start looking for the server form at the top-most level of controls. After we've got our server side form, we need to create two hidden <input> form fields to store the coordinates of the scroll bar at any given moment. We assign logical IDs to them - scrollTop and scrollLeft and then add them to our SmartScroller control collection.

The next step is to write the Javascript that handles the smart scrolling. The JavaScript code is stored in the variable scriptString, which is then added to the page through a call to Page.RegisterStartupScript(). The Page class contains a number of methods to emit client-side script (such as RegisterStartupScript()). For more information on injecting client-side script into a Web page from server-side code be sure to read Scott Mitchell's article Working With Client-Side Script.

That's all there is to the OnInit() method. There is one final piece of the puzzle that needs to be put into place: the Render() method of the SmartScroller ASP.NET server control. This Render() method simply ensures that the control is being rendered inside of a Web Form. It does this by calling the Page class's VerifyRenderingInServerForm() method. This method checks to see if a Web Form exists on the page - if it doesn't, it raises an exception.

  protected override void Render(HtmlTextWriter writer) { Page.VerifyRenderingInServerForm(this); base.Render(writer); } 

Using the SmartScroller Control in an ASP.NET Web Page
Using SmartScroller in an ASP.NET Web page couldn't be easier. If you are using Visual Studio .NET, you can simply add SmartScroller to the Toolbox by right-clicking on the Toolbox, selecting to Add/Remove Items, and browsing to the SmartScroller assembly. If you are not using Visual Studio .NET, you'll need to add the SmartScroller assembly to your Web application's /bin directory and then add a @Register directive to the top of your page that looks like:

 <%@ Register TagPrefix = "sstchur" Namespace = "sstchur.web.SmartNav" Assembly = "sstchur.web.smartnav" %>

 

A complete example (and live demo) can be seen below:

  <%@ Register TagPrefix = "sstchur" Namespace = "sstchur.web.smartnav" Assembly = "sstchur.web.smartnav" %> <%@ Page Language = "C#" %>


[View a Live Demo!]

I've put all those <br> tags in just so the page will scroll for us. When visiting the live demo, be sure to scroll down to one of the Button Web controls and click it. Doing so will cause a postback, but you'll note that on postback your browser will retain the current scroll position, rather than starting back up at the top of the page.

Conclusion
Having the browser retain its scrollbar position may not seem like a terribly important thing to spend your time and efforts trying to accomplish, but trust me, it's really, really annoying when you click on a link of a question in a FAQ and expect its answer, only to be launched way back to the top of the page. It's enough to make me say "forget it" and go some place else to find my answer.

As we saw in this article, creating a custom server control allows for us to enable scroll retention by simply adding a Web control to the page - all you have to do is plug it in to any server-side form, and you're good to go. That's pretty minimal effort. If you're concerned about Javascript errors in browsers that may not support some of the functions we used, you can also modify the code to suit your needs. I'm sure you can think of plenty of way to make this control more robust. Feel free to email me with whatever you come up with (n.hajloo@gmail.com)!

Happy Programming!

نویسنده : Nasser Hajloo : ٥:٥۳ ‎ب.ظ ; ۱۳۸٧/٥/٢٦
پيام هاي ديگران ()      لینک دائم

## ( Development World ) Hajloo's Blog Join Technorati

Hajloo's Blog ( Development World ) Join Technorati , Now You can follow this blog on Technorati .

Hajloo's Profile On Technorati

نویسنده : Nasser Hajloo : ٥:۳٩ ‎ب.ظ ; ۱۳۸٧/٥/٢٦
پيام هاي ديگران ()      لینک دائم

## How to Set or Get Browser ( IE | Firefox | Safari | ... ) Scrollbars Position

Introduction
A few months ago, I was asked by my company to post a list of frequently asked questions about our software on our Support Site. I figured this would be a cinch and said "sure, send me the questions and I'll take care of it." Little did I know that we had so many questions in our FAQ list, but I figured "ok, this is just more tedious than anything -- still not terribly difficult." I set about trying to come up with a way to display the questions in a neatly readable fashion, but I was disappointed with virtually every layout that I tried. I thought about it for a bit and came to the conclusion that it would be nice if I displayed only the questions (not the answers) at first. Then, once a question was clicked, it's answer would appear directly beneath the question, pushing all subsequent questions down on the page.

Armed with my new plan, I figured "great, this should be no problem with a little bit of C# code and some server side ASP.NET Panels." To make this concept a bit more reusable, I decided to wrap it up into an ASP.NET server control that I called SlinkyList (because it expands and contracts as you click on the various links). It didn't take too long to get the control written, and initially I was very pleased with it, but then I ran into another problem: since the code that would show/hide the panels executed server-side, this meant that the page would postback each time a question link was clicked. The main problem with this technique was that when a user scrolled down to the bottom of the FAQ and clicked on a question link, the page would postback, and the question's answer would indeed expand, but due to the page postback, the browser would automatically reset the scroll bar to the top of the page. Thus, the answer that had just been expanded was still essentially invisible.

This was clearly not a very user friendly and, as far as I was concerned, totally unacceptable. I did a small bit of research and found out that ASP.NET offers a means to retain scroll position through a mechanism called SmartNavigation. To enable SmartNavigation on a page, you only have to add an attribute to the @Page directive like so: <%@ Page SmartNavigation = "true" %>. But, can you guess that problem with this solution? It only works with Internet Explorer 5.5 or later. Also, many others have reported "issues" with SmartNavigation.

Eventually I came up with a simple solution for maintaining scroll position, one that works in a myriad of browsers. My technique involves the use of a simple custom control, SmartScroller, that will automatically persist scroll position across postbacks once this control is added to a Web Form. (You can check out a live demo to see it in action.) In this article we'll look at how to use SmartScroller, as well as the control's source code.

A Technique for Maintaining Scroll Position
Modern browsers provide properties to determine the horizontal and vertical scroll positions, as well as functions to automatically set the scroll position. These properties and functions can be accessed through client-side JavaScript code. In order to maintain scroll position across postbacks, what we need to do is the following:

1. Whenever the scroll position changes, we need to record the new scroll position in hidden <input> fields.
2. When the Web Form is posted back, these hidden <input> field values will be sent back to the Web server along with the other form fields. In our server-side code, we need to send back client-side code that sets the browser's scroll position to this sent-back scroll position value.

Through this mechanism we can maintain scroll position across postbacks. However, accomplishing this presents a couple of challenges:

1. How do we determine from client-side code when the browser's scroll position changes?
2. What client-side code is needed so that this technique is compatible with the widest array of browsers?
3. How do we have our server-side code pick out the old scroll values and emit the right client-side code to "reset" the page back to the previous scroll position?

Before we answer these questions, let's first take a look at what client-side JavaScript is needed in order to accomplish maintenance of scroll position:

 

Let's step through this code, starting with the sstchur_SmartScroller_GetCoords() function. The purpose of this function is to grab the current position of the scrollbars (both vertical and horizontal). We start by defining a variable to hold each value, scrollX and scrollY. Next we have a couple of conditional statements to handle browser compatibility issues. The first condition checks to see if we are dealing with Internet Explorer, as document.all is an object specific to IE. So, if document.all exists, the conditional will pass and we'll fall into the body of the if statement. Now, not all versions of IE report the scroll position in the same manner. Therefore, I have another set of conditionals that check whether the version of IE uses document.documentElement.scrollLeft/scrollTop or document.body.scrollLeft/scrollTop. If we're not dealing with Internet Explorer, then virtually every other major browser handles the scroll bar position in the same way: window.pageXOffSet and window.pageYOffset.

Once we've got the scroll position captured in variables, we need to write these values to the hidden <input> fields so they can be retrieved on a post back. The names of the hidden <input> fields are xCoordHolder and yCoordHolder, as we'll see shortly.

Once we've got the values stored in the Hidden Text Fields, we're finished with the GetCoords() function. Next up is the sstchur_SmartScroller_Scroll() function. This function is considerably simpler, and is executed when the page loads, resetting the scroll position to the position prior to the last postback. To accomplish this, all we have to do is get the values we just stored in the hidden <input> fields and then call the window.ScrollTo() function to automatically scroll the window to the correct position.

The last bit of JavaScript content specifies on what client-side events to call these two functions. We obviously want to reposition the scroll bars when the page loads, so we instruct that sstchur_SmartScroller_Scroll() be called when onload event fires - window.onload = sstchur_SmartScroller_Scroll;. The remaining JavaScript ties three client-side events to the GetCoords() function:

• onscroll - this event fires whenever the scroll position in the browser is changed. You'd think this would be the only event needed, but in my testing some browsers didn't fire this event when scrolling with the keyboard. So I also add:
• onkeypress - this event fires when any key on the keyboard is clicked. Further testing revealed that some browsers made a distinction between scrolling by clicking and dragging the scroll bars, so to be on the safe side I also added this event:
• onclick - this event fires whenever the mouse is clicked in the browser's window.

Now, I know what you might be thinking: Isn't that overkill? I mean, we're potentially capturing the scroll bar position at times when it's not even changing (if you click in white space for example) or if you push the tab key to move around a Web Form. That's certainly true, but our options are limited, since the onscroll client-side event does not fire predictably for all browsers. Others have utilized different techniques for recording scroll position; for example, in Justin Lovell's article Keeping Scroll Positions Over Postbacks, he uses a JavaScript timer to record the scroll positions 100 times a second.

Now that we've taken a look at the required JavaScript, let's turn our attention to providing an easily, maintainable mechanism for having pages automatically persist their scroll position across postbacks. In Part 2 we'll look at creating a custom server control that provides this functionality by simply dragging and dropping a control onto a Web Form.

نویسنده : Nasser Hajloo : ٥:٠٦ ‎ب.ظ ; ۱۳۸٧/٥/٢٦
پيام هاي ديگران ()      لینک دائم

## How To Implement a Single DLL for each Localized Language (Satellite Assembly)

Dear Friends , Recently I'd a problem with Resource files, I wanted to create a single DLL for each local language in my application , by default microsoft visual studio , create a seperate resource file per App_localResources folder in application , ( all resource files in a app_LocalResources , merged in a single dll , it's redo for all foبlders ) .

this is not but in common , but if you deploy application per week , or in a small time stamp , you'll get headech!! , becouse of the big time that will take resource file deploy , ( in my application more than 20 minutes it waste time ) .

I check for a solution that once deploy resources , and never build them after that , there is some way and the best one is to use Sattellite assembly , I'd read a good article on , how to create a satelite assembly for each local language , and enjoy it , now I want to share it with you ,

the article provided with Francesco Balena in : http://visualstudiomagazine.com/columns/article.aspx?editorialsid=1932

---------------------------------------------------------------------------------------------------------

Use Satellite Assemblies for Localized Resources
Once you know how to add a resource file to your project, you're ready to use satellite assemblies to hold all the strings and other resources that your main application uses, such as images and WAV files. You must mark satellite assemblies with an AssemblyCulture attribute and avoid placing any executable code in them. The name of a compiled satellite assembly should include the .resources word (as in MyApp.resources.dll for a main assembly named MyApp.dll).

You can create one or more satellite assemblies with localized resources from inside VS.NET. In this example, you'll create a satellite assembly holding Italian resources for an application named MyApp. First, create a new class library project either in the same solution as the main application or in a different solution. The name of this project isn't important, but you might want to use a name formed by appending the name of the main project and the culture identifier. For example, you might name the project MyApp_it_IT, because the satellite assembly will contain resources for the it-IT culture. Delete the Class1.vb or Class1.cs file that .NET creates for a class library project.

Go to the General page of the new project, change the assembly name to match the name of the main application (MyApp, in this example), and change the default namespace (C#) or the root namespace (Visual Basic) to match the default or root namespace of the main application. In general, the namespace should match your company's name (in this example, it's CodeArchitects).

Go to the Build page of the Project Properties dialog box, and change the Output path value to point to the subdirectory where you create the main application's assembly. For example, if the main project is stored in the C:\Projects\MyApp folder, the output directory for both the main executable and its satellite assemblies should be C:\Projects\MyApp\bin.

Next, add an AssemblyCulture attribute that specifies the culture of the satellite assembly in the AssemblyInfo.vb or AssemblyInfo.cs file:

' [Visual Basic]
<Assembly: AssemblyCulture("it-IT")>

// [C#]
[assembly: AssemblyCulture("it-IT")]

Now you're ready to add one or more resources to the satellite assembly, by following the procedure outlined in the "Don't Burn Strings in Code" section. However, it's essential that all the RESX files you create embed the culture name in their name. For example, a file containing all the Italian strings should be named Strings.it-IT.resx. Don't place the resource file in a C# project subfolder, because this action affects the name you use to reference the resource file.

Now you can compile the satellite assembly as usual. VS.NET recognizes the AssemblyCulture attribute and correctly creates an assembly named MyApp.resources.dll. This assembly is created in a subdirectory named after the assembly culture, under the output folder. In this example, the path of the folder is C:\Projects\MyApp\bin\it-IT. The .NET runtime will look for Italian resources in this folder.

Notice that Visual Studio .NET also creates the "standard" MyApp.dll assembly in the output folder (C:\Projects\MyApp\bin, in this example). This assembly contains no code and no resources, and you can delete it before deploying the application.

You can go back to the main application and run the same code used to read a resource from a resource file embedded in the main application (see Listing 1). If the code is running under an Italian version of Windows, or if you've changed the locale assigned to the current UI thread to request Italian resources, then the ResourceManager uses the resources stored in the satellite assembly in the it-IT subdirectory.

A direct consequence of the way the ResourceManager object looks for resources is that resources related to the default locale are located only after checking that no subdirectory for that culture exists. This means, for example, that all the resources for an application whose default culture is en-US are loaded only after checking that no en-US folder exists under the app's main directory.

You can avoid this little overhead by applying the NeutralResourcesLanguage attribute to the main assembly to inform the resource manager about the language for the neutral resources that are embedded in the main assembly:

' [Visual Basic]
<Assembly: _
NeutralResourcesLanguage("en-US")>

// [C#]
[assembly:
NeutralResourcesLanguage("en-US")]

Bear in mind that you should never use AssemblyCultureAttribute in the main assembly. The main assembly should contain only neutral resources—that is, strings and bitmaps related to the default language.

-----------------------------------------------------------------------------------------------------------

also there is another good article on localization , that I read at : http://edndoc.esri.com

### Using resources with localization

This section explains how you can localize resources for your customizations.

#### How to use resources with localization

In .NET, a combination of a specific language and country/region is called a culture . For example, the American dialect of English is indicated by the string "en-US", and the Swiss dialect of French is indicated by "fr-CH".

If you want your project to support various cultures (languages and dialects), you should construct a separate .resources files containing culture-specific strings and images for each culture.

When you build a .NET project that uses resources, .NET embeds the default .resources file in the main assembly. Culture-specific .resources files are compiled into satellite assemblies (using the naming convention <Main Assembly Name>.resources.dll) and placed in subdirectories of the main build directory. The subdirectories are named after the culture of the satellite assembly they contain. For example, Swiss-French resources would be contained in an fr-CH subdirectory.

When an application runs, it automatically uses the resources contained in the satellite assembly with the appropriate culture. The appropriate culture is determined from the Windows settings. If a satellite assembly for the appropriate culture cannot be found, the default resources (those embedded in the main assembly) will be used instead.

A developer sample with localization

The Visual Basic .NET and C# flavors of the Pan Tool developer sample illustrate how to localize resources for German language environments.  The sample can be found in the Developer Samples\ArcMap\Commands and Tools\Pan Tool folder. Strictly speaking, the sample only requires localized strings, but the images have been changed for the "de" culture as well, to serve as illustration.

A batch file named buildResources.bat has been provided in the Pan Tool sample to facilitate creating the default .resources files and the culture-specific satellite assemblies. See the following sections for more information on creating your own .resx and .resources files.

#### Embedding a default .resources file in your project

1. Right-click the project name in the Solution Explorer, click Add, then click Add Existing Item to navigate to your .resx or .resources file.
2. In the Solution Explorer, choose the file you just added and press F4 to display its Properties.
3. Set the Build Action property to Embedded Resource.

This will ensure that your application always has a set of resources to fall back on if there isn�t a resource DLL for the culture your application runs in.

#### Creating .resources.dll files for cultures supported by your project

1. First, ensure you have a default .resx or .resources file in your project.
2. Take the default .resx or .resources file and create a separate localized file for each culture you want to support.
• Each file should contain resources with the same Names; the Value of each resource in the file should contain the localized value.
• Localized resource files should be named according to their culture, for example, <BaseName>.<Culture>.resx or <BaseName>.<Culture>.resources.
3. Add the new resource files to the project, ensuring each one has its Build Action set to Embedded Resource.
4. Build the project.

The compiler and linker will create a separate satellite assembly for each culture. The satellite assemblies will be placed in subdirectories under the directory holding your main assembly. The subdirectories will be named by culture, allowing the .NET runtime to locate the resources appropriate to the culture in which the application runs.

The main (default) resources file will be embedded in the main assembly.

نویسنده : Nasser Hajloo : ۳:٥٢ ‎ب.ظ ; ۱۳۸٧/٥/۱٧
پيام هاي ديگران ()      لینک دائم

## How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX

Most annoying issue with MS ASP.NET 2.0 Ajax  1.0 is the error Sys.WebForms.PageRequestManagerParserErrorException that will crash the web app. I found a great article from Eilon Lipton http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx to help you avoid the error.

You will encounter this issue when  mixing callbacks and postbacks, as callbacks do not use Response.Write and there is not complete Requests to the server.

This is a bug on the MS ASP.NET 2.0 AJAX 1.0, is not that you are doing something wrong, the framework cannot handle the request validation and the exception is thrown. I  found that you can catch the exception using the Script manager; information about it here: http://alpascual.com/blog/al/archive/2007/03/26/Code-Snip-_2200_Customizing-ScriptManager_2200_-to-detect-errors.aspx

Or better yet, you can disable the error by disabling the request validation. On top of the webform add: enableEventValidation="false"

Hope this helps somebody.

UPDATE: setting enableEventValidation does not fix the problem in all the cases.

Cheers All

نویسنده : Nasser Hajloo : ٢:۳٧ ‎ب.ظ ; ۱۳۸٧/٥/۱٦
پيام هاي ديگران ()      لینک دائم

## Sys.WebForms.PageRequestManagerParserErrorException - what it is and how to avoi

If you've used the Microsoft ASP.NET AJAX UpdatePanel control, there's a good chance you've hit the "Sys.WebForms.PageRequestManagerParserErrorException" error.

What's a PageRequestManagerParserErrorException?

The UpdatePanel control uses asynchronous postbacks to control which parts of the page get rendered. It does this using a whole bunch of JavaScript on the client and a whole bunch of C# on the server. Asynchronous postbacks are exactly the same as regular postbacks except for one important thing: the rendering. Asynchronous postbacks go through the same life cycles events as regular pages (this is a question I get asked often). Only at the render phase do things get different. We capture the rendering of only the UpdatePanels that we care about and send it down to the client using a special format. In addition, we send out some other pieces of information, such as the page title, hidden form values, the form action URL, and lists of scripts.

As I mentioned, this is rendered out using a special format that the JavaScript on the client can understand. If you mess with the format by rendering things outside of the render phase of the page, the format will be messed up. Perhaps the most common way to do this is to call Response.Write() during Page's Load event, which is something that page developers often do for debugging purposes.

The client ends up receiving a blob of data that it can't parse, so it gives up and shows you a PageRequestManagerParserErrorException. Here's an example of what the message contains:

---------------------------Microsoft Internet Explorer---------------------------Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.`

If you ask me, this error message is not all that bad. After all, I'm the one that made it :) The details indicate what was being parsed when it decided to give up. You can see the part of the text from my Response.Write(), and immediately after that is part of the special format I keep mentioning.

Why do I keeping getting a PageRequestManagerParserErrorException?

Well, chances are you're doing one of the things mentioned in the error message. Here are the most common reasons and why they don't work:

1. Calls to Response.Write():
By calling Response.Write() directly you are bypassing the normal rendering mechanism of ASP.NET controls. The bits you write are going straight out to the client without further processing (well, mostly...). This means that UpdatePanel can't encode the data in its special format.
2. Response filters:
Similar to Response.Write(), response filters can change the rendering in such a way that the UpdatePanel won't know.
3. HttpModules:
Again, the same deal as Response.Write() and response filters.
4. Server trace is enabled:
If I were going to implement trace again, I'd do it differently. Trace is effectively written out using Response.Write(), and as such messes up the special format that we use for UpdatePanel.
5. Calls to Server.Transfer():
Unfortunately, there's no way to detect that Server.Transfer() was called. This means that UpdatePanel can't do anything intelligent when someone calls Server.Transfer(). The response sent back to the client is the HTML markup from the page to which you transferred. Since its HTML and not the special format, it can't be parsed, and you get the error.

How do I avoid getting a PageRequestManagerParserErrorException?

To start with, don't do anything from the preceding list! Here's a matching list of how to avoid a given error (when possible):

1. Calls to Response.Write():
Place an <asp:Label> or similar control on your page and set its Text property. The added benefit is that your pages will be valid HTML. When using Response.Write() you typically end up with pages that contain invalid markup.
2. Response filters:
The fix might just be to not use the filter. They're not used very often anyway. If possible, filter things at the control level and not at the response level.
3. HttpModules:
Same as response filters.
4. Server trace is enabled:
Use some other form of tracing, such as writing to a log file, the Windows event log, or a custom mechanism.
5. Calls to Server.Transfer():
I'm not really sure why people use Server.Transfer() at all. Perhaps it's a legacy thing from Classic ASP. I'd suggest using Response.Redirect() with query string parameters or cross-page posting.

Another way to avoid the parse error is to do a regular postback instead of an asynchronous postback. For example, if you have a button that absolutely must do a Server.Transfer(), make it do regular postbacks. There are a number of ways of doing this:

1. The easiest is to simply place the button outside of any UpdatePanels. Unfortunately the layout of your page might not allow for this.
2. Add a PostBackTrigger to your UpdatePanel that points at the button. This works great if the button is declared statically through markup on the page.
3. Call ScriptManager.RegisterPostBackControl() and pass in the button in question. This is the best solution for controls that are added dynamically, such as those inside a repeating template.

Summary

I hope I've answered a lot of questions here and not angered too many of you. We're looking at ways to improve some of these situations in the next version of ASP.NET, but of course there are no guarantees. If you avoid changing the response stream, you're good to go. If you absolutely must change the response stream, simply don't do asynchronous postbacks.

Reference

http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx

نویسنده : Nasser Hajloo : ٢:۳۳ ‎ب.ظ ; ۱۳۸٧/٥/۱٦
پيام هاي ديگران ()      لینک دائم