Monday, April 30, 2012

Chrome browser client-side data storage


Web Storage: client-side data storage

The localStorage attribute is an object provided by the www.w3.org specification under Candidate Recommendation review.  This specification defines an API for persistant data storage of key-value pair data in Web clients.  Web Storage offers two different storage areas, local storage and session storage which differ in scope and lifetime. Data placed in local storage is per domain for each client and persists after the browser is closed.

Here is a simple demo html file for local storage...
<!DOCTYPE html>
<!-- LocalStorageDemo.html -->
<html>
<head>
<title>Web Storage Example</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >

<script type="text/javascript">
window.onload  = function(){
 loadvalues();
 };

function loadvalues(){
 getthestuffLocal();
 }

function savethestuffLocal(){
 var object = document.getElementById("localinput");
 var thevalue = object.value;
 localStorage.setItem(1, thevalue);
 getthestuffLocal();
 }
function getthestuffLocal(){
 var data;
 var thediv = document.getElementById("displaylocal");
 data = localStorage.getItem(1);
 if (data){
  thediv.innerHTML = "The value is "+data;
  }
 }
</script>

</head>
<body>
<h1>Web Storage Example</h1>
<h2>Local Storage</h2>
<div id="displaylocal">Seems there is nothing stored in local storage yet</div>
<input type="text" name="" value="" id="localinput" />
<a href="javascript:savethestuffLocal();">Save it!</a>
<p id="local_storage_infio">This data is stored using Local Storage. Which means that even if you close the page, and re-open it, the data you saved should be loaded again.</p>
</body>
</html>

Here, we look at a simple demo (from the code above) for local storage...

Web Storage Example

Local Storage

Seems there is nothing stored in local storage yet
Save it!
This data is stored using Local Storage. Which means that even if you close the page, and re-open it, the data you saved should be loaded again.


When you type something in the input box above and click "Save It!" the data is stored on your local system in your browsers Local Storage area for the domain blog.poling.org and the local path (in my case)...


/Users/drew/Library/Application Support/Google/Chrome/Default/Local/Storage/http_blog.poling.org_0.localstorage


This file is in the SQLite format 3 binary format for Chrome and contains the key 1 and value of the data entered...



$ cat  Local\ Storage/http_blog.poling.org_0.localstorage 
?????z!11?tableItemTableItemTableCREATE TABLE ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAI1test1indexsqlite_autoindex_ItemTable_1ItemTable


You can also see the data from Chromes Developer tools, open VIEW --> Developer > Developer Tools
then click on Resources, under Local Storage click on blog.poling.org to see the value...



For more info you can take a look at Shwetank Dixit's post on Web Storage.


Next time I will take a look at HTML5 Filesystem.

Tuesday, February 7, 2012

Google launches a TED like event "Solve for X"

Official Google Blog: What’s your X? Amplifying technology moonshots: Last week, Google ran an experiment. They hosted a gathering, called “Solve for X,” for experienced entrepreneurs, innovators and scientists from around the world. The event focused on proposing and discussing technological solutions to some of the world's greatest problems. ...

Sunday, November 27, 2011

Open Source Physics

Open Source Physics - (OSP)


The OSP is a project that provides curriculum resources that engage students in physics, computation, and computer modeling and is supported in part by the National Science Foundation. You can pick from many compiled Java based simulations for Astronomy, Mathematical Tools, Classical Mechanics, Electricity & Magnetism, General Physics and many more.

The OSP project has a wide variety of packages, libraries, programs, and files that have been put into Java archive (jar) packages with curricular materials for the study of computational physics.  You can also find help in using the Easy Java Simulations (EJS) tool to create or modify physics simulations without the need for learning java programming.

An example of the EJS tool:

The OSP provides programming resources for computational physics and simulations.
  •  An Eclipse environment for OSP
  • OSP Source Code Libraries
  • OSP best practices
  • Documentation
You can find more at the Open Source Physics.org project page.
For more information on the Easy Java Simulations tool, check the EjsWiki.

Friday, November 25, 2011

Open Technology Blog

This is the Open Technology Blog


This is the first post in the Open Tech Blog that will be part of the Poling.org domain at some point.
I will start to post to this blog when I get the domain set up to point poling.org to blog.poling.org (opentechblog.blogspot.com).

This post is at http://opentechblog.blogspot.com/2011/11/open-technology-blog.html