Posts

Can't Find Synology NAS in my Network

Image
One day, mapped drives to my NAS stopped working and the NAS itself just disappeared from my network. My first thought was either the NAS broke or my router. But my router seems fine, so I first checked my NAS by directly connecting to it via ethernet cable to my laptop (using USB converter). I also downloaded the Synology Assistant software which helps a lot in finding whether there's Synology NAS in the network. The Synology Assistant can be found in Synology Download Center under Desktop Utilities. Synology NAS model required to find the right software. https://www.synology.com/en-us/support/download My NAS was working well, so I decided to reboot my router. After the router reboots, I detached the NAS from the laptop and connect it back to the router. And my NAS is discoverable in the network again. However, it happened again when I transferred a large amount of files. Probably it overwhelms the router as I use an old Netgear Wifi 5 router. There's also a possibility that f...

Copying Files with Certain File Extensions using AzCopy Task in Azure DevOps

 I was trying to copy only certain files within a directory to Azure Storage Account instead of the whole directory content. The files that I tried to copy are those ends with .zip, .tag.gz, and .py. AzCopy support wildcard on the source, so I would like to do something like this: azcopy copy C:\{directory}\[*.zip|*.tar.gz|*.py] ... I found out later that there's --include-pattern option, so this works: azcopy copy C:\{directory}\* --include-pattern *.zip;*.tar.gz;*.py

Azure InvalidTemplate Error: The language expression property array index '1' is out of bounds.

I'm trying to spin up a Redis Cache in Azure and placed it in my Virtual Network. However, it threw an error and the error message was not helping but I eventually figured it out. Here's my Bicep template which threw an error: resource cacheSubnet 'Microsoft.Network/virtualNetworks/subnets@2023-11-01' existing = { name: 'mySubnet' } resource redis 'Microsoft.Cache/redis@2023-08-01' = { name: 'myRedis' location: resourceGroup().location properties: { enableNonSslPort: true publicNetworkAccess: 'Disabled' sku: { capacity: 1 family: 'P' name: 'Premium' } subnetId: cacheSubnet.id } Apparently, I needed the parent field on the subnet reference, so I ended with the following template which successfully launched my Redis cache. resource vNet 'Microsoft.Network/virtualNetworks@2023-11-01' existing = { name: 'myVNet' } resource cacheSubnet 'Microsoft.Network/virtualNetworks/subnets@2023-11-01' existing = { n...

AWS EC2 Can't Reach EC2 Metadata Service After Subnet Change

Just another black box day. I had to move an EC2 instance to a different subnet, so I created an AMI out of it and launch it on a different subnet. Everything went well and it has no issue reaching the internet, but apparently not everything went well. The AWS agents such as SSM agent and CodeDeploy agent in the instance stop working. After checking the logs, they can't access the EC2 metadata. Since this is a Windows Server 2019 instance, it also shows that it is not activated, which is strange. On the following article, I found out that my issue was due to the "Gateway Address doesn't match that of the current subnet". https://aws.amazon.com/premiumsupport/knowledge-center/waiting-for-metadata/ Running the suggested command fixed the issue: Import-Module c:\ProgramData\Amazon\EC2-Windows\Launch\Module\Ec2Launch.psm1 ; Add-Routes

App.config File Transformation in Azure DevOps

Utilizing the right tool for the right job makes life easier. That also means we have to keep learning and exploring new tools. For some if not many of us, we probably wish we can do config file transformation on app.config for various environment just like web.config. To do that locally, we can use something like SlowCheetah , but in my case, I want to do it before deploying to the server.  So I use Azure DevOps  File Transform task . Learning from my experience with web.config, I added couple of transformation file such as App.Prod.config. It took couple of tries for me to get it working right and the following are the steps I take: Add transformation file and set its Copy to Output Directory property to Always. Since App.config is usually renamed to <ApplicationName>.exe.config and File transform task requires config files to follow certain naming pattern, for example, App.<environment>.config can only be used to transform App.config, I set  Copy to Output...

NullReferenceException on VB.NET Anonymous Type

As much as we talk about decoupling in computer world, it is probably quite impossible to achieve. The best thing we can do is reduce coupling. But my point is actually on how fragile our code is nowadays. Seems like I have to keep relying on workarounds just to keep the application working. I have a working anonymous type and there is no change on that particular line. It looks like the following: Dim theValue = SharedFunction.GetValue() Some changes on the project, however, has nothing to do with that particular line of code. I switched to VS2019 instead of VS2017 and update Nuget packages without touching that code. The project builds successfully. But during runtime, that particular line threw NullReferenceException. At first, I thought it is my shared function, but it worked great when I ran it on Immediate Window. Few other things are the project is using .NET Framework 4.6.2 and the problematic code is nested inside an if statement which is nested inside #If directive. ...

Retain Web.Config Transformation Files in Azure DevOps

Documentation is never enough and it will never be able to keep up with the change. The only way to really find answer to a problem is to experiment. I have a simple task. Keep the web.config transformation files during build pipeline in Azure DevOps so I can use them to transform the web.config during release pipeline to customize by environment. By transformation files, I mean files such as web.Release.config.  I had it working by adding a copy task in Azure DevOps but it was just a workaround, so I'm trying to find a more elegant way on doing the same thing. At first, I only set the Build Action of each transformation file to Content. It is supposed to be included during deployment. However, after build is done, I noticed the transformation files were discarded and thus not included. After few trial and error, the steps that work for me are: Setting the Build Action to Content for each transformation file Remove <DependentUpon> tag of each transformation file in project fi...