Sunday, April 25, 2010
Turning One Out
I finally exported my first GUI (Graphic User Interface) based Java Applet. This one was basically the same as a 'magic 8 ball', but with a few other parameters. This one was a request from a friend of mine, and I tried to do it in flash first. I found I could get it to play sounds easily enough when you clicked for an answer, but I couldn't get it to randomly generate text on the screen from a list I created. Most specifically, I couldn't get it to output text to a dynamic text box at all. This was frustrating.
Of course, with Net Beans and java, absolutely everything you make is tagged as an instance you can then manipulate in programming. It took about 20 minutes of effort, but I could get it to spit out text to a dynamic text box. The next thing I had to do was to randomize the string of text it displayed. This was the part of programming that comes easy to me. I had to go through C+ and C++ in college before getting to java, so just writing code is nothing.
I declared my constant(s) first (I was taught constants were to be in all CAPS), and then the remaining variable that would be fed to the textbox.
private int SIZE = 11; //Dictates the size of an array
private String RandAns[] = new String[SIZE]; //Declaration of an array
//of String to be the bank
//for my random answers
Random generator = new Random(); //Initialized randomizer.
//Next I wrote a function to populate the String array RandAns[], only
//example text is shown, can be changed to whatever suits your needs.
private void Populate()
{
RandAns[0] = "Example text 1";
RandAns[1] = "Example text 2";
RandAns[2] = "Example text 3";
RandAns[3] = "Example text 4";
RandAns[4] = "Example text 5";
RandAns[5] = "Example text 6";
RandAns[6] = "Example text 7";
RandAns[7] = "Example text 8";
RandAns[8] = "Example text 9";
RandAns[9] = "Example text 10";
RandAns[10] = "Example text 11";
}
//upon initialization of the java applet, I call the function Populate, so
//that my array is full and ready.
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
setSize( 550,470 );
Populate ();
}
});
//when I open the button handler, I added the following code to output
//a randomized string from array RandAns[] to the dynamic textbox
//on the GUI.
//Dynamic Textbox instance is named "AnsTxtBox"
private void AnsKeyActionPerformed(java.awt.event.ActionEvent evt) {
AnsTxtBox.setText(RandAns[generator.nextInt(SIZE)]);
}
Hopefully this code can come in handy for anyone reading it. Of course...my professors from college are probably weeping at how poorly the program was written. But it works!
Of course, with Net Beans and java, absolutely everything you make is tagged as an instance you can then manipulate in programming. It took about 20 minutes of effort, but I could get it to spit out text to a dynamic text box. The next thing I had to do was to randomize the string of text it displayed. This was the part of programming that comes easy to me. I had to go through C+ and C++ in college before getting to java, so just writing code is nothing.
I declared my constant(s) first (I was taught constants were to be in all CAPS), and then the remaining variable that would be fed to the textbox.
private int SIZE = 11; //Dictates the size of an array
private String RandAns[] = new String[SIZE]; //Declaration of an array
//of String to be the bank
//for my random answers
Random generator = new Random(); //Initialized randomizer.
//Next I wrote a function to populate the String array RandAns[], only
//example text is shown, can be changed to whatever suits your needs.
private void Populate()
{
RandAns[0] = "Example text 1";
RandAns[1] = "Example text 2";
RandAns[2] = "Example text 3";
RandAns[3] = "Example text 4";
RandAns[4] = "Example text 5";
RandAns[5] = "Example text 6";
RandAns[6] = "Example text 7";
RandAns[7] = "Example text 8";
RandAns[8] = "Example text 9";
RandAns[9] = "Example text 10";
RandAns[10] = "Example text 11";
}
//upon initialization of the java applet, I call the function Populate, so
//that my array is full and ready.
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
setSize( 550,470 );
Populate ();
}
});
//when I open the button handler, I added the following code to output
//a randomized string from array RandAns[] to the dynamic textbox
//on the GUI.
//Dynamic Textbox instance is named "AnsTxtBox"
private void AnsKeyActionPerformed(java.awt.event.ActionEvent evt) {
AnsTxtBox.setText(RandAns[generator.nextInt(SIZE)]);
}
Hopefully this code can come in handy for anyone reading it. Of course...my professors from college are probably weeping at how poorly the program was written. But it works!
Labels:
computer programming,
Free Java Compiler,
java,
Net Beans,
Net Beans IDE
Saturday, April 24, 2010
A Walk & A Talk
One of my proofers on my proofing panel for my stories, the harshest critic, in-fact, was over for a day at my house, and we spoke as I continue reaching the end of my first novel. He finds it painful as an English major just graduating this semester when he looks at the shelves and finds out what quality of writing is actually getting published out there.
I told him about an author I had recently met who had gotten their work published, and without pushing it through an editor, so the text still had errors in it when it hit the shelves. We both came to the agreement that this person must have had a very good letter to the publisher when they submitted their text, as this cover letter is important. I hadn't had the chance to read the text yet, but if the letter you write to the publisher can be that influential as to make or break your publishing chances, I had better do well.
Our conversation leaked further into all the works I would like to finish in the world of literature, as they are numerous in number, and I haven't finished or submitted a single one yet. He began speaking of the lack of originality in literature and how he wouldn't start the writing of a book with characters and a plot, but rather, he'd start with the message the text was supposed to push, and work its way back from there. He'd find a way to express the message through events and characters in the book, specifically side characters so the book would not sound 'preachy'.
He commented that most of the ideas I had were messages that had been over-expressed in literature already, and that he would pick the books up, but probably not buy any of them. This went double for my graphic novel ideas. I am happy to have a friend that is so bold and honest in criticism, as I am a bit of a sadist and his altruistic views of the purpose of literature will only serve to elevate the quality of what I produce. Don't get me wrong, I'm not going to alter everything I make to suit his palate, but if I were to make one text out of the many I have sketched out that he would wish to buy, I know I have diversified my audience to include a higher caliber of reader.
My retort to his claim of a message being expressed already, and the general lack of originality in literature, was that in writing, I could take a message and express it how I saw fit. All those who would read the message through my text would then have my antiquities, my mores, and the metaphors I thought expressed the message best now attached to how they view the idea.
Unlike him, I don't start, or rather haven't started any of my stories thus far with the idea of pushing a message through, the message has always come from the work mid-stream. If his agenda is to push ideas through writing, my agenda is to tell a good tale. We agreed to disagree.
I told him about an author I had recently met who had gotten their work published, and without pushing it through an editor, so the text still had errors in it when it hit the shelves. We both came to the agreement that this person must have had a very good letter to the publisher when they submitted their text, as this cover letter is important. I hadn't had the chance to read the text yet, but if the letter you write to the publisher can be that influential as to make or break your publishing chances, I had better do well.
Our conversation leaked further into all the works I would like to finish in the world of literature, as they are numerous in number, and I haven't finished or submitted a single one yet. He began speaking of the lack of originality in literature and how he wouldn't start the writing of a book with characters and a plot, but rather, he'd start with the message the text was supposed to push, and work its way back from there. He'd find a way to express the message through events and characters in the book, specifically side characters so the book would not sound 'preachy'.
He commented that most of the ideas I had were messages that had been over-expressed in literature already, and that he would pick the books up, but probably not buy any of them. This went double for my graphic novel ideas. I am happy to have a friend that is so bold and honest in criticism, as I am a bit of a sadist and his altruistic views of the purpose of literature will only serve to elevate the quality of what I produce. Don't get me wrong, I'm not going to alter everything I make to suit his palate, but if I were to make one text out of the many I have sketched out that he would wish to buy, I know I have diversified my audience to include a higher caliber of reader.
My retort to his claim of a message being expressed already, and the general lack of originality in literature, was that in writing, I could take a message and express it how I saw fit. All those who would read the message through my text would then have my antiquities, my mores, and the metaphors I thought expressed the message best now attached to how they view the idea.
Unlike him, I don't start, or rather haven't started any of my stories thus far with the idea of pushing a message through, the message has always come from the work mid-stream. If his agenda is to push ideas through writing, my agenda is to tell a good tale. We agreed to disagree.
Labels:
graphic novel,
literature,
moral,
philosophy,
publishing,
writing
Monday, April 12, 2010
Into the Black Forest Again
So, in anticipation for my return to college this fall, I'm going to knock the rust from my programming mind. I haven't used it in a while, so I have to turn everything back on.
To give you a little background of my programming experience, I started out with a good 'old robot programmer course that UWP uses to introduce novice programmers to the world of writing code. From there I continued up the chain of C+, C++ and then Java. My college was interrupted after taking my first Java course. I have since messed with Action Script / Flash on my own.
Now I come back to it all. First two steps I take are to get a new flash compiler (Adobe Flash CS4 Professional - [$$Pricey!$$]), and to install the FREE Net Beans IDE 6.8 for programming in Java. I run Vista on my laptop, and the Java Development Kit I downloaded for Net Beans to run on didn't give me any non-Vista-compatible gruff.
I figured since Action Script is a bit faster to learn than Java, I would start my path back into programming with a few flash animations. Boy was I wrong. A lot has changes since I last accessed Flash (through Macromedia Flash MX), and I found that the latest Action Script (3.0) isn't even compatible with former versions. After some looking into, I found the methods of 3.0 to be a bit more friendly to a Java oriented programmer, until I tried to run my script. Let's just say that I'm happy I can access all the professional documentation I need for Action Script and Adobe Flash CS4 Professional through my membership to Books 24/7. That website has saved me a lot of frustration and coin with its repository of web-texts.
Now I am leaning more towards starting off again with Java. With some research I've done, mobile devices are actually a better audience for Java than Flash, which surprised me. Most computers do both, because the languages run virtually and very compatibly with little hardware specification; and the game platforms out there that use the internet are factory Flash compatible, but you have to take steps to get them to take Java.
The I phone, of course, does neither. There goes my idea for another quick buck. Steve Jobs doesn't like developing end user software...it might produce jobs that give him less profit. Bastard.
What this all means in the end, is that I will be pushing more back into Java than Flash, because it has the larger audience, and all my development tools are FREE.
To give you a little background of my programming experience, I started out with a good 'old robot programmer course that UWP uses to introduce novice programmers to the world of writing code. From there I continued up the chain of C+, C++ and then Java. My college was interrupted after taking my first Java course. I have since messed with Action Script / Flash on my own.
Now I come back to it all. First two steps I take are to get a new flash compiler (Adobe Flash CS4 Professional - [$$Pricey!$$]), and to install the FREE Net Beans IDE 6.8 for programming in Java. I run Vista on my laptop, and the Java Development Kit I downloaded for Net Beans to run on didn't give me any non-Vista-compatible gruff.
I figured since Action Script is a bit faster to learn than Java, I would start my path back into programming with a few flash animations. Boy was I wrong. A lot has changes since I last accessed Flash (through Macromedia Flash MX), and I found that the latest Action Script (3.0) isn't even compatible with former versions. After some looking into, I found the methods of 3.0 to be a bit more friendly to a Java oriented programmer, until I tried to run my script. Let's just say that I'm happy I can access all the professional documentation I need for Action Script and Adobe Flash CS4 Professional through my membership to Books 24/7. That website has saved me a lot of frustration and coin with its repository of web-texts.
Now I am leaning more towards starting off again with Java. With some research I've done, mobile devices are actually a better audience for Java than Flash, which surprised me. Most computers do both, because the languages run virtually and very compatibly with little hardware specification; and the game platforms out there that use the internet are factory Flash compatible, but you have to take steps to get them to take Java.
The I phone, of course, does neither. There goes my idea for another quick buck. Steve Jobs doesn't like developing end user software...it might produce jobs that give him less profit. Bastard.
What this all means in the end, is that I will be pushing more back into Java than Flash, because it has the larger audience, and all my development tools are FREE.
Wednesday, April 7, 2010
The Road Ahead
This morning, upon waking, I decided to re-catalogue the skeletons of all my book ideas. After weeding out the contemporarily less viable ones, I was left with about 28 novels, and four graphic novels. I ran out of go-juice before getting through all of them, so the stack of 'to-do' items is larger yet.
I find again that it is important to get finger to key, or pencil to paper and push these works from my mind to printed type. The large fault I've had with my writing since middle school (or perhaps before), is that I do not have the gift of short story. I never have been able to stop writing a book.
As I am working through one or two novels, I'll get another four or five great ideas for additional texts unrelated to the one I'm working on. Sometimes I'll spider off and work on them. The endgame is more tasks due out with none removed from my list.
If it came to pass that I could have a career in sharing my mind and imagination with the world through picture, text, and maybe even screen, I know that I would never run out of resources. The world today (especially Hollywood), is low on originality. Though I can't claim to be truly original, I have so many fresh ideas that haven't been attempted yet to my knowledge, and it is clouding which path to take first.
I just have to plow ahead and get one work on the shelves. That might help the process.
I find again that it is important to get finger to key, or pencil to paper and push these works from my mind to printed type. The large fault I've had with my writing since middle school (or perhaps before), is that I do not have the gift of short story. I never have been able to stop writing a book.
As I am working through one or two novels, I'll get another four or five great ideas for additional texts unrelated to the one I'm working on. Sometimes I'll spider off and work on them. The endgame is more tasks due out with none removed from my list.
If it came to pass that I could have a career in sharing my mind and imagination with the world through picture, text, and maybe even screen, I know that I would never run out of resources. The world today (especially Hollywood), is low on originality. Though I can't claim to be truly original, I have so many fresh ideas that haven't been attempted yet to my knowledge, and it is clouding which path to take first.
I just have to plow ahead and get one work on the shelves. That might help the process.
Labels:
book outline,
book planning,
graphic novel,
novel,
writing
Subscribe to:
Posts (Atom)
