Sunday, December 27, 2020

Nodejs

Installing module global or local using npm

npm 1.0: Global vs Local installation       

npm 1.0 is in release candidate mode. Go get it!
More than anything else, the driving force behind the npm 1.0 rearchitecture was the desire to simplify what a package installation directory structure looks like.
In npm 0.x, there was a command called bundle that a lot of people liked. bundle let you install your dependencies locally in your project, but even still, it was basically a hack that never really worked very reliably.
Also, there was that activation/deactivation thing. That’s confusing.

Two paths

In npm 1.0, there are two ways to install things:
  1. globally —- This drops modules in {prefix}/lib/node_modules, and puts executable files in {prefix}/bin, where {prefix} is usually something like /usr/local. It also installs man pages in {prefix}/share/man, if they’re supplied.
  2. locally —- This installs your package in the current working directory. Node modules go in ./node_modules, executables go in ./node_modules/.bin/, and man pages aren’t installed at all.
Note: When I installed in my ubtunu it has used the {prefix} as /usr/

Which to choose

Whether to install a package globally or locally depends on the global config, which is aliased to the -g command line switch.
Just like how global variables are kind of gross, but also necessary in some cases, global packages are important, but best avoided if not needed.
In general, the rule of thumb is:
  1. If you’re installing something that you want to use in your program, using require('whatever'), then install it locally, at the root of your project.
  2. If you’re installing something that you want to use in your shell, on the command line or something, install it globally, so that its binaries end up in your PATH environment variable.

When you can't choose

Of course, there are some cases where you want to do both. Coffee-script and Express both are good examples of apps that have a command line interface, as well as a library. In those cases, you can do one of the following:
  1. Install it in both places. Seriously, are you that short on disk space? It’s fine, really. They’re tiny JavaScript programs.
  2. Install it globally, and then npm link coffee-script or npm link express (if you’re on a platform that supports symbolic links.) Then you only need to update the global copy to update all the symlinks as well.
The first option is the best in my opinion. Simple, clear, explicit. The second is really handy if you are going to re-use the same library in a bunch of different projects. (More on npm link in a future installment.)
You can probably think of other ways to do it by messing with environment variables. But I don’t recommend those ways. Go with the grain.

Slight exception: It’s not always the cwd.

Let’s say you do something like this:
cd ~/projects/foo     # go into my project
npm install express   # ./node_modules/express
cd lib/utils          # move around in there
vim some-thing.js     # edit some stuff, work work work
npm install redis     # ./lib/utils/node_modules/redis!? ew.
In this case, npm will install redis into ~/projects/foo/node_modules/redis. Sort of like how git will work anywhere within a git repository, npm will work anywhere within a package, defined by having a node_modules folder.

Test runners and stuff


If your package's scripts.test command uses a command-line program installed by one of your dependencies, not to worry. npm makes ./node_modules/.bin the first entry in the PATH environment variable when running any lifecycle scripts, so this will work fine, even if your program is not globally installed:
{ "name" : "my-program"
, "version" : "1.2.3"
, "dependencies": { "express": "*", "coffee-script": "*" }
, "devDependencies": { "vows": "*" }
, "scripts":
  { "test": "vows test/*.js"
  , "preinstall": "cake build" } }


To update a node.js in windows download the latest version and install it.

node -v or node --version
npm -version

npm update -g

To update npm use the below command
npm i -g npm

https://www.npmjs.com --> this mentions the library which are available for node

When we install the npm in global we will have them loaded
C:\Users\ptummala\AppData\Roaming\npm\node_modules

To install typescript

npm install -g typescript

To install /update the latest version of typescript
npm install -g typescript@latest

to look for type script version
tsc -v

If angular cli is not matching with global in project then use the below commands

To known the angular cli version
ng --version or ng -version or ng -v

npm install  --save-dev @angular/cli@latest

To install/update the latest verison of angular
npm install -g @angular/cli@latest


To know the latest version of Angular give


If ng command is not working after angular was installed try to look at the below options by running one after the other

a. Path variable :
     Set the path path variable to have below path
     c:\users\ptummala\AppData\Roaming\npm

b. Run the below commadn to clean the cache
    npm cache clean

c. Run the link command
  npm link @angular/cli

Command

npm audit
npm audit fix


To install node modules

https://atmos.washington.edu/~nbren12/reports/journal/2018-07-16-NN-conservation/node_modules/npm/html/doc/cli/npm-install.html


If package is not getting installed then to check dependency 
npm ls <<node-module>>

npm ls node-sass

to install the dependency check the below 
npm install node-sass@4.12.0


NPM modules we have 
a. Custom modules - which are developed by us and used in our project
b. third party modules - which are developed by others and used from npm and others can also use
c. Core  Modules - These are present as part of Node

http vs express

https://www.geeksforgeeks.org/what-are-the-differences-between-http-module-and-express-js-module/
https://www.quora.com/What-is-the-difference-between-Express-and-the-HTTP-module-in-Node-js

Alternative for ExpressJS
https://blog.back4app.com/expressjs-alternatives/#:~:text=This%20article%20will%20explore%20ten,js%20ecosystem.

To create a packages.json then we will use the below command 
      npm init


To invoke powershell in nodejs refer the below article but when i tried it did not work 
https://www.jeansnyman.com/posts/executing-powershell-commands-in-a-nodejs-api/

https://newbedev.com/execute-powershell-script-from-node-js


Callback in javascript

https://www.geeksforgeeks.org/how-to-create-a-custom-callback-in-javascript/#:~:text=A%20custom%20callback%20function%20can,passed%20is%20actually%20a%20function.&text=console.,-log(%20%22This%20is


require

   to import a module/package we use the keyword require


var fs = require("fs");

var options = {encoding: 'utf8', flag: 'r'};

//Callback with functionname
fs.readFile('./data.txt',options,sampleasync);

//callback with anonymous function
fs.readFile('./data.txt',options,function(err,fileData){
    if(err){
        console.log("File not found"+err)
    }else{
        console.log(fileData)
    }
    endprogram();
});


//callback with anonymous function
fs.readFile('./data.txt',options,(err,fileData)=>{
    if(err){
        console.log("File not found"+err)
    }else{
        console.log(fileData)
    }
    endprogram();
});
console.log("Program ends");

function sampleasync(err,fileData){
    if(err){
        console.log("File not found"+err);
    }else{
        console.log("from sample data : "+fileData);
    }
    endprogram();
}

function endprogram(){
    console.log("End of read")
}

Friday, December 25, 2020

subscriptionservice

 joinkeyring googlechrome extension

curositystream we got an offer to buy @ $12 per year

Wednesday, December 23, 2020

Adeniods and tonsils

https://www.multicarehomeopathy.com/diseases/homeopathic-medicines-for-adenoids-treatment 

Tuesday, December 1, 2020

IPTV

Lookf for the below IPTV providers
http://www.myindian.tv/(Kodi tv annual for regions $126 and $140 for all)
https://helloiptv.com/ (works on android tv $59 for one year)
https://ginnis.store/(adult content $40 and with out adult content $35)
https://am-iptvglory.com/channels-list/ ($80 for 12 months)
https://am-iptvlord.com/($80 for 12 months)
https://ninjatv.org/# ($10 per month)
https://srv-gld.com/($60 and 3 months free for 12 months)
https://subflex.net/index.html#section1 ($54.95 for one year)
https://playvity.com/($10 per month)
https://watchindia.net/ (works on android tv $105 for one year)
https://desiiptv.com/us/home (works on android tv but costly)
https://www.smartv.xyz/ (works on android when annually it will be $44.99 no fast response on chat)
https://bestbuyiptv.co/pt/iptv-subscription (support android tv and cost $70 no response for chat)
https://iptvtune.org/iptv-subscription/(need to verify and adult channels)
https://dream4k.tv/tutorials/ ($75 for year )
https://www.alienconnect.io/apk-premium/ (monthly plan)
https://www.indianiptv.net/ (need to get MAG box)
https://www.bollywoodiptv.com/plans.php(Need box)
https://thetvcloud.com/install/
https://tvsmartinfo.com/collections/all ($99 and $59.99 annual but dont know the difference)
https://sapphiresecureiptv.com/iptv-india/

http://highkeytv.xyz/#gallery ( i am not seeing any support  and adult content)
https://hello.friendiptv.com/ (Payment is pounds so look for this as last option)r
https://hellowtv.com/# (box need to be purchased)
https://iptvboard.com/ (NEed to pay in Pounds)
https://supremetv.eu/(Need to pay in Pounds)
https://king-iptv.org/tutorials/ (Need to pay in Pounds)

https://www.yeahiptv.com/order (need to pay pounds using coinbase)
https://plixiptv.com/ (stay away from this service)
https://www.rapid-iptv.org/ (was shutdown and once again running i hope)


https://www.techfollows.com/iptv/iptv-for-usa-best-service-providers/
https://www.techfollows.com/iptv/iptv-for-usa-best-service-providers/
https://www.quora.com/What-are-the-best-IPTVs-to-watch-Indian-channels-in-Canada
https://exploring-usa.com/best-iptv-service-providers-usa/

https://www.fitiptv.com/service/order
https://www.excursion-tv.com/services
https://sensationiptv.com/wp/
https://premium-ip.tv/index.html


Indian channels
https://www.bossiptv.xyz/about/
https://www.guruiptv.net/
https://www.zadootv.com/




https://troypoint.com/iptv/ (Lits of few iptv)

https://www.quora.com/What-are-the-best-IPTVs-to-watch-Indian-channels-in-Canada

https://watchindia.net/


https://iptvsfinest.com/comstar-iptv/

https://iptvkodi.co/best-indian-iptv-services/


Install Kodi
https://troypoint.com/install-kodi-on-android-box/
https://dream4k.tv/kodi-xbmc-version-17-up/
https://troypoint.com/install-kodi-iphone-ipad/




https://iptvsmartplayer.com/iptv-on-roku/
https://iptvtune.org/tutorials/

https://www.alliance4creativity.com/where-to-watch/#Contact(look for future details)