[VB] Splitting a String into Characters (Mid + For Loop)

Splitting a string into characters is actually very simple, but it comes up a lot in ACM problems. For example, permutation and combination problems require you to split a string into characters before doing any calculation. The Caesar cipher also uses this technique. Below I'll demonstrate with VB.NET. Other programming languages can do the same thing, and the principle is identical....

December 28, 2010 · 2 min

Visual Studio 2010 - Developing with .NET Famework 4, Better Parallel Computing, and Automated UI Testing

I never used Visual Studio 2010, which came out in May 2010, until a few days ago. When I was installing Visual Studio on Windows 7, the installation disc I had was 32-bit and wouldn't install, so I downloaded Visual Studio 2010 Express instead. I originally thought Visual Studio 2010 wasn't much different from Visual Studio 2008, but after installing it I found out I was wrong. The executables it compiles are noticeably faster. That's because all of the controls in Visual Studio 2010 are built with .NET Famework 4, so they run faster. Visual Studio 2010 also upgrades (adds) many things, such as heterogeneous platform development management, DataTips, and parallel computing....

December 13, 2010 · 3 min

[C++] Sending a File to a Console Application via CMD and Returning Data

Actually, in C++ there's another way to read files besides simply using fopen, and it's much easier to implement than fopen: feeding the file to your C++ program through CMD. For example, say you have a program called test.exe and a text file called x.txt, and you want test.exe to read the data in x.txt and display it. You open CMD and type test.exe<x.txt, and it reads and displays the contents of x.txt. This article teaches you this way of reading files. Thanks also to a reader named Canghai, who taught me this technique....

December 4, 2010 · 1 min

[VB.Net] Get File Paths of a Specific Format in a Folder and Store Them in an ArrayList (Easily Adapted to Other .NET Languages)

Last time, while I was working on the entertainment feature of the new version of Desktop Locker, I needed to automatically get all the music files in its Resources folder. That led me to work out the code below, which collects the file paths of a specific format in a folder into an ArrayList. For example, if you want all the mp3 files in a music folder, you can use this code to do it....

November 7, 2010 · 1 min

How to Access Yahoo! Messenger from Code (Change Status, Log In/Out, etc.) (VB Example)

The day before yesterday, a few classmates got bored and started passing around prank programs that change Yahoo! Messenger statuses. That gave me the inspiration to design an advanced version of this status prank program. Writing a program that changes the status in Yahoo! Messenger is actually not hard, because Yahoo itself provides a COM component that makes it easy to configure the messenger. This COM component is called YahooMessengerLib. As far as I know, it can do the following: change the status, get the current status, and log in or out of Yahoo! Messenger. So let me show you how to use the YahooMessengerLib COM component~...

November 7, 2010 · 4 min

Sikuli Script - An Innovative, Easy-to-Write Programming Language

So what is SIKULI? I think anyone who has used game cheats (helper programs for online games) knows the famous Chinese macro tool AnJian Jingling, which automates keyboard and mouse actions. Sikuli Script is quite similar to that kind of tool (but it is not a cheat). Sikuli Script makes it very easy to build a program. Most programming languages today use purely text-based code, but Sikuli Script is different: its code is made of images. The author of Sikuli Script is a true genius to have come up with such a creative idea. Still, that may not make much sense to you yet (what do you mean, writing programs with images....?). So let's build a Sikuli Script program together!...

February 5, 2010 · 4 min

National Internet Programming Contest (NPSC)

I was about to take part in the National Internet Programming Contest. I assumed a competition this big wouldn’t have any cheating, right? But yesterday I read the rules and found that in the preliminary round you write your programs at home and then upload them to NPSC. On the surface that doesn’t seem like a problem, but look a little deeper and you’ll see that holding a competition at home makes cheating very easy. A teacher from your school can sit right beside you and teach you how to write the code, just like a teacher showing you the method next to you during a mock exam. And since the competition has a time limit, if an opponent has a teacher helping them cheat, their problem-solving speed is bound to be fast. That’s how I got knocked out before I even reached the finals…. ...

November 21, 2009 · 2 min

W3C Validation: Checking Whether Your Site's CSS Meets the Standards

About the W3C: The W3C is an organization dedicated to standardizing the web. It is responsible for drafting all kinds of web-related specifications. For example, the CSS4 standard and XHTML were both created by the W3C. Why create these standards? The reason is simple. Web pages are displayed in different browsers. If every browser used different syntax, web designers would have a hard time. But getting all browser vendors to agree on one standard is difficult. I think the main reason is that they're all competing with each other. That's why the W3C was created: an impartial third party drafts the standards, and each browser vendor (such as IE, Opera, and Firefox) must follow these basic rules. Of course, browsers can add their own syntax if they want. Still, not every browser follows the W3C specifications. Big names like IE don't, which is why many web designers have a love-hate relationship with IE (love, because so many people use it; hate, because it doesn't play by the rules). Now that you have a basic understanding of the W3C, let me show you how to check whether a web page meets the standards....

September 6, 2009 · 3 min

ACM: Q001 (★☆☆☆☆)

Write a program that finds the GCD (greatest common divisor) of two numbers. . Input and Output The input contains several lines of data, one pair of integers a and b per line. (0<a,b<10000000) A line with 0 0 marks the end of the input. For each input line, output the GCD of those two numbers. . Sample Input 12 36 25 24 0 0 Sample Output GCD(12,36)=12 GCD(25,24)=1 ...

July 25, 2009 · 2 min

[JavaScript] encodeURIComponent: A Function for Encoding URLs

When you use JavaScript to make GET requests, you’ll often run into the fact that JavaScript requires the URL to be encoded. For functions that need an encoded URL, you can use encodeURIComponent to encode it. ...

July 22, 2009 · 1 min