Blogs

Breakdown of Test Mistakes

Every point I lose on a test can be categorized into one (or more) of the following:

  • Careless miss: This is the most common, and includes arithmetic mistakes, misreading a well-composed question, or circling the wrong letter. The incidence quickly approaches zero with more time and practice (i.e. taking practice tests or doing homework), but can rarely be eradicated by simply studying. Of course, there's the random occasion when a test question asks what you've studied exactly--then you just have to recite from memory
  • Compulsory miss: What? A term or concept appears on the test that I did not come across during lecture or whatever other means of preparation. For example, professors sometimes pull random concepts from the textbook (which aren't covered in lecture), just to give those who read a little bonus. There are few fixes aside from doing all the reading, and these are often unavoidable also (hence compulsory).
  • Capacity miss: I could have sworn I've encountered this fact, concept or term somewhere--I even remember which lecture! But what it really means escapes me. This is when my memory fails. Reviewing lecture slides help immensely.
  • Conflict miss: Instead of forgetting something I've encountered, or not ever encountering the concept or fact at all, I simply learned it wrong. My understanding of the concept was wrong. Or I mixed up two different concepts that seemed similar. This is like careless mistakes, but instead of at recall-time, it's at store-time.
  • Consistency miss: The lecture, test questions, or study material were inconsistent, confusing, or misleading. I can often detect them, but I can't prevent them.
  • Clueless grader miss: The grader makes a mistake. Improving penmanship helps.

Some things can be addressed with practice (careless, capacity and conflict misses). Some things can be addressed with review (capacity and conflict). Some things require extra work (compulsory misses). Some things require vigilance (conflict and consistency misses).

But there are trade-offs with each. It's a matter of where you are weakest, and how you are most effective.

What do you think? Did I cover all the basic ground with these categories? (You can tell I modeled this on the types of cache misses)

Bookmark and Share

Spam

Dailycow got spammed a couple times recently. Registrations now require admin approval so if you want to register to comment, contact me.

Bookmark and Share

StringBuffer vs. StringBuilder

I'm doing some research work that involves heavy work with the Java string classes (I have IBM Java), and I was trying to determine concretely (besides synchronization and such) the differences between StringBuffer and StringBuilder. I replaced "StringBuffer" with "StringBuilder" in StringBuffer.java and then diffed them. The subsequent confusion led to an interesting discovery.

Before I go there, here's a brief summary for those of you with modest Java experience: StringBuilder is similar to StringBuffer in that it can be used to dynamically build strings of indeterminate length. The main difference is that StringBuilder, which came later (Java 1.5), is not synchronized (meaning that multiple threads could cause objects to act unexpectedly--a risk that pays for some level of performance), unlike StringBuffer. But since I was dealing with them at the code level, I needed to know more deeply where they differ.

Back to the topic: Check out the following excerpts from StringBuilder.java:

The constructor:

/**
 * Constructs a new StringBuffer using the default capacity.
 */
public StringBuilder() {
	this(INITIAL_SIZE);
}

A normal method copied from StringBuffer:

/**
 * Optionally modify the underlying char array to only
 * be large enough to hold the characters in this StringBuffer.
 */
public void trimToSize() {
	if (!shared && value.length != count) {
		char[] newValue = new char[count];
		System.arraycopy(value, 0, newValue, 0, count);
		value = newValue;
	}
}

Another method copied directly from StringBuffer:

/**
 * Adds the specified code point to the end of this StringBuffer.
 *
 * @param		codePoint	the code point
 * @return		this StringBuffer
 */
public StringBuilder appendCodePoint(int codePoint) {
	if (codePoint >= 0) {
		if (codePoint < 0x10000) {
			return append((char)codePoint);
		} else if (codePoint < 0x110000) {
			if (count + 2 > value.length) {
				ensureCapacityImpl(count + 2);
			}
			codePoint -= 0x10000;
			value[count] = (char)(0xd800 + (codePoint >> 10));
			value[count+1] = (char)(0xdc00 + (codePoint & 0x3ff));
			count += 2;
			return this;
		}
	}
	throw new IllegalArgumentException();
}

If it's not apparent yet, what's clear is that the authors of IBM Java 5 copied-and-pasted StringBuffer into StringBuilder--word for word, including comments--and changed some variable names until the red underlines (from syntax errors) disappeared, and forgot about the comments.

Interesting discovery. I'm not sure what the lesson here is. I suppose enterprise developers are also lazy and forgetful.

Bookmark and Share

Economic Paradigm Shift

This is the seed for the second wave of economic modernization in China, set to take over the declining role of dirty industry.

Bookmark and Share

Political Discord at the Copenhagen Summit

Mark Lynas, A so-called journalist for The Guardian claims that China wrecked the Copenhagen deal. To see why, let's take a look at the emissions per capita:

It becomes abundantly obvious that citizens of China haven't taken advantage of their share of the Earth's resources nearly as much as most other countries, yet the US insists on capping the entire developing world at that level. What must happen is that (1) all countries must agree to a global emissions cut of 20% by 2020 and 15% for each additional decade, and divide that proportionately with the world's population; (2) an open and international research organization to coordinate on policy prescription, technical innovation and civil education; and (3) agreement on concrete measurement devices to maintain records of progress--changes in average yearly temperatures, level of rainfall, forest acreage, and of course, emissions numbers.

Lynas further demonstrates his inhibited vision of the world. He continues, "I am certain that had the Chinese not been in the room, we would have left Copenhagen with a deal that had environmentalists popping champagne corks popping in every corner of the world." What he ultimately meant was that his absolute confusion prevented him from seeing the issue from the other 4/5th of the world's population.

Yes, environmentalists in the west, oblivious to the desire of people in developing nations to exercise the same rights to development as those in the developed nations, would have been celebrating; but certainly not in every corner of the world.

He claims to have been at the climate summit. We need someone more humanistic and rational to represent the developed world. After all, this planet belongs to no one--hence, no one is entitled to a larger proportion of its resources than anyone else, certainly not the developed nations that triggered the problem in the first place.

It frustrates me to know how biased, selfish and close-minded people can be. This is our world to share and save; let's protect it together.

Bookmark and Share

Why This Recovery is Good for the Long Run

In the previous article, I briefly laid out the case for a jobless recovery in the short run. However, despite the immediate pain, it has positive long-term consequences.

  • The federal government has more time to fix the entitlements issue with regards to the boomers. Their accumulated skills and experience are necessary in the workplace, and with last year's market decline, they have a stronger incentive to work--and pay taxes--than retire--and draw entitlement funds.
  • Greater investment in capital will allow us to achieve the same level of production using fewer people, or equivalently, more production using the same number of people.
  • The above, combined with our lessened propensity to consume, will help lower (or perhaps altogether eliminate) the trade imbalance (net exports)
  • The savings rate going back to a more normal level will help investments in future growth

Perhaps the US will be in a less unsustainable path of unbridled consumption after this transformation.

Bookmark and Share

The Abbreviated Case for the Jobless Recovery

There are three key reasons why this recovery will be fairly jobless in the short run:

  • Aggregate demand is below the normal level because of increased propensity to save and the permanent rise in energy costs (Oil likely won't return to pre-Katrina levels)
  • The workforce is above the normal level because of the recently-devastated retirement accounts of the boomers; they have to work a few more years to compensate for the lost retirement value
  • Companies are increasingly turning towards technology and automation as the way to increase margins and profits. Capital investment is long-lasting and should provide them with increased capacity (at any given labor employment level).

The increased capacity due to both a larger workforce and capital expenditures, combined with lower aggregate demand for the final products will lead to a near-term squeeze on employment and wages. For the inflation hawks, this means wage-pressure inflation still has a long way to go before becoming an issue.

Bookmark and Share

University of California, Incorporated

With the massive 32% tuition hike on top of endless years of double-digit increases, the University of California is not far from achieving full privatization. The days of world class education for the public are quickly coming to an end due to incompetence higher up. The potential of California's future is being gradually sacrificed to feed the hunger of the past.

We are entering an unmitigated cycle of doom and bust. The treasure that has attracted the world's brightest will soon be nothing but the smoke from a smothered candle.

Bookmark and Share

It Worked for Salt--It'll Work for Rice

Before we worry about how many people go to bed hungry in the world, we must tackle an even more damaging yet easy-to-fix problem--how many people are simply malnourished.

It costs less than a dollar to fortify an entire ton of rice with essential nutrients like calcium, many metals (like iron), and vitamins, whether by genetically engineering them to be more nutritious or by artificially mixing them in. Yet, for that dollar, it produces at least a ten-fold (estimated 17x) return within that year in terms of boosted productivity--not to mention the higher standard of living, better health, and clearer mind. The social dividend from this minor investment will be on a scale magnitudes more significant than the global iodizing of salt.

So why don't developing nations invest in such a project? It has three options:

  1. Pay for it: Distribute fortification materials to farmers, or expand the ambitions of agriculture research labs, and distribute engineered seeds. For the few hundreds of millions of dollars spent annually, more than that will be earned back in increased productivity (captured in taxes), better health (captured in lower health costs and higher happiness), and political points (for the democracies). This is the preferred option
  2. Force it: By law, all rice has to be fortified. This has enforcement issues. Since farmers aren't paid to do it, they have no incentive to pay to do it themselves.
  3. Hope for external help: This isn't exactly a complete option--but hope for help from an agency like the IMF or WFP--and simply deal with enforcement

Each idea has issues with centralization, because farmers aren't as concentrated as salt-producers, but if implemented correctly, will provide tangible returns ad infinitum. So why not give it a try?

Let's start with China and India.

Bookmark and Share

The Law of Conservation of Procrastination

Similar to the law of conservation of energy and mass, there's another universal law just as applicable--to students.

When one form of procrastination is blocked, another takes its place. When Digg and Slashdot began to phase out, Google News reemerged in renewed prominence. When I chose to stop reloading Google News, FML and MLIA came into the picture. When I finally blocked FML and MLIA, Failblog staged another comeback.

Not to mention, Reddit has been slowly creeping into my procrastination arsenal since summer.

So all in all, blocking one means of procrastination won't help. You'll just find that an even worse means of procrastination comes into being. Therefore, I propose a new universal law--that of the conservation of procrastination.

Because the only way you'll procrastinate less is if your peers procrastinate more. (*shakes fist at Courtney* for getting me into Reddit) By the way, for the rest of you, be sure to frequent the websites I mentioned up there!

Bookmark and Share

Syndicate content