Posts
60
Comments
36
Trackbacks
18
January 2009 Entries
Java and Radio Buttons Using Netbeans 5.6 GUI Builder

To get through this tutorial, you must already be able to create a basic form with 3 or 4 radio buttons on it.  We are going to go over making and using these buttons in a functional example.  To start, I create a project selecting Java Application and then the Next button.  I rename my application to "RadioButtons", you may name it whatever you want to, I then deselect (uncheck) the "Create Main Class" option, followed by Finish. 

  1. Right Click on Source Packages and New -> Java Package, I name this radiobuttons.
    1-29-2009 5-16-59 PM
  2. Right Click radiobuttons (if you have named it the same as I have) -> New -> JFrame Form, which I name RadioButtons, and click finish.
    1-29-2009 5-21-34 PM
  3. From the Right hand side (maybe different for you), drag Button Group anywhere in your square panel and drop it (you won't see any changes here).
    1-29-2009 5-23-53 PM
  4. Now place your radio buttons, using the Radio Button (next to your Button Group).  I place four for this example.  I then shift-click (to select all of them).
    1-29-2009 5-35-02 PM
  5. Right click your selection -> Select Properties.  This step is where you group them together.  When you look at the properties, there is an option for button Grouping (seen below).  This will group them for our purposes here, select your buttonGroup (that was created in step 3).  Note: If you don't see a selection, you can go back to 3 now and carry out that step
    1-29-2009 5-37-13 PM
  6. At this stage, if you were to click "Play" or Run -> Main Project, you will see the radio buttons in a GUI that are grouped (allowing only 1 of the 4 to be selected at a time).
  7. Now, to put these radio buttons to use, we will add a button, with a click listener and a text area.  (Just drag and drop from the right hand group of objects).
    1-29-2009 5-47-22 PM
  8. To add the click listener to the button, Right Click the button, select Properties.  At the top of the pop up dialogue, select events -> scroll down to mouseClicked and select the ... on the right hand side.  This will take you to the picture below, where I named my event and selected Ok to close out dialogues.
    1-29-2009 5-53-13 PM
  9. This will take you into the code where you can create your code to do what you want it to do.  In this example, I am simply setting the text box to the value of the radio button that is selected.  And here is the corresponding code, below:
    1-29-2009 6-47-31 PM
  10. Press Play now.  :-)

There are a few things to note.  If you are using their text in a calculation, you will need to cast it properly.  There is most likely a better way to do this, but for beginner I believe this will get you started.  Feel free to comment, as always.

posted @ Thursday, January 29, 2009 6:51 PM | Feedback (16)
Java Bubble Sort Array

Bubble sorting a Java array is a very good way to get practice with arrays.  It shows many techniques and here I will show one.  It doesn't give graphical representation, but it gets the job done.  The compiler does a little extra work (as this is designed to be a beginning tutorial and answer to the basic bubble sort algorithm.)  The basic concept behind a bubble sort is that we test each digit of the array once, swapping (hence moving) the higher digit to the right.we will do this one time for every digit in the array.  The final result is a sorted array ascending.

Netbeans 6.5 Arrays File

Lets look at an array 2, 3, 1.  It starts with 2, and tests it against 3.  If 2 is greater than three it swaps them, but 2 isn't greater... we just move on.  It then tests 3 against 1, which is higher (hence swapping the 3 and 1).  The resulting array is 2, 1, 3.  We do this one more time, resulting in 1, 2, 3.  Here is the code:

1-28-2009 11-11-52 PM

In plain English, the above example calls out a swap routine, sending the routine the array and the value which is going to get swapped with the one to the right of it in the array; it is also notable to see that we are returning the full array with the swapped values.  Here is the function to swap, and therefore bubble sorting and that is:

1-28-2009 11-13-57 PM

And this is added directly below the main function.  You can see that it also closes out the class.  For added verification, you may want to print the array, but I will leave that for another day.  In the next issue of Java programming, I will go over a better sorting routine that will not require this many steps.

Technorati Tags: ,
posted @ Wednesday, January 28, 2009 11:21 PM | Feedback (0)
So I am in the Mood

I really just want to release right now.  In a couple hours, I will be teaching class and grading papers, and until then I want to write.  Sometimes I just get into this mood.  This writing mood can last for days, weeks and rarely months.  It is a way for me to just release.  I may not have the time to write, but when I do, I will blog it.  The good thing about my paper, is it rarely talks back, it never laughs at me, and rarely does me wrong in general.

posted @ Wednesday, January 28, 2009 5:41 PM | Feedback (0)
Big Day on Friday

So many employers are laying off so many people these days that I guess I should just be sleepless all of the time.  My employer announced huge layoffs this month (10,000 people), so how do I get through nights successfully.  The short answer is Benadryl, though that only goes so far.  For me, it works if I just stare at the back of my eyelids and shrug off any thoughts that come into my head about future layoffs.  I felt really good though, when recently, I submitted my resume to a head hunter (who knows how he got my resume).  So here are some tips that will you help you get through the nights leading up to getting laid off.

  1. I really wasn't joking about Benadryl.  I have massive allergies here in the mid-west and I must say that it helps me tremendously when I just can't sleep.  I figured out that it helped me sleep because when I went to the allergist, I found that I was allergic to my environment.  My Allegra has taken over along with a nasal spray to help me get my full nights.  The good thing about Benadryl is that it is non-habit forming and a very good short term answer to sleeplessness.
  2. The world will continue to revolve, evolve, and grow.  This includes the economy, and looking at history (since it tends to repeat itself), you can see that we aren't where we were in the early 80's now; we aren't in the depression of the 30's.  In short, the economy will grow and jobs will be created, so hang in there; don't worry so much about losing one job.
  3. Plan your future.  This you should always be doing, I personally re-evaluate my short term goals on a monthly basis and my long term goals not so often.  Short term goals can change, but you should always focus on your long term goals and change these much less often since they are generally harder to achieve.  A few years ago I decided to enter school this August, having a bachelors and a masters means that this goal is not mandatory; but since this has been one of my goals, I will continue to focus on this.  It goes toward the longer term goals that I have.
  4. Stay positive.  Even if you aren't feeling positive you should try to reflect positive.  If you constantly smile at those around you, they will start smiling back.  It is a lot harder to rid a negative seed in any environment.  So if you have anything negative to say, do those around you a favor, keep them to yourself.  It also helps if you depersonalize any critique, which helps in the academic world.
  5. Smile.  'nuf said.
  6. Smile some more.  Possibly until your cheeks hurt.

These are just some of my suggestions if you might be in danger of getting laid off.  If it does happen to you, and you lose that job, working for that employer that you love, then remember that there are other employers out there.  Plan for a course of action, guide your short term decisions by the larger picture (your long term solutions).  After all, that is what your employer is doing.

posted @ Wednesday, January 28, 2009 5:38 PM | Feedback (0)
A Web Site, and What NOT To Do!

When you put your name to a site, I would expect it to be somewhat functional.  What I wouldn't expect to see is half of the links not working.  Ok, so I have had my share of problems, even on this site as far as functionality.  For instance, my email system doesn't work; so try to send me feedback and it won't ever email me anything.  This is an issue with Godaddy shared hosting though.  Find a link on this site listed internal going to an internal link, and I guarantee it will work.  So when developing a site keep these basic rules in place.

  1. Do not have broken links when you are trying to show off your talents and skills.  This may cause your audience to automatically write off your reviews or resume.
  2. Don't have anything that starts music that I didn't ask for.  This is abundantly obvious on MySpace (just look around a little).
  3. Don't put medium gray text on a medium dark/dark gray background.  There is a system to determine the spread of colors.  Also keep in mind that a pretty good majority of people are color blind, so try to avoid solid reds (especially) and other colors that people might not see.
  4. A lot of high contrast decorations and anything else that makes your site hard on the eyes are not good things to do.
  5. Don't put an onclick tag on the body of your page.  I don't want a new add every time I try to focus for scrolling or whatever on a site.

I think the most important thing here is to keep in mind that there are many annoying sites out there.  There are also many sites out there that aren't so annoying.  So try not to make people want to avoid your site.  One of my favorites, is http://Experts-Exchange.com where they still inundate paying customers with annoying pop-ups and pop-unders so often that we shouldn't even have to pay. 

posted @ Wednesday, January 28, 2009 5:19 PM | Feedback (0)
GMAT Scoring

I am writing during my lunch break, while I don't have much email to go through.  Today's topic is surrounding the GMAT scoring.  I believe that it is possible to attain your goal in the GMAT, if you set aside the proper time to do so.  I went in and missed my goal recently because I was so busy that I didn't have time to put the priority on GMAT.  So how do you get the grade you want on a GMAT or GRE?

The first thing I would mention is study.  Not only do you have to study the tips and tricks, you have to study the content that is going to be on the test.  With minimal preparation, depending on the areas that you are generally good at (hopefully it is either math or verbal), you can expect to score around the mean.  What this means is that I believe that a mean of the test takers are those of us that either a.) don't study -OR- b.) don't study the proper stuff enough.  For me, my weak side is verbal; fooey on sentence structure.  Since that was also the hardest for me to study, unfortunately, I did not do better than mean here (I was right at the mean).  My suggestion is to prepare harder for the weaker areas, all the while preparing for all of the areas.

The second thing is to prepare for test day.  Take the GMAC Practice test several times.  While this only gives you an idea of what you will score, it will get you more comfortable with the test and the test layout.  Being comfortable on test day is an absolute essential.  This test doesn't give real time feedback, so find a book that will help you study questions and may give you real time feedback of what happened when you answered something.

Finally, I would say prioritize (and this may be the most important thing here).  Priorities generally determine how we live our life, from all aspects.  Priorities could be family, happiness, work, 2nd job and more.  If your GMAT Priority is aligned where mine was, you may not get any time to study.  Make sure that you plan on that when it is time to schedule your exam.  If you have several priorities that are going to outrank your GMAT test, then schedule more time before you take it.  On the other hand, if you are in a hurry to get it done, you may have to take off work (or at least if you have a second job) to make sure you have the time to put into what you want to do.  If you are in your undergraduate and in a tough class that is taking more time, you may not want to schedule the GMAT during the session so you will have a few weeks of uninterrupted study time.  Align your priorities for success, and if you do that, you will be successful.  Getting your goal on the GMAT can play a big part in where you will be in your future, prepare.

posted @ Wednesday, January 28, 2009 2:54 PM | Feedback (0)
January's Blog

Wow, if there is one thing I can note about my new year, it is that the new year will most definitely be one of my busiest.  While I haven't had time to post as much as I would like to, I would like to share a few things.  First, I would like to mention http://hurl.me which is a little side project of mine.  I have put in minor functionality, though I am still looking for more things to do with it.  Currently, http://hurl.me shortens URLs and since I own http://hurlme.com and http://hurl.me I believe that this is a great chance to write a new feature.  The initial roadmap is taking me towards a new information gala, where you can click a button and determined by your interest, you would be pointed to a new web site that other users with similar interests have liked.  If I went this route, I would tie it into Facebook and MySpace as well.

1-27-2009 3-12-44 PM

Other things going on right now include http://techgrind.com *note, this site is not on right now.  This is going to be a technology blog where the atmosphere is light and the information is exponential.  We will also be looking for writers there, so stay tuned.

1-27-2009 3-10-42 PM

In addition to this I also teach classes at a University and work in a large IT environment on web applications.  So, it is going to be a very busy year; but I am up for the challenge.  Also, I am rooting for Hokiebird, join their fan page here.

Hokie Bird

posted @ Tuesday, January 27, 2009 3:13 PM | Feedback (0)
Laptop Wireless Cards (Laptop will not connect to wireless router)

Is there an FCC Requirement that requires that you physically be able to turn off the wireless router in our laptops?  The reason I ask is because for novices or any non-technical computer user, that little switch will cause many headaches.  If you can't connect your laptop to a wireless router or if your laptop suddenly doesn't work on the Internet, there is a good chance that you have found this switch.  Look around on the front of the laptop or side (they usually put it in a really convenient spot to entice accidents), and flip that switch and watch your Internet come back on.  If that is indeed the problem, you will see a light right next to said switch come on.  This light is green, blue or orange generally (I only have four laptops and they are all one of these three colors ;))

Other possible solutions may be that you have the software turned off on your operating system, though this is generally not the problem, since the pain "suddenly" started (and you were looking at the screen when it cut off).

What do I check if this did not fix it?  I would check your router and modem (cable/dsl) or your combined router/modem.  Note: If your unit is combined, smash it with a baseball bat and go buy something else (joke).  Otherwise, you want to unplug BOTH units for 30 seconds and plug them back in (I usually do them in synch, but believe it is recommended to turn the modem on first).

Note to self: If you ever design a switch like this, put it in a spot so that everyone knows where it is and make it harder to accidentally switch (like, it should break long fingernails).

posted @ Tuesday, January 06, 2009 5:35 PM | Feedback (0)
Should I Attend (Insert University Name Here)

I am in a bit of a bind.  Here is the scenario in words.  I am looking at several different Universities as far as a doctoral program.  Some of them are local, some of them aren't.  So what's the big deal?  I really want to attend a specific University and I want to teach (future) there as well.  The University, or most Universities(?) don't hire their students as faculty after a degree program.  I am not sure if this is a trait of all major universities or just the one that I want.  Regardless here is the thought process.

If I attend the university, my chance of gaining employment there are miniscule (at best).  This means that they most likely wouldn't consider graduates of their program for entry into their staff.  It actually makes some sense if you think about it.  One of the key benefits of doing it this way is diversity.  You bring much more breadth to the ideologies, experiences and more for the program then you do if you were taught there.  If a university consistently hires their own graduates to teach; then your students could be getting a stale education.  Diversity is good in upper level education (as it is almost anywhere).

If I decide to go elsewhere, so that my education can be obtained in a manor in which I would be more likely to get picked up by the University of my dreams; then I run the chance of still not being able to obtain employment at said (dream) University.  Basically, there are hundreds of grads each and every year (or dozens in a specific arena); so lets assume that there are jobs in this department.  What if there aren't jobs at the specific University you want to be at?  If I chose this route, I feel I may severely hamper my ability to ever get to this University (either as a student or staff).

Adversely, if I take a chance and just go to this University (my original goal is just to be an Alumni), I basically surrender my right to ever teach there from a faculty perspective.  However, I achieved my goal of Alumni and also spent 4 years in this dream of mine. Whereas choosing to go elsewhere for my initial education means that I spent 4 years achieving a goal, and still have a chance at attaining lifetime employment at my favorite U. 

The saga deepens.  I generally don't plan on staying anywhere for more than 5 years.  I feel that 5 years gives you enough time to accomplish what you were brought in to do.  After that, unless it is JUST the right fit, you would move on or risk becoming non-diverse (complacent, old-timer, etc.).  I feel that the same reason Universities don't always hire their graduates could be the same reason that people don't generally stay anywhere for a lifetime these days.  Looking at today's economy could be a perfect example: these lifetime employees at companies like Chrysler, GM or Ford who have been employed for 20+ years (and maintain this loyalty until death if they may), are being laid off or put on involuntary (unpaid) vacations and even in some cases bought out for a portion of their pension.

While I could write on this subject for days, I won't because I have too many other things going on.  The basic question here is: Choose the University of your dreams (providing you get accepted), knowing that after your degree is done, so are you in regards to this University?  Choose the University that will provide you a solid platform to get a faculty position at the University of your dreams?  Again, this only applies to doctoral (and some Master's) programs.

Update***

I have thought about the whole 5 year thing, and while I feel my intentions were definitely stated properly, I also feel that it deals with the current state of mind.  I feel that 5 years in the business world is appropriate, especially if you want to move around and move up.  Sometimes, this number can be greater depending on your current situation.  In the academic world, there are certainly chances to move around and move up; however, I also feel that the reward is in the work you do whether that be with students or in research.  I feel that if I have the chance to complete my education in Business Information Technology, I will most certainly find that "right spot" and hopefully stimulate (to my hearts desire) the intellectual need to grow both personally and professionally.

In conclusion, I would have to say that my heart and mind are made up.  This so called "vow of poverty" is worth it to me to realize the reward.  Feeding and learning enough information to launch my intellectual person into a state in which anything that can be dreamed, done, learned and taught (within reason, right?).  One day, I will lecture in the halls of this University, I will complete a terminal degree, I will.

posted @ Monday, January 05, 2009 5:41 PM | Feedback (2)
Studying for the GMAT

Ok, so I want to ask a question.  Is there anything more boring than studying for the GMAT?  I can't think of any off the top of my head, though I can say that I keep plugging away.  In 4 or so days, I have studied more than I ever have before for any test.  It's not even about the content when studying using these GMAT Bibles (I'll get a link later), it's about the mind manipulation of the type of questions.  I still have 3 weeks (approx.) to study.  Are there any methods that you have found better than others?  I am using these study bibles and he really seems to get you ready for this with plenty of test questions.  My initial practice test was in the 500s.  My goal is High 600s and I will be happy with anything OVER 600.  Does anything work for you?

posted @ Sunday, January 04, 2009 6:59 PM | Feedback (0)
News
My Developer Notebook! This also happens to be my opinion place. Thanks for coming by.