Thursday, February 4, 2010

Web SQL Database: client-side databases using SQL.

There many techniques for storing data on the client side, such as: cookies, sessionStorage, localStorage, and database. For a detailed description of each technique please visit www.w3.org.

In this article we will work with client-side database.

Web SQL Database is
a set of APIs to manipulate client-side databases using SQL. These sets of APIs are non-normative, which means that there is no standard. In case of Google Chrome, it implements SQLite.

Key methods:
  1. openDatabase(name,version,displayName,estimatedSize, optional Callback)
  2. transaction(callback, optional errorcallback, optional voidcallback)
  3. readTransaction(callback, optional errorcallback, optional voidcallback)
  4. executeSql(SQLStatement,optional arguments,optional Callback, optional errorCallback)
* transaction is read and write.
* readTransaction is read only.

Key objects:
How it works:

  • First we create the database:
var myDB = window.openDatabase("myDatabaseName","1.0","my database storage",5*1024*1024);

/*(window.openDatabase: object window implements inteface WindowDatabase)*/

  • Next we create our tables, we verify if the table already exists, otherwise we create the table:
myDB .transaction(function(t){
t.executeSql('SELECT name FROM sqlite_master WHERE type=\'table\' and name =\'mytablename\'',[],
function(t,r){
if(r.rows.length==0){
t.executeSql('CREATE TABLE mytablename(id INTEGER PRIMARY KEY AUTOINCREMENT,mytextfield TEXT)');
}
}
);
},function(err){
alert(err.message+" .Creating table.");
}
);

  • Insert some records:
callback callback errorcallback errorcallback
//myDB.transaction(function(t){t.executeSql('',[],function(){},function(){})},function(){})

myDB.transaction(function(t){
t.executeSql("INSERT INTO mytablename VALUES(NULL,?)",["some text"],function(t,resultset){
alert(resultset.insertId);
},function(t,e){
alert(e.message);
});
},function(err){
alert(err.message);
}
);
  • Read from Database:
myDB.transaction(function(t){ t.executeSql('SELECT mytextfield FROM mytablename ',[],function(t, resultset){
for(var i=0; i<>
result = resultset.rows.item(i);
alert(result. mytextfield ); } }); },function(err){ alert(err.message+" .Restoring database."); } );

resultset is an boject of type SQLResultSet. This object has 3 properties: insertId, rowsAffected, and rows.

the property rows is a type of SQLResultSetRowList

Considerations:
  1. The API is asynchronous.
  2. use of the ? placeholder feature of the executeSql() method, and to never construct SQL statements on the fly.
  3. For accessing items in the result set rows use (): resultset.rows.item(index)
Thanks.

Tuesday, February 2, 2010

myNotes

myNotes.

myNotes helps you to easily take notes and bookmark your web surfing experience. myNotes allows you to copy text from a webpage and create a note with this information at the same time. In addition, myNotes automatically bookmarks the URL notes source, so that you can quickly and easily go back to the original webpage source. myNotes eliminates the steps of creating a list of bookmarks, saving additional mouse clicks and avoiding long lists of bookmarks that are often difficult to find later.




myNotes also allows you to edit your notes, while keeping the original note and a reference to the website. You can add as many notes as you want.


It’s so easy to use.

Managing your notes summary and history windows becomes easy and comprehensive. myNotes popup, summary window, and history window communicate with each other to update any changes. This means that when the window summary or window history is open, you can edit your notes from either window and the changes will be reflected in-real-time in the other window.



Any notes added to myNotes will be reflected in-real-time in summary window and history window, you don’t have to reload or close the browser.


Every note has a reference to a tab, if you close that tab the note will turn green, and when you click the link myNotes will open a new tab and update the status of all notes that belong to the previously closed tab..
myNotes is a must for anyone doing research on the Web.

I'm not a designer, I'm not good at it but I'm trying to provide a friendly user interface, clear and functional. Any comment, suggestion or/and idea is much welcome.

Thursday, January 28, 2010

what do I need to know about the web?

This article how a web browsers is integrated, a web page's structure and some other things that I've been reading.

  1. HTML (Hypertext Matkup Langugae) versions: 4.1 and 5. HTML 5 launched on January 2008. Firefox 3.5 and IE* have implemented some HTML 5 features.
  2. CSS Cascading Style Sheet (Presentation Definition Language)
  3. XML (Extensible Markup Language)
  4. JSON: is a JavaScript object representation.
  5. DOM (Data Object Modeling):Web browsers: every browser has its own DOM object, even when W3 is trying to establish a standard.
  6. XHTML v1.1
  7. JavaScript
  8. DTHML: HTML, JavaScript, CSS and DOM
  9. XMLHttpRequest Object: DOM API. Every browser has its own XMLHttpRequest object.
  10. AJAX (Asynchronous JavaScript + XML): HTML, CSS, DOM, JavaScript, XMLHttpRequest/IFrame)

Layout Engines:

  1. 1. Gecko
  2. 2. Trident
  3. 3. WebKit
  4. 4. Presto
  5. 5. MSHTML

  • Internet Explorer (MSHTML)
  • Firefox (uses Gecko)
  • Safari (uses WebKit)
  • Opera (uses Presto)
  • Chrome (uses WebKit)

Client-Side scripting:

  1. JavaScript (most used)
  2. Jscript
  3. VBScript
  4. ActionScript: uses Adobe Flash Player

JavaScript engine:

Server-Side Scripting and Database

  1. ASP.NET (VB.NET,C#.NET) / SQL Server
  2. PHP / MySQL
  3. Python
  4. Perl
  5. Ruby
  6. Open Laszlo

AJAX frameworks (toolkits)

  1. JQuery
  2. YUI
  3. Prototype
  4. Mootools
  5. Google Web Tookit
  6. Dojo
  7. ASP.NET AJAX
  8. ExtJS

Rich Internet Applications: RIA

  1. Silverlight
  2. Flash
  3. Adobe Flex
  4. OpenLaszlo

Cloud-computing services:

  1. Amazon Web Services
  2. IBM: Blue Cloud
  3. Google App Engine
  4. Microsoft: Windows Azure
  5. Rackspace: Mosso
  6. ServePath: GoGrid.

.NET RIA Services:

  1. Silverlight 3 (WPF)
  2. .NET RIA Services
  3. FLEX (from Adobe)

Mobile platforms:

  1. webOS from palm
  2. Android from Google (for storage uses SQLite) IDE: Eclipse & NetBeans.
  3. Blackberry
  4. Windows mobile from Microsoft
  5. iPhone platform from Apple
  6. Symbian

Things that I'm working on

Here are listed the things that I'm working on.
  1. ASP.NET Silverlight
  2. ASP.NET MVC
  3. ASP.NET WCF
  4. PHP and MySQL
  5. android
  6. Java
  7. HTML, CSS, DOM and Javascript
  8. Photoshop, Dreamweaver.
  9. Google Chrome Extensions.
IDES:
  1. Visual Studio 2008
  2. Eclipse
  3. NetBeans

Wednesday, January 27, 2010

How to install ASP.NET Membership Services.

ASP.NET Membership Services is the database structure for storing and managing user information and includes methods used by the ASP.NET login controls to authenticate users.

How to install ASP.NET Membership Services.

basics:

1. Have installed Microsoft Visual Studio

2. Have installed Microsoft SQL Server

3. a database where ASP.NET Membership Services will be stored (optional)

Step 1: installing ASP.NET Services database in SQL Server.

a) run aspnet_regsql.exe utility, you can find this utility in the next path: C:\Windows\Microsoft.NET\Framework\v2.0.50727.


b) Clicking the button "Next" will take you to next step. Make sure to select the first option "Configure SQL Server for application services" and click "Next"


c) The next screen is where you enter your SQL Server data. If you want to install Membership services in an installed database select the database from the dropdown list "Database". If the database does not exist, type the name of the database and the utility will create a new database in SQL Server.


Make sure to enter the correct server name. If you are not sure what is the server name and you get an error, then open Microsoft SQL Server Management Studio to see what is the correct server name.


d) Click Next and the next screen is a verification where Membership services will be installed.


e) In the last screen click Finish and you are done.

You will see the ASP.NET Membership Services tables installed in the selected database.