Thursday, June 23, 2011

Error: Unable to transcode assets/xyz.png

I got this error while trying to build a Flex application using Apache ant and Flex 4.5 SDK (Got it even while directly using the MXML command). The strange thing is that, I was able to successfully compile this same project at my office using the very same SDK. I googled and nowhere did I get a satisfactory solution. There were so many threads and links which showed a similar problem:

 Error: unable to resolve 'assets/xyz.png'.

The fact is that, the above error is entirely different from the error I am talking about. The above error is just because the compiler can't resolve the image. A '/' or  '../' before the 'assets' will easily solve the above problem.

But the error:

Error: Unable to transcode assets/xyz.png

is different and frustrating. I happens even though that particular image could be resolved. 

After a few hours of research I finally figured out the problem. The problem was with the underlying JDK.

My Machine is using 64 bit Windows 7, and apparently the JDK  was also a 64 bit. Flex release notes doesn't mention that it supports 64 bit os and now it's clear -It doesn't support. Finally after switching to a 32 bit JDK the project got compiled successfully.

Note- if the above solution doesn't work, you should try downloading the latest 32 bit JDK and try. 


Wednesday, June 22, 2011

org.springframework.beans.FatalBeanException: Could not copy properties from source to target

I came across this irritating issue(While workign on a Spring based project).

org.springframework.beans.FatalBeanException: Could not copy properties from source to target; nested exception is java.lang.IllegalArgumentException: argument type mismatch
at org.springframework.beans.BeanUtils.copyProperties(BeanUtils.java:599)
at org.springframework.beans.BeanUtils.copyProperties(BeanUtils.java:509)

Google took me to this bug which was already logged with SpringSource:

https://jira.springsource.org/browse/SPR-7693 (unfortunately it's still unfixed)

I made a quick fix/workaround for this.

Download/checkout : org.springframework.beans.BeanUtils.java

Add the below line after: writeMethod.invoke(target, value); (Around line 597) if using the 3.1 source.



if(logger.isDebugEnabled()){
logger.debug(MessageFormat.format("Source Property: {0}, Target Property:   {1}, Write method:{2}, Read Method {3} ", sourcePd.getName(),  targetPd.getName(), writeMethod.getName(), readMethod.getName()));
}

Add the file to your project. Now you can happily debug which property in the class is causing  problem.

Monday, June 20, 2011

Flex Builder 3 on Eclipse Ganymede

While this post might be obsolete, I believe its still useful.

I have had a problem this evening configuring Flex builder 3 with Eclipse. On the final step I was getting this annoying error and for that reason the installation fails:

Missing requirement: Flex Debug Plug-in for Eclipse 3.2 3.0.214193 (com.adobe.flexbuilder.debug.e32 3.0.214193) requires 'bundle org.eclipse.debug.ui [3.2.0,3.3.0)' but it could not be found.

The org.eclipse.debug.ui I have is much more higher version, so Flex shouldn't technically complain about this (3.5.x). I saw a lot of google posts asked by various users, but none had a solution. As I finally made it work, I thought it would be worth useful for somebody else out there.

Solution (Well precisely its not a solution, but a workaround)
  • Assuming you have already installed Flex builder.
  • Take a backup of : /com.adobe.flexbuilder.update.site/plugins/com.adobe.flexbuilder.debug.e32_3.0.214193.jar
  • unjar/open: com.adobe.flexbuilder.debug.e32_3.0.214193.jar
  • Edit META-INF/MANIFEST.MF
  • Remove the value : bundle-version="[3.2.0,3.3.0)" (which would be the last Require-Bundle section)
  • Update the Jar with the changes.
  • You might need to replace the modified com.adobe.flexbuilder.debug.e32_3.0.214193.jar into /plugins as well.
  • Restart and continue the flex update from eclipse.
This time the installation should pass. :)



Sunday, March 27, 2011

org.hibernate.util.JDBCExceptionReporter ORA-01407: cannot update (...) to NULL

I faced this issue for a while this afternoon while deleting a row which has a column referenced by a child table.



The cause for this is due to an incorrect JPA mapping:

Solution:
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "FK_QUESTION_ID", updatable=false, insertable=false)

updatable=false - column is not included in SQL INSERT statements generated by the persistence provider.
updatable=false - column is not included in SQL UPDATE statements generated by the persistence provider.

Tuesday, October 26, 2010

SOAP Monitor

Came across this brilliant tool for monitoring SOAP inbound/outbound messages:

http://java-source.net/open-source/web-services-tools/membrane-soap-monitor

This is more like a tunneling software, but purely for SOAP monitoring. It formats requests/responses for easiness.

YOu could use the SOAP-UI plugin for eclipse, but its quite heavy. One good thing I liked about SOAPUI eclipse plugin is its ability ot crete Junit test case from WSDL.

Tuesday, June 15, 2010

A very innovative tool...

Steve send a mail to the group about a cool online tool - Dropbox.


If you install DropBox on your desktop, it gives you a 'folder' which you can drop files into. The files are actually stored on the DropBox server.
When you get home, just click on the folder to access all your 'dropped' files. Much easier than emailing files to yourself and more convenient than Google docs.

If you use this link https://www.dropbox.com/referrals/NTgxMjE0NDQ5 (demo video and signup form)


You will get free 250MB of storage. I find it very handy.
No credit card details asked for - its free!

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