instruction
stringlengths
71
71.9k
For a while now, I've wanted to write a stack-based "Turing-tarpit". This is the perfect excuse to learn Ruby, which I have never used before, so I wrote Brain-flak. The language only uses these characters, ()[]{}<> in various contexts. Here is the interpreter: class Stack def initialize(name) @name = name @d...
I am completely unaware of all the Android features and available libraries. I just designed a login system to practice it. I have referred to a few books and tutorials. Layout I am using relative layout. And have two EditText and one button for login and one button to start register activity. Activity public class Log...
I made a simple list with drag and drop ordering function using JavaScript, HTML and CSS. Although I tried to do this as efficient as possible, I'm sure there are some improvements to be made. What would be considered bad practice in my code below and what could be improved or are there any suggestions for another appr...
I have a photo_shouts_controller.rb and text_shouts_controller.rb which both have almost similar implementations, and I would like to refactor it. I have implemented a refactoring but I am not too sure if that is the best way to do it. Current implementation class PhotoShoutsController < ApplicationController def cre...
Previous question After applying the suggestions, I wanted to revise the question with the new code because I don't think this is good enough. #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> /* global loop counters */ int i=0, j, k; /* to find a, b, and c from the input */ float A(const c...
I have a list of conversion histories, where information about user channels is stored. For example user may have app for iOS and Android installed. Each time user logs in, I store a conversion history, so that there might be multiple rows with shared data (e.g. client is always iOS). I need to get the latest usage of ...
The Gilded Rose Kata is a refactoring challenge, in which some frankly disgusting code is thrown at the developer, and they're told to make a small change to it. For reference, the (truncated) requirements and the original code are given here: All items have a SellIn value which denotes the number of days we have to ...
I am getting the number part of the container ID that the button is in. Now I am wondering if I need to create an array using split and then put this number in a variable, or if there is a more efficient way to get it. .match() also returns an array, so this is almost the same as using split. I mean the code works and ...
I began studying C# 5.0 a few days ago and am trying to avoid duplicated code for validation of input values. class transcript { //Use lamda expression and Func for validation logic Func<byte, byte> validate = (grade) => { if (grade > 100) throw new ArgumentOutOfRangeException("grade can`t be more than ...
This question is part of a series solving the Rosalind challenges. For the previous question in this series, see Mendelian inheritance. The repository with all my up-to-date solutions so far can be found here. The next part of the Rosalind challenges is basically asking for a Fibonacci solver, with a twist. Problem: F...
I want to run an application and write (append) its processing time into a file. Also, I want to see the stdout and stderr output on the shell, but don't want to write it in a file. After running the process, I'd like to see time measured. Since I'm on Bash, one solution would be this one, but it's pretty ugly, since t...
I'm trying to work with the following class, which is inside a library I currently cannot change: // This class represents "external" code as far as my review // request is concerned: I cannot change this, currently. public class AddressDto { public string Name { get; set; } public string Zip { get; set; } ...
Even I know that this isn't a good way of writing code, but I need to improve this. Here I am retrieving data from Server in Json format by Posting some variables in doInbackground. Getting all the products depends on Posting variable ie Latitude and Longitude of Current Location.All the Json data are stored in LocalD...
Write a program that can calculate the Hamming difference between two DNA strands. GAGCCTACTAACGGGAT CATCGTAATGACGGCCT ^ ^ ^ ^ ^ ^^ The Hamming distance between these two DNA strands is 7. import java.util.Optional; public class Hamming { public static int compute(String s1, String s2) { valida...
I posted an earlier version of this code a couple of days ago, so it's the updated version of the code posted here. #include <iostream> #include <functional> #include <conio.h> #include <unordered_map> #include <string> class EventListenerHandle { template <typename U> friend class EventChannel; pr...
I've implemented a class, which provides access to different static resources, which are used by different frontends. I'm hesitating, because in Java getters and setters are quite wide spread. So my question is, if this code smells bad? public class ResourceManager { public static final Preferences Preferences = ne...
Maintain current element as the top element in the input stack. Pop all the elements on the ordered stack which are greater than the current element and push them in to the input stack and maintain a count of these elements. Now push the current element into the ordered stack and pop the count number of elements from t...
Description: Bob is a lackadaisical teenager. In conversation, his responses are very limited. Bob answers 'Sure.' if you ask him a question. He answers 'Whoa, chill out!' if you yell at him. He says 'Fine. Be that way!' if you address him without actually saying anything. He answers 'Whatever.' to anything else. ...
I'm actually doing my own Prolog compiler just like SWISH one with Java. Prolog is a logic language that is particularly suited to programs that involve symbolic or non-numeric computation. Prolog consists of a series of rules and facts. A program is run by presenting some query and seeing if this can be proved against...
I need to sort a list of lists. The following is a compare function: def compare(lhs, rhs): # lhs&rhs are lists delta = len(lhs) - len(rhs) if delta > 0: return 1 elif delta < 0: return -1 if lhs < rhs: return 1 elif lhs > rhs: return -1 return 0 It looks pretty ...
I wrote this wrapper around the UdpClient,using events for new datagrams: Class EventedUDP Implements IDisposable Dim Client As Net.Sockets.UdpClient Dim Endpoint As Net.IPEndPoint Public Event RawDatagram(sender As EventedUDP, datagram As Byte(), ByRef handled As Boolean) Public...
I'm writing a small program that generates a file containing an adjancency matrix, it then reads from that file, constructs a graph and does something like a parallel depth-first search (dfs) on it. How can I make the dfs part faster, because now it seems to be doing a lot of nothing (each thread just sets the nodes pa...
/** * Execute an external program, display raw output in real-time, and buffer output pipes (stdout, stderr) for further processing. * * @param string|array $cmd Command to execute (not escaped) * @param string[] $output_buffers Buffers to capture * @return int Exit status code */ function tee($cmd, &...$output_b...
I wrote this program to convert binary to hex, it ignores other characters between the binary digits. I would like to receive any recommendations on how to improve it. #include <stdio.h> #include <stdlib.h> #include <string.h> const char table[] = "0123456789abcdef"; int main(int argc, char* argv[]) { int flip = ar...
I am going through some of my companies EDI reports to see if I can make them faster. The query below runs in less than one second in our AWS RDS environment, but it takes ~55 seconds on a blade in the office, so there is room for improvement. I do not see any common performance culprits based upon Google searches, b...
I am trying to implement a hash table in Objective-C. I did some testing and the implementation seems to work. I am using an NSMutableArray to store linked lists of entries. It also resizes when it gets almost full. I am using an NSString for a key and any object as a value. I store NSNull objects in an NSMutableA...
I have written a class that is designed to be an automatically keyed Map in Java. Here is my implementation: import java.util.Collection; import java.util.Map; import java.util.Set; /** * A {@link Map} that is automatically keyed. * * @param <K> the key type for the map * @param <V> the value type for the map * @...
I'm developing a middleware for my client and it's found that there are some delay when executing the process. We are currently investigating what's the exact causes of the issue, from architecture design to coding. Here is part of the script we are calling, which is working, and I'm just wondering if it's optimized an...
Right now, I've got this really ugly loop in my code that waits for a boolean to be true before the method can return. It's triggered when "Done" is clicked. I'm wondering, what is the proper way for me to delay this method's return until the button is pressed? How should I refactor this code so that it follows common ...
My goal is to read from standard input, break up the input into words, case-insensitively, and produce a report to standard output, where each line is a word followed by a space followed by its count. The output should be sorted by words. This is my code: use std::collections::BTreeMap; use std::io; use std::io::BufRea...
I have a table that name is Store , In Store Table , just one row can IsDefault=true at time . when I insert new Row , I check If user selected IsDefault , I update other row whice isDefault=true . I use this code : public AddStatus Add(AddStoreViewModel storeViewModel) { if (Exists(storeViewModel.Name)) ...
I'm implementing a lazy constructor in C++. The goal is that for a type T, lazy<T>(args...) returns a callable object which, when called, returns T(args...). This is what I have done so far: #include <functional> #include <utility> /** * Returns an object of type `T` constructed from `args`. */ template<typename T, ...
I wrote the following code for this problem. The problem is to find the longest palindromic substring. I think it is correct and is working correctly for all the test cases I entered myself. Now, the code is producing a Time Limit Exceeded Error. I know that there exists Manacher's Algorithm which does it in linear tim...
Let's say I following have code: private bool ErrorLogExists(LogEvent logEvent, DateTime filterStart) { var startTimeFrom = logEvent.StartTime.TruncateMilliseconds(); var startTimeTo = startTimeFrom.AddSeconds(1); return _existingErrorLogs.Any(x => x.Name == logEvent.Name && x.EventDateTime...
I have the following input array: $arr = array( 'water' => array(0, 1, 2, 3, 4, 5), 'apple' => array(1, 5, 3, 4, 0, 0), 'beer' => array(0, 0, 0, 0, 0, 0) ); Now I want to know which element has largest sum, so I have the following code: $arrWeight = array(); foreach ($arr as $key => $value) { $arrWeight[$key] = i...
My goal is to learn a bit more about generic programming in C++. So, one of the trickiest things I've heard you can do is creating a Variant class. This took me a while and I needed to read and study a few implementations: #ifndef VARIANT_HPP_INCLUDED #define VARIANT_HPP_INCLUDED #include <cstddef> #include <typeindex...
So, there is this king-of-the-hill challenge going on at PPCG SE to which I submitted my participation. I won't change it further in terms of behaviour, so I wanted to know what you think of the code. The challenge It is very well described in the original post, I'll just summarize the key ideas here. Setup A pile of ...
The code snippet is what I want to do. Previously I use a different version of my code. But it is out of joint according to Python coding guidelines because I was assigned my lambda function to a variable. It was an obvious violation. Here is my violator code: my_dict = { 'first_name': 'Jimmy Floyd', 'last_name...
I want to improve my skills so i startet a very basic MVC framework. Its my first MVC based Framework. Index I rewrited all requests through index.php and the file looks like this: <?php namespace System; use System\Core\App; use System\Libraries\Config; use System\Libraries\Database; use System\Libraries\Registry; ...
Custom class Image takes a 2-D array of 0's and 1's upon initialization. Method transform returns a modified array by modifying 0's adjacent to a 1, such that [[0,0,0], [0,1,0], [0,0,0]] returns [[0,1,0], [1,1,1], [0,1,0]] I've been working on method blur(n), which outputs an array that has been transformed n ti...
Given two python lists a and b. These lists may intersect (It is possible that lists intersect more than once). An example: a = [1,2,5,7,6,9,1,3,1,2,6,6,3,1,2,6,1,3] b = [3,1,2] There are 4 intersections: [1,2,5,7,6,9,1,3,1,2,6,6,3,1,2,6,1,3] [3,1,2] [3,1,2] [3,1,2] [3,1,2] For each intersection I c...
I have written some codes in java implementing simplest genetic algorithm. The code finds (or rather tries to) the maximum value possible for a user-defined number of bits. For example, for 16 bit chromosomes, the code tries to get 216-1. I have never had my code reviewed by any one good, so the thing I am looking for ...
I have details of key decisions made by a business in a worksheet "Decision Record." My data is laid out as follows: I have written some code to create a timeline of these decisions using an XY scatter chart, like this one: The code works fine, but as with most of the code I write, it doesn't look tidy to me. Perhaps...
This is a builder pattern implementation to build immutable Person objects: Person class public final class Person { // All are set to final to make Person Immutable private final int id; private final String name; private final String surname; private final boolean isOccupied; // Constructor ...
I want to let you look through my NetHandler which is basically the component which gets notified when a full packet arrived (not like tcp-packet but my own type of packets) and handles it. First of all, the handle method which gets called from the networking void NetHandler::handle(int id, char* data, int len) { #defi...
I've just finished writing my code to return the prime factors of a number and I feel the GetBestFactors function could be improved. The GetFactors function was hacked together from the code found here:https://support.microsoft.com/en-us/kb/202782. This returns all the factors of a number in a collection. The GetBestF...
(See the next iteration.) I have this small program for sorting a stack using mergesort. Basically, the aim was to use as little aid from JDK library as possible. See what I have: StackMergesort.java: import java.util.Collections; import java.util.Random; import java.util.Stack; import java.util.stream.IntStream; publ...
Does this look like a proper implementation of a hash table in C++? Any errors anyone can find? Thanks in advance (: template <typename T> class HashTable { public: HashTable(int amount) { size = amount; values = new T*[size]; for (int i = 0; i < size; i++) { *(values + i) = nullptr; } } ~Ha...
I'm trying to follow the DRY programming philosophy and I am tired of running isset() and an if not empty statements for each time I want to check a $_GET[] variable. I am working on a page that receives up to 4-5 GET parameters in the URL, so I wrote the following function to reduce repetitive code: function getset( ...
I am just getting into the world of javascript, coming from the world of classical inheritance. The following is a library I wrote to track when a webapp is idling and I wrote it like I write classical inheritance. But what I have heard about javascript is you have to completely forget how classical inheritance works. ...
I am trying to complete this challenge. The user should enter a sequence of instructions, = to link two numbers, and ? to query whether two integers are linked. For example, ? 1 2 = 1 5 = 2 5 ? 1 2 should produce no yes I have tried following the algorithm given here to the letter, but I keep getting a judgment of "t...
I am writing an ASP.Net MVC app which has a page that will display a standard table which will contain a person's hours for the week. The basic structure of the table would be a 7 column, muti-row table. The Header of each column would display the Day of the Week with the total hours worked that week. There would then ...
From LeetCode medium 3. Longest Substring Without Repeating Characters: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the length is 3. Given "bbbbb", the answer is "b", with the length of 1. Given "pwwkew", the answer is "w...
I have an HTML form where I need to do the following when value of Select Box changes to initial "Not Selected" value (where values of the option is 0), I am to highlight the select box, when it's non-0, restore the original coloring of the select when I submit the form, and the Select box value is 0, do not submit th...
I am trying to implement quadtree for my Barnes-Hut algorithm implementation. I am not sure that the code I've wrote so far is good implementation - it is dirty, and tend to be slow. Of course I am also aware that the results might be correct, but I'd be glad if someone can take a look at that and give me a hints. Bec...
I've been learning Haskell recently and I decided I needed to work on a (somewhat) realistic problem. What I'm most interested in getting feedback on is how well I've used the tools in Haskell to accomplish the goal of converting Roman numerals to Arabic values. I suspect that my approach is more verbose than it needs...
I'm a beginner and am self taught and was hoping I could get help from others more educated than me to show me what bad practices I might be forming before I go on further. P.S. This program is just for me to learn, I'm not actually storing passwords with it. #!/usr/bin/env python # -*- coding: utf-8 -*- import sys de...
After my previous post, I decided to work on the project myself for a while (two weeks) to see how far I could get after reading a few of the really helpful answers to my previous posts. I read up on stuffs to learn a little more about the stuffs mentioned in the answers (MVC, interfaces, packages, etc) and read a lot ...
For my project I have rewritten a small lib for a tree structure that was inspired by wangzuo's js-tree. The reason was largely because I prefer to work with an array structure rather than nested objects. Could you advise me if you see any bad practices? I will work with React.js for an important project and if you not...
I am starting to learn ASP.NET, and I am designing a page for an admin to login and do some stuff. I have the username and password for the admin stored in Web.config (Is that a good practice?). Second thing, I am checking if the user filled the username and password fields, then I am checking if the values for the adm...
I was trying to solve the Longest Common Subsequence problem on a HackerRank exercise. It's quite simple and straightforward, just print out the length of the LCS. I submitted this code: s1 = raw_input() s2 = raw_input() lcs = [[0 for j in xrange(len(s2)+1)] for i in xrange(len(s1)+1)] for i, x in enumerate(s1): ...
I am working with the following code: import numpy as np def sigmoid(x): return 1.0/(1.0 + np.exp(-x)) def sigmoid_prime(x): return sigmoid(x)*(1.0-sigmoid(x)) def tanh(x): return np.tanh(x) def tanh_prime(x): return 1.0 - x**2 class NeuralNetwork: def __init__(self, layers, activation='tanh'...
I am novice at creating independent classes for user. I have seen many Reachability library for Swift, but I need to create my own class for that. Here is my code: class SwiftReachability: NSObject { let REACHABILITY_NOTIFIER_KEY = "reachability_notifier_key" var backgroundQueue: NSOperationQueue? var isCancelled: Boo...
The below produces the output I want. Namely, it initially displays the first item on the list and the first expander link. When an expander link is clicked, it hides that link, unhides one more item in the list, and unhides the next expander link. I'm wondering if it can tightened up. JQuery is a definite no-no. w...
I have made a small script for encrypting data. Now I'm wondering how efficient it is for normal users who aren't programmers and for people who are programmers. I mean if you don't have this script there is no way to find out what the text is right? function cipher(message, action) { var text = message; var encryp...
I have a sleep function which displays the time remaining in sec, some feedback would be appreciated use warnings; $x=$ARGV[0]; $|++; $n=0; # arguments could be 1, 1s , 1m or 1h if($x=~/([0-9]+)([a-zA-Z]?)/) { $t = lc($2) ; if($t eq "h"){$n = $1*3600;} elsif( $t eq "m" ){$n = $1*60;} elsif( $t eq "s...
Recently I noticed that the idiomatic python two-dimensional array initialisation is extremely slow. I am wondering, is there a good, proper way of doing this simple task fast? Also, are those two variants equivalent? Here are some code snippets using timeit import timeit A = 5000 B = 7000 N = 10 def list_comprehens...
The purpose of the data-structure is to manage person-objects. Persons can be added at any time. But the order can't be changed afterward. Only the deletion of a person is possible. Represents the case of cancellation. The whole thing is intended to be as simple as possible. Nevertheless: I'm thinking about an additi...
I made a function that should ease the making of new objects out of objects or arrays. I extended underscore so thats why the _. _.dictionary = function (obj, keyIteratee, valueIteratee) { var newObj = new Object(); if (Array.isArray(obj)) { var length = obj.length; ...
I'm currently in the process of refactoring some code and I was wondering if I should use switch or if-else for the is code: Switch for (int i = 0; i < length; i++) { CameraStream stream = null; var id = (Guid)CameraGridView.Rows[i].Cells[0].Value; ...
The task is: I get companies' information from a large CSV file and then I need to compare this information with each company in the database to know if the company is a new one or if it is already in the database. The problem is: The information from the CSV file could contain some errors (wrong zip code, typo in the ...
I have implemented a generic dynamic array implementation using defines. As I am new to C, I am not sure whether the code has any flaws. The code is as follows, #define INIT_CAPAC 5 #define INC_CAPAC 5 #define list(t) struct{ t* data; unsigned int count; unsigned int capac;} #define list_init(lst) lst.data = malloc(s...
I need to add class is_active to all div's when I click on <div id="all-tags"> and remove class if I click again. Only every div have class is_active then main div (<div id="all-tags">) have class is_active. Please tell me if this is ok or not. I need as fast of a solution as possible. I'm also not sure using .each() i...
I'm using Passport in Node.js app to authenticate user by email and password (login) and also by token. Email and password are used only when user is logging in. Passport local strategy generates token when user email and password matched. Token will be later used for bearer token authentication. It would be nice to he...
Can you write an a simpler Rust fizzbuzz program than I have? Use my output or the spec: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuz...
I have a function that takes a four-dimensional NumPy array M and, for each value i of its second index, takes all of M without the i-th "column", evaluates the product over all other columns, and stacks the results so that the array returned has the same shape as M. In other words, what I want to evaluate is: $$R_{ijk...
I have the following unit test that is testing predicate logic in a repository (Note: mockOpportunityRepository.Setup): [Test] public void GetFollowedByUserIdShouldGetTheUsersFollowedOpportunitiesFromOpportunityFollowRepositoryAndThenGetThoseFollowedOpportunities() { const int ExpectedOpportunityId = 9; var te...
I have tried to implement a Bloom Filter in Java here. https://github.com/srirammanoj/skynet/tree/master/bloomfilter I just wanted to know if my implementation can be called 'thread-safe' , and if there is an improvement to be made on the locking I have used here. I opted for locks instead of 'sychronized', as I wante...
I have the following code which loads in a URL based on the id of a user-clicked button. I'm looking to compress it down as much as possible, and make it more modular and reusable: <!-- Function to load in info from different docs --> function loadDoc(UrlString) { var xhttp = new XMLHttpRequest(); xhttp.onreadystat...
This is an implementation of optional<T> from C++17, it is mostly standard conforming. I'm looking for a review on efficiency, correctness and performance. Sample usage #include "optional.h" int main() { util::optional<std::string> s0{ "abc" }; util::optional<std::string> s1; if ( s1 ) s0 = s1; else s...
Problem: Write a program that manages robot factory settings. When robots come off the factory floor, they have no name. The first time you boot them up, a random name is generated, such as RX837 or BC811. Every once in a while we need to reset a robot to its factory settings, which means that their name gets wipe...
I wrote a query for SEDE that I think is pretty cool. It uses the currently available graphing capabilities (scatter plots) to create a bar graph. I have used it as the subject for a self-answer on MSE. This query finds potential "recommendation questions" based on the words in the title. The graph looks like this when...
I tried to make a program to find a string whose MD5-hash starts like the digits of pi, where dot is omitted. Is there a faster way to do it than this: import hashlib import random import string n = 1 while True: word = ''.join(random.choice(string.ascii_lowercase) for _ in range(20)) if (str(hashlib.md5(word.e...
With the following data in a table, +----+-----------+-----------+---------+ | id | name | parent_id | prev_id | +----+-----------+-----------+---------+ | 1 | Section 1 | NULL | NULL | | 2 | Item 1.1 | 1 | NULL | | 3 | Item 1.2 | 1 | 2 | | 4 | Item 1.3 | 1 | 3 ...
This is a follow-up on my previous post. I have made modifications based on the feedback received on the previous post, hence I request another review on the modified code if ok. Note: review purpose is just to check good practices (code / performance wise) and see if anything's missing. I created a jsfiddle here: ht...
I want a matrix that can grow dynamically and build up a structure in RAM as input arrives from standard input och terminal (shell). First I tried with a matrix like A[nrows][ncols] but I changed to the char **matrix[32]; and I want to refactor so that there are fewer constants and that malloc will be safe. char ***w...
I've just started out using C#. I've used Scratch (drag and drop programming for kids) for quite some time. Since Scratch didn't have classes and methods I have a feeling this code could be a lot more streamlined, neat, efficient, more read-able, shorter and in general just better. using System; using System.Collection...
Can you please point out any problems with this C forward list with remove node functionality? I believe this can be way simpler ( removeNode function ) but I somehow cannot grasp it #include <stdlib.h> #include <stdio.h> #include <assert.h> struct node { int val; struct node* next; }; typedef struct node node; n...
I wrote a small, cross browser compliant implementation of xhr requests in client JavaScript that closely follows the jQuery $.ajax() API and standards. The goal is to keep the xhr() very small in size, yet cover most common xhr scenarios and needs. I'd like code review for performance, general best practice, and the m...
The function findMinimal() receives a tuple from a list which contains 171 tuples, each of them go into the function one by one and, for each tuple, it searches the best pair via minimalTscore out of those that match by industry (approx. 20 names, for each one). How can I make the function to run faster? At the moment,...
I am currently working on a project, and I just wrote a piece of it that requires a lot of array manipulation. Given a text input I want to expand it to fill the number of rows and columns I have. I worked out a solution, but I am concerned that I am creating too many arrays in my solution. I am looking for pointers...
I want an istream that you can safely peek arbitrarily many characters from. This works as far as I can tell, but I am unsure if this is really "the right way" to do it since the iostream library is pretty cryptic to me. #include <streambuf> #include <vector> class peekbuf : public std::streambuf { std::streambuf*...
I am studying design patterns and I've implemented a composite prototype pattern which is also a singleton (one instance per JVM). The main and most important part of the code is the Registry class which is a singleton. The Movie and Book classes are inherited from the abstract Item class which implements the Cloneabl...
The program below generates a prime normalised sequence. So, what happens is this: It asks you to provide a number within a range. Program then calculates a factor which is inverse of product of all the prime numbers till the first prime number larger than the number you provided. It then divides each number from 1 ti...
I created an Encryption class that encrypts data and decrypts it using the AesCryptoServiceProvider class with an HMACSHA256 hash. The goal was to replace our existing encryption class with something that was FIPS compliant. I would like a review of my structure, security and FIPS compliance. Encryption.cs using System...
I have a library which makes HTTP calls to my service. I was trying to calculate running average of how much time my service is taking on an average. Here is the core logic of how I am calculating "running average": import java.math.BigDecimal; import java.math.RoundingMode; import java.util.LinkedList; import java.uti...
I'd like to know how I can refactor my JS code for usability. Currently my JavaScript uses some HTML to build out a simple calendar with the following functionality: a. opens into the current month with today's date highlighted b. allows you to view next and previous month My goal was to build out a calendar with the p...
I was given the below Exercise as part of a coding Exercise to do at home for a technical interview, and I did not get through past this round. I would like to get some input on what i could have done wrong. Appreciate your time and effort in providing valuable feedback !! Exercise : Given the following text file(of ...
I just recently wrote a program to simulate how multicast routing works. The program uses a weighted graph to represent the network and simply runs it through the algorithm. I would like to know if there is a better and more efficient way of going about this. Here are my classes: /* * To change this license header, c...
This is a much improved version (I hope) of code in this previous code review of mine. I have: renamed several things. Are the names good? made it lazily start the worker thread only after the first timer is added. Is it clear that the implementation uses one worker thread to handle an unlimited number of timer callba...