instruction stringlengths 71 95.1k |
|---|
I apologize for the title, really didn't know what to call this program. In short, the program takes a file of values for the various atoms of amino acids, and then searches this file based on user input. I'm basically looking for any input on how to improve my script. I have a bad habit of using nested loops, splittin... |
I'm quite new to Rust, and am working on a virtual machine image decompiler. I have some working code that uses match to check opcode numbers, but it doesn't feel very idiomatic, and am wondering what alternatives I should consider.
First up is the cleanest case:
// Stop, or next instruction?
let next = match o... |
I recently started to take a look at the Go programming language and decided to write a small project without practical use.
The objectives were:
Regularly poll the latest funding rates from https://ftx.com/api/funding_rates (I chose them, because each JSON object is rather small and because new updates are available ... |
The idea is to have a function which checks if all elements in a list are contained in another list. But not just the containedness has to be true, but also the times of containedness.
One could say the function has to be an extended version of containsAll , which checks only the containedness.
Here's my implementation... |
I am trying to plot three dimensional (multiple plane) data onto figures with various perspective view. The input data is tab-separated values in multiple file, and each file represent each plane. The document I referred is http://www.gnuplot.info/docs_5.4/Gnuplot_5_4.pdf .
An example is illustrated as below.
Plane1.tx... |
Setting manager class for reading and managing Settings.ini file
I have started a project creating Software Installer application for auto download and auto install software, similar how Ninite works. I have created SettingsManager.java class for reading and managing Settings.ini file of the program so the rest of the ... |
dc = {line.split('=')[0]: line.split('=')[1] for line in txt}
Below avoids duplication but is even longer:
dc = {k: v for line in txt for k, v in
zip(*map(lambda x: [x], line.split('=')))}
Any better way? Just without any imports.
Context: with open('config.txt', 'r') as f: txt = f.read().split('\n')
a=1
bc=se... |
I'm using this script to bulk update docs in my index.
I need to update a field of a doc in Elasticsearch and add the count of that doc in a list inside python code. The weight field contains the count of the doc in a dataset. The dataset needs to be updated from time to time.So the count of each document must be updat... |
I would like to make the below code more efficient by writing all text(CSV) to memory before writing to disk. The CSV file could have upwards of 10,000 or rows. With the current code, it opens and closes the file for R/W each time. There must be a better way. I am calling the WriteToCSV2 on each OnBarUpdate. The file... |
I am new to node.js, ajax, and asynchronous code. I’ve pieced together a working way to exchange json between browser and server and am wondering if someone with more experience considers the approach reasonable for my needs.
Requirement Context: This technique will be used for back-office update of data. Initially th... |
I decided to try my hand at a Hangman game to familiarize myself a bit with the language.
use std::io::{stdin, stdout, Write};
fn main() {
let stdin = stdin();
let mut stdout = stdout();
let to_guess = String::from("BENEDICT");
let mut letters: u128 = 0;
loop {
// Replace unguessed lette... |
I'm making the very common example of Factory design pattern which creates a factory of cars and return an instance of a car. I found a example here https://refactoring.guru/design-patterns/factory-method/php/example and decided to make my own factory. My question is why do I need a Creator for each car?
<?php
interf... |
a Littlewood polynomial is a polynomial where each coefficient is ether -1 or 1 and when the complex roots of them it produces a nice image. As a result I decided to make a program in c++ that plots a heatmap of the complex roots of randomly chosen Littlewood polynomials. Moreover at first I thought it would be as usi... |
Hey people on the internet!
I do not know where to share my new npm package so I am asking you do you know of a good place to share my package?
Also I would really appreciate if you take a look on it and give me your honest opinion on it react-spear
In short the goal of this package is to make state management more app... |
I'm posting a solution for LeetCode's "Maximal Network Rank". If you'd like to review, please do so. Thank you!
Problem
There is an infrastructure of n cities with some number of roads connecting these cities. Each roads[i] = [ai, bi] indicates that there is a bidirectional road between cities ai and bi.
The network ra... |
I got this question in an interview. Given a string of words, print it such as each line has at most limit characters, if a word does not fit on the line, print it on the next line and so on.
This is my implementation:
public static void main(String[] args) {
String s = "Even aside from the rain and wind it had... |
I tried solving Leetcode 01 Matrix problem.
It is running too slow when solved using DFS approach.
Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.
The distance between two adjacent cells is 1.
Example 1
Input:
[[0,0,0],
[0,1,0],
[0,0,0]]
Output:
[[0,0,0],
[0,1,0],
[0,0,0]]
... |
This is my queue implementtion in C. Feel free to ask me any questions relating to my code. Any tips or suggestions are welcome, including tips on naming/spacing/common conventions.
Queue_node, Queue, create_queue, destroye_queue, queue_push, queue_pop are meant to work with any node struct which has a member struct Qu... |
Edit: added clarification for why I want this, and updated the code since I don't have any answers yet
I have a C++11 array-like class which (can be) a wrapper around a random-access iterator. Index-based access and .begin()/.end() can just pass through to the iterator, but there's a bit of complication when the objec... |
I am practicing to implement the KNN classification tool in C#. The basic point structure is constructed by the class Point, and there are two members in Point class: a list of double number and a string. A list of double number is used in order to represent location data in multi-dimensional space. A string is to repr... |
I have two entities in my database: Employee and Shift. I want to implement a C# repository pattern method, that given two workshift IDs, swaps the two workshifts for two employees.
Limitation: one employee cannot work multiple shifts at a time.
Models
public class Employee
{
public int ID { get; set; }
public ... |
Consider a slice with some floating point numbers:
nums := []float64{0.17898, 0.25512, 1.98123, 1.35902, 0.97642}
Suppose I want to extract the numbers lying in between the range from 1 to 1.99 and ones lying in between the range from 0.0 to 0.99 (inclusive of both limits) from this slice and append it into two new se... |
Following my previous question about a FIFO for embedded systems and the very detailed answer I got, I made some modifications to convert a simple FIFO to double-ended queue for Embedded Systems.
It is using a circular buffer.
How it works: When an element is added and the queue is not empty, the corresponding index is... |
I need the ability to generate random MAC addresses, so I wrote up a little function that does that:
>>> random_mac()
'7C:93:B7:AF:BA:AE'
>>> random_mac()
'D8:D8:A0:D4:A5:3F'
>>> random_mac(unicast=False, universal=True)
'55:47:C6:EE:C6:2B'
>>> random_mac(unicast=True, universal=False)
'FE:A1:4B:98:76:B6'
I decided to... |
I'm starting to learn Rust. After reading through chapter 13 of the Rust Book, I've gone and implemented a handful of sorting algorithms for practice with the language.
Would love to learn some more experiences Rustacean's tips on ways to make this code more idiomatic. I have some particular difficulties with mergesort... |
I am reading a book with different quizzes about coding interviews.
Please implement a function that increments a string based on the rules below:
It should take the string of unknown length and increment the numberic ending of that string by 1.
If numberic ending is overflown it must be reset.
Don't use regular expre... |
router/article.js
// =============================== GET / WITH PAGINATION ==============================
router.get('/?:page', async (req, res) => {
const { page } = req.params; // current Page
const { size } = req.params; // items per page
const limit = size || 5; // if size isn't specified, set size to 5
co... |
My project has thee models Cart, Order and Product
Cart and Order have the same fields for pivot model
class Cart extends Model {
...
public function products() {
return $this->belongsToMany(Product::class)->withPivot([
'id',
... |
I want to recursively use a Vue component for each item in a multidimensional array, which is a list of topics. For example, Topic 1 can have subtopics 1.1, 1.1.1 and 1.1.2, but topic 2 might have no subtopics at all. (My working code is presented at the bottom)
My Array in Vue's app data is something like:
[
['Topic... |
Title should be self-explenatory. This is a simple URL parser I wrote in C. The function takes a URL from the user and produces a struct that contains the information that can be used to request the resource at the URL over http(s).
enum url_protocol {
PROTOCOL_HTTP,
PROTOCOL_HTTPS
};
struct url {
/* Proto... |
This is a riot analysis app. Collect data using the riot API and shows the user various data. Nothing too in depth.
GUI file - This file is the GUI file for the program. I have the class that make the rest of the frames of the program. After clicking the button to search for a summoner, it will collect data from anothe... |
I will start by saying I have gotten this to work, and the question is about how improve the script to make it better/faster.
I need to compare a series of files to each other. Let's say I have the below files:
filename0 filename1 filename2
What I have done is:
Z=0 # Beginning number
Y=2 # Final number
X=$Z # Ini... |
My previous implementation: My queue implementation (in C)
I rewrote the queue following @vnp's suggestions. Here is the second version of it:
Any suggestions or tips are appreciated :)
(even tips about spacing/naming code)
(The client must malloc() the data needed to be inserted into the queue, and must provide dtor()... |
I wrote a small sitemap-checker.aspx, the goal of this code is to find the pages, that respond with the codes other than 200. I've only put the C# part here for the review:
void Start_Click(object sender, EventArgs e)
{
CheckUrls(UrlTextBox.Text);
}
private void CheckUrls(string url)
{
... |
So I wrote a rather primitive login logic in Node.js, which authenticates the user and handles JWT. Is it any good in terms of security, efficiency, building, async/sync, logging. SECURITY is my main concern.
On in a prettier format the question would be:
SECURITY: Is my website secure in any way, shape, or form? I'm ... |
How to make changes in my code so that it can take the least memory possible.?
This is a leetcode program , I have tested all the testcases and it has passed, I tried to reduce the memory usage, but by far now, I have not been able to understand.
I want to look into this so that I can understand the usage of memory spa... |
I have a simple task as part of a larger autocorrelation DSP system - to convert from signed 16-bit integer audio samples to floating-point. This part is quite self-contained:
#include <cblas.h>
typedef int16_t sample_t;
void consume(const sample_t *samples, int N, int rate)
{
float *input = calloc(N, sizeof(floa... |
I'm working on a file interpreter and this is the code I have in my main() function right now:
// main.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <crtdbg.h>
#include "FileReader.h"
#include "Interpreter.h"
int main()
{
{
std... |
I would like to know if this is a good solution for a function that has to computer the power of integers given base and exponent.
The solution must include solution for negative numbers.
I'm trying to learn C++ trough a Deitel book and I'm doing several exercises.
#include <iostream>
using namespace std;
double integ... |
so I've been working with R quite a while now, but due to very stressful deadlines in my last university module I had, I wrote code that I'm not very proud of. I would like to be more efficient in data wrangling, e.g. reading files, rearranging and cropping dfs. Here's a short excerpt of my code
# Reading files
org_b... |
I have a simple task I want to do, I want to compare two arrays like this:
array 1 of data: [0.0, 92.6, 87.8, 668.8, 0.0, 86.3, 0.0, 147.1]
array 2 of data: [16.7, 0.0, 0.0, 135.3, 0.0, 205.5, 0.0, 93.8]
I want to find the difference between each value by index, and if the difference is lower than 50%, keep the valu... |
Github repository
Origanally I wrote a program that let you play battleship against the computer.
Pretty easy:
create a number of ships
generate random cells for all the ships
let the user try to guess
I implemented a way to place as many ships as possible:
If I have a 3x3 board and I want to place 4 ships that are 2... |
I am having trouble with time and complexity analysis. I have done a fibonacci series in a recursive way. I think it is O(n2). Can you find out the time analysis? If possible, could you elaborate it?
#include<iostream>
using namespace std;
void fibonacci(int n,int n1,int n2)
{
if(n==0)
{
cout<<endl<<n1... |
I am trying to write a function that would do what a cd .. would do. Basically get the parent of the given path.
eg:
C:\ --> C:\
C:\Users\xxx --> C:\Users
test1\test2\test4 --> test1\test2\
/var/etc/jpt --> /var/etc
I have tested this in windows and linux. Here are the list of comments I have.
I am declaring forward... |
This is a follow-up to this question Node.js backend login logic. I wrote the following login Angular frontend logic for my Node.js Backend (see the previous question above). Is it any good in terms of security, efficiency, building, async/sync, logging? SECURITY is my main concern.
On in a prettier format the question... |
I just completed level 2 of The Python Challenge on pythonchallenge.com and I am in the process of learning python so please bear with me and any silly mistakes I may have made.
I am looking for some feedback about what I could have done better in my code. Two areas specifically:
How could I have more easily identifie... |
Recently I implemented the algorithm, that can find all the patterns which may contain "?" as "any character". For example, if the text is "abracadabra" and the pattern is "a?a", then my algorithm finds patterns like "aca" and "ada". For that purpose, I was using the Aho-Corasick algorithm for "subtemplates" detection,... |
I've been playing with COM lately and while getting to understand the mechanism of how class methods/properties are called an idea came to mind: what if we can have a global instance of a class that exposes a Factory for creating new instances of that class but the Initializer method is Private. Is that possible? The a... |
I have written a tool that is used to rebalance weights in a weighted round robin in AWS. I am quite happy with it whereas I would welcome feedback from any Bash programmers.
#!/usr/bin/env bash
declare -g -A set_identifiers
usage() {
echo "\
Usage: $0 list zones # list hosted zones
Usage: $0 -z HOS... |
If i have a object like following
result = [
{
phones : ["ABC", "DEF"],
name: "Simon"
},
{
phones : ["ABC", "XZY"],
name: "John"
}
]
Expected output
Map of key, value
{ABC, ["Simon", "John"]}
{DEF, ["Simon"]}
{XYZ, ["John"]}
My try
map: Map = new Map();
for ( r of result ) {
for( ph... |
I'm writing a python game-bot where a user needs to send in an input within a certain amount of time.
My current implementation of this is to spawn a new thread that sleeps for that amount of time, then checks if an input has been sent. A nonce is added as the time could run out after another thread starts which would ... |
(See the next follow-up here.)
This is the 4th version of the program killer tool:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <shlwapi.h>
#include <TlHelp32.h>
#pragma comment(lib, "Shlwapi.lib")
static const char* get_last_err_msg() {
DWORD errorMessageId = GetLastErr... |
I worked on a script that takes as input a multi-sequence .fasta file and outputs the number of each aminoacid/sequence in a .tsv format.
This is how a .fasta file looks:
>sp|P21515|ACPH_ECOLI Acyl carrier protein phosphodiesterase OS=Escherichia coli (strain K12) OX=83333 GN=acpH PE=1 SV=2
MNFLAHLHLAHLAESSLSGNLLADFVR... |
Here I am making a calculator for a robotics assignment. I need the program to be able to take two inputs and convert to float. It also needs to display previous calculations when exiting and also stop when trying to divide by 0. It works I just want to make sure its clean and im not using any bad practices.
operators ... |
I would love to get some feedback on this Sleeping barber implementation in C.
the entire project can be found here: https://github.com/T0iS/sleeping-barber
How to run.
1. make
2. start the server on a selected port ( ./server XXXX)
3. start the client on localhost and connect to the previously specified port (./... |
I'm using Spring boot - 2.3.3.RELEASE and gradle.
Note- I'm using Factory and Strategy pattern. This project is going to be used as a Library for other projects to import and use the methods exposed by Service layer.
Here is the folder structure: https://i.stack.imgur.com/aQSJf.jpg
I would appreciate if the community c... |
I have a list of names and ID's, with many multiplication (it's a payroll list). I'd like to see those ID's and names where the name changed somewhen.
Input:
id1 name
1 Josephine Baker
2 Norma Jeane Morteson
2 Marilyn Monroe
33 Sandra Bullock
15 Issur Danielovitch
1 Freda Josephine McDonald
15 Kirk Douglas
... |
I'm posting a solution for LeetCode's "Design Circular Deque". If you'd like to review, please do so. Thank you!
Problem
Design your implementation of the circular double-ended queue (deque).
Your implementation should support following operations:
MyCircularDeque(k): Constructor, set the size of the deque to be k.
in... |
I'm making a simple 2D framework / engine for the first time based on two books and before the project gets too big I would like to know if I'm ordering things the right way. Maybe there are better ways of doing this. I tried to apply patterns so I could decouple as much as possible and keep things abstract.
For exampl... |
I am an undergraduate CS student trying to implement simple unit test framework on C++ as a pet project.
The framework has an assertion macro like ASSERT_EQ(var1, var2), which checks whether two variables are equal or not. If the assertion fails, I want to print a failure message to std::cerr and provide as much inform... |
This is a problem from Codesignal.
The guaranteed constraints are 1 <= a.length <= 10^5, and 1 <= a[i] <= a.length.
You have to return the first duplicate encoutered in a, or -1 if no duplicate is found.
def firstDuplicate(a):
b = [0] * 100001
for num in a:
if b[num] == 1:
return num
... |
Problem
I'm trying to write a code in which Q questions are asked and each question contains two numbers A and B. For each question, I have to find the sum of all primes between integers A and B (inclusive). I've written a program that works, but it isn't fast enough to pass all the restrictions. Is there any way to im... |
I have a very standard Flask website being built, more or less straight out of the documentation though am now at a point where I'm going a bit off the book and am probably being highly inefficient about how my code handles user-input changes to their account details.
My users will have access to an account_details.htm... |
My purpose is to calculate the energy spectrum of three-dimensional turbulent flow from three velocity components. The calculation is too expensive. Therefore, I hope the calculation time can be reduced. The above code is a sample of calculating the energy spectrum. I expect to receive some suggestions on parallel comp... |
I am trying to ensure type in the below method. How to reduce its cognitive complexity to below 15 from the current 27? It looks more readable as it is? Is there a way to break this down to make it more readable?
Shifting some of the checks to separate method will be one way but is there a better way?
private Object en... |
I request data from a table in a database and each line comes as a dictionary like this one :
{
"timestamp" : 1234657890,
"prices" : {
"AAA" : 111,
"BBB" : 222,
...
"ZZZ" : 999
}
}
From all those lines i wanted to creat... |
I have a program that starts a bunch of goroutines, feeds them data and when there is no more data, waits for the goroutines to finish. I use sync.WaitGroup. I am unsure if I am using correctly, in an idiomatic way or if there is a better solution.
Background
My real code reads a log file of disk-space and numbers of f... |
I've reimplemented in C++ the basic interface implemented by Python's threading.Event class using a mutex and condition variable. I've inlined functions rather than pasted both the header and source file. My reimplementation also skips the timeout argument to wait since I don't need it. The code appears to work through... |
I try to create compare script using awk and another command and running successful.
But I think the script I create it's to long.
Is there anyone can shorten my script below ?
After plan A shorten the code than, plan B is :
1. I want eliminated a lot temp file (.txt), only need `lengkap.txt`
2. Put command in variab... |
I have written a basic REST endpoint in Ktor and would like some pointers.
Application.kt
@KtorExperimentalAPI
@kotlin.jvm.JvmOverloads
fun Application.module(testing: Boolean = false) {
install(Authentication)
install(ContentNegotiation) {
gson {}
}
val materialRepository = MaterialRepository(... |
The below code ran in 2:26 which is way too slow especially as it's only 1/3rd of the total (the remaining 2/3rd does something very similar just on different sections). Is there something I can do to speed this up? RangeCount = 625 and TimelineCount = 156 which are obviously large numbers (total is around 100k rows)... |
I am trying to learn Go and as way of throwing myself in the deep-end I thought it would be cool to try building a web framework instead of using an already existing solution. I'm coming from the JavaScript world so all the type and interface stuff is new to me as well. I was wondering if this is an acceptable approach... |
I'm a CS professor and provided this code as a small piece of a refactoring assignment:
private double getTotalPrice(int quantity, double itemPrice) {
if (quantity == 13) {
return itemPrice * 12; // Baker's dozen
}
else if (quantity >= 6) {
return itemPrice * quantity * .95;
} else {
... |
EDIT_START: I want to thank all people for giving me such good answers! It's hard for me to choose any answer over another, because I see that all of your answers are valid and good in their own perspective. I want to clarify my own question. My question is not "How do I not use GOTO?", but my question is "How do I use... |
I currently have a Template Workbook set up that has charts and graphs updating when new data is plugged into the Data Tables.
The Data Tables are fixed ranges, and won't change.
The Macro is within the Template Workbook, which is why the below code doesn't set variables for each of the worksheets within the Template W... |
This script opens a basic form which allows one to search all files in a directory for instances of a string, before outputting results to a textbox and CSV (found in the script location). Each line outputted is of the format:
Word {string} in {file} on line {line number}: {full line}
Steps:
Specify Directory
Input ... |
I have a method that receives 2 params:
first one is an array of objects of type { group1: string, group2: string, measure: number, ... }
second one is a string
I also have an enum GroupColumns
enum GroupColumns {
ColumnTypeX = 'Column Type X',
ColumnTypeY = 'Column Type Y',
ColumnTypeZ = 'Column Type Z'
}
Thi... |
I am creating a library management system. Presently am done creating the Book and BookItem class. Can you point any thing you feel isn't necessary, inefficient or a general bad practice so I could learn from it and grow in my programming career
Book.hh
#ifndef BOOK_HH
#define BOOK_HH
/*********************************... |
I've written a Python program to analyse a huge C++ code base in excess of millions of lines of code. The job of the program is simply to search for all C and C++ style comments and extract all the comments which contain specific keywords and phrases and to write those comments to an associated file. So far the program... |
I've written my first "real" Python application. I've never worked much with Python before, so I'd like to receive feedback on how I can structure the application to make it follow the way Python programs usually are.
This is very much from a "readability" perspective, but getting feedback on general structure as well ... |
I work on a code-base that uses xml to set up problems and specify model parameters. I've created a script that I run in tandem with our code. This script will store important model information parsed from the most recent xml file and eventually end up in a LaTeX document. This script will help me keep track of model p... |
I'm posting two solutions for LeetCode's "Print FooBar Alternately". If you'd like to review, please do. Thank you!
Problem
Suppose you are given the following code:
class FooBar {
public void foo() {
for (int i = 0; i < n; i++) {
print("foo");
}
}
public void bar() {
for (int i = 0; i < n; i++... |
I have created a lot of spigot plugins in my "career" as a developer for a bunch of Minecraft servers, but every time I start writing a new plugin, I basically "reinvent" the structure of my main plugin class, always so it fits best into what I consider to be a readable plugin, that also other developers that will wor... |
I've written a simple util-method in my spigot plugin to check if a message contains a valid minecraft colour code. A valid minecraft colour code consists of a & followed by a hex digit: 0 to f. Minecraft itself exchanges all & by a §, for reasons that would take too long to explain, it's not possible for the users to ... |
Given a string representation of data, I want to extract the information into its corresponding object.
However,
If the string has "|" separators then these should be considered options and need to be picked at random.
If the string data has numbers shown as a range "1-10" then a random value should be chosen between t... |
I developed this code for a vertical debounce counter for the PIC micro (PIC16F57). The code is called every 512 microseconds. It takes 5 bits from PORTB and compares it to a last known debounced state. If an active input has been stable for 64 calls it is accepted as changed. Though it is sufficiently good for the cur... |
This is a personal project which I created solely to torture my friends ;)
I'm pretty sure you've heard about typeracer.
And if you have friends like mine who are faster than you, you'd surely be frustrated.
This is a program that removes your frustration by automating it.
from time import sleep
from selenium import ... |
I have solved problem 10608 on UVA Online Judge using Python 3.5.1. My solution works, but it takes too long to run when the online judge evaluates it.
Problem
There is a town with N citizens. It is known that some pairs of people are friends. According to the famous saying that “The friends of my friends are my friend... |
I am learning and trying to implement the best practice for snake and ladder game.
Rules of the game
The board will have 100 cells numbered from 1 to 100.
The game will have a six sided dice numbered from 1 to 6 and will always give a
random number on rolling it.
Each player has a piece which is initially kept outsid... |
I am writing a GenericDeserializer for Apache Kafka. My class implements IDeserializer<T> from Confluent.Kafka.Net package. I need to supply a Deserialize method which has this signature, T Deserialize(ReadOnlySpan<byte> data, bool isNull, SerializationContext context). But I also need to use Deserializers class of Con... |
I build an addition chain (more information about addition chains: Wikipedia) calculator that produces shorter chains than chains with the length equal to the number that's being tried to achieve.
It doesn't always produces the shortest chains (if were talking about a big number). However still gives a pretty short cha... |
Related to this question: Spigot Plugin: Generic form of the plugin's main clas
I've created a Clan-Plugin, in which I have one "main" command, which is simply /clan. Then there are several sub-commands, e.g. /clan leave, /clan money, etc. There are also subcommands that require multiple arguments, like /clan create, w... |
This code takes a list of EBITDA amounts (for a hypothetical business), and computes a loan that would fund that business with working capital in periods of loss. When the business has positive EBITDA again, the loan is paid off. The loan also charges interest.
Some specific questions I have
I am not sure the way wcLo... |
This is actually an extension of the already written Matrix Library from this post.
This Matrix class is the result of the changes made thanks to this answer by Toby Speight, and having added a few other functionalities.
The library is composed of a few classes namely: a Fraction which contains the numbers that will be... |
I have integrate aad authentication using react-adal client and secure paths using private routes method
I'm not satisfied with the code structure so I would like to improve it.
Here's the code
index.js
import { runWithAdal } from 'react-adal';
import { authContext } from './auth.js';
const DO_NOT_LOGIN = true;
runWi... |
I am a beginner at coding with Python. I am excited because I wrote a program that works in JupyterLab, but I know I can make it shorter. For example, I feel I should not need to write so many boolean operators, and print statements. Also, I am not sure if the break I put at the end is ideal. Can you advise me?
Purpose... |
I am trying to deal with some calculations on nested vector data in C++. The nested vector data may be like std::vector<long double>, std::vector<std::vector<long double>>, or std::vector<std::vector<std::vector<long double>>>. I want to focus on summation here, and the calculation of summation could be done with the S... |
I have this task where I have to make my robot find the shortest way when I enter a destination point. I've created some functions to assign numbers (distances) for each square and counts its way back to my robot by deleting the other options. Then the robot should only follow the numbers. Here's also a screenshot of t... |
This is a problem from Hackerrank (https://www.hackerrank.com/challenges/2d-array/problem). We're given a 6x6 (always) 2D array and asked to compute the sums of all the hourglass patterns in the array. An hourglass pattern is of the shape
1 1 1
1
1 1 1
where the 1's form the hourglass. In this case the sum is 7,... |
I'm a beginner developer and I'm building a calendar for smartphones. I'm using HTML, CSS and JS. I'm not entirely done with the project yet, however, I have the feeling that I'm making a messy code. I'll be posting the link to the git + the code in here, so you can better read it/clone, and help me with design pattern... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.