« first day (303 days earlier)      last day (3719 days later) » 

3:01 PM
@Mat'sMug What is a review?
 
One thing at a time...
 
I haven't had time to look at your recent meta discussion unfortunately.
But to me, "you can use this approach instead" can be a good answer if it explains why that approach should be used.
 
@rolfl Isn't COBOL slightly dated?
 
slightly???
well it's fast ..
 
@SimonAndréForsberg but that's too long to read and you'll get tons more votes if you just say "use this approach instead".
 
3:03 PM
and C / C++ is slightly dated too..
 
@Mat'sMug I don't follow... what's too long to read?
 
@Mat'sMug maybe on Stack Overflow, but if there is lot's of upvoting for non-review answers then people vote "incorrectly"
 
@Mat'sMug how about putting this spin on things.... would you consider that a 'good answer' to a Code Review question would also make for a good question?
If a good answer has suggested code, can that code be reviewed?
 
anyone want to tear up my PHP answer? ▼▼▼
0
A: Building <div>text</div> inside a while loop

Malachiit looks like you don't really need to exit out of the PHP tag on this one. <?php $akhbarkotah1 = $conn->prepare("SELECT text,time FROM small WHERE active='0' ORDER BY time DESC LIMIT 10"); $akhbarkotah1->execute(); while($obj = $akhbarkotah1->fetch(PDO::FETCH_OBJ)){ echo "<div>

 
@rolfl IMO a good CR answer could very well be including no code at all.
 
3:06 PM
Yes, that is true.
But not my point.
 
actually the more code a CR answer has, the more it's geared towards "rewriting the OP's code" rather than reviewing it
 
I actually don't think the posted question code will work at all.....I can't test it from here at the moment I need to get back to work....lol.
 
@Mat'sMug well at least you should reference the code OP Posted, if not in codeblocks then at least in words.
 
I need to catch up on CR politics later when I get home too
 
@Vogel612 absolutely!
 
3:08 PM
0
Q: Making C++11 range-based for loops a bit more useful

stefanC++11 is great. Probably one of the most beautiful features (in my opinion) is the so-called range-based-for-loop. Instead of for ( std::size_t i(0); i < range.size(); ++i ) { // do something to range[i]; } or for ( Range::iterator it(range.begin()); it != range.end(); ++it ) { // do so...

 
the point it, some questions are clearly asking to provide an alternative way to write something - to me this is a fit for this question is asking for code to be written.
...to a certain extent.
What's "saving" us, is the part of the FAQ that says answers can address any part of the OP's code
 
@Mat'sMug it is theoretically possible to rewrite every question of that type to a more review-like question if you want...
 
@Vogel612 try with that one:
6
Q: Which way is better for converting number to string?

User1Sometimes there is need to change an integer to text. I often use the following way: "" + myNumber But there is alternative way: Integer.toString(myNumber) Which one is better (performance, readability, safety)? Or are those equal?

^^ IMO this isn't asking for code to be reviewed.
 
there is no code..
this is something for Stack Overflow / Programmers
 
Well it's officially on-topic, opened, and it's been "cherry-picked" as an example of a "good short question"
 
3:11 PM
this is about "best practices"
 
and I agree it's definitely a better fit for Programmers.SE
 
moar edits
 
I need some more votes on another question so I can get that one cool badge
 
I'm not saying the answers to that are useless - just that they're not the type of answers that contribute to make our site's scope any clearer.
in other words, these questions are toxic.
 
then flag to close / migrate ...
 
3:13 PM
they attract lots of views, lots of votes, and make lots of users believe we're something we're not.
I'll let @rolfl cast the first close vote on that one.
 
That will likely not happen.... mostly because I see things through two perspectives.
1. Any code, no matter how short, can be reviewed
2. even if there are other aspects about the question that are not on topic here, we automatically define the Do I want feedback about any or all facets of the code?
So, if you have something to say that reviews the code, makes suggestions for improvements, etc. then your answer is on-topic, even if the question is questionable.
Also, this is a grey area, not an absolute.
 
@rolfl if you argument like that, one could say that broken code is also on-topic here...
1. you can review it
 
If we follow this line of reasoning, then every time some
... one posts code where the answer finds a bug, it should be closed.
 
2. you can redefine the scope, so you just include the not broken code.
 
The bug-in-code is another grey area....
If the bug makes the code hard to review, and it is obviously broken, then the code is not in a revieable state, and should be closd (it's not fair to the reviewer).
 
3:18 PM
I'd much rather see a question where the OP is converting their integers into strings by doing "" + myNumber and they're giving us a whole method to review. Then the answers can tackle other aspects of the code, and give the same reason why Integer.toString(myNumber) is preferable.
otherwise, it's too narrow
 
@Mat'sMug you mean something like: "code posted should contain at least 3 statements." ??
 
So, what you are saying is that you would prefer:

public static String myToString(int value) {
return "" + value;
}

than:

I have this problem, I have thought of two alternatives, not sure which one is better (and hey, maybe theres and even better alternative...). Suggestions?

"" + value;

or

String.valueOf(value)
 
simply spoken... yes.
 
Seeing "I have A and B, which is better /why" makes my close-button twitch.
 
same here... I'd probably even VTC on SO...
 
3:22 PM
hey @Jamal! Haven't seen your input on
9
Q: One-liners and other narrowed-down reviews

Mat's MugEvery once in a blue moon, a question gets posted (often as a new user's first post) where the OP is asking a quite specific question about very minimalistic code, for example: if (strstr($url, "?")) { $url = strstr($url, "?", true); } There is something to say about this code, of course....

 
Hey! I'm not sure I have much else to add. I'm also still a bit unsure which side I most agree with. Then again, it's not for me to decide; I only uphold the rules.
 
Meh, I look at questions and seek out the value in them.... reasons to review them... maybe I should look for reasons to close them first....
 
@Jamal I like that attitude..
 
Thanks ;-) ( hehehehe ... I knew you meant @Jamal)
 
it's never good if a mod starts a flamewar...
@rolfl well... you just intercepted me..
 
3:26 PM
@rolfl yes. Then we can discuss why the method is static and why it's concatenating an empty string, and suggest the toString way instead, and explain why implementing a method that way makes it better code. It's not about how many lines of code you're giving us to review - a one-liner method is fine. But I think a one-liner that's just totally out of its context is not.
 
Right. Mods do not create rules. They enforce them and make sure everyone else is enforcing them, even if they disagree with them.
Oh look, donuts and coffee!
 
10 hours ago, by Mat's Mug
And here it goes!
^^ How many other closed questions should we reopen now that we're cool with questions that aren't asking for a review?
 
now now.. don't be hasty.
noone ever said that the monkey has the absolute authority ;)
4
 
let me star that
 
> How many other closed questions should we reopen now that we're cool with short questions that aren't asking for a review?
I thought we all agreed that the length was not the criteria
 
3:30 PM
edited :)
 
@rolfl now you're being hasty..
 
The only thing I think that is being disagreed on...... is 'what is enough context'?
 
yea...
and length has quite a weight in that..
 
We all agree that questions that do not conform to the on-topic rules of CR are off-topic.
 
Is this one on-topic?
6
Q: Which way is better for converting number to string?

User1Sometimes there is need to change an integer to text. I often use the following way: "" + myNumber But there is alternative way: Integer.toString(myNumber) Which one is better (performance, readability, safety)? Or are those equal?

 
3:32 PM
dammit @Mat'sMug it's dead...
don't ride it more..
 
I know, it's just an example...
 
<-- English skills start to fail
@rolfl sure you could pack a whole method in one line, but who would do that??
 
@Vogel612 pretend it's an audit for the close votes queue ;)
 
and any halfway structured code ususally does not pack more that 2 statements in one line..
 
@Mat'sMug consider it..... It has context: *Sometimes there is need to change an integer to text.*
It has Code: `"" + myNumber` and `Integer.toString(myNumber)`
It Works: (within the context provided)
It has a question: *Which one is better (performance, readability, safety)? Or are those equal?*
As well as the implied: *Do I want feedback about any or all facets of the code?*
 
3:34 PM
and it's admittedly extremely difficult to review a single statement..
@Mat'sMug SKIP
 
lol
going to catch some air, back in a few minutes ;)
 
@Vogel612 ... this one came up recently:
9
Q: Reversing the digits of an integer

Simon KuangFor CS class, I had to reverse the digits of an integer from the input. This is my solution: System.out.println(new StringBuilder(new Integer(new Scanner(System.in).nextInt()).toString()).reverse().toString()); My main question is this: is this too golfed? Obviously I could simply add whitesp...

 
Jamalization time...
 
Monkey got it. :-)
 
3:40 PM
IMO, a lot of this discussion should be on meta CR.
 
@Simon well, it's much easier to do it in chat..
also, check the room topic: "general discussion about CR"
this includes on-/off-topic discussions.
 
0
Q: Value formatters (for entities like price, currencies so on)

user37979I am looking over some existing code (see below). The problem of grouping in the same place the presentation logic of some fields (like price, currency) was solved as extension methods on int, double, and so on... I do not really like this. What do you think? How could it be done more elegant...

 
@Vogel612: It's better to have this on Meta because everyone needs to see what has been established. Chat is mixed with other things and is not as official.
 
@Jamal good point.. one can still link to transcript on meta, though
 
This is the post:
9
Q: One-liners and other narrowed-down reviews

Mat's MugEvery once in a blue moon, a question gets posted (often as a new user's first post) where the OP is asking a quite specific question about very minimalistic code, for example: if (strstr($url, "?")) { $url = strstr($url, "?", true); } There is something to say about this code, of course....

 
3:48 PM
how many times did you post it in the last hour??
three? four?
hey guys, this answer makes my flag button twitch..
0
A: Reversing the digits of an integer

GroundZeroWhile using a String operation on this is probably the easiest and the fastest way to reverse an interger, you could also do it without casting NOTE: this only works with integers, not with any decimal numbers. int number = 12345; int result = reverseInteger(number); public int reverseInteger(...

 
Flag, or downvote?
 
@rolfl that's exactly what I am asking..
I'd go for the flag, and leave undownvoted..
 
Then you should probably flag this answer too:
3
A: Reversing the digits of an integer

LandeiWhy not throw in some arithmetics? private static String reverseInt(int i) { StringBuilder sb = new StringBuilder(); for(int d = i; d != 0; d /=10) { sb.append(d % 10); } return sb.toString(); }

 
yea..
well they are not really reviews are they..
 
Good question .... ;-) ...... ;-)
 
3:58 PM
I'll flag both for low quality now..
 
13
Q: Short answers and code-only answers

ChrisWWhat should we do with: Short answers (for example, "I suggest you use [hyperlink to this standard API] instead.") Code-only answers (for example, an improved version of the code in the OP) Such answers could be improved (e.g. by adding an explanation of why the suggestion is helpful). Is it...

@Vogel612 befor eyou do
 
toooo... late....
 
0
Q: need refactoring nodejs mongo update user

Sebastian(function () { 'use strict'; var database = require('mongodb'); var util = require('util'); var constants = require('../constants'); var dbhelper = { updateLastSeenDate: function (me) { database.connect(constants.variables.connection, function (err, db) ...

 
Liberal sprinkling of magic upvotes.
 
4:04 PM
ciao @rolfl ;)
 
Crap, did I crash your database?
 
ehehe no no :)
 
<-- bursts out laughing
 
i try so another solution..
but require truncate table and for safety my user not as this privilege :)
 
Select into?
 
4:08 PM
for reet auto_column to the second teble..
ret -> reset
if i use alter table auto_increment i have the same ID number.. only drop or truncate reset ID
 
Yeah, at this point it becomes very database specific, and my 'specific' database is DB2.
 
for have order number 1 at 01/01/2015
 
integrating a 'new way' of doing things when there is existing data is much harder.
 
at this moment i try to setup a second server for testing mongodb.. i'm curius ;)
 
<-- @rolfl can relate after sitting two days in front of a schema change with hibernate introducing a @NotNull column
 
4:14 PM
0
Q: Better way to load Mysql query in PHP Array

Mawia HLHere is my code: $sql = <<<END Select Sum(p)/Sum(w)*100 as present FROM attendance group by month END; $query = mysql_query($sql) or die($sql . ' - ' . mysql_error()); $names = array(); while ($row = mysql_fetch_array($query)) { $names[] = $row[0]; }

 
Is it just me or almost every new question I read is always asking to shorten the code...
 
Well that is one important part of readability, isn't it?
 
shorten is an ambiguous word.
shorten the runtime?
 
shorten the code --> lower the character count
 
it is common in some non-native-english-speakers to use shorten for 'quicken'.
Also, shorten does not mean 'golf'.
If you are referring to:
1
Q: need refactoring nodejs mongo update user

SebastianThis function is update user last login date on the user collection but i guess more bracket more spagetti. How can I shorten this code (function () { 'use strict'; var database = require('mongodb'); var util = require('util'); var constants = require('../constants'); var ...

> How can I shorten this code
Damn right, shorten ==> DRY
 
4:21 PM
which is: lowering character count...
not minimizing character count
 
true
 
No I know that it's not alway about golfing, and I'm not saying ti is actually bad, I was just seeing shorten in every question and was wondering if I was turning crazy :P
 
It may help....
 
Being crazy ?
 
sure...
don't you know the saying?
"I'm not saying that I'm crazy, but it sure helps."
 
4:27 PM
I didn't know that saying.
 
Why is this room called "The 2nd Monitor"?
 
There's a meta post about that
 
I would have feared asking such a question on meta :o
 
6
A: What should be the name of our main chatroom?

Mat's MugThe 2nd Monitor We all [hopefully - if not you're missing out!] work with at least two monitors. I noticed I keep the chat window open on my 2nd monitor [almost] all the time. Having a 2nd monitor is also quite handy during an actual peer review. I think it makes a perfectly suited name for our...

 
@rolfl Take it for what it's worth, but I generally ignore any such request, and just review the code in general. I might keep their specific request in mind, so if there's a change that meets their criteria but is otherwise questionable, I might mention it where I wouldn't otherwise, but I'd still review it in general and their request would only affect the result if it started out as a very close call.
 
4:34 PM
That's my feeling about it too.
In my experience, when doing real code reviews, the actual concerns of the person asking for the review are the least of their problems.
it's the stuff they are not aware of that matters most
What they never considered... the unexpected.
 
well if you post a question here you need to expect the unexpected...
 
Sometimes, they know that they don't know.
 
because if you expect something, you should have already refactored..
 
Or asked on StackOverflow for the particular something that you know you don't know.
 
Exactly. Often when the user says 'I have working code, but can it be better?' they know it can be better, but don't know how.
This is the theme for almost all questions on CR.
I see that as being on-topic.
Does my code have a fat ass?
 
4:40 PM
xD
How can I apply make-up on my piece of code?
 
nononono...
my code has a fat ass.
how do I perform a liposuction?
 
@Morwenn there is some history:
41
A: How is this site different from Stack Overflow?

Jeff AtwoodDid you not read the FAQ at all? About page What topics can I ask about here? As I said on Twitter, this site is about asking Does this code make my ass look fat? In other words, general broad-spectrum subjective feedback about blocks of code you've written. Stated another way, on Stac...

 
A website for people who want callipygian code.
 
0
Q: PHP login system - is it secure?

Mr JackI have created a PHP login system based off of this site. My main concern is: Is it secure? I chose that because to me it looked secure, but a 2nd or 3rd opinion never hurts. The idea of the project is to have something I can just pull into a new project directory and start off from there depend...

1
Q: Python Hangman Program

DaimyoKirbySo to learn python I've been working through Learn Python the Hard Way, and to exercise my python skills I wrote a little python hangman game (PyHangman - creative, right?). Anyway, here it is: #! /usr/bin/env python2.7 import sys, os, random if sys.version_info.major != 2: raw_input('This...

 
/me gone to the another world.. ciao all :)
 
5:11 PM
^^ scary shit
 
which??
 
Did you flush?
2
 
"gone to another world" ...
 
0
Q: ReactiveUI and Rx background calculations with cancellation

WilkaI'm working on a WPF app which uses ReactiveUI and Rx, there's part of the workflow that watches two data sources (ReferenceData and PredictedData properties on a View Model) and an area of that data source (FocusArea property) which is used to show a line graph of that data. Sometimes there ...

 
@Vogel612 sure it's easier to do it in chat. Doesn't mean that chat is the correct forum for such important discussions, just like @Jamal said.
Hi all, I'm back from work
 
5:17 PM
Hi @Simon
 
last, final attempt.
0
A: One-liners and other narrowed-down reviews

Mat's MugLet's take a fictional example: Sometimes I have a function that returns a Boolean, but I'll put a guard clause in the function to raise an error if a certain condition isn't met: If MyCollection.Count = 0 Then Err.Raise vbObjectError + 9999 Would it be better to just do this? ...

 
I see....
I am also part way through a follow-up answer
 
@Vogel612: I have declined your latest two answer flags. They do offer sufficient explanation and do not warrant deletion. Since others disagreed with those flags, they were considered disputed.
 
@Jamal I'm fine with that ;)
I was disputed with myself there, but I thought, better flag and get a decline, than not flag and have some "bad" answers around
 
5:32 PM
Okay. Well, now you know. :-) In general, you should look for three types of answers:
non-answers (new questions, "thanks", other garbage)
code-only answers (zero explanations)
link-only answers (flag with custom for moderator evaluation)
 
(On SO) what do "active" flags mean?
some have been active for a few days
 
It means they haven't been cleared yet. What types of flags exactly?
 
If the flag is for closing a question ti will put the question in the close queue, and will only be marked as helpful if someone vote to close the question
 
@skiwi I got flags on SO, that haven't been processed since July first '13
 
I still have lots of close flags. Those will be sitting around for a while.
 
5:40 PM
If the flags are not about closing, then posting on MSO and asking about the still active flag can help. I believe others have done that in the past.
 
flags on answers I guess @Jamal
 
0
A: One-liners and other narrowed-down reviews

rolflSummarizing some chat, and other perspectives. Also providing more context than the 'counterpoint' answer I gave previously. The 'Real Issues' There are three issues at hand... is there a threshold of 'enough' reviewable content? (and then, an obvious follow-up question is how-much is needed,...

 
I'll dump all of them on there then :o but not today
 
Hello @TheGuywithTheHat
 
Oh, no, it's that guy
 
5:41 PM
@syb0rg Hi
@rolfl ???
 
@TheGuywithTheHat Welcome to The 2nd Monitor!
 
Hey, you're the guy with the hat.... you're him
 
@skiwi About AI, which is a subject that I also am highly interested in (but not that often have enough time to work with), I can suggest reading [Artificial
Intelligence - foundations of computational agents](http://artint.info/html/ArtInt.html). I'm reading a bit in it myself every now and then
@TheGuywithTheHat Never mind the monkey (@rolfl), he's just... being a monkey...
 
Banana?
 
Yes, I have one in the kitchen.
 
5:43 PM
@syb0rg Thanks! @rolfl Do you know some other guy with a hat?
 
I'll save that link @SimonAndréForsberg Thanks for reading back or remembering
I am fighting with shadow mapping at the moment
 
user image
3
 
@skiwi I also have my own little approach for making AIs for games that I work on, you can read a question of mine at Computer Science, I will also put the (Java) code up for review later on:
13
Q: A scoring approach to computer opponents that needs balancing

Simon André ForsbergThis question is about an approach to computer opponents that I have created and are either currently being used, or are planned to be used, in several computer games. Background Last year, when trying to improve a computer opponent for a game called "Minesweeper Flags" (short description: A tu...

 
@rolfl you got my vote there. I can agree to downvote them instead of closing. I'll even comment why I downvote, and will kindly ask the OP to add more meat to their post if they want my downvote retracted
 
@rolfl please no, I get enough of that at home, I don't need it here too!!!
 
5:49 PM
Got the backyardigans?
(if not, you should)
 
quite intersting @SimonAndréForsberg
 
@Mat'sMug Good answer:
2
A: How can I solve my constructor injection code architecture?

Mat's MugYour question isn't crystal-clear about what it is exactly that your code is supposed to be doing. We have to infer the functionality from this block of code: public void Start() { List<Network> networks = context.Networks.ToList(); foreach (var network in networks) { // cre...

 
I'm not that advanced yet...
 
thanks Santa! (got yet another [badge:revival] - not that I'm getting anywhere near our JavaScript-Zombie-Killer-Energizer-Bunny)
@syb0rg thanks! ...but I can't award myself the bounty :(
 
@Mat'sMug Yeah, that's the sad part..
Why didn't you just edit your previous existing answer?
 
5:52 PM
@skiwi Thanks. If you have any comments on it, I'd love to hear them. I'm honestly not that advanced either, it probably looks a lot more advanced than it actually is. Are you also trying to develop some AIs for games specifically?
 
@syb0rg I considered. But the comments would have been moot, and besides it's a totally different answering approach.
 
Well at some point yes @SimonAndréForsberg I'd develop it for anything (apart from washing machines) though, if there is a good reason to do so
I'd be intersted in having our chess bots compute
err... compete
 
I don't have a chess bot, and I honestly don't have any plans on making one either :)
 
lol
3
 
Off-Topic asking for code to be written ▼▼▼
3
Q: Building <div>text</div> inside a while loop

MinAI use the following code <div><?php echo $obj->text; ?></div> in while loop. Is this the best way? Is there a better way, either to optimize or replace this code? <?php $akhbarkotah1 = $conn->prepare("SELECT text,time FROM small WHERE active='0' ORDER BY time DESC LIMIT 10"); $akhbarko...

 
5:56 PM
April 2014: write a chess bot?
 
see my comment on my answer
 
I'd love to have our future Ultimate TTT bots compete though :)
 
@Malachi isn't this comment a little ...ya know?
so in other words you want us to tell you how to code this using a For Each? because that is OFF-TOPIC on this site. — Malachi 1 min ago
 
Weren't you writing something for competitions @SimonAndréForsberg ?
 
@Mat'sMug harsh?
I guess a little bit....but.....
 
5:58 PM
OFF-TOPIC caps bold, ;)
 
@SimonAndréForsberg @Mat'sMug @skiwi fightcodegame.com
^^^ AI competition.
 
@Mat'sMug There's just one problem with that.... you need to have votes to downvote with ;-)
 
he tried to trick us
 
javascript... ugh
 
@rolfl I know, I'll get started... tomorrow ;)
@Malachi yeah that's a little infuriating.
 
5:59 PM
@Malachi I'm voting to close as unclear what you're asking because I just don't understand what the OP is looking for
 
Vote-maxing early in the day removes options for things that come up.
like review queue
 

« first day (303 days earlier)      last day (3719 days later) »