ChoiceBeat

Feb 14

Many Functional programming give you parallelism for FREE, How ?

Let’s try and understand why we should care more about this in the first place. This requires a little bit of historical explanation.

We all know Moore’s Law. It says the number of transistors on integrated circuits doubles approximately every two years. The prediction has been working pretty well since late ‘70. Couple of things started changing from the middle of last decade (around 2005).

First part will help us understand our current topic of discussion and the second point will lead to another interesting discussion, about the rising trajectory of NoSQL landscape and what was the problem with traditional RDBMS ? Will discuss the second part later.

…Unable to increase the clock speed, companies like Intel started adding multi core processors in the same machine. And we got Dual Core, Quad Code … machines. Now the current existing languages, like C, C++, java are designed to use threads to handle concurrency. Now parallelism is different from concurrency. Simply put, concurrency is how we handle multiple request-response and Parallelism is sharing a large CPU intensive work with multiple processors. That’s a different problem, that, even with the threaded model, it’s difficult to write thread safe code that works over time. Livelocks, deadlocks become part of daily affair in maintaining a large application written with threaded code. This is one of the reasons I like Node.js so much; Concurrency is handled by event loop and you don’t have to worry about Locking and synchronization.

Mutability becomes nightmare when you have to share your mutable code. So, if something do not change and you share it, you do not have to protect it, which means you don’t have to worry about safety, synchronization if you share immutable code. This is one of the great aspects of functional programming. Immutability. This is what make your code run in multiple processors. It’s not free, but it’s trivial to make your code run on multiple core. Generally it’s achieved with immutable collection of Objects in Scala. 

Look at this code in Scala

1.        val list = (1 to 100000).toList

2.        list.map(_ + 42)

To make the operation run in parallel, one must simply invoke the par method on the sequential collection, list. awesome !!

1.        list.par.map(_ + 42)

Another important aspect of FP is functions are first class; they are not second class citizens like in C++ or java. You can treat them as any another variable. Functions are pure, they exhibit idempotent behavior, side-effect free and functions are of higher-order. You can pass a function to a function and you can return a function. Closures are very much derived from this. You take an object and transform it to something else, you don’t change it. Monads !!

Scala harnesses all the power of functional programming and combines it with Object Oriented Programming. It’s a JVM language and fully interoperable with Java libraries.

SPARK is written with Scala and what scala does to your code in multi-core machine, SPARK does the same thing across machines in a cluster. Parallelism !!

Sep 09

[video]

Mar 30

Why Facebook Login ?

Creating another user id and password is a pain and facebook is doing a wonderful job in providing a robust authentication and authorization system. May be we should have also provided other open id, gmail, twitter etc, which we’ll plan to do in future.

If you can cast your preference without login, the system will lose the credibility and the purpose will be lost. Hence a login is required.

N.B.: ChoiceBeat does not post anything to your facebook and will never post without your permission. stop. ChoiceBeat does not store your facebook password and will never store. stop.

Mar 23

Usecases of ChoiceBeat

Why should we use ChoiceBeat ?

ChoiceBeat is about honestly expressing, what you feel while making a choice, without having to justify this..

This is certainly not a survey which are typically boring, non-spontaneous and you have to spend a lot of time and energy to participate in such surveys.

Well, there can be many reasons for using ChoiceBeat…

While discovering the like preferences, if you find something worthwhile, please feel free to post it as a blog or write it as a comment. We are committed to make this better. Your feedback is invaluable to us.

Mar 22

                                                        Our Choices
Most of our actions, if not all, are preceded by a series of choices we make consciously, or, subconsciously. We are known by the actions we take and our actions are the results of choices we make. ChoiceBeat is all about making choices and … (find out)

                                                        Our Choices

Most of our actions, if not all, are preceded by a series of choices we make consciously, or, subconsciously. We are known by the actions we take and our actions are the results of choices we make. ChoiceBeat is all about making choices and … (find out)

Credit where the credit is due

Development with Node.js can be fun and who better can vouch for this than us. We built ChoiceBeat entirely with Node.js and we loved it. Node.js can be an awesome framework for any lean startups where 2-3 people do everything. Starting from conceptualization to implementation requires lot of effort and the ecosystem around open source software can really extend you a helping hand.

First of all thanks to Ryan Dahl for creating awesome node.js framework. The framework is getting matured and robust in every passing day. About javascript, someone mentioned, “Brick is becoming the wall”. This is so true. Thanks to Joyent and all contributors for making this framework rugged. There are many modules in Node.js that are simply extraordinary. Some of them that I used, worth a mention and I take this opportunity to extend my gratitude towards the creators. express, socket.io, jade, async, mongoose, redis, cluster, log4js and many more. I just loved using them. thank you guys. You all did a fantastic job. Pedro Teixeira of nodetut also presented some excellent tutorial. I used to refer them quite frequently.

Next, big thank you goes to MONGO and REDIS. There are a lot of buzz around MongoDb these days and trust me, if your application needs to use a NoSql, schemaless, hash-map, document oriented, distributed data store, you can not ignore Mongo. One big feature that I am expecting from them is full text search capability.

If your requirement is to have a data-structure in the database, REDIS should be your default choice. Their pub-sub capability is awesome. It’s a wonderful infrastructure to have in your system if you want to talk to the outside systems also apart from the regular pub sub usefulness. No doubt why VMWare acquired them. The great performance in Redis and Mongo come with the cost of a RAM. Both of them are RAM hungry.

I could not have done the UI without some of the JQuery plugins that I am using. Thanks to all of them, especially highcharts, as I had to remove their credit from being appearing in the site.

As usual, I am a big fan of the technology facebook is using. More than half a billion people using the infrastructure everyday and look at the performance. Isn’t it extra ordinary ? Anyway, my big thanks to them for I am using the authentication and authorization from facebook. I am also using many awesome plugins from them. Thanks a lot for developing these plugins. It makes life so easy.

Big thanks to twitter, their performance is also great. I am also using sharethis. Thanks to them. I am not very sure about how many people actually use them. Same is the case with the contactme plugin. Thanks to all.

We are thankful to Microsoft Bing and Yahoo’s Flickr, YQL, for we are using their APIs to source the images.

Finally big thanks to Tumblr for giving me an infrastructure to write my static pages so smoothly. i am yet to figure out how visitors can comment.

Guys wish me luck so that I can add many more features in ChoiceBeat with your help. Thanks a lot for making them available as open source and for free and that too probably with a better performance and scalability that most paid systems can not afford. Credit for building ChoiceBeat goes to you all.

Mar 19

How to create a new comparison in ChoiceBeat ?

Creating a new comparison of your choice is very easy in ChoiceBeat.

Let’s take a example.

You want to do a comparison between Obama and Ron Paul.

Go to the home page and type Obama in the left search box (or, right, does not matter). Now whatever comparisons we have with Obama will be displayed. Let’s say you do not find the comparison between Obama and Ron-Paul, so you type Ron Paul to the right search box. Images of Obama and Ron Paul are loaded. You need to choose one for each of them.

Fill up the form and submit.

Comparison created.

You can ask connections in your social networks about what their preference is and take it forward.

Mar 06

“Life is the sum of all the choices you make, both consciously and unconsciously.” —
Which one to choose