« first day (458 days earlier)      last day (3551 days later) » 

12:19 AM
I like this style of review. It gives you a chance to see the code changing "in real time".
3
A: Find all collection properties of an object and get their values

mjolkaFirst up, let's clean up the formatting a bit. public class DependencyValidator<TEntity> : IDependencyValidator<TEntity> where TEntity : class { private readonly Type IEnumerableType = typeof(IEnumerable); private readonly Type StringType = typeof(String); public IEnumerable<...

I think a big part of the "Did I write or maintain this code" is that it discourages people from posting questions that are really asking us to explain some code to them. — ckuhn203 25 secs ago
 
Why is that a problem actually? Assuming the question is still on topic otherwise.
 
12:35 AM
We don't explain how code works. That's part of SO's scope.
 
I'm not saying we should.
I mean, people post questions asking us to do stuff... and as long as the answers are just reviewing the given code, what's wrong with that?
I'm not going to post an answer explaining working code in a question.
I'll post an answer with improved code and explain why the improved code is better.
A question asking for an explanation of the code is off-topic, sure.
But that'd be off-topic regardless of who wrote the code.
I've written code that works before and not understand why it works.
 
@Malachi well that's an interesting thumbnail to come back to in chat
2
grr even messed up my icon in here :(
I suppose that's what I get for finally messing with gravitar
 
Hm. I must've caused Gareth Rees to delete one of his older C++ answers.
 
1
A: Can we revisit "Did I write that code myself"?

svickI think the primary purpose of CR is to improve the quality of your code. And not just the code you post, but also your future code. And the way to do that is to post your code, so that we can point out the mistakes you're making.

So CodeReview questions are intended to be beneficial only to the person asking the question? If so, that may explain why CodeReview is still in beta... — nhgrif 6 mins ago
 
I don't think that's the reason why we're still in beta...
 
12:49 AM
Maybe not. But I think we might have more traffic, more regulars, and more upvotes if we could figure out ways to make questions and the answers to those questions useful beyond just the asker.
For example, what's wrong with the question I linked in my meta question if instead of linking to an SO post by another user, the asker claimed he wrote the code himself (or just omitted the SO link and letting us think he wrote it)?
The only problem with the question is that he didn't write it. Otherwise, it's actually a somewhat decent CR question.
But given that the code is posted on SO, it's not illegal, from a licensing standpoint, for him to post it.
The problem I see, and it's not even this specific rule, but the rules as a complete set, make it so that on-topic questions are also of minimal value to future readers.
@rolfl's answer is considerably the best so far. But it's still kind of weak.
> If I am investing my time in the review, I want to be able to ask for more details on why choices were made, and other constraints imposed, and I want the answers from the most reliable source. My time is not worth it, otherwise.
The current rule doesn't do a ton to solve this either.
 
1:04 AM
0
Q: Javascript/Jquery Using Regex to add <span> to vowels

vjnrUsing the following code, how would I use regex replace to add a span around each vowels in the content? Am I on the right track? <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-1.8.0.min.js"></script> </head> <body> <p id="demo"></p> <script> (function() { funct...

 
 
1 hour later…
2:32 AM
The last paragraph of rofl's answer is what hit home.
 
3:06 AM
"You've earned the "c++" tag badge."
"You've earned the "performance" tag badge."
5
 
Very nice, @Jamal. Congrats!
 
Thanks!
 
Kudos @Jamal !
 
:-)
 
3:24 AM
Oh hey! Grats @Jamal
 
:-)
 
Top class badge, your best so far.
 
lmao @ckuhn203
 
Next up: Constable
 
@Jamal congrats
 
3:33 AM
I wonder what question has the most views on the site.
 
I thought you'd like that buddy.
 
@Yuushi Thanks! I'll let you and the others catch up now. :-)
 
0
Q: How to identify if it has a contrct so should do CC?

NoitidartI recall this: The stream wrappers, or XPCOM in general really, usually have a contract that you should call .init() only once let ZipFileReader = CC("@mozilla.org/libjar/zip-reader;1", "nsIZipReader", "open"); let ScriptableInputStream = CC("@mozilla.org/scriptableinputstream;1", "nsIScript...

0
Q: Idiomatic Scala Generics

smkI'm working on some Scala problems given here . Specifically, sealed abstract class Tree[+T] case class Node[+T](value: T, left: Tree[T], right: Tree[T]) extends Tree[T] { override def toString = "T(" + value.toString + " " + left.toString + " " + right.toString + ")" } case object End extend...

0
Q: Isometric Projection and Culling

Danie ClawsonLink to live Codepen. Hello! I'm working on a small isometric drawing system, in Javascript. After much help from the Gamedev section, reading old questions, I've got something working. However...It's still a little hacky. I need to fix the culling to be more straight-forward and it still isn't ...

 
26
Q: Getting/setting default values from my App.config.

Sergio TapiaImagine that I need a color palette form my Winforms application to have a consistent look. What I did was create a static helper class, and helper methods that I can call from anywhere in my code and invoke what I need from the App.settings file. Here for example, I getting the school name fro...

 
@rolfl How did you figure that out?
 
3:42 AM
@Jamal Don't think I'm catching up any time soon :)
 
Donald: data.stackexchange.com/codereview/query/86088/… and used the tag '<' to exploit a bug in the query
 
@CaptainObvious Off-topic?
 
@Jamal Thank you for fixing that Scala question.
 
0
Q: Efficient Multithreaded File Processessing in Java

mtbartaThis method in my code uses a producer-consumer design to read many files and process them for use in an NLP algorithm. The completion service collects files as they are processed, which means that docId != index. Given that I need to retrieve probabilities elsewhere where docID == index, I've im...

 
4:03 AM
@rolfl Thank you!
 
0
Q: Random RGB Colors for vb6

user3905907I have a function for generating RGB colors in VB6.0, and it is working properly. Please suggest improvements for this if any. Public Function RandomRGBColor() As Long RandomRGBColor = RGB( _ Int(Rnd() * 256), _ Int(Rnd() * 256), _ Int(Rnd() * 256)) End Function

 
Mischief managed.
 
4:18 AM
0
Q: Returning JSON depending on the route_id

charlesisjanI have a controller that has a purpose of returning json depending on the route_id being passed from the route (Using laravel). There's a point in my code where I resorted to using a double nested foreach loop in order to iterate the values I want to be stored into an array. Everything works fine...

 
 
1 hour later…
5:37 AM
0
Q: Dynamic Linq From String with EF

Mohsen AfshinI wrote an EF browser to dynamically navigate through entities. Beside basic properties of system types, each entity can have several singular or plural navigation properties. In order to support all of these using a single batch of code, I come up with the following solution considering the foll...

 
morning @all
 
morning @chillworld
 
how are you @mjolka
 
5:53 AM
pretty good, thanks :) you?
 
super, mine day can't be bad and it's only morning
 
0
Q: C++03 member function state machine

kertSo for various reasons i wrote this. For one i don't like to wrap every single function in a separate class, too verbose. It's a state machine based on GoTW 57 function pointer wrapping and CRTP to make things readable, at least in client code parts template <class Derived> struct StateMachine ...

 
hehe I have a nice discussion
Is it :
`private static final Logger logger = LoggerFactory.getLogger(SecurityUtil.class);`
or is it :
`private static final Logger LOGGER= LoggerFactory.getLogger(SecurityUtil.class);`

So actualy what I'm asking, is the logger viewed as a constant or not ;)
 
@chillworld I'm always using it as a constant, as it's a static variable
 
6:24 AM
well we had a discussion at work for this :)
objects are no constants
except the objects vars are final's to
we keep the reference to the object but we can change the object with setters
(had same vision like you before the discussion ^^)
 
0
Q: Kullback-Leibler (KL) distance between inside and outside contour code

user8264I am trying implement the distance measurement between two distributions. The detail is described in [here][1] and [input image][2] . Let short summarize the idea of the paper: The input image is divided into inside region and outside region by using Heaviside function H Calculate the distribu...

0
Q: Bootstrap Collapse Using a Button to Show Additional Text

TahirI’m trying to use Bootstrap Collapse in my project and I’m facing some issues (button moves below and I can’t figure out how to show some lines of text before expand). I want to use a button for the collapse to expand the box downward (to show more text). I want some lines of text to be already...

 
@chillworld They're still static variables
 
7:05 AM
indeed :)
 
7:37 AM
1
Q: How to avoid code duplication in a jQuery snippet?

Mirko PastorelliI need to use the same code in different jQuery attributes. It is possible to put this if in a external function and call it inside change event? I would like avoid duplicating code. $("#Max").change(function () { var max = $("#Max").val(); var min = $("#Min").val(); if (max != min) { $("#...

 
7:53 AM
0
A: Can we revisit "Did I write that code myself"?

PimgdI disagree that code should be self-written. There's something flawed about the notion that... But, the biggest reasons I (personally) think the own-code requirement is valuable is: Code is a personal thing, it's an expression of creativity, and the product of hard labour. People a...

 
8:37 AM
2
Q: Stock Pipe Cutting using Recursion

rdsarnaI'm totally new here and also very new to coding. This problem is from the Stanford Open Course CS106B Programming Abstractions Assignment#3 Here is the link - http://see.stanford.edu/materials/icspacs106b/H18-Assign3RecPS.pdf Problem number 6 "You are charged with buying the plumbing pipes ...

0
Q: This api code needs a refactoring, how to became it dry and optimized?

RicardoHelp me to refactor it and learn, post 'insert' do @inserted = false @message = Array.new event = Event.find_by(unprocessed: params[:unprocessed]) if event event.touch_with_version @inserted = true @message.push 'already inserted' else...

 
@Pimgd Your attitude towards criticism on your code is very idealistic..
the problem is that rolfl describes the actual situation, how it is out there
and you describe how it should be...
all the points you make are valid, but they are actually not hitting the problem...
 
9:22 AM
@Vogel612 And the problem is?
More specifically, is there anything wrong with trying to make things as they should be?
 
not at all....
or rather. The problem is, we can't make things work for how it should be, but for how it is,.
While it's nice that your mindset is like it "should" be, you can't influence the mindset that other people have...
and these other people make up a large part of programmers overall..
 
All I have to do is lead by example and shout hard enough long enough
 
good plan.
 
I can't do that if valid questions get closed, though
Well, I did just say that, but I still need to find a question where they should be opened
Right now it's just a change of close reason
from "not your code" to "not enough context"
 
thx santa
 
9:35 AM
No problem.
 
hehe santa has now a name :p
 
argh, why don't my command line options work in this shortcut
 
That was a joke. I almost never vote on Java questions.
 
@Morwenn well it was a vb6.0 answer :p
 
Ugh.
I don't upvote VB either. No problem :D
 
9:41 AM
:D
 
Hi @fredley
 
@Vogel612 Hi, just passing through testing stuff
 
mhh already wasted mine time from 8-12 am with doing euuh nothing for work :D
think it's time to start :D
 
@fredley stuff?
 
Different chat rooms have their own style quirks, so I'm testing it across a few
e.g. this room enforces hard corners on message boxes, so I have to fix that :)
 
9:48 AM
I cannot believe I'm literally stuck here on creating a working shortcut
 
I am trying to picture the "literally" part.
 
THIS DOOR WILL NOT OPEN WITHOUT ADDRESSING IT VIA A COMMANDLINE SHORTCUT, HUMAN
Like that
 
@Morwenn That's going to be weird
 
@skiwi you know, how smarter you are how difficult simple task begin to come :p
 
10:04 AM
0
Q: Javascript: Game of Life - OOP and Best Practices

timI always have a problem figuring out what good JavaScript coding practices and conventions are and if I'm following them, especially concerning oop. So I implemented The Game of Life and wanted to ask if you have any criticism or suggestions. My main concern is the gameLogic.js file, but for com...

 
@chillworld such as forming a coherent English sentence?
 
@Pimgd you're being jerky right now..
 
@Vogel612 yeah I know but I have no idea how to alter it to be less jerky but still have the same point
 
@Pimgd well, your right. Dutch is mine normal language.
 
@Pimgd something along the lines of "either it's me, or that sentence made no sense"
 
10:10 AM
Cause (and this is probably also jerky) I get that people are not native English speakers (I'm Dutch too) but that sentence took the cake
 
Oh... the joy when it is almost working, only to realize you forgot an equals() method
 
@skiwi you're f*cked
 
@skiwi and hashCode()?
 
whenever equals is missing, hashCode should be missing too..
because you shouldn't implement the separately ;)
 
@Pimgd well scores in school : language avg of 55% - programming avg of 85%
everybody has his/her flaws
 
10:12 AM
@Pimgd equals() and hashCode() are forever together in my mind
@Vogel612 Means I can restart the test
 
@chillworld scores for me: english: 75%, "programming": 100%, german: 50%, math: 100%
programming != actual programming though.
 
It feels like I've seen every beginner mistake today already
@Vogel612 I've never had languages and programming together
 
@skiwi they were separate...
and that's only the scores for Gymnasium,.,..
 
I meant on same school
 
we had the talk about it a while back.
well that's why I put some " around programming.
 
10:15 AM
I could've taken it actually as an extra 1-hour/week class for some months
but when I saw the assignments, I was like , it's so easy
 
What are programming classes like?
Never taken one.
 
@skiwi when you like a challenge : write a program by telling your wife/grilfriend what she has to do, type,... Your not allowed to touch the pc :)
3
Did that once. pffft work of 10 min became 30min+
 
Awesome, my program is working now
 
Why would you even do that =D
 
@Pimgd to make them understand how complicated your work is.
and for the heck of it ;)
 
10:18 AM
@ckuhn203 High school is literally follow a tutorial, university introduction teaches you the basic concepts and say Java also generics in the end, more advanced university class teaches you how to structure programs, etc. and build them
 
well, trouble with the eye's and wanted also that mine wife likes to program
 
@ckuhn203 well my "programming class" was like "this is Visual BASIC, you can do functions with it."
 
last one didn't turn out
 
@chillworld That would be a hell
 
I have the experience already :D (but the output was text with input, nothing graphical)
 
10:21 AM
My programming class ended up with me overseeing the students
I knew more than the teacher anyway
 
So nothing I couldn't get from years of reading and typing and trial and error.
 
(That said, I hadn't programmed before)
 
Scratch that. Did get.
Code Review has been good for me.
I think I've learned more here than anywhere.
 
=/ I just ran into arbitrary restrictions
and it hurts
0
A: Stock Pipe Cutting using Recursion

Pimgd while (true) { int votes = getInteger("Enter required length (-1 to quit): "); if (votes == -1) break; requests.add(votes); } Indentation - properly indent your code. You fixed some of it with an edit already, I assume it's correct in your IDE, then? See if your IDE has automatic format...

my answer is full of "do it differently... but you can't... but if you could, then"
 
0
Q: Random String Generator using OpenSSL in PHP

Entimonfunction GenerateRandomString($Length) { $Length /= 2; $cstrong = false; while ($cstrong != TRUE){ $bytes = openssl_random_pseudo_bytes($Length, $cstrong); } $hex = bin2hex($bytes); return $hex; } Is this a good function for generating a cryptographically secure random string? Is ther...

 
10:37 AM
@Vogel612 I know you downvoted my meta post but could you add your reason for it as a comment?
 
10:52 AM
@Pimgd actually,... I didn't...
 
-1
Q: Statefull Strategy pattern

Narendra PathaiI have a situation in a class tries to create a group of same type of components and if some component fails then it needs to decide whether it should continue or throw the exception. Now the behavior whether to continue or re-throw depends in the context in which that class is used. So a obviou...

 
Some more close-votes on @CaptainObvious please ;)
 
11:09 AM
@Vogel612 oh. Then who was it and why? I'm wondering what's wrong with my reasoning
 
@Pimgd I figure it's somewhat along the lines of what I wrote earlier..
Either way, meta-downvotes can also signalize "disagree"..
 
Yeah, meta is different
 
We don't have any rep on meta anyway.
 
they are not necessarily a critique of your post and don't warrant an explaining comment that much...
btw did you read my comment on the stock pipe cutting answer of yours?
 
yeah
I'm trying to consider how I will decrease emphasis on BAAAAAD RECURSION
before I get downvotes hurled my way
 
11:12 AM
when you're at it, you could remove the crap about "Is this even a valid line of Code?"
sure it's a valid line, after all it's conform to C++ syntax.
but the point you make about splitting it up on two different lines should stay ;)
 
yeah
edit edit edit
-1
Q: Statefull Strategy pattern

Narendra PathaiI have a situation in a class tries to create a group of same type of components and if some component fails then it needs to decide whether it should continue or throw the exception. Now the behavior whether to continue or re-throw depends in the context in which that class is used. So a obviou...

Cloooosed
 
0
Q: My first domain service class: SessionService

Kid DiamondI've made a SessionService class that's supposed to handle everything session related within my application domain. Since I'm still in the learning phase, I would like to have my class reviewed. Is my domain service class fully compliant with DDD's principles? Have I named everything clear enou...

 
can I leave in a lot of the iterative stuff if I wrap it as "if you could use an iterative approach..."
 
sure you can, but it's just "trivia"
I'd leave it in though..
it's extremely important for OP to realize he doesn't need to solve it with recursion.
 
verily so
You're right though, I almost went on a crusade there
 
11:20 AM
Why on earth does a Tooltip in JavaFX have by default a delay before it shows
 
but "use recursive!" and "Here's how OOP works" are two of the most misexplained things
and it hurts
 
@skiwi because frameworks in general suck, whatever you want to do..
but at least they suck less than the DIY
 
@skiwi because all tooltips that I know have a delay before showing
 
@Pimgd stargreed..
 
"Don't Iterate Yourself"?
 
11:21 AM
just realized...
 
@Pimgd It's weird for us to agree on meta since we rarely do on chat.
 
you could write it "star greed", too..
 
@Pimgd Do I not want a tooltip then perhaps?
 
++(*this)
 
@Morwenn please god, no
 
11:22 AM
Appereantly I need to skin my tooltip.
 
preincrement on a pointer to the current object???
 
"Morwenn evolved".
 
Also, recursive functions shouldn't be written for the sake of writing a recursive function...
 
@nhgrif We only disagree when it's about the qualities of Objective C, and that's because of a peeve of mine. It's not like we're complete opposites
 
don't you bork the pointer then?
 
11:23 AM
void operator++() { }
^^ I think it might be safe.
 
*(--(*(++(*this))++))
 
@nhgrif unless the people handling your scholarship/graduation certificate/paycheck say so =/
 
0
Q: Positive integer to Roman Numeral conversion function

Sujith KarivelilFor the past two Hours i was searching for a built in function for convert an integer to equivalent Roman Letter, but it failed to achieve the target. Hence i wrote my own routine for perform this conversion. I think it need some more clarifications so if submit it for a review. Following is the...

 
I think rolfl's concerns are legitimate, but could be covered by adding new rules in places of the "Did I write this code?" rule.
What I don't like is this sort of attitude:
@nhgrif To a significant degree, yes. You're not going to google for a review of a random stranger's code, like you do with SO questions. — svick 10 hours ago
 
@nhgrif he's got a point though..
 
11:24 AM
He's defending the "Did I write this code?" rule by saying I wouldn't google for a review of code written by someone else...
 
most people wouldn't do that...
 
But that's the whole point of the question...
 
Actually, I think I would!
But not on the scale we do today.
 
If we open it up and ask allow asking for reviews of other people's code, it makes it easier for us to grab a smaller section of code that we find interesting and ask for a review.
 
Simpler questions do get google hits, I think
In particular, the recently super-hot "min of 3 numbers"
 
Also old popular questions like "last comma problem"
 
Right.
 
Those things are snippets where even your average developer goes "man, I wish there was a cleaner way so I wouldn't have to fix these things over and over and over"
 
@nhgrif I don't even consider that question a valid question for a "code review"
 
Exactly.
Why not Vogel?
 
11:26 AM
you miss waaay too much context for it, IMO
 
Besides that he didn't write it--the rule I'm trying to challenge.
 
@nhgrif see my answer to your meta question
 
What context do you need? He's trying to compare colors then return something based on what color his color matches.
 
additionally it's asking about "is this best practice".
 
I saw it @Pimgd
 
11:27 AM
For the posted question, I'd close it because:
 
and that's off-topic anyways.
 
The asker hasn't given any context in which the code will be used. (Close.)
 
@nhgrif what keeps him from using a switch case then?
 
We gotta be able to review the solution too and right now that's impossible
 
That's not off-topic Vogel.
 
11:28 AM
@Pimgd no it isn't..
 
> Best practices and design pattern usage
First on the list of things you can ask about
 
@nhgrif directly below.
> it's okay to ask "Does this code follow common best practices?", but not "What is the best practice regarding X?")
 
> Best practices in general (that is, it's okay to ask "Does this code follow common best practices?", but not "What is the best practice regarding X?")
 
Hmmmh
Seems there's a grammar bug in there
Best practices and design pattern usage is not
Best practices + design pattern usage
 
He's asking "What's best practice regarding == vs .equals() on Colors"
 
11:29 AM
it's best practices usage + design pattern usage
 
He doesn't mention equals()
 
note to self: post meta question asking for rewrite to "Usage of best practices and design patterns"
 
@Pimgd it's not actually a grammar bug, but some unclarity..
 
He asks:
> Is the use of == here correct / best practice?
 
@nhgrif which is actually the same..
because in Java that's the two ways to compare objects..
 
11:30 AM
Vogel it's a specific case
 
== vs .equals()
 
Vogel, you can ask if your code complies to best practices.
 
Not generalized
Asking for best practices is offtopic because too broad
 
@nhgrif but he asks specifically about "use of =="
 
Asking if complies to best practices is pretty specific
 
11:31 AM
He posted a code snippet. He's asking if it complies to best practices and in specific, asking for best practice regarding his use of ==
There are a million questions that ask for how well code complies to best practices and highlight something specific to look at.
This is on-topic.
 
no, he posted an isolated usecase, without context, that boils down to abstracting the problem to a question about best practices on ==
 
Okay...
 
Vogel if the question was like this (gimme a min to phrase it)
 
which is precisely matching our definitions of off-topic.
 
No it's not.
And if this question is off-topic because it's asking about best practice, I'm done with this site.
Because if he removed that question but kept the code identical, it'd be fine.
And it's really stupid for questions that contain perfectly reviewable code to be closed because the plain-English part of the question ventured into a gray area of our close reasons.
 
11:33 AM
you might want to read this meta-answer:
6
A: Are SSCCEs off-topic?

rolflNo, SSCCE's should not be closed as off-topic just because they are SSCCE's. In fact, almost all code presented on Code Review is some form of trimmed down code to make it fit, to protect the innocent, etc. Many times 'extraneous' parts are ommitted (header files, java import statements, etc.). ...

it's specifically on why we should consider code-snippets that abstract the problem away as off-topic.
 
How is the problem abstracted?
He's trying to compare colors.
AND, an answer that used a switch would be fine in my opinion... if it would work.
 
"I made some changes to this breakout clone, particularily that different blocks have different strengths. I decided to do so based on color since the user can see which blocks are stronger and weaker. I have a question though, is this function for determining block strength okay? It uses == and I'm not sure whether that's the right way to compare colors"
 
And that question would seem fine.
Except that question would have a ton of code in it... which is fine for being on topic, but makes the question really big and only worth much to the asker and those getting rep from answering.
 
@Pimgd that's a whole different story. Here you got context, use-case and problem in the sentence.
and that's differnt
 
Eh, the only code would be either:
 
11:36 AM
But we have so much context that the question is boring and borderline useless to anyone but the asker and people who want to score rep off the question.
 
- Level initialization, with a tile strength function
or a block or tile class maybe
 
@nhgrif actually I think it would be borderline okay with the code posted..
 
or just the tile strength function (in which case we start asking for more info)
 
but that's my opinion..
there is no site-policy yet
 
It's really stupid that we want to keep question open or close them based on the plain-English context around the code.
 
11:37 AM
@nhgrif what exactly is wrong with that?
 
For reasons other than "There's not enough context to answer the question"
 
@nhgrif so you opt for posting code-only questions???
okay that makes sense..
 
Chat sometimes goes too fast =D
 
yea..
 
I'm okay with creating a "Not enough context" close reason.
2
But it shouldn't generically be applied just because the question is code-only.
 
11:39 AM
Not enough context would be applied if you don't get answers to "why did you do X"
 
This question of mine is almost code-only: codereview.stackexchange.com/questions/58878/…
It's also 1 vote short by the way
9
Q: Int extension for translating integer to plain English

nhgrifThis code was inspired by this question: Number to Words import Foundation extension Int { func plainEnglish (negativeSign: String = "negative") -> String { func singleNumberName (number: Int) -> String { switch (number) { case 1: return "one" cas...

Between the code and the title, it's self-explanatory though, I feel.
Particularly if you know the language.
And it's completely self-contained code.
Would this question be "not enough context" if I removed all the plain-English from the question?
 
yes, but the closed question on == is missing this "self-contained" character.
 
No, it's not.
 
the use-case is completely unclear..
 
Answer in a way that matches what he's doing.
 
11:41 AM
your code is so well-written, that the use-case is seen from the ocde..
 
To be honest...
That question is a special one, since it's not a question.
 
but on the == thingy, you have no clue what he does with these doubles...
 
The thing is though... nevermind what the asker wants reviewed
 
and that's important context..
 
11:41 AM
EVERYTHING posted is eligible for review.
That's why the plain-English parts of the question just aren't that important.
 
It's an answer to a question + "anything I missed"
so you might want to present another example
 
1
Q: How to refactor multiple OR in IF statements?

Lone RiderIs there a better way to write the following code fragment: I can't have more than 10 conditional statement in my method as it gives Cyclomatic Complexity. private List<AutoDto> getFilteredAutoList() { List<AutoDto> autoList = getAutoListForCoverage(); List<AutoDto> fi...

 
@nhgrif "EVERYTHING" imo includes the plain english part.
 
You have no clue what anyone does with the returned strings I use?
The plain English part isn't part of the code.
I'm late for work.
 
Does anyone have a clue how I can implement different tooltip texts on a left mouse hover and a right mouse hover?
 
11:46 AM
lol wat left mouse
you have multiple mice?
 
Huh? No, I mean the button
 
@skiwi hover is independent of button...
there is only one hover...
everything else is a click /mousedown..
also: why would you need that? *flabberghasted*
 
I know of a solution, though
 
Erm... never mind me, I don't know what I was thinking
 
OnLeftMouseDown - set tooltip texts to leftMouseTooltips
OnRightMouseDown - set tooltip texts to rightMouseTooltips
It's a bit silly though
 
11:51 AM
Just... don't do it, I don't know what I've been smoking
5
 
You could even have different mouse overs depending on whether shift and CTRL are pressed
and then dub it "reactive interfaces"
and wow management
and get it into production and in front of actual users
 
I think I was thinking along the lines of which mouse button would have more pressure onto it... so erm, nope
 
and then 168-hour weeks of customer support
 
Another thing
or not, I need to figure out what is happening here
If I cast a class to another class in a legal cast, does it then change the equals method?
 
no
 
11:54 AM
So my equals in combination with serialization might not be working at all
 
Lemme change your question
If I cast a class to its superclass in a legal cast, do method calls on the object call the superclass's methods?
and then it's obvious
 
Then I might have an issue
 
How so
 
In this old friend:
public static <T, C extends Class<T>> T readSerializableObjectFromFile(final Path path, final C clazz) {
    Objects.requireNonNull(path, "path");
    Objects.requireNonNull(clazz, "clazz");
    try (ObjectInputStream objectInputStream = new ObjectInputStream(Files.newInputStream(path))) {
        return clazz.cast(objectInputStream.readObject());
    } catch (IOException ex) {
        throw new UncheckedIOException(ex);
    } catch (ClassNotFoundException ex) {
        throw new RuntimeException(ex);
I can create instances of whatever object I want
 
and...
 
11:56 AM
but then the equals() and hashCode() of Object get used? or not, that was what I'm trying to confirm
Because it is an Object, but presented as a whatever type you want
 
it calls...
instance.getClass().getQualifiedName()'s equals and hashCode methods
And if those don't exist...
instance.getClass().getSuperClass().getQualifiedName()'s equals and hashCode methods
And this will go on until you hit Object.
 

« first day (458 days earlier)      last day (3551 days later) »