import java.util.Date;
import java.text.SimpleDateFormat;
public class test{
public static void main(String args[]){
String dateStr = "26/08/2010";
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
try{
Date date = formatter.parse(dateStr);
System.out.println("Date is : " + formatter.format(date));
}
catch (java.text.ParseException e){
e.printStackTrace();
}
}
}
Sunday, July 18, 2010
How to convert a String to date object in Java
I am going to illustrate using an example
Tuesday, July 13, 2010
How to use wget to download a file
As i know you cannot download wget to download files from the web sites which needs authentication or human verification.
but most of the times you can directly get the URL of the file,
open a terminal and type (without [])
if you need to pass from a proxy if you did not set the proxy address yet
example
but most of the times you can directly get the URL of the file,
open a terminal and type (without [])
wget -drc [URL]
if you need to pass from a proxy if you did not set the proxy address yet
export http_proxy="[url]:[port]"
example
export http_proxy="http://cache.pdn.ac.lk:3128"
Sunday, July 11, 2010
How to clear the page cache memory from terminal
When your page cache memory is full your computer will be really really slow and
you may be unable to run even a single program.
So open a terminal and type as a root user
This will clear your cache memory and enables you to work faster than previously.
you may be unable to run even a single program.
So open a terminal and type as a root user
sync; echo 3 > /proc/sys/vm/drop_caches
This will clear your cache memory and enables you to work faster than previously.
How to add a 'nop' using C
When you write a C code sometimes
you will need to add an assemble nop(No OPeration)
this is how it goes..
for multiple nops add ';'
you will need to add an assemble nop(No OPeration)
this is how it goes..
__asm__("nop");
for multiple nops add ';'
__asm__("nop;nop;nop");
Saturday, July 10, 2010
How to change Grub in ubuntu
Unlike other grub versions, Grub 2 can be edited from the GUI and it is very easy
here is the steps for Ubuntu 10.04,
open a terminal and run
for this you will need an Internet connection, if not download it from here
now open System->Administration->Startup-Manager
here is the steps for Ubuntu 10.04,
open a terminal and run
when the Grub update finished, runsudo grub update
sudo apt-get install
for this you will need an Internet connection, if not download it from here
now open System->Administration->Startup-Manager

Wednesday, June 2, 2010
How To Change root password in Ubuntu 10.04
open a terminal and type:
you will be asked to enter current password or if you did not activate it
already you will be asked for the new password
like this
thensudo passwd root
you will be asked to enter current password or if you did not activate it
already you will be asked for the new password
like this
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Thursday, March 18, 2010
Cache Timing Attack on AES
in 2005 Daniel Bernstien announced a successful cache timing attack so that from there one can deduce the secret key.. Im working on a project which checks this attack for newer processors.. (core 2 duo and quad core etc..)
Subscribe to:
Posts (Atom)