Java J2ME JSP J2EE Servlet Android

Print a part of a webpage using javascript

We can easily print a part of a webpage by calling window.print() .

Here is an example to print a <div>


<html>

<head>

</head>

<body>

<div style = "width:100%;height:100" id="myDiv">

This is to print<br/>

Testing

</div>

<div style = "width:100%;height:100">

This is not to print<br/>

Testing

</div>

<br/>

<span onClick="printIt();">Click here</span>

<script type = "text/javascript">

function printIt(){


wi = window.open('', 'p');

wi.document.open();

element=document.getElementById("myDiv");

wi.document.write(element.innerHTML);

wi.print();

wi.document.close();

wi.close();

}

</script>

</body>

</html>

Eclipse plug-in for android development

Eclipse is now a days popular IDE for software developers. Google provides a plug-in for eclipse to ease android development. Follow the following steps to add android plug-in into your eclipse IDE.

1. Click help from eclipse menue



2. Click on Software Updates...



3. A new window will come. Click on Add sites



4. Type http://dl-ssl.google.com/android/eclipse/ in location field then press OK.



5. Now check the ckeck boxes left to new android update site name. And press Install



6. Check all check boxex in new popup window and click Finish.


7. Next follow the normal installation steps to complete installation.

Now your eclipse is ready for android software development.

Android : What is android?

Android:

Android is a Software Development platform as well as an Operation System for mobile devices based on Linux karnel. Android is developped by Open Handset Aliance (first by Google). It was releasen on november 2007. Android is developped in C.

Android software development tool is Java Programming Language, controlling the device by java libraries developped by google.

Avoid large white space in blogger/blogspot before table/ Table problem

If you want to use table in blogspot blog and many other blogs using <table> as following way..
<table>

<tr>
<td></td>
<td></td>
<td></td>
</tr>

<tr>
<td></td>
<td></td>
<td></td>
</tr>

</table>

You'll see a large white spaces before the table. This is for each time you press [ENTER] for new line blogspot generates a line break <br> and when you view the blog you'll find a whitespace for each <br> before the table.

If you want to avoid this unwanted white space just use the following code

<style type="text/css">.eatbr be{ display: none }</style>
<div class="eatbr">
PUT YOUR CODE FOR TABLE HERE
</div>

This will eat <br> inside it..

Happy Blogging...

JAVA: Accessing properties file(resource) inside jar

You can not load a properties file inside a jar as following way..


Properties props = new Properties();
props.load(new FileInputStream("conf.properties"));


In this case you have to use

Properties props = new Properties();
InputStream in = this.getClass().getClassLoader().getResourceAsStream("conf.properties");
props.load(in);


I hope this will help you. For any other query you can post question as comment.