« first day (2616 days earlier)      last day (1386 days later) » 

12:00 AM
RELOAD! There are 6794 unanswered questions (89.8753% answered)
Questions asking for improvements to style of working code should be posted to Code Review. But see codereview.meta.stackexchange.com/questions/5777/…Barmar 12 secs ago
 
12:58 AM
0
Q: Simple program to print from a buffer until a newline is found

CarcigenicateFor practice, I wrote a small program that goes through a string in the data section (although, it could be easily adapted to take user input), and print out the characters in the string until it finds a newline, then stops. This is by far the most complicated assembly program I've ever written. ...

 
 
2 hours later…
3:08 AM
I’m voting to close this question because it isn’t trying to resolve a specific programming problem. As @Barmar notes, it would be more appropriate for Code Review Stack Exchange. — Jeremy Caney 14 secs ago
 
 
1 hour later…
4:15 AM
0
Q: JSX render method in react

NeshFollowing is the piece of code which is working fine, but somehow it looks bit odd to me to have a function inside a render method and using it in both conditions. Let me know how can I improve this react code as showContainer is only adding a wrapper to the function JSX. Code - render () { co...

 
4:40 AM
0
Q: Calculating a unique count within a rolling time window without an explicit loop

smjI have a pandas DataFrame that contains a row per member per day, expressing member interaction with a website. Members interact only on some days, each member is identified with an ID. Here is a simulated example: import pandas as pd import numpy as np # Generate data. ids = np.repeat(np.arang...

 
 
3 hours later…
7:56 AM
@Reinderien @Peilonrayz It's back.
@RMunroe Unfortunately based on the wrong oil prices so it looks a lot more sensational than it would be based on Brent crude.
 
8:22 AM
-1
Q: Null checking - which is more readable?

tomskyIs this: _ = foo ?? throw new ArgumentException(); clearer, better and more readable than this: if (foo == null) throw new ArgumentException(); The actual exception being thrown does not matter

 
8:32 AM
@Mast Nice
 
 
1 hour later…
9:45 AM
Those screenshots don't make the answer clearer. You can use to_clipboard to get a decent text representation — Maarten Fabré 1 hour ago
Hmm, what is wrong in the screen shots? Get I get more info? And what is to_clipboard?
the screenshots are the output of those commands.
 
Screen shots are not readable for people that are blind. I have translated pictures to text on request of a blind user multiple times before.
Not only does it make the site unusable for people with visual impairments, it give an unsatisfactory user experience for many users
 
Sorry I had no idea that blind people also use the site.
But thanks for correcting.
But this is also new for me. How is seeing text different from seeing images?
 
You can have a text to voice application, (changing interaction from using eyes to using ears) think how Google Translate has the "what does this sound like button"
 
sorry, I rarely have used google translate
not too aware of those technologies yet
Are the screenshots required too? Do I need to give proof that the code is working?
I think maybe it's better to remove those images rather.
 
You can change them to code blocks. The commentor has explained how
 
9:58 AM
to_clipboard? No idea of it too
 
0
Q: Improvements, TicTacToe in Scala

elauserI've just started my journey into functional programming and tried to implement a TicTacToe game Recursively without State in Scala. What I dislike is the JOptionPane but I don't know if i can solve this more elegantly. Does anyone know if i can solve this in a more "Scala" like way? import java...

 
I have used to_html but not to_clipboard. That's why the confusion.Ok I ll do it
 
10:34 AM
Don't those comments already tell you what you are asking? SO is not for code review, there is another site for that — Crowcoder 49 secs ago
 
10:45 AM
@student there's a difference between "bugs" and "improvements" - the two things mentioned sound like "improvements", and frankly: I agree with both of them (they sound like things I've said recently, though - did I say those things? they certainly sound like me); as for "further improved" - again, that's subjective, but I'd add "remove param from GetAllData - it isn't used" - but: you may be looking for codereview.stackexchange.comMarc Gravell ♦ 22 secs ago
@MarcGravell, apprciate your respose. i will post this question on codereview as i was not aware stack also jas code review. I mentioned optimization as well as bug as use comments about bug but code is working fine on my system. since i am new wanted to know more about it — student 49 secs ago
better suited to codereview.stackexchange.com - OP is going to post there (comments) — Marc Gravell ♦ 17 secs ago
@MarcGravell, it okay i tried to post it on codereview, it say can only post 1 in 40 minutes.. — student 28 secs ago
 
11:14 AM
2
Q: Is this code correctly using data connection for dapper

studentI am new to asp.net core 3.1 with no background of MVC i am just moving from webforms to ASP.Net core. i got below comments regarding my code, but this code is working fine for me, I am not sure how to improved it so that its bug free ** comments regarding buggy code received ** it's actually a ...

 
11:39 AM
0
Q: Using two handlers for a GraphQL project; handle query with the second one if the first one is not capable of

Fred HorsI'm trying to use both SuperGraph as-a-library and GqlGen. So I have two handlers: the first one is SuperGraph; this checks that it can carry out the operation the second one is GqlGen; this checks that it can carry out the operation if the first one can't The code I'm using is this: type req...

 
12:00 PM
@Mast Has the user corrected the issue? codereview.stackexchange.com/questions/244837/…
 
codereview.stackexchange.com is a great site for this kind of question. — Steve Bennett 40 secs ago
 
12:23 PM
Might be better suited for codereview.stackexchange.comtobias_k 34 secs ago
 
12:53 PM
0
Q: Check that elements in list follow a specified date-format schema and are not null/na/nan

Jacob CollstrupI'm practicing some data-analysis and I'm currently checking the integrity of my data. The elements that do not follow my date-schema, should be funneled to a new separate list so I can work on strategies and suggestions on how to handle these exceptions. The following code checks the format succ...

 
1:12 PM
@pacmaninbw It was blatantly off-topic. At least it looks ok now.
But I don't Angular, so, not sure. Retracted my CV hours ago anyway.
 
Thanks, I already decided to leave it open, it was off-topic before the edits.
I go a step farther (I run away from any JavaScript).
 
I used to do that.
Turns out you can write relatively sane things in an insane language.
 
0
Q: Using Newton Method in a Neural Network/

Erik Davino VincentI programmed a Neural Network to do binary classification in python, and during the backpropagation step I used Newton-Raphson's method for optimization. Any kind of feedback would be appreciated, but mostly I'd like to know if all of the gradients and hessians were computed correctly - for the e...

0
Q: Can this SelectionSort Algorithm using Python be improved?

Ashwin GounderI am a rookie and I seek the coding community to help me optimizing this SelectionSort() algorithm which I have tried using Python.Looking forward for your suggestions.Thanks in advance. def selectionSort(arr,an): for lastUnsortedInteger in range(an-1,0,-1): largest = arr.index(max(ar...

 
@Mast I'm not sure I can bend my mind that way, for a few years I tried web development and hated it, jQuery was part of the problem.
 
1:30 PM
Oh, yea, I try to stay away from anything front-endy
I still have a project running that should be the last of it (in Python, so it couldn't've gone that bad I thought (I thought wrong)).
 
@Mast Those of us that think logically might have a problem with front ends.
 
@pacmaninbw The only logical conclusion is front-ends defy logic.
Technically it just has a weird idea of logic.
Realistically I simply don't like it.
 
1:47 PM
@Mast Same here, I just don't care what something looks like as long as it's not code.
off by one or two pixels is always a problem for me.
 
Thanks to frameworks it doesn't have to be a matter of pixels. Just put it roughly where it should be and only use rectangles.
 
@An225 i updated my answer with code reviewed, it works for sure (it just used one blueprint) to isolate the logic. — cizario 42 secs ago
 
Python Tkinter can work with lay-outs roughly like C# can with XAML, grid-like structures.
Create a table, fill it out and let the framework do the alignment.
Use sensible sizes and it doesn't look that bad.
 
@Mast Flex boxes, flex boxes all the way
Who needs frameworks ;)
 
Python has flexboxes?
I only know those from CSS.
 
1:50 PM
Nah, CSS does
Oh, I forgot front end is more than just browsers...
 
Yes, GUI is also front-end.
Technically even CLI is front-end, but, that's semantics here.
 
But I much prefer CSS than TkInter, it's just so much easier to make something that doesn't look like it's from the 60s
 
What, and use a HTML/CSS/JS front to send your data to Python?
 
In a perfect world it'd be the HTML/CSS/Python stack ;)
 
I have news for you.
It shouldn't come as a shock to you, especially in 2020, but...
The world isn't perfect.
3
 
1:55 PM
I thought you were about to say here's a framework with that.
You really got me grounded in reality now >:(
3
 
Oh, there's probably a JS framework that runs Python.
There's a JS framework for bloody everything nowadays.
 
They've compiled Python to WASM so I can run Python in the browser... But... Yeah maybe not
 
I've heard about Anvil, but I'm sceptical about that.
 
> Create your UI with drag and drop
Hmm, that's a hard pass from me
 
@Peilonrayz That never ends well.
 
1:59 PM
This is the kind of question you should ask in Code Review. — Ann Zen just now
Hi Ann Zen. In the future please use doubtful wording and link to the help center when recommending Code Review. Take, "This may be on-topic on Code Review. Please check if it is on-topic and how to post a good question before posting there." — Peilonrayz 6 secs ago
 
A UI should be modifiable with parameters, just like the rest of the code. No drag-and-drop, but coded up.
 
Yeah, I've only used drag and drop once. It was in VB.Net and I stopped doing that ASAP. Making a calculator with drag and drop... no thanks
 
Heh, I used VBA once to programmatically sketch HMI lay-outs. I may still have that code somewhere.
 
2:17 PM
That sound pretty interesting
 
@JimB I didn't have type Cache interface in the beginning but in the code review I was told to create an interface and use Set() and Get() through it. So I am not sure how to implement it. That's why i posted the question. — Farzam Alam 20 secs ago
 
@Peilonrayz Mostly for lay-out purposes, but it did help. I can probably recreate it if I don't have it handy somewhere.
 
cjld jcfld jc j ghyf fgu... That would never pass a code review 😱 — Legacy Code 26 secs ago
 
 
If someone told you to create that type, and you don't know why, you need to ask them. That's one of the key reasons for code review--to improve understanding. So go ask them. We can't really read your code reviewer's mind, and we don't have enough context to come to our own conclusion. — Flimzy 53 secs ago
 
2:27 PM
And then there's people willing to make uploading pictures even easier...
-2
Q: Image uploads are too slow

Franck DernoncourtImage uploads are too slow. It takes at least 5 seconds to upload one image (demo: https://youtu.be/laNmsiLhcFY), not due to upload speed but because imgur processing is slow.

@Mast you should consider all images uploaded to stack exchange over time and consider all the human time wasted. — Franck Dernoncourt 49 mins ago
 
@Mast I normally have the image on a third party site, so I just type the markdown and viola no upload to Imgur
I also noticed you on the outdoors meta about qpixel (IDK how it's spelt). Seems like they've actually got an MVP, just not in the language they want...
 
@Peilonrayz They've had a barebones MVP for Writing for a while now, and while it functions, I don't think it's close to what they had in mind yet.
 
Oh I don't remember Writing. I'm surprised at how far its come tho. But then again I'm judging it of the UI and their links/docs/pages whatever seem a bit lacking
 
2:43 PM
The problem of moving any community to anywhere is momentum. Whatever you come from has it, whatever you move to hasn't.
You can't 'migrate' a community like you can do with a server.
The neighbour's grass always looking greener until you buy the place doesn't help either.
 
Yeah, I can only see this fracturing the community, making two distinct communities. Or one if one disappears one day...
 
3:14 PM
This question probably belongs on codereview.stackexchange.com: it is not a specific programming question within the scope of this site (which is not a discussion site). — James_D 16 secs ago
 
@Mast This expects UI guru's to be coders, where they would really want either WYSIWYG or at a minimum drag and drop.
 
0
Q: Filtering a Vec of structs and creating new vector of Strings or strs in Rust

BillyI'm working through the Rust book, and it has the following example of how to use the filter method on Iterators (source): struct Shoe { size: u32, style: String, } fn shoes_in_my_size(shoes: Vec<Shoe>, shoe_size: u32) -> Vec<Shoe> { shoes.into_iter().filter(|s| s.size == shoe_size)....

 
3:45 PM
1
Q: Primitive Calculator

sarfaraz alamProblem Introduction You are given a primitive calculator that can perform the following three operations with the current number 𝑥: multiply 𝑥 by 2, multiply 𝑥 by 3, or add 1 to 𝑥. Your goal is given a positive integer 𝑛, find the minimum number of operations needed to obtain the number 𝑛 ...

0
Q: LeetCode 410: Split Array Largest Sum

EmmaI'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem Given an array which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algorithm to minimi...

1
Q: Basic raytracer written in Rust

Calvin GodfreyI come from a fairly strong background of C and thought that this project would be a good way to get a handle on Rust. Right now, I have everything in one file because I wasn't sure the best way to organize the code (at least not yet). Let me know if I should post anything else (the .toml for the...

 
4:03 PM
@pacmaninbw WYSIWYG is not maintainable in the long run. It's great for sketches, mock-ups and first versions. After that, it's a nightmare.
 
0
Q: approach to solution and time complexicity

KetanLalcheta/* The city is rectangular in shape of size having 'r' rows and 'c' columns. The city is divided into 'r x c' cells. Each cell is either '#' or '.' denoting whether the cell is BURNING or is SAFE, respectively. You can move horizontally or vertically from the block you are standing on. You cannot...

 
Monking
 
Monking
 
4:19 PM
Monking
 
4:36 PM
goto is hard to use correctly, but it is even harder to convince other programmers that you used it correctly. It will usually take less time to restructure the code than defend a goto in a code review. — user4581301 33 secs ago
 
@Mast Micro Soft Word does a fairly good job, but I tend to agree with you. The WYSIWYG would have to generate HTML, and CSS and maintain it to keep things correct.
And I hate cleaning up Word generated HTML.
 
@Peilonrayz You should see what it does to numbered outlines and table of contents if you think that is bad.
 
I don't use it, the worst I ever got was problems with images... I guess it was a blessing in disguise
 
Just think of the number of software engineers and programmers that MS keeps employed for that stuff.
 
4:53 PM
I never thought about that, an "f" in the chat for Word programmers.
 
Got my camera today
Also got one of my bikes to my house today
 
5:24 PM
0
Q: Getting Graph and Block Animation to Run Smoothly Together

jaredI have been working on some code that produces a live graphic of a graph and blocks moving. It works in theory but does not look like how I want. The animation runs very slow when showing both the graph and the blocks together (a code of each alone works much better). How can I get them to work t...

 
As Emma said, this is better suited for Code Review, but I can already provide some feedback: You store the values as user Something but access them as something, so you get null. You should useprompt("something") instead of [prompt("something")]. The last one creates an array, which is probably something you don't want to do. Maybe you should handle if the user presses "Cancel". In that case, the return value of prompt() is null. — D. Pardal 45 secs ago
 
 
1 hour later…
6:43 PM
If you have a working program and looking for review, Code Review is a better place for that than Stack Overflow. — oguz ismail 33 secs ago
Questions on improving working code in terms of best practice, efficiency, readability, ... are better suited for Code Review. How anyone would want to do it, is a matter of opinion. — trincot 56 secs ago
 
7:10 PM
@James_D - I will move this to codereview and re-word it so that it's more in harmony with that site's intended purpose. — Michael Sims just now
 
7:27 PM
0
Q: Is there a simpler way to replace nested property?

java-man-scriptDuring an interview I've got interesting javascript-task: Given the code: const testStr = "bar.baz.foo:111222", testObj = { bar: { baz: { foo: 333444, foo2: 674654 }, boo: { faa: 11 } }, fee...

0
Q: Optimize function that returns length of a subarray

hoplaI did an exercise today on where the task is to write a function that returns the length of the longest subarray where the difference between the smallest and biggest value in the subarray is no more than 1. I had a solution that works but it's too slow to pass the tests that have big arrays. Wha...

 
Hello, is there a way to private message a user? The alternative would be to reply to his in a comment, but it's not entirely on-topic with his question...
 
@cloudy_eclispse You can invite them into a 1on1 chat. First go to their chat profile (if they have one) then you want to click "start a new room with this user". If they don't have chat or you can't find their profile posting it as a comment seems like the least worst thing to do.
 
I did a code review on your git project, make sure to check your github notifications. — theDavidBarton 5 secs ago
 
7:52 PM
0
Q: How to ensure threads running infinite loops are terminated before exiting the program

Michael SimsAs a hobbyist programmer, I gain knowledge where I can find it from google searches. I tend to write code that utilizes threads that have infinite loops using while loops, where the while condition slaves onto a BooleanProperty that when set false, causes the thread to interrupt the loop. I use a...

1
Q: Count the number of riders in each category

PythonIsBaeI have a code to get riders from certain teams and calculate the number of riders in those teams in that category: disqualification_reasons = ["WKG", "UPG", "ZP", "HR", "HEIGHT", "ZRVG", "new", "AGE", "DQ", "MAP", "20MINS", "5MINS"] with open("results.csv", 'rt', encoding='UTF-8',errors='ignore...

 
@Mast I've put it in a repo with some documentation. But I'll leave it a day or two before asking for feedback :)
 
8:41 PM
0
Q: Simple Pretty-Bytes Size (SI System)

Mohsen AlyafeiThis is a simple and short "Pretty Bytes" javascript function using the SI Decimal System for quantifying bytes. The code does not use complex maths such as Math.pow() or Math.log() and mainly uses strings with an array. The function uses the SI system of decimals as shown below (1 kilo = 1,000, ...

 
9:13 PM
@DerKommissar yay! what do you like to click btw ? genre-wise
 
What do you mean?
 
you bought a camera for photography, right?
 
Yeah, sorta. Gonna record educational / instructional videos
 
noice!
 
Should be a good time ;)
I'll post links as I have videos ready
 
9:25 PM
I've only recorded a controlled event, from a stationary angle. So just put it on a tripod and hit record, that's all I know.
@DerKommissar video/ audio podcast hobby is booming!
 
0
Q: Call method by condition

ZOOM SMASHI apologize in advance for my English. I have a user search method. It's parameters - login and strict. The last one determines, which method should have been used for search - Equals (strict is true) or Contains (strict is false). How should I implement it? I could do two different methods, but ...

 
10:20 PM
0
Q: LeetCode 894: All Possible Full Binary Trees

EmmaI'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem A full binary tree is a binary tree where each node has exactly 0 or 2 children. Return a list of all possible full binary trees with N nodes. Each element of the ...

 
 
1 hour later…
11:34 PM
0
Q: Finding the sum of all numeric palindromes that are less than N

AndrewL64I wrote a function that finds the sum of all numeric palindromes lesser than N. const sumOfPalindromes = (n) => { let x = 0; for (let i = 0; i <= n; i++) { x += i == (''+i).split('').reverse().join('') ? i : 0; } return x; } console.log(sumOfPalindromes(10000)); console...

 
11:46 PM
@ankii more like an education video series but yeah
 

« first day (2616 days earlier)      last day (1386 days later) »