All Questions
0
votes
0answers
2 views
First try PDO connection via INI parser classes
A few days ago I asked this question and i've got an answer to work with interfaces. I've tweaked around with this to get myself a INI parser class.
...
0
votes
0answers
4 views
How to keep variables in scope with JS Module Pattern and Jasmine?
I am looking for some pointers/feedback on how to write better modules and simple tests.
This is a simple module which displays (unfortunately an infame for now — yes I know it's bad) the user's cart ...
2
votes
0answers
24 views
Primality test recursive function
I'm working on a primality test and have written a recursive function that returns the value of the function
\$b^{q-1} \bmod q\$
where \$3<= q <= 32000\$
Is there any way to speed up ...
0
votes
1answer
22 views
Removing whitespaces in a string
I wrote this function to remove whitespaces in strings. Please help me improve it. I intended to use the function for a Big Integer ADT.
...
3
votes
1answer
75 views
Find repeated substrings of length 3 in a string
The following method receives a string and finds all occurrences of repeated substrings with a length of three characters, including spaces. Is this a good approach?
...
1
vote
0answers
15 views
Unity Dependency Injection
This is my first time using Unity so bear with me for a moment. I have a sample Visual Studio 2012 project with 4 projects (but only two of these projects will be used with Unity). This is the ...
5
votes
0answers
24 views
Sorting algorithms with utility functions and iterators
My implementation of insertion, merge, and quick sort, with some utility testing functions. I just wanted to know how I can improve the efficiency and general cleanliness of my code.
(note: I know ...
3
votes
1answer
14 views
Unittests for CashFlow object
I'm just writing a small unittest to test for a hypothetical library and object, as a way of predefining the behavior, perhaps both as an acceptance test and for unittesting as well. As I'm writing ...
0
votes
0answers
17 views
C-string reading/writing from socket
I need to handle C style ('\0' delimited) strings from/to a socket and came up with this as a first attempt:
...
5
votes
1answer
68 views
Breadth First Search not SOLID enough
The following code has a modified version of the Breadth First Search algorithm. It not only visits the nodes, but keeps track of the paths, so I can output various messages later. I would like to ...
-4
votes
0answers
19 views
Rebuilding old website [on hold]
I have a very old (1995) and content rich website with a huge amount of various and inconsistent templates that I need to rebuild.
What are the tips and tricks for doing that, considering that I ...
0
votes
4answers
51 views
5
votes
1answer
31 views
Text adventure and global variables
I'm working on this little text based game. Up to this point, I've gotten it to work, however I've heard I shouldn't be using global like I am. I have this set up to modify the global variables ...
4
votes
3answers
251 views
String compression implementation in C#
I wrote a method that reduces a string like aabcccccaaa to a2b1c5a3
My implementation:
...
3
votes
2answers
24 views
Assigning database credentials
I have a config.ini that contains my database credentials. I retrieve them with a parser class like this:
...
2
votes
0answers
21 views
Finding the Cox regression coefficients in a mixed model for microarray data
I have written a code for a project which aims at finding the Cox regression coefficients in a mixed model for microarray data. The study was carried out on the Affymetrix Hgu133a platform. In the ...
-3
votes
0answers
26 views
Rewrite custom query into django's query language [on hold]
I have this special method written by a friend and I don't know how to write it using django's query language.
I want to order my Projects by the lowest datetime ...
3
votes
1answer
95 views
Security flaws in smartphone application
And could you give me any security and optimization recommendations?
...
2
votes
1answer
31 views
Project Euler Problem 57 in Haskell
I'm very new to Haskell, and I would like some feedback on my coding style. Is there anything here that could be made more elegant or concise?
This is my solution to Project Euler Problem 57.
It ...
0
votes
0answers
10 views
Logic based on modified fields of a Hibernate entity [on hold]
I have a Hibernate entity object MyObject with several attributes and a service MyObjectService containing business logic ...
3
votes
2answers
61 views
Implementing faster StringBuilder that only works with ASCII strings
I wrote a StringBuilder that works only with ASCII strings. the current append performance is almost identical to BCL StringBuilder append performance. I want some tips on how to make it faster, and ...
0
votes
0answers
29 views
A (basic) Knights and Knaves Solver
In case you're not familiar with Knights and Knaves, it's a classic type of logic problem.
Here's an example:
"A very special island is inhabited only by knights and knaves. Knights always tell ...
4
votes
1answer
40 views
Parse floats from a string
While fixing some old code I came up with a class that parses floats from a string.
This is used for parsing svg files in xml format. Floats can be separated by comma, space or anything at all in ...
0
votes
1answer
25 views
Queue with task parallel library
I am new to programming using the .Net TPL Framework and multi-threading in general. I have googled up some tutorials and articles and put together the solution below.
It is a simple multithreaded ...
5
votes
5answers
401 views
Is this queue properly implemented?
I tried to implement a queue which stores it's elements in a resizing array. Seems to work fine. Can you tell me if i did something wrong?
...
1
vote
0answers
35 views
Supporting Enum in EF 5 with .Net 4.0 (Visual Studio 2010)
I'm currently working through Getting Started with EF5 using MVC 4 in Visual Studio 2010 (.NET 4.0) to learn about how to use ASP.NET and Entity Framework. During the beginning of the tutorial I ran ...
-1
votes
0answers
35 views
0
votes
2answers
66 views
Request Response pattern in C#
I have created a C# library that can send commands to a device and process the command specific responses and broadcasts over a serial port (or other communications method).
The library must also be ...
2
votes
0answers
35 views
8
votes
2answers
112 views
Threadsafe HashMap with snapshot support
The problem
ConcurrentHashMap provides very weak consistency guarantees w.r.t iteration:
guaranteed to traverse elements as they existed upon construction
exactly once, and may (but are not ...
4
votes
1answer
358 views
Maximizing XOR HackerRank challenge
I know that there are combinatoric libraries for this kind of thing. However, with me being new to C# and coding in general I found that I couldn't understand the code well enough to implement it in ...
1
vote
1answer
39 views
Doubly circular linked list implementation with successive update in O(1)
For the queries mentioned in link in 3 parts, the first two parts have been addressed, as mentioned below:
Part I (6 points)
list/DList.java contains a skeleton of a doubly-linked list class. Fill ...
4
votes
1answer
33 views
CodeEval Sequence Transformation
I've been working on this challenge for a week:
There are two sequences. The first sequence consists of digits "0" and "1", the second one consists of letters "A" and "B". The challenge is to ...
4
votes
0answers
41 views
The Functional FizzBuzz Kata
I run a coding dojo at work. For one session I'm to showing that you can use a kata to get into a new language.
I'm using the FizzBuzz Kata to to show F# (and JavaScript) because it is short. The ...
8
votes
2answers
383 views
The Scripted FizzBuzz Kata
I run a coding dojo at work. for one session I'm to showing that you can use a kata to get into a new language.
I'm using the FizzBuzz Kata to show JavaScript (and F#) because it is short. The ...
3
votes
2answers
451 views
Exception handling best practices
I'm actually working on a piece of code which use the following code:
...
0
votes
1answer
42 views
Python encapsulation [on hold]
From objective and functional standpoints, how can I clean this up so that it doesn't feel messy and hackish?
...
-3
votes
0answers
56 views
a console program that calculate a math equation input: example 5-2*3/3 [on hold]
When run with the equation in the title, the below stated program returns 15,6666666666,
mathematically 3 is the correct solution.
What's wrong in the code?
...
-1
votes
0answers
24 views
WebGL Directional Lighting - Lighting a cube (lighting not working properly) [migrated]
I have been rewriting this code a few times now, but the same problem with the lighting appears... I am comparing this code with the code I wrote a few months ago that does the same thing (lighting a ...
3
votes
1answer
71 views
Automagic (or not quite so) Domain Model Class Validation
The Task
I was assigned a small task, concerning validation of Domain-Model classes.
The Validation for a String property of one of our Models was required to be unique across the whole Table. And ...
2
votes
1answer
165 views
Call html() on two jQuery selector objects
In my webpage I have two places where I need my JavaScript to write dates. How to do it in one go?
Selectors:
...
6
votes
3answers
94 views
Single inheritance polymorphism
I am learning about polymorphism in C++ and decided to implement an example. Is there anything I need to fix in my code? This compiles and runs.
...
8
votes
1answer
525 views
Piano app in Swift
I'm making my first app in Swift: a Piano app. I'd like to get your feedback especially about how I can make codes shorter. I maybe have to use arrays and loops and something, and searched by myself ...
0
votes
0answers
19 views
overriding Iterator<> [on hold]
I'm having trouble understanding the idea of overriding and interfaces. First of all, this is hw and I'm only asking for guidance.
I am given the following interface with some methods to implement
...
5
votes
1answer
39 views
Example of a Multithreaded C program
In answering password cracker in c with multithreading, I ended up writing a sample in C, which is not my forte.
Is there anything that I missed which should have been included in a responsible ...
4
votes
1answer
32 views
Pygame menu to launch games - follow up
Follow up of Pygame menu to launch games
I rewrote most of the code per the one answer. I'm looking for further advice to improve to the code. I'm afraid some of the abstraction may be too java like. ...
-1
votes
0answers
12 views
validate javascript quiz and count ansers [on hold]
I was wondering if anyone could help me out. I am having trouble figuring out my Javascript code. I'm still learning all of this (im not the best at it, so dont be harsh). Theres a couple things I ...
3
votes
2answers
79 views
Efficient mechanism to generate operator overload functions
I'm attempting to tidy up a C++ framework (PyCXX).
One particular file contains ~400 lines of operator overload functions, which I've managed to reduce to the following:
...
1
vote
0answers
18 views
Factors of a number [on hold]
For practice in my programming class I tried to do a problem from the book but I am having a little trouble. The book told me to create a program that shows the factors of a number you would input. I ...
-3
votes
0answers
24 views
Basic VB admission code does not work [on hold]
Here are the codes for College Admission, but no matter how many times I click and try, the list will only be "Not Admitted", what is wrong with my code?
Public Class frmAdmission
Private ...