Debugging Unfamiliar Code

Yesterday I had the opportunity to debug a problem with our document builder. It was my first time debugging this project. I had no idea where the issue was or where to start looking. In this case, I asked for help and Robert point me in the right direction.

First Hour

Frustration. It is human nature to be frustrated when you don’t know how something works. Remember the last time you were lost in a new city. Or the time when you assembled furniture but you end up with too many parts. After looking at the code, it did not make any sense to me. It was a lot of code to digest and find the problem. I searched for the work “GOLD VENDORS” in our codebase and nothing was returned. At this point, I know for sure the issue is coming up from a database table.

Second Hour

After my first hour of frustration, I knew that the issue had to be coming from the database. But which database Sybase or SQL Server? The only way to know is to actually read the code and step into it until you find it. My friend Robert gave me the project name responsible for building this document so that narrowed my search and focus. The issue is somewhere in the middle of the document. Header, table of contents, and footer look correct. I commented out different sections to see where the issue was. Still no luck. I know that I’m very close. I just need to continue. I can see the light at the end of the tunnel.

I continued to comment out code until I see the section and the problem. Now I know the C# method responsible for this bug.

Third Hour

Excitement. I’m excited at this point. I know the method causing this issue and now it’s a matter of fix it. I spent the next hour inspecting variables and see a lot HTML with the word “GOLD VENDORS” in it. I found the smoking bug. I have evidence and can take this code to trial. I kept digging into the codebase and found the table named “document_maintenance”. I’m 100% sure that the issue is coming from the database and also know the table name.

I asked Robert, “Do you know a table name document maintenance?.” He replies, “yes, that’s where we keep document templates”. We opened the document and find the word “GOLD VENDORS”. Finally.

My friends gives me a brief history of the document templates and we close this bug. User error not a bug.


I’m glad I had the opportunity to work on this ticket. It gave me a chance to work on a new project. I went from being frustrated to being excited. It also gave us an opportunity to transfer knowledge. Happy debugging!



Best Time to Review Code

Today it’s the last day in our 2 week sprint. We focus on getting stories from peer review to a development complete status. As I was thinking about the last day of our sprint, a question came to me: when is the best time to review code? Mornings? Afternoons? Middle of the day?

One of the most important thing for me is to not lose concentration on the task in front of me. I usually put my headphones on and focus on my task. Headphones block distractions and noise around the office. When it comes to reviewing code, I prefer to do it with a fresh mind and a cup of coffee.

I prefer to review code during the mornings. I have a fresh mind and that helps with concentration and focus. If I perform a code review during the afternoons, I’m usually tired and have seen different projects. My brain has absorbed so my things that it takes me more energy to do my job.

What abou you? When is the best time to perform code reviews?

AWS Cloud General

How to migrate your wordpress blog from Bluehost to Amazon Lightsail

My first blog post was created back in April 25, 2014. I had used Godaddy before but I wanted to try a different host. After my research I decided to host a WordPress blog using Bluehost. Bluehost is a great host and I highly recommend them. One of the great features they have is automatic backup of your WordPress site and MySQL database.

Why migrate?

Lately, I’ve been studying to take the AWS Certified Developer Associate exam. To force myself to learn AWS in depth, you have to use it frequently. That’s why I decided to migrate my blog from Bluehost to Amazon Lightsail. With Lightsail, it is very simple to create a WordPress site. You select the WordPress for your instance image, select a plan, and finally name your instance.

Here are the steps I took to migrate my WordPress blog from Bluehost to Amazon Lightsail:

Website Backup

Since Bluehost provides daily backups of my WordPress site, the only thing I had to do was download the public_html folder. This folder contains all files needed to run WordPress. If you are using a different host, you can find your WordPress folder by searching for wp-admin, wp-content, and wp-includes folders. Once you find these folders, backup the parent folder.

MySQL Database Backup

For the database backup, I also downloaded the backup files provided by Bluehost. There is a sql script to create the database and another sql script that contains the actual data we want to migrate to Lightsail. In my case, I only kept the file that contains the insert statements to migrate the data.

Create Lightsail Instance

This is a simple process. Go to Amazon Lightsail console, and click on Create Instance. Then select Apps + OS, WordPress, select a plan, and name your instance. It is that simple.

Setup FTP Access

By default, Amazon Lightsail has ports 22, 80, and 443 open. However, if you try to connect to your instance, it will not work. To have FTP access to your instance, download your default private key. Once you have the .pem file, upload it to your FTP client. In my case I used Filezilla and was able to connect and copy files.

Copy files and Migrate Data

Since Amazon Lightsail created a new WordPress site, I refused to restore those files from my Bluehost backup. I compared both sites and I noticed files that were only used by Bluehost. I decided to only copy files needed for this migration to work. The first file was wp-config.php, which contains the database username, password and other settings. I modified this file to contain Lightsail’s database information. I also copied the sql script to migrate the data. After copying this file, I was able to connect using SSH and ran the script against the MySQL database.

DNS Changes

With the data migrated from my old Bluehost database to the new database, it was time to make the DNS changes. I first went to Bluehost and update the nameservers to point to Amazon. After doing that, I created a DNS zone in Lightsail console and A records for solutionsbyraymond and

As you can see, it was a very simple process to migrate from Bluehost to Amazon Lightsail. At the beginning it took hours to read the documentation but at the end I had no issues with the migration. I hope this helps other developers trying to migrate to Lightsail.


Log4net releases 2.0.6

On December 25th, the log4net team released version 2.0.6. This release includes support for .Net Core version 1.3 and other bug fixes. To see the full release notes, go here.

The team is also looking for contributors. I had the opportunity to helped the team by submitting a patch for issue 527 It was a minor fix but I know for sure that the log4net appreciates any help.

My hope is that more developers contribute back to this project and make it even better as we entered 2017.






Log4net Support for .Net Core

Logs are very helpful when it comes to troubleshooting problems. One of the most popular logging libraries is Apache’s log4net. With the recent release of .Net core, libraries need to make changes to accommodate it. In this post, I want to inspect the commit that takes log4net closer to support .net core.

The source code is hosted by Apache at and it uses Subversion. They also have a git mirror at

Now that you know where the code is, let’s inspect the major changes for this revision.

After getting the source code from the subversion repo, take a look at revision 1756257 that happened on Saturday August 13 2016 at 7:47am by chlowell. There is a brand new folder dedicated to .Net core called netstandard which is found in /logging/log4net/trunk/netstandard. Here you will find global.json, log4net.xproj, project.json, and others files.

Now let’s take a look at existing files that were modified to support .Net core. ConsoleAppender.cs line 123 has the following change:

if (CultureInfo.InvariantCulture.CompareInfo.Compare(ConsoleError, v, CompareOptions.IgnoreCase) == 0)
if (string.Compare(ConsoleError, v, true, CultureInfo.InvariantCulture) == 0)

Here the code is checking for a very specific .Net core version 1.3 and if the end user has that version available, the library will be compiled with that block of code.
If you continue with the other modified files, you will see similar code.

As you can see, there was a lot of code changes needed to get the initial support for .Net core. However, this open source library needs help to move forward. We need help testing these changes, updating documentation, etc.

I’m in the process of sending a pull request to have a beta version to nuget soon. Having a beta version in nuget will make it easier to test it and provide feedback.


AWS CodeDeploy Invalid Signature

I’ve spent a lot of time trying to find the root cause for an issue while using AWS CodeDeploy.

The error message was invalid signature, the requested signature does that match the request.

The strange thing is that my code did not change and it was working before. So I created a new aws user with full permissions on S3 and CodeDeploy actions. I also downloaded the latest cli tool. After that I setup the profile to use my new aws user. I have a simple batch file that calls aws deploy push and then it calls aws deploy create-deployment.

When we use aws deploy push, we are creating a new revision and also the zip file gets copied to the s3 bucket.

The strange thing with these calls was that I was getting a confirmation message that included the new deployment id. I had to admit that the error message did not help me find the root cause. Invalid signature?

After a few days researching online, another user had the same issue and he shared that it was related to the S3 bucket and key.

The S3 bucket was not correct because it contained bucket name plus project name and configuration. The bucket name should only contain a bucket name and nothing else. Then I updated the key to be in format [projectname]/[configuration]/[key]. In our project the key was website/dev/

After triggering test builds, I was able to verify our deployments were running successfully.

Hopefully aws can change the invalid signature and provide the specific parameter causing the error.


Using Flyway to Manage Database Changes

Flyway is an open source project that let’s you manage your database changes. In simple terms, it helps us migrate database changes from one environment to another environment. Currently our team is working on a new project that it’s using Postgresql, ASP.NET MVC, and WebApi. When we started the project, we did not have an easy way to manage database changes. At the beginning, we decided to create sql files to manage database changes. We were able to capture the database changes but it was difficult to migrate changes. After some time researching database tools, we decided to use Flyway.

In this post, I want to share how simple is to setup Flyway in a windows environment.

1. Install Flywaydb command line tool
Go to and download the command line tool. When you are done installing the cli, go ahead and add it to your path. I highly recommend it so you can run flyway from any directory.

2. Setup folder structure
We have 3 environments that we need to deploy to: development, test, and production. To make our lives easier, we create a conf folder and inside that folder we create dev, test, and prod folder. Each environment folder will have the configuration file to connect to the specific database.

For dev, we created a post-build step that will run the migrations automatically. For test and production, we will run them manually. We do this because we need to be more careful about those environments.

3. Run migrations
When you are ready to apply the database changes, you can open up a new console window and type “flyway migrate” and press enter. This command will run all pending changes to the specific database. The nice thing about Flyway is that it keeps track of all the versions or migrations thru the schema_version table.

In the next post, I will share a sample project that demonstrate how to use Flyway to manage Postgresql changes in a windows environment.

.Net code review General

My top 3 ReSharper keyboard shortcuts


Recently I had a chance to upgrade ReSharper, a visual studio plugin to help .NET developers be more productive. If you are not using ReSharper, you are missing out on lots of features. In this post, I want to share the top 3 ReSharper keyboard shortcuts that help me write better code.

1. Go To Implementation [Control Shift Alt B]
This is one of my favorites ReSharper keyboard shortcuts. In my current project, we use interfaces extensively. Using interfaces help us write unit tests around our classes. When we are debugging, the go to implementation keyboard shortcut is a must have tool. Many times we read stack traces and we know the method name and it is there that we start our debugging process. To use Go To Implementation, right-click on a method and select the Go To Implementation from the pop-up menu. If you are like me and prefer to use keyboard shortcuts, press control shift alt b at the same time. I try to memorize these shortcuts so I can keep my hands on the keyboard.

2. Go To Declaration [Control B]
If you want to go where a method has been declared, right-click on the method or class that you want to inspect and select Go To Declaration. The keyboard shortcut for Go To Declaration is Control + B.

3. Find Usages Alt F7
This key comes very handy when you are about to make changes and want to see all possible changes. If I have to refactor a piece of code and see a lot of usages, most of the time I will not modify that code but instead create a new method or class. To use the Find Usage tool, right-click on your code and select Find Usages or Alt + F7.

I hope you find these shortcuts helpful while writing .Net applications. In a future post, I will write how to use ReSharper to perform code reviews.
code review General

Things I do before a code review

If you have contributed to an open source project, you probably know what a code review is. Github is a great platform to experience code reviews. By default, only project owners have write permissions. For collaborators, the first thing they have to do is fork a project. Once they have their own project with write permissions, they can add new features or fix a bug. When the code is ready for a code review, a pull request is created to start the review process.

In this post, I want to share what I do before submitting my code for a code review.

1 Test my own code

By default, software developers are not good testers. We put our energy and effort on writing code and verifying that requirements get met. But when it comes to code reviews, it is important that your code works as expected. Go thru all the pages you have modified and test them. Try to break your own code. For example, if you have an input that takes only numbers, try to enter strings or add more than 5 decimal places.

2 Clean up

Before I submit my code for a formal review, I pay special attention to comments. Sometimes comments do not reflect what the code is currently doing. If this is the case, I update the comments or remove them entirely.

Another area that I like to clean up is the using statements at the top. If you no longer use a library, it is a good idea to remove it. If you do remove something, make sure to rebuild your projects.

3 Make code more readable

Have you seen code without blank lines in it? I see it all the time. For example, a Javascript function made up of 20 lines but there is no blank lines in it. This makes it very difficult to read it. For the sake of everyone in your team, add blank lines to help code reviewers read the code.

4 Verify unit tests

After you go thru the clean up process, I recompile and run all unit tests. We have a Jenkins server that handles our continuous integration. As part of that build process, all unit tests are run. The last thing you want to do is submit your code for a peer review when unit tests are not passing.


If you are not using code reviews before your code gets into production, you are doing a big mistake. Code reviews allow teams to identify bugs early on. It is more difficult to fix bugs once they make it into production. And they are also more costly. Code reviews also keep your code consistent and clean. Not all companies use code reviews but they are a great tool to keep a clean and stable code base.


How do I keep my skills up to date

Technology is always changing. New products are created everyday. How do you stay current with all these changes? When it comes to software development, we have to ask ourselves the same question.

In this post, I want to share what I do to keep my skills up to date.

1.  DotNetRocks
If you are a software developer and not listening to Carl and Richard, you are not taking advantage of all the information that it’s shared by this podcast. This is my number one way that I stay relevant in my profession. At the beginning, DotNetRocks was mainly about .NET framework, ASP.NET, and Microsoft technology. But in recent years, I have seen more interviews related to Javascript, DevOps, Continuous Integration, Continuous Delivery, and other topics. After every show, I visit any links provided in the show notes. There is always something good there.

2. Scott Hanselman
Scott Hanselman has the best technology blog. He shares important announcements related to ASP.NET and the .NET Framework. In addition, he is always exploring cool open source projects. I also listen to his podcast, hanselminutes. As of this writing, the podcast has 510 shows and all of them are great. I highly recommend software developers to listen to this podcast. It will help you stay current and relevant in technology.

3. Cloud
You have to keep up with the latest change on the cloud. For me, there are 2 major players in this are: AWS and Azure. With more companies moving their infrastructure to the cloud, there is a high demand for professionals that understand the cloud. At MDBuyline, we have projects hosted in our data center and some projects at AWS. Recently, I decided to invest more of my time understanding the different services provided by AWS. I usually learn by doing and it’s a good way to gain the experience needed to pass the certification exams. I believe all software developers need to have hands on experience with the cloud.

4. Open source software
We have to thank Github for hosting open source projects for free. I like to spend time reading the source code for these libraries. Lately, I have spent time reading the source code for Knockout JS. If you read the documentation for any project, it is easy to get started. However, when you run into issues with the library, it is necessary to read the source code. In addition to reading the source code, I like to contribute back to them. I have had the opportunity to contribute back to Django, a very popular Python framework for building web sites. I also had the opportunity to give back to the Ruby community by sending a pull request to Rspec. Giving back to the open source community will help you stay current with those libraries.

5. Sharing
Twitter is a good way to share interesting pages. There are great sites being shared thru twitter. Another way that I share relevant information is thru this blog. I have written articles related to Python, Ruby, Javascript, and ASP.NET. Writing forces me to spend time researching and taking notes so I can write more effectively.

6. Pluralsight
This is one of my favorites resources to stay current in my profession. When I’m using new technology, I spend time with Pluralsight and watch the videos related to that technology. It helps me understand the basics so I can build on top of that knowledge.


It is difficult to stay current in technology. It is always changing. It is always evolving. The same is true for software development. To keep my skills up to date, I listen to podcasts, read blog posts, read open source projects, and take courses thru Pluralsight. Let me know what you do to stay relevant in software development.