Extern “C” and Name Mangling

Name mangling is very common in C++ compilers when a function have the same name with different parameters or overloading.

As the compiler compiles your code, with a function with the same name , the compiler tries to rename the function or method so they dont clash with each other at runtime and providing different signature.

Using Extern “C” on the other hand if you are calling a C function exactly as it is from your C++ code. With a syntax of

extern “C” statement or block of code

This prevent the compiler from mangling the name at compile time otherwise getting bunch of errors and crashes.

Here are some good articles about it:
http://www.geeksforgeeks.org/extern-c-in-c/

Here some good link about Calling Convention: eg. __stdcall, __cdecl
http://blog.aaronballman.com/2011/04/the-importance-of-calling-conventions/

C & C++: Shell Extension Need to know and understand

Its been a while since I posted something here due to my lost of my  laptop. Anyways aside from that I’m now back and continue this journey of the shell extension in c and c++.

I have asked about the the fundamental of the COM in stack overflow. Follow this question on there to get more information.

http://stackoverflow.com/questions/43010172/addref-and-release-in-iunknown-what-do-they-actually-do

Follow the link for a beginner explanation as well for terms and classes, typedef, and windows.h

This is also for reference for myself.

More to come in my shell extension journey.

C++: Road Block – Renamer Tool

I was just coding away with my Renamer Tool and suddenly hit a road block. My Renamer tool is a Csharp WPF application that renames files according to Filter set by the user. It will also features a way to select multiple files from window explorer to be selected and right clicked to open up with the program.

I thought this was simple as I was googling along adding context menu feature. It led me to..

Shell Extensions.

Ugh… it is said that writing a shell extension in managed code like CSharp is discouraged. And mostly the only way is through..

C++ Active Template Library or COM…. went to have a look through how to implement this. Questions upon questions upon questions!

Apparently writing a shell extension in C++ is like diving to a different world of programming, prepare to go back to the old ways as this requires the knowledge of the old windows api calls. Which has specific OS types and classes.

My program is almost there , and knowing me, I like to use this program for my personal use and Im pretty sure others would like to use them as well.

So what now? I do have some basic knowledge of C/C++, but never ever done shell extensions before or COM which is like assembly language.

Wish me luck, cause Im about to dive in!

Helpful Links:

http://stackoverflow.com/questions/8811621/how-to-write-a-shell-extension-in-c

http://softwareengineering.stackexchange.com/questions/194764/what-is-lpctstr

Programming: JQuery Questions

Recently been asked few programming questions, and the heck wasnt ready for those. The questions were 1. whats the difference between .parent() and closest() in JQuery, and surprise surprise I wasnt able to give an answer, all I can think about is parent(), is of course getting the parent of the element but wasnt sure whats the closest() function was. A simple search takes me to Traversing and there it is. I just had a look at the description and yep. closest(selector) takes an argument selector to look for the closest element and traverse to the tree all the way up the root html.

2. create a function isPalindrome($x), this one I just didnt know what palindrome means, went to search again and there it was, the term palindrome any text given and if reverse should be the exact same as the original. when I was cooking dinner.. just thought there might be a function the reverses the string and then match it against the original.meek .. too late.

3. (selector, selector, selector).fadeIn() how do you construct a function so they dont fade at the same time? Ugh another challenge when you are at the moment not using JQuery. Since I havent really delve into much in JQuery lately, top of my head just said just separate each one so they fade in order. Later that day I did a quick search “multiple selection”  and there it is the each() function, then I thought there must be a way to delay it for some milliseconds and there I went and look for the function there it was delay(milliseconds) chain them together with passing each(index) and voila .each(function(index) { $(this).delay(500*index).fadeIn(1000) }); would have been the answer again too late! lol

4. The last question I couldnt put together was to construct a regular expression, I can answer it but I just needed more time to pull up all my symbols expression using these: ^ $ * { } [] a-z 1-9 ? ! + ABC.  I know how to use them and what they means. Again out of time and too late.

Anyways Ive learned something new that day, which Im always happy about. Just so excited in the world of programming, I may not get a good result but it was definitely fun!

Identifying your weakness and strength

Howdy! We all have our strengths and weaknesses as a person and in our profession. You know yourself better than anyone else or maybe someone knows your better than yourself but most likely its yourself your biggest critic.

Its hard to admit that we have them. Its even harder when it shows and everybody notices it. For example Im not scared to admit one of my weaknesses is …. wait for it.

Im slow to pick up cues. I dont usually understand things that are new. I dont usually pick up jokes straight away, I cant even give a quick remarks back to someone being a smart ass. In all Im slow.

I identify it and proven, that is indeed a weakness or perhaps just part of how you as a person . Its just one of those weaknesses that its just there and can never be improved or fixed or maybe it can . So what do you do?

There is something you can do! Focus on your strength! I know Im slow, but I know that I am a also a critical thinker as well, what this makes you? It means you just dont go opening your mouth without thinking of the consequences, it means you never decide things on impulse, it means you analyze the situation as hard as you can to make  better decisions because you consider every options possible.

In this sense when one of your weakness shows up, there is one of your strength to help you out. Never forget the value that you have, identify your short comings if you can improve on them then yes improve on them, but never forget your strength its there to put you back up your feet.

This post is to just to remind us about learning to identify our own weaknesses, learn to accept them, know why you have them and finally how to do get pass them by identifying your strength!

2017 © Ideas, designs and algorithms