Monday, December 30, 2013

Poems: Hail Upon My Head

According to my oldest son, I absolutely must share this little haiku about hail inspired by him and my younger son. Yes, they got caught in a hailstorm. Yes, they took a couple pieces in the head. And yes, everyone is just fine. In honor of their little adventure, here's their haiku.

 
Frozen water hurts
When it falls onto my head
Can I skate on it?
 

Monday, December 23, 2013

Learning to Use Java

I like doing things myself. So do most writers I know. I hate technology. So do most writers I know. Java was probably the biggest annoyance I encountered, but once I figured it out, I was able to use it to do all kinds of stuff. Java is now my best friend in the technology world, right up there with wireless internet and word processers. But learning to use it can be a challenge. so here are some tips.

In 1995, Sun Microsystems a compiled programming language called Java. This language, which is free to download and integrated into most computer applications today, is platform independent. This means that Java can run on any operating system and so is truly a universal programming language.

Using Java on your computer is a fairly simple process. For the most part, once it’s installed correctly, it just runs itself with very little maintenance from the user except for the occasional update. Java requires Java Runtime Environment (JRE) to run correctly. It is this program which allows the Java code to execute. JRE can be downloaded for free and can be easily located using your favorite search engine.

For those users who wish to write Java code, an additional program will be required. The easiest way to write Java code is by using a Java Development Kit and compiler combination such as Eclipse. There are other programs available, but they all work in much the same manner. They allow you to review and examine your Java code, and even point out syntax errors that you may have missed. These programs are invaluable for the beginner wishing to learn how to write Java code.

Once JRE and Eclipse (or other program; Eclipse will be used in this example) are successfully installed on your computer, you can begin to write your first program. Open Eclipse and begin a new project. You’ll have to name your project, but what you call it isn’t important; for now you can simply call it ‘myProject’. After you’ve named your project, your main class and main method should be automatically generated.

This may sound a little confusing to the beginner, but classes and methods are simply used to accomplish certain tasks within your program. Classes are required to create your program, but are really rather useless things when left all by themselves. Methods are equally useless alone, but are necessary components to have the classes accomplish anything. The methods are those things which put your program into action.

Your new project should look something like this:

public class myProject{

                public static void main(String args[]){

}

}

The term ‘public’ means only that everyone can access it. You can, if you wish, designate your project as ‘private’ or ‘protected’ but it might confuse you right now. Since you’re only experimenting with Java, you can leave it as ‘public’ to avoid any problems that might occur as you’re writing your program.

It is important to understand that your program can have many methods. However, it can only have one main method. The main method of your program is the method that will be called initially when you first run your program, so you can never have more than one main method. Your starting code will go after your main method.

At this point you may be simply staring at your screen wondering what you’re supposed to do next, so try running a very simple program. Choose a name. Any name will do. In this example, we’ll pretend you have a dog named Fluffy and you want his name to appear on the screen. To accomplish this, add the line System.out.println(“Fluffy”); right after your main method initialization.

To execute your program, you’ll need to ‘run’ it. This is the easy part. The program you’re using to write the code should have a run tab. Click the tab and select ‘runas -> java application’. This should execute your entire program beginning with your main method. Since you only have the one method in this particular example, there shouldn’t be any confusion.

Once executed, the program should print out the line “Fluffy” to the console. If it doesn’t, check your code again. You may have neglected to add the semi-colon (;). All Java statements must end in a semi-colon, or Eclipse won’t be able to make heads or tails of your program. If it helps, think of the semi-colons as signposts, telling everyone what’s what. This isn’t a perfect analogy, but they’re just as necessary as signposts. Without them, everyone ends up lost and confused.

This is a very simple example of how to use Java to write code. It can obviously be much more complex, especially when you start adding additional methods. However, with a little practice and a good book (or website) on the subject, you should be able to write a variety of Java programs.

Monday, December 16, 2013

Poems: Ice Storm

 
The breeze is brisk; it is not warm.
I cannot see clear through this storm.
I take a breath that I will hold,
And hope my story will be told.
 
I do not know where I might be,
But I hope I will be set free.
I grow colder with each breath,
And know that I must starve off death.
 
The ice, it comes, I cannot speak.
It chills my blood and makes me weak.
I may be lost, I may be scared,
Perhaps my judgment is impaired.
 
I see something … is it a light?
This feels wrong … but it may be right.
It’s still so cold, I turn within,
And find warmth inside my own skin.
 
It’s a lie, this I know,
I’m still trapped in ice and snow.
I’m cold and wet and full of sorrow.
But things will be better on the morrow.

Monday, December 2, 2013

Flash Fiction: Revenge of the Smallest

It's early December and we have so much snow it defies expectations. The weather is inspiring flash fiction in me, and the kids are out throwing snow at each other. Is it any wonder why I'm writing about a snowball fight?

Revenge of the Smallest

Liam cried out as he ducked behind the snow bank. This wasn’t fair. One against four, and all four older than him. How could any of them think this was a fair fight?

He heard footsteps crunching over fresh snow and knew they were surrounding him. This was no snowball fight. It was an ambush. He should have stayed in bed, but he’d been tempted by the idea of a good romp on a not-so-cold winter’s day. Bad choice.

Knowing he was out of time, Liam glancing around. He did not want to be showered in snowballs. Not again. It had been fun until they had ganged up on him. Now it was just ridiculous. He’d rather go inside and watch his mother baste a turkey. It was better than this.

Just as he was about to dash from his sanctuary, he caught sight of someone on the roof of the house. Uncle Leo. But what was he doing on the roof? Then he noticed the shovel Uncle Leo had. Why would anyone haul the large bucket-shovel up on the roof?

Uncle Leo started waving and pointing, obviously trying to tell him something. Liam tried to pay attention, tried to figure it out. After a moment, he grinned. With a wave back at his uncle, Liam turned onto his stomach and wiggled his way to the top of the snow bank.

As soon as his head cleared the top, his toque flew off as a snowball grazed his head. They were still hunting him. Perfect. They were looking at him, hoping he’d show himself, and hadn’t noticed Uncle Leo up on the roof. Good.

Turning onto his back, Liam waited. He waited until he heard his brothers start to climb up the snow bank. With a deep breath, Liam threw himself up and ran for all he was worth. He ran for the house, for the porch, grinning all the while.

Snowballs peppered his back, footsteps dogged him, but he kept running. He threw himself onto the porch and turned, landing with his back against the door. His brothers ran up the steps, snowballs in hand, only to disappear in a wash of white as Leo pushed the fluffy snow off the roof.

As his brothers grumbled and dug themselves out, Leo’s laughter boomed out over the snow. Liam giggled and smiled sweetly, happy with his revenge.