Blogs

Internship experience at Techprimelab

Internship experience at Techprimelab

This winter I got the opportunity to intern at Techprimelab Software Pvt. Ltd. Even though the span of my internship was just for 3 weeks, this has been a great experience. I wish I could be here for a bit longer but college attendance is a treacherous thing. In such an ephemeral time period I feel an inclination within me towards the startup culture, I feel like I have learned quite a bit and here’s why:

Coding is life:

During college, I have had my differences with coding. But this internship helped me regain my interest in coding. Coding was the sole reason why I took up Computer Engineering in the first place and that’s what I feel I have to do for my entire life. People working here are erudite coders and just watching them code would send chills down someone’s spine. That’s how I want to be when I start working.

Agile development:

"Write a short note on Waterfall model." might be the most important question for your exams but just like everything in our education system it is now old. All that I have observed is Agile development is used these days and is really efficient. Also, it is not just about the tiered architecture anymore. Components, connectors, pipes and filters are the new fads.

Work and learn:

I was asked to work on a topic called “Elastic Search” with just an internet connection I had the freedom to research the topic in any way I wished to. I ended up researching a lot about it and also In the meantime developed a small project to understand how it works. Now, I may not know this stuff enough to pass an 80 mark exam on it but I swear I would not have learned this stuff with such depth or executed a small project in an entire semester if this was a college subject.

Motivation:

This point is somewhat in line with the previous point I made. The owner and founder of this place said to me on the first day “This is how we work here, you have all the resources you need. You use them the way you want to create great things. No one is going to drive you.” It is such a great environment that you yourself are motivated. Approaching anyone is very easy and everyone is very helpful. This informality or rather not paying undue importance to hierarchy is what makes this place so successful in my opinion.

Friendly people:

Someday someone brings in a cake, the other day someone brings in sweets, cookies someday. Everyone has been so friendly and within two days I stopped feeling like this was some new place. It takes me two hours of arduous travel to get here, but I guess the friendliness of this place is what made it worth it and I were never bored or tired of that journey.

Tea and coffee are indeed fuel:

Engineers indeed really need their dose of tea/coffee in the morning and evening to stay in the zone. During this internship, I learned that I am no different either. All I can say, good for me.

The watercooler:

I had to see this to know whether it was indeed true. You probably won’t get the reference if you haven’t seen The Office. But, yes it is indeed true that in an office the water cooler is kind of a social place.

What it takes:

Without letting this get any verbose let me get to the last point. Just like every other engineer out there, it is my aspiration to build a successful startup one day. Hence, I have been quite observant of what qualities you need to be the founder of a startup. Even in this short time, I have learned that you need to be very calm and cool. You need to trust your team as you cannot oversee each project every now and then. You need to make decisions and the most important of all never get tired!

I think I’m done here. I probably will get to know even more things in a few days more I have left here. I will be forever indebted to Techprimelab and the people working here. I feel proud of the fact that I got the opportunity to do my first ever internship here.

30 Dec 2016
By Akash Barve
Read More
Speech Recognition and Synthesis using Google's Speech API

Speech Recognition and Synthesis using Google's Speech API

Speech recognition and speech synthesis are the best technologies that not only evolves but also used in today's web applications. It is having the greatest impact on human interactions with machines, that's why I like the term 'If I can speak why should I type!'. There are much speech recognition API's available like Google's Speech Recognition Cloud API, Nuance SDK (Client side and server side), Wit.ai, AT&andT, CMU Sphinx (also available for offline) and much more.

Google provides open access to their API's so that developers can integrate Speech to Text (STT) or Text to Speech (TTS) in their web and mobile applications. However, you will have to pay Google for their services if you use this for commercial purposes.

Here are some of the features provided by Google’s Speech API -

  1. Powerful speech recognition.
  2. Recognizes over 80 languages.
  3. Returns speech to text results in real time.
  4. Provides accuracy in the noisy environment as well.
  5. Uses deep learning neural network algorithms.

It is always better to have the knowledge, but it's much better if you can use it. Here’s how you can use different APIs -

We are covering Google’s Speech API in this blog so that you can easily use it in your web application right away. This web speech API has two parts: Text to Speech using SpeechSynthesisUtterance and asynchronous speech recognition using webkitSpeechRecognition.

Here are 2 steps to use speech recognition in your web application -

  • Using SpeechSynthesisUtterance:

    var speechSynthesizer = new SpeechSynthesisUtterance()

    Send this object to speechSynthesis.speak(speechSynthesizer).

  • Using webkitSpeechRecognition:

    var recognizer = new webkitSpeechRecognition();

    which have callbacks like onstart,onerror,onend,onresult.

Voice commands are the future of user interface with machine. We still need a remote to turn ON the TV and to control another domestic equipment. We aim to change this and provide the Internet of Things (IoT) sector with the help of voice recognition technology so that adding a voice interface to an app or device should be simple.

10 Oct 2016
By Roshan Karwalkar, Shrikant Patki
Read More
Offline Speech Recognition: All you need to know

Offline Speech Recognition: All you need to know

Hello, Matlab enthusiasts! Welcome to the era of Speech Recognition. To build an isolated word recognition in MatLab is not challenging even for beginners but looking at continuous speech recognition we have to think about different aspects of recording and storing of audio data asynchronously.

To refresh the concept:

Speech recognition is the ability of a machine or program to identify words and phrases in spoken language and convert them to a machine-readable textual format. Systems that do not use training are called 'speaker independent' and that use training are called 'speaker dependent'.

There are two types of speech recognition types: 

1) Isolated word recognition

In this type, we are acknowledging the sentence word by word by giving specific pause between speaking each word. For that, we are having the vocabulary trained by a person from which we are going to search and give its result. It is simple to implement and accuracy is very much high.

2) Continuous Speech Recognition

In this type, we are recognising the sentence of connected words not separated by a pause, then by finding the start and end point of each and every word spoken and grouping them into the envelope. Then that envelope is recognised by above system, but it's difficult to implement.

We are having a collection of good speech recognition toolkit provided in Matlab and Scilab. It is the user's choice to select the one which fits your requirements. Let us take a look at the steps that you can do for isolated recognition and then we can reach to the continuous recognition adding an extra layer of logic on it.

There are several models that you can use in speech recognition and synthesis, these are listed below:

1) Acoustic model

 

It is used to represent the relationship between an audio signal and the phonemes or other linguistic units that make up speech. The model is learned from a set of audio recordings and their corresponding transcripts. Created by merging audio recordings of speech, and their text transcriptions, we can use the software to create statistical representations of the sounds that make up each word.[reference] We can use this model for both, Isolated and Continuous Speech Recognition. The only limitation using this model for Continuous recognition is that the library needed for storing the vocabulary is very large. We get higher accuracy if we use this model for Isolated recognition, but all this at the cost of low flexibility.

2) Language Model

 

In speech recognition, the computer tries to match sounds with word sequences. The language model provides the context to distinguish between words and phrases that sound similar. For example, in American English, the phrases 'recognise speech' and 'wreck a nice beach' are pronounced almost the same but mean very different things. These ambiguities are easier to resolve in this model.[reference] This model can also be used in context to both the above models, but the limitation being that we have to define a huge set of Grammar required for speech recognition for Continuous recognition.

Fundamentally we are implementing the above models using the three different techniques, they are:

1) Hidden Markov Model

2) Dynamic time warping (DTW) Model

3)Artificial  Neural Network Model

I have explained the DTW model in terms of Isolated model to recognise the speech - 

Isolated Speech Recognition with DTW(Dynamic Time Warping) Model

One of the earliest approaches to speech recognition where we store a prototypical version of each word in the vocabulary and compare incoming speech with each word, taking the closest match and return it.

As we stated above, DTW model is used for measuring the similarity between two sequences that may vary in time or speed. The simplest approach is, we are storing the MFCC values of spoken words in a hashtable with a key-value scenario. For example, the key is “Robo clean the room” and the associated value will be “Clean room” OR the key will be “Clean the room Robo” and associated value will be “Clean room”. Here we can have many intents that point to the same command, that is, we can have same values associated with different keys. 

There are two phases in implementing the DTW model:

Phases used in Speech Recognition

1. Training Phase

In the training phase, we are asking the user to speak words for three times for better accuracy. Here we are storing Mel-frequency cepstral coefficients (MFCC) values for each key.

2. Recognition Phase

In this phase, the first step is to verify whether we got the required speech to proceed with OR whether it is carrying some noise or complete silence and we can do it by using Voice Activity Detection (VAD) Here we have input as spoken word and we will calculate MFCC for it. In next step, we will find the distance between each stored word and current word with Dynamic Time Warping (DTW) algorithm. The minimum distance gives us the accurate word that is spoken by the user.

The above image shows the implementation of both the phases in DTW model. 

Just like we used the above model for Isolated Speech Recognition, similarly we can use the model for Continuous Speech Recognition. Just we have to get the words spoken by the user asynchronously. 

21 Sept 2016
By Roshan Karwalkar, Shrikant Patki
Read More
How to setup x-debug with NetBeans on Ubuntu and debugging Magento project

How to setup x-debug with NetBeans on Ubuntu

X-DEBUG is a PHP extension for powerful debugging. It supports stack and function traces, profiling information and memory allocation and script execution analysis. It uses the DBGp debugging protocol. Installing and setting up x-debug on ubuntu is very easy and once it is setup you can use it through any development IDEs such as Netbeans or PHPStorm. In this post I am going to guide you how to install and setup X-DEBUG on Ubuntu machine and how to debug Magento based project on Netbeans IDE.

 

1. Install x-debug using following command
sudo apt-get install php5-xdebug

2. Browse to your php folder and locate xdebug.so file. In my case it is /usr/lib/php5/20121212/xdebug.so.
Copy this files path.

3. Open your php.ini ( /etc/php5/apache2/php.ini ) and add following lines at the end of this file

[xdebug]
zend_extension='/usr/lib/php5/20121212/xdebug.so'
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.profilerenable=1
xdebug.remote_handler=dbgp
xdebug.idkey='netbeans-xdebug'
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
Replace zend_extension path with the path you have copied in previous step

4. Restart your apache server using
sudo service apache2 restart

5. Open Neatbeans and goto Tools > Options > PHP > Debugging and make sure that there is Debug Port set to 9000
and Session ID to “netbeans-xdebug“

6. Thats it you are almost done. Now just create a new php project, add some breakpoints to any php file in it and click on Debug Project from tool bar or press ctrl+F5. This will start debugger.

Watch the video on Debugging Magento Project (https://www.youtube.com/watch?v=1eXGO9Suqos)

12 Sept 2016
By Shubham Takode
Read More
How to build SEO Friendly website using Angular 2 Universal?

How to build SEO Friendly website using Angular 2 Universal?

 

Before directly coming to the knowledge for building SEO friendly website in Angular 2 Universal, I recommend that you should have prior knowledge to the following concepts:

1. Angular 2

2. Node.js and Express

3. Typescript

I assume that you have already build your website using Angular 2 and HTML, and now you can refer to the steps given below to make your website SEO friendly.

First things first, what is preboot in Angular 2 Universal -

Before your website fully loaded, if you have taken any action like mouse click, typing into text field, the browser stores record of action in preboot options. This would help you to track or record the user action on the site.

Setup below Dependencies into package.json:

1.angular2

2.angular2-universal

3.express

4.preboot

5.Typescript

6.typings

As you know the Angular 2 load its application into tag which is given in the selector of decorator of your component. For SEO we have different metadata and title for all pages. This could easily happen in Angular 2 Universal.

Steps for SEO Based Angular 2 Universal Website :

1. Replace your index.html with

<html>

</html>

When we do this, we get all the control over the tags present inside the <html>. Once we get the control, we can dynamically change the data present inside tags as we change our website page.

2. Create your own html tag in selector of your HTML Component:

@Component({

directives: [AppComponent],

providers: [ServiceForSEO],

selector: 'html',

templateUrl: ‘htmlComponet.html’

});

Doing this allows us to get required control over the HTML tags. The selector functionality of the decorator of Component will render all the data from the htmlComponent.html file into the <html> tag of your index.html file.

3. Insert all the meta and title using variables in your htmlComponent.html:

<head>

<title>{{headObject.title}}</title>

<meta charset="UTF-8">

<meta name="description" [attr.content]="headObject.description"/>

<meta name="keywords" [attr.content]="headObject.keywords"/>

<script>

//any other script

</script>

</head>

<body>

<my-app>

</my-app>

<body>

 

Here we actually put the variables which are required to render dynamic data as we browse through different pages of the website. For example, in the above code, we have declared a ‘headObject’ object which includes all the variables for different tags.

4. Change the variables inside the tags using your own service by assigning the desired values of meta tags, title tag, Open Graph tags and all other tags. To execute the code, place it inside your page’s component, that is, ngOnInit()

In every page’s typescript file, you need to override the ngOnInit() function with the variables assigned to that particular page. Also, invoke the service function wherever you want dynamic data. That service will communicate with the ‘headObject’ which is constantly listening to changes. This change is identified by an ‘Injectable’ which further transfers data to the listeners. For example, in this case, the listener is ‘htmlComponet.html’

@Injectable()

export class SeoService {

 // Observable string sources

 private _showHeadSource = new Subject<HeadClass>();

 // Observable string streams

 changeTitle$ = this._showHeadSource.asObservable();

 // Service change commands

 change(headObject: any) {

   this._showHeadSource.next(headObject)

 }

}

I know these are very complex concepts and not very easy to understand, you can send your queries or your issues to amit.gaikwad@techprimelab.com and I will get back to you within 24 hours. 

 


5 Sept 2016
By Amit Gaikwad
Read More
Google PageSpeed Insight report of Techprimelab.com for Desktop

Improve performance and speed of your website

It is very important to improve the performance and speed of your website. As statistics say that, a user loses interest in your website if it does not load within 3 seconds. But don't worry, we hae got the list of improvements which you can perform on your website and improve its performance and speed.

What is website performance and speed test?

Web performance refers to the speed in which web pages are downloaded and displayed on the user's web browser. Web performance optimization (WPO), or website optimization is the field of knowledge about increasing web performance. There are numbers of tools which would give the result of your web performance and speed test online. Some of the best online tools or sites of performance testing :

  • Google PageSpeed Insights - https://developers.google.com/speed/pagespeed/insights/
  • GTmetrix - https://gtmetrix.com/
  • Pingdom - https://tools.pingdom.com/

Steps for optimizing website performance -


  1. Enable compression:

  2. Now-a-days, all the browsers support gzip compression for all the HTTP requests. Enabling compression can drastically reduce the amount of time required for downloading the resource, also reduce data usage for the client. And also improve the first-time rendering of your page by reducing the size of files transferred internally by up to 90%.


    How to enable compression?

    As we are having Angular Webpack server, we are using server side compression plugin which will result in compression of all response and request. Along with this, we also take assistance of Google’s closure compression plugin for client side compression of javascript with 2.5X compression.


  3. Minify CSS, Javascript and HTML:

  4. Minification refers to the process of removing unnecessary or redundant data without affecting how the resource is processed by the browser - e.g. code comments and formatting, removing unused code, using shorter variable and function names, and so on.


    How to minify CSS, Javascript and HTML?

    If you are using webpack, you can make use of loaders and plugins for removing spaces and commas and other unnecessary characters. And if you build that project using production mode, then it will automatically do all the minification and removes all the comments. If you are using gulp or grunt then use task for minification and remove the comments.


  5. Leverage browser caching:

  6. Fetching resources over the network is slow which may cause the download to be completed after multiple roundtrips between the client and server, which at the end delays the processing and it may also block the rendering of page content.


    How to overcome this problem?

    Set your 'expires' header for the amount of time you want that information to be cached.


  7. Avoid landing page redirects:

  8. Redirecting the trigger to an additional HTTP request-response cycle can delay page rendering. Thus, you should minimize use of redirects at your landing page to improve site performance.


    How to solve this?

    By using the fundamentals of responsive design we can deliver a great multi-device experience and eliminate unnecessary redirects.


  9. Eliminate render-blocking JavaScript and CSS:

  10. While parsing the HTML, whenever the parser encounters a script it has to stop and execute it before it can continue parsing the HTML. This may increase the time required to parse the whole HTML document. Even if the script is an external script, the parser is forced to stop, which may incur one or more network roundtrips and delay the time to first render of the page.


    How to eliminate render blocking script?

    Make JavaScript Asynchronous
    For example:
    script async src='my.js'
    You should avoid and minimize the use of blocking JavaScript, especially external scripts that must be fetched before they can be executed. Scripts that are not critical to initial render should be made asynchronous until after the first render.


  11. Optimize images:

  12. Images contribute to most of the downloaded bytes on a web page. Thus, optimizing all the images on your web page can prove very helpful and reduce the amount of size of a page drastically, finally resulting in improving the speed and performance of the web page.


    How to optimize images?

    There are many tools online which provides image optimization for free of cost. Make use of these image compression tools and optimize your images.
    Here are some of the tools that we used-Tinypng - https://tinypng.com/
    Compress JPEG - http://compressjpeg.com/

  13. Prioritize you visible content:

  14. The data will require additional round trips between your server and the browser if the amount of data required exceeds the initial congestion window. This will result in the web page showing scattered visible content.


    How to prioritize your visible content?

    The most important thing you can do to prioritize is, limit the size of the data that is needed to render the page.

Google PageSpeed Insight report of Techprimelab.com for Mobile

26 Aug 2016
By Amit Gaikwad
Read More
SCSS or CSS - Which is better? Find out here

SCSS or CSS - Which is better? Find out here

Back in the days, people used to have a number of problems while writing CSS. SCSS (Sassy CSS) which is the most commonly used syntax for CSS was derived from SASS (Syntactically Awesome Style Sheets). SCSS is a special type of file for SASS, a program written in Ruby that assembles CSS style sheets for a browser.

SCSS is like CSS with better formatting.

SCSS is a superset of CSS3’s syntax. This means that every valid CSS3 stylesheet is valid SCSS as well. SCSS files use the extension .scss

Being an extension of CSS3, in SCSS, we can add nested rules, variables, mixins, selector inheritance, and more. It’s translated to well-formatted, standard CSS using the command line tool or a web-framework plugin.

CSS or SCSS - Which is better?

CSS is the styling language which is used to style web pages and it is understandable by the browser. Using SCSS, we can add many additional functionality to CSS such as variables, nesting and more. All these additional functionalities can make writing CSS much easier and faster as compared to writing the traditional CSS. SCSS produce a traditional CSS that the browser can understand by running the SCSS files on the server running your web app.

Advantages of using SCSS ?

SCSS is more expressive
We can compress several lines of code in SASS syntax into much less number of lines of SCSS. In SCSS, the standard lines can also be compressed when I'm doing something complicated and can be expanded again for reference.

It encourages proper nesting of rules
If you use the comma operator at a high level, it increases the file size of the final CSS. This can result in making the code really hard to perform overriding of rules.

SCSS allows the user to write better inline documentation
SASS is flexible with comments, but any good developer will prefer inline documentation which is available in SCSS. Inline Documentation makes the lines of code self explanatory.

Integrating existing CSS tools and CSS codebase is much easier
Syntax Highlighting widely used CSS tool and is supported in SCSS. SCSS allows you use the existing code, and help improve its internal structure without altering the external behavior of the code.

Additionally, SCSS allows us to declare and define variables, which finally helps us to normalize the code and reduce the redundancy. For example,

  • Instead of repeating #ff0000 many times in your CSS file, in SCSS, we can just set $red: #ff0000 once and use it as many times as we want.
  • SCSS also supports the use of custom functions which accept parameters and are used to prevent unused repetitions.These functions are known as mixins.
  • We can also inherit the properties of one selector into other selector by making use of extensions.
  • SCSS allows us to do math using operators. We can perform simple calculations inside our code for better output.
scss-code

24 Aug 2016
By Swapnil Kadam
Read More
Why you should move to Angular 2 Universal? Here is the answer

Why you should move to Angular 2 Universal? Here is the answer


Angular 2 is Single Page Application (SPA) just like Angular 1.x, but Angular 2 have more features than Angular 1.x. In Angular 2, the application is comprised of a set of components and some services that provide functionality across those components. A component is a view defined with a template. Its associated code is defined with a class and its additional information is defined with metadata.

Angular 2 vs Angular 1.x

  • Performance is improved in Angular 2 as compared to Angular 1.x
  • Bootstrap is now platform specific in Angular 2.
  • Angular 2 supports mobile oriented architecture. (In Angular 2, with the help of ‘Native script’ we can perform mobile development)
  • Angular 2 uses Typescript. (Typescript is superset of javascript)
  • Angular 2 is not using $scope. As an alternative, Angular 2 provides support for java language syntax. This is the reason learning and implementing Angular 2 is a piece of cake as compared to Angular 1.x

Why Angular 2 Universal?

What are the benefits of using Angular 2 Universal? Why to use Angular 2 Universal? Here is the answer to that -

The new rendering architecture of Angular 2 will separate the Angular runtime into two layers:
the application layer and the rendering layer.
The application layer contains APIs and runtime HTML which the application code interacts with directly. The rendering layer provides a common protocol for performing User Interface updates. This split will allow Angular 2 applications to run in different environments/platforms while providing the same set of abstractions to application developers. The default rendering environment is the browser, but other environments could include web workers, web servers or other devices.

Advantages of using Angular 2 Universal

  1. Serves the first view of your application on Node.JS, .NET, PHP and other servers for near-instant rendering in just HTML and CSS. Also paves the way for websites which benefits SEO.
  2. First time users of the application will instantly see a server rendered view, which greatly improves perceived performance, speed and the overall user experience.
  3. One of the most exciting things about Angular Universal is that, it aims to support multiple server technologies. The idea here is to allow other server technologies, other than Node.js, to render an Angular 2 application server side.
  4. Although GoogleBot crawls and renders most dynamic websites, many search engines expect plain HTML. Server-side pre-rendering is thus, a reliable, flexible and efficient way to ensure that all search engines can access your content.

22 Aug 2016
By Amit Gaikwad
Read More
Secret behind creating quality UX for Web Applications

Secret behind creating quality UX for Web Applications

A web app which is inconvincible and inefficient will not get as much users as desired by it's creators. Designing User Experience is hard, up to an extent, but if you know the secret behind it, then it is piece of cake!
Creating User Experience is not only about making stuff in Adobe Photoshop and Illustrator. There is much more to do before actually going into softwares. If you know all these secrets perfectly, then you're halfway there already.

Secret behind creating quality UX for Web Applications -

  • Plan before starting anything
  • Keep it short and simple
  • Don't create what is already created
  • Organize everything
  • Think of new users
  • Maintain consistency
  • Speed and Performance

Plan before starting anything

When you have finally understood what you have to make, you can break down the whole idea into short pieces. Always go in flow, step-by-step. Never jump to things directly. Decide the flow of the application before starting to write lines of code.


Plan before starting anything

Keep it short and simple

The more short and simple User Experience you create, the more your users can understand it. Many users are lost due to bad UX as they don't want to waste time understanding it. The UX should be self explanatory. Don't do more than you have to.


Keep it short and simple

Don't create what is already created

'Repetition is death of art.' - Pablo Picasso Users love to have new experiences. If you give them what they already have, they are not going to like it. Try to invent some design of your own and implement it in your application. Believe me, even if it is new, users will love using it. Provided, it is really something useful and makes users' job easy.


Don

Organize everything

It is easy to find features of your web application if they are organized and users can access them easily. Even if you have created world class features, but they are not organized and your users cannot access it, they will be useless. Similar and related contents should be clustered together. 'Life's more fun when you're organized.'


Organize everything

Think of new users

You should always keep in mind that new users are not connected to your web application fully until they actually start using all your features. If they are not guided properly after signing up, they are going to stop using the application. Create proper guidance for using and accessing all the features of your web app. Never show blank space to new users, either fill content before hand or guide them before to show personalized content.


Think of new users

Maintain consistency

Your web application must be consistent. Some really good web apps showing off consistency are Facebook, Twitter, and many other apps. Making your features consistent will make sure that users have access to them everywhere in your web application. Consistency greatly boosts User Experience and makes user interaction with your web app easy. This will help you prevent users from getting lost in your web app.


Maintain consistency

Speed and Performance

Your User Experience should not hold back your web application and reduce its speed. User Experience should always be designed in a way that it could boost your web app's speed as well as performance.


Speed and Performance

Want to create awesome User Experiences and impress your customers? We have the solution! Contact us now!


Along with User Experience, we are also masters of Software Design & Development for Web Applications, eCommerce, Internet of Things and Mobile Applications.

19 Aug 2016
By Sunil Neurgaonkar
Read More
How Node.JS is changing the directives of app development

How Node.JS is changing the directives of app development

Using one of the most popular programming languages today, Node.JS is leading to more rapid development with greater agility and reduced labour costs. Node.JS is within easy reach of a huge number of developers.

Here’s how Node.JS is dragging majority of developers from around the world:

  • Splendid Ecosystem

With the combination of the work of low-level system programmers and front-end JavaScript developers, Node.Js provides an ecosystem to enable server-side development.

In spite of all the dependencies inside Node.JS ecosystem, the environs make it easier to adapt, absorb, and share.

Node Package Manager (npm) is the largest package ecosystem ever containing more that 300,000 packages as results.

  • Modular design

Modular design of Node.JS makes it elementary for the developers to switch from their existing language work culture to Node.JS.

Node.JS allows one to manage code internally with the help of a package registry and enable teams to collaborate more effectively. It also encourages the enabling of its modular design through its ecosystem and tooling.

Node.JS also authorize faster app development and better team collaboration as each module is delivering specific functionality such that it can be shared across teams and across applications.

  • Association

Alongside modular design and a magnificent ecosystem, Node.JS developers are benefited with increased association.

Unlike Java, which shares its code typically in the form of large libraries, Node.JS makes developing applications trouble-free and faster with more focus on components that groups can organization-wide associate on together.

Isomorphic JavaScript, which is backend of Node.JS code, creates new ways to collaborate and allows for more systematic use of time and  endeavour by the teams.

  • Operating costs

Node.JS easily works its way on modern cloud ecosystems, allowing operational teams to have a nearly one-to-one relationship between resources and servers.

As Node.JS makes it easier to produce applications, it also makes the JavaScript runtime environment cost-effective.

Node.JS apps build faster, it helped in reducing infrastructure and improved performance of many developers using the environment to develop cutting-edge applications.

Being a developer here at TechPrimeLab, I personally enjoy using Node.JS as it is hassle-free and user friendly so it’s easier for me to progressively adapt the functionality of the environment and make efficient application development.

20 Jul 2016
By Sunil Neurgaonkar
Read More
How to install Redmine (version 3.1.1) on Apache – CentOS 7

How to install Redmine (version 3.1.1) on Apache – CentOS 7

Following procedure should help you to install Redmine tool on your CentOS 7 machine.

Couple of Assumptions:-

  • You are logged on to machine as root user.
  • Apache 2.x & MySQL/MariaDB is installed on your machine and document root is /var/www/html
  • Installation of Ruby 2.2 is also taken care along with development tools for centos. If you need the instructions can be found on following URL
    http://www.server-world.info/en/note?os=CentOS_7&p=ruby22

Download the Redmine version 3.1.1 from Redmine Site

# wget http://www.redmine.org/releases/redmine-3.1.1.tar.gz

Extract Redmine from the gzip tarball

# tar zxvf redmine-3.1.1.tar.gz

Move extracted Redmine directory to /var/www

# mv redmine-3.1.1 /var/www/redmine
# cd /var/www/redmine

Now follow below steps to create user & database for Redmine.

  • mysql -u root -p (Enter the password and you will get to MySQL/MariaDB prompt)
  • CREATE DATABASE redmine;
  • GRANT ALL PRIVILEGES on redmine.* to username@’localhost’ identified by ‘YOUR PASSWORD’;
  • GRANT ALL PRIVILEGES on redmine.* to root@’localhost’ identified by ‘YOUR PASSWORD FOR ROOT’;
  • FLUSH PRIVILEGES;

With above steps you have created Database “redmine” and user to access it.

You are alredy in /var/www/redmine directory. Modify settings in database.yml to based on above steps.

# mv ./config/database.yml.example /config/database.yml
# vi ./config/database.yml

Modify username and password with the one setup earlier during redmine database configuration. Save and Exit the file. Similarly modify confguration.yml file and change SMTP settings to enable redmine to send emails.

Install/update the bundler

# gem install bundler –no-rdoc –no-ri

Install Gem for Redmine

# bundle install –without development test postgresql sqlite

Generate Keys

# bundle exec rake generate_secret_token

Generate Tables
# bundle exec rake db:migrate RAILS_ENV=production

Install Passenger

# gem install passenger –no-rdoc –no-ri

Install modules for Apache

# passenger-install-apache2-module

Once you execute above command following message will be displayed and you need to proceed as per the instructions on the screen

This installer will guide you through the entire installation process. It shouldn’t take more than 3 minutes in total.
Here’s what you can expect from the installation process:

  • The Apache 2 module will be installed for you.
  • You’ll learn how to configure Apache.
  • You’ll learn how to deploy a Ruby on Rails application.

Don’t worry if anything goes wrong. This installer will advise you on how to solve any problems.
Press Enter to continue, or Ctrl-C to abort. Specify 1 and hit Enter.

Restart Apache process

# systemctl restart httpd

You are ready to deploy any number of web applications on Apache, with a minimum amount of configuration!

Create configuration file for passenger and add following lines to run Redmine on port 8080. As I am assuming that on default port 80 you might have some other website running already. You can change the port number based on your convenience and configuration of machine.

# vi /etc/httpd/conf.d/passenger.conf

LoadModule passenger_module /usr/lib64/ruby/gems/2.2.0/gems/passenger-5.0.20/buildout/apache2/mod_passenger.so
PassengerRoot /usr/lib64/ruby/gems/2.2.0/gems/passenger-5.0.20
PassengerDefaultRuby /usr/bin/ruby
PassengerDefaultUser apache
NameVirtualHost *:8080
ServerName xxx.xxx.xxx.xxx #(Either IP of your machine or FQDN)
DocumentRoot /var/www/redmine/public

Save and exit out of vi editor.

Modify /etc/httpd/conf/httpd.conf and add following line into it
Listen 8080
Save and exit. Make sure that the port which you are defining is opened through firewall in order to accept the requests on this port.

Restart Apache process

# systemctl restart httpd

Now you can visit following URL to get to Redmine login page.
http://(IP address or FQDN of your webserver):8080

20 Jul 2016
By Umesh Potbhare
Read More
How to Configure Sendmail on CentOS 6.x

How to Configure Sendmail on CentOS 6.x

Sendmail is a mail server used for sending and receiving mails. It works on SMTP (Simple Mail Transfer Protocol ) protocol on port 25.
a. Install package using Yum using command

yum install mailx sendmail sendmail-cf dovecot m4

b. Configure Sendmail to receive External Emails.
You need to comment out below in /etc/mail/sendmail.mc to allow receiving emails from anywhere. You need to add “dnl” at the beginning of the line to make it commented.

dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA’)dnl

c. Add following line to sendmail.mc above option “MAILER”

FEATURE(`relay_hosts_only’)dnl

d. Add full hostname (FQDN)in following file

# hostname >> /etc/mail/relay-domains

e. Recompile Sendmail using m4 (m4 is the macro processor compiler to compile sendmail configuration files.
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

f. Configure Dovecot to fetch emails.

Dovecot is used for providing POP and IMAP protocols for fetching emails from mail accounts.
# vi /etc/dovecot/dovecot.conf
Search and modify lines as mentioned below.
protocols = imap
listen = *, ::
mail_location = mbox:~/mail:INBOX=/var/mail/%u

g. Restart Sendmail and Dovecot services to reload the new configuration generated from aforementioned steps.

# service dovecot restart
# service sendmail restart
# chkconfig sendmail on

h. Open SMTP port on firewall by following commands

# iptables -A INPUT -p tcp -m tcp –dport 25 -j Accept
# service iptables save

i. Verify the email configuration
Use mailx ( To send email from command line ) and program like mutt (To fetch the mails for particular user). You may have to create new users if no users are already configured on machine.

# mailx -s “Test email from user1” user2
Hello This is the test email.
.
EOT
To fetch emails use mutt from command line. You may have to install mutt if not present already on your machine.
# mutt -f imap://username:password@localhost

After sendmail configuration still your application configured using apache may not be able to send an email to user accounts configured inside your application. It may throw an error like “cannot chdir (/var/spool/clientmqueue): Permission denied.

This may happen because httpd do not have permission set to send mail. There are two ways by which you can enable for apache to send the email. This might be an issue with Boolean parameter set in Selinux.
1. Try and configure Boolean by following below mentioned steps.

# getsebool -a | grep mail
allow_postfix_local_write_mail_spool –> on
httpd_can_sendmail –> off
logging_syslogd_can_sendmail –> off

# setsebool -P httpd_can_sendmail on

-P will make it permanent.

2. You can also set the option of Selinux and achieve the same effect.

# sestatus | grep -i mode
Current mode: enforcing
Mode from config file: enforcing

You need to set current mode from enforcing to permissive mode. This can be achieved temporary by using following command. Once you reboot the machine, it will revert back the changes.

# setenforce 0

To revert back the changes made, you use following command

# setenforce 1

3. You can make the changes permanent by following procedure below

# vi /etc/selinux/config
find the line SELINUX and set parameter as permissive from enforced.
SELINUX=permissive
and reboot the machine to make it permanent.

That’s it. You should have working configuration of Sendmail running on CentOS machine. Please let me know if anything is wrong here.

19 Jul 2016
By Umesh Potbhare
Read More
How to write aggregate query in mongoid and mongodb

How to write aggregate query in mongoid and mongodb

The preceding sections provide password-resetting instructions for Windows and Unix systems. Alternatively, on any platform, you can reset the password using the MySQL client (but this approach is less secure):

  • Stop the MySQL server and restart it with the “–skip-grant-tables” option. This enables anyone to connect without a password and with all privileges, and disables account-management statements such as SET PASSWORD. Because this is insecure, you might want to use “–skip-grant-tables” in conjunction with “–skip-networking” to prevent remote clients from connecting.
  • Connect to the MySQL server using the MySQL client; no password is necessary because the server was started with –skip-grant-tables Command Shell# mysql
  • Then change the ‘root’@’localhost’ account password. Replace the password phrase with the password that you want to use. To change the password for a root account with a different hostname part, modify the instructions to use that host name. mysql SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘MyNewPass’);
  • Using MySQL client, execute the server to reload the grant tables so that account-management statements work: mysql FLUSH PRIVILEGES; You should now be able to connect to the MySQL server as root using the new password. Stop the server and restart it normally (without the –skip-grant-tables and –skip-networking options).

20 Jul 2016
By Umesh Potbhare
Read More
How to reset MySQL root password

How to reset MySQL root password

The preceding sections provide password-resetting instructions for Windows and Unix systems. Alternatively, on any platform, you can reset the password using the MySQL client (but this approach is less secure):

  • Stop the MySQL server and restart it with the “–skip-grant-tables” option. This enables anyone to connect without a password and with all privileges, and disables account-management statements such as SET PASSWORD. Because this is insecure, you might want to use “–skip-grant-tables” in conjunction with “–skip-networking” to prevent remote clients from connecting.
  • Connect to the MySQL server using the MySQL client; no password is necessary because the server was started with –skip-grant-tables Command Shell# mysql
  • Then change the ‘root’@’localhost’ account password. Replace the password phrase with the password that you want to use. To change the password for a root account with a different hostname part, modify the instructions to use that host name. mysql SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘MyNewPass’);
  • Using MySQL client, execute the server to reload the grant tables so that account-management statements work: mysql FLUSH PRIVILEGES; You should now be able to connect to the MySQL server as root using the new password. Stop the server and restart it normally (without the –skip-grant-tables and –skip-networking options).

20 Jul 2016
By Umesh Potbhare
Read More
Create & Install Self Signed SSL Certificate and redirect http to https.

Create & Install Self Signed SSL Certificate and redirect http to https.

First part is to create Self Signed Certificate

Creating and Installing OpenSSL self-signed certificate and configure apache so that traffic can be diverted from HTTP to HTTPS, which is more secure protocol. Normally, Self-signed certificates should be installed on production environment. Following exercise is for Ubuntu machine.

  • Executed following command on Ubuntu machine to generate private key.
    openssl genrsa -des3 -out server.key 2048
  • Now create the insecure Key for http so that at every restart we do not need to supply the password
    openssl rsa -in server.key -out server.key.insecure
    mv server.key server.key.secure
    mv server.key.insecure server.key
  • To create the CSR, run the following command at a terminal prompt
    openssl req -new -key server.key -out server.csr

    After then answered following questions
    Country Name (2 letter code) [AU]:US
    State or Province Name (full name) [Some-State]:
    Locality Name (eg, city) []:.
    Organization Name (eg, company) [Internet Widgits Pty Ltd]:
    Organizational Unit Name (eg, section) []:.
    Common Name (e.g. server FQDN or YOUR name) []:www.example.com
    Email Address []:yourname@domain.com

    Please enter the following ‘extra’ attributes
    to be sent with your certificate request
    A challenge password []:
    An optional company name []:

  • To create the self-signed certificate, run the following command at a terminal prompt
    openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
  • You can install the key file server.key and certificate file server.crt, or the certificate file issued by your CA, by running following commands at a terminal prompt
    cp server.crt /etc/ssl/certs
    cp server.key /etc/ssl/private

    Now second part is that you have to configure the Apache Webserver.

  • apt-get install openssl
  • a2enmod ssl
  • Edited default configuration file vi /etc/apache2/sites-enabled/000-default.conf and added following configuration
    a. Redirect permanent / https://8.26.21.70/ – this line added in default virtualhost *.80
    b. Created another virtual configuration as below

    ServerName www.mybookfinds.com
    DocumentRoot /var/www/mybookfinds/app
    SSLEngine On
    SSLCertificateFile /etc/ssl/certs/server.crt
    SSLCertificateKeyFile /etc/ssl/private/server.key

    ### Configuration ends here###

20 Jul 2016
By Umesh Potbhare
Read More
Everything you need to know about Webtorrent

Everything you need to know about Webtorrent

What is WebTorrent ?

WebTorrent is torrent client like utorrent or bittorrent, but it works in the browser. It’s completely written in JavaScript and internally uses WebRTC for true P2P communication. In technical terms it’s a streaming torrent client for node.js and the browser.  One of the cool thing WebTorrent is that you do not need to install any extension or plugin in your browser to use it. WebTorrent uses open web standards and connects website users together to form distributed and decentralized network of browsers  for transferring files efficiently. Browser-to-browser communication cuts out the middle-man and lets people communicate on their own terms. No more client/server – just a network of peers, all equal. WebTorrent is the first step in the journey to redecentralize the Web. It works across the entire web and WebTorrent clients running on one domain can connect to clients on any other domain. The same-origin policy does not apply to WebRTC connections since they are not client-to-server. Browser-to-browser connections require the cooperation of both websites (i.e. the WebTorrent script must be present on both sites).

WebTorrent is currently new technology but still used by many popular applications. Some this are as follows:

  • WebTorrent Desktop – Open source streaming torrent client. For OS X, Windows, and Linux.
  • Instant.io – Streaming file transfer over WebTorrent
  • GitTorrent – Decentralized GitHub using BitTorrent and Bitcoin
  • PeerCloud – Serverless websites via WebTorrent
  • File.pizza – Free peer-to-peer file transfers in your browser
  • Webtorrentapp – Platform for launching web apps from torrents
  • Fastcast – Gallery site with some videos
  • Colored Coins – Open protocol for creating digital assets on the Blockchain
  • Tokenly Pockets – Digital token issuance with WebTorrent-based metadata
  • βTorrent – Fully-featured browser WebTorrent client
  • Seedshot – Peer to peer screenshot sharing from your browser
  • PeerWeb – Fetch and render a static website from a torrent
  • Niagara – Video player webtorrent with subtitles (zipped .srt(s))
  • Vique – Video player queue to share videos
  • YouShark – Web music player for WebTorrent
  • Twister – Decentralized microblogging service, using WebTorrent for media attachments

Who build it and responsible for further development ?

WebTorrent is build by Feross Aboukhadijeh a graduate from  Stanford University and hundreds of other open source contributors. Feross Aboukhadijeh has worked at Quora, Facebook, and Intel.  You can view his full profile here http://feross.org/about/

How does WebTorrent work?

The WebTorrent protocol works somewhat similar to BitTorrent protocol, except it uses WebRTC instead of TCP/uTP as transport layer protocol. Consider following fig :

Once peers are connected, the wire protocol used to communicate is exactly the same as in normal BitTorrent ( How BitTorrent works ? ). This makes it easy for existing popular torrent clients like Transmission, and uTorrent to add support for WebTorrent.

How to use WebTorrent in your App?

Using WebTorrent in your app is pretty easy, you just need to include webtorrent.min.js to your app. You will get more details about this on https://webtorrent.io/intro and official documentation is available on https://webtorrent.io/docs

How you can contribute it ?

WebTorrent is an OPEN Open Source Project. Individuals who make significant and valuable contributions are given commit access to the project to contribute as they see fit. See it on GitHub

20 Jul 2016
By Umesh Potbhare
Read More