Simplest way for understanding MongoDB iphone - ios

What is the simplest way of understanding about mongoDB? i know there's something called as NuMongo wrapper to to interact with mongoDB, but yet its not yet clear in my head. Can some please share the knowledge ?
Thanks

Directly accessing a MongoDB database from a mobile device is probably not a good idea. The main limitation is that the Mongo wire protocol has no encryption.
You can build an application server as middleware, in almost any language you like.
That said, ObjCMongoDB (of which I'm author) has support for iOS, so if you decide you want to give it a go anyway, you can.
If you want to write an application server on Mac OS using Objective-C, you can also use ObjCMongoDB for that, along with something like CocoaHTTPServer.

An very simple way is to set up a Rails Application with some mongoDB PlugIn, e.g. mongomapper and in Rails you can define the web service to communicate with the iPhone.
These links are very good to understand Rails and mongomapper:
Rails Guides
MongoMapper Documentation

Related

What's the benefit of using Sinatra instead of RoR if I'm only need a DB and an API

I need to build a web service, for a mobile game, to manage the states of multiplayer games. I need a database and an RESTful API to access it. I'm very familiar with Ruby On Rails and was thinking of using that since I can throw together the DB and API pretty quickly. However, since RoR is a framework for building web pages and I'm not actually building any web pages, it naturally seems like the wrong technology to use even though it would work. As such, I'm considering using Ruby on Sinatra, but I've never used it before and I'll have to kill some time learning it. For you Ruby gurus, is there an advantage to using Sinatra or a disadvantage to using RoR for what I'm trying to accomplish?
Thanks so much in advance for your wisdom!
You know Rails, you don't know Sinatra. Personally I prefer the latter for things like building APIs, but there's nothing stopping you from doing it in Rails, and there's nothing intrinsically wrong with it either. Unless you want to see this as a learning opportunity for getting into Sinatra, I'd say stick with Rails. Here's some links that might be useful btw:
Building APIs With Rails
Building a Platform API on Rails
It probably depends on your API. If you need more than just a bunch of routes then you will have to come up with your own solutions (authentication, ...).
If all you need is some RESTfulness without the added weight, Sinatra is great. All you need to know is what happens in what route and you're fine. See the Sinatra Readme which has all the information to get started.

Best option for C / Ruby interfacing

I've got a Ruby on Rails application, which needs to communicate with a backend C application, and I'm wondering what the consensus is for the best approach is to this.
The two applications will run on separate servers, with the Rails application on a (partially) public web address. The C application is entirely within a firewall. For security reasons, I don't want them sharing a database. My initial approach is that web services is the right way to go.
Firstly, am I missing any potentially better alternatives to my web services assumption?
Secondly, while I've got plenty of experience using SOAP from C with gSOAP (and importantly, so does the person who will be writing the C-side!), Ruby on Rails prefers the REST model.
But what exactly does a RESTful interface from C code entail? Is there anything like gSOAP that does RESTFUL interfaces from C?
Does anyone have a feeling which is the path of least resistance here?
EDIT: forgot to mention that the C application does already have a web interface using Aapche / CGI.
For C calling Rails, libcurl is probably not too bad an option. Making REST calls is pretty simple, since it's mostly url via string concatenation plus form-encoding. Examples are abundant:
http://curl.haxx.se/libcurl/c/example.html
If you need Rails to C via REST ... ugh. Perhaps Apache and straight cgi? Or just wrap it in it's own rails app and do the calls directly from that app? Seriously, If you need Rails to C via REST, I hope you get a good answer.

I want to build a chat room using Rails, should I use juggernaut 2 or cramp?

Originally I planned to use Juggernaut, however, it is not compatible with Rails 3. And new Juggernaut 2 seems to be completely independent from Rails, which is not what I want. Then I found cramp, it looks quite neat, but is still under development. So I am just wondering which framework should I use? Or is there a better one?
Thanks!
You're right that the new Juggernaut is de-coupled from Rails, but that doesn't mean you can't use the two together. Juggernaut comes with a Ruby library. Using Juggernaut solves the long-lived connection problem that Toby was talking about.
Any questions about Juggernaut, ping me a line (I'm the creator).
I have looked at the options for this stuff quite extensively and real-time chat is a bit against the grain of Rails. If you really want to stay inside Rails, then Cramp is probably the best option. I recommend you have a look at this article on Websockets and Rails as well: http://www.igvita.com/2009/12/22/ruby-websockets-tcp-for-the-browser/
Using EventMachine to handle the communication means you are that even though you will still be outside Rails, you are at least in Ruby and can share models and libraries.
I have a Async Rails build on GitHub:
https://github.com/tobyhede/AsyncRails
Which is largely based on:
https://github.com/igrigorik/async-rails
Well - you could also try Socky: https://github.com/socky/socky-server-ruby
It's ruby-based, and uses WebSocket as base with flash fallback to support most devices. Also it's complete ruby-based so give it a try if you want :)

Web App that uses Webcam...any Rails plugins/gems?

I;m a developer looking to make an app similar to chat roulette. I'm pretty comfortable with Ruby on Rails as my platform and would like to program it in that.
The downside is I have no idea about how to do anything using webcams.
Is there a plugin or gem for rails that integrates webcams easily?
Some quick browsing brought me to abobes site...but I haven't used it before, and though I dont mind learning new things, I'd like to get this out quickly so I'd rather stick to what I know.
What you do you use for webcams?
You would have to use a third-party plug-in to interface the webcam with the site. Rails takes care of things on the back-end (finding and connecting users) but you would need to use Flash or something similar to connect the web page with the camera.
This question is pretty old, but we've been able to use headshot gem in one of our apps.
https://github.com/diwadm/headshot

Using MongoDB for a calendar web app

I have been doing web programming for few years. All this time, I have been using RDBMS. As a side project, I would like to create a web application and would like to use NoSQL. I have never used NoSQL. So I would like to use a NoSQL solution. Web app is going to be a calendar and article list that are going to be shared among a project group. I would be using Ruby on Rails.So would it be fine to use MongoDB for this web app? or do you have any other recommendation?
MongoDB should be fine. I can't think of a particularly compelling reason as to why it'd be superior to an RDBMS or one of the other key-value stores out there for this particular problem, but I can't think of a reason not to use it, either. For a learning project, it should be more than fine.
As far as interfaces go, I'm currently using MongoMapper and am happy with it, and Mongoid is picking up a lot of steam. You can even just use the Mongo driver directly - it's very usable.
Candy looks quite nice as ruby lib. There are other like MongoMapper and Datamapper + do_mongo and likely more.

Resources