Category Archives: Software Development

Anything to do with developing Apps, Desktop application, server application, API etc.

Understanding Sorting Algorithm

I was once asked years ago if I know any sorting algorithm and I terribly failed to answer. As a self taught coder I never encounter having to sort records manually. Because most programming languages have a function already built-in to do this ‘sort’ of thing (pun intended).

So what is it? You my future self should already know the gist of it. Its basically a way to sort set of records based on from lowest or highest to lowest. There are bunch of sorting algorithm listed in this below link:

Different types of sorting algorithms

The most common one is Bubble sorting, you take the first value in the collection or array and compare to the second, if second value is lower, you swap the second to the first. Then we take the second value and compare to the third. Every swap you flip a flag that a swap has happen. You just keep repeating until the swap flag remain false and then everything should be sorted.

For more detailed videos of known sorting algorithm whenever you need it below are full explanations.

Algorithms Playlist

Regular Expression: Lookahead and Lookbehind

Ever wonder what this regular expression means? “^(?<=PO)abc$”, the parenthesis in the beginning is the “positive lookbehind” as per symble less than. It pretty much check any characters before “abc” that has to equal to “PO” otherwise any expression wont happen. It is like a STOP to the expression and fails if it doesn’t match.

For more information check this link:

And also a thorough explanation happening under the hood, this is a good explanation as you follow the paragraph:

If you are wondering whether you can put it in any order, yes you can but an explanation is below:

SQL Server remote access

I just found a gem of a post in how to make Sql Server talk to anyone in your network!


I will definitely go back to this everytime I want access to a database in our network.

Basically, this will show us how to set up SQL Server so that any program on the network is allowed access to its content given they have the right user access to it. It has something to do with enabling Sql Server browser and enabling TCP/IP connection.

Port forwarding and Software Update Implementation

Port Forwarding
I was trying to set up remote access to my router from outside world(I have done it before) and have access to network drive and for the love of me, could not seem to get it to work.

It is so easy for a long time of not doing it and understanding how they all work, your way of thinking just shifts and completely throw you off balance. You know how they work and such but you just need that one sentence to explain it all until… I only needed to see one picture.

Simple illustration of how port forwarding works.

And everything just became clear and smooth sailing to me once again!

Software Update Implementation
As you write software and programs and such, you think how do they actually perform an update onto itself, so I went and ask Google. Its actually pretty basic in terms of step by step process, although if you are only making a small simple program sometimes the technology you are using have it figured out for you.

Just like program in C#.NET, they have the ClickOnce installer where you can upload your package to a server and have it check by the computer if you have the latest version of the application. You can either go that way or a  more traditional route.

Have a separate process in your program that checks the server if you have the latest version installed, and allow the program to download the new version. Then ask the user to install the new version or have it closed and let the updater do the job for you by replacing all necessary files. An will run the newly updated program to continue.

For more information about this topic:

Marshalling and Serialization

These 2 concepts you will often encounter when writing applications especially dealing with data and communication between 2 programming languages.

They seem synonymous to each other but have slight difference.

Serialization is a process of converting an object ready to be written on disk and transmission. In layman’s term object converted into bytes.

Marshalling is to serialize an object just like the explanation above but also gives functionality to convert them back to their original form. Let say C# object serialized and written to disk as “file.dat”, and for C++ to read the file, and a function gets exported as well. When you call that function the data inside the object gets return and process of marshalling concludes.

This also copy and pasted from the link:

In regards to commonality between marshalling and serialization, they both have in common to allow streaming of a representation of an object or a hierarchy of objects to typically be put in a medium (file, memory) for the reverse process to restore the initial object or object hierarchy.

Reference link below:


C++: Range-Based loops

I have come across a new way to loop through collections and range.

It consist of example code below:

for (auto const &x : vec)
  // x is a reference to an const item of vec
  // We can not change vec's items by changing x 

This is definitely new to me and a welcome change as using auto creates a placeholder for any types and can be anything with a proper cast to return back to its original form.

The new loop also simplifies the code as more explain by the link:

Enter ANSI, and Unicode Character Encoding

Been developing a lot in .NET and C/C++ and been overwhelm by the fact that character encoding plays a part in building applications. One might not know that it existed under the hood but understanding why they are there is crucial to getting different quirks and bugs.

In laymen term each machine or computers have a standard default character encoding that translates each character to a byte and multi-byte (Unicode). Mostly nowadays Unicode is used to support wide variety of characters from native English alphabet to other non-english like Chinese, Japanese etc.

Check the link below for a very thorough explanation and more about character and coding and types in Windows system.

Including _T(TCHAR) macro that tells the compiler to use char or wchar_t and L”Literal” to interpret the string as a unicode multibyte string.

Copied and Pasted from the article:
The ## symbol is token pasting operator, which would turn _T("Unicode") into L"Unicode", where the string passed is argument to macro – If _UNICODE is defined. If _UNICODE is not defined, _T("Unicode") would simply mean "Unicode". The token pasting operator did exist even in C language, and is not specific about VC++ or character encoding.

Note that these macros can be used for strings as well as characters. _T('R') would turn into L'R' or simple 'R' – former is Unicode character, latter is ANSI character.

No, you cannot use these macros to convert variables (string or character) into Unicode/non-Unicode text