« first day (1928 days earlier)      last day (2074 days later) » 
00:00 - 20:0020:00 - 00:00

12:00 AM
RELOAD! There are 5479 unanswered questions (89.9797% answered)
 
0
Q: Python - create new columns using groupby in pandas

Atroposrunning into a large bottleneck in my program that takes hours to perform. I have a Dataframe that is very large. I need to take the columns of the Dataframe and create new columns within same Dataframe. the new columns need to grouped by a specific date once grouped they are ranked . after...

 
12:47 AM
0
Q: Can I use "SyntaxError" for an error even if it is technically a "ValueError"?

StrangeRangerI got this program that I am working on and in it, I got a section that has a try statement and two error except statements. try: ... if ...: raise SyntaxError except SyntaxError: ... except ValueError: ... The thing is that the SyntaxErrors are technically ValueErrors, but th...

 
 
1 hour later…
2:02 AM
0
Q: Generic Single Linked List with smart pointers follow up part 3

SnorrlaxxxOkay, this will most likely be the last post I make for Singe Linked List unless significant revision is needed. This post following from here. Shout out to @hoffmale for showing me the ways of the force. Here is the header file: #ifndef SINGLELINKEDLIST_h #define SINGLELINKEDLIST_h template

 
 
1 hour later…
3:18 AM
0
Q: initialising the variables

Michael GeuensHello Stackexchangers, I started to learn c# and while i was writing the same code 100 times in a row, i was wondering if my design is not optimal or i am writing sloppy code. private void initialiseerVariabelen() { int minimum = 0, maximum = 100; trackBar1.Minimum =...

 
4:04 AM
0
Q: Recamán Sequence (A005132)

CarcigenicateI'm going to screw around with visualizing Recamán's Sequence, but want to have a good sequence generator to generate the sequence before I start. I want to use a lazy generator for my actual application, but decided to make a strict version first since it will likely be simpler. This is what I ...

 
4:33 AM
0
Q: Async Await Task for HttpGet

Coder AbsoluteThe following C# code is written to fetch the Categories data from SQL Server Database using Asynchronous Task for HttpGet. The Dapper library is used as ORM. I need help to identify whether the Async Task implementation is correct or any better way to implement? CategoriesController.cs public...

 
4:48 AM
0
Q: FizzBuzz in Common Lisp

Braden BestWhere I stand on Lisp So, Lisp. It's been on my radar for years and I'm finally getting around to learning it. The syntax is foreign but I find I'm having the most difficulty in the areas of semantics and the standard library. The symbol semantics are giving me tremendous trouble for sure, mainl...

 
5:02 AM
thanks for the code review. I can see definitely yours is working. I output my base64 from a console.log so maybe it went bad in some way. Thanks again. — macm 11 secs ago
 
Monking
 
5:18 AM
Monking
 
5:35 AM
Monking
 
6:00 AM
I'm voting to close this question as off-topic because it is more suitable for codereview.stackexchange.comMad Physicist 37 secs ago
 
6:19 AM
0
Q: A thread safe task queue implementation using my own lock_guard in C++

meguliAs an exercise in multithreaded programming, I am trying to implement a basic FIFO task queue. For this, I also implement simplified version of my lock_guard, from STL. Here is the code: #include <mutex> #include <iostream> #include <thread> #include <chrono> #include <optional> namespace cho {...

 
I'm voting to close this question as off-topic because the question has been moved to codereview already. — Lasse Vågsæther Karlsen 10 secs ago
 
6:33 AM
I'm voting to close this question as off-topic because this question belongs on another site in the Stack Exchange network: Code Review. — vishes_shell 22 secs ago
 
6:49 AM
@vishes_shell No! The current code does not work as intended. Which means it's absolutely off-topic at Code Review. — Mast 47 secs ago
 
@Duga Oddly enough I'd consider that a valid close reason. Of-course, it doesn't need anything specific since 'Too broad' works just as well, but hey...
 
-1
Q: code questions with approprate queries and also indicating the basic algae and fungi to respond to the outer areas and cities

karthikThe catchment area is having a bad association with the hungry man. The popular things which are common for the involvment of the understanding of the statement is the perusal of the images and though avoiding the sensor . Please understand and will you ?

 
@CaptainObvious HAMMERTIME!
 
7:05 AM
0
Q: Write a javascript code to zoom an image from the existing image

karthikPlease write a javascript code to zoom an image from a already existing image.I am very confused and I am working here as a fellow. Please help me to write this code and I will be expressing my gratitude forever

 
7:22 AM
monking
 
7:37 AM
Maybe put this on codereview? — hd1 57 secs ago
Don't forget to read how to ask before posting there. — Mathias Ettinger 57 secs ago
 
0
Q: can this be made any faster?

Ryan Im trying to match the pixel spacing between two folders, here matches has 994 keys and it shows that i may take more than a day to compute this. Is there any way i can speed up this operation. the load series function looks like this import SimpleITK as sitk def load_series(path): reader ...

 
8:01 AM
Monking
 
 
8:20 AM
@CaptainObvious That's the same bloody fool as this question
 
0
Q: (short) Throttling failed requests mechanism

fskdjweI have a simple event that the cleint sends to the server, the server can then respond saying if it was successful, or if it failed for some reason. The client has to send a auth code, which is inside their config class. Below I attempt to throttle it, allowing 2 attempts, then reloading the co...

 
Aram, please don't promote a product or service here. Also, please remember that your question is about how many fields in a class, not about code review tools. Lastly, please answer my questions, specifically why 15 fields. Why not 14, 16 or 17? — LBear 50 secs ago
 
8:33 AM
@Mast At least both are closed now
 
Monking
 
8:58 AM
Aram, please don't promote a product or service here. Also, please remember that your question is about how many fields in a class, not about code review tools. Lastly, please answer my questions, specifically why 15 fields. Why not 14, 16 or 17? Personally, I like prime numbers, so 17 is my choice. That last part is an opinion, by the way. — LBear 28 secs ago
 
9:51 AM
0
Q: Correct architecture to use the same activity for insert and update operations

Florian WaltherI have Activity1, where I display Room database entries in form of LiveData in a RecyclerView, and Activity2, where I have the necessary fields to add and update new entries. I wonder what is the proper architecture to build this kind of situation, where Activity2 has 2 roles (create and update)...

 
Read How to Ask, help center and perhaps try this on Code Review - but not with a screenshot of your code, and not with this literal description. Voice your actual concerns, and not "fix anything in this code you find wrong with it please". — CodeCaster 50 secs ago
I'm voting to close this question as off-topic because it's a code review. — CodeCaster 44 secs ago
@CodeCaster Don't you care redirecting crap like this to Code Review. A question of this quality should be fixed before redirection pops up in anyone's train of thought. — Mast 39 secs ago
Imo, It's not a code review. The question for now need big edit. "how can i improve" is not enought context. — xdtTransform 43 secs ago
 
10:06 AM
0
Q: Neural network Numpy - Gradient and L2

Blue SKy314I have a neural network for linear regression: class Neural(object): def __init__(self,x,y,hiddensize1,output_size,cost=None,alpha=0.01,reg_coef=0.1): std=0.1 self.x=x self.y=y self.hiddensize1=hiddensize1 self.output_size=output_size self.cos...

 
10:33 AM
As @Shazu said. This would be better suited to Code Review. — Darren Bartrup-Cook 1 min ago
 
10:50 AM
Monking
 
0
Q: Best way to replace variables in Text Template

Mister 832What would be the best way to replace in a long text (about a page) up to 10 variables. I feel, that there would be something more elegant than this: string s; s = string.Format("Lorem ipsum dolor sit amet, consetetur {0} sadipscing elitr, " + Environment.NewLine + ...

-1
Q: Python ABS Chapter 8 - Allow users to change words in a text via Input

user177233So the assignment is: Create a Mad Libs program that reads in text files and lets the user add their own text anywhere the word ADJECTIVE, NOUN, ADVERB, or VERB appears in the text file. For example, a text file may look like this: The ADJECTIVE panda walked to the NOUN and then VERB. A nearby ...

 
Monking
 
11:07 AM
0
Q: SQL/PHP Laravel - Looping through records to find relationships

oliverbjI have two tables in my database, which contains a big list of organisations. They are called orgs_main and orgs_sub. This is the structure: orgs_main: id | code | name | address | ---------------------------- orgs_sub: id | code | name | address | merged | ---------------------------------...

 
11:17 AM
@sineemore About this:
Hi, @tushar. The code in the question is incomplete. We only review real, working code. Ideally it must compile without changes. I've checked your GitHub repo and suggest you to post all relevant code here in the question body so it can be reviewed. — sineemore 14 hours ago
Did you notice the age of the question?
Why do you think it's incomplete?
The repo is there for context, the code in the question can be reviewed.
 
@Mast: That code is missing imports at the very least
oh, and definition of the MapReduce type
 
@hoffmale Both can be found in the GitHub. I've included them in the question. Anything else?
 
I still think there are some borderline issues (relevant code not included in question/lacking context)
 
11:33 AM
If your code is working correctly and you are asking for possible improvements then codereview.stackexchange.com is a better place to ask. Make sure to read their FAQ first, and choose an appropriate title. — Martin R 47 secs ago
 
@Mast (A bit exaggerated) It's like getting a review request for void my_vector::push_back(const T& val) { return emplace_back(val); } The important parts are missing, even though the code might be totally correct
 
@Mast
I see several issues: types WorkerInfo, DoJobArgs, MapReduce, DoJobReply, Map, Reduce are missing. Same stands for their mehods and fields (both exporteed and unexported) that where used in provided snippet. Function `call` is missing.
 
@hoffmale The context is in the GitHub.
Code doesn't have to compile straight from the question.
3
 
IIUC relevant context has to be included in the question, as links might get broken over time
 
It has to work. But if additional files are required, as long as they tell you how to get it to work, it's fine.
 
11:41 AM
So... Going by your logic, technically I'd be fine requesting a review for each function of a type individually?
As in one question per function
 
@hoffmale We have had people ask for a review of one function on one class. It's not off-topic.
 
@hoffmale That's the argument we use against code and challenge descriptions behind a link, since code becomes unreviewable if the link breaks (there no longer is any code). If the problem statement is already in the question, it's a bit of a grey area I guess.
How much is enough.
 
The biggest single problem I have with the code is that it relies on some non-obvious signaling mechanism (who writes to those channels?) - and without that context, one simply cannot see whether that function is working correctly
 
@hoffmale Feel free to leave a comment telling exactly that.
 
@hoffmale it's not really relevant who writes to the channel, is it?
it's relevant what is written to the channels
 
11:45 AM
The rest I could try to guess, but I'd have to rely on assumptions simply made by function names
Yeah, what is written is important
e.g. If there isn't enough, the function will wait forever
 
@Mast
I really don't see a meaningful way to review the provided snippet. If we strip all unknown types and functions it becomes a bunch of `go` statements and channel operations. Not that much to review.
@Vogel612 Mostly true literals and unknown variable worker. Also not that much.
 
Relevant meta for the discussion at hand:
47
A: Can I put my code on a third party site and link to the site in my question?

Simon ForsbergNo. We require the code to be contained within the question, for the following reasons: To avoid dependency on third-party hosting services. These links tend to go away after a while. To prevent review requests of huge projects. To make it easier to see the code and so it can interest more revi...

 
@MathiasEttinger That's about only hosting on a 3rd party.
11
Q: Asking questions - including full code

tlovelessIn my first CR question, I was looking for feedback about my implementation of a graph data structure and an algorithm for depth first traversal, as I am studying these at the moment. Although I appreciate many of the reviewers' comments, there seemed to be a focus on code that I deliberately pu...

 
> If your code is too long (doesn't fit within the 65 000 character limit for posts on Code Review), please select only the portions of the code where you are especially interested in getting reviewed. In such a case, you may add a link to a site where more of your code can be seen, but don't expect anyone here to review it.
 
@MathiasEttinger They've already done that. The problem now is how much is enough, which isn't explained in that meta.
 
11:56 AM
^^
> The code that you want to have reviewed should be included.
That's key.
 
lines in the sand, people
 
After that, it gets a bit grey.
 
@Mast: Going only from the code as posted, submitJob cannot possibly work as intented, unless some very relevant context is missing. it first tries to read from the channel (?) mr.registerChannel and only afterwards (and with a condition) writes to it. If mr.registerChannel isn't primed / written to somewhere else submitJob cannot work. What should I assume for a review?
 
if you consider the question to not have enough context, you can comment or even VTC as unclear
we even have a close-reason for pseudocode, though that one is somewhat unintuitive in how users understand it
 
@hoffmale For the record, I didn't invent the site wide policy.
If you feel current policy is insufficient(ly clear), there's always the possibility of taking it to meta.
 
11:59 AM
another thing: not everyone needs to agree on the topicality or answerability of a question
 
> What should I assume for a review?
Would make for a great entry.
 
I've taken to explicitly calling out assumptions that I make in my reviews, where necessary
YMMV :)
 
My verdict currently is that the question as-is cannot be reviewed meaningfully without going through a lot of the code on github, because the snippet itself is either missing crucial context or not working as intended.
 
@hoffmale go vtc, add a comment :)
that's how community-moderation works
tip: if it's not working due to a subtlety it's useful to note that in a comment
cv-reviewers have a much easier time then
 
@Vogel612: I wouldn't call "reading from a channel before anything gets written to it" a subtlety
It's like unlocking a mutex before a lock was acquired
It just screams something wrong/weird is going on here
 
12:05 PM
@hoffmale hmm ... I don't know how channels work in go...
 
channels are basically a blocking message queue
default capacity of one element, though that can be increased
 
soo ... basically like a "place" in a petri-net
 
@hoffmale, default capacity is 0
it will block untill received, no buffering
 
@sineemore: capacity of 0 would also mean sending on a channel blocks in all cases
as there is no place to store the message
 
12:09 PM
huh
okay
seems like i was wrong
 
No worry. Except for default capacity it's all right.
IIRC :)
 
@MathiasEttinger (and others that know dataclasses) Do you know if there's a simple way to convert from a dictionary to a dataclass? I know dataclass -> dict is asdict.
 
@Peilonrayz like the_dataclass_instance = TheDataclass(**my_dict)?
 
@MathiasEttinger Sorry, I mean a nested dataclass.
I guess just using a helper that works like your code, and then recurses off type could work
 
12:28 PM
@Peilonrayz Soo… more like
6
A: Store nested json repsonses in relational database

Mathias EttingerYou don't use typing properly. Parametrizing generic types should be done using brackets notation (aka __getitem__) not parenthesis (aka instantiation). You also don't use any feature of dataclasses in your defined classes, so you might as well drop that dependency. Or you could use it properly ...

 
@MathiasEttinger Yeah that looks right. So you can just use a __post_init__. Nice, :)
 
12:53 PM
0
Q: How can i optimize my Go code?

tramwayMy code excellent working, but he very slow. What does my code do: Step 1. Connecting to 30 DB (consistently) Step 2. Copying DB file to temp.dat Step 3. Reading temp.dat Step 4. Writing read data to file. So 30 times with different databases. This take 6-7 second (on powerful notebook), but...

0
Q: Decorating super class methods in subclass definition

Alex EshooI am sub-classing an object in python and I need to overload a bunch of the methods with very similar logic, essentially a call to super() and then some additional operations. I want to avoid explicitly writing out each of those overloaded methods in that way, so I implemented a decorator. Is th...

 
0
Q: How much context is enough?

hoffmaleThis question got sparked by a recent discussion in the 2nd Monitor about this question: Golang Map-Reduce Master - Channels. The problem is: How much context is needed to actually review the code in the question? How much should the reviewer assume about functions/types/object states which are ...

Hmm... maybe I should adjust that title a bit
 
0
Q: How much context is the required minimum?

hoffmaleThis question got sparked by a recent discussion in the 2nd Monitor about this question: Golang Map-Reduce Master - Channels. The problem is: How much context is needed to actually review the code in the question? How much should the reviewer assume about functions/types/object states which are ...

 
faster than Feed
lol
 
@hoffmale, does it make sense to provide a link to discussion?
 
I tried to include the relevant parts in the question itself, but I'll add a link (so noone can accuse me of not giving enough context)
 
1:06 PM
@hoffmale I was going to write an answer, but I ended up dumping it.
 
@202_accepted: I'd be interested to hear why you dumped it. Too hard of a question?
 
No I am just lazy and don't have time to finish it.
Personally, I think that question is fine. Sure, there's setup required, but there's no "Your code must be copy-pasteable from the question to an IDE/Compiler/Interpreter/Whatever to be run" rule.
The rules are that you must provide sufficient context to understand the purpose, you must own it, etc.
No rule about "it must be able to be run directly", which I think is the issue here.
 
I never said "it must br able to run directly"
 
@202_accepted This was my fault at stating this as requirement in the comment under the question. Yep, no such rule. My point was - it makes things easier.
 
@hoffmale No, but your idea is that "there is more setup required to run the code than should be acceptable", which is on the same foundation.
The basic "gist" is that the code doesn't have enough "context", but it does. The OP talks about the purpose, the why, the how, etc. The OP just doesn't talk about "prerequisites."
I mean, if "too much setup" is now a valid reason to ditch a question, there are quite a few that should be gotten rid of.
I've had to Frankenstein a lot of questions to test them, but, unfortunately, that's life.
@sineemore Sure, it makes things easier. So do test-cases. Which should we require?
 
1:15 PM
@hoffmale did you see the conversation that @ThomasWard started last week also?
 
@202_accepted Sorry, don't quite get it.
Which test cases?
 
4
Q: Need clarification on my close reason interpretation for a specific close reason

Thomas WardThe question Does this method guarantee that cells in a CSV will be correctly partitioned? is a duplicate of this one (10k+ and mods only) which asks whether a singular function properly 'escapes' bits of text from a CSV when handed to the function. My personal opinion is that it does not meet t...

 
@CaptainObvious Hypothetical code
 
@sineemore Should we require test-cases? Because that's the same type-of-idea here.
The idea is that we "need to be able to verify the code works", but that's not always the case. If the OP makes the affirmation that "the code works to the best of their knowledge", then that's good enough for me. If we find a bug, so be it.
Basically: I think the question is perfectly valid, and there is no "hard minimum" on the amount of context required.
 
FYI
0
A: How much context is the required minimum?

MalachiI think that an excerpt from my answer to Thomas Ward's meta question provides a good starting point for nailing down the whole "context" thing. This is how I feel about context personally. This may or may not be how Code Review feels as a community The Last Piece of the puzzle Conte...

@202_accepted you may be interested in my answer, I think that it is short, sweet and to the point, almost exactly what you are saying
@Mast how so? I figured this might turn into a lengthy conversation.
if you know the code base and the library, and still can't figure out what they are doing it should be closed, right?
we are only talking about context, not about whether there is enough code to be run.
 
1:30 PM
@Malachi Absolutely, but where do you draw the line from that to "this is perfectly reviewable"? There's a grey area in between how clear it is what the code is supposed to do.
 
if there isn't enough code to be run, that is a different type of context that is defined by the other 4 items of that close reason
 
I think I shouldn't be grepping and running a wc -l over all files in the repo ... that seems like a recipe for disaster
 
@Vogel612 that needs more context for me
 
totally unrelated and somewhat intending to derail the conversation here :)
grep: search through files with a regex
wc -l: count lines in files
 
but totally perfect for the conversation....
someone with enough knowledge about the languages involved would not need more context
I could go to a lot of questions and not know what is going on, I would need more context.
yes there is grey area. if you think it is in the grey area, leave it alone and let someone else handle it that has more knowledge about the language and libraries being used
 
2:01 PM
This would likely be better posted on codereview.stackexchange.comScriptable 18 secs ago
 
was pinged, looks, then walks back out to do his day job
 
2:30 PM
possible answer invalidation by User319 on question by User319: codereview.stackexchange.com/posts/201528/revisions
 
Greetings, Programs.
 
@Duga Adding example usage, should be fine
Greetings, User
 
for anyone interested there is a room for discussing the close reasons --> chat.stackexchange.com/rooms/23988/discuss-close-reasons
6
 
TTQW
 
2:54 PM
0
Q: Project Euler Problem 1 with Python 3 ideal solution

remedcuNewbie Alert! I have been playing around in hacker rank with Python these days, and now pulling my hair out on this question to solve the Euler's problem in the least time required. Without that in mind, I initially wrote the below code: t = int(input()) for a in range(t): n = int(input())...

 
3:36 PM
O HAI
 
3:54 PM
0
Q: Writing a new language using Jison: FreezeFlame

FreezePhoenixReason I decided to write a new language, partially for the challange and for the following reasons: I wanted to implement the pipe operator: |>, the lambda operator: '::' and the hash operator: '#'. Javascript comments were rather jagged, so I replaced /* with @@@ Accessing prototypes was a p...

 
@CaptainObvious new tag:
 
@SamOnela Java Invalid Script Object Notation
 
@Klaus: I'd rather delete this low-quality question, which doesn't even have a Minimal, Complete, and Verifiable example as actually required. Perhaps it could be moved to codereview.stackexchange.com though, but here, it is misplaced. That said, yes, your suggestions are all valuable! — Ulrich Eckhardt 58 secs ago
 
@202_accepted I don't actually care whether I have to do anything to get the code to run. What I do care about are major dependencies on which we as reviewers get no information at all.
 
@UlrichEckhardt Since the code does not work, Code Review won't take it either. — Mast 32 secs ago
 
4:04 PM
Not sure if this was correctly closed as off-topic: codereview.stackexchange.com/questions/201666/…
 
It's hard if not impossible to verify whether some code does what it is intended to do if major parts of the required logic reside in other components.
 
The OP stated that the code only fails some of the test cases due to a time-out, I think this question is on-topic (since we have the tag specifically for this)
@hoffmale Was that a response to me?
 
No
For @202_accepted
 
@hoffmale Sorry, the timing and content threw me off
 
xD
For you: I voted to reopen
(Though some better problem description would be nice from the OP)
 
4:07 PM
@CaptainObvious Since there are no experts on the language available except possibly the OP, who's going to determine whether enough context has been provided?
 
@Mast: Seems like he included the whole "compiler source code" in the question...
 
sigh
 
4:24 PM
0
Q: Using Threading.Timer to update a list of data

user2224583Good Day, Attached is some code I have written for my application. It is an OWIN based web server which connects an Alexa Custom Skill, my security camera feed, and Microsoft Azure Face Api. The number one thing to remember when creating an Alexa custom skill is that the bot times-out after abo...

 
@Mast jison looks like something akin to antlr that automatically cross-compiles stuff to JS
 
@Vogel612 That's about as far as I got, after that it got very CS'ey. Interesting stuff though.
 
not sure why you would want to compile to JS, but hey...
 
4:42 PM
"But it points to a 'squashed' commit, a long list of commit message headers, without detail. Not really helpful." The person who squashed the original commits should generally ensure that the commit message for the new commit is helpful. This may involve editing the old commit messages, replacing them, or adding some kind of summary. The best practice is likely context-dependent. Unhelpful commit messages from squashing can be caught in code review, just like regular commit messages and code changes. — Chris 16 secs ago
So if, in a code review, we find the commit message is in fact unhelpful, is it possible to unsquash it and do it again? If not, then that adds more weight to my feeling that squashing is too dangerous a practice to allow. And yes, it would be by policy—whether squashing becomes part of our policy is something I've been considering carefully, and I'm afraid the 'but reflogs!' counterargument has collapsed now, in my view. — Michael Scheper just now
 
5:00 PM
This question got re-opened:
-1
Q: Project Euler Problem 1 with Python 3 ideal solution

remedcuI have been playing around in hacker rank with Python these days, and now pulling my hair out on this question to solve the Euler's problem in the least time required. Without that in mind, I initially wrote the below code: t = int(input()) for a in range(t): n = int(input()) temp=0 ...

There's 2 pieces of code in there.
If I read it correctly, the first doesn't work for all test cases and the second throws a runtime error.
So, why did it get opened? @hoffmale @Peilonrayz @SamOnela
 
The first one only "fails" tests for time-limit-exceeded AFAICT
So it should be up for review
the second... Well, it fails (runtime error), so could be deleted
 
Pfft
I'll fix it up.
 
Hackerrank is one of those "programming challenge" sites, and there are usually some tests that verify the complexity of the solution.
 
I know, it's just that they forgot to include a problem statement.
 
Honestly, I'm not too thrilled about that question itself, but time-limit-exceeded still justifies a review, though the question can be improved a lot
 
5:11 PM
0
Q: Imprecise value partitioning in if-clause and fail early with exception

problemofficerWhat I Found I stumbled upon this python method: def getMaxFailures(nodeCount: int) -> int: r""" The maximum number of Byzantine failures permissible by the RBFT system. Calculated as :math:`f = (N-1)/3` :param nodeCount: number of nodes in the system :return: maximum permi...

0
Q: Python OOP shared library

snowflakeI am trying to learn OOP by refactoring my existing code (functions only). This example works but I am not sure whether it is pythonic and good practice. I have a shared library which consist of several file with functions: color_spaces.py import cv2 def rgb_to_hsv(image): print ('hsv') ...

 
@Mast You're correct. Your edit's fixed it
 
@hoffmale But why? What makes those more or less important for us to review the code?
 
Because they contain implicit assumptions which aren't communicated to the reviewer, and without those it might be impossible to deduce the actual logic
 
Your question doesn't fit here particularly well, but is a worthy question. Please check "Which site?" for general issues and "Code Review or not?"Prune 36 secs ago
 
Simplest example: If I know a called function will never return null, I don't need to check for that. If that isn't clear to the reviewer, then he can either assume it's working as intended (never returns null) or that it's a bug (missing null check).
Or say you see a call to a function reportError: Does it throw an exception, or just log the error message somewhere?
 
5:20 PM
First example: you should still handle the null, even if it "can't" return one. You should always make it explicit, or leave a comment why it was excluded.
 
Both would be valid assumptions
 
Second example: does it matter? Why do we care? You call to reportError, fine, I'm not reviewing reportError, I'm reviewing what you posted.
Neither of those make the question off-topic. Do they make it a potentially not-good question? Sure.
 
It does matter, because in case it throws, the rest of the function body would get skipped (at least until the next catch)
And you're now unable to follow the logic in the expected error case
 
It still doesn't really matter. What matters is that things work now, and we find ways to do them better.
 
Well... it might matter.
 
5:24 PM
And it might not. The problem is we're speculating about a speculation.
 
auto x = some_function_returning_a_pointer();
if(!x) report_error();
x->some_method();
 
Instead of doing that, we should look at whether or not the question(s) is(are) answerable: do they meet the qualities of an on-topic question?
 
in case report_error() doesn't throw that's a segfault
which is a runtime error, so code not working as intended?
 
@hoffmale While contrived, that still means I don't care. They might want the segfault, who knows?
I purposefully don't catch or accommodate for certain exceptions, because I want them to bubble up.
 
in this case (C++) that would crash the program
no way to catch that
(at least if you're lucky it crashes)
I don't care either whether the exception (if thrown) gets caught or bubbled up. What I care about is whether the logic is sound
And I can't tell that if there are cases where multiple reasonable assumptions on code not in the question itself would be valid
And that example had kind-of well named functions
 
5:33 PM
Well I disagree, but I don't really have time to continue this argument (which is why I scrapped my answer...).
 
6:11 PM
-1
Q: Sum of prime numbers in python

Princy MishraWrite a function sumprimes(l) that takes as input a list of integers l and retuns the sum of all the prime numbers in l in python. Here are some examples to show how your function should work. >>> sumprimes([3,3,1,13]) 19 >>> sumprimes([2,4,6,9,11]) 13 >>> sumprimes([-3,1,6]) 0

 
6:26 PM
0
Q: simple code demo UI

OguntoyeI have a user interface that I designed for a simple code demo the layout is presented like I want it to be, but barely holding up (malaligned components and half-baked animations) I want it revamped and styled properly. I am still getting my feet wet with CSS but would like this to be done p...

 
This better fits over at codereview.stackexchange.comAdam just now
 
@hoffmale, are you using Go for today?
 
not right now
why are you asking?
 
plain interest :)
if u don't mind ofcause
 
i don't mind xD
I currently don't really have a project to work on that interests me
 
6:37 PM
any recent ones?
 
In Go?
 
Actually I just want to chat, perhaps not best time and place for it. :)
 
Err... Give me like half an hour (need to do grocery shopping before the store closes)
 
Sure!
 
after that I'm available for chatting xD
 
6:41 PM
0
Q: Madlib CLI program, replaces string in text file

MusaMad Libs program that reads in text files and lets the user add their own text anywhere the word ADJECTIVE, NOUN, ADVERB, or VERB appears in the text file. #!/usr/bin/env python3 # madlib.pyw - Mad Libs program that reads in text files # and lets the user add their own t...

 
6:56 PM
0
Q: Wrong Java message when adding a new object

Sadeer Thaerpublic void addBird(String art, String location){ boolean found = false; for (int i = 0; i <birdlList.size(); i++){ if(birdList.contains(art)) found = true; break; } if (!found) { System.out.println("The bird is...

 
@CaptainObvious broken code.
Oh my. The tags..
 
lol
 
@Phrancis, are u sure it is not JavaScript..?
:)
 
@sineemore So, I'm back
 
I'm not sure why the OP said the code works. I guess they mean the code compiles without errors. It's clearly giving wrong results...
 
7:09 PM
Well, for loose definitions of "works"...
 
@hoffmale, @Phrancis are you doing CR in spare time?
 
mostly
Unless you're gonna start paying me to do so ;)
4
 
0
Q: C# method for returning valid URLs from a sitemap URL

b4040325I need a method which fetches all of the text from a URL (generally a sitemap URL), and returns an IEnumerable of all valid URLs contained in the text returned from the initial address. What I have so far is: public IEnumerable<Uri> GetSitemapUrls(Uri sitemapUrl) { var sitemapText = GetSitem...

 
@CaptainObvious and yet it moves. Bam.
 
For the love of all that's holy: stop recommending Stack Overflow
The bloody site is more famous than CR
By a long shot
If they can find us, they can find them
 
7:13 PM
<.<
 
We don't like them recommending us on lousy questions either
 
@Mast context?
 
@sineemore Been a bit less active lately
 
@Mast, I'am using @Phrancis snippets for CR.
From Github repo.
Are they still relevant?
 
@CaptainObvious a bird in the hand is worth two in the list??
 
7:17 PM
@sineemore They should be, I try to keep them relevant, but if need be I can change them
@Mast ^ I'd be interested in your opinion
 
Half of new questions get [on hold]. Something is really wrong about this.
 
@sineemore New posters skip the tour and just ask, it's been a problem for years
 
Does any SE site has simular statistics at closed questions?
Actually there is a plenty of nice manuals here at CR.
 
Well... they are nice for the people who read them
which doesn't seem like something too many do
 
@sineemore I have sese.evbpc.com that shows some of this stuff, but it's broke at the moment and I need to fix it. (Meant to do it this weekend, going to do it tonight because I forgot.)
 
7:23 PM
@202_accepted Wow.
 
Fun fact, it's been gathering data for over 2 years now: sese.evbpc.com/SystemHealth
 
Worth mentioning somewhere about this one!
 
@sineemore Stack Overflow gets a lot of off-topic questions, although I'm not sure what the proportion is compared to CR
 
@sineemore Even has an API. ;) sese.evbpc.com/API
I think the problem is the double-meta sites.
Pretty sure that's what broke it before.
 
0
Q: Count lines of scala code (omitting empty lines) in a directory, traversing any subdirectories

Roman BortnikovI need to simply count lines of Scala code in project, which includes some package(i.e. directory) hierarchy import java.io.File import scala.io.Source object CountLoc { def main(args: Array[String]): Unit = { val parentDir: File = new File(System.getProperty("user.dir")) def travers...

 
7:27 PM
@hoffmale, so, do you have any recent hearts project)?
 
If your code works and you're just looking for ways to improve it, Code Review Stack Exchange is the place to ask. — Joseph Webber 53 secs ago
 
Let me think...
The last big one was a custom network protocol analyzer
 
I guess it's not an opensource one..
 
nope
it was a toy project, and I don't think the publisher of the MMORPG whose network protocol I reverse engineered would like it if I went public with it
 
Hah)
Any projects on GitHub or simular?
Actually I'm in search of a thing to join.
Apart from this, the work, and customising my Linux box xD
 
7:32 PM
Not right now
I'm currently doing some thinking about some C++ issues I'd like to improve, but that's more in the planning stage
 
I feel this is really a hard thing to make a somewhat popular opensource project these days.
@hoffmale Like language spec?
 
Well, more like standard library
Basically, pointers have multiple different concerns (ownership, object lifetime, memory allocation and bit representation)
 
let me say Rust
They know a thing about pointers :)
So what's your idea?
 
and the standard library isn't really that flexible regarding the different combinations of different concerns
So I'm trying to find a way to express all those different concerns in a powerful reusable way
 
And not breaking the working stuff?
 
7:38 PM
well... not too much
I guess allocators are here to stay though :/
 
This sounds like a super mighty goal :)
 
yeah... and likely only possible for the version of the standard library
 
Is it hard to get a job at Germany (or Europe) w/o a CS degree?
 
Depends on the job xD
 
If you don't have a question, this is not the right site to post on. If you are looking for a review of working code, take a look at codereview.stackexchange.comBlorgbeard 45 secs ago
 
7:42 PM
0
Q: Simplifying Counter of Checked Checkboxes

BoletroneIs the following code a proper solution to my problem? I have a feeling it can be simplified quite a bit. function checkboxCount() { var form = document.forms["calculator"]; var bar5 = form.elements["bar5"]; var foo = document.querySelectorAll("input[name=foo]"); count = 0; for (var i...

 
Other than that, I'm the wrong person to ask
 
somebody answer a quick yes or no for me....
 
no?
 
I didn't post a question mark, so you weren't supposed to answer yet
lol
nevermind
 
well, you wanted a quick answer...
 
7:52 PM
@sineemore Not if you don't take a CS job.
 
@Mast LOL
 
So it is super fine to be a self-taught programmer to have a job at Europe?
 
@sineemore prior experience seems to help
 
I'm a software applications engineer. I don't have a CS degree.
It's more of a hardware job though, even though we write software all day.
The difference is a CS guy tests his work by writing tests and I test mine by hitting the emergency stop.
2
 
lol no
 
7:55 PM
Does it crash and burn? No? Good. Next test.
 
the difference is that the CS guy tests his work by pushing it into prod and waiting for the emails to come in
 
We only have prod.
If I push my software into the machine to test it, that's the actual machine.
Simulators are fine, but they're only useful for getting out the real stupid mistakes.
 
We don't have tests as well. Only prod, only hardcore.
 
And there's still plenty stupid mistakes the simulator won't catch, now I think about it.
If I screw up my restriction settings and put a value over twice the engine's capacity, the engine will bloody well try to match it's expectations.
Crash and burn.
 
@Mast That's some dedication ^^
 
7:58 PM
@hoffmale German engines. Can't be stopped by petty code.
3
@Phrancis What snippets, the Frequently Posted Comments? Those are still relevant, yes.
 
00:00 - 20:0020:00 - 00:00

« first day (1928 days earlier)      last day (2074 days later) »