Monday, 2 November 2020

Upgrade from Angular 5 To Anuglar 6

Steps to Upgrade from Angular 5 To Anuglar 6

  • If your project contains package-lock.json file delete it
  • Create a file named npmignore in the root location of your project
  • Update your Angular CLI locally, and migrate the configuration to the new angular.json format by running the following:
    • npm install @angular/cli@6
    • ng update @angular/cli@6
  • Update all of your Angular framework packages to v6, and the correct version of RxJS and TypeScript.
    • ng update @angular/core@6
  • Try to run your project using ng serve, If you get any error saying angular.json is not found then run the below command
    • ng update @angular/cli --migrate-only --from=1.7.4
  • Now you can Run your project using the below Command "ng serve"

Saturday, 24 October 2020

Update a property value without deleting other properties in properties file Using Apache Commons Configuration Java

PropertiesConfiguration class of Apache Commons Configuration 1.10 provides save method which lets you save the updated properties file without deleting the previous values.

In this case the Properties file is present outside of the Jar gets modified by the Jar.


public static void setProperty(String property, String value) {

PropertiesConfiguration conf = null;

try {

conf = new PropertiesConfiguration("./config.properties");

} catch (ConfigurationException e) {

e.printStackTrace();

}

conf.setProperty(property, value);

try {

conf.save();

} catch (ConfigurationException e) {

e.printStackTrace();

}

}

Sunday, 26 July 2020

Nginx - net::ERR_CONTENT_LENGTH_MISMATCH

If you get net::ERR_CONTENT_LENGTH_MISMATCH due to Nginx , one of the reasons could be there is no diskspace for nginx logs.






You can check the disk space using the command "df -i"
so we need to mount the logs in a different location.

We can change the configuration of Nginx Log location in 'nginx.conf'  located at "/etc/nginx" file by updating the fields error_log and access_log.

Check the user nginx is working with and chown -R user:user /var/cache/nginx .

And also chmod -R +x /var/cache/nginx


Also

set proxy_buffering to off in nginx

location /some/path/ {
    proxy_buffering off;
    proxy_pass http://localhost:8000;
}

Sunday, 16 February 2020

Add Local Jar files to a Maven Jar




 

We can add Local Jar files to the Maven Jar with the below steps

   
  • Put the dependency in a "file system repository" local to the project.
  • Declare that repository in the pom.xml as below
                       <repositories>
                             <repository>
                                 <id>somename</id>
                                 <url>file://${basedir}/lib</url>
                             </repository>
                       </repositories>

  • Then Just Declare the dependency as below
                       <dependency>
                              <groupId>inc.skt</groupId>
                              <artifactId>skt-localjar</artifactId>
                              <version>1.0</version>
                       </dependency>

  •  To Add the Jar to Maven Local Repository run the below command from the location where you have pom.xml
mvn install:install-file -Dfile=C:\Model.jar -DgroupId=inc.skt -DartifactId=skt-localjar -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true