Thursday, 16 January 2025

AWS Cloud Formation - Update/Delete Resources which are modified(Updated/Deleted) manually

Tried to delete resource xxxxxx but the values provided do not match the current values.



Lets take an example where an AWS R53 Recordset is modified manually  by updating the values associated with the record set such as routing policy, weight, ....

When we try to update this recordset with the cloudformation template its not able to update the record set as it lost control over the resource and gets into Updae_Rollback_Complete state. When we update a resourde manually the cloud formation will lose control over that resource. Its always recommended to do any updates through the cloud formation template.

To solve this we need to update the record set from the console with the values that the cloud formation template is looking for. Go to the cloud formation console and open the stack thats in Update_Rollback_Complete state, 

goto Template Tab > View Infrastructure composer > click on Template > change any attribute of the resource we are trying to update and update the template. lets update weight for example.

This will trigger the stack update. Once its succesful change the attribute back to the initial value.

goto Template Tab > View Infrastructure  > click on Template > change any attribute of the resource we are trying to update and update the template.


Tried to delete resource xxxxxx but it was not found.

Lets take an example where an AWS R53 Recordset is deleted manually  by updating the values associated with the record set such as routing policy, weight, ....

When we try to update this recordset with the cloudformation template its not able to update the record set as it lost control over the resource and gets into Updae_Rollback_Complete state. When we update a resourde manually the cloud formation will lose control over that resource. Its always recommended to do any updates through the cloud formation template.

To solve this we need to create the record set from the console with the values that the cloud formation template is looking for. Go to the cloud formation console and open the stack thats in Update_Rollback_Complete state, 

goto Template Tab > View Infrastructure composer > click on Template > change any attribute of the resource we are trying to update and update the template. lets update weight for example.

This will trigger the stack update. Once its succesful change the attribute back to the initial value.

goto Template Tab > View Infrastructure  > click on Template > change any attribute of the resource we are trying to update and update the template.

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

Tuesday, 3 December 2019

Mount Volumes to Docker Containers On Windows 7



                                                                                           



We need to perform the below steps to mount volumes on Docker in Windows 7

1) Stop the Docker machine using the below Command
"docker-machine stop"

2) Add the Virtual Box Installation Directory to the PATH variable
"C:\Program Files\Oracle\VirtualBox"

3) Then Share the Folder to be mounted using the below command
vboxmanage sharedfolder add default --name "FolderName" --hostpath "Folder Full Path" --automount
ex: vboxmanage sharedfolder add default --name "MountedVolumes" --hostpath "C:\DockerFS\Volumes" --automount

4) Start the Docker-Machine using the below Command
"docker-machine start"

5) Run the Container by using -v flag to mount the folder,
"docker container run -itd -v /FolderName:/app fs"
ex: docker container run -itd -p 5000:5000 --rm --name fs -e FLASK_APP=app.py --net fsnetwork -v /MountedVolumes:/app fs

Sunday, 20 October 2019

Window Handling using Java Script/Type Script to Open Documents


We can open a Window in Java Script using
            window.open("url", "MsgWindow");

and we can provide a name to it in place of windowName. This method opens a new window and assigns it a name("MsgWindow" in this case).

Now if we again call
            window.open("url", "MsgWindow");
then it replaces the window which was opened in the previous call.  


Lets say you have to open a document which contains n number of Pages on a Click event,
Scenarios :
1) If the Doc is not opened then open the document in new Tab
2) If the Doc is already opened then just switch to it
3) If the Doc is already opened but we need to view a different page then replace the Opened tab with  new tab and the new page


Every time we open a window we can add the windowName to a collection such as a Map.
Lets say docid is the name of the document.

We can use docid as the windowName and either switch to the window if the window is already opened or open a new window.



popupIndex number = 0 ;
static window_map  = new Map<number,Window>();  
setTimeout(() => 
{
  URLwindow.location.origin + "/showpdf/" + docid; 
if(this.popupIndex === 0)
CandidatesComponent.windowMap.set(parseInt(docid) ,
window.open(URL,docid));   
if(this.popupIndex !== 0)
{
var windowFound : Boolean = false;
CandidatesComponent.windowMap.forEach(( valueWindow ,keynumber=> 
{
if(key == docid)
{
CandidatesComponent.windowMap.set(parseInt(docid),window.open(URL,docid));
windowFound = true;
return;
}
})
if(!windowFound)
{
CandidatesComponent.windowMap.set(parseInt(docid),
window.open(URL,docid))
return;
}
}
this.popupIndex ++ ;
}, 250)