Friday, August 14, 2015

'Enter' in an Excel cell

i always forget if its shift + enter or alt + enter or ctrl + enter...i use excel often but only need this every few months.

so, it is alt plus enter.  even on a macbook eyboard, no need to press fn+option+enter, just press option/alt+enter

Sunday, April 26, 2015

When debugging i want the console to pop-up in a non-stupid place

See the second response to this question:

Monday, February 02, 2015

intel compiler paths

i have run out of space in my path.the intel composer application suite sets lots of them. since i may need them again i am placing them here;

C:\Program Files (x86)\Intel\Composer XE 2011 SP1\redist\ia32\tbb\vc10;C:\Program Files (x86)\Intel\Composer XE 2011 SP1\redist\intel64\tbb\vc10;C:\Program Files (x86)\Intel\Composer XE 2011 SP1\redist\intel64\ipp;C:\Program Files (x86)\Intel\Composer XE 2011 SP1\redist\ia32\ipp;C:\Program Files (x86)\Intel\Composer XE 2011 SP1\redist\intel64\mkl;C:\Program Files (x86)\Intel\Composer XE 2011 SP1\redist\ia32\mkl;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32\compiler;

Saturday, December 20, 2014

DCS 933L Installs and LED Settings

If you need to reset them you need to download the application that configures them, not use the mydlink website.

To disable the blinking LEDs (not 'disable being able to set the LEDs' which is what the name incorrectly implies:

Tuesday, October 21, 2014

Moving from a console to a windowed app with a windows entry point (winMain with the expected parameters)

often when i start early iterative development on a project i start from a clean sheet and build up as a console application. sometimes i need to make it a real app and need to move from main() to a real windows entry point like this:

int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow )

To do this in a project originally created as a console application go to the property page for the project by right clicking the project, select Configuration Properties->Linker->System, go to the SubSystem editable property, select System->Subsystem dropdown, select /SUBSYSTEM:WINDOWS.


Tested in Visual Studio 2012

Saturday, September 13, 2014

MSVC path for .dlls when you want to put it in your source development tree

When creating projects in MSVC, and assuming you don't want to put the .dll in your system directory but instead local to your project, the default location it will look for a .dll you want it to see is not the top level solution directory but in the respective debug or release directory for the project.  

Monday, August 25, 2014

Attaching a console in Win32

how to get a console in a few simple lines of code in windows:

DWORD pid;
pid = GetCurrentProcessId();
freopen("CON", "w", stdout);
printf("hello, i am the console\n");

Thursday, May 08, 2014

Using RegOpenKeyEx and RegQueryValueEx

just putting this mess of code here for later cleanup, maybe somebody else finds it useful

assuming you need a REG_DWORD, if you need another type, REG_SZ for example, you will need to tweak this slightly.

if you have used this:

 int result;
HKEY hkey_fromRegOpenKey ;

result = RegOpenKeyEx(hkey, TEXT("my\\fav\\subkey\\location"), 0, KEY_READ, &hkey_fromRegOpenKey);
if(result != ERROR_SUCCESS)

  DWORD dwType;
  wchar_t szVersion[32];
  DWORD dwDataSize=sizeof(szVersion);
  memset(szVersion,'\0',32);  //TODO: wide char memset

result = RegQueryValueEx(hkey_fromRegOpenKey, "myval", NULL, &dwType, (LPBYTE)&szVersion, &dwDataSize);

You can use this to print it in C (TODO: simplify the dwValue casting mess from cpluscplus):
//extract a dword from a binary buffer
DWORD dwValue = 0;
dwValue = *((DWORD* )&szVersion); //C cast for brevity as suggested at:
//dword is an unsigned int
printf("%u is dwValue\n", dwValue);

just putting this here so i don't lose it.

Had some issues in a different visual studio project, i think it is related to default project settings. here is a C version that handles the issue:

//  PrintKey takes the key, subkey and value as input and prints the value as output
//  it opens the registry, reports the value, and closes the registry when complete
//  Example usage:
// PrintKey(HKEY_LOCAL_MACHINE, "Software\\Intel\\IGFX\\USC", "CSSIMD8CompileForce");

void PrintKey(HKEY hkey, LPCTSTR subkey, LPCTSTR valuename )
long result;
HKEY hkey_fromRegOpenKey;
DWORD dwType;
wchar_t szVersion[32];
DWORD dwDataSize=sizeof(szVersion);

//it is like a database, you have to first open the registry values you want to query
result = RegOpenKeyEx(hkey, subkey, 0, KEY_READ, &hkey_fromRegOpenKey);
if(result != ERROR_SUCCESS)
printf("RegOpenKeyEx failed for %ls\n", subkey);

//std::cout << "RegOpenKeyEx Failed for " << subkey << std::endl ;

//next, query for the specific value
result = RegQueryValueEx(hkey_fromRegOpenKey, valuename, NULL, &dwType, (LPBYTE)&szVersion, &dwDataSize);
if(result == ERROR_SUCCESS)
printf("%ls\t", valuename);
wprintf(L"%d\n", *szVersion);

/*if(result == ERROR_SUCCESS)
std::cout << valuename << ":\t"  << *szVersion << std::endl;
printf("Error reading %ls does it exist in the registry?\n", valuename);

//std::cout << "Error reading " << valuename << "does it exist in registry?" << std::endl;

//finally, close the registry


Thursday, April 03, 2014

Correct directory structure for clang and llvm 3.3 source tree when using cmake

instructions are slightly outdated.

download clang
download llvm

after unzipping clang go into the clang directory and grab the cfe-3.3.source directory and put this into the tools directory under llvm before running cmake.