All Questions

Filter by
Sorted by
Tagged with
1 vote
0 answers
6 views

Evaluating math terms as nested lambdas instead of expression tree

I need to store some math terms. Originally I would use a tree to do it, especially if parsing strings was involved. However, since the expressions are built within the code and need not be parsed, I ...
user avatar
1 vote
0 answers
8 views

How to implement a daily streak counter in JavaScript?

I want to implement this in a SQL database schema, but am doing it in JavaScript first to make sure I have the logic right. Basically, I would like to track "actions" a user performs. If ...
user avatar
  • 329
1 vote
0 answers
16 views

A C++ Job Manager Class (Rev 1)

This is a revised version of the JobManager class originally posted here. The revisions made were centered around: Encapsulating the ...
user avatar
-1 votes
0 answers
16 views

Is the given code optimized ? Can it be optimized?

Sometimes i wonder if i have written a lot of LOC to change my logic in to the programming. If my code is not that much optimized. To share those i have two pictures where i have to pass some context ...
user avatar
0 votes
0 answers
4 views

Unit testing brevity when capturing a variable and having its innerHTML changed (via state)

Take this basic component using state: ...
user avatar
0 votes
0 answers
17 views

Best way validate object in c# with "Manager" class

In my project I have an class named Precatorio ...
user avatar
1 vote
2 answers
30 views

Check if a new movie session can be inserted

I have this function in my code, this way I validate if a new movie session can be inserted, it works, but I wanted to find a better way to do it. ...
user avatar
  • 11
0 votes
0 answers
12 views

Is this PDO query okay to use in PHP OOP?

Im new in PHP OOP so if anything is wrong I apologize. If I want to do a simple SQL query, do you think this code is good? Is it safe to use? Or am i doing something wrong? ...
user avatar
0 votes
0 answers
14 views

Program for monitoring file in Combined Log Format

After encountering a suggestion that monitoring a log file for a webserver could allow for the implementation of automatically analyzing and handling of certain events (that might require altering ...
user avatar
0 votes
1 answer
15 views

Function that get 3 word for strings, than combine them to 1 string and finally print the string in reverse

I'm learning C and I got a task to make 3 function. The first get 3 addresses of string, get 3 words from the user, and enter into the addresses. The second get the 3 addresses of string and combine ...
user avatar
2 votes
1 answer
27 views

Commented Parser Combinators in C

I've attempted to remedy the issues outlined in the answer to my previous question. I've added several hundred blank lines to better illustrate the grouping of functions and generally make things look ...
user avatar
  • 1,906
0 votes
1 answer
21 views

Common interface for fixed-length and variable-length lists in C#

I am working on library project in which I am reading and writing binary files that have own file format structure. In that structure there are variable-length and fixed-length elements. My approach ...
user avatar
  • 183
1 vote
0 answers
29 views

Smallest interval whose sum exceeds a threshold

In a non-negative 1D array x, we wish to find the shortest slice such that x[start:end] > threshold, with constraint that <...
user avatar
1 vote
0 answers
11 views

Nodejs - Javascript buffer that takes in uint64, enum and string data as input

I am writing a nodejs program that adds some data into a buffer, before it is streamed. The data types are listed in the comments of the code, and there are fixed places in the buffer that these data-...
user avatar
0 votes
1 answer
13 views

Simple websocket chat app, security and efficiency concerns

I'm coding a simple websocket chat app. I was wondering if my code is secure and efficient. I also have a question about the way how I'm sending objects and then checking the type, is there anything ...
user avatar
  • 21
0 votes
0 answers
10 views

Nodejs binary utility functions library interface design [closed]

As part of my current employment, I've been working with TCP/TLS in NodeJS for about 2 years. My colleagues and I are using a proprietary binary protocol, for communication between a proprietary ...
user avatar
3 votes
1 answer
116 views

Applying a cost function to a string based on a pattern string

I have a cost function Cost_Func(pt,STRING) that calculates value in a specific way based on the given pattern string pt and ...
user avatar
  • 131
2 votes
6 answers
810 views

Print a list of license plate numbers of all cars that went over the speed limit, as well as the average speed of each of those cars

I wrote a working code and was wondering if it could be shortened as I saw a lot of similarities in my loop and if statements. I hope it's possible as I want to make it a bit cleaner. I had to print a ...
user avatar
1 vote
0 answers
10 views

Matching corresponding masks of objects between 2 images

Here is a program that processes 2 grayscale images. Both represent the position of objects, in the form of multiple masks per image. Each mask is a shape with one color delimiting it, with 0 (or ...
user avatar
-2 votes
0 answers
12 views

Random number generator repeats issue? [closed]

So essentially, I am trying to make a program where you enter three numbers between 1-10 and the bot will spit back a corresponding seed which matches the values of your inputs (I am bored, that's why ...
user avatar
  • 1
-1 votes
0 answers
11 views

Converting ASCII code of a number to its Binary equivalence [closed]

I want to extract the temperature value from the following string and display it as 2 separate numbers in 2 LCDs of BCD type. For example, if the temperature is 27, the number 2 in one LCD and 7 in ...
user avatar
-1 votes
1 answer
21 views

Transpose and Paste VBA [closed]

Currently from my sheet2, I wanted to copy the column C36-N36. However, each of these cells has one formula that is generated from the numbers within sheet2, i.e. C36 = A1+A2/2 something like this. ...
user avatar
0 votes
0 answers
40 views

Optimizing a program that checks through a very large set of permutations

I'm not sure if this is the correct place for an optimization question like this, but I'm not even sure where to start looking. So here it goes. There's this game I play that has very simple rules. ...
user avatar
3 votes
1 answer
42 views

Doubly Linked List with forward and reverse iterators (javascript)

A doubly linked list contains elements that include pointers to the previous and next element along with a value. Being able to search and iterate through the list in both directions is an important ...
user avatar
1 vote
0 answers
15 views

Permutation of linear models with Python

Similar to my previous post in R All permutations of a linear model given all predictors, I have attempted a Pythonic version. However, a few issues that I have with my version is that I cannot select ...
user avatar
0 votes
0 answers
13 views

Home page with divs that appear when clicked

I imagine home page like two div(for example) user choose one of them and after he click now two new div appears and user do same process for example 5 times. In the HTML its just two times repeat div ...
user avatar
-2 votes
0 answers
26 views

C++ Dynamic types [closed]

My questions are: What do you think about dynamic types in C++ ? (or C++ is self-sufficient) What do you think of my project "var" ? Example: Dynamic array(var:arr) with dynamic values(...
user avatar
  • 1
3 votes
1 answer
42 views

Task executor thread pool

Despite my experience with Java, I am not well-versed with concurrency. I wrote this thread pool that has a queue of tasks. Please ignore any signature choices, such as overuse of ...
user avatar
  • 133
-3 votes
0 answers
15 views

template class T global [closed]

I have never used template before like the code below. And this is not my code, I found it online. The code compiles like this, but if I try to call the functions, it will not compile. I have used ...
user avatar
-1 votes
0 answers
25 views

Recover a secret string from random triplets algorithm CODEWARS [closed]

This is problem from codewars: There is a secret string which is unknown to you. Given a collection of random triplets from the string, recover the original string. A triplet here is defined as a ...
user avatar
2 votes
1 answer
40 views

C++ Connect 4 in SFML

After a substantial amount of programming experience in high level languages like Javascript and Python, I decided to try learning a low level language for once, so I did C++. As my first project I ...
user avatar
5 votes
1 answer
210 views

Doubly Linked List Javascript

A doubly linked list contains elements that include pointers to the previous and next element along with a value. This data structure is implemented with methods similar to what you would find in an ...
user avatar
1 vote
1 answer
27 views

Refactored Todolist created using TS

After getting the code review I refactored the code and the updated version is below. I tried implementing the suggestions but because I am still learning I might refactor again after learning how to ...
user avatar
-3 votes
0 answers
11 views

Stay DRY in jQuery [closed]

I'm new to JavaScript / jQuery and I have no idea where to look to simplify my verbose code: ...
user avatar
1 vote
2 answers
56 views

A C++ Job Manager Class

I've created a JobManager class that manages the execution of submitted Jobs on periodic intervals. While the ...
user avatar
-3 votes
0 answers
19 views

javascript backtracking algorithm with unexpected behavior! [closed]

...
user avatar
3 votes
1 answer
64 views

Rendering a cross in ASCII art

I've recently tried to write my functions by using composition. But this one, renderCross' is especially difficult to convert fully. How would I write this ...
user avatar
4 votes
2 answers
482 views

A simple spaceship game

How could I improve this code? It's a little game. If you run it, instructions will appear. In particular, I'd like to know whether I can make it considerably shorter any trick :) ? whether I can get ...
user avatar
0 votes
0 answers
11 views

Downloading code from html email in Cypress using inBucket API

Hi so I'm searching for more optimal way of doing this. I can't rely on inbucket js client so I tried to do function by myself with native Cypress commands and JS. I try to extract from latest mail ...
user avatar
  • 101
1 vote
0 answers
17 views

Minesweeper using Tkinter

So, I have completed a Minesweeper program in Python using Tkinter. A few questions: I feel I should convert this to Object-Oriented Programming. Any starting tips? Expanding on the above, I have way ...
user avatar
  • 147
0 votes
0 answers
36 views

Television and channel modelling [closed]

I wrote a simple project to train my beginning knowledge of OOP. My class represents a Televisor that has two types of channel list: the first one is global, that's applied to all objects of my class ...
user avatar
-1 votes
0 answers
14 views

Unsure about current NGINX configuration [closed]

My site is working as expected, but when checking for syntax validation, an error is identified ...
user avatar
  • 181
2 votes
2 answers
65 views

Coordinate Descent Non-negative Least Squares optimization

In my fast implementation of Non-negative Matrix Factorization (Rcpp Machine Learning Library, RcppML), about 40% of the runtime is spent solving Non-negative Least Squares (NNLS) systems (the rest of ...
user avatar
  • 143
3 votes
6 answers
1k views

Reverse string with identical spaces as in original String using Java

This is interview question Reverse string with identical spaces as in original String using Java For example Original String : best in the world and is greatest and is making sure the world goes well ...
user avatar
1 vote
1 answer
37 views

Asp.Net Core CacheKey Management

I created cache management structure for Asp.Net Core and Redis. But i dont know is this best practices or bad. My Github Repo First one is Store my entity keys class is ...
user avatar
2 votes
1 answer
54 views

Simple Brainfuck interpreter in C with support for nested subroutines

Wrote a simple brainfuck interpreter that supports nested subroutines ([ ] commands). ...
user avatar
-3 votes
0 answers
8 views

The Right or Better Way To Structure Business Rules In Go [closed]

Hope you're doing okay. I've been learning about Clean Architecture and Hexagonal Architecture and currently, I'm a bit confused about the right / better approach to structuring my service layer In my ...
user avatar
4 votes
1 answer
25 views

Class for serializing themes for my JavaFX application

I have a Theme class for storing themes for my javaFX application. I created a serialize method that stores its information as a String and a constructor to create a Theme from a serialized Theme. I ...
user avatar
0 votes
0 answers
11 views

Framewise Full-Reference Image Quality Assessment (PSNR and SSIM) for Two Videos in Matlab

Besides the case of No Reference Image Quality Assessment for Video. I am attempting to implement a code snippet for calculating framewise Full-Reference Image Quality Assessment (FR-IQA) (PSNR and ...
user avatar
  • 3,556
-2 votes
1 answer
47 views

Small units: property initialization [closed]

We're using Sigrid as our code analysis tool and one of the metrics it uses to measure code maintainability is the well-known "unit size". Units between 1-15 lines of code is deemed to add &...
user avatar

15 30 50 per page
1
2 3 4 5
1517