Category Archives: Development

Direct from the Cybrillan Labs :)

Development

Bitcoin Wallet – Things to know before you build one.

Published by:

What is Bitcoin?

 

Bitcoin is a worldwide cryptocurrency and digital payment system known to be the first decentralized digital currency, The system is peer-to-peer, and transactions take place between users directly, without an intermediary. These transactions are verified by network nodes and recorded in a public distributed ledger called a blockchain.

 

Advantages of Bitcoin:

 

  • Simplistic:

    For cross-border transactions, bitcoin is probably one of the perfect solutions because of its digital nature. It is low cost as well as fast compared to other payment options which are slower and expensive as there are no foreign exchange rates with such cryptocurrency. Bitcoin can be easily purchased through many online sellers for any other currency. Bitcoins can also be mined, but for that, you will require to set a machine and have it endlessly run algorithms. Bitcoins are equipped with increasing complexity of algorithms over time, it is not possible for a standard home PC to effectively mine Bitcoin today. People who actually make money from mining it by dedicated mining rigs with chips that are specially optimized to solve the cryptocurrency hashes.

 

  • Decentralised:

    Bitcoin is a peer-to-peer system where your bitcoin-app/wallet will act like a node in a single-rank public network called the Blockchain which contains all information about all transactions ever made. We can trace back any transactions from any time in the blockchain. The decentralized mechanism makes a transaction unblockable, undeclinable, and the funds can’t be locked. These are the few major things that one should keep in mind about the blockchain before building a bitcoin wallet.

 

  • Safe:

    One major advantage of the Bitcoin ecosystem is that it makes wallet apps a safe place to store, exchange, and use the cryptocurrency as each and every transaction is signed with a digital signature before it is sent to the Blockchain. After it’s sent to the blockchain, a transaction will be processed and it will move through all Blockchain nodes. After that, it’ll become committed which will finally allow the transfer the money to another wallet. Your wallet has to synchronize well with the blockchain, which is important for validating transactions.

Know your competitors: Check a full list of Bitcoin wallets services here.

  • Anonymous:

    Bitcoin works like UPI where you only have to know the Bitcoin address of the recipient to process a transaction into the wallet app. The address looks like this: 1Jhbck6ziWRmQBp67GVDgLSJ9eFF5xNXgB which is in fact way more complicated than UPI address which can’t be remembered as easily as UPI address. You can generate as many addresses as you want for your wallet file. You can check transactions knowing only the address, but you cannot say which wallet is associated with the address and who the actual recipient is.

 

  • Great for stock investors:

    The value of Bitcoin fluctuates and is dependent on the economics of supply and demand, similar to how it works with the paper currency or the stock markets. There are lot of exchanges who trade the cryptocurrency and anyone can participate in trading. Some users may prefer stability over dramatic fluctuations and stability can be achieved with the help of hedging that can be offered as an additional feature of a mobile Bitcoin wallet. Hedging is used to reduce any substantial losses or gains suffered by an individual or an organization and offsets potential price volatility.

 

There are many platforms like Veritaseum, Hedgy and others who provide smart hedging contracts. They work on top of the blockchain and allow users to “lock” their funds. Let us take an example, if a user adds $100 to their bitcoin account, they always have $100 there, and a current exchange rate cannot affect this amount.

 

How do smart hedging contracts make it possible to lock funds? The platforms issue an agreement between two random users, one of which “bets” that the Bitcoin value will increase, and the other that it will fall. After the stipulated period is expired, the user who made the right guess compensates the losses to the user who “lost.” This way the amount of money both users added to their accounts remains unchanged.

 

As cryptocurrency ecosystem has many advantages one of the best is the ease of implementing a wallet for the Bitcoin. We have listed down few libraries that will provide you with standard functionality such as synchronizing with the blockchain and processing transactions.

 

Chain-java: A Java library for the chain.com Bitcoin API can help you access the blockchain.

Bitcoinj: A library for working with the Bitcoin protocol, you can perform the wallet functions. This library powers a lot of wallets.

BitcoinJS: A pure JavaScript Bitcoin library for node.js and browsers. Used in production by over 1.5 million wallet users, BitcoinJS is the backbone for almost all Bitcoin

If you are someone who doesn’t like to be dependent on many libraries, build everything entirely yourself as all standards for the Bitcoin ecosystem are open and can be found in many public sources.

 

Bitcore-lib: A pure and powerful JavaScript Bitcoin library.

 

 

You can a complete guide for Bitcoin wallet implementation using .NET from Codeproject.

Development

“How to make your office creative? Caution DIY ahead! “

Published by:

Meanwhile in India and in everywhere else, Internet of Things (IOT) has  been the most discussed technology of this decade. The obsession went to a new level with the IOT trend.

But wait! We are not one of those who moves with the trend. We follow our own, WITH SWAG.

THE INCEPTION:

When we moved to our new workspace, we were happy, energized and excited. Trust me, this new space plays an important role in making CYBORG’s come to office regularly and sign in their presence in the attendance register.

Wait? What Attendance register? Yes, we were missing those sci-fi  bio-metric attendance system in our office which was trending then in almost every offices in India and here we felt the necessity of getting an attendance machine. But, as I said “We are not one of those who moves with the trend. We follow our own, WITH SWAG” thus the birth of an idea took place and we thought of creating such system by ourself.

GATHERING MATERIALS:

It all began when Mr Kunal Singh aka Kunaldo (as called by the machine) had this vision of creating our own sci-fi smart RFID based attendance system. So what next? As we have a idea now, it was the time to search for the heart that will live up the machine. We came up with few options but after understanding the complexity of our system, we found our hero in “Raspberry-Pi” (the credit card size computer) and ordered it from amazon and started exploring it with other modules as RFID Scanner, Matrix sized keyboard, Speaker and LCD. As Kunal also leads the app development team in Cybrilla he had his other works too. While building the system side by side along with his traditional office work, it took him almost a month to make the system breathe, sense and talk. His smart system scans RFID, identifies cyborg and even speaks out their name in order to mark their attendance.

DIY ATTENDENCE REGISTER

DESIGN:

After the compilation of the system we were confused about how to shape the system so that it looks more creative and becomes more handy to handle. After a session of brainstorming, Punith aka “The Designer Cyborg” came up with a solution. He left office with his smartphone which is only used to book a cab and went for the quest of the “Vintage Coin PCO Box” after a long search (not in google but in the local streets of Bangalore) and longer UBER bills he finally found what he was searching for, “the Vintage Coin PCO Box” and thus we found the IDENTITY for the Identity Machine.

INSTALLATION:Cybrilla_DIY_003

It seemed that the wait was going to get finally over and thus there was a sudden rise in the adrenaline levels of other cyborgs too. We all were excited for the attendance system and more for our new ID Cards, which was technically going to be our first ID Card in last six years.

On 1st of Aug we made the new smart system replace the existing traditional register  and trust me the smile that bloomed in every other cyborgs was undepictable and this also added on the list of Why we love to work in Cybrilla?

And at the end, Kunaldo was crowned with million dollar smiles and satisfaction.Cybrilla_DIY_002

Asset Pipeline Development RailsTips

How to figure out Runtime Dependencies when using Bower via Rails Assets

Published by:

Recently, for one of our client projects we decided to make use of Bower via Rails Assets to better manage Javascript dependencies with respect to the application. This project is on Rails 4.0.13 . For reasons as to why we choose this approach one can refer to the below two blogs –

1. Better Asset Management in Rails Using Rails Assets

2. Bower through Rails Assets

In our application, we were basically replacing the existing dependencies(few of which were placed in vendor/assets/javascripts and others were gems like the jquery-ui-rails) with gems provided to us via the Rails Assets site.

One such third party plugin that we had to replace was the jquery validate plugin. After including the appropriate gem(rails-assets-jquery-validate) from rails-assets site in the gemfile and running bundle to install that gem you might observe from the Gemfile.lock that this gem depends on the rails-assets-jquery-gem.

The BIG question now is, how does the rails-assets-jquery-validate gem(I had installed the gem with version 1.13.1) know which version of the rails-assets-jquery gem it should pick up, given that unlike rubygems.org the current rails-assets site(based on the screenshot below) doesn’t currently list the runtime dependencies required for a gem(which in our case is that we can’t directly find the runtime dependencies for rails-assets-jquery-validate gem).

The workaround

One can find out the exact dependencies required wrt a specific gem by checking out the bower.json file with respect to appropriate code repository corresponding to the gem(in the context of our e.g., this would be for checking out the bower.json file of the rails-assets-jquery-validate gem related code repository) listed on the rails assets site.

 

Development ProgrammingTips

Auto redirect based on language in nginx

Published by:

When you want to do an auto redirect based on the AcceptLanguage parameter sent by the browser the first solution that comes up in Google is this:

This will not work because the AcceptLanguage is of the following form:

And Map will always map to the first one and will not respect the priority.

Solution:

Put this in the nginx

make sure you do :

 

Development Project Management

Tips to Outsourcing your Product development

Published by:

Most of the startups / founders choose to outsource their product development due to shortage of development talent, business domain experts or to skip the hassle of recruiting quality talent and instead start building their product asap and ship it.

At Cybrilla, we get the opportunity to chat with many such founders / companies who have gone with the outsourcing model but have had a really bad experience. Most have had a terrible time managing product development, meeting launch dates, managing different development teams, project delays etc.

Unfortunately most of them have unrealistic expectations w.r.t budget and time about building their product.

If you are one of them, here is a list of things that we recommend to reduce the overall project cost and time.

1> Wireframe your idea :

As a founder / product owner, wireframe your products user flow before you speak to a development shop. It’s one of the most important steps when presenting your idea to someone.

Most of us have an idea that exists only in our head. Wireframes helps to get that idea out of the head and onto a piece of paper. Once your idea is on a piece of paper, you can easily visualize how it works rather than just thinking about how it will work.

It also helps you to jot down different ways a user can flow through the application. Wireframes act as the blueprint for product development.

More importantly it helps the development shop to break down the requirement into user stories.

User stories represent the different features of your product. They serve as guidelines to product development. Exhaustive wireframes will help the development shop to break down the requirements into user stories.

At Cybrilla, we write the user stories and put them into a project management tool like Redmine or Pivotal Tracker. We assign a priority to each story and estimate them individually.

This helps the client to breakdown the budget and assign it amongst the must-have and good-to-have features.

2> Active participation during product development :

You need to be a good project manager, since good project management is the major difference between finishing a project within the estimated time and spending more money on additional features.

At Cybrilla, we follow continuous delivery process and encourage our clients to test each and every build and provide constant feedback. This helps us validate the original requirements and/or make quick changes or tweaks in some of the features. Since we deliver continuously, its important that we have constant feedback

Right from product requirement to delivery participate in each and every step. You can help chart out the test cases which the developers need to validate post development. As a client it is necessary to stay actively involved in each and every step.

3> Having an open mind towards new tools and processes :

At Cybrilla we make use of many tools and follow agile development process. Take time to adopt these tools so that you remain an active participant. These tools help you to keep track of the development progress. Make sure that you are part of weekly sprint meetings where in your prioritize the weekly user stories which will be picked up by the devs.
So, the next time you are planning on outsourcing your product development, follow these steps and be amazed to see how far your budget will go. Take initiative to extensively wireframe your product, scope your product and actively participate in the development process.

Development News

Are you affected by the Heartbleed bug?

Published by:

Heartbleed bug logo

If you are a sys admin or a web master or an internet entrepreneur owning a website, you probably know about the recently discovered bug in the popular open source library Open SSL.

For people who do not know about it, let me put it in simple words. Very recently, on 7th April, 2014, a serious vulnerability has been discovered in Open SSL library (a popular open source library used for secure access to websites & servers on the Internet. It is used by Google, Yahoo, Amazon and almost all popular websites on the Internet). This vulnerability allows a hacker to steal private certificates, user passwords and sensitive data from your website or server. It is a serious bug registered under CVE system as CVE-2014-0160.

Here is what Wikipedia says …

Heartbleed is a security bug in the open-source OpenSSL cryptography library, widely used to implement the Internet’s Transport Layer Security (TLS) protocol. A fixed version of OpenSSL was released on April 7, 2014, at the same time as Heartbleed was publicly disclosed. At that time, some 17 percent (around half a million) of the Internet’s secure web servers certified by trusted authorities were believed to be vulnerable to the attack, allowing theft of the servers’ private keys and users’ session cookies and passwords.

We managed to test all our clients applications and servers if they are affected by this bug before there is any serious damage. Thanks to Vijay and his team for quickly identifying and acting on this.
We have hosted a simple utility which allows you to test for the Heartbleed vulnerability on your website (http://heartbleedtester.org/)

If you are a geek and love digging deep, read this unofficial guide which explains the vulnerability in detail.

If you are stuck fixing this bug on your servers or want to check if you are affected, we’ll be happy to help you. Get in touch to talk to our server security expert.

 

Development

Jqplot – An open source jquery plugin to create charts and graphs

Published by:

As we all know how jQuery make things easy for us to develop and perform better. So here we will talk about the jqplot, which is a jQuery plugin based upon pure javascript, used to build up beautiful line, bar and pie charts with enormous features in it like customized axis, multiple x and y axis, tooltips and labels which you can adjust and customize according to your needs or requirements. In addition to this, it is an open source project which means you can just download it and use it for free whether for commercial or private use.

So here is a short description which will give you a brief idea on how to use it.

  1. Download jqPlot from it official download page. http://bitbucket.org/cleonello/jqplot/downloads/
  2. Unzip downloaded jqPlot copy.
    1. Copy and paste jquery.jqplot.min.css from “dist/jquery.jqplot.min.css” in “css/ ” folder of your web app.
    2. Copy and paste excanvas.min.js from “dist/excanvas.min.js” in “js ” folder of your web app.
    3. Copy and paste jquery.min.js from “dist/jquery.min.js” in “js/ ” folder of your web app.
    4. Copy and paste jquery.jqplot.min.js from “dist/jquery.jqplot.min.js ” in “js/ ” folder of your web app.
  3. In your markup, just use it like this:
  4. Now just open up your markup file in your browser and you would be able to see the plot.

Here is the screenshot of one that i just created:

Development

Native vs Hybrid vs Web application ? Which one to choose?

Published by:

With the inception of HTML5 and CSS3 and with the likes of PhoneGap, Appcelerator, RhoMobile, IBM Worklight coming up with cross platform mobile app frameworks the biggest question running in the minds of mobile app developers is regarding which mobile architecture to use .

Well after running around the internet and searching for answers myself I have tried to narrow down and summarize the problem with the help of the following questions :

What is Native? Hybrid ? Web apps ?

Native refers to building an app in a device’s native programming language. For iOS devices this means Objective-C, and for Android it’s Java. Native apps are typically fast, reliable, and can access all the the device’s hardware. These apps are usually built for high performance needs like mobile games. But the downside is that once built this app is tied down to the platform for which it is built. So an iOS app would not run on an Android device.

A hybrid app is built using web technologies, and then wrapped in a platform-specific shell that allows the it to be installed just like a native app. Thus it is sold/accessed through the device’s app store. PhoneGap is an example of a framework that allows you take a web app and turn it into a native app for iOS, Android, BlackBerry, Windows 7, WebOS, Symbian and more. The hybrid frameworks typically have APIs as well, that allow you to access the device’s hardware and features that are locked out from the browser.

A web app is a website that you access from your device’s browser, but the site is made to resemble an application rather than a traditional website. It’s purpose is also more functional – it offers a utility or service rather than a straight-up website which is often more informational. A web app can be accessed by any mobile device that has a browser. Though being browser-based, it’s typical that not all of the device’s hardware features can be tapped into. To produce a more engaging and interactive experience. HTML5, CSS3 and JavaScript are increasing being used to take advantage of the advanced features offered by this new specification.

1> Pre application build considerations. What kind of application is to be built ?

What architecture you use depends mostly upon the kind of application you want to built.

If you application require the use of native features like camera, bluetooth, accelerometer, database, microphone, speaker, GPS, PUSH etc, then you are better off with a native app. Native apps provide you seamless transitions and quick/flawless access to these device capabilities. Or maybe you want to develop a high end game which utilizes the device graphics and relies on offline storage capabilities, native is the way to go.

On the other hand suppose that your app will seldom utilize minimum device capabilities like camera, push notifications, then you can go for an hybrid app. These apps will infrequently use these capabilities but are not entirely dependent on them. Depending upon the API`s provided by different frameworks like PhoneGap, Rhomobile, Worklight etc you may choose one and start building the app. As the code written using these frameworks is interpreted by the browser and then compiled these apps are slower than the native apps.

The last case is if you want to create a web app wherein you just want to share some information with the users on a regular basis or provide some kindof notifications to the users or for eg. You want to provide a product catalog for the consumers online. In this case the application does not utilize any of the device capabilities like camera, bluetooth etc. Such applications can be built using the powerful yet simple emerging technologies like HTML5 and CSS3. These apps can be accessed from anywhere by anyone using any device as long as they have an internet connection. These apps are the simplest to develop and maintain.

2>Post Application Built Considerations. Cost for developing, testing, maintaining, versioning.

Going native is always going to be costly. Consider this, you may want to develop a game which is available for iOS, android, blackberry and windwos 8 platforms.

Not only do you need experts across different platforms to develop this game, but you now have to maintain 4 copies of the same game.


Going native would increase the cost for distribution, testing, maintenance, enhancements etc.. On the plus side however, these apps will provide you with all the functionality the device has to offer. The user experience would be the best and cannot be compared elsewhere.

The plus point with developing a hybrid application is that the cost of building the application is reduced drastically. You would only need to develop the code once and the framework will provide you with 4 working versions for as many different platforms.

Thus testing and maintenance of the app also reduces. But these apps are yet to showcase the seamlessness and user friendliness displayed by the native applications. One can only imagine with technologies like HTML5 and CSS3 developing that the gap between hybrid and native will be reduced.

The web applications are again the most simplest to develop. Once however needs to take care adjusting the web page resolution depending upon the screen size of the device. For example the same screen resolution used on a 4 inch iPhone will not look great when used on a 8-9 inch tablet. By careful design considerations and coding this however is not a huge task. Again these apps are the simplest and do not use any device capabilities.

Below are a few points which compare the advantages and disadvantages of each :

Native Hybrid Webapp
Skills/tools needed for cross-platform apps
  • Objective-C
  • Java
  • C
  • C++
  • C#
  • VB.net
  • HTML
  • CSS
  • Javascript
  • Mobile development framework (like PhoneGap)
  • HTML
  • CSS
  • Javascript
Development Speed
Slow Moderate Fast
Number of applications needed to reach major smartphone platforms 4 1 1
Advantages Lets you create apps with rich user interfaces and/or heavy graphics. Combines the development speed of mobile web apps with the device access and app store distribution of native apps. Offers fast development, simple maintenance, and full application portability.  One mobile web app works on any platform.
Disadvantages
  • Development Time
  • Development Cost
  • Ongoing Maintenance
  • No portability (apps cannot be used on other platforms)
  • Can’t handle heavy graphics.
  • Requires familiarity with a mobile framework
  • Can’t handle heavy graphics.
  • Can’t access camera or microphone.
Development

How are gems loaded in a Rails application

Published by:

You add a new gem to your Gemfile and start using it in your application’s code. You never have to do ‘require <gemname>’ to use it in the application.

Ever wondered how rails autoloads all your gems? Let me walk you through the process which rails follow. Actually Rails uses Bundler to handle dependency management of all the gems and also autoload them.

How Rails put the gems “on the load path”?

[app]/config/boot.rb

The file is loaded during the rails initialization process and all it does is load rubygems and run Bundler. This will automatically discover your Gemfile and puts all the gems listed in the load path so that they can be required later. (Note: The gem’s aren’t run at this point, just the load paths are set.)

How are gems required (run) ?

[app]/config/application.rb

This file includes all the gems listed in the application’s Gemfile by calling Bundler.require. Bundler allows us to specify which groups to automatically require through the parameters to Bundler.require

The above code loads the assets group of gems only in development and test environments. It makes sense as we use precompiled assets in production, hence assets gems aren’t required to be loaded. (see Rails.groups). There are few comments in the file which will help you to change the default behavior if required.

Understanding rails initialization internals allows us to tweak the process to reduce the application load time. We’ll talk more about the process in the coming posts.

Development

What and Why of Rails?

Published by:

For the last few years, there is a lot of excitement going on about Rails among the web developers. Few months back, techies at Cybrilla have decided to give it a try and now Rails is the main development platform. I decided to blog the reasons behind it, so that it helps you to decide if you are planning to get your hands dirty with Rails.

What?

Rails is a web development framework based on Ruby Programming Language. It strictly follows MVC architecture and believes in ‘convention over configuration’ concept.

For developers with Java background: Rails is similar to struts / spring mvc etc.
For developers with PHP background: Rails is similar to CodeIgniter / Zend etc.
For developers with Python background: Rails is similar to django

Rails philosophy:
1. Convention Over Configuration – Every java developer has to face the problem of maintaining endless xml configuration files. Rails removes much of this pain by following certain conventions for file names, directory structures, database column names etc.
2. DRY: Don’t Repeat Yourself – Rails strongly believes that re-writing a same piece of code is a bad thing. Because so many implementation details are implied from a master source, making changes in Rails becomes straightforward and generally requires a change at a single location.
3. REST is the best pattern for web applications – Rails assumes that most of the web applications are/can-be organized around resources and therefore uses standard HTTP verbs extensively.

Why?

1. Conventions impose discipline in coding. This allows the developers to concentrate on the core application logic than on setting up the application, setting up the database, configuring database etc. mundane tasks.
2. Because of strong conventions, changes to applications are very cheap and therefore Rails is very strong in agile development space.
3. Great community of rails developers keep on building plugins which can be used for common tasks. This removes a lot of “plumbing” associated with building applications with other frameworks.

Above all, it’s fun developing in Rails, as everyday you get to see a new magic 😛