I was curious about some web design companies.
- Checking out Craig’s list for “Computer Gigs”: http://newyork.craigslist.org/cpg/
- www.designflib.com
NYC, Politics, and Tech
I was curious about some web design companies.
I’ve been working on some existing code that has a reputation for being very difficult to understand. It’s taken a while but I’m feeling pretty comfortable with it now and it’s not that complicated. Part of what makes the code inscrutable is a combination of too much indirection and control inversion (no documentation doesn’t help, of course).
Indirection is calling code that calls code that finally does what you want.
It’s great for abstraction. For example, do you really know what happens when you write
i = i + 1;
Indirection gives you more flexibility (i.e. polymorphism). It’s what novice programmers fail to do. When you see 200 line functions, duplicated blocks of code, and hardwired values that constantly need to be changed it’s code written by a newbie.
When you see an execution path like
Class1::doit() -- Class1::doit2() -- Class2::doit() -- Class3::doit()
it’s from someone that learned their novice lessons but hasn’t learned the cost of indirection.
A very cool visualization techinique giving the history of a project. The commits (changes) and who did are tracked. This is one version for a python tracked over the projects 17 year history. Warning: contains audio track.
Good overview of diagnosing memory related problems
We went to the Jeff Koons exhibit on the roof of the Met. The sculptures were flippant but the view was great!
Here’s one of Faranak with Manhattan in the background:

And one of me with a sculpture:

We also saw: Photography on Photography: Reflections on the Medium Since 1960. Essentially photos of photos or photographers, such as:

Hmm, it turns out turning C++ code into html is both harder (nothing obvious) and easier (a great tool) then you’d expect. For the previous post on expanding $var I just used:
enscript -B -E -u "" -T "" --language=html --color Strings.cpp -p ~/Strings.cpp.html
and copied the resulting html into the post.
The coolest thing I found was GeSHi (Generic Syntax Highlighter) which is written in php and so more suitable for web sites.
If I were using WordPress, there’s a
plugin
that use the “<pre lang=”C++”/>” tag
Here’s some sample code that expands strings like “$VAR”. There’s a typedef needed and I have it wrapped in a “namespace path” since this code fragment is part of a bigger project. Feel free to use this code however you like.
typedef std::map StringMap
namespace path
{
/**
* Expand any $VAR by looking up VAR in vars and using
* the return value. If VAR is not found, then the
* empty string is used. VAR can contain letters, digits, and
* underscore ('_') (the usual). To escape a dollar sign, use two
* dollar signs ('$$'). If you include the variable name in parenthesis,
* then any characters are ok: $(A $ %). '[]' and '{}' work
* if you need more characters.
*
* Variables are recursively expanded. So if the expansion includes
* a variable, that variable is also expanded.
*
* @param str The String to be expanded
* @param vars A std::map from std::string to std::string
* @param tilde True if expand ~ to $HOME (at start)
* @return a string with all $VARs expanded.
*/
std::string expand(const std::string &str, const StringMap &vars, bool tilde)
{
std::string newstr;
const char intro = '$';
const char tilde_char = '~';
for (std::string::const_iterator iter = str.begin(); iter != str.end();)
{
if (tilde)
{
tilde = false; // only at the very start
if (*iter == tilde_char)
{
++iter;
newstr += expand("$HOME", vars, false);
continue;
}
}
// Search for a '$'
if (*iter != intro)
{
newstr += *iter++;
continue;
}
// We have a '$'
std::string var;
++iter;
// Treat $$ as an escape for a single '$'
if (iter != str.end() && *iter == intro)
{
newstr += *iter++;
continue;
}
// Get the actual variable
bool start = true;
bool domatch = false;
char match = ')'; // for matching brace/parenthesis
while (iter != str.end())
{
if (start)
{
start = false;
switch (*iter)
{
case '(':
match = ')';
domatch = true;
++iter;
continue;
case '{':
match = '}';
domatch = true;
++iter;
continue;
case '[':
match = ']';
domatch = true;
++iter;
continue;
default:
break;
}
}
if (domatch)
{
if (*iter == match)
{
++iter;
domatch = false;
break;
}
else
{
var += *iter++;
}
}
else if (isalnum(*iter) || *iter == '_')
{
var += *iter++;
}
else
{
break;
}
}
if (!domatch)
{
StringMap::const_iterator variter = vars.find(var);
// If we added an else, we could have non-matches expand
if (variter != vars.end())
newstr += expand(variter->second, vars, false);
}
}
return newstr;
}
}
Here’s a chart showing year-over-year home price changes in Manhattan. Prices
are starting to fall. I’m not sure what the basis is (average selling price or
median price) But these interactive graphics that let you get specific data on
your specific city in an easily digestible form (for free!) are amazing.
Of course, sometimes you get what you pay for. The data for New York doesn’t seem to be updating so I think this is really for Atlanta.
From Home Prices Across the Nation:
And here’s the inflation adjusted numbers (i.e. inflation is subtracted):

I think Scott McClellan’s new book is just re-hashing old news and buying it just rewards someone that failed miserably at serving the country. But part of what’s happening is the many media notables claiming they did a good job on reporting the runnup to the Iraq war. They didn’t!
One of the few news agencies that did a good job reporting, Knight Ridder (since purchased by McClatchy), has this to say:
From Blog: Nukes Spooks:
The Bush administration was gunning for Iraq within days of the 9/11 attacks, dispatching a former CIA director, on a flight authorized by Deputy Defense Secretary Paul Wolfowitz, to find evidence for a bizarre theory that Saddam Hussein was responsible for the first World Trade Center attack in 1993. (Note: See also Richard Clarke and former Treasury Secretary Paul O’Neill on this point).”
The following chart is from the San Francisco Federal Reserve certainly leave one very worried about the economy. Jump to about slide 20 for summary information. There’s even concern about stagflation.