3
votes
1answer
10 views

TDD for Euler Problem #4

I am in the process of learning Java and going through the Euler problems. For Problem 4 I decided to also implement a TDD approach with JUnit. My questions are: Is there a better TDD approach to ...
0
votes
1answer
11 views

Quick sort in PHP

Does this code show proper implementation of bubble sort algorithm? If not, why? Can this code further be improved? ...
1
vote
1answer
10 views

Converting from base-10 to word

The following code is used to convert a base-10 number to a base-N number, where N is a length of a given alphabet that contains characters of which a base-N number ...
2
votes
2answers
39 views

Optimization of stack frame usage with recursion

For the given below exercise: Here is one method to check if a number is prime: ...
-1
votes
0answers
6 views

batch rename files recursively to user entered depth of sub folders

Please review the code I am looking for improvement in terms of performance and testability. ...
2
votes
1answer
10 views

Sum of multiples of 3 or 5 below N

How do I improve speed of this code? The problem definition is "Find the sum of all the multiples of 3 or 5 below N". ...
1
vote
0answers
13 views

Reducing lock contention for a caching utility, or make it totally lockless but threadsafe

My Java program is a module called configProxy which fetches configuration entries from a remote node (say from a Redis instance). When the caller calls the ...
2
votes
1answer
14 views

loopification of highly procedureal, though fully functional, multiclass perceptron

I've implemented the multiclass perceptron in the one vs. all style. I just thought about it and tried to implement it in the most basic way. I think it's correct though my f_measure is a bit low. ...
-1
votes
0answers
10 views

Delete rows when cell in column C meets search criteria (text) [on hold]

I want to perform this functions in this order: Activate auto-filter function In column M, tick 'deposit reversed' and 'blank' Delete entire rows for cell that contain 'AQ*', 'AI*', 'BG*' in ...
3
votes
1answer
21 views

AsyncTcpClient (Asynchronous TcpClient)

I've been doing network programming using C#'s TcpClient for several years. The code below is an asynchronous wrapper for ...
4
votes
3answers
63 views

Stack Implementation in Python

I have written a simple stack implementation and would like some feedback as to what I could improve in my code and coding practices. ...
4
votes
2answers
35 views

Moving chips between cells

Challenge: You are given a line of N cells with positive integers written in them. Initially a chip is placed on the leftmost cell. Each time it can be moved in any direction (to the left or to ...
1
vote
0answers
12 views

Entering base characters one-by-one for a List [on hold]

This function should prompt the user to enter bases characters (a, g, c and t) one-by-one and then insert them in the List. ...
3
votes
1answer
17 views

PHP contact form

I recently had my site hacked, with the main index file being overwritten (nothing else was touched). I'm assuming they hijacked my form input. Are there any vulnerabilities in the code or does this ...
0
votes
0answers
9 views

The following code should Blink an LED as a function of an input frequency [on hold]

I wrote a code to blink an LED using PIC 16F17889. It compiles using MPLAB X but nothing happens on my board. I set the frequency to some value to test it but the LED doesn't blink at all. I dont know ...
0
votes
0answers
62 views

Indexed Properties in C# [on hold]

Someone on IRC asked the question if C# supports indexed properties, the answer of course being no. We then came to two very different implementations of this concept. ...
1
vote
1answer
34 views

Selection handler for color picker

At some point, I have this function which updates a color picker according the the mouse position, according to whether the user clicked a mouse button and according to its previous state: ...
3
votes
1answer
16 views

OVH email manager script using docopt

This is what I coded to realize a command line program to make it easier to manage emails on ovh shared hostings. It's working ok but it seems ugly. I'm a beginner with Python and ...
6
votes
2answers
144 views

Beginning calculator program

I am a beginner in Java and programming at all. I decide to try to write a calculator, as a my first "complete" program. It works for me, however I am curious is it worth anything in reality. I would ...
1
vote
1answer
21 views

Hash read/write/delete functions

Here is my JavaScript function to manipulate the hash: ...
4
votes
2answers
62 views

bash script for constructing RNA pipeline

I have written a bash script that consists of multiple commands and Python scripts. The goal is to make a pipeline for detecting long non coding RNA from a certain input. Ultimately I would like to ...
3
votes
1answer
29 views

Square spiral matrix

I've written a Python script to generate the closest square spiral matrix to a given number. I'm new to code reviews as a practice, and I'm interested in ways to improve. Please suggest improvements ...
6
votes
2answers
294 views

C++ Linked List Implementation

I'm learning C++ and also about data structures, so I am trying to implement some. This is my linked list. I've included two different ways of getting the length of the list, with a ...
5
votes
1answer
43 views

Adding ranks to objects in an array

This works, and I personally find it elegant and kind of "neat," but then I worry it's a bit too tricky. Comments welcome: ...
3
votes
1answer
27 views

Factors sieve optimization

I have written a more powerful version of the sieve of Eratosthenes: this sieve returns the number of factors of all the numbers below the limit. Sadly the running ...
7
votes
1answer
182 views

Let's Break Down the Party

This is a rags-to-riches question, the original is here: Coin dispenser program There are three parts to this, a Denomination ...
1
vote
0answers
13 views

Erlang handling errors in concurrent programs

I have two tasks: Write a function that starts and monitors several worker processes. If any of the worker processes dies abnormally, restart it Here is the code that I built: ...
0
votes
0answers
4 views

Design of actions handlers requiring some order [migrated]

I have a REST application where 'actions' can be executed to perform anything in the system. For example: user.save, user.get, etc... I also have pre and post execution 'handlers'. For example a ...
3
votes
0answers
38 views

Script to upload CV with cookie control

I have created a script which presents a popup on every 5th pageview. I would like to try to use just php cookies, however due to the requirement of setting them beofre any content is output, its ...
3
votes
0answers
12 views

Laravel controller for a commenting system

Can someone review my Controller? I should follow these guidelines: Code should be written with MVC pattern and to use OOP. The code now works fine, but I need to improve it. Also, should I use ...
3
votes
2answers
45 views

Function returning higher order function

For the below given exercise: Define a function cycle which takes in three functions as arguments: f1, f2, f3. cycle will then return another function. The returned fuction should take in an ...
0
votes
0answers
11 views

Stream file to opencsv with the least amount of I/O possible

I have the following code snippet where I'm picking up a file from an ftp server and then streaming it to opencsv. I have very little experience with streams, so I'd like to have someone review this ...
6
votes
2answers
50 views

“Lost in the Woods” text-based game

This is my first Python text-based game. Let me know if there's something I should improve on or fix in the way that my code is written because I feel that I am being very redundant in my code but I'm ...
1
vote
0answers
17 views

Custom forum paginator for navigating through topics

I've made my own pagination service for my forum that I'm working on. I'm quite happy how it turned out but it feels a bit rough around the edges so I would like to know how I can shorten this code ...
1
vote
0answers
10 views

Is it okay to use Twitter Bootstrap columns without wrapping them in rows?

I have code that dynamically adds blocks of information to my page. I don't know in advance how many blocks there will be. I want to utilize Twitter Bootstrap (3.x) to layout them in three columns ...
0
votes
0answers
22 views

Skidding car animation [on hold]

How I can do a better calc on this lines: ...
0
votes
0answers
7 views

popup pictures in a Front end javascript website [on hold]

I am looking for some help to solve a problem that I am having... I am playing around with a template I found online and I am trying to use another JavaScript script on the template to change the ...
0
votes
0answers
16 views

java.lang.NumberFormatException: For input string: “” [on hold]

This is my code and i am frustrated by the error: ...
-2
votes
0answers
16 views

C# Fouier Series Calculator, q is not calculated, only shows a zero [on hold]

namespace Tutorial_3_3 { public partial class Form1 : Form { public Double x1, x2, t1, t2, k, a, q; public Form1() { InitializeComponent(); } ...
0
votes
0answers
30 views

Type checking at runtime

For the below given exercise question: Many procedures require a certain type of argument. For example, many arithmetic procedures only work if given numeric arguments. If given a non-number, an ...
0
votes
1answer
25 views

Network Send and Reply

I have developed a TCP listener to receive messages from a client machine, take that string and put it in a db, then send back a response with some data relating to that string. First attempt at a tcp ...
2
votes
1answer
28 views

SQL Dependency with Broker

I have written a windows service for one of our local servers. This service works like a gem on my local machine, does what it's supposed to (ACCP to exchange db data), but I'm not overly familiar ...
1
vote
1answer
16 views

NumPy eliminate double loop

How can I vectorize this code snippet and eliminate this double loop? Even with "only" 1001 elements in a this takes almost 30s. ...
0
votes
0answers
10 views

Designing a Solution for generalization and future scope with Inheritance [on hold]

I have below code/classes/interfaces with me: An Interface: public interface Animal{ void fight(A otherAnimal); } 2.Tiger class which is implementing Animal ...
1
vote
1answer
11 views

Implementing a Trie in Python using lists alone

I've been working on implementing a Trie in Python for educational purposes. I tried implementing one using dictionaries and I was successful; find below my attempt at implementing a trie using lists ...
4
votes
2answers
257 views

Amazon web scraper

I am trying to improve my programming and programming design skills (poor at the moment). I created a small Amazon scraper program. It is a working program. I would be very grateful if you could ...
1
vote
1answer
32 views

Interface injection and common functionality between classes

I'm trying to get my head around the OOP principles and coding my own classes. As a means to learn, I have decided to convert a couple of functions I have written in Wordpress to OOP classes. These ...
1
vote
0answers
29 views

Generating a histogram efficiently from the datasets in a Map

I have a map in which I store total bytes as the key and count of users as the value: ...
1
vote
0answers
14 views

Conway's Game of Life in Python3 (follow-up)

I asked for a review of my code, and after making the suggested changes I feel that now the OOP version is clearer in its meaning and overall the code looks cleaner. ...
0
votes
0answers
11 views

Calculate Parking Hours using javascript functions [on hold]

This is the full question Write a complete for charging the parking fee for each customer based on the number of hour parking. Ask user to enter the total hour using prompt() Calculate the ...

15 30 50 per page