Wednesday, April 27, 2005

Getting the Screen size using Javascript Code.

To determine the screen size on the client machine, use the properties screen.width and screen.height supported by version 4 of both major browsers. If your user has Netscape Navigator 3 and enables Java, you use a Java call to get the screen width and height.

Click on the link above to see the Example.

Tuesday, April 26, 2005

A good site on Javascript Faqs and other Internet Related Technologies

This site has a couple of commonly used Javascript functions and FAQs on Javascript and articles on all Internet related Technologies......

Executing a Batch file using C# Code.

Take a look at the Process class in the System.Diagnosticsnamespace.
Namespace - System.Diagnostics
Here is a sample to get you started:

ProcessStartInfo startInfo = null;
Process batchProcess = null;
bool finished = false;
// Write relatively well behaved code for
// service processes.
try {
// Prepare the start-up information for the
// process such as filename to execute, its
// arguments, how to execute and whether to
// redirect input and error.

startInfo = new ProcessStartInfo();
startInfo.Filename = "run.bat";
startInfo.Arguments = "arg1 arg2 arg3 arg4";
startInfo.UseShellExecute = false;
startInfo.RedirectStandardInput = true;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
// Start new process using the start info.
batchProcess = new Process();
batchProcess.StartInfo = startInfo();
batchProcess.Start();

// Wait 60 seconds for the process to exit.
finished = batchProcess.WaitForExit(60000);

// If true, the process exited cleanly, if false
// then the process is still running.

if (finished == true) {
// Log that the process exited cleanly.
EventLog.WriteEntry( "The batch process exited cleanly." );
}
else {
// The process didn't exit cleanly so kill
// it off and log the action to the Event Log.
batchProcess.Kill();
EventLog.WriteEntry("The batch process did not exit in time and was killed.");
}
} catch (Exception e)
{
// Things can and will go wrong, at this early
// stage it is probably sufficient to write this to
// the event log. Of course, what do you do if access
// to the event log is denied? Can happen . . .
EventLog.WriteEntry( e.Message);
}

Einstein’s revolution enters second century

‘Miracle year’ still echoes as physics faces new challenges
During the "miracle year" of 1905, Albert Einstein published five groundbreaking papers still sparking innovations 100 years later.
Slide show

Also check out the photographic timeline spanning the life of Albert Einstein.

Life of genius
View a By Alan Boyle
Science editor
MSNBC
Updated: 12:08 p.m. ET April 19, 2005
Just after the turn of the century, scientists knew that their fundamental theories weren't quite right — they just didn't know what to do about it.

Monday, April 25, 2005

How To Implement Role-Based Security with Forms-Based Authentication in Your ASP.NET Application by Using Visual C# .NET

Link taken form microsoft, the article describes the methods to Implement Role-Based Security with Forms-Based Authentication in Your ASP.NET Application by Using Visual C# .NET

Wednesday, April 20, 2005

Using JavaScript Window.Open() & Close() functions in Ur Dotnet Apps

window.Open Function
----------------------------------

The window.open() function allows us to control the way a new window is opened, you can choose to have the toolbar, the address bar or even have a fixed dialog window which cannot be resized.

All these are controlled based on the parameters passed to the open method, lets look at each one of them.

*************************************************************
The "LINKS" or "EXTRAS" toolbar.
window.open("page1.htm","width=400,height=300,directories=yes");

The address or URL toolbar.
window.open("page1.htm","width=400,height=300,location=yes");

The toolbar with FILE, EDIT, VIEW, etc....
window.open("page1.htm","width=400,height=300,menubar=yes");

Allows the visitor to be able to resize the new window or not.
window.open("page1.htm","width=400,height=300,resizable=yes");

Forces vertical scrollbars to appear or not. Rarely used property.
window.open("page1.htm","width=400,height=300,scrollbars=yes");

The status bar along the bottom of the browser window.
window.open("page1.htm","width=400,height=300,status=yes");

The toolbar with BACK, FORWARD, REFRESH, etc...
window.open("page1.htm","width=400,height=300,toolbar=yes");

The height n width of the new window in pixels.
window.open("page1.htm","width=400,height=300");
*************************************************************

All the above parameters can be clubbed together to get a window of our choice.
Specifying only the WIDTH and HEIGHT options will automatically set the other properties to "no". Only the title bar holding the minimize/maximize buttons will be displayed on the window. To get the other settings to show, they will have to be specfied as "yes" explicitly.

window.close Function
----------------------------------

To close the current window just say
window.close()

But how do i close the child window by clicking a button on the parent window.
Provide a name for the child window when you open it
Ex: window.open("URL","Name","parameters");
window.open("page1.aspx","MyExamle","parameters");

Now you have to call the close method on the window name like this
Ex: MyExample.close();

Now by using the Name property you can use all the object available for the window object and manipulate the child window.

The example below changes the Url of the child window to show a new url.
Ex: MyExample.location.href("Webform2.aspx")

Hope this section provided you with some basic information on using the Open and close methods of the window object in Javascript and how to manipulate child window views.

Passing Textbox value form a Child Window to Parent Window Using JavaScript...

There are many a time when you might want to open a child window for showing a calendar and returning the selected value to the parent form text box,

Here's how to do it using JavaScript.

Open the HTML view of the child form, include this as a javascript function and call it on Unload of the child form or on button click.

window.opener.document.getElementById('txtParent').value = window.document.getElementById('txtChild').value

In the parent form you can open the child window by using window.open in the Response.Write method.
Check out my other post on the using the window.open parameters.

Passing Textbox value form a Child Window to Parent Window Using JavaScript...

There are many a time when you might want to open a child window for showing a calendar and returning the selected value to the parent form text box,

Here's how to do it using JavaScript.

Open the HTML view of the child form, include this as a javascript function and call it on Unload of the child form or on button click.

window.opener.document.getElementById('txtParent').value = window.document.getElementById('txtChild').value

In the parent form you can open the child window by using window.open in the Response.Write method.
Check out my other post on the using the window.open parameters.

Tuesday, April 19, 2005

Need a Block Menu in CSS?....its right here.....

Need a block menu fast!
Below are simple CSS menu designs for you to download and use any way you see fit.
You can download the complete set, or an individual menu by clicking the Download Menu button located on each menu.
Thanks to Veerle for the tutorial on the menu design 3, the best looking menu here.
Please feel free to download for commercial or private use, and modify to suit your needs.
Creative Commons - Attribution 2.0 - designed by Ian Main - e-lusion.com

Wednesday, April 13, 2005

Discusses how to use XMLHTTP to update part of a Web page with data from an ASP.NET Web service without doing a post back

A good presentation on using XMLHTTP................
Click on the link above to read on..................

http://www.kbalertz.com/Feedback_893659.aspx

My DotNet App is not Connecting to SQL Server 2000 after a change in IP address for SQL server...why?

There was heated exchange of mails in our company's internal knowledge Bulletin board.
One of my colleague was not able to make her ASP.net web app to run properly.

The SQL server 2000 Server IP address was changed, and after that the ASP.net application does not run.
The app runs fine if impersonated with the line identity impersonate =true is added to the web.config file, which was not the case before.

What might be the reason for this, after a long list of mails finally got the solution from a fellow employee in China.......

*********The Solution***********

The problem is caused by the IP address modification. Please follow the steps to locate the reason:
1. Login to the server where the SQL Server is deployed.

2. Execute SqlDiag.exe to gather information of the SQL Server.
By default, the SqlDiag.exe is under: C:\Program Files\Microsoft SQL Server\MSSQL\binn3. Open the log file generated by the SqlDiag.exe, check the IP address the SQL Server instance is listening.

By default there are three lines which are related with the IP address the SQL Server listen to. For example:

2005-03-30 14:38:36.65 server SQL server listening on 172.21.240.84: 1433.
2005-03-30 14:38:36.65 server SQL server listening on 127.0.0.1: 1433.
2005-03-30 14:38:36.68 server SQL server listening on TCP, Shared Memory, Named Pipes.

In above example, the first line is the IP address of the Server, the second is the lookback ip address, and these two are used to support TCP/IP connection to SQL Server. The third is for named pipeline protocol, which is defaulted enabled.

4. For your problem, mostly is because the SQL Server is still listening to the old IP address. Because the IP address has been changed, and SQL Server’s configuration is not changed, the client can not connect to SQL Server via TCP/IP protocol anymore.

5. If the problem can be located in step 4, the reason that why does the SQL Server can be connected while the “” is configured will be clear.
It’s because that the client application first selects TCP/IP to connect to the SQL Server.
If it is failed, the client application will try to use named pipeline. For named pipeline, it requires authentication before connecting. So, without the line in the Web.Config file, the link via named pipeline can not be established.
So, the client can not access SQL Server

Finally the fight is over........................

Tuesday, April 12, 2005

Using XMLHTTP in Javascript

Stumbled upon a cool posting on using XMLHTTP with javascript, the example posts a code to populate a dropdown list based on the value selected on another.

When I automate an Office application, it remains in memory even after I call Quit(). Why?

There have been a lot of Questions on releasing the COM objects when using Office applications with web apps.
Above is a link to a site that explains how to gracefully clean up the objects.

Also check out this link at the MS site.
http://support.microsoft.com/?kbid=317109

Article Url:
http://www.dotnetinterop.com/faq/?q=OfficeCleanup