Welcome to the Daily Cow (Note: COW, not CAL), your daily source of bull, er, cow-related articles! As you enjoy your visit, ask yourself, who needs The Daily Cal when you have The Daily Cow (about us link)? Be sure to sign up or sign in and let your voice be heard! (or seen on the screen) You will be surprised how many things there are to learn about cows and how prevalent they are in our society.
Every point I lose on a test can be categorized into one (or more) of the following:
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)
Dailycow got spammed a couple times recently. Registrations now require admin approval so if you want to register to comment, contact me.
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.
This is the seed for the second wave of economic modernization in China, set to take over the declining role of dirty industry.
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.
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.
Perhaps the US will be in a less unsustainable path of unbridled consumption after this transformation.
There are three key reasons why this recovery will be fairly jobless in the short run:
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.
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.
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:
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.
Recent comments
6 min 20 sec ago
1 day 8 hours ago
4 weeks 5 days ago
4 weeks 5 days ago
16 weeks 5 days ago
17 weeks 1 day ago
17 weeks 4 days ago
17 weeks 4 days ago
17 weeks 5 days ago
17 weeks 5 days ago