Compiling native libraries for Android L

Preparing your app for Android L ?

While using native executables in our existing Android apps we observed that those executables were no more working with Android L. We came to know that Android has introduced one more security feature starting from Android L i.e
Executable must be PIE (Position independent executable).

To compile a library adhering to above security feature you just need to follow these steps:

  1. Set following LDFLAGS or linker flags : -pie -fPIE
  2. Add --with-pic option while configuring the library.

Some libraries might use different configure options to compile the code with PIC (Position Independent Code) so to check all available configure options for PIC you can use this command:

./configure -h | grep -i pic

If there is no PIC option in configure script then you can try passing -fPIC option with your CFLAGS.

Now, compile the project (make, make install) and it should generate PIE.

To check if you’ve successfully generated a Position Independent Executable (PIE)

You can use “hardening-includes” package on Ubuntu or Debian.

Continue reading

 

Bubble Validations

We were developing a Content Management System which is composed of different components, with each component having dependency on other components in the hierarchy.

Our CMS has the following structure :

  • Site has_many pages
  • Page has_many sections
  • Section has_many embedded_modules
  • EmbeddedModule has_many elements

Problem Statement

For any component to be publishable, we need to ensure that not only a particular component, but also its descendants(children) should satisfy the criteria of publishability.
In our case a Page could be publishable, if all sections belonging to it were publishable. A section would be publishable if all embedded modules belonging to it were publishable. A EmbeddedModule would be publishable if all elements belonging to it were publishable.

If at any step of the hierarchy the criteria fails, not only that component should be marked as unpublishable but also upchain should be notified of unpublishablity.
If any EmbeddedModule gets unpublished then it must unpublish the upper hierarchy i.e its associated section, page and site.

Our Solution

To achieve this we identified that a shared module would be needed which can handle publishability of a component and should also be able to notify the publishability change to its parent.
Continue reading

 

Spree Loyalty Points Extension

Most online stores thrive on customer satisfaction and their loyalty towards their stores. In order to improve the long term relationship with the customers and earn their loyalty, stores come up with different ideas to keep customers engaged. One such idea is to award loyalty points to the customer based on their purchases. These awarded points can be used by customers as a discount in their future purchases.

Understanding the need, we recently published this new extension “Spree Loyalty Points” which adds the loyalty points functionality into the existing e-commerce system. With this extension a new payment method gets quickly added to Spree e-commerce stores. It also automates two features (a) awarding of the loyalty points to the customers on the basis of the configuration done by admin and (b) updating the points based on each transaction done on Spree Commerce platform. It also allow the users to redeem earned loyalty points while placing new orders. Continue reading

 

Cross Compiling FFmpeg with x264 for Android

Recently we were working on a feature where we had to combine an image and audio to create a video on mobile devices. In iOS this can be done using AVAssetExportSessionthough – for detail see this link However, we could not find any native solution for this problem in Android.

FFmpeg is one such tool to tackle this problem but it is not available for Android officially. We tried few existing Android ports of FFmpeg but they were either outdated or didn’t work for us. So we planned to fold our sleeves and compile the library for Android.

Compiling libraries on Linux system is a fairly common task, download the source code of the library and run three commands:

./configure 
make 
make install

As we wanted to use the FFmpeg library on Android devices, we can’t just use the executable generated on the Linux machine directly because Android devices have different CPU architecture, different instruction sets and modified Linux kernel (OS). So we needed to cross compile FFmpeg library for Android

Cross Compilation ?

The process of building executable binaries on one machine, and running them on another machine when the CPU architecture or the Operating System are different is called “cross compilation”.

Continue reading

 

Vinsol Introduces ShopSpree: First iOS App for Spree Commerce

We understand the preferences of shoppers have changed globally. Today, consumers prefer shopping in the most convenient ways: anywhere, anytime and on the move. This changing landscape has given birth to the world of mobile and applications. The statistics prove the increase in mobile internet usage is on the rise, now standing at 65% globally.

ShopSpree0

Around 32% of all online purchases have been done through mobile. Mobile commerce is looking promising, and expects the spending to be $200 billion USD by the end of 2014, reaching an approximate 50% growth from 2013. Predictions indicate that by 2020, smartphones and tablets will account for more than 75% of global online commercial transactions, and more than 50% of spend.

The e-commerce market, which is now enhanced by mobile, is comprised primarily of e-commerce companies that have long held a web presence, but have gained even more with the transition from web to mobile.
Continue reading

 

Bank Transfer Extension for Spree

After we started using Spree for development of e-commerce stores for our clients, we often found the clients looking for different modes for achieving more conversion.

From statistics it was visible that end users need more convenience in their hands while shopping online, particularly in the developing nations where credit card penetration is relatively low. In such environment, Bank Transfer appears to be another practical way by which consumers shopping online can make payments for their order.

Vinsol is SpreeCommerce Premier Partner. View Vinsol’s Services

Bank Transfer or BT, is a payment method which gives user the freedom to do an offline/online transaction to the Merchant’s account directly. The user deposits the amount into Merchant’s bank account, which is specified on the checkout page. The end user, on the other hand, after transferring order amount into Merchant’s account, needs to login and provide the payment transaction details with the specific order. Continue reading

 

Custom model callbacks in RubyOnRails

RubyOnRails provides us with many model callbacks around the object’s lifecycle when object is being created, updated or destroyed. For example: before_create, after_create, before_update, after_destroy etc. We use them to write & run our code around the object’s lifecycle by defining a method and associating them as one of the callbacks.

But then how can we make a piece of code execute as a callback for any another defined method except create, update, save and destroy? For example, let’s say we have a model Article and we want to execute something just before and after an article is being published without hooking into model’s before_save and after_save callbacks?

RubyOnRails or more precisely ActiveRecord provides us with a module ActiveModel::Callbacks, which allows us to define and register custom callbacks using define_model_callbacks method. Lets have a look at the snippet below for the above scenario:
Continue reading

 

Reasons to consider Spree when choosing an e-commerce platform

Don’t select your next e-commerce platform without reading about these 13 factors first.

Online business has become a dominant and growing force. Global sales through e-commerce topped $1 trillion in 2012, with North American and Asia-Pacific nations accounting for nearly 70% of it. Projections are that global e-commerce sales will reach $1.5 trillion in 2016.

“Conduct better due diligence of the platform”

Over 60% of medium to large e-commerce site owners claim they should have done better due diligence on the platform they selected for their store. Much too often do businesses face constrained growth or incur significant losses due to misguided platform selections.

ecommerce-development

If you are ready to sell online, choosing the best e-commerce system for your business can be a challenging and confusing process. Based on our deep expertise of rails e-commerce and Spree development, this blog will help make sense of 13 factors you should be considering for selecting an e-commerce platform for your store and how spree stacks up against the competition on those factors.

1. License
There is no “enterprise” edition of Spree – its all the same software. Enterprise clients, small and medium sized businesses can use Open Source Spree for commercial purpose without paying any license fee.
Continue reading

 

Research firm SourcingLine (Clutch) publishes Vinsol in the list of top Ruby on Rails developers across the globe

The new research identifies leading web & application developers that work extensively with Ruby on Rails.

WASHINGTON, Updated At: June 25, 2014 – Today SourcingLine (now Clutch) published new research on leading web and application developers with extensive Ruby on Rails experience.

The top firms inaugurated into the Ruby on Rails Developers Leaders Matrix are as follows:

Vinsol, Quick Left, Idyllic Software, philosophie, Burnside Digital, Perfectial, DevMynd Software, CognitiveClouds, and VeriQual.

Analysts reached out to firms with a demonstrated history of successful projects for both domestic international clients. Official findings are based on a firm’s proven experience, positive client reviews, and market presence. Companion directories were also published, which allow buyers to search for vendors that best fit their project needs and requirements.

“The flexibility and rapid deployment speed of Ruby on Rails make it ideal for many custom development projects,” explained Joshua Margolin, Senior Analyst at SourcingLine. “The vendors in our research have a proven record of using Rails to deliver viable, high-quality solutions to their clients.”
Continue reading

 

Exporting large data to CSV using mysql outfile in multi-host Rails env.

In one of our current project we had a requirement where we needed to allow the site admin to download raw DB data as CSV file for some offline analysis. So, according to the requirement, we allowed the admin to select a database table and a date range to download the generated CSV data.

Our initial approach was to send the CSV file asynchronously using delayed job. It worked like this:
Admin submits the request, system queues it and sends admin an email with the attached CSV file. The reason we did this asynchronously was to avoid timeout during CSV generation.

While testing & benchmarking this approach, we ecountered two issues when we had a large data to export.

  • Too much memory was used by the ruby process when generating the CSV
  • CSV size could be larger than the supported attachment size by the email service provider, hence could result in an undelivered email

Continue reading