instruction
stringlengths
71
95.1k
I would like to ask for a code review as I feel like it's not the most efficient way of doing it. For context I have a add-ins with all the code in module and then the SheetChangeevent is in ThisWorkbook. Also in the add-ins I have 2 sheets that will have data on it so that the ActiveWorkbook will be able to read this ...
In an interview I was giving the following problem: Count the number of click on on the entire page. Can you think of a better way to do this? let counter = 0; document.addEventListener('click', clickCounter); function clickCounter() { counter++; console.log(counter); }
I have a dataset X_train, which is an array where each entry is an email (a string of characters). There are 11,314 emails, each of which is about 500 characters long. (X_train is a processed version of the training data in the newsgroups dataset.) Ultimately, my goal is to build from scratch a tf-idf function (knowled...
I implemented a Simpletron simulator in C for learning C. Simpletron is a virtual machine invented by Deitel for his books. Simpletron runs programs written in the Simpletron Machine Language, an simple Machine Language. An instruction (and data) in the Simpletron Machine Language is a signed four-digit integer, like +...
As I was advised, I broke my code into 2 classes. Could you take a look at the repository class and report what problems this code has public class JsonSharedPreferences { private static Gson gson = new Gson(); private Context context; public JsonSharedPreferences(Context context) { this.context = context.getAppli...
I am learning C and, for learning purposes, I implemented a dice roller. It uses arc4random(3) for random number generation, as I couldn't find something better. It works both interactively, if no argument is given, reading dice string from stdin, one per line (I used getline(3) for this); and reading dice string from ...
Recently I was learning about TypeList and its algorithms in C++. When reading about its uses i got to know that TypeList along with the help of ClassHierarchy generators can be used to create Tuple Type in C++ (Andrei Alexandrescu). So i tried to write an implementation of it based on ClassHierarchy generator which is...
I worked out a zip operator similar to Python's, because I didn't find one in std. It allows to use range-based for loops to iterate at once over several equal-length containers (arrays, counters... anything that has an iterator and a static length). It should be safe (never exceed the iterator's capacity), be able to...
I made this encryption program in Python. I don't have much experience (or any experience at all) about encryption (since I just gave my 9th grade finals), but I had this idea about an algorithm some time back which would enable the user to encrypt words following an algorithm where the program would follow this proces...
I'm developing a Rust library that implements JSONSchema validation (Drafts 7 fully works at the moment). I have Rust-specific questions and concerns about my implementation. It works by compiling the input schema first and validating the data after it: use jsonschema::{JSONSchema, Draft}; use serde_json::json; let sc...
I was working on a code challenge with the following description: Given an array of positive or negative integers I= [i1,..,in] you have to produce a sorted array P of the form [ [p, sum of all ij of I for which p is a prime factor (p positive) of ij] ...] Example: I = [12, 15]; //result = [[2, 12], [3, 27], [5, 15]] ...
Introduction I am developing a dynamical system simulation/animation framework, which provides three abstract base classes, DynamicalSystem, Visualisation and Animation, from which clients can derive concrete classes for the purposes of animating dynamical (physical) systems in 3D (and 2D). The DynamicalSystem abstr...
I have a college assignment to implement a class called sorter, whose object is a sorted vector (the user is allowed to sort it by the method he/she desires). I have been able to implement it as following. Please review it and suggest me the changes I should make to make it efficient. template <typename T> class Sorter...
I've wrote a piece of code today that really make me sick about: if ( account.plan_id ) { const featuresToCheck = []; for (const vertical of Object.keys(account.account_settings.enabled_features)) { for (const feature of Object.keys(account.account_settings.enabled_features[vertical])){ feat...
I've created the following program to assist me in some template stuff I'm working on. The function get_type returns 0, 1, 2, 3 or nullopt corresponding to which group the argument T belongs to. This is my first template style project, so I'm looking for any critique possible. (Note the functions are marked static inte...
below code takes data (email,password,user type) from $_POST[] and use them to search whether a user exists on the database. If yes sends a JSON object to the client and also stores cookies on the browser. I have two user types and have them stored in two tables in my database. User_Table Driver_Table I need to chan...
I wrote code that stores an AWS Organization tree in a tree data structure in Rust. From the tree, I use a slightly modified preorder traversal algorithm to print all of the accounts in the organization in a table, while keeping track of all ancestors for each account. AWS Organizations are composed of a root organizat...
What do you think about this helper class to specify UTC time? It should also support an easy way to capture current time offsets. Let's say we expose it in API like this: interface IApi { void Start(Utc at); } Now it should go as: api.Start(new DateTime(2021, 01, 01)) // starts on 2021-01-01 UTC api.Start(new Tim...
I have two lists which are also having some duplicate elements , i am converting this list to map as key value pair with element index as the value for the key - element List 1 : [1, 2, 3, 4, 5, 6, 7, 2] = > MAP 1 (Map, List>) : {1=[0], 2=[1, 7], 3=[2], 4=[3], 5=[4], 6=[5], 7=[6]} List 2 : [3, 3, 2, 4, 7] = > MAP ...
I made a struct that will loop through a list, and return the next element on calls to the Get() method. It also allows to remove elements from the list by calling the Evict() method, and is safe for concurrent use. I'd appreciate any feedback: what's ok, what's not, what could be improved or changed. package generator...
I have written an automatically encrypting text editor (github link). The reasons that I wrote this program instead of using vim + gpg are: It's more convenient than vim + gpg (user only needs to enter password once). It's more secure than vim + gpg (see CVE-2010-2547 and CVE-2019-12735). User cannot accidentally cha...
Inspired by this question on Puzzling.StackExchange, I've decided to write a small python script that determines if a word is a BFF Word. Below are the parameters, solved by Puzzling user Stiv, also discussed in the program module docstring: If you remove two letters, you are left with an anagram of an animal which is...
ERROR: type should be string, got "https://leetcode.com/problems/divide-array-in-sets-of-k-consecutive-numbers/\n\nGiven an array of integers nums and a positive integer k, find whether\n it's possible to divide this array into sets of k consecutive numbers\n Return True if its possible otherwise return False.\nExample 1:\n\nInput: nums = [1,2,3,3,4,4,5,6], k = 4\nOutput: true\nExplanation: Array can be divided into [1,2,3,4] and [3,4,5,6].\n\nExample 2:\n\nInput: nums = [3,2,1,2,3,4,3,4,5,9,10,11], k = 3\nOutput: true\nExplanation: Array can be divided into [1,2,3] , [2,3,4] , [3,4,5] and [9,10,11].\n\nExample 3:\n\nInput: nums = [3,3,2,2,1,1], k = 3\nOutput: true\n\nExample 4:\n\nInput: nums = [1,2,3,4], k = 3\nOutput: false\nExplanation: Each array should be divided in subarrays of size 3.\n\n\n\nConstraints:\n\n1 <= nums.length <= 10^5\n1 <= nums[i] <= 10^9\n1 <= k <= nums.length\n\n\nPlease review for performance.\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace ArrayQuestions\n{\n /// <summary>\n /// https://leetcode.com/problems/divide-array-in-sets-of-k-consecutive-numbers/\n /// </summary>\n [TestClass]\n public class DivideArrayinSetsofKConsecutiveNumbersTest\n {\n [TestMethod]\n public void TestExample()\n {\n int[] nums = {1, 2, 3, 3, 4, 4, 5, 6};\n int k = 4;\n Assert.IsTrue(DivideArrayinSetsofKConsecutiveNumbers.IsPossibleDivide(nums, k));\n }\n\n [TestMethod]\n public void TestFailed()\n {\n int[] nums = { 1, 2, 3,4};\n int k = 3;\n Assert.IsFalse(DivideArrayinSetsofKConsecutiveNumbers.IsPossibleDivide(nums, k));\n }\n }\n\n public class DivideArrayinSetsofKConsecutiveNumbers\n {\n public static bool IsPossibleDivide(int[] nums, int k)\n {\n if (nums.Length % k != 0)\n {\n return false;\n }\n\n var dict = new SortedDictionary<int, int>();\n foreach (var num in nums)\n {\n if (!dict.TryGetValue(num, out var value))\n {\n value = dict[num] = 0;\n }\n\n dict[num] = value+1;\n }\n\n\n for (int i = 0; i < nums.Length / k; i++)\n {\n int start = dict.FirstOrDefault(x=>x.Value >0).Key;\n dict[start]--;\n for (int j = 1; j < k; j++)\n {\n if (!dict.ContainsKey(start + j) || dict[start + j] < 1)\n {\n return false;\n }\n\n dict[start + j]--;\n }\n }\n\n return true;\n }\n }\n}\n\n"
Why did I make this? I'm building an interactive data structure visualization, and when certain errors are thrown from certain parts of the code, they are displayed on screen for the user. I have not included that displaying logic. The if checks seem somewhat smelly to me, but they might be simple enough to the point t...
I am a beginner and trying to send data from AWS DynamoDB to Azure Queues. Note that this code will be invoked 10,000 and alot more. Can you guys review it once. using System; using System.IO; using System.Text; using Newtonsoft.Json; using Amazon.Lambda.Core; using Amazon.Lambda.DynamoDBEvents; using Amazon.DynamoDB...
For a long period of time I worked on this code, mostly trying to understand it. That is the main reason for needed review. Second reason is simply that I would like to optimize it in any way you can find. Side note: I have shortened the code as humanly possible. Compilation of the below code: g++-8 -O2 -std=c++17 -Wal...
I made this simple program that can solve every set of linear equations in two variables. You just need to enter two linear equations of the form ax+by=c (without any unnecessary spaces) where 'a' is a positive integer (i.e. x should not have a negative coefficient) and b and c are just integers. The program can also s...
This is the first time that I have tried programming in such a general way using c++. I have tackled this pattern before in other languages such as golang, but this is my first attempt with cpp. Subscriber template // class template for a subscriber that wishes to be informed of the // occurrence of a particular even...
This is a program that can decrypt the codes that have been encrypted using the algorithm that my previously posted encryption program follows, you just need to enter the encrypted text from that program. I got a lot of suggestions from people on the encryption post, I have tried to make this program as short as possib...
I often see very long code lines like this: <input type="email" name="email" autocomplete="email" id="email_address" value="<?= $block->escapeHtmlAttr($block->getFormData()->getEmail()) ?>" title="<?= $block->escapeHtmlAttr(__('Email')) ?>" class="input-text" data-mage-init='{"mage/trim-input":{}}' data-validate="{requ...
This is code for finding if inequality \$abc > 2(\text{area of triangle})\$ where \$a\$, \$b\$ and \$c\$ are the sides of any triangle. The below, and repl, code work as intended. However they take a long time. Can the performance be improved without reducing max_tries? import random import math hn=100000000 num=0 ma...
The data are in a file called test.txt, which is available at https://drive.google.com/file/d/1g0ffvH5oP5C4Cp6ciEp_L1Rst6WeTuYG/view?usp=sharing. There are some odd formatting things about it which I cannot replicate by putting on this website, hence I'm hosting it on my Google Drive. It is just simulated data, so ther...
I've built out a section on a page that contains multiple instances (why I'm using querySelectorAll()) of this Request Brochure form. They are using Campaign Monitor so much of the form code has been removed for this post. Operation On page load an event handler that calls preventDefault on click events is added to e...
I have a RadioStation class file and a view controller where I create two station objects based on this class, one for FM and one for AM. I created both of these station objects from within the same required init method. I'm not sure this was this the best way to do this, for example can you imagine if you wanted 8 su...
I've decided to implement a simple case of the Observer pattern. I've gone about this considering you can only register 1 single observer in the Observable, instead of allowing multiple ones. I would really like feedback about what'd be the proper way to return the listener in the run method while still yielding value...
I am dealing with a large amount of XML files which I obtained from here https://clinicaltrials.gov/ct2/resources/download#DownloadAllData. The download yields around 300.000 XML files of similar structure which I eventually want to load into a single dataframe / csv. The code gives the result that I want: Each row is ...
So I wrote this a while ago and yesterday I was going through it and trying to remember every line of code and how it works. Well, the program simulates a online bank account as well as an ATM. You register your account, you are able to withdraw, deposit, and transfer money. There is a limit to the amount you can trans...
I just started programming a week ago. Online tutorials aren't my thing, so I decided to just start projects and learn what I need for the project. My first project is a guess the number game. The user is asked to guess a number between 0 and 20. If the user's guess is too high, they will be told it's high and likewise...
I am trying to migrate from request to axios, since request has been deprecated. Suppose that the URL 'https://www.example.com' receives a post request with formdata that contains login information, and also suppose that I need to maintain the current session across multiple requests (for that I need a cookieJar). Usin...
I have an application developed in ASP.NET Core C#, where according to a configuration it must replace certain urls of a text when an http request is made and the text must be returned as soon as possible in response, the text can change on each request. At this moment the code I have is working well, but I would like...
Its been a while since I have written PHP or HTML for a project, so I could use some thoughts on improving the code below. I wrote all of this going off of old knowledge, so I imagine its really sloppy and can be written a lot cleaner. All of the code below works. Here is the link to the project on GitHub <!DOCTYPE h...
I am using Python 3.8 with ArcGIS Pro 2.5. This code creates a joined table where I match values for plant greenness in the current month with rainfall X number of months into the past. Each loop iterates through about 600 files (the number of files in ws1 and ws2). The code works perfectly but slowly, taking approxima...
Python script that can download images and videos of the user, like Gallery with photos or videos. It saves the data in the folder. How it works: Log in in instragram using selenium and navigate to the profile Check the availability of Instagram profile if it's private or existing Gathering urls from images or video...
I am creating web page in which I get user location and store it in an input field of a form using javascript. But perfomance is slow.Review my code and provide a better way. var LocArrayForPerfomance = []; LocArrayForPerfomance["longitude"]=document.getElementById("longitude"); LocArrayForPerfomance["latitude"...
I followed a video on YouTube to create a custom user model, this is my attempt: # Django Imports from django.contrib.auth.models import AbstractBaseUser, BaseUserManager from django.db import models # The Custom (UserManager) Class class UserManager(BaseUserManager): # Defining A Function That Will Be Used To Cre...
After just learning a bit of Python I tried coding something myself. I attempted to do a game of Blackjack, which is far from perfect, and still doesn't have some rules a real game has (in my game an ace is always 11 points, whereas in reality it can also be counted as 1 point). There is however an issue that I'm havi...
I have a PHP CodeIgniter website that collects volunteer registrations. One thing I have noticed is that the controllers are getting really big. The controllers have many methods, and each method is fairly long. I believe this could be a code smell, and I would like some help and advice on how to refactor the code. The...
I wrote a program to insert a checksum into a Game Boy cartridge. Here is a spec of the cartridge header, but I'll include the relevant information here, as well. The header checksum is defined as the sum of the bitwise-NOT of the 52nd through the 76th bytes of the file, inclusive. The global checksum is defined as the...
I use the following code to add tree item to vscode extension, Im getting the data and build the tree according to the entries I got, the code works. As I new to typescript I appreciate your feedback's, if the code looks good let me know either :) thanks export class TaskTreeDataProvider implements vscode.TreeDataPro...
I am relatively new so any help would in improving this and future codes. The code involves basic file management for two different files, one for buses and another for the employees and I am not very experienced with file managing so expect some beginner errors and mistakes #include<stdio.h> #include<stdlib.h> #includ...
A friend gave me the following riddle: Given n people with n distinct names, you place n names tags on a round table with n seats. If the n people now sit at those seats randomly such that exactly one person sits correctly (in the seat with the correct name tag with their name one it), can we rotate the table such tha...
I'd like you to take a look at those extension functions I made in kotlinjs (version 1.3.61): inline fun <reified E : Element> Element.queryHtmlSelectorOrNull(selectors: String): E? { return this.querySelector(selectors = selectors) as E? } inline fun <reified E : Element> Element.queryHtmlSelector(selectors: Stri...
So I attempted to write Conway's game of life on an Arduino and display using the FastLED library. I use a custom bitset class to manage the game board state. I'm looking for feedback on performance, and general code style towards embedded systems. I should note that my led strip is a little bit weird see diagram below...
I'm trying to preprocess a large text document. I've written a text normalization function which takes a disproprtionate amount of time and memory. How can I format the function to lower these two? The time result below was for this example. t = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod t...
The N-Queens puzzle can be solved in many ways. One is by a depth-first-search backtracking algorithm. Below is my generalized version using mutual recursion: let dfsBacktrack initialValue solved getNextItems = let rec procCurrent path = match solved path with | true -> Some path | false -...
The natural logarithm can be approximated by the following formula: $$ln(x) = 2\sum_{k = 0}^{\infty}\frac{(x-1)^{2k+1}}{(2k+1)(x+1)^{2k+1}}$$ I've implemented this formula using Java. Parameter n is the amount of iterations to approximate the natural logarithm. static double lnApproximation(double x, int n) { ...
everybody. It took a tree of squares for my web game. I wrote a preview using Typescript. I would like to hear from you tips on how to improve the code (I just started writing in Typescript). First of all, I would like to improve performance. I have a couple of ideas but I don't know how to implement them: What if yo...
My target website is Indeed. I tried to implement the scraper such that it is convenient for the end user. I am introducing my code in the readme file on my github repo. I am somewhat a beginner in programming so I am looking for guidance on things such as if the libraries that I used are approriate, the code itself an...
The full repo is here, but I'll post the most important extracts below. Background I'm trying to get the hang of blockchain and public key cryptography, so I thought it would be fun to create a program for drawing up and promulgating government decrees - the government in question being one that I've just made up. The ...
I have a list of rule names coming from .xml file. These rule names needs to be validated against rule names in database (Validator.cs). If valid, then Id of these rule names are used to fetch user data from database (ExportService.cs). I am using a Dictionary object to save name, Id pair from database - Validator.cs...
I have this method that attaches the year and year's rowspan for a TD and Quarter and a Quarter's rowspan for the TD. Year and Quarter are 2 columns in an Angular Material Table which are calculated from an array of objects one of which property of the object is a date string. Here is a demo for the code: https://stack...
I have written this code as a college assignment fot the famous job sequencing problem. Please tell me any improvements if possible. Oh, for algorithms.h header file, refer my github repo The code: #include "algorithms.h" struct Job { int index = 0; int time_slot = 0; int profit = 0; public: Job() = ...
I was working on making a cache in bash and I found this link - But this guy is attempting to generate new bash functions by introspecting their source and generating a new one as a cache. This seems to me, way overkill. Here is my implementation and it works just fine: cache() { local file file="/tmp/$(printf "%s"...
Please check the following the LRU cache implementation. Thanks for the valuable comments import java.util.HashMap; import java.util.Map; public class LRUCache { HashMap<Integer, Node> lruHashMap = new HashMap<>(); private final int DEFAULT_CACHE_SIZE =5; int capacity = 0; class Node{ int v...
I'm a very new Haskell programmer, and I've written the following code for loading TSV files. I think it can be improved, but I'm not sure how. I feel like the giant "do" block in loadData is inelegant, and that there's likely a better way to approach this. I think I'm trying to avoid the IO monad because I'm not sure...
Problem A non-empty array A consisting of N integers is given. Array A represents numbers on a tape. Any integer P, such that 0 < P < N, splits this tape into two non-empty parts: A[0], A[1], ..., A[P − 1] and A[P], A[P + 1], ..., A[N − 1]. The difference between the two parts is the value of: |(A[0] + A[1] + ... + A[P...
I'm trying to come up with a design for a chess engine in Kotlin that hides implementation details, and that ensures that such an implementation cannot accidentally become spaghetti. Client side example code I envision that a client would access the chess engine with something like: package chessprototype import chess...
I implemented a compiler that compiles a dialect of BASIC known as SimpleBASIC into Simpletron Machine Language to be run by the Simpletron simulator. I wrote the manual for the SimpleBASIC compiler in troff, it contains the commands of the SimpleBASIC language and some example programs. simple(6) ...
The following code uses dynamic approach to solve 0/1 knapsack problem. (I know the maximum profit function I have used is not as good as the one I have defined here and I still am working on that . Are any optimizations possible for the following code? #include "algorithms.h" struct Item { int index = 1; int ...
As a hobby I am working on a game engine in order to learn C++ and graphics programming, now I have completed my first iteration of my camera system using OpengGL and GLM. Because I am mostly self taught I am searching for some feedback. I am mostly searching for feedback regarding the following points: Is the API eas...
This is the first time I am posting here, so please go easy on me : ). I am also writing for the first time python code which uses async / await for streaming web-socket information. My main goal is to: Connect to a web-socket Stream info from web-socket Continuously save the streaming info somewhere (to DB for exampl...
As I was streaming I had a brilliant visitor suggest we write a blockchain in Python. So we did. Note that there is no validation or voting simulated here. Here's the results, in package/blockchain.py: from __future__ import annotations # https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports from oscr...
I have a part of code that is loading a dataset and normalizing property values to [0, 1]. My implementation is: import pickle import numpy as np # -- load data prop_1 = list(np.random.rand(10)*20) prop_2 = list(np.random.rand(10)*10) prop_3 = list(np.random.rand(10)*30) # -- normalize l_bound = [] l_bound.a...
The following snippet of C includes implementations for both Windows NT and POSIX-compliant systems to get the time (with microsecond resolution) since the Unix epoch. In the case of Windows NT, the time is registered as 100-nanosecond ticks since the NT epoch (1/1/1601), so it requires a bit of conversion. I feel like...
I am a beginner in python. This is the Nested Lists problem from HaackerRank. Given the names and grades for each student in a Physics class of N students, store them in a nested list and print the name(s) of any student(s) having the second lowest grade. Note: If there are multiple students with the same grade, o...
I started learning python online and I wrote a blackjack game as my first little project. I would like to get some review on it if possible. (how to make it better , simpler , etc) from random import choice cards = ['A', 2, 3, 4, 5, 6, 7, 8 , 9,'J','Q','K']*4 def get_card(name): card = choice(cards) cards.remo...
Introduction I am recently learning Rust by reading The Rust Programming Language (a.k.a. the book). I have finished the first three chapters so far, and this is my attempt for the first exercise listed at the end of Chapter 3, which has a simple description: Convert temperatures between Fahrenheit and Celsius. My p...
I've created some controller for handling clicked links statistics. Does this class meet Single Responsibility Principle? class StatisticsController { protected $statisticsQuery; public function __construct(StatisticsQuery $statisticsQuery) { $this->statisticsQuery = $statisticsQuery; } pu...
I do not have an intention to ask for an answer, but I want to know if my answer is good for a two-week Python beginner? Question: (Automate the Boring Stuff with Python/ page 102) Comma Code Say you have a list value like this: spam = ['apples', 'bananas', 'tofu', 'cats'] Write a function that takes a list value a...
I'm trying to replicate Android's GenerateViewId() to assign a unique Tag to dynamically created UIViews in Xamarin.iOS. internal static class LayoutExtensions { // A tentative to mimmic Java's AtomicInteger used by GenerateViewId() // https://android.googlesource.com/platform/frameworks/base/+/master/core/java...
I developed this small code to make my life easier when I work with remote machines over ssh tunnel crossing a bastion host. I would like to publich it so others could benefit/learn from it. So I would appreciate your opinions for improvement or maybe I overlooked some issues in this approach. Goal: I have a postgres ...
EDIT: Added a block with the raw code at the bottom (suggested by a friendly user) First post here. I sincerely hope that I am doing everything by the book. Also, I want to thank you in advance for any help and assistance that you may be able to provide me. I have been coding VBA for 2 weeks. Problem: What can I do to ...
I'm switching my neural network library over to using ArrayFire for performance. One of the features I am losing moving from ndarray is ndarray_einsum_beta, as such I need to write my own function to carry out what I was using einsum for. This function needs to be as fast as possible. This is the function: fn arrayfire...
In a particular social network friends are automatically allocated to users by the system and users cannot add friends of their choice on their own. There are currently N users on the social network, labeled from 2 to N+1. For every ith user (where i ranges from 2 to N+1), the system allocated all the users labeled wit...
I made a C# console math project where the user answers addition, subtraction, multiplication, division, power or square-root questions based on the difficulty they choose! However, I am struggling to refactor one part of my code. Here is my code: using System; using System.Collections.Generic; namespace mathstester {...
On a Manhattan grid, find the intersection of two paths closest to the origin. input_3.txt can be found here and the prompts can be found in the original problem statement. import re with open("input_3.txt", "r") as f: coordinates = [wire.split(",") for wire in f.read().splitlines()] class Point: def __init_...
I have a list of about 55k Accounts that I am cleaning up. 95% of them are from US/Canada which is what I'm most concerned with. I am going through record by record and will perform various checks and fill in or correct City, State, Zip, Country. I have a table with every City, State, and Zip for US and Canada that ...
The following is my attempt at parallelizing (I learned about parallel computing over the last weekend, so I'm very new to it) and making more efficient the code in my previous question Block Bootstrap Estimation using Java. The text file text.txt can be found at https://drive.google.com/open?id=1vLBoNmFyh4alDZt1eoJpav...
I am learning python by solving python module from HackerRank. This problem is Find the Percentage. You have a record of N students. Each record contains the student's name, and their percent marks in Maths, Physics and Chemistry. The marks can be floating values. The user enters some N integer followed by the ...
Recently I wrote a validator for some objects. To increase usability the validator gives the user hints on how to fix some of the found issues. Since the application is around something programmatic, and that many of the issues wouldn't make sense without identifying a path to an object; I decided to build a navigator....
i am trying to create a semicircle menu with animations and texts. Currently i try to position the texts in the semicircle which is only working with a specific window-width and browser. This is my current approach: https://codepen.io/Jxner/pen/xxGBKYJ .menu { padding: 0; list-style: none; position: relative; m...
I need some pointers on how I can speed up my code, as of now it is incredible slow for larger inputs. The way the code works is that the file Loc_Circle_50U.txt contains the true locations of 50 vehicles while the files in ns3_files contain some erroneous locations. I analyze these differences which are stored as erro...
The following is a simple class for establishing multiple http connections, mainly for downloading a list of small files: #include <cpprest/http_client.h> #include<string> #include<vector> #include <mutex> #include <cpprest/filestream.h> using namespace utility; // Common utilities like string conve...
I wanted a simple code review for improvement to increase the efficiency of my text generating model. This model is taken from the official TensorFlow site but is being trained on different datasets. I am using TensorFlow 2.0 (beta1) GPU version and Keras. I was training this on a Harry Potter book but I found that the...
I've spent the last few days learning the beginnings of how to implement a simple neural network. I've gone through chapters 1 and 2 of this book and have tried to write my own NN with referrals to the code given when I had some trouble. I am working with the mnist dataset. At the bottom of my question I have listed th...
Exercise: Design a Stack A Stack is a data structure for storing a list of elements in a LIFO (last in, first out) fashion. Design a class called Stack with three methods. void Push(object obj) object Pop() void Clear() The Push() method stores the given object on top of the stack. We use the “object” type here...
I am working with a project of using modern C++ on the Game Boy Advance (repository is here, code under the MIT license). Being a fairly limited platform (288 KB of RAM maximum, no memory controller), I try to avoid as best as I can the use of dynamic memory allocation (malloc and friends). Since now I could get away w...
I have written a few C++ functions that should: take in a string transform it based on index transform it based on number of alphabetic characters seen return the transformed string Example first, detail after: $ rotn_a("Hello, World!") > Igopt, Exbwp! $ rotn_a("aaaaaaaaaaaaaaaaaaaaaaaaaaa") > bcdefghijklmnopqrstuvw...
I build database called MessageBoard and created StoredProcedure GetHomeView that return data for HomeView. I am completely new in this area. Stored procedure contains next fields: Id - Key fied. ForumId - Field that should be in result query because it is need to know, which forum should be loaded if user will open ...
For a project I am using the yelp dataset (found here: https://www.yelp.com/dataset) to create a Hashset of all verbs, nouns and adjectives found in the restaurant reviews. I have it up and running using the stanford nlp pipeline, however it is quite slow (takes about 1 hour to process 10000 reviews) and the dataset co...