-3
votes
0answers
10 views
This code accomplishes some what of a design
I have understood that design patterns are just some things to be followed but not needed to be . Uhm I have a question as to can this code be done better , it basically is supposed to be somewhat of ...
5
votes
0answers
12 views
Musical Fizzbuzz
I wrote some code using ChucK : Strongly-timed, Concurrent, and On-the-fly
Music Programming Language and would like a review. I broke down the logic into a number of classes, all of which are shown ...
1
vote
1answer
10 views
Calculating average grades
I'm a C# developer looking to learn more about Python and how to think in a more functional programming manner.
I have the following which takes a series of grades and returns the average:
...
-4
votes
0answers
12 views
Ambiguous “Abstract” in type name [on hold]
Recent changes to a compiler projects create ambiguous use of the "Abstract" word in class names.
Particularly, we have class AbstractTypeData which inherits from ...
3
votes
1answer
7 views
Using an Equation from another Equation based on **kwargs
What my code does is that it takes input as to which function to use, and then plugs in the appropriate data in to the given function.
For example:
User input: force(1, density = 10.0, volume = ...
-4
votes
0answers
11 views
Node Insertion in the Binary Tree [on hold]
I am going through the following code of Inserting a node in the binary tree from the following location
...
2
votes
0answers
17 views
Flowers Challenge on HackerRank
I worked through the Flowers challenge on hackerrank.com and would like to get feedback on solution and algorithm implementation. It was suggested by hackerrank to review greedy algorithm to solve ...
0
votes
0answers
18 views
Returning the range of a number as a palindrome
I like to do programming challenges in my free time to teach myself and keep fresh, this one I can't seem to optimize though and it's driving me insane.
The goal is essentially, "Given a number, ...
0
votes
0answers
22 views
Dividing a range into N sub-ranges
Introduction
The function divides a range given by a begin_iterator and an end_iterator into ...
2
votes
1answer
22 views
Sudoku type grid generator
I'm trying to make a program which prints different sized grids (n by n grids).
These grids cannot have the same number in any column or row (like a Sudoku).
My ...
1
vote
1answer
24 views
Custom Prime Sieve
I've come up with a prime number finder I call the "Progressive Sieve". I wouldn't doubt it if this has already been thought of. Anyway, here is the idea, an implementation in C#, and benchmarks:
...
3
votes
1answer
22 views
Function which will fire off a specific template depending on which element is selected
I have this function which will fire off a specific template depending on which element is selected. However, with the way it is, I'd have to update the JavaScript and the HTML when a new element is ...
2
votes
0answers
15 views
“EnumSpace” - enum inheritance attempt using namespace macro
EnumSpace
This file enables the use of a utility I like to call "EnumSpace". This utility is enums and ...
2
votes
1answer
27 views
Find if the prefix of the string exists in the values of the hash table
I have a hash map which maps to some strings which serve as prefixes and are of small length (max length is 6):
...
4
votes
0answers
37 views
Java program to count the repetition of characters in a string [on hold]
I solved a problem recently and I want to check the code I have written is good or is a bad design. Is good or poor in terms of efficiency. The problem is given an input string count the number of ...
0
votes
0answers
9 views
Including the current URL in link querystring
I'm trying to add a link which contains the current URL in querystring (so the user can get back). Middle-clicking, right-clicking and ctrl+clicking should be supported.
Is the below completely ...
5
votes
2answers
33 views
Checking for an undefined nested variable in a JS object
Is there a better or shorthand way to perform a check on whether or not a variable within (possibly several levels of) an object is null or undefined?
What I would currently do to check is:
...
5
votes
0answers
25 views
Find magnitude pole of an array
Please review this code, considering I put emphasis on constraining space complexity at the expense of execution speed (accepting additional branching).
Can you see cases that prove the algorithm ...
3
votes
0answers
13 views
Rosalind string algorithm problems
I've been starting to learn Rust by going through some of the Rosalind String Algorithm problems.
If anyone would like to point out possible improvements, or anything else, that would be great. There ...
2
votes
0answers
19 views
Umbraco Macro-Script to grab Contour Form and Node Properties
When it comes to the Umbraco CMS, there are components called "Macro-Scripts" which are essentially a Razor View (.cshtml). They allow you to code a bunch of C# and ...
2
votes
3answers
51 views
Calculating revenue from roller coaster rides
Problem description:
The task is to calculate the amount of money earned from roller
coaster rides on any given day. There is a queue in front of the
attraction. Visitors might be alone or ...
5
votes
1answer
58 views
System backup on Linux
I've written this Python script to make regular backups of a Linux server. It works pretty well except that the script sometimes backups files more than one time, which is pretty strange and I don't ...
-4
votes
0answers
26 views
Read lines of a text file in java [on hold]
I am trying to get my code to read the lines of a text file. It does not seem to be working.
...
-4
votes
0answers
28 views
1
vote
0answers
16 views
First Element not being extracted right in a Max Binary Heap [on hold]
I implemented a Max Binary Heap. However, When I extract the values, the first element extracted is wrong and the values after that are extracted correctly. As a matter of fact, the first element ...
5
votes
2answers
382 views
Thread safe logging class in C# to use from DLL
I tried to sample up a logging class from this question and answer(I want to use this class from C# DLL).
Made slight modification mainly to file name, and also how data is written.
I am interested if ...
-7
votes
0answers
17 views
Output not what expected [on hold]
Expected output: arr[0] = 10, arr[1] = 20, *p = 10
Output encountered: arr[0] = 10, arr[1] = 20, *p = 20
Code:
...
3
votes
2answers
34 views
“Tractor” Python implementation
Problem Statement
Bessie the Cow has stolen Farmer John’s tractor and is running wild on the coordinate plane! She, however, is a terrible driver, and can only move according to the following ...
3
votes
0answers
9 views
SQL with SUBSTRING / CHARINDEX
I've got a VARCHAR variable of this kind:
@string = "BLABLA10;GOGOGO30;RES777;ANOTHER;"
(several keyword + number separated ...
3
votes
1answer
41 views
Converting string to dict using Python ast library
I have been trying to convert a string of dictionary objects as given below
...
3
votes
1answer
39 views
Simply implementing a repeating HTML form with a total
Since the repetition mode didn't make to HTML5, I was wondering how to succinctly implement it in Javascript. I've already spent a few hours on this jsbin. Be great to get a review.
...
-1
votes
0answers
30 views
Program to computer smallest number of notes of a given denominations that will combine to give Rs. N [on hold]
The question has been put up here :
Codechef problem : Smallest Numbers of Notes
Here is my code :
...
5
votes
1answer
35 views
MVC app to associate users with roles
I'm a beginner to web programming and just started a MVC project from scratch. Because this will become a large project eventually, I would like to make sure that I'm doing things kind of right from ...
2
votes
3answers
62 views
Related classes around generic types
I'm wondering if this code can be simplified. I'm less than thrilled about the fact that I repeat the Draw method in both CatModel and DogModel. For that matter, I'm not real happy that that method is ...
5
votes
1answer
120 views
Early Binding with Generics
I have a class which takes the method address and arguments, and executes it later when told to do so.
...
8
votes
3answers
652 views
ROT47 Implementation
ROT13 ("rotate by 13 places", sometimes hyphenated ROT-13) is a simple letter substitution cipher that replaces a letter with the letter 13 letters after it in the alphabet. ROT13 is a special case ...
2
votes
1answer
25 views
“Cut the sticks” Python implementation
Problem Statement
You are given N sticks, where the length of each stick is a positive integer. A cut operation is performed on the sticks such that all of them are reduced by the length of the ...
1
vote
0answers
14 views
Downloading and reading data in go
I am trying to experiment with golang.
This code spins off two Go routines: one to download data and another to read from the body. Both go threads are synced by the data channel.
I have two ...
-3
votes
0answers
20 views
Find greatest common divisor using recursion [on hold]
My problem is that my code doesn't work in DEV C++.
...
1
vote
1answer
43 views
Check if coordinates lie on the same line [on hold]
I'm trying to aim for the right amount of understandability, verbosity, and of course, correctness. I'm assuming that inputs are all integers and are valid.
...
3
votes
1answer
46 views
Basic console video game
This is my code for a very basic video game I created today. I did not create this to be a fun game to play. I created this to test my skills on conditional coding, etc. Please critique this.
...
1
vote
0answers
10 views
Parse JS Cloudcode converting string (links) to files
I created the following cloud code to convert Images (links) into 'files' that Parse can store.
It works- but is incredibly slow for some reason. Can anyone help me review it and speed it up?
...
0
votes
0answers
9 views
Forth to the past - mergesort preps
Still oiling my Forth. Below are few essential algorithms for in-place merge. Please review.
Some introductory comments:
>swap< is not a cute smiley. I am ...
-4
votes
0answers
25 views
C++ Basic Video Game Code Suggestions? [on hold]
I am a freshman in high school and I started a C++ programming class about 2 months ago and have decided to go ahead of my class and study strings, if else, etc. Since I have decided this I have begun ...
-2
votes
0answers
15 views
MySQL - rewrite a heavy multiple child-nested queries query
I'm on a task to improve an app's DB query. This heaving-loading query takes roughly 3-5 minutes to complete which is unacceptable.
The previous developers built this query and they didn't do this ...
-2
votes
0answers
10 views
How to add cost edges in DAG? [on hold]
In directed acyclic graph (DAG) each edge has some weightage to process. my given problem of DAG how to give weightage for each edges, in given form i mentioned in below
...
4
votes
0answers
46 views
Sum data that needs to be joined and grouped by
I have a list of patients, Patient class has Prescriptions property, which is a list of ...
7
votes
3answers
302 views
Determine if a binary tree is balanced
I'm currently running through some Cracking the Coding Interview questions and my solution to 4-4 is quite different from any of the given solutions.
The question asks to determine if a given binary ...
-1
votes
0answers
44 views
Slow C++ in house mathematical formula calculation method [on hold]
I have this formula calculation in my C++ codebase that gets called in a tight loop. I'm quite interested what would be possible to help speed this code up without knowing the formula? I can't really ...
1
vote
1answer
25 views
Euler #25 Scala
I usually write Euler solutions in Javascript. On problems requiring very large integers I have decided to learn Scala and take advantage of BigInt. I wrote a ...