Monday, May 31, 2010

java.lang.IllegalStateException: Error while loading manipulator

While trying to update eclipse plugins, you might get this error:
java.lang.IllegalStateException: Error while loading manipulator

The underlying error in the\workspace\.metadata\.log - would be something similar to:

!ENTRY org.eclipse.equinox.p2.engine 4 4 2010-06-01 00:19:00.483
!MESSAGE An error occurred while unconfiguring the items to uninstall
!SUBENTRY 1 org.eclipse.equinox.p2.engine 4 0 2010-06-01 00:19:00.483
!MESSAGE session context was:(profile=SDKProfile, phase=org.eclipse.equinox.internal.provisional.p2.engine.phases.Unconfigure, operand=[R]org.eclipse.equinox.common 3.5.0.v20090520-1800 --> [R]org.eclipse.equinox.common 3.5.1.R35x_v20090807-1100, action=org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.SetStartLevelAction).
!SUBENTRY 1 org.eclipse.equinox.p2.engine 4 0 2010-06-01 00:19:00.483
!MESSAGE Error while loading manipulator.
!STACK 0
java.lang.IllegalStateException: Error while loading manipulator.



Reason:
The eclipse has not loaded the equinox.launcher plugin.

What is Equinox and Why should I bother?

Equinox is the Osgi Framework implementation. So what? Alright, Eclipse uses OSGi as the basis for its plug-in system.

http://www.eclipse.org/equinox/

Solution:

We have to force load this plugin during startup by specifying it in the eclipse.ini.
  • Open the Eclipse.ini
  • Add the following line:
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
  • Restart Eclipse
  • Try updating/installing plugins

Wednesday, May 12, 2010

Online XML Formatting.

Most of the times XML generated are not formatted. It is extremely difficult to read/debug.

This cool online tool solves this headache:

http://xmlindent.com/

Monday, April 19, 2010

Browser Emulator

I was recently requested by my client to help fix a bug happening in I.E 6. I can't remember when on earth I last used I.E 6 and why this customer is so skeptical about this old nasty browser. But the truth is I have to fix it. My Windows now is a neat 64 Bit Windows 7 which doesn’t even knew there existed a browser called I.E 6.

I was looking for Emulators online and came across this stuff from Microsoft - Microsoft Expression SuperPreview. I downloaded, installed and played with it while I fixed the bug.

It's a good tool with some features of firebug. The difference being this displays the page layout as it is in a particular browser version, and can open two frames of two different browser versions and show the comparison I tried it and seems very helpful.

On the dark side sessions cannot be configured so for checking UI issues of Session enabled pages – I had to save as webpage complete and then open that file.

Some cool Features:

• Multi browsers Firefox xx , IE (6, 7, 8)
• Compare in two browsers simultaneously
• Dom related checks available
• Can set screen resolutions
• Configure more browsers like chrome/Safari etc.

Drawbacks (I didn’t explore, could be wrong)

• No JavaScript Checks
• Session pages cannot be tested live


Read more:

http://expression.microsoft.com/en-us/dd565874.aspx

Tuesday, January 05, 2010

JSON - Jquery

JSON & Jquery might have stormed well in the AJAX/WS world. But the right documents are missing. I was banging myu head for a few hours, on how to get a json object from a codebehind:

I was building a JSON object:{name:myvalue}

Tried all ways and it never workd in the Ajax method:

$.post("test.aspx?tbg=yu", $("#form1").serialize(),
function(data) {
alert(data.name); ---->Always returned undefined. In firebug it was not showing at all.


The Right solution is {name:'myvalue'}. This ******ing >>>>'<<<<< style="font-style: italic;">-Happy Hacking

Monday, January 04, 2010

String to Stream in C#

There are multiple ways, best two:

Us the System.IO.StringReader.

//Good when you want to preserve the UTL character
byte[] bytesFromString = System.Text.Encoding.UTF8.GetBytes(xml);
System.IO.Stream stream = new System.IO.MemoryStream(xmlBytes);

Tuesday, December 22, 2009

CodeGenerator From XML Schemas using Visual Studion XSD.exe

XSD.exe is a nice tool for .NET Code-Generation from an existing xml Schema. It's very similar like its java counterpart (JAXB- XJC)


Syntax:

Visual Studio 9.0\VC>xsd /c /out:c:\aneesh\classes c:\Aneesh\dataTypes.xsd

/c stands for generating classes
/out specifies the output directory
/namespace can give a specific namespace for the generated class


A bit complex situation, with multiple schema's

Scenario:

You have an XSD, objectrSchema.xsd and you have another XSD dataTypes.xsd. Some of the DataTypes in the dataTypes.xsd are used in the objectSchema.xsd. In this situation if you run the above command, it will give you a straight error:

Warning: Schema could not be validated. Class generation may fail or may produce incorrect results.
Error: Error generating classes for schema 'c:\ Aneesh\objectSchema.xsd '.

We can overcome this situation with a few tweaks. Thought I searched google but didn’t yield any satisfactory results. These are thing steps I did to make it work.

Step 1:

Import the dataTypes.xsd into the objectrSchema.xsd using the More details of XD IMport can be found here.

Note that the “namespace=http://www.aneesh.com/datatypes “should be the same as the one defined in dataTypes.xsd

Step 2:

Finally hit the command:

Visual Studio 9.0\VC>xsd /c /out:c:\aneesh\classes c:\Aneesh\dataTypes.xsd c:\Aneesh\objectSchema.xsd

Here you go. Your code is generated. Happy Hacking!

More Reading


Thursday, July 23, 2009

HTml Files not Being Served By IIS7

For a few days I was wondering when I moved my customers ASP application from DailyRazor to Godaddy, it simply does not server .html, .txt, .pdf, etc files. The only diference (Though a huge difference) is the change of server fomr IIS6 - IIS7). I called their support just to be answered by an Idiot.

Finally I started my classic debugging.

Started from URLRewriter by YAF.net

I noticed one thing, if the web.config just has the default stuff, everything is fine (Except .aspx because it doesn't have any registered dlls)

So I started removing the tags one by one from the web.config. Finally, understood, the problem lied in this particulr entry:



I still don't remember when I added this part to the web.config.

Also I added the following to the web.config for the html files to be served:

<add validate="false" path="*.html" verb="*" type="System.Web.DefaultHttpHandler"></add>


</remove name="StaticFile"/>

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