Skip to main content

Posts

Showing posts from 2017

Make use of JavaScript console methods

When I say JavaScript console methods, the one and only thing that hit most of our mind is console.log() and we use it a lot and only that some might be familiar with error() and debug(). Did you ever think of checking if there are any other methods available in console other than log? Most of us don't do that, but knowing those methods might have saved lot of our development time. In this post I will show you some of the console methods which will be very useful in our day to day coding.
Log based on conditionconsole.assert(assertion, log_message); To print something on the console only if the assertion failed - assertion can be any expression which returns a boolean.
Note: In chrome this log will print as an error with message saying "Assertion failed:" with the log_message passed. In FireFox its a normal log message.
Log number of occurrence console.count([label]); If we want to count something, it may be a click, may be a callback, or event triggers. We don't …

Sync files from remote system via command line - Linux, Ubuntu, Debian

If you are using more than one laptop/computers in your day to day life for eg: Your personal laptop and Office laptop. Chances of needing a file from one laptop on the other laptop is very common. We don't want to copy the files over the system again and again. We just want the changes to the files made in one system to reflect on the other system.

In this post we will see a simple way to keep files in sync between your multiple laptops/computers. Linux has an wonderful utility called rsync which can be used to sync files/folders between systems in a very optimised way (copy only modified and new files/folders)
If you don't have rsync utility installed on your system, install it by
$ sudo apt-get update $ sudo apt-get install rsync Also we are planning to sync files from remote systems, So lets have the openssh-server installed on the both machines
$ sudo apt-get install openssh-serveropenssh-client will be by default installed on linux machines, if not install it
$ sudo apt-g…

Installing Cordova on Ubuntu 16.04 without Android Studio

Apache Cordova is a platform to build mobile applications using JavaScript, HTML5 and CSS.

When I was trying to install cordova for creating an android application on my Ubuntu 16.04 I was facing lot of versioning and dependency problems. So in this post I will be discussing about all those issues and the solution that worked for me. All the steps are via command line and so no android studio. I don't want to install GB's of files to just use sdk.
Steps:
Install latest version of node and npmInstall CordovaInstall android SDK (Command line)Setting environment variablesCreating android plaformCreating and running first app Installing latest version of nodejs
By default ubuntu 16.04 has a stable version of nodejs added in its own repository. So to install latest version from Ubuntu itself you can simply use apt commad as follows.
$ sudo apt update $ sudo apt install nodejs But when I was using this version (4.2.6 is the latest stable version available when I was trying) I got some…

Duplicate file finder/Remover using perl and SHA1

When you are using a computing devices (either a laptop or PC or a Tab) for your personal use after some time (let take some years) you will realise that your disk is full and most of the space are occupied by duplicate files (Same copy of file located in different locations).

For ex: You might have a favourite music file in "My Favourite" folder as well as in the "Album" folder. But finding this duplicate manually is a biggest process. That too if the file names are different OMG!.

There are lot of free utilities available to do this in automated way, but if you are a programmer, you will always prefer to do it on your own.

Here are the steps we are going to do. This is purely on a linux - Ubuntu system.  (for windows you might need to change the path as per conventions )
Getting SHA1 for all the files recursively in a given directoryCompare SHA1 with other filesRemove the duplicate fileGetting SHA1 of a file

Using cpan module  Digest::SHA1 we can get SHA1 for a f…

Best Investment of Time

Most of us have a common question of "What should I do in my free time?" which will help you to improve your life skills or even help your life financially.

 Frankly speaking there is not straight one word answer and also the answer depends on person to person. First lets decide what is your interest or what is best skill.


You might be interested in

Body buildingDo it your Own (DIY) projectsKnowing thingsProgrammingTesting ApplicationsDestroying things :-)Talking about moviesRoamingetc..,
What ever it is, first thing is don't be lazy, you have to do your interest day to day else that interest will became obsolete.

And second thing, lets share that to other people in the world. Internet is a common thing for us now a days. Use that resource wisely. Increase your contact and make people know about you.

Upload videosCreate BlogsAnswer people questions onlinePublish articlesCreate Apps and publish it on Play store 
etc..,

Basically show your skills to the world.

Some are real…

Git and Github useful commands

Working on a personal forked repository Most of the time when you are working in an organisation who uses git, you will be requested to fork the project and create pull for your feature or bug fixes (Most of the open source contribution in git will be happening like this).

In this note I will let you know some useful git commands which will be very helpful for you in your day to day life with git. I am not going to explain any git technical terms. I am assuming you already know about it or all those terms are linked to a proper source for more information.
Lets start. You can fork any github project by clicking the fork icon on the top right of a repository.  git clone git@github.com:<your-github-id>/Project.git - to clone your forked Project (personal repo)cd Project/ - get into your repositorygit fetch origin - will fetch all the details/indexes (branches and commits) from remote origin but will not apply.git branch - is used to check all the available branches and current work…

My First Post

After lot of thinking and research me too started a blog finally to share my knowledge :-).

Not everybody know everything but also everybody else don't know what we know. So lets share and gain knowledge with Win Win approach.