#code

April 5, 2024 • 1 min read
Have you ever needed to modify a file locally without committing the changes to the remote repository?

December 1, 2020 • 1 min read
The binary search algorithm quickly searches a large array of numbers, it’s often referred to as divide and conquer.

November 25, 2020 • 2 min read
Continuous Integration (CI) and/or Continuous Delivery (CD) is the norm on software projects these days. There are many build servers such as Azure DevOps, TeamCity, Jenkins, and Cruise Control.Net.

October 23, 2020 • 6 min read
Below is a collection of tools, libraries, and resources I commonly use.

August 5, 2020 • 3 min read
Each engineer defining a new string column decides: Do I use nvarchar or do I use varchar?

July 27, 2020 • 1 min read
Changing a React input value from vanilla Javascript is not as simple as you might think.

November 20, 2019 • 3 min read
The [FromServices] attribute allows method level dependency injection in Asp.Net Core controllers.

November 3, 2019 • 4 min read
Microsoft is adding a new feature to C# 8 called Nullable Reference Types. Which at first, is confusing because all reference types are nullable… so how this different? Going forward, if the feature is enabled, references types are non-nullable, unless you explicitly notate them as nullable.

October 27, 2019 • 6 min read
Naming is subjective and situational, it’s an art, and with most art, we discover patterns. I’ve learned a lot through the reading of other’s code. In this article, I’ve compiled 9 guidelines I wished others had followed when I read their code.

October 13, 2019 • 2 min read
There’s a heated debate around single statements and whether they should have curly braces or not.

September 30, 2019 • 4 min read
Understanding code is the first step to modifying it.

September 15, 2019 • 5 min read
Codifying the secret sauce is instrumental in writing maintainable and successful applications.

September 1, 2019 • 4 min read
Memory management in modern languages is often an afterthought. For all intents and purposes, we write software without nary a thought about memory. This serves us well but there are always exceptions…

August 18, 2019 • 1 min read
Your code reflects neither your beliefs, nor your upbringing, nor your character.

August 5, 2019 • 1 min read
In C# the question mark has 5 meanings as of C# 8.

July 21, 2019 • 2 min read
Have you had to compare two collections and execute some logic based on whether the item is in the source collection, in the comparing collection or in both? Yeah, me too, I needed to merge data from the UI and the database. I couldn’t find a good solution, so, I wrote a collection comparer.

July 7, 2019 • 4 min read
At some point in an application’s development, usually, fairly early on, you realize the application is slow. After some research, the culprit is, unnecessarily retrieving the same data, and a light goes off, and you think: “I need some caching.”

June 23, 2019 • 1 min read
If you must run code in a constructor. I’d look for a different way, but if you must, here’s one way.

October 30, 2017 • 2 min read
This was one of the more frustrating issues with Angular 2/4/+. It’s not an issue with Angular 2/4/+ per se, but with how webpack bundles the supporting HTML files.

December 6, 2015 • 10 min read
For nearly 50 years, the switch statement (also known as the case statement) has been an integral part of programming. In recent years, however, some are claiming that the switch statement has outlived its usefulness. Others go even further by labeling the switch statement as a code-smell.

November 17, 2015 • 9 min read
Writing software is a battle between complexity and simplicity. Striking balance between the two is difficult. The trade-off is between long unmaintainable methods and too much abstraction. Tilting too far in either direction impairs code readability and increases the likelihood of defects.

April 26, 2015 • 2 min read
I’ve been on my project for over a year and it has significantly grown as an application and in data during the year. It’s been nonstop new features. I’ve rarely gone back and refactored code...

March 1, 2015 • 2 min read
In a recent conversation, a friend mentioned he creates proof of concepts and then discards them after testing their viability. I’ve done the same in the past. This time it didn’t feel right. I cringed when he said he threw away to the code. Maybe my days as a business owner has turned me into a froogle goat, but it felt like he was throwing away value.

February 14, 2015 • 6 min read
At some point an application needs authorization. This means different levels of access behave differently on a web site (or anything for that matter). It can be anything from seeing data to whole area’s that are not accessible by a group of users.

January 28, 2015 • 3 min read
A great code review will challenge your assumptions and give you constructive feedback. For me, code reviews are an essential part in growing as a software engineer.

January 1, 2015 • 5 min read
Most of us probably don't think about the developer who will maintain our code. Until recently, I did not consider him either. I never intentionally wrote obtuse code, but I also never left any breadcrumbs.

November 3, 2014 • 5 min read
Have you ever had to encrypt data in the database? In this post, I’ll explore how using nHibernate Listeners to encrypt and decrypt data coming from and going into your database. The cryptography will be transparent to your application.

October 16, 2014 • 2 min read
One of the weaknesses of Entity Framework 6 Code First is the lack of support for natively calling database constructs (views, stored procedures… etc). For those who have not heard of or used Code-First in Entity Framework (EF), Code-First is simply a Fluent mapping API.

March 26, 2014 • 5 min read
The problem is a the nHibernate’s `CreateSqlQuery` needs a complete sql string to be created, but you can’t create a string until you’ve evaluated the parameters. The only work around is to evaluate the conditional parameters to create the sql string to create the nHibernate session and then revaluate the parameters again to add them to the `nHibernate` query object.

December 18, 2013 • 6 min read
In the Visual Studio 2012 version of Crystal Reports 13 there is a threshold that throttles concurrent reports, this also includes subreports, to 75 reports across a machine. This means if there are 5 web applications on a given server all opened reports across all 5 web applications counts toward the 75 report limit.

March 21, 2013 • 2 min read
There is an underlining philosophy in this system that nulls are bad. In most cases where a null can be generated an exception is thrown. At first I did not see a problem with this. I saw it as an architecture decision, an aesthetic, but as I interface with the code, it’s apparent to me it’s an architectural mistake.

May 22, 2012 • 1 min read
To use a runtime type with an IOC container like StructureMap to find a generic implementation, create the generic type using `MakeGenericType` and then retrieve the instance from the container using `_container.GetInstance(type)`.