« first day (2188 days earlier)      last day (1820 days later) » 

12:00 AM
RELOAD! There are 6012 unanswered questions (89.8615% answered)
12:19 AM
Q: opencl, running same kernel many times?

Jorge FernándezI am learning how to program in opencl and I made a simple program that simply takes an array and adds 1 to every element. I want to run it many times (this is just so that i can benchmark how it does against my cpu, I understand it is a dumb application). I feel like the way I am doing it right...

12:32 AM
I'm voting to close this question as off-topic because the code works but is asking for a better way to do it. ask on Code ReviewDaniel A. White 50 secs ago
Q: check if two string are isomorphic

ad fasanIm still a noob in algorithms and data structures and this my attempt to check if two string are isomprhic. My idea was to map the frequency of each character for both strings and store it in a set , then compare the 2 sets to see if they have equal values. I know my solutions is terrible and too...

1:02 AM
@Julian Yes, if speed is important, this won't be the fastest option. To be honest, this question might be best served in code review. codereview.stackexchange.comKeith 48 secs ago
1:17 AM
Q: RGB to YCbCr conversion in java

lucky1928I found a go language code to do RGB to YCbCr conversion from here! I convert it to java as following: private byte[] generateColorBar(int width,int height) { final int COL[][] = { { 255, 255, 255 }, // 100% White { 255, 255, 0 }, // Y...

Photo contest on the Great Outdoors.SE outdoors.meta.stackexchange.com/questions/1465/… should any wish to join
1:36 AM
Q: Rspec validation project

Alex HarveyI have created an open source project that uses Rspec to validate the formatting of AWS::CloudFormation::Init in CloudFormation templates. My project is here. Some general concerns: Is this a valid use-case for using Rspec? Is the documentation in the code okay? I have some specific concern...

2 hours later…
3:35 AM
Fix implemented by me works, but I fail to understand the logic behind it, - I hope you have code reviews of some sort. Fixes submitters force are generallly frowned upon. — Ted Lyngmo 12 secs ago
4:00 AM
Should probably be posted on codereview. — goodvibration 12 secs ago
4:16 AM
Q: How to handle state for a Twilio SMS chatbot which registers new users?

Haardik Haardik​ We are building an API, and we want the functionality that users are able to register over SMS through a Twilio bot we are building. Currently, we have a message_handler with function HandleMessage which Twilio calls upon receiving a message. Unfortunately, Twilio doesn't do any state manageme...

1 hour later…
5:22 AM
If your code works but you want to improve it, post on codereview — alec_a 52 secs ago
5:33 AM
Q: Take a list of ascii strings from a file and hash them using python threading

the_endianHow can I do this in a more performant way? I'm concerned that throwing the data in a queue like this is defeating the purpose of yield from the open() and also how about handling the shared reference to file handle? import hashlib import sys from threading import Thread import queue class Has...

5:53 AM
Q: Trip to two cities

Elijah CorleoneFind the most appealing route when you get an array A as input .A contains cities Appeal is calculated by the value of the first city plus values of the second city plus the the negation of the index numbers i.e [1,3,4] appeal of going to index 1 and 2 is (4+ 3 )+ (2-1) which equals 8 fu...

6:12 AM
Q: Why a variable affects on another variable in this Python example?

Benyamin JafariWhat is the reason for this output? Here is an example: list_ = [{'status': True}] print(list_) for dict_ in list_: dict_['status'] = False print(dict_) print(list_) Out: [{'status': True}] {'status': False} [{'status': False}] # Why list_ changed? I changed only the dict_! Why...

6:32 AM
Q: a Java class that implements a string tokenizer. –about 500 lines of code and with 15 seeded faults. How to remove those faults?

Randoma Java class that implements a string tokenizer. –about 500 lines of code and with 15 seeded faults Input: •Location of a file (i.e., input to the main() method) that contains the tokens to be classified •If a location is not given, the user is expected to type the tokens to be classified in...

3 hours later…
9:27 AM
Q: Program that deletes near duplicate directories and directories that have .ini like files

ManuelThe program needs to only keep directories that have at least 1 .osu (.ini like) file with certain restrictions in them. It also needs to delete duplicate .osu files. But since duplicate files are only in duplicate directories (never in the same directory), we can also just delete all but one dir...

10:08 AM
Is this code doing what you want? If no, please specify the problem. If yes, maybe this question should be migrated to Code Review StackExchange? — Cerberus 30 secs ago
10:35 AM
11:04 AM
Q: Use Scrapy to find duplicate images across pages

W2aI'm trying to use scrapy to find image URLs that are used more than once on a website across all pages. This is my spider: # -*- coding: utf-8 -*- from collections import defaultdict import scrapy from scrapy import signals from scrapy.linkextractors import LinkExtractor from scrapy.spiders im...

Q: TIC-TAC-TOE Player vs Computer

Akshay soniI have created a logical AI for tic-tac game , i want a review about how good or bad it is . Here the computer AI will defend all your attacks as well as try to attack whenever it gets a chance . Below is the code you can directly try running it . import java.util.Random; import java.util.S...

11:23 AM
Q: Calculating the seconds between 2 numbers in a specific place in a string

ManuelWe have a string text = "SOME OTHER TEXT WHITE SPACES AND NEW LINES [HitObjects] 109,192,7241,1,0,0:0:0:0: 256,192,7413,1,0,0:0:0:0: 475,192,75865,1,0,0:0:0:0: 329,192,86524,1,0,0:0:0:0: 182,192,256242,1,0,0:0:0:0: 256,192,306521,1,2,0:0:0:0: WHITE SPACES AND NEW LINES " The third number of...

11:43 AM
Q: Lastest version of my Blackjack game

Maria LauraThis is the latest version of my Blackjack game that uses a MySQL database to store user info. I did everything I was recommended in my previous post, added a ranking system and also fixed a bug where you could make infinite money. from random import shuffle import os import cymysql from getpass...

11:57 AM
I have run into one or two cases where a functional style macro was the best solution, but it is VERY rare. If you are using a macro, it's time for a code review. — Kyle A 27 secs ago
12:22 PM
Q: Parametrised Template Method

BetlistaI have implementation of Template Method design pattern in Java, something like public abstract class AbstractNotificationTemplateMethod<InputType, OutputType> { public void process() { String messageString = ... InputType input = retrieveInput(messageString); // ......

1:01 PM
Q: Simple assignment for classes, java

Conor OepkesI am in my first high school programming course so forgive me if this is such a simple thing, my teacher doesn't really teach very well and i mostly teach myself the syntax and etc. The assignment goes as follows Write a program that asks the user to input three integers and outputs a message ...

1:38 PM
Also, probably codereview.stackexchange.com is the right place to for this question. — Sofo Gial just now
2:19 PM
Q: Leetcode - product of array except self

Mosbius8 Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Example: Input: [1,2,3,4] Output: [24,12,8,6] Note: Please solve it without division and in O(n). Follow up: Could you sol...

This is a code review question. You'd probably get better results posting here: codereview.stackexchange.com. — Slothario just now
2:38 PM
Q: Token-based authentication in app

JamI have setup Web API according to Token Based Authentication using ASP.NET Web API 2, Owin, and Identity. I made the login flow without any reference to a tutorial. So I want some feedback on it. Please comment if I should include more code. Basically it sends username and password in a POST re...

Q: Algorithm for split string to fit size

mazenI got a long string, let's call it Story , I fetch this Story from a Database so i don't know how long it is. I want to display this story in view , But what if the Story is to long that doesn't fit in one view ? I don't want to adjusts the font size Because it may be a very long story and make...

2:55 PM
@adnanabdal I thought so. Although your question is indeed not really clear, it is perfectly clear for somebody who did code reviews in Sonar. For the future try to state the issue more clear. Can you please also up vote the answer so that others don't get the wrong idea? Thanks and good luck. — Mihai 54 secs ago
Q: Code for conditional structure in Java

JRRChecking the maximun of three numbers if (! ! !(num1 < num2)) { if (num1 > num3) { System.out.println("The number " + num1 + " is the greatest"); } else { System.out.println("The number " + num3 + " is the greatest"); } } else { System....

3:17 PM
Q: SHA256 FSharp wrapper code

JacksonI've created the following module to allow me to generate a SHA256 signature for a file. (In real life this is used to verify an image file hasn't been amended). The cut down code looks like this: open System.IO open System.Text open System.Security.Cryptography; // Get the SHA256 hash of a f...

Q: c longest string

RobotManI have several questions about the following code: #include <stdio.h> #include <string.h> #define MAX_INPUT 1000 void LongestWord(char sen[]); int main(void) { char input[MAX_INPUT]; LongestWord(fgets(input,MAX_INPUT,stdin)); return 0; } void LongestWord(char sen[]) { int i,curre...

3:28 PM
This might be a better fit for Code Review. — Barmar 55 secs ago
3:42 PM
Welcome to Stackoverflow! Please remember that SO is not a general help forum, and if you code that already works, and you want to improve it, SO is not the right place to ask. Have a look at codereview.stackexchange.com if you want help improving something that works, rather than asking about how to fix code that doesn't =) — Mike 'Pomax' Kamermans 44 secs ago
4:04 PM
Is your function not working as expected? If that is the case, can you please explain why? For example, some input for which the output is not what you expected. If the function is giving the right output, but you are not sure if this is the best way to implement it, maybe you can ask about it in Code Review SE. — jdehesa 45 secs ago
4:24 PM
4:55 PM
Q: Implementing AES algorithm in Java: is my code secure?

adot710Hi there I have implemented an AES algorithm in order to encrypt files within a GUI. I was wondering if my algorithm is secure. Could I change anything to improve it? Is my IV secure and is it producing different random numbers each time?? Am I transferring the salt successfully? I know that ...

5:14 PM
Q: Atbash cipher in Ruby

sPaGhEtTiCaSe(Here's a REPL if you want to test it online: https://repl.it/repls/RecentMonstrousOffice) I tried to implement the Atbash cipher in Ruby and this is my final code: # frozen_string_literal: true module Cryptorb # The Atbash cipher module Atbash module_function # Encrypts a string...

Q: Implement an api that finds the best person for a job

aluko17I need to create a post route that can add a candidate using JSON such as: { "id":"859895734736", "name": "john", "skills": ["node","javascript","python"] } 'use strict'; const express = require('express'); const app = express(); app.use(express.json()); // Your code starts here....

5:42 PM
the modulus returns you whole numbers, I don't think it has any significance, by the way it'll be better if you ask this question in Code review stack exchangeP.hunter 14 secs ago
@P.hunter this code would be too hypothetical on CR, and also not on-topic, since the OP doesn't fully understand what it is doing. See "Which Site?" and "Code Review or not?"Sᴀᴍ Onᴇᴌᴀ 55 secs ago
Q: Foobar Challenge: Lovely Lucky Lambs

Michael ChoiI've been able to reduce my solution to constant time. Is it possible to reduce this by any constant factor further? (Besides trivialities i.e. inserting constants, not lazy importing). Specifically, I'd like to speed up fastMinPayout if there is a way to do it without using log. ''' Lovely Luck...

possible answer invalidation by Seanny123 on question by Seanny123: codereview.stackexchange.com/posts/157903/revisions
6:23 PM
@Duga I left a comment
OP claims he will comply
6:52 PM
Q: Return all valid paren strings with a given length

Eric AuldHow can the average time of my recursive method be so inferior? The problem is Given a non-negative integer n, return all valid parentheses strings with n open parens and n close parens. My algorithm (represented by the MySolution class below) keeps a count of the open parentheses on th...

Q: How to find all place inside a polygon in a google map

A.M. Patel I need to find all place inside a polygon in a google map. I have added a code for drawing free handed polygon but don't know how to find all the places inside selected area like Restaurants, bars, Hospital etc.. <!DOCTYPE html> <html> <head> <title>Drawing Tools</title> <meta name="...

7:11 PM
Q: Android+Firebase testing using Mockito

CarltonI have a interactor/usecase class in my application. My application follows mvvm architecture with interactor/usecases responsible for logic (e.g: get data from api-service, store in local-database etc). Now I am trying to write unit tests for my interactor classes. Here is one on those classes...

Q: Leetcode - First Unique Character in a String

Mosbius8 Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: s = "leetcode" return 0. s = "loveleetcode", return 2. Note: You may assume the string contain only lowercase letters. My solution public class FirstUniqu...

7:25 PM
Q: Is there a better way to implement this string builder?

legoMyEgoI have a function that returns a string that indicates if an element is the same as another element(s). The logic is: function duplicates(duplicates, id = 1) { var duplicates = 'Item'; var count = 1; var length = duplicates.length; var _id = null; for (var i = 0; i < leng...

7:50 PM
Q: Smart way to shorten the current working directory in pure Bash

DelganI'm trying to create a shell prompt that displays the $PWD in a "smart" way. I want to display the top two directories rather than the full path. If $HOME is the parent (or parent of the parent) directory, I want to show it like ~. Assuming my $HOME is "/home/user", here are a few test cases wit...

@Mast oops I did it again but this time it was a mistake - I hit the wrong button... I shouldn't have been doing that during a meeting
@CharlieBrumbaugh what if nobody wants to join??
@SᴀᴍOnᴇᴌᴀ Nobody knows what would happen
I told my dev team lead that I wanted to be Nobody, so I could be perfect... so he started calling me Nobody
wow there are 23 users named nobody on CR SE
As they say its somebodies fault and nobody knows who
8:05 PM
eventually we started calling some our other team members accordingly: Everybody, Nobody, Anybody
I found there is also a homebody and a dogsbody
but we didn't really use those
busybody likely would have applied to all of us
interesting username: uh oh somebody needs a pupper
great avatar on that one
Q: How to handle copying and assigning of objects containing huge arrays/containers?

HerpDerpingtonI have a class for a certain type of object, that must never be copied, because it contains a pointer member that points to a huge array (or some other container) which may only fit into memory once. I would remove the copy constructor for the object or rewrite it so that it either copies the poi...

8:21 PM
I assumed his version worked, and he's just looking for a more elegant way to write it (although that now suggests that Code Review might be better). — Barmar 47 secs ago
Q: How can i print out an arraylist using a Superclass

Pex van NieuwburgI'm a first grader of a software engineering study and I have some trouble with a showcase I have to make. I give you a quick rundown of my project. I don't know if anyone is familiar with the game Clash Royal? Its a game based on getting higher in trophies and collecting cards. And each arena u...

8:39 PM
This is a perfect question for codereview.stackexchange.comC.Nivs 57 secs ago
@CaptainObvious No context.
Q: Flipping an Image

thadeuszlayThe task is taken from leetcode Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image. To flip an image horizontally means that each row of the image is reversed. For example, flipping [1, 1, 0] horizontally results in [0, 1,...

Q: Rails improvement in term of performance with multiple and condition block

Dinesh Sainidef validate_time_zone if time_zone.present? && org.present? && !org.country.states.map(&:time_zone).uniq.include?(time_zone) errors.add(:time_zone, :invalid) end end I have a user model with relations follows as User belongs to Org and Org belongs to Country and Country has some timezo...

9:08 PM
Q: Trouble understanding the following Pythonic code

neetresult = [0,0,0,2,5,0,2] result = result [ next((i for i, x in enumerate(result) if x != 0), len(result)): ] or [ 0 ] print(result) I know this will return the original array s.t it has no leading zeroes but i don't understand how the syntax here enables that.

9:28 PM
Q: Speed up function withPython

A.wI wrote a function that iterate over 3 parameters in purpose to spot out-of-stock data point to illustrate this i'll draw an example : suppose that the product 10 in store 2 for an offer named "super5" is following this trend day | qty 1 50 2 70 3 55 4 67 5 13 6 0 Of...

I don't understand, what isn't working? Asking for critiques should be done on Code Review, Stack Overflow is for code that doesn't work. — zero298 just now
10:07 PM
Q: Simplify loops with non-contiguous ranges

Zack EThis code is tested and works, but I am needing some guidance on simplifying these loops with non contiguous ranges. I was thinking an array might be better, but I havent had enough experience with Arrays to know where to start with one. Any guidance would be greatly appreciated. Dim r As Rang...

10:23 PM
@CaptainObvious @pacmaninbw et. al, does this post have enough context now?
11:00 PM
@SᴀᴍOnᴇᴌᴀ I'll wait on the others. It has more code, but it's still only snippets of code no full functions.
Q: SafeBlockPopulator to ensure neighboring chunks are generated before population

Michael Brandon MorrisBukkit/CraftBukkit/Spigot are Minecraft server extenders that allow for creating and using plugins. A particular type of plugin is a generator, which creates the game world. Generators operate chunk-by-chunk, where a chunk is a 16x16x256 area of blocks. First, the generator creates the terrain of...

11:48 PM
If the code works and you're looking for advice on how to write it better, Code Review is probably a more appropriate site. — Barmar 19 secs ago
@Duga mmm spaghetti

« first day (2188 days earlier)      last day (1820 days later) »