All about RIA development using Flash, Flex, Flash Media Server (Flashcom) with various middleware and backends.
Today, Once again We came up with interesting meeting series. Instead of just one speaker, We are including many speakers who have expertise in different topics. As mentioned in the meeting topic, Here are the modules we are planning to include in whole series of meetings:
I hope, all of us will really enjoy this series and it would be meaningful add on pack to the knowledge of everyone of us:
Part 1 – Venue and Time:
FlashBrain Unit, Avinashi Systems.
Seminar Hall, 2nd Floor,
Kohinoor Complex, Saiyedpura,
Surat – 395 003.
In past week at FlashBrain, Where do I work; We were working on one cool AIR application with Flash. Naresh – My good friend and colleague at FlashBrain was dealing with timestamps for better algorithm for online and offline sync with AIR.
We were trying to put timestamp on local and remote database to compare the data based on time to get idea about which record is last updated. Our remote database is MySQL and local database is SQLite which is a part of AIR. TIMESTAMP is a known data type for MySQL and which automatically inserts the timestamp based on whenever you create the record. While, in SQLite it does not support TIMESTAMP as native data type for fields.
Usually, SQLite converts or casts the data types automatically and in this process it guesses the data types and tries to convert the data in to nearest possible data type. So if you will enter TIMESTAMP like you are doing in MySQL, it will treat the data as numeric and will not solve the purpose for TIMESTAMP. SQLite only supports DATETIME as field data type. This DATETIME is also stored in specific format of DDDD.DDDD which is julian day number expressed as floating point value. So to store TIMESTAMP in to a SQLite with AIR, you need to convert your TIMESTAMP value in to this DDDD.DDDD format before you insert in to SQLite. Also, at time of retrival of data, you need to convert the data in to your desired data type before you use it.
Here is example, Naresh entered in our internal Knowledge Base, Which we named as Knowledge Dose:
Inserting the data in to SQLite:
INSERT INTO <table> (<column>) VALUES (’2008-06-09 07:20:00′);
here, the important thing is – <column> data type should be DATETIME.
Fetching the data back from SQLite:
SELECT datetime(<column>) AS <variableName> FROM <table>;
I hope this would be helpful to someone!
In our recent project with Adobe AIR and Flash CS3, We are working on making offline mechanism to perform best sync in online and offline modes. Normally for Rich Internet Application development, We are using MySQL as database system.
It’s really fun to work with two database systems, one for online transactions (MySQL) and another for offline transactions (SQLite). Analysis part of data, what should store in online database and what should store in local AIR database. How to maintain sync states? And how to optimize the sync? And when to store data locally and when to fetch data from online database! Yeah, all these questions drives you through all excitement, challenges and fun.
Specially, in applications which are using user based authentication and if user is offline – That’s a tough case. I am not sure, what we are using is the most efficient way to do that or not; but we are storing encrypted password in local database which successfully authenticated last time. If user is online, it will authenticate credentials via online transaction or with local transaction, if not connected.
Once user is successfully authenticated via online or offline transaction, In offline case; It’s easy to fetch data from local database and show required data. But in online case, You need to (at least that’s what we are using) show data from local database, for fastest possible data representation. After that we are comparing sync status in background with showing little status update at some corner of the application. If there is no update, no user interaction is required but, if there is any update on server side – We ask user to update the data representation or to stay wherever he is. Based on user’s decision either we discard the data and let him work on local data or we update the local database and refresh the data representation.
In a special case of, user modifies data while is not connected and someone else is also modified the data between the time when user made last sync and this sync. This case really creates the excitement. This requires timestamp based verification of various data in different tables. Also, this data comparison is not just record to record comparison, but it should be set of data action based on what task user is performing with application. Even this part is easy compare to the situation where you need to handle the merging the data. It’s like you are walking on double edge sword. Any mistake will mess up all the data. You need to take care of all little cases even with 0.001 probability! While working with this application, I was thinking about SVN and Git. Just thinking that how they are managing different versions of files, directories and with many users. And that’s programming all about!
We are still working on it and I will share all the possible peace of information I can share.
Adobe today announces AIR 1.0. In their words, here are how it’s important for Developers and for How it’s good for business.
The Adobe AIR runtime lets developers use proven web technologies to build rich Internet applications that deploy to the desktop and run across operating systems. It’s for all developers like AJAX, Adobe Flex Developers and Adobe Flash Developers.
Adobe AIR offers an exciting new way to engage customers with innovative, branded desktop applications, without requiring changes to existing technology, people, or processes. Click here to know more on this.
Here are other important links: