Add this tag to your question to indicate that you are new to the language of your code. This will often be taken in to consideration by reviewers when assessing your code.

learn more… | top users | synonyms

6
votes
1answer
88 views

Tic Tac Toe in plain JavaScript

I have created Tic Tac Toe game using plain JavaScript. Can any javascript expert review it and let me know whether the way I have written JavaScript code that is right (preferable)? I am unsure that ...
-1
votes
0answers
21 views

beautiful soup, ugly code, looking for a more efficient way edit this html [on hold]

Basically I want to do a simple find and replace search at this point but since the object is not a string I cannot do that. So here you can see I switched it from soup object back to string several ...
3
votes
2answers
19 views

Align text (left, center, right) without additional packages

I wrote this short subroutine to left, center, right-align a multiline string. How can I make it better (shorter, prettier, optimized)? Can you offer some suggestions? ...
6
votes
2answers
108 views

Numbers to words

Please review my code ...
2
votes
2answers
54 views

JavaScript function that toggles element visibility according checked radio input

This function has a set of radio inputs, for each radio there is a hidden text input. When a radio input is checked it shows its chained text input. I've done it with a function constructor, and I ...
-4
votes
0answers
22 views

Overloaded Operators [on hold]

May someone please help me with the following problem on overloaded operators: Consider the mathematical construct of a matrix (http://mathworld.wolfram.com/Matrix.html) Create an Abstract Data Type ...
7
votes
2answers
132 views

Set desktop background

I created a simple program that downloads an image (different image every day), then sets it as my desktop background. I feel like the lines of code can be cut down significantly while still remaining ...
5
votes
3answers
129 views

Project Euler #9 - Pythagorean triplets

This code works, and I'm trying to figure out if there's a better way to optimize it. As you can see, I've cut down drastically on time just by using numbers that work for ...
3
votes
1answer
36 views

How can I make this Euler/RK4 implementation more elegant?

One of the things that I'm doing to teach myself is converting some numerical methods from existing Python code (they seem to me to lend themselves to functional programming quite well). I'd like to ...
9
votes
1answer
643 views

Battle a random enemy

I am trying to write a text adventure as my first Python project. For this segment, I wanted a random enemy (part of a class with its own attributes) to appear and then enter a turn based battle with ...
2
votes
1answer
36 views

Google Map, SVG Graph and ruler

I would like to get feedback on the code. It is working and can be seen here. I welcome any kind of feedback, since I am just starting to use JavaScript. Epecially in the case of performance, there ...
9
votes
3answers
578 views

Clean code attempt at ATM problem on codechef.com

The problem asks you to take an integer (debit amount) and a double (credit or initial balance amount) and process the requested debit verifying that 1 it's a multiple of the minimum denomimation ...
-2
votes
0answers
21 views

Issue with Simple Python Volume Calculator [closed]

I'm a beginner learning Python, one of my first projects was to try to construct something that would calculate volume for a few basic geometrical shapes. The issue I'm running into is that when I ...
1
vote
1answer
38 views

Combinations with replacement

I am still new to Scala and wrote a small snippet to find all the combinations with replacement of a sequence (e.g. cwr(ab, 3) should give aaa, aab, abb, bbb). The slow way would be to generate all ...
3
votes
2answers
47 views

Creating polls and calculator with custom functions and without any global variable

I solved this problem using custom functions and calling them in main function. The challenge was to avoid global variables. Please note that I'm C++ noob and this program is fairly large. I'm ...
3
votes
1answer
24 views

Merging values with lists as flat-lists

I'm merging dictionaries together in series. Each one may/may not have lists as values. I'd like to merge indefinitely and, have the final merged dictionary contain only flat lists as values. Any ...
8
votes
1answer
63 views

Interactive API documentation page of a RESTful dictionary API using Backbone.js

I'm working on the interactive API documentation of a RESTful dictionary service. The page should let testers try the different API calls, by playing with the parameters using a simple web form. ...
5
votes
3answers
59 views

Cautious File Writer

I'm trying to follow the path of Sandi Metz and others who state that aiming for small and simple is good for writing understandable code. I've written a method that takes care of writing content to a ...
0
votes
1answer
63 views

Reducing the sorting time of a large number of numbers

I have to sort many large numbers in a given time limit. The program below works, but not when the test cases reaches \$10^6\$, in which case it exceeds the time limit. ...
3
votes
1answer
47 views

Random select in two MySQL tables

I wrote a simple AJAX request that performs a random select in two MySQL tables. The thing is, my current script involves connecting to the database and creating a new PDO every time the ...
4
votes
2answers
48 views

GameLoop with requestAnimationFrame

I am creating a HTML game where you fight monsters and stuff and this is part of the game loop for dealing damage: ...
-1
votes
0answers
36 views

Creating a tuple out of a list [closed]

For homework I need to make a 4 tuple out of the given list.(Datatypes can be gathered from looking at below code along with the format required). I don't understand the error message I receive--no ...
2
votes
1answer
33 views

A module to display, update and save a dictionary as .csv v2.0

I'd like feedback on my revised code after my previous question. The goal is to create a module which can display, update, save dictionaries as .csv files. I'll use this in another program to update ...
0
votes
0answers
57 views

Mock user table class

I've just created my first tests using mock classes. So far my tests are running much faster and now I guess I'm solely focusing on a single class (in this case I'm testing UserTable and mocking the ...
2
votes
2answers
233 views

Get and display employee time clock data

I have been making a web page in PHP and JavaScript to take employees clock times and do some things with them so I can display them. Everything is currently working quite well, but the code looks ...
5
votes
2answers
96 views

Locking viewport to the top element on window resize

On a responsive website where elements may shrink/expand according to the size of your viewport, the elements that was at the top of your viewport at the time may get pushed down/up as the elements ...
-1
votes
3answers
145 views

iOS coding style

I am new to iOS development. I wrote this code, but the company said that this is bad architecture and is not acceptable. I want to improve this code. ...
8
votes
2answers
411 views

Clean code attempt on codechef.com FCTRL

I have been reading Clean Code and decided to start working problems on Codechef.com attempting to apply some of what I have learned. Do I seem to be on the right track or am I way off? The ...
8
votes
3answers
106 views

Switching font and background color on button click

I am currently building a web app where I need to randomly switch the font and color of a title (inside the #content div) and the background of the page every time ...
4
votes
2answers
473 views

Querying school databases

This is the application I created for my personal use. I need some quality testing of this application. If you see some errors or any lengthy coding (it's already lengthy), and it needs to be ...
3
votes
3answers
161 views

A program to display, update and save a dictionary as .csv

I'm now looking for feedback on v2.0 of this program instead. I'd like some feedback about my code. What bad habits do I have? What advice could help me write more Pythonic? I'm trying to write a ...
8
votes
1answer
77 views

Dungeon generation in Scala

I've recently begun learning Scala, and while I've run into its concepts before (immutability, tuples, first-class functions) I'm not sure whether I'm using the language how it's supposed to be used. ...
7
votes
4answers
1k views

Dice-rolling program

I am sort of new to programming. I would like to understand the code areas that are garbage and could be better written keeping the exact (if possible) behavior the code has now. ...
8
votes
1answer
334 views

Project Euler #2

Problem: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
19
votes
4answers
2k views

Project Euler #1

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. My ...
-6
votes
1answer
59 views

Can You Tell Me Whats Wrong With My Java Code? [closed]

This is used for checking age. ...
7
votes
3answers
111 views

Extracting data from text file in bash using awk, grep, head and tail

I've been writing bash script on and off, with pretty good results in terms of getting the job done. However, I'm worried that my script might be very ugly, as I am a beginner. I'm looking for advice ...
2
votes
2answers
92 views

90 year data simulation in need of performance increase

I developed some code for my masters project that will simulate 90 years daily data using 1000 different data sets. The code is working fine and gives the correct output that I wanted but the ...
1
vote
1answer
38 views

Securely shuffling an array with 75 numbers in Go

I have a SHA512 hex string consisting of my random input and that of the user. Since rand.Seed only accepts a int64 I can never ...
6
votes
1answer
110 views

“Hello world!” in Prolog

I have just written the following "hello world" program in Prolog. Although it is as simple as it can be, I would like your feedback as Prolog is very new to me. ...
4
votes
1answer
69 views

Trying to grasp OOP Rock, Paper, Scissors program

I'm trying to wrap my head around OOP but so far I feel like I'm just moving functions into classes and calling them methods. I am trying to create a "Rock Paper Scissors" game using OOP best ...
4
votes
4answers
85 views

Index mechanics for Rock Paper Scissors

I just went through a very easy online example creating a Rock-Paper-Scissors game, but it seemed like it was not a great use of computing power. It seemed like I was writing out results for every ...
8
votes
3answers
377 views

Stock Pipe Cutting using Recursion

This problem is from the Stanford Open Course CS106B Programming Abstractions Assignment #3 Problem number 6 here. "You are charged with buying the plumbing pipes for a construction project. Your ...
4
votes
2answers
96 views

Parse text file function

This method takes a text file of my work schedule and parses it. It works, but is kind of kludgey, and I'm looking for feedback and suggestions. My first attempt at a file parser, and my first look ...
4
votes
2answers
145 views

Python Hangman Console

I'm quite new to Python and have been experimenting. So far I have made a simple hangman type game which creates a random word and the user than guesses it. I'd like to know if I've committed any bad ...
3
votes
3answers
82 views

List primes within an interval

I'm trying to solve the SPOJ primes problem: Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime numbers between two given numbers! ...
5
votes
1answer
127 views

Wedding Photography Cost Calculator

This is my first code. I would really appreciate a critique for it, if anyone can spare the time. ...
1
vote
1answer
41 views

Update a field in a list of dictionaries

I have a piece of code which follows this form. Is this correct or is there a better way? ...
2
votes
3answers
400 views

Efficiency of Project Euler problem 35

The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, ...
6
votes
1answer
46 views

Generating Cartesian product of strings in R

Sometimes I need to create character vectors like this one: ...