Sidekiq “reliable_fetch”​, not so reliable! Well sometimes…

Rails development and Sidekiq go hand in hand. One or the other time you must have gone into problem where jobs go missing. Wondering why?
Sahil explains!!

Let's make learning fun!

Recently, in one of my projects, I came across a situation wherein I was required to parse a CSV uploaded by the end user. For performance reasons, I choose to create a new Sidekiq worker for each row in my CSV. All these rows (workers) were running in parallel (standard Sidekiq behaviour). I wanted to execute some logic ONLY after all rows (workers) had finished processing. Sidekiq Pro let’s you do this by creating a batch of workers. Sidekiq has a Batch API that provides success and failure callbacks for such scenarios.

Everything was working well in development and staging environment. Until a day when a customer reported that he is not receiving success/failure report for his jobs. I tried to reproduce the scenario described by the user but, couldn’t. Not even for the same customer account. But, then I was able to reproduce it and again I couldn’t.


View original post 529 more words

Posted in General | Leave a comment

Ionic 2 : Issues and Challenges

In the tech world you always want to be upto date and when a new version of a framework or library is released you tend to & want to upgrade. We also did the same by upgrading our Ionic 1 app to Ionic 2. But it turned out to be very challenging. Nougat just made it even more cumbersome. Swati talk about the challenges/issues and solutions.

Tech Blog

In my last blog we have seen the key benefits of Ionic 2. It includes speedup factor, organized directory structure, easy navigation, generator commands, set of native API and support for cross platform.

However, if you are thinking of migrating from Ionic 1 to Ionic 2, you may face different challenges or issues. You may either find ready solutions to these or you may have to implement solution yourself. I have successfully upgraded my project and hence would like to share my experience, with the issues I faced, and the way I solved these. Hope it will help. Lets see the issues one by one :

Handle Hardware Back Button

Many times we stuck at particular problem, trying to find solution. But unfortunately we do not get anything. Same thing happened with me. I was trying to handle hardware back button manually with the help of method provided by Ionic 2 :

But the problem was, whenever…

View original post 1,085 more words

Posted in General | Leave a comment

Benefits of Ionic 2

Ionic is world’s most popular cross platform mobile development technology. Recently Ionic2 was released. Swati takes us on an interesting tutorial to understand the key benefits of migrating to Ionic2.

Tech Blog

Ionic is world’s most popular cross platform mobile development technology. Basically its hybrid mobile app development framework. Build on top of Cordova, which enables us to build app along with web technologies. The goal behind developing Ionic is to give web developers a way to use their skill-set to build mobile applications.

Recently Ionic 2 has been launched. Conceptually Ionic 2 is similar to Ionic 1. In Ionic 2 controller hold all logical part and view is handled by template, except controllers are classes. Like this there are many key differences. Ionic 2 is build on the base of Angular 2 which uses typescript. All controllers are written in .ts file. Hence while building a app, these files get converted into .js files. This is the process of ‘Transpiling’. Transpiling does not allow logic to be directly available through debugging.

Now a days Ionic 2 is top choice for fast development…

View original post 647 more words

Posted in General | Leave a comment

RoR Tips & Tricks Series – #1

I am staring this series of blog posts. This will cover few tips and / or tricks from ROR. We as developer come across a situation, where we struggle to solve the problem. Once solved we realise that, in our trial and error efforts we have found some trick, which is not documented.

This blog post is an effort to  collect such tips and tricks and make developers life easy !!!

Tip : .first and .last returns same object on mongoid 5

Database : Mongodb

There are 2 ways to overcome this problem.

Simple query that comes in mind is to use “all[-1]”. But this is expensive. Instead use order to get last document. Here is the benchmark of both queries. Collection used for this benchmark has size as 35783 documents. { Unit.all[-1] }
    => 5881.32297800621 { Unit.desc(:id).first }
    => 3.993231992353685
Posted in General | Leave a comment

Ionic 1 or Ionic 2: Anatomy of the decision to upgrade!

Let us take a case where you have an app on production. The app uses some framework and a new version with major architecture changes in the framework is released. Do you upgrade?? Or continue with the old framework version. This problem becomes even more complex if,

  • The product is in early stages, which essentially means there would be a lot of changes, with a very less turn around time.
  • The framework itself at the first place is relatively newer to your team.

This exactly happened with me. Thought, I will share my though process and how I made the decision. It may help somebody perhaps!!

My company excels in Ruby, Ruby on Rails & Angular. Recently one of our esteemed client threw a technical challenge on us. They wanted us to build a MOBILE app using the Ionic framework to complement the Web application we were developing. We had never done this, did not have any in-house expertise, so we were reluctant and pushed back. But, given to the client’s faith and confidence in us, we gave it a thought. Given that we had Angular expertise, this was not completely off the track and took up the challenge.

The team had a learning curve for Ionic-1, but we got the first version out to production (Google play) in 3 months. In next couple of months we had more versions released. But, a product has a life cycle!! We had redesigned the UI.

The catastrophe – by this time Ionic-2 (which uses Angular-2) was released.

It was time to decide whether to continue with Ionic-1 OR switch to Ionic-2. Any one in mind would say UPGRADE (There are many blogs that do a descent comparison). But this wasn’t an easy decision to take –

  • The team had just learnt Ionic-1, now time to learn Ionic-2, huh??
  • The bigger problem, need to first learn Angular-2. It has a completely different architecture & scripting language.
  • The app is on production and in dire need for an UI upgrade.
  • The product had just entered the marked so timing was the key. Any delays could have extreme impact, to the extent that we may lose business and most importantly our reputation.
  • We did not know if all the plugins (e.g. cordova-plugin-sms, razorpay-cordova, cordova-plugin-push etc.) would work out of the box. And if they do whether the way to use would be same or different.
  • The UI was so different that it made no sense to change the existing code but redevelop the UI (Views ONLY). If we live with existing framework, the changes to controllers and models (Angular term) would be negligible. But, this would go haywire if we use Ionic-2/Angular-2 as it would then be completely new architecture of components & providers. Essentially, it would mean more time spent and thus MONEY!!
  • New framework supports Android 4.4 and above.
  • Stable build of Ionic 2 was still not out. The community was hoping it would be out soon but….

The thought process: Key considerations

  • Ionic 1 would soon be deprecated and so the related libraries. Surely wanted to use Ionic 2+Angular 2 for being latest technology and leverage its benefits, like performance, code maintenance etc.
  • Technically we needed to decide which one we should go for and understand the differences between Ionic 1+Angular 1 and Ionic 2+Angular 2 and evaluate technically which is better.
  • Cost benefit analysis –
    • How much time we need to understand Angular 2 and Ionic 2.
      • This involves understanding the new scripting language
      • How to design the UI components.
      • How do the UI components interact with providers and in turn how to call APIs.
      • Critical changes to architecture that will need converting controllers & models to providers.
    • Essentially, how much extra time will be needed, i.e. how much cost of development goes up!
  • Is the team willing & capable of taking the pressure?

The Decision

The entire development team was very excited to learn the new framework and ready to put in the extra efforts to learn and mitigate the risk of running way out of schedule. So I went ahead and did a detailed estimation, figured out that the upgrade would cost us a month and half. Now, it was easy, I had to weigh the cost of these hours against the benefit of getting latest version. The answers was – UPGRADE. The internal decision was made.

But, now comes the most important factor discuss the pros and cons with the client and suggest the approach that is beneficial for the project in long run. Our client is very understanding and he readily approved the additional cost.

The end result – in less than 3 months we are production ready for the Ionic 2 build. Kudos to the efforts of the entire team too!!


Indeed it was a very good decision to go with Ionic 2.

  • The team now knows Angular 2 and tending to be an expert.
  • The new build is much faster.
  • Last but not the least, the new build is out in estimated time. Well before the New Year, begins.

In the next post, I shall detail out more about the “Things to keep in mind while migrating to Ionic-2”

That’s all folks !!

Posted in Angular | Tagged , | Leave a comment

ProTips: Google calendar one-way sync (from google to application)

Learn with fun

In this blog post, I will walk you through my experience of google calendar one-way sync (from google to my application) and will tell you some key points which I understood about google calendar recurring events and normal events.

Google documentation for this is very nice but you need to experiment a lot to understand this so thought of writing it down.

Recently, I was working on one rails backend API only app which has iOS and angular as frontend. In this project one of the feature was syncing user’s google/salesforce/exchange calendar and send push notification as and when meeting is created or updated and that meeting can be single or recurring. Of course, the  user has given permissions to do so 🙂

The obvious question – why not do it in iOS app?

Yes, but we cannot because the user can login using the web app too. And the…

View original post 1,000 more words

Posted in General | Leave a comment

Create multiple flavors of an Android app using gradle script

Product Flavor is a very powerful feature available in the Android gradle plugin that allows us to manage different “flavors” of an application.

In this blog, we are going to learn, how to design and build a single application with multiple flavors, which can be pushed to the Play Store and deployed on the same device simultaneously.

Android Experience

I’ve been asked sometimes on how to work with different hosts, different icons, or even different package names, deppending on different versions of the same app.

There are lot of reasons to do this and one easy way to go: Product Flavors.

Product Flavor is a very powerful feature available in the Android gradle plugin that allows us to manage different “flavors” of an application.

In this blog, we are going to learn, how to design and build a single application with multiple flavors, which can be pushed to the Play Store and deployed on the same device simultaneously.

You can use the productFlavors closure of your app/build.gradle file to define different variants of your product.

In addition to flavors, there is another very important concept regarding building android apps, called “build types”.

Once the changes have been made on app/build.gradle file, a yellow warning bar will appear across the…

View original post 403 more words

Posted in General | 2 Comments