« first day (2479 days earlier)      last day (43 days later) » 

12:00 AM
RELOAD! There are 6410 unanswered questions (90.0797% answered)
12:57 AM
Q: Novel sorting algorithm ⸺ ımprove time complexity

kokotko1I have devised a novel sorting algorithm, named Oracle Sort, which I believe is far superior to all currently known sorting algorithms (under certain assumptions). It utilizes an oracle to achieve a constant time complexity with regard to both the length of the input sequence and the number of di...

1:17 AM
Q: check_prime.cpp (checks if input is a prime number)

Chris Heathcheck_prime.cpp Description: Accepts user input to check if the user entered a prime number. Notes: If any text inputted after an integer will be ignored. For example: 1234.5678 and 98abc will be interepred as 1234 and 98, respectively. Please provide any feedback (positive or negative). TYI...

1:37 AM
Q: 15 Puzzle in python

Tornado547This is a playable 15 puzzle game in python and curses. It consists of 2 files, a backend called fifteen.py and a frontend called curses_frontend.py. The idea is that different frontends could be built for different purposes. Anyway, here is the code fifteen.py: from enum import Enum from colle...

1 hour later…
2:58 AM
Q: Is this a reasonable algorithm for shuffling cards?

ErlichBachmanSo I based my "algorithm" on the poke method defined by Persi Diaconis. You start with the card at the bottom of a given deck and then poke the top card into a random position in the deck. At first the probability of this happening is 1/52 but once a card is below the bottom most card it increase...

3:39 AM
Q: Chess Model in C# to GetAvailableMoves

GrimJust curious if someone could review my design, and implementation of the following requirements below. I am a mid level dev, and this is for a new job. I am looking for ways to improve, and your overall thoughts if you were the interviewer. Code Test Instructions: Write a simple application/s...

3:50 AM
@JohnZwinck, unfortunately, set -e has a lot of very undesirable side effects, to the point that it makes code review almost impossible (because a given line's behavior depends on what's up the call stack -- if a function is called in a "checked" context, set -e is disabled for it and everything it in turn calls). See the exercises in BashFAQ #105. — Charles Duffy 1 min ago
2 hours later…
6:03 AM
Q: Code to Check browser Compatibility for RequestAnimationFrame & Vanilla Javascript .animate() API

Ryan StoneTrying to Set up some code to first test if the Vanilla Javascript .animate() Api is Supported, then if its not Check if requestAnimationFrame is Supported and if its not FallBack to either setTimeout, setInterval or setImmediate. not 100% sure if this has any security concerns as I'm not a web s...

1 hour later…
7:24 AM
Q: Finding median of sub arrays taking too much time

PasanWI'm trying to solve a programming challenge where I have to find the median of given subarrays of an array. I have used std::vector's n_th element for this. But the evaluator fails some test cases as "time limit exceeded"/ #include <iostream> #include <bits/stdc++.h> using namespace std; /* I...

8:04 AM
Q: Query about trivial if/else statements

NotACodeNinjaI am going to undergo a code review shortly at work. I feel that my code is too verbose, could log more sensibly, and I feel that my if/else statements are somewhat duplicative/repetitive and can be done better. But I can't seem to be able to put a handle on what I am missing. How would you clean...

8:24 AM
8:45 AM
Q: Drop down filter in datatables on rails

user3359964I have created the model called Example[name, status(boolean)]on rails. I have created the datatable which contains dropdown filter to 2nd column. Now when i click on the values of dropdown, I get error(DataTables warning: table id=examples-datatable - Ajax error) ,#Getting error on this line: fo...

9:08 AM
StackOverflow is a place for problems and solutions, not to look for opinions on how to improve something that already works. You might try SoftwareEngineering or CodeReview instead. — Abion47 13 secs ago
3 hours later…
11:47 AM
Q: Mixing MVC into flat PHP

Robert HolmanI've read up on using MVC in PHP, but I'm still struggling to find an example that I can understand. How would I adapt, say, the following code using the MVC pattern?: <?php $db_options = [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, ...

11:59 AM
Stackoverflow is place where we resolve problem with errors, not add functions to make it more usefull. Maybe go to CodeReview or hire someone on Freelancer.comfuras 11 secs ago
No, please don’t go to Code Review with this code. It is for code that is already working. — mkrieger1 54 secs ago
test [cr.help]
Oh no I've forgotten it :(
12:15 PM
@Abion47 Please don't send people on wild goose chases. It doesn't give users a good experience to have their question closed on three sites, rather than just one. If you don't know what is on and off topic on another site don't go around recommending them. A quick browse of Code Review's help center shows that this is off-topic there. — Peilonrayz 28 secs ago
1:05 PM
@Peilonrayz Looking for [help/on-topic]?
Only works in the comments, not chat.
@Mast No, I thought there was a [cr.help]. Maybe I'm getting it mixed up with [cr.meta] or something
[cr.meta] [meta.cr]
[codereview.se] & [meta.codereview.se]
1:48 PM
Q: Rejected at code challenge because of lack of separations of concerns but I feel like YAGNI [Kotlin / Java]

pragmatic_programmerRecently got rejected in a code challenge that was a very simple WebService with 3 endpoins: POST /transactions to add transactions with an ammount and timestamp. GET /statistics to query the statistics of the transactions of the last minute. DELETE /transactions. I just pasted below Servic...

Q: Runtime Error in banking system

UML totally distilledWell over here I've made a banking system in Java. The problem is, i've been getting a runtime error that's driving me nuts. It's a basic java runtime error that i simply can't fix, and is matching the given design by 100%. Here is the error message Failed. Runtime error Exception in thread "m...

2:12 PM
This type of question - asking for a code review - is more suited to CodeReview SE. codereview.stackexchange.comEugeneProut 52 secs ago
3:09 PM
Q: My Approach to Sorting Algorithm

TlomolokoFor practicing purposes, I had the idea of making a sorting algorithm in python, my approach to it was to iterate through a given unsorted list to find the shortest number in it, add the number to a second list, remove shortest number from unsorted list, do that until the unsorted list is empty a...

3:50 PM
Q: Optmize logic IF statement

Mr. Hello_worldI have a little dilema with such if statement, I have tried optimizing it in order to remove some checks, but could not think of how to make this code part cleaner. Can someone please make a review, and tell if it's possible to optimize such statement of maybe there is some law for this? Thank yo...

4:10 PM
Q: K&R - The C programming language Exercise1-12

matmakhiI am working through the K&R and just finished exercise 1-12 and below is my solution. Exercise1-12: Write a program that prints input one word per line. #include <stdio.h> main() { int c; while((c = getchar()) != EOF) { if(c == ' ' || c == '\t' || c == '\n') { ...

4:50 PM
Q: Clean and fast MiniMax for numpy implementation of Tic-Tac-Toe

LuapuluTic-tac-toe is small enough to be solved completely but since I have a slow computer and this is an interesting exercise, I want to build the fastest possible minimax tic-tac-toe implementation in CPython. I welcome any comments on style, performance and cleaning up code. Here are some points I'...

5:04 PM
SO is for fixing a problem with getting your code to work as intended; either it doesn't work or it does not give the result expected. The place to ask for improving working code is in Code Review. Please post your item there. — SmileyFtW just now
5:31 PM
Q: array summation algorithm complexity

Ugur YilmazGiven two input arrays [-1,8,3] and [3,7,2] your function will return true if any two of the numbers in the first array add up to the any numbers in the second array -1+3=2 -> return True My algorithm simply takes all the pairs from the first input and check if they exist in second array set ...

Q: The proper way to use DI to make a code more testable, mocking

Maxim ShoustinI have a struct method that calls the other two struct methods: Option 1 type IDeployService interface { foo(*A) error } type DeployService struct { IDeployService // some Interface IData // data provider Interface } func (s *DeployService) Start() err...

Q: Survey Populate with List, Option Label and Formula, VBA

Anna ZetI am quite a novice. The below code does what I require but I was hoping you could help me speeding it up and simplifying it please. I know should start with basics when learning VBA..but it's just so exciting. Probably it would be faster if I applies For i to x, next i method Could you please h...

5:51 PM
Q: Optimizing nested loop for calculating geodesic distance

Rwy5I segmented an image into N superpixels and constructed a graph based on that in which each superpixel considered as a node. The information about neighbor superpixels is stored in glcms array. The weight between each pair of neighboring superpixels is stored in matrix W. Finally, I want to com...

6:11 PM
Q: Creating a list using for-loops

Mario ArendI am trying to create a list based on some data, but the code I am using is very slow when I run it on large data. So I suspect I am not using all of the Python power for this task. Is there a more efficient and faster way of doing this in Python? Here an explanantion of the code: You can th...

Sometimes I'm tempted to request the site be renamed to whydoesmycodesuck. codereview.stackexchange.com/questions/237117/…
6:31 PM
Q: Binary Tree Preorder Traversal

SaurabhWhat is the best way to move _add and _preorder methods in class Node to class BinaryTree such that the class structure becomes: class Node: __init__ __repr__ class BinaryTree: __init__ add_node preorder Complete Code:: class Node(object): def __init__(self, item, l...

6:52 PM
TIL GitHub allow you to have unlimited private repositories :O
7:12 PM
Q: Construction of external sorts from comparison ones

Skrabák CsabaHere's an example how to construct an external sorting algorithm from the Quicksort. The method may be applicable to other known internal comparison sort algorithms. I have checked that it shows N*logN time complexity when fed with random file, and almost exactly 0.5 N square when input is alread...

2 hours later…
9:36 PM
Since your code is working and you're basically asking for a code review, a better place to post is likely on StackExchange Code ReviewPeterT 54 secs ago
9:56 PM
When there are down-votes on a question, and close votes for "Needs details or clarity" and no comments, SOMETHING IS WRONG. AND IT'S NOT WITH THE QUESTION!
2 hours later…
11:55 PM
Q: User Specified Array Read and Modify

Darnoc ElocHow may this code be improved upon, the user inputs array of specified length and replaces each element that is smaller than the mean of the first and last element with the mean. Is there a better way to pass the array to the function (ref/ptr, etc.), or more efficient way to manage memory (when...

Q: Execute MSSQL SP in Python

BrijeshI need to execute a Stored procedure in SQL Server and capture all Print statements inside the SP. In addition to this, for other SP's i want to access the result set of the Stored Procedure. I have tried using few libraries like pyodbc, jaydebeapi etc. but none worked db_conn = pyodbc.connect...


« first day (2479 days earlier)      last day (43 days later) »