« first day (2823 days earlier)      last day (32 days later) » 

12:00 AM
RELOAD! There are 7284 unanswered questions (89.6337% answered)
1 hour later…
1:26 AM
Q: Odd/even sums competitive programming

halcyon44I am stuck on a competitive programming problem. There are N < 1000 numbers each with values from 1-100. These numbers can be separated into groups such that the first group is even, the second group is odd, the third group is even, etc in this alternating fashion. I have written some code, but t...

3 hours later…
4:00 AM
Q: Convert hex to base64 and then fixed XOR

BorI've seen on the site questions where too simple tasks can be grouped into one. Here are Challenge 1 & 2 from Crypto Challenge Set 1 in Python. Any suggestions? the_hex = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d" base64_table = { 'A':...

1 hour later…
5:00 AM
5:17 AM
Q: Removing prepending "0" output from Haskell toBinary function that converts number to binary string?

AliyaI am new to Haskell. My function is supposed to take an integer and convert it to a string in base 2. My code works correctly, but I would like to remove "0" from my results. For example, toBinary 16 outputs "010000" rather than "10000", as I would like. Does anyone have any advice? toBinary :: I...

5:49 AM
If this code is working, and you are looking for more of a code review, then perhaps it'd be better suited for codereview.stackexchange.com. — Drew Reese 37 secs ago
6:34 AM
Q: Simple & Double Pendulum simulation with Python's Tkinter

AbsentButterflyI decided to create a double pendulum simulation to trace out its path and explore chaos theory a bit. I'm looking for any feedback regarding my code. Are there any atrocious portions of my code or bad practices I did? import tkinter as tk import random from math import pi, sin, cos G = 9.81 c...

7:00 AM
Q: Small Python math library

CATboardBETAI have been writing a math library with more options than the standard builtin one, partially to make my life easier in the future, and partially just for practice. Here is what I have so far in the main file (master/xtrmth/xm.py): import typing as tp import decimal as dc _meganum = tp.Union[in...

7:41 AM
OK . so far you just posted your assignment, what about trying a solution for us to look at? Remember, if your solution work, you should post it as a code review on the right page, not as a question on SO — Stultuske 53 secs ago
7:51 AM
Q: Complexity and code style in for each loop for input data validation before transfer

Michael SchulzSee following code snippet. For me it looks too complicated, and it doesn't feel like it is the optimal solution for this problem. But to be honest I do not find any other solution. Mapping to other objects is to keep each layer input data separated. Further each object validates itself in the co...

8:17 AM
Q: Best way to optimize similar payload (React)

dev phpI have a function mentioned below, i have to do some optimization on it. This function is used to make some data like a payload based on the arguments that i passed into this function. I am not much sure how to optimize this to look better & less Please share some thoughts on this. //Process data...

Q: Multiple conditions in for-loop in c

codexplorerThis is a question from Leetcode as below. "Given an array of integers arr of even length n and an integer k. We want to divide the array into exactly n / 2 pairs such that the sum of each pair is divisible by k. Return true If you can find a way to do that or false otherwise." The unfinished ans...

8:39 AM
If you have working code and you're looking for improvements, you should post on codereview.stackexchange.com instead — Mike Scotty 9 secs ago
Q: Find the odd int challange

Moamenthis is a function given an array of numbers to find the one that appears an odd number of times. what I did is: Sort the array Check if the array is odd. If the array length is 1 then return this value. Assign every two values to a new array, and check if it is a number. Check if every two valu...

9:19 AM
@CaptainObvious RBA
@Duga Technically invalidation, but the onus is on the answer.
I'll edit the answer.
1 hour later…
10:25 AM
Q: Generic Meyers Singleton implementation in C++

Tom GebelIs this a correct implementation of a generic Meyers Singleton in C++17? Any tips appreciated. Singleton.h #ifndef SINGLETON_H #define SINGLETON_H template<class T> class Singleton { public: static T& get() { static T obj; return obj; } protected: Singleton...

10:51 AM
Q: Simple Todo CLI APP in Python with SQLalchemy

MrLok3rsI wanted to ask you a favor. I am recruiting for the position of Junior Python Developer (my first try in IT) and I got a task to create a script to manage the task list. https://github.com/Lok3rs/Todo-CLI Could you please give me some feedback about that script? I will be very grateful! Thanks i...

2 hours later…
12:34 PM
If we are going to do code reviewing :) then the backgroundColor can be set using a ternary operator and the tintcolor directly to black — Joakim Danielson 53 secs ago
This is more a code review question and, as such, is a better fit for codereview.stackexchange.comMitya 55 secs ago
2 hours later…
2:18 PM
Q: To multiply and then add four double precision point values through MIPS

Anas RathoreI am assigned to write a program that should multiply and then add four double precision points values in MIPS I wrote the following code, .data doubleval1: .double 7.2 doubleval2: .double 6.7 doubleval3: .double 3.3 doubleval4: .double 1.2 .text l.d $f0,doubleval1 l.d $...

2:31 PM
Another question is, are you running code where a difference of 54.42 ops/sec when retrieving data from object/Maps with hundreds of thousands of keys would be tangible and of great concern? I would be worried about any developer that came to me with a code review of an object with 100000 keys, but that's me. I think this is a case of premature optimization. — Heretic Monkey 28 secs ago
Greetings, Programs.
I tried to address your specific issue, but I'd also recommend asking on the F# forums or fsharporg slack for some code review help - there's quite a bit here that could be written in more "typical F#" style, too, which might be worth exploring as you continue to learn. — Reed Copsey 54 secs ago
3:03 PM
"Does a better solution exist ?" better in what way? What are you looking to improve upon? As written I don't think this question is specific enough for Stack Overflow, but it could be appropriate on codereview.stackexchange — Adrian just now
3:21 PM
3:42 PM
Dean Ward on January 25, 2021
We take a detailed look at a hacking incident that gave a user unauthorized access to our code and data.
3:54 PM
well... it seems like you're prompting for a code review\refactor here based on the notion of an easier to use helper method. I don't think this is a good question for SO in that respect. In addition, you're using some incorrect terminologies. (client-side\server-side has nothing to do with this framework, you mean lambda expression when speaking of expression trees). — Brett Caswell 23 secs ago
@Feeds Uh oh
4:20 PM
This site is not for code review. Maybe codereview.stackexchange.com is the better place for this question. — jonathan.scholbach 40 secs ago
Q: Randomized Algorithm for finding optimal path in graph

Akash PatelNote: the optimal path can be chosen as the shortest path or the longest path I made a randomized algorithm for finding random paths in a graph. The graph has weights on the edges. For non-cyclic graphs, the algorithm does not form any cycles. However, cyclic graphs can form cycles. These paths ...

Q: Optimize and speed up the program

Mohsen.RJI wrote a program about triangular numbers, which are derived from the sum of natural numbers one after the other. For example, the third triangular number is equal to: 1 + 2 + 3 = 6. NOW I WANT to find Divisors of triangular numbers. for example the third triangular number have 4 divisors which ...

4:50 PM
Welcome to Stack Overflow! If you want help improving working code, you should post this on CodeReview.SE. If you do decide to do so, please delete the question here. — NathanOliver 34 secs ago
5:18 PM
Q: Game in Python3 using OOP

Mj _So iam making a game using OOP in python however is this the best practise when defining your objects? are you meant to define them all at the end of the script like I've done, or are you meant to define them after each class you make? Thanks in advance and any other improvements would be much ap...

5:44 PM
Q: Cpp exception handling

WidokI want to make my own custom exception handling and I am curious if I am going the right path, maybe some of you could suggest me how I could improve it ? Or maybe I have went the wrong direction? (Also would be amazing to know how I could make this peace of code more of a modern c++) #include <s...

5:57 PM
The question could have better been posted at codereview.stackexchange.comsteven7mwesigwa 28 secs ago
6:35 PM
Q: Binary IO inspired by struct pack

Luka AleksićAbout I'm writing a header-only template library for helping with binary IO. It is inspired by pack-d, which is in turn inspired by Python's struct module. I've only finished the output part and posted it here for review. You can find the source (~300 lines of code) at the bottom of the post. It'...

1 hour later…
7:52 PM
Q: C# vectors and matrix overloading operators

marcus class Program { static void Main(string[] args) { int[,] matrisBir = new int[3, 3] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; int[,] matrisİki = new int[3, 3] { { 9, 8, 7 }, { 6, 5, 4 }, { 3, 2, 1 } }; double [] v1 = new double[] { 1, 2, 3 }; do...

8:11 PM
Questions about coding style are off-topic here as they're purely opinion-based. You can probably ask this over at Code Review instead. — John Kugelman 36 secs ago
8:44 PM
Q: DateTime Extension for entering historical dates, i.e. birthdays

Tim MortonThis class is intended to fulfill these requirements: Output in Y-m-d H:i:s format Allow dates to be entered as m-d-Y or m-d-y Complain if an invalid birthdate is entered (i.e., in the future or otherwise) Allow simpler, friendlier coding without typing a lengthy DateTime instantiation <?php /*...

9:09 PM
Q: Was this an idiomatic and prudent way to extend R's matrix multiplication syntax? Should I have used R's object system?

J. MiniAfter reading one too many Lisp books, I decided to try extending R's syntax. My goal was to implement repeated matrix multiplication in a way such that I could write matrix%^%n to produce the result from multiplying matrix by itself n times (where n is a natural number). I produced the following...

9:28 PM
This question appears to be off-topic because it is a code review request. This might be better suited to the Code Review Stack Exchange site. Before posting there be sure to read their FAQ to ensure that your question meets their guidelines. — John Conde 25 secs ago
Fun project! You might like to post those class definitions on codereview.stackexchange.com to get feedback on them. — David Aldridge 56 secs ago
10:01 PM
Q: PHP design pattern - Decorator

PawelCI try to learn design patterns. First of all I try learn decorator. My code: Interface <?php declare(strict_types=1); interface Product { public function getPrice(); public function getDescription(); } BaseProduct class <?php declare(strict_types=1); class BaseProduct implements Produc...

1 hour later…
11:09 PM
Here are two more related threads: 1 2Andreas Wenzel 55 secs ago

« first day (2823 days earlier)      last day (32 days later) »