Wednesday, September 8, 2021

Administer Port Exclusion

 There might be instances when you cannot use a port. You end up getting the error that port is in use. However, no process using that port. 

That could be because those ports might be reseverd. you can check it using the following command

netsh int ip show excludedportrange protocol=tcp

If you see your port there, you can clear those reservation using the following command

net stop winnat

Tuesday, September 7, 2021

Docker Desktop - Error message when trying to switch to windows container

 Exception:

System.ServiceProcess.TimeoutException:
Time out has expired and the operation has not been completed.
at System.ServiceProcess.ServiceController.WaitForStatus(ServiceControllerStatus desiredStatus, TimeSpan timeout)
at Docker.Backend.Processes.WindowsDockerDaemon.TryToStartService(Settings settings, String args, Dictionary`2 env) in C:\workspaces\master-merge\src\github.com\docker\pinata\win\src\Docker.Backend\Processes\WindowsDockerDaemon.cs:line 208
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_1.b__0(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ApiControllerActionInvoker.d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ActionFilterResult.d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__15.MoveNext()


Solution:

Remove the readonly flag of the following file. 

C:\ProgramData\Docker\panic.log

Don't know the connection but it works :)


Thursday, August 12, 2021

Change URL of Git Repo

 To change the URL of Git Repo from one to another is


run 

git remote -v

to see existing URL from within your repo folder.

run 

git remote set-url origin {newURL}


Done!

You can run git remote -v again to make sure that update is successful.




Wednesday, June 23, 2021

Change Detection Strategy - Angular

 Each of the angular component uses Default change detection policy by default. UI keep checking for the change continuously. Which many times affect the performance of the component and overall product. 

There is a way you can control this by setting the Change Detection for your component. 


How to find out the effect Change detection is putting on your control.

Override ngAfterViewChanged event on your component and use code similar to below. 

  ngAfterViewChecked(){
    this._ngZone.runOutsideAngular(() => {
      if(this.divElement.nativeElement)
      {
      this.divElement.nativeElement.classList.add('highlight')
      setTimeout(() => {
        this.divElement.nativeElement.classList.remove('highlight')
      }, 1500)
    }
    })

  }


Inject "private _ngZone : NgZone" to your constructor. 

divElement is the Element in your html. 

and highlight-css , change the background color of the div with css. 

You will see how many times the event fires. 


Changing the Default Change Detection:

- You can change the default change detection by setting the changeDetection to OnPush in your Component declaration. 

Ref:

https://medium.com/ngconf/simplified-angular-change-detection-e74809ff804d

https://pankajparkar.github.io/demystifying-change-detection/#/default-strategy

Wednesday, June 2, 2021

Increase the number of files visible in Azure KUDU

 Problem: Kudu console doesnt show more than 400 files. 

Open kudu ,

go to console and run following command

window.localStorage['maxViewItems'] = 1000

refresh the page.


Wednesday, April 14, 2021

Docker Default Network Connectivity

*Make sure to set "bridge":"none" in "C:\ProgramData\Docker\config\daemon.json".

And Stop and Start Docker service using Stop-Service Docker and Start-Service Docker. 


Create a docker network using 

docker network create -d "transparent" tnet

make sure it got created

docker network ls

test it by running a sample container

docker run -it --network=tlan mcr.microsoft.com/windows/nanoserver:1903

You will end up on command prompt of the docker. 

run ipconfig and see if it is assigned proper ip by DHCP. 

and run the ping command to validate the internet connectivity.

Monday, March 8, 2021

Running prod Angular on Dev Machine

 Build your app using the prod flag. 

NG_BUILD_MANGLE=false node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng build --prod --aot


*NG_BUILD_MANGLE is used for performance troubleshooting. 

once done, go to dist directory and run npm i -g serve (if not already installed)

and then run serve -s. this will start the http server. 


Better you do performance troubleshooting in incognito mode where no chrome extension is loaded. I assumed you are using chome for performance troubleshooting :)

Wednesday, March 3, 2021

Showing network mapped drive in SQL Restore Database

 EXEC sp_configure 'show advanced options', 1;

GO

RECONFIGURE;

GO


EXEC sp_configure 'xp_cmdshell',1

GO

RECONFIGURE

GO


EXEC XP_CMDSHELL 'net use H: \\192.172.0.141\Downloads /User:username password '


You need /User if your shared drive requires authentication. Once this is done, You should be able to see H drive whle restoring the database.