Friday, December 31, 2010

Learning to Type

I only learned how to touch type (typing without looking at the keyboard) when I was in high school.  I used to type at a decent speed (~40 words per minute), but it was only after I learned how to touch type that I could raise that up to 80 words per minute.

If you have to do a lot of typing, such as writing reports for school, programming, or even casually blogging, typing quickly is extremely valuable.  The faster you can get your ideas down, the more time you have to do other things.  It is really annoying when you have so many good ideas, but you took so long typing that you forgot what you were going to write.

I first learned to type when I was in 10th grade.  I took AP World History, which had a lot of homework that involved reading the book and taking notes on it.  Usually, it ended up as a 1 - 2 page note-sheet.  Of course, I could read and process much faster than I could type, so my typing speed was definitely the bottleneck for my homework completion rate.

I decided that I would learn how to type faster.  This is the part where most people stop trying to learn, because your typing speed drops dramatically in the first few weeks.  Right when I decided to switch over from random typing to touch typing, I probably had only 15 - 20 word per minute.  Yes, that's very slow!  I had to constantly remind myself to keep on typing correctly, because once I stop thinking about touch typing, I would automatically revert to looking down at the keyboard and typing with random fingers again.  Since I typed so slowly at first, it took much longer to do my homework.

However, I could see improvement after a while.  My speed began picking up.  After a few days, I could type without looking at the keyboard, but I still had to sometimes stop and think about where certain keys were.  After a week or two, I could type just as fast as I used to be able to.  After around a month, it became habit.  I could touch type without a problem.  My typing speed doubled!

If you don't know how to touch type, then I think you really should.  It really helps a lot, especially after I learned how to program.  If you're extra-awesome, maybe you want to learn how to type with a Dvorak Keyboard, which has better key layouts for faster typing with fewer errors because it requires less finger movement by placing the important keys in the middle row.

Thursday, December 30, 2010

Spelling and Grammar

De ez-est whey two luk smartur (or dummer) then u r s 2 uz (or not too uz) curekt speling and gramr.  Evin tho its exceptable 2 uz abbrs 4 neerly evry wurd n a 4um poast, Facebppl statis updayt, or txt msg, it luks a lot wurs dan if ech wurd wuz writen out kurektly & teh sentens had kurekt gramar.

(The above paragraph translated into English)
The easiest way to look smarter (or dumber) than you are is to use (or not to use) correct spelling and grammar. Even though it's acceptable to use abbreviations for nearly every word in a forum post, Facebook status update, or text message, it looks a lot worse than if each word was written out correctly and the sentence had correct grammar.

If someone was reading a post that you made, and every other word was spelled wrong with sentence fragments all over the place, then the first thing that he (or she) will think of you is that you're lacking in intelligence because you can't even write normally.

So, I suggest that you keep spelling and grammar in mind when you write stuff, even online.  It will help you in the future if you can make it a habit.  If you haven't already taken the horrific SAT, then constantly using correct grammar will help you in the new and terrifying Writing section.

Remember, if you're really smart, but can't get your ideas across, then you'll still look pretty dumb.  Unless, of course, you're like an Einstein.  Communications skills are so important in today's world, and it all starts with spelling and grammar.

That brings up another point: What happened to teaching those two skills in elementary school?  Even though there are still spelling tests, they are so easy that they don't really teach anybody anything.  Here's an [exaggerated] example:
Teacher: Time for a spelling test.
Kids: <Groan>
Teacher: Here's an easy one: Spell "I" as in "I love you."
Kids: <some write "I," others write "eye," even others have no idea>
Teacher: The next word is a lot harder: Spell "add" as in "To get the total number of apples Robin and Martha have, add them up."
Kids: <some write "add," others write "ad" because they don't know how to spell it or because they don't know the difference between "add" and "ad," still others have no idea>
... etc ... more words of this difficulty.
Teacher: Here's the bonus word -- it's a real challenge: "flower" as in "I picked flowers for my mother."  I'll even give you a hint: It has 6 letters!
Kids: <some write "flower" (good job!), some write "flour" even though it only has 5 letters, some write "IDK" because they text too much already at a young age>
Teacher: All right, that concludes our spelling test!  It's time for recess!
Kids: Hooray!!!  (then they run to the computer to play video games and turn their brains to mush)

I hope there's a reason that elementary school is also called "grammar school."  Incorrect grammar has been imprinted so deeply that using the correct grammar makes you an outcast.  "May I go to the bathroom?" ... "That's not right." ... "May I go to the bathroom, please?" ... "That's still not right." ... "Can I go to the bathroom, please" ... "That's much better!"


I think it's OK to misspell a word here or there or to forget your grammar rules (temporarily) if you are chatting online or sending text message because nobody besides maybe a few people will see what you said, but if it's going public, then you should correct the easily spotted mistakes first, including typos.

Is the spelling and grammar problem fixable?  I think so.  The question is: Will you be part of the solution or part of the problem?

Wednesday, December 29, 2010

FarmVille Bot

FarmVille is this "popular" game on Facebook.  In a nutshell, you're a farmer, and you just have to plant and harvest crops to level up.  It's a surprisingly addicting game.  However, the one turnoff is that it takes so long to individually click each field (those who play the game know what I'm talking about).  It can take up to 30 minutes if you have a large enough farm.

This program uses several of the C# classes I posted on my blog earlier:
C# Mouse
C# InputBox
C# FileSystemDialog

It also a class I made up for this program called the Location class.  If you want to look at it, then just download the source code (at the bottom of this post).

I developed a pretty easy to use tool for working on your farm (it works best if you have just a massive square of fields).  Refer to the image below:


What you have to do is tell it how many rows and columns of fields it has to work on and where the four corners of the rectangular region you want to harvest are.  TOP means the top-most field, LEFT means the left-most field, RIGHT means the right-most field, and BOTTOM means the bottom-most field.  I'm pretty sure you could have figured that one out.  To set these values, you have to select one of the boxes, and press space when your cursor is over the respective field.  The program will automatically rotate the selection counterclockwise, so I recommend starting at the TOP box and then going LEFT, BOTTOM, and RIGHT.  Also, I think it's best that you go to the market and select any crop so that you have your actually mouse pointer when you're setting these values.

The program will not click on the field indicated in the exceptions box.  Click "Add" to add an exception to the field given by the row and column in the rectangular region.  Keep in mind that the left-most field is at row and column 0 (ZERO).  For example, you'd use this to skip over the square that my guy is standing in at the center.  By the way, it's best that you fence in your character using hay bales so that he doesn't have to walk over to the fields to work on them.  It saves a lot of time.

Just hit the "Go!" button to begin the operation!  Watch as the program does all the work for you.  However, you can't minimize the FarmVille window until the program is done clicking on all the fields.  If it misses a few fields, you can probably click them yourself and then tweak the corner locations later.  If it totally fails, then you can just minimize the FarmVille window (or show desktop using the Windows Key + D) and then try again.

In the File menu, you can save your farm.  The program will automatically load the file called "Default.fvm" if it exists, so you are going to do the same farm over and over again, save it as "Default.fvm."  You can also load existing farms.  Also, just in case you forgot to save your farm, it creates a file called "LastFarm.fvm" automatically.  It will be overwritten the next time you exit the program, so make sure that rename this file to something else if you want to keep it.  Keep in mind that the program can only read and write .FVM files.

A hint to those who have irregularly shaped farms (that aren't rectangular or square).  You should divide your farm into as few rectangles as possible, and make a save file for each of those rectangles.

You can download the program here ("FarmVille Master.exe").
You can also get the C# source code here ("FarmVille Master.zip").

Have fun winning at FarmVille!

Tuesday, December 28, 2010

Sentence Spacing

Many of you probably have never even thought of this before, but do you put ONE or TWO spaces after the period at the end of a sentence?  I have always put two spaces, but modern conventions are otherwise.

Way back in the day, people used typewriters.  They had mono-spaced fonts (which meant that all letters took up the same space -- an "W" was as wide as an "i").  Courier New is a mono-spaced font.  In order to make things more readable, a double space would help readers know where sentences ended.  However, in today's word processing, the letters in fonts are now proportional.  Times New Roman, arguably the most used font today, is a proportionally-spaced font.

Even though single-spaces will suffice because of the newer fonts, I still think that a double-space makes the text overall more readable.  That's kind of weird because I wasn't even around when typewriters were used.  However, most style guides are saying that the single-space is correct.  It's too bad I don't think I'll ever switch to the single-space.

I guess it's all due to personal preference.  Since I've been seeing my own double-spaced typing ever since I started using the computer, anything else looks funny to me.  Of course, I can't really tell unless I scrutinize the text, but upon closer examination, the single-space after the period always looks cramped and it irks me.

Arguing the other side, some people may think that the proportionally-spaced fonts makes the double-space obsolete. They think that the extra space between sentences looks strange and detracts from the flow of the text. Besides, it's more modern and it's one less keystroke between sentences! (In this paragraph, I used a single space after each period. It looks really weird to me.)


Hi. I'm Weird. I like single-spacing.
Hi.  I'm Cool.  I like double-spacing.


Since it's all up to personal preference, what do you prefer?
The single-space or the double-space?

If you want to find out more, just look it up on Google:
http://www.google.com/search?q=sentence+spacing+after+period

If you don't know what Google is, then look it up on Google (and you're also probably retarded):
http://www.google.com/search?q=google

Monday, December 27, 2010

How to Make V-Darts

"V-darts" are these small paper projectiles shaped like V's (hence the name).  They're also called "stingers" because they sting a lot when you get hit.

Of course there are many ways to make them, but the best ones are small and dense.  Here's the V-dart that I think is best.

Take a sheet of letter paper and rip it into the 8 pieces according to the diagram below.  Remember, ripping paper is a life skill, so if you don't know how, read How to Rip Paper.  I recommend doing the rips in the numbered order.  (By the way, the relative sizes on the picture are accurate!)


After you tear the paper into those nice eighths, take one of those, make the folds, following the diagram below.  In case it's not obvious enough, orient it in the landscape fashion first, fold it the "hotdog" way, and then fold it in half horizontally 4 times.


After you make fold #5 above, you can either fold it in half down the middle ("hamburger" style) or put tape on the ends so that it's stronger and unfolds less when you try to make that final fold down the middle.



Now you have a V-dart!  When it's done, it should look something like this:


WARNING: Do not shoot anybody with these.  Even though they might not really hurt some people, others think they hurt a lot.  Besides, it's always good to be nice!  These things are pretty powerful, and when launched of a decent rubber band, they can penetrate packets of 3 or more pieces of paper!  Imagine that hitting skin!  So don't shoot people!


The back of a packet of 4 sheets after being shot with V-darts

Thursday, December 23, 2010

C# FileSystemDialog

Now that you know how to read from and write to the hard drive (or if you don't, see C# Read/Write From File), we need a way to get the name of the file to be loaded from or saved to.  You could use my C# InputBox, but it's not as professional-looking as this C# FileSystemDialog.

I created this class, which takes two classes already made and puts it into one.  It uses the SaveFileDialog and the OpenFileDialog.  If you don't remember how to add a class to your project, see (C# InputBox).

The use of this class is pretty self explanatory.

To get the name of a save file, use:
FileSystemDialog.SaveDialog();

It gives you the name of the file or an empty string (as in "") if the user presses cancel.

To get the name of a load file, use:
FileSystemDialog.LoadDialog();

It gives you the name of the file or an empty string if the user presses cancel.

If you want to make an absolute path into a relative path (from the .EXE file), use:
FileSystemDialog.MakePathRelative("full_path");

Obviously you have to replace "full_path" with a string containing the path that you want to make relative.

Finally, after adding this class to your project, you should change the properties (i.e. DefaultExt, Filter, etc.) to the stuff that you want, such as a unique file extension for your save files.  In the init() method, Change all the instances of "clk" to your file extension of choice and "Click file" to the name of your type of file.  The Title is whatever you want to be displayed at the top of the respective dialog windows.

Here's the code:



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;


static class FileSystemDialog
{


private static SaveFileDialog saver;
private static OpenFileDialog loader;


// for the first time the FileSystemDialog methods are called
// change the strings in this method to fit your needs
private static void init()
{
saver = new SaveFileDialog();
loader = new OpenFileDialog();


saver.DefaultExt = "clk";
saver.Filter = "Click file (*.clk)|*.clk";
saver.AddExtension = true;
saver.RestoreDirectory = true;
saver.Title = "Save As...";
saver.InitialDirectory = Directory.GetCurrentDirectory();


loader.DefaultExt = "clk";
loader.Filter = "Click file (*.clk)|*.clk";
loader.AddExtension = true;
loader.RestoreDirectory = true;
loader.Title = "Open...";
loader.InitialDirectory = Directory.GetCurrentDirectory();
}


public static string SaveDialog()
{
if (saver == null)    // only when first time
{
init();
}


saver.ShowDialog();
return saver.FileName;    // return empty string ("") if cancel button is pressed
}


public static string LoadDialog()
{
if (loader == null)    // only when first time
{
init();
}


loader.ShowDialog();
return loader.FileName;    // return empty string ("") if cancel button is pressed
}


public static string MakePathRelative(string path)
{
return path.Replace(Directory.GetCurrentDirectory() + "\\", "");
}
}

As always, you can download it here ("FileSystemDialog.cs").

Wednesday, December 22, 2010

Choosing a Monitor

No computer is complete without a monitor.  Seriously.  You won't be able to see what your computer is doing. So, it's time for you to pick a new monitor.  Maybe it's for your new custom machine.  Maybe you want to upgrade from your "Stone Age" screen.  Or you want to upgrade to an awesome multi-monitor setup (see Multiple Monitors FTW).

Nowadays, there are just so many different monitors out there.  So which one is the right one to buy?

There are 5 main things to consider in a monitor:
  1. Resolution
    • This is probably the most important thing to consider when buying a monitor because the higher the resolution, the more you can see on the screen at a time.  As of now, nearly all mainstream monitors are in the 16:9 aspect ratio, so bigger is pretty much better.
  2. Dot-pitch
    • This has to do with the size and resolution of your monitor.  It's how big each pixel on your screen is.
    • If your monitor is bigger, the pixels will be bigger, so you can see stuff on it from farther away.
    • If your monitor is smaller, the pixels will be smaller, so the images will appear sharper.
    • Personally, I prefer higher dot-pitches so I can sit further from the monitor and have more things on my desk between me and my monitor.
  3. User reviews
    • You can find out a lot of useful things from user reviews.  You want to make sure that the monitor has a lot of positive reviews.  It's the only real way to tell how well the monitor actually works.  If it has a high fail rate, you may not want to buy it.
    • You can find out how durable the monitor is -- that is, how long it will last before giving up.  Many of the really cheap ones can break in around a year, so if you're intending to replace it by then, then you might want to go for one of these.
    • Make sure your monitor has minimal backlight bleed and color inaccuracy.  Backlight bleed is when there is too much light coming from the sides of your monitors, and it is extremely noticeable/distracting when you have a black background showing.  If color reproduction is important to you, many times the reviews will tell you how good the colors are.
  4. LED vs. LCD  (see LCD vs. LCD)
  5. Input
    • Your monitor should be able to receive input from whatever signal you're outputting.  If you don't have any adapters and don't want to buy any and your monitor can't get your output, then it's basically useless.
    • Most monitors come with all of the cables needed to connect them to your computer.  However, some try to cut costs by not giving you all of the necessary cables (not the power cord, of course), so you'd have to buy them yourself unless you happen to have spare cables lying around in your house.
The verdict (my choice): For under $160, highest resolution, largest size, very positive reviews, LED

Tuesday, December 21, 2010

C# Read/Write From File

A lot of the more advanced programs that you will write will require reading from and writing to the hard drive.  This basically means saving and loading files for your program.

Most operations involving your hard drive will need the namespace System.IO, so add the following statement to the top of your class:
using System.IO;

To read from your hard drive, using the following line:
string fileText = File.ReadAllText("file_name");

You should replace "file_name" with whatever file you want to read.  Remember that you have to include the file extension.  The contents of "file_name" will be put into a string called fileText (or whatever you want to call this variable).

To write to the hard drive, use the following line:
File.WriteAllText("file_name", "text");

Again, replace "file_name" with the name of the file you want to save it as, and you still have to include the extension if the file is supposed to have one.  "Text" is whatever you want to put into the file.  Obviously, you can have a string variable instead of just some text in quotes.

I think that those two methods are the most useful in the System.IO namespace, but if you're still interested in all sorts of the other cool things in the System.IO namespace, see this site:
http://msdn.microsoft.com/en-us/library/system.io.aspx

Monday, December 20, 2010

No Fear Literature - ALL

Remember the old post on No Fear Shakespeare?  If you do, then that's great!  If you don't then you should go read it (see No Fear Shakespeare - ALL).  Well, I found out that SparkNotes has "No Fear" titles not only for Shakespeare plays, but also for a few other books, such as the scary The Scarlet Letter or the terrifying Beowulf.  It's called No Fear Literature!

Since I already had the code for compiling all of the "No Fear Shakespeare" plays, all I had to do was make a few modifications to the code to make it compile the other plays.  It was a bit more of a pain getting these five works because the formatting of these URLs was much less standard between each other.  However, it could be done, as we see now!  (If you're still expecting the code, it's so un-standard, meaning that you have to tweak it for nearly every book, that I don't think anybody actually wants it so I probably will never release it.  Besides, every single "No Fear" book has been compiled now.)

As of now, SparkNotes only has six "No Fear Literature" books (I'm too lazy to actually finish A Tale of Two Cities because it would require quite a lot of code-tweaking).  If you actually need (or want) the "No Fear Literature" version of this play to be compiled, then leave a comment and I'll try to get around to uploading it as soon as possible.

Remember: THE TEXT IS NOT MINE!  IT'S ALL FROM SPARKNOTES!

If you like these "No Fear" compilations, please tell your friends and link them to this blog!  That gives me more web traffic, which increases my happiness!

If you haven't already, read the bulleted list in No Fear Shakespeare - ALL before downloading the files.  There are a few things in there that you should know.

Here's the link you've been waiting for:
http://www.mediafire.com/?b2n498laiyznz

Sunday, December 19, 2010

The Asian Grading System

The Asian Grading System is pretty similar to the American Grading System.  Anything less than 65 is failing, around an 85 is satisfactory, and anything above a 95 is excellent.

This is how you convert from the American Grading System to the Asian Grading System: Take your American score (out of 100) and subtract 90, then multiply by 10.  It's pretty easy, actually.

Here are some examples:

Example 1:
Mom:  Let me see your report card.
Kid:  Here it is -- I did pretty well this quarter.
Mom:  Hmm... let's see what you got.  WHAT?!  96.2?!
Kid:  What's wrong?  I thought it's pretty good!  I beat all my friends.
Mom:  You got a 62.  That's failing!
Kid:  What are you talking about?
Mom:  Don't you know what the Asian Grading System is?
Kid:  Umm... no.  Should I?
Mom:  Yes!  Of course you should.
Kid:  (to himself) Uh-oh.  This could be bad.
Mom:  I must go get your Dad.  This is a serious concern!
Kid:  What's going on?
Dad:  Because you failed the quarter, we decided that you will have no more video games for a month!
Kid:  NOOOOO!!!!!!!!!!!
Dad:  You'd better get your grades up next quarter!
Mom:  Why can't you just be like Roger?  He's so much smarter than you!

Example 2:
Mom:  Let me see your report card.
Kid:  Here it is -- I did really well this quarter.
Mom:  Hmm... let's see what you got.  Do you really think you did really well?
Kid:  Yeah.  Why wouldn't I?  I got a freakin' 98.9 average!
Mom:  What's so good about that?
Kid:  It's insanely high!  I beat all my friends by at least a point and a half!
Mom:  So what?  Did you check the Asian Grading System.
Kid:  (to himself) Oh no... not that!  (to Mom) No, I didn't.
Mom:  Well, you know what it is.  What did you get on the Asian Grading System?
Kid:  OK, I got an 89.
Mom:  You know that's only satisfactory, so don't get too full of yourself.
Kid:  Fine:
Mom:  You should really try harder next quarter.
Kid:  (to himself) I think it's good enough.  (to Mom) Yes, I will.
Mom:  You should look up to someone like Roger.  He's way smarter than you.
Kid:  Yeah, I know.
Mom:  So don't think you're actually smart until you're smarter than Roger.

Example 3:
Mom:  Let me see your report card.
Kid:  Here it is -- I really aced this quarter!
Mom:  You kids always say that.  Let the numbers speak for themselves.
Kid:  OK, why don't you read the report card, then?
Mom:  Let's see.  You got a 99.  That's pretty good!
Kid:  No, I didn't.  I got a 99.9.  That's basically 100.
Mom:  You forgot to convert it to the Asian Grading System.
Kid:  Oh.  Either way, it's really good.
Mom:  Yes, I agree.  But there's still room for improvement.
Kid:  Room for improvement?  I pretty much maxed out!
Mom:  You didn't get 100.
Kid:  It rounds to 100.
Mom:  Not on the Asian Grading System.
Kid:  I have pretty much the best grades in the region!
Mom: You'd better work harder next quarter.  I need to see some improvement!
Kid:  (to himself) Wow, this sucks!  (to Mom) Yeah, I'll do better next time.
Mom:  If you don't, I'll have to punish you.  Roger would definitely do better than you!

In case you were actually concerned about this, I wasn't serious about this.  These are all just made up scenarios (I hope), and I'm pretty sure any Asian parent would be fully satisfied with a 99.9 average.  Even though I'd agree that most Asian parents place a lot more importance on grades than others in general, they still are not this intense about their kids' grades.  By the way, did you enjoy the Christmas colors in the dialog?

If you want to try out your newfound C# skills (or if you haven't, see Learn to Program!), create a program that will convert from the American Grading System to the Asian Grading System and vice versa.  You can use an InputBox (see C# InputBox) to get the value you need to convert.

In case you were too lazy to figure out for yourself, use the following line to convert from a string that you get from the InputBox to a double that you can use mathematical operations on:
double someDouble = Convert.ToDouble("some_string");

To convert back to a string, you can use either of the following lines:
string num = someDouble.ToString();
string num = someDouble + "";

This program shouldn't take too much time, so you should give it a try if you're new to C#.

If you're getting confused as to what a string or double is, here's a quick run-though of the most used C# primitive datatypes:

  • int : an integer
  • bool : either true or false
  • double : decimal number
  • string : text

Of course there are more, and you can just Google "C# datatypes" or something.

Saturday, December 18, 2010

How to Rip Paper

Ripping paper is a life skill.  Not the kind of ripping where you completely annihilate the piece of paper on these scraggly rips, but the kind of ripping that gives you a clean line where you want it.

I'm thinking that most people already know how to do this, but maybe I'm wrong.  I've seen people who are wholly incapable of making a nice rip, so it's never too late to learn!  For the (hopefully very small) minority of people who want to learn how to rip paper correctly, read on!  There's even images!

First, find a piece of paper that you want to rip (duh!).

Fold it along the line that you want to rip.  You have to crease it well, as in running your fingernail, pen cap, or paper clip over the fold two or three times.  You don't have to overkill on this.  Some recommend wetting the crease with spit or something, but I think that's gross and unnecessary.


Carefully make a small rip along the line at the top of the paper.  You might want to hold the paper in the air and slowly make the small rip.  Or you could hold it against the desk tightly and pull sideways slowly.  Either way, do it slowly and carefully.  If your starting point rip is a failure, turn it around and try again on the other side.  If both sides are failures, then pick the best side you have and move on.  If both sides are epic failures, get a new piece of paper and try again.

The rest is easy.  Just rip down crease from the starting point you created!

Now if that's not efficient enough for you, you can try ripping two pieces at a time.  It's a bit harder and a lot of this depends on the friction between the pages and the friction between the paper and your surface.  I'd say that anything more than three pages is unrealistic and you'd spend more time getting it right than ripping them two or three at a time.

It's pretty much the same as before.  Make your crease where you want to rip.  This time you have to make sure that the crease is better, especially for the paper on the inside, which you can't really see.  Maybe run your creasing tool over it three to four times.


Make that starting rip, but make sure that the rip is good on both pages.

It's not as easy as before, but finishing is still very easy.  You might have to press down on the paper harder to make sure that they stay together and both get ripped at the same time.  If they fall apart, then you can just rip them separately.

Now you know how to rip paper.  It's totally a life skill.

Tuesday, December 14, 2010

EarthBound - Guest Post

Have you ever been playing Super Smash Bros., and found yourself wondering, "Ness?  Who's Ness?  What game does he come from?  I've never heard of him before."  Actually, Ness comes from a game called EarthBound, which was released in 1995 for the Super Nintendo (SNES).  EarthBound is definitely one of the best role-playing games ever made, with a really cool storyline that takes a very long time to get through.

EarthBound may also be referred to as Mother 2.  This took a while for me to understand.  In 1989, a Japan-only game was released for the Famicom (NES), and this game was called Mother (Unofficially, in America, it is known as EarthBound Zero).  Mother is like a prequel to EarthBound.  Later, in 2006, another game was made for the Game Boy Advance.  This game was called Mother 3, and this is the game that Lucas in Super Smash Bros. Brawl came from.  Mother 3 is the sequel to EarthBound, except none of the characters are even the same.

EarthBound was very successful in Japan, but not so much in the United States.  I'm not exactly sure why, since most of EarthBound is references to old pop-culture and other American things.  Since EarthBound is old and on the Super Nintendo, it is actually pretty coveted now and costs a lot of money if you actually wanted to buy it.  That's why emulators were created.  You can download an emulator for free and also download the game to play in the emulator (an emulator is like a virtual console, allowing a person to play a game from another system on their computer).

IMPORTANT NOTE: Emulators themselves are not illegal, but downloading ROMs for them is, especially if you do not own the game.  If you happen to own the game, then you’re in the gray area; some say it’s illegal, some argue that it’s legal.  I’m pretty sure that nobody will really get busted or see the cops at their door for playing these games, but if you have a moral issue with doing things of questionable legality, it’s best you turn back now!

The link to get the Super Nintendo emulator is here:


I would download the first one, ZSNES.  It works well. Also, you will need the game in order to play it (duh). Here is a link to download the game:


 Also, if you wanted to play that Japan-only game, Mother 3, there has been a fan translation for that game so you can actually play it!  You will need a Game Boy Advance emulator found here:


You should probably download the latest version.  This Game Boy Advance Emulator is special because it is capable of linking for multiplayer games!  Also, here is the game so you can actually play it:


Click the yellow "Download" button. This game is in Japanese, so you need the patch so the game will run in English (unless you are fluent in Japanese, because that's cool, too). The patch can be found here:


It's the thing that says "Download MOTHER 3 fan translation."  After it is unzipped, read the instructions in the folder.  The patching DOES in fact work on most operating systems, although Windows is the best!  But it does work even on Windows 7, so if you are having trouble, try again.  Personally, I would say you're good with EarthBound, but if you beat it, and want the next, then download those things.

So that's basically all you need to know.  The only other thing would be that in the emulator you need to map out controls in the options menu, and choose open ROM from the menu and open the un-zipped portion of the game, be it the .SMC file or .GBA file.  You may need WinRar or 7-Zip to unzip it, so here is the link to download 7-Zip:


To unzip, open 7-Zip, find your file, and click extract. You cannot run the "zipped" folder as your game in the emulator.

Well, that is all I have to say about EarthBound. It is a great game, and you should stick with it to the end, even if you are frustrated at points.  Thanks, and see you later!

CREDIT GOES TO ALEX VARGAS

Saturday, December 11, 2010

C# Mouse

Have you ever wanted to manipulate the mouse cursor programmatically using C#?  Well, look no further, because this small Mouse class puts the mouse actions into a nice, small class you can use in your programs.

If you are still wondering what you can do with this simple class, here are a few examples:
  • Moving the mouse around so the user has no idea what's going on.
  • Making a macro (or "bot") for an online game.
  • Repeatedly clicking the same thing over and over again.

Many of the programs I will post will be based on this Mouse class!


Have a look at the code here (although you can download it at bottom of this post):


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing;
using System.Windows.Forms;


static class Mouse
{
private const UInt32 MOUSEEVENTF_LEFTDOWN = 0x02;
private const UInt32 MOUSEEVENTF_LEFTUP = 0x04;
    private const UInt32 MOUSEEVENTF_RIGHTDOWN = 0x08;
    private const UInt32 MOUSEEVENTF_RIGHTUP = 0x10;
    private const UInt32 MOUSEEVENTF_MIDDLEDOWN = 0x20;
    private const UInt32 MOUSEEVENTF_MIDDLEUP = 0x40;


    [DllImport("user32.dll")]
    private static extern void mouse_event(
        UInt32 dwFlags, // motion and click options
        UInt32 dx, // horizontal position or change
        UInt32 dy, // vertical position or change
        UInt32 dwData, // wheel movement
        IntPtr dwExtraInfo // application-defined information
    );


public static void Move(Point p)
{
Cursor.Position = p;
}


    public static void Move(int x, int y)
    {
        Mouse.Move(new Point(x, y));
    }


public static void Click()
{
        mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, new System.IntPtr());
        mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, new System.IntPtr());
}


public static void Click(Point p)
{
Mouse.Move(p);
Mouse.Click();
}


    public static void Click(int x, int y)
    {
        Mouse.Click(new Point(x, y));
    }


    public static void RightClick()
    {
        mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, new System.IntPtr());
        mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, new System.IntPtr());
    }


    public static void RightClick(Point p)
    {
        Mouse.Move(p);
        Mouse.RightClick();
    }


    public static void RightClick(int x, int y)
    {
        Mouse.RightClick(new Point(x, y));
    }


    public static void MiddleClick()
    {
        mouse_event(MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, new System.IntPtr());
        mouse_event(MOUSEEVENTF_MIDDLEUP, 0, 0, 0, new System.IntPtr());
    }


    public static void MiddleClick(Point p)
    {
        Mouse.Move(p);
        Mouse.MiddleClick();
    }


    public static void MiddleClick(int x, int y)
    {
        Mouse.MiddleClick(new Point(x, y));
    }
}



Most of the methods are self-explanatory (a.k.a. they do pretty much what the method names would suggest).  However, I give some examples anyway:

For each of these lines, assume that somePoint is some Point already defined, such as:
Point somePoint = new Point(13, 37);

Mouse.Move(somePoint);    // Moves the cursor to somePoint
Mouse.Move(123, 456);    // Moves the cursor to the pixel on your screen at (123, 456)
Mouse.Click();    // Left-click at current cursor position
Mouse.Click(somePoint);    // Left-click at somePoint
Mouse.Click(135, 246);    // Left-click at the pixel on your screen at (135, 246)
Mouse.RightClick();    // Right-click at current cursor position
Mouse.RightClick(somePoint);    // Right-click at somePoint
Mouse.RightClick(147, 258);    // Right-click at the pixel on your screen at (147, 258)
Mouse.MiddleClick();    // Middle-click at current cursor position
Mouse.MiddleClick(somePoint);    // Middle-click at somePoint
Mouse.MiddleClick(159, 260);    // Middle-click at the pixel on your screen at (159, 260)

After reading that, you're probably thinking, Why did I bother reading that?  It was so freakin' obvious!  Or maybe you were thinking, Why did that guy waste his time posting those examples?  Does he think I'm stupid or something?!


Anyway, you can download the C# class here (Mouse.cs).

Note: If you don't remember how to add this class to your C# project, see C# InputBox.

Friday, December 10, 2010

Facebook at School (Ultrasurf)

Have you ever wanted to use Facebook (or some other site that was blocked) in school?  Look no further, because a company called Ultrareach created a program called Ultrasurf.

Ultrasurf was originally created to stop censorship in China so those people over there could see ideas such as democracy and free labor.  See more about their cause here:
http://www.ultrareach.com/background_en.htm

Even though it was created for this noble cause, you can still use it for your own purposes (such as Facebook in school).  Basically how it works is that it searches for a fast proxy to mask your IP address.

You can download Ultrasurf here: http://www.ultrareach.com/
More available downloads here: http://www.ultrareach.com/download_en.htm

After you download it, I don't think you even need to extract it from the .ZIP archive, although you could if you want to.

Sometimes, schools might block the Ultrasurf download page.  Never fear, because you can use a proxy server (lots of them listed at http://proxy.org/) to download Ultrasurf.  You're using a proxy to download a proxy!

Why not just use a proxy server online?  Well, many of them have really annoying ads that pop up, most of them cannot render certain pages correctly (especially images), and they're usually pretty slow.  Ultrasurf displays all of it correctly and loads the pages very quickly.  Plus, Ultrasurf has no ads in it at all.

One more problem... what if you school blocks proxy servers?  Then I guess you'll have to bring Ultrasurf on a flash drive after downloading it from your home computer!

Thursday, December 9, 2010

Choosing a Keyboard

The keyboard is super-important to computer users because it's the other main way people interact with their machines.  This means that they should be happy with their keyboard, especially programmers, who really depend on their keyboards.

First of all, ever wondered why it is called a keyboard?  If you did, then you're DUMB!  Just kidding... maybe you just never thought about it before.  If you didn't know, it's called a keyboard because the thing is basically a board with keys on it for you to press.

There are 5 main things to consider in a keyboard:
  1. Ergonomic vs. Normal
    • Ergonomic keyboard are those round ones you see that are supposed to be better for your hands and arms when typing.  The standard is the regular rectangular keyboard you always see. 
    • Ergonomic ones are supposed to decrease the risk of Carpal Tunnel, but there is no real evidence to back this.
    • An ergonomic can help you type faster, more easily, and more comfortably because it puts your hands in a more natural position, but it may take some getting used to.
    • Ergonomic keyboard are usually bigger, so if desk space is tight, that might be a consideration.
  2. Wired vs. Wireless (see #2 in Choosing a Mouse, and replace all instances of "mouse" with "keyboard")
  3. Types of buttons
    • Extra keys that let you set the volume and stuff are quite helpful.  It's so much easier to adjust volume using your keyboard than manually going into your taskbar and changing it.  However, changing it using your speakers adjustments is even easier.  I don't find other keys as useful as volume adjustment.
    • The [ENTER] key is not supposed to take up two rows!  Those old-school keyboard with massive enter keys and tiny backspace keys are quite annoying because they shift the backslash into the top row and make the backspace harder to find.
    • Your arrow keys should be arranged normally, as in up arrow on its separate row, with all other directional keys below it.  On some keyboard, the down arrow gets its own row under the left and right keys, which feels kind of weird overall.
    • Your keyboard should look nice.  Visually, your keyboard should be at least somewhat pleasing.  The keyboard that look like the keys are completely cramped together without a thought to their logical placement are probably not a good choice.
  4. Durability (see #4 in Choosing a Mouse, except that its about keyboard this time)
  5. Keyboard noise
    • This is pretty hard to gauge unless you've tried it out because all manufacturers list their keyboards as "quiet."  I really think that excess noise from the keyboard can be quite distracting, so invest in getting a quieter keyboard (maybe your friend has a recommendation for you), unless you like the clackety noise coming from your keyboard to tell you that you REALLY are typing.
    • This sometimes has to do with how easily or how difficult the keys go down.  Mushy keys don't give enough tactile feedback to your fingers, whereas stiff ones require too much effort to push down.  I think that keyboard tend to get softer the more you use them.  I personally prefer my keyboard on the mushier side because they're generally quieter and are easier on the fingers.
The verdict (my choice): Ergonomic, wired, extra buttons for volume adjustment, medium durability, quiet/mushy.

Price Range: $15-25.

Wednesday, December 8, 2010

No Fear Shakespeare - ALL

It all started with Hamlet (see No Fear Shakespeare - Hamlet for more details).  I figured that since I could make one of these, I could do the rest.  All it would take would be a more general program and some "skillz" at using Microsoft Word.

Again, I'm sorry, but no source code will be released at this point.  It's a bit neater than it was when I was extracting Hamlet, but it's still difficult to explain.  Maybe I'll just release it in its unpolished form sometime.  But it doesn't really matter because the program has already done its job.  All of the No Fear Shakespeare plays have been extracted and converted into these files.

Here's a quick overview of what I did, if you care.  First, I saved an example of a No Fear Shakespeare webpage from some random play (probably Macbeth).  Then, I played with the HTML until I knew what I needed to extract and what other things to keep and what to delete.  I wrote a C# program to extract this stuff and compile a .HTM file (a.k.a. just a webpage).  Then, I copied all the text in this formatted .HTM file and pasted it into a word template I made just for these No Fear Shakespeare plays, preserving the source formatting.  It still didn't look great, so I created a VB macro in Word to touch up the text.  Since I was using my slow laptop, it took a while to paste and format such large volumes of text.

Now you can go download all of the files, and here are some things you should know first:
  • You can get specific Word 2007 (.DOCX) or .PDF files by going into the different folders for the different plays.
  • The .DOCX files are smaller, but you'll need something to read it, but I think the .PDF files seem more professional.
  • You CAN edit the .DOCX files, but you CANNOT edit the .PDF files.
  • "No Fear Shakespeare WORD2007.zip" contains only the .DOCX files for each of the plays.
  • "No Fear Shakespeare PDF.zip" contains only the .PDF files for each of the plays.
  • "No Fear Shakespeare HTML.zip" contains only the HTML files for each of the plays.  HTML is by far the smallest format, and is the best if you are reading on the computer (printing the HTML file makes it really small and the formatting is kind of funny).  You MUST all of the .HTM files in the same folder as the "No Fear Shakespeare  Macbeth  Act 1, Scene 1_files" folder and the ""No Fear Shakespeare  Macbeth  Act 1, Scene 1_files.htm" file because they contains all the scripts used in displaying the .HTM files correctly.
  • "No Fear Shakespeare ALL.zip" contains all of the files.  You still have the keep the .HTM files in the same long-named folder with the scripts.
Remember, THE TEXT IS NOT MINE!  IT IS ALL FROM SPARKNOTES!

All of these files are kind of long (they're full plays with Modern English translations), so printing them out will use a lot of paper.  But it's still better than buying the No Fear Shakespeare book from SparkNotes (in my opinion).

If you liked this, don't forget to tell your friends!  Please link them to this blog first instead of giving them a direct link, because it increases the traffic on this site, which makes me happy!

Have fun reading Shakespeare (if that's possible).  Believe me, the No Fear Shakespeare version is countless times easier to read than the real thing!

So, without further ado, here's the link to download those files:

Tuesday, December 7, 2010

C# InputBox

A lot of people who start programming might choose Visual Basic because, as the name suggests, it is a rather easy language to learn since there are a lot of words and fewer symbols than other languages like Java and C#.  As time goes on and they become better at programming, people might want to switch over to C# because Visual Basic is too verbose or because of C#'s similarity to Java.  Or you could just start with C#.  Either way, if you're just starting to use C#, you realize there is no built-in way to get input from the user through a dialog box in C#.

So I created my own InputBox.  And get this: it has the option of getting multiple responses at once in an array.  This is pretty useful for getting multi-parameter things from the user, such as getting the location of a new Point (it's much nicer to have the X and Y coordinate prompt in the same dialog than to have two separate dialogs).

HOW TO ADD NEW CLASSES TO YOUR PROJECT:

To add this class to your C# project, you should click: Project > Add New Item... (or Ctrl + Shift + A).  Select a "New Class."  Name it "InputBox.cs".  Then copy and paste the following code into your new class.


Alternatively, you can download the class (InputBox.cs) and add it to your class: Project > Add Exiting Item (or Shift + Alt + A).  Choose the InputBox.cs file you just downloaded.

Basically, Show(...) is an overloaded method that can return an array of values with the same dimensions of your prompt array or return a single value if your prompt is only a single string.  Note: the method returns null if the user presses cancel.

Examples:
string par = InputBox.Show("Give me a number:", "Prompt");    // shows a dialog box for getting a single value in return with the title "Prompt"
string[] pars = InputBox.Show(new string[] {"X:", "Y:"}, "");    // shows a dialog box for getting an X value (will be in pars[0]) and a Y value (will be in pars[1]) without a title because of the empty string in the title parameter 
Here is the code (sorry the spacing is awkward and the text is so small... it's just so that all code fits on one line... it'll look just fine after you copy and paste it into your C# class):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;




static class InputBox
{


    public static string[] Show(string[] pars, string title)
    {
        int size = pars.Length;
        Form frmInputBox = new Form();
        Label[] labels = new Label[size];
        TextBox[] texts = new TextBox[size];
        Button btnOK = new Button();
        Button btnCancel = new Button();


        frmInputBox.Text = title;
        frmInputBox.ClientSize = new Size(420, 100 + 40 * (size - 1));
        frmInputBox.FormBorderStyle = FormBorderStyle.FixedDialog;
        frmInputBox.MinimizeBox = false;
        frmInputBox.MaximizeBox = false;
        frmInputBox.AcceptButton = btnOK;
        frmInputBox.CancelButton = btnCancel;
        frmInputBox.StartPosition = FormStartPosition.CenterScreen;


        for (int i = 0; i < size; i++)
        {
            Label l = new Label();
            l.Text = pars[i];
            l.Location = new Point(10, 10 + 40 * i);
            l.AutoSize = true;
            labels[i] = l;
            TextBox t = new TextBox();
            t.Location = new Point(10, 25 + 40 * i);
            t.Size = new Size(400, 20);
            texts[i] = t;
        }


        btnOK.Text = "OK";
        btnOK.Location = new Point(255, 70 + 40 * (size - 1));
        btnOK.DialogResult = DialogResult.OK;


        btnCancel.Text = "Cancel";
        btnCancel.Location = new Point(335, 70 + 40 * (size - 1));
        btnCancel.DialogResult = DialogResult.Cancel;


        frmInputBox.Controls.AddRange(labels);
        frmInputBox.Controls.AddRange(texts);
        frmInputBox.Controls.AddRange(new Control[] {btnOK, btnCancel});


        DialogResult dialogResult = frmInputBox.ShowDialog();
        if (dialogResult == DialogResult.OK)
        {
            string[] results = new string[size];
            for (int i = 0; i < size; i++)
            {
                results[i] = texts[i].Text;
            }
            return results;
        }
        else
        {
            return null;
        }
    }


    public static string Show(string par, string title)
    {
        string[] temp = Show(new string[] {par}, title);
        if (temp == null)
        {
            return null;
        }
        else
        {
            return temp[0];
        }
    }
}