All Questions

-2
votes
0answers
5 views

A better way to organize my test functions

I'm writing a software application of a few thousand lines of code (in Python), and in order to keep the whole thing together, slowly but certainly the need for unit tests (and later, other types of ...
3
votes
0answers
11 views

Assigning projects in order of priority

Let's assume we have the following situation: Multiple project topics exist, each corresponding to a natural number n, students can sign in and choose two ...
0
votes
2answers
30 views

Stable-sorting all even numbers before odd numbers in a linked list

Given a Linked List of integers, write a function to modify the linked list such that all even numbers appear before all the odd numbers in the modified linked list. Also, keep the order of even ...
-3
votes
0answers
12 views

A controlled ageing system in Python EDIT: Wrong place, sorry [on hold]

If someone can delete this I put it on the wrong website! I didn't realise I was logged into stack exchange and not stack overflow... sorry guys. I'm an absolute beginner to python, this is my first ...
2
votes
1answer
21 views

This technique for functional programming, and testing functional programming, in javascript

I've been playing around with functional programming and testing with jest recently. An issue I've run into, is that it's hard to mock ES6 module exports directly. See this Stack Overflow question ...
-3
votes
0answers
24 views

Better coding practice: Declaring a variable or directly use it? [on hold]

This is code List<Data> listOfData = DAO.getInstance().findbyId(Id); listOfDataBos = BoHelper.wrapList(listOfData); Here we are creating a reference and ...
1
vote
0answers
29 views

Simple c sharp calculator

I'm doing simple calc for my school. Code looks okay to me, not sure if there is something to improve, but probably there is always something to improve. Any ideas how to make it look and work better? ...
-2
votes
0answers
14 views

Introductory Python Hangman Game [on hold]

I'm currently taking a beginners' computer science class for school and we were assigned to create a Hangman game in Python. I've found that after I input a secret word, the program only counts the ...
4
votes
0answers
13 views

Prototype GameManager for game written in Unity

I am self taught, so I'm consistently seeking ways to code better, and more efficiently. If anyone has the time, please advise me on what can be done better with explanations as to why the old method ...
-2
votes
0answers
7 views

Native operation call failed.java.lang.UnsatisfiedLinkError: Test.Sample.Jni_sample.Jni_sample(DDDII)V [ERROR] [on hold]

I am using a java program to call .so file. Now I am getting an error (DDDII)V and i have no idea what might that be.. I am a complete noob.. Any help would be appreciated. Here is the lines that try ...
4
votes
0answers
23 views

Warped Audio Sample

I was asked this question and got no feedback, so I'd like to ask you for any feedback on my solution, Thanks! Think of an audio sample as a rubber-band that you want to pin to a musical time ruler. ...
1
vote
0answers
11 views

Naïve Prime Factorization in Clojure

I saw a question about prime factorization on Stack Overflow and realized I had never attempted it before. This was what I ended up with after some playing around and tweaking. I'd like improvements ...
-2
votes
0answers
9 views

Method ordering for Requirements API [on hold]

Over the past couple of years I've quietly developed a library for enforcing API contracts. The project is hosted at https://bitbucket.org/cowwoc/requirements/ Users write ...
2
votes
1answer
22 views

Python merge sort

In Algorithms Fourth Edition by Robert Sedgewick and Kevin Wayne, the exercise 2.2.10 states that: Implement a version of merge() that copies the second half of a[] to aux[] in decreasing order ...
1
vote
2answers
22 views

Generic Min Heap Implementation in Java

There is a Min-Heap implementation in Java. BubbleUp() and BubbleDown() could have been coded using recursion but I prefer without recursion. Would there be a major difference if had used recursion? ...
-4
votes
0answers
17 views

Have to rewrite the code for react table every-time I want to use it for different data [on hold]

I am using a react table for displaying, for example all ACCOUNTS. I have customized this table using fields like headers, accessor, cell, min-width, max-width, props, etc. ...
0
votes
0answers
22 views

Bartender Project - exporting printer code templates - Follow-up-2

Here is my second revision of my code. The other revision (and the base project) may be found here: Original: BarTender project - exporting printer code templates 1st Revision: BarTender project - ...
2
votes
0answers
28 views

Find out whether a given text contains any of the prohibited words

We have been given a list of strings which are blacklisted. The goal is to identify if a given text contains any of these blacklisted strings. The restriction here is that the blacklisted string needs ...
-2
votes
0answers
39 views

Lock-Free Multiple-Producer & Multiple Consumer - Stack and Queue [on hold]

Update: The dequeue method was reading from Head multiple times. Update: Dequeue curr pointer can become null when looking for the last node. Update: I've switched to using C++ std 11 atomics and so ...
3
votes
0answers
17 views

Ultra-simple, automatic, non-float, 1-4 column, grid system

Has everyone moved over to CSS Grid and/or Flexbox? If not, I've maintained and evolved this system over a fair amount of time, the concept was derived originally, I believe, from Mary Lou, although I ...
10
votes
3answers
567 views

Implementation of Luhn credit card algorithm

I've implemented Luhn's algorithm for checking credit card numbers. My code works, but I wanted to learn about a more efficient and more Pythonic way of doing this. ...
2
votes
1answer
18 views

Excel blank row inserter

I wrote a program as an excercise, to check the openpyxl module, which inserts blank rows into an excel file. See the docstring in the code for more description. I ...
0
votes
0answers
9 views

Making a certificate signing request, with validation

I have a function that takes a handful of parameters and I want to ensure the data being passed to it is the correct data and types. Below is a sample function that I wrote to ensure the parameters ...
-4
votes
0answers
21 views

How do you properly organize data to compute multiple (independent) recursive filters at the same time taking advantage of SIMD instructions? [on hold]

I'm processing multiple (independent) Exponential Moving Average 1-Pole filters on different parameters I have within my Audio application, with the intent of smooth each param value at audio rate: <...
0
votes
1answer
28 views

Tile and grid abstraction

This question is a small subset of the problem I am trying to solve. I am trying to learn to break problems into better abstractions. The original problem I am trying to solve is: Write a JS ...
2
votes
0answers
32 views

First React App: ToDo list

This is my first attempt at React and I don't want to pick up any bad habits for the long term. The code is adopted from a example app, but I have added a fair amount of new features. I.e. Clicking ...
1
vote
2answers
49 views

Simple Publisher Subscriber in Java

I am new to Java and had some difficulty creating this simple Publisher Subscriber class. It finally seems to be working and I wanted to check if I have been following best practices and see if there ...
-1
votes
0answers
15 views

Is using callback here bad? [on hold]

Hello everyone can i have some feedback with this code?, i'm passing in an object to the callback since i don't want to pass something like this reply(null, {data}) ...
-2
votes
0answers
23 views

Project euler problem 23 [on hold]

below is my code, it takes to long to compile, any improvement in the code to make it quickly. ...
0
votes
2answers
50 views

Nested for loops in pandas that use conditionals to append to a list [on hold]

I have been using pandas library in python to get add extra columns to one dataframe. The only way I thought to do this for one of the columns was to use a nested for loop with conditionals and then ...
1
vote
0answers
49 views

Controller method to add a folder to a tree

I am using the jstree to get a tree structure in my MVC application. I am actually on showing javascript errors, when something is wrong. In this case, returning an alert to Javascript. Furthermore I ...
3
votes
1answer
43 views

Game of Life in Ruby

I think Ruby is kinda interesting, so did this Game of life implement in Ruby. I am wonder is there is some magic in Ruby can let my code more elegant. I am a python coder and I think my Ruby kinda ...
3
votes
1answer
61 views

Advent of Code 2018 Day 13 - Detect mine cart collisions

This is a solution to Advent of Code Day 13 (problem specification, test input), for which I was asked to read a layout of tracks and mine carts and detect 1) where the first crash would occur and 2) ...
-2
votes
1answer
58 views

Array insertion sort [on hold]

I'm attempting to sort an array at the initial insertion of a value. I tried to think "binary search", except with sorting, where I'm searching for the correct insertion point. I guess you can call it ...
2
votes
2answers
68 views

A recursive algorithm to find the number of distinct quantities of money from a pile of coins

Problem: find the number of distinct quantities of money that a pile of coins can make. The vector coins contains the values of the coins, and the corresponding ...
6
votes
2answers
100 views

Sorting algorithms with Python project

I wrote my first project in Python and i would like to know is it correct? I prepared some guidelines i want to ask. (I know that i dont have any documentation yet ). In the future i want to extend my ...
2
votes
0answers
42 views

Data Transfer Task

The task: You will be given several lines of messages containing data. You have to check for the validity of the lines. A valid line should be in the format: ...
1
vote
0answers
6 views

In React/Redux, fetch a list from a server and create a randomized subset with lifecycle methods

This is my first React/Redux project. I'm pulling down a list of Google Fonts, then displaying a list of 3 randomly selected ones. I want the list of random fonts to be populated automatically after ...
1
vote
1answer
43 views

Implementing `components(separatedBy:)` method in Swift

On looking at the components(separatedBy separator: String) -> [String] method from the Swift Standard Library, I tried to come up with an implementation just ...
-2
votes
0answers
17 views

C# Selenium - How to retain Parent URL Info in Recursion [on hold]

I have written a test automation program the recurses through all links under a page element. However, for some reason it is not preserving the parent URL info where a particular link's web response ...
-1
votes
0answers
18 views

better approach on caching data from HTTP call [on hold]

I'm creating a service that will pull data from server, then load that data into a property to be used later on, then notify all component that the service "is ready". The idea of loading data into a ...
-3
votes
0answers
15 views

JavaScript Code Construction for recording Node Tree Changes [on hold]

I have a node tree structure that renders database information in the browser using vis.js - see this. I won't use the actual table entities, but suppose it's something like: ...
-2
votes
0answers
28 views

Parallel Foreach loop [on hold]

GetValuesFromDB will fetch values from the DB and return a new object which will have SubStatus. ProcessCounter is a class that defines SafeCounter for Processed, Passed, Failed and Skipped. The ...
10
votes
4answers
1k views

First non-repeating letter

The problem: find and return the first nonrepeating character in a string, if the string does not have a nonrepeating character return an empty string. For purposes of finding the nonrepeating ...
6
votes
3answers
169 views

Function to return subword of a camelcase string

Given a camelcase string and an index, return the subword of the string that includes that index, e.g.: ...
-5
votes
0answers
14 views

Yatzy JavaScript [on hold]

Need help if anyone could help me with the following in JavaScript Depending on how many sexes you've hit, convert it to the following answers ...
1
vote
2answers
69 views

Functions to handle big numbers in C

I'm working to implement some simple bigint functions for addition, multiplication and powers. They work correctly but the larger the numbers the longer the time it takes. For example 2^10000 takes a ...
2
votes
0answers
49 views

Repeating a task that may fail (in parallel)

Almost like this question here, I'm playing with some methods that may fail, but in my case, the method failing is not a exceptional case; it just means I need to try running it again. The method I'm ...
-4
votes
0answers
9 views

SPOJ is giving WA for this solution of ROCK [on hold]

I am solving ROCK problem on SPOJ. I dont know why I am getting WA here. Tried many testcases. ...

15 30 50 per page