Friday, May 4, 2018

Upgrade to angular 6

How to upgrade/update to angular 6 ?

By using the angular cli we can upgrade to angular 6, below are the steps to upgrade

  1. Update the NodeJS version to 8.9+
  2. Update Angular cli to latest version

  3. npm uninstall -g @angular/cli
    npm cache verify
    npm cache clean
    npm install -g @angular/cli@next
    npm install typescript@2.7.2
    


Monday, April 16, 2018

MongoDB – Allow remote access

By default, MongoDB doesn’t allow remote connections. to enable the remote access bind the ip address of the machine in mongod.conf.
in linux /etc/mongod.conf
 # network interfaces
net:
  port: 27017
  bindIp: ip-address of the machine // by default it will be 127.0.0.1

Wednesday, February 14, 2018

How to make @requestparam optional in spring

Question:

Make spring endpoint with optional request parameters

Solution:

To make the request parameter optional on the spring controller, user JAVA 8 feature Option type or set required attribute to false.

public void count(@RequestParam(name="name") Optional name){
if (name.isPresent()) { 
 String name= name.get()
....
}
}


Sunday, February 11, 2018

@angular/platform-browser/src/browser/transfer_state.d.ts (34,40): ',' expected.

Error:

`ERROR in [at-loader] ./node_modules/@angular/platform-browser/src/browser/transfer_state.d.ts:34:40 TS1005: ',' expected. ERROR in [at-loader] ./node_modules/@angular/platform-browser/src/browser/transfer_state.d.ts:34:42 TS1139: Type parameter declaration expected. ERROR in [at-loader] ./node_modules/@angular/platform-browser/src/browser/transfer_state.d.ts:34:46 TS1109: Expression expected. ERROR in [at-loader] ./node_modules/@angular/platform-browser/src/browser/transfer_state.d.ts:34:51 TS1005: ')' expected. ERROR in [at-loader] ./node_modules/@angular/platform-browser/src/browser/transfer_state.d.ts:34:59 TS1005: ';' expected. ERROR in [at-loader] ./node_modules/@angular/platform-browser/src/browser/transfer_state.d.ts:34:60 TS1128: Declaration or statement expected. ERROR in [at-loader] ./node_modules/@angular/platform-browser/src/browser/transfer_state.d.ts:34:73 TS1005: '(' expected. ERROR in [at-loader] ./node_modules/@angular/platform-browser/src/browser/transfer_state.d.ts:34:42 TS2532: Object is possibly 'undefined'. ERROR in [at-loader] ./node_modules/@angular/platform-browser/src/browser/transfer_state.d.ts:34:48 TS2304: Cannot find name 'key'. ERROR in [at-loader] ./node_modules/@angular/platform-browser/src/browser/transfer_state.d.ts:34:53 TS2304: Cannot find name 'string'. ERROR in [at-loader] ./node_modules/@angular/platform-browser/src/browser/transfer_state.d.ts:34:62 TS2693: 'StateKey' only refers to a type, but is being used as a value here.`

Solution:

Update your typescript dependency to the latest version

 "devDependencies": {
   .....
    "typescript": "^2.6.1"
  }


Monday, February 5, 2018

MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe"

Error:

MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe"

Solution

This error will be thrown on the windows machine for the node module build, to resolve this issue, run/install the windows build tools. Run from the administrative CMD or PowerShell!

npm install --global --production windows-build-tools

Friday, January 19, 2018

Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

Issue:

Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain. Bitbucket pipeline or Jenkins console output, the build is failed – “Could not find org.gradle.wrapper.GradleWrapperMain”

Solution:

This error will be thrown when gradlew build unable to find the gradle folder which contains the gradle-wrapper.jar file, if the generated gradle-wrapper.jar is not check-in/commit to bitbucket please check-in or add the file.

    gradle folder structure:
|---gradle
    |---wrapper
        |---gradle-wrapper.jar
        |---gradle-wrapper.properties
|---gradlew
|---gradlew.bat