™ not working with XML

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Sample HTML:


Save it as sample.html
In the browser you will see as shown beside.

Replace&#8482; with&#153;

Sample XML:

TM_SS2<html><head><title>HTML</title> </head> <body>Trademark&#8482; </body>

Save it as sample.xml
It will work fine.
Replace&#8482; with&#153;
It will not work.
The code positions from 128 to 159 are reserved for control codes like DELETE, NEXT LINE, SINGLE GRAPHIC CHARACTER INTRODUCER etc and these are not allowed in decoded XML.In windows char set (Windows-1252) some of the octets from the range 128-159 are assigned to printable characters. But in ISO 8859-1 character set they are reserved for control codes.
VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

java.awt.HeadlessException or X11 display

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

You develop an application in Java which uses AWT on Windows platform. Deploy the build in Unix box and when you hit the URL of the web application only to find that the charts, barcodes etc., are not displayed on the page.

Check the logs and you will see some Exception related to X11 display variable/HeadlessException. This happens when there is no X11 service running.

When you get errors like: java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it

Or, any other error related to X11 or graphics display.

Steps to set the DISPLAY variable:

1) Login with root privileges. This is to ensure that all the DISPLAY settings are common for all the privileges/profiles within root.

2) Execute this script: startx &

This will run the startx command in the background. The startx command is an easy way to start an X session if you’re working on a single computer or boot Linux to runlevel 3 mode (X11, multiuser and networking enabled). There are other ways to start X. The startx command is a handy shell script that will pass on command-line options to the X server for your X sessions. The startx command is typically used to pass starting color-depth information to the X server, as well as to find client commands or options to run for the session (usually your .xinitrc file in your home directory).

3) Execute this script to set the DISPLAY variable: export DISPLAY=localhost:0.0

This sets and Environment variables called DISPLAY. EVs store useful information for programs defaults or system state. If you look at your EV you will see a variable called “DISPLAY” this variable stores the address for X clients to connect to. These addresses are in the form: hostname:displaynumber.screennumber

4) Execute this command: xhost +

The xhost program is used to add and delete host (computer) names or user names to the list of machines and users that are allowed to make connections to the X server. This provides a rudimentary form of privacy control and security.

* xhost + hostname: Adds hostname to X server access control list.

* xhost – hostname: Removes hostname from X server access control list.

* xhost + : Turns off acccess control (all remote hosts will have access to X server)

* xhost – : Turns access control back

Once this is done, you can see all graphic related charts and images come up in your application.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

java.lang.OutOfMemoryError: PermGen space

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Every time we make a new build, we redeploy it, and after a few such redeployments it throws this error.

And we need to restart JBOSS. 

As we are seeing this error very frequently, I had googled it and found some information on this.

Here are the links to this information.

These links also say that after a few redeployments, JBOSS console shows up this error.




 Excerpt from links:

 In Sun JVM, garbage-collection of Java Heap is managed in generations (memory segments holding objects of different ages- Young Generation, Tenured Generation and Permanent Generation). Garbage collection algorithms in each generation are different.

 The permanent generation holds data needed by the virtual machine to describe objects that do not have equivalence at the Java language level. For example objects describing classes and methods are stored in the permanent generation.

Applications with large code-base can quickly fill up this segment of the heap which will cause java.lang.OutOfMemoryError: PermGen

We can increase the PermGen (Permanent Generation) size in JVM, but this just delays the error and cannot get rid of it. 

To tackle this, posts suggest two options:

  • Restart the JBOSS every time we redeploy.
  • Change the Sun JVM to some other JVM.

Links also suggests JRockit JVM as it doesn’t have a PermGen area and can never throw this error.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

A tryst with brown rice

VN:F [1.9.22_1171]
Rating: 4.0/5 (2 votes cast)

I am always hungry, whatever I eat gets digested in a couple of hours:-)  It was okay while in college but the IT job got me a potbelly.

Read somewhere that white rice has simple form of carbohydrates whereas brown rice has complex carbohydrates and our body has to burn extra calories to digest it and it also keeps you full for a longer time.  Also as the Internet says, it comes with all the goodies like high fiber content etc.  So decided to give it a go and a bit of googling revealed that it is kinda challenge to cook brown rice.  It either remains uncooked a bit or is burnt & sticks to the bottom of the vessel.

I am good at cooking white rice in both vessels & pressure cooker.  So unfazed by the googled facts I set on for a tryst with brown rice.  Here is how it turned out…

  • Took a part of brown rice (normal not basmathi) and wahsed it.
  • Then soaked it in two parts of water for 30-min.  Actually, was watching videos on Youtube & realised only after 30 min:-)
  • Put the vessel on stove with flame enough to cover the base till the water boils.
  • Now reduce the flame a bit and allow it to cook with the lid slightly open (for steam to escape).  Stir it once or twice in between.
  • When water is almost over, close the lid completely and put the flame on simmer.  After a couple of mins turn the flame off & leave it for 5 min.

 Brown rice

You are ready to eat now!!  It turned out good but takes more time to cook than that of white rice.  Taste was okay too, it is eatable.  I had it with Tomato Dal, Mango Pickle and Curd/Yogurt.  Probably I will start eating it often and will be cooking in pressure cooker.

***Liked it?  Click the facebook like button below & let your friends know what you like!!

VN:F [1.9.22_1171]
Rating: 4.0/5 (2 votes cast)