How does the Import and Export module work in JavaScript?

What is Module

In JavaScript, a Module is a JavaScript file where we write codes. The object is a module that is not available for use unless the module file exports them.

Exporting Module

export – The export statement is used when creating JavaScript modules to export functions, objects, or primitive values from the module so they can be used by other programs with the import statement.

There are two different types of export – named and default. You can have multiple named exports per module but only one default export.

Default Export

You can have only one default export per module. A default export can be imported with any name.

mobile.js

Named Export

You can have multiple named exports per module. Named exports are useful to export several values. During the import, it is mandatory to use the same name of the corresponding object.

mobile.js

Named Export

You can have multiple named exports per module. Named exports are useful to export several values. During the import, it is mandatory to use the same name of the corresponding object.

mobile.js

Importing Module

import –  The static import statement is used to import bindings that are exported by another module. Imported modules are in strict mode whether you declare them as such or not.

Importing Defaults

You can have only one default export per module. A default export can be imported with any name.

mobile.js

app.js

Importing Named

You can have multiple named exports per module. Named exports are useful to export several values. During the import, it is mandatory to use the same name of the corresponding object.

mobile.js

app.js

Importing All

mobile.js

app.js

Importing Default and Named

mobile.js

app.js

Tagged : / / / /

Ansible Playbook Lab & Excercise – Part 2

Execution Mode – Remote

  1. Write a Ansible Playbook to create a group called “deploy”

  2. Write a Ansible Playbook to create a user called “deploy-user” which is part of group called “group” and with /bin/bash shell.

  3. Write a Ansible Playbook to install package named “httpd” in RHEL/centos.

  4. Write a Ansible Playbook to start and enable the service named “httpd”

  5. Write a Ansible Playbook to create a file called “index.html” in /var/www/html with some dummy html contents.

  6. Write a Ansible Playbook to reboot a self machine.

  7. Write a Ansible Playbook to install a package called “git”, “wget”.

  8. Write a Ansible Playbook to clone git repo. thttps://github.com/scmgalaxy/ansible-role-template

  9. Now Merge all Top Playbook into one and run and verify

Tagged : / / / /

Puppet Module Lab & Excercise – Part 1

Puppet Module Lab & Excercise – Part 1

  1. Write a puppet module to setup a webserver(httpd) only in RHEL and use the HEREDOC to craete a html code of index.html inside a directory called “/var/www/html/index.html”

  2. Write a puppet module to setup a webserver(httpd) only in RHEL and use the puppet template to create a html code of index.html inside a directory called “/var/www/html/index.html”

  3. Write a puppet module to install git, ntp and wget tools.

  4. Write a puppet module which has file named with deploy.sh under module’s files directory. the file should be copied to /opt

Tagged : / / / /

Parenthesis After Module Name And Without Parenths

scmuser created the topic: parenthesis after module name and without parenths

What is the difference between having a parenthesis after module name and without parenthsis after module name?? i.e

Package::Module();

Package::Module;

Tagged :

Error: Cannot find module ‘graceful-fs’

rajeshkumar created the topic: Error: Cannot find module ‘graceful-fs’
Error –

Error: Cannot find module ‘graceful-fs’
at Function.Module._resolveFilename (module.js:331:15)
at Function.Module._load (module.js:273:25)
at Module.require (module.js:357:17)
at require (module.js:373:17)
at Object. (/usr/share/npm/lib/utils/ini.js:32:10)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:349:32)
at Function.Module._load (module.js:305:12)
at Module.require (module.js:357:17)
root@mtv-ubld-39:~/node/npm/scripts# export NODE_PATH=/usr/lib/nodejs/graceful-fs.js
root@mtv-ubld-39:~/node/npm/scripts# echo $NODE_PATH
/usr/lib/nodejs/graceful-fs.js
root@mtv-ubld-39:~/node/npm/scripts# echo $NODE_PATH
/usr/lib/nodejs/graceful-fs.js

Solution

Your npm isn’t properly installed. Execute (as root):

curl npmjs.org/install.sh | bash

This reinstalls npm on your computer, it should work afterwards.

You might need to restart your shell after that for the changes to take effect.

In some cases even the installer fails because of the graceful-fs error, in this case you might need to remove npm using your distribution’s package manager first, e.g.

sudo apt-get remove npm

Or

www.scmgalaxy.com/48-other-build-tools/2…ind-local-grunt.html
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Merge Module for msvcr71.dll

InstallerExpert created the topic: Merge Module for msvcr71.dll
I am trying to use a merge module for msvcr71.dll since its strongly recommended to use merge models for re-distributing c runtime libraries.
But i want to copy this msvcr71.dll to 2 different folders on installation.
But using the same merge module reference twice would cause the same file to be included twice in the final msi, which causes conflict in the File table , since file id is the primary key. (Since same file would be included twice
)
Here is a sample of the code:

< Directory Id="TARGETDIR" Name="SourceDir">

< Merge Id="msvcr71dll" Language="1033" DiskId="1" SourceFile="My_MSM.msm">

< DirectoryRef Id="Folder2">

< Merge Id="msvcr71dllF2" Language="1033" DiskId="1" SourceFile="My_MSM.msm">

< Feature Id="ProductFeature1" Title="MergeMod321" Level="1">

< MergeRef Id="msvcr71dll"/>

< Feature Id="ProductFeature2" Title="MergeMod322" Level="1">

< MergeRef Id="msvcr71dllodbc"/>


Above code gives obvious error that File/Id is duplicated(which is the file id in the msm.

Now i have to use the merge module and i cannot even modify the merge module in anyway and need to copy the file in both the folders.

Is there a way to do so?

I saw the CopyFile element but that can be used only under a Component or File Element.

InstallerGeek replied the topic: Re: Merge Module for msvcr71.dll
Doesn’t the merge module install the file to the Windows system folder? If that’s the case then you shouldn’t need to install the file anywhere else.

InstallerExpert replied the topic: Re: Merge Module for msvcr71.dll





That is all you should Ricky need assuming you’re using the VC++ 7 merge modules provided with Visual Studio 2003. Your convoluted directory structure is totally unnecessary as the merge module is going to put the files into the WinSXS area regardless of where you would like it to go.
You can’t install those merge modules in an arbitrary directory even if you want to.

Tagged :

Use of Merge Module

InstallerExpert created the topic: Use of Merge Module
Reposting this question :
Is it possible to use the same merge module twice in the same source file.






















The above code is giving error:
Error 1 The merge module ‘merge2’ contains a file identifier, ‘m’, that is duplicated either in another merge module or in a File/@Id attribute. File identifiers must be unique. Please change one of the file identifiers to a different value.

Code in the merge module:







Basically i want to copy the file (file1.txt) in F1 and F2 using the mereg module.How can it be done?

InstallerGeek replied the topic: Re: Use of Merge Module
You can’t merge a Merge Module twice. You can connect the Merge Module to multiple Features but that won’t get what you want. I think in your case, you’ll have to use a CopyFile element to copy the decorated File/@Id from the Merge Module.

Tagged :

Steps to Import Module Process by using WinCVS

wincvs

Import Normally refers to the process of creating a new module in the repository by sending an entire directory structure. Module A directory hierarchy. A software project normally exists as a single module in the repository.

Step 1: Navigate to Remote/Import Module

Step 2: Define Import Filter Operation…

Step 3: Set following basic Import Setting.           

  • Repository Path           
  • Vendor Tag           
  • Release Tag    C
  • VSROOT

Step 4: And press OK. The desired source code will get add in CVS server… 

 

 

 

Tagged : / / / / / / / / / / / / / / /