@DJanssens @Duga currently scans for comments mentioning Code Review and Programmers, and Software Recs. She determines whether or not the comment is recommending the asker to post on that site, and it is in that process that I thought n-grams could be used (somehow), so that she knows that some words can be replaced with other words and therefore it is easier to know whether or not the comment is a suggestion to post on another site
@Mast I don't really see how that question would belong at Programmers...
@Yann If someone would come in with broken code and ask for how to fix it, that would also be closed, but these are three different close reasons, is it not? I doubt that 100k line code would be closed as being "example code".
@SimonAndréForsberg The user is basically asking whether that snippet of code is idiomatic or not. I recently asked something similar on Programmers without trouble.
@Yann No, that would actually be allowed. As long as people stick to the character limit of-course and insert enough context.
Several questions (including some of mine) have lots of code. Some of those have ridiculous amount of code and should probably be broken into two, three, sometimes even four questions.
When it's a recent post, we can comment and ask the OP to edit and often they'll happily comply.
But when it's...
What 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...
While Stack Overflow questions often contain segments of pseudocode or purposely abbreviated code in order to make the question more palatable to other readers, for something like a Code Review, the asker is generally going to have to post their actual code that composes a given system (otherwise...
@Mast I never seem to learn what's on topic on Programmers. I just don't want them to end up getting our trash as well. Before recommending Programmers to an OP, I'd recommend visiting the Programmers chat room and asking them about it.
Obviously related to this, but I want to know the opposite. How short is too short? For example this doesn't seem long enough to be appropriate for a code review:
Highlight input if empty
The entire code sample:
/* highlight input, if it is empty */
$(function() {
var highlight_if_no_val=f...
Every 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....
I recently asked this question: Random value excluding both limits
The code to review is as follows:
do {
var random = Math.random();
} while(random === 0);
I know it is short and looks like stub code, but it actually is my real live code to generate the random number. I did not simplify ...
@SimonAndréForsberg I didn't recommend it to the OP for exactly that reason. As long as I'm not 100% sure (or as sure as one can be) I won't make such recommendations.
I recently asked this question: Random value excluding both limits
The code to review is as follows:
do {
var random = Math.random();
} while(random === 0);
I know it is short and looks like stub code, but it actually is my real live code to generate the random number. I did not simplify ...
> While the warmer weather is being enjoyed by many, governments advise people to stay out of the sun during the hottest part of the day, use sunscreen when outside and drink plenty of water. (from BBC)
I would have expected people to be smart enough to realize that, without the governments having to advise them...
Have I over-ridden GetHashCode properly in the below code?
public class ODPair
{
#region Constructors and Destructors
public ODPair(string origin, string destination)
{
if (string.IsNullOrEmpty(origin))
{
throw new ArgumentNullException(origin, "Origin of...
@SimonAndréForsberg So Dugo just looks for the string 'Code Review', 'Programmers' and 'Software Recs'? Or How does the determination of it being a recommendation take place?
It opens up a new can of worms for testing the application though, right now it mocks most of the stuff, but then I need to actually test inside a Spring container
I could inject a Clock that always shows the same time
@DJanssens for Code Review and Software Recs, it is that easy. For programmers, because of it being a common english word as well, it looks for certain series of words that are often being used for suggestions to post at other sites and then it gives scores to the words, and if the score is above a specific range, it posts it. See github.com/Zomis/Duga/blob/grails-dev/src/main/groovy/net/zomis/…
I use an online file backup service (Backblaze) and recently got a new computer. Several files on my old computer were too large to move via my usb drive so I decided to download them from my backup service.
Specifically the files included 3 videos consisting of about 20GB.
However...when I pro...
public class LinkedListReverseKthPosition {
private Node root;
private int size;
public static void main(String args[]) {
LinkedListReverseKthPosition ls = new LinkedListReverseKthPosition();
ls.addFrontNode(10);
ls.addFrontNode(11);
ls.addFrontNode(12);
ls.addFrontNode(13);...
@Yann No. I think the zip was incompatible with the default extractor. The extractor didn't know that, went looking for data on the wrong place (or actually for wrong data on the right place) and parsed the data to a number.
I've created a program where the user is, at first, presented with a window with a yellow circle (random size, random coordinates) and a Start button. Once the user presses Start, the circle, when hovered over, will turn red in color and when it is clicked, another circle (random size, random coo...
I have implemented the gossip algorithm in distributed systems. Kindly review the code, and advice on what to improve on.
Gossip class
import random
import socket
from threading import Thread
import time
class GossipNode:
# hold infected nodes
infected_nodes = []
# initialization...
Really short question: I have a namespace called Controller, which logically contains all the controller classes of my application. However, I have an abstract class that contains all of the common logic shared by all my controllers. The logical name for this abstract class is, to my mind... Cont...
@200_success I promise I won't discuss with you about your answer, but I feel I have to ask. Do you consider to nominate yourself for moderator election ?
@200_success I still don't know. Have a little bit of a timing and language problem. Almost no time and not english native. Have to look up to many words..;-) I have the feeling that for me the spare time I have, also I am always arround here, is better invested in answering questions.
@200_success "People do, however, get used to said functions and when they come to a better designed language they get lost because they have to implement some of these somewhat vapid functions themselves."
@DJanssens I've thought about it as well, it's possible if some people in here could classify 100 strings each, but haven't had the time to implement something like it
In addition I don't really know if the accuracy will be good enough. The keywords that are used atm are handpicked and of high quality. If those appear you are pretty certain they are talking about Programming SE. So tbh I'm not 100% sure if it's gonna be better.
There's a problem, though. "Fixing" the mess can't make it better. Part of the problem with PHP is that there is no coherent design; everyone just implemented what they wanted. You would just be adding yet another way of doing things.
I think you're too focused on what you want to ask a question about other people's opinions. AFAIK most people want to keep their code syntaxes separated; now I'm in JavaScript so I write JavaScript. Now I'm in PHP, now I write PHP...
It's up to you to draw the line of what's worth your time, but I'm just saying that only you having the use of it does count as it being of use. I'm sure there might be someone else who'd like it, but I don't think the general populous of PHP programmers are dying for it... (I'm sure it would have existed by now in that case)
Yeah, it's hard to be the innovator though. If you want to be the savior you need to make up something that doesn't exist yet that people will love when they see it.
Like Node.JS
If you had asked people if they needed a serverside JavaScript they would have said "no" now people love it and it's spreading like a plague ;P
@Vogel612 But imagine what it is to spend 3 days writting something and then everybody looks at it and says: "This is worst than PHP's original library!"
@Gemtastic I know, and that's why I wanted to write it
The following implementation of push-relabel with gap heuristics seems to work in my test cases. However, it fails to be accepted at an online programming problems platform ("wrong answer").
I was having a hard time understanding push-relabel, but I think I now understand it well enough. Still I...
I'm currently learning Clojure to try to get a good understanding of functionnal programming, so I wrote this brainfuck interpreter that takes a filename on the command line. I tried to make it as correct as I could, but I'm sure there are many things that would make more sense that I didn't thin...
I've been recently working on a custom rational number implementation. Due to not very interesting reasons, using this implemetation is not an option.
I'd appreciate comments of anyone who has the time to review the code. The posted code is free to use, so you can make good use of it should you ...
I have two tables with different no. of records as below. I need MSSQL query to display the result. Can anybody help this.
Table 1
WoNo DelvNo DelvItem DelvQty
WO\23 DLV-20 34s C YARN 750
WO\23 DLV-20 40s C YARN 750
Table 2
WoNo RcptNo RcptItem RcptQty
WO\23 RPT...
Really short question: I have a namespace called Controller, which logically contains all the controller classes of my application. However, I have an abstract class that contains all of the common logic shared by all my controllers. The logical name for this abstract class is, to my mind... Cont...
Also you are having only a naming question, you should nevertheless post the whole code here. Code review is about "review of any and all aspects of the code" so usually this question would be closed as off topic. Give us a chance to review your code. — Heslacher10 secs ago
@Vogel612 If it's about code, yes. If it's about style or UX, which I thought at first instance, it isn't. In this case, it could be on-topic if the question is phrased well.
The following implementation of push-relabel with gap heuristics seems to work in my test cases. However, it fails to be accepted at an online programming problems platform ("wrong answer").
I was having a hard time understanding push-relabel, but I think I now understand it well enough. Still I...
@AlexeyStolybko So basically you search a solution (which is off-topic like MicroVirus pointed out) and neither want to do a lot of coding or install software on the servers ? If you want to stick with File.Copy you should show us your code and ask how it can be changed, perhaps this is even a topic for the codereview area of stackexchange. — Marged35 secs ago
@Mast That question (Push-relabel with gap heuristics) is not fine — the OP is essentially asking us to debug their code. We only have their word for it that the bug is to do with "edge cases".
Question, if you encounter a question on SO that is fit for CR but that is already answered, should one still comment that it's better to post it on CR next time?
I currently have this working code for computing the new centers within the K-Means algorithm:
/* Delta reduction and accumulate new centers */
delta = TOD(0.0);
for (i = 0; i < SIZE; i++) {
cluster_id = membership_new[i];
new_centers_len[cluster_id] = new_centers_len...
I'm trying to implement a Collider class, extended by Circle and Rectangle which will have to interfere with each other to test collision, or if the other Collider fits into "*this".
I tried to implement it as a template class, but I can't get it to work, as I get many errors about templates.
I m...
Okay, so I answered that one question here, and I've been told that it's the wrong answer here. Should I delete my answer, or would it be better to leave it be?
I have no particular reason to believe that I'm right over Emily
The obvious course of action would be to find out how it really should be done and improve your answer with that. If you dig deep enough and take your time, you could even write a better one than Emily did.
@Mast You might be right with that, although I'm pretty sure that that would require more effort than I'm currently willing to put in for that particular thing
I think that the only reason I'd leave it there is if she didn't give my answer as context. Given that she did, I think that probably answers my question
@Mast That translation isn't accurate. It's a general word for something that's (kinda) good enough. If you want a banana but they only have apples and though you don't mind apples at all, you wanted a banana, but now it's apple or no fruit so it's good enough (det får duga)
I suppose you can translate that scenario into "it'll have to do" (det får duga)
But the proverb that something's named duga is an expression of that something's awesome