instruction stringlengths 71 95.1k |
|---|
Problem description:
The sum of the squares of the first ten natural numbers is,
1² + 2² + … + 10² = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + … + 10)² = 55² = 3025
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is:
3025 – 385... |
I have an app which parses data files on the clients browsers and displays a scatter chart. This is an example of a scatter chart with 10,000 data points:
This is an example of a scatter chart with 1.4 million data points:
My algorithm is crude and simple. I get the events in a correct format (eg if the canvas is 200... |
I am trying out Leetcode problem 68 and I need your help to asses the code. I am pretty new to this.
Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified.
You should pack your words in a greedy approach; that i... |
Been working with python for a couple years on the side, looking to get feedback on this Blackjack game I made for some OOP practice. Code executes as expected (and I know the game is incomplete - no splitting, etc).
https://github.com/josh9730/misc/blob/main/blackjack.py
Code:
import cards
class Blackjack:
game_... |
I'm making a timer class in C++. This is the overview:
#include <chrono>
namespace ktp {
class Timer {
using Clock = std::chrono::high_resolution_clock;
using TimePoint = std::chrono::high_resolution_clock::time_point;
public:
Timer(bool start = false) {
if (start) Timer::start();
}
void pause()... |
I wrote my own hash function and my own hash table.
My hash function seems to work surprisingly well!
Feel free to comment anything!
Hash function:
#ifndef __CLRS4_HASH_FUNCTION_H__
#define __CLRS4_HASH_FUNCTION_H__
#include <bit>
#include <common.h>
namespace frozenca::hard {
using namespace std;
template <size_t... |
I'm trying to learn about OOP, specifically encapsulation, and use of static.
My goal is to improve my coding skills, I am just looking for feedback specific to encapsulation, the use of static, and any other tips to make this "production quality". I don't feel confident the Solve method has been implemented correctly.... |
Here are 2 bubble sort algorithms:
1:
function bubbleSort(array) {
let i = 0;
let startVal = array[i];
let comparingVal = array[i + 1];
let iterations = array.length;
while (iterations > 0) {
if (comparingVal === undefined) {
i = 0;
startVal = array[i]
comparingVal = array[i + 1]
... |
I'm translating the python program video-diet as I am learning rust. The program is to recursively compress video files in a directory, but here I'm just preparing the ffmpeg command.
I like to follow clean code principles. The problem I usually have is that I don't know how to make some functions smaller; for example:... |
I'm looking for advice on how to improve the performance and/or style of these two search functions. This is just for fun and for practice: they are already fast enough for any application I would be using them in, and they don't have to meet any specific performance criteria, but I'm interested to see how they could... |
I am using "tinyexpr", a cute library that can solve mathematical formulas in a string and I extended it such that it does logical operations with two operands as well.
However I wasn't sure how to handle the logical NOT as it is performed on a single operand, which is why I just created a small function that does just... |
I'm making a connect4 game in c++ and so far i have almost got the board class done
before I continue coding i want your thoughts on what I should improve because
i definently feel like this could be way simpler
class Board {
public: enum Type {
player1,
player2,
empty
};
private:
std::array<std:... |
I came up empty handed in search of an alternative to Quartz for scheduling Crons in a clustered/distributed environment. Redisson has a scheduler, but it came with its own issues:
https://github.com/redisson/redisson/issues/4020
https://github.com/redisson/redisson/issues/3991
https://github.com/redisson/redisson/iss... |
I made a connect4 game in c++ please tell my how I can make the code better, thanks.
I already asked some people and they told me i should be using fixed witdh ints and [[nodiscard]] on functions that cant be discarded
and also to use noexcept on functions that dont throw
#include <algorithm>
#include <array>
#include ... |
I am trying to perform the No-Reference Image Quality Assessment (NR-IQA) calculation on video. Several NR-IQA methods including Naturalness Image Quality Evaluator (NIQE), Perception based Image Quality Evaluator (PIQE) and Blind/Referenceless Image Spatial Quality Evaluator (BRISQUE) are used and the calculation resu... |
I am new to programming and was working on a project that calculates an entire "diet plan" as well as a projected weight goal for each week.
There are three objects that all have methods called on them to print the details for their weight loss plan. Each "person" object contains a name, a current body weight, desired ... |
Here is my program to convert Arabic numbers to Roman numbers in AEC. You can see it live on my website:
CharacterPointer elements[13] := {"I", "IV", "V",
"IX", "X", "XL",
"L", "XC", "C",
"CD", "D", "CM... |
Code is posted after explanation.
Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused.
Post 2 of 3, CLI: UPDATE 1 on Newspaper Bill Calculator CLI with Python (2 of 3, CLI)
Post 3 of 3, Database: UPDATE 1 on Newspaper Bill Calculator CLI with Python... |
Code is posted after explanation.
Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused.
Post 1 of 3, Core: UPDATE 1 on Newspaper Bill Calculator CLI with Python (1 of 3, Core)
Post 3 of 3, Database: UPDATE 1 on Newspaper Bill Calculator CLI with Pyth... |
Code is posted after explanation.
Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused.
Post 1 of 3, Core: UPDATE 1 on Newspaper Bill Calculator CLI with Python (1 of 3, Core)
Post 2 of 3, CLI: UPDATE 1 on Newspaper Bill Calculator CLI with Python (2... |
Problem description:
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10001st prime number?
Prime number:
A prime number is a whole number greater than 1 whose only factors are 1 and itself. A factor is a whole number that can be divided evenly into anothe... |
I have written a program to convert an infix expression to postfix with the help of infix2postfix() function. Please review my code and suggest ways to make it simpler and more readable.
Code:
#include <iostream>
#include <cstring>
#include <stack>
using namespace std;
int isOperator(char x)
{
return (x == '-' || ... |
Is there a way to do in a nicer way the following thing in Python ?
def proving():
a = 4*5
b = 1*9
results = [a,b]
return results
results = proving()
a = results[0]
b = results[1]
I would like to make a function that makes some calculations and then obtain the values of the variables of interest from ... |
This is a utility class for running CompletableFuture<T>s in batches (e.g. to avoid using too much bandwidth making HTTP requests). It seems to work, but I'm a little iffy on the use of my CompletableFutureReferenceWrapper class— I need it so that wrappedFuture can remove itself from running after it completes. Is ther... |
I've written a simple JavaScript function to increment a counter after clicking on a button.
Here's my code:
function incrementValue() {
span = document.getElementsByClassName("quantity")[0]
let value = span.textContent;
span.textContent = Number(value) + 1
}
Is my solution to what I want to do too si... |
I'm studying nodejs w/ graphql and I would like to make sure I'm going in the right direction here.
My study project is based on a simple ERP with entries, products, orders and users.
I have one mutation that creates products indiviadually but I thought that allowing add products while creating a new entry (same mutati... |
public class BlobStorageHelper
{
private readonly StorageSharedKeyCredential _sharedKeyCredential;
private readonly BlobClient _blobClient;
public BlobStorageHelper(BlobClient blobClient)
{
_blobClient = blobClient;
_sharedKeyCredential = new StorageS... |
I've wrapped everything inside a gamecontroller, so that everything is private, was this a good idea? that was my first time using oop and module pattern. also the code is in a good shape, or must be refactored?
const scoreDiv = document.querySelector(".score");
const canvas = document.querySelector("#canvas");
const c... |
Below is a script to scrape data from the National Severe Storms Laboratory Probsevere dataset. Their data is available at a 2 minute interval and is only available for 24 hours before moving to the archives. The data is GeoJSON which I convert to a MultiIndex DataFrame and save as a parquet. The script runs once an ... |
I have these two methods that work, but I also hate because they almost certainly can be improved. I'm hoping to gain some guidance from others who are more knowledgable of .NET's offering for encodings and byte manipulation.
Given a string, any character that is not a-z, A-Z, 0-9 is replaced by hex values enclosed in ... |
I've seen a lot of C++ simulators implementing logic gates, but absolutely all of them use the wrapped bitwise operations of the programming language itself. I have tried to omit the use of a bitwise operator and mimic what a transistor really does at its basic level until it reaches a really functional logical gate (j... |
I am starting with the Angular and I need some support. I have watched some of the tutorials and lot of them are using things differently. I upgraded some tutorial with my own idea, but I am not sure is this right way to do apps or not.
If you can take a look also at pagination and solution, not sure that is the best w... |
I would like to parallelise with OpenMP a one-dimensional integral using the integrate() function implemented in the Boost library. I found a rather obscure example (for my C++ skills) in the Boost web site.
I was wondering whether someone has experience with that, and may point out how I could implement this approach... |
I did a multi-step form. I only learn how to build applications, and would like you to check my code out, whether everything is done well, and so on. PropTypes checking was not implemented intentionally to make the code a bit cleaner.
What would you recommend me to re-do or change up?
The full-on version is available o... |
Foreword
As a personal project, I've been creating a SPA blog (available here), which features 4 tabs (Thoughts, Projects, Readings, and CV), each accessible via one of four radio buttons, and several entries per tab. When one of the tabs is selected, an associated fragment is appended to URL, and one can enter that UR... |
I just did a HackerRank challenge, but my code kept failing 3 tests, with a timeout error. These tests were probably passing very large arrays as arguments (constraints said the arrays could have as many as 109 elements).
I researched some performance bottlenecks in my code (Array.slice, Math.min and Math.max, getting ... |
I'm an Ubuntu contributor, and I finally got tired of the workflow for ISO testing I was using (zsync, gpg, sha256sum, create Gnome Boxes VM, install, delete VM). So I decided to make a Bash script to automate a bunch of the process for me.
Trouble is, Bash is not my "native" programming language. The code works proper... |
Here I'm trying to create the multiple consumers of rabbitmq queue using the goroutines. Also, I'm trying to achieve a graceful shutdown. Is the following approach create any memory leaks? or is it the correct way to handle them?
package main
import (
"fmt"
"log"
"os"
"os/signal"
"runtime"
"str... |
I've written this sorting algorithm in C. It looks for the element with the max value every iteration and adds it to the end of the array, swapping it with other smaller elements. This way, by almost n swaps, an n element array can be sorted.
#include <stdio.h>
int max(int arr1[],int l){
int max = 0;
for(int ... |
Problem description:
The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832.
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
125406987471585238630507156932909632952... |
I am trying to hide the implementation details of accessing a Postgres database. To do this, I want to create "database" and "transaction" traits for use in a repository struct. This should allow:
Using a fake implementation for unit tests
Migrating to a new database implementation without requiring any changes to the... |
This query is part of a mobile application backend I am working on. It is hosted on Supabase (open source Firebase alternative): It's purpose is to retrieve the profile 'preview' - the most important data related to the user's profile.
I need to be able to present the following using this function:
basic profile infor... |
I have a method that takes a collection of objects, and in turn calls a method that handles a single object. My question is, do I need to handle the tasks coming from the DeleteSingleAsync method since it's not really an async method or is this safe since the concrete implementation is just returning a completed task.
... |
I am writing code to randomly place ships on a board in Python. I need help reducing the amount of Global variables I have in this code. I have thought about using a Ship class here but I'm not very comfortable with OOPS yet.
I have also thought about passing these global variables by as function arguments but that wou... |
I'm trying to make a simple and straightforward example for WebRTC without a signaling server. The code works (whole HTML file below), but it feels like I'm overshadowing something in the logic that I can't pinpoint. I need help simplifying this code for easier readability. There are little limitations in regards to le... |
This code's job is to load save files from a subfolder in ~/undertale-saves and save them to ~/.config/UNDERTALE_linux_steamver. I'd like to know if there's any ways to improve readability, or obvious ways to improve performance or binary size (neither of those are a problem with this code but if it's easy, why not?)
u... |
This is my attempt at creating a Union Algorithm for an arbitrary set of any number of arbitrary simple polygons. It works for both convex and concave polygons.
public static List<List<Vector2>> UnionPolygon(List<List<Vector2>> uvPolygons)
{
List<List<Vector2>> newPolygons = new List<List<Vector2>>();
#region ... |
To better understand a paragraph, I implemented the intent behind the paragraph. In this case, it was a formal definition of a graph contraction:
Suppose we have an undirected graph G and X ⊆ V(G). By contracting (or shrinking) X we mean deleting the vertices in X and the edges in G[X] (note from me: that's the graph ... |
I wanted to split a list into 2 parts, as per the chosen size, first the size and then the list. Example:
(split 3'(1 3 5 7 9))
(defun split (list count)
(values (subseq list 0 count)
(subseq list count)))
|
I have a snippet of code to get indices of a 2D numpy array if the maximum value of that raw is greater than a number.
index = []
for i in range(np.shape(soft_p)[0]):
if soft_p[i].max() > 0.4:
index.append(i)
I was wondering if there's a better way to do it using numpy conditions and functions
|
I've recently made an attempt at creating a binary search tree class that allows for duplicate elements. I've included as many functions as I can think of so that I can use it later on.
I've tested the code and it works well, without any memory leaks when using -fsanitize=address.
I was wondering how my code looks over... |
Recently started learning python, and it's quite a difference coming from C and knowledge taught in CS1. Overall, I am trying to build a team building script for my summer side-project (probably will become a full application eventually), but specifically, am I using python dictionaries and classes correctly with what ... |
One of the companies I was recently interviewing with gave me a following task to implement in a day or two using .Net, just to see where my coding abilities are at:
Implement a Web API that gets webhook on POST and enters it to DB
Enter the data first to collection, then read from this collection (other thread), and ... |
this is actually my first question so please don't go hard with me. I am in the process of learning my Javascript skills and I am wondering if there are some valuable suggestions to better write the below code to be more optimized/readable etc?
I didn't put any comments within the code itself but what it basically does... |
Related questions: I need to take specific row from different df to generate new df. How can I make my code faster?
I want to take the last data before the specified time from different time intervals df:
generate_data is for demo purpose, selecte_time and get_result_df is for production application.
select_time and ge... |
I've an array of objects and I want to convert it into a visual table in HTML; so I did it last night, but I was tired. I don't think it is the right way of doing it, even though it's working and gives the expected result.
let notes = [
{ note: "n1", subject: "subject1", value: 10 },
{ note: "n2", subject: "subje... |
Out of boredom one day I decided to make a game in pygame. I think it turned out fine, but am absolutely sure that it can be improved. How so?
import pygame, random, time, pyquark, pygame.freetype
from configparser import ConfigParser
pygame.freetype.init()
config_object = ConfigParser()
config_object.read("config.in... |
I have implemented an option pricing algorithm following the Heston model. The simulation involves specifying the number of simulations, then generating a discretized path for each simulation (code below). Setting N = 10000 and M = 10000 results in a fairly slow runtime on my machine. Is there any way I can speed this ... |
You are given an array A of length N (where N is as large as 2×105). All elements of the array are positive integers less than or equal to N. Determine the count of subarrays (contiguous subsequences) of A which contain their length as an element.
The time limit on CodeChef is 1 second. My code exceeds the time limit.
... |
I tried following IHttpContextAccessor pattern but for Hangfire context. What I'm mostly interested in is CustomScope class with Resolve method. I'm using ActivatorUtilities there because otherwise I would need to register TestJob to IServiceCollection, this way it resolves without the need to register it.
Snippet is f... |
I recently decided to make my own implementation of the Introsort sorting algorithm for educational purposes. Here's what I ended up with (apologies for the lack of comments):
#include <cmath>
#include <functional>
namespace __Introsort
{
template <typename T> using Compare = std::function<bool(T const &, T const &)>;... |
Premise
I have written a function in VBA, called FILTER_RANGE(), which accepts a Range object and a filtration parameter. Unlike the existing FILTER() function, this FILTER_RANGE() will return a Range object: the subset of the original Range that was preserved by the filter.
"Filtering a Range"
To clarify what I mean b... |
I cooked up a FFT code in c++ for calculating with arbitrary data size. The czt function is copied from GNU octave's czt.m. Here's the code,
#define _USE_MATH_DEFINES
#include <vector>
#include <algorithm>
#include <exception>
#include <cmath>
#include <complex>
#include <future>
#include <chrono>
#include <random>
#in... |
I have just started to learn C++ and wanted to improve my function. I am making a basic statistical API and am calculating an SMA (simple moving average) for some data. This function provides the correct, output but it is quite messy and convoluted I am sure.
I wanted to solve the problem before asking for help which i... |
Code below, very new to python, would love some constructive criticism, mainly in relation to what I could have improved on, if my use of aces (where I subtract 10) is smart, and my use of functions?
The way my code works is it starts by dealing 2 cards to both the dealer and the user, this is done randomly, it then as... |
Here is my dataframe:
data = [['a1','b1',0], ['a2','b3',0], ['a1','b2',1], ['a1','b1',1], ['a2','b3',0]]
df = pd.DataFrame(data=data, columns = ['A','B','label'])
Except for 'label' column, each col is categorical value (string). I want to replace (numeric) values by their frequency of label = 1, e.g.:
n(a1) = count(... |
I made this project that simulates a frozen yogurt shop, where you can pick your flavor, toppings, and sauces and then pay for it. I'm a beginner at python and this is my first project. I don't even know where this idea came from - I was hungry I guess. I feel like this code is unnecessarily long and redundant though, ... |
Hello I made a sieve of Eratosthenes algorithm on x86 assembly using NASM.
The highest number it can take is about 2 million and it takes like 2 seconds to complete.
Here's the code:
section .bss
buffer resb 100
numbers resb 0
section .data
arrayLength db 0
section .text
global _start
_start:
... |
I would like to ask if the implementation is ok, and what I can improve.
Although I'm not sure if the Singleton is working properly.
class MyLinkedList<T>
{
class Node<G>
{
public Node<G> next;
public G Data;
public Node(G data)
{
Data = data;
next = null;... |
I implemented the nice linux command. How can I improve the program? In terms of optimization, error handling, bugs and possible undefined behaviors
#include <stdio.h>
#include <sys/resource.h>
int my_nice(int incr)
{
/* adjusts the nicess value of a process by +incr.
Returns -1 on failure.
Returns n... |
I wrote a program that implements a POSIX signal API. It implements the functions sigset(), sighold(), sigrelse(), sigignore() and sigpause().
I would like you to criticize my implementation, to find any problems that may arise.
#include <signal.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#define SIG_... |
I wrote a program in C that simulates the touch command from linux.
I would like to ask you to criticize my implementation, to find bugs in particular
#include<sys/types.h>
#include<sys/stat.h>
#include<stdio.h>
#include<stdlib.h>
#include<fcntl.h>
#include <sys/dir.h>
#include <sys/param.h>
#include <errno.h>
#include... |
This script is supposed to download query xkcd json interface, find the total number of comics till date, pick a random number in that range, use the xkcd json interface again to find the comic image url, download it into /tmp filesystem, and use feh image viewer to display the image.
I'd appreciate it if you could tel... |
I wrote a class on top of BeautifulSoup using the builder design pattern that allows for the navigation of the necp data directory.
There are a couple navigation methods navto which just builds upon the base url to return a new instance, and inav useful when the urls are likely to change due to temporal updates.
import... |
I am working on writing a rust implementation of a sh-like language.
Rather than posting 600 lines of code here, you can just go to the GitHub repository.
Is this a good approach for lexxing?
Here's the lex function:
pub fn lex(&mut self) {
while self.input.has_next() {
let c: char = self.input.next();
... |
I have an assignment in a python course. We were instructed to make a 3D Battleships game for 2 players on the same computer. I've written a code that works, according to the assignment instructions, but I think it looks a little messy. I'm a beginner. Any suggestions to make the code simpler and tidier?
import numpy a... |
I have developed a fairly large function that can do the following:
From a dataset, select the response variable and the independent variables.
Get all the number of permutations for the formula between response and predictors.
Develop a parameter to choose a specific predictor of interest and its combinations.
Gra... |
I am sure you know what Pythagorean triples are, in the extremely unlikely case that you don't know:
A Pythagorean triple consists of three positive integers a, b, and c, such that $$a^2 + b^2 = c^2$$
source
I have written four functions, the first one is a brute-force solution that gets all possible unique combinati... |
I'm learning javascript objects and ES6 and made this dark mode toggle for TailwindCSS. I'd like to know what can I improve with this code below
'use strict';
document.addEventListener('DOMContentLoaded', event => {
// --------------------------------------------------------------------------
// App
let a... |
I have written a simple Python script that generates n-flakes using matplotlib.
Wikipedia article on N-flake.
I wrote two functions, one function generates pentaflake, the other generates hexaflake, I adapted my code from some turtle example code, I understand the mathematics, but I am not sure about the performance.
P... |
As a beginner exercise, I made small manual lexer that recognizes three types of inputs:
integers: /[-]?[0-9]+/
strings, inside double quotes, with backslash escaping
nil
using only Data.Char and Data.Maybe.
I would have wanted to do something that looks like this
parse s = tryParseInteger s
OR tryParseStri... |
I'm trying to get more coding experience and decided to start small with a basic noughts & crosses game.
Any feedback is welcome and below are the items I think I should add
a print out of an actual grid not the array
more error catching ie user enters T instead of X or O
potential position recommendations
more commen... |
I am bringing up to date an old Xamarin app. I am concerned mostly with any design patterns I should be using or anti-patterns I shouldn't be using. This is my first attempt creating a ViewModel from scratch.
public sealed class DetailsViewModel : INotifyPropertyChanged
{
#region Private Fields
private Activi... |
I'm here again; I'm learning a bit about github and posting things to packagist, this is my first try.
I have created a library that validates or verifies in what type of environment php is being executed, whether from a web environment or from a command terminal.
I appreciate if you can support me by giving it a look,... |
This code snippet implements password hashing for safe storage. It uses Argon2 as hashing algorithm. The method hash_password() is used to hash and salt a password. The method verify() is used to check whether a password matches a hash.
Initial setup:
pip install argon2-cffi
Code:
from argon2 import PasswordHasher
fro... |
I wrote some AES encryption/decryption methods with the following requirements:
Inputs should be easy-to-use strings.
Something encrypted in a .NET 6
app using these methods should be able to be decrypted in a .NET Framework 4.8 app using the same methods.
I do NOT need military or banking grade encryption.
I do NOT d... |
I recently wanted to find out which functions take which amount of time in a project, and calling a timer and printing the difference inside a function that is called multiple times does not scale well.
That's why I created my own little decorator function:
from timeit import default_timer as timer
time_in = dict()
... |
Here I have a basic text gradient effect which fades into a gradient animation, and fades out of the animation on hover in/out. Without the fade in, it looks janky and jolty. But because of the fade-in/out, I had to add two layers, one with the visible text "by default", and one with the overlay animation layer, which ... |
I am self-learning C++ and this was my first smallish project. The goal was to create a working calculator that runs in the terminal, saves history of previous calculations, and has the ability to enter commands to display history, re-display commands, and quit. The display history/command commands need to work at any ... |
I am learning C++ and I took on this small project to get more familiar with OOP. The goal was to create a Die class that randomly rolls and returns a value based on the sides of the die, the number of dice rolled, and any added modifiers, (ex: +2).
Die.hpp:
#pragma once
#include <random> //std::random_device, s... |
I have been working on a text based minesweeper game in Java and I am looking for some ways to improve it. I worked through this project through JetBrains academy. I will attach the instructions of the final part of the project
Objectives In this final stage, your program should contain the
following additional functi... |
I needed to create a bar plot that show:
the mean from some series;
them 95% confidence interval; and,
bars might be colored blue if they are definitely above this value (given the confidence interval), red if they are definitely below this value, or white if they contain this value.
Well, I coded the following li... |
Function:
Calculates delivery charges based on area and also shows number of deliveries (fast food shop).
Created to stop bickering from drivers and for stats.
code:
from decimal import Decimal
# local delivery area £2 being the charge num being number of deliveries
def local(num) -> Decimal:
return Decimal(2 * n... |
I decided to implement a vectorset, which is intended to be faster than std::set for the 3 fundamental operations, namely insert, erase, and lower_bound. The basic idea is to store some contiguous nodes in an array in order to improve cache locality, essentially "unrolling" the tree. (Of course this is a standard idea ... |
I have developed a function to graphically plot between two predictors of interest their confidence interval regions on an ellipse. It states whether the null hypotheses have been accepted for the one-sided and two-sided tests. Additionally, I have included points on the plots to identify the confidence interval and th... |
I want to implement a "service" of callbacks, where subscribers register or unregister a callback. I was thinking about indexing the callbacks by the function address, so that to unregister one would simply have to pass the same function.
So, disregarding threading issues, the simplest form of my implementation would b... |
I was trying to to print all subarrays of an array in quadratic time. Here is my code:
#include <iostream>
#include <vector>
int main()
{
std::vector<int> v;
int N;
std::cin >> N; //size of array
for (int i = 0; i < N; i++) {
int x;
std::cin >> x;
v.push_back(x);
}
int... |
So this is my scenario. In my Websocket Vuex module I'm dealing with all the data coming from the server. I can get different kinds of notifications from the server and according to the type of notification I have to dispatch different actions, then for certain kind of notifications I have an array of events that I als... |
This code snippet shows an implementation of a password policy check.
- The method composition uses regex to verify that the password meets composition criteria (at least one number, one special character, one capital letter and length between 8 and 64)
- The method check_strength() uses the library zxcvbn to check a p... |
I am working in a Noise-based P2P lib that has only basic TCP networking implemented so far. I am looking for anyone who get interested in this project that want to helps with reviews to the code and give some feedbacks about design, good practices, potential improvements, fixes, etc.
In general, it is a library that a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.