Posts
Generating and Streaming Potentially Large CSV files using Ruby on Rails
Most applications I’ve worked on at some point required that ‘Export’ feature so people would be able to play with the data using the familiar Excel interface. I’m sharing some code here from a recent work that did the following:
Generate a CSV file for download with up to 100,000 rows in it. Since the contents of the file depends on some dynamic parameters, and the underlying data is changing all the time, the file must be generated live.
Posts
Simplicity and Client-Side MVC
After spending about 6 months on this new project using BackboneJS, and spending some hours learning AngularJS and EmberJS, my realization at this point is:
Use Client-Side MVC very Selectively.
Sometimes on a single page of your app, you need to offer a lot of interactions, each scoped to a small part of the page only. In such cases Client-Side MVC offers some neat features. I’ll try to share my perspective with some concrete examples where I’d say yes/no to Client-Side MVC.
Posts
MicroOptimization Trap
Yesterday, couple of my friends and I were discussing about a CoffeeScript topic. In short, given the following code in CoffeeScript:
class Cat type: -> 'cat' meow: -> 'meow meow mee..ow' The compiler produces this in JavaScript:
var Cat; Cat = (function() { function Cat() {} Cat.prototype.type = function() { return 'cat'; }; Cat.prototype.meow = function() { return 'meow meow mee..ow'; }; return Cat; })(); As you see here, the prototype method definitions use the prefix Cat.
Posts
Unconventional Conventions
JavaScript has been reborn, thanks to jQuery to begin this epic and wonderful march. These days, we have a huge influx of micro to macro frameworks, all providing some well curated set of features. Every now and then I try to get a glimpse of the new and hot stuff so when time comes, I can make an informed decision on what to use and why.
This post is about my recent attempt at learning AngularJS and EmberJS.
Posts
Call me Sohan and Ask-Me-Not about S M
I have heard this question n times, where n tends to the number of days since June 2006, as I started working with the people from North America:
Should I call you S M?
Well, I’m from Bangladesh and even today, we don’t really have a first and last name, instead what we have is, a full name and a nick name. My full name is, S M Sohan, and my nick name is Sohan.
Posts
Implementation Challenges with a Multi-Tenant/SaaS Database
{% img right http://farm1.staticflickr.com/21/26445881_7c69777b7b.jpg 500 353 ‘Photo credits to corydalus’ ‘climbing’%}
This 2006 MSDN article points out some key aspects of designing a multi-tenant database for SaaS applications. As you can read in the article, SaaS databases need to pick one of the following three configurations:
separate databases shared database, separate schema and shared database, shared schema. A number of factors including economic, security, skillset, etc. contribute to the selection of the best suitable configuration.
Posts
Interesting User Interaction Data on Dashboard Widgets
At SourceFire, among other things, we build a cloud based Advanced Malware Protection software. As security products go, we collect a huge amount of data about events that happen on the user devices so we can identify and potentially quarantine malicuous events. Security in itself is a big specialized domain, but this post is about a dashboard that we serve as the main point of entry into the big data that we collect from enterprises and consumers.
Posts
MvcMailer and Open Source Happiness
MvcMailer makes me happy as a developer.
I find an immense amount of happiness everytime I check the Nuget page of MvcMailer. It’s so refreshing to see the download count going up (42,427 total downloads as I write), receiving feedback, praises and even the complains.
The idea of MvcMailer came from trying to bring some of the amazing Ruby on Rails ActionMailer features to ASP.NET MVC developers. It was well accepted since the very beginning and I hope is still helping people.
Posts
Solution Architecting Using Queues?
When building a bunch of applications that need to interact with each other, Queues or Message Oriented Middleware services offer some very useful features. To name a few, you get features like a) Guaranteed message delivery, b) routing, c) throttling, etc., for free. Tools like ActiveMQ, RabbitMQ, MSMQ, JMS servers are tuned and time tested to handle such requirements robustly. I’ve had good experience with these tools for the happy paths.
Posts
Random Data in Tests
… are evil if you expect the randomizer to give you unique values on each call.
Here’s an example:
before(:each) do @user_1 = User.create!(email: "email-#{Random.rand(1000)}@example.com") # the following will fail intermittently if you have a unique validation on User#email @user_2 = User.create!(email: "email-#{Random.rand(1000)}@example.com") end It’s a timebomb, use it, it will haunt you later. Be sane, stop using random numbers in tests like this.