# All Questions

62,467 questions
Filter by
Sorted by
Tagged with
218 views

### Interpret a date from a string of digits

I developed a function that, from a given sequence of digits, extracts the date and reformat it. This is the code: ...
25 views

### Intercept and ignore SIGALRM in c [closed]

I have a program that sets an alarm, prints a question, takes an input and either prints "correct" or "wrong". If the alarm "rings" the program exits. I am trying to write a C wrapper that will: 1) ...
31 views

### Downsample fastqs

I'm working on a project to downsample some fastqs (files that contain sequences). Each line of the fastq bioinformatics format comprises 4 lines chunks (id, dna sequence, "+", quality score). ...
29 views

### buying stock module - nonlocal vs global variable or others? [duplicate]

[Background explain] I wrote three Flask views and module interact with the views. I do this one module called /buy using different scenario cases based on flag. Zero view if user come in GET, ...
20 views

### Optimization of weightedWinner() and random() function

I have written a Lottery contract that picks winner based on the amount they contributed to the pool. I am looking if the code of weightedWinner function can be ...
57 views

### WARNING - Codewars Kata - spoiler - getting to next level pythonic

The challenge: You managed to send your friend to queue for tickets in your stead, but there is a catch: he will get there only if you tell him how much that is going to take. And everybody can ...
21 views

### 'Form1 does not contain a definition for 'Form1', and [closed]

I am completing this tutorial: https://www.youtube.com/watch?v=bglYDCdoBCg I have uploaded the code and fixed all the reference errors but am still facing the following: "Form 1' does not contain a ...
57 views

### Video player UI in Javascript/JQuery

I am a Javascript/JQuery beginner working on my first ever project. Everything in this program is working as it should and I am happy with its performance. I have pieced it together from a variety of ...
18 views

### Test a method that Swizzles in Swift [closed]

How can I test a class that Swizzles? In particular, I want to test the following: ...
2k views

### Hero battle game

This is my first attempt at OOP/classes: a game where you will select a character and use attacks and abilities to defeat the enemy character. I have a few specific questions: I was told that having ...
47 views

I have implemented a class to abstract the process of building a shader program in OpenGL (For now it does not deal with uniforms). I would like some feedback on the coding style, and more ...
19 views

### Multiple Stopwatch App

I was fed up with the default alarm clock when doing laundry. The washing machine is in the basement and takes different time depending on the choosen program. The stopwatch has to be configured for ...
25 views

### Combine the same function that takes an array of string argumens and one that takes a single string argument into the same functon? [closed]

I have two functions that are basically the same, that could do with the wizardry touch that I can only find among the ranks of yourselves! function optional(arg) { if (Math.random() < 0.5) ...
33 views

### .xltx to .xlsx file conversion with bytearray and streams [closed]

I´ve written a code that will open a Word template .xltx and then convert it to a word document .xlsx I have put 2 parts of code together an made it work. My goal is to make it better and seek ...
23 views

### Hardware Clock Divider

I have created a clock divider that works as follows: If the division factor is 0, pass the clock through unchanged. Otherwise, flip the output clock signal after the specified number of input clock ...
14 views

### Apply labels from a stream to a Bitraversable

Labelling Traversable containers is an ancient and honorable test of skill. My task here is to create a generic labelling mechanism for a ...
75 views

### Persisting Variables Over A State Loss

In an application that I built recently, I needed to persist several variables, without loosing their state, for duration that the application was in use. After some research, I found this post on ...
20 views

### Custom React hook to store a sample window

I would like to record a list of the most recent values passed as props to a React component, including the current one. This list will be passed as props to a child component (a time series chart, ...
83 views

156 views

### YAAI (Yet another any implementation)

I am a C# game developer currently learning C++ and this is my second big-ish project (the first one being a vector implementation). This time I opted for implementing a mot-a-mot ...
44 views

### Handling errors in an input based program

I wrote a program which creates a svg-group that contains several arranged rectangles with passages inbetween to reach all of the rectangles inside of an area selected by the user. Each rectangle ...
81 views

### Knuth-Morris-Pratt algorithm in Java Finding substrings in a matrix

Problem Given two matrices: a pattern p and a text t. Write a program that counts the number of occurrences of ...
89 views

### Minecraft city class [closed]

This is a class representing a city in a mod I am creating for Minecraft. All the constructor parameters are mandatory and they are used to help the class that calculates and builds the Paths, ...
46 views

### Code help: Delete files that are older than 60 days [closed]

New to Python. I'm trying to write a script that will delete files that are older than 60 days. I know that there are a bunch of ready exampels out there that are ready but I'm trying to solve it by ...
283 views

### String Format object extension

I wrote an extension to create a string-representation by an object: ...
55 views

I wrote three Flask views below. First view input stock code Second view get the stock details (name, price) of the stock by using 3rd party api get the balance cash of DB and show to the view ...
60 views

### Timeout Error in Fraudulent Activity Notification HackerRank

I am solving this problem: Fraudulent Activity Notifications on HackerRank. I am done with my code and is working, but it is inefficient as well for very large inputs. I don't know but after all ...
20 views

### React Native form for entering one-time password [closed]

Here is the React Native code to optimize: it's an OTP form. I want it to be as small as possible. ...
17 views

### Cannot retrieve data 'movement' in the server using react-websocket [closed]

This code below is coming from serverside php codeigniter returning json data ...
41 views

### Asp.net middleware [closed]

This code is asp.net core middleware written in f# and called from c# for a blazor server-side app. How can this be made more efficient if any in regards to the async code. F#: ...
46 views

### Periodically synching data from an API to database is extremely slow

I have a scheduled task where I synch all the data from one table (via an API) to another. There are about 10,000 rows that are being updated and the new ones get created. This is what I came up with ...
54 views

### Drag and drop selected array items in Javascript

I've written a function that moves selected items from a list into a new position. I've found that in order to do this, I need to retain the original 'index structure' of the array. The way I've done ...
27 views

### Split a string inside of a list in Python [closed]

I am new to learning python. I know I am supposed to use a split for separating the first and last name of the first item on the list but I am not sure how to do this. My code is as such ...
40 views

### Java ArrayList Sorting 2D ArrayList [closed]

I was trying to sort ArrayList including both Element but did not work great. ...
42 views

### Combining two nested for loops into one [closed]

Description What this does is it takes a randomly generated 64x64 stack and checks for overlap within the 64x64 array. Here is an example: https://imgur.com/a/kkPRzhn. Each color is its own ...
609 views

### Peak valley detection in python

Below is a peak/valley detection algorithm I've designed. The basic premises for this function is that we split our data into chunks, do linear regressions on these chunks, detrend the data based on ...
17 views

### Angular8 pass all data through FormGroup

How to improve this code? Is it somehow possible to remove fields fro, html and pass all necessary data through FormGroup? app....
52 views

### 99 beers song in Rust

I'm learning Rust. I find it sometimes confusing when compared to other programming languages, especially when dealing with strings and slices. Her's an implementation of the 99 beer song that I've ...
295 views

### Perform a predetermined set of operations on a large sequence

This is a programming challenge. I have been given the following input: $n$ where n is size of sequence $k$ is an integer a sequence $A_0, A_1, A_2, \ldots A_{n-1}$ I need to ...
48 views

### Can anyone give me feedback on my encryption program? [closed]

My name is Valentino, I am 14 years old and I have just created with a friend an encryption program. I haven't got many people to try it yet and wondered if anyone would try it and give me feedback ...
85 views

### Sanitize and build data structure from Consul configuration

I have a piece of working code that takes some strings from Consul configuration exports, sanitizes them a little and converts them into valid json and/or hocon structures. While I am iterating over ...
96 views

### Decoding of binary data (AIS) from socket

I am currently working on a AIS message decoder written in pure Python. It's just a little project to teach me some things about binary data, decoding, etc. Because I am only programming for about a ...
54 views

### A simple priority queue in Java via linked list sorted by priority keys

Now I have this very simple priority queue. add and changePriority both run in $\mathcal{O}(n)$ and ...
67 views

### Bash script for speedreading training

I have coded a speedreading training bash script. My targed was to make some experience with bash in a funny way. It ...
17 views

### Search for specific lines in a txt-chaos [closed]

import re log = open("automatic.log", "r") answers_in_my_head = 0 chance_on_succeeding = 100% print("Hey guys! I am a beginner, I've only written ...
56 views

### Simpler state manament alternative to Redux, MobX, Context API, etc

I got frustrated with the jargon and created an alternative state management solution. Its up at https://github.com/smakazmi/react-soliit. It goes something like this ...
876 views

### Displaying characteristics of the Hero in a console game

I am beginner in OOP. And i want you to analyze my piece of code and give me some recommendations. My task was : RPG game give a chance to choose race of Hero : Argonian, Breton, altmer, nord. In ...
81 views

### Fantasy Game Inventory - Automate the Boring Stuff with Python

Below is my code for the Fantasy Game Inventory problem from Chapter 5 of Automate the Boring Stuff with Python. Is there anything I can do to make it cleaner or more efficient? The code starts out ...