Sandip's Programming Zen

An attempt to share tech/coding experiences

Archive for January 2008

Registration Form Fields Popularity

leave a comment »

Recently I have found an interesting post on Get Elastic blog. It is a must read if you not just a registration form user but much more than that. It gives an insight on registration form field’s popularity and also offers some suggestion on what should and shouldn’t be done.

According to that “Password” field is most popular ((with 100% frequency)) registration field and Captcha field was least popular (with 1% frequency)

Written by Sandip

January 30, 2008 at 6:17 pm

Posted in E-Commerce

Tagged with ,

Batch file Backup Utility

leave a comment »

For long I have been using a simple batch file to keep backup of important content on my PC. It is a very simple & flexible solution and you don’t have to install anything. However, the batch file is using a command line compressing utility called FBZIP you can download it from here, which you have to keep along with batch file.

You can run the bath file manually or schedule it according to your backup strategy

Following is the code for batch file.

@echo off

:: variables

set backup_drive=D:\Backup

set backupcmd=xcopy /s /c /d:12-31-2007 /e /h /i /r /y

set Fbackupcmd=xcopy /s /c /e /h /i /r /y

 

echo ### Backing up Desktop contents…

%backupcmd% “C:\Documents and Settings\…\Desktop” “%backup_drive%\Desktop”

echo ### Backing up My Docs

%Fbackupcmd% “C:\Documents and Settings\…..\My Documents” “%backup_drive%\MyDocs”

echo ### Compressing Backup Folder…

fbzip.exe -a -p -r “%backup_drive%\Backup_%date:~-4,4%%date:~-7,2%%date:~0,2%.zip” “%backup_drive%”

echo Backup Complete!

@pause

In following line, date is used to check differences of target and destination folders only after specified date.
set backupcmd=xcopy /s /c /d:12-31-2007 /e /h /i /r /y

If you want to keep it simple then remove the date part (as follows), it will just check all differences regardless of date stamp.

set backupcmd=xcopy /s /c /d /e /h /i /r /y

Written by Sandip

January 30, 2008 at 10:22 am

Solution: Timeout expired – Connection Pool Error

with 8 comments

“Timeout expired. The timeout period elapsed prior to obtaining a
connection from the pool. This may have occurred because all pooled
connections were in use and max pool size was reached.”

How many times you have got above error? I have got it number of time but I was not troubled much as I did last time.

We have done following to resolve error (in sequence):

  1. Tried to check obvious code if we can find faulty code.
  2. Ran SQL profiler on Live scenario and gather as much data as possible
  3. Checked SQL server log for possible error messages.
  4. Checked Eventviewer for application error messages.
  5. Tried increasing connection pool value in web.config

None of above helped in our case at last we checked sql locks in syslocks table in master database which continuously holding lock on one of our primary tables. Some how lock was created and never removed during a simple update query, normally sql server creates lock on table when any insert/update/delete transaction is in progress.
We commented that update query and locking issue is gone and everything worked perfectly, no time out errors now.

As of now we don’t have any idea why a simple update query which was working normally, suddenly creating a permanent lock on a table, if I will find out with the help of my team will update here.

I suggest if you ever encounter this error try to follow the steps in the sequence I have mentioned above and narrow down the possibilities.

Update: If you want to set timeout property in DTS package than you can use timeout property shown in the screenshot below:

 

Written by Sandip

January 29, 2008 at 7:06 pm

VS 2008 Web Deployment Project Support Released

with 2 comments

ScottGu’s Blog just reported that they have released support for VS 2008 Web Development Projects.

Find more details on ScottGu’s Blog.

VS 2008 Web Deployment Project (WDP) is new version in line with VS 2005 WDP. If you are not aware about VS 2005 WDP then again refer ScottGu’s old post.

The new WDP is shipping with new features on top of existing features of VS 2005 WDP.

You can download it from here.

Written by Sandip

January 29, 2008 at 7:21 am

Posted in .Net

A free software everyday

leave a comment »

Few days back one of my friend Chetan told me about this website and after reviewing for few days I should refer this to readers.

GiveAwayofTheDay is the website which gives away a free software everyday (for non-commercial use of course). A commercial software is available for download free or charge for 24 hours otherwise have to be bought.

Currently softwares comes for download are small utility kind of tools but as popularity may grow in future who knows bigger commerical apps can also be downloaded freely someday! Till then keep looking you may find some useful tool for personal use.

Written by Sandip

January 26, 2008 at 5:27 pm

Posted in Softwares

.Net Videos

leave a comment »

I just found out a new website which offers .Net programming videos on various subjects ranging from beginning concepts to advance programming.

I find it useful to learn some concepts really fast.

Written by Sandip

January 26, 2008 at 4:43 am

Posted in .Net

Tagged with , ,

Test-Driven Development (TDD)

leave a comment »

This IEEE paper finds out during their research that test -first method of programming gives more productivity then any other method. They wrote that formalizing a piece of functionality as a test and code it in such a way that the test passes.

“We found that test-first students on average wrote more tests and, in turn, students who wrote more tests tended to be more productive. We also observed that the minimum quality increased linearly with the number of programmer tests, independent of the development strategy employed.”

Paper explains why TDD offers more productivity:

We believe that the observed productivity advantage of Test-First subjects is due to a number of synergistic effects:

  • Better task understanding. Writing a test before implementing the underlying functionality requires
    the programmer to express the functionality unambiguously.
  • Better task focus. Test-First advances one test case at a time. A single test case has a limited scope. Thus, the programmer is engaged in a decomposition process in which larger pieces of functionality are broken down to smaller, more manageable chunks. While developing the functionality for a single test, the cognitive load of the programmer is lower.
  • Faster learning. Less productive and coarser decomposition strategies are quickly abandoned in favor of more productive, finer ones.
  • Lower rework effort. Since the scope of a single test is limited, when the test fails, rework is easier. When rework immediately follows a short burst of testing and implementation activity, the problem context is still fresh in the programmer’s mind. With a high number of focused tests, when a test fails, the root cause is more easily pinpointed. In addition, more frequent regression testing shortens the feedback cycle. When new functionality interferes with old functionality, this situation is revealed faster. Small problems are detected before they become serious and costly.

Test-First also tends to increase the variation in productivity. This effect is attributed to the relative difficulty of the technique, which is supported by the subjects’ responses to the post-questionnaire and by the observation that higher skill subjects were able to achieve more significant productivity benefits.

To learn more read the full paper available in downloadable pdf.

Solution: Event ID ( 0 ) Error – Application Crashing

with one comment

Recently I have got a weird error on our production web server. The server is Win 2003 R2 running with Framework 1.1 application.

The following error is logged in event viewer and whenever it occurred our server crashed and mostly we have to reboot to make the application working.

The description for Event ID ( 0 ) in Source ( .NET Runtime ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: .NET Runtime version 1.1.4322.2300- Setup Error: Failed to load resources from resource file.

As it seems it does not provide any clue what is going wrong. After researching Net for hours I have seen number of people reporting this error in different context. So there is no fixed reason or solution.

However, I have tried to do everything what some people have suggested as solutions and one had done the trick for me. I am putting them together some of the possible solutions (as I believed) those may fix the problem if you ever encounter.

  1. Stake overflow is the number one cause according to most and it usually happens because of recursive function in code. You have to go through your code and find out and fix.
  2. As it gives a hint in message itself “Failed to load resources from resource file“. Means you may be using a resource file in your application and now it can’t be loaded or accessed.
  3. Check in your code if there are any threads which stuck in any of your function and goes into infinite loop. This can be easily found out as this may be happening on carrying out particular action on your application.
  4. If you have used any “third party” library where you don’t know how it works inside then better check. Try to remove them from your project and see if the error goes away.

If you find more solutions then please update me as that may save someone’s hours of time.

Written by Sandip

January 25, 2008 at 5:10 pm

Some of the striking features of Visual Studio 2008

leave a comment »

The following feature list is not in any order of importance, it is just the way I explorered them in sequence.

  1. Multiple Framework Targeting

    By default VS creates project with Framework 3.5 but the New Project dialog window has this dropdown where you can select later versions also. This means you can load your VS 2005 solutions in VS 2008 and not worrying upgrading them.

  2. JavaScript Intellisense

    This one is cool; you get in-built JavaScript intellisense. This will enable us use JavaScript and create AJAX application in much easier way. Apart from rich syntax Intellisense it also supports type interface, external library support, add hints to your functions, Intellisense within external JavaScript files.

  3. Built-In AJAX support

    With Framework 3.5 AJAX 1.0 support is built-in, that means you no longer need to download it separately. So when you create application targeting Framework 3.5 VS will automatically adjust web.config file with AJAX entries. Core AJAX control will then show up in your toolbox.

  4. LINQ (Language Integrated Query)

    This one is cool, LINQ is a new way of querying data source in declarative manner in your server side programming language (C#/VB etc). This will make querying data sources consistent across various data sources. This will make it much easier to target multiple data sources for single application like (Objects, XML, SQL, and Dataset).

  5. Debug through Framework

    VS 2008 ships with ready only source of Farmework 3.5 so now you can debug your application deeper through Framework system libraries.

  6. WPF (Window Presentation Foundation

    The WPF designer in Visual Studio 2008 provides developers with a great environment for developing rich applications with WPF, through its Rich XAML navigation and editing, Split View editor and Visual Design Surface.

    One of the coolest implementation of WPF is “Microsoft Surface”. If you haven’t watched the video yet Watch it here.

  7. C# 3.0 and VB9

    C# 3.0 and VB9 has many new features (including automatic properties, relaxed delegates, object initialisers, type inference, anonymous types, extension methods, lambdas and partial methods). The compilers generate backward compatible IL. This means that all the new language features can be used with existing Framework 2.0 projects (due to the multi-targeting feature mentioned above).

  8. Office Customization

    There are built-in support for Office customization for both version 2007 and 2003. Many add-in templates are provided ready made which makes it easier to make office add-ins and extensions.

  9. WCF (Windows Communication Foundation)

    This one is for server developers. WCF and WCF templates are now built-in VS 2008.

    The WCF programming model unifies Web Services, .NET Remoting, Distributed Transactions, and Message Queues into a single Service-oriented programming model for distributed computing. It is intended to provide the rapid application development methodology to the development of web services, with a single API for inter-process communication in a local machine, LAN, or over the Internet.

Written by Sandip

January 24, 2008 at 6:05 pm

Posted in .Net

Tagged with , ,