Fix: Windows 7 Chinese characters showing up as squares

One of the things I really like about Windows 7 is its ability to recognise and show me my Chinese stuff properly without me manually installing the Asian language pack that I had to install in Windows XP to properly view Chinese (and some say Japanese / Korean) characters in filenames, directories, or within certain software (ID3 tags for Japanese and Chinese music, yea!). But sadly, it worked for the majority of stuff, but sometimes it’ll show annoying squares instead of the characters. And here’s the problem: apparently, these characters aren’t in Unicode.

I found a solution for Win 7 Enterprise / Ultimate: manually install a language pack. Ugh, wasn’t not doing that the reason why I liked Win 7?! And why only Enterprise/Ultimate? I am only using Win 7 Professional, so I need to find another way to make this work.

So after more googling around, I found this trick, and it worked for me. It should also work if you’re trying to fix the problem for other Asian languages. I’m not sure about the rest (Arabic, etc) but I’m pretty sure this will also do the trick. If you tried it for non-Asian languages and it works, please comment below so others can learn from your experience :)

  1. Go to Control Panel, select “Clock, Language, and Region”

    Control Panel, "Clock, Language, and Region"

  2. Select “Region and Language”

    Control Panel, "Region and Language"

  3. Go to the “Administrative” tab, and click “Change System Locale”

    Administrative tab, "Change System Locale"

  4. Change your System Locale to “Chinese (Simplified, PRC)”. Or, if you’re fixing this for other languages, select the one you need it to recognise (Japanese, Korean, etc)

    Change your System Locale to the language you want recognised

  5. Click “OK” and restart. You have to restart the computer through that dialog box, otherwise it doesn’t recognise your System Locale change.

Now your programs will recognise those Chinese characters, but in some software, it will show all menus and instructions in Chinese. I don’t want that, I just want the Chinese to show up properly. So to fix that, repeat the steps up there, but change your System Locale back to “English (United States)”. Magically, it still recognises your Chinese characters that it previously showed as squares!

Posted in Computing | Tagged , | Leave a comment

The end of the DVD / BD era

I think DVDs and Blu-ray discs (BDs) are reaching the end of their era soon, and I will explain why.

Cost (US cents per gigabyte, quoted by Amazon today)

  1. DVD (still dominant in computers) hold about 4 GB of data. The cheapest one is 20USD for 100 pieces, so that’s 5 cents/GB of data.
  2. A Western Digital 2 TB hard disk costs 99USD. That works down to also about 5 cents/GB of data.
  3. 25GB Blu-ray disks are selling at 87 USD for 100 pieces. That works out to 3.5 cents/GB.

Seems like the the Blu-rays won. However, remember that these disks are write-once, whereas a hard disk can rewrite multiple times. Even as an archiving option, I would choose a hard disk, because so many elements can destroy a round disk (heat, sunlight, etc), whereas the hard disk can withstand much harsher environments. In terms of cost, the round disks have a slight advantage at Blu-rays, but hard disk technologies are quickly catching up!

Usage frequency
Can you tell me when was the last time you popped a round disk into a computer? (Don’t count BDs into gaming consoles.) You probably don’t remember. Now can you tell me when you last popped a USB thumbdrive into a computer? I think the answer is very likely “within the last few days”.

Why? Again, most likely because a DVD or BD is usually write-once, but your objective was most likely just to transfer data files from one computer to another. Burning a word document into a DVD drive just to transfer it into another computer sounds like trying to attack a nail using a sledgehammer. The DVD drive in your computer is most likely underutilized, and should best be gotten rid of because it’s a waste of resources.

In fact, 2 years ago, I made my family computer optical drive-less, and “conveniently forgot” to tell them about it. Over the 2 years, nobody in my family has ever complained that they needed the DVD drive. As this is only my personal experience, I would still recommend you have at least one computer with a DVD drive in your family, so that you can make ISOs and run them on the optical drive-less computers using virtual drives. In my house, my laptop is the one doing this job, since it has a DVD drive built-in to it.

Speed
The speed of reading from a hard disk (7.2k rpm usually gives over 100MB/s) is much faster than that of a DVD (24x gives 30MB/s) or even a Blu-ray (2x gives 72MB/s). Loading data from an ISO on the hard disk is faster than reading data from the optical drive.

The Internet and cost of bandwidth
Internet data transfer speeds have increased to the point where almost every download seems to be instant. On top of that, the cost of having such a cable line has become so low almost every household can afford it. So, why can’t you store the data that you wanted to store on those disks, online? Yes you can. It’s called the cloud. You can store all the data you want on the cloud, and access it from anywhere as long as you have an Internet connection. So there’s really no point keeping those DVDs around: make ISOs of them, put them on the cloud, and you can access them from anywhere with Internet. You don’t even have to bring that odd-shaped CD case around!

 

The future
So far, the only real use of DVDs / BDs I have seen are:

  1. DVD or Blu-ray movies for home theatre systems, and
  2. Blu-ray discs for game consoles (Xbox, PS3, Wii).

But, the future of home theatre is the cloud. The rise of Internet speeds and dip in Internet cost will eventually pave the way to fully streaming video even for a HD home theatre movie. BD and DVDs will have no future in here.

Although it looks like Blu-rays will still be here quite a while for game consoles, but just like home theatre systems, I believe that one day, Microsoft, Sony, and Nintendo are all going to open their own cloud store to sell games for their game consoles. You just pay for a game, download it to your console (which already has a hard disk in it), and start to play.

I see a world, 10 years into the future, when there won’t be any more DVDs and BDs, or in fact any “other discs” around. Do you see it?

Posted in Computing | Tagged , | Leave a comment

Installing Windows 7 from USB instead of DVD

Sounds incredible? Not to most tech wizards I guess. But for the rest of you muggles, this means that you don’t need to use a DVD drive in order to install Windows 7. Instead, just plug in a USB Thumbdrive, and the installation feels much like what you do with a DVD.

The upside of this? Quite a few:

  1. Supposedly, *much*, *much*, faster installation times. This has been quoted in many articles as one reason to move from DVD installation to USB installation, but a quick check on read times for USB 2.0 and 24x DVD drives on Wikipedia (citation required :P ) tells me this is wrong. Both theoretically give you 30MB/s thereabouts.. So unless someone decides to run a fair test and install the same OS on the same computer using DVD and USB and time them, I won’t be able to say for sure this is one good reason :P
  2. However, you get to install an OS on a optical drive-less computer! I’ll probably post next about why I think an optical drive-less computer is awesomely cool. Here’s a list of reasons why I think an optical drive-less computer is awesomely cool.
  3. If you do OS installations often, you really don’t want to lug a big CD case around with that installer. A thumbdrive is easier to carry around (This applies more to tech helpdesks though, rather than normal humans).
  4. You can store the custom drivers on the same USB drive, but you can’t do the same with a DVD (unless you burn a new one). In fact, you can make new folders on the USB drive and use it as per normal. All they ask is for you not to touch the folders already created for the OS installation.

Woops, I ran outta plus points. Anyone who can think of more can comment on this and I’ll edit this article to include it.

I think almost all computers for the last 5 years are BIOS-equipped with booting from USB. If your friend had a computer that needed reinstallation, chances are it was bought in the last 5 years, so this can help him/her.

Actually, there are already quite a number of articles teaching you how to do this. Searching for “USB install windows 7″ on Google (today) yields this and this article on the 1st and 2nd spot respectively. Following the instructions on those links will give you all you need to install Windows 7 from USB, except..

These caveats below weren’t mentioned, but I bumped into them while trying to follow the instructions. I’m writing them here so anyone who sees my article hopefully doesn’t waste time with the same mistakes I made.

  1. If you’re like me, you probably hung to Windows XP for your dear life, not moving on to Vista, and finally decided that Windows 7 is good enough that you want to make a great leap forward. If so, I’m sorry, the diskpart utility in Win XP does not support USB drives. My recommendation? Borrow a friend’s computer that already has at least Win Vista installed. Vista and 7 both have diskpart which supports USB drives. This chicken-and-egg problem had me muddled for awhile.. And if you really don’t feel like troubling your friends, you can use your Win 7 DVD (or the ISO of it) to first install it as a virtual OS (I like VMWare or VirtualBox), and use it to configure your USB drive, then reinstall the real computer. I used the Virtual OS way to get my USB drive configured.
  2. Windows comes in 32-bit and 64-bit OS. If by chance you’re trying to install the 64-bit version and the OS you’re using to follow instructions is 32-bit, you will get stuck at the “BOOTSECT.EXE /NT60 <usb drive letter>:” command. I’ve not tried what happens if you wanted to make a 32-bit USB installer using a 64-bit OS. I think it should be backward compatible, but no guarantees on this! The solution to this is just to shrug your shoulders and find a friend who’s using the same 32- or 64-bit OS as the one you are going to install.
  3. It’s all nice and happy and you finally reach the Windows installation part! But for some reason, Windows 7 installer will create an extra hidden system partition during the installation process. Searching online tells me that this is supposedly a safety feature to make it harder for viruses to attack the core components of Windows. Hmm… nah not interested. I prefer my drives to be cleaner in partitions. The solution… remove the additional drive before the OS installation phase.

Now to let you in on the biggest secret.. If you followed all the instructions on those 2 articles, good for you! But for lazy bums like me.. this is so much easier than pasting lines of command into DOS :P It has the additional advantage of circumventing problem 2 (32 vs 64 bit problem) too! Thank you Microsoft for creating such a useful tool!

Posted in Computing | Tagged , , , | Leave a comment

Java’s sleep(), suspend(), and resume()

As we all know, the very useful Java Thread methods sleep(), suspend(), and resume() have been deprecated. Many articles online tell us to use a control variable instead, by polling the status of the variable at key points in the run() method. This may be a good idea, but I felt that we could have done better. For example, thread synchronization: what happens if all you need to do is wait for a particular signal to continue? There’s really no point in awakening the thread every x milliseconds just to find out that it should still be sleeping. Just as an analogy: Would you like to wake up every hour to check your email?

Solution: the wait() and notify() methods in a Thread class. To understand why they are named this way, you must first understand the role of locks (aka mutex/semaphore) in thread synchronization. I assume you have a basic understanding of what locks are.

Locks in Java are pretty simple, and you only need to know the synchronized keyword. Each object in Java is its own lock, so you may lock on any variable or object that you have a reference to. If you’re going to use thread synchronization, then it’s most likely that the thread in charge of notify() has is a reference to the other thread. So the waiting thread should put a lock on itself. In terms of code:

// put this code in the thread that should be waiting
synchronized (this) {
  wait();
}

You can also set a timeout to wait using wait(int n) so that it continues after that time, regardless of whether it was notify()-ed. This can be a good substitute for sleep(int n) too, if you didn't implement notify() anywhere else :P

Here's the example code to set you going.

public class TestThreadWait {
  public static void main(String[] args) {
    final WaitThread w = new WaitThread();
    w.start();


    final Timer t = new Timer();
    TimerTask tt = new TimerTask() {
      public void run() {
        synchronized (w) {
          w.notify();
        }
        t.cancel();
      }
    };
    t.schedule(tt, 5000);
  }
}


class WaitThread extends Thread {
  public void run() {
    System.out.println("Entering wait, should wake in 5s..");
    synchronized (this) {
      try {
        wait();
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    }
    System.out.println("Out of wait!");
  }
}

Posted in Computing | Tagged , | Leave a comment

http Keepalive

I was making a client program that connects to my server online a few days ago. Then I wondered about the kind of connection I needed to make with my server. It was a problem because:

  1. I cannot run external applications on the server (this is a shared host). Therefore, I wanted to use individual php scripts backed by a MySQL server to serve all the functions through a http connection.
  2. Certain aspects of the program was passive, and required just listening to the server for data. It is unknown how long the connection needs to last, but would normally last around 15 mins. It would be pretty safe if I could get a connection that stays alive for at least 30 mins.

Since the problem of which port to use was determined by my first requirement, I needed to find out whether a http connection performs the same as other kinds of connections to other ports. Theoretically, there would be no need to do this, because a port 80 connection should be no different from other ports. But port 80 is managed by web servers (eg. Apache, IIS), which impose their own sort of rules. One of which I’m aware of is that connections that are idle for more than x minutes will be forcefully terminated by the server. Such a thread should be assumed dead by web server standards, since a webpage should theoretically stream data continually (in the case of downloading a massive file) or close itself (since the required data has all been streamed out). Another restriction I know possible on Apache servers is the ability to close any connection that has been alive for more than y minutes, regardless of whether it is in idle. This is because Apache has a fixed number of threads it can use to serve pages, and it has to have a way to say when a thread should likely be no longer in use.

The first problem will force me to stream data (whether real or bogus) regularly down the connection in order to keep it alive. We don’t want to force useless data through the pipe too often, because that will increase bandwidth usage for nothing. The second problem will determine whether I can actually use http to stream my data down without needing to constantly reconnect.

I made a simple php script that uses GET to get a start and end count, with a stepsize. Using these parameters, I sleep the script in a for loop from start seconds to end seconds, each time adding a step of stepsize. Stepsize will determine your accuracy, and start and end is the range of numbers you’re guessing the connection will timeout after. I used 30s accuracy, and found that my webhost terminates an idle connection after 5 minutes.

For the 2nd part, I made another script that takes a sleep time, and number of iterations it should go through before ending the script. I used 5 minutes for sleep time, and put it for 180 iterations (15hrs total). I really wanted to test up to 10hrs, but put 15 for fun :P The script ran for 132 iterations before I stopped it (time to sleep!). That’s a grand total of 11h!

I assume that it will run forever since it has already run for 11h. This should likely be okay.. since a normal webpage has a serve time in seconds or milliseconds, 11 hours would certainly seem like eternity.

Actually, the results for the 2nd part makes sense. A connection is only dead if either side (server or client) can no longer receive and send data. As long as data is sent and replies are heard on both ends, this means that both sides have still kept the connection open. How can such a connection be considered dead?

I would also like to note that my results are subjective. Different web servers have different settings, so it is important not to rely on just my results if you have the need to use a long http connection like me. In future, I would also like to test this on the major cloud providers (AWS, Google Cloud. Azure is out cos I need to pay, unless someone is willing to host my script and let me do my little experiment :P ). They may have interesting restrictions too.

Posted in Computing | Tagged , , | Leave a comment