Web data visualization/charting library - ruby-on-rails

I'm building a Rails app that needs some data visualization. What is a good library to learn? (If it matters, I don't have much web/javascript experience, but I'm starting to learn.)
I've been dabbling around with Protovis... But, well, I don't understand what all the hype is. It seems quite long and painful even to create just a simple bar chart with axes, and badly in need of defaults! [But the only other real graphics library I've used is ggplot2 in R, so maybe this is standard for the web?]
I've seen gRaphael suggested, and the single piece example code I've seen on the website [for a piechart] makes it look much easier to use than Protovis. But there's no documentation, so I don't know how to learn to use it.
I've played a bit with the Google Charts API in the past, and it's fairly easy to use and well-documented, so maybe I should just stick with that if I don't need anything super fancy and customized?
So, I guess: what are the advantages/disadvantages of Protovis/gRaphael/Google Charts? Are there any other data visualization libraries I should be considering?

Check out Ryan Bates screencast on charts. It is focused on Highcharts, but he also shows other alternatives.
http://railscasts.com/episodes/223-charts
I have only used Google Charts, but I was considering trying some of these after watching this screencast a few months ago. Hopefully this will show you a few more options that may suit you.

You can give Gruff a try. The graphs look nice and the API is quite easy to use.
http://nubyonrails.com/pages/gruff
Hoa

Related

Is Rails much better for interactive website compare to Django?

Just got a new website project for my company internal use. The whole website isn't that complicating but requires quite a lot of real time interaction. Basically, it's an interactive time line table where we can freely drag and drop each elements to move and resize them.
At first I wanted to use this opportunity to learn Python+Django (I'm given a huge amount of time) but then I read around and a lot of people mentioned Rails is better for creating rich interactive website.
So, for a website with a lot of drag & drop interaction like this, is Rails really the better choice? Is Rails built-in ajax that much easier to work with compare to Django+jQuery? How flexible and customizable is Rails' built-in ajax? I want to learn RoR just as much as Python by thee way.
I don't think AJAX functionality will define which framework you find yourself preferring.
I can't answer most of your question relating to ajax, but still think this post could be useful for you: it's highlighting a huge difference between ROR and django -- mainly RoR uses magic, django doesn't.
I prefer django for exactly that. Others may prefer RoR for the same reason I don't.
What's wrong with "magic"?
Rails' developers are of the opinion
that this sort of "magic" is a good
thing because it makes it easier to
quickly get something working, and
doesn't bore you with lots of details
unless you want to reach in and start
overriding things.
Django's developers are of the opinion
that this sort of "magic" is a bad
thing because doesn't really save all
that much time (a few import
statements isn't a big deal in the
grand scheme of things), and has the
effect of hiding what's really going
on, making it harder to work out how
to override stuff, or harder to debug
if something goes wrong.
Both of these are, of course, valid
stances to take, and generally it
seems that people just naturally
gravitate to one or the other; those
who like the "magic" congregate around
Rails or frameworks which try to
emulate it, those who don't congregate
around Django or frameworks which try
to emulate it (and, in a broader
sense, these stances are somewhat
stereotypical of Ruby and Python
developers; Ruby developers tend to
like doing things one way, Python
developers tend to like doing things
another way).
So I think one will click for you regardless of out of the box ajax support.
Speaking as someone who mostly works on Rails, I would say take a day with each framework, follow a "getting started" screencast or tutorial, or pick up a book. ( For rails, I recommend Beginning Rails 3 ). Then, keep going with whichever one you feel more comfortable with.
One amazing resource rails has is Railscasts. Railscasts almost single-handedly converted me from PHP to ROR. I don't know if Django has a similar volume of quality screencasts available or not.
All frameworks are pretty heavily focused on the server-side of the equation. Now, Rails has a lot of things that help make writing views (your drag and drop stuff) nice, such as HAML (a fantastic template language)... and while I don't know enough to post links I'm sure Django has similar helpers. It's worth noting that both Django and Rails can use jQuery or any other javascript framework.
But, in the end, just by the nature of the web as stateless, there's going to be a degree of independence between your client-side templates and javascript, and what's serving that from the server side.
The real question you should probably be focused on is: Do you want to become a jQuery ninja, or do you want to scale up a notch and focus on Javascript itself, perhaps using tool suites like MooTools or Prototype. Your drag and drop stuff is client-side, so that's where your toughest decisions will have to be made.
Good luck!
I used to worry about things like this and would try new frameworks all the time because people would say it was a big improvement over the last one I was using until I realised I wasn't doing anything. Now I just pick one and stick with it. The fact that I know it much better than any others means I am more productive, even though the other frameworks probably include nice little tricks and shortcuts, and because I know it better I can debug problems faster.
Basically what I am trying to say is that just about every popular web framework can do everything that you want it to. Some are better than others but what really matters is that you become an expert in at least one of them. Being able to dabble in lots is not helpful, you really need to know one inside and out. Committing some code to the project helps this process.
Mainly depends on which programming language you prefer to work and most comfortable with. Some prefer the flexible syntax of Ruby others like the cleanliness of Python. Also need to take into consideration the production environment (aka what OS is it going to be hosted on).
Django does not do interactive web applications, it is agnostic to the whole "frontend" part, this is done in Javascript with little to no support from Django (except for transferring data from AJAX calls).
So if you want to use Django for this, you will have not only to learn Python but also to learn loads of Javascript.
I like this solution as hand-written Javascript feels a lot clearer than any of these generating tools to me, plus there are plenty of libraries that make writing advanced Javascript GUIs a breeze these days, check out Jquery UI or ExtJS.
From there, the server side will only be AJAX calls that (de)serialize data in JSON, nothing else.
Both Rails and Django are good. Try them both out and see which you like better.

introduction to latex

what's a good website that has an introduction to latex for window users? I will be using it mainly to write math homework problems and probably then converting it to a PDF to print out. I'm hoping somebody has bookmarked a good link already so I don't have to search. Thanks!
You should start from this "not so short introduction to latex"
http://www.ctan.org/tex-archive/info/lshort/english/lshort.pdf
I recommend this one: http://en.wikibooks.org/wiki/LaTeX
LaTeX works the same across platforms (and even across its distros, except some may provide features that others don't), so it doesn't really matter what your platform is.
I find that Andy Roberts's site is perfect for beginners, it has a lot of newbie exercises and takes you by the hand in a perfectly controlled fashion. It is my online reference for my basic latex questions.
http://www.andy-roberts.net/misc/latex/index.html
The LaTeX Community site doesn't seem to have any beginner tutorials, but it does have a number of articles that go into specific uses. If one of those articles covers what you're trying to do, then it may give you a headstart.
Outside tutorials, as a beginner getting into LaTeX, I found the TeXnicCenter Open Source IDE to be very useful. It makes life a lot easier when you get some syntax colouring and templates to help with common structures like tables.

Best technology option for implementing RIA with Rails as the backend?

I'm working on a application that requires a feature-rich media view, including images, videos, and smooth sequencing based on capture time. The backend is currently written in Rails.
What's currently the best, most mature option for implementing RIAs with Rails on the backend? I've looked at Flex, Laszlo, and ExtJS. ExtJS is interesting to me because I'm really not a fan of pure Flash UIs, but it seems highly targeted towards business apps, not entertainment applications like this.
Any suggestions or insights from others doing similar efforts will be very much appreciated.
Thanks!
I second zdmytriv for that book Flexible Rails, it's awesome. It's fairly outdated now though but lays out how simple it is to create a solid Project Management application with Flex and Rails. Everything in there has now become "RestfulX".
Check out RestfulX, it's a must. The RestfulX Google Group is very active too and they've made a lot easy.
We built this website in Flex with RestfulX and it was very easy. That application uses the Rails Paperclip gem to do image processing in a Flex admin panel like ScrapBlog (Scrapblog was built in Flex), and we could use some cool layout effects built into Flex 4. RestfulX made that pretty easy, and the gems made it even easier :p. They have generators too like Rails so it's real easy to get up and running with a DataGrid/CMS-like interface in 5 minutes.
I don't know anything about the other things you've mentioned, but I do know that it's pretty fun and easy to integrate Flex with Rails now-a-days.
As a side note, you can do hardcore SEO with Flex and Rails too, thanks to SWFAddress. We're doing that with that site above.
Cheers
I can recommend Flex and also this book Flexible Rails, whole book dedicated Flex with Rail cooperation. List of sample applications from the book here
Flexible Rails http://ecx.images-amazon.com/images/I/51QysfVDlVL._SL500_AA240_.jpg
If you're serious about considering Ext as an option, you should really search and maybe post in their forums about others using Rails, I know there are quite a few doing so successfully. I just ran across this example that seems like a pretty fully-baked app doing just that, so it's definitely possible.
Without knowing exactly what you're trying to do, I think that saying Ext is "targeted towards business apps" is a fair general statement, in terms of the widgets that come with it out of the box. It's highly geared toward window/form-based Ajax apps. That said, Ext Core is very similar to jQuery and other core frameworks, and everything in Ext is built to be highly extensible (hence, "ext"). In terms of being able to build what you need off of it, it is very powerful and flexible. You can certainly implement a flash viewer easily, and there are existing plugins that will do exactly that.
Sounds like Toby had a bad experience with Ext, but many other people enjoy it and find it very natural to code in. The syntax definitely has a Java/C# flavor to it in some ways (although it's really hard to directly compare any JS framework to a static language), and it has roots in YUI (which is even more verbose). For someone coming from C-ish backgrounds, it will likely feel very comfortable. If you're more used to Python or Ruby or something else, then it might not be as enjoyable, I don't know. Something you'd have to try for yourself.
Take a look at WebOrb from themidnightcoders.com. Among many features, it allows for AMF protocol for serialization of data. It is smoking fast.
IMO, if you want a true RIA experience, you'll need to focus on either Flex or Silverlight. There are pros and cons to each.
I did a GWT project a while back and am working with Ext right now. I have some C# / Swing GUI experience, none in Flash.
I like Ext a lot. It looks great, and I found the programming model close enough to the C#'s and Swings of the world as to be familiar and fairly pleasant. The documentation is not excellent, but definitely good enough. For Java at least, there is a solid remoting mechanism (third party, called DJN... most likely there are others, too). A couple of minor bugs here and there.
The major negative is support. They have a forum but there are a distressingly large number of questions and problems that go unresolved. They have paid support in theory, but were sufficiently unresponsive to basic 'how does your paid support work' type questions that I was not encouraged to buy any. There is only one book that I know of, it looks promising but it is not out yet.
I found GWT impressive and had no real problems, but at the end of of the day I am much happier with Ext.
Have you taken a look at Google Web Toolkit yet? In my opinion it's a great way to build rich and performant web applications. The toolkit is quite mature (Google Wave is build with it) and has a lot of good tools to make development easy.
Here's a previous Stakoverflow post.
I don't know about best, but I did a project using ExtJS and hated every minute of it. Frustratingly verbose code, overly complicated programming model, confusing documentation, and difficult to make it do anything it didn't want to.
That said, it looks very awesome, has incredibly powerful widgets and the client and users loved it.
I haven't helped at all, have I?
I think if you requirements include doing anything with video and audio, you are going to need a Flash solution.
Take a look at netzke -- client-server components with Sencha Ext JS and Ruby on Rails.
Netzke is a framework that allows for a beautiful blend of client- and
server-side code (JavaScript and Ruby, respectively) into ready-to-use
GUI components. It's most useful for creating complex data-rich
backend applications with Ruby on Rails on the back end, and Sencha
Ext JS in the browser.

Should I create a blog in rails or use something that already exists?

In my next rails project I'm going to need blogging functionality. I'm wondering whether anyone has any good suggestions, or should I just roll my own? (Probably not in 15 minutes)
I think the most important feature will be to display code samples elegantly.
How's your free time?
Five years, that's how long that little idea took. Plus 2 years of adding bells and whistles. And that, folks, is why I'm giving in and using a blog host. Because I have lots of ideas, lots of things to say and to explore, but only a few dozen years left at best. I can't afford to go chasing every 5-year idea that springs to mind. After due consideration of the crap web frameworks and crap blog packages out there, I decided that I don't want to spend my next 5 years implementing my vision for a decent self-publishing system. Someone else can do it.
http://steve-yegge.blogspot.com/2006/03/blog-or-get-off-pot.html
It's a classic build-versus-buy (or, in this case, download for free) decision isn't it?
Write up the feature set of what you are looking for.
Survey the offerings out there to see how close a fit you have.
For the one or two products that is the closest fit, evaluate whether or not it would be less effort to write your own solution or customize the offering to do what you need.
If all you need is a blog site, then this is a no-brainer. Use WordPress and that's it.
If there are other features for this app and blogging is just one of them, then consider writing an app around WordPress. It is just a PHP application using MySql after all.
If WordPress has features or does things that you don't want, then maybe you do need to roll your own.
If the most important feature for this site is that it is to be written in RoR, then roll your own or find a RoR based blogging app as WordPress is not written in RoR. I haven't really done the homework on this but I would imagine that getting PHP and RoR to share session state would be a time consuming hack.
Rolling your own blog is a great project (and quite fun too!), but for practical usage, using something pre-made is going to be more secure, have more cool features, etc. etc. Unless you're incredibly dedicated, you'll probably end up cutting corners and end up with something that isn't quite what you want.
Despite being a Rails guy myself, I'm a huge fan of Wordpress. If you're looking for Rails-based blog engines, I've had luck with Mephisto, although the documentation leaves something to be desired. Radiant CMS is another CMS/Blog system that might be worth looking at.
A lot of Ruby/Rails developers have actually gone the route of using static website/blog generators. This has a few advantages. First, the pages are static HTML with no dependency on a database. This means they can be served by your front-end Web server (Apache, Nginx, etc.) faster than if they were to go through Mongrel, Thin or Phusion Passenger. Secondly, the pages will be easier for search engines to index. Finally, and probably most importantly, you can easily version control your posts using Git (or your favorite SCM)
I switched my blog over to a static model after development on Mephisto seemed to stall. I am using Tom Preston-Werner's Jekyll and Disqus for the comments. Works great. Give it a try!
If you are just looking for a project, then building your own blog engine is a good start.
Personally, though I have been a full-time Rails developer for the past 3 years, I still use and recommend Wordpress for myself and others.
If the project is to write a blog, don't roll your own. There are plenty solutions out there that will solve this problem for you while you worry about pumping out great content.
You will end up spending to much time futzing with the little things that don't really matter.
Probably there are tons of those.
For example, Rastafari, or Enkiblog.
In my next rails project I'm going to
need blogging functionality. I'm
wondering whether anyone has any good
suggestions, or should I just role my
own? (Probably not in 15 minutes)
I wouldn't recommend rolling your own blog system. You should look into using Radiant CMS with a blog extension.
I think the most important feature will be to display code samples elegantly.
For this I can recommend looking into SyntaxHighlighter.
All depends on your goal:
If it is for learning purposes and it's for fun, code it from scratch. Also, try to add new functionality that you will not find in current blogging platforms. For example, make in a way that is easy for a developer to blog tutorials or screencasts.
If it's for a client or just to blog, use wordpress. You can have your site in ruby and then link to wordpress. Think about it, how many human hours are behind wordpress so for you to match that you will need to work full time on it for 8 years.
Wordpress will work out of the box and then periodically you can tweak it, depending on future needs.
I agree, for fun and learning, code from scratch. But consider coding something people really need and don't already have. Innovate.
There are so many excellent blog platforms out there, and some (like Wordpress) have active developer communities writing hundreds of useful and powerful plugins. And that includes some excellent support for code samples.
No need to reinvent the wheel.

How to approach learning a new SDK/API/library?

Let's say that you have to implement some functionality that is not trivial (it will take at least 1 work week). You have a SDK/API/library that contains (numerous) code samples demonstrating the usage of the part of the SDK for implementing that functionality.
How do you approach learning all the samples, extract the necessary information, techniques, etc. in order to use them to implement the 'real thing'. The key questions are:
Do you use some tool for diagramming of the control flow, the interactions between the functions from the SDK, and the sample itself? Which kind of diagrams do you find useful? (I was thinking that the UML sequence diagram can be quite useful together with the debugger in this case).
How do you keep the relevant and often interrelated information about SDK/API function calls, the general structure and calls order in the sample programs that have to be used as a reference - mind maps, some plain text notes, added comments in the samples code, some refactoring of the sample code to suit your personal coding style in order to make the learning easier?
Personally I use the prototyping approach. Keep development to manageable iterations. In the beginning, those iterations are really small. As part of this, don't be afraid to throw code away and start again (everytime I say that somewhere a project manager has a heart attack).
If your particular task can't easily or reasonably be divided into really small starting tasks then start with some substitute until you get going.
You want to keep it as simple as you can (the proverbial "Hello world") just to familiarize yourself with building, deploying, debugging, what error messages look like, the simple things that can and do go wrong in the beginning, etc.
I don't go as far as using a diagramming tool sorry (I barely see the point in that for my job).
As soon as you start trying things you'll get the hang of it, even if in the beginning you have no idea of what's going on and why what you're doing works (or doesn't).
I usually compile and modify the examples, making them fit something that I need to do myself. I tend to do this while using and annotating the corresponding documents. Being a bit old school, the tool I usually use for diagramming is a pencil, or for the really complex stuff two or more colored pens.
I am by no means a seasoned programmer. In fact, I am learning C++ and I've been studying the language primarily from books. When I try to stray from the books (which happens a lot because I want to start contributing to programs like LibreOffice), for example, I find myself being lost. Furthermore, when I'm using functionality of the library, my implementations are wrong because I don't really understand how the library was created and/or why things need to be done that way. When I look at sample source code, I see how something is done, but I don't understand why it's done that way which leads to poor design of my programs. And as a result, I'm constantly guessing at how to do something and dealing with errors as I encounter them. Very unproductive and frustrating.
Going back to my book comment, two books which I have ready from cover to cover more than once are Ivor Horton's Beginning Visual C++ 2010 and Starting Out with C++: Early Objects (7th Edition). What I really loved about Ivor Horton's book is that it contained thorough explanation of why something needs to be done a certain way. For example, before any Windows programming began, lots of explanation about how Windows works was given first. Understanding how and why things work a certain way really helps in how I develop software.
So to contribute my two pennies towards answering your question. I think the best approach is to pick up well written books and sit down and begin learning about that library, API, SDK, whatever in a structured approach that offers real-world examples along with explanations as to how and why things are implemented as they are.
I don't know if I totally missed your question, but I don't think I did.
Cheers!
This was my first post on this site. Don't rip me too hard. (:

Resources