instruction
stringlengths
71
71.9k
I am a newbie in this world of data structures and algorithms (returning to these topics after 5 long years). Can someone please check if the code I have written for Binary Tree is OK? Test-case 10, 3,11,11,5,0 PrintInorder 3,0,5,10,11,11 PrintPreOrder 10,3,0,5,11,11 PrintPostOrder 3,0,5,11,11,10 using namespace std;...
Next Saturday I'd like to conduct a TDD demo in our local developer meetup. For this purpose I want to implement the first user story of the BankOCR kata from the Coding Dojo Wiki. Here is the solution I came up with. Any feedback is appreciated. AccountNumberParser.java package com.demo.bankorc; import java.io.Buffer...
I am working with this code to parse through HTML files stored on my computer and extract HTML text by defining a certain tag that should be found: from bs4 import BeautifulSoup import glob import os import re import contextlib @contextlib.contextmanager def stdout2file(fname): import sys f = open(fname, 'w')...
I'm trying to accomplish the following: Start out with 1 interval on the real line. This interval is processed in some function and out comes an array of errors (size < 10 usually). The maximum element of this array is also stored and the interval is put onto a queue sorted by this maximum error. Then we proceed by tak...
This is a variant of the Manhattan Distance problem. The input is a 2D matrix of boolean with the true cells representing location of an ATMs(or anything for that matter). The output has to be a 2D int matrix giving the distance of each cell from the location of the closest ATMS. Here's my code, public class ManhattanD...
This is my second attempt to make simple lock using extended assembly. See https://stackoverflow.com/questions/37241553/locks-around-memory-manipulation-via-inline-assembly/37246263 The code: static inline void atomic_open(volatile int *gate) { asm volatile ( "jmp check\n" "wait:\n" ...
I am working on a server for a smart house. This part of code is responsible for communication with client (separate application), sending requested data and ensuring everything is safe. I've decided to use multithreaded version of Python socketserver in order to avoid bottlenecks (I want it to be flexible enough to ma...
This script records audio from the computer's output and passes it to a C program that fingerprints it and queries the Gracenote database. If it identifies the audio then it offers options to look it up on Discogs. I made this because I wanted a way to identify tracks in DJ mixes that didn't involve using Shazam on my ...
I am new to unit testing and I am unsure how to design classes that use third party libraries, so that I can easily test them. The example I'll use is with EPPlus-OfficeOpenXml (an Excel document manipulator). I have a class to import excel documents and validate them. Here is a sample of my code: Imports OfficeOpenXml...
Given the task of having to return an array that alternately takes elements from two arrays, what would be most Ruby way of completing the task? As of now, I have this code, but it doesn't feel very elegant. def alternateTake (a, b) raise ArgumentError, "Unequal length" if a.length != b.length build = [] (0..a.le...
For a new project I'm going to need to be able to serialize random types to TSV or CSV files, so I write a class which can be used to serialize any object to a TSV, CSV or any other _SV file you can think of. (You could literally serialize objects to files with the letter "B" or the word "Rawr" as the column or row del...
I wrote a prime number sieve in Ruby last year as part of a coding challenge, but lately I wanted to port it to Rust. I finally got around to it, but it's still intensely Rubinic. Before I take the obvious next step and parallelize it, I want to make sure my code is as Rust-idiomatic as possible, so that I don't develo...
I wrote this program to process the names and meanings from .txt files. From the while loops I wrote, I noticed they are very similar loops containing Scanners. I am wondering if there is any way to reduce the redundancy in the code. Also, for this program my instructor only allows us to use Scanners, while and if/else...
I'm currently building a node.js addon for libcurl. Right now I'm trying to correctly use v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory to update v8 on the amount of memory being allocated by libcurl, and to do that I need to wrap the above mentioned functions that libcurl uses, using curl_global_ini...
To give you a simple background, I've been programming in C++ for about a week and decided I wanted to build a simple snake game. I made one over the course of a day and this is the end result. What overall improvements can be made to this code? Are there any general advice on programming that might be relevant? #incl...
I recently stumbled onto a very old article about procedural dungeon generation on this site. Unfortunately, the author did not provide any code, only a description of the algorithm he used. Wanting to use this in my game, I tried to write my own generator following their algorithm: local random = math.random local fu...
I'm doing this HackerRank problem, which asks whether an array of up to 100000 integers can be sorted in ascending order by exactly one of the following: swapping two elements reversing a subarray doing nothing (i.e. it is already sorted) I've written this code and it passes all the tests, but it seems very convolute...
I had a test task for internship where the main part was in implementing fixed size caches with different displacement policies (LRU/LFU/FIFO). I did that task, but was refused afterwards. Now I am wondering how my solution might be improved? Requirements for an implementation are: Cache must be thread-safe Operations...
I have this code that fetches rates from a website called X-Rates, and outputs to excel the monthly averages of a chosen country. The code runs quite fast, but I still think there's improvements to be done! Apologies for long code, but if you help me I would be really grateful! Option Explicit Public Sub fetchCurrency...
I've created a method to split a date range into a collection of date-arrays. These arrays consist of two timestamps. Example: System.out.println(""); System.out.println("*****************************"); System.out.println("Split 2.1.2004 to 26.3.2004: "); for (DateTime[] date : TimeSpl...
I've been reading up on Actions and delegates for the last couple of days, and I think I'm finally starting to understand, but I wanted to check that I was using them correctly, or at least using them in a way that isn't totally insane. I'm using a text-based game (as such) as a platform for learning about what I susp...
Is there any way to simplify this query? It's being run against a Progress Database via an ODBC connection. The CustomerSalesperson table has a CustomerID, a SalespersonID, and a CreateDate. Each CustomerID could have many records, each with a different SalespersonID. I'd like to get a list of the SalespersonIDs with t...
I have been writing a web crawler in F# that downloads pages with stylesheets and scripts. Can somebody give me suggestions on improving this code, please? Would appreciate any feedback that could improve it / prettify it. open System open System.Net let log fmt = Printf.kprintf (fun str -> // todo: lock | agent...
For a while now I've been playing around with various ways of passing a logical predicate E.G. >= someValue as an argument to a function. (see: If ComparisonIsTrue(thisPost, ComparisonOperator.NotEqualTo, goodCode) Then Me.Answer and a global enum for comparison operators) In the end, I've decided to build a CLS_Compar...
The following is a full example to illustrate my question: #define MAX_LENGTH 32 #define ITEM_COUNT 3 using namespace std; void doSomething(char ** name, int items) { *name = new char[MAX_LENGTH * items]; strncpy_s(*name, MAX_LENGTH, "Oracle", 7); strncpy_s(*name + MAX_LENGTH, MAX_LENGTH, "Apple", 5)...
I'm fairly new to VBA, and this was basically a brute-force solution to a problem I was encountering. I wanted to take data that appeared in two columns, and pull it together into one. The current code works, but is very slow with large datasets. I've been told to avoid using the clipboard if possible, but I'm not qui...
I need to create an structure to control dynamically locks. For example, I have 100 threads running, and each thread will "process" a "key". Sometimes two threads could be processing the same "key", and if it occurs, a dynamic lock needs to be created and used by both, to process one at a time. I create the following s...
I wrote a small function that checks if an image or multiple images are loaded. For that purpose, I decided to use ES6 promises, but I'm not really sure if my way of handling errors is the best way. const loadImg = function loadImg(src) { 'use strict'; const paths = Array.isArray(src) ? src : [src]; const ...
So, I have written a code which calculates the number under n( 1 million in this case) which produces the largest Collatz Sequence in that range(). The problem is given in detail below: The following iterative sequence is defined for the set of positive integers: n → n/2 (n is even) n → 3n + 1 (n is odd) Using the rul...
I am using the below jQuery and HTML to read in and use an XML server status feed for a server widget. This is the code: XML Feed: <status> <script id="tinyhippos-injected"/> <serverinfo> <hostname>harvey</hostname> <external> http://stats.pingdom.com/3tltrr03waho/1435422/history </external> </serverinfo> <host> <statu...
Recently I was looking for some really simple modal/popup solution in vanilla JS, but nothing popped. So I wrote mine component. It works great so far, have all the options I need, but I don't know if I can improve the code itself. JS: /* A very simple modal component You can close the modal either with `esc` key, hitt...
I am putting together a couple code samples for prospective employers and would love some feedback. I am still pretty junior so I am not sure what constitutes a good code sample and the do's and dont's. The code sample shows both the original version of the code which is currently in production (at my previous company)...
I have already asked a question about a dynamic multi threaded lock, and the reviewer found a problem. Here is the description of the problem that I need to solve: I need to create a structure to control dynamically created locks. For example, I have 100 threads running, and each thread will "process" a "key". Someti...
Recently, I came across this problem on Codility. I am aware there is a bit of similarity to this question and this question, but I am trying to achieve this in C#. The problem is as follows: A non-empty zero-indexed array \$A\$ consisting of \$N\$ integers is given. The array contains an odd number of elements, and...
I have a table with columns dated by week that changes dynamically each day. Currently, I am using the following php code to get the proper dates for the past eight weeks: $currentDate = date('Y-m-d'); $weekOneStart = strtotime("-56 day", strtotime($currentDate)); $weekOneStart = date("m/d/Y", $weekOneStart); $weekOneE...
I was trying to use the ES6 Promise with the "co" module to write the async code without callback. Though actual async call is neat and clean, I still have to add wrapper method to return Promise object which made it little bulky. Any feedback to improve this code quality will be appreciated. crud.js 'use strict'; cons...
Alright, so I've got this script which basically drains the thumbnails and streams from the twitch API/JSON. $(function() { var i=0; var twitchApi = "https://api.twitch.tv/kraken/streams"; var twitchData; $.getJSON(twitchApi, function(json) { twitchData = json.streams; setData() });...
The following code does three things: The filename is determined by the RawData class The reader and writer send data through a processing pipeline (Hopefully) makes changes and extensions easy Regarding (2), the processing pipeline consists of "processors", that can process and deprocess data. For example, if you r...
I would like to calculate the average for the same days (e.g. Monday, Tuesday, etc) in a selected period: $data = array( '2016-05-01' => 100, '2016-05-02' => 150, // monday '2016-05-03' => 5, '2016-05-04' => 5, '2016-05-05' => 25, '2016-05-06' => 25, '2016-05-07' => 25, '2016-05-08' => ...
While I'm not aiming for a drop-in replacement for AsyncTask, I would like a utility class that accomplishes some of the same goals. Considering the criticisms of AsyncTask, in many cases I just deferred responsibility to the user - if the work you're pushing to a background Thread needs to be aware of your Activity li...
While I can often understand the performance reasons behind using fixed-size arrays to store vertex, triangle and UV data, I've often found it annoying because it makes dynamically generating meshes somewhat difficult. In order to fix this, I've built a small helper class to make the process much easier. It currently o...
I'm trying to get an efficient algorithm to calculate the height of a tree in Python for large datasets. The code I have works for small datasets, but takes a long time for really large ones (100,000 items) so I'm trying to figure out ways to optimize it but am getting stuck. Sorry if it seems like a really newbie ques...
Below is a python script which scrapes specific google apps url for example https://play.google.com/store/apps/details?id=com.mojang.minecraftpe and save the developer email,application name and price in mysql database with database name "app_database" and inside table named "app_table". There are lot of data type conv...
Problem 8 on Project Euler which asks Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the product? This is my solution in Visual C#. class ProblemEight { static byte[] input = new byte[] { 7, 3, 1, 6, 7, 1, 7, 6, 5, 3, 1, 3, 3, 0, 6, 2, 4, 9, 1, 9, 2, 2,...
Write a multithreaded C++ application (executable) for Windows Platform. This program uses the two threads to read and process the input data and store it into an output file. Candidate is free to make it console or UI based Windows application. Detailed description Program should accept an input text file with...
I'm using the Spring Framework in my web application and I'm curious as to whether my controller implementations are good or not. I've used many Hashmaps to make a object that serves my purpose for grouping from list of objects as per provided date params The following is my controller method, I am curious as to its qu...
I want to extract a price for a single index fund, the price of which is available on dynamic web pages. Being new to this, my original idea was to download the single page of static HTML and get the price from that. How hard could it be? Inspired by an article on F# for fun and profit I imagined it would be easy. ...
I have a database table storing information about documents (MigrationMaster). There is another table with security information on these (DocumentSecurity). There are 4 steps I can see that I need to perform. I've listed them here with the average time (or range of times) I've recorded they take (you can also find them...
I wish to take an XHTML source document (e.g. demo.in.xhtml below) and add class attributes to every td element whose content is one of the following six strings: A1, A2, B1, B2, C1, or C2. The corresponding classes will be mytable-a1, mytable-a2, mytable-b1, mytable-b2, mytable-c1, mytable-c2. Any other td elements in...
I recently joined the website www.hackerrank.com for programming challenges, and one of them was a time conversion from 12 hour to 24 hour. Rather than using the Date class, I decided to write the code for it, and in the end I came up with this: String time = new Scanner(System.in).nextLine(); String suffix = time.subs...
I have the following code that displays a standard AdMob banner depending on whether the user has purchased an ad-free (banner-free) non-consumable In-App Purchase or not (i.e. If purchased, no banners) UITableViewController - static cells (1 section, X no of rows): import UIKit import GoogleMobileAds class WorkoutFor...
Problem: Write a program that, given a word, computes the scrabble score for that word. Code: import java.util.regex.Pattern; import java.util.Optional; import java.util.Map; import java.util.HashMap; public class Scrabble { private static final Pattern WHITE_SPACE = Pattern.compile("\\s+"); private static fi...
I am working on a monthly billing application that utilises a rate band pricing mechanism to reward increasing consumption within a designated billing period. For example: Say I have the following rates bands: Minimum Quantity | Price --------------------------- 10 1 20 0.5 50 ...
I have a list X containg the data performed by different users N so the the number of the user is i=0,1,....,N-1. Each entry Xi has a different length. I want to normalize the value of each user Xi over the global dataset X. This is what I am doing. First of all I create a 1D list containing all the data, so: tmp = lis...
This is a Tic Tac Toe game in Java in preparation for my seconds personal project (chess game). I'm having a little problem though and am thinking that my for loop to create those buttons is a mistake. I believe I should instantiate all 9 JButtons implicitly instead of using a for loop because then I know for sure I wi...
Here is a REPL of the code. The idea here is to learn how the basic insertion sort algorithm works rather than to use existing sort libraries. How can it be clearer and more efficient? function insertionSort(array) { for(var i = 1; i < array.length; ++i) { var currentItem = array[i]; for(var j ...
Revision #1 for Simple spinlock for C using ASM The code: static inline void atomic_open(volatile int *gate) { asm volatile ( "jmp check\n" // Renegade selected, lets skip the line! "wait:\n" // Honest citizens wait in line. "pause\n" // ...
I have built the following application which searches Flickr API and returns photos. I am presenting the code: index.html <html ng-app="myapp"> <head> <meta charset="UTF-8" /> <title>F1000 coding challenge</title> <script src="https://code.angularjs.org/1.5.3/angular.min.js"></script> <link rel="stylesheet" typ...
Project Euler problem 54 asks: The file, poker.txt, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's cards. You can assume that all hands are valid (no invalid characters...
Whenever I try a new language I always try to write a speed-distance-time calculator as well as possible. I did this with C++ a while ago now. This is a similar question but this time in Rust. The program calculates speed, distance or time from the other two variables in the equation and the idea is to try to do this w...
I found this old piece of code that I wrote while I was learning C a while back: #include <stdio.h> #include <stdlib.h> #include <math.h> int main(int argc, char *argv[]) { if (argc < 2) { fprintf(stderr, "Usage: %s <N>\n", argv[0]); return 1; } size_t limit = strtoul(argv[1], (char **) N...
I was asked to find all the numbers that added up to 100 with no duplicates in Ruby. I float between Python, GoLang, and Ruby in a day. I am always concerned if I am doing something in the most optimal way. require 'pp' sumdata = [ 95, 5, 95, 5 ] def find_sum(data) result = [] processed = [] data.each_with_inde...
I've written these 2 methods and I'm wondering if the 2nd method, which uses yield is more efficient or if I'm using yield wrong. Can someone refactor the 2nd method to make it more efficient for reading system os calls with large output? def exec_cmd(command): proc = subprocess.Popen(command, ...
I'm learning regular expression as part of my Java course. Now I know sometimes the best use of regex is to not use regex at all. But since I have to use it for this course and learn it, I figure I might as well learn it properly. I am matching (##/##) or (##) where # is a number 0-9. All white space is ignored (except...
I'm really concerned about my transaction with a database and my code structure. I have created more methods to insert, update, delete data to the database but sometimes some of them will break or miss. That's why I try to use Laravel transaction and PHP catch and throw exceptions to rollback and avoid any errors happe...
Was playing around tonight and thought this problem was interesting enough to post here. Given a 2D array of digits, try to find the location of a given 2D pattern of digits. Input Format The first line contains an integer, T, which is the number of test cases. T test cases follow, each having a structure as descr...
I just started learning C++, and this is one of my projects. It's just a simple 2-player (No AI) TicTacToe game that runs from the console. The project was to familiarize myself with arrays, so review on how I used arrays is mostly what I'm looking for, but any other advice is greatly appreciated. #include <iostream> u...
DIVSUM - Divisor Summation #number-theory Given a natural number n (1 <= n <= 500000), please output the summation of all its proper divisors. Definition: A proper divisor of a natural number is the divisor that is strictly less than the number. e.g. number 20 has 5 proper divisors: 1, 2, 4, 5, 10, and the divisor...
This code works so far and it is a TicTacToe game (Personal Project of Mine). I'm kinda new to programming. My question is I really do not like how the Connected method is at all, because well it's fairly large for no reason. Is there a way to make it more compact because I have to add the middle and bottom row then do...
I am trying to fetch weather data from the OpenWeatherMap API. The responded JSON will be deserialized into a object which has the same structure of the JSON, then we need to transform this object into another class to meet our needs. Following is the class which the JSON returned by OpenWeatherMap will be deserialized...
It is the case where data contains some field indicating what type of strategy should be picked. I mean, I often ignore solving the problem like shown below and duplicate the problems that strategy pattern is out to solve in the first place. Is there a pattern for it or is it not viable at all in this case? Recent exam...
I'm creating a counter picker for a game called League of Legends, and for this I need to compare effects of abilities, which each champion has. For this I'm using 4 lists of champions, the returnList, the banned champion list, the enemy champions list, annd the allied champion lists. However, seeing that the returnli...
results is a list of dict having panel name and work type and price to do that work on that panel. There can be two dicts for same name and work type where one of them is on car model level and another is on car type level. In such cases we would give preference to car model level dict. output is the group of panels an...
I have a winforms app and I've been using the following approach to update controls on the main form from worker threads: GamepadManager class has: public static event EventHandler OnGamepadConnected; Main app class has: GamepadManager.OnGamepadConnected += OnGamepadConnected; private void OnGamepadConnected() { I...
When trying to follow single responsibility principle, I often find myself in a position where there is so much to do that I do not know where to start. Maybe there is there a rule of thumb that I could use? A concrete example originating from my test project. // doing way too many things public InvoiceDto Get...
The aim is to have that: list ["Hello", "World", "in", "a", "frame"] And make it printed like this: ********* * Hello * * World * * in * * a * * frame * ********* I did this and it works fine: a = 0 for nb in listA: if a == 0: print("*"*10).center(20) a += 1 if len(nb) == 2: prin...
I am starting out in Haskell and thought I would try to make a function that got the index (nth) from the end of the list. So getNthFromEnd 5 [1..10] would equal 5 The code I have so far is getNthFromEnd :: Int -> [a] -> a getNthFromEnd _ [] = error "Empty list given" getNthFromEnd nth list | listLength < nth = err...
Project Euler problem 9 says: A Pythagorean triplet is a set of three natural numbers, \$a < b < c\$, for which, $$a^2 + b^2 = c^2$$ For example, \$3^2 + 4^2 = 9 + 16 = 25 = 5^2\$. There exists exactly one Pythagorean triplet for which \$a + b + c = 1000\$. Find the product \$abc\$. My code finds the correct solu...
Is there a simple way to DRY this jQuery code? $('ul.icons li.size').click(function() { $('ul.icons li.size').not(this).removeClass('selected'); $(this).toggleClass('selected'); }); $('ul.icons li.color').click(function() { $('ul.icons li.color').not(this).removeClass('selected'); $(this).toggleC...
Here are 2 functions defined that do the exactly same thing: take input a template (in which one wants to replace some substrings) and array of strings values (key value pair to replace, such as [subStrToReplace1,value1,subStrToReplace1,value2,.....]) and returns the replaced String. In second function I am iterating o...
I am creating a tile based game in Unity and ran into a problem with my architecture of the Map and Tile types. The tile class contains logic like events when the tile type changes. When I tried to save the type to disk those events were being serialized as well, which I don't want (causing several problems in Unity). ...
I want to be sure that my code below properly secures the website based on all of the information provided. Login System Overview When a user logs in, the following user info is saved to a persistent cookie: User Id (Primary Key) First Name Last Name User Role Login Token (randomly generated guid value) Valid (bool - ...
I have 7 source files that I am searching and cross-referencing. I have tried a few different methods inside Excel (cell-by-cell iteration, dictionary), and found select statements as recordsets to be the fastest thus far. Unfortunately, it still takes around 5 seconds for my code to search 4 of the files for all inst...
I'm just learning C# and wrote a little program to check if a word contains vowels. It's fairly simple and not to exciting but I would like to know if there's easier ways to do this: using System; namespace check_vowels { class Program { static void Main(string[] args) { string word...
I am currently learning JavaScript and the project I have been working on is creating a basic Blackjack game. Some code was provided for me, with the additional instructions: "How would you edit the above code to PRINT what you and the Dealer have? How would you edit the code to let you know if you beat the dealer or n...
Problem Statement: Write a function to convert from normal numbers to Roman Numerals: e.g. 1 => I 10 => X 7 => VII Code: import java.util.HashMap; import java.util.Map; import java.util.NavigableMap; import java.util.TreeMap; public class RomanNumeral { private final int number; private static final Map<...
Given a number between 1 and 7, this will display which day of the week corresponds to that number, starting with Monday. This is pretty simple and pretty easy, but it seems that there would be a much better way to do this, where I wouldn't have to write out each day of the week, and possibly iterate through an array.....
I am currently building my first game/app in javascript. It is a very simple script that has about 130~ lines of code. I feel like what I did so far is not optimized, can anyone please help me optimize the code also, can you please explain your changes? How the game works: At the start of the game every player gets 20 ...
I'm practicing my JavaScript skills by trying to create a Pokemon game. So far, I've made the dataset and the functions required to work the game. Can someone help me optimize the code and tell me why they made that change? function pokemon(name, hp, critical_attack, lowest_attack, highest_attack) { this.name = nam...
I have implemented the LEB128 encoding for unsigned integers. I'm fairly new to Haskell so I have some doubt about the coding style I'm using, particularly the definition of byte and then 2 lines later byte': import Data.Bits import Data.Word uleb128 :: Integer -> [Word8] uleb128 0 = [] uleb128 n = let byte = (fromI...
The code currently works as it should and seems to work dynamically as I need it to but I am pretty new to Excel so I think there is probably a better way to do some of the things I have set up. I also would like to make the code a bit prettier. '************************************************************************...
I have not had any experience with coding before, and after beginning to learn I stated working on this calculator which runs different functions on the console. I'd like to hopefully be taught what I could have done differently or easier. { class MainClass { public static void Main (string[] args) ...
Can you help me verify my test result? I'm testing different malloc() implementations with a small program that allocates gigabytes many times: int main(int agrc, char **argv) { int i; for (i = 0; i < 1000000; i++) { void *p = malloc(1024 * 1024 * 1024); free(p); } return (0); } If I ru...
Looking for feedback on any bad practices and general advice on how I might better structure my code. $(function() { // Load song on page load var song = new Audio('./songs/DJ Snake - Middle (Bad Royale Remix).mp3'); song.load(); // Update song duration display song.addEventListener('timeupdate', f...
Project Euler #15 is to find out all the distinct possible ways there are to move from the first point (1,1) to point (n,n) in an n*n lattice. def lattice_paths_of_n(n): list2 = [] my_list = [] for i in range(1, n+2): list2.append(i) for i in range(1, n+2): my_list.append(list2) for ...
My program is supposed to sort a stack such that the smallest item are on the top. I can use a temporary stack, but you may not copy the elements into any other data structure. The program works overall, but I was wondering if there is anything that I can do to make it more efficient/better. import java.util.Stack; pu...
I have been tinkering with generic methods in Java but still haven't figured out a way to optimize this code. Here I need to write similar piece of code for both plan and add-on. public Set<SubscriptionDto> getCustomerSubscriptions(Integer customerId) { Set<SubscriptionDto> subscribedProducts = new HashSet<>(); ...
I have to make a program which creates a number of threads that are waiting at the beginning, then the main process creates a doubly linked list where random numbers are put and then a signal tells the threads that a number has been put in the list, then the threads should "process" these numbers (is simply calculate t...
I am trying to estimate a good approximation for the arclength of the curve \$ y = \sqrt{1-x^2}\$ for \$x \in [0, 1]\$. I did this using a Bezièr curve, and made it so that the area under the two curves are alike. In order to estimate the error I want to calculate the differences in arclength. The arclength of a quarte...
I'm writing a C# WPF project built with a MVVM pattern. This software is written to use a medical diagnostic device, so in our planning it will be certified IEC 62304. Since I've been mainly writing only C++ software for the last few years, I don't have much exeperience with C# programming. So I would like to receive a...