« first day (3301 days earlier)      last day (699 days later) » 

12:01 AM
REFRESH! There are 8082 unanswered questions (89.2968 answered)
 
 
3 hours later…
3:14 AM
NOTE: In case someone is tempted to consider this either a "code review" question or a "matter of opinion": I'm not asking for "better" code; I'm asking whether c# has any syntax that simultaneously keeps both the declaration and the usage simple, in this given situation. [So far, the answer appears to be "No".] — ToolmakerSteve 19 secs ago
 
3:36 AM
Monking
 
 
1 hour later…
5:40 AM
possible answer invalidation by 200_success on question by Mike: codereview.stackexchange.com/posts/276637/revisions
 
 
1 hour later…
6:49 AM
Probably belongs on codereview, not stack overflow. Some minor points to help... Use a queue instead of recursion. The queue can be held as a plain array and you maintain a head and tail pointer or index. Avoid the use of 2D indices. Multiplication is a cost. You can store the position as just a pointer or a 1D index, and use offsets from there (-W, -1, 1, W). Consider some branchless code for both counting and queuing, then measure it. e.g. int *n = p-W; count += (*n==0); *tail = n; tail += (*n == *p); -- where p points to the current stone having its neighbours tested. — paddy just now
My first sentence is in regards to the purpose of Stack Overflow versus the purpose of Code Review. This website leans toward code that doesn't work correctly, whereas Code Review leans toward seeking feedback/improvements. — paddy 59 secs ago
 
 
2 hours later…
8:28 AM
these sort of questions probably fit more into codereview.stackexchange.comrasjani 42 secs ago
 
 
1 hour later…
9:30 AM
0
Q: How to random the questions for my quiz game in C# Console App

Chick3nJoyI create a quiz game app and it is a multiple choices. But, I do not know how to random the questions. Any suggestions here? static void Main(string[] args) { string name; int score = 0, engScore = 0, filScore = 0, mathScore = 0, cScore = 0, javaScore = 0, s = 5; char choose; char Eans1, Eans...

 
 
1 hour later…
10:55 AM
This question would appear to be better suited to Code Review. I'm voting to close it (here) as "Opinion Based". — Adrian Mole 20 secs ago
 
 
3 hours later…
1:33 PM
@paddy: questions asking for new code, especially a SIMD-optimized version of a scalar problem, belong on Stack Overflow, definitely not codereview. Such questions should have working scalar code as an example of what's wanted, as well as English description that makes it clear which behaviours of the scalar code are necessary and which are implementation details. (i.e. what assumptions a SIMD implementation could make.) This question doesn't want comments on the coding-style, efficiency, or other quality of its scalar example; the OP knows it has big problems, so it's not a code review. — Peter Cordes 38 secs ago
A note on the "assignment operator" (a.k.a. walrus operator, because...: look at it := ) of PEP 572: it's somewhat controversial and some teams might flag those in a code review. — Gregor just now
 
2:33 PM
0
Q: Is there a better way of printing Fibonacci series?

Rahul ShivsharanI have written a code below for printing the first n fibonacci numbers, the code is as follows var fibo = function (n){ var num = 1, prevNum = 1, currentNum = 1, printNum = []; do{ if(num == 1){ prevNum = num; currentNum = num; printNum.push(num...

 
2:50 PM
This question is pretty vague though, and I think likely to be opinion-based. You'd be better off writing more code and then posting on the code review stack exchange. — ddejohn 52 secs ago
 
Monking
 
3:31 PM
Might want to check out codereview.stackexchange. Stackoverflow is generally more focused on fixing broken code than evaluating working code. — CollinD 21 secs ago
 
3:47 PM
Monking
 
Monking
 
Monking
What language tags currently have the highest level of being unanswered?
 
4:04 PM
@pacmaninbw As of Sunday, the tags (not specifically language tags) with highest unanswered percentage are reported here
 
Without looking? Probably C++ and Python.
I think we had a better query for that, let me take a look.
 
Just found low hanging fruit you should see
 
0
Q: Returning all multiples of a number as a matrix with N X 2 dimensions

Dollar XI have developed a class structure with methods to return a matrix from a single input array. The objective is to insert the middle value of the array so 2n remains in terms of array length. So there should be an even number always as the minimum number of multiples for any number is 2, given by ...

 
 
Top zombie tags.
@SᴀᴍOnᴇᴌᴀ CC ^
 
4:21 PM
Thanks
Interesting how closely performance matches C++.
Did we lose any python reviewers recently?
 
@Mast That isn't normalised to the volume of questions by tag, though. Is there a percentile version?
 
@pacmaninbw We lost a lot of reviewers over the years.
 
@pacmaninbw I need to stop obsessing over this question. Long story short, your clock is 2 MHz, and you need a 16-bit timer, not an 8-bit timer.
 
@Reinderien Not that I know, but feel free to write one.
2
 
4:40 PM
@Reinderien Thank you.
 
np! it makes me want to take and/or teach another embedded development course. lots of fun
the last one I taught was in... 2015? ish?
 
@Mast noice
@pacmaninbw who is "you"?
 
@Reinderien Never took an embedded course before the end of March. I learned C programming in my operating systems class in 1983. Started using it professionally in 1984. I learned hardware programming on the job around 1990, but it wasn't considered "embedded" at the time, I might disagree with that.
 
niiice. In 1983, I was... definitely not alive.
 
The systems I worked on in the 80s have very limited memory compared to today's systems. malloc() could actually fail.
Well you missed the K&R era.
 
4:48 PM
I did! The 80s would have been such a fun time to learn C. In 96 I started with C++, not knowing any better.
 
@Reinderien Do you see any problems with my devreg.h file.
I learned C++ on the job, at the time it was C with classes.
I have a first edition of Stroustrup somewhere
 
I have an edition of... not that. I learned from Oleg Yaroshenko
@pacmaninbw Sooooo. Aside from the comments in the other answers rightfully pointing out that in production this would all already exist for you, and assuming that your prof is making you write it yourself: it depends on how much effort you want to put into this. In addition to (not instead of) your hex definitions for CLOCK_CTRLE_OFFSET etc., you could define bitfield structs for each of the registers you care about. This is what PIC headers do, and it's handy.
 
The systems I worked on in the 80s were OEM versions of Digital Equipment's PDP 8 or PDP9. Our registers were 9 bits.
 
I worked at Teradyne, Inc, the computers control VLSI test systems at probe test(wafer) and final product, packaged.
 
4:55 PM
fun times. About the closest I got to a bed of nails was when I worked for RIM (now Blackberry)
 
We maxed out at 640 K of memory, almost everything was cross compiled on a VAX 11.
Definitely fun times.
 
Yikes. I had an encounter with PDP bytecode when a university course had us design a PDP-like inside of an FPGA
 
16 years total at Teradyne,
My EE is week, software pretty good.
 
EESE is a very different place from CRSE - a little bit more grumpiness, a lot more volume, but some very knowledgeable people (it will be difficult to avoid Tony)
@pacmaninbw you should split this into "controller support" and "board support", which you currently have mixed. Also, and this is a common downfall of C macros, everything is missing types and usually the implicit types are wrong. Those addresses should be pointers; and the bitfields should be marked as uint8_t or uint16_t as appropriate
 
?? Who's Tony? What is CRSE?
 
5:01 PM
CRSE is where we are now (Code Review Stack Exchange). Electrical Engineering Stack exchange is at electronics.stackexchange.com. Tony is a prolific contributor.
 
ahhh
I just think of us as CR. When I said EE, I meant Electrical Engineering, K maps among other things.
I learned De Morgan in a symbolic logic class in the philosophy department
Ran into him again in a 3rd year electrical engineering class, my only electrical engineering class.
 
ha, awesome. I bet the students in symbolic logic were not thrilled to have math intrude on their humanity
 
LOL
At least half the class was computer science majors
required back then
You don't want to see BASIC code written a philosophy professor, it is total spaghetti code.
He's got to be retired by now.
 
To be fair... code written by electrical majors can be just as bad I'm sure. It's often very "get it done, to hell with standards, legibility, etc."
 
How many gotos?
 
5:08 PM
If you're in C or especially assembly... not zero.
 
In assembly it is a given, there is no other way to loop and most if statements contain branches
 
possible answer invalidation by 200_success on question by stromboli: codereview.stackexchange.com/posts/276615/revisions
 
There are other ways to loop, but you don't want to hear about them
 
@Duga Definitely not.
@Reinderien I'd be afraid to ask.
 
including: direct math on the instruction pointer; or literally resetting the controller when you need to repeat something
 
5:13 PM
Direct math on the instruction pointer should be a no no.
 
There are lots of "shouldn't"s that are still happening in the wild :D
 
LOL
I don't know if you ever programmed on Sun Microsystems, but their OS version 1.2 occasionally rebooted when you were in the debugger. The stack pointer got corrupted.
I used to share the system with 2 other developers, I would let them know when I was debugging code.
 
I did have passing acquaintance with Sun machines. Quirky to be sure. For the longest time, the only mainframe accounts we could get were on the "sunshine" university cluster.
 
Teradyne used them for at least 17 years on their test equipment. Some time in the 2000s they went to Windows, but there was a big fight in engineering about it.
Had to switch bus types among other things, and Windows doesn't have the best real time systems.
@SᴀᴍOnᴇᴌᴀ Any one who wants to up vote an answer from a former moderator.
 
5:58 PM
Do you know where I could find a close example of the non-intrinsic approach intimated in the question ? I am able to find one except this one : codereview.stackexchange.com/questions/255373/…Stef1611 1 min ago
 
@Reinderien Absolutely. We write code like it's all a big flowchart. Procedural and not afraid of a goto regardless of language.
 
possible answer invalidation by anastaciu on question by anastaciu: codereview.stackexchange.com/posts/276598/revisions
 
I've had a colleague who abused Python like it was 80's C.
Deciphering that was always fun.
 
6:45 PM
0
Q: Removing \n and \f from a string

JonJonI am trying to remove \n and \f (I'm not sure what they are called, I know \n is a new line) const test = "Hello bob\nHow are you?\n\f have a nice day\n" const removeL = test.replace('\n', ' ') const removeF = remove.replace('\f', ' ') console.log(removeF); What would be a better approach to cle...

 
7:08 PM
@CaptainObvious Hammer time.
 
Rookie.
Off-by-whitespace.
 
7:36 PM
1
Q: Implementing multidimensional integral for a custom function in C++

CafféSospesoI am not an expert with C++, but I am trying to implement a 4-dimensional integral using GSL numerical integration approach. The code below shows the whole algorithm. Although it seems correct what I wrote, I have some difficulties to get results. It actually takes very long time. Do you have any...

 
8:26 PM
0
Q: Simple C11 mutex implementation using `_Atomic`

gberthiaumeI'm trying to learn concurrency and synchronization using C programming (C11). As a learning exercise, I wanted to quickly implement a mutex I appreciate that this code is almost trivial, but I would appreciate your feedback nonetheless. Additional question: Should atomic_flag be declared as vol...

0
Q: Managing websocket subscriptions

nopThe following code is pulling data off an exchange. It keeps the subscriptions to the channels because when the websocket client reconnects, all subscriptions are gone and we basically need to resubscribe. When a message is received, it parses it directly from ReadOnlyMemory<T> to avoid string al...

 
9:06 PM
@Fmxerz as for the design, you may have your reasons of course. But what I mean is that it's very weird, from a theoretical point of view, to have the parent class being aware of its child. I think the whole design should be re-visited, but of course not under a comment (maybe in a new question for Code Review) — Matteo NNZ 27 secs ago
 
9:17 PM
0
Q: Adapter pattern in C++ via Inheritance and Composition

userPrimeNumberAny suggestions on how the implementation of the C++ Adapter pattern could be improved here? Implemented via: Composition Inheritance What needed to be adapted was the OptionLegacy class which returns implied volatility of the option but the client needs the dollar price so a simple conversion ...

 
9:29 PM
It sounds like you want a code review? — Ted Lyngmo 57 secs ago
"Better" how? What do you find unsatisfactory about it? Please read How to Ask and stackoverflow.com/help/dont-ask; we don't take subjective questions here. Questions about code style and elegance should go to Code Review. — Karl Knechtel 41 secs ago
Further, Stack Overflow is generally not well suited for subjective questions which rely on unclear metrics or general opinion. Such questions will typically be closed. This type of question is better suited for Code Review Stack Exchange—though they have their own requirements, so you should take their tour before just posting this there as is. — Jeremy Caney 17 secs ago
 
10:25 PM
If you have working code, there's a site for that here: codereview.stackexchange.comPaul Sanders 25 secs ago
 
10:42 PM
And all those concerns should be of interest to the code review folks. For us knuckleheads here on SO, not so much. — Paul Sanders 40 secs ago
If you think so. Here I found many useful comments in several occasions similar to this. I posted also in Code Review, but there the probability of receiving an answer seems quite smaller than here. If you think that I should remove it from here, I will. Otherwise, I am happy to keep it for folks that want to answer. — CafféSospeso 39 secs ago
 

« first day (3301 days earlier)      last day (699 days later) »