Thursday, February 21, 2013
Gson convertion between Object & String
Following JAVA function can be used to convert "Response" object to "String".
Gson library need to add to project.
Gson gson=new Gson();
Response response=new Response();
response.setStatus("OK");
response.setMessage("Test JSON");
String rtnStr=gson.toJson(response);
return rtnStr;
This code snip convert "String" to "Response" object.
Gson gson=new Gson();
Response r=gson.fromJson(str, Response.class);
Tuesday, February 19, 2013
Unzip batch of files in Linux
Following command can be used to unzip batch of files in Linux.
gzip -d *.gz
gzip -d *.gz
Rename batch of files in Linux
Following awk script can be used to rename list of files.
Here, it will rename ".txt.pdf" files into ".txt" files.
for k in *.pdf;
do mv $k `echo $k | sed 's/txt.pdf/txt/g'`;
done
Here, it will rename ".txt.pdf" files into ".txt" files.
for k in *.pdf;
do mv $k `echo $k | sed 's/txt.pdf/txt/g'`;
done
Copy files from one location to another in Linux
Following "scp" command can be used to copy files from one location to another.
scp * sujith@192.168.1.153:/apps/sujith/data
scp * sujith@192.168.1.153:/apps/sujith/data
Monday, February 4, 2013
SQL concat string in informix
Suppose database contains mobile_no field which has records like "0715355403".....
If you want to remove front "0" and add "94", you can use the following SQL command.
select "94"||mobile_no[2,10] from sms_request
This is can used in SQL where clause, too.
If you want to remove front "0" and add "94", you can use the following SQL command.
select "94"||mobile_no[2,10] from sms_request
This is can used in SQL where clause, too.
Subscribe to:
Posts (Atom)