qOmpute - an AIR application

Cody Says...

I'm going to share to you our simple AIR application name qOmpute - time computing. It is a dekstop application, made using Adobe Flex Builder, that will allow user to track your total office hours.


Good thing about Adobe AIR is that it allows you to create a database of its own. We used the database to track the inputs made by the user. To build a database on Adobe Flex Builder, below is a sample code:

public var timeConnection:SQLConnection;
public var createStmt:SQLStatement;

public function createTable():void
{
timeConnection = new SQLConnection;

var newDb:File = File.applicationStorageDirectory.resolvePath("ojttime.db");
timeConnection.open(newDb);

createStmt = new SQLStatement();
createStmt.sqlConnection = timeConnection;

var sql:String = "CREATE TABLE IF NOT EXISTS OJT(";
sql += " ojtid INTEGER PRIMARY KEY AUTOINCREMENT, ";
sql += " deight TEXT,";
sql += " timein TEXT,";
sql += " timeout TEXT,";
sql += " totalminutes INTEGER) ";

createStmt.text = sql;
createStmt.execute();

timeConnection.close();
}


For you to better understand the code above, I'll explain it further. SQLConnection is used to manage the creation of and connection to local SQL database files and SQLStatement is used to execute a SQL statement. We will name the file ojttime and add the file extension .db so that Adobe Flex Builder knows that it is a database. The storage of file can either be on applicationsDirectory, desktopDirectory, userDirectory, applicationStorageDirectory, or documentsDirectory. We have to make sure that the connection to the database is open and the createStmt variable is linked to a SQLConnection instance. We use "IF NOT EXISTS" to make sure that there is no duplicate table. And after the SQL statement has been executed, we have to close the current database connection. qOmpute is a simple AIR application that helped us compute for our OJT (On-The-Job-Training) or Practicum hours. As we add more dates, the total number of hours continues to add up. It follows a time format of hh:mm and 12-hour format. And 1 hour is always deducted for lunch break. qOmpute uses the component DateField so you don't have to key in the date.


The time-in and time-out follows a strict format of hh:mm. Semi-colon is used to separate the hour from the minutes. On the time-out text field, user can just press the enter key or click the add button to save the new inputs made.





Of course, we should always provide a Help information in case the user have any problems encountered in the process. Help function can be found at the upper right corner of qOmpute. It has simple description of the application and the limitations in using it.



To those who are still under their OJT, I think this is a great application to use to keep track your time. Enjoy! Don't forget to drop by a comment when you download our application, thanks!

Download qOmpute here.

Before you install this application, download Adobe AIR first.

I think there are still some bugs and errors on this application. If you found any, don't hesitate to contact us.

0 comments:

Post a Comment