instruction
stringlengths
71
95.1k
I started university this semester. Can you review my code and share your thoughts with me # 5-November-2020 username = input("Please enter your username: ") password = input("Please enter your password: ") username_password = { 'Mert': "mertt" } if username in username_password: if username == "Mert" and pa...
I am trying to use bluepy to write and read serial data to/from an HC-08 Bluetooth module. The HC-08 is connected to a device that returns a fixed number of bytes whenever it receives a message over the HC-08. Below is my code so far. This seems to work—however, I kind of winged this code from examples and an a lot of ...
Below is a simple typescript class used to generate a room code for an online lobby-based game (for example, https://jackbox.tv/ uses 4 digit codes to join rooms) The goal of the class is to quickly generate unique 4-letter codes for game lobbies, and release them after the lobby is closed. Typically, less than 100 lob...
I needed to write a Python generator that lazily generates, in lexicographical order, strings composed of a certain alphabet (e.g. lowercase English letters). My first thought was to make an infinite generator, but an infinite iterator would be pretty useless because it would just generate strings composed of only the ...
Original problem (not in English): https://pokval21.kattis.com/problems/pokval21.robotdammsugaren How can my code be optimized? import sys j = 0 instructions = [] room = [] for i in sys.stdin: inp = i.split() if(j == 0): r = int(inp[0]) c = int(inp[1]) k = int(inp[2]) if(j==1): ...
I am making a puzzling tool using Pygame. We have unlimited containers that we can choose their maximum capacity, and how much water is in them. We can also choose the size of each unit for convenience. Here is how it goes: Here is my code: import pygame pygame.init() wn = pygame.display.set_mode((600, 600)) class ...
I have multiple binary (structured) file, each of 2GB, which I am currently reading in pair, using memmap to cross-correlate the same. I want to minimise the time required by this IO process, in the code. I am implementing this as a Cython function, though the copying of memmap array to numpy array is quite fast (~3 se...
I am creating a watchdog in python to monitor a folder and then create a backup with the new version when a file is modified. I extend the FileSystsemEventHandler class to add 7 extra variables. However not every variable is used on every event so I'm not sure where to initialize the variables and where to put the logi...
Hello I am making a code in C to find the value of the last sequence of palindromes of a specified size (d) and I need to optimize this code as it is for an exercise platform called URI Online Judge and is giving Time Limit exceeded. https://www.urionlinejudge.com.br/judge/en/problems/view/1686 Given a string s[1..N],...
Hi I am trying to write a programme that outputs the probability that the two randomly selected numbers are coprime Two integers are coprime if the only positive integer that divides into both of them is 1. In other words, the greatest common divisor of two coprime numbers is 1. If two numbers x and y are selected ran...
I decided to write a simple tab bar for macOS using Swift. tabs.swift import SwiftUI import Foundation import Combine class ViewRouter: ObservableObject { @Published var currentView = "home" } struct Tabs: View { @ObservedObject var viewRouter = ViewRouter() var body: some View { GeometryReader { geom...
This is a follow-up question for A recursive_transform Template Function for BoostMultiArray and An Add/Minus Operator For Boost.MultiArray in C++. Besides the add / minus operator for Boost.MultiArray, I am trying to implement an element-wise increment operator and decrement operator as below. The recursive_transform ...
This time, one of my labs state that I need to write a complete java program which will calculate the square root of a number via Newton's method. The reason behind using Newton's method, as opposed to Math.sqrt(x) is so that I get to practice the use of simple IO, conditional expressions, loops, and nested loops. The ...
There is a problem on Exercism Java track that requires writing a function to flatten an arbitrarily nested list to a flattened list without null values. For Example input: [1,[2,3,null,4],[null],5] output: [1,2,3,4,5] Here is the solution I wrote for it without using wildcards. public List flatten(List<Object> two) { ...
I'm trying to implement a Doubly Linked List data structure in C++. Please give me suggestions on how this code can be improved. Try to remain in C++11 because that's what I know atm. #ifndef DOUBLY_LINKED_LIST_HPP #define DOUBLY_LINKED_LIST_HPP #include <iostream> template <typename T> class DoublyLinkedList { ...
I like to compute dummy variables based on the existing values in a dataframe and a dictionary with certain "cut off" points. I wonder whether I need to get rid of the for loop in the example below. And if so, how? The second answer in this Stackoverflow post compellingly urges to avoid looping through dataframes. In m...
I'm new to javascript and trying to figure out what improvements I can make to my code. In this code I retrieve values ​​from an iODBC database then I format and push in SQL database. I am making arrays to get all my values that I am processing, however I think the best way would be to do it in object. I don't know if ...
I am working on a project in which I am using vue js 2 and electron , to manage the state I use vuex , I have at least 20 actions to call methods: { ...mapActions('Store1', ['FETCH_AB',...]), ...mapActions('Store2', ['FETCH_DS',...]), ...mapActions('Store3', ['FETCH_SD']), ...mapAction...
I have a list of dictionary let's say : l=[{'a':1,'b':2},{'a':5,'b':6},{'a':3,'b':2}] and I want to have another list l2 and add 4 to the 'a' in the all dictionaries l2=[{'a':5,'b':2},{'a':9,'b':6},{'a':7,'b':2}] (the first list l shouldn't change) so I am doing it this way but i feel there is better, it is a bit hard ...
I have two optional strings, any of them can be None. I want to create their combination with a delimiter between them if they both exist. I expect to be able to come with a more concise and nicer solution. val seq = (Some("abc"), None) val none = (None, None) val both = (Some("abc"), Some("x")) def concat(s: (Option[...
Currently, I am working on this project where I need to achieve the following... Get column named Category from MySQL database. And whatever the output is, check the specific radio button on winforms. I'd like to see if I can improve it, or if there is a much easier way of achieving my goal: Personally - i think there ...
This is my code. It loops a menu, from which you can select whether you want to add a subject, see all subjects or delete a subject. Is there anything style- or functionality-wise to add or correct? def add_subject(subjects): # ask for subject to add add = input("\nWhat subject do you want to add? ") ...
Given a byte string S of length l, obtain the string D of length l-1 as D(i) = S(i) * S(i+1) (each element of D is the product of two consecutive elements of S). here is my code. bits 32 global start extern exit import exit msvcrt.dll segment data use32 class=data s db 1, -3, 4, 7 ; declaring the strin...
Let's assume you are writing a REST Api with a common structure like Controller > Service > Repository > Database. In the database there's a table with a column with a unique constraint: // Examples with typeorm/typescript // user.entity.ts @Entity() export class User { @PrimaryGeneratedColumn() ...
The following code is in-memory repository that stores key/value pairs. It will be used on our server to keep information about active clients. Clients send keepalive messages to indicate that them are active. Important point: the information of inactive (expired) clients should be removed from repository ASAP. A clien...
Have you ever written a python script, then got to a part where you have to get input from the user? I would assume your code went something like this: user_input = int(input("Enter number: ")) Then you realized that if the player enters "keyboard spam", then your program crashes. So you need to set up a while-loop ex...
Today's assignment states that I need to write a complete java program which will calculate the relative orthodromic distance between two sets of geographic coordinates declared by the user. When the user enters latitudes, it should be in degrees with negative numbers representing South latitudes. Similarly, the longit...
I created this project on EDA Playground that builds a variable-width 3-way multiplexer out of 2 variable-width 2-way multiplexers. It will be part of homework that I assign, so I want to follow all best practices. I followed the lowRISC Verilog Coding Style Guide. Design Modules module mux2 #( parameter Width = 4 ) ...
I'm trying to refactor the working code below which intends to handle bill cancellation, but doesn't seem "linear" enough. open FSharpPlus open FSharpPlus.Data type BillCancellationReason = | A | B type OrderBillingCommand = | A | B type OrderBillingEvent = | A | B type CommandError = | A | B type BillCancellationReq...
So I have two PHP files that execute SQL code in them. It's a simple registration script and an account recover script. I want to know is my code safe from SQL exploits & other exploits? Here's how my code works. how my registration system works a person goes to my url with specified data such as the following example...
Can you please give your feedback to my double linked list implementation below? It comes with some very basic functions as well as separate code to test the implementation. The tests are only 'success' tests. I used valgrind to catch and fix any kind of memory-related issues that I came across and valgrind did not rep...
S is a given character string, then I have to find all the digits characters of S. Did I make it unnecessarily complicated? bits 32 global start extern exit import exit msvcrt.dll segment data use32 class=data s db '+', 'r', '0', '8', '8', '1', 'i', '5' len equ $ - s digits db '012345789' d t...
Very difficult to explain in a sentence sorry so here is example. I have this array: $setParams = [ 'repeat_delay' => [23, 1], 'repeat_type' => ['Hour', 'Day'], ]; that I want to turn into this $wanted = [ [ 'repeat_delay' => 23, 'repeat_type' => 'Hour' ], [ 'repeat_delay' =...
The program below defines macros START and END that expand to the left and right curly bracket symbols plus some example tracing code. Is this a portable use of a macro and are there any obvious major problems with this? It compiles fine under gcc --pedantic #include <stdio.h> #define TRACE #ifdef TRACE #def...
I have created custom video player based on HTML5 video API and JS. Please review the JS. P.S. I couldn't add the video, if you want to check how it works, please add some example video. Thanks. (function() { 'use strict'; const player = document.querySelector('.player'); const video = player.querySelector('.v...
I've a table with the following data and I need to find the number of minutes between two jobs (Say A and C). The following query works but wondering, if there is a simpler way to achieve the same. DECLARE @StartTime datetime Declare @EndTime datetime set @StartTime = (SELECT start_time from table where jobn...
So I have a file(story.dat) with a randomly generated story like: "Sleeping in his car was never the plan but sometimes things don't work out as planned. This..." It will print out each word and the corresponding word to it like so: 0."It: was, 1."Pepsi-Cola.": He, 2."This: is, 3./: 50., 4.50: /, 5.50.: I, 6.A: long, 7...
I have the following postgresql query that was created for use in a production database to return a daily recap of counts. This query runs and returns correct results in the "staging"/test version of the database, but when run on the production db, no results are returned. I suspect it's the method I used to accomplish...
This is a follow-up question for An Element-wise Increment and Decrement Operator For Boost.MultiArray in C++ and A recursive_transform Template Function for BoostMultiArray. I am trying to implement a ones function which can construct a new Boost.MultiArray object with the given dimension and assign each value to 1. T...
I made a word searching app that allows the user to inout words into a text box, and parts of the word grid will be highlighted to show the location of the words. The letters of the grid can be edited while you are using it by clicking on the cell, and pressing the key you want to replace the current letter with. Here ...
[EDIT] The question has been edited. Please make sure to read the summary at the end of the post. If you'd like me to make a new post with a cleaner explanation and better examples, tell me to do so in the comments. [/EDIT] [ORIGINAL] Recently, I've started learning and exploring more about template metaprogramming. I ...
can this script be made simpler? I'm just learning about javascript, so I don't really know which syntax to use. My HTML I have several id consisting of "doc1, doc2, doc3, .." and there is another id "icon-cek1, icon-ceck2, icon-cek3". "icon-cek" is used to display the place of a checkmark icon when the upload is succe...
I was thinking of the following problem: List all sequences \$ a_1, a_2, a_3, a_4, a_5, a_6, a_7 \$ of positive integers where \$ 1 \le a_1 < a_2 < \ldots < a_7 \le 39 \$. For any sequence with this property, my code computes the next sequence in lexicographic order. Starting with the initial sequence \$ [1,2,3,4,5,6,7...
I just completed a snake game using object-oriented programming. The focus is on the class implementation. OVERVIEW Snake game works by moving the snake in order to eat fruits whilst escaping obstacles such as walls and itself. Aim To conform to SOLID design pattern. food.h #ifndef SNAKEXENXIA_FOOD_H_ #define SNAKEXE...
I've been learning PHP and I've created a phone book webpage as an exercise. I am satisfied with the way it works -- it seems to handle all possible input cases correctly, and the interface feels nice and solid. I would appreciate feedback on the code style, as well as suggestions for what would be a better or more idi...
I created a dice rolling game where the outcome shows the highest sum of rolls per player. As you can see from the if/elif statements, it's not very eloquent. I do not want someone to rewrite those statements into something more efficient. I would like to know if there is a better way of writing it and what that sugges...
I have the following program that I wrote as an exercise for learning C. It simulates the scheduling of processes according to round-robin, first-come-first-served, shortest-job-first, and priority-scheduling policies. It reads a list of processes from a file, which are represented with the format [id] [cpu burst lengt...
I wrote a Java Spring Boot application with MongoDB that on every application start loads customer, account type and transaction details from CSV files to MongoDB. It has one end point that returns transactions for a given customerId and accountType (for example customer id 1,3,5 etc. or account type "ALL"). The main t...
IBM's Maximo Asset Management platform has a WORKORDER table (265 columns). Details: The WORKORDER table contains two different kinds of rows: WO records (istask = 0) Task records (istask = 1). The table has columns that store the actual costs (populated for both non-task WOs and for tasks): actlabcost (actual labor...
I am not an expert in shell scripting, I need help optimizing the shell script I wrote, This shell script I wrote is run by users on the client side who connect to our vpn server from the setting passed in the config.tar. I check if pip or or tar or other packaches are installed if not isntalled than install it, I am d...
What is an FEN? Link to the Wikipedia page: Forsyth–Edwards Notation An FEN is a very simple way of representing a chess position in a single line string. It contains the following data Which piece is placed where, and which squares remain empty Who is going to play the next move, white or black Castling rights en-pas...
Need help to refactor this code to look like its done by a pro. Or just put some advice or links to useful stuff. The idea is to clone a div with two empty tables for two separate arrays of data. div is cloned depending on the longest array length between the two. Then append row of data to them, if rows reach max numb...
I wrote brainfuck interpreter in order to prepare myself for a C job. I try to write the code as clear and as defensively as I can. Can somebody take a look at the code and give me some hints for improvement? // tape.h #pragma once #include <stdio.h> #include <stdlib.h> #include <assert.h> typedef struct Tape { l...
GitHub Here is a Castle.Core based service interface decorator providing automatic logging through the ambient logging context. Logging context should be constructed higher in the call stack: using var log = new Log(log.Debug, log.Info, log.Warning, log.Error); and used through the static API after: Log.Info("Hello Wo...
In the code, I am checking altPhoneExist and altEmailExist conditions multiple times. How can I avoid this and improve the performance and readability of the code? Code Description: A contact is created and added to a list if one of the conditions is true. And a different set operation executed for each one. boolean al...
Conway's Game of Life Conway's Game of Life is a mathematical game invented by English Mathematician John Horton Conway. The game is based on the theory of cellular automatons. It is a so-called zero-player game because once the "player" set the initial state of the automaton, the game is just about to watch the determ...
I'm playing around with the concept of functional programming. I have flattened the nested if statements and made by code more verbose. The refactored code looks overly complicated. What could be a simpler approach? Nested Ifs public static int Main(string[] args) { int computer = 1; string brand = "PC"; i...
So I have tried to implement a doubly-linked list in C++. My implementation includes some basic methods (although I know there could be many more), an iterator class and an overwritten << operator. I know the code is quite big, but I would really appreciate any comments on functionality, style or anything else you thin...
This is a follow-up question for A recursive_transform for std::vector with various return type, A recursive_transform Function For Various Type Nested Iterable With std::variant Implementation in C++ and A recursive_transform for std::array with various return type. The execution policy parameter is available since C+...
I am making a number uncovering app. The program takes in an equation that has numbers hidden as letters, like: abc + d = efg - hi and it will return all the strings like 290 + 6 = 347 - 51 290 + 7 = 348 - 51 250 + 6 = 347 - 91 250 + 7 = 348 - 91 290 + 4 = 365 - 71 270 + 4 = 365 - 91 290 + 4 = 375 - 81 280 + 4 = 375 -...
I have a registration system, but I really don't know if it is safe, because I don't understand security very well and I'm afraid of compromising my clients' data, I believe that the methods I created are good for security, but I still have doubts if it is safe I created several variables using encapsulation, and then ...
This is the initial skeleton for a short game written in Fennel for a Jam event. It runs sensibly, but I want to know if I'm missing something that could make the code more elegant as it's a bit confusing and smelly at the moment. Edit: since it seems people found this interesting, updated with the actual final release...
I created a assembly REPL using some ctypes hacks to run the assembly code. Any suggestions on how I could improve it? I am unconcerned about some of the "obvious" security issues such as running raw assembly or using eval, since it only affects the user. Main script: #!/usr/bin/env python3 import ctypes import re impo...
Here is the sender and handler interfaces: public interface ISender { Task SendAsync(object e); } public interface IHandler<in TEvent> { Task HandleAsync(TEvent e); } So I register in IoC container a sender service implementation, which dispatches events to all the compatible IHandler<in T> implementations. I...
This is my first time web scraping, and here is the code I whipped up: from bs4 import BeautifulSoup import requests import time keywords = ['python'] for n in range(1000): res = requests.get(f"https://stackoverflow.com/questions?tab=newest&page={n}") time.sleep(3) # Sleep to avoid getting rate limited again ...
I want to create a wrapper around this third party package class so that I don't litter my app with calls to it. The idea being that if there are breaking changes to the package (rename the class or one of its members), or if I want to delete the package, I can just change my implementation of it in this one file. Here...
I saw this problem in C++ on here and decided to try it in Python, which was much simpler. I've used the same problem blurb as in the link above, so they are consistent. I'm sure my code can be improved. You are given 3 strings: text, pre_text and post_text. Let L be a substring of text. For each substring L of text, w...
I have built this Django Package which is an alternative for sending mail to users using Gmail API. Everything is working fine. But the verify(self, request) method inside gmailer/gmail.py is not feeling great with the way I coded. I need to optimize this code and understand if there is a better style of coding that I ...
This is a simple game I am making in the arcade library of Python. I am quite new to object-oriented programming as well as game development. I feel like a lot of the code is inefficient, so I was hoping to get some improvements on the code. Any kind of suggestion is appreciated. import os import random import arcade ...
I found one project on Internet and after I downloaded it, I got this message from SonarQube: Move constants to a class or enum. But, when I downloaded SonarLint, it did not report any code smell. This is the code: @Repository public interface TaskRepository extends JpaRepository<Task, Long> { String QUERY = "up...
This is a follow-up question for A ones Function for Boost.MultiArray in C++. Thanks to G. Sliepen's answer, the mentioned method which can set various initial value is better in generic purpose usage. However, the previous function specified the input type which must be boost::detail::multi_array::extent_gen<NumDims>....
I have implemented a structure to handle BitVector64 (default System library support only 32 bits). In the implementation i have added some custom method to manipulate bits inside the vector. I would like comments and suggestions about the implementation, because i am concerned about correctness and performance. Ps : i...
I have the following code that takes user input "path" and adds the current time into the filename after the name part and before any extension (if it exists). It seems a little hacky to me just looking at it. What do you think? #include <string.h> #include <stdio.h> #include <libgen.h> int main() { char buf1[256]...
Here is my task: Create classes for a menu plan. With the help of the classes it should be possible to create a menu card for a restaurant in a hotel. There should be a 'MenuCard' class for this purpose. This should include a date for the card and one or more course menus. Use an appropriate data type in Python for the...
This is bad. I've been hacking away at Sympy for a few hours and the only solution I've come up with to yield the data I want is brute-force: Code from sympy import Interval, Naturals0, Q, Symbol, refine, solveset N = 10 digit_interval = Interval.Ropen(0, N) digits = digit_interval.intersect(Naturals0) # equivalent t...
I'm a beginning programmer and wrote a little code for a mathematical question. There are 6 rounds where each time the pile of cupcakes is divided into five equal groups, with one extra cupcake (which is discarded). Then one fifth is taken away and the next round starts. I've written the code, but there must be a way t...
I have created this simple currency convertor to learn VueJs more. Any code review/comment on coding standard and best practice for Vue? Thanks in advance. new Vue({ el: "#app", data() { return { currency_from_amount: 0, currency_to_amount: 0, result: '', currencyFromOptions: [], ...
(This is homework, however I have a working solution that I'm trying to improve upon) I'm working on a program that adds or subtracts up to 15 decimal or hexadecimal numbers from the command line. You run the program with the arguments and then choose the option from a menu. I.e.:./main 5 10 15 20 will take in those fo...
I wrote the following method which would just call an API which would then update a user's subscription to something. void updateSubscription(String userId, boolean subscribed){ try{ // some stuff restTemplate.exchange(.....) // some stuff }catch (HttpClientErrorExcep...
https://leetcode.com/problems/is-subsequence/ Given a string s and a string t, check if s is subsequence of t. A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, "...
Could you please give me some feedback on the use of class methods in this Python script? The code retrieves time entries from the Toggl API and works as expected. My question is, do the methods make sense? The methods first_api_call and make_subsequent_calls change self.data. Is this okay or should all the changes to ...
I am trying to resolve below question in order to prepare for an interview xD An XOR linked list is a more memory efficient doubly linked list. Instead of each node holding next and prev fields, it holds a field named both, which is an XOR of the next node and the previous node. Implement an XOR linked list; it has an...
This is my first attempt to learn Rust by applying it for a problem that I assume is suitable for the language. It's the Intcode computer from https://adventofcode.com/2019. I've implemented all the features of the computer, and the result is the following: use crate::ComputeResult::{CanContinue, Halt, WaitingForInput}...
Here's Some Context So I was messing around in Minecraft and decided to make some code that basically makes you god. While making the code and testing it I noticed there were some problems that I didn't know how to fix, and came here to see if there were at least a semi-professional coder that could review my code for ...
I am in learning process, even though its a very easy project, I still want experts to please review it and share the improvement that can be done, if anyone wants to use other modules to shorten the code then you can also use them, I already thank you to the people who wants to spend their precious time for this. othe...
I have a random forest model I built to predict if NFL teams will score more combined points than the line Vegas has set. The features I use are Total - the total number of combined points Vegas thinks both teams will score, over_percentage - the percentage of public bets on the over, and under_percentage - the percent...
This is a follow-up question for A filled_multi_array Template Function for Boost.MultiArray in C++. Based on G. Sliepen's answer, there is another get_extents template function mentioned for handling retrieving boost::detail::multi_array::extent_gen<NumDims> type size information from a multi_array. I am trying to imp...
I'm fairly new to c++ programming. It would be helpful if I could get a feedback on a dice game I wrote. I would really appreciate some tips as well as your opinions. This program will begin by asking the user to enter an amount to bet (from $1- $1000). Next, the user is asked to guess the total that will occur when tw...
I did this Tic-Tac-Toe as an exercise for OOP. I would like to know possible improvements (the method main loop is too rock and roll, if you have suggestion to reduce it and improve readability). Code: import numpy as np class Game(): """Core of the game, contains the loop and victory checking""" def __in...
Which of these variations do you think is the best way to write a function that returns True based on multiple conditions? Variation 1: def is_trial_plan(order): return ( "shipping" not in order and order["amount"] == 0 and order["description"] == "Affiliate" ) Variation 2: def is_trial...
Would you help me? I want to make this code efficient and simple. Original Link Frodo, a backcountry explorer, came to explore an underground cave with n rooms during his expedition. All rooms are numbered 0 through n-1. There are many, the only entrances are connected with 0 rooms. Each room is connected to each other...
Question description I am currently developing an RPG to gain programming experience. An RPG consists of many individual components such as the combat system, quest system and the item system. I decided to develop an item system first, before I develop the other parts. I have made some philosophical thoughts on the que...
I wrote a script that places documents to the folders they should be (based on my preferences of course). It even creates the folder if it doesn't exists. Here's how it works: You run de script by clicking on it. (idk if I should let this run in the background constantly, I don't use it that much) Checks the selected ...
As the title says, I have created an alternative class to imitate AsyncTask class (deprecated) with Thread and Handler classes but i feel uncomfortable to use it.(the app works fine with my class) Can you guys tell me is it ok or not? I feel like there is nothing changed. The reason i want to stop using AsyncTask is me...
Objective Determine whether a given word is contained in a 2D Array word search. Question 1. What are the time and space complexities of the current algorithm? Time complexity Linear: \$O(2(r * n))\$ There are iterations through the outer and inner loops for the rows and columns occurring twice, once for the horizont...
This question is a follow up question to the Product of all but one number in a sequence. I am posting a new code here with taking into consideration the suggestions of [Edward], [CiaPan], [chux], [superb rain] and others. Please advise how the code efficiency can be improved. #include <stdio.h> #include <stdlib.h> ...
I have two arrays of objects. One has an id property with a list of ids and the second has an object with a unique id property. I want to filter the ids in the second array with the first list and get the data. const data1 = [{ name: 'A', ids: [1, 2, 3] }, { name: 'B', ids: [4, 5, 6] }, { name: 'C', ids: ...
This question is a follow up question to the XOR linked list implementation. I am posting a new code here with taking into consideration the suggestions of Toby Speight and Deduplicator. Please advise how the code efficiency can be improved. #include <stdio.h> #include <stdlib.h> #include <stdint.h> struct StNode { ...
Story Niñez friends from Kakao Elementary School meet a stream with stepping stones on an autumn picnic with Ms. Ryan and are about to cross over to the other side. Ms. Ryan made the following rules so that Niñez and his friends can safely cross the river: Stepping stones are placed in a row, and the number of times a...
I made a small python script to create an audio sound used as stimuli. It's one of my first uses of super(), and I do not know if I did it right. I'm looking for any improvement in both optimization and style you could suggest. import pyaudio import numpy as np class SoundStimuli: def __init__(self, fs=44100, dura...