Windows Install change hardware configuration

Ever wondered how licensing works now comes Windows 10? Back in previous Windows OS, as soon as your pc glitches the last resort for salvation is through fresh install of the system.

I can just boot from my DVD drive using the OS CD and input back your serial number and away you go.

This is still applicable in the latest Windows 10. You can also create a boot USB disk if you are trying to install to a different drive. But somewhat came as a bit confusing as many devices now came pre-installed with the OS.

If you are building your own system, you will need to buy your own license or if you have a Windows 8 or 7. You can go to the upgrading route. When your build PC you have to know that, new motherboard = new license.

Here is a link that will help you understand a little bit the process how installation of new OS works.

How does Windows 10 licensing status change with changes in hardware configuration

In other words, when you buy a new PC loaded with operating system, you need to ask how they installed the OS. And make sure you get the serial key off them by hook or by crook if its not already on the physical box on the sticker.


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:

Visual Studio: Useful Shortcuts

Ctrl+Shift+ B  | Build the project
Ctrl + – | Ctrl + Shift + – | Navigate backwards and forward
Ctrl+K then Ctrl+C | Comment selected or cursor
Ctrl+K then Ctrl+U | Uncomment selected or on the cursor
Ctrl+K then Ctrl+F | Format and beautify selected code
Ctrl+L | Delete a line or selected
Ctrl+U | Changes the selected text to lowercase characters
Ctrl+Shift+U | Changes the selected text to uppercase characters
Ctrl + W | Selects the word near the cursor or highlighted one
Ctrl+Tab | Change active document among the open ones.
Ctrl+Shift + Space | Show tool tip for parameter function.

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

C: Common Data Types and Calling Convention __stdcall

I know I should not link a already well made documentation but for my sake and my project. I d like to put in on here anyways.

Since I have been dealing with different data types in C, its hard to remember what they do and what they stands for. Eg. LPCWSTR, LPBYTE etc.

Here is the link to the documentation: C Common Data Types

Also another I want to touch on is Windows C/C++ Calling Convention in what it actually means in laymen term. Here is an article about it:

Basically compiler has a way to call a function and how to clean up after the call is made. How arguments are push into the stack and who is responsible for cleaning up after. __stdcall usually makes the caller responsible for pushing the argument from LEFT->RIGHT and make the CALLEE responsible for clean up. __cdecl is from RIGHT->LEFT and makes the caller responsible for cleaning up.

2017 © Ideas, designs and algorithms