Robert D. Smith

Ranch Hand
+ Follow
since Oct 04, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Robert D. Smith

Peter Verhas wrote:

I especially loved the note in the section on overview of sorting algorithms where you ask the math geeks not to curse you.



You are welcome. You can also read my blog at javax0.wordpress.com that may help you to decide if you like my style or not. If not, I do not take that personally, you cannot fit everyone's taste. My wife likes my style, that is important. In my home, we have more than thousands of books, some of them older than 100 years. You should never scrap a book. Books are sacred.

 I am in total agreement regarding books being sacred.  The pride of my collection would be my 11th edition Encyclopedia Britannica, followed closely by my 1832ish complete collection of Shakespeare's works (unfortunately they are in extremely poor condition, but it was a great find in a used bookstore that was only concerned with turnover and sales).

The joke within my family is when someone needs a book on this or that, I can usually say, "I have a book on that."  To which everyone in the family, including the rotten, ugly grandkids, respond, "Of course you do."

Anyway, I digress.  Thanks for the blog link.

Respectfully,
Robert
6 years ago

Campbell Ritchie wrote:

Robert D. Smith wrote:. . . Not sure that I have any questions. . . . not to curse you.

You can curse me instead
I can see three questions in your post; each should be a th‍read of its own, to give you a chance to win the book.

They were meant more as comments, and perhaps discussion points, than they were as questions.  

This is strictly to give a sense of who I am.  First, I would like to win the book.  It would be nice to have -- it is something I could use and learn from, and it would annoy my wife( who continually tells me that I must get rid of two books for each book I bring into the house).  That's a win-win for me.     But to create multiple threads to increase my chances to win is just not in my nature.  It just doesn't feel right.  In this day and age of casual wear, I still wear a coat and tie to worship while most are in, at best, khakis and a polo shirt (if that).  It just feels right.

My post wasn't an attempt to win anything (well, maybe another cow   ).  My intent was to merely point out a bit that caught my attention and seemed interesting.

Respectfully,
Robert
6 years ago
Why not use the Java Time API?  From the Date Classes Trail it's a reasonably simple way to get the number of days for a given month, without the need to resort to if-then-else logic.  

Respectfully,
Robert
6 years ago
As the others have stated -- welcome and all that that implies.

Not sure that I have any questions.  While perusing the TOC, I was mildly surprised to see the discussion "jump in with both feet" when bringing up the subject of collections.sort (Chapter 3, Optimising the Sort).  Packt doesn't really provide much of a preview, so I couldn't get a feel for the level of detail provided on collections, arraylists and the like.  Personally, I'm hoping for more of the former, where the book isn't going to try and hold my hand to explain everything.

Book looks interesting, and will probably end up being added to my book wishlist.  I look forward to the coming discussion and questions from others.

Respectfully,
Robert

ps. I especially loved the note in the section on overview of sorting algorithms where you ask the math geeks not to curse you.
6 years ago
you are going to need something like this ---

main()
 create an instance of average
 pass your ints to your new instance
 don't forget the return string
 print out the result


For what it's worth, your getAverage works.

Regards,
Robert
6 years ago
There is a built in grep like tool for Windows -- findstr.  It's a cmd line program, and I have zero experience with it.  Thought I'd mention it, in case it applied to this discussion.

Regards,
Robert
6 years ago

Eric Arnold wrote:Frankie, take a look in C:\Program Files\Java\
I believe that is the default installation directory on Windows. In there you should find your jdk-10.0.1 installation.
As for the PATH environment variable, it's done automatically when you installed Java, so assuming it's installed, you should be able to use java/javac/jar from the command line in any directory.


This is partially correct.  The Oracle installer will set a path to C:\Program Files (x86)\Common Files\Oracle\Java\javapath which contains the java and javaw executeables.  The path to the jdk is not set.  (New laptop, fresh installs of everything), and will need to be set through the control panel.

Frankie -- there are plenty of tutorials and how-tos to set the path.  Several even contain step by step pictures.  Since you have installed java 10, assuming you took the default install directory, you will find java installation at C:\Program Files\Java\jdk-10.0.1\bin

Normally, I would post the step by step here; but, given your level of experience I strongly suggest you google something along the lines of windows 10 set environment variables.  

Good luck, have fun and ask lots of questions.

Regards,
Robert
6 years ago

Stephan van Hulst wrote:By the way, why does the entity have an ID if it already has a unique name? The ID is superfluous and just plain cumbersome.



This is what jumped out at me first.  As it is, it will fail on those rare names, like Robert Smith, that happen to be the same yet have different user ids.  I would think a PK of ID and name combined would be called for, but that's just me.

Regards,
(the one and only) Robert Smith
6 years ago
If I understood this correctly, you are asking the user to input two (2) integers, multiply these two numbers together, and store the result.  Rinse and repeat.



Check the syntax on the println method.

Of course, We Are Not a Codemill, but this should get you on the right path, and hopefully a clear  this up for you,  Sorry about the crappy formatting -- something to do with the way I did the copy, cut, and paste.

Regards,
Robert
6 years ago

Frankie Bailey wrote:

OK - I had only downloaded the JRE.  I went and downloaded the JDK.  I have both but I understand the JDK includes the JRE. What next? How do I get to a place to run a java program?

I know how to use the command line in the dos window. Would that be the only way to execute a java program unless I have an IDE?

Also, what is the purpose of the JRE?  I must be sounding like a head without brains here.

Thanks for the responses - every little bit helps.




I see others have answered the what is the JRE question.

It is recommended that you first learn Java using the command line, and holding off on an IDE.  IDEs, while convenient, have been found to hide certain functional matters (how to handle packages comes to mind).  Using the command line will give you the skills needed that an IDE will hide and it will make you a better programmer.

As to what to do next, and where to get started, I suggest The Java Tutorials.  Remember, the best way to start your project is to turn off your computer, find a pad and pencil, and write down what it is you want to accomplish.  Keep at this until you have a good understanding of what your requirements will be.  Doing this will help you plan out what objects you will need, and will make actual coding much easier.  This simple method will reduce the number of times you will start over from scratch, throwing away classes, rewriting the same class multiple times, all that fun stuff.

Good luck.  Ask lots of questions.  Let us know when you have solved a problem you have asked here at the ranch for advice.

Regards,
Robert
6 years ago
Why not something as simple as reversing a copy of the string, and then check if they are equal?  Seems much simpler than running through a loop, counting characters, and such.

Just a thought,

Regards,
Robert
6 years ago

Robert Manley wrote:
Copied java file into this window, highlighted and pressed "code" button.
Then clicked "preview".
No change. no line numbers.
What am I doing wrong?
Particularly annoying as I know I have done it correctly in the past.



Hopefully, this offers a bit of clarification.

Based on my interpretation of what you wrote here, is that you pasted in your code, and then you pressed the code button.  Press the code button first. You should see the following line.

[code=java][\code]

Move the cursor between the ] and [ and then paste your code.  If this isn't the problem you are having, maybe give a little more detail such as enumerating each step you took.

Regards,

Robert
6 years ago

Nasio denasio wrote:
This statement is ridiculous considering that this is a Beginning Java forum. Do you tell everyone who asks question here to think for a moment what they need to do differently to make the code work? These forums are for asking questions or not?

If you want to help with tips or code, then that's great! Otherwise keep quiet and let others who are willing to help answer.



I found your reply rather irksome. so instead of trying to explain anything to you, I will just point you (not that I think you will actually read it) to the We Are Not a Code MIll documentation.  [edit: comment deleted (none of my affair_]
6 years ago
What you are asking for is a very broad topic.  Much like mathematics, writing, art, the only way to learn and get better is to do by doing.  Any google search for something like "java programming projects" should return enough to keep you busy for a long time to come.  You might also look at the Cattle Drive here at Code Ranch, and work through the projects.  They start off simply enough and get progressively more complex.
6 years ago
Thanks for the review, Jeanne.  Buying this for my granddaughter(s).  The 12  year old is always borrowing my laptop for school projects, and this might intrigue her eough to go a bit further in her studies.  And she has expressed interest in a time or two.
7 years ago