Saturday, September 29, 2007

Infinium System Handling Via Net Manage.

I found 3 ways to handle the Infinium System via Net Manage.

One is to write the pure script which is bit difficult to write but easy to debug.
Second is to scrap and record the screen one by one.
Third is the mixture of the above 2.

So second approach is easy to create but difficult to debug.

I thing the mixture of both the approaches are the best way to achieve the targets.

Friday, September 28, 2007

Net Manage

Hi Guys,

These days I was so busy as I was working on a new tool called Net Manage and truly speaking I find it very interesting because its like a different experience.

Net Manage is use to interact with the existing Infinium System. Its like automating the task user can perform on that system and expose those task like a WebService for .Net Developer and Java Beans for Java Developers.

So, developer is able to integrate the Existing Infinium System with Java/.NET.

The concept of Net Manage is like a concept of reading the dimensions of the screen and performing the keystoke on the particular dimensions to move to the next screen.

It saved a lot of work otherwise one has to understand the whole database structure to integrate the existing infinium system with the new building system which is in process.

Friday, August 24, 2007

Javascript function handling Print, Print Preview.


I have seen many developers looking for the print, print preview and related problems. Below is a good javascript function solving this purpose based on the value of OLECMDID parameter. It also has the option for suppressing the option for promting the end user.

<html>
<head>
<script>
function printpr()
{
var OLECMDID = 7;

//var OLECMDID = 20;

/* OLECMDID values:
* 6 - print
* 7 - print preview
* 1 - open window
* 4 - Save As
*/


var PROMPT = 1; // 2 DONTPROMPTUSER
var WebBrowser = '';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(OLECMDID, PROMPT);
WebBrowser1.outerHTML = "";
}
</script>
</head>
<body>
<form>
<input type='button' value="Print Preview" onclick="printpr();">
</form>
</body>
</html>

RemoveLeadingZero

Sometimes developer gets the unformated numbers from the server as a result but they have to show the formated data on the screen according to their choice.Below is a very good example which will remove the leading zeros from the number. Make sure the number you have will be string otherwise ithing will not work.That is the only reason below code snippet has value=value.toString(); line which is converting the number into string.

<html>
   <script>
    function RemoveLeadingZero(value)
    {
      value=value.toString();
      while (value.charAt(0)=="0")
      {
       value=value.substring(1,value.length);
      }
      if (value.charAt(0)==".")
      {
       value="0"+value;
      }
      return(value);
    }
    var z="00000000.5000";
    alert(RemoveLeadingZero(z));
   </script>
</html>

Tuesday, August 21, 2007

Prevent unwanted text selection and unwanted drag and drop

Some days back, I was facing a strange problem. When my web page is in the loading stage I was able to drag the images on the page to adress bar and any other location in the page. I ’ve never seen this before, and I spend some time to conclude the problem and then I came up with very a nice solution to prevent unwanted text selection and unwanted drag and drop in IE, So I have added the below mentioned event defination in the body tag of HTML.

<body onselectstart='return false;' ondrag='return false;'>

Monday, August 20, 2007

SQL 2005 Try Catch.

In SQL Server 2005 you can use try catch block as in other programming language.Below is the simple example which is generating the divide-by-zero exception and the catch block statement is retrieving the error information.


BEGIN TRY

-- Generate a divide-by-zero error.
SELECT 1/0;

END TRY

BEGIN CATCH

SELECT

ERROR_NUMBER() AS ErrorNumber,

ERROR_SEVERITY() AS ErrorSeverity,

ERROR_STATE() AS ErrorState,

ERROR_PROCEDURE() AS ErrorProcedure,

ERROR_LINE() AS ErrorLine,

ERROR_MESSAGE() AS ErrorMessage;

END CATCH;

Beware of opening links in a new window

Top 5 reasons I found on the net why one should beware of opening links in a new window:

1. Unless you warn them, Web users are likely to expect the new page to load in the current window. Unexpected surprises can be fun, but not when you're browsing the Web.
2. The act of opening a new browser window resets the back button in that window. The back button is the second most used navigation function (after hyperlinks, source: useit.com), so resetting it is a big no-no.
3. To open a new browser window can disorient very novice Web users and the visually impaired. They might not realize that a new window has opened and might struggle to switch between windows.
4. Opening a new browser window disrespects the desires of your users. If they want a new window, they'll ask for one. Don't force a new window upon users unless there's a very good reason to do so.
5. New browser windows can make an already cluttered taskbar even more difficult to use. We've all spent ages hunting through the taskbar in search of the window we want. Don't make this process even harder by increasing the number of windows the user has open.
Reference: http://www.sitepoint.com/article/beware-opening-links-new-window