All Questions

Filter by
Sorted by
Tagged with
0
votes
0answers
30 views

String search using Rabin-Karp algorithm

I am trying to solve a needle in haystack using Rabin-Karp algorithm, but for large inputs my code takes way too long time. Here is the part which apparently is too slow: ...
0
votes
0answers
10 views

Achieving same abstraction by replacing JObject's implementation with System.Text.Json alternative

I'm trying to improve the following Binance Web Socket API wrapper. I like it because it uses System.Reactive and it takes advantage of the combined web socket ...
1
vote
1answer
19 views

Euler Project Problem 2 JavaScript

Just solved Euler Project Problem 2 using JavaScript and I would like to know how I could improve my code. I do think it looks good, but you never know. Problem Statement Each new term in the ...
0
votes
0answers
15 views

Create trigger that updates Table3 from an insert into Table1 that multiplied by a value in Table 2 in MySQL

I know this is probably more complicated than it needs to be, however, I would really appreciate some help. I'm trying to create a trigger in MySQL that will update the value in the Costs table when a ...
1
vote
0answers
15 views

Producer/Consumer Multi-Thread implementation - Is the solution correct?

I recently faced this following question in a Java coding round, needless to say I did not get a callback. So I want to know where I am going wrong in my solution and also what can be done to improve ...
1
vote
1answer
19 views

Rust Pig Latin Translator - Idiomatic suggestions

This is the code I came up with for the Rust pig latin exercise. I am looking for suggestions on how to make it more idiomatic. I think working with iterators instead of chars and Strings would be a ...
0
votes
2answers
31 views

Python function for finding if all substrings exist in a string in sequence

I want to find if all of a list of substrings exist in a string, in the correct order (with or without spaces between them), it seems to be a good use for regex. I think I need to build a regex ...
1
vote
2answers
30 views

Grade Statistics

I'm learning Java in a MOOC right now and this is my solution for exercise grade statistics. This is the exercise: In this exercise we create a program for printing statistics for points in course. ...
0
votes
0answers
15 views

Command-line sentence-by-sentence EPUB reader in Python

This is a command line application which displays the text of an EPUB one sentence at a time. I am going to make it more robust, including: make the segmentation more accurate, because it currently ...
4
votes
3answers
195 views

Passky Password Manager router with authentication and validation guards

I have a long switch statement and it would be great if someone know how to make it cleaner. Code is available on Github: https://github.com/Rabbit-Company/Passky-Server/blob/main/php/index.php And ...
2
votes
2answers
17 views

group computed properties in vue component

I have the following vue component which all works fine ...
-1
votes
1answer
44 views

Is relying on exception handling a good way to ensure that the app's work is done correctly?

Contextually, I'm evaluating if a member exists with the supplied information. This, ostensibly, is intended to prevent the addition of new members with the same details. The user will be provided ...
-2
votes
0answers
43 views

How to get rid of TryParse in this code?

I believe that using TryParse is not a great idea here. How to improve this part? ...
-2
votes
0answers
13 views
0
votes
1answer
55 views

Simple sort function

I am learning Python and for practice I have written this function which sorts a list. Can you please provide feedback on how I have structured it and what better ways could be there to write it for ...
3
votes
2answers
574 views

Magic ball 8 program

I was doing the Magic Ball 8 project (its task is to read a user's question and output a prediction) on Python and wrote the following code: ...
0
votes
1answer
69 views

Fastest string search algorithm invented by me. It is called ""Choudhary String Search Algorithm""

I have invented the fastest string search algorithm. It is called ""Choudhary String Search Algorithm (choudharyStringSearchAlgorithm)"". I have compared my algorithm with Brute ...
0
votes
1answer
33 views

Objects for a face book

Consider the following two classes: ...
0
votes
1answer
42 views

Absolute Permutation | Hacker Rank: Any way to make this python code faster without changing it's whole logic?

https://www.hackerrank.com/challenges/absolute-permutation/problem I know that if you work out the math and logic first, the algorithm can be simplified greatly (shifting indices), but is that the ...
3
votes
3answers
75 views

Finding the next 9am/pm from now

I have some code that needs to return a datetime of the next 9am or 9pm, UTC. I've figured out some code to do this, but it feels unnecessarily complex to me. Is ...
0
votes
1answer
24 views

Map chaining vs execute on first map

I have two large arrays of objects, which look something like: [ { key: "prop", Email: "someEmail@email.com" }, //... ] and ...
1
vote
1answer
43 views

best way to get data from dict

I have a function general_statistics that takes a dict as input and get the wanted information. the function is working without any problem, but I want to know if I ...
3
votes
0answers
44 views

Machine Learning Loss Functions In C++

I was looking for C++ versions of the machine learning metrics implemented in Python's sklearn, but they were surprisingly hard to find. I came across a website that had most of the loss functions ...
0
votes
0answers
20 views

Calculate of the average of time discounted values

Given the current table: ...
-1
votes
1answer
28 views

Use an exception to check if item in dictionary

I am using a KeyNotFoundException to check if an item exists in a Dictionary, creating it when the exception is thrown: ...
0
votes
0answers
17 views

Suggestions on how to upgrade HTML and CSS making a hamburger icon that transitions to "X" in the code below?

I'm interested in how I can improve my HTML and CSS? I didn't yet learn JS, even though I used it for onclick function, so I'm not currently interested in how to improve the JS in this code. I was ...
1
vote
0answers
21 views

find max value in islands defined by other vector

I have a vector of values vals, a same-dimension vector of frequencies freqs, and a set of frequency values ...
0
votes
1answer
22 views

Allow caller optional flags for returns

Checking return flags is generally very important. But, when you don't need to based on meeting pre-conditions, the syntax gets unnecessarily ugly. This class allows returning a value with flags that ...
0
votes
0answers
23 views

Resolving circular references in VBA via ObjectStore class and CleanUp cascade

Resolving circular references in VBA via ObjectStore class and CleanUp cascade I have been working on a VBA database library and realized I had a few circular reference loops in my class hierarchy, as ...
0
votes
0answers
34 views

Merge two Dataframe with condition

I have 2 datafarme And need result, date of datefarme 2 between date of dataframe 1 result = A of datefarme 2 add in datafarme 1 ...
4
votes
2answers
230 views

Remove matching lines from all files

I have written a Python3 program that looks for matching strings and removes them from files. ...
1
vote
2answers
46 views

Given an integer N, returns the smallest integer greater than N, the sum of whose digits is twice as big as the sum of digits of N

Write a function: class Solution { public int solution(int N); } that, given an integer N, returns the smallest integer greater than N, the sum of whose digits is twice as big as the sum of digits of ...
0
votes
0answers
24 views

ASP.NET Core dependency injection in class library with params

I know this question could be the new variant of other 1million questions but before you say that, let me explain what I'm trying to achieve. I have a lot of APIs and want to create an SDK. There is ...
7
votes
3answers
1k views

strcat_new() function, not present in standard C library

strcat_new() function, not present in standard C library. Syntax: char *strcat_new(char *delim, long num_args, ...); The code is ...
0
votes
0answers
33 views

Converting Audio Bytes to Array of Floats for Visual Representation

I'm trying to write a Java function that will take a byte array (of PCM audio recorded on Android) and return an array of data of floats that is intended to be used to create a visual representation ...
0
votes
0answers
23 views

Mergesort unstable as Implemented?

I just had a realization about Mergesort possibly being unstable depending on how it is implemented while reading this post. Would the merge method below lead to an unstable algorithm? ...
0
votes
1answer
32 views

Safely and Quickly Trim a Byte Array of Audio in Java

I'm trying to take a raw byte array of audio and trim it. The user selects a start and end value using a range slider. ...
0
votes
0answers
16 views
1
vote
0answers
27 views

avoid reassigning variables in javascript [closed]

I have the following piece of code. ...
0
votes
1answer
27 views

Bash script to process Kafka messages

I want to use shell scripts to consume kafka messages and return to status. I found that my script wasn't efficient enough. Can I write this script better? I want to output kafka-console-consumer.sh ...
4
votes
2answers
46 views

Higher lower game

I'm currently learning python with an udemy course. I wrote this code, which is meant to be a higher lower game, where the second answer always stays. As far as i tested it my code is working fine, ...
0
votes
1answer
34 views

Search in circular sorted martix

The method is given NxN matrix always powers of 2 and a number,it will return true if the num is found example for 4x4 size: ...
0
votes
0answers
34 views

Choose meals for a week

I've built this complex form or at least what I would consider a complex form and it feels really dirty. It felt dirty while I was programming it but I wanted to get it working and then go back and ...
2
votes
1answer
51 views

A Custom Range Partitioner

Terminology usage: I will use chunk, page, partition, or subrange interchangeably. I frequently use and promote using the System.Collections.Concurrent.Partitioner ...
1
vote
0answers
34 views

Mean, median and mode GUI

This program takes x numbers and displays the mean, median and mode. My goal here was to use classes and class properties the best i could to make the code shorter (honestly i may have just made it ...
-2
votes
0answers
30 views

C, atoi. Своя функция atoi на C [closed]

Please, tell me, why this code doesn't work without "-'0'" in this string:"result = 10* result + (str[i++] - '0');"? Объясните, пожалуйста, люди добрые, почему код не работает без &...
-1
votes
0answers
27 views

What would be a recommended data structure for a set of baking conversions? [closed]

I am working on a Python package for converting baking recipes. Ideally, the recipe is simply stored as a CSV file read in by the package. Given the recipe can be imperial or metric units of ...
3
votes
4answers
430 views

Generate HTML select tag and options using a text file having list of countries

The code below will generate an HTML select tag and options using a text file having list of countries. If the file doesn't exist or contains only empty / white space lines then generate an input box ...
-1
votes
0answers
30 views

Console for Java JAR programs

When you run a jar file by double-clicking on it, you don't get console so all your input/output have to be on GUI. This program solves this problem and gives users/programmers a console which can be ...
1
vote
1answer
56 views

Predeclared class instance tracks the number of regular instances

Predeclared class instance tracks the number of regular instances In VBA, predeclared class instances can act as object factories, and in general, it makes sense to keep this instance stateless. ...

15 30 50 per page
1
2 3 4 5
1479