I am a junior developer. How do I handle disagreement in a code review regarding an unlikely edge case?

I am working at a robotics startup on a path coverage team and after submitting a pull request, my code gets reviewed.

My teammate, who has been on the team for more than a year, has made some comments to my code that suggest I do a lot more work than I believe to be necessary. No, I am not a lazy developer. I love elegant code that has good comments, variable names, indentation and handles cases properly. However, he has a different type of organization in mind that I don’t agree with.

What do I do? 

Continue reading “I am a junior developer. How do I handle disagreement in a code review regarding an unlikely edge case?”

Method to Copy Data Between Objects of Different Types

This article describes a method to automatically copy data from an object to another object with similar structures. This is similar to a deep_copy(source, destination) but with the possibility of returning a type that is different from the source.

I needed a way to apply/convert values from one object to another so I created a method to automatically drill down the source object graph and copy the properties from one object to another. There are many ways to do this, but I designed a method that is generic enough and also leaves place for customization/fine tuning/hacking. Continue reading “Method to Copy Data Between Objects of Different Types”

A template containing a class feature must end with a class feature

If you have had a play with the awesome Code generation tool that you can build yourself:

Walkthrough: Generating Code by using Text Templates


Then you might have had a small issue with the above error:

A template containing a class feature must end with a class feature

The error is caused by an invisible space after the last #>

It is also important to bear in mind, that invisible spaces may cause other hard-to-understand compile-errors.

If you want to see a bigger picture, just look at following links:

Now that you are aware how harmfull invisible spaces can be when dealing with Text Templates, my advice is: Make them visible. If you don’t know how to do it, see Jeef Widmer’s blog


When programming against any LDAP backend, it’s good to sanitize any user input that may go into a search filter. A typical case is authentication (login or single sing-on) applications, where an input username or email must be used to resolve a user’s distinct name (DN) in the LDAP directory. Continue reading “ESCAPING SPECIAL CHARS IN LDAP SEARCH FILTERS”

Create an Active Directory Parser based on Organisational Units (OUs)

LDAP queries look like this:

("CN=Dev-UK,OU=Distribution Groups,DC=gp,DC=gl,DC=google,DC=com");

What it means:

  • CN = Common Name
  • OU = Organizational Unit
  • DC = Domain Component

These are all parts of the X.500 Directory Specification, which defines nodes in a LDAP directory.

Each = pair is a search criteria.

With the query

("CN=Dev-UK,OU=Distribution Groups,DC=gp,DC=gl,DC=google,DC=com");

In effect the query is:

From the com Domain Component, find the google Domain Component, and then inside it the glDomain Component and then inside it the gp Domain Component.

In the gp Domain Component, find the Organizational Unit called Distribution Groups and then find the the object that has a common name of Dev-UK.

In order to list all users in this OU, you can write the following function:

public ArrayList EnumerateOU(string domainController, string OuDn, string username, string password)
 ArrayList alObjects = new ArrayList();
 DirectoryEntry directoryObject = new DirectoryEntry("LDAP://" + domainController + "/" + OuDn);
 directoryObject.Username = username;
 directoryObject.Password = password;
 directoryObject.AuthenticationType = AuthenticationTypes.Secure;
 foreach (DirectoryEntry child in directoryObject.Children)
 string childPath = child.Path.ToString();
 alObjects.Add(childPath.Remove(0, 7));
 //remove the LDAP prefix from the path
 catch (DirectoryServicesCOMException e)
 Console.WriteLine("An Error Occurred: " + e.Message.ToString());
 return alObjects;

Protecting your precious code!

Whatever your reasons are, at some stage in your development career you may want to protect your code from reverse engineering. Whether it be to stop intellectual property theft, to supply a “try before you buy” option on your software, or to stop people modifying your code; there will likely come a time where your code needs to be protected. I’m sure we’ve all had that feeling where we’ve just written the most awesome code in the world and that it now holds a special place in our heart. Imagine if someone stole that code and passed it as their own… How would you feel? We’ll go over in a “series” of articles how to avoid this heart break!

As a .NET or Java developer, unfortunately code can be reverse engineered with much ease, as demonstrated by tools such as Reflector for .NET, or Jad for Java. Of course this can also be a fantastic feature of the language depending on your viewpoint! But this series is about code protection… so what are your options? Continue reading “Protecting your precious code!”

How to create a list with hours and minutes based on interval

In the days of VB.NET I used to use two drop-downs to determine the hour and the minute of an import via the following manner:

For i As Integer = 0 To 23
ddlHour.Items.Add(New ListItem(String.Format("{0:0#}", i), i.ToString()))
For i As Integer = 0 To 45 Step 15
ddlMinute.Items.Add(New ListItem(String.Format("{0:0#}", i), i.ToString()))

I’ve had a play with the TimeSpan object and found an easy way to print the hours and mins using c#

private List LoadHours(int NumberOfMinutes)
            var ts = TimeSpan.Zero;
            var ts_end =TimeSpan.FromDays(1);

            var lstReturn = new List();

            while (ts<ts_end)

                ts = ts.Add(TimeSpan.FromMinutes(NumberOfMinutes));
            return lstReturn;