« first day (622 days earlier)      last day (3389 days later) » 

3:00 PM
I grew up in California and joined the army. 4 years into my enlistment, I got transferred to a base in Maryland. A friend of mine was living there and we went to movies, played Traveler and hung out. One day he saw an ad in a local paper for a square dance group that needed more men for its introductory classes.
 
Speed limits don't apply to bikes, bitcheeees
 
0
Q: Future in f# unavoidable use of mutable var

albertjanI have this type: type Future<'a> () = let mutable _value: 'a option = None member x.Resolve value = if _value.IsSome then failwith "can only resolve once" _value <- Some value member x.IsResolved with get () = _value.IsSome member x.Value with get () ...

 
Shortly after we started classes, I met this girl and we started going out. And the real irony is that we both have an intense dislike for country music. We've been married 28 years, and we haven't been square dancing since 1986.
4
 
@JeroenVannevel You mean... a regular bicycle?
@Donald.McLean So you met on a place where you both were not supposed to be, but somehow you still managed to be both there?
 
@skiwi Yep.
 
3:05 PM
So you were both round pegs in square dances.
 
@skiwi Yeah, bicycle. That's the word.
 
@JeroenVannevel How fast did you go?
 
LOL In a manner of speaking. But we are very different. I'm a geeky science/SF type and she's much more "normal". I'm west coast, she's east coast. And we're exact opposites on Myers-Briggs.
 
Dunno, I don't have any fancy stuff on my bike. Up until 2 weeks ago, I didn't even have mud-protector-thingies on my wheels
but the truck had to slow down, he was in a zone-30
sucker
 
@Donald.McLean I don't put much faith in compatibility 'tests' and so on.
 
3:10 PM
@rolfl: very cool story although I have no idea who's who in it. Though I assume you're Rolf
 
@JeroenVannevel My dad lived in a small town that had a 25 MPH speed limit. His dog could run faster than that. Made her hard to catch.
 
@JeroenVannevel Yeah, Rolf is my name, ;-)
 
Haha @JeroenVannevel, going 30 is quite fast though on a regular bike...
 
@rolfl It isn't a compatibility test, it's just a personality type thing. One part of Myers-Briggs is introversion/extroversion, for example.
 
My dad is planning to buy a bike with electric support that can reach 50 km/h
 
3:11 PM
@Donald.McLean that's pretty restrictive yeah
 
I got to digging though my photo's earlier, and found this one:
 
@rolfl Called it.
 
 
@rolfl As long as the unit tests pass, it's all fine
 
My daughter's chin is discolored, and we used a pen to draw around it.....
this was a few years ago. We thought she was having an alergic reaction to something...
 
3:12 PM
I should read what Myers-Briggs means
 
@skiwi I only raced for about 2-3 minutes and there was a slight wind from behind. But still, outraced that truck.
 
@skiwi Unless there is no test for the thing that's broken.
 
turns out she was drinking from a glass, and 'sucked on it and stuck it to her chin'.
 
The Myers–Briggs Type Indicator (MBTI) assessment is a psychometric questionnaire designed to measure psychological preferences in how people perceive the world and make decisions. These preferences were extrapolated by Katharine Cook Briggs and Isabel Briggs Myers from the typological theories proposed by Carl Gustav Jung, and first published in his 1921 book Psychological Types (English edition, 1923). Jung theorized that there are four principal psychological functions by which we experience the world: sensation, intuition, feeling, and thinking. One of these four functions is dominant most...
 
I'm an INTJ if I remember correctly. Had to take several personality tests for a class last year
 
3:13 PM
couple of hours later she was bruised.
 
Some of you may remember me complaining about it as I sometimes tend to do
 
@rolfl You still managed to get a red-haired girl after all?! (That wasn't exactly clear from your story)
 
Yes, of course ;-)
Freckles too.
 
@JeroenVannevel INTJ is the classic software developer profile. I am one as well. My wife is an ESFP - exact opposit.
 
Somehow red-haired girls in general look more attractive than any other
 
3:14 PM
I'm okay with that. Means I'll go work for NASA as well. Without a doubt
 
Is that Myers-Briggs test something you can reliably do yourself? I've never read about that until long now
 
I'll take a look which site my teachers told me to use
Also had to take Enneagram/Ofman and a competence indicator tests
So. Many. Tests.
 
I took a look a the Myer-Briggs test, but it seems that I don't fit anywhere...
 
0
Q: AngularJS communication between Controllers

Christiaan ScheermeijerI'm creating a webapp with AngularJS and use controllers to separate parts in the site. But I don't seem to find a satisfying way of data communication between 2 controllers. Why would I like to do this? <body ng-app="testApplication"> <header ng-controller="HeaderController as header"> <h3>...

 
3:18 PM
@JeroenVannevel Yay, a Dutch site
 
Nationalism is on the rise in the chatroom
 
I've never been tested you know of any personality things, but I'm sure they would find stuff if I ever were to be tested
 
Honestly, not a single test I had to take was any surprise
You can also take the Enneagram test if you want even more insight in your soul and stuff
 
I took some tests during special classes at engineering school. There were some clear things but it was generally mixed/average/unclear where I could fit. That's fun ^^
 
For Enneagram I'm type 7, the enthusiast.
@Morwenn Like that movie! You know?
 
3:21 PM
@JeroenVannevel I don't x)
 
I seem to be giving contradictionary answers... wonder what the results are
 
@JeroenVannevel For this test, I'm ???, the foreigner who doesn't understand a word.
 
The one where the fighting faction starts killing the farmer faction
It's derived from a book
Pretty recent as well..
@Morwenn It has an English version as well: eclecticenergies.com/enneagram/test.php
 
That faction thing reminds me of something, yeah. I must have heard of it.
Divergent?
 
@JeroenVannevel That test is a bit heavily focused on work
 
3:23 PM
@Morwenn That's the one
 
I didn't see it.
 
You might be one of those special ones that unite all factions
I'd wait until the second movie comes out before you watch it
it has the most horrible cliffhanger ending ever
 
> U komt in de richting van het type: ISTJ
No INTJ like everyone else according to that site
 
0
Q: Optimize multiple ifs

ThomasI have a list of tasks I get from my database (as strings) and then execute. However I'm uncertain on how to implement this correctly. Currently I have implemented this in the following way: Dim monitorTasks = TaskDefinitionDAO.GetActiveTaskDefinitionsByCategory(TaskDefinitionCategoryEn...

 
mutant!
 
3:25 PM
Seriously, I want to answer "partly" to anything, where "partly" means "it depends on the day".
 
Warning: This will be hugely filled with Partly
lol @Morwenn, you're having the same
 
@JeroenVannevel I thought you meant Motorcycle, I have revoked your star!
 
@Malachi Revoking stars is a crime
 
YOU CAN'T HURT ME LIKE THAT
flag
 
Theorically revoking theorical starts.
TRTS
 
3:32 PM
> I'm a big procrastinator.
YES!
 
LOL
 
Today was supposed to be international procrastination day. But they eventually decided that it would be tomorrow.
 
@Morwenn "But by no decision, it will now be decided upon tomorrow."
 
Apparently, the company owner will be part of my 1 yr review meeting. We're a small company but this is still abnormal.
 
> I have a compulsion to do things the right way, even if it's not cost effective.
This puts me on a fence regarding writing software
 
3:35 PM
@nhgrif congratulations!
 
Doing it ugly is usually up front more cost effective, but in the long run probably not
@nhgrif Owner as in your boss or the real owner, or are they just the same person?
 
Real owner. I've met him about 4 or 5 times.
 
What's this...
>

You are most likely a type 9.

Taking wings into account, you seem to be a 9w1.
 
@nhgrif this is either very very good, or very very bad ;)
 
For Enneagram, I'm a type 5w6.
> Fives, especially with the Four wing, sometimes mistype themselves as Fours.
Reading the description for Four, I have to admit that I would have said that I have many roots anchored in four.
 
3:51 PM
Classic four winged five.
 
0
Q: How should I name a function which show or hide an element?

long-lazuliI got a function to display or hide some elements. What I want to do is manage the display of those elements regarding a value. Here is a sample : function togglePassengers() { var nbPassengers = $("#nbPassengersForTravel").val(), $passengers = $('#d_passenger').find('fieldset'); ...

 
INFP apparently
 
1w6 it seems.
 
Hello, world!
 
Hola @Phrancis
 
3:53 PM
Anyway, be it 4, 5 or 6, that makes be depressive and insecure :D
 
4:04 PM
X Vs. Y ??? --> codereview.stackexchange.com/q/77722/18427 is that off-topic?
 
0
Q: Rules on Migration to Code Review

Chrismas007The following Stack Overflow question, Modifying excel code to speed up the process was just migrated over to Code Review. When it was first posted 23ish hours before it was migrated, I read it over and thought it would be a good candidate for migration. The user is basically asking for a way t...

 
Grima is a bot right?
 
@rolfl That's what my youngest daughter is.
 
@Phrancis Correct, technically it is a feed.
It' pushes codereview-se tagged questions here.
 
Feeds, bots, whatever lol.
 
4:15 PM
 
4:25 PM
@Malachi that's when I spend a downvote
So.... which "option" is your actual code to be reviewed? — Mat's Mug 6 secs ago
 
@Mat'sMug upvoted that comment
 
If I'm not mistaken A vs B review are ok ? He don't need to choose over one version (It's been a long time since I've seen a discussion about this)
 
@Marc-Andre exactly what I am saying... have tagged with comparative-review
@Mat'sMug the answer to this question is both and neither
 
Personnaly I don't like such question, but the community consensus is that is on-topic, the question as-is looks on-topic.
 
still it kinda misses context, so I can understand a downvote
 
4:36 PM
Have you Tested both options? do they both fit into your application nicely? — Malachi 9 secs ago
> // Say hello world until the user starts questioning
// the meaningfulness of their existence.
 
Mind joining us in the 2nd Monitor where we are discussing your question? — rolfl ♦ 7 secs ago
2
My particular concern is that it is more about the design, than the implementation.
Not that the design is off topic, but really the code is just an 'expression' of the design decision that is the real focus of the question.
It's not a case of: which code is better?
it's a case of: Which design is better?
My initial assessment is that both code blocks implement their respective designs quite well.
 
@Marc-Andre A vs B are arguably on-topic (despite C being the usual answer), it's just a type of question (that and one-liners) that I systematically downvote. I think they're poor CR questions.
 
I don't like them, but the consensus seems to be they are on topic... I would be more concerned about what @rolfl is talking about though. (haven't looked at the question yet)
 
A vs. B Q's are not my favourites either.
But, now that I think about it, the question in question is 2 questions.
 
@Mat'sMug Sure you can downvote all you want I have no problem with that! But since A vs B question are on-topic atm, the OP does not need to choose a version of actual code to be reviewed, since both can be reviewed (as far as I understand A vs B, but seriously I don't even read those type of question at all).
 
4:48 PM
One is: I have this design, and this implementation. Is the implementation good?
The other question is: I have this other design, and this other implementation, is the implementation good?
 
There's that, but it is awful close to that "review my design" line isn't it?
Which, by my own words, are okay if they have an implementation they're interested in.
 
Ethel Lang was believed to be the last person living in the UK who was born in the reign of Queen Victoria.

Mrs Lang was born in the Worsbrough area of Barnsley on 27 May 1900 and lived in the South Yorkshire mining town all her life.

In 2005, she moved into the Water Royd House nursing home in Barnsley, where she died on Thursday. Mrs Lang is survived by a 91-year-old daughter.
 
Bah... I'm out on this one. Y'all can work it out without ol' ducky here.
 
Have a daughter at age 23. That daughter has her own at age 23. and again at 23. and again at 23. 114, 91, 68, 45, 22, 0 .... great-great-great-grandmother.
 
I hope 200_success handles my latest flag.
 
4:55 PM
to me A vs. B questions are sitting on the hypothetical code fence - OP's actual code presumably does not have both implementations, so one of the two is a waste of time. I hold off on close-voting because of community consensus, but I can't hold back the downvote.
 
@Mat'sMug But both work, and either could go in.
It is a kind of cross between CR and Programmers, if I understand Programmers scope correctly.
Those are the questions I have most - A works, and B works.
 
Nobody understand Programmers scope correctly :P
8
 
^^ that
 
If I ask about A, I get a total revision.
If I ask about B, I get a different total revision.
Which is more correct?
 
2 mins ago, by Mat's Mug
to me A vs. B questions are sitting on the hypothetical code fence - OP's actual code presumably does not have both implementations, so one of the two is a waste of time. I hold off on close-voting because of community consensus, but I can't hold back the downvote.
But we also have the FizzBuzz paradox
 
4:57 PM
?
 
@rolfl that is what I was thinking but didn't want to outright say it in a comment just yet....
 
Yes, it is.
But then, how do I tie the two different versions that people posted together?
Which should I go with?
 
FizzBuzz paradox - Someone posts code with i % 15 == 0 then print "FizzBuzz", and the answers say: You should separate those to the two components %5 and %3 so you can make those variables. Someone else posts code with i % 5 .... i % 3 ..... and get the answer "You should find the lowest common multiple for performance reasons.....
 
that's the thing: if you haven't gone with any yet, then you haven't actually implemented your code yet, and it's not ready for review yet.
 
If someone were to post a fizzbuzz A vs. B question, what would be do?
 
4:59 PM
@Mat'sMug So what is implementing then?
It isn't writing it?
 
@rolfl Mercilessly downvote it for stating a holy war and close it as primarily opinion based.
 
of course it is. I'm saying that if you're posting A vs. B, [hopefully] either A or B is actually in your current code base, and the other is hypothetical.
@RubberDuck lol
*starting
 
I often write and test a couple versions before I ask a question.
 
@Mat'sMug I'm not joking. I feel like A vs. B question are primarily opinion based in general. The Fizzbuzz paradox is just a great illustration of it.
 
5:02 PM
With fire.
 
But then, if we make it into two questions...
It is still comparative review split up.
 
I've gotta go eat something. Someone want to book mark this conversation at some point?
bbiab
 
I am closing this question as "too broad". In my assessment this is a question about which design pattern or strategy is more appropriate to your circumstances. It is not a question about whether the code effectively implements the strategy you have chosen. Code Review is for evaluating your code, not your design. Having said this, the issue has a grey area, and is up for discussion. If you disagree with my assessment, please feel free to open a meta post, and we can discuss it further. — rolfl ♦ 40 secs ago
 
@Hosch250 I have written a VBA parser, it works. I put it up for review, got great advice and all. Then I changed my mind, I added a reference to ANTLR and now my parser is turning into a tree walker, walking a tree that ANTLR produced. A completely different approach, that I'm going to put up for review when it works the way I want it to. What's wrong with two questions? What's wrong with two questions?
 
Absolutely nothing.
 
5:04 PM
hang on, there's a joke in this......
There we go, fixed that for you.
 
The point is, the one is obviously better than the other.
 
Not obviously.... the ANTLR one requires third-party dependencies, etc.
 
OK.
 
but my point is, I didn't post on CR an "A" with my homebrewn parser, and a "B" with something that looks like it might be a working ANTLR tree walker, and asked which is better... I did one, got it reviewed, then I do the other one, get it reviewed. That's how CR should work IMO.
 
0
Q: Palindrome Index Optimsation

user2405469You are given a string of lowercase letters. Your task is to figure out the index of the character on whose removal will make the string a palindrome. There will always be a valid solution. here is my quick solution: public class Main { private static final String AAA = "aaa"; public...

 
5:08 PM
@Mat'sMug Ditto
 
if I wanted to know whether it's best to use ANTLR over rolling my own parser+lexer, I'd ask on Programmers. And pray it's on-topic there.
 
5:21 PM
The praying part is very important.
 
Indeed @Phrancis.
 
Hey I noticed a directory with a ton of files: C:\Users\fveilleux-gaboury\AppData\Local\Microsoft\Windows\Temporary Internet Files
Should I be OK deleting the files in there?
Ah, that's where cookies are stored, it looks like. Maybe I shouldn't touch those.
 
that and all the files IE doesn't bother downloading because you already have them locally
 
Remove it all you like Mug. I saw that. =;)-
 
@Mat'sMug Ok guess I might just leave it alone
 
5:31 PM
yeah.. you don't want a slower IE do you?
 
0
Q: Powershell script to create folders on remote servers

user3029809This is pretty much the first Powershell script I've ever done and I am here looking for a quick review of it. Is there something I could have done better? Is the format okay? I don't know much about expected standards, and this was cobbled together as a result of me wanting to learn. $Compa...

0
Q: Is there a way I can rewrite my reverse_list_recursively without having a funky NULL variable?

CodeCrackThis is how my Linked List class looks like in PHP. I am trying to figure out if I can rewrite my public function reverse_list_recursively($current = NULL) function more elegantly without having the funky $current = NULL.. The reason I have it is because I need to pass $current in my recursion ca...

 
Jamal is active again.
 
:)
Must take a lot of caffeine.
 
Hi all :)
 
5:46 PM
0
Q: Are regex reviews on topic?

Ismael MiguelI know that regular expressions (regex) aren't a language on it's own. But sometimes, there are things that use regex, and we may want to improve it. One example of a regex: /src=([^"'>]+|(['"]?)(?:[^\2]|\2+)+?\2)/gi This ugly smelly beast matches src attributes, as close as I can to a XML/H...

 
Hi.
 
@StackExchange hasn't this been discussed before? ...nevermind, dupe.
hi @DJanssens
 
@StackExchange "This ugly smelly beast matches src attributes, as close as I can to a XML/HTML parser."
 
the center cannot hold
 
Beat me to it.
 
5:48 PM
Outflanked!
Each man for his own!
 
0
Q: Vertical Histogram

kfcobrienI've been been working on a vertical histogram that prints an asterisk in place of a number in a certain range (say 1-10... and so on). My code is working as required. Is there a better, simpler or more efficient way of doing it? If so, would you mind explaining or showing me better code if you ...

 
I should stop looking at the SE blog when they're talking about the work environnement. It make me feel bad about my actual job !
 
> Congratulations, you managed to get a PS script to run, that's already something!
 
> It's pretty simple.
1. Setup the Google Code Prettify.
2. Load a downloaded CSS file instead of prettify.css.
3. Beautiful.
Doesn't work.
 
lol
1. Setup the Google Code Prettify.
2. Load a downloaded CSS file instead of prettify.css.
3. Still ugly.
 
6:00 PM
I think this issue may be on topic for Webmasters.SE? I'll try fixing it a bit longer, but this is just silly
 
@Marc-Andre You & me both, and I work from home.
 
Uh-oh. I need some non-Mac volunteers to test something out real quick, anyone?
 
Maybe.
What?
 
@RubberDuck I got one day per week to work from home, and it's the best day of the week!
 
@Hosch250 Just download a small repo and open an HTML file
 
6:05 PM
OK...
What?
 
Downloaded the zip.
 
@Marc-Andre I wouldn't mind going into the office 2 or 3 days a week personally, but my office is over 6 hours away by car. You end up missing a lot by never being there.
 
Then open: cardshifter.github.io-develop\prettify-test\prettify-test.html
And please copy any of the code blocks with the numbers and paste here (and tell me what browser you're using)
 
@RubberDuck Sure ! I would not be able to always work from home, but I must say I have a better concentration and motivation at home (and free coffee too)
 
6:08 PM
@Marc-Andre You don't have free coffee at the office? What kind of hell hole do you work in?
 
@RubberDuck I'm in an IT departement inside a "big" insurance company.
 
@Marc-Andre Sounds like me (except not in IT)
 
Nonsense. Coffee is the lifeblood that fuels the corporate world. Mutiny I say!
No more work without free coffee.
 
j/k.... kind of....
Where are you from @Marc-Andre? France??
 
6:11 PM
@RubberDuck Quebec, Canada
 
(just guessing from your name)
Ahhhh that also makes sense.
 
Firefox 35
Nice, by the way.
 
Top, IceDragon (flavor of FF).
Bottom, IE.
 
0
Q: converts text to colored pixels and back again

sdin3dspaceAny suggestions for improvement or critiques are welcome!! <canvas id="myCanvas" width="400" height="200" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML5 canvas tag.</canvas> <input type="button" onclick="alert(ColorToText())" value="Click Here"/> <script>...

 
IE with ActiveX
 
6:13 PM
@Hosch250 I need the actual text copy & pasted, not a screenshot
 
Oh, why?
 
To see if the line numbers carry into the clipboard in your browser
 
// this is a comment
/*
** Block quote
*/
public static class Evaluate
{
public static string FizzBuzz(int start, int end)
{
return Enumerable.Range(start, (end - start) + 1)
.Select(FizzOrBuzz)
.Aggregate(String.Empty, (y, x) => String.Format("{0} {1}", y, x))
.Trim();
}

public static string FizzOrBuzz(int n)
{
if (n % 15 == 0) return "fizzbuzz";
if (n % 3 == 0) return "fizz";
if (n % 5 == 0) return "buzz";
return n.ToString();
}
}
They didn't.
// this is a comment
2./*
3.** Block quote
4.*/
5.public static class Evaluate
6.{
7. public static string FizzBuzz(int start, int end)
8. {
9. return Enumerable.Range(start, (end - start) + 1)
10. .Select(FizzOrBuzz)
11. .Aggregate(String.Empty, (y, x) => String.Format("{0} {1}", y, x))
12. .Trim();
13. }
14.
15. public static string FizzOrBuzz(int n)
16. {
17. if (n % 15 == 0) return "fizzbuzz";
18. if (n % 3 == 0) return "fizz";
 
It didn't with Chrome on my Mac, but IE11 on this PC...
// this is a comment
2./*
3.** Block quote
4.*/
5.public static class Evaluate
6.{
7.    public static string FizzBuzz(int start, int end)
8.    {
9.        return Enumerable.Range(start, (end - start) + 1)
10.            .Select(FizzOrBuzz)
11.            .Aggregate(String.Empty, (y, x) => String.Format("{0} {1}", y, x))
12.            .Trim();
13.    }
14.
15.    public static string FizzOrBuzz(int n)
16.    {
17.        if (n % 15 == 0) return "fizzbuzz";
18.        if (n % 3 == 0) return "fizz";
 
In IE, they did.
 
6:15 PM
C#/LINQ

    // this is a comment
    /*
    ** Block quote
    */
    public static class Evaluate
    {
    public static string FizzBuzz(int start, int end)
    {
    return Enumerable.Range(start, (end - start) + 1)
    .Select(FizzOrBuzz)
    .Aggregate(String.Empty, (y, x) => String.Format("{0} {1}", y, x))
    .Trim();
    }

    public static string FizzOrBuzz(int n)
    {
    if (n % 15 == 0) return "fizzbuzz";
    if (n % 3 == 0) return "fizz";
    if (n % 5 == 0) return "buzz";
    return n.ToString();
Copied OK, but no indent.....
 
so fizzy in here
 
@rolfl What browser is that?
 
Firefox, if I copy the titles above and below......
 
What if you copy just the code block?
 
 public static string FizzBuzz(int start, int end)
{
return Enumerable.Range(start, (end - start) + 1)
.Select(FizzOrBuzz)
.Aggregate(String.Empty, (y, x) => String.Format("{0} {1}", y, x))
.Trim();
}
 
6:17 PM
Hm. Odd. Probably something to do with having a different setup than SE
 
Isn't that FizzBuzz code from a CR question?
Because I remember seeing something similar recently and that Aggregate is way more than is needed
 
@JeroenVannevel Yeah it is
I just grabbed a few short code snippets from various languages to test prettify
 
Ah okay, all good
I'm a little dissapointed that they used all different icons for everything except "Flexible hours"
I'll shoot them a mail later in the year for an internship
you never know
 
6:32 PM
> 20 days vacation
I have to work 10 years at my company for that much time off.
 
Refactoring gone wrong... Only 23 out of 31 tests have failed
 
just need to break 8 more :)
 
@skiwi No I has not yet gone wrong! Everything is working as expected since your tests warns you that you've break something! :D
 
@skiwi That's it? I was expecting all 31 to fail when you were done.
 
@RubberDuck Nope, that's it
The best part is that my very first test even fails, so the problem is in the core and probably cascaded all the way through
A NullPointerException may be causing trouble
 
6:37 PM
Are you sure the tests test actual breaking changes?
Maybe they're just side shizzle
 
public ListLogReader(final List<String> inputList, final EntryParsers entryParsers) {
    super(entryParsers);
    Objects.requireNonNull(inputList, "inputList");
    this.iterator = new ArrayList<>(inputList).iterator();
}
The tests are claiming that this.iterator is null
I don't believe that
Or I've broken Java.
 
 
@rolfl It's on my radar of issue to fix
 
K Good.
Get to it.
High priority
chop chop
 
@rolfl is obviously the manager here
 
6:40 PM
Ahaha I wish I could fix this at the moment but got to work !
 
Can I call a overridden method in the constructor?
 
you can, but you won't
that's asking for messed up shit
 
Not generally.... it has effects.
 
I WON'T LET YOU
5
 
That seems to be returning null
 
6:41 PM
like null variables..... in the constructor.
If the super() call is invoking methods that in turn require this.iterator, then there will be a NPE
 
> CA2214: Do not call overridable methods in constructors
Listen to Microsoft
 
This is Java, but.... Listen to Microsoft.
6
@skiwi - you seeing this? ^^^^
 
Yeah..
So maybe I'm doing it wrong?
protected abstract Iterator<String> readIterator();
 
This is not a constructive comment. — Franck 13 mins ago
 
That should be a constructor argument?
 
6:44 PM
5 mins ago, by skiwi
public ListLogReader(final List<String> inputList, final EntryParsers entryParsers) {
    super(entryParsers);
    Objects.requireNonNull(inputList, "inputList");
    this.iterator = new ArrayList<>(inputList).iterator();
}
^^^ that has ... issues.
 
Why do you store the iterator instead of the arraylist?
 
Should I flag ^^ as nonconstructive?
 
@JeroenVannevel Because the array list is just an example here
 
@Hosch250 UI stuff shouldn't be in the code, that's for sure
I don't know if it relates to the problem
 
I know :(
 
6:46 PM
but I'd leave it up for a bit so the OP sees it and then perhaps
 
But the comment - there is a close reason for nonconstructive comments...
 
My current idea is that I have an AbstractLogReader class that knows about an iterator, and the concrete subclasses (FileLogReader, ListLogReader, etc.) provide the iterator
 
I don't really care that much about these low-view questions that will fade into the darkness anyway
 
And the comment specifically states it is not constructive.
 
0
Q: Scope and return values in Ruby

Mike RileyI know I have seen this before and I can't remember how to fix it or find where I saw how to fix it. Here is some psuedo code: def matched_items matched = [] items.each do |item| matched << item_matcher(item) end matched end This is just an example of code I have seen that I am tr...

 
6:47 PM
Leaving to take a quiz.
 
Good luck
 
Do you think my approach makes sense?
 
Nope
 
Give github
It sounds overengineered to the top
But I might not be getting the full picture
 
@skiwi At what point does getting a 1-time-use iterator make sense in a constructor?
 
6:49 PM
@rolfl Because I use the iterator in other methods
 
So, you save it away in a field, but you can use it only once....
It's a 1-time use, you cannot use it in more than one place... you cannot 'reverse' it or reset it.
 
The 1-time use is okay
This is how it is currently done: gist.github.com/skiwi2/d6e68f8dee55c2288244
(The one that is failing)
 
And there's your problem:
 protected AbstractLogReader(final EntryParsers entryParsers) {
this.entryParsers = Objects.requireNonNull(entryParsers.get(), "entryParsers.get()");
this.readIterator = Objects.requireNonNull(readIterator(), "readIterator()");
}
this.readIterator = Objects.requireNonNull(readIterator(), "readIterator()") <--- this
 
Yes, that I know now
 
readIterator() is being called.....
 
6:52 PM
But I'm asking how to solve that
I see that one way would be to pass it via the constructor
 
If you expect to have an iterator in the anstract constructor, then pass it in as a constructor argument, and don't have an abstract readIterator method
Otherwise, just ignore the validation in the constructor, and wait for the NPE on use.
pre-checking every possible NPE is not a good strategy.
 
So in here it would make more sense to not do the check?
Or nevermind, that still gives boom then
 
What does the check actually prevent, or change?
it changes the error message, and the trace
 
Then it will throw the NPE on initialization rather than on usage
 
It does not prevent the error
 
6:58 PM
That's a pretty good point. Is there any reason why Objects.requireNonNull() should even be used in the first place?
 
I always certainly use that if a variable is saved at one place and used in another place as rule of thumb
 
That particular instance I would make the readIterator a concrete method, and take the iterator in to the constructor.
Since the constructor does the test, it needs it regardless.
 
Think about it like adding a null accidentally to a list, and later you operate on that list, then things go boom
 
there's no reason to have the abstract method.
 

« first day (622 days earlier)      last day (3389 days later) »