Showing posts with label in. Show all posts
Showing posts with label in. Show all posts

Wednesday, April 19, 2017

Duel in the Dunes AAR

On Sunday Ninjasaurus Rex and I gathered at Deans place for our second game in the desert campaign that Dean has started running. This was a fictional encounter between an Italian defence force facing against a British recce unit. Both sides were expecting reinforcements which would enter the game at a random point and randomly along the start lines. 

The Italian defenders were dug-in and consisted of two companies of colonial troops, a couple of heavy machine guns, two mortars, higher command and two field guns. The British attackers had two sections of engineers and higher command in Universal Carriers, three Vickers MK IV light tanks, three Humber Mark Is, two companies of infantry in trucks, supported by mortars, a 6lber Portee truck, a towed AA gun and two towed 25lbers. A quite light force, all in all. The reinforcements for both sides consisted of various tanks.

A wadi ran the length of the table, which gave protection from fire and spotting, but could only be entered in two places. The Italians held the top of the table helped by two mine fields and belts of barbed wire. I took the British and this was the initial set up.


With the threat of reinforcement coming at any time, I felt it better to hit the Italians hard and pushed forward into them.


However, his initial round of reactive fire took out a Universal Carrier, a Humber scout car and heavily damaged another Humber.


Not only that, but he destroyed the AA gun and truck along with the truck for the portee gun! I was complacent about the Italians from the previous game and things were not looking good!


Mind you, once my forces began firing things shifted, I silenced a machine gun and one of the field guns.


Nosing forward, I directed the two remaining Humbers around the mine field and got the Vickers tanks close to the sand dunes where more Colonial troops were hiding.


Italian fire was not as successful this time as my infantry de-bussed and exchanged shots with them behind their defences.


The engineers began clearing the large minefield in front of the Italian wire and the 25lbers set up behind the safety of the wadi in order to commence firing on the Italian positions.


There was hard fighting in the centre with the Italians losing out to my armoured cars and infantry.


On the right flank the three Vickers crested the sand dunes and started firing at the colonial troops behind them.


The British higher command in the Universal Carrier directed the 25lbers to fire on the Italian positions, but with very desultory results.


It was the rifles of the infantry and machine guns of the vehicles that were causing the most damage.


The minefield was cleared and on the right flank the Vickers tanks had forced the colonial troops back to the defences, British infantry on the left swarmed over the barbed wire and the Italians were very much on the back foot at this stage.


It was looking decidedly empty on the Italian side of the lines as the British tracked vehicles chewed up the barbed wire. Still no sign of reinforcements from either side though!


Then suddenly swooping out of the sun an Italian CR.42 Falco strafed the British higher command in the Universal Carrier. They were easy pickings with no AA fire from my side.


The aircraft killed the passengers and the loss of my commander as a spotter effectively put my 25lbers out of action.


Despite taking heavy losses, my morale stayed intact and the Humbers and Vickers were able to destroy the remaining Italian defenders. We decided that the reinforcements would have been shot to pieces as they arrived so finished the game there with another British victory.


It was another exciting and action packed fight in the desert. The Italian defence looked pretty sharp initially, but was soon knocked about by the armoured vehicles. The high losses on my part were due to a reconnaissance unit being forced to attack rather than heading back to the main unit to report! It certainly looked touch-and-go when the Italian fire started wrecking my attack...

We finished the day off with two games of Memoir 44, which Dean had got for Christmas but had not yet played. I won both of those as well...

Thanks for reading!
Read more »

Wednesday, April 12, 2017

Download Tom And Jerry In House Trap PSX ISO High Compressed

Tom And Jerry In House Trap adalah game PS1 kucing Tom dan tikus Jerry yang akan saling mengejar dan memukul satu sama lain dengan memakai senjata seperti petasan, dynamit, payung, sekop dll hingga salah satu diantara mereka ada yang K.O. Game ini juga memiliki berbagai macam misi untuk diselesaikan.

Kali ini saya akan share Tom And Jerry In House Trap PSX ISO High Compressed, silahkan download bagi sobat yang ingin bermain game kucing vs tikus.




Screenshot :


Download
Tom And Jerry In House Trap PSX ISO High Compressed

Download Emulator Game PS1 Untuk PC
disini

Download Emulator Game PS1 Untuk Android
disini

Read more »

Saturday, April 8, 2017

Download The Wolf Among Us Ep 4 In Sheeps Clothing PC

       O terceiro episódio de The Wolf Among Us, In Sheeps Clothing desenvolvido pela mesma equipe de The Walking Dead, é um jogo de clima violento, adulto e cheio de suspense e muita emoção. Baseado na história em quadrinhos Fables, vencedora de vários prêmios. Você controla Bigby Wolf, e precisa descobrir o que está por trás de um brutal assassinato. Porém, esse crime é apenas um aperitivo do que virá ao decorrer da historia, onde cada decisão sua tem um peso no futuro, o qual lhe reserva diversas surpresas garantindo uma grande expectativa dos jogadores.







The Wolf Among Us - Episodes 1,2,3 e 4
Tamanho: 4,44 GB
Gênero: Ação/ Aventura/ Ficção
Lançamento: 28 de Maio de 2014
Plataformas: PC/ xBox 360/ PS3/
MAC/ iOS/PSVita
Desenvolvedor: Telltale Games
Distribuidor: Telltale Games
Multiplayer: Não
Idioma: Inglês
Site Oficial / Steam
The Wolf Among Us Ep. 1: Faith
The Wolf Among Us Ep. 2: Smoke and Mirrors
The Wolf Among Us Ep. 3: A Crooked Mile
The Wolf Among Us Ep. 5: Cry Wolf

Processador: Intel Pentium IV/ AMD Equivalente
Velocidade do Processador: 2.0 GHz
Memória RAM: 2 GB
Placa de Vídeo: Não Informada
Memória Placa de Vídeo: 512 MB
Versão do DirectX: 9.0c
Sistemas Operacionais: Windows XP (SP3)
Espaço Livre em Disco: 4 GB Livres em Disco

Processador: Intel Core i3/ AMD Equivalente
Velocidade do Processador: 4 Núcleos de 2.3 GHz
Memória RAM: 4 GB
Placa de Vídeo: Não Informada
Memória Placa de Vídeo: 1 GB
Versão do DirectX: 9.0c
Sistemas Operacionais: Windows 7 e 8
Espaço Livre em Disco: 3 GB Livres em Disco

Este arquivo contém os episódios 1,2, 3 e 4 de The Wolf Among Us.
1º: Monte a imagem iso utilizando o Daemon Tools.
2º: Prossiga normalmente com a instalação do jogo.
3º: Copie os arquivos da pasta "CODEX" para o diretório do jogo.
- É recomendável bloquear o executável do jogo no firewall.
- Tenha seu computador atualizado (DirectX, C++, Framework, Drivers...)
- Se gostou do jogo, compre o original e contribua com os desenvolvedores!
Pronto, divirta-se!


Trailer The Wolf Among Us Episode 4: In Sheeps Clothing:
Read more »

Sunday, February 15, 2015

LG touch screen watch Phone Lands In India









April 25th, 2010

NEW DELHI, INDIA (GaeaTimes.com)- It is not surprising to see mobile phones that perform various other tasks than making or receiving calls nowadays. There are plenty of models in the market that double up as music player and camera. However, it is not everyday that one comes across a touch screen phone that is built in a watch form factor. That is what the LG Watch phone is all about. It looks like a designer watch but inside there is a sophisticated phone brimming with cutting edge features. It weighs only 84 gram and hence one can wear it without straining his wrist. However, this is quite expensive at 40,000 INR and only the hardcore gadget freaks with deep pockets will opt for it.

The LG Watch phone has been launched in India and it is available in LG flagship outlets across the country. The phone uses a capacitive type touch screen resulting in excellent feedback and it displays 256,000 colors. The resolution at 128 x 160 pixels is not much but then you have to consider its unique form factor. The UI is flash based and it is very responsive.

The LG Watch Phone is water resistant which means one can use it in rain without any fear of damaging it. Its music playback capacity is also praiseworthy and there is an equalizer to customize the music quality as per the taste of the uses. The VGA camera is capable of making video calls. There are lots of connectivity options offered by this model. Apart from the GPRS and Edge, there is HSDPA for high sped

http://gadgetophilia.com
Read more »

Saturday, February 14, 2015

Business Card Template in Ai EPS

Business Card Template in Ai & EPS

Free Download Beautiful Business Card Design Template in Vector (.ai, .eps). This business card is a perfect example for new designers as it includes all the essential elements covering social media profile links & QR code.

Type : Ai, EPS
Category : Cards
License : Free
Author : Designbolts
Download
Read more »

Adding dollar sign to X axis lables values for bar charts in pentaho CDE

Hi Guys,
Using below java script one can easily add $ sign to the values of X-axis for any charts in pentaho CDE.
Example:
function f(v) { return "$" + sprintf(%d, v/1000) + k; }


Write the java code in "orthoAxisTickFormatter" java script wizard.
Make sure to give orthoAxisTicks as "True"

Sample output:


NOTE:
This code works with 13.06 as well with 13.09 version of pentaho CDE.
Also note that in java script if one line is not executing then the remaining lines will not execute. i.e., for instance you have 10 lines of code and 4th line is not executed then the remaining lines will not execute. Check with an alert function.


Sadakar Pochampalli
BI developer

Read more »

Wednesday, February 11, 2015

Conditional coloring of cell values in pentaho CDE table component Table component customization

Hello Guys,

This post will talk about one of the major component of pentaho CDE. i.e., Table component.

Table component is offering many features like sorting, searching, pagination, selected number of rows per page on the dashboard....

Some times we may not need these built in features but need our own features like conditional coloring of cell values .. In that case the below customization tips might useful for you..

This post will brief about below features. 
1. Removing default row banding.
2. Give back ground color table headers.
3. Group by table component.
4. border to all the cells
5. bar Type cell feature along with value.
6. trendArrow cell type feature along with value.
7. circle type cell ( not customized yet, will try to workout in future posts).
8. color change of pagination buttons
9. conditional coloring of cell values.

Future work outs on the table component. 
1. Expand rows.
2. Removing groupHeader preSpace & groupHeader postSpace (if any one done this please post your solution in comment box).
3. Difference b/w Hyperlink type cell and hyperlink on table rows.
4. Group by summation values.
5. Summation of table columns either page wise or total. 

Id already posted tool tip on table component cell values. 
You can refer that example here along with example code .

Readers of this post is encouraged to add your solutions for the future work outs if you have already done in comment box.. That will be very helpful for the community developers. 

Of course, most of the things can be done using css overriding but it is a bit matter on implementing in CDE.

Software Setup :
Pentaho BA Server 5. 0.1 CE , C-Tools(CDE,CDF,CDA) of Trunk (after 14 verion), foodmart database of postgesql(formally jasper server back end database), Mozilla fire fox along with fire-bug Addin.

Id like to share the core part of the example and the remaining things you can see by opening the example(source code) attached later here.

Basics about table component. 
1. You can give types (CDE+data tables types) to the columns for table component(which differs from
2. You can insert charts for the cell values.
3. You can  give hyperlink types (should take hyperlink values - not the regular hyperlink)

Steps :
1. From Lay out section  Row - Column(give html Object Name)
2. From Datasource section give code an SQL query for your table component.
 For example: (Name it : query1_TableComponent) assuming you are already aware of giving connections.
select distinct state_province AS state,
city,
CASE WHEN sum(unit_sales)<=5000 THEN sum(unit_sales) ELSE 9000 END   UnitSales,
CASE when sum(store_sales)>=3000 then sum(store_sales) ELSE -sum(store_sales) END StoreSales,
sum(unit_sales) UnitSales2,
sum(store_sales) StoreSales2,
sum(unit_sales) UnitSales3,
sum(store_sales) StoreSales3
from sales_fact_1997 sf7
INNER JOIN customer c ON sf7.customer_id=c.customer_id where country like USA
group by state_province ,city
ORDER BY state_province ,city

Output actions proprery:
Give indexes to your query output: In the above query you are having 8 columns so you will be giving 0,1,2,...7 indexes. 

3. Components section :
Add table component as you generally do and name it and give datasource name and give below types to each of the columns.. 


In the Pre-Execution section you need to write Add-ins code for customization. If you dont write add-in code, the cells will take default behavior of types. 

 function f(){  
//conditional coloring of cells
    this.setAddInOptions("colType","formattedText",function(cell_data){
       
        var percentage = cell_data.value;
       
        if(cell_data.colIdx == 7) // column index
        {
            if(cell_data.value === || cell_data.value === null) //checking the null possibility
            {
                this.value = 00000;
            }
        }
       
        if(percentage <=8000){
            return {  textFormat: function(v, st) { return "<span style=color:red>"+v+"</span>"; } };
        }
         else {
            return { textFormat: function(v, st) { return "<span style=color:green>"+v+"</span>"; }  };
            }
      });

     
     
    //bars 
    this.setAddInOptions("colType","dataBar",function(column4){
       return {
                includeValue:true,
                widthRatio: 0.8,
                startColor: "red",
                endColor: "green"
              };
    });



    //trendArrow
    this.setAddInOptions("colType","trendArrow",function(column5){
       return {
            includeValue: true,
            good: false,
            valueFormat: function f(v) { return "$" + sprintf(%d, v/1000) + k; }


       };
    });
   

     
 }//main function ending


The core part of this post is conditional coloring of cells... the first part of the above code will conditionally apply the color to the cells.. itll give some idea on how to increase the chances of customization on table component. 

The other goal of the post is : removing and styling table component using css code. .

Either you can apply below css code in External file and locate or A Code snippet for the dashboard.. 
In this demonstration, Ive taken it in Code Snippet and code is :

body{
    margin-top: 0.5cm;
}
.overflow {
overflow: auto;
}


#The below will remove default -row banding
table .even, table .odd{ background-color: white; }
table
{
    align-left:200px;
}
#This will add back ground styling for table header row
table th {
    background: black;
    border: 1px none #B3B3B3;
    color: #FFFFFF;
    font-family: Century Gothic;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}
#This will add borders to the cells
table td {
    border-left: 1px solid #A9A7A1;
    border-right: 1px solid #A9A7A1;
    border-top:1px solid #A9A7A1;
    border-bottom:1px solid #A9A7A1;
    height: 20px;
    font-size:14px;
    /*padding-left: 10px;*/
    vertical-align: middle;

#This will be useful for changing the style of pagination symbols.
.paging_full_numbers span.paginate_active {
    background-color: #FF0000;
}
.paging_full_numbers span.paginate_button, .paging_full_numbers span.paginate_active {
    border: 1px solid #008000;
    cursor: pointer;
    margin: 0 3px;
    padding: 2px 5px;
}

.paging_full_numbers {
    line-height: 18px;
}
.dataTables_paginate {
    text-align: center;
}



 Download the example here and play around with it. 


or

https://drive.google.com/file/d/0BymV_QP4TGBEU09kN1VUVGJRdVE/edit?usp=sharing



 Sadakar
BI developer






  
Read more »

Tuesday, February 10, 2015

Arrays in C 2D Array Part 5

Till now I told you about the 1D arrays but today I will discuss about the 2D arrays or two dimensional arrays in c. Array is a collection of elements with similar data type. We can make arrays with any dimension. However programmers rarely go beyond 3D arrays. I will also give you an overview on 3D arrays in the subsequent tutorials. But today lets discuss the 2D arrays briefly.


2D Arrays in C

As its name suggests, 2D arrays are the arrays having 2 dimensions. Those two dimensions are generally called rows and columns. 2D arrays are also called matrix.


Declaration of 2D Array

A two dimensional array can be declared in following way.

int a[3][3];

This is a 2D array with 3 rows and 3 columns. The total elements in the array are 9 (3x3).


Initialization of 2D Array

Similar to 1D arrays, a 2D array can also be initialize at the time of its declaration. Given below are some of the initialization methods that are used very frequently.

int num[3][2] = {
{43,56},
{56,54},
{65,98}
};

This is one of the simplest way of initializing a 2D array.

int num[3][2] = {43, 56, 56, 54, 65, 98};

This method will also work but it will decrease the readability of the array too.

int  arr[ ][3] = { 12, 34, 23, 45, 56, 45 } ;
int num[][2] = {
{43,56},
{56,54},
{65,98}
{87,86}
};

It is optional to provide the row dimension of a 2D array if we initialize it. Remember giving column dimension is always compulsory.

Lets take one simple program to understand 2D array in C.


#include<stdio.h>

int main()
{
int student[6][2];
int x;

for(x=0;x<6;x++)
{
printf(" Enter roll no. and marks
");
scanf("%d %d",&student[x][0],&student[x][1]);
}

for(x=0;x<6;x++)
printf("
%d %d",student[x][0],student[x][1]);

return 0;

}

Output

Arrays in C (2D Array) - Part 5

Explanation
1. In the first statement I have declared the 2D array with name student. Remember 2D array also stores elements with index 00. Elements will be stored in this way.

00 01
10 11
20 21
And so on.

2. Now by using two for loops I have stored the values inside 2D array and display it on the screen.

3. Consider carefully the printf() and scanf() function with arguments “&stud[x][0], &student[x][1]”. We are storing and accessing values inside 2D array by row wise. We can also store values and access them column wise too.


Memory Allocation of 2D Array

2D arrays also stores its values similar to 1D arrays. They also store elements in contiguous memory locations.

Elements of first row will be stored first, after that elements of second row will be stored. This procedure will continue until the array elements ends. Given below is the memory allocation of a 2D integer array s[4][2].


Memory Allocation of 2D Arrays
Read more »

Thursday, February 5, 2015

Seven Languages in Seven Weeks Ruby Day 1

I recently picked up a copy of Seven Languages in Seven Weeks by Bruce A Tate. The book is a survey of seven very different programming languages: Ruby, IO, Prolog, Scala, Erlang, Clojure, and Haskell. For each language, the goal is to give you just enough of a taste that you can see what makes it unique, what its strengths and weaknesses are, and the mindset and philosophy behind it.


Each section of the book focuses on a different language and includes coding problems for the reader to try at home. Ive decided to record my my solutions to the problems and thoughts about each language in my blog. Today, well start with Ruby.

Ruby, Day 1: Thoughts

Ive used Ruby fairly extensively the last few years, including several Ruby on Rails apps (Resume Builder, Veterans Hackday) and a number of utility scripts. There is a lot to like about Ruby - the concise & clean syntax, incredible flexibility, expressiveness, powerful DSLs - but my favorite part is the central tennet of the language, as expressed by its creator:
"Ruby is designed to make programmers happy." Yukihiro Matsumoto
The language isnt built for speed, concurrency, or any particular feature set. Its central "success metric" is programmer happiness and productivity, which are, arguably, the biggest bottlenecks in most projects.

Ruby, Day 1: Problems

The "Day 1" Ruby chapter focused on the very basics of the language, so I didnt learn anything new. The problems are extremely simple and basic, but for completeness, here are my solutions:

Hello, World
Print the string "Hello, world".


Hello, Ruby
For the String "Hello, Ruby", find the index of the word "Ruby".


Print Name
Print your name ten times.


Print Sentence
Print the string "This is sentence number 1" where the number 1 changes from 1 to 10.


Random Number
Write a program that picks a random number. Let a player guess the number, telling the player whether the guess is too high or too low.


Ruby vs. Java

Coming from a Java background, every time I see Ruby, Im amazed at how concise and readable it is. There is far less boilerplate: you dont have to wrap everything in classes and methods, no semi-colons, far fewer curly braces, and so on. Everything is an object and there are countless helper functions, all with intuitive names: even if youve never used Ruby, its easy to guess the effects of 10.times or 1.upto(10). Whereas in the Java world, libraries seem to compete on having every bell, whistle, and tuning knob, in the Ruby world, libraries focus much more on having the simplest, easiest, one-line-and-youre-done API possible.

For comparison, I implemented the number guessing game in Java:


Its has more than twice the number of lines of code as the Ruby version (and I kept opening curly braces on the same line!) and even though Ive been doing Java for a very long time, it still took longer to write. Of course, there are many other trade-offs at play here, but they key thing to think about is the golden rule of programming:
"Programs must be written for people to read, and only incidentally for machines to execute." SICP
Ruby has its downsides, but it is one of the best languages Ive seen for writing code that others can read, understand, and maintain for a long time after.

Ruby, Continued

The Ruby explorations continue on Ruby, Day 2.
Read more »

Tuesday, February 3, 2015

What is CWM ClockWorkMode in Android

CWM (ClockWorkMod) Recovery in Android OS. 

What is CWM Recovery ?

CWM Recovery


CWM (ClockWorkMod) Recovery is a Custom Recovery for Android tablets and smartphones to allow user to Backup/Install and restore ROM,gain root access,kernels & mods ,backup full device data. CWM work as  alternative to Stock Recovery . CWM was built by Koushik Dutta (Koush) a well named developer in Android world. Somehow CWM work better than Stock Recovery  as its have better and more option which we do not have in Stock Recovery.
 Different Android devices have different method to install CWM but the common and easy way to install CWM over Stock Recovery is ROM Manager . Rom Manager is an app which available on Google Playstore

Note:- Make a deep search before installing CWM on your android device. Make sure every thing work perfect. 



Rom Manager 
You may also like to read :

Android System Recovery
CWM Recovery for Rockchip tablets
What is a difference between Stock and Custom Firmware .
Read more »

Monday, February 2, 2015

Creating realistic lightning in Photoshop

In this video tutorial, Photoshop expert Deke McClelland teaches you how to make this pretty cool lightning effect, which looks pretty realistic in my opinion. This video is from an ongoing series called Dekes Techniques from Lynda.com, which contains lots of excellent Photoshop and Illustrator tutorials. Sign up for a free 7-day trial, and check it out.

Read more »

PhoneGap How to create database store values and retrive values from database CRUD in phonegap example

Hi Friends,

I am going to explain how to create database , insert values into tables,retrive value them using android and phonegap.

Environment :

1) Require to install android sdk.
2) Add PhoneGap plugin for Eclipse.

Example : Database  CRUD  Example using Android and Phonegap.

Step 1:

create a new phonegap project name it as DataBase,package name as com.sree.database.

Step 2:
now create a new file and name it as database.js as we need to write our java script functions in this file.

Step 3 :

now write the following functions in the java script file.

function
populateDB(tx){
tx.executeSql(
DROP TABLE IF EXISTS DEMO);
tx.executeSql(
CREATE TABLE IF NOT EXISTS DEMO(id unique,data));
tx.executeSql(
INSERT INTO DEMO(id,data) VALUES (1,"First Row"));
tx.executeSql(
INSERT INTO DEMO(id,data) VALUES (2,"SECOND ROW"));
}

Explanation :

executeSql function is used to execute sql statements using tx object.
the above function drops table demo if it is allready exists then crteates table demo if not allready exists and stores id and data values.and inserts some data into demo table.


function
errorCB(err){
console.log(
"Error processing SQL:" + err.code);
document.getElementById(
sql-result).innerHTML = "<STRONG>Error processing SQL: " + err.code + "</STRONG>";}

if there is any error like not creating database or any syntax errors will be displayed in the console with sql error.

function
successCreateCB(){
console.log(
"Database has been created successfully");
document.getElementById(
sql-result).innerHTML = "<STRONG>DATABASE HAS BEEN CREATED SUCCESSFULLY</STRONG>"; }

if it is created successfully then it shows database has been created successfully.

var
db=0;
function
createDB(){
if(!db){
db=window.openDatabase(
"Database","1.0","PhoneGap Training",200000);
}
db.transaction(populateDB,errorCB,successCreateCB);
}

if you want to create database use the above function.
function
querySuccess(tx,results){
console.log(
"Rows Effected = "+ results.rowEffected);
console.log(
"No of Rows = " + results.rows.length);
document.getElementById(
sql-result).innerHTML = ("<STRONG>number of rows" + results.rows.length + "</STRONG>");
}


the  above function give number of rows inserted.

function
queryDB(tx){
tx.executeSql(
SELECT * FROM DEMO,[],querySuccess,errorCB);
}

The above function is used to retrive all rows and columns from the table.

function
getSqlResultSet(){
if(!db){
db=window.openDatabase(
"Database","1.0","PhoneGap Training",200000);
}
db.transaction(queryDB,errorCB);
}

to retrive the sql result set use the above function.

function
writeLocalStorage(){
window.localStorage.setItem(
"myKey", "vmSoftTech");
var keyname = window.localStorage.key(0);
document.getElementById(
local-storage-result).innerHTML = "Wrote key: <strong>" + keyname + "</strong>";}

As phonegap supports localstorage we can write values to local storage using the above method.

function
readLocalStorage(){
var value = window.localStorage.getItem("myKey");
if(!value){
document.getElementById(
local-storage-result).innerHTML = "<strong>Null</strong> - Try Write first";
}
else{
document.getElementById(
local-storage-result).innerHTML =
"Got value: <strong>" + value + "</strong>";
}
}

As phonegap supports localstorage we can read values from localstorage using the above method.

function
removeItemLocalStorage(){
window.localStorage.removeItem(
"myKey");
document.getElementById(
local-storage-result).innerHTML = "Removed key/value: <strong>myKey/vmSoftTech</strong>";}


we can also remove localstorage item using the above function.

Step 4 :

now we edit the index.html file and call all the methods above.

<!-- Copyright (c) 2012 Mobile Developer Solutions -->
<!
DOCTYPE HTML>
<
html>
<head>
<meta http-equiv="Content-type" name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">
<title></title>
<script type="text/javascript" charset="utf-8" src="phonegap-1.4.1.js"></script>
<link rel="stylesheet" href="index.css" />
</head>
<body>
<h2>Storage</h2>
<blockquote>
<p>Provides access to the devices storage options.</p>
</blockquote>
<h4 class="help">Based on <b>W3C Web SQL Database Spec</b> and <b>W3C Web Storage API Spec</b></h4>
<a class="btn" onclick="createDB();">Create DB</a>
<a class="btn" onclick="getSqlResultSet();">SQL Result Set</a>
<div class="result-block">
SQL Result:
<br/><span id="sql-result"></span><br/>
</div><br/>
<a class="btn" onclick="writeLocalStorage();">Write LocalStorage</a>
<a class="btn" onclick="readLocalStorage();">Read LocalStorage</a>
<a class="btn" onclick="removeItemLocalStorage();">Remove Item</a>
<div class="result-block">
Local Storage:
<span id="local-storage-result"></span><br/>
</div>
<!-- /scrollable -->
<div id="footer" >
<h1>&copy; 2012 Mobile Developer Solutions</h1>
</div>
<script type="text/javascript" charset="utf-8" src="database.js"></script>
</body>
</
html>

step 5 :

now we need to design our screen to look good so create index.css file and insert the following code .

body
{
background-color: #F6F4F2;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: .9em;
line-height: 1.1em;
margin: 0px;
}
h1,ul,li
{
margin: 0px;
padding: 0px;
}
#header
{
background-color: #515151;
background: #515151
-webkit-gradient(linear, left top, left bottom, color-stop(0.2, #515151),
color-stop(0.8, #302F2D) );
border-top: 1px solid #919192;
height: 32px;
left: 0px;
position: fixed;
top: 0px;
width: 100%;
z-index: 1;
}
#subheader
{ display: none; }
#footer
{
display: none;
background-color: #515151;
background: #515151
-webkit-gradient(linear, left bottom, left top, color-stop(0.2, #515151),
color-stop(0.8, #302F2D) );
border-top: 1px solid #919192;
height: 32px;
position: fixed;
bottom: 0px;
width: 100%;
z-index: 1;
}
#sidebar
{
background-color: #ECEAE7;
overflow: auto;
padding: 30px 2% 20px 0px;
text-align: right;
/* position: fixed; */
float: left;
width: 22%;
top: 33px;
bottom: 0px;
z-index: 1;
border-right: 1px solid #999;
}
#sidebar
ul,#sidebar li {
margin: 0px;
padding: 0px;
}
#sidebar
li, #sidebar li a {
color: #767573;
font-size: 1.06em;
list-style: none;
margin: 1.05em 0px;
}
#scrollable
{
/* position: fixed; */
padding: 20px 2% 0px 1%;
float: right;
width: 72%;
overflow: auto;
top: 33px;
}
#content
{
margin: 20px 2% 0px;
color: #313131;
/* position:absolute;*/
/* overflow:auto;*/
z-index: 0;
}
#header
h1, #footer h1 {
color: #F6F4F2;
font-size: 1.2em;
font-weight: normal;
line-height: 32px;
margin: 0px;
text-align: center;
text-shadow: 0px -1px 1px #222222;
}
#footer
h1 {
font-size: .9em;
text-align: left;
padding-left: 16px;
}
#content
h2 {
border-bottom: 1px solid #ccc;
padding-bottom: 0.25em;
color: #e87a12;
font-size: 1.4em;
font-weight: bold;
margin: 1.3em 0px 0.8em 0px;
text-shadow: #FFFFFF 0px 1px 1px;
}
code
{
font-weight: bold;
font-size: 1.0em;
color: #bc6108;
}
blockquote
{
color: #767573;
font-style: normal;
margin-left: 30px;
margin-right: 10px;
padding-left: 6px;
position: relative;
text-shadow: #FFFFFF 0px 1px 0px;
}
blockquote
p {
padding: 5px 0px;
font-size: 0.8em;
}
blockquote
::before {
font-style: normal;
content: 201C;
font-size: 400%;
font-family: Georgia, Palatino, Times New Roman, Times;;
position: absolute;
left: -25px;
top: 0.2em;
color: #E0E0E0;
}
ul
{
margin-left: 40px;
}
ul
>li {
list-style: disc;
list-style-position: outside;
}
ul
ul {
margin-bottom: 0.5em;
margin-top: 0.5em;
}
a
.btn {
border: 1px solid #555;
-webkit-border-radius: 5px;
border-radius: 5px;
text-align:center;
display:block;
/* float:left; */
clear: both;
background:#eceae7;
width:90%;
color:#e87a12;
font-size:1.1em;
font-weight: bold;
text-decoration:none;
padding:0.7em 0.1em;
margin: 5px auto;
}
a
.btn.deux {
clear: none;
float:left;
width: 45%;
margin:6px 3px 3px;
}
a
.btn.trois {
clear: none;
float:left;
width: 30%;
margin:6px 2px 3px;
}
#deviceinfo
{
border-collapse:collapse;
width:75%;
margin: 20px auto;
}
#deviceinfo
tr th.alt, #deviceinfo tr td.alt {
text-align:left;
}
#deviceinfo
, th, td {
border: 1px solid #ccc;
}
#deviceinfo
th {
font-size:1.15em;
padding-top:4px;
padding-bottom:4px;
background-color:#e89442;
color:#f0f0f0;
height: 1.3em;
}
#deviceinfo
td, #deviceinfo th {
padding:3px 7px 2px 7px;
vertical-align:bottom;
text-align:right;
}
.result-block
{
clear: both;
margin-top: 0.3em;
}
#accel-data
{
margin-bottom: 15px;
width: 95%;
}
dl
{
clear:both;
list-style-type:none;
padding-left:2px;
overflow:auto;
}
dl
> dt{
float:left;
margin-top: 15px;
margin-left:5px;
}
dl
> dd{
float:left;
font-weight:bold;
margin-top: 15px;
margin-left: 10px;
margin-right: 25px;
}
.api-div
{
display: none;
margin-bottom: 0.6em;
}
.api-div
h4 {
display: block;
font-size: 0.8em;
font-weight: normal;
background: #eceae7;
border-left: 6px solid #de2c2c;
padding: 5px 8px;
}
.api-div
.help {
border-left: 6px solid #188f8f;
}
#cameraImage
{
border: 2px solid #666;
display: none;
margin: 1.7em auto;
width:200px;
height:150px;
}
#eventOutput
{
height:1.5em;
display: block;
}
#map
{
width: 180px;
height: 140px;
border: 2px solid #666;
display: none;
margin: 1.0em auto;
}
@media
screen and (max-width: 320px) and (orientation:portrait) {
/* #header h1 { color: #f00; } For TESTING */
#sidebar { display: none; }
#scrollable {
padding: 0px;
margin: 64px 1% 0px 1%;
float: left;
width: 97%;
overflow: auto;
}
#subheader {
display: block;
background-color: #CBCBCB;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.0, #F9F9F9),color-stop(1.0, #CBCBCB) );
border-top: 1px solid #383A3C;
border-bottom: 1px solid #919395;
height: 42px;
left: 0px;
position: fixed;
top: 33px;
width: 100%;
z-index: 1;
text-align:center;
}
select {
font-size: 1.65em;
font-weight: bold;
padding: 5px 16px 5px 20px;
color: #444;
background-color: #e8a35f;
margin: 3px auto;
}
#deviceinfo {
width:90%;
}
}
@media
all and (min-width: 800px){
/* #header h1 { color: #0f0; } FOR TESTING */
#content {
font-size: 1.0em;
line-height: 1.2em;
}
#content h2 {
padding-bottom: 0.4em;
font-size: 2em;
margin-top: 2em;
}
blockquote {
margin-top: 20px;
margin-bottom: 30px;
}
blockquote p {
/* padding: 5px 0px; 10px 0px; */
font-size: 0.95em;
}
blockquote code {
font-size: 1.2em;
}
#cameraImage {
width: 400px;
height: 300px;
}
#map {
width: 360px;
height: 280px;
margin: 1.5em auto;
}
#content {
margin: 30px 3% 0px;
}
#sidebar {
padding-top: 15px;
position: fixed;
}
#sidebar li,#sidebar li a {
font-size: 1.2em;
margin: 1.8em 0px;
}
.api-div h4 {
font-size: 0.9em;
}
#footer {
display: block;
}
}
@media
all and (min-width: 1200px){
/*#header h1 { color: #ff0; } FOR TESTING */
blockquote p {
/* padding: 5px 0px; 10px 0px; */
font-size: 1.0em;
}
blockquote code {
font-size: 1.3em;
}
#deviceinfo {
width:50%;
}
#deviceinfo th {
font-size:1.35em;
height: 1.4em;
}
#deviceinfo td, #deviceinfo th {
font-size: 1.1em;
}
#footer {
display: none;
}
}
Step 6:

finally your javascript file looks like this,

function
populateDB(tx){
tx.executeSql(
DROP TABLE IF EXISTS DEMO);
tx.executeSql(
CREATE TABLE IF NOT EXISTS DEMO(id unique,data));
tx.executeSql(
INSERT INTO DEMO(id,data) VALUES (1,"First Row"));
tx.executeSql(
INSERT INTO DEMO(id,data) VALUES (2,"SECOND ROW"));
}
function
errorCB(err){
console.log(
"Error processing SQL:" + err.code);
document.getElementById(
sql-result).innerHTML = "<STRONG>Error processing SQL: " + err.code + "</STRONG>";
}
function
successCreateCB(){
console.log(
"Database has been created successfully");
document.getElementById(
sql-result).innerHTML = "<STRONG>DATABASE HAS BEEN CREATED SUCCESSFULLY</STRONG>";
}
var
db=0;
function
createDB(){
if(!db){
db=window.openDatabase(
"Database","1.0","PhoneGap Training",200000);
}
db.transaction(populateDB,errorCB,successCreateCB);
}
function
querySuccess(tx,results){
console.log(
"Rows Effected = "+ results.rowEffected);
console.log(
"No of Rows = " + results.rows.length);
document.getElementById(
sql-result).innerHTML = ("<STRONG>number of rows" + results.rows.length + "</STRONG>");
}
function
queryDB(tx){
tx.executeSql(
SELECT * FROM DEMO,[],querySuccess,errorCB);
}
function
getSqlResultSet(){
if(!db){
db=window.openDatabase(
"Database","1.0","PhoneGap Training",200000);
}
db.transaction(queryDB,errorCB);
}
function
writeLocalStorage(){
window.localStorage.setItem(
"myKey", "vmSoftTech");
var keyname = window.localStorage.key(0);
document.getElementById(
local-storage-result).innerHTML = "Wrote key: <strong>" + keyname + "</strong>";
}
function
readLocalStorage(){
var value = window.localStorage.getItem("myKey");
if(!value){
document.getElementById(
local-storage-result).innerHTML = "<strong>Null</strong> - Try Write first";
}
else{
document.getElementById(
local-storage-result).innerHTML =
"Got value: <strong>" + value + "</strong>";
}
}
function
removeItemLocalStorage(){
window.localStorage.removeItem(
"myKey");
document.getElementById(
local-storage-result).innerHTML = "Removed key/value: <strong>myKey/vmSoftTech</strong>";}





Read more »