I have been writing code in Imperative programming languages for many years. Writing code in functional programming is a big shift and change in thinking. As I recently started with Elixir and when I was reading about Functional Programming, I keep reading mention of Lambda Calculus every time. That ignited my curiosity to brush up my computer science knowledge.

As Functional programming languages implement Lambda Calculus(λ-calculus). If we understand how Lambda Calculus notation works from...

Read complete blog post

Neo4j is a Graph Database. It uses Graph Data Model to represent the data, unlike other databases which use tables, documents, etc. Graph Data Model or Graph Data Structure is composed of Nodes and Relationships that connect nodes.

Neo4j Browser

A query workbench and a visualization interface.

To install Neo4j and run Neo4j Browser - you can head to https://neo4j.com/download/ and download a community or an enterprise edition based on your requirements. Based on your OS the installation steps...

Read complete blog post

While working with any application, testing plays most important role. Data is main requirement for writing proper test cases. We need different kind of data to test complex features and here factories plays important role.

Data factory is blueprint that allows us to create an object, or a collection of objects, with predefined set of values. Factories makes it easy for us to define different kind of data.

In rails or ember we create model object to write test cases. In rails many of us use ...

Read complete blog post

In one of our Rails 4 app, we decided to move file and image uploads to another microservice so that the load on server is reduced when a big file is uploaded. We decided to do this in Phoenix.

In Phoenix, we have ex_aws package which makes file uploads to S3 very simple just like Rails. So lets get started.

Add ex_aws

Update mix.exs to include following dependencies.

defp deps do
 [
 ...,
 {:ex_aws, "~> 1.0"},
 {:poison, "~> 2.0"},
 {:hackney, "~>...

Read complete blog post

Component is one of the awesome thing in knockoutjs. It makes code more manageable, reusable and help you to code cleanly. Separating functionality in components make coding easier. You can create your own controls and use it anywhere in your project.

You can have nesting of components. You can break your sections into small reusable controls or you can have entire section of application in one component. For nesting of components there is option to pass data to child components through...

Read complete blog post

In the previous article, we have seen how to configure DigitalOcean Droplet. Now let's proceed further to set up our application repository and Ngnix with Phusion Passenger on the DigitalOcean droplet.

1. Install RVM and Ruby

We will install ruby using Ruby Version Manager(RVM) as it gives more flexibility to manage multiple ruby versions on the same system over rbenv, chruby, etc. Import RVM GPG key, before installing RVM:

gpg --keyserver hkp://keys.gnupg.net --recv-keys...

Read complete blog post

Nginx is a lightweight, high-performance web server. Passenger used with Nginx gives us many advantages. It automatically serves static assets from the public subdirectory to improve performance. Capistrano is used to automate deployment process to your remote server. Using Capistrano, you can deploy your web application on many servers simultaneously in sequence or as a rolling set.

In this article, we will see basic steps that need to be followed to configure your DigitalOcean Ubuntu...

Read complete blog post

In this article I'm gonna show you how to build MySQL Docker container image. This article assumes that you've some basic knowledge about Docker.

To run MySQL on Docker we would need to do the following

  • Install Docker engine on your computer
  • Download MySQL image from Docker Hub
  • And run the container

1) First, get the MySQL image

docker pull mysql

2) You'll need to set up your credentials and specify path for MySQL

docker run -d --name=mysql1 -e MYSQL_ROOT_PASSWORD=’mypassword’ -v...

Read complete blog post

Apple URL Schemes helps you to access system apps in iOS. Native iOS app uses this schemes to integrate with system apps and provide a more seamless experience to the user.

For example :- If your app display telephone number you can use appropriate URL to launch phone app whenever user click on the telephone number.

There are many functions of Apple URL Schemes used for such as :-

1. Phone Link :-

Phone link helps you to make dialing experience easy for specific phone numbers. It will prompt...

Read complete blog post

Ever stuck on a remote server with some file? Needed to upload/download file from remote server? Find FTP clients tedious for a simple file upload/download? Keep reading for one stop solution to all these problems.

Many a times I fall in situation where I have to deal with remote servers and just to upload a file I have to open FTP clients and have to leave command line for such a simple task. I always wondered if, there was a command line way of doing simple FTP stuffs. Then few weeks ago I...

Read complete blog post

In my previous knockout.js post, I just gave introduction and explained how knockout works. We learnt about how knockout uses bindings to make UI dynamic and how it connects to the view model

In this article we will learn custom binding. There are built in bindings like click, value, text, visible and so on. But you are not restricted to use only those binding , you can create your own custom binding.

It’s always better to create custom binding for DOM elements instead of writing jquery....

Read complete blog post

In one of app we are sending multiple PDFs as attachment, so instead of sending individual file we decided to send all PDFs in zip. I found a gem 'Rubyzip', to create temporary zip archive and send it as attachment.

Rubyzip is a ruby liabrary to reading and writing zip file.

To create a zip and send it as attachment using Rubyzip here’s a simple example:

  1. Add gem in gemfile

    gem 'rubyzip'
    
  2. Write function to create zip file:

    def get_zip_data
     zip_file =...

Read complete blog post

Traditionally web applications were dependent on back end for routing as A request is made to a server and based on the URL being requested the server responds by HTML.But now a days due to advanced browsers and need for speedy response more advanced code started being moved from the backend to the frontend.

Sammy.js is a tiny(<20kb) javascript framework which uses URL hash (#) to allow you to create single page AJAX applications.It has also limited yet powerful functionalities.Its API is modeled on the popular ruby framework, Sinatra, and is great for both simple and complex applications.There are basically two main functionalities of Sammy which is (1)Routes and (2)events.

Above theory is good for starting so now lets move on with example of sammy js using type script.

public addRoute(url: string, action: (context: Sammy.EventContext)...

Read complete blog post

In this article I am going to show how to write model attribute and computed property test cases for ember applications.

I have been writing test cases from couple of days in GoodCity ember app. I will takeDesignation model as an example model to write test cases. Designation model has shown below.

models/designation.js

import Ember from 'ember';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo, hasMany } from...

Read complete blog post

NSDataDetector

There are many application that extracting specific desired information from a string like date, url, link, address, number and many more. Using this specific desired information we can perform many useful action like create a event, open a url, save a contact number, navigate to particular address.

Example

enter image description here enter image description here

The NSDataDetector class can match dates, addresses, links, phone numbers and transit information. NSDataDetector will be return one of the data detectors type, depending...

Read complete blog post

enter image description here

Spoiler Alert: This article is not about Microservices architecture or how microservices works. In this article, I will share what we have learned in scaling one of the large SaaS platform, our ongoing improvements and how Microservices architecture is playing a key role in scaling this SaaS platform.

This SaaS Platform has experienced tremendous growth in the past 18 months. It has now become one of the leading CRMs in North America.

Everyone’s definition of “scale” and “growth” can differ...

Read complete blog post

In this post I am just going to show 3 ways to parse and extract HTML documents - a useful way of scraping websites, analysis and conversion of offline documents etc.

  • Nokogiri gem -

    The nokogiri gem is a popular Ruby HTML/XML parser which uses libxml2(a software library for parsing XML documents). Parse HTML with nokogiri using the Nokogiri::HTML method:

```

 require 'nokogiri'
 document = Nokogiri::HTML(input)
  • Oga gem -

    The oga gem is a Ruby XML/HTML parser with a small...

Read complete blog post

If you want to show users gravatar profile picture in your rails application this article may help you Its very simple to use gravatar image in rails application by these simple steps

We need to create a helper method that returns Gravatar image for given user in your app/helpers/users_helper.rb as shown below

module UserHelper
 def user_gravatar(user)
 gravatar_id = Digest::MD5::hexdigest(user.eamil.downcase)
 gravatar_url =...

Read complete blog post

The Contacts framework provides Swift and Objective-C API to access and create a new contact. This framework is optimized for thread-safe, read-only usage.

The contact class (CNContact) has a mutable subclass CNMutableContact for use to modify contact properties like phone numbers, email addresses, an array of CNLabeledValue objects. CNLabeledValue contain label and value. Labels describe each value to the user, It allowing differentiation such as home and work for properties and you can...

Read complete blog post

Many of us have already heard about PaperTrail gem and its use for versioning of model. I found it very useful for purpose of debugging. Lets have a quick look at exactly what is PapertTrail gem and how we can use it for purpose of debugging.

PaperTrail and Versions:

  • When we add papertrail gem in our rails app and run migration for same at that time it creates Version table for us in our DB.
  • When we use it in particular model and perform any kind create, update operation on it then each time...

Read complete blog post