Categories
General

Remote Work During Coronavirus

It’s been a couple of weeks working exclusively remote. The entire company is working remotely and in this post I want to share what has worked for me.

Before the coronavirus outbreak, our company had a remote policy in place. In my group, some of my colleagues took advantage of this remote option. I like having the flexibility to work remotely 1 or 2 days per week. The commute time is nice as well. There is no traffic to worry about and you save in gas. I can continue with more benefits but I want to share what I’m using to stay productive.

Teams is our collaboration tool of choice. We have our daily stand-up and it has worked great during this time. When we have to collaborate on a project, we share our screens and brainstorm on solutions. There is also less distractions while working remotely.

One of the drawbacks of working remotely is that you missed some of the company perks. Our company has different kind of coffee flavors. I really miss my cappuccino. I also miss going for a walk outside our Addison office. And finally, I also missed the interactions with my colleagues during lunch.

I hope everyone works together in fighting the coronavirus. My thoughts and prayers are with our healthcare workers.

God bless.

Categories
.Net Azure SDK

Integrating Azure Services to your own project

In this post, I want to share what options do we have as software developers to integrate Azure services to our own projects.

Go to https://azure.microsoft.com/en-us/downloads/
and see that we have couple of options or tools to integrate Azure services. First, we have the Unified SDKs. The Unified SDK is the new and improved SDK from the original Azure SDK. It is available in Java, Python, .NET, JavaScript / TypeScript. 

Next, we have the original SDKs. It is available for Go, Java, PHP, Python, .NET, and JavaScript / TypeScript. 

If you enjoy working on a terminal / command window, Azure also has command line tools. Currently there 4 tools in this space:  Azure command-line interface, PowerShell, AzCopy Command-Line Tool for Azure Storage, and Azure Storage Emulator.

In addition to SDK and command line tools, Azure has standalone tools. Currently, there are 3 standalone tools: Azure Storage Explorer, Azure Data Studio, and Azure CloudShell.

If you don’t see your programming language listed here, let me know how you have integrated Azure services into your project. 

 

Categories
General

If Else Statement in 10 Different Programming Languages

I have written code in many programming languages. Some languages have strange syntax while others invite you to write more code. In this post, I want to write if else statements in 10 different languages so you can share what you like or dislike about each language.

Python

amount = 0
if amount < 0:
print('Negative amount')
elif amount > 0:
print('Positive amount')
else:
print('Zero')

Java

int amount = 0;
if (amount < 0) {
  System.out.println("Negative amount");
} else if (amount > 0) {
  System.out.println("Positive amount");
} else {
  System.out.println("Zero");
}

Ruby


amount = 0
if amount < 0
puts "Negative amount"
elsif amount > 0
puts "Positive amount"
else
puts "Zero"

C#

int amount = 0;
if (amount < 0) {
  Console.WriteLine("Negative amount");
} else if (amount > 0) {
  Console.WriteLine("Positive amount");
} else {
  Console.WriteLine("Zero");
}

Swift

let amount = 0
if amount < 0 {
print("Negative amount")
}
else if amount > 0 {
print("Positive amount")
}
else {
print("Zero")
}

Objective-C

int amount = 0;
if (amount < 0) {
  NSLog("Negative amount");
} else if (amount > 0) {
  NSLog("Positive amount");
} else {
  NSLog("Zero");
}

Go


amount := 0
if amount < 0 {
fmt.Println("Negative amount")
}
else if amount > 0 {
fmt.Println("Positive amount")
}
else {
fmt.Println("Zero")
}

Javascript

const amount = 0;
if (amount < 0) {
Console.Log("Negative amount");
}
else if (amount > 0) {
Console.Log("Positive amount");
}
else {
Console.Log("Zero");
}

Rust

let amount = 0;
if amount < 0 {
print!("Negative amount");
}
else if amount > 0 {
print!("Positive amount");
}
else {
print!("Zero");
}

C++

int amount = 0; 
if (amount < 0) {
cout << "Negative amount";
}
else if (amount > 0) {
cout << "Positive amount";
}
else {
cout << "Zero";
}

There you have it. If else statement in 10 different programming languages. Leave me a comment with your favorite language.

Categories
Azure Container Instances Container Registry Docker

Deploy Angular App to Azure Container Instances.

Azure Container Instances, Angular 8, Docker

As I continue my quest to learn more about Azure services, I have decided to play with Azure Container Instances. In this post, I will share how to take a simple app, integrate Docker, and finally deploy it to Azure Container Instances.

First, let’s create a new Angular app using Angular CLI command ng new angular8docker. If you want to see the Angular app, take a look at this repo https://github.com/agileraymond/angular8docker.

Now that we have our app in place, let’s integrate it with Docker. So what is Docker? Let me share opensource.com’s definition, “Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. By doing so, thanks to the container, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code.”

To integrate our Angular app with Docker, we need to add a Dockerfile. Dockerfile is a file that tells Docker how to build an image.

This file tells Docker to base the image from node:12.2.0. WORKDIR sets the working directory for our app. Next we set the path for our node modules. The COPY command copies package.json file to our app/package.json. Next, we run 2 npm install commands: one installs our app dependencies and the second installs angular cli tool. Next we copy entire contents to /app directory. And finally ng serve to run our app.

We have a very simple Dockerfile. If you want to learn more about this file, visit https://docs.docker.com/engine/reference/builder/. In addition to the Dockerfile, we also need to have a .dockerignore file.

This file tells Docker to ignore these files or folders. We are ignoring node_modules, .git and .gitignore. Using a .dockerignore file will keep our app small with only files needed to run it.

At this point, we are ready to build our app. Make sure you have Docker Desktop setup on your computer. Using a terminal, run “docker build -t angular8docker .”. This command will build our image by reading the Dockerfile and tag it as angular8docker.

After our image has been created, we need to run the app locally. On a terminal window, run “docker run -p 80:80 angular8docker”. This command will run our app by publishing port 80 to the host and will use angular8docker image. Very simple. Now using a browser, go to http://localhost and you should see your angular 8 app.

Now let’s host this app on Azure Container Instances. I’m going to use Azure CLI on this post so make sure you have the CLI installed locally. First we need to create a resource group. Run this command on your terminal: “az group create –name myResourceGroup –location eastus”. With our resource group in place, we can create our container registry with this command “az acr create –resource-group myResourceGroup –name angular8docker –sku Basic –admin-enabled true”.

We have to login to our container registry before we can push images to it. Use this command: “az acr login –name angular8docker”. If the login request was successful, you will receive a successful message otherwise an error message. Now let’s get our login server using this command “az acr show –name angular8docker –query loginServer –output table”. In my case, I received my loginServer as “angular8docker.azurecr.io”.

Now we need to see a list of our docker images with this command “docker images”. This will help us tag the image and associated with our container registry. Use this command to tag it: “docker tag angular8docker angular8docker.azurecr.io/angular8docker:v1”.

Run docker images again to verify the tag.

Finally let’s push our v1 image to Azure Container Registry with this command: "docker push angular8docker.azurecr.io/angular8docker:v1"

With our docker image in our Azure Container Registry, we can create an Azure Container Instance to run our angular 8 app. Run this command to create container instance “az container create –resource-group myResourceGroup –name angular8docker –image /angular8docker:v1 –cpu 1 –memory 1 –registry-login-server angular8docker.azurecr.io –registry-username angular8docker –registry-password <password> –dns-name-label rayangular8docker –ports 80”. After couple of minutes, you will receive confirmation message.

Find the FQDN in the confirmation message above and open up a browser window to see your app online. If you don’t see your app online double check port settings. Let’s do a final clean up so we don’t incur additional cost. Run “az group delete –name myResourceGroup” and all resources attached to this group will be deleted for us.

In a future post, I will show you how to troubleshoot Azure Container Instances.


Categories
Azure Cloud

Creating a Virtual Machine using Azure Portal

At work, we use Azure as our primary cloud provider. Our infrastructure runs on Azure and there is a need to learn Azure and its services. With my AWS background, I believe it is going to help me gain a deeper knowledge of Microsoft’s cloud. In the past I have written about Azure but now I want to start preparing for Azure certifications. I need to drink Azure Kool-Aid. I want to start this process by creating a virtual machine.

Let’s create a virtual machine using Azure Portal.

Azure Portal - Create Virtual Machine - Basics
Azure Portal – Create Virtual Machine – Basics

Fill out your basic details like operating system under Image. Here you have linux and windows machines. For this post, I’m choosing an ubuntu server. After completing required inputs on basics tab, I move on to the disk section. Here I accept default parameters. I continue with networking, management, advanced, tags, and finally review and create.

Azure Portal - Virtual Machine - Review
Azure Portal – Virtual Machine – Review

After creating my virtual machine, I noticed that my server is ready within 2 minutes. At this moment, I’m curious what resources were created. At the top of the list, I see my virtual machine. I also see network interfaces, storage account, network security group, virtual networks, and public ip addresses.

Since I’m not going to use this virtual machine, I will delete this resource so I don’t get charge for it. In a future post, I’m going to explore the .NET SDK and create a virtual machine writing C# code.

Categories
AWS EBS EC2 KMS

Easy way to encrypt EBS volume

Back in January 2019, I wrote an article on how to encrypt an EBS volume. It was a very tedious process. However, things have changed for good. AWS has simplified this process. In this article, I want to share how easy is to encrypt an EBS volume.

Before we launch a new EC2 instance, we need to use a key. Just like you lock and unlock your house door using a physical or digital key. Same principle applies to encrypted EBS volumes. To create a new KMS key, go to the key management service console and select customer managed keys from the left side menu.

Now create a new key. Once you have a new KMS key, we can launch a new EC2 instance. When you get to the storage option, pay attention to the encryption option. 

As you can see from image above, you will see your KMS keys in the encryption option. Go ahead and select a key and continue with your EC2 configuration wizard. 

That’s it. We have to be thankful to AWS for making this process easier. 

Categories
General

Advice for JR software developers

Back in 2007, I went to work for a startup company. It was my first job in IT. I did everything from desktop support, software development, and server maintenance. After a year and a half, I decided to leave this company so I can focus more on software development. In this post, I want to share tips on how to find great companies where developers can grow and advance their careers.

Find a Mentor
When you are starting your career as a software developer, there are many questions on how to do your job. What tools to use? What process to follow? How to write clean code? All of these questions can be answered with the help of a mentor. When I joined PrintPlace back in 2007, the company was in rapid growth mode. There was not much time to train or develop people. After my first year with the company, I knew that I needed to find a company where I can have access to mentors. I was fortunate enough to work with the CTO of the company. After PrintPlace, I joined Ristken, a software company that specialized in the auto industry. The IT group was made up of 10 developers, 3 QA, and IT director. In this company, I was able to work with the software architect and learned a great deal about software development. He was a very patient person that had the heart of a teacher. I also learned from the other developers in the company. Many came from different countries and that made conversations interesting. In addition to these mentors, I also watched youtube videos on software development. This is where I found my online mentor, Scott Hanselman. Before Scott joined Microsoft, he works at a bank. He shares valuable info thru his blog and podcast.

Promotions
I’m not a big fan of the title of JR developers. I prefer software developers. When it comes to promotions, you have to find companies where you can develop your skills and grow. Ask other developers in your team when was the last time they were promoted. In a healthy organization, promotions have to be open within the organization. Let me explain this point. If the company needs to hire a senior developer, do they look within or they go outside to find that talent. Make sure you see a path to go from JR developer to mid-level and then to senior developer / architect. If you are in a small company, there might be less opportunity to advance your career. You might have to look at a mid size company with a good track record of promoting within.

Skills
In this career, you have to always be learning something new. Technology that does not advance, it’s technology that stays behind. Nowadays I’m seeing entertainment services moving to on-demand streaming. With this change, there will be less demand on DVD players for example. Is redbox going to stay competitive with their business model? We, as software developers, face the same challenge. We have to stay relevant with current technology changes. Currently Cloud and DevOps come to mind. If you have experience with cloud computing, your skills are in high demand.

See you next week.

Categories
AWS

AWS Solutions Architect – Associate

After a very long process, I was able to take and passed the AWS Certified Solutions Architect Associate exam. In my current job, we don’t use AWS and that made it more difficult to gain hands on experience with AWS services. To prepare for the exam, I used 4 resources:

Acloudguru – I took at least 30 minutes to watch acloudguru videos. I also paused the videos to take notes. It is so many material to cover so it’s better to have notes for future use.

Frequently ask questions – There is so much information on AWS FAQ documents. Based on the acloudguru videos, I wrote down what services I needed to read the FAQs. I highly recommend to take additional notes as well. It will come handy before you take the exam.

Re:Invent videos – During my commute to work and back, I use my phone to listen to re:invent videos. I listened to EC2, S3, ALB videos and they were very beneficial to reinforce what I learned in the past.

Hands on experience – I also gained hands on experience by using AWS console or using the SDK. If you search on my blog, you will find many posts with detailed information on different AWS services.

I hope this post will help you prepare for any AWS certifications.

Categories
General

The Overnight Success that took 4 years

Back in April 2014, I started this blog to share my experiences as a software developer. I was motivated to write by Scott Hanselman. Many articles took long hours to write. Others were written in a couple of minutes. Without a clear goal for this blog, I was determined to help other software developers with common issues. In average, I receive 10 visits to my blog everyday. Recently I have written exclusively on AWS and .NET. Last year I read articles on AWS Lambda and was very impressed with this service. I also watched youtube videos to understand lambda. With this information, I started taking notes on lambda and how to use it with .NET Core.

After I shared this article on Linkedin and Twitter, AWS liked it and they included it on https://github.com/aws/aws-lambda-dotnet with a short description. This link is taking my blog to a new dimension. I’m getting more visits to my site and I’m happy that someone is starting to appreciate my articles.

It’s been a long 4 years writing technical articles and it’s finally paying off. Like many people say, “this is an overnight success that only took 4 years.”

Categories
General

How to Encrypt an EBS Volume

When you create a new AWS instance, you don’t see an option to encrypt the root volume. In this post, I’m going to show you step by step how to encrypt root volumes using the console.

First, we need to create a new AWS instance. Pay attention to the storage section. I’m unable to change the encrypted option. If you add a new volume, you will see that the encrypted option is also missing.

ebs root volume - no encryption option

Go ahead and configure your new instance. After the instance is launched, that’s when our real work begins. While the instance is in the initialization stage, go to volumes and create a new snapshot.

ebs volume - create new snapshot

Now that we have our new snapshot, we can copy it to a new region.

In this example, I’m copying this snapshot from US N. Virginia to EU London. As you can see, we have an option to encrypt this snapshot and also select a master key. Go ahead and click on copy button. Now we can switch to EU London region and go to the snapshots page.


Now we see that our London snapshot is encrypted. From this same page, select the encrypted snapshot and create a new image.

create image from encrypted snapshot

Now go to the AMIs page, select your newly created image and launch a new instance. Pay special attention to the storage section.

Our Encrypted column shows Encrypted. That’s what we want it. I hope this post was helpful to you. See you soon!