Set a filled sqlite default database in a chrome app - javascript

I have written an app using javascript , it uses websql as its database, when I open it in chrome everything works fine. it uses a filled database table which is like a dictionary. I mean the app needs the database to run correctly. The problem is that when I want to use it on another computer I need to transfer the database to where chrome databases are and rename it to the currently created sqlite file that is created by running the program first (with database not found error of course). The question is how can I automate this? , I've tried deskshell and tidesdk but it still doesn't work. tidesdk doesn't even render the css correctly. deskshell doesn't create the app and the database problem is still unresolved.

Related

How to show an android app which uses webview is up to date

I'm trying to develop an offline android app using simple html, css and javascript. I use website2apk software to convert the local html files to a standalone apk file.
My app contains a tariff of some random products. What i need is to notify (in-app notification) my app user if there is any update to the app.
For example, when user get connected to internet the app should automatically check for updates and if there is any update available, a warning should appear on top of the home page which says "New Update Available" which will be linked to mysite.com/newversion.apk .
Can someone suggest me what to do for this?. I can only depend Webview and pure javascript, which means no jquery.
I'm sorry for my bad English. Thanks in advance.
The site which hosts your apk should have an api so you can check from your app if there is any newer version available.
A possible solution would be to add a file (for example a json file) which contains the actual version of your app. Then you can make a web request in your app to get the file data.
Example:
get 'http://www.yourwebsite.com/appversion.json'

Need to add image to existing xls file in rails 2?

I am reading .xls file through spreadsheet gem and i can successfully update the content, but unable to add image to xls file , please provide any solutions to my problem.
From what I can see, there's nothing out there that can do what you want short of actually automating Excel, which you can do from Ruby using WIN32OLE http://ruby-doc.org/stdlib-2.2.2/libdoc/win32ole/rdoc/WIN32OLE.html.
In order to do that, however, you'll have to be running Rails on Windows with Excel installed. You'll also probably only be able to process one document at a time per server (either physical or virtualized).
If your app is not hosted on Windows (I presume it isn't), you could write a separate application to do the processing and call out to it as a service from your main application. You'd still have to host that on Windows somewhere though.

reading & writing sqlite database with javascript

I am currently trying to get my head around database's and web programming.
I currently have 3 files index.html, script.js (empty at the minute) and test_db.sqlite.
I am trying to pull info from the sqlite database, create a javascript variable with the info and the print it to the html with the document.getElementById method.
What I'd having trouble with is reading the database using javascript. I am willing to use jquery or any other extra JS scripts, but I cannot use php as I intend to use this to create a cross platform app with a python web wrapper on windows & linux and phonegap for iOS and Android.
I also need to figure out to write to the database with javascript.
Thank you for any help in advance.
You have to dump the database (you can use .dump command in sqlite3)
Then you can send that dump to de front-end (the navigator)
You can use WebSql API to create the database and execute all commands of the dump to recreate
Warning, this does'nt work in Firefox. It works only in Chrome and Safari

database table not being created in phonegap

I have a working web app developed using jquery mobile, html5, javascript. I created an android project in phonegap using the html and js files that i already had. The application launches properly on the emulator and I can see all the pages are being loaded fine. In one of the pages I have to save form data in the database. I can see the database creation is happening properly but the table is not being created. This is the code where i'm creating the table in the js file,
db.transaction(function (tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS exp (
id INTEGER PRIMARY KEY,
ename VARCHAR(30),
amount DECIMAL(4,2),
category TEXT,
date DATE)',[]);
});
I'm confused and don't even know where to start looking as to what is going wrong.
There seems to be some issue with the phonegap since I was not even able to run the database example provided by them on the website. Still you can achieve this functionality by creating a plugin for phonegap and accessing the database using the android code.
convert the data from database to json and pass it to the phonegap js file.Refer to this page to know how how it can be done:
http://wiki.phonegap.com/w/page/36753494/How%20to%20Create%20a%20PhoneGap%20Plugin%20for%20Android

Javascript in browser, print data to file

Im running a javascript trading application in my browser, provided by my bank. The application gives me realtime data on stock quotes etc. Is there anyway i can get the browser to make the data available outside the browser, like writing the info to a file every ten seconds? Im using firefox.
No, the Javascript is running in a sandbox. You can write it into a html5 database build in with your browser.
May be, the application is using a SOAP-Service, which you can use directly.
there is a way save the web pages. hope it will help you.
The add on is available to save web pages in mozilla.
see https://addons.mozilla.org/en-US/firefox/addon/auto-save-document/
There is a straight-forward approach, that requires a server (even if it's a very dumb one): You could post the data to the server and have it respond with a file containing the posted data (no more, no less) that the user is prompted to save.

Categories