# All Questions

74,497 questions
Filter by
Sorted by
Tagged with
7 views

### Round Robin algorithm implementation

I wrote a program that implements the Round Robin planning algorithm. The total number of processes is read directly from the input standard, and for each process the arrival time and execution time ...
10 views

### Python: functions vs methods vs classes for simple cases

I have the following file that is included in others. I realise I need to put in try/except but for the purposes of this question, the below should suffice Function ...
9 views

### Calculate time interval excluding breaks

I have a solution for a question I asked on SO: I am trying to create a database where I also need to find the time difference inside a record. However, timediff() ...
2 views

### Stamp Combination Kattis

I tried to solve Stamp Combination problem on Kattis, which basically gives an integer array and a target number. The problem asks whether we can find a contiguous subarray which starts at either end ...
10 views

### Initialize and run/stop subprograms in ViewModels

I make WPF application and I need start "subprograms" (scan directory & send to the API for now, in future - accept incoming files) in MainViewModel, ...
8 views

### Moving from Entity Framework to Dapper with DTO : Case Study

sp_name return a Dictionary(Of Integer, DTO) using the passed params. I attach VB.NET code. I have to convert the call using dapper, because we decided to use it in our application. Can you give me ...
6 views

### Advent of Code 2021 Day 4

Here is my attempt at Advent of Code Day 4 using Haskell. A file contains list of number in first line. And subsequent lines have the bingo Cards ...
119 views

### Implementing hash table

I am implementing a program to interact with hash table, the data to be hashed is just number. It works but I want to know if there is any error like: memory leak,... in my code and how to improve my ...
27 views

### Python module to print in printer

I made a code that simplifies the job of sending anything to print with the Windows API. The module has a Document object which stores a reference to the actual device context within it. You can ...
14 views

### Async generator that processes input enumerable in batches-at-a-time

I have a lot of Input documents, which contain collections of sentences. I would like to use an online sentiment API to attach sentiments to each of these sentences ...
14 views

### Updating active cards dynamically added by API

I am making a website where you can search through all the countries in the world. Once you have found a country you want more detail about you should be able to click and view a detailed page with ...
9 views

### Creating database and two tables linked by foreign key

These commands do what I want, but I'm trying to find out the best approach for this. My main areas of concern are: error handling and disposal of resources. In regards to error handling, I'm catching ...
291 views

### Block-free priority lock

Background I wanted to write an event loop that supports scheduling, but found that no implementation of priority queue that I know of supports waiting on a condition variable (the idea is that the ...
23 views

### Web-scrape bonds information from nasdaqomxnordic

I'm a newbie getting into web scrapers. I've made something that works, it takes 3.2 hours to complete job and randomly have 10 lines blank each time I run this job. Help is much appreciated! ...
5 views

### Getting a single result from multiple LiveData objects

I have an Android viewmodel for a Fragment that requires the user to perform multiple tasks. In addition to a LiveData object to track the status of each task, I ...
38 views

### Python: token request, SQL user fetch and API calls

I have the files as below. What I'm looking for is some feedback with regards to security, reliability, maintenance, scaling and performance. What is going on? Make a request to get a token to access ...
29 views

### Create walls in a game from a random maze

I use four bools, if true a wall is in that direction: ...
34 views

### Copying a folder to another disk in python

I have made this code to copy a folder to another disk, and it works, but I think there is a better way. If don't use the replace(), it says the folder exists and ...
45 views

### Is there a faster way to write dictionary values to csv?

I have a dictionary that I am writing to a csv file, however I am only writing the values. I want to know if there is a faster way than using a for loop. I am using python 2.7 here is my code. ...
13 views

### QMediaPlay Pyqt5 Python

Is it right to put this code, inside this class, like this? ...
12 views

### Using TVP and MERGE to OUTPUT Inserted Variables and TVP Variables

I have an application where a list of objects must be passed to an SQL stored procedure. The application needs to be aware of the unique ID that is has been given once inserted into the database. My ...
32 views

### Python: iterating with .items() or not? [closed]

I have this code for endpoint in endpoints: if key in endpoints[endpoint]['keys']: yield endpoint pylint suggests ...
15 views

### Pandas: process data on dataframe subsets

I have written a piece of code which select each ID whose value equals something, then select a subset for each ID and then work with the subdata. My dataset has over a million entries, thus the code ...
24 views

### Calculate how many categories I can construct

I would appreciate to have your opinion on this code and whether I can refactor it and make it cleaner. I don't like the fact that I have 3 nested for loops, which ...
16 views

### How to use collection from Postman to send HTTP request and after updating the bearer token? [closed]

I am currently trying to automate API testing using Python. I have stored the API endpoints in a CSV file and read the data through the loop to fire the requests. But I am getting HTTP Error 400. The ...
28 views

### Python: How to best create a dictionary from another dictionary in a library

I have the following code which builds up a dictionary of endpoints that I iterate through later on. Is this the cleanest, most scalable and performant way? I was thinking of adding a list as a key to ...
19 views

Details: Based on the input parameter to return corresponding output which is needed for setting & accessing Internet over interface [ppp0]. If the SIM is registered[ status = 1]. This script will ...
14 views

### Go REST API feedback

My intention is to create an API as generic and DRY as possible using Go. To achieve this, I have made some more or less common decisions: To use AJAX call to avoid reloading page when updating the ...
3 views

### Pytorch: RuntimeError: mat1 dim 1 must match mat2 dim 0 using 2D CNN model with pretrained vgg_16 [closed]

I am working on cardiac CT data(axial, sagittal, coronal). I am using the pre-trained model vgg_16. But got the following error. According to this error, my dimension is not correct but according to ...
49 views

### Finding the minimum element of a stack of numbers

As part of an online programming challenge, I wrote a program that implements a stack of integers, supporting adding and removing elements, finding the last inserted element, and the minimum element. ...
44 views

### C++ : Garage Sale Algorithm

I'm studying Dasgupta's "Algorithms". I solved this problem in C++: The garage sale problem. On a given Sunday morning, there are $n$ garage sales going on, $g_{1}, \cdots, g_{n}$. For ...
16 views

### Categorize similar transactions

Please review the code to categorize some uncategorized objects: ...
34 views

### Chess move selection using Alpha-Beta pruning

I'm a new programmer currently coding a JavaScript alpha-beta pruning minimax algorithm for my chess engine, using Chess.js and Chessboard.js. I've implemented a basic algorithm with move ordering. ...
31 views

### Recursively delete directory using relative filesystem calls

I made this function to recursively delete a directory and its contents, because using VLAs to concatenate paths is more susceptible to Stack Overflow and is probably slower. ...
41 views

### Try-catch-finally with 'using' in ADO.NET

I want to check if I'm correctly disposing of resources using Ado.NET. I'm not sure when the 'using' statement makes .Dispose() irrelevant. Please bear in mind I'm aware I shouldn't hardcode my SQL ...
14 views

### Generically calculate powers of two below a number

The following function is an attempt to generate powers of two below the input number max. So powers_of_two_below(15u8, u8::BITS)...
24 views

### Leaky Bucket algorithm with concurrency

Trying to mimic a scenario where multiple threads are creating the traffic to fill the buckets & a thread which leaks the bucket at a specified rate. Could you review this code? ...
6 views

### rust on esp32 no-std no-idf

https://github.com/JasonKleban/rust-esp32/tree/no-idf main branch of this project runs blinky with a oled printout and console output. I'm trying to get rid of ...
684 views

### Coding style and idiomaticity of solution to the Word Search II problem on LeetCode

"Word Search II" is a hard problem on LeetCode (problem #212): Given an m x n board of characters and a list of strings words, return all words on the board. Each word must be constructed ...
39 views

### Python - Temperature - descriptors with conversion

So I'm trying to understand the concept of descriptors and gathered some code together and made an exampel out of different sources. Like the offical documentation and StackOverflow answers. I'd hope ...
27 views

### Early exist fold implementations in F# with a high degree of similarity

I've been writing a bunch of helper functions lately, all revolving around the concept of an early exit fold (which is a bit like unfold, i.e. you can control when the looping ends but you pass a list ...
42 views

### Java OOP Hangman - revision (get word in category)

I've revised the code in the light of comments (the initial post was here). I've initially just redone the logic to get a random word for the category chosen by the player. I'd appreciate any feedback ...
13 views

### QMediaPlaylist python

i'm trying to play a background music that is already in my python project folder, the music plays very well, but i'm working with classes and i don't know if the way i wrote to play the music inside ...
19 views

### Multiple grouped value select component

I've been designing a React component to select countries that a user has visited, grouped by continent. This component is a part of larger project but is relatively self contained. This is my first ...
11 views

### rebuild message from strings parts in scala [closed]

The problem is to develop a scala function called rebuildMessage which receives an array of character strings as a parameter. Each part element was cut from a ...
26 views

### Efficient algorithm to generate random multigraph (undirected) given nodes and degree

I wrote a simple algorithm to generate 1000 random graphs given total nodes and associated node degree. Graph is undirected with multiple edges and no self-loops. My current algorithm is very slow: ...
84 views

### CodeForce 230 Dragon Fighting, Sorting without using array

Problem: https://codeforces.com/problemset/problem/230/A Kirito is stuck on a level of the MMORPG he is playing now. To move on in the game, he's got to defeat all $n$ dragons that live on this ...
25 views

### Get tennis game's state using scala

I am developing a scala function called TennisGameStatus which returns the state of tennis games between two players. To remind, here are the rules of tennis games :...