« first day (2596 days earlier)      last day (1719 days later) » 

00:00
RELOAD! There are 6738 unanswered questions (89.9035% answered)
00:27
@CaptainObvious The answer is yes, broken code.
@pacmaninbw Ran it on LeetCode it's accepted. So, no - it works in the OP's environment.
OK
@Peilonrayz Did you up vote it, it really belongs on SO.
@pacmaninbw No
00:56
Oh, I noticed that that may not have been clear. No I didn't upvote it. And it probably is better for SO, but I don't know their rules. However IDK if it's off-topic here as it's not broken. IDK about "any and all" and I don't think it's off-topic for authorship as the author knows why it's written the way it is. I'm sure someone, like @Mast, can put the pieces together nicely to show me that it is in fact off-topic here.
01:39
This is probably better suited to codereview.stackexchange.comNick 16 secs ago
0
Q: The intersection of two polygons in C++

Jerik MangubatI implemented the intersection of two (convex) polygons in C++. It finds the polygon in the intersection like in this image. Looking for any and all feedback. I left the logic for line intersection and point containment out. #include <algorithm> #include <cmath> #include <iostream> #include <opti...

02:08
1
Q: C++17 enum macro with to_string operator

sudo rm -rf slashI created a simple enum macro that creates a to_string method for the enum. This has been done before, but my version is designed to compile quickly. From what I can tell, existing libraries use deep preprocessor macros and lots of template instantiations which is taxing for large enums. Here i...

02:23
@Peilonrayz I post the SO How to Ask link when I suggest that the user is off-site. When a poster asks specifically if their code has UB, I smell a problem.
 
1 hour later…
03:41
0
Q: Trying to avoid repeated symbols in C?

user225976Is this the best way? Is it better to use ternary operators, but repeat '.', 'l', 'a', 'n', 'g' and other stuff? What is the best way to simplify this code, and minimize repeated symbols? unsigned char NameSize = Settings.Lang.Char3? 12 : 9; char CurrLangPath[ResourcesLen+NameSize]; memcpy(CurrLa...

04:00
@CaptainObvious Could someone please help me out, here?
0
Q: NameError: name 'PlayerIG' is not defined

OmegaI have just started learning Python and decided to get extra practice and followed an youtube tutorial on how to create an adventure text-based game. Because the video was old, I made a few changes for Python 3.8 and added a few extra options for better navigation. The current issue I'm running i...

04:28
0
Q: Digital Clock Script

DanielP533While learning JavaScript I thought it was a good idea to make a digital clock program. I followed a youtube tutorial (with some tweaks to my preference) and came up with my final code that I have. I came to CodeReview to get the script reviewed, and to ask is there anything wrong with the script...

05:14
0
Q: change the promise to async await

dudleyI want to the function below to async await format the function is same as below function getUserInfoApi({ idToken }) { const options = { method: 'GET', headers: { Accept: 'application/json', 'Content-Type': 'application/json', Authorization: `JWT ${idToken}`, }, ...

 
1 hour later…
06:24
0
Q: Rotating a matrix by 90 degrees

IvenBachI'm going through books and various questions to improve my algorithm knowledge. I solved each NxN matrix first by hand and applied that process to build the code from that. I have done my best to break each task into its own step and keep them encapsulated. Below is the class followed by its acc...

06:44
This looks more like an answer that belongs on codereview.stackexchange.com — Oddthinking 1 min ago
06:56
@Peilonrayz @pacmaninbw It's a specific request to fix current behaviour that OP can't explain. Depending on how hard you want to play it, it fails on-topicness for wanting an explanation of current code or for failing the first rule of Code Review: do I want a review of any and all aspects of the code.
Considering the request, I think SO is a much better place for it indeed.
But, considering it seems to work and C++ being almost as riddled with UB as C...
Yet, there's an answer that explicitly mentions already it shouldn't have been answered.
This is what we call a Royal Mess (TM).
@J.Doe Welcome to The 2nd.
In general, when you know a question shouldn't be asked on Code Review, it's better to close it than to answer it.
If the question is how to avoid UB in general, that's a question for Software Engineering.
Where it has been asked and answered before.
And in part already on SO I imagine.
After some consideration, I think the question could be salvaged by rewording it greatly. Whether that will still fit the intent by OP or not, I do not know. That may not be relevant either, since the alternative is closing the question.
Is that something you'd want @J.Doe
07:31
I just realized nobody has linked to the site scope yet. Please find our help center and FAQ on asking questions if anything is unclear. Feel free to ping us in chat too.
 
1 hour later…
08:38
SO isn't really the place you should go to for a code review — Stultuske 6 secs ago
I’m voting to close this question because it's a CodeReview request: codereview.stackexchange.comStultuske 25 secs ago
0
Q: Windows Form Log in and Dashboard

LV98I'd like to see and hear some reviews on my current Login and Dashboard code. It's a desktop application only to be used internally and not over the web. If you have any code suggestions - I'd be more than happy to see it and see where I can improve. LoginScreen.cs using System; using System.Coll...

09:06
-1
Q: How to reduce so many if else?

SamulafishI have below code: c1 = ["Mary herself","Mary is mine","John himself","John is mine","Alan himself","Alan is mine"] s1 = pd.Series(c1) c2 = [1,2,3,4,5,6] s2 = pd.Series(c2) dictionary = {"A":s1,"B":s2} df = pd.DataFrame(dictionary) print(df) for i in range(6): name = df["A"].iloc[i] if "Mary"...

09:52
0
Q: Special Monte Carlo Simulation

Kartik ChhajedI am doing a simulation of a model, RASEP. I wanted to write the optimized code to figure out Quasi-stationary state. The model is: A 1D binary string has the following dynamics $$110 \to 101$$ each with rate \$p<1\$. That is if we see \$110\$ in the string, then we change to \$101\$ with probabi...

10:11
google it, my friend. You're not the first to get this assignment. Look around and steal some ideas here and there. codereview.stackexchange.com/questions/92586/…Paul 55 secs ago
 
2 hours later…
11:54
0
Q: argmax of List of Double

blue-skyHere is my implementation of arg max in Scala. q_table_test.txt contains: ["---------,'0','0','0','0','0','0','0','0','0', "X--------,'0.', '0.1', '0.1', '0.1', '0.1', '0.1', '0.1', '0.1', '0.1'"] For example the String ---------,'0','0','0','0','0','0','0','0','0' maps to key: "---------" , wit...

Well, first off, "How to write the function cleaner?" is off-topic on SO. It might be a good question on code review. Another problem with your question is that it contains more than one question. The one above and the one about the error. And the last problem, regarding your error is that you haven't included the code that produces it (If I just use your code I'm not getting that error). Despite all of the reasons above to close your question as off-topic, I tried to help you as much as I could by providing useful insight. — tao just now
12:33
@Mast The link was in my first comment that I deleted when @Peilonrayz told me it worked in the posters environment as well as retracting my VTC.
@Mast I'm not sold on that, to me it looks far less off-topic than asking to fix warnings. After sleeping on it, explanation of code seems a like a stretch as it's no different from "How good is my code following {OOP/FP/buzzword}". So if I see it in the queue I'm going to VTLO. If anyone wants to close for something that isn't "broken" then I'm not gunna fight you on it.
@Mast Did not mean to cause a Royal Mess..
I flagged the post so that my comments would be deleted if they were wrong.
Or harmful.
12:59
@pacmaninbw FWIW I'm happy to apply a CV on your behalf
@pacmaninbw Don't worry about it. These things happen
@Peilonrayz Thank you.
0
Q: JavaScript Proxy: set DOM Element styles by chaining CSS setters

Danny '365CSI' EngelmanFirst time creating my own Proxy handler, instead of copy pasting code. Goal is to chain CSS definitions: style(element).color("red").background("green") and allow whole CSS objects: style(element).CSS({color:"red",font:"12 px Arial"}).background("green") Any optimizations? let handler = { ...

@Peilonrayz It's so easily fixable I didn't VTC myself either. I'll take a look at it in half an hour to see whether or not anything should be done yet. On mobile now.
13:15
@Mast No problem :)
13:27
-1
Q: C++ Templated Trie

Carlo MerolaI did a templated Trie. The KeyType is the type of the key to insert in the map. The ContainerType is the container that contains all the keys you want to insert. For example I used char as the key and string as the container. The program runs for every container and key. You may use it with keys...

-1
Q: Why "int n=1; void f(int& n){} int main(){std::thread(f, n)}" does not compile?

JohnWhy does not the code snippet compile? You can check it on http://cpp.sh/9l5i4. a is a lvalue reference indeed and function f2 needs a reference, why does not std::thread t2(f2, a); compile? I would be grateful to have some help with this question. #include <iostream> #include <utility> #include <...

0
Q: Generate the name of a computer from its properties

Jean-PierreI am writing a small application to generate the domain name of computers, from their known properties, and business rules. My Asset class is: public enum AssetSite { Rotterdam, Sydney, } public class Asset { /// <summary> /// Gets the Asset Tag of the asset. /// </summary> public string...

13:58
Removed part of the ambiguity, I think. Honestly, it doesn't matter much.
I assume you mean the test case time out because your program is to slow to return a result? If so you'd better ask your question on the CodeReview SE which is more relevant when you want to improve working code. — Aaron 6 secs ago
Thanks for the edit Mast ^^
14:48
Monking
15:01
Monking
15:18
@CaptainObvious no
code review: 1.0 and 0.0 could be stored with integer mov (with the right bit-pattern for 1.0). You don't need fld1 / fldz / fstp, just integer stuff like you're doing with mov dword [Math],0x42652EE1. IDK why you're storing to a named static-storage temporary instead of using the callstack, or a read-only constant that already has the right value. Also, you don't need to fxch if you're just going to use jne. — Peter Cordes 16 secs ago
possible answer invalidation by Your Common Sense on question by FamousAv8er: codereview.stackexchange.com/posts/234405/revisions
0
Q: Will my code be more performatic if I parallelize some calculations using Promise.all?

gabriel_vincentI have a task in my code that consists of performing multiple unrelated calculations. If I put all the functions that do these calculations in an array of Promises and resolve them with Promise.all, will it be faster than running each function synchronously? Here is an example of the code: getMan...

possible answer invalidation by Taylor Scott on question by Taylor Scott: codereview.stackexchange.com/posts/243576/revisions
15:53
@CaptainObvious One more to close.
possible answer invalidation by Taylor Scott on question by Taylor Scott: codereview.stackexchange.com/posts/243576/revisions
@Duga rolled back
@Duga ^^
@Duga I'm not sure what to say about that one - YCS is the one who removed the code after adding an answer...
16:11
0
Q: Implementation of itoa

Edeniaint get_digits (int num) { if(num < 10) return 1; if(num < 100) return 2; if(num < 1000) return 3; if(num < 10000) return 4; if(num < 100000) return 5; if(num < 1000000) return 6; if(num < 10000000) return 7; if(num < ...

@SᴀᴍOnᴇᴌᴀ If it invalidates his own answer that's his own problem then. As long as it doesn't invalidate the other answer (yours), shrug.
That question has an interesting history though.
let's all edit each others stuff 😁
"Thanks, Santa!"
@Duga Only one thing to say about that edit history, "Oh my lord!".
16:29
@pacmaninbw Hmm... the last edit (after mine) looks like another flood when Side-byside Markdown is selected but then with Side-by-side selected it looks like just the one word, i.e. "according", in the narrative was changed; I wonder if the Common Mark makes a difference...
I'm glad I can use my Home button on my keyboard to scroll to the top
Will SE change the label from Side-by-side Markdown to Side-by-side Common Mark?
@SᴀᴍOnᴇᴌᴀ Considering CommonMark is a specification of Markdown, that won't be necessary, I think.
This answer asked about it
30
A: We're switching to CommonMark

Eliah KaganHow will old revisions, in cases where they would trigger edits if they were current, be displayed when viewed? To clarify my motivation for this question: As I understand it, each post that is currently not valid CommonMark will be updated by one non-bumping edit (which I presume will be shown ...

Your understanding is perfectly correct. In the revision history we calculate and diff a post's HTML on the fly based on the revision's markdown source. That means that after switching over to CommonMark, even revisions that predate the CommonMark migration will be rendered with the new CommonMark renderer. I know, that's less than stellar but it's all we can do if we don't want to keep the old renderer around forever. — Ham Vocke ♦ Jun 2 at 8:40
0
Q: Fully buffered stream with atomic commit

George BarwoodThis is a class from an implementation of SQL in C# I am writing. It fully buffers all reads and writes, and also logs changes to a log file so that updates are atomic ( all or nothing ). It implements the standard IO.Stream methods, but also has a "FastRead" method that allows direct access to t...

0
Q: Calculating primes: Could this be any faster?

IanHackerI've ported a prime-number calculation program from primes.pyx to C++ for benchmark purpose. Since I wrote it in C++, I thought that my program would be faster than the original. However, mine took 25.8 ms at the fastest, while the original took only 1.45 ms on the same machine. I tested 10 times...

This might be better asked on Code Review since it's not requesting help to resolve a problem. — devlin carnate 32 secs ago
16:58
Thanks i was not aware of code review — gkkkab 1 min ago
 
1 hour later…
18:53
0
Q: TypeError: Cannot read property 'execute' of undefined . node.js how to export oracle db connection

Swapnil ShendeHi I am new to node and oracle.I have created a app and made a successfull connection to db. I need to use connection object across the application how can i do that? Below is my index.js file const express = require("express"); const app = express(); const authRoute = require("./routes/auth"); ...

@CaptainObvious no... shouldn't have gotten through first posts queue without a CV...
It appears there are some robo-reviewers in that first-posts queue
19:17
0
Q: Optimize c# Neural Network project

NephilimI'm writing a NeuralNetwork library, so everyone could use it and I'm wondering if I can optimize it even more. Unfortunately, I can't past the whole code here, so if you are interested in helping me - here is the repository (the NeuralNetwork library is in the "NeuralNetwork/NeuralNetwork.cs" pa...

0
Q: TypeScript model and API response data diff checker report

htmnThe problem As a Front-end developer, I do not have control over the data that is returned from the Backend. I sometimes notice that the data shape and types I expect on the Front-end are different from the actual data inside the API response. I don't want to manually look up these differences an...

@DerKommissar I have a tower I want to rebuild for CentOS 8. I want to replace the HD's with SSD's, what motherboard CPU combo do you recommend?
@pacmaninbw Budget and expected performance?
@SᴀᴍOnᴇᴌᴀ Have been, for years.
@pacmaninbw Do you need more than one PCIe x16 slots (gaming video)?
@CaptainObvious RBA
@DerKommissar Not really, just want one monitor and doesn't need gaming resolution.
Not going to be creating a lot of videos or playing games.
Mostly coding and testing.
19:25
An i5, i7 or i9 would be sufficient, depending on the price you are OK with. I'd go 10th gen i7 or i9, then either LGA 1200 (for i7) or LGA 2066 (for i9) MB with onboard video.
What are the benefits of i9 over i7?
More cores, but it has no integrated GPU so you'll have to get a discrete one.
i9 is also generally faster, but unless you're hardcore gaming or running a massive server on it, i7 is more than enough.
I have a 5th gen i7 still running like a beast.
That motherboard would be solid unless you want quad-channel RAM.
But dual channel at 3000+ would be super quick. Even better if you get 4000+ Mhz.
The LAN port should support 1Gig easy, rated for 2.5G but you need special switches for that.
If $300 on the MB is too high, this would be a great alternative: newegg.com/asus-rog-strix-h470-i-gaming/p/N82E16813119306
Slower RAM limits is all.
Looking for max RAM either 64G or 128G faster RAM is better.
Otherwise the first one.
(I have all this stuff in a Newegg wishlist lol)
Looking at a base cost of $800-$900 for the MB+CPU+RAM if you go the i7 route with 64GB.
At 3600Mhz, as well.
If the RAM is too pricey and you're good to drop speed, this Kingston is a good replacement: newegg.com/p/2KY-0009-000W8
That's pretty inexpensive, last system was about $2000 but I don't need a tower and power supply.
19:38
That's 2400Mhz, but at dual-channel you'll see pretty good throughput.
Have usually gone with Micron memory.
Yeah, tower + PSU is usually pretty reasonable anyway.
Want the 3600Mhz
Micron only has a 2666Mhz option, it would be a good alternative to the Kingston: newegg.com/p/1B4-00SK-000A8?&quicklink=true
If you want to go 3600 -> 4000 you have to almost triple the price, by the way.
The first was 2.9Ghz @ 8 cores + HT, the second is 3.8Ghz @ 8 cores + HT.
@DerKommissar I'm surprised to see an Intel recommendation. :) All I here is how AMD are wrecking Intel for the first time in years
19:42
Both have the same UHD Graphics CPU.
@Peilonrayz Honestly I have no issue with AMD, but they get hot a lot of the time.
The Intel 10th gen get hotter atm IIRC
The faster i7 option looks good, will Linux fully support it?
I had problems with the LAN drivers the last time.
LAN as in cable or wireless?
Cable, don't believe in wireless.
It can be hacked
Oh, I've only had problems with wireless and Linux. Never had an issue with cables so I can't help that :(
19:51
Wireless is the devil
4
Absolutely.
Trying to find LAN details
Intel® I225-V 2.5Gb Ethernet
ASUS LANGuard
0
Q: Any improvments or suggestions for my makefile?

Foo BarI wrote a makefile that would generate a simple executable from the example directory structure. project/ source/ include/ makefile The makefile itself comes equipped with dependency tracking, and automatically generates two directories named build and dependency. Currently the makefile I ...

> With the new platform comes a new NIC, and this time it's a 2.5Gbe I225-V. But one small problem, this kext no longer uses the E1000e Linux base that IntelMaussi uses. So until support comes, we're likely gonna be without ethernet on this platform for quite some time unless Mieze has something cooking in the oven - Reddit
That's under hackintosh so it may work for non hack pcs but IDK.
20:06
@DerKommissar the Z490 boards have been tested with Ubuntu. I'm going to guess that the Linux code is the same for CentOS.
^^code should be core
20:23
yay - we finally got more than 200 views on this:
11
Q: Let's update the modal for new askers

Sᴀᴍ OnᴇᴌᴀThe Issue There are many posts on CR that are off-topic for various reasons... Sometimes 10-20 per day! Apparently many users don't read/heed the text on the right side (i.e. "Your question must contain code that is already working correctly, and the relevant code sections must be embedded in th...

@SᴀᴍOnᴇᴌᴀ Yay :D
20:47
@pacmaninbw Nice, there you go :)
21:20
@CaptainObvious looks a hypothetical user...
22:13
22:46
0
Q: Callee specifying more spectific behaviour of the caller

vankesselI am working on a game in Unity/C#. I have a section of code that both feels like the best solution and code smell. There are two objects. A player, and something interactable. The interactable object defines a method from an interface IInteractable with the signature void Interact(GameObject int...


« first day (2596 days earlier)      last day (1719 days later) »