Working With Data on Titanium Local Data Remote Data Titanium Data Options:

Slides:



Advertisements
Similar presentations
Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Advertisements

UFCE8V-20-3 Information Systems Development 3 (SHAPE HK)
Cookies, Sessions. Server Side Includes You can insert the content of one file into another file before the server executes it, with the require() function.
PHP and the Web: Session : 4. Predefined variables PHP provides a large number of predefined global variables to any script which it runs also called.
Session 13 Active Server Pages (ASP) Matakuliah: M0114/Web Based Programming Tahun: 2005 Versi: 5.
PHP (2) – Functions, Arrays, Databases, and sessions.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
Guide To UNIX Using Linux Third Edition
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
CST 594 Mobile Computing Kavitha Elamparith Pratibha Channamsetty Eshwari Mente Shruti Shivashankaraiah Pranay Mahendra Adit Shah Naveen Kumar.
Martin Kruliš by Martin Kruliš (v1.0)1.
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
CSC 2720 Building Web Applications Cookies, URL-Rewriting, Hidden Fields and Session Management.
Java Database Connectivity (JDBC) Introduction to JDBC JDBC is a simple API for connecting from Java applications to multiple databases. Lets you smoothly.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
© D. Wong  Indexes  JDBC  JDBC in J2EE (Java 2 Enterprise Edition)
1 Designing a Data Exchange - Best Practices Data Exchange Scenarios –Sender vs. Receiver-initiated exchanges –Node Design Best Practices: –Handling Large.
Intro to Ajax Fred Stluka Jan 25, /25/2006Intro to AjaxFred Stluka2 What is Ajax? "Asynchronous JavaScript and XML" New name for an old technique:
Data File Access API : Under the Hood Simon Horwith CTO Etrilogy Ltd.
COMP 365 Android Development.  Manages access from a central database  Allows multiple applications to access the same data.
CS378 - Mobile Computing Persistence. Saving State We have already seen saving app state into a Bundle on orientation changes or when an app is killed.
USING PERL FOR CGI PROGRAMMING
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Chapter 8 Cookies And Security JavaScript, Third Edition.
(Chapter 10 continued) Our examples feature MySQL as the database engine. It's open source and free. It's fully featured. And it's platform independent.
Creating and using Persistent Data From before – Where does the data come from? – Why is it kept? – How is it used? Affects design and implementation choices.
Serialization. Serialization is the process of converting an object into an intermediate format that can be stored (e.g. in a file or transmitted across.
Android Storage. There are several options for storage of data with Android We can put data into a preferences file. We can put data into a ‘normal’ file.
Chapter 6 Server-side Programming: Java Servlets
Cookies Web Browser and Server use HTTP protocol to communicate and HTTP is a stateless protocol. But for a commercial website it is required to maintain.
Christopher M. Pascucci Basic Structural Concepts of.NET Managing State & Scope.
Term 2, 2011 Week 1. CONTENTS Problem-solving methodology Programming and scripting languages – Programming languages Programming languages – Scripting.
Object Oriented Software Development 10. Persistent Storage.
Visual Basic Programming
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
Chapter 15 Introduction to PL/SQL. Chapter Objectives  Explain the benefits of using PL/SQL blocks versus several SQL statements  Identify the sections.
Efficient RDF Storage and Retrieval in Jena2 Written by: Kevin Wilkinson, Craig Sayers, Harumi Kuno, Dave Reynolds Presented by: Umer Fareed 파리드.
CS378 - Mobile Computing Persistence. Saving State We have already seen saving app state into a Bundle on orientation changes or when an app is killed.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
SQlite. SQLite is a opensource SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation.
Creating Animations, Working with Graphics, and Accessing Data Lesson 9.
AJAX and REST. Slide 2 What is AJAX? It’s an acronym for Asynchronous JavaScript and XML Although requests need not be asynchronous It’s not really a.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Module 6: Administering Reporting Services. Overview Server Administration Performance and Reliability Monitoring Database Administration Security Administration.
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
Unit-6 Handling Sessions and Cookies. Concept of Session Session values are store in server side not in user’s machine. A session is available as long.
Intro to JDBC Joseph Sant Applied Computing and Engineering Sciences Sheridan ITAL.
JavaScript and Ajax Week 10 Web site:
CHAPTER 9 File Storage Shared Preferences SQLite.
Exploring Networked Data and Data Stores Lesson 3.
Web Services Essentials. What is a web service? web service: software functionality that can be invoked through the internet using common protocols like.
JQuery, JSON, AJAX. AJAX: Async JavaScript & XML In traditional Web coding, to get information from a database or a file on the server –make an HTML form.
By: Eliav Menachi.  On Android, all application data (including files) are private to that application  Android provides a standard way for an application.
Mobile Application Development Data Storage. Android provides several options for you to save persistent application data. The solution you choose depends.
Introduction to Database Programming with Python Gary Stewart
Phonegap Bridge – Storage CIS 136 Building Mobile Apps 1.
Mobile Applications (Android Programming)
Android Application Data Storage 1.
z/Ware 2.0 Technical Overview
AJAX and REST.
Azure Machine Learning & ML Studio
WEB API.
Lecture 1: Multi-tier Architecture Overview
Intro to Ajax Fred Stluka Jan 25, 2006.
Presentation transcript:

Working With Data on Titanium Local Data Remote Data Titanium Data Options:

Working With Local Data Application Properties Filesystem Database Titanium Local Storage Options: To use a device's local storage, the following objects are needed: * Titanium.App.Properties is ideal for storing application-related settings * Titanium.Filesystem facilitates file and directory manipulation * Titanium.Database gives access to local SQLite3 databases Each of these enable data to persist on a device across application restarts, power cycles, re-installation and even migration to a new device.

What kind of data storage should I use? 1. Application Properties - used when one or all of the following is true: * the data consists of simple key/value pairs * the data is related to the application rather than the user * the data does not require other data in order to be meaningful or useful 2. Filesystem - used when one or all of the following is true: * the data is already provided in file format * the data is an image file 3. Database - used this when one or all of the following is true: * there are many similar data items * items of data relate to each other * you require flexibility over how the data will be presented when you retrieve it * the data accumulates over time, such as transaction, logging or archiving data The decision about which of the three local storage options you choose is usually determined by the following:

Application Properties Reading and Writing Properties Titanium.App.Properties has six sets of get/set methods for handling six different data types: getBool() / setBool(): for booleans (true, false) getDouble() / setDouble(): for double-precision floating point numbers getInt() / setInt(): for integers getList() / setList(): for arrays getString() / setString(): for strings > See Sample Code

Sample Code result String: This is a string Integer: 10 Boolean: true Double: List: { 'address' : '1 Main St' 'name' : 'Name 1', }, { 'address' : '2 Main St' 'name' : 'Name 2', }, { 'address' : '3 Main St' 'name' : 'Name 3', }, { 'address' : '4 Main St' 'name' : 'Name 4', }, //JSON OUTPUT The myJSON property contains: {"reports":[ {"icon":" ","city":"Mountain View"}, {"icon":" "Cloudy","city":"Washington, DC"}, {"icon":" Thunderstorm","city":"Brasilia"}]}

Filesystem Storage Objects Titanium.Filesystem is the top level Filesystem module used for reading and saving files and directories on the device. Titanium.Filesystem.File is the file object which supported common filesystem based operations such as create, read, write, delete, etc. Data storage locations: applicationDataDirectory: A read-only constant that indicates where your application data directory is located. Place application-specific files in this directory. resourcesDirectory: A read-only constant where your application resources are located tempDirectory: A read-only constant that indicates where your application can place temporary files Properties

getFile(): return a fully-formed file path as a Titanium.Filesystem.File object read(): return the contents of file as blob write(): write the contents to file deleteFile(): delete the file exists(): return true if the file or directory exists on the device move(): move the file to another path rename(): rename the file nativePath(): return the fully resolved native path Filesystem Storage cont... > See Sample Code Filesystems Methods

SQLite Databases SQLite3 is version 3 of SQLite's SQL-based relational database management system (RDMS), chosen by Apple, Google and RIM to provide local data storage on their mobile devices. Objects Titanium.Database the top level Database module. The Database module is used for creating and accessing the in-application Database. Titanium.Database.DB is the Database instance returned by Titanium.Database.open or Titanium.Database.install. Titanium.Database.ResultSet is the ResultSet instance returned by invoking a database SQL execute. open(): open a database. if it doesn't yet exist, create it. execute(): execute a SQL statement against the database and returns a ResultSet. close(): close the database and release resources from memory. Database Methods

isValidRow(): return true if the row is a valid row. fieldByName(): retrieve a row value by field name. next(): iterate to the next row in the result set. returns false if no more results are available. ResultSet Methods > See Sample Code SQLite Databases cont...

Working With Remote Data Remote Data in Titanium Your Titanium application can interact with remote servers over HTTP using the HTTPClient object provided through the Titanium.Network namespace. HTTPClient's API mirrors that of the XMLHTTPRequest object in the web browser, so if you have done any Ajax programming in the browser HTTPClient will be familiar to you. Objects Titanium.Network.HTTPClient is the HttpClient instance returned from Titanium.Network.createHTTPClient. This object (mostly) implements the XMLHttpRequest specification. open(): open the request and ready the connection. send(): send the request (Only async is currently supported). SetRequestHeader(): set the request header. Must be called after open but before send. setTimeout(): set the request timeout. HTTPClient Methods > See Sample Code

Resources Working with Local Data: Working with remote data: API Reference Guides: