« first day (2701 days earlier)      last day (1298 days later) » 

12:00 AM
RELOAD! There are 7021 unanswered questions (89.7454% answered)
possible answer invalidation by Martin York on question by Martin York: codereview.stackexchange.com/posts/249764/revisions
 
12:41 AM
This question may be better suited for the Code Review site. — bbnumber2 25 secs ago
Code Reviews belong on Code Review if the code is complete and works. I'll note quickly though that every list slice ([:]) and concatenation (+) creates a copy, which is expensive. — Carcigenicate 54 secs ago
 
 
2 hours later…
3:09 AM
0
Q: Initializing an array of string constants, and another constant array of the equivalent lengths

user231012Ok, a struct would actually be most convenient, but it woudl be easier on teh system to have 2 seperate arrays rather than an array of structs. #define PAIR(Str) {(Str), sizeof(Str)-1} static const struct StrStruct { const char *Str; unsigned int Len; } Packed4 DefaultStr[] = { PAIR("...

 
3:34 AM
1
Q: Minimum swaps to form a palindrome

Rudrani AngiraHow can I modify the code below to count minimum swaps to form a palindrome. The original code computes all permutations of a string. I tried to modify it to count minimum swaps but cant make it work. For the string AAB it returns 4 whereas it should return 1. * permutation function * @p...

0
Q: How to deal with nested objects which might be string or undefined in a clean way?

lachlanvSo I'm parsing an object using Typescript. I am pushing a value from within the object into an array of strings. Here's the code: if (data.InstanceStatuses != undefined) if (data.InstanceStatuses[0].InstanceId != undefined) instanceIds.push(data.InstanceStatuses[0].Ins...

 
4:23 AM
-3
Q: redirect user after facebook share and publish

Mac SommersHow can I redirect a user to a specific URL after clicking the share button? <html> <head> <meta property="og:url" content="https://www.your-domain.com/your-page.html" /> <meta property="og:type" content="website" /> <meta property="og:title" content="Y...

 
5:13 AM
0
Q: Caching the result of a query to the database

JeksonWhen rendering a page, a heavy query to the database is performed. My task is to cache the queryset obtained in the query and use it later. If 5 seconds have passed since the last initialization of the cache during the next cache query, the old cache should be removed and new data should be writt...

 
5:54 AM
Monking
 
I’m voting to close this question because working code should be on codereview.stackexchange.comAlan Birtles just now
 
6:15 AM
@Mast CV retracted
Time for an appointment with me pillow - see ya on the flip side
 
6:53 AM
0
Q: First non repeated character

Omkar76 Problem Statement : Print the first non repeating charecter in a string. Example : In the string somecharsjustdon'tliketorepeat, m is the first non-repeating charecter. My attempt : public class FirstNonRepeatedChar{ public static void main(String [] args){ String str = "somecharsj...

 
7:18 AM
0
Q: python bash code refactoring on script to list files based on changes

anonymously132526Need help with improving the code I wrote as I am new to programming and needs input on how I could've written better. Not coding on daily basis. The challenge was to write a script in python, bash or anything. So I mixed python with bash commands using python module os.systems. Some friends reco...

 
 
1 hour later…
8:33 AM
0
Q: searching for duplicates two times

Chaban33I have this function that searches for stock moves that have the same product, and if it finds them then it searches for lots in those lines, and if it finds the same lots then UserError is raised. The thing is I think this method can be rewritten in a more elegant way. Maybe someone can help me ...

 
8:53 AM
@TheAmayJain "... and says time limit exceeded ..." What's this now? This isn't any known c++ standard exception or such. If you want to get helped regarding possible performance improvements for already working code, ask a(nother) quesiton at SE Code Review please. — πάντα ῥεῖ 5 secs ago
 
9:21 AM
I feel this is a code review post, and which is not supposed to be here, but in Code ReviewArakkal Abu 22 secs ago
I’m voting to close this question because I feel this is a code review post, and which is not supposed to be here, but in Code ReviewArakkal Abu 50 secs ago
 
9:47 AM
0
Q: Can not clearing a local vector contents cause a memory leak?

user231027Memory is gradually increasing in our application and I see there are many places where we use vectors. Is clearing the vector( or any stl container like map) contents mandatory to avoid memory leaks? As vector contents are stored in heap, what happen when a local vector variable goes out of scop...

 
10:12 AM
0
Q: List some things that to make it less verbose and more robust

Vinay KumarI am quite new in django forms. I am woking on problem where in function name generate_outage_form passed two parameters name settings and segment Now I have to make function less verbose and more robust. def generate_outage_form(settings, segment=None): form = None     datacenters = settings...

0
Q: React - form of multiple components

slizikyI need to create a form in React made of multiple components, such as <TextField>, <DropDown>, <DatePicker> where each one has a different props, some of them are common such as Id, Label Question is how should I program this, I have come with a few ideas -> It would be easier to split it into s...

 
10:37 AM
0
Q: Sending HTML reports to a database project

LV98So, I have been recently heavily focusing on Front-End, for data validation, showing errors etc. And a big thank you to CertainPerformance for many reviews hes done for me :) I have created a Report template using handlebars and a MySQL database to store the data, using Node JS to interact betwee...

 
11:27 AM
0
Q: Reusing objects in an array efficiently

Will PierceI'm making a function that adds a new object to an array and removes the oldest if it has reached a specific length. Click the button in the example below. All objects are drawn until its array reaches a length of 5 when the oldest is removed. Is there a better, more processor and memory efficien...

 
This question has broken code or code not working as expected.
 
@pacmaninbw How is it broken?
 
11:46 AM
> The response from the scale is fixed length but when I go into debug mode the response is not received during the first couple of cycles through the code. Then it arrives later. This is ok when I am outputting it to a rich text field but when I try to pull out a substring I get an error if there is no data.

Also, the UI locks and the only thing I can do it stop the execution.
 
Thanks
 
You could subtract the credits for all the tracks before actually separating the tracks. This will also prevent any problems you could have when an user submits multiple sets of tracks in multiple browser windows. Users will try this if processing takes time. In the case of an error no tracks will be returned and you can refund the credits taken. Your code could be improved in many ways. To get suggestions you could upload your code to Code Review. Make sure your code is working correctly, and add some more comments, before you do so. — KIKO Software 25 secs ago
 
0
Q: How to simplify and optimize bitwise get/set operations on a large bit buffer in JavaScript?

Lance Pollardtl;dr: How could you rewrite the buf_get and buf_set functions below to be most optimal? It took me a long time and a lot of head banging on the wall to get these buf_* functions to work, but they are not very elegant and I'm sure many of you can easily spot how to do these "more correctly". Basi...

 
12:09 PM
"please check my coding styles and structure" - codereview. — Sinatr 1 min ago
 
I need a sanity check here, this answer is a fairly poor answer, but I believe a question that is worded badly led to the answer. Can we close the question instead?
Need more coffee, good thing there is still 2 cups in the pot.
 
0
Q: How to optimize insert into array in reverse while iterating forward, without using push/unshift/reverse operations in JavaScript

Lance PollardSo currently I have this function: function loadPath(chunkSize, dataSize, depth, index) { let path = [] let i = 0 while (i < depth) { path.unshift(index % chunkSize) index = Math.floor(index / chunkSize) i++ } return path } I would now like to pass in path as a variable fro...

 
12:26 PM
@pacmaninbw You don't close questions because they get a bad answer. Why is the question off-topic?
 
It us asking for alternate solutions.
 
Which off-topic reason does that relate to?
 
0
Q: How to simplify and optimize bitwise get/set operations on a large bit buffer in JavaScript?

Lance Pollardtl;dr: How could you rewrite the buf_get and buf_set functions below to be most optimal? It took me a long time and a lot of head banging on the wall to get these buf_* functions to work, but they are not very elegant and I'm sure many of you can easily spot how to do these "more correctly". Basi...

I feel like there are so many things wrong with this code, the fact that they blatantly ignore the direction of the binary coding, and many other things.
Their Uint8* code looks like they didn't even write it, nobody writes code like that.
The only reason I'm not flagging it is because there's no flag for "Uh, are you a human"
 
12:44 PM
@Peilonrayz It is kind of asking for feature requests, which would be code not working as expected, but that isn't clear, so it doesn't relate to an off-topic reason directly.
That is why I asked.
 
@FreezePhoenix I don't really see the problem. The code doesn't look great but it looks like what I'd expect someone learning bitwise operators would do. Additionally what's the left to right problem? Is this big-endian vs little-endian?
 
const a1 = uint8_get(0b10100000, 0, 1)
assertBits(a1, '1')
This is retrieving the "first" bit in the binary, at the 0th index, and reading 1 bit.
This should give 0
 
@pacmaninbw It's commonly accepted that asking for alternate solutions is the same as asking for improved code.
 
Bits in JS are read from right to left, as opposed to left to right.
 
Yet we don't approve code only solutions as answers.
 
12:52 PM
@pacmaninbw Because getting a code dump is not helpful
 
They're not really getting the "first" bit, they're getting the 8th, as far as bitwise operators are concerned.
 
@Peilonrayz And you don't see this question as leading to a bunch of code dumps?
 
@FreezePhoenix That looks like big-endian to me. Just because JS's ints are little endian doesn't mean you're not allowed to implement big-endian in it.
 
JS ints are stored big-endian but the bitwise operators start at the right
 
@pacmaninbw The cause for code dumps is normally correlated with the amount of rep the answerer has.
I have seen the wording a lot, and also not many code dumps.
It's non-optimum wording so I tend to edit it out. But closing for it is inappropriate.
 
12:58 PM
uint8_get(0b10101010, 0, 2).toString(2) // "10"
it would appear that their method could be simpler done with substringing
their assertBits method consumes the number from right to left and the string given from left to right
Hence... assertBits(0b10, "10"); // fail
Wait, something isn't right
 
@FreezePhoenix I don't see any reason the question is problematic. I'd suggest if you feel strongly about it downvote the question and forget about it.
 
Are you looking for a code review? — jaco0646 39 secs ago
 
Alternately you could post an answer and possibly get some upvotes. If you want to risk potentially posting an answer that goes against the OP's needs.
 
Eh, I'm not really in the answer post mood.
 
That's understandable
 
1:08 PM
I don't know why you would make a method to clear a buffer when this is a thing:
a = new Uint8Array(3)
a.fill(0)
Unless it's to "clear" a certain number of bits at a specific index in a specific number..
 
1:31 PM
0
Q: Optimize and refactoring

DurgaI am still learning Python and have a scenario in the current project to benchmark a code snippet using refactoring in Python and increase the performance. Once finalized I will deploy it on a larger scale. I'm trying from my side and also looking for suggestions/guidance from you all. Thanks!! d...

0
Q: Designing object oriented clean code structure with spring services

wokstymI'm writing spring app for storing and manipulating recipes. I wrote ShoppingList service which generates, based on UUIDs of recipes, shopping list. This is my current model for which i wrote tests and works as intended. Service uses another service called IngredientConverter which converts to re...

 
2:02 PM
I assume you don't have a specific problem? If you want a code review, we have a specific community for this type of question, called Code Review. Maybe your question will be better received there? Stack Overflow is mostly for solving specific problems, which you don't seem to have. Your code looks fine. — Pedro Lima 28 secs ago
 
@FreezePhoenix Not everyone knows all the features a language has :-)
@pacmaninbw Alternative implementation not having a review.
 
AFAIK, no. IMHO, this should be handled with code review and training people to use moved objects unless they set them to some known state first. — NathanOliver 17 secs ago
 
@Mast Can confirm this. I think I know a fair amount of the Python stdlib, but I read the Python docs sometimes and go "I've never seen this library, is it new? It's from Python 2?!"
 
If it's from Python 2, that's why you haven't seen it before. A lot of Python 2 libs took forever to get ported to 3, if they got ported at all :-)
 
2:17 PM
Yeah I'd have no luck knowing even a fraction of third party libraries D:
 
@DerKommissar Have you ever heard of This Old Tony? Has some interesting elektromechanical videos.
Especially good when it's getting late.
Springs, latches, lathes, welding, all kind of odd stuff.
 
Ryan Donovan on September 25, 2020
Welcome to ISSUE #39 of the Overflow! This newsletter is by developers, for developers, written and curated by the Stack Overflow team and Cassidy Williams at Netlify.  It’s a big, round milestone, so we’re celebrating the way we always do: giving you the scoop on future robo-coders, getting names for lonely lists, and marking the moment when Moment.js…
 
2:46 PM
0
Q: calling Cancel() on CompletableFuture after get() is correct approch

Ramesh PapagantiI writing this code to leverage the advantages of Completable future. My doubt is call cancel() method after get() is correct approach? private void combineFilters(JobFilter jobFilter, CompletableFuture<List<String>> measureCompletableFuture, ...

 
3:00 PM
Monking
 
possible answer invalidation by simonzack on question by simonzack: codereview.stackexchange.com/posts/249275/revisions
 
3:36 PM
This sounds like a question for Code Review rather than Stack Overflow. — TylerH 35 secs ago
 
0
Q: Generic function for interpolating missing values in power query

S. MeltedI have written a (relatively) generic function for interpolating values in power query (also useful for power bi and m code). I am looking for any improvements or input, but especially: speed handle more inputs correctly (more generic) documentation / readability of code (Input as table, xColum...

 
@TylerH when suggesting users post on CR it would be great if there was also a suggestion like "Please read the relevant help center pages like 'What topics can I ask about here?' and 'How do I ask a good question?". In the current form the post above would at minimum need the title updated to describe what the code does instead of CR goals... and possible more context on what the code does. — Sᴀᴍ Onᴇᴌᴀ 35 secs ago
 
@Duga Not a problem, reworded question a little bit, answer was code only solution anyway.
 
@pacmaninbw yes the one answer is in the LQP queue... the code in the question did change a little - code to call function wrapped in a function and an extra call to the wrapped function added... likely just usage example
 
1
Q: Optimal Move Tic Tac Toe using Haskell

Ayman SantirI've just started learning Haskell and I'm practising on a Tic-tac-toe project. In which, at the end, I have to Write a function makeMove :: Player → Board → Maybe Board that makes an optimal move (if it is still possible to make a move). I used Rose tree to save the new boards at each level. dat...

0
Q: C# MySQL library: How can I reduce bundling and abstraction?

AAAI'm a teen developer who just does this as a hobby, but I still care about good practice even if I don't fully understand it. Two of the most used phrases when sharing the code of my C# MySQL library is bundling and abstraction, First of all... do I need to reduce said phrases? If so, how can I d...

 
4:18 PM
FWIW, here is an extension to using _Generic for printing. — chux - Reinstate Monica 45 secs ago
I think you need to post here codereview.stackexchange.com not in stackoverflow — Mathew Magante 11 secs ago
@MathewMagante It sounds like the code is not working as expected and thus would not be on-topic on Code Review. Please read What topics can I ask about here?'. Also if the code was working, it would need to be embedded in the post for a review. — Sᴀᴍ Onᴇᴌᴀ 59 secs ago
 
4:38 PM
@SᴀᴍOnᴇᴌᴀ actually I have a code same of this question before I don't remember when 3 years a go I think, and its down voted and said go to codereview and post them my question so as for my experience I recommend to go there like some people say to me — Mathew Magante 5 secs ago
@AnthonyVO Code Review is a good alternative for feedback on working code that you'd like opinions on. — Parrish Husband 50 secs ago
 
4:59 PM
@ParrishHusband that is true but the code above appears to be too hypothetical for a review... A user posting there wouldn't be able to answer yes to all the questions on the 'What topics can I ask about here?' page... — Sᴀᴍ Onᴇᴌᴀ 1 min ago
 
5:10 PM
I think this may be better asked at cs.stackexchange.com or cstheory.stackexchange.com or codereview.stackexchange.com depending on how abstract (pseudocode), theoretical, or practical you are going to make the code example. — sophros 51 secs ago
 
5:29 PM
@ParrishHusband + SamOnela, The code review site looks interesting but you are correct, I was not asking for review of a specific block of code but rather a generalized question that would hopefully give people some alternatives. Thanks for you time. — AnthonyVO 8 secs ago
 
6:05 PM
0
Q: Naive Bayes Classifier for sentiment labelled documents

p.vitzliputzliIn order to continue improving my Python knowledge, I have implemented a naïve Bayes classifier as described in "An introduction to Information Retrieval". I would be very interested which parts could be improved, be it e.g. coding style or use of data structures. """Implementation of a naive Bay...

 
6:30 PM
0
Q: Proper Naming For Synchronous Data Structure in API

tkelleheOverview I am attempting to build a high-level library utilizing common synchronizing structures like mutexes, semaphores, condition variables, etc. I designed and built a simple API that provides two basic behaviors: Pending on the structure will be ended if a signal is produced after the pendi...

 
6:55 PM
1
Q: Booking an East London Tennis Court

LudisposedDescription I'm not sure if it Covid-19 but lately it is impossible to book a tennis court in my area on time. It's always full or maybe just don't check enough :) To beat the queue and get notified earlier, I started making a scraper to ensure I can book a court on time. But because of iframe he...

 
7:28 PM
Yes, that does seem valid syntax. I wouldn't do it that way, but that doesn't mean it is bad. There are many ways to create a database class. On Code Review you can find many examples. Search for "php database class". — KIKO Software 46 secs ago
 
 
1 hour later…
8:35 PM
0
Q: Optimizing code in codewars

DarklightI was practicing python on codewars.com with this question: Create a function that takes a positive integer and returns the next bigger number that can be formed by rearranging its digits. For example: 12 ==> 21 513 ==> 531 2017 ==> 2071 But when I attempted my solution it said it was not optimiz...

 
 
1 hour later…
9:53 PM
@CaptainObvious so there is @Duga and now there is also Durga
 
10:12 PM
@SᴀᴍOnᴇᴌᴀ lol
 
TIL about the term invigilator
 
Oh it's a pretty common term in the UK. You hear it a lot around exam season and later years of school
 
ah I see
this suggested edit proposes a new tag... is it worth it?
 
@SᴀᴍOnᴇᴌᴀ I'd say no, because of the other tag's description "Mash-up code, the language behind power query."
Nice work on checking @Duga's comments today btw :D
 
10:33 PM
"we do what we must because we can"
 
@Vogel612 How do you, mods, want us to handle non-urgent VLQ posts? I've seen some Meta.SO posts saying they are declining them because the site can handle them without mod intervention. We saw one today, rather than flagging I downvoted and VTD, it's also got 4 RDs in the VLQ queue. Is flagging them a good move?
 
I personally usually don't directly act on VLQ flags, because most of them don't need me to swing the hammer
that doesn't mean that you shouldn't flag them, it's just that VLQ flags are not that terribly high on my list of priorities :)
 
Ok, that makes sense. Thanks :)
 
@Vogel612 thanks for the context
 
10:57 PM
@Peilonrayz like a "vigilante" ?
 
@SᴀᴍOnᴇᴌᴀ Sorry, I don't understand what you mean
 
As far as I know they're completely different things - I wouldn't expect to see Robin Hood checking I don't cheat in my exams
2
 
-1
Q: Confused in understanding where the code is failing

Adithya KamathI had recently written a code which gives the maximum XOR sum of the subsets of an array. While submitting the code, my code fails a few test cases and I’m unable to see what test cases it fails. The code is below const readline = require('readline') const rl = readline.createInterface({ ...

 
11:19 PM
@CaptainObvious ~ embodying Chandler Bind: "could it me more ??"
 
@SᴀᴍOnᴇᴌᴀ ty. I've not seen Friends :(
 
@pacmaninbw Sorry, I'm not actually "around" so much as my Mac still has this window open all the time lol
 
@DerKommissar have you been using yer Ryobi outdoor tools lately?
 

« first day (2701 days earlier)      last day (1298 days later) »