Posts

Showing posts from 2010

Create Log file for Application

1. Create Log Folder in the project folder 2. Create Batch file and Add following @echo --------------------------------------------------------- @rem ************* Project nameBatch Commands ************* @echo -------------------------------------------------------------- @For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @( Set Month=%%A Set Day=%%B Set Year=%%C ) @set ProjDir=C:\Projects\project@set logfile=%ProjDir%\Log\log%Month%%DAY%%Year%.txt@echo %logfile%@set app_exe=%ProjDir%\ProjFolder\bin\Debug\Project.exe%app_exe% >> %logfile% cls

File Watcher Windows service : Waits until a file can be opened with write permission

/// /// Waits until a file can be opened with write permission /// public static void WaitReady ( string fileName ) { while ( true ) { try { using ( Stream stream = System . IO . File . Open ( fileName , FileMode . Open , FileAccess . ReadWrite , FileShare . ReadWrite )) { if ( stream != null ) { System . Diagnostics . Trace . WriteLine ( string . Format ( "Output file {0} ready." , fileName )); break ; } } } catch ( FileNotFoundException ex ) { System . Diagnostics . Trace . WriteLine ( string . Format ( "Output file {0} not yet ready ({1})" , fileName , ex . Message )); } catch ( IOException ex ) { System . Diagnostics . Trace . WriteLine ( string . Format ( "Output file {0} not yet ready ({1})" , fileName , ex . Message )); } ...

How do I create shared assemblies

How do I create shared assemblies ? How to install an assembly in the Global Assembly Cache in Visual Basic .NET or in Visual Basic 2005? A shared assembly is one that is used by multiple applications on the machine. A shared assembly must have a name that is globally unique. The .NET Framework supports these naming requirements through a technique called strong names. Shared assemblies must have a "strong name" consisting of the name of the assembly, the version, a 64 bit hash of a public key (called a ´token´) and the culture. To create a strong name for an assembly (that is, to generate a public/private key pair), you'll have to use another utility called sn.exe. In this article, we will create a Visual Basic 2005 component called myGAC. We will also create a key file named mykeys.key. We will sign our component with this key file and place it in Global Assembly Cache To create a Component we have to create a Class Library project by using Visual Studio .NET. Step ...

Disable the Anchor Tag Using JavaScript

function DisableTheAnchorTag() { var btnA= document.getElementById("name of the a tag"); if(btnA!= null) { btnA.onmouseover=function y(){this.style.cursor='default'} btnA.setAttribute('onclick', "void(0);"); } }

Getting Query parameters using Javascript

<script language='JavaScript'> // get the current URL var url = window.location.toString(); //get the parameters url.match(/\?(.+)$/); var params = RegExp.$1; // split up the query string and store in an // associative array var params = params.split("&"); var queryStringList = {}; for(var i=0;i { var tmp = params[i].split("="); queryStringList[tmp[0]] = unescape(tmp[1]); } // print all querystring in key value pairs for(var i in queryStringList) document.write(i+" = "+queryStringList[i]+"<br/>"); </script>

How to create a connection string file

1. Create a text file. 2. Change a file extension as UDL 3. Now Double Click the file and Test connection string. 4. close 5. Open a file with notepad 6. We can have connection string

calculating how many days remaining in a month or last day of month or any other scenarios

calculating how many days remaining in a month or last day of month or any other scenarios: declare @numberOfDaysInMonth int; set @numberOfDaysInMonth = DAY(DATEADD (m, 1, DATEADD (d, 1 - DAY(getdate()), getdate())) - 1);

Configuration file in SSIS package

1. Right click in the control flow and add the configuratin and click next, next -> finish. 2. Pass words will not be added in the configuration file, We have to add in the two places( a. connection string and password property

How to find a error line in SQL

BEGIN TRY -- Generate a divide-by-zero error. SELECT 1/0; END TRY BEGIN CATCH SELECT ERROR_LINE() AS ErrorLine; END CATCH;