RSS

npm install bcrypt fails on Windows 7 / windows7 64

Step1: Download and install visual studio(2013 or 2015) in your machine.

Step2: Go to the project folder and execute the following command. It will try to install bcrypyt plugin.

npm install --msvs_version=2013

Step3:start your application now

npm start

 

 

 
Leave a comment

Posted by on January 18, 2016 in nodejs

 

Tags: , , , , , ,

Enable Crontab Job in ubuntu/Centos

Step1:

List crontab jobs

crontab -l

Step2:

Open and edit crontab

crontab -e

Step3:

copy and past the following comment and replace the exact path.

Example to run every 1 min:

*/1 * * * * /home/user/fileToStart.sh >> /home/user/logfile.log 2>&1

Example to run on 4:01am on January:

01 04 * * * /home/user/fileToStart.sh >> /home/user/logfile.log 2>&1

Layout example:

minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday)

01 04 1 1 1 /home/user/fileToStart.sh >> /home/user/logfile.log 2>&1

 

 
Leave a comment

Posted by on December 31, 2015 in CentOS, shellscript, Ubuntu

 

R script – Error in UseMethod(“meta”, x) : TermDocumentMatrix.VCorpus

Ever got this error when running R script with tm package??

Error in UseMethod(“meta”, x) :
  no applicable method for ‘meta’ applied to an object of class “try-error”
Calls: source … TermDocumentMatrix.VCorpus -> meta -> meta.VCorpus -> lapply -> FUN
Just try this line before using the TermDocumentMatrix,
textvectors <- Corpus(VectorSource(textvectors))
And then proceed with the TermDocumentMatrix which uses the textvectors
 
1 Comment

Posted by on February 4, 2015 in R

 

Tags: , , ,

Install R in Ubuntu

Add the following to /etc/apt/sources.list

deb http://cran.rstudio.com/bin/linux/ubuntu precise/

Then execute these commands

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys E084DAB9

sudo add-apt-repository ppa:marutter/rdev

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install r-base

 
Leave a comment

Posted by on February 4, 2015 in R

 

Tags: , , ,

Gradle ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/default-java

When using gradle build, we would have faced this error

JAVA_HOME is set to an invalid directory: /usr/lib/jvm/default-java though we have already set the JAVA_HOME correctly

The reason might be gradle itself tries to export java home once again

Just open /usr/bin/gradle file and find the line

export JAVA_HOME = /usr/lib/jvm/default-java and comment it out

Now it should work fine

 
Leave a comment

Posted by on October 14, 2014 in Gradle

 

Tags: , , ,

Git Keep only recent commits in history

Ever faced a situation to cleanup the history in git where you do not need to retain very older commits in history that you never will rollback or do any operation??

I faced this where i need only recent 700 commits in my history.

Here is the work around i did.

Let branch1 be the one which has some 5k+ commits committed years ago

Now i need branch2 with just recent 700 commits in the history, that is the 700th commit from present to past should be the initial one of the repo

I used the fast-export and import feature of git along with the linux sed command combined together for this

git fast-export branch1~700..branch1 | sed “s|refs/heads/branch1|refs/heads/branch2|” | git fast-import

  1. Use fast-export to export the recent 700 commits in branch1 branch
  2. sed – way to create a new branch called branch2 out of branch1 branch
  3. Import the exported 700 commits alone into the branch2 branch

Now you will have your desired branch2 in your local repo which you can push to github

 
Leave a comment

Posted by on October 9, 2014 in Git

 

Tags: , , ,

Insert dynamic regular expression to replace string in javascript

Insert Regular Expression dynamically to replace string in javascript.

var regex = new RegExp('nornaml_'+(dynamicValue), 'g');
replaceString.replace(regex, "Replace Value");
 
Leave a comment

Posted by on May 27, 2014 in General