I am following the Restkit Tutorial on https://github.com/RestKit/RestKit/blob/master/Docs/Object%20Mapping.md and this is pretty good because RestKit is a really cool framework - I think.
There is just one point I don't get. In the documentation is a line with "article" but I cannot see where article is declared and where it comes from.
// Define the relationship mapping [article mapKeyPath:#"author"
toRelationship:#"author" withMapping:authorMapping];
Can someone give some light into the darkness?
Is this the right area on how to handle 1:n relationships that are nested?
The line should be:
[articleMapping mapKeyPath:#"author" toRelationship:#"author" withMapping:authorMapping];
The updated article on the wiki has the correction.
Related
I'm honestly stumped as to how I could do this. I've been searching and trying out different methods for the past day or so and none have worked. What I'm basically trying to do is store comments for a post (Each row represents a post). I've been reading through the Parse documentation and have tried to implement some of the things that they have there into my code in order to achieve this, but that hasn't worked out either. If anybody could help me out, I'd be extremely greatful.
This exact task is the example provided in the documentation.
http://docs.parseplatform.org/ios/guide/#relational-data
You need to create a new class called "Comments" and then refrence its parent post as one of it's columns.
I need to create a taxonomy and rdf/xml ontology for it,Initially i started with "Protege"
i found tutorial with sample example,and done with it.
On googling i found OntoStudio is better than Protege,but i am not finding any tutorial with example on creating ontology,
Can any body help me in finding it.
With advance thanks,
Laxmi.P
The Ontoprise company has posted a pseudo video tutorial: http://www.ontoprise.de/fileadmin/user_upload/product-videos/OntoStudio/OntoStudio3-Video.html
Spoiler alert: this is NOW a question, so apologies to anyone that read it purely as a discursive topic :)
Anyway, I was doing a little research today re adding routes via javascript when i thought that a bit of google research wouldn't hurt. Basically, my aim was to do away with the following type of construct within my views:
and replace it with something akin to:
well, i lucked out a little today after finding this fantastic article (which isn't mine nor do i have any affiliation other than respect for the piece of work):
http://weblogs.asp.net/zowens/archive/2010/12/20/asp-net-mvc-javascript-routing.aspx
this really has been a missing link (or so i thought) for me when dealing with routes via javascript. However, the 2nd code example is misleading and actually won't produce what the example leads on. Can anyone suggest a fix for this and/or an alternative solution to allow this fluent convention of js routes within mvc views??
cheers...
[edit] - question edited 22:16 GMT to explore deeper options on this topic, plus changed title (removed OT portion).
So the question is why the second code example won't work as expected. Here's the answer, post currently doesn't return anything. This is an example of a certain developer not looking at the details of the code. When you use homePageUrl, the value will be undefined.
To actually get the home page URL, you'd do the following:
$.routeManager.action({controller:'Home', action:'Index'}).toUrl()
So, the moral of the story is that the code is a bit broken. The post action SHOULD return an object where you can put "toUrl()" right after the post is performed, like this:
$.routeManager.action({controller:'Home', action:'Index'})
.post(function(data){ alert(data); })
.toUrl();
I'll be fixing this bug in a bit!
Ok, so you know how you ask a question here, and in the "Tags" field you can enter several space-separated tags into a single text field?
I'm trying to replicate similar behavior in my Rails app. Except instead of questions, I'm doing a blog app (which has "posts"), and tagging those.
I'm using "form_for" to build the quick form. Inside of that I have the line:
f.text_field :tags
The problem I'm running into is, "tags" is not a field on my Post class. My Post class HABTM tags. So, somehow I need to parse the tags text field (using String.split), and pass the resulting tag Strings into my controller, so my controller can create and associated the tags along with the new blog post.
Is using "form_for" not going to work in this case? Is doing this sort of behavior beyond the design of the quick-and-dirty "form_for" functionality?
Thanks!
Unless you really want to reinvent the wheel, I would suggest using a plugin for this. ActsAsTaggableOnSteroids is a mature one. http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids
Agree with Ben on this - there's lots of great plugins and features/helpers that make them simple to use. And you can learn a lot about how to do this in a well-designed way. Here's another good choice.
http://github.com/mbleigh/acts-as-taggable-on
I'm constructing a site with tutorials and other things. I'm trying to find a good URL structure. However, I have a conflict:
tutorials/ <-- list of all tutorials
tutorials/a-very-cool-tutorial <-- points to the very cool tutorial
tutorials/java <-- a list of tutorials tagged java
tutorials/java+soap <-- a list of tutorials tagged java and soap
tools/soap <-- soap tools
tools/wsdl-generator <-- points to the tool
resources/foo <-- resources for a foo
resources/foo+bar <!-- resource for a foo and a bar
tutorials/java?sort=newest
tutorials/php?showhidden=yes&count=30
It's impossible to resolve the difference automatically, so one of them has to be changed. Which one should I do
tutorials/show/a-very-cool-tutorial
VS
tutorials/list/java
or list-of-tutorials or something like that?
I'm inclined to go with tutorials/list/ (and redirecting tutorials/ to that too)
Why don't you express the article hierarchy in the URL structure? You can write:
tutorials/ ← list of all tutorials
tutorials/java ← a list of java tutorials
tutorials/java/a-very-cool-tutorial ← points to the very cool tutorial
This way the visitor can tell that A very cool tutorial is a Java tutorial, and if you mind SEO, this version is good for that, too.
Edit
According to your comment, an article may have several tags, and your site has listings of articles that belongs to a tag set. In this case, you can choose this concept:
tutorials/
tutorials/a-very-cool-tutorial
tags/java ← tags have a separate prefix
tags/java+soap
Or another:
tutorials/
tutorials/a-very-cool-tutorial.html
tutorials/java/
tutorials/java+soap/ ← the trailing slash indicates that it's a listing
(And you can write a third one which may better or not.) It's the matter of your taste.
In addition to the scheme you choose, I suggest you to put the article ID or the publication date in the URL to avoid URL collision.
tutorials/20090509/a-very-cool-tutorial ← a visitor friendly way
tutorials/928/a-very-cool-tutorial ← ID in URL like how Stack Overflow does
Edit 2
Your latest update on the question clarified that aside from the tags, you both have something like categories—I mean tutorials, tools, resources. It gives an unnecessary complexity to the problem. I think it'd be better to handle these extra aspects as tags, too. So tutorial is just another tag like java, and this works with all of the ideas described above.
/a-very-cool-tutorial ← article (beware of URL collision)
/java/ ← all Java posts
/tutorials+java+soap/ ← all Java related SOAP tutorials
/tags/tutorials+soap/ ← you can use an extra prefix
It's not 'impossible'. You can always have a method of checking if the last item in the path is a group or an item and act accordingly - passing control to the relevant code. I have used this technique before on a shopping site.
As the number of items is generally larger than the number of groups, I'd suggest checking if you are dealing with a group as a special case and fall back on item by default.
That's not to say that having an extra parameter in the URL is wrong, better or worse. But you can do it the way you originally stated.
Why not
tutorials/ <-- all tutorials
tutorials/java <-- all Java tutorials
tutorial/a-very-cool-tutorial <-- the very cool tutorial
thus distinguishing between individual tutorials and lists of tutorials by using singular/plural. This removes any possibility of ambiguity, which may give you some sense of security :-)
What's wrong with this?
tutorials/ <-- list of all tutorials
tutorials/a-very-cool-tutorial <-- points to the very cool tutorial
tutorials/tags/java <-- a list of tutorials tagged java
tutorials/tags/java+soap <-- a list of tutorials tagged java and soap
Seems much more intuitive to me, and avoids any ambiguity.
tutorials/by-tag/java
tutorials/search/user-search-string
tutorials/ <-- all
tutorials/a-nice-tutorial
When parsing the url, you can look for these keywords. If it's unknown, it's a variable index passes to the parent 'resource' to resolve (The tutorials collection gets "/a-nice-tut", a search object is passed the searchstring, etc).