Using CoreData to save data across Views and sessions - iphone

I am new to IOS and coreData Framework..from past 2 days m reading tutors regarding coredata..I understood few concepts..but i am confused..can you all please suggest me good tutorials regarding coredata.
So my second problem..I am building a application..where my first view has a text field and a search button..and an empty table..so when the user enters a search query and hit the search button..it opens a another view which gives him a list of values in a table and again when the user cliks on a specific cell he is agian taken to page which contains some values..so on this page ,I want to have a button name (xyz) which when cliked..will save that particular value in the table which is present in the first view..and similarly the process will conitnue..
So i want to know..whether coredata is necessary for my problem or any diffrent menthods are available......
Please reply..m waiting for your respones..
Regards
RRK

Core Data manage very well sqlite database.
You can learn on the apple developer website :
http://developer.apple.com/library/ios/#documentation/DataManagement/Devpedia-CoreData/coreDataOverview.html
And there is a quite good tutorial here :
http://developer.apple.com/library/ios/#documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html
I think core data is a very suitable solution for your problem.

Related

Realtime datatable with asp.net core web app , EF core and SignalR

I want to retrieve data from Sqlserver database with EntityFramework core and do crud operations and show data table to client without refreshing the page (Realtime) , is there any source or example in this case ?
Not sure there is a definitive source for this, but it's not that hard to build yourself.
It should be relatively straight forward. In general you'd need
A model for the grid that defines the properties to show and edit, and also which row is selected.
An HTML Helper to change the rows from read-only to editable
A view to display the table.
An [edit] action link for each row enables you to select a row by ID for editing, and after clicking it, reloads the page and then the view can respond accordingly to change the type of the row from read-only to editable.
You could use Blazor or maybe Ajax to change a row from read-only to editable without refreshing the page, but I'm not sure if you need to meet certain requirements that discard using either of them.
John Ciliberti has written a recipe for a book, that works just like I described, find it on his Github page to get some ideas of what's involve.
If you need a more out-of-the-box solution, perhaps consider wiring up DataTables.js.

laravel 5; redirect to previous section after store or view

I think this is a basic problem or question, but i can't find any solution that solves this problem, so probably i'm searching in the wrong way or on the wrong keywords.
I have a bunch of articles in my DB, and there are a number of ways to read/edit them on the site.
- The visitor can see them in a list, click on them and read the whole article
- The registered users can see them in the same list, but click on them to read or edit the article
- The admin can see a different list (an different view), and edit or delete them
and i'm sure i will come up with some other ways to read or edit the articles or other data.
The point is, that if a visitor or user had read or edited the article, i want them to return to their own index of articles, but if an admin has read or edited the article i want him to go back to the admin-index.
So from the start i have a number of routes:
Route::get('/article'... will display the index of articles
Route::get('/article/{name}'... will display an article
Route::get('/article/{name}/edit'... will display the edit form for the article
Route::post('/article/{name}'... will update the article
And for the admin:
Route::get('/admin/article'... will display the index of article
Route::get('/admin/article/{name}'... will display an article
Route::get('/admin/article/{name}/edit'... will display the edit form for the article
Route::post('/admin/article/{name}'... will update the article
But..Route::post('/article/{name}' and Route::post('/admin/article/{name} should point to the same function to update the data, and that function should redirect to different routes, in this case Route::get('/article' and Route::get('/admin/article'
I really dont want to write 2 different routines to store or update the data in the database, that are in fact the same, except for the 'redirect'-line after updating or storing.
My first thought was to make 2 routes, with two entries in my controller that each call the same routine that saves the data, and return where i can redirect, but then i would have to use different 'actions' in my form. That would mean i would have to make 2 forms that are the same, except for the 'action'-line.
Whatever i do, i would have to redirect somewhere based on the section of my site where i was before i started to read or edit my data.
I read something about the 'back()'-function, but that won't help me because i want to be able to read an article, and then choose to edit it, then return back to my index.
I hope i was able to explain what i want to do, and i'm sure i'm not the only one looking for this, but again, i failed in finding a right solution.
What is het best way to achieve this?!?
I would just separate the controllers between normal users and admin users. This way your code will stay clean and understandable.
You could for example make the following folder structure:
app
- Http
- Controllers
- Admin
- User
Don't forget to change the namespace in your controllers.
If you really want to stick with the same controller for both users then you need to make some kind of if else statement to see what kind of user your are dealing with and redirect on that outcome. Do you have some kind of role structure in your application?

how to make a Questionnaire iPhone app with sqlite

I want to make an iPhone app just like a questionnaire/Quize, and want to store all questions in sqlite database , i need to have One question that can be a label and 4 radio buttons for answers, user will select the option and will go for the next question, questions and answers will be saved in sqlite and at the end user will come to know how many he made correct or wrong choices.
Please suggest me any tutorial or anything that can be help full for me,please guise i will be grateful to u for this kindness in advance.
Just make a database with a table with columns like so : id, question, answer1,answer2,answer3,answer4,correct answer, did answer correct;
If you don't know SQL just use a wrapper like FMDB
After that just us use the built in function to get from database the question with a certain id (i.e. question number) and pass that to your question-asking class . When the user presses on an answer, check if it's correct and modify "did answer correct" columns.
Break your project into set of questions:
1. How to create GUI in iPhone?
2. How to connect to database in iPhone?
3. How to create label, radio buttons in iPhone?
4. How to submit form in iPhone?
Etc.
Then search the web for each of these. Perform these examples individually, test them and combine them.
Voila you've got a brand new questionnaire application :)!!!

Simple Core Data Example App?

I am trying to learn about core data on the iPhone, and I am looking for a simple Core Data example app.
The problem is, all the example apps I've seen are either too simple (just one view and one data object), or so full of extra functions that it's hard to see what's relevant (Apple's example apps).
I'm looking for an example app with:
an ordinary cascading to-many relationship (e.g. Company > Departments > Employees)
a simple drill-down interface (e.g. click on a company to see list of departments; click on a department to see list of employees; click on an employee to see name and address)
simple editing (press plus for modal view to add company/department/employee)
... so I can learn the basics about passing contexts between views, NSFetchedResultsController etc.
Does anyone know of such a thing?
Thanks!
Try the example found here: Wiley Code Examples
Click on Chapter 18 - Downloads.
Hope this helps.
Let It Be Known
I would recommend Marcus Zarra's Core Data book and the examples therein. He takes one example app that starts off very simple and incrementally adds complexity.
RecipeCT is the project that I would suggest looking at first. Having the book would help you navigate from project to project as the basic Recipes app transforms.

iPhone example to go through

Can you provide me a basic iPhone example which has the following;
a. It is primarily a navigation-based app (Top-level view, Detail view, etc)
b. It also uses table (to present list of items, item details, add, edit, delete)
c. It uses Core Data for storing the list items
d. Optionally, it would be really great if it uses an API for retrieving some of the table data (otherwise user entered if API does not return).
While I do have individual examples for all these thing, I ma basically looking for an example which kind of combines all these things into a single app.
I have already gone through some of the IOS developer reference and hence would want other combined examples.
Any reference examples would be highly appreciated.
Thanks a lot.
Have you looked through the iOS Sample Code library? You'll find examples of all these. They have TopSongs (API, Navigation Views, Table Views, Core Data) and CoreDataBooks for Core Data.
If you create a project using the Navigation based template and select "Use Core Data" you will get the skeleton of exactly the type of app you want.
Examples covering all of those are on Apple's developer website, developer.apple.com.
I used this one is one, to learn this: http://icodeblog.com/2008/08/19/iphone-programming-tutorial-creating-a-todo-list-using-sqlite-part-1/#create-db