Rob Bank

+ Follow
since Jan 11, 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
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Rob Bank

Let me rephraze the clumsily written second last sentence.
So, as I see it, I can either try to implement some .replaceAll when I'm modifying the total HTML string I have read, to exclude the teamNames (which if can be done, I have no clue how to), or utilize the DURATION_PATTERN for which space / comma is indifferent, apart from that the pattern would have to look slightly different.
4 days ago
Ahaa, I assumed you had a typo in previous post with the plus not being preceeded by a space. It is not a plus sign, the plus is just the regex one or more;

At URL read and corresponding txt file write, .replaceAll(" +", ",") gives ...,New,York,...

HTTP POST and AJAX what? In a rush so in layman terms, I read a web-page and get the text that includes all HTML-tags. I filter out the text I want as CSV using a set of .replaceAll(). Sorry for the confusion, I did not put much effort to the phrasing as by "reading a web adress" I assumed it was clear that I'm reading the contents "under it". I still don't have access to my code so I can't comment on the technical way in which the data is read.

Why so? My earlier comment was based on the assumption that you were talking about the + sign in regex terms. I.e. that you were querying on my choise of separating each object (not sure I'm using the right word here, but with each object I mean each firstName, each lastName, each duration and so on..) with comma instead of space. Sure, it sounds more straightforward to extract teamNames by implementing other separation of their words than the other data's comma if I were to use it, but I'm looking to dump it alltogether. So, as I see it, I can either try to implement some .replaceAll at initial file generation to exclude the teamNames being read (which if can be done, I have no clue how to), or utilize the DURATION_PATTERN for which space / comma is indifferent, apart from that the pattern would have to look slightly different.

Thanks, I get your point in principle on redundancy.
4 days ago
Thanks a million guys. Been offline a while and will be looking closer at this starting tomorrow. Studying it & relating theory should take a few days.

Meanwhile just a quick response on the questions.
matcherPoint.reset(line) sets the matching region of line to start,end (matcherPoint is initiated to "" i.e. matcher.region(0,0))

Yes, ONE thing / property. The choise of commas; can't recall any particular reason for it at start of project, other than that's the data separation formatting on file orders and generations at work and that it would be the best format considering a possible future database setup. I’m basically reading the source code of a URL. As far as I understand from a googling, that is the HTML request body, no? Don’t have access to my code currently so can’t say how it’s done technically.

The initial thought of calculating point went way over my head so I settled for listing them – great. Calculating place also fixes an issue I’ve been having with incorrect place after removing some performances due to certain criteria – great. Since you didn’t know about that, I’m curious as to why you prefer calculating place and difference instead of reading them. I guess I will find that out while looking closer at your code though.

Robert and Mick sharing place but having different point was an example of what I was trying to fix with my arrow anti-pattern loop. And while it fixed just that, the issues I had were;

... (i) not if there are more than two participants sharing a place and (ii) not if there is additionally, say, in course B, a shared place.

4 days ago
Thanks for the pointers! I learned a great deal.
  • Ok
  • Ok (nice to learn that try blocks take care of the closing by default!)
  • mPoint is short for matcherPoint. I see a lot of Pattern p = … and Matcher m = …  so this seemed like a suitable naming - switching.
  • Ok
  • I’ll think about what would be logical to split into classes/methods and with that as base maybe try some GuardClause conversions of remaining superfluous nesting.
  • Ok. If I understand correctly, e.g. lines 25-33 should be put outside the if-bracket. I guess this is readability related / common praxis more than computationally significant?

  • Since why something happened seems like a question longing for a technical answer, I’m not sure what info you are after. But cities is neither really really cities - it can be a club or a city or whatever the results uploader decides to put there. I have seen up to three words used on occasion; however mostly it is null. Let’s call it a property of the participant that in theory can be anything between zero and n strings. Heck, come to think of it, there might even be integers there There will not be a + sign though. Yes?

    Course & letter is the official naming, where the letter stands for level of challenge in alphabetically ascending order. If you’re feeling invincible, run the toughest Course A.

    Point calculation:
    A: 100, 95 and 90 for top-3, then -2points per place, down to a minimum of 1point/participant
    B = 0.88*A rounded to even numbers, down to a minimum of 1point/participant
    C= 0.77*A rounded to even numbers, down to a minimum of 1point/participant

    Why are two… Oops, because of my manual summary mistake. This is what it would look like on file;
    A,2.,A2,Mick,Mickelsson,New,York, 1.41.22,+10.00,92
    1 week ago
    This got really ugly, long, and buggy - I believe I'm just scratching the surcafe of what the Participant object could provide in terms of flexibility.

    So I've previously written points to new lines based on course, producing the unwanted feature of different points in case shared place;

    Now I look to iterate through the list to find these Mick Mickelsson's and raise their points. To simplify, I added a coursePlace Participant object. The below stuff copes well with the above three-lined file, but (i) not if there are more than two participants sharing a place and (ii) not if there is additionally, say, in course B, a shared place.

    Any thoughts on how to do this bugfree and more elegantly, or just bugfree?

    1 week ago
    Hmm, yeah that's not going to work for id's >9 but that should be easy to fix.
    2 weeks ago
    Sorry & Thanks Carey,

    Doublechecked the COURSE_PATTERN, you're right.

    Switching to e.g. (.)(,[0-9].,) once I get home. I'll test the code on a file not having any null fields also.
    2 weeks ago
    At URL read and corresponding txt file write, .replaceAll(" +", ",") gives ...,New,York,...

    My understanding was that Duration difference = scanDuration(scanner, () -> new ParseException("Missing difference.", 0)); adds a zero in case this.difference = null? Any case, if that's the case, I guess I should remove || difference == null , or an easy alternative would be to hardcode difference 0:00:00 at file generation to each course winner.

    According to regex101, the first capturing group ([0-9]) matches A, B or C. Also, see my update before your post.

    Also, I noticed I was missing this. on line 20 but the issue remains.
    2 weeks ago
    And the COURSE_PATTERN should be ([0-9])(.,[A-Z]).
    2 weeks ago
    And for the sake of not being misleading a second time, +1.31.20 should be +1.01.08
    2 weeks ago
    By the way, in case you're wondering, I put your method for formatting a Duration in the main.
    2 weeks ago
    Thank you!

    My understanding was that the %s: needed to match the string it represents, now I know you can manipulate strings with it.

    I do most of the stuff in my project under this if-statement
    By the poorly worded "nothing after it compiles" I mean that this
    piece of code breaks the if, which I guess should happen since it is not yet correctly implemented.

    In my first post, as I was looking for a simple regex, I thought that my data structure visualization was sufficient. So let me provide the non-misleading structure;

    I added the first value course to the Participant object. It takes values A, B or C. I also added point (I award 0 - 100 points per participant, a sort of "goodness-of-performance" measure).
    This may be me misunderstanding the intention, but I removed both the if (this.cities.contains(null))... and || cities == null arguments since not every participant have a city. I've read up on getter but I'm not sure how to apply it in this context, here's my best shot;
    And in the main, since I understand the pre-Java-8-style better;

    Besides the getter implementation, I am thinking that the parsing is underperforming, maybe I'm misusing or incorrectly referencing line / lineOfCsv?
    2 weeks ago
    Hope you don't mind two fast ones;
  • Why the colon in %s:? This would imply lastName's are followed by a colon, no?
  • Row 5-6: in my head, the ending parentheses shouldn't be there. E.g. id is a variable, not a method, no? "The method id() is undefined for the type Participant". Removing them and making the variables public in Participant does make the code compilable, however incompletely, nothing after it compiles. Hmm...
  • 2 weeks ago
    Thanks Stephan,

    Haven't gotten into typing mode yet but seems like the weeekend is saved
    2 weeks ago