All Questions

Filter by
Sorted by
Tagged with
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
2 votes
1 answer
68 views

Animating GIF on hover in Javascript

I don't know JavaScript and it's safe to say this is my first code ever written in JS. I just needed to animate my GIFs when user hovers over them only. Googling separate concepts such as "string ...
user avatar
  • 1,375
2 votes
1 answer
44 views

Created a todo list in TS

I am learning Typescript and created a straightforward to-do list project to practice some basic concepts. I am able to Edit the todo Delete the todo Mark the todo as completed I want to how can I ...
user avatar
0 votes
3 answers
35 views

List with values not found in another list when each index has two objects

As the question already says, my code returns a list with the index's that don't exist inside another list. For this I currently create two lists joining the objects of each index, then filter the ...
user avatar
2 votes
1 answer
45 views

Using methods to get and display userInput

Would like to know if I could have done anything better with the code that I wrote. Want to also know if I could have avoided using a static variable. ...
user avatar
  • 23
1 vote
0 answers
19 views

Hack assembler/disassembler in x86_64 assembly language

Starting from this answer I thought I would show a fully worked example of how to create a data-driven version of the assembler for the Hack assembly language. As I noted in that answer, having ...
user avatar
  • 64.4k
1 vote
1 answer
16 views

Code for setting all child controls to the default message font on Windows

If you aren't aware, if you hand-code a GUI with the Windows API you will find your controls look quite ugly by default due to their font. Running this code: ...
user avatar
1 vote
0 answers
15 views

Return type-erased object to the caller, use typesafe cast in a subsequent call [closed]

Libraries might need to return "context" objects to the caller, and then require the same object in subsequent calls. In some cases, the user is not required to know what's the concrete type ...
user avatar
0 votes
0 answers
38 views

Implementation of A star Algorithm [closed]

I am implementing an indoor map, using A star algorithm as its pathfinding algorithm. I came across a library in github and modified it into my floorplan, it works but now I'm trying to study how the ...
user avatar
0 votes
0 answers
40 views

Web Scraping: finding a particular content and taking an action for multipule pages

Summary: the whole code is given at the bottom the problem (or say main concern) is described hereinbelow. The code scrappes the website goes through various pages and finds particular content to ...
user avatar
  • 231
2 votes
0 answers
40 views

Cosine similarity calculation in Rust, which is slower than NumPy

I'm running this in release mode. Currently, the following function takes around 6.7 seconds to run on my computer vs 3.7 seconds on Python. I know that Numpy is just calling to C, but I'm trying to ...
user avatar
3 votes
0 answers
45 views

Decorator implementation around xarray.open_dataset

If you would like to download some grib data for yourself, the script below will pull girb data from the google api over a date range at an hourly interval. Extract some hrrr grib2 data ...
user avatar
-2 votes
0 answers
18 views

Python while loop - How to print last value without tab [closed]

I am working to create a program that creates a hailstone sequence and I'm nearly there except my last value is printing with a tab after it. I can't figure out how to fix my code below to not have a ...
user avatar
0 votes
0 answers
19 views

Simple Todoesque React Component for selecting Multiple Choices in a form

I was recently pinged about a quiz app a friend of mine was building with React Native for fun they were having minor brain farts over handling a multichoice answer template and asked me to look over ...
user avatar
3 votes
0 answers
27 views

Scheme interpreter in QBASIC

I wrote an interpreter for Scheme which includes stop and copy garbage collection. ...
user avatar
2 votes
1 answer
40 views

A (Sort of) Generic Stack Implementation in C using Macros

I spent some time implementing a generic stack in C using macros. Apart from general bugs and bad practices in my code, I was wondering about the viability of an implementation like this that uses ...
user avatar
1 vote
1 answer
68 views

My LRU Cache implementation in Java

...
user avatar
  • 11
0 votes
0 answers
20 views

Export dataGridView to an Excel Worksheet in c#

I have a dataGridView in a WindowsForms. I also have a button to export this dataGridView to an Excel Worksheet. If the button will be clicked, the data in the dataGridView will be exported to a XLSX-...
user avatar
  • 115
3 votes
1 answer
128 views

Resize image, blur image and overlay image

This code has the function of removing worthless borders from the original image and then: Generate a 1080x1080 image (Instagram default) to be used as a blurred background. Generate an image with a ...
user avatar
3 votes
2 answers
72 views

Parse the weekly menus of a German delivery service

I am a C# beginner, and I wrote a program that parses the weekly menu of a German delivery service. It works fine and I think the code quality is okay. Can anyone with more experience than me review ...
user avatar
4 votes
1 answer
103 views

Check how many days a country has been independent

I have been using a website called 'CSNewbies' to learn Python and one of the tasks was to create a way for a user to check how many days a country has been independent. The countries are limited to ...
user avatar
1 vote
2 answers
59 views

Finding the cheapest path between two points using Dijkstra

I am trying to use Dijkstra to find the cheapest path between two pixels in an image. Implementation: ...
user avatar
1 vote
1 answer
34 views

Hangman game in Haskell, written using a state monad

I recently made a simple hangman game in Haskell but soon wanted to explore the state monad, since it could possibly simplify the code. The result was this (see below), which is exactly 30% more lines ...
user avatar
2 votes
2 answers
94 views

Change interface depending on if statement

I'm using fiber and mongodb. Field "field" is needed to obtain certain data to unload the load on the database. If field "field" is empty, then needs to output all the data from ...
user avatar
  • 23
6 votes
1 answer
232 views

Check stock status at a retailer

I am learning Python and wrote this code to check (every 10 mins) whether a product is available at a retailer, since it usually runs out of stock pretty quickly. It's working as expected, but can ...
user avatar
  • 61
-1 votes
2 answers
106 views

Is my "insertion sort" correct?

I am writing an insertion sort code in C. This code is perfectly working. But I am a bit confused if my implementation is correct or not for insertion sort. ...
user avatar
2 votes
1 answer
100 views

Small shopping cart application - Solid Principles and Clean Code

I've recently had a technical interview where I had to identify code smells and refactor an existing code by applying the SOLID principles and implementing unit tests. It is a small shopping cart ...
user avatar
-1 votes
0 answers
27 views

Make requestAnimationFrame faster javascript [closed]

I'm creating a gameloop using requestAnimationFrame. But I have a little problem. My webpage has also a sidebar, which can be toggled on/off I made it so when the sidebar is OFF (not shown in the ...
user avatar
2 votes
1 answer
58 views

non recursive quick sort in c++

I'm relatively new to c++ programming. I have a few years of experience writing simple Arduino programs, but I always kept to the basics. I also have some more experience with Python. I set myself the ...
user avatar
  • 21
1 vote
1 answer
44 views

Optimal Jelly string compressor in Rust

I'm writing some small programs to practice Rust, and this one's a string compressor for the golfing language Jelly (unofficial spec). It involves some non-ASCII stuff and bigints (from the ...
user avatar
2 votes
2 answers
56 views

Virtual method with variations for different types

Each animal type will call reactToOwner() and exhibit its own behaviour. So simply define a reactToOwner() override for each ...
user avatar
  • 1,109
0 votes
1 answer
27 views

How to avoid nested map allocations in below code?

I have a below struct where I have a nested map for CustomersIndex which allocates bunch of internal maps causing memory increase. I profiled it so I noticed this. ...
user avatar
  • 11
1 vote
1 answer
75 views
+50

A uniform interface for storing data by fd or container

I need to store the data in three different ways: storing the data to a std::string writing the data to a given file descriptor both of the above And I hope to ...
user avatar
  • 27
1 vote
1 answer
66 views

Simple networking framework in C++

Question: What do you think about this design and the implementation? This is a simple networking framework for IPv4, IPv6 TCP client and TCP server for Linux and MS-Windows in C++14. It uses a single-...
user avatar
3 votes
1 answer
69 views

Simple networking framework in C

Question: What do you think about this design and the implementation? This is a simple networking framework for IPv4, IPv6 TCP client and TCP server for Linux and MS-Windows in C. It uses a single-...
user avatar
-2 votes
0 answers
53 views

MaxCounters Codility Challenge JavaScript (88%) [closed]

Thank you in advance. I would like to figure out why I'm getting 88% of the score. I would like to know how can I improve my code based on my approach to get 100% on this challenge. ...
user avatar
-1 votes
0 answers
16 views

Beginner looking for Critiques! Formatting an Excel for Tableau using Openpyxl [closed]

I just finished writing a script in openpyxl to automatically format a dataset so it can be placed into Tableau. The script is running and working as intended but I know there are some things that can ...
user avatar
-3 votes
0 answers
16 views

Saving 6 images [exact bit by bit files!] from a webpage and making a collage out of them to download with description [closed]

Hello I have a code here below and I would like to know how to make it get the exact original images, because when I do look at the 6 images put together and downloaded, it is not the same pixels, as ...
user avatar
  • 1
2 votes
1 answer
33 views

bash script to setup a digitalocean webserver (apache2, nginx, PHP7.4, fastcgi, SSL)

The following bash script is intended to be run on a freshly installed digitaloceans ubuntu 20.04 droplet by root in its home dir. The purpose is to setup a ready to use webserver with SSL (certbot), ...
user avatar
9 votes
4 answers
2k views

Git Push Bash script

I created this bash script to make it easy to publish your files to a GitHub repository. ...
user avatar
2 votes
2 answers
39 views

JavaScript code to check whether X won a tictactoe game

My code is already doing what I want, so it's functional, now my concern is, if there is a way to make it easier to read or even better and shorter my code, it's supposed to check if 3 'X' or 'O' are ...
user avatar
  • 21
0 votes
0 answers
36 views

Deterministically hash dictionary

I need to compute a deterministic hash for a JSON-serializable dictionary. This answer almost does the job, but there are a few problems. If dict1 == dict2 then I ...
user avatar
1 vote
0 answers
47 views

Rust code implementing cosine similarity

I've been trying to create a piece of code which consists of looping through each element of a list of questions, preprocess it, and then calculate the Cosine similarity with the rest of the elements (...
user avatar
0 votes
1 answer
60 views

Clean up multiple if/else statements by using an enum [closed]

I would like to have an external opinion on how bad the code i implemented is. This is the context. I was working on a evolution on a legacy class, and i found this. ...
user avatar
-1 votes
1 answer
54 views

Forecast experimental results based on temperature [closed]

I would really welcome any hints on making this code more concise please. In this example we have some experiment results. For each planned experiment We have predicted results based on 4 temperatures ...
user avatar
  • 3
0 votes
0 answers
71 views

Best design for a generic reader

My goal is to propose a generic interface to read all kind of document, without bothering of file extension (reading word, pdf, etc ...). First Implementation: My first attempt was to implement: a ...
user avatar
  • 273
-1 votes
0 answers
14 views

im attempting to make a very crude neural network, and im having trouble with OOP [closed]

...
user avatar
0 votes
1 answer
48 views

Optimization using a differential evolution technique, ideally with a million iterations

I'm working on an optimization code using differential evolution to solve. However, it is taking a long time to get the solution. See that I have a variable called number_of_iterations that must equal ...
user avatar
0 votes
0 answers
21 views

Java utility which forwards a request to an error handler mapping

I have a class ErrorForward which is basically a utility. It's used in Servlets, inside the catch block. It forwards request to <...
user avatar

15 30 50 per page