« first day (2855 days earlier)      last day (46 days later) » 

12:23 AM
Q: An expirable LRU cache implementation c++?

dahohu527I implemented an ExpireLRUCache class, which will clear the data when it's times out. There are two ways to achieve this. Use a timer to clear the expire data Call the clean function in Add and Get If I use a strut in class, and it use the template typename, how to deal with this? I put the dec...

@SimonForsberg I see 502 Bad Gateway again ...
3 hours later…
3:38 AM
Q: Creating a 3D array from a dataframe and grouping said dataframe

user238261I have a dataframe df where I have two particular columns of interest: "trip" and "stop#." Each trip has unequal number of stops (think of any regular car trip -- sometimes you make 0 stops, sometimes 1, sometimes 100, etc.) I am trying to create a 3D bumpy array out of this, where the dimensions...

4:03 AM
Q: How could I construct a C# function that takes in a credit limit and advance amount and outputs an Amount and APR?

user2382620 The Amount and APR will be set as a percentage of the credit limit. The split will be 50%, 25%, and 25% of the credit limit compared to the advance amount. APR starts at 249 and increased 25% each time. For example : My credit limit is $1000 and my advance amount is $800. My output should be th...

2 hours later…
5:34 AM
6:28 AM
Q: Alarm Clock with React.js

bzzrPreface This is an Alarm Clock app. The way it works is pretty simple: you change the time by pressing the +/- buttons and set the time by pressing the play button. When the time is up, the alarm will ring at which point you can stop it by pressing the pause button. This question is already long ...

7:16 AM
Q: Class showing a format similar to var_dump

Francisco NúñezSome methods of this library require some improvements (see this description): In the constructor I am trying to create the possibility that the user modifies the colors of the output. I think it can improve but I do not know if there is any standard or good practices in this regard, or if there...

3 hours later…
10:09 AM
@Peilonrayz Smells hypothetical
1 hour later…
12:09 PM
Greetings, Programs.
Q: Is there any way of finding out the maximum value a program can take as input before it eventually runs out of memory and stops executing the program?

JustinHere's a memoization technique I learnt thanks to @FMc - def T(n): if n not in T.cache: if n <= 0: T.cache[n] = 1 else: T.cache[n] = T(n-1) + (n-1) * T(n-2) return T.cache[n] # Initialize the cache. T.cache = {} Now let's say that to my knowledge,...

Q: Validator and Sanitizer for HTML 5 attribute regex according to current HTML living standard

BlackbamAccording to https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 an HTML 5 attribute name is defined like this: Attribute names must consist of one or more characters other than controls, U+0020 SPACE, U+0022 ("), U+0027 ('), U+003E (>), U+002F (/), U+003D (=), and noncharacters. In ...

12:26 PM
@Mast Thanks :)
@CaptainObvious PSA Justin has a history of breaking the AOC reason. Please can you be extra careful when checking new questions.
1:00 PM
Q: Finding the maximum value after which a recurrence relation function starts taking an indefinite amount of time to execute

JustinHere's a memoization technique I learnt thanks to @FMc - def T(n): if n not in T.cache: if n <= 0: T.cache[n] = 1 else: T.cache[n] = T(n-1) + (n-1) * T(n-2) return T.cache[n] # Initialize the cache. T.cache = {} This is a recurrence relation funct...

Q: How to remove duplicates of code and apply pattern?

AlexeyI have the following class: @Injectable() export class MapControlsService { constructor( private reonMapLibraryService: ReonMapLibraryService, private eventService: EventService, private portalBridgeService: PortalBridgeService, ) { this.eventService.subscr...

1:32 PM
@CaptainObvious @Peilonrayz Is the question ok now?
@pacmaninbw IMO the question is not asking for a code review. If you can swap from an \$O(n)\$ algorithm to an (might be wrong here) \$2^n\$ algorithm and ask the exact same question about performance the code has nothing to do with the question. Just seems to me like the user is skirting around our rules with a specific question.
Oh I forgot no MathJax in chat :( unless you have a user script
@SᴀᴍOnᴇᴌᴀ load average: 24.92, 24.13, 21.95
I got bigger problems at the moment
Something is reading and writing to disk without causing a big CPU load and I'm not sure what
Additionally, some commands, like w and htop refuse to respond.
1:48 PM
@SimonForsberg have you tried ps aux? Did that on my server the other day and found tons of runc init
@Peilonrayz Fun thing is that ps aux doesn't finish.
root       982  0.0  0.0  72308  6368 ?        Ss   Feb21   0:00 /usr/sbin/sshd -D
postgres  1040  0.0  0.0 320076 27208 ?        S    Feb21   0:06 /usr/lib/postgresql/10/bin/postgres -D /var/lib/postgresql/10/main -c config_file=/etc/postgresql/10/main/postgresql.conf
root      1044  0.0  0.0 143108  1940 ?        Ss   Feb21   0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data  1045  0.0  0.0 145404  8248 ?        S    Feb21   0:00 nginx: worker process
www-data  1046  0.0  0.0 145404  9680 ?        S    Feb21   0:00 nginx: worker process
after this ^^ it just stops
I can't even use Ctrl + C to terminate it
@SimonForsberg Wat. That's so odd
2:12 PM
kill -9 1163 and kill -9 1165 seems to have helped
Working on starting things up again
in Duga's Neighborhood, 11 secs ago, by Duga
Monking! (Duga is now listening for commands)
2:30 PM
@Peilonrayz Was about to comment in the now-deleted question: @Peilonrayz Here's one that shows times and time increase factors for n=50 to n=60, cheating by...
... hardcoding n=30 and n=31. The factor ~1.62 seen there should be realistic, the times of course not (but could be adjusted by adding how often T(30) and T(31) would be called in the non-cheating solution and how long those take).
@superbrain Nice yeah that looks legit. Yeah the rate of change probably fluctuates a bit around 1.62, because timings can fluctuate significantly from timeit. Nice yeah that's pretty cool thanks!
Q: Java reading and parsing file with huge json content using few resource

SpaghettiFunkI' m trying to solve a coding exercise in Java, I'm using Java 11 on Windows. The fields type and host are not guaranteed to be in the json. id is the unique event identifier. I have an input file with json content in this format: file.txt {"id":"arb", "state":"start", "time":4, "type":"system", "...

I tried to get more accuracy with min(timeit(lambda: T(n), number=10) for _ in range(10)) and got a TLE error. The joys of trying to accurately test the performance of code :/
2:54 PM
wasn't me but probably because you haven't shown any attempt to do it yourself - also if you had code that was working, it may be more of a question suited to codereview.stackexchange.comPete 21 secs ago
@Peilonrayz Well, I'd say my range there from 1.58 to 1.64 is already way more accurate than the OP's "days and days" :-D
@superbrain Yeah, I think we can agree there :)
Q: C++ a csv file reader program cpp

Nate Hothis the body of code i cooked up so that it is scalable when I want to read more data from a csv file. I am wondering if the code can be written more efficiently? perhaps using more references? Thanks in advance! This code reads a csv file and prints data to cmd. user can enter more column to re...

3:12 PM
Medi Madelen Gwosdz on February 26, 2021
Welcome to ISSUE #61 of the Overflow! This newsletter is by developers, for developers, written and curated by the Stack Overflow team and Cassidy Williams at Netlify. This week, understanding communication cultures, the lack of inconsistencies in Newton’s universe, and understanding how CPUs handle negative numbers. From the blog Why are video calls so tiring? You might be…
3:26 PM
re no harm in C style casts -- when reading the source code, any C-style cast is an automatic code review issue. So leaving it that way wastes time and attention every time it is looked at again. Function-style is the same number of characters. — JDługosz 46 secs ago
Q: Specifying in a decorator which function argument to use

wRARI have a decorator that needs to access (let's say print) an argument of the wrapped function. It currently just uses the first argument, with the simplest implementation possible: def deco(f): def wrapped(interesting, *args, **kwargs): print(interesting) return f(interesting,...

I guess your implementation looks fine. You could adapt your code to another nonlinear optimization problem whose solution you already know and check if the result is as expected, if you wanted to be sure. BTW: since SO tends to be somewhat problem-driven, in situations like this, where you have a program that seems to be working correctly, you may want to see what the people at Code Review have to say about it. — Vicky 51 secs ago
3:55 PM
Please provide a minimal reproducible example with sample input and expected output data so that we can better understand what you're trying to do here. Also, if your code works and you just want it improved, there is also Code Review, but if you post there please read their rules and how-tos to ensure your question is on-topic — G. Anderson 29 secs ago
4:08 PM
Are you asking for a code review? If so please ask a question on Code Review. — Null 56 secs ago
1 hour later…
5:12 PM
Q: Sort items so that parents are created before their children

JohnLBevanI've been asked to create some code to help automate the loading of data into a system based on employee data in a spreadsheet. However, the data isn't clean, so some people may have no manager, some may be their own manager, some have managers who already exist in the system, so aren't included...

I always use _ as my unnamed object's name. Since there's frequently only one in a code block. It's hard to get it past code reviewers though ... — davidbak 55 secs ago
5:55 PM
@Peilonrayz I think I saw a comment by you recently, possibly removed now, about nowhere in the rules does it say code needs to compile... so would a summary of responses to this question be something like "No, but it helps with better review and analysis"?
Q: Does my code example need to be compilable/runnable?

Faheem MithaI'm thinking of posting a question here, but am unsure how I should do so. The question is about comparing the performance of a piece of pure Python code vs a hybrid Python/C++ piece of code, glued together with Boost Python. Now, I could (probably) create a minimal working example (MWE), but it...

Q: Fibonacci sequence and nth number with reduce()

Ilija Ivicconst generateFibonnaciSequence = (n) => { return [ (arr = new Array(n).fill(1).reduce((arr, _, i) => { arr.push(i <= 1 ? 1 : arr[i - 2] + arr[i - 1]); return arr; }, [])), arr[n - 1], ]; }; const [fibonacciSequence, fibonacciNthNumber] = g...

@SᴀᴍOnᴇᴌᴀ That's the way I read the answers. How would you reading the answers to say code does need to be compilable?
Remember quality != scope
@Peilonrayz Grammatical error in "_How would you reading the answers to say code does need to be compilable?_"
carp- darn formatting
s/reading/read/ ??
Yeah s/reading/read/. I rewrite sentences whilst writing them. It's probably why I'm such a slow responder. But one of the annoying things about English is that I then have to rewrite the entire sentence, cause I change the tense or something :/
6:11 PM
I've rewritten things too...
This question might be more appropriate for codereview.stackexchange.comMitchel Paulin 12 secs ago
I've been more annoyed with the English language as of late
How's English been vexing you of late?
I've been learning some other languages this year. They all have confusing/annoying/difficult aspects.
@Peilonrayz I've been annoyed with words where removing a prefix doesn't lead to an antonym - e.g. impeccable -> peccable
6:15 PM
You don't sound gruntled
Did you know that codereview.stackexchange.com exists? — Wyck 51 secs ago
@SᴀᴍOnᴇᴌᴀ So I guess I'm not sheveled, either.
@SᴀᴍOnᴇᴌᴀ Yeah seams like "impeccable" has outgrown its origin
I learned a few years back that whelmed would still imply something/one is burdened so if one is looking for an opposite of over-whelmed then under-whelmed might be requisite
I've noticed many personal pronouns have been getting dropped - especially on social media... which isn't wrong but slightly annoying
6:24 PM
There are all kinds of back-formations (impeccable -> peccable) that are not actually grammatically valid in English.
@Wyck codereview is for complete and working code, this question would be offtopic — largest_prime_is_463035818 12 secs ago
Q: Excel datamapper with fluent config

AndersExample of usage with header: public class AccountBalanceConfig : IExcelTypeConfiguration<AccountBalanceFile> { public void Configure(IExcelTypeBuilder<AccountBalanceFile> builder) { builder .WithHeader(3, file => file.Balance) .Property("Kontobenämning", ab =

@peilonrayz anyway, the reason I asked about code compilation is because of this comment:
Your code doesn't compile since it is missing the #include lines. Please post your complete code here so that we don't have to guess anything but can concentrate on what you actually wrote. — Roland Illig 3 hours ago
This is probably more suited for Code Review. — Ivar 47 secs ago
In Italian lately, I've been having a hard time with clitics. Basically, it's the form of Italian pronouns in which the pronoun is not the predicate of the sentence.
6:35 PM
@SᴀᴍOnᴇᴌᴀ I think everyone can agree including imports makes for a better question. (quality) Makes the code easier for new programmers to answer etc. I'm not going to say more cause this is a can of worms that I don't want to open again.
@Peilonrayz Also, we have no way to know what VECTOR is in that question.
6:52 PM
@Edward I can't empathise with this point. Python is all about duck typing so not knowing the type is the norm. I've seen people ask for things like this and then go on to complain that the additional code has missing information... The only way this ends well for the OP is to ignore the rule that snippets are allowed and post the entire code base.
Q: connect 4 Game Design in C++

AshkanI am working on designing a simple version of connect 4 game here is my first draft code. Wonder to ask for feedbacks and also required modification for these following up questions: Add some intelligence in the players to select the column optimally. How will you make the game generic so that i...

Q: Multithreaded implementation of K-means clustering algorithm

Teodor DyakovHello I have written a multihreaded implementation of the K-means clustering algorithm. The main goals are corectness and scalable performance on mluticore CPUs. I expect to code to not have race conditions and no data races, and to scale good with more CPU cores. package bg.unisofia.fmi.rsa; im...

Q: Asteroids clone

CaseyI wrote an Asteroids clone using my 2D game engine. It's way too long to post here in its entirety so here's the GitHub repo link: https://github.com/cugone/Asteroids In terms of scope, I'd like the review(s) to focus on readability, game development best practices, and performance. Any further i...

@Vicky Thank you for your reply. Ah great I didn't know about Code Review! Thanks — Christina 47 secs ago
@Peilonrayz It's a fair point. We can infer that this VECTOR has push and getSize members and guess as to what those are and do. It's why I said it would be helpful to reviewers but did not VTC.
@Edward Sorry
@Peilonrayz No need to be sorry or apologize! It's a legitimate question.
7:04 PM
@SimonForsberg okay- would you prefer messages about Duga in another chatroom? e.g. her neighborhood, Coding Projects and Factorio Madness :), etc.?
7:15 PM
possible answer invalidation by Francisco Núñez on question by Francisco Núñez: codereview.stackexchange.com/posts/256388/revisions
@Duga rolled back
Q: Handling sessions in SignalR core

Adam QI am using .Net 5, and I am making game server using SignalR core. Ther're 2 ways to inject service to my classes. 1- Constructor injection: where I must separate functions and data, even if it's stored in memory not database. For example: Instead of Room class that contains data and functions, I...

7:49 PM
@SᴀᴍOnᴇᴌᴀ I mostly hang out in Coding Projects, so you can usually ping me there
That's the room I check the most
8:03 PM
1 hour later…
9:28 PM
Q: Post request in React app to PHP file in Apache server on localhost

Tomáš KretekI am creating simple app for fetching icos and firm names from one site. I have this project already done with JQuery and now I am trying to learn React and do the same in it. First part of this project is form with ico and name inputs. On submit, it create post request to php file, which checks,...

9:54 PM
Q: A simple lexer for SGF format

imdjI intend to write a parser for SGF. Since I don't have any previous experience in parsing, I'm looking for critique regarding the simple lexer implementation I just did. Any suggestions on using modern c++ features or issues with the code are also appreciated. The SGF format specification: https:...

10:15 PM
@CaptainObvious I don't think that can work.
Q: Generic Queue in C

sdasdadasI'm implementing a generic (ie. void *) queue in C. I believe I have a working version but I'm looking for two things: Do any subtle bugs pop out to the experienced reader? Can I implement this in a better way (perhaps using void ** pointers? queue.h #ifndef QUEUE_H #define QUEUE_H #include <...

Never mind, I think I understand. But if someone I worked with wrote code like that I would smack them. Blech.
@CaptainObvious CNWAI
@FranciscoNúñez I don't think Mast will be on for the rest of today. Can other members of the community help you?
10:47 PM
no thank you
@SᴀᴍOnᴇᴌᴀ can i create a second post based in the First RC5??? becouse the diference of the code is huge XD
@FranciscoNúñez yes - see the section under heading I improved my code based on the reviews. What next? on the help center page What should I do when someone answers my question?
as long as the code is different then you can post a new question
@SᴀᴍOnᴇᴌᴀ same question but diferent and less...
11:35 PM
For a review of working code, please use Code Review. You do need to post the entire code there, however, not just link to a repository. — VLAZ 48 secs ago
11:51 PM
self:: and $this-> have the same behavior???

« first day (2855 days earlier)      last day (46 days later) »