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.