April 7th, 2010
Just discovered this pretty nifty gem that works very much like pretty_print but is awsomer. It works right out of the box as a gem in your rails console and is very handy while checking on objects.
Here is what it simply does:
$ ruby script/console
Loading development environment (Rails 2.3.4)
>> require 'ap'
=> []
>> ap User.first
#<User:0x10498f648> {
:id => 1,
:first_name => "Tinu",
:last_name => "Cleatus",
:address => "123 ABC Rd",
:city => "Cochin",
:state => "Kerala",
:zip_code => "123456",
:country => "India"
}
=> nil
Basically pretty prints the object in a very clean way with pretty colors (in the Terminal).
Moreover, it supports a lot of other custom options. Head over to the GitHub page for more info.
Tags: github, nifty-gem, ruby
Posted in Programming | No Comments »
March 29th, 2010
The first ever Ruby conference in India happened last weekend in Bangalore and I’m glad to have attended it. It would have been a big loss if I had not. There were a few good speakers who gave some very interesting talks and I think the whole crowd was amusing too. Every time a session ended, there were many sensible discussions that happened between the audience and the speaker. Me and my friends reached Bangalore early morning on the day of the conf and we reached very late, apparently we missed the first talk by Ola Bini. So, my day one of the conference started with Obie’s “Blood, Sweat and Rails 2010″ session. It was quite knowledgeable how Hashrocket as a company works. Some pretty good tips there on entrepreneurship and how better startups can work using the right tools.
Next notable session was Rails vs. Django by Shreyank Gupta, pretty interesting stuff he discussed there on what and how different Django is from Rails. I’ve been eager to know about Django since I started on Rails and this quite gave me a hint. Interestingly, the final word from Shreyank was “Rails is better”. *happy me* *crowd applauses*
We then hurried to the next hall where Matz was about to start his video conf call. As opposed to my expectations, this session turned out to be very fun and amusing. Matz spoke about the future of Ruby mainly and he also announced that Ruby 1.9.2 will be released in August and the community will start working on 2.0 after that.
Another interesting session was about the Rhodes mobile app development framework. This was something I was looking forward to. The talk was interesting but I was disappointed that using this framework does not really produce a really “native” iPhone app. It is more like a web app that works locally on the phone and uses sqlite to store data locally. We could then use libraries like jQTouch to make it feel native. I’m yet to give this a real try though.
Overall, RubyConf was a great success, enjoyed every minute and was great pleasure meeting a few great Rubyists and some fellow developers. I think there were a lot of developers who mostly did not work with Rails but worked with Ruby in some way, which is amazing. I see great future for Ruby in India, and look forward to more similar conferences in and around.
Here’s what people still talk about the conf.
Tags: rails, ruby, rubyconfindia
Posted in Programming, Web Development | No Comments »
February 22nd, 2010
Recently while working on a client project, we had a requirement to enhance the existing fraud detection techniques already in place on the application. That is when, I came across Maxmind’s minFraud service which is basically a service for online fraud detection along with their already famous GeoIP service.
Merchants can use the minFraud service to speed up manual order verification, automate order process by using our risk scores, or develop their own customized scoring system with the information that we provide.
minFraud is a centrally hosted service where all business solutions networked with it connect to it, and the feedback and results received is apparently shared within the network. It uses Maxmind’s GeoIP service to find the user’s location through IP, and hence it helps in a great way to detect fraud. The best part is that it has a simple API where you send the customer’s details (only the non-confidential part) and you receive back a ‘risk score’ which is based out of 100. This risk score depends on various factors how minFraud detects the transaction as fraudulent. You could work up on a strategy so that if the risk score goes up a threshold, the transaction could be put on hold and manually verified.
Trying to find more about minFraud, I luckily came across this ruby gem called maxmind which was exactly what I needed. Only little problem was that it was written to work with HTTParty. HTTParty while being a good alternative over Net::HTTP, I wanted something simpler and similar to what we already have in the existing project. Thanks to Github, forking and making changes to the existing gem was a breeze. I also added a attributes method so if you need all the attributes of the response object for convenience.
So, if you are looking to enhance fraud detection on the transactions on your ruby app, checkout minFraud, and have a look at the original gem if you like to Httparty, or if you need a simple solution with NetHttp, have a look at my forked gem.
To install
gem install hackedunit-maxmind --source=http://rubygems.org
Rubygems URL
Ta.
Tags: maxmind, minfraud, ruby
Posted in Web Development | No Comments »
January 23rd, 2010
A while back Friendfeed posted a blog post explaining how they changed from storing data in MySQL columns to serializing data and just storing it inside TEXT/BLOB columns. It seems that since then, the technique has gotten more popular with Ruby gems now around to do this for you automatically.
So when is it a good idea to use this technique?
If the application really is schema-less and has a lot of optional parameters that do not appear in every record, serializing the …
Continue reading at MySQL Performance Blog.
(Via The Ruby Reflector)
Tags: mysql, ruby, serialize
Posted in Programming, Web Development | No Comments »
January 17th, 2010
If anyone of you is using Dropzone app, I’ve made a small script to post images to the fun blogging platform – Tumblr. If you haven’t used Dropzone, it is a very useful mac app that lets you easily drag and drop files to perform customizable actions on them. For example, to upload the file to remote destinations, like your own FTP servers, Flickr, Posterous, Twitpic to name a few. But it is not just limited to file uploads, other uses include zipping and emailing the files you drop on it, install mac apps easily, share code on Github Gist or Pastie etc. Smoking Apples has a good review on the app.
I mainly use it to quickly share screenshots I take while on work, and also to quickly share a file with someone else on my FTP server.
The very good point with Dropzone is that the developers have made it very easy to extend the app with its API. If you are fine doing away with Ruby, then you can build your own destination scripts. I’ve just tried my hand on it, with a simple script that uploads the dropped image to Tumblr. I tried both the Net::HTTP method and also using Curl. However, using Curl seems to be quite faster.
The code is at my fork of Aptonic’s user contributed scripts at Github.
I believe that this app has got great potential and hope to see more extended scripts in the future and also will try creating my own if I get the time.
Tags: Mac, ruby, tumblr
Posted in Mac, Programming | No Comments »