Hungarian notation is a programming language naming convention. Writing with Hungarian notation entails creating variable names that start with a group of lower-case letters which are mnemonics for the type or purpose of that variable. Hungarian notation, fully implemented can be more trouble that it is worth. However, a subset of Hungarian notation can be useful.

A subset of Hungarian Notation

Modified Hungarian Notation (MHN) is a self-coined term, that described slight changes to normal Hungarian notation and also defines a subset of full Hungarian notation. The main point of MH is to help define scope and consistency of variable naming. We can differentiate between local variables and member variables that are semantically similar, by the prepended mnemonic; this results in less time wasted trying to determine a different variable name.

MHN Guidelines

Mnemonics

  • integer i
  • string str
  • float f
  • double dw

String Variables

Always prepend with the scope and the mnemonic:

string strMyName, g_strMyName;

Local Variables

Looping variables are: i, j, n, t

Short name local variables are the full type name but in lower case:

int counter(0), index(0), age;
float average, rateofclimb;

If the type of the local variable is important (mathematical or type operations) then the type is specified in lowercase:

float fSomeValue;

Do not place “C” before the class name, instead use the class name itself in lowercase when instantiating:

MyClass myclass; 

Global Variables

Prepend with g_ for example :

MyClass g_MyClass;

If the type is POD or string then always prepend the type mnemonic:

float g_fRateOfClimb;
string g_strNameOfTheShip;

Class member variables

Preped with m_ and always for example:

class A 
{
  string m_strValue;
  public:
  A(string s) { m_strValue = s; }
};

A a("hello world"); 

Function Signatures

Single letter lowercase can be used for the variable name if the function is a setter. If the single letters conflict then append a number:

int MyFunction(string s1, string s2, int i, float f1, float f2);

If the function is non-trivial (not a settor or getter) then use the full semantic name in lowercase. If conflicting then append a number:

void MyFunction2(string strFirstName, string strLastName);

Competence Delusion

April 22nd, 2009

My favorite APA article:

“Unskilled and Unaware of It: How Difficulties in Recognizing One’s Own Incompetence Lead to Inflated Self-Assessments”

From the article:
People tend to hold overly favorable views of their abilities in many social and intellectual domains. The authors suggest that this overestimation occurs, in part, because people who are unskilled in these domains suffer a dual burden: Not only do these people reach erroneous conclusions and make unfortunate choices, but their incompetence robs them of the metacognitive ability to realize it.

PDF Download

We believe that our computer anti-virus software will protect our computer and our data. Is that belief justified? Let’s take an informal look:

First some definitions

Let’s define the term “unknown virus/worm” as a virus that is “in the wild” and the anti-virus companies do not know about it because the behavior of the virus/worm is so stealthy (or so targeted, or just new) that it does not call attention to itself.

Let’s define the term “known virus/worm” as a virus that has a virus signature and can be scanned and found.

Now some numbers:

Symantec reported in 2007 that a little more than 700,000 computer viruses were identified. Let’s say that the 700,000 viruses represent 99.99% of all virus/worm (known and unknown), leaving at least .01% unknown . The number of unknown virus/worm would then be about 70.

Let’s divide that 70 by 12 months, that comes out to 6 unknown virus/worm per month or about 0.2 viruses a day. To make this simpler, let’s say on average there is 1 unknown virus/worm that is produced each 5 days.

Let’s say that of each unknown virus, it takes about an average of 72 hours for it to become detected and a virus signature created.

Now for the kicker:

Such an unknown virus/worm would have an infection rate of 100% during those 72 hours. This suggests that the larger the computer network, the higher the probability of infection.

The true horror:

Since the infection rate, of that virus/worm is 100%, during those 72 hours, this means you’ve most likely been infected but you just don’t know it (yet), and your anti-virus software is running perfectly. This means for at least 72 hours, your computer is under the control of the virus/worm writer.

Are we doomed?

The majority of experts believe that the vast majority of virus/worm writers are not state sponsored, which means state resources (human, equipment, material) are not being actively used to create viruses/worms for the purposes of world computer domination of the average person. That is not to say, such resources are not being actively used to target specific computers in particular governments.

If you are considered an average target, then you are at risk. An average target consists of computer users that run active-content from the Internet, either by receiving non text-e-mail, downloading and installing questionable free tools and utilities, or running non text-based browsers that run active-content either through client-side or plugin technologies.

What if you are directly targeted?

Sucks to be you. If you think you are actually targeted (if your paranoia is really justified), the only hope is to go totally offline. Otherwise the following may help:

  • Don’t be an average target
  • Maintain multiple backups of your data
  • Maintain archives of your data
  • Subdividing your network results in a reduction of risk, on average; a network consisting of one computer is the safest (but still not 100% safe).

Managing Knowledge

March 22nd, 2009

I like to explore new software technology and it is enjoyable to learn the mechanics and technical details inherent with new technology. However, there is the challenge of retaining as much of the knowledge gained. I think a knowledge base is mandatory, now-a-days, to keep up with the fast changing technology landscape.

Here are my basic requirements of a knowledge base engine:

  • Knowledge must be difficult to destroy
  • Knowledge must be transferable
  • Knowledge must be easily found and easily edited

The knowledge base engine must have the following technical capabilities:

  • A free form schema that self defines itself
  • Free-form data entry that supports text, multimedia, and HTML
  • The schema is abstracted as data that is fully editable and extensible from within the User Interface
  • Reports and Search is abstracted as data that is fully editable and extensible from within the User Interface

So far the only free knowledge base that fits the above is Wagn. Wagn is a combination of a Wiki and a Database. The innovation is that the Wiki allows free form exposure of the database schema; this means this knowledge base is extremely flexible and extensible. The Wagn site explains:

One of the most exciting things about using Wagn as a database is that, unlike most databases, the public-facing website and the database are all wrapped up into one. With conventional tools you have your data structure (aka model), where you store everything, your web interface design (aka view), and a whole layer of programming to communicate between the two (aka controller). Then, if you want to change any one of them, you often have to change all three! Wagn wraps all of these into one simple organizing unit: the card.

I have Wagn set up on a Slackware instance on my VMware “beta” host. The Wagn installation serves as my personal IT knowledge base. It is customized to store various code snippets and server administration procedures as well as little bits of knowledge that is tactically useful for solving interesting but esoteric software/system problems.

I just reviewed Apple’s online video presentation and given the improvements and new APIs I think the iPhone OS 3.0 is the Killer App of the iPhone. This is similar to how the Java API itself was the Killer App for Java. Apple has provided most of the heavy-lifting, leaving the creativity to the iPhone software developers.

I think the upcoming APIs are going to make near-future iPhone applications so compelling, the end result will be that purchasing an iPhone will no longer be based upon the hardware or even cost. Competing mobile applications and their phones that are non touch and button-based, will be seriously outclassed.

The 3rd Party device API, will make the iPhone the ‘brains’ of dumb devices; the potential for innovation founded upon the iPhone enabled 3rd party devices is just too staggering to consider.

The new features and APIs will compel the building of new enterprise-level applications. I think that a new enterprise-level software/hardware development industry might just have been born today.

Impossible

March 1st, 2009

I first heard this when watching the old Disney movie “Black Hole”. It turns out, the quote is much much older:

“Impossible is a word to be found only in the dictionary of fools.”
[Napolean Bonaparte]

Project Naming Conventions

February 22nd, 2009

How about using major hollywood film titles?

The results would be hilarious and somewhat disturbing to non-insiders or to people that like to eavesdrop:

  • Project Alien
  • Project Bubba Hotep
  • Project Star Wars
  • Project Temple of Doom
  • Project The Day the Earth Stood Still

Linksys outage

February 10th, 2009

I’ve noticed that every few weeks the Linksys Router will inconsistently route traffic to and from the VMware servers. The only way to resolve this is to reboot the router. This is very annoying since any hope for a stable PPTP session from the Internet is completely toast because the Linksys won’t forward packets to the VMware servers.

No more cable

January 5th, 2009

For the Win:
  • Saving over $50 a month
  • Uncompressed over-the-air HD signals
  • No more talk-news pundits
  • Jim Lehrer News Hour in HD
  • PBS in HD

Adverts on Webpages

January 5th, 2009

One word: Tacky.

Development VMware Servers

January 3rd, 2009

From time to time, I do server-side adminstration, as well as software development and testing. To do this efficiently, I have set up a two server VMware installation.

Each VMware Server consists of the following hardware:
  • CPU: AMD Athlon™ 64 X2 Dual Core Processor 4800+ at 2.5 Mhz
  • RAM: 8 GB
  • Hard Drive: 150GB Raptor 10k RPM SATA
  • Motherboard: ASUS M2A-VM
To build each server, I used the following media:
  • Ubuntu-8.0.4-server-amd64.iso
  • VMware Server 1.0.5
  • vmware-any-any-update-116.tar
  • VMware-server-1.0.5-80187.tar.gz
The Instructions are simple enough:
  • install Ubuntu server
  • sudo aptitude install build-essential linux-kernel-devel linux-headers-generic xinetd ia32-libs linux-headers-server
  • install vmware server: When it asks to run vmware-config.pl, answer “no”
  • install vmware-any-any-116: When it asks to run vmware-config.pl, answer “yes”
  • Install bridge networking when prompted

The two VMware servers are named “alpha” and “beta”. The “alpha” server is configured to host different workstation instances and the “beta” server is configured to host different server instances.

New Homepage

January 1st, 2009

I finally got around to choosing a new blogging engine for EliteFrontier.org and I’ve chosen Mephisto. Mephisto is written in Ruby and uses Ruby on Rails. This is a definite plus, since I can easily update or modify the Ruby code at will. Performance is pretty good and initial test results are excellent.

EliteFrontier.org has gone through many incarnations over the past few years, starting as a minimalist wordpress blog, to a full multi-user Elgg installation, to finally a Mephisto based blog. So far I think Mephisto could be the foundation for new services and features, since Ruby is easily hackable.