Sunday, March 22, 2009

EventBubble in Javascript

Today I came across a cool method of Javascript. Basically I was trying to fix a long running bug. The underlying issues was something similar:

<tr id="idTR" class="some-Tr-Class" onclick="javascript:Ajsclass.doTRWork();" >

<td class="some-Td-Class" onclick="_do_nothing()">

<input type="checkbox" id="dynamicallyGen" value="xyz">

<td class="some-Td-Class">

..Some title..

</td>

.....
....

</tr>



My Issue is I want to override the Ajsclass.doTRWork();. for the first TD with the checkbox. Was wondering how to
to fix it. Finally Mozilla helped me with their API documentation.

The solution is to not call the bubble function which is Ajsclass.doTRWork(); Just stop after _do_nothing().

The solution is to add:

event.cancelBubble = true;


in the _do_nothing().

The above works fine for Firefox but not for IE


For IE add the following:

event.stopPropagation()


Cool aha? I started liking javascript right from the beginning of this project as 70% of my work was Ajax & JS.

Friday, November 30, 2007

Back to .NET

After a gap of 3 years, I am again back to dotNET. The company for which I ma consulting now, have a small requirement to do a small project in dotNET 2.0. My manager asked me if I am interested....and thats it.

I downloaded the Microsoft Visual C# 2005 & Microsoft Visual Web Developer 2005. .Net 2.0 has some good features such as the partial class, and the web builder has got some kind of template built in with it, which really eases the coding time. Well Done Microsoft. But the C# studio has a bit more to mature. Earlier days, when somebody moves into java from vc++,VB, it was a pain in the ***. But now it has turned the other way round. Somebody who was using Eclipse till yesterday and today on seeing the VC#, feels pity.

After installing IIS, I thought I am done, and updated my taklist as "Environment setup completed". Suddenly, like a thunderstorm in the summer, I got this error below :


The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

A name was started with an invalid character. Error processing resource 'http://localhost/pages/Default.aspx'. Line 1, Pos...

<%@ Page Language="C#" %>
-^


I didnt have any clue of this error, until I knew that, in the IIS properties, we had to set the ASP.NET version. It is/was blank by default.

MyComputer-RightClick->Manage->Services and pplications ->IIS->Default Website->-Properties->ASP.NET(TAB)->ASP.NET version

There you go. Restart IIS.

Here comes hailstorm, the next error, when I tried to access.


Failed to access IIS metabase.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.

The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HostingEnvironmentException: Failed to access IIS metabase.]
System.Web.Configuration.MetabaseServerConfig.MapPathCaching(String siteID, VirtualPath path) +3609834
System.Web.Configuration.MetabaseServerConfig.System.Web.Configuration.IConfigMapPath2.MapPath(String siteID, VirtualPath vpath) +9
System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +169
System.Web.CachedPathData.GetConfigPathData(String configPath) +382
System.Web.CachedPathData.GetConfigPathData(String configPath) +243
System.Web.CachedPathData.GetApplicationPathData() +68
System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp) +3503459
System.Web.Configuration.RuntimeConfig.GetLKGRuntimeConfig(VirtualPath path) +189



On Successfull googly, MSDN guided me to reinstall dotNET framework :( . No Way, I don't want my manager to be behind the bars, after killing me....Blistering barnacles and thundering typhoons. I finally got the solution.

Issue:
The IIS was installed after .NET framework was installed. SO the IIS should be regestered for ASP.NET application unless, and for security rights.

Solution:


C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis.exe -i
Where "i" is Install this version of ASP.NET and update scriptmaps at the
IIS metabase root and for all scriptmaps below the
root. Existing scriptmaps of lower version are upgraded to this version.

Bingo!!!! I am back to dotNET. Pause J2ee for a while :)

Friday, November 23, 2007

What caused me surprise this afteroon??

Today afternoon, I went to Mysql page to download the latest version of Mysql. I was a bit perplexed, the way the welcome page behaved. It was asking for username/password to proceed or else to register. I was unable to find the download link. I thought for a while and clicked on the customer link. I was totally surprised on seeing the list of customers. More than the numbers its the companies which is using this database.

To name a few :

NASA
Google
AT&T Wireless
British Telecommunications plc
Suzuki
BBC News
Lloyds TSB Bank
Reuters
Lufthansa Systems
Toyota France


More..

Tuesday, November 20, 2007

Helper for Purging Oracle Bpel Instances.

I had written a piece of code during my free time, which I thought would share with some Bpel enthusiasts. There had always been questions regarding purging of Bpel instances, if it's faulted or completed abnormally..

The following code removed all the bpel instances which are:


  • Closed Faulted
  • Stale
  • Cancelled



import com.oracle.bpel.client.IActivityConstants;
import com.oracle.bpel.client.IInstanceHandle;
import com.oracle.bpel.client.Locator;

public class PurgeHelper {

    
public static void purgeInstances(String aDomainId, String aPassword, String aIPAddress) throws Exception {
        
        // initialize the instance handler
        IInstanceHandle instances[] = null;
        try {
            //check if parameters are invalid
            if(aDomainId ==null || aPassword == null )//|| aIPAddress ==null)
                throw new  Exception(" Invalid Parameter");
            // get the instances
            instances = new Locator(aDomainId, aPassword).listInstances(1, -1);
            // check for null
            if (instances == null) {
                throw new Exception("No Instances Retrieved");
            }

            // get the instance length
            int instancesLength = instances.length;
            // iterate
            for (int j = 0; j <=instancesLength;++j)
                // get the instance
                IInstanceHandle tempInstance = instances[j];
                // check for null
                if (tempInstance == null)
                    continue;
                
                //check  the state
                if(tempInstance.getState()!= IActivityConstants.STATE_CLOSED_FAULTED ||
                        tempInstance.getState()!= IActivityConstants.STATE_CLOSED_STALE ||
                        tempInstance.getState()!= IActivityConstants.STATE_CLOSED_CANCELLED)||
                        ){
                    // remove the instance from the Dehydration Store
                    tempInstance.delete();
                }

            }

        } catch (Exception err) {
            // handle exception
        }

    }

/* Some usefull Bpel instance status */

// IActivityConstants.STATE_CLOSED_FAULTED);
     // IActivityConstants.STATE_CLOSED_ABORTED);
     // IActivityConstants.STATE_CLOSED_COMPLETED);
     // IActivityConstants.STATE_CLOSED_CANCELLED);
     // IActivityConstants.STATE_CLOSED_COMPENSATED);
     // IActivityConstants.STATE_CLOSED_FINALIZED);
     // IActivityConstants.STATE_CLOSED_PENDING_CANCEL);
     // IActivityConstants.STATE_CLOSED_STALE);

   

}

Note. You need to add orabpel.jar for compilation.

Monday, January 08, 2007

How to Start VNC From A Remote Machine

Today I wanted to install 10.1.2.0.2 JBoss Bpel to my Integration test machine. I was wondering how to do that, because the server didn't had a monitor. I didn't even know if vnc was present in the machine.

First using the locate vnc, I was able to find the vnc was present in teh machine.

So after some struggling over the man pages, I found how to start the vnc in a machine.

Just type vncserver in the command line. If the vnc server is successfully started, then you get a similar message:


New 'myhost.com:4 ' desktop is myhost.com:4

Starting applications specified in /home/oracle/.vnc/xstartup
Log file is /home/oracle/.vnc/integration-pc:4.log

So here the new port for the vnc server is "4"
The next step is setting the password for the first time.

Just type vncpasswd
You give passowrd of your chice and the system will again ask for verification.

From your remote machine, open the vncviewer. Enter the host name and the new port number.

EG: myhost.com:4
In the password prompt, give the password you have supplied earlier. Thats it, you are successfully connected to the vnc server.

Monday, January 01, 2007

If volatile why synchronized ?

Did you you have this question in mind????
ok, they are really different mate......

Have a look at the Java Language specification (JLS).

http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#36930

Wednesday, May 31, 2006

Bpel- Evenings Technology, Tomorrows workflow.

BPEL(Bussiness process execution lanaguage), was in my mind for quite some time, unfortunately was not able to get my hands on it. Now, I came to know much more in BPEL and going deep into it. Bpel is an outcome of a decade long research by IBM, BEA & Microsoft. Its the best particles of IBM's WebServices Flow Language (WSFL) & Microsoft's XLANG specification.

Infact, this is an xml based languge, which has specific grammer and rules. Bpel is designed as standard for orachestring, multiple services to performs single/ multiple activites. These services will be literally webservices.

Visit:
Oracle Bpel
IBM

Oracle & Open Source

Oracle is in sync with the Open Source community. InnoDB followed by ADF Faces, which was contributed to Apache, by Oracle and others like BPEL Process manger Plug in for Eclipse, to name a few.

A couple of months before, I passed through an article in OTN, Oracle Technology website, regarding the acquisitions of Innobase, the company which makes a very powerful DB engine called InnoDB. To make things clearer, let me just talk about InnoDB for a while.

I am not sure of the version, when MySQL made InnoDB the default engine. But earlier in MySQL versions of 3.x, it was a pain working with MYSQL and the basic MyISAM engine, where there was not foreign key constrains available, and the performance was snail. The INODB, which comes with the MYSQL, has a bunch of excellent features, which made MySQL the best open source database. To name a few, they are:

Transaction-safe

Oracle-styles, non-locking read

Multi-user concurrency

Constraint support-foreign keys

Maximum performance, with large volumes of data

Moreover, fully integrated with MySQL Server, the InnoDB storage engine maintains its own buffer pool for caching data and indexes in main memory. InnoDB stores its tables and indexes in a tablespace, which may consist of several files (or raw disk partitions). This is different from, for example, MyISAM tables where each table is stored using separate files. InnoDB tables can be of any size even on operating systems where file size is limited to 2GB.

J, Not Sure of what will be the fate of MYSQL. But I feel this is one of the intelligent acquisitions Oracle has made. Literally speaking MYSQL, is/was definitely a competitor for Oracle Database, for customers who look for both Economy and a bit of performance. The Oracle policy: “BUY IT IF YOU CANT BEAT IT” is slowly and consistently making waves.

Well, one more thing to add, MYSQL is not free, for people who think that way:

http://www.mysql.com/company/legal/licensing/faq.html