instruction
stringlengths
71
95.1k
I am looking for feedback on screen reader improvements for the code/example below. The Select2 pillbox control needs to be more accessible. They have an open issues on this subject Select2 Issue Page and after I get more feedback will submit change suggestions to them (or submit a branch with the changes). My Goals i...
Hey guys I am trying to improve my Python Programming skills, I tried to build a hangman code. I know it is not perfect but I works. I am looking for some hints or advice to improve this script. txt_file = open('dictionnary.txt','r') # Open the file with read option words = txt_file.readlines() # Read all the ...
I'm learning rust by creating a simple card game program, with the usual stuff, ranks, suits etc. Currently I only implemented the card generation and a simple render function (not for future use). Looking at it, I can abstract some things, in terms of modules: I have a deck generator, it can be for a poker deck with ...
I have tried implementing an AVL Tree on my own, based on visualising it. But i'm unsure how many testcases it work with, and how efficient it is. Are there any ways to make it efficient, and compact? class Node: def __init__(self, value, parent=None): """ Every Node has a value, and a height based ...
import requests import json import time f = open('ok.txt', 'r') c = f.read() r = [] start = time.perf_counter() def steamCheck(name): return requests.get("https://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/?key=removed&vanityurl=%s" % (name)).json() for word in c.split(): p = steamCheck(word) ...
Scraping news articles from various web page is the main goal of this code. For starting all spiders(web crawlers) at the same time, I try to implement the facade design pattern. It works but I feel the constructor of SpiderFacade class can be improved. Is there better way to do it or better design pattern to do it ? A...
https://try.gitea.io/nadal/repository Used this in a coding challenge after a job interview. I didn't get chosen, but I was wondering if it was because of the code quality in the project. import React, { Component } from 'react'; import * as ExpenseActions from '../actions/ExpenseActions'; import { bindActionCreators }...
I tried to implement union find (disjoint set data structure) algorithm in C++. There I used unordered_map data structure. Is there a better way of doing this using any other data structure. While finding the root I have used the following way. int root(int i){ if(i != parent[i]) parent[i] = root(parent[i]); ...
I'm making a Minecraft clone and have made an Object Pool. Looking for some advice on how I have implemented it. Uses m_availableObjects as a O(1) way of searching for the next available object. Thank you in advance. constexpr int INVALID_OBJECT_ID = -1; //Internal Use - Object Pool template <class Object> struct O...
It's a pretty simple script really, i just want to know if there is a way to improve it. #!/bin/env sh set -o nounset set -o errexit if [[ "$#" -ne 3 ]] && [[ "$#" -ne 2 ]]; then echo "Usage: ./project.sh [NAME] [GENERATOR] [MAKEFILES]" exit 1 fi mkdir $HOME/Dev/$1 mkdir $HOME/Dev/$1/src/ mkdir $HOME/Dev/$1...
I implemented an open-addressed, double-hashed hashmap in C, now looking for some advice on improving it. Thank you. hashmap.h: #pragma once #include <stdbool.h> typedef struct hm_hashmap_t *hm_hashmap_t; hm_hashmap_t hm_init(void); void hm_destroy(hm_hashmap_t hm); void hm_set(hm_hashmap_t hm, const char *key, voi...
I have implemented a binary search tree with 2 operations to begin with. I have tried to implement it using the best practices I could think of. Overall, I am happy with the implementation. But, I want someone else's opinion about what they think about the design or any bad practice I have used. I wanted to get rid of...
There is few points In the script I don't like I think it can be improved, but I need a second opinion, here is the interactive plot I'm trying to build. here is the code with thought in comments. #!/usr/bin/python3 from functools import lru_cache import numpy as np import scipy.stats as ss import matplotlib.pyplot ...
I'm writing code for some accordions at the moment, using some simple vanilla JS (strictly not jQuery, has to be vanilla) and it feels like my code is really inefficient. Here it is at the moment: // Variables let down = document.getElementById("chevron-down-1"); let down2 = document.getElementById("chev...
This is my first project using Python OOP. I don't know whether the code I have written is correctly or not. How can I make this code feasible? Machine.py Class containing some default values class Machine: dict_coffee = { 'Cappuccino' : 100, 'Cafe Latte' : 200, 'Espresso...
I need help fixing my gameloop. Sometimes the game feels very laggy and I think the reason is that the tick() method is called slower then the render() method. What I want is that update is called as often as possible and the tick method gets executed with some kind of value that determines how fast thinks are going. F...
I am new to rust and this is a program that finds out the palindromes between a range. All tests have been passed but this program is really slow in finding the 4 digits Palindromes. This is an exercism exercise and Palindrome struct and struct methods new, value, and insert must be used in the final solution. I need y...
The following code represents the store method of a resource controller. A user can create an training offer on my website and can pass various information like website, trainers, date, title, address, videos and also upload a coverImage and multiple images for a gallery. The following steps are conducted: Validate t...
I develop an in-house Java framework. I provide an interface so that my end users can provide their own custom implementation (i.e. plugin/SPI). public interface SomePlugin { SomeResponse doSomething(SomeRequest request); } There are a number of small configurations to be made, some required and some optional. For...
I have tried the code for finding the class of the IP address the user inputs, and printing the network and the host bits in the IP address. Could someone please review this approach and provide suggestions. Thanks:). #include<stdio.h> #include<stdlib.h> #include<string.h> #include<sys/socket.h> #include<netinet/in.h>...
Background A few months ago, I asked this and this question on my implementation of a Sudoku-Solver. I now tried to further improve this little project. Changes Minor GUI-changes Input validation "Reset"-button Check if solution is unique (This question on stackoverflow helped) Naming Structuring Code with Classes Add...
I have the default code snippet that comes with the nvidia nsight eclipse V10.2, but I've modified it to do some profiling: /* ============================================================================ Name : Project1.cu Author : [] Version : Copyright : If you find this, by pure chance, feel f...
What my code try to do here is to sort items trough 2 dictionaries. If they are similar or the same, I create a new list to append them. The test file is relatively big, around 2000 data each dictionary. My concern is that i need to maintain a linear time complexity trough out the code and i am not sure that my code is...
Im refactoring a large internal legacy application and part of the stuff I want to get rid is the widespread code repetition. I'm starting with the way the website checks if a User can access a route e.g., '/admin` and which parts should be rendered or not. I made this little function and works pretty well but wante...
Very new to coding, so please don't bully me. Implement the legendary caesar cipher: In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each let...
following is My Code for Collapsing div on Click using JavaScript It is Working Fine But i Want to Precise the onClick Function in Script Any Suggestion will Highly appreciated.Thnx In Advanced. <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link href="https://fonts.googleapi...
I've made a sudoku solver which solves a sudoku, given user input, and can also extract digits from a picture of a sudoku to solve it. I've used OpenCV and GTK+ 2.0 to achieve the above. I am very open to any kind of suggestion on how write proper and understandable C++ code. I have the following question: How would y...
This is a follow-up (somewhat) to this post. I said somewhat because I've kinda changed most of the logic. Changes: I've changed the project name I've changed the CLI UX I've added encryption / decryption I've added a setup.py for easier installation. I've added click Temporarily removed type annotations & docstrings....
With a specific requirement of showing/hiding the pages, the following implementation has been carried out. The pages which needs to be hidden will be provided through an array this.unshowPages = ['menuPage', 'aboutusPage','linkedInPage']; The corresponding HTML file, <ng-container *ngIf="showaboutPages"> <l...
I applied for Junior Java Developer in some company. Got a task:"Listing words (without duplicates) from text, provide lines where appears, count them." Output should looks like: Alphacoronavirus - 3 - pozycje -> [1,3,2] gatunki - 4 - pozycje -> [1,3,2,7] Koronawirusy - 2 - pozycje -> [3,2] Wirusów - 1 - pozycje -> [1]...
I have the following function which works properly and returns all of the rows from a specific table, then loops through each row to add data related to it as a subarray. public function fetch_products() { $return = $this->db->all("SELECT * FROM consumables_products"); foreach($return as &$r) { $r[...
I have the below code for a A* pathfinder, however it is taking upwards of 10 minutes to find a solution using a simple 1024 x 1024 array. I had to comment out //Collections.sort(this.openList); as it was throwing a comparison method violates its general contract! error when running. Is the algorithm correct and any i...
I have to write a simple web application using the Java Spring framework as my course project. So I decided to write a simple Stack Overflow clone. My application has the following features: Authorization (using Spring Security); Posting new questions and answers; Voting up/down for questions/answers. I am very new i...
I have an input dataframe like below, where 'ID' is unique identifier, 'Signals_in_Group' is a derived field containing list of all unique 'Signal' column values present in a 'Group'. And 'Signals_Count' is also a derived field whose values are count of items in 'Signals_in_Group'. groups_df ID Timestamp Signal ...
I'm writing a small program to plot new COVID-19 infections. As of right now, I have it so the program reads the given data file, pulls out the daily cases and dates for each country, and adds together all the cases for a given date. However, because both of the lists generated have lengths of over 2000, it currently r...
I have written a series of functions that are designed to create a space-filling curve (similar to a Hilbert Curve) that is intended for symmetric matrices (as opposed to a square region). I plan to ultimately use the function in R, but decided to write it in c++ for the sake of speed. Also, you may notice that I am ...
I have written a simple Integrator class in C++17 that can perform either a definite single integration of a single variable or a definite double integration of a single variable using the same integrand. Here's my Integrator class: Integrator.h #pragma once #include <algorithm> #include <utility> #include <functi...
This code below, was for my school project, first year. I am new to C programming, before which I learned Python. Hence, I do not know the tweaks and tricks in C language. What are the various ways to improve the code? Moreover, my requirement requires me to have indentation. I am unsure how to apply that indentation i...
This question is related to my previous two questions, in which I have implemented HashTable, and also SortedListMap and BinarySearchTree. Since the three types of mappings have similar interfaces, if I wrote three separate tests for them there would be lots of boilerplate codes. Instead I decided to write a single tes...
Intending to reuse the installation process of a GNOME extension, I wrote the following script: #!/bin/bash # It installs a target gnome shell extension defined via url STORE_URL="https://extensions.gnome.org/extension-data" EXTENSIONS_PATH="$HOME/.local/share/gnome-shell/extensions/" ZIP="gnome-extension.zip" cd ~/D...
I'm working on a program that takes website links and extracts the website name. Right now, it works perfectly, but it is very much a brute force approach and very ugly in my opinion. Some of the properties of the links are as follows: - entirely random - will all contain https:// and .com - may not contain www. Here's...
I am just trying to understand the algorithm of the problem statement Given an array, we need to find the maximum sum of absolute difference of any permutation of the given array. Here is my implementation after following the algorithm mentioned in the link static int sumOfMaxAbsDiff(int[] arr) { Arrays.sort(arr...
Find the limit to the number of items that can be prepared with given amount of ingredients - Let's try to understand with input/output pattern: Input 4 2 5 6 3 20 40 90 50 Output 8 1st Line: Number Of Ingredients 2nd Line: Each unit required from total ingredients given 3rd Line: Each value represent total number...
This is my implementation of Clojure's assoc-in function. I am looking for tips on making it more idiomatic and in general, better. (defn my-assoc-in [m [& ks] v] (let [sorted-keys (reverse ks)] (loop [curr-key (first sorted-keys) rem-keys (rest sorted-keys) curr-map (get-in m (reverse re...
So, I made this in order to practice my Python OOP and algorithms skills, and refactored it a bit after a few months of s tale. May anybody review it in a PR please? Want to see the flaws that could be fixed, considering I didn't improve much since the initial development of this. https://github.com/fen0s/TABSlike/ One...
I submitted my solution for palindrome Index coding challenge but I get "test cases terminated due to time out error". My code is working and so I don't know what else to do to optimize it. Please help: function palindromeIndex(s) { let palindrome = s === s.split('').reverse().join('') if(!palindrome) { ...
note: You might be scared seeing the length of the post, but it's actually not that long because you don't need to read the compiler logs or the python code to understand my code (I wish StackExchange allowed foldable code like github). I've been reading CodeReview for a while but this is my first post here. This is a...
I have the following short function code that converts Exponential (e-Notation) Numbers to Decimals, allowing the output of large number of decimal places. I needed to cover all the e-notation syntax permitted by Javascript which include the following: Valid e-notation numbers in Javascript: 123e1 ==> 1230 1...
I am working on a project where I want to generate random throughput on a particular method so that I can do some performance testing on it. This way I can test my method by generating random throughputs and see how my method works under all those scenarios. For example: I need to call my doIOStuff method at an approxi...
I can't find out which loop is better performance than another, if you know help me. I try about loops in js and performance in this site and this is code snippet, you can run and check. const array1 = []; for (let i = 0; i <= 50000; i++) { array1.push(i); } //for... var forT0 = performance.now() for (let eleme...
I was just reviewing the source code of Nifi, see explanation and public version of the source. This got me wondering whether there are any obvious improvements here to increase the performance of the random generation. As there are many people using this, the size of the random array could be anything, but probably it...
I have written a function that prints all the prime factors for a given number. Here is my code static void printPrimeFactorization(int number) { if (number <= 1 || isPrime(number)) { // If given number is already prime, no more factors for it System.out.println(number); return; } // check divis...
Is this my_upgrade_mutex class a valid implementation of boost::upgrade_mutex semantics? (Ignoring the try_* and *_for/*_until part.) class my_upgrade_mutex { std::mutex xmutex; std::shared_mutex smutex; public: void lock_shared()//u->s { smutex.lock_shared(); } void unlock_shared()//s->...
I'm new to std::atomic, std::mutex, std::unique_lock, std::condition_variable and more or less c++11 std::thread, so I wrote this little Job_Queue class, where you can submit a void() function and it will be distributed among some threads. I wonder if there's room for improvement or if I made to beginner's mistakes. Th...
Implementing A Simple Singly Linked List I'm trying to learn Go and wanted to implement various data structures and algorithms from scratch. I wanted to try and implement a singly linked list without using slices. In the sake of keeping things simple, I am not taking into account concurrent access to this list and am e...
I am writing a game via SFML. In difference places I want to use loaded fonts. So I decided to write the fonts loader, so that load fonts only one time and use them in the future from class. My code: enum class FontsID { PIXEBOY, DIGITAL7 }; class FontObject { public: FontObject::FontObject(const std::stri...
I have stumbled across these unit tests in a code review that are using in memory db: private DatabaseContext _context; private Fixture _fixture; [SetUp] public void Setup() { _fixture = new Fixture(); _fixture.Customize(new AutoNSubstituteCustomization()); var options = new DbContextOptionsBuilder<Datab...
please roast my code, I hope this is the good place to look for some advice on where I can improve. Problem definition: Apply modifications on values depending on date ranges. Data: Base array - holds dictionaries in the following format: [{'date': 20200101, 'value': 1}, {'date': 20200102, 'value': 2}] Modifier array -...
I'm going through the book Grokking Algorithms which is in Python but wanted to write everything in C++. Up to this point everything's been pretty straightforward translation but the code for Dijkstra's algorithm really exploits nested dictionaries and weak typing which I used as an excuse to try out std::optional. I a...
There are probably a lot better ways to do it, but take it as a learning exercise. Basically below is the JSON InputValidation and parsing using nlohmann::json which takes expected fields, objects arrays and verifies its presence and (optionally) parses them into an appropriate c++ structure. inputvalidation.hpp: names...
In a part of our system a lot (I'm not sure how many, probably a couple thousand) of emails are being sent to the users at a specific time of the month. It seems this kills the server. So I was asked to add the mailing of these emails to another part of the system that uses a Scheduler to do calculations. The idea bein...
I'm solving yet another problem in HackerRank (https://www.hackerrank.com/challenges/determining-dna-health/problem). In short: you are given 2 arrays (genes and health), one of which have a 'gene' name, and the other - 'gene' weight (aka health). You then given a bunch of strings, each containing values m and n, which...
I'm working on a Node.js chat app project using the ws library. I have it up and running but I'm still making improvements and adding stuff like authentication, etc. Before I get too far, I am wondering what the best functional approach to handling messages (and other events) is. For example, right now I have the follo...
I am writing a simple merge algorithm in Haskell. I wanted to add simple logging, hence am using the Writer Monad to include logging. type ArrayWithLogging a = WriterT [String] Identity [a] merge :: (Show a, Ord a) => ArrayWithLogging a -> ArrayWithLogging a -> ArrayWithLogging a merge al bl = do a <- al b <- ...
I am implementing an algorithm for estimating light at the ocean surface as a function of wind (waves, surface roughness), chlorophyll, and zenith angle. I want to do this using climate projections from CMIP6 as input for the period 1950-2100 on a monthly basis. I use Python and Jupyter notebook to read global values o...
This outputs the manufacturer string associated with your CPU using the CPUID instruction. I wrote this up for a homework assignment, then found out that I didn't need to. When run on my (virtual) machine, I get the following output: EAX: 16 EBX: 756e6547 ECX: 6c65746e EDX: 49656e69 GenuineIntel What I'd like comment...
I recently have been very interested in custom allocators, so I decided to make the very basic (this should be faster than malloc) bump allocator. Here is my code in C: #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <sys/mman.h> #include <unistd.h> #define KB(size) ((size_t) size * 1024) #define M...
I have an array of colors for my app to choose from. My goal was to have the app cycle through the array of colors, apply it to my object, and reset to the beginning once each color has been used. This is simple enough to implement, but I am looking to see if it's possible to clean it up slightly. The one complication ...
First time posting and first real Python program that I use fairly frequently. I needed a way to pull a large amount of containers, re-tag them, save them (docker save) and clean up the recently pulled containers. I did this pretty easily with bash, though depending on the container and depending how many containers I ...
We have code that reads in a DXF/DWG file (drawing file) and then our own geometry library that converts everything into point, line, arcs, circles, and etc. objects. Then we have a Shape object which will hold one or many entities. Shapes can also contain other shapes as children and those shapes can have children. ...
I have a directory with 'sets' of files that start with a state name followed by 4 or 5 digits (typically indicating year). Each 'file set' contains 3 files a .txt, a .png, and a .jpg. Example of files in directory: California1998_reform_paper.txt California1998_reform_paper.pdf California1998_reform_paper.jpg Califo...
I am working with cassandra using datastax c# driver. I need to pull data out from three different tables. Below is my code which does the job. private const string itemMapStmt = "FROM product_data WHERE client_id = ? PER PARTITION LIMIT 1"; private const string itemSelectStatement = "FROM item WHERE item_id =...
I test in a bash script if a variable value contains digits only. There are two options, both give the valid results: validate_is_pos_int(){ local value=$1 if ! [[ ${value//[0-9]/""} ]] then return 0 # True; $1 has digits only else return 1 # False; $1 contains other letters besides digits fi} and the second (...
Please review my code for the problem statement below. Many Thanks. You job is to create a simple banking application. There should be a Bank class: It should have an ArrayListof Branches Each Branch should have an ArrayListof Customer s The Customer class should have an ArrayListof Doubles (transactions) Customer:...
I'm solving the m-coloring problem using java. and I have following code that uses concept of recursion and backtracking. import java.util.Arrays; public class GraphColoring { static void graphColor(int k, int m, int n, int colors[], int graph[][]) { for (int c = 1; c <= m; c++) { if (isSafe(...
Needs A container holds two collections: Parent instances and Child instances; their items can be searched by name; A child can return a reference to its parent; A parent can search its children by name and return one of them by reference; A Child is read-only after creation, but new children or parents can be added a...
This is a follow up for my question about optimizing solution for DNA Health HackerRank problem. Short re-cap: You are given 2 arrays (genes and health), one of which have a 'gene' name, and the other - 'gene' weight (aka health). You then given a bunch of strings, each containing values m and n, which denote the...
I use this function in browser automation. It pings the document in the browser to check if an element we are looking for is available (useful when there is JavaScript generated async content). If it's not available, it will retry after a given interval or times out eventually. Example usage: function clickContinue() {...
I've created a serial C++ code for gravitational N-Body calculation. Because I expect to have upwards of 8-71 sparse bodies (ie, where Barnes-Hut is not necessarily practical) and running for long periods of time, I want to make as much use of parallelization and vectorization as possible. I did try a method with mutex...
I am completely new to rust. My first rust code is simple text filter application for parsing log file and accumulating some information. Here is my code: //use std::io::{self, Read}; use std::io::{self}; use regex::Regex; fn main() -> io::Result<()> { let re_str = concat!( r"^\s+(?P<qrw1>\d+)\|(?P<qrw2>\d...
So I'm currently using python to unscramble words that are retrieved from an OCR program, and checked in the 'dictionary'. The current code I am using to unscramble words is this: import numpy as nm import pytesseract import cv2 import ctypes from PIL import ImageGrab def imToString(): # Path of tesseract e...
I have a file that is written DOS format and I need to replace some characters into others. I created a dictionary for that purposes, and now I have to read everyline from my stream and replace my values as I go. I created this piece of code in C#, however, I highly doubt that this is the way to go, since I figure that...
I am implementing a simple recursive Depth-First Search algorithm on graphs, using StateT and ReaderT for encapsulating all the required information. Pre-requisite definitions type Vertex = Int type Cost = Int data Edge = Edge { vertex:: Vertex, cost:: Cost } deriving (Eq, Show, Ord) newtype Graph = Graph { adjacencyL...
I written my own calculator script in javascript! It is a basic one, but works really well. I am just wondering if there is any way to make this script more efficient & clean. On first look, I feel like I did some redundant stuff in it, however I am a beginner and in no right to judge the code on my own. window.onloa...
I am working on some custom rules in a time managment system and need to know how many hours in a shift have been before a certain time (19:00pm) and how many hours after. Shifts can start in the evening and finish in the morning so need to take that into account. So far I have the below (this is just a snippet for one...
I'm after a pythonic and pandemic (from pandas, pun not intended =) way to pivot some rows in a dataframe into new columns. My data has this format: dof foo bar qux idxA idxB 100 101 1 10 30 50 101 2 11 31 51 101 3 12 32 52 102 1 13 ...
OK, you don't really have to read it all, but I think you get the basic Idea. Does anyone have anything small that could make my code better? I just found out about "global" and "lower()". Is there any small thing you can give me that could improve my code a lot, or at least save me some time? global myname global move...
We have published a product today called MMMR.js this product is licensed under the MIT license and is built by Syed Mohammad Sannan. The uniqueness of this product is that it is built with and for Javascript though there are many libraries out there such as NumPY, SciPY, and much much more but they are built for Pytho...
For homework, I had to parse CPUID instruction output in C, which required a lot of specific bit-manipulation like: (eax & CACHE_LEVEL) >> 5 I calculated the mask CACHE_LEVEL and the amount that was needed to be right-shifted by hand. It was a pain, so I decided to write a couple Python functions to help with this. Fo...
I made this because I couldn't find any good C# classes/libraries that allow you to dump the contents of a process' memory into a file or a byte array. I haven't tested this on 32 bit systems but it works in both x86 and x64 on my 64 bit system. I've been mostly testing this on the notepad process which executes pretty...
As told by experts, I am re-posting the code review request with the code. Brief Description: from outside sha256() will be called with parameter having UTF-16 character set. then after prepareData() and initializing variables, the hash() will be called with converted binary message string (having pad and 64 bits mess...
I'm trying to create a node editor "framework" (IDK what to call it, but essentially there is no GUI and should be implemented using these classes), similar to rete.js, blueprints(maybe an exception since there are events involved), imnodes, etc; and am creating a pin class/struct. A pin, in this case, is the small thi...
I would like to request iOS developer community to please review my POC i.e. [GithubUserFinder][1] which I have created as part of job screening test at T-mobile Bengaluru. I have around 2 years of experience in programming and I got 24 hours to complete this POC. Below is the feedback I got through mail by recruiter: ...
Develop a smart application as Student Grade Calculator(SGC). Create a class Student with following private attribute : int id, String name, marks(integer array), float average and char grade. Include appropriate getters and setters methods and constructor. public void calculateAvg() - This method should calculate av...
This code gets detailed information about a particular game from an online database using an API Get request. The question I have doesn't pertain to the request but is more about the code itself. The code works. I just think it is long for what needs to be done though. I was wondering if this code is able to be refacto...
I have tried to check whether the ports of a host from port 0 to port 1023 is open or not. Could someone please review this code and provide feedback. #include<stdio.h> #include<stdlib.h> #include<string.h> #include<sys/socket.h> #include<sys/types.h> #include<netdb.h> #include<error.h> #include<errno.h> char *convert_...
Given a Singly Linked-List, write a function to delete the linked list recursively. Below is my attempt. I am confused if I should use del keyword to delete the nodes or below method is better. I don't know if it is memory efficient this way.I'd appreciate any critique of what I could do better. class SLLNode: def ...
The problem I need is to solve, is a linear optimization problem where we need to to minimize parcel delivery costs by assigning nodes as hubs, which supposedly will reduce costs. In my code 'nodes' represents the number of nodes of a given set N. Then 'flows' is a list with the flow x_{ij} from a node i to a node j. ...
I'm sure my question exists on the internet, i just don't know the right formulations. I have a data-sample as input for a NN. This sample has the shape (1, 8, 28, 80). Basically it is 80 timesteps of an image. -> y=8, x=28, time=80 i can extract the image at time=0 with: np_img = image.data.numpy() # shape (1, 8, 28...
I use Electron with NodeJS but this is mainly a javascript question. I got tired of build processes and being dependent of frameworks like Vue so I started my own. Setup in index.html <head></head> <body> <div id="home"></div> <script> var components = {}; // component(name) var component = (name) => components[name]....