« first day (2772 days earlier)      last day (44 days later) » 

12:00 AM
RELOAD! There are 7159 unanswered questions (89.7092% answered)
@RMunroe subtle
5 hours later…
5:16 AM
Q: FizzBuzz game, open to any critiques

SocoI made this FizzBuzz game for my college class and it's kind of ridiculous, but is suppose to demonstrate chain of command so writing it in a little forloop was out of the question. In case you don't know the game, this program counts numbers 1-100 printing them to the console but replace any mul...

6:06 AM
Q: Memory management in my code

Vedant MatanheliaI am a beginner programmer and have made a tic tac toe program in c++. I need some help with my memory management can anyone review and help me. This is my code // This is a trial for tic tac toe in C++ #include <iostream> using namespace std; char *squares = new char[9]{'1', '2', '3', '4', '5',...

3 hours later…
8:38 AM
Q: JavaScript video player

sebinohooI've produced some JavaScript code for a Video Player, but my experience in coding is with C# and the differences between the languages and my lack of experience has made me wonder I'm not following the correct guidelines. I'm just wondering if anyone doing a once-over would have any good critici...

8:58 AM
Welcome to stack overflow. Here we can help you with your coding issues. However, we're not a software design forum. There are other sites in the stack exchange network, for instance for code review, computer science, software engineering and mathematics. Plus there are many forums on the internet, as well as resources discussing the problem you describe. — JHBonarius 54 secs ago
9:28 AM
Q: Thread-safe LRU Cache Implementation in Java

yplooI am trying to implement a thread-safe LRU cache algorithm, please review my code and would really appreciate some criticism or suggestion. Some assumptions: capacity will be larger than 0 Some questions I have: I know it is better to encapsulate variables in a class and declare them private, ...

Q: PowerShell - Sort strings containing numbers numerically

Xeнεi ΞэnвϵςI am a newbie in programming, but I do have potential, I am using PowerShell to hone my skills, I have written a simple function to sort strings consisted of numbers humanly (i.e. in a order like 1 2 10 25 32 123), using the basic concept of padding, I would like to see it be expanded so that it ...

10:19 AM
Q: C: matrix has n random inaccessible

Harpreet Singhproblem : matrix has n random inaccessible cells and for each inaccessible cell, the eight adjacent cells cannot be inaccessible Question : how can i improve my solution ? example : n = next inaccessible cell cannot be placed there x = inaccessible cell 1 |0|0|0|0| |0|n|n|n| |0|n|x|n| |0|n|n|n...

11:10 AM
Working solutions that need refactoring might be a better fit for the Code Review Stack Exchange site. — El_Vanja 40 secs ago
1 hour later…
12:25 PM
Q: Wrapper library for Spotify Web API

Jiankai ZhengI've been building a Java library the past 3 weeks that makes it very easy to fetch data from the Spotify Web API. The library is build using Retrofit. I don't know if I'm allowed to link to the GitHub repository but here it is: repository Here is an example of how to use the library: Getting an ...

@SᴀᴍOnᴇᴌᴀ Why don't people double-check their crap before posting it...
Just leave it be as-is now.
We have a meta stating that technically the answer shouldn't have been posted, but I'm not sure that's enforceable now.
Also, it really shouldn't be on HNQ.
That's to blame on everyone upvoting a broken question I guess.
12:53 PM
Code reviews are not on-topic here, there is a whole site dedicated to that topic: codereview.stackexchange.comDr. Snoopy 19 secs ago
1:41 PM
Q: array 2d using function and pointer

ryani try to make code but it' error in calling function array2d and is there mistake in my code? this my code : #include<stdio.h> #define size 100 int array2d(int *x){ int i,j; for(i=0;i<x;i++){ for(j=0;j<x;j++){ printf("%d ", *x); *x++; }...

Q: Return n largest nonzero entries of an array

MaxFor something I'm working on, I need a function that takes in a one-dimensional array vec of integers and returns a boolean array of the same shape indicating where the n largest entries of vec are located. For example, nlargest([0, 1, 3, 5], 2) should yield [0, 0, 1, 1]. nlargest([0, 0, 4, 0, 3...

1:56 PM
2:26 PM
I’m voting to close this question because it should be posted at codereview.stackexchange.comDr. Snoopy 57 secs ago
this question is better suited at codereview.stackexchange.comppwater 52 secs ago
Q: Using a character vector component as an argument to an R function

Antonio PiemonteseIn order to find the best distribution fit to a dataset, I need to pass a component from a character vector of possible distributions (intentionally short-sized in this example) to the ks.test() R function as an argument. So, my problem relates to Statistics and, much more generally, to R program...

2:55 PM
@taco I don't know if I fully agree with all of that comment. Ccarver, be very careful to ONLY post working code on CodeReview. — mickmackusa 24 secs ago
3:22 PM
Q: Inverted Index : Slow processing

zzz247For a project at school, I need an inverted index in Python (I'm a beginner). There is one specific function that I've done that works, but my tutor told me he would not give it any points as the function is very long to process and inefficient. Here is the code : def build_inverted_index(article...

codereview.stackexchange.com seems more appropriated. — Jarod42 49 secs ago
1 hour later…
4:40 PM
Q: Prime numbers that are also a prime numbers when reversed

A Honey BustardThis is a challenge on Codewars I took years ago. Task is to find all prime numbers that are also a prime number when reversed, i.e. 13 -> 31 is such a number. This is still the answer with the most upvotes in the categories 'Best practice' as well as in 'Clever'. Know looking at this answer year...

5:30 PM
Q: Java application for identifying the misspelled words

HanadiIn this project, your team will develop a Java application for identifying the misspelled words in a given input text file. The input to the program is a text file containing normal English text. The output must be another text file containing a list of all misspelled words. For each misspelled w...

5:56 PM
Q: Use try catch witout reapating myself in lararavel

Jorge Eduardo Tirado SandovalAlways is program a new controller I use try/catch block code but I start to think if this is a good practice: public function show($id) { try { return $this->userService->get($id); } catch (\Exception $e) { return response()->json($e->getMessage(), 400); } } Th...

Q: Complex nested object with an array of objects

JeffersonI have a complex nested object with an array of objects coming from an API. But the grid tool best works with flattened data. So I came up with this logic that will build the correct object for the grid tool. To achieve this, it heavily relies on foreach loops and adding object to list object. Pl...

6:17 PM
Welcome to Stack Overflow. Please take the tour and read about what's on-topic in the help center. We're not here to do code review, but you might have better luck on our sister Code Review site. Pleaes make sure to read their "How to Ask" page to make sure you are following the guidelines when you post there. — Chris 53 secs ago
Q: A calculator in C without #include

ArianI made a calculator in C without #include. Now, I want to make my code shorter and better. But I don't know how. Here is my code: int printf(const char *format, ...); extern int scanf(const char *format, ...); double pow(double x, double y); int main() { do { double num1; ...

1 hour later…
7:38 PM
Q: First two consecutive primes a fixed distance apart in a given range

niamulbengaliThe Challenge The challenge is to find the first pair of consecutive primes given three parameters: Gap: the distance between the primes Start: the inclusive starting point of the search End: the exclusive end of the search The Code This is the main function gap(interval, start, end), which nee...

8:03 PM
Q: Plotting using Matprolib

JoshJohnsonProgram description: You are given a set of two functions: $$f=x^3-6x^2+x+5; g=(x-2)^2-6$$ Plot them using Matprolib. My solution: import matplotlib.pyplot as plt import numpy as np from scipy.interpolate import interpolate # for smoothing def func(x): return [pow(x, 3) - 6 * pow(x, 2) + x...

Q: Stack Implementation in Scala

Ankush SinghI would like to get feedback on my code for Stack implementation written in scala. What can be improved to make it more like scala code. What important helper functions am i missing? class StackDS[A] { private var list: List[A] = List[A]() def push(ele: A) = list = ele :: list def po...

For working code optimisations, you should post on codereview.stackexchange.comLawrence Cherone 15 secs ago
8:29 PM
Q: Faster way to intersect arrays

SamulI need to intersect lots of array with each other. Those arrays are like: $a = array(4 => true, 10 => true, 18 => true...); $b = array(6 => true, 10 => true, 73 => true...); $c = array(106 => true, 293 => true, 297 => true...); In PHP there is a function array_intersect_key, which intersect keys...

8:49 PM
Welcome to Stack Overflow. Please read about what's on-topic in the help center. We aren't here do to code review, but you might have better luck on our sister Code Review site. Please make sure to read their "How to Ask" page before posting there. At minimum, you'll have to be clearer about how / why you want to refactor this. What is your goal? — Chris 1 min ago
9:20 PM
Q: code for Tic Tac Toe game does not work

aurumpurumMy code for Tic Tac Toe does not work. When I can start the game and I choose the fields, 9, 7, 5, 2 (in that order), the program crashes with the following error message when I want to execute move 2: Traceback (most recent call last): File "/Users/Andrea_5K/Library/Mobile Documents/com~apple~Cl...

1 hour later…
10:38 PM
Perhaps better to ask this on codereview.stackexchange.commatt 43 secs ago
10:50 PM
StackOverflow isn't intended for performing a general code review. It's a site for solving concrete problems, bugs and undesired outcome. For code review please post on CodeReviewStackExchangebloody 21 secs ago
11:03 PM
Q: What is a better way of finding the index a year fits into an array of years in Swift 5

ICT1901I have the code below which works, but I'm sure it's not Swifty. Can someone suggest a better method? Thanks import UIKit class ViewController: UIViewController { let testYearsArray: [Int] = [1950, 1955, 1960, 1965, 1970, 1975, 1980] override func viewDidLoad() { super....

11:28 PM
Q: Calculating the Checkdigit of an ID-Card-Number (german ID-Card) / assembly nasm 32bit

Etti _im pretty new to coding and I have to do the following: Write a program that wants you to input your ID-Card-Number (It's a 9 digit long Number, it can contain either Letters from A to Z or Numbers from 0 to 9) (Its based on ascii and apparently A=10, B=11 etc.) the positions of the input are wei...

11:54 PM
Q: Need Insight to Learn Better Coding Practices (C++ Beginner)

schmobbingI'm very new to C++ and am trying to code simple programs to test my knowledge on the very basics of this language. Yesterday, I created a very simple calculator script which allows you to add, subtract, multiply, and divide and set of two numbers. While it is still very basic (e.g. only calculat...


« first day (2772 days earlier)      last day (44 days later) »