Jeff Zak

+ Follow
since Feb 24, 2016
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jeff Zak

Through a tutorial I made my first MySQL database which uses EditTexts, then can Add, update, delete and view the records. I've now replaced one of the EditTexts with a Spinner which shows my two values when I test the app. When I go to add the new record my app crashes and then i get this error below in Android Studio. I assume I am passing no value.

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.widget.Spinner.getSelectedItem()' on a null object reference
       at com.bassbuddy.bassbuddy.MainActivity$3.onClick(

Now, I'm not 100% sure about HOW to pass the value so I followed how the EditTexts worked and followed that as in the following:

public void addData(){
               new View.OnClickListener() {
                   public void onClick(View v) {
                    boolean isInserted = myDB.insertData(spinBass.getSelectedItem().toString(),                      

                    if(isInserted == true)
                        Toast.makeText(MainActivity.this, "Data Inserted", Toast.LENGTH_LONG).show();
                        Toast.makeText(MainActivity.this, "Data NOT Inserted", Toast.LENGTH_LONG).show();

Below is the spinner.

String[] fish = new String[] {"Largemouth", "Smallmouth"};
       Spinner fishSpin = (Spinner) findViewById(;
       ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, fish);

If I need to post more code let me know. Any help would be great.
1 month ago
I have created an HTML Help File that is accessed from "Help" on the menu bar of my program. Now that I am getting my program ready to distribute I find I have to change path to this file since users won't be able to access my Documents/Project file from their computers. This file will be included in myproject folder. How would I set up a path in this situation where users might place my program folder on various drives?

3 years ago
Right now I'm playing Silent Hunter III with a whole ton of mods that makes a 10 year old game pretty fun. I just finished a patrol from Long Island, NY to South Carolina and sunk about 40,000 tons of allied shipping.

TIE Fighter is still my absolute favorite PC game ever!
3 years ago
Good info elsewhere on the blog, too.
3 years ago
Is it possible to edit the functionality of the close(x) button on the JFrame? I have two places to close my program. One is in my File Menu that displays a nice message saying "All unsaved data will be lost if you proceed" YES/NO. This works great but I'd also prefer this when Close(x) is pressed as well since that closes without the prompt.
3 years ago
I tried to find ones no one else did and I also gave directions.

Box from the movie Logans Run is the bluish silver robot 3rd on the right robot Bill and Ted.

Scooter from the GoBots is the red one behind C3PO.

The rusty colored robot to the right of Robby the Robot is from the movie Judge Dredd.

Second to the left of Marvin , the little white one with big jaw, that's a Mouser from the Teenage Mutant Ninja Turtles.

Two below Robot Bill is Crow T Robot from Mystery Science theater 3000.

Tom Servo is to the left of Twiki from Buck Rogers.

Two to the right of the 80's Cylon is the robot from Return to Oz, the copper-ish one.

Two above the Return to Oz robot I think is GlaDOS from Portal

White robot 3rd over from R2D2 is T-Bob from the cartoon M.A.S.K.

Tin Man from Wizard of Oz is in there, too.

I also think the robot on top of Marvins head is from the movie Batteries Not Included.

Right side of image 3 robots down from the robot from Sleeper, the one with big eyes and a boxing glove, that's Uncle Paulie's robot from Rocky 4.

Maria is from the movie Metropolis and is holding hands with C-3PO.

3 years ago

Jem Crystal wrote:

What I do want is to build a game or two. Don't care if it is 2d or 3d or whatever.

How bout No D?

Programming By Doing's exercise # 33 is a simple text game. It doesn't have commands or anything. Its just go here or go there but technically its a game of sorts. You should be able to find other tutorials to build upon the basics and add more functionality to it.
3 years ago
I like HP Lovecraft's stuff and my favorite story of his is The Dunwich Horror. I google imaged that story and people had made up some drawings of "the horror" appears to be, even though its invisible in the story. This one was awesome for a desktop background and matched up to the description in the story pretty well.

3 years ago

Hadijah Mohamad wrote:can you give me your sourcecode? because i can not retrieve image from database. thanks in advance. ...@...

Can't give you my source code, sorry. That's Top Secret information. I'm also not using a database but text files instead. However, do a google search for "get image from database Java" and you'll probably find your answer in those tutorials. Same with Youtube videos you can follow. Quite a few tutorials that should help you out from the looks of it.

3 years ago

Eric Matthew wrote:What small thing did you over look or perhaps didn't click-in/notice right away for you that caused so much frustration?

Awhile back ago, I had a difficult time parsing/splitting a CSV(Comma Seperated Values) file that had fields with commas in them "Plumbing & Cleaning, Inc." and "$1,999.00". So I read up on Regular Expressions hoping to get some voodoo magic working for a few days.
Then I realized I could just excel to select all the Strings and Integers, find & replace all the "," with "". Bam, all extra commas gone. Don't know how this slipped my mind.

How about yourself? What can we learn from your pain and suffering?

I have a Jtable with about 8 rows visible in the GUI before it'll scroll. I NEVER added more than 5 rows to it before tonight even though its been functional for a month. I figured it would scroll when I add more no problem. Well, that didn't happen. My scrollbar on the Jtable wouldn't move and I couldn't figure out why. After 2.5 hours of worry,research, and staring at it, it turned out that my Preferred Height of the table was set to the height of the table itself. All I had to do was increase the Preferred Height to a larger value and it worked.

All these little things add up and you learn from it so they aren't all that bad.

3 years ago

My latest obsession is Keep Talking and Nobody Explodes. You could say it's a tabletop game that uses a PC or Mac as one of the components. One person is "stationed" at the PC, which shows a bomb with various wires to cut, knobs to turn, buttons to press or passwords to enter. The other person has a printout of the bomb defusal manual, which has instructions for, as the name suggests, defusing the bomb. The person with the PC can't see the manual, and the person with the manual can't see the PC screen.

Say this on an episode of The Angry Videogame Nerd recently. That is a really neat idea for a game.

I play IL-2 Sturmovik 1946 online and am kind of addicted to that. I also play NES emulators quite often, too.
3 years ago

That's a solution, sure, but would it maybe be easier to just initialize everything in that column to zero?

I could but what would happen if the user enters a new value , say 325 for the weight and updates. Again, the user makes a change and fills out the row with a new part and accidentally leaves the weight entry blank, clicks update, then decides to calculate the weight total. Does that empty cell then revert to 0 again or will it be an empty string?
3 years ago
Hey Knute..

I solved my problem but just did it a different way than what you mentioned. What I did was just search for the null or empty value in a single column, then
just put a value in there in its place. In this case, since its a columns called WEIGHT, i just added a "0". So, if the user doesn't put in a value for the weight
it will just automatically give them a 0 in the cell or any other in that column. Here's the code.

Thanks for all the help, anyhow!
3 years ago
Well, I may or may not have an error in the label but it gets cleared before this loop takes effect. I'll read up on that flag stuff
and give that a shot. Thanks for the help.

3 years ago
When testing my program i run into this issue (Empty String) when one or more cells in my weight row are empty when i go to calculate the weight totals. In the program I can keep pressing my "calculate" button and nothing will happen until I enter a value in that column, however, I get this specific error in the console. When a value is entered in that column in each row all my calculations work great.

I have set up a label in my program which handles errors when conditions are met like " No row(s) to update." when you click UPDATE button and there are no rows in the table. Or, if there is a row and its not selected, "Select a row first" when UPDATE button is pressed. This process works great and i'd like to use the same process for this button as well. I'm just not sure how the heck to get there.

Here is what I have in regards to the loop and getting the column value which doesn't seem to catch anything.

3 years ago