« first day (2629 days earlier)      last day (19 days later) » 

12:00 AM
RELOAD! There are 6832 unanswered questions (89.8524% answered)
12:27 AM
Q: Computing the minimum number of swaps necessary to sort an array

Matteo NNZProblem statement I have the following problem statement: You are given an unordered array consisting of consecutive integers [1, 2, 3, ..., n] without any duplicates. You are allowed to swap any two elements. You need to find the minimum number of swaps required to sort the array in ascending or...

3 hours later…
3:42 AM
Q: Hangman Bot built with performance in mind

TajyManyI'm working on a bot that can use a wordlist to play hangman optimally as fast as possible. With the current implementation, the simulateGame function, which plays a whole game against the bot, takes ~500-700 microseconds to execute for the words I've tested, like "fatherhood", "esoteric", "joyou...

4:05 AM
1 hour later…
2 hours later…
7:23 AM
Q: How to modify array of object

Donitta JohnI want to modify object of arrays , such that a new key with incrementing value. For eg: myArray = [{id: 1, patientId: 1, therapy: {id:3,name:"test"}, moa: {id:3,name:"test"}, drug: "Lorem Ipsum drugs"}, {id: 2, patientId: 1, therapy: {id:3,name:"test"}, moa:...

7:53 AM
Welcome to Stack Overflow! Please visit the help center, take the tour to see what and How to Ask. Improving of code questions normally belong at codereview — mplungjan 10 secs ago
@CaptainObvious RBA
@CaptainObvious Nooo not another question, hopefully it gets roombaed ;_;
@Peilonrayz Closed and at -3, probably eventually.
@Mast Yeah, no answer either. It'll just make my custom filters even more icky for a couple months :(
Hmm, after @SᴀᴍOnᴇᴌᴀ pointed out that a question with just a title change didn't get put in the queue I'm tempted to test if tag only edits put it in the queue. If so I could clean up the stragglers safely
8:23 AM
@Peilonrayz Worth a shot.
Let us know how it turns out.
@Mast Yeah, I wont test it until later so we can easily fix it if it goes pearshaped
8:52 AM
@Peilonrayz Just give a shout and we'll watch the reopen queue like a hawk. No worries.
9:25 AM
Q: Iteration over an XDocument based on some existing elements and conditions

KasrakI wrote this piece of code which works as expected: XElement theContentWhichIncludeBuilds = xDocument.XPathSelectElement($"//Project/Group").Elements() .FirstOrDefault(e => e.Name== "Content" && e.Attribute("Included").Value == "buildings"); It will target all the Gro...

@Mast That's the plan. :)
@DerKommissar Thanks for showing me how cool curses is. I have a program that could really use it, but I was using ANSI and it's now broke on Linux ;_;
9:55 AM
Dear @emix, I tried to post this to codereview but I can't because it has no relevant tag. So you won't let me post here, and I can't post there. What do you suggest I do? — SteveF 21 secs ago
Dear @Toastrackenigma, I tried to post this to codereview but I can't because it has no relevant tag. So you won't let me post here, and I can't post there. What do you suggest I do? — SteveF 20 secs ago
10:10 AM
@SteveF If that's the only problem, we can create the tag for you. Please make sure you read the Code Review FAQ on asking questions first, clean-up your question and reply to this message afterwards. — Mast 57 secs ago
10:30 AM
possible answer invalidation by Kasrak on question by Kasrak: codereview.stackexchange.com/posts/245515/revisions
@Duga thats ok
If you want feedback on working code, codereview is the right place for that. You seem to be contradicting yourself by saying you would like feedback, but not for it to be reviewed? — DBS 40 secs ago
Q: C#: A* pathfinding - performance and simplicity

XamtosYet another implementation of A* pathfinding. It is focused on: Performance (both speed and memory allocations). Readability and simplicity. Well defined objects and methods. Accordance with general conventions (naming, signatures, class structure, design principles etc). Path is calculated on ...

Q: Monitoring a view model for changes to display a save button

QuitchI'm working with Knockout3 in a Chromium 28 environment (ES5). I have a series of preset difficulty options, and a player has an option to switch to custom difficulty and tweak the options. When they tweak an option the save button lights up and the player cannot proceed to start the game until t...

11:27 AM
Q: Multiple RouterOutlets and Routing from Subcomponent

Kevin WallisI have two outlets (primary and second). The routes are defined like this: const routes: Routes = [ { path: '', redirectTo: '/home(second:list)', pathMatch: 'full' }, { path: 'home', component: HomeComponent }, { path: 'list', component: MyItemListComponent, outlet: 'second' }, { path: 'n...

@Mast Did you just VTC this? It's not showing up in my queue yet. codereview.stackexchange.com/questions/245520/…
@pacmaninbw Yes, from the FP queue.
I'm nit showing anything in the queues at the moment.
Still on first cup of coffee
11:52 AM
I review straight from chat half the time anyway.
I just went linearly down the list of new question Newest to where I saw my name in a closed question.
That works.
Codereview seems to want the code posted in the post itself or I can't submit it. I want to review my entire approach to the test as well as the code itself. — Robert3452 1 min ago
12:16 PM
Q: Is This code googd for checking leep year?

BilalMohibI have made a function for checking leap year I want to review that is this the right solution or not? I further want to know that if there are any holes in this solution.Any help will be greatly appreciated.Thanks var year = prompt("Enter the year to check for the leap year?"); var length=year.l...

12:31 PM
@CaptainObvious RBA.
Good, not much we could do for him.
They should have started with Donald Knuth's algorithm.
Tests wouldn't have hurt to show their current one isn't working.
1896? Yes. 1897? No. 1898? No. 1899? No. 1900? Still no.
2000? Yes.
With those 6 tests, you catch a lot of errors already.
It's a one-liner in Python.
You're correct rather than posting on CR, they should have used testing.
12:52 PM
@Peilonrayz Hehehehe glad I could help (unintentionally).
@pacmaninbw The one I've found that's attributed to Knuth looks a lot more convoluted than what I usually come up with.
Do you happen to have a copy and is it worth a read (Art of Computer Programming)?
I'm not sure it's still worth it in 2020 unless you're interested in very-high performance.
@DerKommissar One of the nice things about CR seeing someone do something you've never seen before and them bam, now you are playing with black magic ;)
1:08 PM
Anyway, even reading Wikipedia would've solved their problem.
Length doesn't come into it.
Wiki says:
> if (year is not divisible by 4) then (it is a common year)
else if (year is not divisible by 100) then (it is a leap year)
else if (year is not divisible by 400) then (it is a common year)
else (it is a leap year)
Which apparently is faster than what I used usually, because it looks for leap years while I try to exclude leap years.
while True:
        year = int(input()) # "Please enter a year: "
    except ValueError:
        print("Not a valid integer.")
        if not year%100:
            if not year%400:
                print(year, "leap year")
                print(year, "NOT leap year")
        elif not year%4:
            print(year, "leap year")
            print(year, "NOT leap year")
@Mast I thought it was a one liner in ever language bool((year % 4 == 0) - (year % 100 == 0) + (year % 400 == 0))
1:29 PM
Q: XOR Encryption, Decryption, and Cracking in Python

DemonessJessI have recently been working through a number of the Cryptopals Cryptography Challenges to try and improve my knowledge and understanding of both cryptography and Python. As five of the first six challenges are XOR related problems I thought it would be a good idea to compile my work into a singl...

Q: Excel VBA to Import IE Data Table

Chris H.I have the following macro that opens an instance of IE and copies the data into an excel file. The code below works but the only way I could get this to work is to copy all of the web page then format the worksheet to keep only the data table. I did inspect the web page and tried to use the tabl...

@Peilonrayz Probably.
I think I was trying to say what OP had posted was not only not working, it was overly lengthy.
Looking at it again, it's even worse than I remember.
The code makes very little sense.
@Mast Well it is JavaScript ;) In all seriousness tho they should really post here, they'd probably learn a thing or two
I'm closing this because it's going to be opinion based - since OP already has it working. This is better suited for codereview.stackexchange.comdisinfor 30 secs ago
I’m voting to close this question because it fits better on codereview.stackexchange.com or wordpress.stackexchange.comdisinfor 46 secs ago
1:48 PM
@Mast I have 3 of the 4 books he published, I bought them when I was still in the University. I use them more as a reference than reading all the way through them. The software I wrote for the first 15 years of my career was performance critical. My code wasn't always pretty. Compilers were not optimizing compilers back in the 80's and 90's and you could write tighter code than they could.
1 hour later…
3:07 PM
@pacmaninbw Oh, absolutely. Those books were almost worth their weight in gold. But that's back then.
3:26 PM
removed per code review. :p — Akin Okegbile 18 secs ago
3:53 PM
"easier" and "more straightforward" are matters of opinion, you might get more help if you can be more specific what you mean. Alternatively it's possible that code review stack exchange might be more able to help, though I'm less familiar with what questions are on-topic there so you'd need to check their help pages. — Tim 10 secs ago
Ryan Donovan on July 15, 2020
As a 2nd year medical student, I was beginning an intense period of independent study for our first licensing exam (Step 1) when the COVID-19 pandemic hit in April. Studying for this test meant that I had less structured time for volunteering, so I wanted to find a way to contribute to the pandemic effort…
4:24 PM
I’m voting to close this question because it better fits the CodeReview site. — MrBean Bremen just now
4:34 PM
@Mast Well let's face it, I'm a doddering old fool. :)
@Peilonrayz Aha! We have found the Sorcerer's apprentice.
5:05 PM
I guess I should be glad that there has only been 1 item in my VTC queue so far today, but it is so slow and boring.
5:33 PM
Q: Can I use this with a prepared statement?

user13477176Hello I want to know if it is ok and safe to do something like this: public function getUnreadNumber() { $userLoggedIn = $this->user_obj->getUsername(); // get_result for * and bind for select columns // bind_result Doesn't work with SQL query that use * $query = $this->con->prep...

5:46 PM
while the OP may not accept my advice as beneficial, I finally got this zombie taken out :)
Welcome @JGPhilip! if you have any questions then let us know.
6:10 PM
If the code works, and you're willing to get a review of all of it, you can check the help center of Code Review to see if your question is on topic there. — Heretic Monkey 43 secs ago
6:25 PM
@Duga I believe you mean this:
@ParthShah in the current form this post would not be on-topic on CR. Please familiarize yourself with the site before recommending it to users. — Sᴀᴍ Onᴇᴌᴀ 3 mins ago
6:46 PM
Q: Displaying Video file from storage with MediaStore in android Java

sanoj lawrenceI Used MediaStore to scan and display media files from my storage using below code private void displayAllVideos() { Uri uri; Cursor cursor; VideoAdapter videoAdapter; int column_index_data,thum; String absolutePathThumb; uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;...

7:11 PM
Q: Converting a stateless object to a stateful one

Ardent Java LearnerI have a piece of code that I wrote and I got a review comment... It's a little difficult to get help from my team so I am seeking your help (It can be quite frustrating when you don't really know what to do or what it means, I love to learn but I can't really seem to do it without any assistance...

@SᴀᴍOnᴇᴌᴀ Can you clarify this?
okay - I have added a demo with some benchmarking to illustrate that the suggestions lead to lower average executions times for the draw() method - maybe not initially but eventually it becomes true. — Sᴀᴍ Onᴇᴌᴀ 22 hours ago
Leaving it on for a couple of minutes clearly shows what you mean, but it's not clear from the comment itself.
If you really want to drive it home, plot it for a few million draws.
Difference is 5-6 percent eventually, might continue to go down but seems to flatten a bit.
6.5% now.
7:59 PM
Q: Using back-slash on # (Python)

Prabhav Agrawal\#variable1 = "Hello" print(\#variable1) trying to store in #variable1 just to know that why won't it work \\variable2 = "Hi!" print(\\variable2) trying to store in #variable2 just to know that why won't it work

@Mast okay - I haven't found a good tool for that yet... I did consider adding a chart e.g. with something like chartsJS and vueJS
@SᴀᴍOnᴇᴌᴀ Just store the ms values every iteration and plot it using whatever.
Excel for all we care.
A dead plot is better than no plot. It doesn't have to graph live with the rest of the picture, although that would be even more magnificent of-course.
Could influence the results a bit though, doing it live.
I'd do the dead one.
8:31 PM
I’m voting to close this question because it belongs on codereview.stackexchange.comScott Marcus 42 secs ago
@ScottMarcus As currently written, it would be an absolutely terrible question at Code Review. So it doesn't make sense to use that as a close reason. — Mast 47 secs ago
8:48 PM
@Mast okay live and dead added
Heh, looks like it did indeed affect the performance.
Both are scoring slightly worse now.
hmm... I typically see the modified under 5 ms
I had both under 1.3, now they're under 1.4
Not quite sure what's going on here, but looks interesting.
The plotting may have killed the benefit of your simplified function I'm afraid.
@Mast I disagree. It doesn't belong here. If posted at code review, they can decide what the quality of the question is and vote on it there. — Scott Marcus 48 secs ago
@ScottMarcus I'm from Code Review and I'm telling you right now. — Mast 20 secs ago
9:04 PM
@Duga @Mast you could have stated that you don't disagree that it shouldn't be there (i.e. on SO), given SM said "I disagree..."
@Mast what browser are you using?
Latest FF.
The average time did go down with the previous iteration, so again, I'm afraid the live statistics screwed up the benefit.
@SᴀᴍOnᴇᴌᴀ SO's scope is their problem. I have no opinion on that.
It's the redirecting crap towards us that has me worried.
I honestly couldn't care less what they do with that poor-quality question as long as it doesn't end up here.
I might switch to a different chart library....
9:10 PM
Had the question be of quality I'd have tried to save OP some face, perhaps.
1 hour ago, by Mast
Could influence the results a bit though, doing it live.
@Mast live chart removed
@SᴀᴍOnᴇᴌᴀ Unfortunate, but thank you for trying.
Welcome @ScottMarcus - let us know if you have any questions.
9:30 PM
@Mast Thanks for giving me permission that you have no authority to give. One of the reasons to close a question here on SO is that it doesn't belong here and CR is where a question about DRY belongs. So how about you do your thing and leave me out of it?! — Scott Marcus 34 secs ago
@CaptainObvious Hopefully this is headed for a quick but painful death.
@Duga Thinks he understands our scope better than we do, I guess. shrug
Can't convince them all, but we can't give up or we'll be overwhelmed.
@Mast you know SM is here, right?
Jason: Just so you know, questions about code quality that you'd like feedback on are not appropriate for Stack Overflow, but they are welcome at codereview.stackexchange.com despite what @Mast says. Check this for more details on what kinds of questions are appropriate there. — Scott Marcus 30 secs ago
10:01 PM
Q: Determine table structure in image using whitespace between coordinates

lawsonI'm looking to see if there are any better / faster ways of identifying table structures on a page without gridlines. The page is converted to an image with rectangular boxes for each strip of text. For the sake of this snippet, this has already been generated and has yielded the dataframe below....

Q: A JS Sort function for multiple params

Brett DeWoodyI'm building a functional React component that allows a list of products to be sorted by various properties. The properties could be top-level or nested properties. And I'd also like a sort order to be defined. As a secondary sort, I'd like a name property to be used. I have left out the React pa...

10:26 PM
Q: Breaking features down in a ML model

Austin JohnsonWhen using feature selection is it ok to break features down by other features. Let me give an example, I scraped over 9 thousand data points of PGA player's tournament stats from 2018 to present day. I found that Total Putts GIR was most highly correlated with fantasy performance. However, all t...

11:14 PM
Q: LeetCode 952: Largest Component Size by Common Factor

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 a non-empty array of unique positive integers A, consider the following graph: There are nums.length nodes, labeled nums[0] to nums[nums.length - 1]; There ...

But also note that quality of question matters on Code Review, just as it matters here. If you post the exact same question without improving it significantly, you risk having the question down-voted and closed there, similar to here, and just like this site, enough of these can block you from asking in the future. So do check out their help site well before asking. — Hovercraft Full Of Eels 32 secs ago
11:39 PM
Q: Quobjectcoin ERC20 coin weekly awarded to supporters of Quobject

MatthiasI want to create an ERC20 token, and would like some help with reviewing the code for security issues. From the whitepaper: Reward schedule Quobjectcoins will be issued on a weekly basis. Beginning with 50000 tokens rewarded every week for the first 210 weeks (4.0274 years). Every 210 weeks the r...


« first day (2629 days earlier)      last day (19 days later) »