facebook

how to package the database on build??

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
    Posts
  • #351430 Reply

    Darshan Patel
    Participant

    still the differences in the sizes is luring me…
    (btw its not a json file, it is a text file)

    uncompressed db – 5mb
    compressed db – 300kb

    i am skipping the compression thing for now..

    but have one last query please if you have anything to share on this,
    is there any way through which i can unzip my file at the time of installation or on first run without affecting the performance of app? like the uncompression process running in background or something

    thanks,
    Darshan

    #351448 Reply

    support-michael
    Keymaster

    wow! 96 percent compression

    >is there any way through which i can unzip my file at the time of installation or on first run without affecting the performance of app like the uncompression process running in background or something

    Yes, on first launch your app could:
    1) make an ajax call (async) to retrieve the bundled compressed data file
    2) uncompress the data file to memory or the app’s file system
    3) process the uncompress data file from its readable src (memory or file system)

    I don’t know the javascript decompression libs very well but you should be able to find or adapt something that can stream the compressed data directly to an output stream to the file system.

    Alternative Approach
    For some reason I assumed the data file was in json format and that you only need this data file on the 1st launch of the app. You could possibly simplify the runtime concern by packaging as a compressed json file. Imagine preprocessing the db’s initial data and the sql loading logic into a single json file. Compress it with gzip and bundle it in your app. Then on 1st launch of your app load the data file, letting the browser’s resource loading logic automatically handle decompression, reading and execution without any special runtime logic other than the ajax request.

    #351456 Reply

    Darshan Patel
    Participant

    yes!! know you see why i was so much behind the compression thing!!

    but i am currently putting the compression thing on the hold… will do it later

    and i have gone thru many libs… some r useful(but not as way you want it) and some are scrap..

    btw how to run a specific code on first launch??
    is there a predefined method?(i dont know this) or we have to implement a logic.. (i know this)

    #351472 Reply

    Hi,

    You can either set a flag and save it in local storage or check for the absence of some application state that will exists after 1st launch.

    >or we have to implement a logic.. (i know this)
    You should implement your login in the phoneui.documentReadyHandler() function in the <appname>_custom.js file.

    #351478 Reply

    Darshan Patel
    Participant

    yes.. thats what i had in my mind… thanks..

Viewing 5 posts - 16 through 20 (of 20 total)
Reply To: how to package the database on build??

You must be logged in to post in the forum log in