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.
What I need here is a multiple value field like in this tutorial.
Is there another way to do this with Playframework and scala template? If not, how do I get the values in the field once it is populated?
Play and its template system is nothing more than a way for generating required code (in very basic words) so yes it's possible to use this tutorial in Play.
The tutorial you initially pointed contains everything you need, although it doesn't describe required JSON format. Fortunately you can check included demo to see what they are generating with friends.php
Use Firebug or other similar tool to check what requests are sending to the server when you're starting writing in the To: field and also what does it return as a response.
Now only thing you have to do is just create an action in Play which will return data in required format ie:
when it sends a request:
http://somedomain.tld/friends.php?callback=jsonp1350036024256&term=m
it receives the response (names beginning with given term):
jsonp1350036024256([{"name":"Mace Windu"},{"name":"Mon Mothma"}])
How to prepare the JSON in Play's action is described in last section of the JSON document
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 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.
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.
I am creating a blogging functionality to my website running on a cms.
My requirement is this:
When a person has written an article, he must automatically provided with 'suggested tags'. These words must come from the article. How can I implement this functionality?
I thought some ideas. Like:
Suggest words which are the longest. Using this, I can filter out 'a', 'of', 'my' etc but not 'because'.
Create a blacklist of words. But I couldn't find any such ready-made list and creating such a list will take a very long time.
So, any other ideas?
You could do Bayesian classification and see what happens. Here's some example code.
UPDATE: This presupposes that you have some tags for the classifier to choose from. Here is a simple algorithm for extracting keywords from text if you need to initialize your list of tags.