Showing posts from August, 2012

JavaScript: Remove all backslash (\) from a String in JavaScript

How to remove  all backslash (\) from a String in JavaScript

function replaceAllBackSlash(targetStr){
      var index=targetStr.indexOf("\\");
      while(index >= 0){
      return targetStr;

Google App Engine: Cloud Storage: java.lang.NoSuchMethodError: org.objectweb.asm.ClassReader.accept(Lorg/objectweb/asm/ClassVisitor;I)V

Uncaught exception from servlet
java.lang.NoSuchMethodError: org.objectweb.asm.ClassReader.accept(Lorg/objectweb/asm/ClassVisitor;I)V
    at com.sun.jersey.spi.scanning.AnnotationScannerListener.onProcess(
    at com.sun.jersey.core.spi.scanning.uri.FileSchemeScanner$1.f(
    at com.sun.jersey.core.util.Closing.f(
    at com.sun.jersey.core.spi.scanning.uri.FileSchemeScanner.scanDirectory(
    at com.sun.jersey.core.spi.scanning.uri.FileSchemeScanner.scan(
    at com.sun.jersey.core.spi.scanning.PackageNamesScanner.scan(
    at com.sun.jersey.core.spi.scanning.PackageNamesScanner.scan(
    at com.sun.jersey.api.core.ScanningResourceConfig.init(
    at com.sun.jersey.api.core.PackagesResourceConfig.init(
    at com.sun.jersey.api.core.PackagesResource…

facebook share button

1) Using javascript
<div >
<script>var fbShare = {google_analytics: 'true', size: 'small',url: ''}</script>
<script src=""></script>


2) You can use FBML.....

<div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) return;
          js = d.createElement(s); = id;
          js.src = "//"; // appId must be valid; 
//  for example: APP_ID=172095742912464

          fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>
        <fb:share-button type="b…

FileZila error: 421: Could not connect to server

FileZila connection error:

421 Sorry, cleartext sessions are not accepted on this server. 
Error:Could not connect to server


Please add a ftpes:// before the domain name

Previous One,
host :
username : abcd
pass : ******
port : 21

Change this,
host : ftpes://
username : abcd
pass : ******
port : 21

Timesgroups interview questions: Servlet lifecycle : who called destroy() method of servlet

destroy() method is called by the servlet container. It is to indicate to a servlet that the servlet is being taken out of service. This method is only called once all threads within the servlet's service() method have exited or after a timeout period has passed.
  public void destroy() {
      anyDB = null;
How container knows that all the threads are exited and where we specify the timeout period for a servlet.

For more, visit link:

Timesgroups Interviews questions: Iterate hashmap in java

You can use the following different ways.....

1: Iterating HashMaps over entries using For-Each loop.

Use this if you need both map keys and values in the loop.

Map<String, String> map = new HashMap<String, String>();
for (Map.Entry<String, String> entry : map.entrySet()) {
    System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
2. Filterating over keys or values using for-each loop.......

If you need only keys or values from the map, you can iterate over keySet or values instead of entrySet.

Map<Integer, Integer> map = new HashMap<Integer, Integer>();
//iterating over keys only
for (Integer key : map.keySet()) {
    System.out.println("Key = " + key);

//iterating over values only
for (Integer value : map.values()) {
    System.out.println("Value = " + value);
3.: Iterating …

Times group Interview questions: Method overloading/overriding

is it overloading? will it compile, if not then why ?
  public void show(String a){

public int show(String a){

Solution: It is not mothod overloading as argument list must be different. It will not compile and compiler will give duplicate method error.

Timesgroup interview questions: Self JOIN with an example

A self-join is used when a table is joined (compared) to itself.  It means when you need to compare values in a column with other values in the same column in the same table. 
Use of self-joins:  obtaining running counts and running totals in an SQL query.

 Example: select,emp1.salary,emp1.state   from employee emp1,employee emp2
  where emp1.state=emp2.state;

  Name                     Salary          State
  Rajesh Singh           10250            Delhi
  Kavita                     10850                Delhi
  Kamal Singh           15250            Delhi
  Rajesh Singh           20250            Haryana
  Manish Kumar        15100            Haryana