Wednesday, July 3, 2019

How to upgrade nodejs or npm


curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -  sudo apt-get install -y nodejs


Error: *** Error in `appstreamcli': double free or corruption (fasttop): 
0x0000000000fe3990 ***

Solution:  sudo apt install --reinstall libappstream3




How to install JSON

JSON Installation:

download json-server-master package

apply command

 npm install json-server --save-dev

Got error: Linux 4.15.0-45-generic etc

Solution: upgrade to the latest version of npm using:
npm install -g npm@latest

Sunday, June 23, 2019

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)

import sys  reload(sys)  sys.setdefaultencoding('utf8')

and then apply 
text1=text.decode('utf-8')

How to pass text string from php to python

$text="भारतीय भाषा टेक्स्ट टू स्पीच सिंथेसिस सिस्टम";
$p=shell_exec("python lang-detect.py "."\"$text\"");
Kind Regards  /सादर
Pranaw Kumar / प्रणव कुमार
Principal Technical Officer / प्रमुख तकनीकी अधिकारी
C-DAC MUMBAI / सी-डैक, मुंबई
Ph-(+91) (22) 26201604 Ext: 561
Mob: 7303226767

Friday, June 21, 2019

Unable to import package in python calling from php


Disable ENABLE_USER_SITE and then re-install the package, it would be installed in machine level directory, and then it would be accessible via php also (www-data user)

How to disable ENABLE_USER_SITE
open:
/usr/lib/python2.7/site.py

and change ENABLE_USER_SITE = None
to ENABLE_USER_SITE = False

This url is also having good info about package import: