You are looking at posts that were written in the month of January in the year 2008.
Posted on January 23rd, 2008 by Tim.
Categories: General/Misc..
This function will print out a list of exports from a DLL. Note that this function for enumerating DLL exports requires imagehlp.lib and dbghelp.lib (and the corresponding dynamic libs).
void ListDLLFunctions(PCSTR pszDllName)
{
_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory;
unsigned
long cDirSize;
LOADED_IMAGE *pImage = ImageLoad(pszDllName, NULL);
ImageExportDirectory = (_IMAGE_EXPORT_DIRECTORY *)ImageDirectoryEntryToData(pImage->MappedAddress, FALSE, IMAGE_DIRECTORY_ENTRY_EXPORT, &cDirSize);
if (ImageExportDirectory != NULL)
{
DWORD* dwNameRVAs = (DWORD*)ImageRvaToVa(pImage->FileHeader, pImage->MappedAddress, ImageExportDirectory->AddressOfNames, NULL);
for( DWORD i = 0; i < ImageExportDirectory->NumberOfNames; i++)
{
PCSTR pszName = (PCSTR)ImageRvaToVa(pImage->FileHeader, pImage->MappedAddress, dwNameRVAs[i], NULL);
printf(“%s\n”, pszName);
}
}
}
Posted on January 23rd, 2008 by Chris.
Categories: Chris, Product Design, Programming.
How do you decide when to throw out your code/idea and sleep on it/do a rewrite?
Most people intuitively know when they’ve gotten stuck. Suddenly, after plowing through mountains of work, returns suddenly diminish dramatically. People who program late at night will recognize this phenomena; coding turns from an art to a masturbatory exercise in frustration. (This also comes up when doing late night work as a student, interestingly.)
The reason people can overlook the stall point is that it’s not one point. If we got pitched headlong into a freezing room, we’d be far less likely to leave the thermostat alone.
Being acutely sensitive to even the smallest amounts of frustration is a good way to pick up on incoming stall points.
Be intolerant of annoyances.
Posted on January 20th, 2008 by Tim.
Categories: General/Misc..
Building on Chris’s previous post concerning legalese I came across the following:
Military Commissions Act of 2006
SEC. 8. REVISIONS TO DETAINEE TREATMENT ACT OF 2005 RELATING TO PROTECTION OF CERTAIN UNITED STATES GOVERNMENT PERSONNEL.
(a) Counsel and Investigations- Section 1004(b) of the Detainee Treatment Act of 2005 (42 U.S.C. 2000dd-1(b)) is amended–
(1) by striking may provide’ and insertingshall provide’;
(2) by inserting or investigation’ aftercriminal prosecution’; and
(3) by inserting whether before United States courts or agencies, foreign courts or agencies, or international courts or agencies,’ afterdescribed in that subsection’.
And all of a suddent it occurred to me: We’re encoding a diff in english. Maybe law and programming are really more similar than I realized.
Posted on January 19th, 2008 by Chris.
Categories: Chris.
We usually assume that people calculate things rationally in economics. If we shop for a car we look for the best value; if two pizza places are equally good, we lean towards the cheaper one. Some economists have noted that sometimes, people don’t make these perfect calculations. For example, humans tend to exaggerate fears — the risk of a small loss requires a much larger gain.
One explanation for this - humans operate not on calculations, but on perceptions. We judge things by how big an imprint they make in our mind–not by crunching numbers. We lock our houses and cars up, but if our house or portfolio loses a few thousand dollars in value, it’s more abstract and we treat it as less important, even if it’s numerically the same. If the odds of a get-rich-quick scheme succeeding are extremely low, we may lean towards it because it makes a larger impression in our minds.
Judgments that humans make may seem irrational, but that doesn’t mean they are–it may just be the method by which we judge.