Titanium mobile app - Communicating Between WebViews and Titanium UI

Few days back, we were facing problem establishing communication between a Webview control and a Titanium UI or vice versa. We were integrating Facebook authentication in our Titanium mobile app using Titanium Facebook mobule where we stumbled upon this issue. We wanted to trigger FB Auth Titanium module specific code on click of an HTML Login button tied with a jQuery click event. The FB auth module checks if Facebook mobile app is installed on the device and opens this mobile app for authentication otherwise it opens the browser window popup and redirects to Facebook site to authenticate. This is

Better performance with Index type `varchar_pattern_ops` operator_class in Rails

Rails has provision to provide order of indexing on a column for better performance of like queries. The varchar_pattern_ops improves the performance of like queries by 4 times i.e 4x. For example, lets have this like query on name column (that has sequential index.) Select * from users where name like 'John%' We might have added a regular Rails index in migration for this name column as add_index :users, :name - This will generate a sequential index. The same can be made 4 times faster using btree index by adding xxx_pattern_ops options add_index

Quick dive into Elixir, Phoenix and Erlang ecosystem

Few weeks back I was reading a blog about concurrency limitations in Ruby (which we all are aware since long) and how Elixir is evolving. Thus I was extremely curious to know this new dynamic functional programming language "Elixir", the two decades old Erlang language & Erlang Virtual Machine (VM) known for running low-latency, distributed and fault-tolerant systems. This article is a result of my curiosity about Elixir and Erlang. This article does not cover (i.e. out of scope) installation steps of Elixir & Erlang on Mac, Ubuntu or Windows machine as lot of help is already

Chargify - Subscriptions are cancelled automatically in TEST mode

We have integrated Chargify in one of our web application for recurring subscription payments. Recently we observed that few of our test users, that are more than 6 months old, are unable to login in our staging site, which is connected to Chargify TEST Mode. We noticed that auto cancellations are happening (once a day) for these users in their Chargify subscription records. This was a strange behaviour. We thought either this is happening due to our Dunning settings in Chargify or due to unpaid state changes for credit card expiry. After debugging and verifying everything in our Chargify settings,

Issues with Sidetiq recurrence - tends to eat up 100% CPU for quite a while

If you are using Sidetiq to set recurrence to schedule background jobs, then you may want to be aware of this known and reported issue with recurrence. BTW, recurrence schedule is done using ice_cube gem This is likely an issue in Ruby 1.9.3 but I have posted comments on this article here along with git issue to clarify if its an issue with Ruby 2.0 and above. References at the bottom of this email. Issues: We generally set recurrence daily or hourly in our app/workers/job_name.rb like this recurrence do daily end recurrence

Nokogiri gem installation issues on Mac OSx with Ruby 2.1.5

On our Mac OSx, if we upgrade to latest Ruby 2.1.5 (or even 2.1.2) then there are high chances that we will face issues installing nokogiri gem. We might face errors like: ERROR: Failed to build gem native extension. Following are the steps to resolve these issues on Mac OSx Install library libxml2 using brew. brew install libxml2 Read complete error dump on console while doing bundle or bundle install. We will notice that there are useful tips to fix this on our OS, for example for building Nokogiri with a packaged version of libxml2-2.9.

Customizing Devise authentication, to check for active Chargify subscription

This post is an extension of article. I added further customization to check if user has active chargify_subscription and then only proceed to login otherwise show custom message instead of default devise message. Here is what I did (2 step process). In our user model (specifically user_extensions) override devise method active_for_authentication as follows def active_for_authentication? super && locked? && active_subscription? end Calling super first is very important here, to have devise perform all its regular checks first and then upon success we can proceed to add our custom checks. locked? is

Solr configuration for CircleCI build

Recently, in one of our in-house app, we faced issues with RSolr that failed all our builds in CircleCI. We faced following RSolr specific errors in our CircleCI builds for the repo. RSolr::Error::Http: RSolr::Error::Http - 500 Internal Server Error Error: Severe errors in solr configuration. Check your solr log files for more detailed information on what may be wrong. If you want solr to continue after configuration errors, change it to following configuration instead of null <abortOnConfigurationError>false</abortOnConfigurationError> After troubleshooting and debugging, we noticed that our repo in git just had

Solr query language and testing search results using "Solr Admin" page

Recently we had a bug in one of our app where search was not able to find anything based on sub keywords or sub text. Lets say we have an article that has keyword "dedicated" in subject or body or in tags. Now if we try to search using keywords say | cat | cate | ted | dedi | dicat | dedi | then outcome was zero search results. This issue was due to the way indexing was done along with missing query configuration in Solr. We fixed the indexing and seaching configuration in solr/conf/schema.xml file. We added/edited following code

List of frequently used Linux - Ubuntu console commands

Following is an handy list of frequently used Linux (Ubuntu flavour) console commands Find Files find . -name '*.cnf' find . -name 'hello.workd' The dot here represents all files and folders in current path Mysql DUMP - Import and Export Export mysqldump -u username -p database_name > file_name_to_save.sql Import mysql -u username -p database_name Install LAMP on Ubuntu sudo apt-get install tasksel sudo tasksel sudo tasksel install lamp-server Install Apache2 on Ubuntu sudo apt-get update sudo apt-get install apache2 The /var/www path is the document root for the apache web apps. SCP - File