I created a python script to calculate the largest series of 13 product in a 1000 digit number. I keep getting the wrong answer despite changing the code over 9000 times and making sure no numbers are skipped. The largest product I get is 6270566400. Below I will include the algorithm, number, an...
Are you asking for a code review? That isn't on topic for Stack Overflow. Is there an actual problem with what you are doing currently? — David L27 secs ago
I currently want the base class also be the factory with static Create function.
To make base class does not need to know the imp concrete classes, I try to forward the two core jobs of factory to the concrete class. One is what are the all concretes. Another is how to dispatch it.
I try let the...
I received my code review comments for the following method:
private RequiredDocumentEntity GenerateRequiredDocumentMapping(string documentTypeCode, params string[] alternativeDocumentIds)
{
int alternativeDocumentCount = alternativeDocumentIds?.Length ?? 0;
List<DocumentTypeEntity> sati...
I am new to programming and have been having a lot of trouble with user input validation. Everything I found online I could break and I finally put this function together that appears to be unbreakable. It is for int and double specifically.
I am curious about how it might be critiqued by experi...
I am working on an rc4 encryption implementation for s3fs and I'd like to better optimize my design so I'd like feedback on my encryption/decryption here.
Below is the code which accepts a file descriptor of an open file for a parameter:
void crypty(int fd){
// Initial steps, read the file...
I am creating a messenger for my class project, I decided to do things more complex than the requirements given as I am using a class based PHP/MYSQL system. In my javascript file there is this code
$.tzPOST = function(action,data,callback){
$.post('php/ajax.php?action='+action,data,callback,'js...
@CaptainObvious code-review-review eh? I think -4 is a bit much, though it's not a great question I don't think it's that bad, maybe erring a bit on the unclear side
I have a program that monitors real-time air waves and demodulates them into useable data. The program runs fine and with very little issues over time. The only thing I am really interested in is whether the calls to memcpy can be handled differently.
I have tried using valgrind and this code do...
please I am new to java and i was asked to create a program that when u input an id number it bring out a name.I need as much input as possible.using dialog box method. Thanks.
So I've written up my code.
Obviously, I'm looking for easy of use and error checking. I don't
have more idea what could I do to optimize my code.
Will be glad the hear your opinions or suggestions. It's a lot of code, so bear with me.
# -*- coding: utf-8 -*-
import sqlite3 as sql
from P...
I was reading binary search from an interview book and changed some part of the algorithms.
It is working for all the values I tested with: i.e. all the values in array and outside the array extremes. Appreciate another person's glance on my use of lower <= upper condition. Any other opinion is ...
int[,] dimensions = new int[1, 2] { { 83, 41 } };
Rectangle destRect = new Rectangle(10, 234, dimensions[1, 2], dimensions[1, 1]);
when ran in windows form,I get the out of range exception and I get this message
"System.IndexOutOfRangeException: 'Index was outside the bounds of the array.'"
wha...
favorite
I know how to create list comprehension, however I am confused whether it is possible or not to convert below code into list comprehension:
def value(a): # a is any integer
ln=[]
for i in range(1,a+1):
for j in range(1,i+1):
ln.append(j*i)
for j in ra...
If your code has no errors, you should post your code on Code Review instead of Stack Overflow. People over there are more than happy to help you figure out more efficient ways to write your code. — erikjust now
I am pretty new to Clojure & am loving it so far. After going through a few resources, I decided to make a hangman game.
I'm wondering how idiomatic is my code. Where can I improve it stylistically & reduce complexity. It is divided into two files. Both of them are shown below.
src/core.clj
(n...
This is throwing Uninitialized string offset. I want to persist a .ini file in the $_SESSION array.
$items = parse_ini_file($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'config.ini');
foreach ($items as $clave => $valor) {
$__SESSION[$clave] = $valor;
echo '<br>ee' . $__SESS...
I've created an algorithm which uses envelope detection and other means to recognize that a baby is crying. As it's using audio as input signal it constantly processes a lot of data, which is fine for a laptop, but the algorithm need to run separately on a Raspberry Pi which has much less process...
I have implemented this MIPS code to determine the length of given ASCII character strings.
Is there a simpler way to implement this code or if there is a built-in function in MIPS?
Given String:
"Hello\n"
Output:
6
.data
message: .asciiz "Hello\n"
.text
main:
li $t1...
After answering http://codereview.stackexchange.com/q/160567 I wondered what the outcome were to be if there were more than three doors, say four or seven. And so I decided to modify the problem slightly to adjust for this.
There are \$x\$ amount of doors. Behind one door is a car, the others ar...
Just completed a piece of code - a credit card validation program in python - as a little side project. Having no experience with classes in the past, I decided to employ classes in this project.
I am wondering if you could review my code, both appraising the actual code, but also evaluate my us...
I am trying to ad nested to some flat data, which is nested.
Basically this code works the following way:
"taglevel":1 tags should be key of the array
"taglevel":2 or higher tags should be nested within an array and not be duplicated in its' array
If no "taglevel":1 exists add, it to a generic...
public class SinglyLinkedList implements LinkedList
{
protected SinglyLinkedListNode first;
protected SinglyLinkedListNode current;
protected int size;
public SinglyLinkedList()``
{
first = current = null;
size = 0;
}
public int length()
{
...
@tobi303 oh and btw should I repost it there ? I don't know if it's possible to move it since this question already contains comments. — justHelloWorld50 secs ago
@justHelloWorld Reposting on CodeReview is fine. Be aware that CR requires your actual, unaltered code. Preferably straight from your IDE. In its' current form, this runs the chance of being closed as Pseudo/Example code. — Kaz55 secs ago
Reviewing someone else's code review is not really what this site is intended for. I'd suggest to add context to clarify what this piece of code is meant to do, so that we can review it properly. — Phrancis' DROP TABLE Users--8 hours ago
@Phrancis'DROPTABLEUsers-- ^ What indication is there that it is not his own code?
Recently I have tried two DFS problems(UVA459-Graph Connectivity and SPOJ-LASTSHOT).
I used DFS recursively to solve both of the problems. In my terminal, I run the programs with multiple test cases and all are given right answers with no errors. But when I submit the problem, I got Runtime erro...
Return the number of bits (N) that will need to be changed in order to convert an integer, X, into another integer(Y).
Constraint: 0 <= X <= Y <= 2**128
Example:
X = 1, Y = 2 => N = 2
X = 2, Y = 3 => N = 1
X = 0, Y = 4 => N = 1
I have written following code, How to impro...
We just went through the end of the tax year, followed by the beginning of the new tax year. I think I placed about 2,000 Trades on April 6th. I might even be able to get my work backlog caught up by the end of the month.
hackerone has a open and closed status, and there are varying 'substatuses' for each of those things. an open issue can be triaged, a closed issue can be closed as not applicable or closed because it was resolved.. etc
@Kaz o.o
@Kaz Yeah that'll be an interesting one for sure. Most people in my team are left-wing but my boss is right-wing, so :D
Find the kth smallest element in row wise and column wise sorted element:
Example:
matrix[row][col] < matrix[row+1][col]
matrix[row][col] < matrix[row][col+1]
mat=
1 2 21
11 23 25
31 36 41
I have written following code, How to make more readab...
I have implemented a play fair cipher.The code works fine but I would like to improve the clarity and/or performance of the code.
Crypto.java
public class Crypto {
private static boolean verbose = true;
public static void setVerbose(boolean verbosity) {
verbose = verbosity;
...
I am learning recursive functions and I kinda understand that tail recursive functions performs the processing at first and at the end of the statement it goes into the next iteration/recursive call.
I am trying to solve a problem which is difficult to understand using loop but makes more sense...
Ok, i started to program with python some moths ago and i've made this login program:`
UserAge=(int(input('how old are you?: ')))
if UserAge < 18:
print('you can\'t enter')
accesso=False
elif UserAge >= 18:
print('you can enter')
accesso=True
elif UserAge >= 100:
print('WTF you a...
Hey! Welcome to Stack Overflow. Working code actually doesn't really belong on this site. You're better off posting on the sister site Code Review. — Michael19 secs ago
Problem definition
We are given an undirected graph \$G = (V, E)\$ and a weight function \$w \colon
E \to (0, 1]\$. The weight of the edge \$e \in E\$, \$w(e)\$, describes its reliability, or, in other words, the probability that the edge is available. Given two distinguished nodes \$s, t \in ...
I have a big txt file containing some specific IP addresses, and all of them appear more than once (the file has around 13 million lines). The file looks like this (the first octet is set to zero for anonimity):
0.169.252.233
0.140.165.113
0.112.0.44
0.89.149.36
What I want is to read all thos...
I have seen many examples which the results of a Producer/Consumer queue implemented using BlockingCollection<T> are independent, e.g. each result can be consumed independently in parallel. For example, here the produces calculate a square root and consumers grab each result to update the UI.
I ...
I solved this Challenge from LeetCode
Design a simplified version of Twitter where users can post tweets,
follow/unfollow another user and is able to see the 10 most recent
tweets in the user's news feed. Your design should support the
following methods:
postTweet(userId, tweetI...
I'd recommend writing your own solution and posting this question to CodeReview.stackexchange.com. It's not really suited to SO answers, you'll get far better answers there. :) — Jack C59 secs ago
We don't do library requests here... and code review is better handled at CodeReview SE. One note; this kind of code is why you should use WPF with MVVM, its just awful the WinForms way. — BradleyDotNET25 secs ago
I wanted to do a practice and randomly picked: Hackerland Radio Transmitters. I highly encourage you to give it a shot, I at least enjoyed working on it.
Please do not proceed if you want to solve it yourself!
My implementation is as follows:
package biz.tugay;
import java.util.*;
public cla...
can you help me!
I need program in c++ contains two or three classes
and that almost contains most of (selections, repetitions, arrays, pointers, vectors and classes A deeper look)
*the program can be a simple game or simple program of arithmetic or other.
thank you!
I have a form with listboxes as below. It is used for unit conversions. I'm looking for some some .net libraries that will help in doing this. Below are my questions,
Is my code proper way of approach?
If any changes must be made to this code, what are they?
What are best available sources for ...
I'm working on retry mechanism for inserting data into database.
If there is an exception while invoking ExecuteNonQuery from MySqlCommand, I will try to instantiate a new MySqlConnection and execute the command again.
The problem is: MySqlCommand is related to a MySqlTransaction object.
Here...
I was interviewed for one position and had the following task.
Goal is to design system according step1, then step 2 is like next requirement and we need to adapt system to it.
Step 1: Shopping cart
You are building a checkout system for a shop which only sells apples and oranges.
Apples cost...
I read some questions/answers related to functions in C# to calculate the working days; some uses an extended code to achieve that.
I have a data table with more than 50,000 rows and I required an effective method to calculate this information.
This is my attempt at a Sudoku solver using a DFS approach.
I mainly developed it to become a better Rust developer, but if you have any performance tips, I will be glad to hear them :)
Note: My program should work for any dim > 1, but fails for some reason for dim >= 4. Just ignore those cases...
This is a project that grew out of the React Tutorial
and is one of my first efforts at solving React problems on my own. There is a lot of code
here and I am sure that there are more concise ways to have completed aspects of this project.
Any suggestions, insights or positive comments would b...
I'm just missing a few thousand points (or a few hundred upvotes)... Almost there?! :-P
Vogel, still around?
@Duga If so, could you check whether this question has a deleted answer, which has been moved into the question? (I'm trying to figure out what happened with that question)
Python 3's built-in array type has no support for complex numbers. As an exercise, and in support of a possible future array-based multi-dimensional array I decided to implement a class complexarray that extends array to support complex numbers. The goal here is to have a class that behaves exact...
Solved the classical Towers of Hanoi problem in Ruby, using recursion. Would love your feedback on this.
# Excellent explanation of the solution at
# http://www.mathcs.emory.edu/~cheung/Courses/170/Syllabus/13/hanoi.html
Move =
Struct.new :disk, :from, :to do
def to_s
"Disk #{disk...
We do not field questions about improvements to working code. Once you have tested your implementation enough to have a reasonable degree of confidence in its correctness, CodeReview SE would be the place to ask about possible improvements. — John Bollinger33 secs ago
I'm implementing a set of thread-safe functions that update and search an unbalanced binary tree with Pthreads (see The Linux Programming Interface: Exercise 30.2).
It's easy to implement a 'functional' tree that simply locks the entire body of functions like add or delete, but I believe it poss...
I have a program, where I have to display only certain items from one enum list. Each session has a value as RRE, PLU, ELE and based on these session id's I need to filter so that only so many show for each one.
For example RRE should only show 4 out of the total amount of items. I am very new...
I'm working on retry mechanism for inserting data into database.
If there is an exception while invoking ExecuteNonQuery from MySqlCommand, I will try to instantiate a new MySqlConnection and execute the command again.
The problem is: MySqlCommand is related to a MySqlTransaction object.
Here...
I created this class in TypeScript:
export class ViewerItemCardType {
public static Big: ViewerItemCardType = new ViewerItemCardType(1, "FeaturedBig", 330, 660);
public static Medium: ViewerItemCardType = new ViewerItemCardType(2, "FeaturedSmall", 155, 310);
public static Small: View...
@GiorgosAltanis The following sounds hypothetical: "though it is mostly all theoretical, we aren't actually plugging in the SQL". Code Review does not deal in hypothetical code. The author will have to clarify (and read the help centre) or risk getting the question closed. — Mast39 secs ago
We are to normalize a database, though it is mostly all theoretical, we aren't actually plugging in the SQL. This is the Data we have normalized to these tables..
and here is our SQL for normalizing it. I'd just like to know if anyone spots and glaring issues.
insert into bldg_table (bldg)
S...