HERE YOU CAN FREE DOWNLOADS JAVA,JSP,SERVLET,STRUTS,SPRING,HIBERNATE,J2EE PROJECTS AND SAMPLE SOURCE CODES ABSOLUTELY FREE AND ACADEMIC PROJECTS DOWNLODS FREE !!!!
/*
Terminate Java Virtual Machine (JVM) Example
This Java example shows how to terminate currently running
Java Virtual Machine(JVM) using halt method of Runtime class.
*/
public class TerminateVirtualMachine {
public static void main(String args[])
{
/*
* get current Java Runtime using getRuntime()
* method of Runtime class.
*/
Runtime runtime = Runtime.getRuntime();
/*
* To forcibly terminate the currently running virtual machine, use
*
* void halt(int status)
* method of Runtime class.
*
* Usually, non-zero status is passed as status for abnormal exit.
*
* Please note that, unlike exit method, this method DOES NOT invoke
* shutdown hooks or run object finalizers.
*
*
*/
System.out.println("About to halt the current jvm");
runtime.halt(1);
/*
* THIS METHOD NEVER RETURNS NORMALLY.
* This statement will never executed, as the JVM is
* terminated!
*/
System.out.println("JVM Terminated");
}
}
/*
Typical output would be
About to halt the current jvm
*/
/*
Get Free Memory of Java Virtual Machine(JVM) Example
This Java example shows how to get amount of free memory
in the Java Virtual Machine(JVM) using freeMemory method
of Java Runtime class.
*/
public class GetFreeMemory {
public static void main(String args[])
{
/*
* get current Java Runtime using getRuntime()
* method of Runtime class.
*/
Runtime runtime = Runtime.getRuntime();
/*
* To determine amount of free memory available to current
* Java Virtual Machine(JVM), use
*
* long freeMemory()
* method of Runtime class.
*/
long freeMemory = runtime.freeMemory();
System.out.println(freeMemory + " bytes free in JVM");
}
}
/*
Typical output would be
4993048 bytes free in JVM
*/
/*
Get Available Processors using Java Runtime Example
This Java example shows how to get number of processors
available to current Java Virtual Machine (JVM).
*/
public class GetAvailableProcessors {
public static void main(String args[])
{
/*
* get current Java Runtime using getRuntime()
* method of Runtime class.
*/
Runtime runtime = Runtime.getRuntime();
/*
* use availableProcessors method to determine
* how many processors are available to the Java Virtual
* Machine (JVM).
*/
int numberOfProcessors = runtime.availableProcessors();
System.out.println(numberOfProcessors + " processor available to JVM");
}
}
/*
Typical output of this program would be,
1 processor available to JVM
*/
Another way for running this example is to download this example, Extract it and put the extracted folder in the GWT directory. Place this extracted folder in the samples directory of the GWT toolkit. Just double click on the cmd SimpleXML-shell.cmd to view the output of the program.
$host = "localhost";
$user = "root";
$password = "root";
$database = "komal";
$connection = mysql_connect($host,$user,$password)
or die("Could not connect: ".mysql_error());
mysql_select_db($database,$connection)
or die("Error in selecting the database:".mysql_error());
$array = array(1,2,3,4);
foreach ($array as $value){
$sql="Select * from stu where id =".$value;
$sql_result=mysql_query($sql,$connection)
or exit("Sql Error".mysql_error());
$sql_num=mysql_num_rows($sql_result);
echo "
$text = "\t\tThese are a few words :) ... "; $trimmed = ltrim($text); // $trimmed = "These are a few words :) ... " $trimmed = ltrim($text," \t."); // $trimmed = "These are a few words :) ... " $clean = ltrim($binary,"\0x00..\0x1F"); // trim the ASCII control characters at the beginning of $binary // (from 0 to 31 inclusive)
?>
Right - rtrim() function
$text = "\t\tThese are a few words :) ... "; $trimmed = rtrim($text); // $trimmed = "\t\tThese are a few words :) ..." $trimmed = rtrim($text," \t."); // $trimmed = "\t\tThese are a few words :)" $clean = rtrim($binary,"\0x00..\0x1F"); // trim the ASCII control characters at the end of $binary // (from 0 to 31 inclusive)