« first day (2952 days earlier)      last day (1361 days later) » 

00:02
RELOAD! There are 7614 unanswered questions (89.4235% answered)
 
2 hours later…
02:26
Thanks for your comments. I gave the python solution I've been using, but wanted to know if there is a better way. The javascript example shows using anonymous functions, none of them have names. Maybe it is a code review thing, but not sure. Seemed to fit here, and I couldn't find answers to it. — user1942362 10 secs ago
0
Q: Singleton in Ruby without using Singleton module or class variables

Ivan OlshanskyWhen I need a singleton class in my Ruby code (for example, single logger for multiple classes) I usually use code like this: class Parent_Singleton @singleton = nil def self.new @singleton || (@singleton = super) end end This approach allows me to avoid using the module Singleton (b...

03:25
0
Q: cleaner for loop that accommodates direction

simplenameI have a for loop where I either increment or decrement the value of i by 1 each iteration. If start is greater than end I have to decrement i and if end is greater than start I have to increment i I had written the for loop like so below, in order to keep it always starting at i = start and endi...

 
2 hours later…
05:53
0
Q: Allocating char in dynamically reading file

trix junieI'm still a beginner in coding. Suppose I had a file Mary had a little lamb Twinkle little stars After opening with fread, and calling freadline(fp) once will return a char* with "Mary had a little lamb" as its contents calling freadline again will return another char* with "Twinkle little stars"...

06:43
0
Q: Sports DataSheet

Grewal_CreatorThis program asks the user for a players name, # of goals, saves, games played, etc. This information is ten organized on a .txt file along with the time the information was logged. users can also compare the players based on # of goals, Assists and saves made. If anything can be improved, cleane...

07:16
Monking
07:58
0
Q: Async/Await TCP server Pattern

FatalSleepThis is an asynchronous server written using the modern async/await pattern for TCP server applications. I've also attached a TCP client simulation for testing purposes. Everything seems to work just fine, but there is a massive CPU usage spike when all clients disconnect simultaneously--unlike m...

08:22
0
Q: Aggregate data from a huge list under 50ms [Kotlin or Java]

David MeikI got this question as a coding challenge and was unable to get it done under 50 milliseconds (my solution takes >100 ms) :D Would you please review my code and share any idea how to do this within 50ms? Problem Description One of our customers, a multinational company that manufactures industria...

08:59
0
Q: "I'm Done" option disabled

Billal BegueradjI tried to review this question, once I was done, I tried to click on I'm Done radio button, but I can't (it is disabled). I can only choose No action needed, but I decided to skip instead. The last first post I reviewed yesterday falls in the same scenario (except I did not skip)

@GuidoG Use the link below, along with MessageBoxes and an onboard trace module. And above all do a scrupulous code review: you will find the bad guy. With experience you will find it faster and faster and one day a simple glance will suffice. But here you do not provide enough code but I can say perhaps you missed if viewInfo == null) ...;Olivier Rogier 28 secs ago
09:22
This question is better suited for Code Review. That said, you may look at getattr function, which will remove the need to use list and make the code for call method more universal. Also note that probably you want to add another param to call, because current code will always run the method at index 0 in the list. — buran 53 secs ago
More suitable for Code Reviewpilchard 23 secs ago
09:40
By the way, this should have been a better fit on the code review SE site. — Some programmer dude 18 secs ago
 
1 hour later…
10:52
0
Q: VB script to run query in file

justaguyThe below vb script is called by a batch file and opens the xlsx in \Path allows a query to execute, waits 20 seconds, saves and exits. The script does execute but, I am trying to allow the query to execute until completion... currently it waits 20 seconds which is fine for now but not as the que...

11:06
This post would need some work to make it suitable for Code Review, make sure to read A guide to Code Review for Stack Overflow users, as some things are done differently over there - e.g. question titles should simply say what the code does, as the question is always, "How can I improve this?". And we require that the code to be reviewed is present in the question. Be sure that the code works correctly; include your unit tests if possible. You'll likely get some suggestions on making it more efficient, easier to read, and better tested. — Toby Speight just now
Welcome to Stack Overflow! Before you post at Code Review, make sure to read A guide to Code Review for Stack Overflow users, as some things are done differently over there - e.g. question titles should simply say what the code does, as the question is always, "How can I improve this?". Be sure that the code works correctly; include your unit tests if possible. You'll likely get some suggestions on making it more efficient, easier to read, and better tested. — Toby Speight 21 secs ago
@Someprogrammerdude, it's not suitable for Code Review, as it's asking for replacement code rather than a review of the actual code. And it would require much more context to be reviewable, too. — Toby Speight 35 secs ago
0
Q: An IEEE half-float implementation in python similar to array.array, is there any way I could make this more efficient?

SekenreI've written this class to wrap a collection of bytes and interpret them as 16-bit floats. It's supposed to work like memoryview(buf).cast('f') or array.array('f', buf) I'm trying to avoid converting back and forth between values as much as possible. cPython does not currently support using the f...

11:32
If the code works, you should actually consider asking on Code Review instead: codereview.stackexchange.comTerry 8 secs ago
I’m voting to close this question because the code works and simply needs optimization. It is better off asked on CodeReview instead. — Terry just now
Other options: 1) Find examples of the same GUI programs on GitHub. ordering system and login gui. 2) Find a mentor to whom you can show all your code, explain what the code is supposed to do, and receive appropriate guidance (code review). — 8349697 41 secs ago
12:07
0
Q: Search Method In Python / Python 3.9

SamI have implemented Binary_Search in python (I think), and my own method for range objects. I want to know if there is any way to improve this code, here it is: def findAmountString(string, char): amount = 0 for n in range(len(string)): if string[n] == char: amount += 1 return amount def...

12:42
This question belongs on Code Review. — buran 27 secs ago
12:57
0
Q: Store result of uploaded file converted to base64/data URI

RyomenSukunaI have spent the last few days on this. While the process of converting a file that's uploaded is straightforward, I really need the base64 value of the file that's been uploaded in a variable which I can use anywhere. I thought of using just the file path, but most browsers do not allow file pat...

0
Q: Where is the best place to declare variables?

Olivier KrullI hope this is the right place for asking this type of question. If not please direct me to the right place. So we have quiet a big TypeScript codebase at work, where each method resides in its own file. Now in a lot of those methods the variables are often declared all together at the top/beginn...

13:11
The question is rather abstract (and probably better suited to codereview.stackexchange.com but since the question is abstract, I think abstract answers are "ok-ish". @gaurav-verma, in general you want to give concreate answers with example code if possible. Also, welcome to SO! — JonSG 28 secs ago
13:22
0
Q: Contiguous Memory Allocation Algorithms

Serkan GünThis project I'm dealing with will read the size of free memory segments and size of processes from a text file and then will try to allocate a memory partition for each process using the first-fit, best-fit and worst-fit allocation algorithms. Below is the first part of the code I wrote. How do ...

0
Q: Can my javascript code for pulling data from an API and working with it in Goole Sheets be more efficient?

DBWeinsteinI'm trying to build out some DeFi position tracking pages in Google Sheets. I want to pull from the Zapper API (or other APIs) to track trades, positions, gains, losses, fees...etc. This is my first crack at tracking a position on SushiSwap. I tried to make re-usable functions and organize the ...

13:57
@SᴀᴍOnᴇᴌᴀ That's one way to fix a problem :-)
A couple of low-volume days is hardly a problem.
Different story if it's 2 weeks of this.
14:08
@Mast Now if I only knew python we could also bring the answer rate up.
Any thoughts on what sites will disappear if SE is acquired?
14:41
Does this code currently have a problem? If so, you need to describe what it is. If you just want general advice, then you should probably post this on Code Review but make sure to read their help centreVLAZ 6 secs ago
@pacmaninbw None any time soon, why would some of the sites have to go?
15:12
Monking
15:27
@Mast Depends on why SE is being acquired.
@pacmaninbw This had always been the plan, going from one venture capitalist to the next until the bubble bursts.
They're mostly silent partners, usually, so not that big a deal.
@pacmaninbw Unlikely we have like 5/6 CMs governing 100-200 sites. One of the major parts of SE infrastructure is for sites to be self-governing. So even as a cost cutting measure, pretty bad idea
15:48
Questions about improving otherwise working code may be better suited for Code Review, but be sure to follow their content guidelines. — jmoerdyk just now
1
Q: Appending data to JSON file in C

ArunI have this code which I use to append data to a JSON file. It will be helpful if someone could suggest pointers on: Reducing file opening and closing Make the write_json function efficient and other general pointers. Thanks a lot. #include <stdio.h> #include <string.h> #define ENTRIES_PER_LOG ...

16:07
Monking
0
Q: Write a ANSI C function to remove all unwanted characters from a string buffer, where _buffer_ argument is changed in-place

ryykerThe following code was written with the intent to be as efficient as possible, where efficiency includes speed of execution, memory usage, and lines of code, all in support of the primary design constraint that it can change the payload argument buffer in-place. In its current state: It does succ...

16:40
If the code works and you're looking for advice on improving it, Code Review is the appropriate place. But see codereview.meta.stackexchange.com/questions/5777/… first. — Barmar 46 secs ago
16:52
@pacmaninbw There are plenty of other languages with zombies :-)
17:06
0
Q: More readable code for first fit algorithm

broThe program will read size of free memory partitions and size of processes from a text file and then will try to allocate a memory partition for each process using the first-fit algorithm. Input Example: 300,600,350,200,750,125 115,500,358,200,375 My code for the implementation: import sys file...

18:02
@AndreasWenzel, it's one of the tenets of structured programming. One entry, one exit. It can be argued that it's easier on code reviewers when every function/method/procedure has a single return at the end. But then it can be carried too far in cases where the reviewer has to carry too much program state in their mind, making harder to manually verify correctness. But I find that to be an argument for simplifying over-complicated functions. — jwdonahue 47 secs ago
18:21
0
Q: JavaScript optimize a function to check if a nested object is empty

loretoparisiMy function needs to check if some nested object is empty. For flat objects, there is no need of recursion, and a very basic function could be the following (inspired to PHP empty): empty = function (mixedVar) { var undef var key var i var len var emptyValues = [unde...

18:40
test
 
2 hours later…
20:27
0
Q: Evaluating strings with more than 255 characters in VBA (Excel)

Allan Paolo AlmajoseI'd like to ask a question with regard to evaluating strings in VBA. I am perfectly aware that there is a certain 255 character limitation in evaluating strings in VBA (Excel); similar to this: Function testfunc2(Rng As Variant) Dim x As String x = "1000 * (1 * (0) - 0 * (0)) - 210000000 * (0.4 *...

20:52
0
Q: Bash script (to be used as a login MOTD message) that displays status of docker-compose projects, and individual docker containers

DavidPHThis is for a cheap vps I use for personal projects. I like having a motd displaying system info on login and I wanted to add the status of my docker containers to it, to see if all are running and whatnot. My problem was that scripts I found online for this displayed all the containers, but sinc...

21:40
"How can I clean up this code and make it more elegant?" == Code reviewLouys Patrice Bessette 30 secs ago
0
Q: How do I validate tic-tac-toe game ending scenario

ch2019I have created a simple program for tic tac toe. I need help on last part of the program. the program checks if the game is over - there are four possible verdicts: the game should continue, or the game ends with a tie, your win, or the computer's win; Can some one please help. Also, area where I...

 
1 hour later…
22:58
0
Q: Haskell implementation of Needleman-Wunsch

Ahmad BThe code below is a Haskell implementation of Needleman-Wunsch algorithm for sequence alignment (and string edit distance). It's an experiment in trying to closely imitate the dynamic programming method as it would be implemented in imperative languages. Hence my use of mutable arrays and ST mona...

23:48
0
Q: Symmetric Difference in C++

JodieIn this code in C++, I tried to reproduce the union, intersection and difference between two sets. I'm stuck in the symmetrical difference. Thanks for your ideas or solutions. #include <iostream> class conjunto { public: conjunto(); ~conjunto(); void inserte(int); void imprimir()...


« first day (2952 days earlier)      last day (1361 days later) »