instruction stringlengths 71 95.1k |
|---|
I had created hash function library (MD5, MD4, SHA256, SHA384, SHA512, RipeMD128, RipeMD160, CRC16, CRC32, CRC64), written in C++.
Everything working well and My library produces exactly the same output compared to the PHP output. (Except for CRC series)
The individual algorithmic abstraction layers consist of the chas... |
(See also the previous follow-up.)
Now, I seem to improve my program partially via the answer in my previous follow-up. It goes like this:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <TlHelp32.h>
/********************************************************************
* Search... |
I have a program which splits a url into host and path:
int main(int argc, char** argv){
std::vector<std::string> url = parseUrl(argv[1]);
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
int MAXDATASIZE = 1024;
std::string request = "GET " +url.at(1) + " HTTP... |
I am just learning about C++ templates and generic types, I decided it would be nice to try to create a generic container class as a challenge and test my knowledge in the process. Here is what I have come up with.
#include <iostream>
#include <cstdlib>
#include <cassert>
template <typename __T>
class List{
private:... |
What is the coin change problem?
The change-making problem addresses the question of finding the minimum number of coins (of certain denominations) that add up to a given amount of money. It is a special case of the integer knapsack problem and has applications wider than just currency. Read more: Wiki
My code:
def coi... |
function openav() {
document.getElementById('sidenav').style.width = '18%';
document.getElementById('open-btn').style.display = 'none';
document.getElementById('main').style.marginRight = '18%';
document.getElementById('hero-header').style.marginRight = '18%';
document.getElementById('footer').sty... |
Stock analysis takes a lot of time to filter and find the right one for a long-term investment. So I thought I could speed up the process by calculating a few basic values and write them all into one report file. Now I'd like to simplify everything as I'm sure there are a lot of redundant and repeating parts in it.
My ... |
Apologies if this question doesn't fit the format here, seemed more appropriate here than SO due to the more nebulous nature of the question.
Think mini tinyURL clone: POST to service to save the url + hash, then look up the mapping when visiting /anything. It's been a while since I've touched Ruby, and the resulting c... |
This is my first attempt at using asyncio, I don't believe I am using it properly and would like assistance using it to maximize efficiency. The current run time is between 20-22 seconds. I would like to reduce this as much as possible, thank you!
import asyncio
import aiosnow
from snow import snowCommands
#import logi... |
First Question:
Simple C++ Hash function library
I had created hash function library (MD5, MD4, SHA256, SHA384, SHA512, RipeMD128, RipeMD160, CRC16, CRC32, CRC64), written in C++.
Everything working well and My library produces exactly the same output compared to the PHP output. (Except for CRC series)
The individual ... |
Input:
Enter a decimal number: 101
Output:
The binary number is : 1100101
I have solved this way->
#include <stdio.h>
int main(void){
int input=get_input();
long long complete_integer=binary_conversion(input);
reverse_digits(complete_integer);
}
int get_input() {
int number = 0;
printf("Enter a decimal numbe... |
I'm loading my game's sound effects into an array to easily pick a random one and play it. Previously, I used a switch statement to select a random sound but it looks less verbose to just pick an array key.
Is it inefficient to use an array to store and play my sound effects? Is there a better way to do this or any imp... |
Context. I was looking for some simple implementation of SVM with the SMO algorithm that can be used as an in-class problem together with a simple mathematical explanation of how it works.
The problem is, that even simplest modifications of SMO I was able to find, e.g. Simplified SMO from Stanford CS course, are still ... |
I wrote the below code to convert a long data frame containing start and end date event spans into a daily df with rows for each day:
output:
**bene_id, day, death, hha**
row 1: abc, 1 ('2018-10-01'), 0,0
row 2: abc, 2 ('2018-10-02'), 0,1
row 3: abc, 3 ('2018-10-03'), 0,0
row 4: abc, 4 ('2018-10-04'), 0,1
I am p... |
I am using the following script to read search terms from a file and then search those terms in google (each search result in it's own tab).
from selenium import webdriver
browser = webdriver.Chrome()
# first tab
browser.get('https://google.com')
with open("google-search-terms.adoc") as fin:
for line_no, line in... |
The function filterList recieves an array of objects and filters the list, checking only the properties of the object specified in a 'filterFields' array.
It compares the values of those specified properties to a string 'filterTerm' using a comparison function.
If the property specified by 'filterFields' is an array or... |
Please can I receive suggestions on how to improve my code.
I am interested in improvements to the speed, quality and adaptability.
import random
import time
global fs
fs = 0
hs = "Heads"
ts = "Tails"
hs_a_ts = [(hs), (ts)]
def coinflip():
while input("To flip a coin input [Y/N]:") == "y":
print(rando... |
For a project I'm working on, I need to calculate the age of users based on their birthday (which is a DateTime object). with a few requirements:
the output must be in french (the entire project is in french)
the output is needed to be all caps
the output must follow these rules:
if the person is a newborn (less than... |
I have a personal website that's used primarily for fun. I upload images, videos and text that I want to share. An HTML submission form accepts questions and string submissions from users, which uses a phpmyadmin database table for storage.
The below snippet is my current .htaccess file. https://gtmetrix.com/ notes tha... |
I am learning C# and in the process I am trying to implement a multi producer consumer thread safe class. Can you please code review and point me to any mistakes I have made and improvements I can make? I understand there would be libraries and other thread safe queue objects which would provide me the functionality wh... |
I just wrote a little Python 3 program to spit out every possible combination of a set of 99 characters.
It gets the job done, but I would be very interested in what you think of it.
I am just a few days into Python, so I would be grateful for even seemingly obvious advice.
import sys
# List of 99 characters and a bl... |
I wrote two microservices in Springboot and tried to follow the best practices. I would appreciate any suggestions about any improvement that I can make on the whole codebase. What are the parts of the code that I can improve on the whole project?
Project Link: https://github.com/forhadmethun/mbank
Technology used:
Jav... |
I'm trying to solve this problem with Python 3.8. In my code, I used 3 nested for loops to check every single point and storing the largest area with each set of points. This program works fine, but it's \$ O(n^3) \$ time complexity, and I'm wondering if there are any more elegant/efficient solutions. Is there a more e... |
I have the following program. I have 90 million domain names split between 87 files. I need to resolve the IP of all. Right now I feel like this is super slow.
import multiprocessing
import fileinput
import socket
from datetime import datetime
socket.setdefaulttimeout(2)
def worker(i):
filename = (str(i).zfill(le... |
I was doing LeetCode heater problem.
Question: https://leetcode.com/problems/heaters/
Winter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses.
Now, you are given positions of houses and heaters on a horizontal line, find out minimum radius of hea... |
This is a console password manager in C# script. It has 370 lines of code, from shebang to the last }.
Are there any ways to make it even smaller without inlining and changing in formatting? Maybe using helpers from some nuget package, modern C# features, etc?
Any security concerns?
Link to github: https://github.com... |
Hi I'm implementing a few leetcode examples in Rust. https://leetcode.com/problems/flood-fill/
(looks to be same question as LeetCode: FloodFill C#)
The input is one matrix, a position and its new colour. The output is the modified matrix
// Input:
// image = [[1,1,1],[1,1,0],[1,0,1]]
// sr = 1, sc = 1, newColor = 2
/... |
I have a code that should read diameters of barrels from a txt file. If a barrel is smaller than the last one, smaller gets put inside bigger one. One package like that is lied on a stack. at the end, code should give out how many stacks we get and how many barrels were in a file. also sum of diameters.
If one number i... |
Recently I was learning to code using PyQt5 and Python.
I was doing a school project on Calculator.
Here is my graphic class:
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'calculator.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file wil... |
What is the transpose of a matrix:
In linear algebra, the transpose of a matrix is an operator which flips a matrix over its diagonal; that is, it switches the row and column indices of the matrix A by producing another matrix, often denoted by Aᵀ.
Code
dimension = int(input())
matrix = []
transpose = []
for row in ran... |
I wrote this function to multiply vector with a matrix and I was wondering if someone experienced can spot something can improved its performance.
class matrix:
def __init__(self, width, height):
self.width = width
self.height = height
self.m = [[0 for i in range(width)]for i in range(height... |
I am a little bit confused on Factory Method with multiple parameters in which all parameters can change from GUI by user as seen below picture.
For each combobox item I have an interface and concrete implementations.
I have a SignalProcessor class which gets parameters as this 3 interfaces as below:
public interface ... |
I'm slurping up fields from an API that returns an array of fields. Each field in the array is a String that actually contains two separate fields (a number and a date). The number is enclosed in parentheses and the date is following this and a space. The following is an example of the format.
const data = [
... |
I am trying to refactor a service by providing some options on what to bring back. I can't decide what is best way to go between the below
A. Use a class for the options
Create a new class for the options like
public class Options
{
public bool Addresses { get; set; }
public bool Documents { get... |
This code works, but I feel bad about it. Did I achieve Python Zen or create a terrible monster?
Note: it doesn't have to be super-fast or work on super-huge directory trees.
import glob
from typing import List
# Provide pathname without a trailing /
def find_files_with_extension(pathname: str, extension: str) -> List... |
I have below json which I need to deserialize in C# -
{
"clientSettings":[
{
"clientId":12345,
"entries":[
{
"key":"abc",
"value":false
},
{
"key":"def",
"value":false
},
{
... |
I'm building an MVC web app with ASP.CORE 3.1 and EF connected to MSSQL.
Today, finally after 3 days, I've somewhat reached a working code for filtering my view.
I've got database of
Date stamps (15 minute intervals) and
INT values of cars (3 types (OA, NA, NS))
going through Border (13 of them).
Data are for both dir... |
I am absolutely new to c++ and am trying to learn SDL2 with c++. I am setting up my first project and I was unsure if the way I have structured the project is good or if I have over done it. Here is the code:
generalFuncs.h
#pragma once
#include "SDL.h"
#include <iostream>
struct State
{
bool quit = false;
};
cl... |
I've developed a class which is designed to hold a range of percentage values. The following is the intended functionality:
The range should store two bounds (a lower and an upper)
The bounds should be percentages expressed as a double decimal and should be >= 0 and <=1
Each bound could be inclusive or exclusive
The l... |
so as a beginner in Python, I've been utilizing CodeWars to practice everyday alongside my courses, been happy by the results so far, however, what I really am focusing on is the logical thinking side of things and "Thinking like a programmer". I got a question today on codewars that brought me here to ask. Although th... |
I'm fairly new to programming and I'm learning python.
I've defined a function for a dice roll and set it up to roll multiple.
def d20(num):
rolls = 0
for i in range(num):
rolls += randint(1,20)
return rolls
Thonny and my assistant tab gives me a warning:
Line 3: Unused variable 'i'
The code works... |
My program uses merge and insertion sort to sort a set of numbers.
It works perfectly fine for small inputs, less than 2 seconds for 1,000 ints. But I need to sort 1,000,000 ints. When I try with 1 million, it takes over 2 hours to sort. Can someone please help me optimize this program so it works faster?
FYI: I have s... |
I wrote a small utility in bash that allows me to edit config files anywhere. So, whenever I want to edit a config file, I don't have to type its full path or have to remember where it is.
First, I have to do:
$ edfig add <name> <config file path>
Then, I will be able to edit the corresponding config file by:
$ edfig ... |
I'm building a chart component and it behaves differently if data has been passed in or not.
Here are two ways I can think of to conditionally fill chart variables.
(data will be empty {} or have non-empty values)
// helper
function isEmptyObject(obj) {
for (const i in obj) return false;
return true;
}
const gridI... |
I came across a problem where given a array of integer arrays of different lengths [[1,2,3],[4,1,1], [9,2,1]] you need to return an array of arrays, each array containing indices of the arrays (of the input array) such that the corresponding arrays have the same mean: [[0,1],[2]] This seems relatively simple to solve u... |
I am trying to fetch the format (e.g. background color, border settings) of each cell in Excel file with Microsoft.Office.Interop.Excel class. I know that there are many tools could be used well in data reading, such as ExcelDataReader. However, many of them cannot retrieve cell format (https://github.com/ExcelDataRead... |
Dynamically growing arrays are a type of array. They are very useful when you don't know the exact size of the array at design time. First you need to define an initial number of elements. (Wikipedia)
I have written a Python solution and converted it to Cython.
Cython can be used to improve the speed of nested for loo... |
This is my approach on creating a sudoku generator and solver with backtracking.
Is right for sudoku generator to inherit from soduku solver?
What is your general overview on the class structure, data members, variable names and data structure used.
Here is the code
#ifndef SUDOKUGEN_HH
#define SUDOKUGEN_HH
/**********... |
I have completed my first attempt of a simple music visualizer app for windows in C++ using SDL. It takes system audio and outputs the soundwave in real-time.
I'd appreciate some feedback on how I can improve the code, especially the OOP design and where I can use modern C++ features.
main.cpp:
#include <chrono>
#incl... |
I am an Android developer with only 5 months of experience. I am still learning and trying to do my best.
Right now I am interested in concept of Separation of concerns. I do understand what it means and I am trying my best to follow it in my android development, however, I found myself a bit confused when I started le... |
Basics
I created a simple comment system. My goal was it to create a system that can easily be used on everyone's server without having to install a load of programs. I also tried to create it as privacy-friendly as possible (no email-address, no cookies). I also need to solve this problem without databases.
Functional... |
So I wrote this fixed timestep & rendering game loop.
I am posting it here to see if there are ways to optimize it/make it more accurate.
const float updatesRate = 1 / 60.0f;
const float framesRate = 1 / 308.0f;
double currentTime = hireTimeInSeconds( );
double accumulator = 0.0;
double accumulato... |
I use the following which works( I remove the unnnecery parts to the question)
https://play.golang.org/p/OozjexJ4hZk
The program is doing the following:
run concurrent functions
each function should return response
calculate the response
I will add a logs and comments but I want to get feedback on the code.
What Im... |
I was recently told I need to change my coding style. An Interviewer told me he would like to see "more formalized class structure and organization". I have attached few of my cpp files.
if you can you review it and give me your feedback on the things I can improve that will be extremely helpful.
Challenge:
Given n rob... |
I have created a modular design pattern which provide a single interface that can be used create instances with swapable back-end components, however I'm not entirely satisfied with it.
My practical implementation involves creating a generic interface to certain kinds of device drivers. The hope is that I can create an... |
I've learned JavaFX recently (with Scene Builder) and made a MineSweeper game, would love to receive feedback and tips for improvement!
Thanks.
Below is mines class, I've commented out some lines for the GUI part to work:
import java.util.Random;
//import java.util.Scanner;
public class Mines {
private int height ... |
Having too much spare time during the quarantine I learned some basic python (plus tkinter for GUI) and made a little HangMan game :)
Would love any feedback for improvement.
Thank you.
import os
import random
from tkinter import *
from PIL import ImageTk, Image
from tkinter import messagebox
import pygame
# Window se... |
I've just spent a good hour or so developing a python script that hunts down and removes .php files depending on the regex expression the situation was a client has got several sites and got hacked recently and as a result a large portion of 8 character random php files have created, so in order to remove them all I ma... |
The first "method" I have coded is _bigPow which can pow(x, y) on any number which is really big. And the _printBigInt prints a very big integer. Plus I have tried to comment most parts of my code to make it easier hopefully!
I just want criticism on what I can improve upon!
The _start you can edit the numbers to check... |
In Rust, I want to take an array of u32 values, convert each to four bytes in big endian, and concatenate them to yield a Vec<u8> result. Example:
let input: [u32; 5] = [
0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0];
(... Do some data conversion work ...)
let output: Vec<u8> = vec![
0x67, 0x45,... |
I came across this strategy pattern implementation
https://github.com/jtortorelli/head-first-design-patterns-python/blob/master/src/python/chapter_1/adventure_game.py
class Character:
def __init__(self):
self.weapon_behavior = None
def set_weapon(self, weapon_behavior):
self.weapon_behavior = w... |
I would like some advice on improving/optimizing a small program I wrote. What it does is run a random walk on a torus manifold with 8 colors that loop around.
//RTM Test Using Random Walk Fractals, WIP
//Created by delta23
//This Code works on Minix, Unix, MacOSX, Linux
//This Code does not work on DOS or Windows (yet... |
Trying to get my first job as a developer I made an app I was extremely proud of:
https://github.com/AnatolyRudenko/Crystals.Dragons
The game starts in a random room of a random maze. Some prebuilt items get randomly located all around the maze. User can see arrows (from 1 to 4 depending on directions available to move... |
I created a class to scrape URLS, parse and validate emails and get internal links.
How can I achieve the SOLID principles in this class written in Javascript to make a web scraper?
const axios = require('axios');
const fs = require('fs')
const {
JSDOM
} = require('jsdom');
class Scraper {
static dangerDomains ... |
I made a simple program as an exercise in improving my code flow in Python, which does the following:
asks user to input their name
presents them with a choice to either print their name in reverse, or print the number of characters
after the output is printed, the user is asked if they want to "play again". if not, ... |
I'm fairly new to R. I have used the 'r2excel' package to create an excel workbook from a subset of my R data. This should have 3 sheets for the three different subsets. What I have written works fine, but its a lot of code and is very clunky, just re written three times.
If there is a better way of framing my question... |
I'm writing a library which simplifies the usage of intrinsics in C#.
It's a generic library which supports all numeric types.
The goal of this library is to perform these operations at the highest performance possible.
I'll gladly head any suggestions / tips which might improve the performance.
All feedback is welcome... |
Here is the sample Students json am processing
{
"students": [
{
"firstName": "Veena",
"lastName": "Butteris",
"email": "vbutteris@xyz.com",
"country": "Wales",
"availableDates": [
"2020-05-24",
"2020-05-25",
"2020-05-29",
"2020-06-03",
"2020-06-04",
"2020-06-05"
]
},
{
"firstName"... |
Newbie here. I have this gqlgen api with sqlc update code, which updates the user by given id with provided fields:
// graph/schema.resolvers.go
...
func (r *mutationResolver) UserUpdate(ctx context.Context, id string, input model.EditUser) (bool, error) {
// Validate
v := validator.New()
if err := v.Stru... |
I'm trying to getting integer keyboard input to call the corresponding method.
invalid input works, keyboard input 3 works, input 2 exits, input 1 calls the wrong method.
I've not yet worked on the subtring and points problem method yet.
Regards, and I appreciate your feedback.
import java.io.File;
import java.util.Sca... |
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include <unistd.h>
#include <string>
class Website
{
int status, sock;
struct addrinfo hints;
struct addrinfo *servinfo;
public:
int init(std::string url){
memset(&hints, 0, sizeof hints);
... |
I have created a PowerShell script that will call a REST API and then for each node returned, add the data into a database table. This particular endpoint only returns ~600 records worth of data, however this is the method I will be using for a bunch of other API endpoints.
There are a couple things I think would help ... |
I wrote a program that read a csv file that contain 100 rows that look like:
1;S****L;SCHOOL
2;*A*G*A*;HANGMAN
then try to guess the letters like in a hangman game. My scope is to count every right and wrong letters and then sum them up. The code works fine, I get around 1670 right + wrong attempts to guess the letter... |
I made a simple program in Python
stores tasks in the file
allows the user to manage them.
I'm interested if my implementation is efficient and could I do something better. I'm not sure whether loading all data from file to memory and again saving it in the file is a good way to implement list saving tasks.
#!/usr/bi... |
I am trying to implement a network server application in C++ using Boost.Asio.
Here are the requirements I am trying to meet:
The Application creates only one instance of boost::io_context.
Single io_context is being run() by a shared Thread Pool. The number of threads is not defined.
Application can instantiate multi... |
Hi I just finished a VERY Basic airline reservation system. Wanted some feedback please let me know what you all think, if I am obfuscating information or passing parameters where I shouldn't or if things don't make sense
Airline Class: handles booking and refunds
Passenger: Has a seat assignment, and a balance to pay ... |
for clarity: moved here from stackoverflow after being pointed to Code Review being the better place for this question
I love async/await and Promises since I got my hands on them. And I might be overdoing it, but it feels like there should be a good and readable way to utilize async/await to get a little closer to a f... |
I need to design a generic "Unit Of Work", basically so that I can "change the context of the Database" only changing the implementation of IUnitOfWork on my DI container. I will exemplify below.
So far, I have following solution:
IUnitOfWork.cs
public interface IUnitOfWork
{
TTransactionType GetCurrentTransaction<... |
I've written a function that reads and returns one UTF-8 code point from an istream. I am wondering if the code is efficient or if there are some obvious problems with the implementation.
chr_t utf32::get_utf32_char(std::istream &in_stream) {
int next;
chr_t out = in_stream.get();
if (out == -1 || out < 0x8... |
Discovering sk-learn pipelines (https://scikit-learn.org/stable/modules/generated/sklearn.pipeline.Pipeline.html) made me wonder why weren't I using the same idea for any set of functions applied to a single main argument.
Based on this idea I developed the following code (Using kwargs treatment from https://stackoverf... |
I am working on a finite element (FE) code and want to provide multiple material models (20+). In FE applications, the computational domain is subdivided into a set of geometrically simple elements, e.g. tetrahedra or hexahedra. I use Workers that carry elementwise computations sing a given material model. Depending on... |
I haven't a clue whether this works for every case, but it has in the ones I tried.
If there are any optimizations that could happen anywhere please do comment on it. Regarding my code style, I'm sure there's something to fix there.
In this game you are given a set of numbers and a target. You need to reach the target ... |
This code reads barrel diameter and height from file, then, based on dimension make decisions and finally these decisions are printed out to a file. My pronbelm is how to avoid using the code wrtine on lines 70-101? Probably has to do with line 35, but I haven´t figured my way around it. Would be nice if there is a way... |
I've written a script that gets a list of all groups in AD along with a few specific properties for each group (DistinguishedName, CN, Type, and Description). Then it goes through each group and, for each member of type "user" (to exclude computers, servers, etc.), it gets the user's full name, title, and their manager... |
Here is my code:
add_hook('ClientAreaPageInvoices', 1, function($vars) {
$user_id = $_SESSION["uid"];
$today = Carbon::now()->format('Y-m-d');
$query_1 = Capsule::table('tblinvoices')
->select(Capsule::raw('SUM(total) as total_aberto'))
->where(array('userid' => $user_id, 'status' => 'Unpaid... |
I'm a new Rustacean, decided to make a wrapper for the LeagueOfLegends API.
Focus is on simplicity, being able to make any API call with a simple function.
I have not finished all functions however it's currently in a working state, and the other function will be very similair.
Code
Lib.rs - I've included this file as ... |
This is a problem that is asked on leet code for a simple calculator. The problem is stated as follows -
Implement a basic calculator to evaluate a simple expression string.
The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division should truncate toward zer... |
Recently, I have been working on a College Football Manager game, in which you coach a team from the ground up. I have successfully made it to where you can win games, lose games, and change your team overall. Yet, I haven't worked out how to make a ranking system. I tried it with an Array, but got lost and had no idea... |
I've been working on an Aerodynamics calculator using python (which I'm relatively new at), In this program, a value can be calculated based on multiple different inputs ie. a calculates b, b calculates c, or c can find b and b can find a.
To elaborate on the function of this program it will loop through it's logic unt... |
Description of the problem:
Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size.
Implement the ParkingSystem class:
ParkingSystem(int big, int medium, int small) Initializes object of the ParkingSystem class. T... |
int combiset(int ism,int inarr[],int inpth){
int r1,r2,r3,r4;
for(int i=0;i<inpth;i++){
r1 = inarr[i]+inarr[i+1];
r2 = r1+inarr[i+2];
r3 = r2+inarr[i+3];
r4 = r3+inarr[i+4];
if(r4==ism){
printf("%d %d %d %d %d\n",inarr[i],inarr[i+1],inarr[i+2],inarr[i... |
its a practice project from "Automate the Boring stuff with Python" book. i am an intermediate level Python programmer and i tried to solve this problem with less code as possible. This code will not take any wrong date into consideration eg: 29-02-2002 will not be selected because 2002 is not a leap year and only leap... |
My goal with the below piece of POSIX shell code was to address the more platforms the better with shell tput colors. With this code, I now start all of my scripts, and so it's time to review it for some things I overlooked, did not think of too well, and such. Note: I start my scripts with set -u, which is why I set a... |
I'm trying to get my code to conform to java formatting convention, I think I've spaced and indented the right way, however, your peer review would be much appreciated.
/**
* @author Nad Deb
* Date: 10/10/2020
* This program is used to play two words games
* It will work on input from the keyboard to workout suffix/inf... |
I've been learning about about how to use context, and how to make a higher order component to provide context values through props.
So, I've created my HOC to pass down the props, and it looks like this, in a file called ConsumerWrapper.jsx:
import React from "react";
import {ThemeContext} from "../context/fakeContext... |
I am writing unit tests for a NestJS service, which imports and instantiates a class (OAuth2Client) from an external module (google-auth-library) and uses one of its functions (verifyIdToken).
I am mocking the class to override that function as follows:
// service.test.ts
jest.mock('google-auth-library', () => {
ret... |
problem statement: using React and Redux build an interest calculator that, given a principal, rate of annual interest, and number of years, will display the total principal plus interest using the formula
TOTAL = principal * (1 + (rate * years))
Any feedback welcome on the style, approach, etc.
<!doctype html>
<html><... |
Very new to OOP with Python - and feel like I still don't totally get OOP. However I thought I'd put together a personal online book library to practice inheritance, methods, docstrings etc.
Program allows one to add books (comics or novels - with comics inheriting from novels) to one's own library, and create a custom... |
I know that there is a generic data structure System.Array could be used to create customized type array. I want to focus on the two dimensional data structure that something like plane with concatenate methods. The following code is my implementation of a generic two dimensional data structure Plane<T>.
Is there any p... |
I have started with C and I made this code and as the title suggests this program can calculate the average score of a given number of scores. Now my major concern is, is it more efficient to get the number of scores as a Command Line Argument or is the current approach better incase if sometime in the future someone d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.