All Questions

0
votes
0answers
6 views

O(n) Object Pool

I recently rewrote my object pool design to O(n) complexity. I did this using a linked list, which is not native in javascript. It does not, unfortunately, automatically assign null to a value when ...
-1
votes
0answers
13 views

Mapping to I/O method results [on hold]

Consider the following Java code: Stream.of(1, 2, 3).map(i -> i*i).mapToInt(Integer::intValue).sum() This is pure and will result in the same answer every ...
-2
votes
0answers
21 views

How to enforce parameter is a CONSTANT in python [on hold]

I am writing a data preparation class that should work differently on different database types. I would like to assert that the class is instantiated with allowed database types. So far best solution ...
0
votes
1answer
44 views

Grouping report data by one of two criteria

I have a report with a group by filter. A stored procedure returns all the data and maps it to IEnumerable<EventListRow>. The code should then group the data ...
0
votes
0answers
7 views

Planning HTML structure & attributes for Javascript value collection

I'm planning a feature which would have a dynamically created number of input text fields(by a button click) which I will later be collecting. As of today I have been assigning ids by a running index ...
-2
votes
0answers
19 views

using try except in python [on hold]

Actually, this is not my own code but because I wanna use it and this problem bothers me frequently, I wanted to check it out here: ...
-3
votes
0answers
13 views

How to call paint method with a canvas in Swing? [on hold]

I've searched everywhere about how to use awt's canvas, but there's one thing that I just don't get: how do you actually call the paint method? Yes, you have to override it to draw whatever, but when,...
4
votes
1answer
43 views

Comparing similar types that don't share any interface

I have two types that don't share any interface but have similar properties and that I need to compare for equality. One of them is comming from a 3rd party library and one of them is mine. I ...
-1
votes
0answers
14 views

How load randomized background image

One ASP.NET MVC application has a login page. In this login page (and only for this page) I'm using a background image. This background image is changing every week. All the pictures path are known in ...
3
votes
2answers
256 views

Search in a nested list of a dictionary

I have a dictionary structured as {a_1: [((b_11,c_11),d_11), ((b_12, c_12), d_12), ...], a_2: [...], ...}. I want to extract the maximum abs(c) among all the ...
0
votes
0answers
17 views

Correctness of iterative DFS for cycle detection

I'm attempting the Graph Algorithms section in CLRS right now. Here's an iterative DFS using a stack called nodes. ...
2
votes
1answer
52 views

Doubly linked list using C++ and templates

Working doubly linked list using C++ and templates, I tried to make it by myself. I tried to use head and tail as buffers and make a simple implementation. Please help me understand what I have done ...
1
vote
1answer
33 views

Flip coin Game in an Object oriented way

I started out creating a simple game in an Object Oriented way to practice. The rules are pretty simple There are two players You let one player choose if they want Heads or Tails. You assign the ...
1
vote
1answer
11 views

duplicated operator(or attribute) on the same input control - v-model and @change

I wrote a code like below - It is nuxt.js, which is one of the Vue frameworks. This code will be expected to When change event triggered, update ...
0
votes
0answers
26 views

Error-Handling Class and Logging

I am relatively new to C# and would like to see if what I have been using for my exception handling, message and logging is along industry standards. I have created a simple class for the Error ...
0
votes
0answers
11 views

Querying DB inside SQLAlchemy Model [on hold]

I have a SQLAlchemy model that looks something like this: ...
-1
votes
0answers
12 views

Updating/edit a single row of CSV file with python [on hold]

I have existing csv file with records in them: ...
0
votes
0answers
22 views

EF core 2 generic repository implementation

EDIT: If you're against a generic Repo Can you show me another method to implement these abstractions to adhere to AOP and SOLID principles besides a generic repo? I'm implementing a generic repo for ...
0
votes
0answers
12 views

Logical flow for user verification process

I've provided methods to determine what stage user is at in verification process. This will determine the appearance of the view or what progress user has made. Its pretty straightforward, but I think ...
0
votes
0answers
7 views

Optimal way to use GLFW callbacks inside classes [on hold]

Im creating a window class in C++ to provide a bit of abstraction for a GLFW window. To me it makes sense to add a key_callback as a method in my class. The issue is ofcourse that GLFW is written in C,...
0
votes
0answers
15 views

Control the input of the user according to a sample string and get some info from it

I made this Python code that prints a sample string and ensures that the input of the user agrees with the sample, and then do an action with this inputted string, in this case a multiplication table. ...
-4
votes
0answers
13 views

How can I make this function run asynchronously? [on hold]

This function runs thousands of times on different files, causing the UI thread to lock up. It gets called in several different places in the program. How can I make it run asynchronously? The issue ...
0
votes
0answers
17 views

Refreshable JSON settings file accessible for HttpClient provided by IHttpClientFactory

I'm trying to achieve the functionality of automatically reloaded JSON settings file and at the same time maintaining all the benefits of using IHttpClientFactory (...
2
votes
1answer
41 views

Very basic C++ HTTP Parser

I was bored, so I decided to write a very basic HTTP Request/Response parser in C++. Some Notes: This isn't meant to be a complete implementation of the HTTP protocol This isn't meant to be the ...
2
votes
0answers
23 views

Binary heap implementation with a generic base class

This is my attempt at implementing a Binary heap. I made an abstract base class Heap with an abstract property controlling whether it is a min-heap or a max-heap. ...
1
vote
2answers
30 views

Continuous Shuffler with “linked loop”

As an academic exercise, I decided to implement a continuous shuffler, as seen on casino blackjack tables. It operates by storing a "linked loop" (a linked list with the last element linked to the ...
-3
votes
0answers
26 views

Failed iOS interview homework assignment [on hold]

I recently received a homework assignment from a Vietnamese company. A few days after finishing it, they gave me a rejection. Can someone please tell me what I did wrong? Here is the assignment: ...
2
votes
1answer
44 views

C++ class for a flag register in a Chip8 emulator

In order to learn C++ I decided to code a Chip8 emulator following a tutorial. When I came across the idea of a flag register and decided it would be fun to implement in order to get familiar with ...
-4
votes
0answers
15 views

I have a Python Program which gets Candidate data and tells the user whether or not each person could run for president [on hold]

I have my program task and a picture of the code I’m working on. This is super beginner stuff and I’m kinda having trouble. Please let me know what I should change. Thanks!!.
1
vote
3answers
30 views

Determine a list contains two elements with a given sum

On interview I was asked to write method with following contract: boolean checkList(List<Long> list, long sum){...} for example it has to return true for ...
0
votes
0answers
34 views

Comparing 100,000 string pairs, quickly

I recently compared various comparison operators in ColdFusion 2016 ...
1
vote
0answers
41 views

PHP Login Checker Stage

I have been working on my script which allows people to sign-up and login to my website. I was wondering if someone could review the code. It works but I can't help but feel it could be optimized. ...
0
votes
0answers
25 views

Determine indexes in a string for the first and last word in variable word length strings

I was wondering whether people could recommend some modifications they would make to this code if it were theirs. :) In my project, I utilise OCR to read user's timetables. This code is to determine ...
-3
votes
0answers
18 views

switch case inside for loop cant work c [on hold]

I'm Trying to use switch case inside for loop but apparently it wont work ...
-2
votes
0answers
24 views

i need to know how can my following pearson correlation finding code be better to select features(attributes) in dataset [on hold]

My question lies in the better use of array... i can understand the working of most of the code however there is so much room for improvement... because i came from a java,c++ working environment to ...
2
votes
2answers
45 views

Collect members from custom tree nodes

In my program, I have a tree of Group nodes, each identified by their ImportId. Each group has zero or more members, that I ...
3
votes
0answers
25 views

Eassily create a logger in python for many modules with loglevel set according to command line arguments

I'm trying to learn writing python programs in a modular way as much as possible. One of the issues I've had difficulty to solve is parsing command line arguments (with ...
0
votes
1answer
20 views

Shell POSIX OpenSSL file decryption script follow-up #3 (final)

From original very simplistic code: Shell POSIX OpenSSL file decryption script I learned a lot both from the first follow-up review, and the second one as well, many thanks! I just need one final ...
-3
votes
0answers
23 views

WA in “Spread the Word” [on hold]

Problem Link https://www.codechef.com/SNCKQL19/problems/SPREAD2/ Link to the solution https://ideone.com/JAO5lX I am ...
3
votes
2answers
37 views

K&R Exercise 1-13. Printing histogram of word lengths (horizontal variant)

I'm going through the K&R book and want to get the most from it. How does the following solution look to you? Note that, for the sake of exercise, I don't want to use techniques not introduced yet ...
0
votes
0answers
13 views

Inserting nodes to the end of a linked list by function [on hold]

I am trying to insert nodes to the end of a linked list by function. This is the insertNode function: ...
2
votes
2answers
57 views

N-puzzle solver using A* with Manhattan + Linear Conflict

I've been working on this solution for a couple days now. Finally managed to get it to work and I got it to where it solves about half of the time. The other half goes for so long that it eventually ...
2
votes
0answers
37 views

Pythonic quick sort

I'm new to the world of python, and wrote this quick sort implementation which was taught to us in an algorithms class. I would like to learn to write code less like C++ and more pythonic. Could you ...
0
votes
0answers
15 views

Creating text game with JavaFX Interface

It's only my third day with Java and I already got a recommendation to check out JavaFX and build a simple text game. I do like text games, but I had no idea how to implement the features that I ...
0
votes
0answers
18 views

Python Class conversion [on hold]

I am to encapsulate the GUI part of the code below into a Class. ...
1
vote
2answers
102 views

Bubble and Cocktail sort

Lately, I've been developing sorting algorithms as a kind of exercise to make better code and I've come accross something curious, even though bubble and cocktail sort are known to perform horribly, I ...
3
votes
1answer
26 views

CGI for htpasswd registration

I decided to go with a very simple CGI user registration program to pair with Apache's mod_auth_form wrapper around a private site. It was only just after I ...
2
votes
2answers
454 views

Processing voice samples

I'm within an audio application that sends variable-length buffers to my DLL, which will process at higher speed (48000 samples per sec, but can also be higher). Here's the code I've written: ...
-1
votes
1answer
39 views

Pramp: Flatten a Dictionary skipping empty keys

This is a question from pramp: A dictionary is a type of data structure that is supported natively in all major interpreted languages such as JavaScript, Python, Ruby and PHP, where it’s known ...

15 30 50 per page