Sunday, June 28, 2009

Why I don't value American culture

A society should support and improve people's lives. Capitalism focuses on something else: supply and demand and profit. The problem is that profit or demand for something does not mean that it is a positive contribution.

Drugs are the easiest example. They are in demand but most people feel that at least some drugs make a negative contribution. They're not the only example however. There's also unhealthy food, television, video games and more.

The main counter-argument is personal responsibility and in particular the idea that if someone makes bad choices, that is their fault. However, things are not that simple. From one point of view people make decisions from their own free will, but from another point of view people may be influenced in various ways. For example, consider the amount of money being spent on advertising. That money is spent because it is often a worthwhile investment; it changes people's behaviour. For another example consider food. It's possible to carefully optimize food to increase its appeal to people, but that doesn't have to make food healthier.

America obviously isn't the only capitalist country, but it seems to be the one that's most involved in this destructive cycle of recklessly increasing demand to produce profit. For example you can see what happens when unhealthy food is optimized for appeal, and when advances in video games make them so appealing and available that children spend more time playing video games and less time playing outside. You can also compare BBC to American television and food in other countries with US food.

When the government tries to fix the problem via laws, that can fail and just cause more pain and suffering. The problem is that laws are used as a crude tool which essentially amounts to ongoing terrorist attack. They say that if you do something bad, agents of the government can take your money, possessions and freedom. For example the US war on drugs hasn't worked out very well, and America has the highest incarceration rate in the world. Laws don't seem to be able to create a substitute for a healthy culture. For example, compare what US alcohol laws do with other countries which have a healthier culture surrounding alcohol.

The worst part may be how American culture is spreading throughout the world. Look at its icons: companies like Coca-Cola and McDonald's. That can't be good. The problem is that the main motivation to spread comes from companies who want more customers so they can increase demand and profit.

Culture has a sort of inertia, which is a double-edged sword. It means that old healthy patterns can persist, but it also means that when new unhealthy patterns form, they tend to persist. Because of inertia, culture has value. Positive patterns are an asset and negative patterns are a liability. People need to keep this in mind.

The main hopeful thing I see is that the same things which cause problems can also be used in a positive way. For example, maybe capitalism would work if sales involved the true value of objects: both their current value and their long-term value and/or cost. Also, an ability to effectively influence people can also be used to influence people to make healthier choices. Many things cause harm when overused or otherwise abused, but they still can have a constructive place in life if used intelligently.

The main obstacle I see is lack of awareness about the fundamental problem. Awareness seems focused on particular instances of the problem such as the mortgage crisis, obesity epidemic or messed up health system. People need to understand the underlying pattern which needs to be fixed.

How to copy Windows from a bad hard drive

If a hard drive starts going bad, and read errors and bad sectors start appearing, what do you do? It's best to have a recent backup, and if you don't, it's best to recover your files and settings and reinstall Windows on a new hard drive. However, if there aren't too many bad sectors, it's possible to copy Windows from an a bad hard drive to a good one. Here's what I did.

First, I considered the requirements. I did not want to run chkdsk or otherwise attempt to fix things on the bad drive, because that could make things worse. I wanted to transfer the entire filesystem, not copy individual files. I wanted to know which files have read errors, so I could see the extent of damage and then either replace individual files or conclude that the situation is hopeless and reinstall. Finally, I wanted the process to be reasonably fast and automated.

Disk cloning software seems like the obvious choice. Unfortunately error recovery and logging features are lacking. After some research it seemed that no disk cloning program will create a log of files with errors. The only promising program was DiyDataRecovery Diskpatch, but it was ridiculously slow.

I decided on another approach: ddrescue. I downloaded the Ubuntu Rescue Remix, booted it and ran ddrescue, putting the log on a USB flash drive. The initial copy was fast and simple. Then, retries quickly read about half the bad sectors. I was left with 26 sectors which seemed totally unreadable. The ddrescue log gave offsets, which I divided by 512 in an automated way to give sector numbers.

Now I put the write protect jumper on the old hard drive and swapped the SCSI IDs. I wanted to be sure that the sector numbers I had remained valid. This was probably unnecessary and it complicated things. Windows started booting off the new drive, but then it mounted the partition from the old drive as C:, and I got a blue screen of death because of write protection. (Make sure you set up Windows to not automatically reboot after a BSOD. It's much easier to set that option in Windows than to edit the registry when Windows can't boot.) To fix the problem I used a disk editor to change the disk signature in the MBR of the new disk, and then I used Partition Saving to update which partition is mounted as C:.

Finally, I was able to boot Windows on the new drive. I used nfi.exe (from OEM Support Tools Phase 3 Service Release 2) to find which files those bad sectors corresponded to. The results were encouraging. Only one bad sector was in a real file, and Windows File Protection took care of that. The others were already marked as bad sectors or in unallocated space.

Since the filesystem on the new drive was directly copied from the old drive, it had sectors which were marked as bad. I needed to remove these. Again, I used Partition Saving. This was probably a mistake.

Now it was time to increase the size of the partition because the new drive is larger. Unfortunately, partition resizing programs refused to work. This wasted by far the most time of the whole operation. Eventually I tried ntfsresize, which told me I had hopelessly many bad sectors. (This is the sort of unprofessionalism found in open source software; it shouldn't be making an emotional comment. Commercial software handles the problem in a more professional way, such as cryptic error codes, generic error messages telling you to run chkdsk, or lockups.) Eventually I concluded that the bad sector file was corrupted in a way that chkdsk was unable to detect or fix. I suspect the problem was caused by Partition Saving, because Partition Magic started once before I reset the bad sector list and it always locked up after that.

Fixing the bad sector list was a problem. The /b option in Vista chkdsk didn't help. I read about a method using ntfstruncate, but a LiveCD with ntfstruncate was hard to find and ntfstruncate refused to work. Finally I recompiled ntfsresize, commenting out that check for hopelessly many bad sectors. (I used System Rescue CD. Besides rescue tools, it also has basic networking tools and gcc.) After a resize, chkdsk found some problems with the bad sector file, and after that everything was fine. Mission accomplished.

One interesting pattern here is that open source tools were far more useful than commercial software. For example, I used to think of Ghost and Partition Magic as important tools, but their poor error recovery and reporting made them useless here.

Thursday, June 25, 2009

A better way to play FLV files in Windows

I used to play FLV files using FLV Player. That worked fine, but I've now found a better way: FLV Splitter from Guliverkli2 and ffdshow tryouts. With these, I can play FLV files in practically any video player which supports DirectShow.

Monday, June 15, 2009

Tulip trees are interesting

Tulip trees are interesting. The flowers really are tulip-like from the outside, but they are greenish so, so they're not as spectacular and noticeable as the name implies. The inside of the flower is especially interesting. Here are some photos I took today:


Sunday, June 14, 2009

Friday, June 05, 2009

What I did about my Reddit addiction

Reddit is an endless source of information and discussion on practically any subject. I find it endlessly entertaining, highly addictive and almost entirely unproductive. I finally found the perfect solution: I blocked the Reddit cookie, and I don't log in anymore. Sure, I still go there, but I don't linger, and so I spend very little time there.

It's interesting that this worked but blocking Reddit via LeechBlock didn't. If I try to extrapolate from these experiences I come up with two relevant ideas or hypotheses:
  • Directly fighting myself over what I want or don't want to do is stupid.
  • Psychological addiction is not a craving for something, but a tendency toward a particular pattern of activity.