« first day (2050 days earlier)      last day (1970 days later) » 

12:00 AM
RELOAD! There are 5848 unanswered questions (89.7348% answered)
 
Somehow I earned a hat on Writing....
where the hats be?
I will be back later to pick them up.
 
 
3 hours later…
3:13 AM
0
Q: Can I make this sort at insertion faster?

Yussuf A ClarkI'm attempting to sort an array at the initial insertion of a value. I tried to think "binary search", except with sorting, where I'm searching for the correct insertion point. I guess you can call it a binary sort, but its hardly that. It works just fine, but I wish it was faster. The slowest pa...

 
 
2 hours later…
5:27 AM
Monking
 
5:47 AM
I suggest to add the python tag to get your Python script code reviewed by a Python expert. — Mofi 15 secs ago
 
6:07 AM
a similar thread [codereview.stackexchange.com/questions/188053/… My way: generate and enumerate. — Matt Cao 58 secs ago
 
 
1 hour later…
7:15 AM
I'm voting to close this question as off-topic because it is better suited for codereview.stackexchange.com — CinCout 58 secs ago
This might be better suited to codereview.stackexchange.com — Joey 58 secs ago
I'm voting to close this question as off-topic because the question is more of a code review question "is this a best way" and would be a better fit at codereview.stackexchange.compstrjds 52 secs ago
If you have code that already works for you but you want feedback on how it could be improved, please ask on codereview.stackexchange.com. but provide more detail about what element you're looking to improve. (Read the guide before posting.) — Jon Skeet 1 min ago
 
7:45 AM
Monking
 
7:56 AM
Monking @Zeta
 
8:15 AM
@SᴀᴍOnᴇᴌᴀ Wow, that's indeed a lot
 
0
Q: Advent of Code 2018 Day 13 - Detect mine cart collisions

Charles_FThis is a solution to Advent of Code Day 13 (problem specification), for which I was asked to read a layout of tracks and mine carts and detect 1) where the first crash would occur and 2) where the final remaining cart would be after the rest had crashed. The tracks consist of: straight pieces: ...

 
8:38 AM
0
Q: Game of Life in Ruby

Aries_is_thereI think Ruby is kinda interesting, so did this Game of life implement in Ruby. I am wonder is there is some magic in Ruby can let my code more elegant. I am a python coder and I think my Ruby kinda smell like Python now xD(and with lots end) def lifegame(grid) alive = 1 die = 0 whi...

 
8:55 AM
possible answer invalidation by OliverRadini on question by OliverRadini: codereview.stackexchange.com/posts/209609/revisions
 
9:09 AM
0
Q: Handle Javascript Errors in Controller

Spedo De La RossaI am using the jstree to get a tree structure in my MVC application. I am actually on showing javascript errors, when something is wrong. In this case, returning an alert to Javascript. Furthermore I want to now what I can code better. For this case, I had to switch the public void AddFolderto pu...

 
 
2 hours later…
10:39 AM
Isn't this question a better fit for CodeReview? — Codeer 31 secs ago
 
11:27 AM
0
Q: Nested for loops in pandas that use conditionals to append to a list

mp252I have been using pandas library in python to get add extra columns to one dataframe. The only way I thought to do this for one of the columns was to use a nested for loop with conditionals and then compare row values. This works correctly however I want to use a more pandas way of doing it to ma...

 
Better suited for Code ReviewCinCout 45 secs ago
@Bernhard A unit test will not help you here. If you have UB then anything can happen and you cannot depend on a test to catch that. This is the hardest category of bug to find, and ultimately it is really just down to code review and pure chance. — Lightness Races in Orbit 36 secs ago
 
12:04 PM
0
Q: We need Captain Obvious back

HeslacherAlmost one month ago the new-question-feed of our main chat-room The 2nd Monitor posted by the special user named Captain Obvious stopped working. there had been a short discussion Room owner 1: I was more thinking along the lines of, would it help to remove/add the feed again? Roo...

-2
Q: Can I have a pension?

anatoly techtonikI am getting old and I need money. I bet many people do, but for some reason they prefer not to speak about it. Over 8 years at StackOverflow I scored 11k rep and some medals. There are not many answers there, as you may see below. It is roughly 64 rep per answer. I like discovering things ...

 
@CinCout Code that does not compile is not suited for the code review site. Please consider this before directing people there. — Max Langhof 12 secs ago
When you get your code running, maybe you want to post it at codereview.stackexchange.com to get some hints to improve your style. — Ralf Kleberhoff 18 secs ago
 
12:45 PM
If it works, it is off topic for SO. Better suited for codereview SE to get input on possible improvements. — Fildor 12 secs ago
 
1:24 PM
1
A: We need Captain Obvious back

ArtOfCodeWhat I can't do is assign the feed back to user -263, the "original" Captain Obvious. What I can do is create a new feeds user, -786, and copy Captain Obvious' name and avatar across to it. So I've done it.

Please show some love for this answer
 
0
Q: Project euler problem 23

Aniket Prakashbelow is my code, it takes to long to compile, any improvement in the code to make it quickly. #include <iostream> using namespace std; bool isabundant (int n) { bool flag =false; int sum =0; for(int i=1;i<(n/2+1);i++) { if(n%i==0) { sum = sum...

 
Welcome back @CapainObvious
 
2:01 PM
@trighati - I did not vote to close as duplicate, but as off topic and suggested it be asked at codereview, see my above comment. — pstrjds 55 secs ago
 
0
Q: Is using callback here bad?

Megs BarlisoHello everyone can i have some feedback with this code?, i'm passing in an object to the callback since i don't want to pass something like this reply(null, {data}) // no error `reply({err}, null) // error controller.on('interactive_message_callback', function(bot, message) { const channel =...

0
Q: Simple Publisher Subscriber in Java

KNejadI am new to Java and had some difficulty creating this simple Publisher Subscriber class. It finally seems to be working and I wanted to check if I have been following best practices and see if there are any improvements I can make. The following Java class accepts any topics as a string (e.g. "...

0
Q: React ToDo App - Any issues with coding style

SANM2009This is my first attempt at React and I don't want to pick up any bad habits for the long term. The code is adopted from a example app, but I have added a fair amount of new features. I.e. Clicking on the item allows it to be edited Delete Option Option to mark the items as Complete / Uncomplet...

 
> Sounds like you need to get into the world known as consulting. There, you don't actually really do anything, you just charge a ton of money to tell companies how they should be doing stuff. It's kinda like retirement, except that you still need to answer your email and bring yourself to install and use Skype.
2
Greetings user
 
Greetings, Programs.
 
2:16 PM
0
Q: which is better in DAL layer operations - IQueryable vs IEnumerable

Kgn-webIf I am writing DAL operations, which is better IEnumerable or IQueryable & why?? public class DALLayer { public IQueryable Get() { } public IEnumerable Get() { } }

 
@Mast Gotta rewire one outlet in my garage for one of the pieces of equipment I'm buying.
 
2:36 PM
@202_accepted In the US not all receptacles are equal, right? From what to what will you rewire? Or did the wire/insulation simply go bad?
 
@Mast Our stuff is 115V, my air-compressor is 230V.
So I need to rewire one outlet it my garage for the 230V air compressor.
 
Around here, we go from 230 to 400 using 3-phases, how does it work there?
 
My house has two 110 (we use 110/115/120 pretty synonymously) inputs, usually we chain the breakers to get to 220/230/240, our 3-phase is 480V and that's only ever industrial.
 
So you simply stack the voltage to get 230?
 
Yeah.
We use the same amperage on the breakers and just chain them to stack the voltage.
 
2:43 PM
Yuck.
 
Usually we have +120V, -120V and a neutral, I haven't dissected the outlet but I might be able to go that route instead.
Just wire the breaker up for +120/-120 to get my 240V split.
 
Yeah, we simply have +230 and neutral.
 
I don't know why they made U.S. houses so friggin complicated.
 
That ^^
 
0
Q: Tile and grid abstraction

CodeYogiThis question is a small subset of the problem I am trying to solve. I am trying to learn to break problems into better abstractions. The original problem I am trying to solve is: Write a JS library which allows an user to select an Image and then divide the image into square tiles. Calculat...

 
2:47 PM
@Mast It's even worse because most houses need a 230V loop anyway, Dryers / Washers / Electric Stoves are often 230V here.
 
Someone should try and standardize that crap, but that's hard.
This (old) list should give an idea about the diversity around.
 
@Mast Our standard / 120V outlets are NEMA 5-15 or 5-20, but our 240V outlets are NEMA 6-15, 6-20, L6-15 or L6-20.
NEMA 1-15 is our old outlet type.
 
3:04 PM
We got Schuko's.
 
Gross
 
Well it seems you are really off-topic now, aren't you?
 
Just a smidge.
 
@Heslacher No site business. shrug
 
Yeah but seeing in the tab that new messages apear I check and see this
 
3:08 PM
You'll learn a lot from it. ;)
 
Not really, I have been there where you are now.
 
Monking
 
3:34 PM
0
Q: How do you properly organize data to compute multiple (independent) recursive filters at the same time taking advantage of SIMD instructions?

markzzzI'm processing multiple (independent) Exponential Moving Average 1-Pole filters on different parameters I have within my Audio application, with the intent of smooth each param value at audio rate: for (int i = 0; i < mParams.GetSize(); i++) { mParams.Get(i)->SmoothBlock(blockSize); } ... ...

 
@Mast I was thinking about this last night... reminded me of your comment from a few months ago
Oct 4 at 18:16, by Mast
Everything can be broken.
@Heslacher what is the source of this? did you generate it?
 
In future, questions like these are perfect for Code Review. In fact, if you delete your question here, you could probably post it there. — Graham 58 secs ago
possible answer invalidation by mp252 on question by mp252: codereview.stackexchange.com/posts/209664/revisions
 
3:59 PM
@SᴀᴍOnᴇᴌᴀ see
-24
Q: Can I have a pension?

anatoly techtonikI am getting old and I need money. I bet many people do, but for some reason they prefer not to speak about it. Over 8 years at Stack Overflow I scored 11k rep and some badges. There are not many answers there, as you may see below. It is roughly 64 rep per answer. I like discovering things...

 
possible answer invalidation by mp252 on question by mp252: codereview.stackexchange.com/posts/209664/revisions
 
@All please add some votes for this answer
3 hours ago, by Heslacher
1
A: We need Captain Obvious back

ArtOfCodeWhat I can't do is assign the feed back to user -263, the "original" Captain Obvious. What I can do is create a new feeds user, -786, and copy Captain Obvious' name and avatar across to it. So I've done it.

 
Looks like an XY problem. Instead of refactoring the code (removing globals, packing related variables in dicts) you want to adopt some weird approach of visually grouping blocks of code by indentation. My suggestion is to post complete and working code on codereview.stackexchange.com, get reviews and see how it should be done properly. — Georgy 47 secs ago
Random code review comment after following your post on Meta: reduce nesting in void sf::TextField::handleInput(sf::Event e){ by inverting conditions and returning early: if (!m_hasfocus || e.type != sf::Event::TextEntered) return; Then combine the followingelse into else if: else if (m_text.size() < m_size) Then you can finally drop the curly braces and your overall function is much cleaner and easier to read. If you'd like a metric, the cognitive complexity score is improved. — AndyG 58 secs ago
If this code works and you're only asking about its quality you may be better posting over at codereview.stackexchange.comOldBoyCoder 13 secs ago
 
4:20 PM
0
Q: Parameter validation within functions

jacksonecacI have a function that takes a handful of parameters and I want to ensure the data being passed to it is the correct data and types. Below is a sample function that I wrote to ensure the parameters are correct. How does this practice look and can it be improved on? thanks in advance! def self.c...

 
@SᴀᴍOnᴇᴌᴀ If you think something is fool-proof, you haven't met enough fools.
 
@Heslacher Thank you for getting the ball rolling on that.
 
4:35 PM
0
Q: Excel blank row inserter

Sandro4912I wrote a program as an excercise, to check the openpyxl module, which inserts blank rows into an excel file. See the docstring in the code for more description. I would like to know what you think about the code. Is it easy / difficult to follow? Is it structured good / bad? What can be improv...

0
Q: Effiecent Implementation of Luhn Credit Card Algorithm using python

HackersInsideI'm trying to implement the Luhn's algorithm for checking credit card numbers Hers is my code: (Works Fine) def validate_credit_card_number(card_number): #start writing your code here #Step 1a - complete temp_list=list(str(card_number)) my_list=[] list1 = temp_list[-2::-2] ...

 
Thinking about it, rephrasing the question would lead to ask: how to optimize this? I guess it would be considered code review, which is off-topic on SO. Any advice on the rephrasing or should I just close the question and post somewhere else? — Ben 27 secs ago
 
@Mast no problem
 
@Ben: Don't post it somewhere else - disregard anyone here suggesting that you post it on another site as noise (and at least read Code Review's FAQ for this very situation). But in all reality you haven't demonstrated that it needs to be optimized; there's only ten thousand records that it's iterating on in the double loop so the performance of this code is not bad at all. Once you demonstrate that there's actually a significant performance slowdown in your code, you'll have profiled it and have the info to make a great question. — Makoto 6 secs ago
 
4:54 PM
Monking
 
5:18 PM
@200_success I see you deleted your answer to the following, but I do not have sufficient reputation to see deleted answers, so I can't see why. I was exploring a solution based on reversing the string and then came back to read your answer again, only to find it gone. Can you help? Thanks.
9
Q: First non-repeating letter

Kevin SThe problem: find and return the first nonrepeating character in a string, if the string does not have a nonrepeating character return an empty string. For purposes of finding the nonrepeating character it's case insensitive so 't' and 'T' appearing in the string would imply that that 't' and 'T...

 
-1
Q: receive the checked values and URL in query string format

FrontSideThere is this html code. I want to return a string that combines the values currently checked in the URL with the parameters when the button is pressed. For example, if the current page is localhost:8000, pressing the button will combine the checked values. What do you need to know to get returne...

0
Q: Ultra-simple, automatic, non-float, 1-4 column, grid system

darcherHas everyone moved over to CSS Grid and/or Flexbox? If not, I've maintained and evolved this system over a fair amount of time, the concept was derived originally, I believe, from Mary Lou, although I don't recall where the article is. I was never a proponent of floats, although the using font-s...

 
possible answer invalidation by mdfst13 on question by KNejad: codereview.stackexchange.com/posts/209670/revisions
 
6:08 PM
-1
Q: Lock-Free Multiple-Producer & Consumer - MemoryCache Stack and Queue

roscoe_casitaI am looking to implement the follow lightweight Multiple Producer / Multiple Consumer data structures: MemoryCache, Stack, Queue. As these are Lock-Free, they only use CAS/__sync_bool_compare_and_swap for maintaining consistency. The MemoryCache uses two Stacks internally to store a pool of I...

 
6:29 PM
 
@RMunroe And it's very, very good they exist.
 
1
Q: String match : multiple patterns at a time

hsgHere is the problem statement - We have been given a list of strings which are blacklisted. The goal is to identify if a given text contains any of these blacklisted strings. The restriction here is that the blacklisted string needs to match on the word boundary e.g. consider a blacklist string "...

-1
Q: Clean Service Method Logic

Adam BatesA co-worker and I are having a debate as to whose implementation of the same code is cleaner. We are handed the dependency interfaces that we must use, and the DomainAuthorizationService interface that we must implement. The business logic requires the process to happen in a certain order, and al...

 
Information wants to be free!
 
6:54 PM
-1
Q: What am I missing with this Prime number counter code using int method? // I'm beginner to Java, sorry if it is too silly to ask

T. Milstatic int primeCount(int start, int end) { int count = 0; for(int i = start; i <= end; i++) { if(i == 2 || i % 2 != 0) count++; } return count; }

 
@CaptainObvious cue the sad trombone sound
pfft "too silly"
 
7:56 PM
0
Q: Bartender Project - exporting printer code templates - Follow-up-2

C. CattHere is my second revision of my code. The other revision (and the base project) may be found here: Original: BarTender project - exporting printer code templates 1st Revision: BarTender project - exporting printer code templates - Follow-up I have incorporated Pieter Witvoet's comments from m...

 
Since you do not have a demonstrable problem, you're on the wrong site. Please check "Which site?" for general issues and "Code Review or not?"Prune 32 secs ago
 
8:54 PM
This question might be better asked at Code ReviewG5W 54 secs ago
Clearer yes, but probably still a better fit for Code Review. — Tim Lewis 19 secs ago
 
0
Q: Have to rewrite the code for react table every-time I want to use it for different data

Pranav BhatiaI am using a react table for displaying, for example all ACCOUNTS. I have customized this table using fields like headers, accessor, cell, min-width, max-width, props, etc. columns={[ { Header: this.generateHeaderCell(this.props.headers[0]), accessor: 'name', Cell: (props: any) => <NameCel...

 
9:13 PM
0
Q: Filling missing rows for time series data in R

syhwyqpThanks to many great Stackoverflow posts, I have a solution to fill missing rows for time series data. But my major concern is if there is any way to make this more concise and shorter. I am working with data like below: df <- data.frame( id = c("A", "A", "A", "A", "A", "B", "B", "B", "C...

 
9:55 PM
I'm voting to close this question as off-topic because I think it belongs in codereview — David Wilson 46 secs ago
@DavidWilson Feel free to recommend the OP post on CR but in the future, please don't use the existence of the Code Review site as a reason to close a question. Evaluate the request and use a reason like too broad, primarily opinion-based, etc. Then you can mention to the OP that it can be posted on Code Review if it is on-topic. Please see the section What you should not do in this answer to A guide to Code Review for Stack Overflow usersSᴀᴍ Onᴇᴌᴀ 13 secs ago
@SᴀᴍOnᴇᴌᴀ ok so is the question on-topic or off-topic because it should be migrated to Code Review or off-topic for another reason? I would understand an optimization question as off-topic for this site because it belongs on Code Review, but there is no such option in the same way that there is for the superuser site etc — David Wilson 35 secs ago
 
10:15 PM
if only I could get people to write code for me... ⊙﹏⊙
 
11:03 PM
I'm voting to close this question as off-topic because this question is very broad "what's wrong with my code?" and belongs on either codereview.stackexchange.com or android.stackexchange.comGraham 1 min ago
"What is wrong with my code" problems are not off-topic here ... under the right circumstances. But they are definitely and explicitly off-topic on CodeReview!! — Stephen C 14 secs ago
 

« first day (2050 days earlier)      last day (1970 days later) »