« first day (327 days earlier)      last day (3689 days later) » 

7:00 PM
I think that was a comment on the question I linked @SimonAndréForsberg
 
@skiwi Nice answer there. I'll see if I can improve your solution.
 
I'll start become more active on CR once the Java 8 questions start coming.
 
@skiwi in the meantime you can advertise CR on SO for ;)
 
@SimonAndréForsberg I think the final step can also have a map, and you can always refactor the code that creates the map, plus rename the method ^^
 
-1
Q: Which is better in terms of code quality + readability

maythesource.comI have the following 3 different versions of code and am wondering which one is better. Their all equivalent in terms of functionality. I am not sure about readability. Personally I prefer version 1 even though it contains redundant statements. Version 1: for (int i = 0; i < resultsSize; i++) ...

 
7:02 PM
Oh god... It has a -1 when @StackExchange sees it already
 
@ChrisW: I'm about to apply the update to the locked post. I've appended your desired snippet of revision 11 to the top of the current revision, removed some redundant info, and cleaned up the grammar and spelling.
 
@skiwi Take a look at my answer on the SO question. Are we doing the same thing? Is my solution correct?
0
A: How to check to see if the characters of one string are in another string

Simon André ForsbergI believe this solution is correct. If I have understood your requirements correctly. public static void main(String[] args) { String a = "helloworld"; String b = "lshewodxzr"; containsAllChars(a, b); containsAllChars(b, a); } private static void containsAllChars(String a, Stri...

 
Did you test it? :p
    boolean checkOne = check("helloworld", "asdfuvjerhelloworld");
    System.out.println("checkOne = " + checkOne);

    boolean checkTwo = check("helloworld", "lshewodxzr");
    System.out.println("checkTwo = " + checkTwo);

    boolean checkThree = check("helloworld", "abc");
    System.out.println("checkThree = " + checkThree);
true-true-false is my check here
@SimonAndréForsberg +1 that's the best one... My whole Map actually does not even make sense
 
checkOne = true
checkTwo = true
checkThree = false
 
An optimization would be precalculate b
 
7:11 PM
precalculate how?
 
Convert it to a HashSet
TTGH ... a bit early.
 
> This type of question (A vs B [vs C]) isn't very likely to give you a useful code review, why don't you just post the version you're using, and let reviewers tell you how it would be best written? Please see our [help/on-topic] to see what we're all about - we're looking for code to be peer reviewed, not for snippets to be compared and discussed. As it stands, this question is still opinion-based.
^^ true? (not posted yet)
 
true....
but
is it off topic?
 
I really love, how that guy has "shown a minimal understanding of the problem being solved and include attempts".
 
I just put a close vote for being opinion-based. We'll see if OP edits it again
 
7:13 PM
@Mat'sMug What question?
 
1
Q: Coding standard and Readability: Verbose/Redundant statements vs Short/Compressed

maythesource.comI have the following 3 different versions of code. Version 1 is overly verbose and contains redundancy but on the other hand seems easier to read. Version 2 is somewhere in the middle, and Version 3 is shortened and straight to the point. Their all equivalent in terms of functionality. I am not ...

 
0
Q: Using a Pythonesque range() generator function with the Java foreach loop

Highland MarkNow that we have the nice new foreach loop in Java, the old-style loop looks ugly be comparison. I like the way Python has a range() generator that allows the foreach construct to iterate over a range of integers. I have written a Range class which allows this. Comments please. package highla...

 
@SimonAndréForsberg I beat you to it
public boolean containsAllChars(String a, String b) {
    List<Character> aChars = stringToCharacterList(a);
    List<Character> bChars = stringToCharacterList(b);
    return bChars.containsAll(aChars);
}

public List<Character> stringToCharacterList(String input) {
    return input.chars().distinct()
            .mapToObj(i -> (char)i)
            .collect(Collectors.toList());
}
Beat that.
 
@Vogel612 OP has serious SO rep, might be the OP coming here with the SO "what have you tried" mentality
 
Your code may be smaller, but mine is prettier!
 
7:16 PM
@Mat'smug it's about the SO questio
 
oh, I'm off-topic, sorry ;)
 
I wonder if it's correct that I added a second answer, but I don't want to invalidate my first answer.
 
@skiwi What exactly should I beat? Readability? Performance? Minimum-char-count?
 
and now it's answered... pretty good
0
A: Coding standard and Readability: Verbose/Redundant statements vs Short/Compressed

palacsint Version 1 is overly verbose and contains redundancy but on the other hand seems easier to read. I'd go with the first one with some modifications. The second one need horizontal scrolling which is hard to read. The third one was made for a computer, for humans it's too hard to follow, the co...

 
Yours is a one-liner @SimonAndréForsberg
Though technically I could also write...
public boolean containsAllChars(String a, String b) {
    return b.chars().distinct().mapToObj(i -> (char)i).collect(Collectors.toList()).containsAll(a.chars().distinct().mapToObj(i -> (char)i).collect(Collectors.toList()));
}
 
7:19 PM
@Jamal Looks good.
 
What's the consensus about A vs B questions again?
 
Out of own experience I have noticed that A vs B vs anything is allowed, but A vs B isn't...
 
@Mat'sMug I'm not sure it is as opinion-based as it seems.
 
@ChrisW Alright. I'll clean up the comments and then unlock. Hopefully the OP will be educated on what we generally expect for questions.
 
I think there is an "optimal solution" on the V1/2/3 Java question
 
7:21 PM
@Jamal I think I boo-boo'd on the Coding standard an readability: Verbose... question. Am I close-vote-happy?
 
Gah, we are loosing ground in JavaScript
75 open question, lowest was 69
 
And now off for a bit, which I should've been an hour earlier until questions popped up :>
 
should I retract the close vote?
 
@Mat'sMug I don't think so. It does still seem to lean towards off-topic.
 
@ChrisW I don't know, it looked like it was right for the question.
 
7:28 PM
Or not off yet :D, if you want to see what burnin looks like:
Look on the left of my screen
Also in the top middle you can see stackoverflow...
 
@Malachi Maybe it is; I clearly don't know what is for exactly.
 
@skiwi I'm starting to understand how you're able to get so much SO rep these days. I like the Java 8 questions there :)
 
@SimonAndréForsberg I'm not so much of a person for the simple -please do my homework to the Help, I have no idea what I am doing- questions
 
This looks... off-topic in multiple ways:
0
Q: Snorby auto-install script for Raspbian - Rake Error

user3200534I came across this excellent peace of code on github that automatically installs Snort and Snorby on your Debian 6.x or 7.x machine. It consists of 2 files: autosnort-debian.sh and snorby-debian.sh. I want to run this script on a Raspbian powered RaspberryPi! So I removed the package source li...

 
Adding Java8 suggestions to answers now:
0
A: Using a Pythonesque range() generator function with the Java foreach loop

rolflFor the most part, this appears to be neat, and well structured. There is a significant bug, though: Iterable<Integer> implies an iterator() method. Each time you call that iterator() method you should get a new instance of an interator, not an 'expired' instance. For example, the following ...

 
7:33 PM
0
Q: Snorby auto-install script for Raspbian - Rake Error

user3200534I came across this excellent peace of code on github that automatically installs Snort and Snorby on your Debian 6.x or 7.x machine. It consists of 2 files: autosnort-debian.sh and snorby-debian.sh. I want to run this script on a Raspbian powered RaspberryPi! So I removed the package source li...

 
@syb0rg I suggest that you tell him yourself. ☺
@skiwi LCD "burn-in" should go away if you wait a while.
 
@200_success That would lead to a long review, which is too hard to do from a phone ;)
 
7:49 PM
@200_success Only needs one more Java answer to score a gold badge.
 
0
Q: Wait until all files are loaded asynchronously, then run code

CharlesI'm an experienced programmer but not too great at JavaScript so I'm looking to see if I'm doing this 'right'. I want to have several files loaded in (Ajax or really AJAJ) and, once loaded, run some final code. My basic idea is: var jobsToDo = 2; // global function getAsync(url, func) { var...

 
@SimonAndréForsberg We now have 7 Java zombies. ;-)
 
@Jamal I've answered two C# Zombies today.
 
:D
 
4,999 reputation on SO
@200_success The "burn-in" is there already for a few days, it is gone though if the screen is entirely off
 
[tagI-forgot-the-color] ;)
 
Thanks, Santa! Almost to 8K.
 
@Jamal Santa's giving you the 200 rep you wanted for Christmas?
 
@SimonAndréForsberg I suppose he is. I just hope he doesn't have a serial upvote somewhere in that bag...
 
8:09 PM
 
@Jamal I don't think Santa will give you 200 rep, at least not today.
 
@SimonAndréForsberg I know. It's not my goal. :-) I'm just looking towards 10K someday.
 
Wow, I've been with stupid for a while.
I thought you couldn't inject functionality into a Java library class
 
@skiwi At least you haven't been doing
 
but you can of course extend an existing implementation, and then still let it work
 
@skiwi Just like I extended ThreadPoolExecutor?
 
@SimonAndréForsberg Pretty much I think
 
class CustomList<T> extends ArrayList<T> {
    public void printRandom() {
        System.out.println("random");
    }
}
    CustomList<String> cstmLst = new CustomList<>();
    cstmLst.add("a");
    cstmLst.add("b");
    Collections.sort(cstmLst);
somehow I was under the impression that this code would break
 
Hmm... why would it?
 
I don't know actually, why did my brain even think that
This makes room for interesting things...
Only too bad I had forgotten what I actually wanted to do a while ago :>
method toList in class Collection cannot be applied to given types;
  required: no arguments
  found: no arguments
  reason: actual and formal argument lists differ in length
Thanks, Netbeans.
 
@SimonAndréForsberg he may need one more question, but he also needs 230 up-votes....
 
Oh, missed that.
Silly me.
 
8:35 PM
TTQW
 
dang just noticed I have 149 rep today.. now I must stay to cap
Whata? is this
 
it is a misguided attempt to steer people right
 
Not the first time someone mis-typed a tag on SO
 
no, and the tag will die without any questions anyway
 
9:03 PM
Someone care to be the bad-guy for me? Invalidating edits: codereview.stackexchange.com/posts/45535/revisions
Meh, never mind, I will do it.
Done, i am a big ape and can care for myself.
 
@Jamal, I am thinking that this question should be protected, second time someone with no rep has given a non-answer answer ▼▼▼
12
Q: Array whose values are the product of every other integer

footyI was asked the following interview question over the phone: Given an array of integers, produce an array whose values are the product of every other integer excluding the current index. Example: [4, 3, 2, 8] -> [3*2*8, 4*2*8, 4*3*8, 4*3*2] -> [48, 64, 96, 24] and I gave the follo...

 
@Malachi - that question is on the Hot-Questions list at the moment. That is a good thing.
It has also attracted answers like this:
0
A: Array whose values are the product of every other integer

user3356382What about something like this ? import java.util.Arrays; public class ArrayCalc { public static void main(String[] args){ Integer[] exparray = {2,3,4}; Integer[] resultarray = new Integer[exparray.length]; for (int i = 0; i< exparray.length; i++){ ...

Which is (not great) but an OK answer, from someone who would not have been able to answer if the protect is in place.
 
@rolfl I see your point.
 
@Malachi - the protect feature really has me confused..... I have not seen any case on CR where it has been really useful.
The only time I see it being applicable is where the number of answers is getting close to the convert-to-wiki threshold.
 
@rolfl I understand your confusion.
@rolfl by that point it is too late I think.
 
9:18 PM
When it is getting close, you can act.
(on code review, it will be about when the answers go on to page 2)
There are other tools for dealing with new users creating bad posts....
The first-post queue is the right place.... I think.
 
0
Q: Backbone.js application for maintaining people information

SBelI would like advice if this is a good implementation of an application for maintaining information about people (first name, last name, and age). The index.html contains an empty div and 2 templates (1 for listing people and the other for entering/editing a user): <div id="app"> </div> <script...

 
@Corbin Are you here? Using pointers as keys doesn't seem to be working right now.
 
I'm just wondering: has Jon Skeet more reputation on SO than the whole CR community?
 
hax
or making the C# compiler
 
9:34 PM
0
Q: java project counting words ,character, is valid code

stam21rhello i want to make a program with frame to select a file in input , count length and where is the file in output and three check boxes count characters , words and if is valid code.

 
Rude people on SO... I'm not allowed to help some guy with small trouble appereantly
It's not like the question is completely messed up.
 
@rolfl: Yeah, I also prefer that (code changed now) but I don't have hard facts for that. Steve McConnell has some, rather hard to follow ones in Code Complete 2nd Edition (p746) and the Java Code Conventions from 1999 also suggests that. The latter is rather a mess nowadays, sometimes I find it embarrassing to quote. Do you have any good resource? — palacsint 19 secs ago
 
0
Q: C++ template Range

Loki AstariFrom a previous question I got an answer that included some template magic (that to be blunt was mind boggling (as I could not understand it)). So I have been trying to achieve the same results (because trying helps me learn). To make sure I have learn correctly I am putting it here for comment....

 
@palacsint No. Jon Skeet has a measly score of 660652. CR collectively has 3306144. That's a bit over 5 Jon Skeets!
6
 
9:49 PM
lol I am now out of stars. but I had to Indian Give one to give it again
 
@200_success Sounds good :) Thanks!
 
wee 10 points short of maxing out on SO
I actually stayed online longer to max out :>
I wonder if maxing out rep on a day can be taken away? Or do you get the hit as soon as you hit 200?
 
@rolfl I would also give it a while, even with those bad 1-rep answers. I sort of feel that others may judge us if we protect so soon (unless it just happened to attract absolute crap).
The OP stated: I would like to get feedback on my answer and see what's wrong. This in no way addresses the OP's code and is just a code dump. Please review the OP's code (you can even explain how this would make for a better solution), otherwise this answer may be deleted. — Jamal ♦ 23 secs ago
 
10:14 PM
@palacsint I messed up my comment, I missed that you also referred to it in your comment...
@200_success It is true that he only has 600K rep, but it would be about 7Mil if it was not for the cap.
 
@rolfl Thanks for the second one!
 
I expect I will be seeing references from there a lot now ;-)
 
I'd be interesting more about the whys, but three not so explanatory reference could be convincing :)
 
As far as I am concerned, it's enough just to differentiate Java from C/C#/C++
No, that's short-sighted... but I feel that the extra-line eye-scan for the brace is a waster.
3-lines of an ....} else { ....
if (condition) {
    ... do something
} else {
    ... do something else
}
vs.
 
0
Q: Prime generator from one to n c++

nimssonMy code calculates primes from one to n. I have verified that the code always produces all the primes in that range correctly. Are there any optimizations that I can make? Are there any bad programming practices besides variable names eg. l is close to 1? Any better normal Windows api? I am using...

 
10:24 PM
if (condition)
{
    ... do something
}
else
{
    ... do something else
}
 
Agree, I hated that when I reviewed C# code at work
 
You can use me as a reference, and I will use you? OK?
 
:))
 
@Malachi - naughty... naughty ... that edit you approved invalidates part of an answer.
 
@rolfl I guess we don't have any other choice just downvoting the invalid answer =)
 
10:31 PM
The edit is still pending approval/rejection, as far as I can tell.
@Jamal, have a second to be a second set of eyes on this one?
The edits contained clear comments indicating the changes and acknowledging the answer that prompted them. I feel it is a shame that you felt it necessary to remove them. — Highland Mark 1 min ago
 
@rolfl I do agree with you. Comments are not an exception as the original code is still changed.
 
0
Q: Setting and getting bits in C

Sean PedersenI am just starting to get my feet wet with C; and am rather enjoying myself in doing so. This is sort of a follow up to my last question here. I am posting this ordinate to hopefully getting some feedback on the logic itself, and possibly also some feedback on coding style. I do, however insist o...

 
^ a new tag. Should it just be replaced with (or is it not quite the same here)?
 
it is .
 
Is there a bitmask tag?
I feel there's a slight difference between bitwise and bitmask, yes?
 
10:45 PM
yes, there is a difference between bitwise and bitmask, in that a bitmask is a subset of bitwise operations.
@palacsint - just in case you are thinking that I was mental when I wrote that comment, it does contain a link to that exact same meta Q/A ...
While it is tempting to edit and improve your question, it also makes the existing answers look wrong - it invalidates them. There is a meta post about this here.... I have rolled-back your edits, but feel free to create a new question with the revised code, or one of the other alternatives suggested in that link. — rolfl 2 hours ago
 
lol, I'm getting tired
 
10:59 PM
The easiest way to get to the real problem is usually asking Why five times. — Gordon ♦ Oct 21 '12 at 17:25
 
0
Q: Bash script to clear files not matching a given extension

WCharginUsing LaTeX creates a bunch of auxiliary files like foo.aux, foo.log, etc. Sometimes, I want to create a clean run of my document. I usually manually execute this in the terminal as $ ls foo* foo.tex foo.aux foo.log foo.bbl foo-blx.bib $ rm foo{.aux,.log,.bbl,-blx.bib} This works fine. However...

 
11:27 PM
?
-1
Q: CSS3 animation Negative value

user39606I was what can happen if we use negative value for the animation-duration property in CSS3? I was referring to a demo here http://www.tutorialspark.com/css3Reference/CSS3_animation-duration_Property.php

 
0
Q: First program with threads

user1991779This is my very first program that using threads. I use C++11 standard threads and I run it on Linux. The program create two threads that sums all the elements in a vector together. The first created thread sums the left half of the vector and the other thread sums the right part of the vector. ...

-1
Q: CSS3 animation Negative value

user39606I was what can happen if we use negative value for the animation-duration property in CSS3? I was referring to a demo here http://www.tutorialspark.com/css3Reference/CSS3_animation-duration_Property.php

 
You can if you like edit your question, to append an improved version and/or comments; but the convention on this site is to leave a copy of the original code untouched at the top of the question. — ChrisW 37 secs ago
 

« first day (327 days earlier)      last day (3689 days later) »