Tuesday, September 15, 2020

disabling profiling in visual studio 2019

 


Disable in Options->Debugging->General->

Enable diagnostic tools when debugging.

Startup and shutdown of apps during debug is much faster, especially on remote debug scenarios.

Wednesday, June 03, 2020

Bodyguard treadmill maintanance

After lubricating the treadmill also have to go into a menu called 'maintenance' and reset the average current or it will not compute a current based on the new lubricated treadmill.

this is not documented as far as I can tell.

Wednesday, April 15, 2020

Ensuring console window pops up on same place when debugging

Place window where you want it to pop up.

On title bar, right click-?properties->layout set 'Let system position window' to false.


Tuesday, March 03, 2020

Unlinking Google Chrome and NYTimes

Need to go to 'subscriptions'
(yup, even though you didn't actually suscribe to anything).


https://myaccount.google.com/payments-and-subscriptions


Saturday, December 14, 2019

filename up to the extension and creating a new filename

Just dropping this here for now.

void getFilenameWithNoExtensionAndCreateANewFilename()
{
char *arg= (char *)"foobar_filename.ppm";
char output_filename[256];

char* ptrToPPMStart = NULL;
char* ptrCopyFrom = NULL;

char buf[80] = { 0 };
int i = 0;

ptrCopyFrom = arg;
ptrToPPMStart = strrchr(arg, '.');

while (ptrCopyFrom != ptrToPPMStart) 
{
// printf("copying %c\n", *ptrCopyFrom);
buf[i] = *ptrCopyFrom;
i++;
ptrCopyFrom++;

}

buf[i] = '\0';

printf("%s\n", buf);


strcpy_s(output_filename, "output_");

//from this create a new filename
strcat_s(output_filename, arg);

printf("output_filename: %s\n", output_filename);
}

Wednesday, December 11, 2019

Allocating of heap memory inside function with doubly nested pointers

just a cut/paste of template/pattern code here so i don't have to spend 10 minutes dancing with the compiler.

#include
#include
#include

#define SIZE 10

void fooAllocator(unsigned int** image)
{
*image = (unsigned int *) malloc(SIZE * sizeof(unsigned int));

if (*image != NULL) //resolves MSVC compiler error, just a little test before the real loop
{
(*image)[7] = 14;
}
for (int i = 0; i < SIZE; i++)
{
(*image)[i] = 66;
}
}

void fooWriter(unsigned int* image)
{
for (int i = 0; i < SIZE; i++)
{
image[i] = 42;
}
}

void printImage(unsigned int* image)
{
for (int i = 0; i < SIZE; i++)
{
printf("[%d]=%d\n", i, image[i]);
}
}

int main()
{
unsigned int* image = NULL;

//function that allocates memory for image
fooAllocator(&image);
printImage(image);
fooWriter(image);
printImage(image);

for (int i = 0; i < SIZE; i++)
{
image[i] = 36;
}

printImage(image);
return 1;
}