instruction_seed stringlengths 71 95.1k | _source stringclasses 1
value |
|---|---|
I have created a small selenium script that checks for available times to write a test for a drivers license. The program runs every minute and takes approx 50 seconds to run. I have noticed that it's quite unstable, and do not preform optimally because the web-page loads elements dynamically. Even if I use seleniums w... | stackexchange/codereview |
Also posted at rgcsm.info/blog
//Number Guessing Game in Java Swing
//Also posted at
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Guess extends JFrame
{
JTextField t1, t2, t3, t4;
JLabel j4;
ButtonListener bl1;
ButtonListener2 bl2;
ButtonListener3 bl3;
//sett... | stackexchange/codereview |
I maintain an application that has a method in a class for saving uploaded files to filesystem and I want to run asynchronously as it saves multiple files in a single request. I don't know if it's best to use Task.FromResult or Task.Run, but I've modifed the code to use Task.FromResult.
public class AttachmentProcessor... | stackexchange/codereview |
I was looking at other people code and I realized that mine is not so neat after all.
In this version, I included a base case for the merge part (when there is only 2 elements to merge, just sort it normally). I do not know this is a good idea or not, never seen it in other people' codes.
This is the first time I imple... | stackexchange/codereview |
Objective: Crop the image so only the number stays in the image
Problem: Slow Performance
I have code that crops an image.
The image pixels are 0 or 255. There are no values between.
The background is 0 (black) and the letter/number is between 0 (not-inclusive) - 255 (white).
This code is being used to crop a Mnist Di... | stackexchange/codereview |
I am learning React by doing a Contact Manager, I am trying to write this code more efficiently. Any ideas...good practise, component splitting, formatting tips are accepted too. Thanks in advance
P.S. Sorry for my English...I am from Italy.
First I used a separate function for everything, then I transformed person var... | stackexchange/codereview |
I began the journey to be a self-taught programmer about a month ago and my biggest fear about teaching myself is developing bad habits and not realizing it.
I'm looking for criticism on this "Guess a Number" game. It's my first real "project" that I've invested serious time into so I feel like this is my first opportu... | stackexchange/codereview |
I have written a code to solve the N-Queen problem for a 14 by 14 chessboard. There are preplaced queens (see below for the sample input and output). The lines of sample input (after the 3) represent the positions of the preplaced queens. For example, "1 1 2 9 3 6 4 10" refers to the 4 preplaced queens are at (1st row ... | stackexchange/codereview |
I have completed this mockup eCommerce app using Javascript. This version can add products into a shopping cart and automatically calculate the order summary in the shopping cart. It can also delete one item and all items in the shopping cart.
Checkout and login functions are not included.
Appreciate all comments and c... | stackexchange/codereview |
Like most of the folks here, I'm learning Haskell, so I figured an interesting exercise would be to build a matching engine that I could use to build a financial exchange. I'm wondering primarily if I used monad transformers here idiomatically, but all other feedback is appreciated as well.
In some cases I felt like us... | stackexchange/codereview |
This is my first attempt at using OOP JavaScript in my work. I know the concepts but implementation is more complicated than I thought. Now the code is a mixture of several things (JavaScript/jQuery).
The code works well however I am not sure if it is proper OOP (don't like the way it looks - tons of this).
I know th... | stackexchange/codereview |
Simple question:
What would you rather do?
public class FooRepository
{
public Foo GetById(int id)
{
Foo foo = null;
using (IDataReader data = /* Get Foo's data */)
{
// Let the Foo object set it's own fields using the data object
foo = new Foo(data);
}
... | stackexchange/codereview |
This is my version of the knapsack challenge and I was wondering if there was a way to do it so it doesn't go through the foreach statement so many times. At the minute it goes through it thousands of times to get he closes value to the target number, which takes long time to do, I was wondering if there was a way to e... | stackexchange/codereview |
The task:
Given an integer list where each number represents the number of hops
you can make, determine whether you can reach to the last index
starting at index 0.
For example, [2, 0, 1, 0] returns true while [1, 1, 0, 1] returns
false.
My solutions:
// functional:
const reachLastIndexOf = (arr, start) => {
... | stackexchange/codereview |
I would like to share this post with the community since at first glance it is very promising. Storing flags in the database is something that I have been interested in doing for a while since it seems like a lean way to store some bit options which become ugly with Is[this], Is[That], and Is[Whatever]. However, I have... | stackexchange/codereview |
Code first, elaboration later:
// Fizzbuzz: 1..100, %3->fizz, %5->buzz, %15->fizzbuzz
// noif: do not use if/switch statements or ternary expressions
// LIMIT must be a power of 10
// WIDTH must be equal to log10(LIMIT)
#include <stdio.h>
#include <string.h>
#define LIMIT 100
#define WIDTH 2
char *
itoa(int n)
{
... | stackexchange/codereview |
I wrote this function to remove from the array those words that are less than n values. More precisely, I updated my old function and added some functionality. Since I am a beginner in this programming language and so I could in my code allow for various illogical errors: Old version of my function:
$words = array("ӯта... | stackexchange/codereview |
Please be gentle with me-- I just began learning to code a few weeks ago as a hobby in order to support my other hobby of learning general relativity, so this is the first bit of code I've ever written. I would love to keep getting better at coding, though, so any feedback on ways to improve my code would be much appr... | stackexchange/codereview |
Yesterday in an online interview, the interviewer asked me this question:
If I give you a string, you have to return if a string is number or
not. You are not allowed to use any parse function available.
This was my first online interview after a long long time, so I took way too much time in this question. I want ... | stackexchange/codereview |
Is the following procedure good for shuffling data in general (not just for JavaScript)?
function Shuffle(array) {
var temp = null,
len = array.length - 1,
rnd = null;
for (var i = len; i > 0; i--) {
// Generate a random number in which does not exceeds the length of array.
rnd = Math.floor(Math.r... | stackexchange/codereview |
Introduction
I have released a small a WAVE file reader with a mutex/lock-based caching mechanism, as a header-only library. The general purpose of the library is to read WAVE files into floating points, in a way that handles repeated sequential requests for audio data without hanging on disk reads.
I am looking for so... | stackexchange/codereview |
All of the codes are based on the PSR-2 standard. Also Dependency-Injection and Repository patterns are followed. I would love to hear some advices or comments.
StudentRepository Class
namespace REST;
use Slim\PDO\Database;
interface IStudentRepository
{
//Functions to be defined
public function __construct... | stackexchange/codereview |
I have written this backup utility to keep incremental backups by copying new and modified files, and hard linking unchanged or simply moved files. In an attempt to speed up the comparisons, I save a record of the file stats from the previous backup to avoid iterating over the old backup directory. The backup is called... | stackexchange/codereview |
There is a test of OO knowledge called Iffy Tractor. The task is to refactor the code and make it as much flexible as possible for the future modifications.
I have placed the code here.
It was taken from here.
This is a kind of a part of the game with a tractor unit, which receives the commands from user. So the possib... | stackexchange/codereview |
I have a form that submits to a registration Servlet, which inserts a new user to the database when they sign up to the web application. Depending on the erroneous user input, the Servlet will sendRedirect() to a result page, telling the user what went wrong.
Servlet: doPost()
protected void doPost(HttpServletRequest ... | stackexchange/codereview |
I have just started using Python, and I am attempting to make a prime number sequence generator, where it will print the a specified amount prime numbers in terminal. I have other versions of this also, and versions for the Fibonacci sequence, although, I will post just the version for prime numbers I specified above.... | stackexchange/codereview |
I have created this code for user error logging, and I am wondering if there is anything that can be improved. The point is that this error handler would ONLY catch user errors created in-code by trigger_error(), and would display, log, and/or email the error, depending on the config settings. The error logging class i... | stackexchange/codereview |
I want to call a series of functions to build up an array, like so:
$array['conditions'][] = $this->function1($input1);
$array['conditions'][] = $this->function2($input2);
$array['conditions'][] = $this->function3($input3);
However, each function may return either an array with values or an empty array (depending on i... | stackexchange/codereview |
I am learning c++ and read why we can't use realloc() in std::vector, but i think we can use realloc() for pods, so here is my attempt to write std::vector like class template specialized for PODs
#include <malloc.h>
#include <stdexcept>
#include <type_traits>
namespace gupta {
namespace detail {
namespace podvector {... | stackexchange/codereview |
I am fairly new to coding TSQL script and am looking for some second view on my script.
The goal here is to to pull in some data and amongst that data to show a field with a counting the number of working days since the order date only (i.e. minus weekend days and UK bank holidays). The SELECT script below is working a... | stackexchange/codereview |
I wrote a program that calculates the minimum number of coins required to give a user change.
One concern I have is: When do we initialize the value of a float to be negative or positive? I recently saw
float userInput = -1.0;
but what about
float userInput = 1.0;
Are there differences between the two, and when... | stackexchange/codereview |
I use the Repository/Service design pattern in my projects and I have found something that might be a bit redundant. Am I writing any unnecessary code?
With that in mind, here is my structure:
public class Competition
{
public int Id { get; set; }
[Required] public string UserId { get; set; }
public string... | stackexchange/codereview |
Exercise 7.2 from Python for Informatics:
Write a program to prompt for a file name, and then read through
the file and look for lines of the form:
X-DSPAM-Confidence: 0.8475
When you encounter a line that starts with “X-DSPAM-Confidence:” pull apart
the line to extract the floating-point number on the line. Count... | stackexchange/codereview |
My code passes 11 out of 12 test cases. I was wondering where I can improve my code. NOTE: This code needs performance improvement, as it is working for most of the cases. To mu knowledge it would work for all the test cases where the size of arrays is smaller than 200.
Here is the question:
Alice is playing an arcade... | stackexchange/codereview |
I work mainly at developing MSSQL databases but I've been trying to teach myself C# for a bit now and I wrote some simple code that prints a list of colleagues and their coffee preference.
I just went through it with my precarious knowledge and I can't find much more to add or remove from it, I thought maybe I can pos... | stackexchange/codereview |
I've developed a fully working flash card app for kids. It has a UIImageView that cycles through 26 cards (abcs) via a gesture click and a music button that will play a sound for each image. Right now I have this 100% working, but the sound plays in an IF statement that has added an additional 400 lines of code.
How I ... | stackexchange/codereview |
I appreciate any feedback on where I might alter or improve my code for this project. This is an old attempt at implementing a Hierarchical State Machine in F#. I'm from a C#/OO background mostly.
module FSharp.HSM
open Option
open System.Collections.Generic
exception NoTransition
exception NotInitialized
exceptio... | stackexchange/codereview |
I wrote a Java program implementing Resenblatt’s perceptron Single Layer Network, Least Mean Square algorithm for Single Layer Network and Back-propagation algorithm (MLP) Network. I'm trying to write efficient and clean code.
NeuralNetwork class
package fcis.asu.neural;
import java.util.Map;
import lombok.Getter;
im... | stackexchange/codereview |
Consider this code:
public class DataSt {
DataType time;
DataType memory;
public DataSt(DataType time, DataType memory)
{
this.time=time;
this.memory=memory;
}
private static void saveIt(DataSt p, Data... | stackexchange/codereview |
I'm trying to find out whether a particular file is UTF-8 encoded readable text, by which I mean printable symbols, whitespaces, \n, \r\n and \t (think: source code). As speed is of importance, this has to be determined from just the first few dozen or so bytes of the file.
I've tried my luck using an io.RuneReader, im... | stackexchange/codereview |
I have written a method which will return the size 16 List every time. If the input List has size less than 16, the remaining list object will be filled with default values. Is there any way to remove the if and for condition from the enrichAddress method?.
@Component
public class TestService{
public List<TestB> enri... | stackexchange/codereview |
I have given an assignment where I have to escape a labyrinth. The goal is to find the shortest way. I have done some research and there seem to be two strategies to solve the problem: the Depth-first search and Breadth-first search, where the first starts at the root (Starting point in maze) and explores as far as pos... | stackexchange/codereview |
I am implementing a binary search algorithm and my code is as shown bellow:
def binary_search(a, x):
left, right = 0, len(a) ... | stackexchange/codereview |
I am working on a project that requires a directed weighted graph data structure. It looks like this:
graph.h
#ifndef COM_GITHUB_CODERODDE_PERL_GRAPH_H
#define COM_GITHUB_CODERODDE_PERL_GRAPH_H
#include "unordered_map.h"
typedef struct GraphVertex {
size_t id;
unordered_map* p_children; // Maps a child to the... | stackexchange/codereview |
I just finished a simple script for Node that will delete all the folders and files inside a specified folder ID through Box's API. It works by getting a list of items inside a folder, then generating a list of File IDs and Folder IDs, then making parallel calls to Box's delete file and delete folder endpoints.
This s... | stackexchange/codereview |
I have already addressed this issue and corrected something .really..now the graph looks different
Please tell me if the program works correctly?You can see the results in the picture above.I will be grateful if you find any mistakes (if there are any, of course..)
/I'm just not sure if the average number of swaps and... | stackexchange/codereview |
I have this work task, to write a SQL query that would show how many of the active customers are new (= do not have prior transactions) as opposed to returning per a given period.
There is nothing particular in the DB to get this, so my solution takes a transaction and compares customer_id to the pool of customer_ids t... | stackexchange/codereview |
I was thinking of adding a very high-level implementation of the event/observer pattern to my project. The implementation would manage adding and removing observers as "needed". You can use an almost DLS-like API to define when an observer should be added or removed.
Here is an example of the API in use. We want to tra... | stackexchange/codereview |
This my first Python program and game. Can you please point how I can improve and what code should be changed?
import pygame
from pygame import *
import random
import time
import os
import sys
from pygame.locals import *
black = (0,0,0)
white = (255,255,255)
pygame.init()
def game():
os.environ['SDL_VIDEO_CENTERE... | stackexchange/codereview |
I've been working on a C project where I needed a small, thread-safe shared pointer, and so I wrote this implementation.
It's primary use in the project is as a way of allowing multiple threads to have ownership of a resource at once. This means it's very important that it is thread safe (and also doesn't leak, obvious... | stackexchange/codereview |
its a practice project from "Automate the Boring stuff with Python" book. i am an intermediate level Python programmer and i tried to solve this problem with less code as possible. This code will not take any wrong date into consideration eg: 29-02-2002 will not be selected because 2002 is not a leap year and only leap... | stackexchange/codereview |
I've decided to go with OOP style and prepared statements, and so far I like it a lot more than the procedural style. It's much more understandable in my opinion.
For this code review, I've just included my PHP code that interacts with my MySQL database. Everything is working how it should, but I'd like to know if you... | stackexchange/codereview |
I need to find cosine similarities between two lists of different sizes. I have this code but it is running for a long time. The first list has 40 000 words and the second list has 400 words. Is it possible to speed this up?
I have been trying different approaches instead of using vectorizer but none of the other appro... | stackexchange/codereview |
The intent of this SQL Server query is to:
Dynamically work rebuild/reorganize all indexes in all tables in all databases on a server.
Rebuild or reorganize depending on the specified fragmentation threshold values.
Attempt to perform an online rebuild. If an online rebuild can not be performed due to column types... | stackexchange/codereview |
I have a file format that I need to read which contains blocks of CSV data interspersed by non-CSV (or at least, inconsistent CSV) lines. Other than the very first line of the file (which has comma-separated headers), each repeated "block" has one line containing some metadata - including the number of actual CSV line... | stackexchange/codereview |
I have an array vs.tags which may contain hundreds of objects, and a smaller array coloredTags which only contains up to 3 objects.
The goal is to efficiently check the ids in coloredTags to the ids in vs.tags and perform some action.
This is what I have so far:
var coloredTags = ColoredTagFactory.retrieveColoredTags()... | stackexchange/codereview |
I tried writing alternative functions to Java's BigInteger.add(BigInteger.ONE), BigInteger.add(BigInteger), and BigInteger.subtract(BigInteger):
public static BigInteger increment(BigInteger x)
{
int i=0;
while(x.testBit(i))
x=x.clearBit(i++);
x=x.setBit(i);
return x;
}
public static BigInteger add(BigI... | stackexchange/codereview |
I am currently programming a game in java, and I recently implemented a centralized event dispatcher system in order to decrease coupling between different parts of my game.
My system consists of three classes : GameEventDispatcher, which contains the actual dispatching functionality, GameEventListener, a simple listen... | stackexchange/codereview |
I have a simple form validation script. Could you tell me how I can improve this script (mainly regarding security)?
HTML page
<form name="input_form" action="process_form.php" method="post">
<p>
<label for="name">Name</label>
<input type="text" name="name" id="name" maxlength="25" />
</p>
<p>
... | stackexchange/codereview |
I created a linked server in SSMS so that I could run reports on a SpiceWorks SQLite database. there are a few quirks in the whole system.
These simple queries are becoming some of the most expensive queries on my reporting SQL Server, I kind of know why, is there a way that I can do this differently?
The Code
I have... | stackexchange/codereview |
public partial class CreateAdmin : System.Web.UI.Page
{
#region Events.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadOrganizations();
}
}
// Save Admin and Organization Admin in db.
... | stackexchange/codereview |
I've started a little challenge on a website, and the first one was about counting different DNA letters. I've done it, but I found my method very brutal. I have a little experience, and I know that hard-coded information is not good. Any way to improve this code?
chaine = "AAAACCCGGT"
nA = 0
nT = 0
nG = 0
nC = 0
for... | stackexchange/codereview |
My first Firefox add-on (WebExtensions compatible, so it works without modification in at least Chromium) puts a red border around insecure links, including plain HTTP links and links with a JavaScript event handler. The code is linted and appears to have good unit and acceptance test coverage. I'm mostly worried about... | stackexchange/codereview |
#include <stdio.h>
#define MAXLINE 1000 /* Maximum length of a line */
#define TABSTOP 4 /* Length of tabstop */
int getLine(char line[], int limit);
int lookAhead(char line[], int start, int end);
/*
* Exercise 1-21
* Write a program entab that replaces strings of blanks
* by the minimum... | stackexchange/codereview |
I am trying to implement lock by which I want to avoid reads from happening whenever I am doing a write on my three maps.
Requirements:
Reads block until all three maps have been set for the first time.
Now second time, If I am updating the maps, I can still return all the three old maps value(before the updates are d... | stackexchange/codereview |
I'm just learning JavaScript and jQuery, and I've got some code that works, but I know it can be optimized. I have a page that when a button is clicked it adds 1 to a label, and then increments a bootstrap progress bar by 1. I have 6 functions that could probably be reduced to 2 by passing in arguments instead of havi... | stackexchange/codereview |
I am writing a Tetris game while learning Haskell and I'm trying to make the following code more concise and easier to read. How can I improve it?
Note that the function is not finished yet (There is no check for complete lines, for instance); I currently want to improve its readability.
updateGame :: IORef InputsData ... | stackexchange/codereview |
I'm new to RXJS and I have a working piece of code for http-request and subscribing to Observables from a shared service in Angular. This works, but I'd want to get rid of the nested subscriptions, which I know is probably very possible with RXJS operators, but I haven't figured out how. The usage of flatMap in the nes... | stackexchange/codereview |
I have implemented a simple FIFO that can optionally be used by either a single thread or way to pass data between threads. The class is templated with arguments for the types the queue will contain and also the number of elements in the queue (queue data is stored in an std::array). For single thread use, it is insta... | stackexchange/codereview |
As part of an academic project I wrote a code about dynamic programming that solves the "Three-machine proportionate flow shop problem with unequal machine".
In flow shop scheduling it is usually assumed that the processing
times of the operations belonging to the same job are unrelated. But
when a job corresponds to ... | stackexchange/codereview |
The task is to find the top two elements from the array without sorting. how can we achieve it? Can we use any DS to achieve this? Say tree? Please pour in your suggestions.
Between, iterative way of solving the problem is also one way. I have done that. Below is the code. I will also welcome if the below can be custom... | stackexchange/codereview |
Problem on Algorithm for same like 'stations'
Problem is to use weather data to run ARIMA model fit on each group of like named 'stations' with their associated precipitation data, then finally execute a 30 day forward forecast. Looking to process specific same named stations and then next process the next unique same ... | stackexchange/codereview |
MetaBrainz has an IRC channel called #metabrainz on which there's a bot called BrainzBot running. It provides utilities such as linking to JIRA issues or Github PRs automatically when they're mentioned. Recently, I came up with the idea of a "voting" plugin, which could keep track of community interest in a particular ... | stackexchange/codereview |
There is huge legacy class MyService in which several new business cases need to be implemented. Unfortunately we are not allowed to touch existing legacy code within _legacyMethod and need to build a new condition on top of it. However I'd like to have a new code covered with unit tests (using NUnit)
public class MySe... | stackexchange/codereview |
This is a cut-and-dried Fisher-Yates implementation. As not typically a JS developer, I've tried to incorporate as many best practices as I can. I would appreciate any input as to make it conform to more best practices and continue to be maintainable.
(function fisherYates () {
"use strict";
var shuffle = fun... | stackexchange/codereview |
This is a follow-up question for A Sub-string Extractor Implementation with Specific Keywords in Java. As AJNeufeld's answer mentioned, the test case getTargetString("Where the start is before here.", "start", "here"); will return "". I am going to fix this with the vocabulary word comparison technique in this version.... | stackexchange/codereview |
My recent post had some things to fix. I think this should be well structured and written for you.
How does this code look to you? If something needs to be changed please tell me.
// Gets all elements by ID's
function elem(id) {
return document.getElementById(id);
};
//
//Check box id"RadioGroup1_0" will be check... | stackexchange/codereview |
I am using libtelnet to design a telnet client by sending text commands to a telnet server and receiving text responses. I am utilizing telnet-client.c. For simplicity, I made send and receive functions. The complete code is shown below:
#include <arpa/inet.h>
#include <ctype.h>
#include <errno.h>
#include <netdb.h>
#i... | stackexchange/codereview |
I'm in the process of a complete re-write of a stagnant and ill-conceived project. I would like some feedback on the following Python 2.7-3.4 code, before I go any deeper into it.
I would hope it is self-explanatory, but that is always the illusion when you stare at something long enough. The other dilemma is glossing ... | stackexchange/codereview |
I'm "playing" with ARM assembly on a Raspberry Pi, reading various tutorials and posts to help - no, it's not a college assignment, I'm too old for college! I'm pleased with getting the following code to take a decimal value (between 0 and 255) and output the binary string equivalent to the screen using scanf() and pri... | stackexchange/codereview |
I have written the following routines to convolve two images in the frequency domain which are represented as 2d Complex arrays.
How can I optimize my routines for better performance?
public static class Convolution
{
public static Complex[,] Convolve(Complex[,] image, Complex[,] mask)
{
Complex[,] ... | stackexchange/codereview |
The problem I am referring to is here
So basically it's about shifting an array of ints 1 position to the left and relocating the lost first int in the start of the array to the last position at the right:
\$\mathrm{shiftLeft}(\{6, 2, 5, 3\}) → \{2, 5, 3, 6\}\$
\$\mathrm{shiftLeft}(\{1, 2\}) → \{2, 1\}\$
\$\mathrm{sh... | stackexchange/codereview |
This question is a follow-up question of this one.
I've learnt a bit more Python since then. I recently came back to making battleships again, and I think I did better.
These are the changes I've made:
Completely rewritten.
Multiple battleships.
Removed difficulty settings (as the way I was doing it before would... | stackexchange/codereview |
You probably know the following problem: You have written a small program that runs in your console and want the user to enter something. of course, it is very inconvenient when the user types the wrong things, so we have to prepare for any small child hacking like a madman on the keyboard.
Most functions wait for a va... | stackexchange/codereview |
I've started learning java. I've written a small program I've done in C before. It's simple input analysis. If there is
number, program checks if number is prime. Then write number: (value of input variable) (prime) for example
date in format DD/MM/YYYY, if does program will print date: DD/MM/YYYY Day (Day represents... | stackexchange/codereview |
I've always been used to write my own CSS but I decided to give a go to twitter-bootstrap and I want to make sure I'm not using more HTML containers that I need to:
This is my code for a single element of a list:
<div class="row form-group">
<div class="col-md-4">
<input type="email" class="form-control" placeho... | stackexchange/codereview |
I have just started learning coding and am trying to clean up a website that I am making. Everything is functional, but I imagine there is a better way write everything that is there, because a good chunk of it is repeated each time (the part with mouseover and mouseout) Is there a way to create a command like mouseove... | stackexchange/codereview |
I am working with a some small functions to test recursion. I am fairly new to Python and am wondering if there is a cleaner way to get the job done.
def count(t,p):
''' recursive function when passed a binary tree (it doesn’t matter if it is a
binary search tree) and a predicate as arguments; it returns a co... | stackexchange/codereview |
This is the code from my answer to a another CR question. My goal was to provide a fast and simple computation and I'm rather unsatisfied with it. It's maybe 10 times faster than the original, but this may be still too slow for bigger displays and/or weaker devices.
I'm mostly interested in performance improvements, i... | stackexchange/codereview |
Is there more efficient way remove duplicate records?
strsql := 'delete from ' || TableName || ' a
where rowid <
(
select max(rowid) from ' || TableName || ' b
where a.val=b.val
)';
| stackexchange/codereview |
I recently had to code an algorithm that will, for an input of: matrix of up to 5x5 size and a defined path length, find a path of this given length from the first top left matrix element (0, 0) to the last bottom right element (n, n). The desired path is the one which maximizes the sum of matrix elements along the pat... | stackexchange/codereview |
I made this game called Jumpol, about you trying to jump over as many obstacles and collect as many coins as possible. The coins can be used to change your ball and revive yourself so you get another shot on the track.
I've released this game on the iOS and Android apps stores and some users are reporting that the jump... | stackexchange/codereview |
Code for grammar
grammar EpicLang;
Break : 'break';
Do : 'do';
Continue : 'continue';
Else : 'else';
Func : 'func';
For : 'for';
If : 'if';
Then : 'then';
Len : 'len';
NoneObj : 'none';
Print : 'print';
Return : 'return';
While : 'while';
TrueLiteral : 'true';
FalseLiteral : 'false';
// Lexer rules
LINE_COMMENT
... | stackexchange/codereview |
I've been writing some smaller jQuery plugins lately, and I've been thinking of writing up some boilerplate that I can use when writing new ones. I have code that works (for now), but I want to share it and get feedback on things I may be missing as I move to larger plugins.
/**
* jQuery Plugin Boilerplate
* - find a... | stackexchange/codereview |
I came up with a suitable solution to a HackerRank problem that failed because the execution took longer than 10 seconds on lists that were of very large size.
The problem: Given a list arr and an integer d, find all combinations of length 3 whose sum is divisible by d
My solution:
[
sum(p) % d
for p in combina... | stackexchange/codereview |
I am using this code to display the recent post from my subdomain to my main domain. I got it after spending 6-7 hours. Now I need to show the avatar image and username of the user of has posted the questions on questions.admissiontimes.com. Right now, it's coming in green and black.
function print_requested_template_p... | stackexchange/codereview |
Some recursive code is part of a particularly slow path of a project. Out of curiosity I was playing around with reimplementing the code using stack context iteration instead of recursion. Below are snippets reduced to just the iteration patterns of tree elements using a DOM structure for simplicity.
I was surprised w... | stackexchange/codereview |
I have previously asked here for a review of my Pong game. Since then I have implemented most of the recommendations but I'm not sure I did so correctly, the result can be found on my github.
Would it be possible to get another review? Below is the whole source code of the game:
main.cpp
/*
* Pong game
* Author: Ch... | stackexchange/codereview |
This is a plugin for hangoutsbot/hangoutsbot that listens for words people say and then gives them an ETA and a link with directions.
Happy to hear about any optimisations that could be made.
import logging
import hangups
import plugins
import asyncio
import googlemaps
logger = logging.getLogger(__name__)
from textb... | stackexchange/codereview |
Sometimes I end up with a function that requires checking multiple conditions to determine the outcome and the logic can get to be too much to handle on a single line. Here's an example of how I currently handle this:
function validateType($type,$data) {
if ( (isset($this->validationRules[$type]['requiredThing'])... | stackexchange/codereview |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.