Using offline storage - ruby-on-rails-3

I am trying to make a website which will store all the contacts of the user on the server database. The user can add, edit, delete or update a contact. I want the user to be able to do all these functionality even when he is offline. What should I use to achieve this. I came across web sql database which can be use to store database offline. But I dont know how to synchronise the online and offline database. I am using Ruby on Rails

According to Web SQL's W3C page, the specification is no longer in active maintenance and the Web Applications Working Group does not intend to maintain it further (http://www.w3.org/TR/webdatabase/).
Why don't you give HTML5's persistent storage a try instead? There's a great tutorial here that also features a chapter on local storage hacks before HTML5, so you may read it if you're not planning to dive into HTML5 just yet.
You may also try Google Gears, as it features an interface to a local sqlite3 database in which you may store your offline data.
As for the synchronization mechanism try persistanceJS. It should help you with both HTML5 and Google Gears options.
EDIT
Apparently persistanceJS has no support for rails just yet, but there's a tutorial on how to use local HTML5 storage with rails here, and there's a rails plugin to easily enable gears on rails apps here. Those should get you started.

You can use Ruby on Rails to do it as well. Check out the Railscast series of video tutorials. Specifically episode 247 to get started with ROR and offline storage

Related

Nativescript Offline Data

I'm quite new to NativeScript so I'm after some advice.
I've been looking at different back-end database solutions for the data. I've looked at firebase and while it does what it says on the tin I've come from am SQL relationship database background historically.
I've had a look and see that kinvey can connect to azure database (haven't tested this as yet)
I've looked at the azure database plugin but at present that doesn't support offline data.
Just wondering what other people have tried and recommend/stay away from.
Your use plugin nativescript-sqlite.

Can i connect my reactive app with Mysql database

I've searched all over the internet. I'm very new to reactnative and react. So i'm wondering how to connect my app with Mysql and perform CRUD operations.
If you're referring to an on-board database, your best options are probably Realm, which as per their gitHub page is "faster than even raw SQLite on common operations, while maintaining an extremely rich feature set," react-native-sqlite-storage, or react-native-local-mongodb.
For off-device, what has worked for me--though it was a long road to get there--is using react-native-meteor (at this repository) which does CRUD operations with MongoDB. I used MySQL when I was working exclusively in Android, but Meteor and MongoDB is a nice marriage to RN for cross-platform deployment. Otherwise you can just use Fetch in React Native, use a REST API server interaction that gives you a JSON response (which can use any server language you're comfortable with), and go from there. Good luck!

how to have database offline for iOS app

I would like to develop dictionary app for iOS application. and I am not sure which database Managment system should I use to store data. I want to my app to be offline so even user that don't have internet, they still can use my app. so my question which database should I use to store my database ? I research on google, it said sqlite. so if i store my data in sqlite so will my data in database sqllite will go with my app? thank
Yes, sqlite is your DB of choice unless you're just working with a couple of dozen records.
If you plan to use CoreData, you can also address sqlite with it.
If you don't plan to use CoreData, you can still use sqlite and work directly with the DB. There are good wrappers which help you, like FMDB: https://github.com/ccgus/fmdb

What's the easiest/cheapest way to create a cloud-based SQL database?

I have a website that I've built (hosted on Amazon S3) and it works great. The only problem is that all of the data is static. I'd like to create a SQL database in the cloud that would allow me to store basic text data from users after they submit forms. I'm still a novice web-developer but I've used sqlite3 for several of my Java desktop apps and I'd like to use that SQL knowledge to create this online database. I guess what i'm asking (in my ignorance) is: how can I create a sqlite-type database that is stored in the cloud and that I can query against using javascript?
Where do I get started? Is there a service like Amazon AWS or Azure or something where I can create this database and then use some sort of jQuery/Javascript API to query data from it? I don't need a ton of storage space and my queries would be very basic SQL type stuff.
Any help would be greatly appreciated. Thanks in advance.
For more flexibility, less service lock-in, and cheaper scalability: I would suggest CouchDB (though you would likely still use a hosting service like Cloudant). CouchDB can host your website, and provides a HTTP API for storing data, to which your client-side JavaScript can make REST calls.
StackMob has a free package that you can use. You can use the JS SDK to write your HTML5 app and save stuff to the StackMob DB. You can host your HTML5 on StackMob for free and point your own domain to it as well. There is also S3 integration.
Some references:
JS SDK
JS SDK Tutorial
Hosting your HTML5
Custom Domains
Create a Postgres database on Heroku for free.
https://devcenter.heroku.com/articles/heroku-postgres-plans#hobby-tier
As you mentioned your website is hosted on Amazon S3 I am sure it is a static website with lots of JavaScript embedded HTML files. Due to having a static website, I can understand your requirement to use a database which can be connected from your static site and to be very honest there are not a lot options you have. Static website are considered to have no dependency on database so honestly you have very limited choice because what you are looking for is "A Database which is accessible over HTTP which you can call from scripting language withing HTML"
If you have ability to write back to S3 directly from your JavaScript code you can create a JavaScript based database within your static site which is complex but consider a choice.
In my thinking you are better off to have an extra-small instance in Windows Azure (or your choice of cloud service) and connect with a cloud based database which will be comparative cheaper and fit for your requirement.
Or unless Amazon can come up with a DB accessible from status content as S3, you really have no great choices here.
Since you are already familiar some of AWS's offerings, you should check out:
Amazon RDS - Managed Relational Database Service for MySQL or Oracle
Amazon DynamoDB - Fast, Predictable, Highly-scalable NoSQL data store
But to do what you are asking (access data via JavaScript), check out www.stackmob.com. You can host an HTML5 application with data access via backbone (javascript based framework) on StackMob.
Create a Virtual Private Server on Vultr.com. It's not the easiest way, but it's the best way for you to learn about Database Security, and it will be significantly cheaper than the other solutions, should your server begin to require more storage.
[vitrobridgedb] is free for hobby applications and pretty straight-forward to use
SQLite isn't really a good choice for web facing applications due to its scaling issues.
Both AWS and Azure support SQL databases. They also each support alternatives like MongoDB and Redis. For something as basic as you describe the only real difference is cost.

Does Anyone Have Experience Creating an Occasionally-Connected Browser App With NHibernate?

We need to make our enterprise ASP.NET/NHibernate browser-based application able to function when connected to or disconnected from the customer's server. Has anyone done this? If so, how did you do it? (Technology, architecture, etc.)
Background:
We develop and sell an enterprise browser-based application used by construction field personnel to enter timesheet information. Currently, it requires a connection to the server back in the customer's office and we'd like to build an occasionally-connected version of the application for those clients without wireless Internet availability.
Our application is an ASP.NET application using NHibernate for O/R mapping. Being a Microsoft shop, the Microsoft Sync Framework is attractive, but we don't know whether it "plays well" with NHibernate.
Any insight would be greatly appreciated.
Dave T
Maybe you could operate some kind of offline version using a small version database (I hear good things about vistadb - http://www.vistadb.net/ which I believe does play well with NHibernate). With a syncing tool to copy data in when they are back on line. A click-once launcher could handle installation and integration.
Want to be careful with anything involving syncing though - if it is just single user timesheets that might be OK - but if there are any chances of conflicts in the online-offline data you might be better considering the problem from a different angle for pain-avoidance...
Why not couple it with Google Gears? People put their data in while offline, and then they can sync it when they reconnect to the server.
In a modern world, using the HTML5 data store:
http://www.webreference.com/authoring/languages/html/HTML5-Client-Side/