• i believe in what i do •
sirimalla_savechild_1098

September 2012 Archives

Android Application in 2 steps

| 0 Comments | 0 TrackBacks
Convert your web content into an Android web based application in 2 steps.
Just logon to AppsGeyser and start converting your web applications to Mobile application in 2 steps.

AppsGeyser free android app maker

HTML5 - Local Storage

| 0 Comments | 0 TrackBacks
HTML5 local storage, simple and better way to store data than cookies.
The localStorage object stores the data with no expiration date. The data will not be deleted when the browser is closed, and will be available the next day, week, or year.

Below is the code to use HTML 5 localStorage object.
working example click here

<!DOCTYPE html>
<html>
<title>HTML5 - Local Storage</title>
<body onLoad="init();">
<div id="result"></div>
<div id="myName_input" class="hide_ID" style="width:600px; height:50px;">
<form action="#">
<b>My Name:</b>
<input id="myName" type="text" name="myName" />
<button type="button" onclick="saveData()">Save to Local Storage</button>
</form>
</div>
<script>
function init(){
if(typeof(Storage)!=="undefined")
{
if(localStorage.myName){
document.getElementById("result").innerHTML="Hello <b> " + localStorage.myName + " !</b>";
document.getElementById("myName_input").className = 'hide_ID';
}else{
document.getElementById("myName_input").className = 'show_ID';
}
}
else
{
document.getElementById("result").innerHTML="Sorry, your browser does not support web storage...";
}
}
function saveData(){
var inputName = document.getElementById('myName').value;
localStorage.myName = inputName;
init();
}

</script>
<style>
.hide_ID
{
display:none;
}
.show_ID
{
display:block;
}
body
{
font-family:Verdana, Geneva, sans-serif;
font-size:12px;
}
</style>
</body>
</html>

ORACLE-Transpose Column Value to Row

| 0 Comments | 0 TrackBacks
This example demonstrates how to transpose column value to row
Simple select query from marks table

SQL> SELECT stud_id, sname, subject, marks from  marks;

stud_id	sname	subject	marks
------- ------- ------- -------
100101	Praveen	Math	90
100101	Praveen	English	75
100101	Praveen	Social	60
100101	Praveen	Telugu	90
100102	Ram	Math	89
100102	Ram	English	66
100102	Ram	Social	70
100102	Ram	Hindi	90
100103	Deepak	Math	92
100103	Deepak	English	85
100103	Deepak	Social	80
100103	Deepak	Hindi	76

12 rows selected.
 
SQL>

Below query displays the subject wise marks in a row for each Student.
SELECT stud_id,
  sname,
  NVL(MAX(DECODE(subject, 'Math', marks)), 'N/A') Math,
  NVL(MAX(DECODE(subject, 'English', marks)), 'N/A') English,
  NVL(MAX(DECODE(subject, 'Hindi', marks)), 'N/A') Hindi,
  NVL(MAX(DECODE(subject, 'Telugu', marks)), 'N/A') Telugu,
  NVL(MAX(DECODE(subject, 'Social', marks)), 'N/A') Social
 FROM marks
group by stud_id, sname;

Transpose query results

stud_id	sname	math 	english	 hindi	  telugu   social
------- ----    -----   -------- -------- -------- ------- 
100101	Praveen	90	75	 N/A	  90	   60
100102	Ram	89	66	 90	  N/A	   70
100103	Deepak	92	85	 76	  N/A	   80

get file from unix to windows

| 0 Comments | 0 TrackBacks
@ECHO ON
@ECHO OFF
ECHO ****************
ECHO This is an example of .bat to get files from unix server .
ECHO Navigate to PuTTy install location
ECHO This script assumes that you have valid UNIX ID 
ECHO ****************

c:
cd C:\Program Files\Putty
pscp -pw password userid@server:/usr/local/test.log d:\archive.

ECHO file copied 
ECHO **************** END *******************

d:
cd D:\archive

PAUSE
EXIT

save the code to .bat file.
Now, to run the batch file, double-click or run the file like any other program. Once the batch file has completed running press any key to close the window automatically.
This program requires PuTTy with pscp in the client system where the batch will be executed.
click here to get PuTTY