Looking at our data trends for VIN API, we show about 15% of all requests are for the complete data set. It's the same price as the basic data set and rich with a ton of data.
Check out the data set from this post over 1 and half years ago. On top of the basic data set's year, make and model, the complete data set comes with data like MSRP, MPG (city and highway), dealer invoice, gas tank size, etc.
We get tons of hits for basic data, but at no additional charge we also provide the complete data set. Just add a complete
=> "true" to your request. So simple and there's no performance hit.
For more information, check out or examples and faq.
Enjoy!
Here's another look at the data elements from a comprehensive query:
Did you install the Android SDK / JDK, etc? If not, start here - http://developer.android.com/sdk/index.html.
If you're running 64-bit like me, make sure to install the ia32-libs, since the SDK is 32-bit.
This is completely based on the Hello Android tutorial - I didn't really do a whole lot, but the hope is that this will help get some more ruby devs into android development with a simple how-to.
Step 1 - Setup RVM with jruby
Note: RVM is awesome, if you don't use it or don't know about it - read more here.
rvm install jruby
cd /path/to/your/android/pindah/mirah/project/dir/
# using your .rvmrc will trigger `rvm use jruby` when you cd into your project dir.
echo "rvm use jruby" > .rvmrc
# this will make sure your .rvmrc is working, you should then be able
# to use rvm info and see jruby
cd .
Step 2 - Install the mirah and pindah gems
# too easy
gem install mirah pindah
Step 3 - Create your first pindah app
pindah create com.example.android.hello_world
cd hello_world
Step 4 - Create your activity - HelloAndroid.mirah
# from your project dir and inside your pindah app dir
<editor> src/com/example/android/hello_world/HelloWorld.mirah
This is the code I used:
Step 5 - Setup your AndroidManifest.xml file
This is where you define your app, version, name, etc, but more importantly for this example - what activity will handle your main intent.
Mine looks like this:
Step 6 - Install to your device
# make sure a device is recognized ...
# and make sure adb is in your path (platform-tools in the SDK)
adb devices
rake install
It can't be a shock to any of you that after many months (wait - more like a full year) of running VIN API completely free and out-of-pocket, it is time to monetize. As I am sure most of you know, the back-end data is quite pricey. For example, a monthly subscription for a "lite" data set (your typical year, make, model, engine type, etc) at one of the better known distributors would run you about $260.00 a month for ~800 VIN decodings. This is some very expensive data at 32.5 cents a VIN. Some of you that use our API are running 50,000+ VINs through in a weekend, that is $16,000! Wow!
Ok, so what did we decide to do? Well first, and most importantly, we decided to keep the service up and running; for a while there it was looking pretty bleak and if you take a second to look at the numbers (financially) you can understand why. Anyway, to be as fair as possible, we did not feel this could be monetized as a subscription-based product, some months you need 500,000 VINs and some only a 1,000. Looking at the data for year, we had many questions - what plan would you pick? should the plan rollover it's unused decodings?
We discovered a lot of complexity in the subscription model, so we decided to setup the pay as you go plan, where you buy your decodings at various bulk levels. For instance, you could buy in groups of 1,000 or 10,000 or 100,000 such that you would realize savings on a price-per-VIN basis the larger the group you purchase. There is no use policy either, so you can sit on the VINs for as long as you want, or you can even buy decodings the day (even the minute) before you need them. No monthly credit card bill, no rollovers, just simple "buy what you need," and if you buy in bulk, you save.
Another consideration in doing this was having to maintain soft limits. For example, if the user purchases the 5,000 VINs per month plan, and the their site does well this month and they need 6000 VINs, should they have chosen the 10,000 VIN plan? We didn't think so, we figured no hard limit, just soft limits, and after the soft limit is hit, we would charge the additional VINs at the current rate per VIN to the user's next month's bill. We tried to explain this to a few current users that are helping us come up with reasonable rates and they were not all that thrilled about it. So we had a problem, we did not want users to pay for what they did not need, but at the same time we did not want to cut users off in the middle of a month when they hit their limit. That entire idea had to be scrapped and along with it went the idea behind the subscription plan itself. We like it though, it's simple now - buy your decodings and use your decodings, we will email you if you are getting low and may want to add decodings to your account.
Subscription models are great for static resources and static services, but not a single one of our customers decodes the same number of VINs each month, so it just won't work. So onward and upward, pay as you go and regardless of how the other API providers offer their service, we are excited to be a little different and lot cheaper as you will soon find out.
A few of our VIN API customers have been kind enough to take our Ruby and curl examples and come up with .NET and PHP implementations.
Here is a VB .NET example:
And for PHP, you have this:
Hope this helps and if you have examples for other programming languages, please let us know.
I've been working with Cairo the last day or two to build a sign generator. I chose Cairo because it seemed like a good fit for building a sign that had to be loss-less in detail and scalable, this rang vector graphics. I found a few good examples here and there, but they were very few and the documentation was not exactly ruby-friendly.
So I'm going to do a few posts about what I learned and I am going to start with the very basics, since all I could find were completed and elaborate images, way too complicated for a beginner.
Let's start with rotating a square box by 45 degrees. Very simple.
Just a quick note about the Open Flash Chart II plugin for Rails and Rails 3. Rails 3 did a 180 with regards to ERB tags and security. Everything is now considered unsafe HTML. So where we used to be able to do <%= @graph %>, we have to now do <%= @graph.html_safe %>.
Update: Bloggity does not require the Engines plugin to run if you are using Rails 2.3 or above (where the Engines plugin is baked in). -- Noted below by Bill.
Update: Added the plugin to github - simple_blog. It is not production ready or really all that usable quite yet.
Ok, so this a rant and I am sorry for that - but as simple as it is, I have been looking for a blog plugin lately. The problem with the plugins I find is that I don't want to have to deal with the engines plugin or have the controllers, models, views, etc ... all extracted into my applications code. I want it all external (hence a plugin) but let it be minimally configurable.
So in my recent search for a blog plugin for rails, I came across two that look very useful, but each with their flaws:
1) bloget - Everything is extracted to my code space. Why? Yes, I realize that it is most likely because I will want to override things, but get out of my space and keep to yourself! 🙂
Provide me a way to override things that I would need to (there really shouldn't be too many), after all it is ruby.
2) bloggity - Uses the engines plugin! I have nothing against the engines plugin (I think it is well written and documented) but for a freaking blog plugin?!? Why?
Is there a third option?
Glad you asked - yes, there is a third option - I hate to say it, but do it right! There's your third option.
Ok, but really, if there is a third option (a third plugin), I would love to hear about it.
Ok, so all that to lead up to a little plugin tutorial? Well, it got your attention didn't it?
Starting from scratch
Ok, I guess I will start from scratch. So let's get started.
Models, Views, Controllers and Helpers - Living as one in my plugin
Models
Ok, so we have a clear path for where our models, controllers, views, and helpers should live, right?
For simplicity, let's just have a post and comment model - you have all seen this a billion times.
And there you have it.
So what do you do to tell your rails application about your models?
Simple - inside vendor/plugins/simple_blog/init.rb - add these lines
That's probably good enough. We have a working model and relationships. The best part is that all the code is still in the plugin.
What does my code space contain?
<h1>Posts</h1><% @posts.each do |post| -%> <h2><%= h post.subject %></h2> <%= post.body %> <h3>Comments</h3> <% post.comments.each do |comment| -%> <b>by <%= comment.username %></b><br/> <%= comment.body %><br/> <br/> <% end -%><% end -%>
Append your view paths:
If you don't do this next step, you will very likely see an error message like this:
Missing template posts/index.erb in view path /home/pullmonkey/rails_projects/simple_blog/app/views:
So let's add it.
There are at least two ways to do this. 1) Added to your controllers individually or 2) Add to application controller globally.
I prefer the less obtrusive, so let's go with number 1.
For this test, we will just work with the posts controller, so open it up again and add this line:
Start your web server - ./script/server
Browse to http://localhost:3000/posts
You should see the post we created up above via Post.create(...) and its associated comment that we also created above.
Note:Feel free to overwrite any of the views. This can be done simply for the posts index view by creating the same file under RAILS_ROOT/app/views/posts/index.html.erb and doing what you'd like.
That's it for part 1
Ok, so that's part 1. The goal was to keep everything external and I think we succeeded (aside from migrations).
No offense to those that use engines or extract files into one's application's space, we all have our ways - the above is what I prefer.
Part 2 will consist mainly of filling this out a bit more and further discussion on adding helpers, routes and migrations to your plugin without interfering in the application's code space.
And here is the code (the controller): NOTE: You will need the latest plugin and open-flash-chart.swf (as of this article) for the tooltips to register properly.
classTestItController < ApplicationControllerdefindex@graph = open_flash_chart_object(600,300,"/test_it/graph_code")enddefgraph_code# we will have bars for each student subject combo bars = []# random colors to chose from colours = ["#459a89", "#9a89f9"]# the results results = Result.find(:all)# group by subject and use subject as the key results.group_by(&:subject).each do |subject, result|# 3d bar graph, could be any bar graph though bar = Bar3d.new bar.set_key(subject, 3) bar.colour = colours[bars.size] bar.values = result.map(&:test_score) bars << barend# some title title = Title.new("Test Results")# labels along the x axis, just hard code for now, but you would want to dynamically do this x_axis = XAxis.new x_axis.labels = ["Jack", "Jill"]# go to 100% since we are dealing with test results y_axis = YAxis.new y_axis.set_range(0, 100, 10)# setup the graph graph = OpenFlashChart.new graph.bg_colour = '#ffffcc' graph.title = title graph.x_axis = x_axis graph.y_axis = y_axis graph.elements = bars render :text => graph.to_sendend
Create a view, mine is index.html.erb for the test_it controller: