After having reviewed this question, I recalled that I haven't solved Project Euler's problem 54. So I did it, however, I fount out that implementing the exact rules is rather tricky.
So I implemented just the necessary part. It works, problem solved, so let's call my code working. However, ther...
So I'm in the process of creating a simple Contract Bridge in Java. I will be using JavaFX to create the GIU component of the program. For right now I am trying to tackle writing each of the classes needed to run the game.
If you're unfamiliar with bridge the short explanation is as follows: you ...
I am getting an error on the 'start' in the (start + finish) at the bottom. The only way to fix it is to add "int start = inputFn.nextInt();" below ' Scanner inputFn = new Scanner(System.in);' but that screws it all up. I was able to fix it before but I forgot how I did it. Please help.
publi...
so what is your question this is not a question as it stands now, it is blog post about writing a bridge game in Java with JavaFX. If you want a code review there is a site specifically for that codereview.stackexchange.com — Jarrod Roberson47 secs ago
I'm voting to close this question as off-topic because it is asking for a code review! — Jarrod Roberson34 secs ago
@JarrodRoberson - you should read the help-center for Code Review before recommending that as a site to post to (which you have been doing recently). Broken code (code that does not work) is not on topic there: *I'm having trouble writing the string values of the elements in the vectors. * — rolfl18 secs ago
is ’1’ if the box is checked and ’0’ if it isn’t. -> I don't like using number for true/false value. I've trouble remembering which is one is which and it's never the same thing when you change language/framework.
Well I have a lot of work to do! My project is not going that well so I need to do a lot of things and I've been taking a lot of responsabilities at work. I'm learning ruby and trying to do some interestings project.
I've re-started to do a bit more of moderation on Code Review (editing, closing, etc). There is a lot more activity on the site it's nice to see!
Hi. I have update my question and add code review section. Can you please check and review my code and guide me If I am wrong. I have create same way that you explained. Thanks :) — Manan10 secs ago
You should consider that alternative systems can also be acceptable design decisions.
Shells: 0 exit status is true, non-zero is false
The example of shells treating a 0 exit status as true has already been mentioned.
$ ( exit 0 ) && echo "0 is true" || echo "0 is false"
0 is true
$ ( exit 1 ) &&
This solves Sudoku by using backtracking. Accepts one grid where 0 represents a missing number. Here are some examples: http://norvig.com/easy50.txt
The program is quite slow. Input is stdin.
import Data.Char (isDigit)
import Data.List (intersperse, delete)
printGrid [] = []
printGrid x = (int...
Ok, so I have an SDL_Wrapper working almost perfectly : only problem remaining is that I don't get a log message that my unique_ptr (or shared_ptr) gets disposed at the end of my program. Maybe because the unique_ptr gets disposed when my console window is already closed ? Tell me if it doesn't ...
I'm voting to close this question as off-topic because it seems more appropriate for codereview.stackexchange.com or programmers.stackexchange.com — Peter Duniho8 secs ago
Thanks. I have posted this question in Code Review. Hope you are more interested in answering and not just closing questions. — elysefaulkner49 secs ago
In the spirit of April 2015 Community Challenge, I have created two Java-based calculators with the following codebase layout:
An interface Calculeightor for describing how values can be appended into a stream and then reduced to a single result given an operator.
An enum Operator to represent ...
Here is an algorithm which finds longest increasing up sequence.
However, I can't figure out what the tailIndices and prevIndices are doing
in the following C++ code.
This is taken from this link
http://www.geeksforgeeks.org/construction-of-longest-monotonically-increasing-subsequence-n-log-n/
...
In the spirit of April 2015 Community Challenge, I have created two Java-based calculators with the following codebase layout:
An interface Calculeightor for describing how values can be appended into a stream and then reduced to a single result given an operator.
An enum Operator to represent ...
If the 'main macro' was poorly written, it may involve code commands like Range("A1").Select which will throw your Worksheet_SelectionChange into conniptions. If you cannot rewrite the code to remove inefficient code like that, use Application.EnableEvents = False at the very beginning and Application.EnableEvents = True before the macro exits to ensure that everything gets turned back on. Consider Code Review for advise on improving the 'mainmacro'. Great site for improving inefficient (but working) code. — Jeeped10 secs ago
Firstly I am not a professional programmer and I am just learning C#, MVC and Web Development.
Much of what I describe here is self taught and comes from lots of googling and posts on Stack Overflow. I have adopted the approach outlined in Mike Brind's recent blog post
Can some of you with mor...
"""
Provides a way to caculate the area of an arbitrary
n-sided irregular polygon.
"""
import doctest
import math
def heron(a,b,c):
"""
Uses the heron formula to calculate the area
of the triangle where `a`,`b` and `c` are the side
lengths.
>>> heron(3, 4, 5)
6.0
>>>...
Here is my code:
def odd_numbers_from(n):
if n % 2 == 0:
n = n + 1
while True:
yield n
n = n + 2
def takeWhile(pred, lst):
for item in lst:
if pred(item):
yield item
else:
break
def takePrimes(iterator):
for n in...
I have this piece of code which I know can be improved greatly, but I simply don't know how. I've been googling for a little while, but truth to be told, I'm not really sure what I should be even looking for. Please help me make it more dynamic, make it cleaner!!! Any help is much appreciated.
p...
Ok, so I have an SDL_Wrapper which is working perfectly (it is not broken)! If anyone could suggest how I could improve performance, and how I could make my unique_ptr(s) dispose automatically, It would be great !
so far, I call my class like this :
CWindow window = std::make_unique<CWindowWrap>...
To my kind reviewers: Please note that I am not a professional programmer, but that I very much enjoy programming in the course of my research. As a result, no-one ever sees my code and I am very insecure about it. When I first found out about this site I was very excited as it seemed a perfect remedy for my lonely predicament. I have a strong desire to learn to be a good citizen of this community. If I err, as I no doubt will, please try tell me how I can improve as clearly as you can. I will listen. — milos2 hours ago
I'm working on a simple hashing program for a class and would love if somebody could verify if mine is correct or not. The hash function I'm using is key % tableSize and the rehash function is (key + 3) % tableSize. The table size is 20 and the values being hashed are, in this order: 66, 47, 87, ...
Reverse Polish notation (RPN) is a mathematical notation in which every operator follows all of its operands, in contrast to Polish notation, which puts the operator in the prefix position. It is also known as postfix notation and is parenthesis-free as long as operator arities are fixed. The description "Polish" refers to the nationality of logician Jan Łukasiewicz, who invented (prefix) Polish notation in the 1920s.
The reverse Polish scheme was proposed in 1954 by Burks, Warren, and Wright and was independently reinvented by F. L. Bauer and E. W. Dijkstra in the early 1960s to reduce computer...
At the Posfix Algorithm
At some point you need to pop two values of the stack
If there's a stack with 2, 1, 5 from top to bottom, then they "Pop two values (1, 2) and push result (3)"
I’ve written a basic implementation of Breakout using Java 8 & Slick (~400 lines of code). Please let me know of any design/OOP improvements that can be made (any improvements in general are welcome, but I’m specifically looking for design & OOP improvements).
Game - the main class
package brea...
@JorgeCampos It sounds like this question is asking for help with implementation which makes it off-topic for Code Review. CR is only for code that already works as expected. — Simon André Forsberg34 secs ago
@Anony-Mousse If you think it should be migrated, then flag it for migration with a custom flag. "Voting to close because it should be migrated" is contra-productive. Also, as I said in my comment above, this question does not seem to belong on Code Review. — Simon André Forsberg24 secs ago
For the below given problem from this assignment:
Q4. In passing, Ben also cryptically comments, "By testing the signs of the endpoints of the intervals, it is possible to break mul_interval into nine cases, only one of which requires more than two multiplications." Write a fast multiplicatio...
I started with Haskell some months ago, but didn't really use it since then. As a simple training I implemented Conways game of life. What/How could it be improved?
module Main where
import Control.Monad.State
data CellState = Dead | Alive deriving (Eq)
data Cell = Cell CellState Int deriving ...
THis question has been auto-flagged for: More than 20 comments posted in the past 3 days I can see there has been a lot of discussion, and I would like to continue that discussion, but in our chat room instead. Please join us in the 2nd monitor community chat room. — rolfl ♦26 secs ago
Meme: Monking
Originator: Morwenn
Cultural Height: The 2nd Monitor
Background: A morning greeting to the Monkey doing his monkey-business, in other words: monking
Examples: A small chat search
Variations: Monkernoon, Monkevening, Monknight, ... Important is only that it begins with Monk... ;...
About your question, I am trying to figure out how to tell you nicely that I don't think you will be able to make it on-topic here, and, even if you did, it would still have to be closed. I don't think there is a nice way, so I will just have to explain it carefully instead.
On Code Review, if a quesiton has an answer, then changing the question will likely make the answer wrong. We don't like that, so, in general we do not allow people to change their questions after answers are given
There is a way of improving the code as desired in that it is possible to constrain the type T to T: NSWindow. Upon introducing this change, however, the function will indeed return the first NSWindow in the current ordering, whether or not it is of subtype T (too check this you must construct a ...
The answer ^^^ (whether it answers the question you want it to answer, or not).
Well, his close vote got your question in to the review queue, and in that queue I saw it, and assesed the question as being offtopic for "code not yet written".
We consider code to be working not only when it compiles, and runs, but it also has to produce the output in the way the design/specification requires, etc.
> But it bothers me that with the first of the two convenience methods I'm accepting any T. In other words, it bothers me that type checker won't complain if I write: App.frontmost(Int)
So, your first code does not restrict your inputs the way you want them to.....
I know that this could be made much more efficient, I am just not sure as to how.
package main;
public class Cycle {
int penny = 0;
int nickle = 0;
int dime = 0;
int quarter = 0;
int halfdollar = 0;
int onedollar = 0;
int twodollar = 0;
int fivedollar = 0;
in...
Stack Overflow's scope also covers things like explaining how or why specific code behaves in a particular manner (explaining code if off-topic on Code Review). These would be questions in which the code in the question falls under "but it is working!"
Stack Overflow's scope also covers things like "My code is doing A, B, C, D, and E, but I also need it to do F." Note in that question, for points A, B, C, D, and E, the code falls under "but it is working!" But questions asking to extend a code's features are off-topic for Code Review.
I'm not saying it does or doesn't fit. I'm saying that just because it is working code doesn't mean that it's not fit for SO. I'm also, (more relevant to this discussion) saying, that just because it's working code doesn't mean it's inherently on-topic for Code Review.
@milos You say your desire is for the code to be reviewed, yet you have been extraordinarily defensive any time anyone but yourself points out issues with the code.