All Questions
0
votes
0answers
6 views
Finding the sum with the minimum difference of two numbers
The code reads an input with numbers and find the sum with the minimum difference of the first two big numbers. The sums are three.
Is there is any way to make the code cleaner? (Note that I don't ...
1
vote
0answers
7 views
0
votes
0answers
5 views
Class derived from TXmlIniFile to save/read to/from XML
I have created this unit containing a class derived from TXmlIniFile. This class uses the common TCustomInifile methods to write to and read from an XML file. It comes from an idea of Chris Rolliston ...
1
vote
0answers
7 views
Persisting database row ID between controller actions on a multi-step “create item” form
I have a form on an anonymous site which has 3 steps. A user submits each step individually, in sequence (1-2-3). BUT, step 1 creates a new table row, while steps 2 and 3 only update the existing row ...
-2
votes
0answers
7 views
Repeating Pattern Capture in Perl with “{ }” [on hold]
I'm having trouble implementing a specific number of matches in Perl. I've read all of the documentation regarding regular expressions from various sources, and am at a loss as to why the following ...
1
vote
0answers
7 views
Changing Component Style Best Practice with React
I have a component that I want to render with certain styling based upon the props that it will receive. I'm currently defaulting the prop types, and then creating the styling at render as such
...
0
votes
0answers
14 views
Function Split in Delphi
I have the following split function in Delphi works perfect the problem is I want to improve the code to not use repeat-until more but not that another way to do it.
...
2
votes
0answers
23 views
Git merge script
The branches I need to merge are called test and test-passed. Merging will always be fast-forward, from test to test-passed as commits to test-passed are only done automatically from test. This is ...
0
votes
0answers
16 views
Search box in JavaScript for blogger.com
I wanted to build a search box for Blogspot which goes through every label and filters them so remains just the match and every other label is hidden.
I work with this through the firefox developer ...
2
votes
0answers
15 views
Custom backend app
I'm working on a small custom backend app in PHP for personal use (and practice MVC) and I thought it was a nice opportunity to try (and learn) requirejs to 'organize' my scripts and load just what ...
3
votes
0answers
19 views
Type-safe cartesian co-ordinates
I've recently been fiddling around with a type safe implementation of cartesian co-ordinates (and a few operations on those co-ordinates). Often it's easy to get units mixed up: is something in ...
-4
votes
0answers
28 views
1
vote
1answer
11 views
Depth First Search and Breadth First Search in C++
I am trying to learn DFS and BFS. However, I just want to make sure that I am not doing anything wrong. Would you please determine if the BFS and DFS functions are correct?
...
0
votes
0answers
14 views
Calculating the determinant of a matrix [on hold]
I am working on a project that I needed to calculate the Determinant of a matrix.
Usually, I would just have a class "Determinant" and just calculate that way, but, things have changed and I have had ...
2
votes
0answers
36 views
extremely simple character manipulation
Given a string, this code
Multiplies odd numbers
Subtracts even numbers, do nothing if only one even number is found
Turns uppercase letters to lowercase and vice versa
I think this code is too ...
2
votes
0answers
9 views
Split string in chunks preferable at spaces
I'm working on a tool to import data from one database to another. One requirement is that I have to split a string from one source field into three (shorter) fields at the target. If possible the ...
2
votes
1answer
89 views
Simple streaming parser to extract lines
It is meant to be given strings over time and output all NewLine delimited substrings. The ColumnReader is meant to be a solution for ...
0
votes
0answers
11 views
Building a Raspberry Pi network monitor. My code is not working [on hold]
A little background on me, I have 2 weeks of experience bash scripting on Solaris from a class about 2 and a half years ago, no python experience what so ever till this past Friday. I am a windows ...
3
votes
1answer
32 views
PDO class and security
I have started a project in PHP with PDO and I'm almost done, but I've read somewhere that PDO escape alone is not secure and we have to consider some settings of PDP. I am a little confused about my ...
0
votes
0answers
5 views
Wordpress wpDataTables: PHP serialized array loop through posts [on hold]
has anyone been able to use wpDataTables (wordpress plugin) and the PHP serialized array option to loop through posts?
Here is a basic WP_query I'm trying:
...
0
votes
0answers
12 views
Completed WorkItem List population [on hold]
I have a program where we schedule work items in a queue and process them in background thread one-by-one and load completed work item into a list.
Below is code to schedule work item.
...
2
votes
0answers
36 views
Building an efficient bubble sort function
I've been asked to create a bubble sort function that checks whether the array has been filled sorted before all passes are complete, thereby avoiding unnecessary passes. This is to involve ...
1
vote
0answers
11 views
jQuery UI tabs: navigation thru tabs using active options
I am using jQuery UI Tabs for a web application and I would like to navigate thru different tabs with these four buttons: next-tab: takes you to the next tab prev-tab: takes you to the previous tab ...
4
votes
2answers
47 views
Line passing the most number of points
Given points on a two dimensional graph, find a line that passes the most number of points.
Any comments please?
...
0
votes
1answer
40 views
Implementation of MVC Bootstrap & Factory
Before I get started, I feel I need to list the following.
I am not looking for an existing DI or Framework this is a personal project to shift from procedural to oop programming.
Tear this apart. ...
5
votes
1answer
63 views
Hangman program in Java
Here's an implementation of Hangman using Java 6. I've split the code into 2 classes - a logic class & a gui class. Is it ok to have so many static member variables? Please let me know if there ...
6
votes
0answers
25 views
YAuB - Micro Benchmark Follow-on
Following some great advice here from Simon, I realized that I had over-engineered things, and that the Task builder methods were a horrible Java8 abstraxction. In Simon's words: "From a usability ...
0
votes
0answers
14 views
Working with C++'s Queues [on hold]
So, to teach myself how to work with queues in C++, I started out simple. All I want to do is find the greatest value contained within a queue of integers. When I did this:
...
2
votes
1answer
35 views
Letter Combinations of a Phone Number
I was asked to code a solution in Python in 15 mins. Print all possible word combinations for a given phone number. Numbers 0 and 1 will not be part of the phone number, the numbers can be repeated, ...
0
votes
1answer
22 views
Networkx VS graph-tool
I'm working on graph mining, so I'm trying to find the best library to do that.
I've read in here that "graph-tool" is faster, so I tried the same program who count the duplicated graphs (I call them ...
2
votes
1answer
43 views
Number processing slower with asm.js
I did a few times ago what I called a plasma in plain JavaScript:
jsFiddle
The idea is to use 2 oscillators (LFO) which have their frequency + phase driven by two oscillators each. Then we use ...
2
votes
1answer
34 views
Batch file for looking through text files
I was creating a program and I was trying to explain it to some of my coding friends. They commented that it was too tedious typing out all the "if" commands. How do I streamline this code?
Note: ...
0
votes
1answer
44 views
3
votes
0answers
34 views
Particle class for physics simulation
This is a very lengthy class called Particle, it relies on two other headers, one of them is a simple struct which contains an x and y (...
2
votes
1answer
24 views
Printing simple histogram horizontally
I am new to programming and want to know if this is really bad code. I know my variable names may seem arbitrary but I spent some time trying to get them right. I am struggling on that. Would you do ...
2
votes
0answers
23 views
PDF-to-JSON converter
I've created some methods to help me convert PDF to text and then text to a JSON object. I've never done this before and I'm using this exercise as a way to improve my knowledge of Ruby.
The ...
4
votes
2answers
337 views
Non-recursive method for finding a ^ n
I am working on an interview question from Amazon Software. The particular question I am working on is "to write a program to find an."
Here is my recursive solution to this problem (in Java):
...
4
votes
2answers
103 views
“Set” your expectations low for this ADT
For my third assignment in CS2, I was given the following:
A set is a special bag that does not allow duplicates. Specify each
operation for a set of objects by stating its purpose, by ...
3
votes
0answers
30 views
If a message is there, but you cannot see it, is it really there?
I have created a space encoder program, because it is fun to generate invisible messages. (This programme is not cryptographically secure, it is just for fun)
...
1
vote
1answer
41 views
Palindrome Checker with Stack
In my answer to this question, I wrote a new solution. Personally, I would not use a stack, but given that a stack was required, how good is this solution?
In this solution, I add half of the word, ...
3
votes
0answers
26 views
Creation of Queen Ann's Lace fractal
I've created a program which recreates the Queen Ann's Lace fractal. However, when the amount of points that are being plotted increases, the points are plotted way slower. Is there any way to make it ...
1
vote
1answer
35 views
Loop through object and send analytics code based on objects properties value
The code I have now is currently working, but I'm looking for ways to optimize it, and really, to just get any feedback.
I'm implementing this code through Ensighten (a tag management platform) as a ...
-1
votes
0answers
37 views
How can i make this code more efficient? [on hold]
Problem: I have two lists. For the element at position i in each of these lists, I want to take the minimum of these elements, and then add them up and append the sum to a separate list. In the case ...
1
vote
4answers
49 views
Palindromes with stacks
I'm creating a simple function to verify whether or not a string is a palindrome, and must use stacks in solving it.
...
7
votes
1answer
32 views
Parsing log files of HearthStone: Loading card data without external libraries for JSON
I'm still working on a parser that can parse log entries from a game called HearthStone, the overall idea is that it will read the log file live when the game is running, parses the log file and show ...
0
votes
0answers
9 views
Using global variables in Python unit tests [on hold]
Here's a very simple test in nose
def simple_test():
x = 2 + 2
assert x == 4
Imagine x = 2 + 2 is setting up a test. ...
3
votes
1answer
21 views
Different factorial algorithms
I'm new to Ruby and as an exercise I implemented different factorial algorithms. Other rules are: raise an ArgumentError exception if n < 0 or if n is not an integer.
I'm interested in whatever ...
1
vote
0answers
14 views
Read from DataInputStream (Socket connection)
I am interfacing with a network device and must read a response after I issue a command. Sometimes when I attempt to read, nothing has been returned from the terminal. This means I must wait, but not ...
2
votes
0answers
23 views
JSON extraction
Given the code below, is there a better way to essentially create different native objects without changing the native constructor or the nativeList.json file? The only option I can see is adding a ...
2
votes
1answer
17 views
Refactor two jQuery filter functions into one function
I have two separate lists both sitting side by side. How can I refactor the code below to only have one filter function for both lists?
...