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

URL Re-writing in a simple way.

Most of the times we have to write the Module or handler for the URL Re-Writing we also have to mark its registration in the web.config file but there also a simple way to achieve it.

Below is the code snippet from the Global.asax file.

protected void Application_BeginRequest(object sender, EventArgs e)
{
try
{
HttpContext myContext = HttpContext.Current;
myContext.RewritePath(Request.QueryString["PageName"].ToString());
}
catch (Exception ex)
{
Response.Write("ERR in Global.asax :" + ex.Message + "\n\n" + ex.StackTrace.ToString() + "\n\n");
}
}

Dynamic URL

I found a good article on the net which says some interesting fact about the dynamic url for the search engine.

Dynamic URL are bad in view of SEO because of the way that dynamic URLs are created, they sometimes create nightmares in the area of search engine optimization (SEO). Therefore Search engines do not like to index dynamic URLs. Many times dynamic content is hard to spider. There are multiple reasons for this, one of them being the non-standard characters like ?, &, %, =, and others in the URL. Many times, anything after the character is disregarded. For example, we may have URLs that look something like this:

http://www.mobilejazz.co.uk/NewDeals.asp?id=290
http://www.mobilejazz.co.uk/NewDeals.asp?id=380
http://www.mobilejazz.co.uk//phwithnetwork.asp?netid=16

Many search engines are unable to deal with dynamic URLs, that is a URL containing a question mark or an ampersand. Google says that a dynamic URL with 2 parameters “should” get indexed. When we pressed a bit on the issue we also found that URLs themselves don’t contribute too much to the overall ranking algorithms. In other words, a page named Page1.asp will likely perform as well as Keyword.asp.

Types of Search Engine

Me and my boss were discussing about the search engine and I found some good information about the search engine.

1. Crawler-based search engines are those that use automated software agents (called crawlers) that visit a Web site, read the information on the actual site, read the site's meta tags and also follow the links that the site connects to performing indexing on all linked Web sites as well.

2. Human-powered search engines rely on humans to submit information that is subsequently indexed and catalogued. Only information that is submitted is put into the index.

Tuesday, July 24, 2007

atlas:CollapsiblePanelExtender which fetch the data from the server when expands.

Hi,
I have changed the code of the existing atlas:CollapsiblePanelExtender , CollapsiblePanelBehavior.js and added some extra properties in atlasToolkit:CollapsiblePanelProperties which helps to make to the server call (fetch the fresh data from the server) when it expands. Moreover it can work in the same as it was working earlier.

There is a boolean property with the name IsEveryTimePostBack which will decide the behaviour of the postback.

<atlasToolkit:CollapsiblePanelExtender ID="cpe" runat="Server">
<atlasToolkit:CollapsiblePanelProperties
TargetControlID="ContentPanel"
ExpandControlID="HeaderPanel"
CollapseControlID="HeaderPanel"
Collapsed="True"
ExpandDirection="Vertical"
ImageControlID="ToggleImage"
ExpandedImage="~/images/collapse.jpg"
ExpandedText="Collapse"
CollapsedImage="~/images/expand.jpg"
CollapsedText="Expand"
SuppressPostBack="true"
IsEveryTimePostBack="true"
PostBackURL="http://SomeServer/SampleWebSite/TestService.asmx"
PostBackMethodName="Test"
PostBackMethodParameters="query:This is the result from"
ResultDiv="Result"/>
</atlasToolkit:CollapsiblePanelExtender>

Additional Creadted Property Used For

IsEveryTimePostBack ~~~~! Used for mentioned everytime postback should happen or not in case of expand.

PostBackURL ~~~~~~~~~! Used for mentioned the url of the web service.

PostBackMethodName~~~! Used for mentioned the method name of the
web service.
PostBackMethodParameters ~~~~! Used for mentioned the parameters of the method in the web service.

ResultDiv ~~~~~~~~~~~~~~~~~! Used to set the name of the div for the fresh result fetched from the web service.

Thanks.

Monday, July 16, 2007

SQL2008 Multiple Insert statement

One of the Difference between the SQL 2005 AND SQL 2008.

SQL2008 gives you the facility to insert multiple rows in a single statements.

--SQL Server 2005
INSERT dbo.EMPLOYEE(SALARY) VALUES (1000)
INSERT dbo.EMPLOYEE(SALARY) VALUES (2000)
INSERT dbo.EMPLOYEE(SALARY) VALUES (3000)
INSERT dbo.EMPLOYEE(SALARY) VALUES (4000)

--SQL Server 2008
INSERT dbo. EMPLOYEE(SALARY) VALUES (1000),(2000),(3000),(4000)

Thanks