0
votes
0answers
5 views

Eight queens on a chess board puzzle [on hold]

When I first saw the question: How to arrange eight queens on a chessboard such that they cannot attack each other I was intrigued by it, so I decided that the best way to answer the question was to ...
-1
votes
0answers
3 views

Error in python script for Scatter plot [on hold]

I am trying to create a graph with this script, but I get an error if someone sees the error, please I ask you to help me find it, because I do not know python. ...
0
votes
0answers
10 views

Counting length-2 substrings that are common to two strings at the same offset — Python

I solved the CodingBat task: Given 2 strings, a and b, return the number of the positions where they contain the same length 2 substring. So "xxcaazz" and "xxbaaz" yields 3, since the "xx", ...
3
votes
1answer
21 views

Sorting thousands of records

I have the following list to sort: A 0.53 B 0.56 C 0.56 D 0.98 E 0.33 Please note that my list may contains thousands of such type of records. I am sorting my ...
0
votes
1answer
17 views

Random fadeIn has unwanted pauses

I have a title with each character and word split into a <span>, using lettering.js. I am relatively new to jQuery and ...
-1
votes
0answers
9 views

How do I implement per-pixel shading in GLSL 4.3? [on hold]

I've created a functional level in C++ and OpenGL. I am able to render it properly using a basic shader, but I need to add my own per-pixel shader for lighting. I have added per-pixel shading in GLSL ...
5
votes
1answer
88 views

Counting length-2 substrings that are common to two strings at the same offset

I am working through the CodingBat exercises for Java. I just completed this one, an exercise that requests the comparison of substrings of two strings: Given 2 strings, a and b, return the number ...
2
votes
2answers
21 views

Creating an iOS form with many similar text field cells

I'm using multiple instances of an object creating a form: ...
1
vote
0answers
11 views

Server side form validation library

Have I followed best practices for PHP development, or can this class be improved? GitHub ...
2
votes
1answer
31 views

Sort a linked list with merge sort in C

This is my version of a linked list in C. The function mergeSort requires a reference to the first and to the last nodes, as well as the indices of the first and ...
1
vote
0answers
23 views

Extremely simple code that adds two integers with wxWidgets

This code using wxWidgets for GUI adds two numbers when the add button is clicked. Please review my code design because I would like to know a few things on managing wxCtrls before writing more ...
0
votes
1answer
14 views

JavaScript: Why so much abstraction/interfacing in Addy's Observer Pattern?

I'm working through the design pattern example for the Observer Pattern in Addy Osmani's book, "JavaScript Design Patterns". My question is why is it important that there are so many levels of ...
2
votes
0answers
17 views

Optimization for calculating statistics

I have collected a large amount of data about the train network in my country. Now, I am writing some code that calculates the average amount of delay on the entire train network, for each day, in a ...
3
votes
2answers
17 views

Checking in four directions for board game win

I have the following code which I would like to simplify in Haskell, although I'm not sure how. I recall that I can use monads to simplify a case chain when the result of the case leads onto a next ...
0
votes
0answers
35 views

Efficient way to find dupes in a set of 4 numbers [on hold]

I'm currently writing a program where efficiency is rather important. In this program I sometimes end up with values from up to 4 different sources. I want to check if any of the values I end up with ...
3
votes
0answers
10 views

Generic Pickle-Aware Super-Class for Mixing Classes with and without __slots__ in Python

I want a generic super-class that I can easily subclass - and if desired add slots to my class - without having to worry about any pickle issues (with the lowest protocol). Is this in general a good ...
2
votes
0answers
18 views

Method for gaining access to private members in javascript for testing purposes

When running unit tests in javascript it is often useful to gain access to private members. Previously I would add an extra snippet of code inside the class definition (or whatever one calls this in a ...
1
vote
1answer
17 views

Equalizing heights

I'm running a jQuery function to equalize heights. I want to equalize the heights of several pairs of elements, and can't think of a way to do so without repeating the whole function. How can I ...
10
votes
5answers
960 views

Checking if a number is divisible by 9

I tried to develop a new way to check if a number is divisible by 9. I have written my code and it is working fine. I'm not allowed to use *,...
4
votes
2answers
248 views

Simple java code measuring

I am trying to simply measure my code execution time. ...
2
votes
0answers
15 views

Empty an array on focusout - jQuery UI Autocomplete

Is it good to empty an array on focusout? ...
3
votes
0answers
21 views

Implementation of the FNV-1a hash algorithm for 128-, 256-, 512- and 1024-bit

A little over a year ago, I asked this question. Since then, I've implemented the larger bit variations and am looking for any and all feedback - performance is obviously key when talking about ...
-1
votes
0answers
12 views

Reverse of linked list not working with argument [on hold]

These are the reverse and display functions of the linked list. Correct output : ...
3
votes
0answers
17 views

Bootstrap show many move one carousel modification

I've been steadily improving a show many move one carousel sample that I found a few weeks ago. I want to post my improvements for others to use but don't want to spread bad code. I'm not an expert in ...
3
votes
2answers
256 views

Encrypting and decrypting passwords in PHP

I am wanting to encrypt a password and decrypt a password using PHP. Is this a safe method? ...
-3
votes
0answers
15 views

Please help me with the optimization [on hold]

Resources in my program are not exempt and with prolonged use application, it can take up to ~ 500 MB of RAM, which is not I do? How to fix it? If Could you see the source code and share advice. ...
0
votes
0answers
13 views

Race On - a gambling game (in beta) [on hold]

It's for six players. Each player writes six numbers from {1,2,3,4,5,6} down - any six (repeats allowed). They take it in turns to throw a dice. If the number is top of their list, they cross it off ...
-1
votes
0answers
13 views

Double Dice Game: I must make the two dice equal eachother to win [on hold]

I can't get my main class to recognize the dice as doubles. In order for the player to win, they must roll doubles. ...
2
votes
2answers
19 views

Assembly Summation Implementation

I wrote a simple summation program in MARS to practice using loops and jump instructions. I feel like this is pretty lightweight and wanted some feedback on possible improvements: Lowering ...
8
votes
1answer
43 views

Rubberduck's “Rename” refactoring implementation

Knowing who's using what, and where, I've implemented a "Rename" refactoring for Rubberduck. It works great - it needs further extensive testing, but the preliminary tests are very, very exciting. ...
2
votes
1answer
46 views

Determine the index where two lists diverge

Background A class provides an API to determine the index where two string lists diverge. ...
3
votes
4answers
280 views

Check if all lotto numbers are covered in input

Each ticket for the Pick-10 lotto has 10 unique numbers ranging from 1 to 99. Suppose you buy a lot of tickets and like to have them cover all numbers from 1 to 99. Write a program that reads the ...
1
vote
0answers
19 views

Calculate median and quartile in C without sorting the array

Here's a piece of working code wrote in C to calculate the median without putting all values in an array and sorting them. It reads values from a file. ...
-1
votes
0answers
10 views

Pygame implementation of pong [on hold]

Recently, I have been working on a pong game in python using pygame. I have a complete basic game, however there are two problems. 1) The ball always follows the same trajectory and I do not know how ...
1
vote
1answer
29 views

Forming combinations of a 16 bit binary number

I wrote this code to form combinations of a 16 bit binary number (I know it is in output is string format, but it is my goal to just print all possible 16 bit binary numbers). My question is, can this ...
5
votes
1answer
80 views

Simple todo list

Can someone tell me how good/bad this code is for a super simple todo list made from vanilla JavaScript? Anything to work on or consider on my next projects? ...
2
votes
0answers
33 views

Program for compacting other given code

I've just finished a small function that will reduce the size of code as much as possible without breaking anything. Obviously it makes everything a bit unreadable so it's not really for cleaning the ...
2
votes
1answer
32 views

Simple High Score Server for HTML Game

I have implemented a basic high score server for my strategy game. The goal here was to get the high scores working for the browser based version of the game (I am using the libGDX library with GWT ...
0
votes
0answers
9 views

Shuffle Symfony entities

I've got an object $contest which is a Symfony entity that has some other entities assigned. I can get them by ...
2
votes
1answer
12 views

UPenn homework 3: histogram

Please see here for the general description. Exercise 3: histogram :: [Integer] -> String takes as input a list of ...
2
votes
1answer
38 views

Vitaly & Pie Programming challenge

I've been trying to solve this problem on Codeforces: Challenge description: After a hard day Vitaly got very hungry and he wants to eat his favorite potato pie. But it's not that simple. ...
3
votes
2answers
18 views

UPenn Homework 3: localMaxima :: [Integer] -> [Integer]

Please see this question for the general description. Exercise 2: localMaxima :: [Integer] -> [Integer] A local maximum of a list is an element of the list ...
2
votes
0answers
28 views

MultiLevel JavaScript Inheritance

I'm making an experiment on JS, trying to build a framework for OOP. It's called Universe. The main purpose is to emulate a mini-universe, where classes are "created" with a defined behavior ...
4
votes
0answers
19 views

Replicating a file system

The goal of this is just to practice. I went off on a self-challenge to replicate something(So the names of the parts can be ignored), I'm not done yet (Though what is here is fully runnable), but ...
4
votes
1answer
38 views

Normalizing strings using PHP preg_replace and regex expressions

I needed a way to normalize nearly any given input for a configuration parameter on a dashboard. Server side code is in PHP so I wrote a test script to experiment with ...
4
votes
2answers
60 views

Text files: Copy, Rename, Append/Merge together

I wrote 3 subroutines related to batch data processing, they will be used together. A bit of background, I wrote this for my admin colleagues who do not write code. An application dumps daily ...
2
votes
0answers
18 views

Evaluating an expression with integers, +, and *, as well as -, / - revision 3

The original question came from this web site. Revision 1 Revision 2 And this is the third revision. I delete spaces and validate an equation before computing. ...
0
votes
0answers
19 views

Regex to search and replace text in a large file

I am searching for a multiline pattern in a huge file and if found need to replace the contents. I want to accomplish this in a memory efficient way. My current implementation reads text from file in ...
5
votes
2answers
66 views

UPenn Homework 3: skips function

I've started learning Haskell by following along the CIS 194 Course from UPenn. In the first lessons there is talk about wholemeal programming and certain ways idiomatic Haskell code looks like. Now, ...
-1
votes
1answer
31 views

Tidying up code using for loops [on hold]

Using Netbeans to program java code, I completed a tutorial on how to create a matching game in Java which my teacher requested me to carry out. After successfully completing the tutorial and getting ...

15 30 50 per page