Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am creating one application. This application have two databases.
Local Database (In the mobile)
Cloud Database
Both databases are automatically syncing.
Through my application when I Browse the page I want to keep that page in my phone. again When I browsing without internet (Offline) I want to access that store files.
My problem is without internet offline browsing (stored web pages) need to access my local database and give the informations.
Eg. I want to search something. if it is internet search cloud database. (Same time store the web page HTML content in the phone). Offline searching want to access the local database. In here it want to use the stored HTML content. But access the local database.
It is possible or not? I am a beginner. Please guide me
You use scripts/code on server to connect to db on the server when you are online. Even if you download and save you 'HTML' file locally, when you load it in UIWebView it is not going to start fetching data from your local sqlite db. (hence all the down votes i guess)
So simply put, what you are asking is not possible.
However, an alternative which may work, subject to your app requirements, is to change your app code to always perform searches on local database and instead of HTML show search results using native UI. As you claim that your local db syncs with the sever automatically, when you are online, after your db is up to date, your search results will fetch fresh, synced up data from local db. Since your search uses local db you'll be getting last synced data when you are offline.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Sometimes client and server side caching, cookies, and other complicating factors can get tricky, and when they do, sometimes opening an app in the browser and inspecting can be a quick way to see what's going on.
However, for various reasons, sometimes it would be nice to open the app in a completely isolated instance of chrome (or other browser), without any need to alter current chrome instance(s) (e.g. the reference pages you may have open, or even other tabs with your app loaded - sometimes you just want a completely isolated environment to open your app in, just as though it were another computer altogether).
How can this be achieved?
What I know so far
Incognito - the downside here is only once instance can be opened because multiple incognito windows will share cookies/assets
Run chrome in docker? (I haven't tried this it's just an idea)
The only sure-fire way I have atm is to simply put the app into production and view/test it on another computer altogether (this is not sensible nor efficient, as I'd like to test in development i.e. localhost)
Open app in another browser is another possibility, however, suppose we want to test specifically in chrome
Chrome and Firefox supports using multiple profiles that won't affect each other, reusable (unlike incognito) and can even have entirely different extension ecosystem.
By creating and using multiple profiles, you can do development — creating extensions, modifying the browser, or testing the browser — while still being able to use Google Chrome as your default browser.
How to do it:
From Chromium docs:
The details of how to create and use a profile vary by platform, but here's the basic process:
Create a folder to hold data for the new profile.
Create a shortcut or alias that launches the browser, using the --user-data-dir command-line argument to specify the profile's location.
Whenever you launch the browser, use the shortcut or alias that's associated with the profile. If the profile folder is empty, the browser creates initial data for it.
In other words, simply create an empty directory somewhere and run this to open a new instance of chrome that's completely separate from any current one:
open -n -a "Google Chrome" --args --user-data-dir=$(mktemp -d)
Related:
see here for how to open chrome on mac and pass it arguments
see here for how to create a random temp directory in bash
see here for more on 'How do I start Chrome using a specified “user profile”?'
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I want to make use of Firebase's services such as authentication and the real-time database. It makes integrating with the front-end clients very easy. However, I am struggling with the database portion. I still want a relational database, so I can more easily interact with my other data, so I thought of Rails and Postgres for this. I know Rails has ActionCable, but I want to utilize more of the services in firebase. I wanted to have my frontend clients talk to my Rails app and then have the Rails save to Postgres then transforming the data in a suitable NoSQL format for Firebase's DB. Is this a proper way of using Firebase? How else can I utilize Firebase's real-time DB without making it the source of truth?
I think you can do it. I usually do things like that using an event source architecture.
Let's say I have a class called User and I want to keep them in sync with a user collection on firebase. For that purpose, I would put a listener on User:
models/user_observer.rb
class UserObserver < ActiveRecord::Observer
include Wisper::Publisher
def initialize
subscribe(FirebaseUserPublisher, async: true)
super
end
def after_save(user)
publish_changes_to_firebase(user)
end
end
so that, every time a user is changed/created, the changes will be async reflected on your firebase and the FirebaseUserPublisher class will take care of it.
Remember that this means eventual consistency: if the FirebaseUserPublisher fails, your data is out of sync
This is basically what we are doing in a large collaborative web-application. We have a Java-based backend which watches specific keys in our Firebase RTDB for changes/additions/deletions, and responds accordingly. It uses the data from Firebase and then fires up a new Apache Mesos executor for each workspace that is currently active in our web-application (Has "presence"), with each instance having its own PostgreSQL database that the executor uses. This database is populated using data scattered around our RTDB.
When we want to have the backend perform a long-running calculation or task for the client, we write some data to a specific location ("dbRequests") outlining the task we want and some user-defined parameters. The backend executor reads the request and then goes off and spawns a worker service to execute the task for us. Once that is done, it writes new data as a child to the original request which the client picks-up and displays to the user (Or, in the case of reports, opens a new tab with the rendered charts using the calculated data). Generally, it works well for our use-case: many connected users working in a digital workspace with live updates for each connected client.
The biggest problem we've faced using this model is running data migration scripts, and managing all of the data we have in the RTDB. To be expected I suppose, since it's essentially a giant JSON-structure ;).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm new to iOS and have just started leaning it. I want to develop a small app for bus passengers where-in all users in the bus must login using the app.
If user is using the app for 1st time, he must sign up . User must enter all details like Name,Age,Emergency Contact,Address,Source,Destination,Phone number etc.
If user already exist, then login with existing user name and password.
All details must be stored somewhere (not sure) and retrievable format.
Here comes all my question and doubts based on above app requirements :
do i need to follow client-server architecture ?(mobile app being client )
where all user details will be stored ( on mobile or server )
when user tries to login, how check if user already exists or not ?
if any communication protocol to be used for mobile app communication then which will be good considering the performance of app should be fast.
mobiles internet data should be available ?
which database to use to store user details ?
considering all above things i need to design my app.
thanks
I will try to give some points to start from.
1) I think yes (its really depends what you want to achive but if you only want to get/pos resources to/from server, http request should be enough to start from).
2,6) Depends which details.
For simple details which no need in protection NSUserDefaults Sqlite or Core data can fit. (also there are some nice wrappers for them for instance TMcache, you will need to investigate it).
If you need to save private details you will probably need to use keychain.(honestly I would avoid saving important details on the device everything can be hacked so try to limit it).
3) One of the common ways which come to my mind is to check in run time if the user already logged in is by saving login status in NSUserdeFaults and check it in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions. If you need to check Existence of user in your system than probably some server help will be need.
4) Please refer to apple Docummentation NSURLSession should fit.Also AFNetworking is really good library.
Edit:
5) Usually IOS will use Current Internet Connection which is available and more efficient for the system it will start with WIFI then CellularData (Check Reachability for testing availability of internet connection its also included in AFNetworking library) .
-All those questions/answers can be found on stack.Hope I helped.
List of common IOS frameworks
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am looking for advice on what the best tool for the job is for sharing a relatively complex data object between two iOS apps on the same device.
I have a real estate investment app that we will call app A which allows the user to input data about a potential investment property and calculate important financial metrics such as ROI. All of the property data is persisted using Core Data in an object we will call Property.
I am developing app B which imports a Property Object from app A and creates a PDF report that the user can send to other investors. The Property object does not need to be persisted in app B, only used temporarily to create the pdf file. I would like the user to be able to open up app A from app B and choose a property, similar to a photo picker.
My initial instinct is to use URL schemes to solve this problem. Is this the best solution for my needs?
There aren't many options and what few there are really require that both apps be developed by the same developer (which appears to be the case here).
The easiest is to used a shared, private, named pasteboard (UIPasteboard) in conjunction with custom URL schemes.
App A can put the data in the pasteboard and then launch app B using its custom URL scheme. Of course both apps must be coded to understand how the data is written to the pasteboard and on the name of the pasteboard. Though the name of the pasteboard could be passed as part of the custom URL.
Once app B generates the PDF, the reverse process can happen. App B can put the PDF into the pasteboard and then launch app A using its custom URL scheme. Then app A can get the PDF from the pasteboard and present it to the user.
Or, if it makes sense, app B can use a UIDocumentInteractionController to let the user choose what to do with the PDF. That is certainly up to your needs.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I hava an iPad app where I store data using Core Data (sqlite store).
The app would be sharing the Core Data store between authorized users on a per-app/per store basis; in other words, one shop buys the app, and has several staff members with iPads who want to access the Core Data store on their iPad for that shop. Other shops are have the same requirements, each shop having it's own unique Core Data store on a unique Google Drive, which would hopefully prevent one shop from looking/downloading another shop's data.
is this possible?
can someone please point me to the relevant docs that I need to get started with Google Drive API in my iOS app?
is there a way that the app can synchronize the data between iPads on a per shop basis using Google Drive?
If you want to put the Core Data in shop's Google Drive, there is a potential risk that the shop might accidentally delete or modify the Core Data, but anyway, this can be achieve like this:
In your app, ask for the shop account for appropriate scopes, then store the credential in your service so later when staff members ask for the Core Data, you can delegate the shop account to grant shop's staff permission to access the Core Data. In the staff's Google Drive the file will appear in Shared With Me.
Maybe you should use another account to hold all the Core Data for all the shops, for example your service account. When one shop buys the app, your service creates a Core Data for the shop, then adds permission for only the shop. I suppose you want the Core Data to be readonly, so you can grant the reader permission for the shop. When shop staffs ask for the Core Data, you do the same for them.
Now the shop and staffs can access the Core Data, you will want it to be in specific folder, so it can be synchronised to shop or staff's local devices, in your case, their iPads. You can delegate the shop or staffs account to create a folder for them. Then update or Patch the file's Parent to include the folder Id. The shops and shops' staffs will see the Core Data in the folder you create for them. This action will require a higher scope, say: https://www.googleapis.com/auth/drive.
https://developers.google.com/drive/quickstart-ios
Hope it helps.