« first day (3014 days earlier)      last day (986 days later) » 

12:03 AM
REFRESH! There are 7723 unanswered questions (89.3744 answered)
 
 
1 hour later…
1:14 AM
sorry - can you clarify what the issue is? you're using pandas... what are you having trouble with? FYI - code improvement questions are generally not allowed on stack overflow - instead, check out code review Stack Exchange if you'd like help improving your working code :) — Michael Delgado 49 secs ago
 
1:35 AM
0
Q: garbage string remover with array or object input

Book Of FlamesThis is the second time I am writing any practical JavaScript so it is pretty likely that I have messed something up. I am beginner, so just need a piece of advice before sharing the code: Do I need to be more focused on writing maintainable and flexible code or do I need to be more focused on wr...

 
1:59 AM
0
Q: simple java virtual machine

phillbushI implemented a simple java virtual machine in C. Here it is: https://github.com/phillbush/jvm It includes two programs: javap(1), a java disassembler; and java(1), the jvm itself. It does not have a garbage collector nor exception handler yet, but I want to implement them (but how should I do it...

 
2:24 AM
0
Q: Generic PriorityQueue (Min-Heap) implementation

Souvik GhoshI was trying to implement a generic PriorityQueue in C#. Below is my implementation which works fine as per few test cases. Operations supported- Add: Adds an element Poll: Removes the smallest element and returns it Remove: Removes a specific element (only first occurence) and returns it Clear:...

 
2:46 AM
possible answer invalidation by Abhishek on question by Abhishek: codereview.stackexchange.com/posts/265629/revisions
possible answer invalidation by Abhishek on question by Abhishek: codereview.stackexchange.com/posts/265621/revisions
possible answer invalidation by Abhishek on question by Abhishek: codereview.stackexchange.com/posts/265629/revisions
possible answer invalidation by Abhishek on question by Abhishek: codereview.stackexchange.com/posts/265621/revisions
 
 
2 hours later…
4:52 AM
0
Q: Factorial function for a math library in C++

Suryasis PaulI am trying to code up a basic combinatorial math library for C++. Started with the implementation of the factorial function. Here I include the code and the test code. Please review. Is the way of throwing argument exceptions the best way to do it? Am I using the Test code the correct way for t...

 
Monking
@Duga rolled back
 
5:27 AM
This would be a matter of taste and opinion, so this question is not a good fit for SO. If your code is working as expected and you want some advice to improve it, you might want to have a look at codereview.stackexchange.com . Anyway, the more complex a task becomes, the more you'll find different ways to do it .. — Thierry Lathuille 22 secs ago
 
5:41 AM
possible answer invalidation by Sati on question by Sati: codereview.stackexchange.com/posts/265627/revisions
possible answer invalidation by Sati on question by Sati: codereview.stackexchange.com/posts/265627/revisions
 
6:14 AM
@Duga rolled back
Had been a bad roll-back. OP only added output. My bad.
 
6:55 AM
0
Q: A scripting language (interpreter) in C

ArianKGI made a scripting language (interpreter) in C. The codes are too long, and I can't paste all of them it in here. main.c: #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include "functions.h" #include "lang/constants.h" #include "lang/names.h" #include "lang/lang.h"

 
@SᴀᴍOnᴇᴌᴀ I know a thing or two about spam, but I have no idea what they're talking about.
I'll see if I can reproduce that when back at home and if there's a big red box popping up I'll notify the relevant people.
 
7:24 AM
If your current implementation works, a better place for this question would probably be: codereview.stackexchange.comempiric 31 secs ago
 
0
Q: Code review regarding removing duplicate switch statement in GO

FouadI have this method that I feel has code repetition that can be improved but since I am new to GO, I am not quite sure how to improve it. I would appreciate if anyone can give me their opinion. func (c *Configuration) loadFromEnvVars(key string, target interface{}, optional bool, defaultValue inte...

 
@Feeds wrong site. Left a comment
 
@Heslacher Should we have a migration target for meta⟶main? We have one the other way...
 
Doesn't happen that often. Don't know
 
7:44 AM
0
Q: Using a IEnumerable where we have mostly only one item

Max R.I have a project where I publish and subscribe some data packages. Mostly those data packages are just one package, but sometimes (1 in 100) there could be more packages at one time (a lot more, like 100.000 at the same time) I have a class PacketTransport which only has a IDataPacket property in...

 
8:08 AM
0
Q: React children props array type predicate

slideshowp2Component: import React from 'react'; interface QuestionsProps {} export default function Questions({ children }: React.PropsWithChildren<QuestionsProps>) { return <div>{children && React.Children.count(children) > 1 ? children.join('\n') : children}</div>; } TSC throws error: Property 'join...

 
@potong yes, you're right. I missed handling that case, which was probably needed in the OP's problem. One more reason to love code reviews :) — Ionuț G. Stan 19 secs ago
 
8:33 AM
0
Q: Remove almost identical switch statement in GO method

FouadI have this method that I feel has code repetition that can be improved but since I am new to GO, I am not quite sure how to improve it. I would appreciate if anyone can give me their opinion. func (c *Configuration) loadFromEnvVars(key string, target interface{}, optional bool, defaultValue inte...

 
9:07 AM
SO is not a code review platform so I primarily try to solve questions in the scope given by the TO. Nonetheless, I added a solution that doesn't involve querying already modified elements. — shaedrich 46 secs ago
 
9:22 AM
0
Q: Rest api spring boot + angular

mhelThis is my first post here and I'm not sure if this is excatly the right site to ask my question. Anyways, I have developed an gym managment application in which you can add new members,add membership for members,measurements, equipment,services for eqipment and stuff like that. I also have added...

 
9:44 AM
If you love code reviews may I offer some more? First, the . matches any single character so I think you intended \.. Second, {...} group commands but are unnecessary for a single command ,so /^text/! b loop would be suffice. Third, since that single command is flow control, it infers anything following does match and so another match is not necessary. Finally, since the -n` option is invoked, a p command or flag is needed to print lines and should be placed outside of the chain of commands that constitute the solution as a catch all. HTH — potong 39 secs ago
 
@TobySpeight @Heslacher Since this isn't the first time the question has popped up I had a look around and I can't add a CR.Meta->CR.Main migration target. We can ask a CM, via a meta post, to add a migration target
However, I'm not sure one is needed. We don't get them often, and normally (above 50% of the time) I'm not asleep :)
 
10:21 AM
A single migration away from meta in the last 90 days... It doesn't seem to be relevant, especially considering that off-topic questions should be closed on meta instead of being migrated (and then rejected)
 
We've had at least 2 in the past 90 days.
 
possible answer invalidation by Souvik Ghosh on question by Souvik Ghosh: codereview.stackexchange.com/posts/265686/revisions
possible answer invalidation by Souvik Ghosh on question by Souvik Ghosh: codereview.stackexchange.com/posts/265686/revisions
 
11:00 AM
-1
Q: My implementation of cycle detection doesn't work

Prim ElementI'm trying to learn C++ by making problems on HackerRank and I've come across this problem: "Cycle Detection" where I need to find if a linked list has a cycle (A linked list is said to contain a cycle if any node is visited more than once while traversing the list): https://www.hackerrank.com/ch...

 
11:19 AM
@Peilonrayz Thanks for considering whether it would be useful. I didn't have a strong opinion either way, but thought I should ask the question and find what the community thinks.
 
12:02 PM
This question belongs on Code ReviewBotje 14 secs ago
 
 
1 hour later…
1:06 PM
Hey, your question might be better suited for codereview.stackexchange.com. Your writing style is fine, I'd just put it in a function and add some comments. — Peter 17 secs ago
 
@Duga Applied suggestions in answer, definitely AI. Rolled back and commented.
 
1:30 PM
Monking!
Should I use spoilers if I create an example such as the one at the bottom? Or should I refrain from doing that at all?
 
1:48 PM
@MaartenBodewes personally I wouldn't/won't use spoilers in code review answer. But thats just your decision to make.
 
@Heslacher If the code is so convoluted in the question, would you post an example on how to code it correctly as I did?
 
I usually pick parts of the question and post my opinion about how to make it better. Sometimes/often I the have the whole code (which is targeted by my answer) at the end with a comment like Implementing the mentioned changes leads to then the code
 
2:04 PM
Well, I did include a list with the positive changes at least. I'll leave it be. Trying some generator Fu in Python now because I'm having fun. I just removed the max argument from cycle, but now I need to make the cycle code even easier.
Darn, you can hardly see the difference between code and code here.
 
2:21 PM
`def crypt_xor(message, key):
result = bytearray(message)
for i, k in enumerate((key[i % len(key)] for i in range(len(message)))):
result[i] ^= k
return result
`
```
def crypt_xor(message, key):
result = bytearray(message)
for i, k in enumerate((key[i % len(key)] for i in range(len(message)))):
result[i] ^= k
return result
```
So close to getting a one liner.
 
@MaartenBodewes I did that for some of my reviews on questions to allow the OP (and other readers) the decision of reading the resulting code when applying a concept I introduced.
 
possible answer invalidation by Suryasis Paul on question by Suryasis Paul: codereview.stackexchange.com/posts/265688/revisions
 
I've now decided to create a spoiler alert on top of the code, it is very much below the review anyway. Dang, the one liner doesn't come to me, and I know it is possible.
 
possible answer invalidation by Suryasis Paul on question by Suryasis Paul: codereview.stackexchange.com/posts/265688/revisions
 
@MaartenBodewes might be easier to formulate as oneline if you iterate over the bytearray(message)
 
2:32 PM
Yeah, just what I was typing in right now :)
 
PS "am I doing this right?" is not really on-topic for Stack Overflow (go to CrossValidated for statistical questions, or Code Review ...). If you specifically want to know how to plot the results, please ask that question more explicitly. — Ben Bolker 55 secs ago
 
return [ct ^ key[i % len(key)] for i, ct in enumerate(bytearray(message))]
 
Oh, just the square brackets. I'm dumb.
You can remove the bytearray call.
@Vogel612 I'm getting 'list' object has no attribute 'decode', that's probably Python 3 that is byting me?
 
don't know... sounds like you're trying to do something with the result of the crypt_xor call that isn't available on list
if you want a string, you'd need to convert the list into a string first.
 
2:54 PM
return bytearray(m ^ key[i % len(key)] for i, m in enumerate(message))
that works :)
Scary :P
This is why you should not pay developers by productivity in code lines.
 
3:30 PM
0
Q: Combination function for a math library in C++

Suryasis PaulTaking forward the combinatorial library link, I have tried to implement the nCr function. Please mention if this is prone to failing somewhere Any other test code that needs to be added. Any more efficient way to code this. N.B: I am aware that overflow handling has to be taken into considerat...

 
Monking!
@Vogel612 Oh, hey, the one liner is even rather performant, see here. That was a fortunate bounty offered, I thought it would be going down the drain!
 
3:45 PM
@MaartenBodewes You may want to check if a list comprehension is faster than a generator expression. Because Python tends to have optimizations for lists.
 
@Peilonrayz Thanks; I'll save performance monitoring for another time though.
With list comprehension: that means turning the message and key to a list? That seems relatively expensive...
(compared to array access anyway)
 
# Generator expression
return bytearray(m ^ key[i % len(key)] for i, m in enumerate(message))
# List comprehension
return bytearray([m ^ key[i % len(key)] for i, m in enumerate(message)])
@MaartenBodewes No, Python lists are arrays on the backend and function similarly to how the bytearray builds a list.
 
OK, it is ever so slightly faster it seems:
maartenb@maartens-ryzen:~/Test$ time python3 xorcipher.py
a1f2b889a4b5c8b3f08ca0b589bf
I have a dream

real 0m1.864s
user 0m1.859s
sys 0m0.004s
maartenb@maartens-ryzen:~/Test$ time python3 xorcipher.py
6021844877890960cc4d7389486c
I have a dream

real 0m1.730s
user 0m1.730s
sys 0m0.000s
For a million runs.
 
Monking
 
BTW, Java would have put down 0 seconds as it would recognize that the output wasn't used :P
 
3:58 PM
I think the question is more suited here: codereview.stackexchange.comSujay 26 secs ago
This is not a type of questions you can ask on Stack Overflow, check Code Review. — Olvin Roght just now
 
Spent 50 minutes today with a coworker to figure out that everything in an app was working as intended, except that a button had white text on a white background with a white border
 
brilliant design!
2
 
Well most is locked in except the background color is configurable by others :P
 
@MaartenBodewes Yeah, not much of an improvement. But is a common pattern in Python.
 
@skiwi Apple doesn't like it when you indicate that you work for them :P
 
4:05 PM
@MaartenBodewes :P
 
(OK, OK, sometimes Apple uses different colors as well. Although their Crypto API was light grey on white - which hid the fact that there wasn't any)
 
I had to work a little bit with a Mac today, ugh
 
Wish I had one right now, my AndroidDeveloper doesn't seem to like the USB ports of the Linux machine that I created, so I cannot test on the phones themselves.
 
Very nice and I love that the internal implementation is shown! Note that a friend on CodeReview indicated that list comprehension is slightly faster still, so e.g. arrays(gen) is slightly slower than arrays([gen]). — Maarten Bodewes 39 secs ago
 
Heh, I new Duga would do that :)
 
4:44 PM
0
Q: Shortest Path to Get All Keys in JavaScript

myTest532 myTest532I build the Shortest Path to Get All Keys algorithm in JavaScript. It's working properly, but with a really bad performance. The problem: You are given an m x n grid grid where: '.' is an empty cell. '#' is a wall. '@' is the starting point. Lowercase letters represent keys. Uppercase letters rep...

0
Q: Simple Blackjack Game in c++

MaxI made a simple BlackJack game and I want to make it as good as possible before I move on to creating a few other games in my "casino" - let me know how I can improve it I added a few things here and there if you are interested my GitHub for this project is linked: https://github.com/sharoika/Cas...

0
Q: Tkinter Sticky Notes

Anna SmithCurrently I am creating an app in Tkinter that creates, displays, and saves sticky notes. I am new to python so I keep trying to rewrite my classes so I have my code more organized but every time I try to create a separate class that inherits from my root class, it quits working properly and won'...

 
5:04 PM
@skiwi Do you prefer Windows or Linux?
 
0
Q: Bash - Very Simple Unpacking Script For Comments

Adi_KoganHi Everyone, this is my first bash script ever. I would really appreciate it if you could provide me with some comments and insights regarding correct function use, logic implementation, and a lead to how to implement the recursive functionality described in the script's body. Thanks a lot! #...

 
5:39 PM
@pacmaninbw From experience Windows
 
I like Linux / Ubuntu better, much better internal system. But since they made Ubuntu a first class citizen of Windows now, I may run them together, as there are still very annoying audio bugs, login bugs and various other bugs when using Linux, and I'm pretty restricted when it comes to game support as well. Even CS:GO, although best handled well Stream, has serious issues sometimes. Kudos to them for at least trying to fix them all the time.
 
6:29 PM
@MaartenBodewes My PC is Arch. I find Steam's Proton compatibility layer to be really solid, and really like being able to play every game my friends have wanted to play because of it. I'm hoping if the Steam Deck blows up, Linux support becomes a bigger issue and gets more support. However my laptop is Windows because I don't want to maintain 2 Arch systems... and, after first time setup, I think WSL is really good. The only problem I've ran into is the complete absence of systemd.
 
7:05 PM
If you don't know of a specific problem with this code, then your question probably would be a better fit for the Code Review Stackexchange site. — Solomon Slow 25 secs ago
 
 
1 hour later…
8:15 PM
@MaartenBodewes Not just games. Try any enterprisey CAE/CAD software. Most won't run on anything but MS.
 
8:49 PM
0
Q: General coding style and efficiency of a maze maker

Apple_BananaI have just finished making a maze maker. I took inspiration from this video, but its my own implementation. I just wanted to know what you guys thought of it and if there are any improvements that can be made like Improving the way the algorithm is implemented If the code should be less verbose...

 
9:08 PM
@MaartenBodewes Audio software via ASIO APIs seems to be mostly unsupported as well
but I have not had issues with my Arch setup for most games (aside from issues around graphics card switching)
 
9:23 PM
@Vogel612 If I use YouTube and start a game my audio is distorted; I run my audio from my monitor as I use 3 computers here.
 
hmm ... that sounds annoying
 
I think it is a known issue. I think I've got it fixed, but all my trying around broke some things as well. This is always the case when I run Linux - I get an unstable environment because I try and fix things from the internet. Usually I have no idea what I'm running, I just hope that it is somewhat correct. I cannot know everything about the windows environment, all the possible startup and services, USB drivers and whatnot
 
9:36 PM
Your question is too broad, but I encourage you to try again when you have a more specific question. Architecture proposals are not within the scope of stack overflow. Without knowing more about your current architecture and goals, it's very difficult to provide useful input on the appropriate implementation. However, codereview.stackexchange.com may be a potential place to find a useful review. I would hazard a guess that if you do a good job with the implementation, Go will do an excellent job for you - it excels at async and concurrency. — Daniel Farrell 42 secs ago
if you post on Code Review please read the help center pages like How do I ask a good question? - in its current form this post would likely be considered off-topic because there is no working code posted to review. — Sᴀᴍ Onᴇᴌᴀ 42 secs ago
 
10:27 PM
0
Q: The variables inside of a recursion

Prim ElementSo, I've done this problem on CodeWars: Given n, take the sum of the digits of n. If that value has more than one digit, continue reducing in this way until a single-digit number is produced. The input will be a non-negative integer. Examples: 16 --> 1 + 6 = 7 942 --> 9 + 4 + 2 = 15 --> 1 ...

 
 
1 hour later…
11:41 PM
0
Q: X11 file manager in C and Xlib

phillbushThis is a still incomplete file manager for X11. It can only navigate through directories, select files (and do nothing with them), call a script to open files, and call a script to produce and cache thumbnails. Here is the git repository: https://github.com/phillbush/xfiles To test it, do the f...

0
Q: UNIX calendar(1) in awk

phillbushThis is a simple implementation of the calendar(1) utility included in some UNIX systems (all BSDs have it, GNU has not). Here's the manual: CALENDAR(1) General Commands Manual CALENDAR(1) NAME calendar - print upcoming events SYNOPSIS calendar [-l...

 

« first day (3014 days earlier)      last day (986 days later) »