Friday, November 27, 2009

Still Blog Does Not Appear In Google Search

You have a blog with some posts but still your blog not displaying in search results then this post will be useful for you.
Following steps will be useful for your blog/website appear in Google search engine.
Step1:
Verify your blog with Google webmaster tool.
above post will help you to handle Google webmaster tool.
if you got any crawl errors,solve it first.
Step2:
Get your friends to link to your blog, where your blog is relevant.
Step 3:

Participate in forums, where your blog is relevant, and include the URL.
Step 4:
Comment on other blogs, in relevant comments, and include the URL.
Step 5:

           Put relevant and useful content in your blog.
Step 6:
      Some search engines may index your blog using the site feed.  Be sure to activate the feed(check with Google webmaster tool).

Step 7:
          When you have done all of the above, your blog will have some weight.  Submit your blog to the search engines, for indexing.
Step 8:

    Post frequently, and keep the content of your blog moving.
Step 9:
          Avoid your blog/website loading problem(It shouldn’t take more time to load).
Step 10:
      Add your blog url in the following link.
Step 11:
         Check your robots.txt file with Google webmaster tool.
Step 12:
               Wait for few days until you get a following message in Google webmaster tool.
Googlebot has successfully accessed your home page.
Pages from your site are included in Google's index.

Tuesday, November 24, 2009

Best Blog Widgets

Widgets are designed to make your content more attractive and more enjoyable for your readers to consume.
You can get the some good widgets from the following urls.
Panoramic Slideshow
Live Activity
Photo Gallery
Feed Content 
Slideshow
Tag Cloud
How to get above widgets?
You just send your blog url/website address to following address
They will review your blog/website if satisfies their criteria then you
will get link for the above widgets.

Saturday, November 21, 2009

Java and XML

Following are the APIs for java with xml
1.JDOM
2.Java API for XML processing (JAXP)
3.SAX Parser

Useful links for java and xml

Useful tools for blogger

Google Webmasters tools

Google Webmaster Tools is free web service tool by Google for webmasters. It allows webmasters to check indexing status and optimize visibility of their websites.
Steps to use Google webmaster tool
1.First we need to do Login for Google webmaster.
2.Add your website/blog url using Add site button
3.Submit a Sitemap to tell Google about pages on your site we might not otherwise discover
Click Site Configuration section click sitemaps
for bloggers
   atom.xml
e.g
or we can add site feed also
e.g
Crawl access:
In this section we have robots.txt file to specify how search engines should crawl your site's content.
We can specify whether search should search your site/blog or not.
for unregistered bloggers can’t change their robot.txt file
If you have any problem with your sitemap or your site pages then you will get some crawl errors that will be displaying in crawl errors section.
If you don’t have any errors then after few days if googlebot successfully crawled your site/blog means you will get the below
message.
Googlebot has successfully accessed your home page.
Pages from your site are included in Google's index.

Google Analytics

 Google Analytics  is a free web service offered by Google that generates detailed statistics about the visitors to a website.
    

GoogleAnalytics

Windows Live Writer

Writer Live Writer makes it easy to share your photos and videos on almost any blog service—Windows Live, Wordpress, Blogger, LiveJournal, TypePad, and many more.
     It is a development tool/platform for blogger.And It has lot of features to post the blog easily.   

This update to Windows Live Writer 1.0 (Beta) features:

  • Tagging support
  • Support for Blogger Beta
  • Improvements to categories
  • And more...(details below)
      image

Thursday, November 19, 2009

Java - Card Layout

   Card Layout is used to manages number of panels(or components) in same dialog that share the same display space.
For example,
 1.Next, Back, and Cancel buttons in the same dialog to see number of panels with same or different components.
 2.We can create installation wizards.


Card Layout Example


import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class CardLayExample extends JFrame {
   
    private int currentCard = 1;
    private JPanel cardPanel;
    private CardLayout cl;
   
    public CardLayExample() {
       
        setTitle("Card Layout Example");
        setSize(300, 150);
        cardPanel = new JPanel();
       
        // getContentPane().add(cardPanel);
        cl = new CardLayout();
        cardPanel.setLayout(cl);
        JPanel jp1 = new JPanel();
        JPanel jp2 = new JPanel();
        JPanel jp3 = new JPanel();
        JPanel jp4 = new JPanel();
        JLabel jl1 = new JLabel("Label1");
        JLabel jl2 = new JLabel("
Label2");
        JLabel jl3 = new JLabel("
Label3");
        JLabel jl4 = new JLabel("
Label4");
        jp1.add(jl1);
        jp2.add(jl2);
        jp3.add(jl3);
        jp4.add(jl4);
        cardPanel.add(jp1, "1");
        cardPanel.add(jp2, "2");
        cardPanel.add(jp3, "3");
        cardPanel.add(jp4, "4");
        JPanel buttonPanel = new JPanel();
        JButton firstBtn = new JButton("First");
        JButton nextBtn = new JButton("Next");
        JButton previousBtn = new JButton("Previous");
        JButton lastBtn = new JButton("Last");
        buttonPanel.add(firstBtn);
        buttonPanel.add(nextBtn);
        buttonPanel.add(previousBtn);
        buttonPanel.add(lastBtn);
       
        firstBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                cl.first(cardPanel);
                currentCard = 1;
            }
        });
       
        lastBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                cl.last(cardPanel);
                currentCard = 4;
            }
        });
       
        nextBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                if (currentCard < 4) {
                    currentCard += 1;
                    cl.show(cardPanel, "" + (currentCard));
                }
            }
        });
       
        previousBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                if (currentCard > 1) {
                    currentCard -= 1;
                    cl.show(cardPanel, "" + (currentCard));
                }
            }
        });
       
        getContentPane().add(cardPanel, BorderLayout.NORTH);
        getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    }
    public static void main(String[] args) {
        CardLayExample cl = new CardLayExample();
        cl.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        cl.setVisible(true);
    }
}
 



 

Wednesday, November 18, 2009

Java Communication API - Serial Port Communication

The Java Communications API (also known as javax.comm) provides applications access to RS-232 hardware (serial ports) and limited access to IEEE-1284 (parallel ports), SPP mode.

How To use javax.comm


This package contains following files.
1.    comm.jar
2.    win32com.dll
3.    javax.comm.properties
Place the above files in below location.
comm.jar should be placed in:
    %JAVA_HOME%/lib
    %JAVA_HOME%/jre/lib/ext

win32com.dll should be placed in:
    %JAVA_HOME%/bin
    %JAVA_HOME%/jre/bin
    %windir%System32
javax.comm.properties should be placed in:
    %JAVA_HOME%/lib
    %JAVA_HOME%/jre/lib

Download Link:


How to Read data from Serial Port


import java.io.*;
import java.util.*;
import javax.comm.*;


public class ReadData implements Runnable, SerialPortEventListener {
    static CommPortIdentifier portId;
    static Enumeration            portList;
    InputStream                       inputStream;
    SerialPort                serialPort;
    Thread                     readThread;


public static void main(String[] args) {
    boolean                   portFound = false;
    String                      defaultPort = "/dev/term/a";


          if (args.length > 0) {
              defaultPort = args[0];
          }
  
          portList = CommPortIdentifier.getPortIdentifiers();


          while (portList.hasMoreElements()) {
              portId = (CommPortIdentifier) portList.nextElement();
              if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                   if (portId.getName().equals(defaultPort)) {
                       System.out.println("Found port: "+defaultPort);
                       portFound = true;
                       ReadData reader = new ReadData();
                   }
              }
          }
          if (!portFound) {
              System.out.println("port " + defaultPort + " not found.");
          }
         
    }

   public ReadData() {
          try {
              serialPort = (SerialPort) portId.open("ReadApp", 2000);
          } catch (PortInUseException e) {}


          try {
              inputStream = serialPort.getInputStream();
          } catch (IOException e) {}


          try {
              serialPort.addEventListener(this);
          } catch (TooManyListenersException e) {}


          serialPort.notifyOnDataAvailable(true);


          try {
              serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
                                                   SerialPort.STOPBITS_1,
                                                   SerialPort.PARITY_NONE);
          } catch (UnsupportedCommOperationException e) {}


          readThread = new Thread(this);


          readThread.start();
    }


 public void run() {
          try {
              Thread.sleep(20000);
          } catch (InterruptedException e) {}
    }


 public void serialEvent(SerialPortEvent event) {
          switch (event.getEventType()) {


          case SerialPortEvent.BI:


          case SerialPortEvent.OE:


          case SerialPortEvent.FE:


          case SerialPortEvent.PE:


          case SerialPortEvent.CD:


          case SerialPortEvent.CTS:


          case SerialPortEvent.DSR:


          case SerialPortEvent.RI:


          case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
              break;


          case SerialPortEvent.DATA_AVAILABLE:
              byte[] readBuffer = new byte[20];


              try {
                   while (inputStream.available() > 0) {
                       int numBytes = inputStream.read(readBuffer);
                   }


                   System.out.print(new String(readBuffer));
              } catch (IOException e) {}


              break;
          }
    }


}



How to write data to serial port


import java.io.*;
import java.util.*;
import javax.comm.*;


public class WriteData {
    static Enumeration            portList;
    static CommPortIdentifier portId;
    static String             messageString = "Hello, world!";
    static SerialPort       serialPort;
    static OutputStream       outputStream;
    static boolean          outputBufferEmptyFlag = false;
  

public static void main(String[] args) {
          boolean portFound = false;
          String  defaultPort = "/dev/term/a";


          if (args.length > 0) {
              defaultPort = args[0];
          }


          portList = CommPortIdentifier.getPortIdentifiers();


          while (portList.hasMoreElements()) {
              portId = (CommPortIdentifier) portList.nextElement();


              if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {


                   if (portId.getName().equals(defaultPort)) {
                       System.out.println("Found port " + defaultPort);


                       portFound = true;


                       try {
                             serialPort =
                                 (SerialPort) portId.open("WriteData          
                             ", 2000);
                       } catch (PortInUseException e) {
                             System.out.println("Port in use.");


                             continue;
                       }


                       try {
                             outputStream = serialPort.getOutputStream();
                       } catch (IOException e) {}


                       try {
                             serialPort.setSerialPortParams(9600,
                                                                 SerialPort.DATABITS_8,
                                                                 SerialPort.STOPBITS_1,
                                                                 SerialPort.PARITY_NONE);
                       } catch (UnsupportedCommOperationException e) {}
         


                       try {
                             serialPort.notifyOnOutputEmpty(true);
                       } catch (Exception e) {
                             System.out.println("Error setting event notification");
                             System.out.println(e.toString());
                             System.exit(-1);
                       }
                      
                      
                       System.out.println(
                             "Writing \""+messageString+"\" to "
                             +serialPort.getName());


                       try {
                             outputStream.write(messageString.getBytes());
                       } catch (IOException e) {}


                       try {
                          Thread.sleep(2000);  // Be sure data is xferred before closing
                       } catch (Exception e) {}
                       serialPort.close();
                       System.exit(1);
                   }
              }
          }


          if (!portFound) {
              System.out.println("port " + defaultPort + " not found.");
          }
    }



}





Monday, November 16, 2009

Check Valid XML File Using Java

We can check the XML file is valid or not in different ways. If we are opening the XML file in Internet explorer or XML notepad then if we get some errors means the XML file invalid, so it might be because of unclosed tag or invalid characters.
     Here is the program checks the xml file is valid or not.
import java.io.File;
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
public class CheckValidXML {
public static void main(String[] args) {


File xmlFile = new File("XML File Location");
if (xmlFile.exists()) {
if (isValidXMLFile(xmlFile.getAbsolutePath().toString())) {
System.out.println("Valid XML");
}
}
}
private static boolean isValidXMLFile(String filename) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();


try {
File f = new File(filename);
if (f.exists()) {
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(f);
return true;
}


} catch (SAXParseException spe) {
System.out.println("Invalid XML");
return false;


} catch (SAXException sxe) {
System.out.println("Invalid XML");
return false;


} catch (ParserConfigurationException pce) {
System.out.println("Invalid XML");
return false;


} catch (IOException ioe) {
System.out.println("Invalid XML");
return false;
}
return true;
}
}


Sunday, November 15, 2009

Java Swing - Icon as JButton

This section illustrates you how to show the icon on the button in Java Swing without border.
Example code.


import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Image;


import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JTextField;


public class IconButton extends JDialog {


public IconButton() {


JLabel filename = new JLabel("File Name");
JTextField filenameLoc = new JTextField(10);
Icon image = new ImageIcon(
"url of the image");
JButton iconButton = new JButton(image);
iconButton.setBorderPainted(false);
iconButton.setContentAreaFilled(false);
Container con = getContentPane();
con.setLayout(new FlowLayout());
con.add(filename);
con.add(filenameLoc);
con.add(iconButton);


setLayout(new FlowLayout());
setSize(500, 300);
setVisible(true);
}
public static void main(String[] args) {
IconButton obj = new IconButton();


}
}


Bookmark and Share
Hihera.com
Increase Page Rank Google
TopBlogDir.blogspot.com button
Best Indian websites ranking
Tips for New Bloggers
TopOfBlogs
The Link Exchange - Your ultimate resource for link exchange!

About This Blog

TopOfBlogs

FEEDJIT Live Traffic Feed

  © Blogger template Webnolia by Ourblogtemplates.com 2009

Back to TOP