As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
My app has a table view, for which the data used to fill it up were from remote service, the data is also expected to change on demand when user tap on a refresh button. Based on that, I am wondering what would be the best design pattern for the scenario, anyone can provide some suggestions or samples?
MVC?
Edit (to try and be a bit more useful):
Model: your own class for this that communicates with the web-service and returns data to the controller as requested. You'll probably download the data and parse it into arrays depending upon how you want to sort/manipulate it.
View: your UI as either a .xib or written in code or a combination of .xib and code
Controller: the table view controller
I imagine most of the work will be in the model.
You could check out the LazyTableImages source code sample from Apple.
and
You should be able to get a prototype up and running pretty quickly using hard-coded data in arrays in the model, and then at a later date modify your model to retrieve real data from the web-service.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am working on a mobile app where I need to send objects back and forth to a central server. Each object has around 10 attributes (either strings or ints).
When I want to send an object from the app to the server I make a POST where each attribute becomes a key-value pair.
When I want to get an object from the server to the app I simply reply to a POST request with the object's attributes on a concatenated string (e.g., atribute1;atribute2;atribute3;atribute4;atribute5;etc.) and then I parse that data on the app by splitting the string and re-creating the object.
Question: Is it fine to use this method instead of formatting the strings as JSON or XML? I opted for this because of the simplicity, and I also believe I won't lose any performance (in fact I might gain some). But I wanted to cross check to be sure.
Here is an interesting site showing the performance difference between splitting strings and parsing json. I feel that if you've already got a system set up for sending data, you should be fine to stick with it.
http://jsperf.com/json-parse-vs-string-split/4
As for other dev's JSON is a great and simple simple standard to stick with.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Where ever I read I see experts writing to stay away from typed datasets and use the entity framework or similar.
On the other hand almost every ado.net book I read will show first how to use datasets and some of them only use datasets, that gives me the impression that its not bad. if it is why teach it for the new programers?
All depends on what you want to do with the data you're pulling from your DB.
I use a DataSet to load data in to a Crystal Report because it plays well together. Anywhere else in my app i use mostly anonymous types. Either way i use the EntityFramework to pull the data from my DB. I get results much faster that way than using ADO.NET and DataSets. If i need raw performance I use ADO.NET. For batch updates for example.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
In Zend_Form_Element. I see addValidators(), but not in Zend example, and the book. They only show me about "NotEmpty" , and "EmailAddress".
Also have ->addFilter('StripTags') and "StringTrim" or "Int"
I want to know is there more value for addValidators() & addFilter() (not only "NotEmpty" and "EmailAddress", right?)
But I can't find any link on Zend website.. Their document is hard to use.
Any one give me a list of those values or link to some page I can learn.
You have it also in your project in library/Zend/Validate and library/Zend/Filter
The Reference Guide is the place to be looking for useful information.
See the Standard Validators page from the Zend_Validate section which shows all the built in validation classes you can use, and a similar page for Standard Filters from the Zend_Filter section.
The API Documentation gives you a full outline of all the classes and their methods, but if you are new to ZF it can be hard to find what you are looking for in the API docs. The reference guide is where you will probably be spending a lot of your time reading and learning from examples.
Zend_Form_Element works seamlessly with Zend_Validate classes, so you are able to 0 or more Zend_Validate_* classes to your form elements to validate them against a set of rules instead of manually writing code to validate input.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
While creating an IPhone application I always care about techniques which greatly effect working of an application on one side and understanding of code on the other. For instance, I prefer creating Singleton to manage data, which separates Data from View. Similarly, use of Asynchronous images and memory management are few techniques which I always use whenever I work with some web service or any database.
What I believe is, there are a lot many effective programing techniques which programmers follow to make their application best presented before the client.
Which techniques I should keep in perspective while creating an IPhone application which makes use of web data or local data? Are their concepts similar to Singleton which I should consider using in my application?
Thanks for letting out few of your secrets :)
I would like to add about the delegate pattern here. Its very helpful when you are waiting for async notifications.
A personal favourite of mine is to control and display gracefully any errors that occur in serving web data. For example if an application uses Async image loading (as you said) have a time out with an Image failed to load picture.
This presents a much nicer interface than a spinning wheel and lets the user know that its not working without them waiting for ages for something to happen.
If you want you can add a try again button to the image placeholder as well.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Any suggestions for some sample source code for an iPhone application that shows Edit/Delete/Add rows for a UITableView?
The code would highlight the typical way to have a UITableView and then use editing mode and various methods (callbacks) to implement Edit/Delete/Add.
(have looked at the Apple examples and see things like Table View Suite, however it doesn't show what I'm after here.
The apple sample code has good examples for these, but here is a pretty detailed tutorial I found a while back that should get you headed in the right direction.
iPhone SDK Tutorial – {Part 5}: Add, Delete & Reorder UITableView Rows