How does BreezeJS will help in saving data to client browser without actually saving it to database - breeze

In SPA , how can we use BreezeJS to save data on client cache before saving back to database. I am working on this HotTowel Template and trying an application which is a simple calculator and I want to calculate the results using cache and save it to only cache (client browser), and I should be able to query on the results. ( I am already done with this type of application but problem is that it will do the saveChanges into database directly and the view is updated accordingly)

It's not clear that you have a specific issue we can address.
For a general understanding of how to manage changes offline, you might watch John Papa's Pluralsight course, "Building Apps with Angular and Breeze - Part 2", particularly the "Saving State with Local Storage" module.

Related

Asp.net MVC + Knockout - Single page application - Image upload

I am working on a ASP.NET MVC app with knockout. its a single page app. I have a functionality to upload image. I am not sure whats the best option. the problem i have is, the session is not a sticky session. Which means there is no guarantee that the request will go to the same box. The options i have tried to do image upload are
1.)Data uri - I have created a custom knockout binding for image upload which posts a form to the MVC controller and the controller converts the image to a base64 string and i set the response to a viewmodel property in JS and binding to img tag. While this seemed to be the best solution, i had to support IE8 and this dint work work in IE8 as IE8 has limitation for Data URI
2.)Storing the image in temp folder in application server - Since sticky session is not available this wont work reliably
3.)Store the image in session - This seems to be non performant as session would end up hogging memory
Is there any other approach?
Ad 1) This option is cool for session problems, but you will have a really big overhead in transfer (every image you will send to client and back multiple times).
Ad 2) You can store image in temp folder in unique subfolder (for example with GUID name), and send to client only this GUID. Of course you will have to provide solution which will for time to time clean up this folder - but this is quite easy.
Ad 3)If you store your session in memory, your Web server will quite fast "blow up" with out of memory exception.
So in my option the best option is 2, because:
You will save transfer, so your site will work faster for client
It is quite easy to implement
It is easy to manage.

Should I use Core Data for a mobile shopping application?

I'm currently developing a mobile shopping iOS application that connects to a RoR's backend to receive all its data.
Would you recomend core data as a way to store persistent data such as
Users information + Auth token (to stay logged in)
Photos of items so they don't have to load from the web every time the view is instantiated / app is quit and re-opened(caching).
These photos will be shown in multiple table views & description pages
If you don't recommend using core data. What other options would you say are best for someone in this situation to use.
Your bullet points are describing some simple preference-like items and then an image caching scheme. I don't see a reason to use core data or even sql lite. (Core data, incidentally has a steep learning curve.) You may be better off using NSUserDefaults for the auth token and then implement a file based image caching mechanism. Since the urls are unique, then create a file name by hashing the url. When you fetch the image, generate the hash based file name and see if it's in the file system first, if not fetch it over the net and store it for the next time.
I would utilize CoreData for your caching. You can easily store your images as NSData objects. For your Auth token, you may want to consider using the keychain. Take a look at the Keychain Services Documentation.

How to Insert data from login form into database table

I am new to blackberry, i am doing application in eclipse,i got an situation, how to insert values into the database when entering the data in the login form which contain 2 fields username and password in blackberry applications, please provide solution.
It's quite difficult to understand what are you asking here.
Do you want to add login form data to a local (mobile) database? Or you want to add it to a centralized (to all applications) server?
In the former case, you need to use BlackBerry APIs to create and populate databases using Persistent Object Store (which is always available for BlackBerry Apps) or use any other database you can separately install in BlackBerry. Also consider using SQLite (integrated with BlackBerry OS 5 or superior).
In the latter case, you need to send login data through HTTP (or any other TCP based protocol) and once data is on you application server, you can insert it on any database it supports: MySQL, PostgreSQL, Oracle, SQLServer, Sybase, you name it.
http://docs.blackberry.com/en/developers/deliverables/8673/JDE_5.0_SQLiteGuide.pdf
DataStorage concept comes here.For this first of all learn how data can be inserted to a database table..The above link is a guide which helps you to learn everything about how table can be created,stored retrieved.
Store the data you entered in a variable viz.username,password using persistent storage..
Use these variable names in the Insertion syntax..

Which database can be used with Xcode and at the same time be populated through a website?

We are trying to create an iPhone application that will automatically receive data from a database. Which is a database that will work with Xcode. Our goal is that users can go to our website and input information. That data will be recorded to a database. Once the user downloads our app, the info should then be retrieved from the database and included in the app. We are wondering what database is suitable. It must be able to receive information from a website AND submit it to an application.
You're unlikely to find a iOS "aware" database that can automatically sync content over the internet.
However, you can of course obtain the data over the internet yourself and then insert it into the local database on the device, in which case the popular (and supported out of the box) SQLite would seem like an obvious choice.
As #Deepak also suggests, you could use Core Data which is a (sort-of, ish) ORM that can automatically use SQLite as it's underlying storage mechanism.
The solution that most people use in this case is to use an RDBMS like MySQL and build a web-service layer on top of the database for the entities that your iPhone app is interested in.
This way, when a user goes to the web-app, they can add the data that you allow them to add there, and later on they can access the same data from the iPhone app via the web-service layer also.
Couchbase's new iOS-Couchbase framework is in beta right now - all the functionality of Apache CouchDB on your favourite developer platform - at https://github.com/couchbaselabs/iOS-Couchbase. the iOS release is new but we're looking for it to go places!
Its awesome sync abilities would allow you to pull down any relevant content from your website via HTTP/JSON, or further formats using shows and lists if needed. Pushing data the other way is just as easy. Sync can be continuous, or on demand, bidirectional or one way.
Take a look at some of the Couch App frameworks (not for iOS but for your website)
http://techzone.couchbase.com/community/articles/couchdb/recipes
http://www.mail-archive.com/user#couchdb.apache.org/msg13928.html lots of comments on this thread
A+
Dave

iPhone Data Best Practices - caching vs remote

I'm developing an iPhone app that uses a user account and a web API to get results (json) from a website. The results are a list of user's events.
Just looking for some advice or strategies - when to cache and when to make an api call... and if the iPhone SDK has anything built in to handle these scenarios.
When I get the results from the server, they populate an array in a controller. In the UI, you can go from a table listing view, to a view of an individual event result - so two controllers share a reference to the same event object.
What gets tricky is that a user can change the details of an event. In this case I make a copy of the local Event object for the user's changes, in case they make an error. If the api call successfully goes through and updates that event on the server, I take these local changes from the Event copy and set the original Event object to match with setters.
I have the original controller observing if any change is made to the local Event object so that it can reflect it in the UI.
Is this the right way of doing things? I don't want to make too many API calls to reload data from the server, But after a user makes an update should I be pulling down the list again with the API call?
...I want to be careful that my local objects don't become out of sync with the remote.
Any advice is appreciated.
I took a similar approach with an app I built. I simply made a duplicate version of the remote data model with Core Data, and I use etags on the backend to prevent sync issues (in my case, it's okay to create duplicate records).
It sounds like you're taking a good approach to this.
Some time back, I developed an iOS app where in, I had almost same requirement to store data on server as well as locally to avoid several network call and also user can see their information without any delay.
In that app, user can store photos, nodes, checkIns and social media post and with all this data, app can form a beautiful timeline. So what we did was, we had everything locally and whenever user phone come in some WIFI zone, we start uploading that data to server and sync both (local and remote) databases.
Note this method works well when only one user can access this data.

Resources