Page 1 of 2 12 LastLast
Results 1 to 20 of 27
  1.    #1  
    Hi all, looking for some advice.

    I am developing a bus tracker app. I'd like to store the routes & stops information directly on the device to reduce the number of Ajax calls over the air.

    Right now I have that data in a bunch of .json files which is okay since prototype.jsjsjs $has$ $some$ $nifty$ $methods$ $to$ $help$ $with$ $arrays$ $of$ $data$. $However$, $I$'$m$ $sure$ $it$ $would$ $be$ $even$ $cleaner$ $to$ $use$ $SQL$ $statements$ $and$ $a$ $database$ ($maybe$ $help$ $with$ $overall$ $file$ $size$ $as$ $well$?).

    What I am unclear on is what/how I'd go about implementing some type of database solution. I have read whatever info I could find about Depot & HTML 5 storage but it seems like those solutions capture "secondary" data that the user creates while interacting with your app. It doesn't seem like they are solutions for housing permanent data your app requires for its main functionality. I could be totally wrong, if they are ... I just don't really have my head wrapped around how to go about doing it.

    Hopefully I am not being totally unclear... thanks in advance for any help.
  2. #2  
    Hey, I was planning on making a bus schedule app!! Well, since you've already started...I guess there's no need. I was planning on using cookies to store the bus routes. See Mojo Cookies .
  3. #3  
    Look in the Youtube video app source code /app/models/history-table.jsjsjs $for$ $a$ $primer$ $on$ $database$ $usage$. $The$ $file$ $it$ $stores$ $is$ $in$ /$usr$/$palm$/$data$/$file_XXX$.$com$.$palm$.$app$.$youtube$/$00000000007$.$db$ $and$ $can$ $be$ $read$ $via$ $sqlite3$ $command$ $line$ $function$. $They$ $even$ $have$ $sql$ $select$, $insert$ $and$ $delete$ $statements$ $in$ $the$ $code$. $I$'$m$ $waiting$ $for$ $palm$ $to$ $publish$ $more$ $information$ $on$ $calling$ $a$ $sqlite$ $file$ $or$ ($XML$) ($that$ $could$ $be$ $bundled$ $within$ $the$ $application$ $files$) $directly$ $from$ $the$ $application$ $instead$ $of$ $letting$ $Luna$ $create$ $an$ $HTML5$ $database$. $I$ $found$ $that$ $the$ $HTML5$ $column$ $syntax$ $seemed$ $like$ $it$ $wanted$ $to$ $store$ $everything$ $as$ $a$ $varchar$.

    If you really want, you can check for existence of your app's HTML5 database in the system and if it does not exist, initialize your database from your json arrays and import them into the database that way to cache them for future use. These databases stay resident until your app deletes them (or perhaps when updates happen)...

    I have an application in the works that uses arrays to hold the data (no SDK required). I grew tired of trying to get the database method working. It is a practical solution for smaller sets of data (like mine) but becomes rather clunky and slows down quite a bit as the dataset size increases.

    To save you some more time, consider checking out the Firefox sqlite database manager plug-in too.

    Hope this helps you.
  4.    #4  
    Hey feel free to keep with it! I am only doing chicago btw (at least for now). I'll look into cookies but I would love to have tables and use SQL statements... sadly the last time I messed around with databases years ago with Access/Visual basic...
  5. #5  
    Ok....let me know if you need any help. I'm pretty busy this week (and weekend), so I won't start digging in until hopefully next Monday.
  6.    #6  
    Flipflops thanks a lot. I was hoping to find an existing app where they used one but everyone I looked into used arrays. I'll probably come back to it after I am done with getting the basic functionality done and use the arrays as a temp solution.
  7. mosdl's Avatar
    Posts
    781 Posts
    Global Posts
    787 Global Posts
    #7  
    The html5 database solution is what you want. Cookies should only be used for storing small sets of data.
  8. #8  
    Being unable to design, define and populate a SQLite database externally for inclusion in a Webos app leaves a glaring hole in the entire complex application development realm. This must be fixed.

    Streaming JSON data files in over the network and persisting them into a database is kludgey at best and slow and user unfriendly at worst.

    If no fix is forth coming then I'll have to build some prototype methods to genericize the schema construction and population methods. Bah! I've got my SQLite database already build for both Windows Mobile and Palm 5.0 - I don't want to have to do this again...
  9. jjlucsy's Avatar
    Posts
    51 Posts
    Global Posts
    56 Global Posts
    #9  
    Quote Originally Posted by Anonymole View Post
    Being unable to design, define and populate a SQLite database externally for inclusion in a Webos app leaves a glaring hole in the entire complex application development realm.
    You can create and populate a HTML5 SQLite database from the JSJSJS. $Is$ $this$ $not$ $enough$?

    Quote Originally Posted by Anonymole View Post
    Streaming JSON data files in over the network and persisting them into a database is kludgey at best and slow and user unfriendly at worst.
    I have'nt gotten to actually retrieving data remotely yet, but why is it kludgey?
  10. #10  
    SQLite is file based. There should be no reason why I cannot simply include a SQLite db as a file within the directory structure of an app and then reference it by including the machine path (/usr/palm/applications/MY.APP.ID/database) or relatively from the openDatabase() method.

    Some databases are just much easier to build and include as part of the install.

    Is HTML5 enough? Well I suppose it will just have to do. I'll probably now have to build JSON files and include them in the app/dir and load those on application init. So now I have the data duplicated - unless I can hook the OS and delete these extraneous files. Network updates were easy in the old OSes too. Just fetch a new SQLite.db - or a new PDB - done.

    Streaming 5 meg of ascii over the wire rather than 1.2 meg of binary will take much longer too - not to mention the parsing and incremental transactions.

    But, hey, the promise of a web OS is finally coming to fruition, that is, after 10 years in the making.

    -AM
  11. #11  
    there is a howto page on sqlite db on webos-internals.wikidot.com
  12. #12  
    Kinda keeping along with the ideas on this thread, does anyone know how to PROPERLY get the cookies working for your app?

    I'm trying to save some preferences from a preferences scene in my app and I can't get the darn cookies to save and/or load up.

    I'm trying to use the example here but... yarg!

    I'm able to save the cookie on "deactivate" but I can't seem to do the if part on start up correctly. I want to check if there is a cookie and set a value from the cookie, and if there isn't, make one.

    Also, I don't know where else to ask so I'll just ask here, is there a way to call some variable from one assistant.jsjsjs $to$ $another$? $Would$ $anyone$ $be$ $so$ $kind$ $as$ $to$ $give$ $me$ $an$ $example$ $of$ $how$ $to$ $do$ $it$? $Does$ $it$ $REQUIRE$ $cookies$? $or$ $can$ $it$ $be$ $done$ $just$ $normally$?

    *edit*

    YAY! After hours of playing around I finally figured it out. It's SUCH an awesome feeling. . haha. If anyone really wants to know, PM me or post on this or my thread. kthxbai. I think I might actually go to sleep at a decent hour tonight! wow...
    Last edited by SirataXero; 07/16/2009 at 02:46 AM.
  13.    #13  
    Hi Anonymole, I think I am wanting to do the same thing you are talking about but I am not as experienced in SQLite or databases (or probably as a developer overall). So if you can offer me any pointers its much appreciated.

    Basically I have a large list of bus stops that I would like to have in a db so I can use SQL to pull the data. Right now I have a JSON file for each route and have an Ajax call when I need the data. As I add more features to my app though I foresee this becoming a lousier and lousier solution.

    Can you offer a suggestion as to the best solution we have available with webOS? Sadly I don't know much about dbs other than in college when we played around with MS Access! A table for all my stops is actually what I want... but I have no clue how to make it happen.
  14. #14  
    I would guess that given the release of the sdk, that some college kid soon will build a JSON to SQLite loading script.

    And I would just give that a week or so to come to light. I'd do it but I've got about 20 other projects on my plate at the moment and Pre software is at the bottom of the list. Maybe after they've sold a couple of million units I'll make it a priority.

    But generally you'd want to create a local database (even Access would do) and from this developer database you would build your data text files - of which JSON files could be one type. By keeping the data in a real database you can then export it to any other type of your choosing.

    I believe it would be easiest to create JSON files which upon EVAL() perform the database loading themselves. It might take a bit of doing but I would guess this will be the cleanest and fastest way to get a loaded SQLite database on the device.

    This sounds challenging - I may have to try this myself.

    I'll let you know how it goes.
  15. #15  
    Quote Originally Posted by rboatright View Post
    there is a howto page on sqlite db on webos-internals.wikidot.com
    Can you verify that URL? It wants to create the page for me instead of provide access to it.

    I too very much want to solve this problem, and be able to install a sqlite db which is pre-populated onto the device. The load/import time to do it on first use is just too high. Trials doing the same thing on the iPhone show times of over 30 minutes to populate the db from the data set.

    Alternatively, if I could just get binary file access -- even if read only -- and be able to install the data files I use on other platorms, I could traverse the files myself and not use SQL at all.
  16. #16  
    I haven't looked at this stuff yet, but this might steer you in the right direction:
    Data Sample – webOSdev – Palm

    I think the page has some mistakes, but on my Mac there is an example in /opt/PalmSDK/Current/share/samplecode/samples/Data/
  17. RickNY's Avatar
    Posts
    254 Posts
    Global Posts
    319 Global Posts
    #17  
    Quote Originally Posted by PreOwned View Post
    Can you verify that URL? It wants to create the page for me instead of provide access to it.
    Try this pre dev wiki: Database Storage Using Mojo
  18. #18  
    Quote Originally Posted by joshewah View Post
    I haven't looked at this stuff yet, but this might steer you in the right direction
    Thanks, but I am well aware of the processes for creating and loading a database on the device. What doesn't seem possible (yet?) is to download (or even install via USB) a DB file which is already pre-populated with data to avoid the time required to load or import the data into the database.
  19. #19  
    Well, I'll have to call it quits for now. I can write complex trading strategies in C# with interop calls out to Matlab in half the time I spent on this sqlite database thing in the Pre emulator.

    I'll tell you, this this.method.bind(this) stacked two or three deep in anonymous function calls stitched to prototyped and down classed pseudo objects in Javascript is not the way to write applications.

    I built out what I thought was a fairly classy JSON to database translation class hierarchy but damn if I could get it to perform in the device's emulator. I'm used to much better tools (VS2008) and I suppose they are out there but doing this the hard way through Javascript files pushed up in incremental revisions and tested over and over - yeah that's not going to work. Even Venkman in FireFox was a decent tool - at least you could stop the code and inspect the DOM.

    So maybe someone could point out an interactive debugger setup for dynamic breaking and interrogation of the memory space, the code stack and the parameter values. Until they do I'm off of this Pre-meditated, Pre-occupied, Pre-madona of a OS. My Pre-monitions turned out to be false.

    AM
  20. #20  
    Well, I'll have to call it quits for now. I can write complex trading strategies in C# with interop calls out to Matlab in half the time I spent on this sqlite database thing in the Pre emulator.

    I'll tell you, this this.method.bind(this) stacked two or three deep in anonymous function calls stitched to prototyped and down classed pseudo objects in Javascript is not the way to write applications.

    I built out what I thought was a fairly classy JSON to database translation class hierarchy but damn if I could get it to perform in the device's emulator. I'm used to much better tools (VS2008) and I suppose they are out there but doing this the hard way through Javascript files pushed up in incremental revisions and tested over and over - yeah that's not going to work. Even Venkman in FireFox was a decent tool - at least you could stop the code and inspect the DOM.

    So maybe someone could point out an interactive debugger setup for dynamic breaking and interrogation of the memory space, the code stack and the parameter values. Until they do I'm off of this Pre-meditated, Pre-occupied, Pre-madona of a OS. My Pre-monitions turned out to be false.

    AM
Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions