All Questions

1 view

Implementing classes that should behave as Optional

Imagine finding out if two shapes intersect. An intersection of two shapes may be either another shape, or nothing. I believe, the proper object-oriented solution would be: ...
3 views

From VBA to R: what can I use in R that does the same as ReDim in VBA?

I am currently working with the explicit finite difference method and I have a code for this method. The code is written in VBA and now our teacher wants us to write the code so that we can use it in ...
4 views

Prefix- and z-functions in C++ (string algorithms)

Let us define prefix-function(string)[i] as the length of the largest prefix of string, which is also a suffix of string[1..i], and z-function(string)[i] is the length of the largest prefix of string, ...
9 views

console.log() 'relay' to the document

This is a very complicated code, with the goal to show all the messages sent to console.log() on the document or another element. The code simply replaces the ...
13 views

Button presses counter

I'm moving on to graphics, picking Pyglet and Cocos2D. This is my first program in Python with GUI. Introducing: Two distinct high definition button sprites. Satisfying high quality button pressing ...
52 views

Brute Force N Body Implementation in c++

I have wrote the following code in c++ for n-body problem. This code is sequential as later on I am planning to parallelize it using openmp. I want to know whether I have wrote the correct ...
26 views

Is it safe to aquire an id from a newly inserted entry in MS Sql Database like this? (c#)

In an MSSQL Database, i have automatically increasing ids for every entry. Is it safe to aquire the id of the newly inserted entry like this? I am worried that, if at the exact same time another ...
15 views

Suffix array construction in O(nlog^2(n))

Here is my implementation of the suffix array construction algorithm which follows this paper (specifically, pages 4 and 6). ...
16 views

Switching between several animations

I am making a game and my main character has many different states. Every state has different animations, for example ducking, flying, jumping, walking, hit by enemy etc. ...
26 views

Emulating Conway's Game of Life using JavaScript

I am currently reading Eloquent JavaScript and am trying to solve the exercise problems. One of the exercises in chapter 18 asks to emulate Conway's game of life using checkboxes in JavaScript. ...
12 views

Starting a Clojure Chess Engine

In my journey to learn Clojure I recently decided that I would like to write a chess engine, which is kind of funny because I don't really know chess either. ;-) My goals are to learn Clojure and ...
17 views

Coderbyte longest string [on hold]

So I am currently working on a problem set for Coderbyte and I cannot seem to figure out why my code is not returning any value at all. JS lint is not seeing any issues with, but when I run the code ...
24 views

A Virtual Piano

I have created a virtual piano that turns the home row (excluding 'g' and 'h') and the top row (excluding 'y' and 'u') of the user's keyboard in a piano's keyboard. The home row is used for white ...
19 views

Python TKinter data entry window GUI for SQLITE3 table

I would like to offer for review a simple tkinter GUI window in Python 3 to be used for data entry into an SQLite database table. As a noob, this is my first attempt at OOP and my first experience ...
27 views

...
39 views

Stanford CS106A Min / Max program

I am learning Java through Stanford CS106A and I'm wondering how the code for this early assignment looks. I've worked in a proprietary scripting language before and so I'm trying to get the right ...
19 views

Suffix tree implemenation in java

I was trying to solve the problem where given a larger string and an array/list of smaller string, we need to make the determination whether the larger string contains each of the smaller strings. I ...
44 views

The effect of typing a sentence out

The following code is complete and works perfectly. What I want to do to is make it more modular in a way where I can use the code again - similar to an api. I also hardly ever code in javascript, ...
12 views

Hashmap in Java [on hold]

Im trying to use a HashMap to do a project where i read in a list of jumbled words and a file of actual dictionary words and use a HashMap to find all the words that match in the jumbled words file an ...
35 views

Iterative tree traversal to turn tree into a dictionary and list

I am trying to iteratively turn a tree into a list. For example: c1 c11 c12 c111 c112 The tree above ...
111 views

JPaint (Java painting app)

I have this painting app called JPaint in Java and I'm wondering if it could be improved. The variable declaration seems repetitive and long, and I think it might ...
15 views

...
21 views

Minimal Map implementation with weak values

What follows is an implementation of the java.util.Map interface with weak values. This means that entries should be removed from the map when their values become ...
15 views

Excel Laboratory Data Entry from Python 2.7

I've written a script to automate the entry of laboratory instrument data into an Excel spreadsheet using pandas and win32com. I've got the script functioning correctly, but it is painfully slow. In ...
22 views

SecureString as SqlParameter value without GC concerns

The purpose here is to make it easy to use sensitive data that is already in the form of a SecureString (example) without converting it to a ...
12 views

Travelling Salesmen Problem - Dynamic Programming

I wanted to review my TSP program for correctness in my approach, although I have not implemented one function subset which would be simple. ...
20 views

Markle-Hellman Cyptosystem [on hold]

I have converted this code from Java to C#, but I do not understand the entire code, especially the masking. Please tell me how I can make the Encryption and ...
29 views

Throwing exceptions in a database wrapper

I hope the extension methods ThrowArgumentNullExceptionIfNullOrEmpty and ThrowNullReferenceExceptionIfNullOrEmpty are ...
18 views

Starting multiple Bitcoin daemons [on hold]

I've written following bash script in order to start multiple instances of a programm daemon (bitcoind = Bitcoin daemon) starting upon multiple independent conf-files: ...
14 views

Web API using Repository / UnitOfWork

I'm looking for feedback on a repository I set up based on a blog post I read here. I have just recently got more into .NET within the past year, so any feedback and/or best practices that can be ...
38 views

Generating letter combinations

It's about two months since I posted this question on CodeReview. I've been working hard to improve the code posted there and came up with the following. ...
21 views

Optimized board representation for the 4x4 sliding puzzle

Inspired by this question and my answer to it I told myself I could try an optimized version for a 4x4 puzzle. There are only $16!$ possible states, so the state fits into a single ...
14 views

Backbone/requireJs and circular dependencies

I'm trying to have a main App view with references of all my views to manage and call transitions between theses views. But, I have circular dependencies. app.js ...
46 views

Guess the Number Game in Python

I have been using Python to learn programming, but I am just recently beginning to utilize classes. I have a basic game below. Please review and let me know what I should improve on. ...
13 views

DAO layer in Spring application [on hold]

Let's say I have a Java web application driven by Spring and Hibernate. Let's discuss only about DAO layer. So instead of writing DAO interface for each implementation class I decided to write one DAO ...
19 views

LiveDate version 2

LiveDate has the ability to display the current date either by asynchronously fetching the time from a server or by just using the client system date. It's only as ...
23 views

Creating a hexagonal grid [on hold]

The objective of this code is to create a hexagonal grid (honeycomb type). This code is written by a friend and it contains lots of junk that do not contribute towards the objective. ...
17 views

1st questions with answers within X hours

I recently challenged @Hosch520 with writing a query as such: Find first questions with answers posted within 24 hours And he did great. I figured I would have a go at it too. Turns out I ...
27 views

Simple, functional URL parsing library in Clojure

I recently wrote some code to handle parsing of URLs, even if those URLs might not be one hundred percent perfectly well-formed. (This constraint made using Java's ...
102 views

I am implementing, in my SinglyLinkedList class, an interface where I redefined linked list. I am trying to learn data structures. Please, let me know what I can ...
65 views

WinForm Calculator

I'm looking to get this cleaned up. ...
37 views

Natural mergesort

This is a problem from Robert Sedgwick's Algorithms book: Write a version of bottom-up mergesort that takes advantage of order in the array by proceeding as follows each time it needs to ﬁnd two ...
26 views

Creating a game of Checkers in C# [on hold]

So I am having a tough time understanding how to get the program to read my inputs via button presses for each cell. It's a more of a primitive checker game, but I seem to be getting super confused ...
39 views

MVC N-Tier Architecture

I am working on a new MVC web application, so the project is in early stages. I have created 4 projects. Let me explain what they do: Common --> contains all my DTOs, enums helpers, ViewModels ...
35 views

...
34 views

Registering a plist to NSUserDefaults

I've been struggling with registering a plist into NSUserDefaults and I've finally got it working, though I'm not sure that its written properly. I'm hoping someone ...
33 views

Filtering multiple large (>2gb) csv files with stock prices

I have a set of pretty large files (>2 GB, over 30m rows) containing intraday data in the following format: ...
11 views

Send Ajax Request Function v2

I would like to get a full on review on my sendAjaxRequest function. Suggestions for any improvement are always welcome! sendAjaxRequest.js ...