« first day (2600 days earlier)      last day (1715 days later) » 

00:00
RELOAD! There are 6742 unanswered questions (89.9075% answered)
0
Q: What is the proper way to count entries in a directory?

user226181I have a few options including this one: DIR *Dir = opendir("/path/to/directory"); while (readdir(Dir)); long NumItems = telldir(Dir); Is there a faster way than that? How do I find the number of items in a directory in C?

possible answer invalidation by user226181 on question by user226181: codereview.stackexchange.com/posts/243951/revisions
@Duga Out of my depth
00:17
Regardless of whether this belongs on Code Review or not, it clearly is too broad for Stack Overflow, and I'm casting the third close vote accordingly. — pppery 20 secs ago
@Duga Nice comment @pppery
What's especially nice about it?
Wow, that's surprisingly not trivial to explain. It's because we get lots of bad recommendations or reasons for why people close on SO. Your comment just sticks to SO rules to close on SO which is not common.
0
Q: Looking for some feedback

raol5AFI just started learning to code and I want to see if you guys know any ways or tricks I could use to improve my programming skills. This program is based on the deciphering text, given that you know the key. The code works fine, I'm mostly looking for feedback in ways I could improve how I write ...

@Peilonrayz It was a major change in the code.
Check the edit history now.
Done for today.
00:39
Now that this has an answer posted, I don't agree that it is not too broad. Nevertheless, it is kind of turning the standard Q&A model on its head, in that what you are actually asking is "please suggest improvements to this answer", not "please answer this question". If what you are asking is "how can I improve this code", I would recommend aggregating the question and answer into one complete, working, snippet (as opposed to scattered code blocks), and post that as a question on Code Review. This is kind of unclear as a StackOverflow question right now. — pppery 39 secs ago
@pacmaninbw Ah thank you. Many of the things in compiled languages I just don't understand.
If you're asking "is there another entirely independent way of doing this", then this isn't really suitable for Code Review, but it isn't really suitable for Stack Overflow either because it regresses back into the "please do my work for me" I mentioned earlier in the comments. — pppery 58 secs ago
01:07
01:40
0
Q: write() with to many system calls

lettomobileI have a writeOnFile() method with too many fwrite(). I think it is not a good implementation because too many system calls may produce a high overhead. What can I do? Code void writeOnFile() { char cr[1] = {'\n'}; //Usefull characters char sp[1] = {' '}; char header1[] = "Insta...

02:03
0
Q: Simple C++ Telegram Bot

Jess LimHi :) I am a beginner coder who just learnt C++ and I wanted to apply it in projects to solidify my learning process. However, I only took a short tutorial before trying this out hence I'm pretty unsure about my C++ coding practices and I would like to know what areas I can improve on - and perha...

 
2 hours later…
03:36
@Peilonrayz Good question. The salvageable ones, sure. But the unsalvageable ones may as well stay as they are. If they clutter the results too much, explicitly search for non-closed questions.
@Mast What do you mean by salvageable ones? As in can be made on-topic?
@SᴀᴍOnᴇᴌᴀ @Peilonrayz I think it would've been more proper as a comment first, pointing it out. If all anonymous users start editing old, often viewed answers who knows what happens. If they're logged in, at least there would be a measure of accountability. I fully agree with that answer of rolfl, but anonymous edits are not covered in that answer I think and have a 'lesser' status IMO.
@Peilonrayz Exactly.
There's no point in editing questions that won't be fixed-up far enough anyway.
Edits do put them in the reopen queue after all.
@Mast I disagree, but meh. This isn't a hill I'm gunna die on. Janos can still approve it.
Yeah I don't think I'll edit any of them 2/5 are from '16 for instance... There's a reason they're closed
@Peilonrayz I know, so it's not like there is no notification now.
I don't understand. Did there used to be no notification?
03:44
Hmmm? I meant Janos should've been notified somebody thinks the code should be modified. So if the edit is that valuable it can still be made by himself.
Or any other user feeling it's worth the effort.
At that point, we have accountability.
I understand now. Makes sense :)
I've come to the conclusion that rep on SO is much like rankings in CoD. It's not a measure of skill, it's a measure of time.
it's also a measure of willingness to gain rep at the expense of the quality of the website
2
Ooof 😂
Ooof?
I mean something like "what a burn", "ouch", "damn" or "that's a lot of damage"
03:59
Because one only gains rep by asking and answering questions, and "I care about quality"-style actions like close-voting don't give you any rep
Yeah... imagine if they gave rep for closing :O
It would certainly be a good idea.
04:49
It seems that your code currently works, and you are looking to improve it. Generally these questions are too opinionated for this site, but you might find better luck at CodeReview.SE. Remember to read their requirements as they are a bit more strict than this site. — Богдан Опир just now
 
2 hours later…
06:36
@Peilonrayz If moderation gave rep, I'd be way over 20k by now.
A point per review alone would net almost 3,5k instantly.
Good thing we don't do that though, the system is flawed enough as it is.
07:01
I think you should post this to: codereview.stackexchange.com instead. — Zuckerberg 20 secs ago
0
Q: What is the most optimal way to concat XML files as one large string/text file?

leopardxpreloadPython3 - Recursive XML Files to Large Text File I have a recursive function that looks through a directory (there are 6000+ files). For each XML file found - the XML is converted to a string and appended to an array. At the end of the recursion - All these arrays are joined to return a (very) la...

Does it work? Then you may be interested in codereview.stackexchange.com. — deceze ♦ 47 secs ago
07:27
0
Q: How to split and refactor a large function so it would do only one thing?

LigaI am learning about clean and maintainable code. I heard that functions should be no more than 20 lines long (preferably 5 - 10 lines). I have come across this Bob Martin quote where he said: “The first rule of functions is that they should be small. The second rule of functions is that they sho...

0
Q: how to build pandas data frame faster from elastic scroll result (more than half billons)?

NaughtyCatRun125currently I use elastic python API to query my data by scroll.However, it is quite slow to build a pandas data frame from the result(1 millon records, about 40s). list my code below: page = es.search(...) sid = page['_scroll_id'] scroll_size = page['hits']['total'] # Start scrolling ...

0
Q: Two same strings are shown that they are not same with "=="

Tejas JoshiThis is my code: def _h(): global _PubKey _PubKey = open('PubKey.FSMK','r') print('Please enter public key to open FSM.') global _PublicKeyCheck _PublicKeyCheck = input(">>>") print(_PubKey.read() == _PublicKeyCheck) I don't know why but it is showing false. I have evn ...

0
Q: JS Custom Event System

Patrick BozicI've written the following custom event system module and I'm planning to use it in production in the future. Before I do that, I'd like to ask for general suggestions on how to improve it. Thanks a lot. const event = (function() { let registry = {}; function on(event, callback) { if(!r...

@Duga sigh
08:14
For future reference: if the question is purely about coding style, Code Review Stack Exchange may be a more suitable site. — kalatabe 29 secs ago
09:10
@CaptainObvious I'm still not sure whether I should convert my comments into an answer or close the question. It smells as if OP is not doing what they show to be doing.
09:24
If it hasn't been closed by tonight, I might as well turn it into an answer.
09:46
0
Q: Slow Python Pandas

rogerwhiteI have the code below, which works successfully, and is used to parse, clean log files (very large in size) and output into smaller sized files. This would take about 12-14 mins to process 1 GB worth of logs (on my laptop). Can this be made faster? Could Dask or parallelism or asyncio or another ...

0
Q: C# AES Encryption/Decryption or byte[] array with a custom Key/IV

omriman12I wanted to create an AES encryption service which will use a custom key/iv. I want 2 methods: dycrypt/encrypt byte[] The code works as expected, any remarks/issues? public class AesGenericEncryptionService { private readonly byte[] m_Key; private readonly byte[] m_IV; public AesGene...

10:46
What have you tried, where do you struggle? Please show your code. And questions starting with 'What's the best way' tend to be off-topic. If you have questions regarding code improvements, please use SOs sister board CodereviewnilsK just now
@Codereview: I have a code that works but it's rather cumbersome with nested for loops so I am looking for a more concise method to do the same. — Joan Venge 5 secs ago
11:18
0
Q: Mock Atm program basic functions and xUnit unit test

Steve NgaiFor self learning purpose, I have created some xUnit unit test for these 2 Atm classes. At the moment, data is store in the in-memory object. This version is extended from previous version. For brevity, I excluded Withdraw method and ThirdPartyTransfer public class BankAccount : IBankAccount { ...

11:33
@Paedow nobody called error handling unnecessary, it would be just misplaced here. Error handling should be centralized and uniform. Please see this article and also this answer of mine that explains why your mysqli code shouldn't report its errors. — Your Common Sense 18 secs ago
12:04
0
Q: Using vswprintf( ... ) to create wchar_t* with variable argument list

FFMGI am using c++17 and wide characters. I have created a function to create a wchar_t* using a variable number of parameters ... #include <stdarg.h> // the caller will free the memory wchar_t* GetMessage( const wchar_t* format, ... ) { va_list args; va_start(args, format); // get the size o...

0
Q: Why is my Groovy / Gradle code ambiguous?

Jonathan KomarConsider this simply function fileContains, (File, String) -> Boolean. Gradle complains that it is ambiguous because it could be interpreted as a parameterless closure expression or an isolated code block. Why? How can I fix this? Closure<Boolean> fileContains = { File file, String s -> { ...

12:16
That might be a question for codereview.stackexchange.comFlimzy 1 min ago
@Mast Yeah, I can see that. Yeah I can see it being gamed hard
Note: I almost posted this on the Code Review SE, but they have a rule against posting code that you don't know works. — J. Mini 16 secs ago
@Mast I don't think it'll be closed. Looks like you've got some good points there
Ok, I will delete and ask elsewhere like codereview.stackexchange.com — Chris G. 10 secs ago
0
Q: Exercism assignment Matrix

Konstantin KostanzhogloThe task is to represent a Matrix as a class and to instantiate it from a string such as "1 2 3 4\n5 6 7 8\n9 8 7 6" The class must provide methods for accessing individual rows and columns by index starting at 1. While my solution is relatively short and more or less clear, I'm wondering about t...

12:30
@Mast I can see giving rep for moderation being a problem, but at the same time it might get more people in the queues.
Maybe there should be a second rep for moderation?
12:47
@Peilonrayz The edit identified that it was an edit, I changed the mark up to bold and noted that it was after the answer, the additional class doesn't really hurt the answer that way.
0
Q: Simple classes exercise

Maths64I started learning C++ one week ago and I am now studying clases. I tried to write a code which computes the product of two numbers. I get a missing declaration error for l and w, but it makes no sense since these values correspond to some other values which were declared. Can anyone please spot ...

0
Q: How to make this small Racket program simpler and more idiomatic

BJFI'm trying to learn Racket. I'm coming from a mostly imperative background, but I do have some casual experience using functional languages like SML and working with lists and recursion for small problems. I've heard the arguments advocating the power of Lisps, and decided I would combine these t...

@pacmaninbw I'm assuming you meant to ping the message below the one you did?
Ok that seems fine :)
@pacmaninbw We got badges.
@pacmaninbw Probably robo reviewers.
Yes we do get badges, and you have a lot.
I'm not even close to having acquired all moderation badges yet.
12:55
@Mast Ah, I can see the problem.
Yes, I don't even have reviewer badges for some of the queues and only 2 Steward badges.
@pacmaninbw We had someone a while back openly admitting to gaming the review system, didn't think there was anything wrong with it.
Are the still a community member?
@pacmaninbw I still don't have Reviewer for Late Answers. @Sᴀᴍ actually has Steward for that.
Wow, he must jump on them really fast, that's one that I'm not even close to reviewer on.
@pacmaninbw Account still exists and logs in every so often, but the last review was roughly a year ago. So, at least the roboing stopped. For that user.
@pacmaninbw Now we know why we aren't even close to reviewer on those. They'd already been taken ^^
It's good though. I like the queues empty.
2
13:02
@Mast True.
@Peilonrayz Only on second cup of coffee.
It is 6:03 AM here.
@Duga @pacmaninbw Your rollback is rolled back.
@pacmaninbw No problem I was just confused :) Hope I made the right assumption tho
@Mast That was the second time my rollback was rolled back, I flagged the post for moderator attention after the first one. The user doesn't seem to have an account any more, and their other question was migrated to SO.
The moderator said helpful on the flag.
Good.
13:18
@Mast have you noticed the new users are more augmentative this week?
@pacmaninbw It can come down to you noticing it more. I've not noticed it, but then again I kinda have started to learn to ignore it.
@Peilonrayz What shook me up the most was the exchange between @SᴀᴍOnᴇᴌᴀ and Emma.
@pacmaninbw That's a messy situation. I'd suggest thinking of that as quite a large outlier
I just consider Emma to be a spoiled child, but I'll leave it alone.
The same with the user that rolled back my rollback twice.
13:48
@Mast you get one good guess why that is :)
@Vogel612 Wow no "something something" :)
the something something would be regarding the time period before that
Touché
0
Q: Pascal's triangle in Java

QuantJava beginner here! As part of practicing programming, I've run into Pascal's triangle. I tried to implement a solution where the triangle is printed like so: 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 ... So roughly right-sided. My solution though runs into multiple errors, and although I would appreciate...

14:02
@Vogel612 I recall a ban of a significant time.
Set on a year, later shortened to a significant amount of months.
14:24
0
Q: I'm new to rust and want feedback how "rusty" my code is

Tobias LangnerI did the Nth Prime problem on exercism.io. Now I need feedback what can be done better / improved to make the most of rust. The code calculates the nth prime. I chose to provide the sieve of Eratosthenes as iterator in Rust. The code can be seen here: https://exercism.io/tracks/rust/exercises/nt...

14:47
@KrzysztofSkowronek thanks, I just found a similar code on a recent code review and was wondering why it does not work if you append the NotNullWhen to the property. You gave me the right hint, I've the solution somewhere back in my mind... I will answer my own question if I got the solution... It was something like "Do validation checks in synchronous methods and then call your async methods. Otherwise you can have unexpected behaviours with exceptions thrown in your async method." — Marcus Kaseder 15 secs ago
15:05
I’m voting to close this question because it should be asked on codereview.stackexchange.comTom Carrick 54 secs ago
15:25
@TomCarrick While this may be on-topic on CR in the future, please don't use the existence of the Code Review site as a reason to close a question. Evaluate the request and use a reason like needs focus (like have done here), primarily opinion-based, etc. Then you can mention to the OP that it can be posted on Code Review if it is on-topic. Please see Does being on-topic at another Stack Exchange site automatically make a question off-topic for Stack Overflow?Sᴀᴍ Onᴇᴌᴀ just now
Monking
0
Q: LeetCode 218: The Skyline Problem - Java

EmmaHere I'm posting my Java code for the skyline problem. If you have time and would like to review, please do so, I'd appreciate that. Problem A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you are given the...

0
Q: I hate this block of code but I cannot see a better solution. I keep thinking pairwise or zip might help but of course it does not

Corey Alix result.POINTS = { POINT: [] }; for (let i = 0; i < p.coordinates.length; i += 2) { const [x, y] = [p.coordinates[i], p.coordinates[i + 1]]; result.POINTS.POINT.push({ "@x": x, "@y": y }); ...

16:07
Monking
@CaptainObvious RBA yet no comments... maybe the OP saw the downvote and decided to read the help center ...
I use to take the local final variable approach, but in a code review someone pointed out that this should be static constant. It is not the first time I have the same discussion in code reviews. I just wanted to listen different opinions. Thanks — zeugor 19 secs ago
16:22
1
Q: Finding all factors and prime factors of a number

Zach FrostI am working on the Project Euler, number 3 project (finding the largest prime factor of 600851475143), but I wanted to take it a step further and write something that will list all factors and prime factors of any inputted number. I'm also using this project to learn about classes (I'm putting a...

16:46
0
Q: Rock Paper Scissors in Swift

MaxI'm going through the eBook Intro to App Development with Swift by Apple and I am making the Rock, Paper, Scissors app in lesson 20. This is the assignment that I got: [...] Name the enum Sign. Add a calculated property to give the emoji that represents the Sign. [...] You need to be able to com...

@SᴀᴍOnᴇᴌᴀ Some people RBA 5 seconds after the first downvote. Who knows.
16:58
This question is better suited for code review. SO is not a free code consulting site. — Neko Musume 53 secs ago
@NekoMusume No, Code Review does not explain how code works to users. — Peilonrayz 52 secs ago
0
Q: Loading dialog with handling exception

delminI have created 2 reusable loading dialog methods for communicating with server. One with exception handling static Future<void> runWithException(BuildContext context, Future future) async { showDialog( context: context, barrierDismissible: false, builder: (BuildContext con...

17:18
@CaptainObvious Nononono.
4
@Mast if that is the same user I am thinking of, I noticed there is a second account with a similar name and an avatar with the anonymous mask
17:40
@CaptainObvious we need context oh, the irony....
17:57
0
Q: Simple timed event template class

Irinel IovanIt's a simple timed event template class. It's used in a 3D multiplayer game! asdasdfasdfsdaf sadfdsaffsdaf asdfsdafsda template <class T> class CTimeEventDecorator : public CBaseDecorator, public CPooledObject<CTimeEventDecorator<T>> { public: typedef CTimeEvent<T> TTimeEventType; typede...

@ThomasW XmlNodes are mutable objects, and any changes made to them will be reflected in the original XmlDocument. That is true regardless of what you use to iterate through them. Hard to picture exactly how you're going about modifying the document, but if you share your code on codereview.stackexchange.com and post a link to the question here, I might be able to suggest some improvements. — JLRishe 20 secs ago
@SᴀᴍOnᴇᴌᴀ Yea, that cracked me up.
@SᴀᴍOnᴇᴌᴀ That would be his style, burning profiles and moving on...
18:20
0
Q: How can I reduce LOC and a condition for while loop?

SaadI've made this Function gradient() that returns a list of rbg of all the colors in an order. Issues:- What should be the condition for while loop to stop the loop. Though b == 0 in the last elif block works fine. How can I reduce the code of the function keeping the functionality the same. Like...

18:30
Huh, I've managed to rep cap on SO today. I feel I if I knew Numpy/Pandas or Django I could easily rep cap in the time it takes to write an answer on CR...
15 hours ago, by pppery
it's also a measure of willingness to gain rep at the expense of the quality of the website
You've proven my point exactly: 65 of the rep you earned came from answers on closed questions, which therefore shouldn't have been posted
@pppery SO defies all logic.
4
I try to stay away from there.
What do you mean?
It's a minefield and a tar pit at the same time.
That's still not very clear
18:39
Ok, what brings you to Code Review anyway? Can we do anything for you?
@pppery Gotta go fast. Yeah FGITW seems like the only way to get rep
@Mast Yeah, I want to get 10k and then leave asap. It's not really a community at this point.
I declared myself "done" at 3K rep, except for a recent push to hit 10K network-wide
@pppery Makes sense. You have any plans on getting to 20k or you just chilling at 10k?
I've reached every rep threshold I consider it feasible I will ever reach, except for 3K on Arqade
@Peilonrayz Nothing special at 20k network-wide, right?
@Mast Depends, 20k on 10k CR + 10k SO = see deleted posts on both sites.
If you mean per site then past 10k is pointless, for the most part
I should eventually hit 25k on CR, but afar from that, I couldn't be arsed by the rep.
@pppery Ah yeah, 3k's a big one.
I prefer moderating to keep the site clean, leave the answering to the experts.
I've actually done that for a couple of summers, literally. Getting rid of trash.
On a dump truck.
likewise. This brings up the conclusion that the people who have the most rep use it the least.
18:53
Magnificent. Hot as hell. Very tiring. But sometimes, I'd trade my sorrows for just doing the simple work again.
Yeah that's a nice mentality. I found once I hit 10k I no longer had any desire for more. But it's sometimes nice setting a goal to see that you're helping some people :)
@pppery That's only the case on CR since they have normally left.
Yea, that's what I got with 25. After that, I'll either have found the knack for it and go on a roll or just go back to taking out the trash.
I mean, I've written 6 answers since New Year's. 11 in the entirety of 2019.
@Mast No need to beat yourself up there Mast, you're better than many :)
Yea, yea, some of them have been quite rewarding in what I got back from the comments luckily.
@Mast <requisite gif of Obi-Wan describing Mos Eisley>
19:02
By the way, that skeleton project you got on your GH for Nox looks interesting @Peilonrayz
> You will never find a more wretched hive of scum and villainy.
19:15
@Mast When I got a couple of projects all my meta files started getting fragmented so I was like. "No! I'm making them all fork off one thing." It, my noxfile.py or my travis.ini, are missing some stuff but it's a pretty complete solution. It's even got more bells and whistles then Nox's noxfile...
@Peilonrayz Yea, it looks fairly solid.
19:35
Check out codereview.stackexchange to ask for feedback on your code. Their community is just as great and will help you out with your question. — Emiel Zuurbier 35 secs ago
20:20
Efficiency problems should go into code review(codereview.stackexchange.com), not here. It's an easy mistake to make, so don't worry about it and just move this question over to there. — ZeOnlyOne 9 secs ago
@ZeOnlyOne 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?". It is unclear if this code works as intended to the best of OPs knowledge... — Sᴀᴍ Onᴇᴌᴀ 5 secs ago
21:05
0
Q: Creating a Navbar Menu from JSON data with Lodash

nanokozmosI am trying to create a navbar menu from JSON data. Actually I have achieved it but I am looking for feedback not to call getItems twice? How can I improve my code? Thank you var _ = require('lodash'); let menuConfig = [ { ID: 1, TAG: "M:A", PARENT_TAG: "MAIN", ...

0
Q: QuickSort Algorithm (Python)

soufiane yesI'm a beginner ! and I want to implement a quick sort algorithm , but my code doesn't give a wrong answer. this is the code : def quick_sort(sequence): if len(sequence)<= 1: return sequence else: pivot = sequence.pop() # To take the last item of the list . ...

possible answer invalidation by Stacklysm on question by Stacklysm: codereview.stackexchange.com/posts/224691/revisions
@Duga No edit to the code, also it's fine
21:21
Please note the existence of Code Review which is a site designed to review code that does work, soliciting improvements. Do read their Tour and Help Center because posts follow a specific format. — msanford 56 secs ago
Questions about coding style are more appropriate on Code Review. But read codereview.meta.stackexchange.com/questions/5777/… first. — Barmar 44 secs ago
21:52
0
Q: Laravel Scope get request data/param

Muhammad Dyas YaskurI want to pass the param from the request on the scope method in the model and serve it as json to be rendered by select2. Which is better? 1. Pass request from the controller like this controller: public function selectJson(Request $request) { $request = Customer::getSelect2($request) ...

Since you have working code, I would suggest asking for a review in Code Review Stack ExchangeAlejandro 19 secs ago
22:39
0
Q: Is there a cleaner way to write this Python code?

Babadream_vacation_poll = {} question = 'What is your dream holiday? ' while True: name = input('Name: ').lower() message = input(question).lower() dream_vacation_poll[name] = message message = input('Does anyone else want to answer? (y/n)').lower() if message == 'n': break e...

0
Q: Simple to-do application

BagseyeThis particular snippet is a simple to-do app that allows the user to add new items to the list, mark them as done, delete a single item, or delete all items. What I would be looking for advice on are my use of a function constructor. It may be overkill for something like this, but it is more of ...

0
Q: Trie implementation for strings in Swift

Paul GowderA trie for handling strings for an autocomplete dictionary. This passes my fairly casual tests, though it's always possible that there are broken edge cases, but I'm mainly concerned about design and efficiency: is this a sensible way to implement this data structure? (In particular, is it sens...

23:26
0
Q: Minimax based Tic Tac Toe

a pI am attempting to make an unbeatable Tic Tac Toe game using a simplified minimax algorithm. The code looks like this: private static int findBestMove(String[][] board, boolean comp) { // comp returns true if the computer is the one looking for the best move // findBestMove is always call...

23:50
0
Q: Simplify Adding Same Parameter To Every Returned Object

Sean KulzickHere is a very simplified example of my code using Cars so I don't have to explain my domain details. The primary class concerned is the CarGenerator class. This takes a CarConfiguration object. It has a various properties of Car<T>. You can see its usage below: static void Main(string[] args) ...


« first day (2600 days earlier)      last day (1715 days later) »