Ashvin Savani “arckid” – Flash Platform Expert

All about RIA development using Flash, Flex, Flash Media Server (Flashcom) with various middleware and backends.

Archive for the ‘AIR’ Category

Meeting – Creating IMAP client with Adobe AIR – Part 1

Hello friends,

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:

  1. Basics of AIR. (By Ashvin Savani)
  2. Basics of Protocol. (By Ashvin Savani)
  3. Basics of IMAP. (By Ashvin Savani)
  4. How to understand any protocol specifications from specification document / RFCs.
  5. Basics of Socket Communication in Flash Action Script 3.
  6. Handshaking with IMAP Server.
  7. UI – Login Screen.
  8. UI and Event Handling.
  9. Authentication with IMAP Server.
  10. Retrieving Folder Structure from Server.
  11. UI – Displaying Folder Structure.
  12. Retrieving Email headers for given folder (From, To, CC, BCC, etc.,).
  13. Retrieving Email data for given email.
  14. Separating Email Body and Attachments from email data.
  15. UI – Displaying Email Body.
  16. Decoding Email Attachments in to file data.
  17. (Not Sure – For Now) Scan the file via anti virus tool before display it.
  18. UI – Displaying whole email.
  19. UI – Replying email.
  20. Basics: Sending an email via SMTP.
  21. SMTP specifications and normal procedures.
  22. Handshaking with SMTP.
  23. Sending an email with SMTP.
  24. Final touch up to the application.
  25. Lessons Learnt by each attendee.

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:

As usual, Sponsor for Event, Place and Equipments is Avinashi and FlashBrain.

Part 1 – Venue and Time:

FlashBrain Unit, Avinashi Systems.
Seminar Hall, 2nd Floor,
Kohinoor Complex, Saiyedpura,
Surat – 395 003.

User Group ManagerAshvin Savani
User Group Co-Manager
Naresh Khokhaneshiya

Update:

  • We were able to finish 3 topics on first part of our meeting on 2nd Aug 08.

Support for TIMESTAMP in SQLite with AIR (as local database)

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!

AIR – Handling online and offline sync mechanism

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.

  • 6 Comments
  • Filed under: AIR, Adobe, Flash
  • Download — Adobe announces AIR 1.0

    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.

    For Developers:

    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.

    Developer Links:

    Business Benefits:

    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:

  • 0 Comments
  • Filed under: AIR, Adobe, Flash, Flex, News