I agree with @IvanGabriele this could be suitable for Code Review if the code works as intended. I would recommend a title that says something about what the code does, however. — Phrancis31 secs ago
To start off I'd like to note I am aware of int(val, base). My goal was to write a short function capable of taking in a base int, and a string defining the value to be summed.
The function rests upon the equation:
represented_value = value * base ^ placeholder
>>> base_v = lambda base_v, ...
humans just aren't made for having to make a bunch of ethical decisions in the form of "you're wrong you die" in a short span of time, even if it's just game people
I made a colour game and my question is how to make the script shorter and easier? The script is working but in my opinion the script can be shorter and better.
I will explain my game. It's a game about matching the right colour. In the first level you start with 3 cubes that each have a differe...
This is my first C# program. Since it is my first C# program, I'd really love someone to dissect it and tell me all the things I can do to improve it. This is a real learning experience.
This program was written on Windows 7 using Visual Studio 2012 Professional. Some of the issues encountered m...
pfff when the game throws a puzzle at you and you pause the game and work it out and then one of the characters just straight up tells you the solution
Was just wanting some general feedback on the below code regarding readability, structure and if there is a more efficient way of accomplishing the task.
https://gist.github.com/JLeonn/5a3aae2468ce6cc2115fef6e6c3b3d08
Was just wanting some general feedback on the below code regarding readability, structure and if there is a more efficient way of accomplishing the task.
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
/**
* Created on 5/27/2016.
*
* Si...
Was just wanting some general feedback on the below code regarding
1. Readability
2. Structure
3. Efficiency
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
/**
* Created on 6/23/2016.
*
* Inspired by r/dailyprogrammer
* https:/...
Was just wanting some general feedback on the below code regarding
1. Readability
2. Structure
3. Efficiency
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
/**
* Created on 5/27/2016.
*
* Simple functions used to reverse either a s...
Task. Given a set of points on a line and a set of segments on a line. The goal is to compute, for each point, the number of segments that contain this point.
Input Format. The first line contains two non-negative integers s and p defining the number of segments and the number of points on a lin...
I have a small program in Java with GUI, which is showing NBP currency data in specified tabs. It downloads data from www.nbp.pl using XML format and saving it into Apache Derby database using hibernate. I am posting my code here because I want to correct myself in style and, eventually, in effic...
I'm voting to close this question as off-topic because it asks for a code-review instead of stating a specific problem. codereview.stackexchange.com would be a better place for this question. — Mureinik12 secs ago
many thanks for your help Increment irow was the solution. I am interested in understanding what you mean by heading over to codereview. How can I get my code shorter? — MAx Segura13 secs ago
I am trying to create a Data Access Layer using ADO.Net. I have created a generic method for ExecuteNonQuery. The stored procedure I am calling will return two parameters. The output parameters from the stored procedure should be assigned to DTO object and the DTO should need to be returned to BL...
I creates ListView inside the ScrollView using java code and bottom of Listview i added on Button its working fine.I know to fix the button always bottom.But my doubt is how to fix the button is bottom of the screen when the item is less like two or three? if the item increases the button have to...
I've created a working Android app for my project website. I'm newbie too android dev so please review the code of this app. Any simplification or suggestion to optimize it much appreciated.
Thank you.
MainActivity.java
public class MainActivity extends AppCompatActivity implements MyWebChrome...
Codereview is another stackexchange site where you can get help improving your code (as opposed to stackoverflow where you get help fixing errors). — arcadeprecinct31 secs ago
I just decided to get a bit more acustomed to using templates. Maybe this is a stupid question, but in my experience in C++ there is always some pitfall lurking aroung the corner. Thus I prefer the danger of embarresment instead of building up on bad habbits. Mainly as an exercise I wrote this:
...
I've written a ISBN-validating annotation. It is to be used in conjunction with Hibernate Validator.
I'm pretty satisfied with this code as it works as expected, but I've had to make a design choice that I totally dislike. This is why I post this question.
The method checkISBN returns an Option...
As long as the content is correct you have done your duty. Would be nice to be acknowledged for your work though. I love "Thanks that worked" comments.
Quick Python question: Support x = [[1,2],[3,4]]. Can/should I iterate through the "rows"? I.e. [1,3] , then [2,4] in plain Python or is this numpy territory?
@zʏᴀʙiɴ101 @Duga is not mine though, it's @SimonForsberg's bot, I only started with it, formerly called GithubHookSEChatService and deployed as TCG ChatBot with as only purpose to show commit messages, issues, etc. from Github
I have written a basic PHP upload script a few years ago and recently I discovered some phishing html pages in the website's root.
This website is located in /www/sitename, while I upload the files to /gstorage/sitename, which can't be accessed from the web.
I have found a lot of html files in...
Hello I'm creating my own game and for some statistics I need to get the names of specific objects, the problem was that I had them declared like this SmallFireBall but I wanted them to appear like this Small Fire Ball because that's something the user is able to see, so I decided to create my ow...
This is a very famous piece of code from Quake-III Arena, game/code/q_math.c. Its sqrt function is even 4 times faster than the system funtion sqrt(). I want to know how to use this in Swift.
Thanks in advance!
float InvSqrt(float x)
{
float xhalf = 0.5f*x;
int i = *(int*)&x; // get bits for fl...
I'm writing a simple tool as a helper on Route Cipher for fun. In summary, the tool breaks input string into a two-dimensional array of characters with the dimensions specified by the user, and after that it's represented as a table on HTML. The tool also has a function to shift table data on a r...
I did think about posting it to codereview, but whilst the code compiles and runs the output is incorrect for my specific problem so I thought it would be better to post it here. — ArchbishopOfBanterbury56 secs ago
I'm looking to improve a loop within a script that performs scheduled server restarts.
Currently, I'm using a DO While loop with an exit condition within an IF statement once a counter reaches a limit.
I'm looking to change this into a more simpler loop using a Labeled While loop containing a F...
I am unsure of how I can simplify my code for this HackerRank activity:
Here's my code in C++:
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int main()
{
unsigned test_cases, low_range, high_range, count = 0;
vector<unsigned> sherlock_squares;
cin >> test_...
I am doing a project here where i had to learn everything fast so i could be able to do my class, however i am pretty newbie in PHP and i need a LOT of help here :(
I need to print the many-to-many relation ship in my tablet, however i don't know what to do for my case: i tried tons of ideas, ho...
I've just started to teach myself Rust. I've written the following code to read a text file and store the contents in a String. Is this the typical way of doing this? Can anyone suggest any improvements to this?
use std::fs::File;
use std::io::Read;
use std::io;
fn main() {
let file_name ...
@Mast Swift uses the IEEE 754 representation for Float (at least on all platforms where it is currently available), therefore the same "trick" works in Swift: stackoverflow.com/a/33680900/1187415.
Below I've written a simple version of what I'm attempting to accomplish. I'm new to asynchronous functions, so it's difficult to wrap my head around this. My goal is to wait for the loop to finish all the callbacks before console.log() runs, but I want all the callbacks inside the loop to be asy...
I came across the below problem in a coding challenge:
Let's define 2 functions a function F(i) and Val(i,j) for an Array A of size N as follows:
F(i) = ∑ Val(i,j), for j = i+1 to N
Val(i,j)=1 ,if A[i]<A[j], otherwise Val(i,j)= 0.
I need to find the number of distinct unordered pairs of elemen...
Im a complete noob and started today, i watched some videos about how to make a simple text game but doesnt seem to make it happen. When i run the shell it says missing paranthesis around print, i tried to swap it but nothing happened.
What am i missing to make it run?
def start():
print ("Hell...
Im a complete noob and started today, i watched some videos about how to make a simple text game but doesnt seem to make it happen. When i run the shell it says missing paranthesis around print, i tried to swap it but nothing happened.
What am i missing to make it run?
def start():
print ("Hell...
Welcome to Stack Overflow. Please take the time to familiarize yourself with the Stack Overflow help file, which will help you understand what kinds of questions are appropriate for this site. This site is intended to help you obtain answers to specific programming questions, as opposed to providing tutorial, design or code review assistance. — MarsAtomic55 secs ago
This is one simple crawler that downloads images from websites, the website's URL to be crawled to must match the regex, as well as any image-to-download's URL.
(Also, I know, I made my own thread pool, because I did want to keep my crawler lightweight...)
Code:
import BeautifulSoup
import req...
I have generated an image in png format using ChartUtilities.saveChartAsPNG() method in JFreeChart save that chart in the local path.
I am retrieving that chart from local and converting into bytes arrayand then to binary and save them in a variable.
When I vice versa this process by convertin...
Inspired by Reddit r/dailyprogrammer
A vampire number v is a number v=xy with an even number n of digits formed by multiplying a pair of n/2-digit numbers (where the digits are taken from the original number in any order) x and y together. Pairs of trailing zeros are not allowed. If v is a va...
How can I improve my code, make it more efficient, and are there any tips you have?
public class LargestPrimeFactor {
public static void main(String[] args) {
long num = 600851475143L;
boolean isPrime = true;
// this is to see if num is factorable
for (int ...
Good grief @Duga, 3 messages saying it's off-topic for SO because "belongs on the code review site"
@CaptainObvious I ran the code and it gave the right answer, but after a while errored...
71
839
1471
<right answer removed for spoilers>
Exception in thread "main" java.lang.ArithmeticException: / by zero
at Main.main(Main.java:13)
exited with non-zero status
Not sure if that makes it broken or not
It also prints 3 wrong answers before printing the right one
@Eiko please vote to close as "Too Broad" or "Unclear" if there is no actual programming question/problem. That being said, if the code works correctly it would be on-topic on Code Review. — Phrancis8 secs ago
@nnnnnn please vote to close as "Too Broad" or "Unclear" if there is no actual programming question/problem. That being said, if the code works correctly it would be on-topic on Code Review. — Phrancis28 secs ago
@Phrancis - The question is completely clear. But the code works as is and the OP has essentially asked for a review, which is why it is a candidate for the Code Review SE, and why I voted to close it as off topic. — nnnnnn1 min ago