Welcome to my blog, hope you enjoy reading

Monday, 24 February 2014

Project facet Java version 1.7 is not supported

Project facet Java version 1.7 is not supported 

When i update my java I found the issue "Project facet Java version 1.7 is not supported" To resolve this issue follow the steps.
  1. Go to Ecllipse , right click on your project folder
  2. select the properties
  3. now select Project Facets ,here you will see java, click on the version and change the higher version to lower or as per your requirement .


Sunday, 23 February 2014

How to Use RichTextToolbar in GWT

How to Use RichTextToolbar in GWT 

If you’ve ever tried to use the RichTextToolbar that is showcased in the Gwt Showcase, you will quickly find out that it’s not actually built into GWT.  Many GWT developers have experienced this WTFery, as their hopes to conveniently import RichTextToolbar have been dashed.  It is supposedly so that developers are not locked into using that toolbar, but of course, a good default is better than no default…

As you can see here, multiple bugs have been filed about this exact issue since 2008, to no avail!  Drats, I guess it is one of those things that has low priority because there’s a work-around, but it does affect a good number of developers, which should count for something.

Anyway, to use it in your code:

  •     Navigate to <path>/gwt-2.0.3/samples/Showcase/src/com/google/gwt/sample/showcase/client/content/text on your computer, and you should see a bunch of icons, RichTextToolbar.java and RichTextToolbar$Strings.properties.
  •     Copy RichTextToolbar.java and RichTextToolbar$Strings.properties and paste them into your source code folder and modify the package names accordingly.
  •     Copy all the icons and paste them somewhere (I created a folder  <project>/client/icon)
  •     In RichTextToolbar.java, above each “Image Resource…”, you will need to indicate the source of the image.  For example,


    ImageResource bold();

    if the directory you copied RichTextToolbar.java is under client.

That’s it, a little annoying, but hopefully it will find its way into GWT itself soon, though don’t hold your breath.

Also, you can easily play around with the Toolbar– I removed the bottom row of ListBoxes that give you lots of control over background and foreground colors, font and font sizes (I don’t want my users to have that much control over how my website looks!), and it ends up looking like this:

Hope that helps, and that it will save a few people some time!

Related posts:


Allow only Numeric in HTML inputbox

Allow only Numeric in HTML inputbox Following code is used to allow only numeric (0-9).

<script language="Javascript">
      function isNumber(evt) {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;
         return true;
<input onkeypress="return isNumber(event)" type="text">

Another Way

Following code is used to allow only numeric (0-9).
<script language="Javascript">
     function validate(evt) {
      var theEvent = evt || window.event;
      var key = theEvent.keyCode || theEvent.which;
      key = String.fromCharCode( key );
      var regex = /[0-9]|\./;
      if( !regex.test(key) ) {
        theEvent.returnValue = false;
        if(theEvent.preventDefault) theEvent.preventDefault();
<input onkeypress="return isNumber(event)" type="text">


STRUTS : java.lang.IllegalAccessException

STRUTS : java.lang.IllegalAccessException

STRUTS : java.lang.IllegalAccessException: Class org.apache.struts.util.RequestUtils can not access a member of class view.myAction with modifiers "


Thursday, 13 February 2014

Wampserver : #1045 – Access denied for user ‘root’@'localhost’ (using password: NO)

Here is a simple way to solve #1045 – Access denied for user ‘root’@'localhost’ (using password: NO) error…

Just follow the steps:

Note: [WAMP_PATH] is the path to the wampserver directory in your computer so it can be anything. Default (C:\wamp).

   1. First, go to [WAMP_PATH] > apps > phpmyadmin3.5.1.
   2. Then find and open config.inc.php in your text editor
   3. Now find $cfg['Servers'][$i]['password'] = ”; and change it with $cfg['Servers'][$i]['password'] = ‘admin’; (You can put anything in place of admin as your password, this is only a test password).
   4. Now find $cfg['Servers'][$i]['AllowNoPassword'] = true; and replace it by $cfg['Servers'][$i]['AllowNoPassword'] = false;.
   5. Thats it now save that file.
   6. Now restart the wampserver. To do this left-click the wamp icon in the windows taskbar (Notification one), a box will pop up then just click on Restart all Services.

Yeah! You have successfully resolved the error. If you face any error make sure to comment or email me.

For login page getting
1.find $cfg['Servers'][$i]['auth_type']  and change the value like
$cfg['Servers'][$i]['auth_type'] = 'cookie';
2.save the page.
3.restart the server.
for info see the link video.


Saturday, 1 February 2014

How to swap keys and values in a Map

How to swap keys and values in a Map 

package com.javanotes2all.java.collectionfw;

import java.util.HashMap;
import java.util.Map;

public class SwapKeysAndValuesinMap {

 public static void main(String[] args) {
  HashMap map=new HashMap();
  map.put("1", "a");
  map.put("2", "b");
  map.put("3", "c");
  map.put("4", "d");
  map.put("5", "e");
  map.put("6", "f");
  map.put("7", "g");
  System.out.println("before swap"+map);
  System.out.println("after swap"+map);
 public static  HashMap reverse(Map map) {
     HashMap rev = new HashMap();
     for(Map.Entry entry : map.entrySet())
         rev.put(entry.getValue(), entry.getKey());
     return rev;