Modifying Windows Store Application Package

Sometimes we need to modify our application package without taking a long time rebuilding the project, I hope this note helps you to do it.

Let’s say we have application named SmartPak and we forgot to include configuration file when building the app. What we will do is extracting the SmartPak.appx, copy the configuration file into it then package it again.
However we couldn’t do it using traditional archive manager like 7zip or winzip, Microsoft provides tool to handle this case and it already included in Windows SDK since 8.1.

So currently we have this directory structure :
gbr1 Continue reading

Faux Variadic On Visual C 11 (Visual Studio 2012)

Yes yes yes

That’s the answer if you ask me whether I have personal problem with VC 11 (Visual Studio 2012).

Another problem which I found interesting is how variadic list was implemented in VC11, they called in Faux Variadic. In short this feature is not yet fully supported, or you could say it works via workaround. However this workaround have some side effects, the one most affects me is the number of maximum argument was reduced to reduce compiler memory consumption.

Normally we would have function with variadic list ┬áhandles 6 even 10 argument, however you couldn’t do it on VC 11 by default. In order to allow this scenario you have to define _VARIADIC_MAX, the default number is 5. This surely comes with side effects, compiler would eat more memory than before.

Function Template

It’s been a while since I wrote about technicall stuff. This time I write about very basic feature of C++, function template. What I found intimidating at the first time learning C++ were memory management and template, so it’s normal if you say it’s not easy.
With function template you can create one function for different data type.

Normally to handle different data type we write different function or do overloading, lets create simple sizeOf function.

size_t sizeOf(int n)
 return sizeof(n);
size_t sizeOf(char n);
 return sizeof(n);
size_t sizeOf(const char* n);
 return sizeof(n);
int main(int argc, char **argv) {
 std::cout << sizeOf(40);
 std::cout << sizeOf('p');
 std::cout << sizeOf("petruk");

Look, they use same implementation therefore those code is not good.

we could rewrite the code above using function template. Continue reading