1
vote
0answers
7 views
Lockless SCSP queue
I'm looking for a code review on a class that I've written. It was my first attempt at lockless programming and I'd love any feedback I can get.
...
1
vote
0answers
6 views
notifyDataSetChanged after list update within Fragment [on hold]
I'm brand new at Java and have read a bunch of questions/answers about this but have not been able to find a solution which works.
I have a ListView and when I remove an item from my list (within ...
2
votes
2answers
26 views
Library for C++ programs
Here is some of the code in my library. If there any inefficient things in my code, let me know.
InverseAPI.cpp:
...
2
votes
0answers
15 views
Factory that creates a complex object tree
I've got a complex object tree that I need to instantiate. The object tree is a bunch of specialized classes that don't have a common root object (other than Object) and has generic objects (that I ...
5
votes
2answers
103 views
Stack Implementation in C++
This is my first template implementation. I'm trying to learn C++ and Algorithms. Any constructive criticism on code quality, readability is welcome. Everyone has their own style, but there are ...
1
vote
0answers
40 views
Fast constant time evaluation of “x==7” to 1 (true) or 0 (false) in Java [migrated]
I want to port a crypto function from C to Java. The function has to run in constant time, so no conditional branchings are allowed.
The original C code is:
...
-1
votes
0answers
13 views
PHP USB serial port call from Windows to Linux [on hold]
I have a piece of simple code that works on a Windows - WAMP environment, e.g.
...
3
votes
1answer
24 views
ProductManager: a basic CRUD for products with SQLite
I would like to have a review of this basic CRUD application so I can improve and learn from your experience. The code can be found here.
Design pattern/coding principles improvement that could be ...
2
votes
1answer
16 views
4
votes
1answer
34 views
Find minimum in rotated sorted array
The given code find the minimum element in a sorted array rotated by some fixed distance.
Eg: [1, 2, 3, 4, 5, 6, 7] -> [3, 4, 5, 6, 7, 1, 2]
The elements in the ...
0
votes
1answer
16 views
PHP script to connect to MySQL database using PDO
Introduction
I am preparing to use a basic script to cover how you can connect to a MySQL database using PDO. This script is meant for educational purposes (introductory class on PHP/MySQL) and does ...
1
vote
0answers
13 views
Python GUI for cropping and saving images quickly
I wrote a simple GUI applications to help me select 'positive' regions of a bunch of photos for the purpose of training an object detectir using OpenCV Haar Cascades.
For training purposes, you need ...
2
votes
2answers
13 views
Passing JSON object through loop to be used in jQuery Dialog
I'm wondering if there is a better (cleaner?) method than my current implementation. I'm currently encoding a PHP SimpleXMLObject (USPS Tracking API) to JSON and ...
5
votes
1answer
29 views
Class managing queuing updates from another thread, Version 2
This is an updated version of: Class to manage updates coming in from another thread
Managing updates from other threads into Swing is a hard problem. In MVC design, if you don't want to have the ...
2
votes
0answers
31 views
My own version of a search binary tree
I wrote my own version of a search binary tree in Java. Could someone kindly review it?
...
2
votes
1answer
21 views
A selection pattern for C++11
In simulating physical equations (such as fluid dynamics) it is common to write an application that deals with 1, 2, and 3 dimensions. A common C/Fortran approach is to make all vectors (for example) ...
2
votes
0answers
13 views
Boarding cards route finder
Recently I had an interview project, which I did and sent, so this question is not for avoiding thinking. I am just struggling to build my own opinion about it so I decided to ask in public.
My ...
-4
votes
0answers
26 views
Return lexicographically earliest string [on hold]
Write a function called answer(chunk, word) that returns the shortest, lexicographically earliest string that can be formed by removing occurrences of word from ...
2
votes
1answer
26 views
Plugin Pattern for Generic Python Application
Summary
I am experimenting with a plugin pattern for a generic Python application (not necessarily web, desktop, or console) which would allow packages dropped into a plugin folder to be used ...
3
votes
1answer
23 views
Function that shortens a String based on a term/abbreviation mapping with special cases
This is a update of this question since the requirements for this task changed.
I have a function that takes a description as a String and returns a shortened ...
-5
votes
0answers
14 views
send parameters to server in ios [xcode 6.1] [on hold]
Please help me.
I have to send parameters to the server same as like this.
I wrote this code.But this is not correct format.
...
2
votes
1answer
39 views
Circular array list in C
Now I have this circular array-based list in C. Circularity allows pushing/popping to the both ends of the list in constant amortized time. Inserting/removing at random locations runs in linear time, ...
2
votes
0answers
24 views
Generating an attendance spreadsheet
I have written a Ruby script to generate an attendance spreadsheet. The below part of the code queries data and after few manipulation is saved in a nested hash. I had to implement switch case to ...
1
vote
2answers
138 views
-3
votes
0answers
18 views
4
votes
0answers
37 views
Handling CSRF protection
I'm currently working on an implementation of a CSRF protection. What is the best practice when we detect a CSRF? Is it better to 404 the page, 403 (forbidden), 200 (OK) with an error message, ...
10
votes
6answers
1k views
2048 merge function
From: Principles of Computing Part 1 Course on Coursera
I got -2 pts on my OWLTEST which uses Pylint for style guide. The error states:
Too many branches (17/12)
function "merge", line 7
...
4
votes
1answer
80 views
Abort thread on new request, but complete only last request
The situation is that a certain asynchronous operation is called multiple times, which is basically to consolidate results. But I want to abort every time a new request comes in, which means that only ...
1
vote
2answers
44 views
Implementation of Brent's Algorithm to find roots of a polynomial
I made a program that contains a root-finding algorithm for polynomials as a function and contains 3 test polynomials. The algorithm is Brent's method and is based entirely off the pseudocode from ...
-3
votes
0answers
17 views
Listing product with the fixed numbers [on hold]
My app has a feature to list the fixed number of products(say 5) in the screen.
...
2
votes
0answers
21 views
Ruby-like squish in Haskell
squish is an onomatopoeic string function provided by Ruby on Rails that works on strings.
Given a string, squish condenses all ...
6
votes
1answer
36 views
Recursive search for combinations of words that have a specified MD5 hash
This code solves a challenge problem that a local company is hosting to attract/screen applicants. The link to the challenge is here.
In brief, we are given a wordlist containing approximately ...
3
votes
2answers
250 views
forever.sh - should keep a process alive forever
This script's only responsibility is to keep a process alive. Forever.
It's sole dependencies shall be bash and coreutils. I'm ...
2
votes
2answers
57 views
DeepPtr: a deep-copying unique_ptr wrapper in C++
When using the pimple idiom it is necessary to represent your "impl" as a forward declared pointer in the header file. This necessitates a lot of boilerplate code to implement the rule of five.
...
2
votes
2answers
38 views
C++ Minimalistic Unit Testing Library
I was looking for a unit testing library for C++, and I found many. Unfortunately, I decided I didn't want to use any of them. I decided to make my own.
This is the result. I made heavy use of the ...
1
vote
0answers
32 views
Text-based RPG game in C++
This is a text-based RPG game I've made in C++ and would love some review on it. I am a 100% complete newbie with maybe 2 weeks of C++ experience so I'd love some lessons on what I did wrong and how I ...
4
votes
2answers
87 views
Project Euler 18/67: Maximum Path Sum Solution
I wrote my solution to Project Euler #18 and #67 in C++ (which I'm relatively new to), and was just wondering what everyone else thinks of it. It executes in 3-4ms and works flawlessly (even for ...
-3
votes
0answers
26 views
compare two List(T) via three or multiple properties using LINQ in C# [on hold]
I have a List(T) like this one:
...
2
votes
2answers
37 views
C++ Optional Implementation
I haven't done much programming in C++, so I figured I'd try making an Optional class. I'm mainly concerned that I didn't follow good conventions or that I didn't ...
3
votes
2answers
54 views
Greasemonkey Fantasy Football Script
I have the following Greasemonkey script that fetches some data from a Yahoo webpage and injects it into a webpage. It has the feature that it only fetches the data once per day instead of fetching it ...
6
votes
1answer
44 views
Return Y integer with same bit sets as X & having | X - Y | minimum value
I happened to come across one question:
Given an integer 'x' (Only positive), write an algorithm that returns
integer 'y' such that it has the same number of bits set as 'x' and is
not equal ...
13
votes
2answers
303 views
AngularJS - REST + Authentication service
I have a REST web service that uses OAuth 2 for authenticating and authorizing requests.
I have an endpoint, that when receiving the correct credentials, responds with an access token that will be ...
1
vote
0answers
17 views
`Expand_grid` where not all variables expand within each other
I am trying to further the use of the function expand_grid so that the user can specify pairs (or triplets or more) of variables that won't "expand within each ...
1
vote
0answers
23 views
Vigenere's Cipher in C [on hold]
I spent two days on this, not so much the math, rather char's and int's and converting to get the thing to work.
I was ...
4
votes
0answers
10 views
Moves box in direction of touch, and has wraparound when reaching edge of screen
Part of me thinks that it would be simpler to ditch Apple's move API and just updated position with a timer. I know that's what I did with a JS canvas snake game I built a while ago. But I'm also ...
6
votes
0answers
26 views
Nothing compiler/interpreter, Part 2
Part 1
I've followed some of the suggestions:
Adding newlines to error messages
Implementing options (I decided to use boost instead of getopt)
Using strerror for fstream failure
Allow multiple ...
-3
votes
0answers
27 views
Water volume calculator [on hold]
I'm at the beginning of my Java course, and the instructor gave us this question:
Create a java program that will calculate the water volume of a swimming pool or pond. The basic formula for ...
9
votes
3answers
544 views
Lights on: playing with buttons in Javascript
First play with the game a little bit, and it is quite fun (a little hard but very satisfying when you win, be sure to put it full page):
...
4
votes
2answers
57 views
App settings helper
The helper should be able to set a default value if the value can't be fetched with the provided key. There is also a bool that will throw an error if the key value or the default value could not be ...
3
votes
1answer
22 views