Net Neutrality – Is it Neutral?

What is Net Neutrality?

Net neutrality simply means that you are in control of what you do on the Internet. Net Neutrality is the principle that Internet Service Providers (ISPs) should not discriminate or promote any form of data over the internet. It prevents ISPs from charging differentially based on content, user, site, etc.

net-neutrality-money-drain-for-all

Why this fuss about Net Neutrality in India?

In December 2014, Airtel, a leading telecom network and ISP, changed its service terms for 2G and 3G data packs so that Voice over Internet Protocol (VoIP) data was excluded from the set amount of free data. So, Airtel would levy additional charges for making voice calls using Continue reading

 

Multiple-Databases In Single Rails Application

This is a simple post to list some of the challenges faced during multiple database setup in a single rails application. The content in the post is available over the internet, we have consolidated it here to bring it at one place.

While integrating multiple third party services we felt the need to store each and every pair of request-response shared between our application and others. We decided to use database tables to store this information instead of files or other options so to have an easy disintegration of data. This helped us in filtering for some particular handshakes based on certain scenarios. Also we could pick requests that failed to respond or if any request claimed to be sent to us but never did.

We thought it would be better to place this in a separate database to avoid clouding our main database. Plus we could also avoid picking up this content while backing up our already big database, as this was not that “critical”.

So we set our sails in this direction and Rails made it very easy by letting us set up different database connections for such classes/models.
Continue reading

 

Integrating Interswitch WebPay Payment Gateway With Rails

Interswitch WebPay is a leading Nigerian payment gateway and integrating WebPAY with any website is fairly simple. At a high level this integration can be achieved with following steps:

  • Calculate a request hash based on input parameters like transaction reference, amount, callback url etc. to ensure transaction integrity.
  • Provide a URL at which WebPAY would post back the authorization response (callback url).
  • POST these transaction details to WebPAY page
  • Once the transaction is done, query the transaction details directly from WebPAY to ensure the actual transaction amount and the transaction status.

To integrate WebPay with any rails application seamlessly we have extracted the code into WebPay Interswitch Gem. Continue reading

 

Migrating from Protected Attributes to Strong Parameters

In Rails3, we use attr_accessible or attr_protected(Protected Attributes) to white-list attributes of a model for mass assignment.
In Rails4, Protected Attributes was moved out as a Gem and similar feature was implemented at the controller level, which is now known as Strong Parameters.

We were migrating one of our project from Rails3 to Rails4 and decided to use Rails’ Strong Parameter instead of using the Protected Attributes Gem. While migrating from Protected Attributes to Strong Parameters we found ourself in a situation where we were repeating the same code. To elaborate, in Rails3 when we used Protected Attribute, all our white-listed attributes were at one place i.e. in the model itself. But when we used Strong Parameters, all these attributes of model came into the controllers, so if we had more than one controller dealing with same model, we were repeating the code for white-listing attributes in each controller. Continue reading

 

EmberJS: Snagged by belongsTo association

Writing Javascript code using MVC framework and rendering templates at client side is the new fancy way of writing web applications. As they say, when Rails is the backend, Emberjs at frontend is a good fit.

The beauty of the architecture along with our excitement has impelled us to dive into this framework. It started with revamping of an eCommerce site by building its version-2 using Emberjs as frontend framework and Rails as an api server. Initially, everything was working fine and we were enjoying our Emberjs learning and implementation, but in the following scenario belongsTo association has become a stumbling block for us.

Before we talk about the obstacle, let us share what tools we are using and how we are trying to integrate Emberjs and Rails.

Continue reading

 

Custom Edit Control for UITableViewCell

In one of my recent iOS project I was supposed to replace table view cell default edit control with a custom button to match the designs. I guess everyone knows that its pretty simple to change edit control’s color for selected state, we simply need to set cell’s tint color.

custom-edit-controls-for-uitableviewcell-01
custom-edit-controls-for-uitableviewcell-02

But there is no way to customise selected or default state of cell edit control with our own custom image because there is no public API to access this control. So, to customise this we have to write our own code. Steps below will guide you to achieve this.

Continue reading

 

Droidcon India 2014 Experience

Last week we attended Droidcon 2014, held in Bengaluru. First thing we noticed was that we had underestimated it a lot. The event was humongous. With around 250-300 attendees, most of which were either cream Android devs or entrepreneurs.

The content selection panel as well seemed to have done a great job. Topics ranged from core technical (hacking through Android source code) to all the way upto UI centric stuffs (delightful user experience). The speakers were highly experienced and most of them were either business owners or with hands-on experience in product development. Even the promotional interactions were highly informative and bent towards their technical details.

Following are some talks we would like to mention particulars about:

Continue reading

 

Tips for Designers: from a Developer

Android is a versatile OS with more than 1000 device manufacturers and more than 18000 distinct devices. Screen size of android phones vary from 2.6” – 6” and the resolution of screen ranges from 240 X 320 to 1440 X 2560 px with screen density from 120 to 640 dpi (ldpi to xxxhdpi). It is difficult for designers to create such designs which work well on all these devices irrespective of the size, density and aspect ratio of device and still stay developer friendly. In this blogpost I will discuss some useful techniques that ease out the painful design implementation in Android devices that I’ve learnt over a period of time.

Android’s way of dealing with this diversity:

Android provides basic structure to support these devices by putting them in different density buckets i.e. ldpi, mdpi, hdpi, xhdpi, xxhdpi and xxxhdpi.

Continue reading

 

Communication patterns for application components

Activities, services, fragments, helper classes etc. are main components of Android applications but its tricky to establish communication between these components. It’s tricky when one cares about writing reusable code – loosely coupled, plug-n-play-able. The goal here is to avoid tight coupling.

Tight coupling – Components keep references of each other and call methods on them directly. In the code below, we are keeping a reference of MagazineActivity inside MenuFragment. So, MenuFragment is tightly coupled with MagazineActivity i.e., it cannot function without MagazineActivity.

Continue reading

 

Fragment view state retention: A dirty solution

This is the last part of this 6 part series about Fragment Oriented Architecture in Android applications. In the previous post I talked about managing sessions in fragment oriented application. In this post I am going to talk about retaining view hierarchy of a Fragment after removing it from container and then coming back to it by popping the backstack.

(Sample application’s source code and README)

When a fragment gets replaced by another fragment and the transaction is added to back stack, the expectation after a popBackStack() is to return to the previous fragment with its UI state intact. Activity backstack takes care of this expectation quite cleanly until a low-memory situation occurs. But in case of fragments, this isn’t the default behaviour. In a vanilla implementation, the replaced fragment’s view-hierarchy would get recreated upon returning back to it. Reason is that during a replace operation, all the destructive life-cycle methods get called till onDestroyView(), which wipes out the view-hierarcy. Upon returning back, all the constructive lifecycle methods right from onCreateView() get called, thus, recreating the view-hierarchy totally afresh. Reason for this flow is to keep ‘Fragments’ memory friendly. Without the view-hierarchy, a fragment is just a java object with a bunch of instance variables.

Continue reading