Welcome to my blog, hope you enjoy reading
RSS

Thursday, 19 September 2013

Setting the PATH and CLASSPATH on Windows

For VERSION 1.5.0_02 of Java (new version)

 1.      Click on START (lower left)

2.      Under "Settings" click on "Control Panel"

3.      Switch to "classic view" (upper left) -- not "category view"

4.      Click on the "System" icon.

5.      Click on the "Advanced" tab.

6.      Click on the "Environment Variables" button (bottom).

7.      Highlight "PATH" (in the top window) and click the "edit" button.

NOTE:  DON'T EDIT OR MODIFY AND OF THE "SYSTEM VARIABLES" -- you could render your entire computer unusable! --

8.      Edit the "PATH" so it begins C:\Program Files\Java\jdk1.5.0_02\bin; (note: if you install Java into a different directory, you may need to change the directory from that listed above)

9.  After you have finished editing the PATH, click "OK".  You are done setting your PATH.  Now you have to create a new variable, called your CLASSPATH.

10.  Click on the "NEW" button below the top window.

11.  Under 'variable name' type CLASSPATH

12.  Under 'variable value' type . (yes, type a single period).

13.  Click OK.

14.  EXIT the control panel.

15.  Restart your computer.

16.  Test your installation by opening up a DOS window and verifying that both the commands "java" and "javac" are recognized.
Share

Thursday, 29 August 2013

How to increase mysql connections

How to increase mysql connections

If you are getting “too many connections” errors in MySQL. By default the max_connections is 100, you need to change the max_connections to allow more connections, you will need to have enough RAM/memory to handle the increased number.
Share

Eclipse ADT update does not work

Eclipse ADT update does not work

Problem:
I updated my android sdk to and I tried updating my adt via ecplise through
Help-> Check for updates.
This action results in the dialog that says -
'no updates found'
But my sdk says-
This android is SDK requires Android Development Kit 21.1.0 or above
  Current version is 21.1.0.v201212060256-543035.

Share

Monday, 26 August 2013

Data Types in java

Data Types in java


Based on the data type of a variable, the operating system allocates memory and decides what can be stored in the reserved memory. Therefore, by assigning different data types to variables, you can store integers, decimals, or characters in these variables.
There are two data types available in Java:
  • Primitive Data Types
  • Reference/Object Data Types
Share

How To See the Processor Model Number/Speed on Linux

If you rely on somebody else for managed hosting of your Linux servers, you might not always know exactly what type of server you’re actually running on. There’s a quick and easy way to figure this out, however.

Simply type in the following command at the prompt:

cat /proc/cpuinfo
And then you’ll see a big long list of all the processor in the system, along with all the information about them, which should look something like this:
output:
-------------------------------------------------------------------------------------
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 26
model name      : Intel(R) Xeon(R) CPU           L5520  @ 2.27GHz
stepping        : 5
cpu MHz         : 2267.545
cache size      : 8192 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 4
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
 mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe
nx rdtscp lm constant_tsc pni monitor ds_cpl est tm2 xtpr popcnt
bogomips        : 4538.12
-----------------------------------------------------------------------

You’ll see in this example that we’re running on an Intel Xeon L5520 running at 2.27GHz… and if we had shown the full example you’d see that there are actually 4 cores on the machine.
Share

Thursday, 22 August 2013

Upgrade to 12.04 in ubuntu stuck

Upgrade to 12.04 in ubuntu stuck

This time the crash is quiet. Nothing is happening. The screen displays the following and the disk light occasionally blinks but there is no progress indicated on the screen.
Share

Saturday, 3 August 2013

What svn revision was this branch created in?

What svn revision was this branch created in?

how do I find out in which svn revision a branch was created?

The answer is 
svn command: to show all the log from creating the branch.

svn log --stop-on-copy  url (url of the branch).

Share

Monday, 29 July 2013

Short form for Java If statement

Short form for Java If statement

problem:
if (city.getName() != null) {
    name = city.getName();
} else {
    name="N/A";
}

Solution:
name = ((city == null) || (city.getName() == null) ? "N/A" : city.getName());
Share

Friday, 19 July 2013

How to call URL from JAVA

How to call URL from JAVA



package com.javanotes2all.java.reqRes;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

public class CallUrl 
{
  public static void main(String[] args) 
  {
         URL url;
         try 
         {
             // get URL content
             String a="http://docs.oracle.com/javase/tutorial/jdbc/basics/sqldatasources.html";
             url = new URL(a);
             URLConnection conn = url.openConnection();
             // open the stream and put it into BufferedReader
             BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
             String inputLine;
             while ((inputLine = br.readLine()) != null) {
                     System.out.println(inputLine);
             }
             br.close();

             System.out.println("Done");

         } catch (MalformedURLException e) {
             e.printStackTrace();
         } catch (IOException e) {
             e.printStackTrace();
         }

     }

}


Share

Wednesday, 17 July 2013

case sensitive and insensitive condition in String replace function

case sensitive and insensitive condition in String replace function

            String target = "FooBar";
   target = target.replaceAll("foo", "");
   System.out.println(target); 
In java the above statements output is 'FooBar'
Share