instruction_seed stringlengths 71 95.1k | _source stringclasses 1
value |
|---|---|
I want to search for a pattern in a time-series while either ignoring the mean/shift/bias or the scale/standard deviation.
Consequently, I've written two functions.
The first function searches passes through the time-series, incrementally calculating the mean for each search-space sub-sequence and using this mean to no... | stackexchange/codereview |
I am trying to solve this question: https://www.codechef.com/problems/TADELIVE
Andy and Bob are the only two delivery men of Pizza-chef store. Today,
the store received N orders. It's known that the amount of tips may be
different when handled by different delivery man. More specifically,
if Andy takes the ith o... | stackexchange/codereview |
Here is the code I wrote for the problem at http://www.interviewstreet.com/recruit/challenges/solve/view/4e1491425cf10/4efa210eb70ac where we need to to print the substring at a particular index from the lexicographicaly-sorted union of sets of substrings of the given set of strings...
import itertools
N = int(raw_inpu... | stackexchange/codereview |
For an online contest whose problem is here, I wrote some code.
In this problem the input will consist of a number of lines of English text consisting of the letters of the English alphabet, the punctuation marks ' (apostrophe), . (full stop), , (comma), ; (semicolon), : (colon) and white space characters (blank, newl... | stackexchange/codereview |
Link here
I'll include a solution in Python and C++ and you can review one. I'm mostly interested in reviewing the C++ code which is a thing I recently started learning; those who don't know C++ can review the Python code. Both solutions share similar logic, so the review will apply to any.
Problem statement
Given an... | stackexchange/codereview |
I'm trying to implement a homogeneous multithreading example that multiple threads process portion of a huge task. In order to achieve this, I thought of clustering data/resource and multiple threads handle/process each clustered data/resource. In the meantime, I wanted to maintain singleton like structure that can man... | stackexchange/codereview |
I have gone through all steps to optimize the code, deactivating screenupdate, deactivating calculation, events, and pagebreaks removed the unnecessary selects, adding constants, and etc. However, I don't think my algorithm for coping is the best one, even if it is probably the simplest of them all.
For Each cell In cu... | stackexchange/codereview |
I'm doing a motion detection program where it snaps an image when it detects movement and snaps an image of the person's face if in view while this is all recorded and sends it all to Dropbox.
It's moving very slowly and lagging like crazy, showing 1 frame in like a minute. Is there a way to optimize it?
I'm using a Ra... | stackexchange/codereview |
I wrote my first series of test for this simple function:
def map_directory(self, path='', method='recursive'):
"""
scan the given path
method -> recursive (all levels) or single (first level only)
:param method: string
:param path: string
:return: generator
"""
if not path:
... | stackexchange/codereview |
Below is my Code, I want to know ways to improve it.
const findOdd = (A) => {
newObj={};
A.filter((cur,index) =>{
return A.indexOf(cur)===index;
}).forEach((cur) =>{
newObj[cur] = 0
for(let i = 0; i<A.length; i++) if(cur === A[i]) newObj[cur] +=1;
});
const keys = Object.keys(newObj)
key = k... | stackexchange/codereview |
This script counts how many matches were won by the team with a first half, second half, and full game time of possession differential advantage.
The data is stored in a pandas data frame:
Points H1 H2 Total
0 36 46 50 96
1 -5 16 18 34
2 47 12 65 77
3 12 79 13 92
4 ... | stackexchange/codereview |
Couple of items to make note of first:
Some of the code is inherited the other has been refactored by me. The procedures that have an underscore in them I am still working on refactoring.
I am still working through naming cells that I feel need to be named.
This code below was re-factored once with help from @TinMan... | stackexchange/codereview |
The code pretty much explains what I am doing here. Just wondering if anyone can think of a better way.
public class AttachmentQuery
{
/// <summary>
/// Initializes a new instance of the <see cref="AttachmentQuery"/> class.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="sta... | stackexchange/codereview |
I've created a little hangman game. It's pretty simple, and not to exciting but I want to know if there's a way I could turn this little game into something more extravagant and more exciting. How can I take this delicate piece of crap machinery into something a little more fun and a bit more complicated? For example:
... | stackexchange/codereview |
I am trying to implement a monochromic image container with std::unique_ptr.
The example usages
The example usages is as below.
int main()
{
auto test_data = std::make_unique<unsigned char[]>(100 * 100);
for (size_t i = 0; i < 100 * 100; i++)
{
test_data[i] = 3;
}
auto test = DigitalImagePro... | stackexchange/codereview |
I have 2 nested for loops which i want to get rid of. Any thoughts?
I am calculating distance between cities based on their longitude and latitude. There is a custom function earth.dist() that i am using in the loop.
for (i in 1:nrow(dat)) {
#for each other airport
for (j in 1:nrow(dat)) {
#if both airport are... | stackexchange/codereview |
The branches I need to merge are called test and test-passed. Merging will always be fast-forward, from test to test-passed as commits to test-passed are only done automatically from test. This is currently working, just wondering if the approach is correct. The script is executed by Hudson, once all testing is complet... | stackexchange/codereview |
Here is the GitHub repository for the code if you'd like to look at that instead. It's hardly any larger than what's posted here. Most of the code are in these three modules.
Besides just general suggestions, there is a bit duplication in my code, I've tried to minimize it, but I've hit a point where everything gets sc... | stackexchange/codereview |
Here is my attempt at converting hex strings to byte arrays and converting byte arrays to hex strings:
net.coderodde.util.ByteStringConverter
package net.coderodde.util;
import java.util.Scanner;
public class ByteStringConverter {
/**
* Converts the given byte array to its textual hex representation.
*... | stackexchange/codereview |
I want to create a very basic physics engine in SFML. I also want to be able to control objects using Dear ImGui. So I created this basic foundation. My main problem with it is how I handle rendering the GUI, because I couldn't find another way to implement it, either just drawing an object, or drawing object and a GUI... | stackexchange/codereview |
An array is called balanced if its even numbered elements (a[0], a[2], etc.) are even and its odd numbered elements (a[1], a[3], etc.) are odd. Write a function named isBalanced that accepts an array of integers and returns 1 if the array is balanced, otherwise it returns 0. Examples: {2, 3, 6, 7} is balanced since ... | stackexchange/codereview |
I have designed a logger class to log messages to a file. It uses an independent thread to log the messages save to a queue previously using the main thread. I want to receive reviews about it.
#include <iostream>
#include <queue>
#include <mutex>
#include <condition_variable>
#include <fstream>
#include <atomic>
#incl... | stackexchange/codereview |
I am beginner in python and I am learing about syntax and other functions in python by writing Algorithm and Data Structure programs.
How can this code be improved?
def get_input(): #to get input from user
input_str = input("Enter elements to be sorted: ")
try:
lst = list(map(int, input_str.split())) #m... | stackexchange/codereview |
I've run into the same scenario involving Monad Transformers a few times now, and I'm looking for some "best-practice" advice.
Bear with the introduction, the issue itself is really simple:
Say you're given a list of inputs, and you want to convert them into some aggregated form while handling the possibility of inval... | stackexchange/codereview |
Consider the taxicab ring metric space shown below. This is a discrete metric space in which we have both a grid and concentric diamond rings. This metric space stretches infinitely in all four directions, but I have only drawn four rings.
I want to write a function that returns the shortest distance between any two po... | stackexchange/codereview |
I've got the following code in my calculator project:
private ITerm CalculatePostfixExpression(IEnumerable<ITerm> input)
{
var tempResult = new Stack<ITerm>();
foreach (var term in input)
{
if (term is IOperand)
{
tempResult.Push(term as IOperand);
}
if (term is I... | stackexchange/codereview |
this.action = function(value){
var deleted=false;
for (var row in binaryObj) {
if(value == 3){
for(var i = 0 ; i < binaryObj[row].length; i++){
binaryObj[row].sort();
if(binaryObj[row][i]+binaryObj[row][i+1] === value) { ... | stackexchange/codereview |
I'm trying to extend the Mongoose RESTful server example with URL routing.
This code relies on the Mongoose library available here.
This is heavily inspired by the routes class from this question but I've tried to use a multimap to store routes and make lookup more efficient, as well as support Mongoose's wildcard matc... | stackexchange/codereview |
This is the second version of my lotto game, based on this thread before. I hope I used all the tips I was given, also I fixed it using only functions as promised.
Game rules
Each player is given 15 numbers, in increasing order. This is why I
use sorted() on the lists of player and computer. Also there is a
common... | stackexchange/codereview |
I am a self-taught programmer and would like anyone to point out anything that is not the standard or professional way to do things. Any help/advice is greatly appreciated.
I would love to post a lot of my code or perhaps make a youtube video explaining certain portions for feedback. Let me know in the comments what yo... | stackexchange/codereview |
I have an Angular component and it is just a label which renders a value and if it has an associated pipe, the output of the pipe should be rendered as value of the label. But I don't want to declare all the pipes in the component. Currently I would like to use the currency pipe and the date pipe with their parameters.... | stackexchange/codereview |
I wrote some code using ChucK : Strongly-timed, Concurrent, and On-the-fly
Music Programming Language and would like a review. I broke down the logic into a number of classes, all of which are shown below.
This is pretty new to me, and I would appreciate any and all constructive criticism. What the main script fizzbu... | stackexchange/codereview |
I have implemented Lagrange polynomials, i.e.
\$l_j(x) := \prod_{\begin{smallmatrix}0\le m\le k\\ m\neq j\end{smallmatrix}}\frac{x-x_m}{x_j-x_m} = \frac{(x-x_0)}{(x_j-x_0)} \cdots \frac{(x-x_{j-1})}{(x_j-x_{j-1})} \frac{(x-x_{j+1})}{(x_j-x_{j+1})} \cdots \frac{(x-x_k)}{(x_j-x_k)}\$
where the product is supposed to be e... | stackexchange/codereview |
For my game engine I needed a simple templated array class that can be safely passed across module boundaries. It's not supposed to be a replacement for std::vector and thus doesn't need all of its features. Instead it is intended to be used in the interface where binary compatibility is important.
For malloc and free ... | stackexchange/codereview |
I have an implementation of the sqrt function that uses a combination of IEEE 754, packed bitfields, and the Newton-Raphson algorithm:
decompose.h:
#ifndef DECOMPOSE_H
#define DECOMPOSE_H 1
#ifdef __cplusplus
extern "C" {
#endif
#include <float.h>
#define MANTISSA_SIZE 52
#define EXPONENT_SIZE 11
#define EXPONENT_BI... | stackexchange/codereview |
My program calculates the determinant of a matrix of any degree. If you really can't understand my comments or indentifiers please let me know.
//;;MakeShift make element number 'ind' the head of list:
(defun MakeShift (ind L buf)
(if (= ind 1) (cons (car L) (append buf (cdr L)))
(makeReplace (- ind 1) (cdr ... | stackexchange/codereview |
I'm having trouble with the slow computation of my Monte Carlo simulation code. Based on the pycallgraph, the bottleneck seems to be the module named miepython.mie_S1_S2 (highlighted by pink), which takes around 0.5 seconds per call.
Below is an example of the implementation of miepython.mie_S1_S2.
m = 1.336-2.462e-09... | stackexchange/codereview |
Currently I am looping through dependencies of objects, and I am trying to replace GUID (unity object ID's) inside the files.
Right now I am using the following code, any suggestions for improvement ?
public class SendToThread
{
public int localID = 0;
public string oldID;
public string newID;
public L... | stackexchange/codereview |
I am currently looking into improving code efficiency while working with a flat string collection in C#. The strings in this collection can be considered a "group" or a "child".
The problem is that the API for this collection is exposed in such a way that the type of each String in the collection is not directly retrie... | stackexchange/codereview |
Here's a small experiment about handling boilerplate tasks via service pipelines. It's similar to the HTML pipeline but simpler and multipurpose.
I've updated the question and this is the 2nd version of this project. The first one turned out to have some substantial weaknesses like inability to invoke more than one co... | stackexchange/codereview |
I'm having trouble with a current algorithm I'm writing that takes a corpa, a list of characters in sets (1 one or larger) with a frequency number attached to it. Against another list of character sets that need to be created using the most frequent occurrences of the combined sets... if that makes sense. I'll explain ... | stackexchange/codereview |
Algorithm: Determine if an array of arrays of characters can be
concatenated in order, into a substring of haystack.
Example:
[['a','A','@'], ['b','B','8'], ['c','(','[']]
This list can be combined by selecting from each of the subarrays in
order, such as:
abc, ab(, ab[, Abc, Ab( etc.
Are any of these combination... | stackexchange/codereview |
I have recently started working on angular.js and I like it. I have decided to use a single controller per view. I use the json data from the backend. As my work is progressing, my codes are getting more verbose and I would like your suggestions on how I can (as a newbie) improve my code. I use the default $http servic... | stackexchange/codereview |
I got some good feedback from the last code I posted which I have incorporated in to this project (enum, try, f string formatting), so again just looking for some feedback on how the code could be improved. My teenage son came home with a Computer Science project for Rock Paper Scissors with an advanced option to add L... | stackexchange/codereview |
I want to make some VHDL code open source. But before I do, I want to make sure that it is as readable as possible. Things to improve upon could for example be naming and the use of comments.
The code is adding two binary-coded-decimal numbers. The algorithm behind it will come in the documentation. Note that this isn'... | stackexchange/codereview |
This is my first F# program.
It's a command line utility that takes a parameter containing a path to an height map bitmap and prints out this height map converted to JSON format.
open System.Drawing
let convertLine (y:int) (bitmap:System.Drawing.Bitmap) =
[ for x in 0 .. bitmap.Width - 1 -> "\"" + bitmap.GetPixel... | stackexchange/codereview |
I am working on Word Ladder - LeetCode
Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:
Only one letter can be changed at a time.
Each transformed word must exist in the word list. Note that beginWord is no... | stackexchange/codereview |
I have created a quest system for a sort of game. The users will be able to complete quests by doing simple things and in return earn rewards for completing them.
Handles everything quest related
public class QuestHandler
{
private readonly Dictionary<int, Quest> _quests;
private readonly Dictionary<string, int... | stackexchange/codereview |
I have a problem with my code, because his is required a long time to be done(only when I put big numbers like 2000)...
I am trying to do the Hamming Numbers kata on codewars.com:
A Hamming number is a positive integer of the form 2i3j5k, for some non-negative integers i, j, and k.
Write a function that computes the n... | stackexchange/codereview |
This should be the last iteration for this code.
Does this approach make sense or am I heading down the wrong path?
The only thing I can see to make this better is to genericize the GetType methods at the end so that I could eliminate the goofy if statement in the GetProperties method. Any suggestions?
What I've don... | stackexchange/codereview |
I am learning Go by writing a simple CRUD REST API using gotilla/mux and Gorm.
I would like to get some feedback on the application code and on unit tests in particular. Please suggest me what to improve, what to do better, what not to do and generally tell me what comes to your mind.
func TestGetAllStudents(t *testin... | stackexchange/codereview |
latest updated version in cross-post from SO
I'm testing performance regression of some code I wrote (this is not that code) by timing its execution in Unit tests. I would like to see if execution time equals some expected value within a given degree of accuracy, e.g. <1% change. VBA doesn't have this built in as far a... | stackexchange/codereview |
I have the following code:
if (isMandatory)
{
x.MandatoryServices.ForEach(y =>
{
if (!y.IsSelectedByUser)
{
containsRemovedSrvcs = true;
return;
}
});
}
else
{
x.OptionalServices.ForEach(y =>
{
if (!y.IsSelectedByUse... | stackexchange/codereview |
I'd like some feedback.
from random import randint
turns = 1
computer_guess = randint(1, 10)
while True:
user_guess = raw_input("Guess Number: ")
print 4-turns, "Turns left"
if turns == 4:
print "You lost!, LOOSER!"
exit()
else:
if int(user_guess) == int(computer_guess):
... | stackexchange/codereview |
I have a slideshow in jQuery slideshow switching picture automatically every 5 seconds with CSS3 transitions. The current picture has the current class, the previous picture has the forrige class and the next picture has the neste class. The first picture on page load has the first class to avoid animation, and a bakle... | stackexchange/codereview |
I'm just starting out in Rust and I find the concept of ownership confusing so I wrote an implementation of the echo command. I would like to know if I could have set the initial value on the echo variable any better or just any general improvements.
use std::env;
fn main() {
let args: Vec<String> = env::args().co... | stackexchange/codereview |
I have made a basic program using AngularJS that displays data from a JSON file, and filters it according to the user's selection (specifically FIFA 15 chemistry cards).
I did plenty of CSS work to it; mainly to test myself as I have barely used it. I have done some (minimal) work to make certain aspects respond to dif... | stackexchange/codereview |
I have an application where I need to highlight some information that is printed to the console, so I wrote some static library methods which do that. I tested for bugs. Is my code clean and satisfying, or are there aspects to criticise?
It has to work for multiple lines - given as a string that contains newlines and f... | stackexchange/codereview |
Optimizing/parsing files into semi-complex data-structures more efficiently
To preface, I'd like to say that this code is part of the Advent of Code 2019 solutions I have been working on. Particularly #14.
--- Day 14: Space Stoichiometry ---
As you approach the rings of Saturn, your ship's low fuel indicator turns ... | stackexchange/codereview |
This code is working on the user selection when pressed a button the table will be filtered by the number of criteria the user selected:
Sub advancedMultipleCriteriaFilter()
Dim cellRng As Range, tableObject As Range, subSelection As Range
Dim filterCriteria() As String, filterFields() As Integer
Dim i As Integ... | stackexchange/codereview |
I made some code to get RTTI information of a polymorphic object, it works both if you pass it directly or a pointer to it(the pointer will get dereferenced until null or the object is found), it's going to be used only for debugging log, can this solution be improved in some way?
#include <cstdint>
#include <string>
#... | stackexchange/codereview |
I've written a 3-SAT solver based on this prompt:
Alice recently started to work for a hardware design company and as a part of her job, she needs to identify defects in fabricated integrated circuits. An approach for identifying these defects boils down to solving a satisfiability instance. She needs your help to wri... | stackexchange/codereview |
I inserted this code snippet in the functions.php of my child theme, to create the woocommerce single product page in the hook woocommerce_after_single_variation of the custom icons in line centered on the text, without using css, everything works, but I ask you much more experienced if that's okay, or could you do bet... | stackexchange/codereview |
I have the following code which iterates over all pixels of an image and does some manipulations on two images of the same size. I would like to speed it up and to avoid iterating over the positions in a for loop:
import numpy as np
import cv2
# Two images of same size
image_in = cv2.imread('my_image.png')
image_in2 ... | stackexchange/codereview |
I have recently started learning Python and one of the assignments I have been working on is a Caesar decipher.
Can you tell me how I can make my code better?
def caesar(code, shift):
''' (str, int) -> str
Shift every letter in the code by the integer 'shift'.
>>> caesar('ABC', 2)
CDE
>>> caesar('a b c', 4)
... | stackexchange/codereview |
This is my first PHP project - just to write to something to learn from. I made a page with form to send some quote to server and display some quotes from db.
I'm just starting with PHP so point out anything that could help me improve.
Live version.
quote-a-day.php
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/... | stackexchange/codereview |
I just recently finished going through all of learncpp.com's and Lazy Foo's SDL2 tutorials. This is my first program written outside of the tutorials so I assume there's plenty of room for improvement. Any constructive criticism for what can be improved would be greatly appreciated.
The gist of the game is that it gene... | stackexchange/codereview |
Here is a simple implementation of the Discrete Fourier Transform:
myFourierTransform.m
function [ft] = myFourierTransform (X, n)
% Objective:
% Apply the Discrete Fourier Transform on X.
% Input:
% X - 1xM - complex vector - data points (signal discretisation).
% n - 1x1 - integer scalar - number of discrete f... | stackexchange/codereview |
I am following the Stanford iOS 8 lectures and I believe I have successfully added the "Clear" functionality to the application, but I don't know if I am doing it properly.
Controller
import UIKit
class ViewController: UIViewController
{
@IBOutlet weak var display: UILabel!
var userIsInTheMiddleOfTypingANumb... | stackexchange/codereview |
You are given to paint a floor area of size A. There will be 12 paint buckets from 4 primary
colors with each having 3 shades (i.e. total 12 buckets). The bucket size, or more specifically,
the amount of area you can paint from each shade is given in the following arrays.
The different shades of the same primary color ... | stackexchange/codereview |
I'm a first year computer engineering student who's learning about algorithms and data structures. I've implemented a parallel merge sort algorithm in C++ and would like constructive criticism. This was done in Visual Studio on Windows.
Some thoughts:
portability isn't a concern I have atm.
merge_sort isn't using tail... | stackexchange/codereview |
Context
I was proud of this code for a little while, but the repetition wounds me. I know that the function name sucks, but the name and interface to this function are not under my control. Performance is not a concern. Note that this must be an inline table-valued function.
Fixing the repetition is my only concern. Ho... | stackexchange/codereview |
The below code will read a downloaded HTML file. Uses BeautifulSoup and lxml to parse the document and extract all the URLs present in the document.
The function should return full URL, present with the domain, and no duplicates (even links with # are split and only the first part is taken). I may want to run this scri... | stackexchange/codereview |
Here is a simplified implementation to obtain the duplicate words in a text using lambda expressions.
public class FindDuplicateWordsInText {
public static Set<String> findDuplicateWordsInText(String text) {
String[] words = text.split(" ");
Set<String> duplicatesRemovedSet = new HashSet<>();
... | stackexchange/codereview |
I am new to C# programming. I wrote a little program in C# to calculate all primes until a user-given value. Ignoring the lack of computing power I wrote this program to handle theoretically very huge numbers.
The code works properly. I have no error handling simply because it is a little program for myself. But I'd li... | stackexchange/codereview |
I work on a small Web Component that converts an amount of money to another currency. For that, I use an API that returns the exchange rates.
I want to use the component multiple times on a page and thought that it would be a waste of traffic if every component fetches the same exchange rates. So I wrote some logic tha... | stackexchange/codereview |
I'm doing a Java text based game as a course project.
Everything is fine but the part where it shows a conversation, then gives you 2-4 options, then each actions will lead to different text and stats changes.
For now I can only come up with declaring a string array to store all the text, looping through the text until... | stackexchange/codereview |
I have a code that works but is very badly written. The main is very verbose, it is just to test the class.
I want to make objects move on a chessboard (a coordinate grid). I've defined these object as Vehicles. They have a position (x,y) on the plane and a direction. Being forced to move only North-South-East-West pos... | stackexchange/codereview |
I wrote a simple and small projects that present 3 buttons, each one loads a different list to the screen on the same place but not in the same time.
In my HTML, I think I can maybe use some more generic way to present the lists:
<div>
<!-- list 1 button -->
<button md-button
(click)="showFirstList()"
... | stackexchange/codereview |
function parse_request_uri() {
$parts = [];
if (array_key_exists('REQUEST_URI', $_SERVER)) {
$request_path = explode('?', $_SERVER['REQUEST_URI']);
$parts['base'] = rtrim(dirname($_SERVER['SCRIPT_NAME']), '\/');
$parts['path'] = substr(urldecode($request_path[0]), strlen($parts['base']... | stackexchange/codereview |
I am gradually completing the CodingBat exercises for Java. Here is the one I just did:
Given an array of ints, return true if it contains no 1's or it contains no 4's.
Here is my code:
public boolean no14(int[] nums) {
int oneCount = 0;
int fourCount = 0;
for (int i = 0; i < nums.length; i++) {
... | stackexchange/codereview |
I'm making a card game and I found useful to include a 60 second countdown timer. Here is my approach:
import java.util.Timer;
import java.util.TimerTask;
public class SecondTimer {
private Timer timer;
private int countDown;
private int secondsLeft;
public SecondTimer() {
timer = new Timer()... | stackexchange/codereview |
Whilst developing a game I needed a delay routine capable of doing delays
ranging from 0.5 sec to just a few msec. The obvious choice was to use
the BIOS delay function 86h on int 15h. In a true real address mode environment
it works correctly but I saw that an emulator like DOSBox messes up things.
Tons of illegal rea... | stackexchange/codereview |
What do you think about this implementation of 2 floats comparison functor considering how tolerance is introduced?
class Less
{
private:
float m_tolerance;
public:
Less(const float tolerance)
: m_tolerance(tolerance)
{
}
bool operator()(const float f1, const float f2) const
{
... | stackexchange/codereview |
I made a simple login page with Java EE, jsp, servlet, tomcat and jdbc.
It does following:
login user
register user
after login it creates token for the session so ya can be directed from start page if ya have already login
you can remember your login: then email and token is store in cookies
logout: clear cookies and... | stackexchange/codereview |
I have a slider with 3 images and left/right arrows. If you click on them, the image changes. You also have 3 bullets below the images and the image changes depending on what bullet you click.
I don't want to use buttons "arrows"; I want to use the tag "a." Any ideas on making it better? You'll need to add 3 images "be... | stackexchange/codereview |
I have written a plugin loader in Ruby, and I would like to know if it uses the best technique to handle classes, or if anyone has any recommendations on how to improve my code.
I have written a class called PluginManager, and an accompanying module named Plugin. The names of these are self explanatory, one handles the... | stackexchange/codereview |
// ms is expected to be between 0 and 2000
// fakeDouble is expected to be {0, 0}
// uint64_t isn't used because it doesn't work with /NODEFAULTLIB when compiling 32-bit
void msToDouble(uint32_t ms, uint32_t* fakeDouble) {
if (ms == 0) {
return;
} else if (ms >= 2000) {
fakeDouble[1] = 0x4000000... | stackexchange/codereview |
I'm developing an application to manage a player card-library from an online game. Each card has an image that is stored on disk with a numeric code, for example, the card with ID=1234 has his image stored as 1234.png and all the images are stored on the same folder.
As of now there are more than 3500 images for a tota... | stackexchange/codereview |
I'm looking to improve it in brevity, readability, and simplicity. Basically, I'm just looking for a more elegant solution. What improvements can I make?
i=0
while true; do
OUTPUT="$(docker inspect --format='{{json .State.Health.Status}}' su-apache)"
if [ $OUTPUT = '"healthy"' ]; then
echo
break
... | stackexchange/codereview |
I have two lists: L stores some values and P holds values that are indices in the first list that should be printed. Lists are sorted in ascending order. Error-checking can be ignored, and both lists are valid and values are valid.
Do I understand correctly, that since I always continue from the place I ended at, and s... | stackexchange/codereview |
As part of learning Rails framework, I have small app in progress. Basically idea is, user can create IP address, define is it in use, to which server is assigned, which user is it using and role of IP address in web hosting environment. I have 3 models, IpAddress, IpAddressRole and IpAddressUser. User is able to defin... | stackexchange/codereview |
I'm trying to solve the Reve's puzzle (a variant of the Tower of Hanoi puzzle with four pegs). This is what I've come up with so far:
def solve(disk, source, temppeg1, temppeg2, destination):
if disk == 1:
print((source, destination))
elif disk == 2:
print((source, temppeg1))
print((sour... | stackexchange/codereview |
I have an Enum the encapsulates numeric primitives (u8, i8, u16, i16, u32, i32, u64, i64, f32, f64) into a common type called "Number". I want to implement a PartialOrd train for the enum based on the encapsulated data allowing different numbers to be compared. I have a solution that uses nested pattern matching and ... | stackexchange/codereview |
While practicing for a school coding challenge, I came across this problem. My code got the right answers but exceeded the time limited. Any tips for how to reduce the time complexity?
https://pctc.cuttle.org/index.php?action=user_question&grq_id=946
Problem
Details
My code:
x = int(input())
c,a,mx,ct,og,mx = 0,0,0,[... | stackexchange/codereview |
I've been learning a ton of c++ lately on Codecademy and I'm soon done with the course of c++.
(Still need to learn classes, object-oriented programming and harder projects.)
But I wanted to get a review of my recent program.
And I also wanted to know if its possible to make an Unique ID, that only fits me, kinda like ... | stackexchange/codereview |
I have an interface with two functions. This interface is being inherited by an abstract class which implements just one of those functions. The other one is left to be implemented by the derived classes of the abstract class.
public interface ICombination
{
bool Check(IReadOnlyList<int> hand,UsersProperties user);... | stackexchange/codereview |
I wrote a small simulator to understand the Elo rating system. I can create players, matches and tournaments, and I want to be able to predict the match ending depending on the rating of each player and some randomness. At the beginning the ratings are all around the same values (say 600) and it appears to stay between... | stackexchange/codereview |
This code calculates the factorial of a number on multiple threads. My issue: it is only a little bit faster than the sequential version of it (and I think I know why, I just can't find a way to solve this).
I use boost::multiprecision::cpp_int so the limits of default integers are not a problem, the size of integers i... | stackexchange/codereview |
This code was first critiqued here (without the Card class): Card Deck class for a Poker game
After learning more about data structures both online and in class, I wanted to revisit my Card and Deck classes and see if I can still make them better. Based on my driver tests, they are doing nearly everything I want them ... | stackexchange/codereview |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.