Gary Charles

Ranch Hand
+ Follow
since Oct 29, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
39
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gary Charles

I've got a technical job interview in a few days and I'm wondering how to
prepare. I've already had a phone interview and explained where I'm comfortable
and where I'm weak w/r/t to the technology. The phone interviewer will not be
at the in-person interview. He said they won't necessarily be testing on syntax but
whether or not I can complete a series of steps. Or maybe explain what
steps need to be done in logical order to solve a problem.

The job description lists the ability to write advanced scripts and prepare
complex on-the-fly SQL queries. I don't meet either of those requirements but
they are evaluating me because of my experience in other areas. My
own evaluation is that I can read most shell scripts and I can write scripts
but I'll be a little slow in the beginning. My SQL experience is pretty
limited. I can do basic queries but I haven't really done much in the way of
joins and whatever is beyond that.

I did well on the soft skills or else I would not be getting an opportunity for
the in-person interview. The areas I need to consider are shell script
writing, SQL queries, and logic. The recruiter shared the evaluation with me
from the phone interview

Scripting = fair,
SQL = we will need to work on it.

I'm not trying to fool anybody as it'll be obvious very quickly what my skills
are or are not. I'm just not sure what to focus on during my time beforehand.

The job is for a Technical Support position and FWIW I've been in that area for 15+ years.

Thanks for any advice!
10 years ago
Message that was here removed. I found my answer.

Gary
10 years ago
Thanks Paul. That really helped.
The assignment instructions noted that I needed to implement the Comparable interface in TimeCard so I had the empty method, but I thought the requirement was for a different part of the assignment. Now that you've given me the hint, it(somewhat) makes sense that you have to daisy chain the compareTo() methods just like other object calls where the item to retrieve is several layers deep. Once I spend time going through it I think I'll get it.


This part still seems a little bit like smoke and mirrors but some of that has to do with using static methods. It's like the list is sorted in place which is confusing to me. But that's another topic.







Here's my code for reference in case it helps someone else.




Gary
10 years ago
Thanks for trying to spoon feed me. I know that takes a certain amount of patience. Unfortunately, I guess I need a smaller spoon.

Ask yourself why sorting a collection of TimeCard objects should need to compare two Consultant objects.


Because a TimeCard contains a unique Consultant object and Consultant is the item we're trying to compare.

Wouldn't it be more reasonable to expect it to compare two TimeCard objects?


This statement seems to be equally valid to me as the last statement. Although I think you're trying to make the point that this is the correct way to think about this problem.

And when it does that, what method of what class would it use?


Getting to object I need to use for comparison seems simple in isolation. That's where I was thinking I need to do with the enchanced for loop. In my mind the chain is something like

except you cannot operate directly on a list like this. Well, I take that back because Arrays.sort(timeCards) does.

So I am not sure where to go from here.
10 years ago
Thanks Paul.

For Consultant.java there are a couple of options I can use to get the name. I put both in my method below and I think they are essentially the same.
I'm choosing to sort on the last name just to get something working although I would eventually like to understand how to use both last and first.

I have not been able to test this because I don't know how to call Consultant.compareTo() from TimeCardListUtil.java.
The provided JUnit test indicates

which I interpret as the sorting needs to happen with out returning anything. I've seen examples on the www that use

So of course I tried that and it does nothing. So I also tried the enhanced for loop as below.

Either way I am not communicating with Consultant.CompareTo() since a simple System.out.print statement doesn't output anything.

Gary
10 years ago
I've got a homework assignment to add a compareTo() method to an existing set of classes and use a supplied JUnit test. In this example I'm trying to sort by Consultant name in TimeCardListUtil.java. As you'll see, Consultant is an object of TimeCard and Consultant consists of a Name object. I'm getting lost in the objects. In my comparison, I don't know how to get at my string to do the comparison. Although our instructions are not explicit, I think it's assumed we'll sort by alpha last name, but the first name and last name start with the same letter so it's probably not critical. I apologize for such a large example, I've paired it down as much as I could while still keeping it workable.

Here are my classes.






The comparison needs to occur right above here in Consultant.compareTo(), right?

Gary
10 years ago

Henry Wong wrote:
Can you elaborate a bit? What is wrong with having two overloaded constructor -- that aren't chained to each other?



Oh my goodness. I was making it much harder than it needs to be.
I can do this...

and


Thank-you for your patience and time.
Gary
10 years ago

Henry Wong wrote:
Not all constructors can be chained. If you have two completely different ways to construct an instance of the class, then they may have to be completely independent constructors.



If I don't chain here, how do I use and ?
10 years ago
Hi,

In the class below I'm trying to create a class that will accept dates in various formats and create a range. The first constructor is easy because I send it the begin date and end date as Date objects. Now I want to send a month(and year) in a constructor and derive the begin and end dates from it. In my constructor that accepts the month/year I need to put the at the top to be allowed, but the parameters are not built yet. I've seen chaining examples on the www, but I haven't been able to get what I've seen working for me. How do I do this?



Thanks,
Gary
10 years ago
Thanks E.

Each assignment does build on the previous so you're right, all I really need is one project. I don't necessarily need to keep each assignment unique. It's more my uneasiness in adopting to that type of workflow. What you propose should work as well.

I've also been thinking about Git, but that too gets back to how many peripheral technologies(to me) I want to add that might take time away from my core Java time.

Gary
10 years ago
Thanks again for your help Joe. I guess I need to rethink my workflow.
10 years ago

Joe Harry wrote:
Did you use the same groupId and artifactId?



Yes, I did. It seems as though that is bad? The instructor said "all we should have to change is the version tag". To be fair though he might have been saying just copy everything from the last assignment directory to the current assignment directory and update the version tag. I tried that as well but Eclipse is still looking at the same project name I think and seeing a conflict.

I may have misheard how he suggested we do this but I'm sure about the "leave everything alone but the version tag" part.

EDIT: Or that may have been if we wanted to use the same single project each week and just update the pom.xml.

Thanks for your help BTW in this and previous post. I appreciate it.

Gary
10 years ago
When I run the
  • mvn archetype:generate ...

  • command in my second directory(assignment02), and then in Eclipse
  • File > Import > Existing Maven Projects

  • Eclipse gives me a message "Project cp125 already exists, Add a version or custom suffix "Name template" in "Advanced" settings.

    I copied in my pom.xml from assignment01, incremented the tag but it didn't help. It may be obvious to readers here but when I imported the previous assignment it came in as cp125 and that looks like part of the problem.
    One thing I know the instructor was adamant about; and that is that the only thing we should have to change is the version tag. In fact he wants basically nothing else changed so that he has consistent packages for grading.

    I've tried a few things to get this going like I want but I'm not sure what I should do to get this working?
    10 years ago
    I just started a Java course where we're using Maven. To start with we ran something* like this at the command line for the first assignment/project.


    Next,
  • I edited the pom.xml file as per the assignment instructions and added the dependencies.
  • Installed the M2E plugin and imported my project into Eclipse with File > Import > Maven > Existing Maven Project.
  • > mvn clean test
  • > mvn assembly:single

  • That all went well.

    Now I want to create a new directory/project for each assignment each week but it seems like I should not have to run through all of the above steps each time. The instructor is not going to go into maven much more than the above and if I understood the lecture correctly, we're supposed to do that each week if we want a new project.

    What I think I should be able to do is

  • create a new directory
  • copy the pom.xml
  • change the -Dversion='02' in my pom.xml
  • run a mvn command on the command line or in Eclipse and have it create the remaining directory structures for me
  • I'm going to have my hands full with the Java topics and speed at which we are moving so I'm hoping there is a simple command I can run.

    Is this possible?

    I've looked at creating a new archetype but it looks like more than I can get into right now.


    Environment:
    Windows 7
    Eclipse 4.3.1
    Maven 3.1.1

    * The example above was for Linux but I used PowerShell so the actual command was slightly different.

    10 years ago