## Friday, December 30, 2016

### Quick Python notes

In python shell, use execfile('foo.py') to execute directly in the shell. Mostly trivia, not a good way to do things but don't want to look this up again if it comes up.

## Thursday, December 29, 2016

### Tensorflow installation on ubuntu linux hints

tensorflow 'Download and Setup' instructions seem to be great (verified for only installing the CPU version).

minor clarification: When reading the installation instructions you can disregard the part that says 'install tensorflow' if the command pip install tensorflow worked for you. no indentation on that page makes it a tiny bit ambiguous in the section 'Pip installation' on page: https://www.tensorflow.org/get_started/os_setup#test_the_tensorflow_installation

### Ubuntu hints

notes about ubuntu install for a NUC:

created a bootable USB with these instructions:

in particular the rufus tool was key to making this painless.

must also do:
https://help.ubuntu.com/lts/serverguide/apt.html

sudo apt update

or the 'ubuntu software' tools won't work/broke when i tried to install emacs.

creating a shared drive with windows host:
with virtual mx shut down, go to 'edit virtual machine settings', select vmware options tab, select drive to share and name it
the drive will appear under /mnt/hgfx/ when you turn virtual machine back on

## Saturday, December 24, 2016

### Ubuntu in VMWare display issue?

only coming up in 800x600 or VGA? suspend the client, then resume it. seems to resolve issue for me. will update if i find this incorrect.

resizing the windows window also seemed to work.

## Thursday, December 22, 2016

### Where are Linux OpenCL SDKs installed?

you were wondering that too?

they are in the /opt directory:
cd /opt/intel/
cd /opt/AMDAPPSDK-3.0/

basic command line (confirmed to compile, not execute):
gcc -L/opt/intel/intel-opencl-1.2-6.3.0.1904/opencl-1.2-sdk-6.3.0.1904/lib64 -o target 1.c -lOpenCL

## Tuesday, December 06, 2016

### dispatch table with function pointers in C simple sample

#include "stdio.h"
#include "string.h"

void foo() {
printf("in foo\n");
}
void bar() {
printf("in bar\n");
}
void foo2() {
printf("in foo2\n");
}
struct table_entry_s { char *name; void(*function)(); };

typedef struct table_entry_s table_t;

//populate the table
table_t dispatchTable[256] =
{ {"foo", foo}, {"bar", bar}, {"foo2", foo2}, {NULL, NULL} };

#define NUM_ENTRIES 3

void dispatchKernel(char *string)
{
int iFound = 0;

printf("dispatchKernel with %s\n", string);

for (int i = 0; i < NUM_ENTRIES; i++)
{
char *result = NULL;
result = strstr(string, dispatchTable[i].name);
if (result == NULL)
{
printf("%s was not in %s\n", dispatchTable[i].name, string);
}
else
{
iFound = 1;
printf("Found %s in %s\n", dispatchTable[i].name, string);
dispatchTable[i].function();
}
}
}

void main()
{
printf("hello\n");

printf("dispatchTable[0] name = %s\n", dispatchTable[0].name);
printf("dispatchTable[1] name = %s\n", dispatchTable[1].name);
printf("dispatchTable[2] name = %s\n", dispatchTable[2].name);

dispatchTable[0].function();
dispatchTable[1].function();
dispatchTable[2].function();

dispatchKernel("fdafsdbarfdsafs");

printf("goodbye\n");

}

## Wednesday, November 16, 2016

### doxygen getting started

i'm sure i'll add more to this later, but just spent an hour getting this up and running and don't want to forget this:

when creating the doxyfile.txt for your project, if you want to add (for example) .cl files as input, you might need to make the addition in two places. first to tell it to look for these types of files and the second is how you want these files treated when parsing the marked up file: EXTENSION_MAPPING as well as FILE_PATTERNS variable. Also don't forget to point the OUTPUT_DIRECTORY and INPUT to the appropriate locations.

EXTENSION_MAPPING      = cl=C

and add this to FILE_PATTERNS = blah blah \ *.cl

Your file won't be parsed if you don't add this to the top of the .cl file (self referential statement):

/*! \file blah.cl
\brief A test file class.

A more detailed class description.
*/

Running Doxygen (basics):

To run doxygen (assuming it has been added to your path) you can traverse to the directory that the template you generated lives (doxyfile.txt) and it will grab the template. Not recommending this for production but just for getting things up and running.

## Monday, August 22, 2016

### Creating Labels for Excel Columns

If you want the columns to have a label, the term you are looking for is 'categories', which does make sense, just not the way i was thinking about it, usually 'x-axis, y-axis or something like that in my head'

To give your columns names, select the little funnel looking icon, go to 'horizontal (category) axis labels' select 'edit', then select the names you want each column to have from your spreadsheet and the fields will populate as you expect.

just another note for my own personal FYI.

## Thursday, July 14, 2016

### Do i need an escape for a filename when passing to fopen in this case: c:\\foo\\bar\\readme.txt

no escape for the colon ':'

use like the subject line

## Sunday, July 10, 2016

### Creating a very primitive installation tool: Using winzip to create archives that preserve directory structure

Even when i do an internal project, i like to create a quick installer package for anybody else who might want to use the tool(s). Winzip has a nice command line interface to make this happen, however it took an hour poking through documentation (and 7z proved non-obvious as to how to do it, and online notes suggested the developer is not too interested in making this use case easy..read about it on superuser.com).

The specific challenge is the right parameters to get the entire directory structure when you unzip at the destination. To me, this would be quite a useful mode of any zip/archive tool, yet the default is baffling a flat directory structure, surprise! Even using the GUI default modes does the expected thing..so it would seem NOT preserving the directory structure is the uncommon case, but that rant is not why i am writing this note for later.

So, here's the scoop:
using winzip, archive using this:
"c:\program files\winzip\wzzip" -P -r file.zip @BenchFileList.txt

where BenchFileList.txt has a format like this:

".\docs\bench-overview.pptx"
".\docs\sim-overview.pptx"
".\docs\GPU Architectures.docx"
".\docs\queues-and-contexts.pptx"

".\Bench\source\Bench.sln"

DO NOT INCLUDE THE '.' IN THE STRINGS IF YOU WANT IT TO SHOW THE DIRECTORY NAMES AT THE TOP.

and you will get what you expect: when you unzip you will have a directory structure such that your solution and project files are where they are expected to be.

## Wednesday, July 06, 2016

### migrating C functions when code refactoring

functions:
functions are default extern, so you don't need the extern on them when you move the declaration to a header file and definitions to a new file.

when adding the functions to the new cpp file, move the full function over, put the declaration in the header, include the header in the old file you are migrating from but still intend to reference the function. include the new header in the old function.

for the new .cpp file with the code that has migrated from the old .cpp to the new .cpp, include the new header file.

include the .cpp file for the new code in the project as well. or just wait until visual studio complains you forgot this step, come here to re-read this blog post, then do it :)

TODO: add an example here for clarity, but not tonight :)

### structs, typedefs of a global struct when code refactoring in C

i often end up in a situation where i've prototyped something in a small testspace then things work out and you want to reuse those tools as you build out another project in the same solution. i've run into this twice in the past year and spent 10 minutes resolving a misunderstanding of intent between the compiler and myself so i'm posting here to save time in the future. note this is for an internal test utility and not product code which shouldn't have any (or very few) globals in the first place, so i'm not putting this here as a shining example of how to do something but instead as how i resolve this specific issue.

here's the refactoring steps:

1. put the typedef and structure in the header file.

typedef struct foo_s { } foo_t;

2. put the declaration into one of the files (the central utility file for example):

foo_t foo;

3. when you want to reference the variable foo in another .c file, use this:

extern foo_t foo;

## Sunday, May 01, 2016

### GPUView

log.cmd file location

C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\gpuview

click on 'windows assessment ....' link in first sentence of page:
https://msdn.microsoft.com/en-us/library/windows/hardware/dn927310(v=vs.85).aspx

you only need the windows performance toolkit, a few hundred MB vs. all the 6GB+ of what they try to convince you to download by default.

## Sunday, April 24, 2016

### Reminders for a las vegas trip

limited number of wifi devices at some hotels (4 at wynn)
excess 3$credit card fee on taxis resort fee for hotel (~$35)
no hot water making capability in some rooms, bring something to heat water

queens/rooms with 2 beds on golf resort side, room feels smaller
preference is strip-side not golf side.
paid $40 (including tax) for panorama upgrade, worth it, don't like the smaller/lower rooms, not worth cost of travel to get there IMO. require king panorama upgrade on strip side check on pool availability, wind effects, also december will not have both pool available. colder in dec. not likely to want to use pool at that point. dolphin and tigers$20/head. interesting, but mandalay bay is better value
paris baguette has/had poke bowls, great lunch value
early checkin just a rip off that puts in you in crappy room they couldn't sell the night before

flight: 6am out to arrive in vegas early was not needed.
leaving around 2pm was great.
recommend next time to depart later but perfect leave time given check out was noon.

don't forget pre-check for everyone in party

## Wednesday, February 10, 2016

Example of how to configure remote debug session with a simple hello world program. Also installed Visual Studio 2013 on the remote machine. Also from a mapped network drive.

shutdown /r /t 0

## Monday, January 11, 2016

### One technique to efficiently craft your annual review

Caveat: A broader career direction discussion should talk about a 5 year Development Plan.

The focus here is on the yearly focal/review and how to get it done efficiently.

The Focal algorithm:
1. Open your monthly/weekly/whatever status reports and merge them into a single document. Close the monthly docs. this gives you a compression opportunity, often you will find some redundancies or things that don't matter as much as you thought they did. use a smaller font, clean things up so they are easy for you to read/work through.
2. Read through/think about this collection of activity, what are the 2,3,or 4 buckets they can fit in to tell your end of year narrative of your key accomplishments. what really are probably better suited to go into the section on strengths?
3. Take a break and go do something else for awhile.
4. Think about your proposed buckets after you've had a break...do you like them? how do they align with your group and corporate charter? If you like them start to build out your focal sheet based on these buckets, cutting/pasting from your list created in [1] into the main Focal worksheet(s). Spend some time thinking about these buckets, the titles will provide the anchor for the most important part of the document.
5. Now you have a list that is too big and not coherent, but all of your work is in the appropriate buckets and you've made some hard decisions about where things go.
6. Compress each bucket to fit into your corporate format. it is usually some form of  ~3 accomplishments, 3 strengths, 3 areas of development
I am writing this down because each year i seem to reinvent the same process forgetting what i did the year before until about 30-40% through the process then i remember 'Wait, I did it this way last year?'. :)

This is just the practical part of getting your review complete. One should also use this time to take a 'big think' about your 5 year plan and how the work you've done in those years aligns with what is in that list. What needs changed? What would you do different? What rathole did you go down that you want out of? Take some time to really think about where your career is going and how to course correct where needed as topics with your manager. Use the section of 'Areas of Improvement' as a way to drive that into your development for the next year and your development plan.

Good luck!

## Friday, January 08, 2016

### how do i get a price refund on amazon?

if you order something and the price changes within 7 days you can get a refund of the difference. go to this link and fill in the info at the bottom of the page. at that point you can do phone, email, or chat session.

https://www.amazon.com/gp/help/customer/contact-us?ie=UTF8&nodeId=508510&