instruction
stringlengths
71
95.1k
Background info I have just started using/ learning how to use Next.js and developed a basic application which allows users to view several pages, some of which are authentication protected. Users must sign in/ up, in order to view content on other pages. I'm using Firebase's Google Authentication to handle my user log...
I'm trying to make some JS code more browser compatible. So I've written an alternative to JS's classList providing its .add(), .remove() and .toggle() functionality because it is not or just partially supported in IE. (I know there are exiting polyfills, but I like to have a good overview regarding my code.) My test w...
I've only been writing code for about 2 weeks. I have no idea how to fix this, and it's getting extremely repetitive. If there is a way to simplify the idea, how would I go about doing that? As you can see, it'll start the combat, assign goblin to 30 then keep on doing the same combat regime over and over and over. def...
I have an associative array of the states of some country, and the states names are the keys: array:13 [ "Ontario" => null "Manitoba" => null "New Brunswick" => null "Yukon" => null "Saskatchewan" => null "Prince Edward Island" => null "Alberta" => null "Quebec" => null "Nova Scotia" => null "Britis...
(repost: https://stackoverflow.com/questions/59665338/censoring-words-in-lua#comment105491094_59665338, as advised) Im currently making a discord censor bot for my friend, and I was wondering if anyone with experience could help me, or if theres an easier way to complete my code. local BadWords = { ['poop']=true, }...
For my programming class I had to make a sudoku solver. import time # Used to add a delay for user readability ROWS = COLS = possibleValues = 9 # The rows and columns of the board GRID_ROWS = GRID_COLS = 3 # The rows and columns in which there are lines possibleBoard = [] """Functions""" def board_filler(): ...
I wrote a thread pool where the user can submit jobs through ThreadTask objects. These objects bundle the job priority, the task as a function, and some arbitrary number of function parameters. After much frustration I ended up with something like this: struct ThreadTask { template <typename Func, typename... Args>...
I'm filling a list of items from the database, which is taking extremly long time to run (Approx 60 seconds) Here is the code with the relevant breakdown 97% of the performance issues come in the foreach loop at the bottom. Is there a better way to match list items on the nested object. private List<ROPSetting> TestM...
I have a dataframe with measurement data of different runs at same conditions. Each row contains both the constant conditions the experiment was conducted and all the results from the different runs. Since I am not able to provide a real dataset, the code snippet provided below will generate some dummy data. I was able...
I've come up with this code for a tic tac toe game with and AI that the player can go against, please help me optimise my code and help me grow better habits haha. import random # I want 'random' so I can randomize the AI's choices # whenever it cant win or 'intercept' t...
I have the following class public class ExrDepthMapExtractor : IDepthMapExtractor { public RawDepthMap GetDepthMap(string filePath) { return DepthMapExtractorService.ExtractDepthMapAs1DArray(filePath, Callbacks.ProgressCallback); } } This calls the static C++ API wrapper public static class Depth...
I did Advent of Code recently and enjoyed Day 15, which involves exploring a maze (my attempt in Kotlin). I've tried to recreate it partially in Python, minus the emulator: https://repl.it/@MalcolmCrum/ReflectingFarNaturaldocs It works but my code is largely 1:1 from Kotlin, and I'm not certain if I'm doing things in a...
I wrote the following function in order to handle some data from a QR code: func genInt(fromBitArray array: [Int]) -> Int { var n = 0 for i in 0...array.count - 1 { n += array[i] << ((array.count - 1) - i) } return n } genInt(fromBitArray: [1, 1, 0]) would return 6. Is there a better/more effic...
Simple console tip calculator app in JavaScript. I would like to get some feedback on improving my code. Thank you beforehand. Source code: //header const headerMessage = () => { console.log('Tip Calculator') } //service quality const serviceQuality = (billEntered, userOption ) => { const userInput = Number(use...
I am working on moving some complex script logging from functions to classes. In the functional version I would use a string like this "{header-[cf][0][:12]}_Started: 11:30:21" {????}_ is the identifying info, here I have a header item header- (which has formatting implications), it will log to both console and file [...
I working on optimizing some code for speed in a python module. I have pinned down the bottleneck and is a code snippet which calculates three np.ndarrays. Namely the following code: xh = np.multiply(K_Rinv[0, 0], x ) xh += np.multiply(K_Rinv[0, 1], y) xh += np.multiply(K_Rinv[0, 2], h) yh = np.multiply(K_Rinv[1, 0...
My question is about proper testing procedures for Django models. The project is for a startup building a very basic HR system due to excel sheet data integrity problems. I am trying to figure out the best way to unit test the documents and models they will be managing. Based on how I wrote this test, what are some way...
I took a stab at implementing Promise.race(): "use strict"; function race (...promises) { return new Promise((resolve, reject) => { let [resolved, rejected] = [false, false]; promises.forEach(promise => { promise.then(value => { if (!resolved) { resolve(value); ...
I use the following command to get specific entries between certain dates from Apache log files. Then I filter out my own address and some bots, then I print out the IP, sort it, get the uniques, output the ip with count, and for summary I count lines to get a total. Is there a way to improve this, reducing the amount ...
So here I wanted to make a system that registered a person's account. It remembers the person's email, account, first and last names, by writing to a file. You can login to that account by typing the email and password according to that email and then you would get a hello message, saying your first and last name that ...
We want to provide a simple Redis pub/sub alternative in memory for our software. So we implemented this : public class MemoryDataBus implements DataBus { private final Map<Consumer<Message>, MessageListener> subscribers = new ConcurrentHashMap<>(); @Override public void publish(final Channel channel, fina...
I have the following class. The aim is to have a few methods that deal with the type of the gift, the dwarf who is packing the gifts and the time he will take. And finally, the reindeer, which is supposed to do the work. class kdo_pack(): def __init__(self, maxsledge = 12, remainingplace=0): self.maxsledg...
I have the following recursive function to compute the continued fraction: $$s_i = \frac{a_{i}}{b_{i} + s_{i+1}}$$ The relative error is defined as: $$\text{Delta} = \frac{s_n - s_{n-1}}{s_{n}}$$ Here is the implementation in Python, of Lentz's method for computing continued fractions: import numpy as np def n_continu...
this is my first post to Code Review, so please bare with me. I just finished writing a simple Snake clone in C++ with the goal of having an actual design this time and not just winging it. So I made a class diagram of the game and wrote all the code, and it works fine, but there are some areas where I feel like I coul...
I am trying to solve this question: In a block storage system, new data is written in blocks. We are going to represent the flash memory as one sequential array. We have a list of block writes coming in the form of arrays of size 2: writes[i] = [first_block_written, last_block_written]. Each block has a rewrite ...
For a code challenge I thought it'd be useful to have a helper function to group positives and negatives into their own sub arrays while maintaining the ordering of the original array. I'm sure there's a better way to do this but wanted to take a crack at it before researching. This idea came to mind, to track the sta...
For a basic program I am writing to help learn, I am at the step where I should be cleaning up the messy code and trying to condense my "main" to 5-20 lines by recalling other methods that repeat themselves. I simplified one section perfectly where the user enters their score and the score is recalled from another meth...
This is a follow up to this question Objective: Manage what happens when users interact with Excel Tables (ListObjects) Code incorporates: Greedo's answer suggestions: Listen to an encapsulated ListObject Gather useful data to pass to the event raised when the ListObject was changed Raise events according to the us...
As a small exercise in Python, I created an Assembler for the rather simple Brookshear Machine (see f.e. Brookshear Machine, please note, however, that the instruction set differs from mine). The instruction set used by this implementation is based on a task from a friend's Computer Science course. He showed me another...
Objective: Simulate namespaces in VBA and access functions like if you had a Framework setup or at least that was what I understood... Background: I was inspired by this piece of code: Framework.Strings.StartsWith in this post Questions: As I'm basically coding against the predeclared instance, is there a risk of a ...
Objective: Have a single point of entrance to initialize a class that holds instances of "sub" classes Background: I read about inheritance in VBA (or as close as you will) in this post and it occurred to me that you could have a hierarchy of classes/objects so accessing them while coding would be easier Thought abou...
We are given a vector of std::pair<int, int>s, start int and stop int, and I need to extract the path out of it. For instance: given start = 2, stop = 8 and list of std::pairs as [(0, 5) (6,8), (5,6), (2,0)]. I am ordering the vector into: [(2,0), (0,5), (5,6), (6,8)]. Now I need to isolate the nodes to get the path a...
The case scenario: A 2-D array is given: 1 3 6 10 15 2 5 9 14 19 4 8 13 18 22 7 12 17 21 24 11 16 20 23 25 and its size N is given as 5. The program should output it as 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 The code I wrote for this problem: #include <stdio.h> void main() { ...
The Application I have an application in testing that runs off of an MS SQL Server database. The app allows users to authenticate using Windows authentication (that is, using the Windows username the user is currently logged in with), but the need was discovered for the app to a have a built-in, independent method of a...
First off, not the greatest with jQuery but know enough to get by. I have a custom script for our WordPress site that ties in with a main plugin we use. I have a JSFiddle that gives the gist of what it does as well as the staging site. My main goal right now is to improve upon the code. The main thing is trim the fat a...
I'm new to programming, I'd like you to check my work and criticize the hell out of me. What would you do differently? FQDN: https://en.m.wikipedia.org/wiki/Fully_qualified_domain_name 253 characters not including trailing dot Label1.Label2.Label3.adomain.com All labels must be between 1-63 characters Cannot start or...
Recently I created a small app using JavaScript, and I would love for some JavaScript developers if they have the time of day, to tell me their opinions so I can grow and improve. I'm mostly working on back-end tasks with PHP and Go, but I thought making something small in JS would be fun attempt. Basically it's an app...
This program constantly sends an https request to Reddit's API for new comments. Using a PostgreSQL Database containing Regular Expressions, find comments of interest and notify about them using faye. When run locally, the information is sent to localhost:8080, otherwise data is sent to a heroku application. Full code ...
This time I made a quiz game, in which the player is asked questions and receives points for each question answered correctly. Some people told me I should learn about classes, so this is what I came up with. import random from Quiz_Questions import game_questions questions = [*game_questions] def game(): print('-...
I have to apply two deals on the cart. Buy 3 (equal) items and pay for 2 Buy 3 (in a set of items) and the cheapest is free Items in cart: ---- |Car| ---- {'itemcode': 4, 'cost': 20.5, 'type': 'car', 'name': 'volvo'} {'itemcode': 5, 'cost': 25, 'type': 'car', 'name': 'tesla'} {'itemcode': 6, 'cost': 15, 'type': 'car...
First time writing a Go script, just looking for feedback on language usage etc. Using chromedp to run a headless (I think) browser to load some html, generate a PDF and then save the PDF to the file system. package main import ( "context" "fmt" "io/ioutil" "net/http" "net/http/httptest" "gith...
I am trying to subclass list in order to implement a callback function that would be called whenever a list item is being set. I have this: class CustomList(list): def __init__(self, *args, **kwargs): self.setitem_callback = kwargs['setitem_callback'] del kwargs['setitem_callback'] super()._...
I'm working on some code to find the max depth/height in a tree. I came up with a recursive solution, and I find myself needing to pass an integer "by reference". Currently, I'm using a mutable container to achieve this, but is there a more Pythonic way? class Node: """ Node in a tree, with children stored in a list. "...
I have a requirement to send emails when certain errors are logged(using log4j 1.2.17). But the SMTP appender sends emails in a synchronized manner. I can not use the AsyncAppender either. So I have written my own custom appender and an email sender which utilizes the javax.mail library. The custom appender creates a f...
This is a follow-up to previous post, code is significantly better thanks to comments. The problem is that now it takes 0.25 seconds to iterate 1 row of VehicleEvents through 95000 rows of GPS information. At this rate, with 370k rows of VehicleEvents, it will take me days and I was wondering if you can find a better w...
I have this code which is a callback for Filter in WPF ICollectionView. When I run code analysis, the cyclometic complexity is reported to be 11. I consider this line by line comparison gives a better readability. How can I improve the cyclomatic complexity or improve this code in general? private bool FilterLicenseLi...
I made a sidebar that has a slide-out feature. When you click on it, it shows more items. I made it with JS and HTML but I think the code can be done more efficiently. How can I clean the code up? $('.slide-out').on('click', function() { let data = 'slideout-item'; if($(this).data(data)) { let item = $(...
I have the following function that is supposed to compare current and historical transactions for each id. The logic seems to work ok, but the performance is extremely low for the amount of data I'm processing (about 20 million records); more than 10 hours to run. What can I do to improve the performance? Functions de...
I'm attempting the SpecialStack problem on GeeksforGeeks. Design a data-structure SpecialStack (using the STL of stack) that supports all the stack operations like push(), pop(), isEmpty(), isFull() and an additional operation getMin() which should return minimum element from the SpecialStack. Your task is to co...
I've solved this problem: https://leetcode.com/problems/word-break Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. Note: The same word in the dictionary may be reused multiple...
EDIT A port of Björn's answer to C++ with further improvements at bottom achieving up to 2.4GB/s on the reference machine. Text file parsing and processing continues to be a common task. Often it's slow, and can become a performance bottleneck if data is large or many files need to be processed. Background This is t...
I'm seeking a review of some code I've written for a small personal project. The project is not yet mature enough for any domain specific details to be of concern - but I'm happy to provide further details/examples should this help the review. A description of what I hope to achieve and minimal working example has been...
This is a follow up from my previous post: Program that converts a number to a letter of the alphabet This is meant to teach my little brother (who only knows how to make games in Geometry Dash) about C, and computers. This is an example I've written meant to be shown and explained to him. #include <stdio.h> #include <...
I'm working on a library of shell utilities for Swift, and at the core of it is the need to spawn a subprocess. For Linux, I came up with the following function to do the low-level work. Requirements that led to this ugliness: it can remap FDs arbitrarily (like bash) it must work in a library (can't assume files were ...
I'm writing a few simple functions that compare the length of an iterator to an integer, returning as early as possible. Right now I have: class ILengthComparator: def __init__(self, iterator: Iterator): self.iterator = iterator def has_more(self) -> bool: try: next(self.iterator) ...
Relatively new to Python. Have some experience in C++. I have written a small program that reads a CSV file (SAMPLE) and initialises two arrays and few values. There are 2 values in each line, and there are 8763 such lines. The first value of each line is put into one array and the second value is put into the second a...
I'd recommend thinking of readimage.py's tess() and cune() as sort of black boxes that use the OCRs. Anyway, this code is meant to be used for a science fair project where I am testing Tesseract and Cuneiforms' abilities to read text on images with various font sizes and colors, etc. Any thoughts, obvious mistakes, etc...
I've written a 2D ray-tracer in GLSL ES for GameMaker for dynamic lighting. I've also written a blog post on how it works... though it is out-dated. I am looking to have JUST my shaders reviewed to see if there is anything that can be done to simplify or improve performance. Here is a download link to the full working ...
I need some constructive feedback for the working OOPs project which I created to introduce to Object Oriented Programming in a class. Hence is for beginners, I did not include interfaces or abstract functions nor singleton or factories. Can you give me some feedback on the code style, some possible anti patterns? Than...
This is different from classic LIS problem. Here I want number of contiguous longest increasing subsequences! For example: INPUT: arr[] = { 3, 6, 10, 8, 11, 17, 16, 100 } OUTPUT: 2 Explanation: There are 2 longest contiguous subsequences: { 3, 6, 10 } and { 8, 11, 17 }. Here is a function that I have made to achieve t...
This is a basic React problem, how to handle global listener and change state in callback without attaching a listener on each rerender. Here is a common solution: useEffect(() => { const handleScroll = () => { var rect = selectedRingElement.current.getBoundingClientRect(); if(isElement...
Task: given a number (positive or negative), square every digit of it and concatenate them, forming a resulting number. For example: 9119 should become 811181 = 9^2*10^0 + 1*10^1 + 1*10^2 + 9^2*10^3 (-1) should become (-1) My code: -- convert a number to the list of digits -- doesn't work with negative numbers digs :: ...
I am working on a game engine and in order to learn the math behind graphics programming I decided to write my own mathmathical structs and operations. I went for an union class that gives me the oppertunity to use an array and x, y, z, w accessors without using extra memory. Being the first time I'm using unions I am ...
My solution to the Coderbyte task 'Vowel Square'. It's a simple task, but I'm sure there's a more Pythonic solution than mine. The problem: Vowel Square Have the function VowelSquare(strArr) take the strArr parameter being passed which will be a 2D matrix of some arbitrary size filled with letters from the alphabet, an...
I'm trying to create the most efficient (not nicest/prettiest) way of moving particular values within an np.array() to the back of said array. I currently have two different solutions: import numpy as np from numba import jit @jit(nopython = True) def move_to_back_a(a, value): new_a = [] total_values = 0 ...
I have a voxelization that I need to write out to a binary STL file. These voxels are inside a higher-level 3D grid, with each cell in the grid being made up of voxels. Individual cells may or may not have any active voxels in them. I've optimized the file size significantly by not writing out triangles for interior fa...
I am working my way through a Django book and part of that covers the test cases. In the current chapter I have the following code form the start of the test cases but some of it feels like it breaking the DRY principle. from django.test import TestCase, SimpleTestCase from django.contrib.auth import get_user_model fro...
[I'm awaiting suggestions for improvement/optimization/more speed/general feedback ...] This code takes a label and a folder path of subfolders as input that have certain labels ex: trees, cats with each folder containing a list of HD photos corresponding to the folder name, then a multithreaded image processor convert...
I made todo app in vanilla JS with functionalities like add todo, delete todo, edit todo, complete todo.. so, I think my code is not really good and I want to hear any suggestions on how to improve code and similar.. Here is the link: http://dash.vision-themes.com/ HTML: <section id="todo"> <!---- Todo navigation -...
My below solution to the following problem is exceeding the maximum recursion depth. I am looking for any improvements which i can make. Problem Alice and Bob need to send secret messages to each other and are discussing ways to encode their messages: Alice: “Let’s just use a very simple code: We’ll assign ‘A’ the ...
I often find myself doing rebase manually in an interactive form in a way as follows. Say I want to squash two last commit to third commit. First I execute: $ git rebase -i HEAD~3 Now editor pops up, I mark two last commits as fixup. I close the editor and then rebasing is done (if there are no errors). I'd like to au...
Firstly I was using regex to get if the number of parentheses in a string is balanced or not, but the performance was quite slow when any large string was passed to the regex. So I created this custom method, which returns whether a string contains balanced parentheses or not. Please review this code and point out any ...
The given code reverses an array of input characters. The additional while loop in reverse() function is unnecessary I guess. Any other method or way to remove it? I would prefer to keep reverse() as void. #include <stdio.h> #define MAXLEN 65535 /* maximum length of input line */ void reverse(char s[], int l); /* re...
Let's say I have this function called coolName that takes an argument name and decides whether it's a cool name: function coolName(name) { const n = name.toLowerCase(); return n === 'peter' || n === 'paul' || n === 'mary'; } You could achieve the same using this approach: function coolName(name) { return ['peter...
I used the "long" form of all math statements, avoided the use of pointers, and used only while loops for aesthetic purposes (simply put, I think the code is prettier when it is written like that.) I am mainly concerned about the CPU efficiency of the code. Bubble Sort - The quintessential example of an "inefficient" s...
How can I refactor it to elegant way? This code is about parse birthday from Rodne Cislo string. I don't know how to do it clever and add more clean code style details public static void extractBirthdayFromRodneCislo(String rodneCislo) { rodneCislo = rodneCislo.replace("/", "="); int year; int month; i...
Context: gitlab link I know, it's a lot of code but I need your help ladies and gentleman. I'm not sure if I can ask for code review for the whole project so I just ask to review this activity. I would like to add this project to my summary (still looking for first work and I'm still student). This is how interface loo...
I have this program that takes two strings from the user, stores them in mixArray, then "mixes" them with mixItUp() and outputs a bit of flavor text, depending on the combination. Duplicate combinations (red-blue, blue-red) also give the same outcome. I've gotten to a nested switch statement that's miles shorter than m...
I am new to stackoverflow and a newbie to VBA coding. At my work, we are supplied with shipment data in the form of Ms Word which is not very useful. I have found a way to transfer the data using VBA and have a code that is fully functional. However, the data set contains hundreds of thousands of records. I tried runni...
(I hope this isn't too general a question given I'm just pasting a bunch of code in, if that's the case then sorry) edited to remove the bit that wasn't working I've written a brute force implementation of the N-body simulation in Python with a leapfrog integration method (using numpy & numba's jit function to speed it...
I built a tree in Haskell where every node has a number that is unique in its path from root to leaf. Nodes have a dedicated list for children that are leaves. Because the tree is very large I want to unify (i.e. keep the right one, replace the left one with a link) sub trees that are equal by some metric. For this and...
I was playing the game Set online, and thought it would be a good exercise to write an F# script to find all of the sets for me. The rules of set are as follows: A SET is 3 cards for which each feature is either common across all 3 cards or is different on each card. The object is to find all the SETs among the cards....
I am generating co-occurrence matrix (2000X2000) in Python. Vocab is a list of the 2000 top words in corpus. It does not contain all words in corpus. Corpus is a Pandas dataframe of 30000 (rows) sentences. An example of a single row in the corpus: the energy classroom high the room filled scholars eager learn they em...
I wrote a simple wrapper for the <random> header, as follows: #include <random> namespace Random { static int getInt(int min, int max) { std::random_device rd; std::mt19937 gen(rd()); std::uniform_int_distribution<> distribution(min, max); int rnd = distribution(gen); ...
I have written the following code for doing a reverse dns lookup. I'm not sure if there are any errors in it. Please have a look: #include <stdio.h> //for printf() #include <stdlib.h> //for exit() #include <arpa/inet.h> //for inet_pton() #include <netdb.h> // for NI_MAXHOST, getnameinfo() and gai_strerror() #include <e...
I am trying to create a word-finder game. There will be an n-by-n Board filled with Tiles. class Tile: empty = None def __init__(self, letter): self.letter = letter #the dictionary tracks the Tiles that border a given Tile self.directionals = {'n':Tile.empty, 's':Tile.empty, 'w':Tile.e...
This is the backend code for the page where you upload a post. I have already tried to do a sql attack on this page, but it didn't work. <?php include_once 'includes1/dbh.inc.php'; session_start(); //*skåd ifall man är inloggad *// if (isset($_POST['topic_submit'])) { $newFileName = "annons"; //Här ska egentligen v...
There is no facility in TcpListener (or for that matter Socket) to close a listening socket that is waiting for a connection without throwing an exception. After running up a test bench with 8 threads opening/closing/connecting thousands of times and reviewing the .Net source I found three different exceptions out of ...
I'm in the process of learning both Rust and algorithms after primarily focusing on web development. As such I've had a go at implementing merge sort both iteratively and recursively. I've looked for various implementations in Rust online and found them either to be quite complex, quite specific (for types/use-cases) o...
EDID: Thank you very much for your feedback. I updated the code and opened a new post for the updated version. See here. This post is loosely based on A multi-threaded Producer Consumer with C++11. I would like to implement producer consumer pattern, where a consumer consumes data from multiple producers. The idea is t...
I have a small WPF program built using Caliburn.Micro which checks Active Directory for a user with the current username of the logged-on user. I have a Bootstrapper method: protected async override void OnStartup(object sender, StartupEventArgs e) { await ShellViewModel.CollectFullnameAsync(); DisplayRootViewF...
I am writing a finance library with the intention to have the best of Golang's performance. The function Re calculates the returns of a float list, and function Sum calculates the sum of float list. //Calculate returns func Re(data []float64) []float64 { re_ := make([]float64, len(data)) for i := 1; i < len(d...
The task is to store the newest ~100 numbers and calculate their sum. I would like to optimize for time-performance. Usage: In the context of sequence alignment, after creating a 2D scoring-matrix between 2 sequences, starting at the bottom right corner, I want to search for the optimal alignment path. Here I adapt pre...
I am trying to improve working code seeing if there was any potential issues or performance problems. This code will connect to an ftp server and upload a file. public SendFiles(string demoFileLocation, string liveFileLocation, string fileName, string username, string password) { ResultStatus resul...
I have a lot of compressed csv files in a directory. I want to read all those files in a single dataframe. This is what I have done till now: df = pd.DataFrame(columns=col_names) for filename in os.listdir(path): with gzip.open(path+"/"+filename, 'rb') as f: temp = pd.read_csv(f, names=col_names) df = d...
I had an exercise to solve, written in German. I try to translate it: Write a program that takes an amount of seconds. The program than has to output the number of years, days, hours and seconds. My Solution public class Main { public static void main(String[] args) { final int HOUR_IN_SECONDS = 60 * 60; fi...
I had a test for a Java-position where they asked me to manipulate JSON-data from an API. Once my overall parsing of the data into Maps were done. The test required me among other things to implement: Parameter for sorting the data (ASC, DESC) in Maps. Parameter for filtering the selection of names in Maps. Parameter...
I am writing a program for vacation in a company and the time that is allowed to be in a specific holiday I used an Abstract class with an abstract method: public abstract class Abstract : TimeLength { public AbstractTest(string employeeCode, string employee, string typeOfHoliday, DateTime startDate, DateTime endDa...
I have joined the Facebook interview recently. And the following question has been asked on the coding interview. Given a sequence of numbers and a total target, return whether there exists a continuous sub-sequence that sums up to target. [1, 3, 1, 4, 23], 8 : True (because 3 + 1 + 4 = 8) [1, 3, 1, 4, 23], 7 : False ...
I've created a basic implementation of ECIES (Elliptic Curve Integrated Encryption Scheme) based on http://www.secg.org/sec1-v2.pdf section 5.1. /// <summary> /// Simple implementation of ECIES (Elliptic Curve Integrated Encryption Scheme) based on http://www.secg.org/sec1-v2.pdf, section 5.1 /// The KDF, cipher and HM...