Kevin Mckeon

Ranch Hand
+ Follow
since Jan 17, 2018
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 Kevin Mckeon

Here is my code

Struts.xml :

Action Class :

Web.xml ;

Index Page

the Index page loads fine, but when I click the link in the Index page. i get a 404

There is no Action mapped for namespace [/] and action name [LoginAction] associated with context path [/StrutsApplication]. - [unknown location]

Any ideas ?
2 months ago
How to  Git Commit to single project from two PC's (without using Github)

I prefer to work on personal projects on my work PC as i have two screens, more Ram, more tools etc.

But when i move home for the weekend, I need to be able to carry on from my laptop.

Before, I was committing all changes to my GitHub account, and pulling across the changes every time I swapped PCs but now my work proxy causes issue when trying to push to (and pull from) GitHub

Is there any other way to keep a central repo without having to export the project ZIP, emailing it to my other PCs and manually updating the files
Thanks for the advice. From reading the above, what I think what I am looking for more than anything is help creating a Project Plan.
Once I know what I should be doing, I can start.
Here is what I came up with so far :

1. Learn how to use GIT from command line and learn how to TAG Commits for each working release,
2. Learn how to set up Unit tests and continually test each part of the project (fully test each commit),
3. Adhere to best coding practices throughout (Naming conventions, GIT commits, Commenting, Separate code and data, Keep it object orientated etc),
4. Create a database that holds ITEM Names and prices. Use the Application to extract the data and compute it and expand database when required,
5. Turn the function into a web API, probably REST,
6. If creating a front-end, consume the API rather than having everything coupled

Part 5 and 6 are where i will get stuck as it will be about process as opposed to actually solving a problem. I have no idea how i would turn a function into a Web API or what it means to consume an API.

Also a couple of other short questions, should i be using Maven from the beginning ? Is this a case for a Maven Project ?
Should i try and use something like Jira to keep track of issues, bugs and my testing cases ?
4 months ago

Campbell Ritchie wrote:How long did they give you for this exercise? Did you ask you to create it during the interview? Where did you have your Git repository? How long did you take to create that app? I presume you didn't get the job?
I would worry a lot about somebody who didn't try to have a working prototype in 15 minutes. They want to see the way you handled the task, your code style, etc. Adding all those other things would worry me too, becuase it would raise suspicions about whether you are going to spend all your time doing extraneous things which add nothing to the value of the product. Also the way you wrote raises suspicions that you are trying to work out implementation details before deciding what to do.

Your thread title “Open ended interview question - How to tackle” doesn't tell us what the thread is about.

Hey !

Their was no time limit, the sent the email with the spec on a Thursday and asked to send them on the repository link the following week. So a couple of days or a weekend.

I withdrew from the job application the following week as it meant moving to the London, which I wasn't prepared to do.

I never attempted the question - partially because I had turned down the application and it was Christmas week, but mostly because I dont really know what to do.

I dont really know where to start, what tech to use, what they are looking for, how to organize unit testing, how to turn a Java function into a REST web API, How to link a front end with an API, how to tag Git commits .

If this was a simple Java question, I could do this in 5 minutes - write a method that takes in an array, loop through array, keep a count of the total cost and apply discounts where required etc.

I want to complete this exercise and learn all the above but its difficult to do this without sitting down with a developer and talking it out. (hence the thread)

I would like to know how other developers would tackle this question. What tools / methodologies / patterns they would use. What an examiner would be on the lookout for.

I would have no problem solving a medium/difficult hackerrank question or Java exercise but how or where does one learn to develop simple software after becoming proficient in the Language  
5 months ago
I was given this question as an assignment for Junior/Mid Level Full Stack Developer role.

(The interview process is long over but I want to try and gain as much as I can from the assignment)

Step 1: Shopping cart

  • You are building a checkout system for shop which only sells apples and oranges.
  • Apples cost 60p and oranges 25p.
  • Build a checkout system which takes list of items scanned at the till and outputs the total cost.
  • For example: [ Apple, Orange, Apple ] => £2.05
  • Make reasonable assumptions about the inputs to your solution; for example, many candidates take a list of strings as input

  • Step 2: Simple offers

    The shop decides to introduce two new offers
  • buy one, get one free on Apples
  • 3 for the price of 2 on Oranges

  • Update your checkout functions accordingly

    The only request was to use Git throughout the process to show your work.

    It can probably be created as a Java program in about 15 minutes, but that wouldn't show off any abilities with frameworks, databases, REST etc.

    After a bit of thought, my approach would be

  • Create a spring boot application that generates a webpage
  • Use javascript buttons on the webpage to mimic the scan of an apple/orange (and automatically update totals inc. discounts)
  • Save the details of each sale/transaction to a Google FireBase database

  • This alone would take me a few days to figure out as I am not very experienced with this type of project.

    I would like to know what approach people would take to answering this and what would a company be specifically looking out for knowing that the applicants are Junior/Mid Level.

    5 months ago

    Daniel Demesmaecker wrote:When you try to move a package inside the same project, it will refactor.
    If you move a package from on project to an other it will copy.
    A cleaner solution is to create one main project and import all the other projects as seperate modules.
    By the way, I also think this is more a question for the Ide forum

    Thanks ! How would I go about importing all the other projects as separate modules ?

    Ill have a look in the Ide forum next time - thought this problem was java related
    6 months ago
    I have done 5 separate tutorials on Spring Aspect Orientated Programming and i want to upload them to GitHub for safekeeping.

    At the moment, all 5 tutorials are in separate Java projects in Eclipse and I want to move them to 1 project, split into 5 different source folders. When I drag and drop source folders between projects, I get all sorts of error

    Here is my hierarchy at the moment, and on the right is what I want to achieve (with a little help from MS paint) :

    The problems I am having are the system sees two packages called App, both with a main method so this flags an error. I dont have this problem with other projects with this set up. Also when i move packages around, sometimes they move cleanly, sometimes they copy and sometimes they refactor the package name.

    I have refactored the package names in the first tutorial but i havenr changed the second or third yet. How can this be done ?
    6 months ago
    On looking closer, I think the largest element is moving to the end of the array by default. (It is not the element I am trying to move)

    "With every pass, the largest element moves to the end of the array" - My java book

    But in my case, the smallest element moves to the beginning of the array. So therefor my algorithm is backwards.

    But this shouldn't make any difference in the efficiency. Am i right ?
    7 months ago

    By debugging the code, it seems like the largest element moves slowly to the end of the array, but at the same time the smallest element moves to the beginning of the array.

    Every time the larger number moves one index to the right, the smaller number it swaps with then moves to its correct location.

    The array does sort but I'm not sure if this is correct in in terms of number of passes /efficiency
    7 months ago

    Jeanne Boyarsky wrote:Kevin,
    Your .classpath file on the work computer specifies the "source directories". It looks you didn't commit this to the github repo. Which means, you are using the defaults on checkout.

    I didn't realize that this was an issue, I thought the Home PC would generate a new .classpath file when the project was checked out.

    Is the solution as simple as editing the '.gitignore' file and removing the line that states '/.classpath' ?

    Or is there a separate process using Egit to now include the ./classpath file ?

    I used to generate the gitignore and then typed in the '/.classpath' manually.

    Jeanne, is it your experience that .project and .classpath files (or any IDE-specific files) should be included in the git repository?

    I didnt include .project either. Should I ?
    8 months ago
    To follow on from a previous thread about Interviews Questions, Time limits, mistakes and pressure..

    What is the best way to approach a coding question so that you dont :
    1. Waste too much time thinking up an elegant solution that may not work
    2. Waste time implementing a complicated solution that in the end, doesn't work.
    3. Both of the above and in the end failing the exam.

    For example here was a question I took on recently :

    You have three stacks of cylinders where each cylinder may vary in height.
    You can change the height of a stack by removing and discarding its topmost cylinder any number of
    Find the maximum possible height of the stacks such that all of the
    stacks are exactly the same height.

    This means you must remove zero
    or more cylinders from the top of zero or more of the three stacks
    until they're all the same height, then print the height.

    The removals must be performed in such a way as to maximize the height.
    Note: An empty stack is still a stack.

    Rather than using the Stack Class, I think an ArrayList works just as well.

    Here is my process of solving the question (The tabbed format shows the process of creating methods within methods) :

    (Note. The height of an array is the total when all the elements are added)

    1. Change three Arrays/stacks to ArrayLists

    2. Write Method checkHeightEquality() to check ArraysLists are equal height
           - Write Method calculateHeight() to calculate the height of one ArrayList
                   - Loop through each ArrayList to calculate height of each.

    3. While the ArrayLists are not of equal height (using checkHeightEquality() method)
          - Write Method findHighestArray() to find the highest ArrayList
                 - Reuse calculateHeight() method
                 - Use IF statement to return the highest ArrayList
          - Write Method removeLastElement() to 'pop' the last element off the highest ArrayList

    4. Print out the height of the ArrayList(s)

    If you want to see the full solution in all its un-optimized glory :

    The question is not difficult. But under time pressure of an exam, it would have been a total failure.
    I see that the issue now is that I dived into the question with only a loose idea of how it was going to be solved (ie. I knew what methods I would need and what they would be called).
    The solution works but its extremely inefficient so it times out with large stacks/arrays.
    On reflection, there is plenty to optimize. For example, the calculateHeight() method should only be used once and then keep track of the result as height changes.

    Their may be an even simpler solution, using Maps or Trees or some other data structure, but my question is how do you approach this type of question to get the best answer out in the shortest time ?
    8 months ago
    With something like this, you need to TellTheDetails (that's a link).

    Im new enough to git so its hard to know how much info is required

    * Did you execute Git from Eclipse or from the command line?

    From eclipse - both on the work PC and the Home PC.

    * Post the exact statement or procedure you took to pull from Git

    When I make a change on the work PC, I open the 'Git stagaing' tab , Stage the changes I want to commit and click 'commit and push'.
    When I open the Home PC, I clicked 'Import', 'Import from URI', chose the default options, and the packages and classes appear in my Home PC workspace

    * Post the exact error message

    I solved the first set of errors by adding in the JRE System Library to the project.

    The rest of the errors were all based on package names. errors such as :
    The declared package "equal_stacks" does not match the expected package "stacks/equal_stacks"
    Hence why I posted the images above. Some packages are laid out in hierarchical order. Others follow convention 'stacks/equal_stacks' and others are named like 'stacks.equal_stacks'

    * Are you pulling into an existing repository?

    As I am importing the project to my Home PC for the first time, I dont believe I am pulling into an existing repository. (It gives me an option while importing to specify where this new repository will live)

    * If you don't have modifications in the local repository, what about removing the local git directory and trying again?  Use git clone https://URL/path/to/your/repo.git

    I will try this when I get the chance. I wonder is it possible that the issue is because of the Git Ignore file not committing the Work PC files that the Home PC requires.
    8 months ago
    I have a Workspace on my work PC where I solve java problems and these are sorted into packages and sub packages. I also push the contents to Github regularly

    I am now trying to pull the git repository to my personal PC so I can work on them at the weekend but i get a host or errors and problems.

    Here is my Work Directory :

    And here is my Laptop Directory after pulling for Github :

    I cant understand why some packages appear as 'packages' , others appear as 'package folders' (or source folders) and others don't keep the naming convention (ie Exams/interview_exams)

    All the errors I'm getting are due to 'wrong package declarations'. Some of which are solved by making a folder the 'source folder'

    I also don't want to make to many changes or when I push from my laptop, and pull to my work pc  - Ill have the same errors all over again.

    Heres the Github page :
    8 months ago
    Thanks for all the help. It feels like it has been invaluable if not eye-opening.

    Seems like I have a bit of work to do before the next interview.

    Anyway, Id really like to view someones solution using the LinkedHashMap<String, TreeSet<String>> approach

    I understand the concept but I am finding it hard to implement without multiple loops which I think is incorrect. In the end I had to settle for a similar method which is far from short and took a lot longer than 15 minutes  :

    8 months ago

    Liutauras Vilda wrote:Looking to Piet's tip (missed it before), I must say I like it too. I have solution ready.

    I really advise to follow Piet's suggestion, certainly easier approach than I had initially in my mind.

    Anyway, go small.

    First thing is to figure out how to normalize string/anagram. There is a habitual approach or using streams. As for habitual, think if you could convert string to an array of(?) and use Collections class to sort it? So later you could construct back the string from sorted array. Using streams api is slightly easier.

    I will give this ago, thanks @piet.

    On a side note, would this question be considered a difficult interview question ? As I am a junior full stack developer, I don't think a single developer in my office would have gotten the answer out correctly. Only someone (like piet) who is probably working with HashMaps and TreeMaps on a daily basis and who is lucky enough to spot the correct structure would stand any chance.

    This was one of two code questions (the other is write a method to check if two unsorted string arrays have the same elements) and two multiple choice questions about MultiThreading. The test was 90 minutes.

    Personally I felt this was difficult but maybe I am underestimating the Java developer required skill level.

    Some feedback on whether or not my solution was up to scratch or not would be very much appreciated.
    8 months ago