News / Tag Aggregation Packages? - ruby-on-rails

In an attempt to avoid writing my own aggregator for an existent Ruby on Rails app and WordPress blog, I'd like to be able to aggregate various chatter going on in various mediums at one central page based on particular keywords, etc.
This aggregator can live either on the blog or within the Rails app, it doesn't matter.
For example, let's say I want to continually poll Google News, Twitter, public Facebook, and perhaps others, for "chocolate chip cookies." Is there a package that already facilitates this or am I in a "roll it yourself" situation?

One thing to consider is using HTTParty to deal with the APIs those services expose...

Related

Multiple users with single database Ruby on Rails 4

I'm building a system that (when completed) will serve multiple commercial customers. I need to accomplish the following:
App should use one database
Each commercial customer will have multiple users.
When any of the commercial customer's users create/read data, they should do so under the commercial customer's namespace....Thus they should not be able to see other customers' data and should also not be allowed to create data etc. for other customers.
Initially I thought that the best way would be to assign all users to a commercial customer via association. As I was worried about querying the database too much, I did some research and found some info regarding Rack and middleware. This seems to be another option of achieving what I want, but it confused me a little.
What is the best option to achieve this sort of functionality in my app?
**PS. All commercial Customers will have unique URL's ex. customer1.myapp.com
Thanks
Rack and Middleware are layers that requests go through before they hit the code you wrote in your Controllers and Models. In short, if you need some preprocessing, or anything of that nature going on, then you shouldn't mess with middleware. For this particular case, you don't need to deal with middleware.
You're building a standard Rails app that serves different clients (users, if you will). It is okay to make many queries to the DB. The important thing is to make sure your queries are efficient and that you're making proper use of the ActiveRecord system, which helps a lot in efficiency. You have Model#includes, Model#eager_load, amongst other methods at your disposal.
As for customer1.myapp.com, there is a lot of information in Rails guides about getting those things set up and interfacing with it.
What you're looking for is Multitenancy.
There are several approaches on how to implement it. One of the options is to use PostgreSQL's schemas.
You can take a look on the gem Apartment. Maybe you can get some idea out of it.

track visitors data on a website ruby rails?

I want to track the information of a user , which pages the user visited, which ip from to a website using ruby on rails, how should I start with ? good sources to study for web visitor tracking program I m a newbie to ruby/rails
If you want more in-depth analysis than google analytics then Kiss Metrics may be what you are looking for. You can use it to track arbitrary actions or events that occur within your application.
https://www.kissmetrics.com/
Note: I do not work for kiss metrics... just a fan.

How to implement data visualization in ruby / ruby on rails using R?

Disclaimer: We're a collection of scientists that are just now getting into python/ruby.
Project summary: We have analytics and usage data from social networking sites that we are using R and Highcharts (via lazy_high_chart gem) to present analytics to users through a website. The user can interact with this data by specifying which and when they want to investigate a social media segment. So the user defines the subject and the website responds with a slew of metrics.
Problem: So far we have been using straight ruby to pull social networking data (one class), send it to the analytics engine (another class), and present it in plotted glory (final class). However, this is all been proof of principle and console driven so it seems inefficient to push it to a site from this start. Should we have started from the ground up with a rails framework and just built the site with all of these analytic engines built into the site? Or...is it better to have this backend pipeline written in ruby that only interfaces with a rails framework trough yet another object?
A suggestion or pointer to a general document that hints on how to integrate backend data crunching with frontend rails would be great.
Your question is basically how to architecture the system, and this is somewhat hard answer since it usually depends on a lot of things: system requirements, application landscape, project planning, skills, etc.
But just looking at the two alternatives you mentioned, I think there's nothing wrong with creating a fresh Rails application, copying your prototype modules into the lib/ directory and connecting things the standard way. You can use rake tasks to keep the console interface you already have. In the end, your setup looks quite similar to a standard web application. (Usually you have a database doing the "data crunching", in your case it is the R engine.)
I don't know any specific documentation about integration Rails with R, but some research about general system integration with Rails should give you a good starting point. (However, this would only be needed if you really want to build two independent systems.)

Rails Authentication via Web Service

So, this may be a kind of dumb question, but I checked the Google and got no hits. We want to host multiple Rails apps in a way that makes them look homogeneous. We want all the apps to have the same look and feel, and all the apps to use the same sign-on database.
Theming I think we could accomplish by just putting the site theme into a gem, and requiring that gem from our github repository in each app. However, auth is trickier.
I know that I can achieve this "for free" by just not making the different portions of the site (store, chat forums, etc.) different apps. If they're all, say, Rails Engines, we can basically drop them into the same application with their own namespaced routes, and have a single plugin that does auth.
However, for various reasons we'd like to keep these separate apps, if that's technically possible. The number one reason is scalability; since this will be a hosted site, we want the flexibility to spin up more instances of, say, the store (perhaps to handle a holiday sale rush), without needing to spin up the chat forums. Also, we want to be able to completely isolate the portions of the code that AREN'T intertwined.
Ideally, the databases would be separate too (keeping us from falling back into the rut of "put everything including the kitchen sink in the db"), but I do know that one "cheap" way to do cross-app auth is just to use the same plugin (say, Devise), and just point to the same DB.
So, I'm thinking that maybe the way to do this is to auth via a web service call. Is this prior art -- does anyone have a gem for this that "just works" so that authentication can be shared across all apps? Or am I just entering into a world of pain by trying to build things this way?
Thanks in advance!
You could do a single sign on approach described at:
http://blog.joshsoftware.com/2010/12/16/multiple-applications-with-devise-omniauth-and-single-sign-on/
The single sign on approach with oauth and devise has some drawbacks. The main problem I had was I was unable to extend the timeout time across multiple apps.

The best aproach to translate a page in a web app

I'm developing a web application using Spring, JSF 2 and Primefaces 3. I want the user to be able to choose from different languages. I don't want to use Google Translate. Which is the best approach to translate my website?
Take a look at http://www.coreservlets.com/JSF-Tutorial/jsf2/#Properties
Basically, you create a properties file for each language, like messages.properties, messages_fr.properties, messages_es.properties etc. and the appropriate one is loaded according to the locale.
The user can also select the language herself, take a look at the next tutorials at that site to see how to implement it.
Are you asking how to implement this technically or how to get the content of your site translated?
For the former I trust you can find a guide or five.
For the latter if you don't want to use an automated service like Google Translate then you're going to need humans to do it for you. Unless you have multilingual friends who owe you a favor or, say, a giant, enthusiastic userbase like Facebook or Twitter has, you're not going to get this for free. Your options, basically, are to pay for the services of one of the many, many companies out there that do this, or find multilingual individuals on your own, e.g. by calling local universities' foreign language departments or international student organizations, or posting on Craigslist and the like. As with web development contractors, I think it's safe to assume you get what you pay for.
When you say you don't want to use Google Translate, do you men GT specifically, or any such service? Because if you're not using any translation service, you'll have to maintain versions of each page on your site in different languages. And maintain them.
Come to think of it, you probably have to take this approach as none of the online translation services provide a good enough native translation.
There's probably some commercial machine-translation packages out there, but they don't come cheap, I imagine.
Alternatively, employ an army of translators - there's websites out there where you can hire translators.
You'll probably want to do a search for translation software, then figure out how much it'd cost you.

Resources