2012 January | Titanium Development

Archive for January, 2012

This Week in Titanium Mobile Development: 30 Jan 2012

This is all the Titanium Mobile development news I’ve gathered from the Twittersphere and Interwebs for the past week.

News

Not mobile news, but Appcelerator is handing their desktop to development community to take the reins. They will be focusing on the mobile platform.

Appcelerator is a finalist for the Global Mobile Awards in both the Best Consumer Mobile Service and Best Cloud-based Technology categories (press release)

Appcelerator hired Gartner Analyst Mike King specializing in the mobile space. He wrote about the top Top Five Mobility Questions for CIOs.

Infinite Monkeys launches its zero-coding-get-it-for-free app building machine, built on the Appcelerator Titanium platform.

Are you going to MWC? Appcelerator will be there, and is hosting a developer meetup
at 7pm on Tuesday, February 28th

Work with Kasey wrote an article on his first experience with mobile – the basics of going mobile with Appcelerator Titanium and Javascript. (Part 1).

A geek with a hat posted an article on his revisit to titanium.

Tips

Greg at Artanis design created a tilt effect using 3DMatrix and Titanium. You can read about it on LearningTitanium.com

Matt Apperson’s TiPopover gives you iPad style pop over for iPhone.

Ti Agent is a light-weight and progressive Ajax API crafted for flexibility, readability, and a low learning curve.

@ConorClafferty shared TiGrid a titanium module for x / y grid based layouts.

creapps has posted a neat piece of code to help update SQLite databases remotely

@Pegli(Paul Egli) tweeted about his latest version of the CouchDB  module for Titanium.

Take a look at Ti.Draggable – Open source iOS Module for Titanium Appcelerator, and Contributions are welcome.

The Mack UK blog posted a great introduction to Appcelerator on their blog recently and it will give new comers a feel for how it all works.

@ficeto tweeted a module for working resumable downloads over wifi proxy for Titanium Mobile 1.7.x for Android.

@boydleep posted a couple of cool videos on controlling a basic Arduino circuit using a combination of Appcelerator Titanium mobile and HTTP requests & playing a virtual piano through a piezo element.

From Christian Sullivan: Aheads up on a new XHR library ported to Titanium. TiAgent ported for the node superagent module. Look out for future plans that are going to be added to this.

Apps

Sleepbox says it is the ultimate sleep and relax app for iPad.

BeGrateful is a great app to help you affirm things positively and focus on the wonderful things in your life.

WebNote gives you the ability to take note of what is happening (iPhone)

Localbeat app brings location-based services for over 40 cities in India, tweets via @SocialLBSNews and @arjunram

Keep tabs on your drinking and share with your mates, what you are drinking and where. Drinkbot Mobile for the iPhone is approved!

Site Grafx’s first iPhone app, “Baker’s Buddy“.

The latest Handshake app released today – for @shechooses!

London Eye gets Samsung Galaxy Tab 10.1 virtual guides – on msn.com.

Concert Spot is available on the Android Market, and it gives you the chance to find and share live music anywhere you like.


If you’ve got any news, tips, or apps I’ve missed, please leave them in the comments below!

Jeff

Date posted: January 30, 2012

0 Comments
Top

10x Faster INSERTs in SQLite using BEGIN / COMMIT in Appcelerator Titanium Mobile

A while back, I wrote about how multiple INSERT statements in SQLite can be pretty slow. Today, I saw the following tweet from Tobias Reike:


cool,just decreased the time to save data to db in my android app from about 1.5min down to 10sec by using only one sqlite transaction
@tobiwankenobi
tobiwankenobi

After contacting Tobias, he pointed me to the BEGIN / COMMIT documentation in SQLite:


@ look here: http://t.co/4XW2DRwn I’ve just done a db.execSQL(“BEGIN”) before and db.execSQL(“COMMIT”) after my inserts.
@tobiwankenobi
tobiwankenobi

Sure enough, I modified my code to use BEGIN / COMMIT and the results were pretty awesome. Inserting 105 records went from 585ms to 44ms – more than 10x faster!

I’m sure this falls into the category of something I should have known, but it was news to me that SQLite had BEGIN / COMMENT. Here is my code of before and after:

  // BEFORE
	var dbLog = tracer.createTracer('db');
    dbLog.info('opening database');
    var db = database.open();
	dbLog.info('deleting old items');
	db.execute('DELETE FROM ITEM');
	dbLog.info(db.rowsAffected + ' rows deleted');    
    dbLog.info('starting insert');
    for( var i = 0; i < data.length; i++ ){
    	var item = data[i];
		db.execute('INSERT INTO ITEM (SERVERID, TITLE, TYPE, Q1, Q2, MAINPHOTOURL, ALBUMPHOTOURL, THUMBPHOTOURL, AUTHOR, AUTHORID, AUTHORPHOTO, COMMENTCOUNT) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)', item.id, item.title, item.type, item.q1, item.q2, item.mainPhotoURL, item.albumPhotoURL, item.thumbPhotoURL, item.authorUsername, item.authorId, item.authorUsername, item.commentCount);
    }
    dbLog.info( 'finished inserts' );
    dbLog.info( 'closing database' );
    db.close();
    dbLog.info('database save complete');	

	// AFTER
	var dbLog2 = tracer.createTracer('db2');
    dbLog2.info('opening database');
    var db2 = database.open();
	dbLog2.info('deleting old items');
	db2.execute('DELETE FROM ITEM');
	dbLog2.info(db2.rowsAffected + ' rows deleted');    
    dbLog2.info('starting BEGIN');
	db2.execute('BEGIN');
    dbLog2.info('starting insert');
    for( var i = 0; i < data.length; i++ ){
    	var item = data[i];
		db2.execute('INSERT INTO ITEM (SERVERID, TITLE, TYPE, Q1, Q2, MAINPHOTOURL, ALBUMPHOTOURL, THUMBPHOTOURL, AUTHOR, AUTHORID, AUTHORPHOTO, COMMENTCOUNT) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)', item.id, item.title, item.type, item.q1, item.q2, item.mainPhotoURL, item.albumPhotoURL, item.thumbPhotoURL, item.authorUsername, item.authorId, item.authorUsername, item.commentCount);
    }    
    dbLog2.info( 'finished inserts' );
    dbLog2.info( 'starting commit' );   
    db2.execute('COMMIT');
    dbLog2.info( 'finished commit' );   
    dbLog2.info( 'closing database' );
    db2.close();
    dbLog2.info('database save complete');

And the results:

[INFO] db     0ms  opening database
[INFO] db     0ms  deleting old items
[INFO] db     4ms  105 rows deleted
[INFO] db     4ms  starting insert
[INFO] db   589ms  finished inserts
[INFO] db   589ms  closing database
[INFO] db   589ms  database save complete
[INFO] db2    0ms  opening database
[INFO] db2    0ms  deleting old items
[INFO] db2   10ms  105 rows deleted
[INFO] db2   10ms  starting BEGIN
[INFO] db2   10ms  starting insert
[INFO] db2   25ms  finished inserts
[INFO] db2   25ms  starting commit
[INFO] db2   53ms  finished commit
[INFO] db2   54ms  closing database
[INFO] db2   54ms  database save complete

I hope this helps!

Date posted: January 27, 2012

6 comments - Latest by:
  • jeff Hi Stephen. See https://gist.github.com/1210394 for the tracer.
  • Stefan Hi Jeff, Looks like something I'll try What type is tracer variable, can't find anything that matches the createTracer() method in the ...
Top

This Week in Titanium Mobile Development: 23 Jan 2012

This is all the Titanium Mobile development news I’ve gathered from the Twittersphere and Interwebs for the past week(s). I’ve been away so am a little behind!

News

If you missed Titanium week, you can catch up on all the Webcasts On-Demand. The code from the Todo list best practices is posted at github.

Jose from the Electric playground posted a Titanium Overview video.

Appcelerator opened their London headquarters – they issued a standard press release. The bigger news is two big guns from Adobe join the Appcelerator team to work in Europe.

Tim Anderson interviewed Appcelerator CEO Jeff Haynie to try and get his perspective on the EMEA expansion, WebKit and his views regarding Titanium and PhoneGap.

Sharry from LearningTitanium.com interviewed developers Kazuaki Konno and Kota Iguchi.

Tips

Aaron Saunders being as resourceful as ever posted a link to another quickie: Simple Location Information on Kindle Fire or Nook.

LearningTitanium.com created a new Twitter Account with access to new Q&A questions from the forums – updated every 15 minutes.  Follow @AppC_QA

Appcodingeasy.com posted an article that shows you how to use raw accelerometer data in titanium. There’s a snippet of code and neat video to show you how it works.

Here is a nice article on Extending a titanium project with iOS module development – Implementing the Bit.ly API. Really good stuff if you are interested in module development.

Bill Dawson posted a way to get the NDK crash from your Android emulator after a crash. Great for debugging when things aren’t going right.

Matt Apperson shows us how to move the tabbar on android to the bottom.

Tony Lukasavage posted another video with the results of his first steps in building a pimped out table view in Titanium. I can’t wait for the finished product.

Lance Spellman updated hisTitanium Zipfile module over on Github.

A question about drop shadow effects on iOS came up on the Q & A Forum. Olivier Morandi came up with a quick module for it.

A 2D gaming API in case you want to create a couple simple games

Pinehead.tv has a nice video tutorial on getting & adding results to the Tableview in SQLite.

The legendary Dawson Toth shared Version 2.0 of TiAir 2.0 with examples, documentation, and way short initialization.

Arthur Evans (@DevDocDude) updated the Titanium API documentation on the Appcelerator site so you can now show/hide of inherited members & property accessors.

Apps

TweetMic allows you to record your tweets instead of typing them, now your followers can hear you!

Dubplate.fm is an audio streaming app that was recently approved.

Porsche uses a Titanium app to deliver immersive experience for their 911 models.

Wiki Dip makes it easy to discover random articles on Wikipedia and share them with friends.

SNMP Scan looks for SNMP (Simple Network Management Protocol) enabled devices on a network. Amazing that this was built with Titanium.


If you’ve got any news, tips, or apps I’ve missed, please leave them in the comments below!

Jeff

Date posted: January 25, 2012

0 Comments
Top
1 2 Page 1 of 2