RELOAD! There are 3759 unanswered questions (91.3537% answered)
I'm voting to close this question as off-topic because it belongs on another Stack Exchange site: codereview.stackexchange.com — Daniel Storm54 secs ago
Codecademy's final Python project is to build a Markov chain text generator--with someone else's module. I wanted to build my own; although I understand the concept I'm having trouble implementing it in Python. I followed a YouTube video, Poetry in Python: Markov Chains, which has an amazing simp...
So I have two sliders that I can select using my keyboard. The black bar shows what currently is selected. It looks for current_position_in_option_buttons and positions itself as needed. When selected on either the sound or music option you can use the left and right arrows to change the settin...
If it seems to be working and you are wondering if it is good/ bad practice, code review would be the better place for this question. — Evan Carslake9 secs ago
Code is actually broken, and as such is not a good candidate for Code Review. It'll break if trying to remove an element not found in the list. — holroy58 secs ago
I'm trying to understand that how a simple neural network works. The program below (that I wrote to test my understanding) aims to train a network that will eventually be able to distinguish whether given elements of input are bigger than 0.5 or not.
Its input size is 4 and output size is 2. It ...
So, I have decided to make a little "guessing game" where the user tries to decode what the encoded piece of text prompted. I'm sure it works. However, I know that there are places where I can improve. I am open to any constructive criticism about this. This program was done in HTML + JavaScript....
I am trying to create a Neural Network class with backpropagation so I can learn about how it works. I am following this tutorial about how to do this in Python, but trying to make it work in java with any size
When trying to train the NN, it hovers around 0.5. It goes up and down but not in a d...
The following code seems to work ok to remove a node from a linked list:
bool remove(node * & head, int toBeRemoved)
{
if (head == nullptr) //empty list
return false;
else {
node * temp = head;
//the first node needs to be removed
if (head->data == toBeRemo...
Even though there is answer below I'd recommend going to code review anyway. Indentation aside it would be much cleaner with single if and for loop. It would be easier to spot errors as well. — Maciej Piechotka14 secs ago
I have looked into this code lots of times now. I can't figure it out. I was practicing this at home when this error popped up. The program when shown to us in class, ran perfectly. Please Help. Below is both the code and the error. Thanks.
import java.io.*;
import java.sql.*;
class DBTest {
s...
Hi, could you give a little more detail on what you are trying to accomplish. What's exactly wrong with your code? If it's are review you are seeking maybe you should seek help at codereview — Remy J29 secs ago
I was curious which U.S. president had the lowest approval rating for each day in their presidency. For example, which president had the lowest approval rating on day 42, and what was the rating. I downloaded the data from http://www.presidency.ucsb.edu/data/popularity.php and built this code to ...
I have a URL but unable to get the codes to get the distance between two places and show it in textview on the activity. I am novice in android and unable to link the textview to show the distance. Please help me.
This belongs on code review. But for starters, you could use Counter object. Also, don't call .keys() to iterate over dictionary keys, e.g. for mechanics in count.keys():, iterating over a dictionary already does that: for mechanics in count: — juanpa.arrivillaga43 secs ago
I have inserted the Spring Method isHtml on my project's utility class, and then I included a check for each resultSet that comes out from the database.
In my controller class, I added a try catch each time a call is made to the persistence layer in order to handle the exception.
My question no...
There are n circular organisms with radii r0,r1,..rn-1 . During each second, two organisms with radii ri and rj and (chosen randomly and equiprobably) collide to form a new, bigger organism with radius ri+rj.
Given the radii for n creatures and an integer,k, print a single floating-point numbe...
I have a 3D data set made of a certain number of points (x,y,z) that cover a certain region of space. Using the scatteredInterpolant object I can interpolate this data set over a grid to produce a rectangular mesh. Note that the mesh may extend to regions that are not defined by the data set; in ...
I have no idea why this piece of code doesn't work as I expect. For any kind of number I input I'm getting the else part of the case-statement. On the other hand it works like magic when the same statement is a method that I call with an argument. I'm learning Ruby as my first programming languag...
I don't think there is, but I haven't been here that long and am mostly learning myself. Can't say I have seen anything above 200 lines of code on the site so far
I saw a post a few weeks ago regarding a Python solution to the Mars Rover problem as outlined HERE.
Basically we are tasked with developing a software to handle a squad of Mars Rovers based on user input:
First input is the size of a Mars plateu.
After Mars surface has been set the user is pr...
The following JS code to bypass Cloudflare, I found it in the net. Please explain how the performance of this code?
<script type="text/javascript">
//<![CDATA[
(function(){
var a = function() {try{return !!window.addEventListener} catch(e) {return !1} },
b = function(b, c) {a() ? do...
Ah! Another room where it seems more appropriate to ask! Thanks, last couple of times I tried I immediately found somebody that was willing to answer, which helped with the particular problem, but not necessarily with the fact that I'm a beginner with not enough places to ask for help ^^' (If only it was easier to gain points in stackoverflow v.v), shall ask there
At least in the past, when there was more people around here, and someone asked a question on some topic, and got redirected to that room if there was other talk going on. And if someone in this room felt like it was something they could contribute with, they jumped over for a while.
This helped keeping this room free for discussing directly Code Review related issues, and not becoming a support desk for coders. :-)
@SatwikPasani @Isofruit There is a limit, it's not posted and unless your code runs over 1000 lines you won't approach it. The probability that someone has the time to review over 200 lines of code is rather small. If you have a lot of code, you can post the part you really want reviewed in the question and have a link to a github repository or other online location for the rest.
I would like to implement a higher level design pattern here but I am a bit stumped, how can I improve this code and make it cleaner?
import __builtin__
import logging
import requests
import json
import datetime
from string import Template
from resource_helpers.abort_logger import AbortLogger
C...
I have completed a simple java program. Here everything is doing fine except
for one silly logical mistake which I couldn't figure out.
When the user enter 0 as account number it should
1) Display "No account has been processed." Only
I have attached the code and details of the program.
Any...
This was the assignment:
Here’s a self check that really covers everything so far. You may have
heard of the infinite monkey theorem? The theorem states that a monkey
hitting keys at random on a typewriter keyboard for an infinite amount
of time will almost surely type a given text, suc...
One of the first Haskell puzzles on http://exersicm.io/ is to implement a leap year check. I've done this twice.
Using pattern matching:
isLeapYear :: Integer -> Bool
isLeapYear year
| year `mod` 400 == 0 = True
| year `mod` 100 == 0 = False
| year `mod` 4 == 0 = True
| otherwise ...
I asked a similar question (C++ linked list) but I'd like to have this similar code reviewed. It's not the same code, just slightly different and with bugs fixed.
The code takes the head pointer of a singly linked list and an int element to find and remove from the list:
void removeFromList(node*
Look I will remove it from code reviewer. Just as soon as someone gives me some input. I will work on using these platforms correctly however I want help not criticism. Hobby not my job settle down. — John Shiveley55 secs ago
I am using a QSqlRelationalTableModel model_contacts to populate a view that shows all necessary data from the contacts of the user.
Today, I need to add a QPushButton that generates a list of all contacts that do not have an emailaddress.
I try to applicate the Model-View approach as much as p...
I have build class to pass ordering arguments and (key value) arguments.
instance of class return all arguments pass to __ init __ as attributs
class Person(object):
""" Init Person with ordering values or keys values"""
_attrs = ["name", "firstname", "email", "address"]
_ops_attrs ...
For a personal project, I need to parse YAML file. I chose to use C-based libYAML instead of yaml-cpp, because:
I try to keep my dependencies to what's commonly installed and Debian statistics show 45% installs already have libYAML, vs 0.5% for yaml-cpp.
I don't need variant node types, as the ...
I am currently working on my own little game engine and thought about implementing a simplified version of Unitys component system where you can attach objects of derived Components to an GameObject. Later you can request specific Components to use their functionality. Below is a stripped down (b...
I have started to create a console app, which I am testing locally on my mac.
The idea is to generate an ssh key and structure the storage of these keys within the .ssh folder. My thought behind this is for my digital ocean ssh keys, and so I am using a folder structure dictated by the droplet n...
I work for a service desk in a Windows 7 environment. Recently we have had an issue where (do to an update) when users are attempting to map printers to themselves they are not able to open the devices and printers tray, it just loads endlessly. I've figured out a solution for this via the follow...
This is the algorithm that I'm trying to solve:
There are n circular organisms with radii r0,r1,..rn-1 . During each second, two organisms with radii ri and rj and (chosen randomly and equiprobably) collide to form a new, bigger organism with radius ri+rj. enter image description here
Given the...
Write a function called longest which will take a string of space-separated words and will return the longest one.
my code
function longest(str) {
var words = arguments.split(" ");
var words_count = words.length;
var longest_word_length = 0;
for(var i = 0; i < words_count; i++){
if(...
Hi I am trying to know if there is a better way to handle reversals for this function, currently how it works is this:
A user inputs in amount, bank, and account number this would be used to debit his virtual wallet like so:
models.sequelize.transaction(function(t){
Q.fcall(function(){
...
I just started learning about functional programming, and thought I would have a look at writing a simple object comparer as the basis for my implementation. Below is my result.
My assumption (in writing) is that functional code is intended to not modify external state, and not have side effects...
For a project I have one of the requirements is to generate cryptographically-secure random numbers from 0 through 9 (so 10 total possibilities). It's a .NET project so my first thought is to use the RNGCryptoServiceProvider class provided by the framework, the only problem is that the class does...
At the outset, I am a beginner at python, having started out about 2 weeks back.
Aim- To create a GUI program, that can adequately work as a buzzer-management system. A buzzer, like those used in quizzes, should display who pressed the switch first, and also, who is currently pressing their swi...
My current algorithm has no predictable bias right now.
Over three runs it has shown a very slight bias against 6 and 8 when generating 1 million digits.
And the fourth run eliminated that.
Though it still has a very slight bias towards 4.
And the fifth run eliminated that as well.
And by very slight I mean that the values are at worst 9.95% of the generated numbers, and at best 10.05%. So out of 1 million numbers I'm generating a uniform distribution in [0, 9] within 0.05%.
As long as the bias keeps shifting (which it is) then there's no real bias there.
1) You might want to check out Code Review 2) You could always utilize short circuiting. var scrollPage = checkSex || checkWeight || .... After one of them returns true, the following ones won't execute. — Mike C9 secs ago
@Ðаn: If you wanted to be super cheeky and obscure, you could hex_encode your string (up to 4 chars), and then pass it to a templated decode function. It would be standard compliant, but hopefully be laughed out of any code review: demo — AndyG17 secs ago
So I am making a checkers for my intro to c++ final project. I design a the project to have three classes Champ, Board, and Game. The Game class declares three objects. Now the every time a try to run this declare a game object in main just to make sure everything is in place, I get an error sayi...
Me and my friend are trying to build a connect4 game with a twist.
The twist requires us to have a 7*7 board and to be always able to check all possibilites for a win for both players after each move.
Currently, we are just filling the board with a random distribution of 0,1 and 2 (in the final ...
I made a small app to download wikipedia articles (and optionally those that it links to) as PDFs to take on the go. I'd eventually like to do a text-to-speech option and save the article as an mp3, though that's the next step. Any thoughts would be helpful.
import wikipedia
import pdfkit
impo...
I have created a "wrapper" for a button that "pulses" until the user presses the button. The implementation that I came up with is below, but I'm sure there's a better approach.
<UserControl x:Class="Foundation.Common.Controls.Wpf.FoundationGlowButtonWrapper"
xmlns="http://schemas.mi...
Write a function called longest which will take a string of space-separated words and will return the longest one.
my code
function longest() {
var words = arguments.split(" ");
var words_count = words.length;
var longest_word_length = 0;
for(var i = 0; i < words_count; i++){
if(lon...
My Code fails after test case 4. Need help in improving solution.
Question:
Alice and Bob are playing the following game:
The game starts with a sequence of zeros and ones.
Alice and Bob take alternating turns, and Alice always moves first.
During each turn, a player removes one element from t...
I had hard time writing unit test for my really small example. Can you review it and explain if it violates SOLID principles?
public class Cell
{
public int X { get; set; }
public int Y { get; set; }
public string Value { get; set; }
}
public class Table
{
private Cell[,] Cells...
I saw you doing code reviews in different threads and was quietly hoping that you would do here as well. Very much appreciated! This looks so much better than the code I posted... — stiopa32 secs ago
'''
Write a python program that computes the take home pay of a commissioned
sales person. Prompt the user to input the employees's name, base salary
and gross sales for the pay period. Make sure to use the appropriate data types. When parsing the keyboard input, use exception handling to detect ...
Stack exchange has a code review site that might be a better fit for this question — Rufus L22 secs ago
Private members is the way you do encapsulation, what problem are you having with your code? If you're just looking for comments on the design, CodeReview.stackexchange.com is the appropriate place. — Barmar26 secs ago
Is this good style? I've never seen people format it like this, but I think it's really clean.
import numpy as np
letters = [chr(i) for i in range(65,65+26)]
numbers = ['ZERO',
'ONE',
'TWO',
'THREE',
'FOUR',
'FIVE',
'SIX',
...
I'm learning "Cuda C++" (and C++).
Can you guys give me some feedback on my "basic templated matrix" implementation?
A brief explanation of my decisions:
First things first: I can't use STL classes / functions in cuda code.
I can't use C++ 14 (or newer) features.
I'm using templates to give su...
Please edit your question to include the JSON and the code you are using now to deserialize it. Without being able so see what you're doing, all we can do is guess, which isn't going to be helpful to anyone. See How to Ask. If you're really asking for a code review, try asking at codereview.stackexchange.com — Brian Rogers15 secs ago
I'm voting to close this question as off-topic because it's more suited to CodeReview.stackexchange.com — Barmar16 secs ago
Once you have finished this warming up project, I suggest you take it to CodeReview so there's a big nice place for people to guide you on idioms and style :) — Quentin23 secs ago
Played with GitHub API yesterday, expect one-boxing for GitHub links of all varieties in the Stack Overflow chat sy… https://twitter.com/i/web/status/852881232845299712
I've been mentoring someone fresh out of training today (and will be for next 4 weeks) hadn't realized there was so much to know until now having to teach someone else
I'm new to javascript, and wrote this little animation in canvas. I'm wondering if anyone has any suggestions as for how to improve it.
Here's me code:
//render the canvas at 2x dpi
var canvas = document.getElementById('myCanvas');
canvas.width = 1920;
canvas.height = 816;
canvas.style.width = ...