instruction
stringlengths
71
95.1k
I wrote an idempotent script loader (for the browser), where the same script won't be loaded more than once. scriptLoader.js: let _loadingAndLoadedScripts = []; export async function loadJs(src) { let hash = generateHash(src); // scenario 1: first invocation, so load script if (!_loadingAndLoadedScripts[hash])...
I'd like some help to improve this cli program. It queries a city's weather and pushes a weather report. It takes two arguments: the city to query and the apikey for OpenWeatherMap. For example lein run glasgow abcde12345. How to make it more idiomatic clojure? How can I avoid having to pass the apikey multiple times? ...
A while ago, I wrote a small Rust crate for parsing & generating URLs for GitHub repositories in various formats (HTTPS, SSH, git://, etc.), with the parsing done using regular expressions with the fancy-regex crate. However, the regular expressions weren't all that complicated, and so, in an effort to cut down on dep...
I want to make small console application that can find and run certain exe. This works, however it is extremely slow in given situations. Any Idea how can i improve this? string[] drives = Directory.GetLogicalDrives(); string pathToExecutable = String.Empty; foreach (string drive in drives) { pathToExecutable = ...
Given a matrix, which represents a multivariate time series, wherein some observations are missing, I want to calculate the most likely observation, given a covariance matrix. Notation: \$x_{-i}\$ represents some vector with the \$i\$th elements removed. Let \$m\$ be an index of missing observations, \$X\$ is a vector ...
I'm working on a custom implementation of A-Star and so I had to also create a Priority Queue and so I had to create a Heap. I'm quite happy with my Heap but I'm a bit worried about my Priority Queue: it is done and it works, but I am still wondering if the way I have done it will come back and bite me in the ass later...
I tried to code a console hangman game that looks a lot like hangman often does on paper, with a scattering of incorrect guesses next to the drawing of the hangman. import functools import math import random import sys from string import ascii_lowercase hangman_pictures = [''' +---+ | | | | |...
I created the following program to calculate probable primes with a maximum number of bits. It works as expected but I'm sure there must be a better way to implement calcPrimeMaxBits. #include <boost/multiprecision/cpp_int.hpp> #include <boost/multiprecision/miller_rabin.hpp> #include <iostream> #include <iomanip> nam...
This mutex prevents concurrent access to a target resource. One key requirement is the ability to be acquired in a (scheduler) thread and released in a different (worker) thread. Unfortunately this means that widely used primitives like the implicit lock (synchronized) or Lock from java.util.concurrent cannot be used b...
It is difficult to find resources on above programming problem therefore I've decided to ask a question on this forum. Using memoization and dynamic programming we can obtain a code that gives \$O(2^N \cdot N)\$ time complexity. The code takes in a symmetrical adjacency matrix which is stored as the weights vector, and...
I have created a non-owning view of some spatial data that organises the data into cells. The data is split into a grid of cell size 100, and the key to the underlying HashMap is the index (top left corner) of the grid cell. Each grid cell contains a Vec of Point2D. The purpose of this data structure is for efficient ...
I'm working on a script that will archive, compress, clear old archive files, then remove the source file if it is below a set size. The output when I tested it worked, but I just wanted a second look to make sure I'm not missing any issues. #!/usr/bin/ksh # Script Name: archiving.ksh # Purpose : To copy and Archi...
I wanted to play with a two-dimensional generic data container in C++ and explore different methods of traversals: using closures and iterators. I'd like a review of it. #include <cstddef> #include <functional> #include <iostream> #include <iterator> #include <utility> #include <vector> template <typename T> class Mat...
I have json data in a file and I want to load the file content only once when application is initiated instead of calling the loading file multiple times in class instances. I created a config which loads on app init named REPOSITORY_CONFIG. Then created a script with the method like this: import json CACHE = None de...
I adapted this Tarjan algorithm in JavaScript to be a little more functional and not pollute the Vertex object with temporary metadata, and arrived here: function execute(graph) { const state = { stack: [], indexCounter: 0, traversibleVertex: {}, components: [], } for (const vertex in graph) { ...
This question Code lines counter prompted me to write my own line counting program. I program on both Windows and Linux and I know about the Linux utility wc. The command line and output format are based on the wc program, as are the methods for getting the byte count, word count and line count. My comparison is based ...
After a discussion of a mysterious color code on the Arch Linux live medium on the Arch Linux forums, I implemented a codec to encode (and decode) arbitrary byte streams to ANSI background colors. The basic idea is, that there are sixteen ANSI background colors, ranging from 40-47 and 100-107 respectively. Thus I can e...
This is API def create_log(self, name, params, response, success, path, model, res_id=None): logger_vals = {'name': f'API Call {name}', 'type': 'server', 'level': 'DEBUG', 'path': path, 'func': 'TEST', 'success_state': su...
I have an API that returns the brand of a credit card. I want to make them look nice for my user (e.g. correct case and spacing). The possible options are amex, diners, discover, jcb, mastercard, unionpay, visa, or unknown. Here's how I am currently doing it: if ($x == "jcb") { $x = strtoupper($x); } elseif ($x ==...
from inspect import signature, Parameter def check_can_take_positional_arg(fun, arg_ix): params = signature(fun).parameters.values() return len(params) >= arg_ix + 1 or any( param.kind == Parameter.VAR_POSITIONAL for param in params ) def check_can_take_keyword_arg(fun, arg_key): params = si...
This is my algorithm to backup data on Windows using Bash scripting language. I'm looking forward to any innovations, and better solutions. My task was to create a simple backup algorithm using dry-run and delete. Are there any simpler solutions? Also, adding a GUI would be a pretty nice training for me, but in my cas...
I want to write a function that validates the German tax identification number (Steuer-ID). The identification number consists of eleven digits. The last digit is only for checking. This is not what this question is about. The first ten digits of the identification number contain one digit exactly twice and another dig...
I have a method which takes List<Document> documents as parameters. I created unit test for it: @Test public void getDocumentsWithHighestVersion(){ List<Document> docs = new ArrayList<>(); Type type1 = new Type(PDF, ENGLISH); docType1.setDocumentTypeId(37); Type type2 = new Type(PDF,...
How can I improve this? The idea is to store every left to right diagonals in a list Not looking for a more efficient algorithm instead something readable, LINQ perhaps? input: 3, 1 2, 5, 7 1, 5, 8, 3, 1, 4 6, 8, 7, 1 4 6 6, 2, 5 output: 1, 7, 3, 3, 5, 8, 1, 7, 3, 5, 8, 1, 2, 5, 7, 8, 1, 5, 7, 1, 8, 6, 2, -- var a...
I have the following code: # tests/examples cases = [ ["getMyID", "get_my_id"], ["getMyAlphabetABC", "get_my_alphabet_abc"], ["getAlphabet", "get_alphabet"], ["simple", "simple"], ["getALetter", "get_a_letter"], ["getBook1", "get_book1"], ["simpleButNotSoSimpleBecauseItIsVeryLong", "simple_b...
The situation: A certain number of kids come to a library and each of them wants to borrow a book. Since there is only one copy of each book in the library, each child must say which book they would like to read the most, which book they like the second most, etc. We assign the books to the kids based on their preferen...
I have been working on a Python Curses terminal user interface for RSync for a little while now. I recently visited code review and recieved some help with cleaning up the code to make it more pythonic. I worked for a bit to break up classes, simplify functions, etc. Now, I'm returning to see if my code is more complic...
This code finds highly composite numbers (numbers with more factors than any smaller number) in Swift. I'm not too familiar with Swift, I did this in python but it was too slow so I decided to try it. I made some optimizations, such as only evaluating factors up to \$\sqrt{n}\$, but I would like to improve performanc...
I need help optimizing my Python code for CodeWars Integers: Recreation One Kata. We are given a range of numbers and we have to return the number and the sum of the divisors squared that is a square itself. Divisors of 42 are : 1, 2, 3, 6, 7, 14, 21, 42. These divisors squared are: 1, 4, 9, 36, 49, 196, 441, 1764. Th...
I've written a Python function that generates a smoke wisp/genie-tail shape using all 26 (and only 26) letters of the alphabet. Here are some examples of the kind of ASCII art I'm trying to produce: v g j p b n m a i h u t f q k s d c ...
I've made a method that provides a robust way for a user to fill out a lottery ticket. During this process I found out that Java also provides syntax for labels. That was very astounding for me. But I also was told that using goto-like code can be a bad smell. But I've not found a way to make my code "more beautiful". ...
I am currently writing a program that takes image files from my data base and uploads them to Azure storage here is what I have written: public async Task UploadAssetsAsync(Func<GridFSFileInfo, string> prefixSelector, List<GridFSFileInfo> files, Func<GridFSFileInfo, Task<Stream>> streamOpener, Func<string, Task...
This code works perfectly as intended but I am fairly new at VBA and want to learn new techniques and way to optimize my code writing. It is a very simple process that involves (3) seperate workbooks. Step 1: Open a .csv, copy a range to the master workbook (wbMacros) and close the workbook. Step 2: Open another .csv, ...
Here is a bloom filter I made in C#: public class BloomFilter { private BitArray PosValues = new BitArray(int.MaxValue); private BitArray NegValues = new BitArray(int.MaxValue); public void AddValue(int HashCode) { if (HashCode > 0) { PosValues[HashCode - 1] = true; ...
I have this ef 6 delete method where I build <List> the related entities that will need to be deleted. Then I use RemoveRange to remove then. Once its deleted I will need to re-order the data and update the SequenceOrder field. public ResultStatus DeleteMeetingPollingQuestion(int MeetingPollingQuestionId) { using ...
I implemented the finger exercise from chapter 2.4 of the book called Intro to Computation Programming using Python by John Guttag. The task is: Write a program that asks the user to input 10 integers, and then prints the largest odd number that was entered. If no odd number was entered, it should print a message to t...
Is the code in Test1 and Test similar if it's being called like in RunAsync? The example is simplified, but this is an application with a high concurrency during peak and does have performance problems. We can expect the caller will always use await. We try to prevent faulted Tasks to be cached. The idea is that it sa...
Task: What to fix in the class, just as a beginner it's hard for me to understand where I messed up? Code: Model: from sklearn.neighbors import NearestNeighbors import pandas as pd class UserBased: """ User based recommendation system. This class makes recommendations to the user using User-Based Collabor...
I have a function that needs to compute a system response y in response to an input time series defined by x. In practice, x will be determined by an external process. y is then exposed to external processes as class member timeArray. Computing y entails two levels of recursion. The function I need to optimize in the c...
I was told over at gis.stackexchange.com that this question would be a better fit here. I already have a working code but it is very slow and my hunch is that it could be optimized. The goal here is to process 11 years of data = 11 x 12 x 30 x 24 = roughly 95,040 hourly files On a RAID/NAS external storage I have NetCD...
My task was to create a function that returns the level of a user. A user has a certain amount of XP. Each level is level * 10 xp so for example level 1 would be 10 xp level 2 would be 20 xp level 3 would be 30 xp and so on however your XP doesn't stack so if you have 30 XP you would fill the requirements for leve...
There is an exercise in the book Python Workout: 50 Ten-minute Exercises that asks to write a function to do the following: Write a function that takes a list of dicts and returns a single dict that combines all of the keys and values. If a key appears in more than one argument, the value should be a list containing a...
May I know how to speed up this simulation process? It is simulating a sequence with if condition at each step. The theta here contains two elements lambda and mu, which are both scalars determining the rate of growth of aphid population, where \$N[t]\$ is the current population and \$C[t]\$ the accumulative population...
The Observer Pattern is used here to notify changes in a Person's data. For example, when age changes, the value of can_vote() can change too, and all observers shall be notified of this change too. A simple if-statement can handle this. But this cannot be maintained when later age affects many other things (e.g. ca...
I am not really proud of the final project design. Whenever I try following MVC I get lost and in the end a lot of code doesnt end up where it should be. I am also wondering if am I overusing private members? I am not sure what to do when I have a lot of constants. In this project I declared them in separate classes bu...
and no, I'm not talking about Workbook_BeforeClose. Note that the motivation of this question is Excel specific but the technique I'd like feedback on is not. If you don't care about the motivation, you can skip to the chapter Option 3, the "magic" way. If additionally, you already know about the IUnknown::Release tric...
I'm a beginner developer in Python and I need some tips to improve my code, in performance (speed) and hardware usage. Is it possible to improve? And I have a question: is it possible to keep the browser (chrome/chromedriver) open after execution? The objective: to automate scheduling at the Italian Consulate, through ...
I need to implement back navigation handling on multiple pages of my react application. Currently I have added an alert on when the browser back button is clicked. I would like to optimize my code and make it better. I feel there can be a better way to add back handling to web apps in react. Any help suggestion or bett...
In this post, I will compare performance of a circular list and a conventional list with head/tail -references: package com.github.coderodde.sentinellisttexperiment; public class SentinelListtExperiment { private static final int ADD_FIRST_N = 50_000_000; private static final int ADD_LAST_N = 50_00...
The objective is to implement the reversed version of StringToDoubleConverter but without writing too many redundancies. I love DRY (Don't Repeat Yourself) design principle. public class StringToDoubleConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo cu...
The following code is a simple text-based RPG game where you can move between rooms and fight with monsters until you defeat the boss. import random import sys class player(object): name = "Hero Arius" hp = 200 power = 20 armor = 20 class gnome(object): name = "Flimp the Gnome" hp = 10 p...
I'm trying to figure out all the paths of all the nodes up to K depth. It seems to be a dynamic programming problem, my attempt seems to be working however its slower than I expected I would think that I would just have to: Iterate over all the nodes, add the node neighbors as a path Foreach additional iteration, itera...
My task is: In this challenge, write a function CountLOC.count to count the lines of code in a Java source file. A line of code is defined as any line in the source which contains at least one character of executable code. This excludes comments and whitespace. All input will be valid Java code in string format. Cou...
Class intended to be used as main type in a key-value database where keys and values are strings. Searched features: It is a const char * Behaves like a std::string Reference counting integrated reducing the number of indirections Vampirizes string_view using ptr + len Some additional methods (contains(), trim(), etc)...
I had to implement the below as a coding challenge. There are two http endpoints. The first http endpoints returns a list of postcodes. The second http endpoint takes a postcode as a parameter and returns the prices, commission and a discount, which includes percentage discount which should remove to the commission if ...
I have an exercise requires me to write a service to management menu. The requirement like this: Food menu includes: breakfast menu, lunch menu, dinner menu. The three menu haves list menu item( name, price, description, image). Write CRUD operation for food menu. At first, I separate completely three types of food men...
in last couple of days i was struggling with this drawing circle algorithm using bresenham’s method. This is my solution, im looking forward for better ones and definitely the faster ones, i dont know how to improve this algorithm, without using try/except method. My code: def bresenhamCircleNoTry(x, y, r): xc = x ...
Inspired by TechWithTim, I built up the solar system including Pluto. I have added a camera feature, zoom feature and displaying information about the selected planet. Zoom in and out using arrow keys, drag using mouse and select planet with left click. I would like my code to be reviewed on the basis of performance an...
When the remote server returns a 429 (Too Many Requests) response with the Retry-After header, the HttpClient can handle such cases with a handler: public class RetryHandler : DelegatingHandler { protected override async Task<HttpResponseMessage> SendAsync( HttpRequestMessage request, CancellationTo...
I am a beginner to Java and have studied up to loops only. After loops lecture above pattern was given to print as homework. I have successfully managed to print this pattern with following code: public class Main { public static void main(String[] args) { int n = 5; for (int i = 1; i <= n; i++) { ...
I made the following function to create the storage path for files from the the first 5 characters of the file's hash: function create_path($hash) { $splitted_hash = str_split(strtolower(substr($hash, 0, 5))); $path = ""; foreach($splitted_hash as $char) { $path.="/$char"; } return "$path/"; } // will...
Implements most (if not all) applicable member functions from std::vector and std::array Compatible with C++11, C++14, C++17, C++20 [] operator allows unchecked access, all other member functions throw #ifndef STAT_VEC_H #define STAT_VEC_H #include <memory> #include <cstddef> #include <cstring> #include <iterator> #...
I have this Python Package called ToTemp under development for precise Temperature Conversions and currently thinking in changing the method's implementation to be able to convert multiple values and return an Iterable with those converted values (in a list). It would be good to see some reviews on this. Default implem...
I have a hash table which I would like to query as fast as possible. The hash table is stored this way : When I query a hash, I extract first 4 characters then use it to find the file. For instance a hash starting by e0a458. I extract e0a4 and go to the file ./e/0/a4 On each file I have one line per hash[4].hash[5] cou...
I've recently gotten into Typescript and I'm solving some Leetcodes to learn. Problem description: Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same eleme...
I would like to ask the opinion for experts out there. The following code snippet was written by a colleague of mine who is very fond of functional style in Java. public Book findBookByIsbnOrId(String isbn, String id) { return Optional.ofNullable(isbn).map(i -> { return bookDao.findByIsbn(i); }) .orElseG...
While working on Project Euler, I have come across a few questions involving usage of the little omega function, big omega function, and Möbius function. My prior code wrote factors into an array and stepped over each factor to check values for the little and big omega functions, then counted the array's length and cal...
I'm dealing with a communication channel that: Converts \n characters into \r\n Removes 0xfd, 0xfe, and 0xff characters entirely Not ideal for transferring binary data. I can effectively use base64 to transfer binary data through it, but this makes the data being transferred 33% larger, which, when dealing with large...
I'm currently writing a card-game in Unity and the below code handles the player's ability to drag/drop cards onto various sections of the game board. Right now, I have this nagging feeling that as it is written now, it violates the "Single Responsibility Principle" by handling the drag/drop operation as well as the dr...
I'm creating a cache system for an object (Mesh) that is expensive to create. A Mesh can be created using a small amount of information in a hashable key (MeshKey). There are multiple methods of creating meshes, and the key must identify which method is being used and supply the parameters to the creation function. The...
I decided to try a hand at writing a simple state machine. The StateMachine class accepts any number of classes as template arguments, along with a base class. The classes act as states (a class so it can have permanent data), which have enter, exit and tick functions. The tick function can return nullptr to stay on t...
I think I made a good FileIO object because I can simply copy-paste whenever I need, however I wonder How I can improve my code. This code takes file path of the target file and turns every line to Strings. And combine all of the Strings into String array so that we can use the data of the file. import java.io.Buffered...
The following is my submission for LeetCode's Max Points on a Line: Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane, return the maximum number of points that lie on the same straight line. Example 1: Input: points = [[1,1],[2,2],[3,3]] Output: 3 I looked at other answers in th...
I need your expert opinion! In fact, for a Leetcode Problem, I had to code a queue using 2 stacks. It's shown just below and functions well. It is a pretty simple code with peek, pop, push, etc. functions, quite classic. But this code does not please me completely since I coalesce the optionals with a default value, ta...
Main is added to compare the expected result with the result of the function, the war field is GetMostFrequentNextWords. What data types can be better instead of Dictionary<string, Dictionary<string, int>>? Are there any problems with the usage of this data type? Is my code easy to read? In Particular, the creation o...
I am working on SQL Server I have sample data like this in a table. CustId Bank city rating date rnk 1 Deutsche Delhi 5 10/10/2022 1 1 BOA Pune 6 10/10/2022 2 1 UBS Mumbai 7 10/10/2022 3 1 SBI Chandigarh 2 10/10/2022 4 2 Axis Jaipur 1 10/10/2022 1 2 Amex Delhi 3 10/10/2022 2 2 CitiBnk Kolkatta 4 10/...
I have an array of integers labels, for instance array([0, 1, 1, 2, 2, 2, 3, 3, 1, 4, 4, 1, 1, 0, 0, -1, -1]). The array can be large (> 100k elements) and rarely consist of more than 5/6 different integers + (-1). In the example above, the unique integers are 0, 1, 2, 3, 4. The integers are always consecutive and 0-in...
This code works, but it's so ugly, so I was hesitant to put it on display. There must be a nicer/easier way to achieve this. The main issue is to count each unique occurrence during runtime when the object creation takes time. Input: 1190 W X 1648 H X 14 T S 1190 W X 1254 H X 14 T S 1190 W X 1254 H X 14 T S 1190 W X 12...
I'm computing higher order derivatives using nested jacobian from pytorch/functorch. $$f(x, y, z, \dots) : R^{m_x} \times R^{m_y} \times R^{m_z} \times \dots \to R^{m} $$ Given a function f(x, y, z, ...) and derivative orders for first several arguments (nx, ny, nz, ..), partial derivatives can be computed and used as ...
I implemented a bingo game and check for line, bingo or nothing for a given input where I get a 3x3 bingo card and next 15 numbers extracted. I wrote the following functions: using System; class Program { static void Main() { const int numberOfRows = 3; const int numberOfColumnns = 3; c...
I am working on my first brute force experiment and I modified code from this SO post but it is kinda slow. Are there any improvements I can make to make it run faster? What the code basically does is loop through a range of possible 8 numerical combinations and input every possibility to try and connect to a Wi-Fi net...
I have a use case where I need to programmatically hide the cursor on a running X.org server. While the suggested C progam works, I wanted to learn a bit about the X.org API and get some practice with rust. Hence I implemented an equivalent program that hides the cursor on an X.org server in Rust: Cargo.toml [package] ...
The program is taken on the standard input a list of football team games with the result of the match and displays on the standard output a summary table of the results of all matches. A team is awarded 3 points for a win, 0 for a loss, and 1 for a draw. from collections import defaultdict numberTeams = int(input()) d...
I am new to coarray Fortran and wrote a naive nbody-simulation. It is about 30x slower than an implementation in C + gasnet or C + openSHMEM. I compiled with gfortran -O3 -march=native -mtune=native -Wall -ffast-math -fcoarray=lib -g -lcaf_openmpi using GCC 12.2.0 and Open MPI 4.1.4 ! An n-body simulation. module acce...
I have below unstructured but valid JSON which need to be converted to structured format using any C# library or newtonsoft- { "root_id": { "Path": "InsertCases", "MainContract": "CreateCaseParameter" }, "root_tittel": { "Path": "InsertCases", "MainContract": "CreateCasePara...
I get a dynamic string(strConflictedYesReviewers) which contains multiple user recordswhere each record is separated by semicolon and then each record represents ownerid and opportunityid separated by asterisk. I have done it but looking for a better approach or code review. const strConflictedYesReviewers = "8863928...
I have a method in a class that accepts either a datetime or string parameter. It is shown in the last code block (I didn't include the class). A little background is that I am defining a wrapper around an API, and I want the end user to be able to pass either a string or a date but convert that into the appropriate st...
Code explanation: I have a code, which performs two tasks - To open two workbooks, one being extract info and one destination and it compares the column A with Column A of these workbooks and all matching cells are made vbBlue (Disclaimer:code is made with several other codes from net and with my customisations, id ad...
I am currently implementing a native Rust API to X11, especially around the XDisplay for a related project. I chose an object-oriented approach: use crate::util::discard_const_1; use std::ffi::{c_char, CString}; use x11::xlib::{ self, Window, XActivateScreenSaver, XAddExtension, XAddHost, XAddHosts, XAddToSaveSet, ...
EDIT: Dequeu was the correct guess EDIT: I did the BFS method for the suffix link/output link construction I'm doing a hackerrank challenge and I came up with this implementation of the aho corasick algorithm. Everything works fine but my suffix construction is too slow and it's taking ages to build with 100 000 inputs...
I just started to learning JavaScript and i did this below code for a simple countdown to halloween project // Setting counter start date const year = new Date().getFullYear() let timeInterval let countdownWasStarted = false let deadline = new Date("Oct 31, " + year) // Function that starts the counter function initC...
I created the following Chrome bookmarklet to open all elements with text Extra Examples boxes on this page. For example - the element labeled with text Extra Examples below can be clicked: When it is clicked then a list of examples will be displayed: The element can then be clicked again to hide the list of examples...
The following code is an instantiation of wilson's theorem. It uses a simple factorial and division theorem to check for primality. My issue is with the performance of the code, and there are two most prominent issues. Firstly, the cumtime for which the remainder is taken far exceeds the rest of the code; Secondly, the...
Description The code uses strtol() to convert text that represents a value in a given base into an integer. It takes three arguments from the command line, including the string and the base. The string may begin with an arbitrary amount of white space followed by a optional - or +. If the base is 0 or 16, the string ma...
Task: A subset is a continuous segment of an array. Two integer arrays are given with elements from 1 to 100: of N and n (N > n). For every subset of the first array of n length find out the next thing: Does this subset have the same values as in the second array? Order isn't important. The method should return bool[]...
Here I illustrate the use of the Memento Pattern to restore certain (but not all) data of a class that has data in abstract base classes. A Spellcaster has spells and is derived from an abstract CharacterClass that has levels, etc... data, which in turn is derived from LivingBeing which has hitPoints, etc... data, and...
I previously submitted this CLI tool to this site for review and have made changes based on comments by the reviewer. I have refactored the code, fixed a bug (the tool will no longer output certificate expiry dates for certificates that are not valid until the future) and added the following features: Accepting URLs f...
I am making a sandbox environment for javascript. For this I create a webworker with this function: (self is a webworkers global context) (() => { Function("\"use strict\";\nlet self,fetch,globalThis;(async()=>{try{"+arbitrary_code+"}}catch{})").apply({}); return; })(); With this, people are only able to use van...
For the segmented Sieve Of Eratosthenes, I have devised the following code provided. And I understand that it is not the best implementation; However, it should be much quicker than what it is now. The c Profile provides numerous results. However, it only defines built-in methods and gives no further context as to whic...
I've been trying so hard to come up with a data model that works for mathematical expressions (like x^2 + 2x - y * 4, no equals sign) in Rust. It's very different to other languages I'm most familiar with. Eventually, I want to be able to I think of mathematical expressions as recursive structures. As in the BNF <expr>...