instruction stringlengths 71 71.9k |
|---|
I made a small app to download wikipedia articles (and optionally those that it links to) as PDFs to take on the go. I'd eventually like to do a text-to-speech option and save the article as an mp3, though that's the next step. Any thoughts would be helpful.
import wikipedia
import pdfkit
import os
from gtts import g... |
This code is an academic example. I was trying to write something easy because the domain is not important but the principles and best practices.
In this code, I have a class - Table. It has a private array (of objects Cell), which is used by many public functions in the code but there is no function that will return ... |
I'm learning CUDA C++ (and C++). Can you guys give me some feedback on my basic templated matrix implementation?
A brief explanation of my decisions:
First things first: I can't use STL classes/functions in my CUDA code.
I can't use C++ 14 (or newer) features.
I'm using templates to give support to floats, doubles and... |
I'm new to JavaScript, and wrote this little animation in canvas. I'm wondering if anyone has any suggestions as for how to improve it.
When running the code, the JavaScript draws a scene of three pyramids, a sun, and a sky. The sun and gradient of the sky animate over time.
The code is working perfectly, but I would l... |
I created a Frogger game using JavaScript and HTML5. The game runs fine, but that might be because the complexity is so low. I'm looking for ways to improve the code.
Some aspects of this game are still buggy, but I'm not concerned about that right now. I want to improve the current functionality first, then worry abou... |
I started this exercise with NumPy with a goal to find neighbors and return the new matrix. I want to get your feedback. Here's an example from this website. It looks like it's \$O(N^2)\$, and I'm adding a internal loop to look around neighbors.
import numpy as np
import pprint
world = np.array([[0, 0, 0, 0, 0],
... |
I have made a search function that seems to work for passing the tester. I am just unsure if it will always be without errors. Can someone tell me if they see any flaws in the logic, and if so, where to look to improve?
Search function
//looks up the word in the object. If it is in the object,true is returned.
//You ... |
I wanted to get some review on this code I wrote. The repo is here if you want to download the CodeBlocks project.
This program is several things: it is a console using SFML graphics; it is a console able to parse a few hardcoded commands (this is how clients and servers will start the networking); and it is a server/c... |
I have built a Python 2.7 script to track all file and subdir changes inside a nominated directory. It is used with directories that have multiple levels of subdirectories, hundreds of thousands of files, and hundreds of GB of file data. The filenames can have Unicode characters (encoded in UTF-8). By "changes" I mean ... |
I created the Stackapp IGB Stack Flair a while ago and I think it's a good time for a revision now. Is there anything that can be done better, shorter, more elegant, more performant, etc.?
I thought of using something like a map/associative array for the SE sites in addSiteLinkFor(), for instance. [This has been implem... |
I am trying to print the Z pattern, but the time complexity is coming to \$O(n^2)\$. Is there any way to reduce the time complexity?
package matrix;
public class ZPattern
{
public static void main(String[] args) {
String a[][] = { {"1","2","3","4","5"},
{"a","b","c","d","e"},
... |
I would like to get a few tips on how to improve this program, which is supposed to help recovering lost passwords from .zip files.
import zipfile
import string
import itertools
import random
import time
"""
Zipfile password cracker using a dictionary attack and, if not successful,
switches to bruteforce
"""
def cra... |
I have designed a class that allows the client to set an initial value. The idea is that if later on we wish to update this value then we can use the Update method and pass in the new value. We can then use the HasChanged() method to do something with the new value if it is different than the initial value.
public cla... |
I am implementing a binary heap in Java. I've come to the point where I have to fix the heap ordering whenever a new node is being inserted to the heap. The code below fixes the heap ordering. I have a gut feeling that the code can be improved.
private void fixHeapOrder(Node anomalousNode)
{
if (this.heapType == 0)... |
I am learning Python and in particular learning about classes. Since I'm self teaching, I'd appreciate any feedback and constructive criticism.
I have a couple specific questions:
In Python you can have multiple functions and classes in a single file (module), but is it considered bad practice to do so?
Python doesn't... |
I have an array of data like this:
var data = [
['a', 2010, 12], ['a', 2010, 20], ['a', 2011, 43], ['a', 2012, 25], ['a', 2012, 15],
['b', 2010, 40], ['b', 2012, 65], ['b', 2013, 20], ['b', 2013, 10], ['b', 2013, 15],
['c', 2010, 13], ['c', 2010, 17], ['c', 2011, 22], ['c', 2011, 32], ['c', 2011, 10], ['c... |
I'm developing a game where you have multiple levels and each level contains a question, an answer and some info abut the question. All this information is stored in .txt-file as shown below. What I need to do is read only a specific part of the .txt-file and the specific part is depending on the input. The input could... |
I wrote a program that approximates Pi by using polygons. I used the formulars in the picture beyond.
In my code they are called innerPoly (\$c_{2n}\$) and outerPoly (\$C_{2n}\$).
And since you can calculate the circumference of a 2n-polygon with knowing the circumference of a n-polygon you will get the circumferences... |
I'm trying to port some MonteCarlo code to CUDA (this is my first CUDA experience).
The CPU code often calls a function which generates a random number:
float generate_random_number() {...}
Since all the existing code base runs fine on the GPU, that is basically the only thing to adjust.
My strategy is to put a curand... |
Today I had an interview, where I was asked to solve this question:
Find all the permutations of a given string
Example:
str = 'abc'
Answer: 'abc', 'acb', 'bac', 'bca', 'cab', 'cba'
I have written this code, but can it be improved or is there any other way to do it in better manner?
public class Permutation{
... |
I just got into C++ a few days ago and decided to make a MiniMax based TicTacToe game, I don't really know much about the conventions and best uses of the C++ language so I'd really appreciate any kind of feedback.
Brief summary:
Board: has all the information pertinent to the game. Is used by the main method to paint... |
I want to change the conversion from List<string> to the StringCollection type. To make files move faster.
try
{
List<string> Picture = new List<string>();
List<string> PaThS = new List<string>();
string[] SVF = {
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
... |
A project I'm working on requires generating a random number of \$N\$ length to a very high degree of fair distribution between digits \$[0, 9]\$.
That said, I used the RNGCryptoServiceProvider in the .NET framework, and built my own window restriction / clamping.
First, we have the clamping. This clamps the values to ... |
I'm currently working on the Student Attendance Record II problem:
Given a positive integer \$n\$, return the number of all possible
attendance records with length \$n\$, which will be regarded as
rewardable. The answer may be very large, return it after mod 109 + 7.
A student attendance record is a string that on... |
I have a simple PHP form I'm developing to let users submit their name, telephone and email.
At this stage, I basically want to prevent as little abuse and nasty code getting into my system, so I've tried filtering and validating the input.
I was hoping I could get a quick scan to see if I'm doing things well or if it ... |
This provides a fill-in-the-blanks homework framework to implement the game "LightsOut".
LightsOut is a game with a grid of lights. When you touch a light, it toggles it’s state; it ALSO toggles the state of the lights adjacent to it (in a cross pattern). The goal is to turn all the lights off.
In addition to the norm... |
Solving it by the logic:
find the length
traverse to length-n+1
remove item
I've written the following code
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next ... |
At my workplace, we changed string type (which holds internationalized characters) for from std::wstring to std::u16string after VS 2015(Update 3) compiler upgrade.
Due to this, we are seeing loads of performance regressions such as this.
The profiler analysis reveals that std::u16string's std::char_traits<char16_t> o... |
I am just new to programming I just have a 2 month experience in programming and a 2 week experience with python.
This is my chess game written in python with pygame.
Can some one help me how can I improve this program ?
p.s. this is not a AI chess game it is a multiplayer game; also the checkmate condition is not yet ... |
I'm currently working through "Algorithms in java" by Robert Sedgewick (3rd edition, german version) on my own and am trying to solve one of the exercises there.
Edit: This question now also has a follow-up question here.
Translation of the exercise
Write a program to check if 2 int arrays of N whole numbers between 0... |
I am trying to grasp MVP (like so many) and although there are quite a few resources out there, I'm not sure I really get it.
I am trying to do this without frameworks to really see what's going on.
Here's my code:
main method (only method in a special class called Main):
SwingUtilities.invokeLater(() -> {
JFrame m... |
This is an assignment and i have implemented the function hexasc from the description above. To run this code I'm using MARS-simulator.
For the sake of understanding it better i would appreciate to see different approach.
Write a small subroutine, that converts numbers in the range 0 through 15 into a printable ASCII-... |
(The entire project lives here.)
Problem definition
Suppose we are given three genomic strings drawn from the alphabet of 20 amino acids:
ACGH
CFG
EAC
In multiple sequence alignment problem we want to align them optimally in order to access their evolutionary similarity. Such an alignment may look like the following:
... |
Create an application class named LetterDemo that instantiates objects
of two classes named Letter and CertifiedLetter and that demonstrates
all their methods. The classes are used by a company to keep track of
the letter they mail to clients. The letter class includes
auto-implemented properties for the name ... |
I am quite new to Java and I wanted to try and make a smoking calculator that tells the user how much they would save over a certain time period. I would appreciate if someone could tell me where they would improve my code and what other features they would add?
Should I always use objects when coding in java even for... |
I was asked this question in interview:
Check if a number N is a power of K.
Example:
N = 32, K = 2 => True
N = 40, K = 5 => False
I wrote following code but got the feedback that, complexity could have be improved, How to improve its complexity?
def check_kth_power(n, k):
while n%k == 0:
n = n/k
... |
I was asked this question in an interview:
Find all the factors of a given natural number, N
1 <= N <= 10**10
Example:
N = 6 => 1, 2, 3, 6
N = 60 => 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60
I wrote following code,but got an feedback that complexity could be improved.
How to optimise following code?
import math
def ... |
The previous post can be found here.
In the previous post I tried to solve an exercise but found through the answer of Peilonrayz a bug in the code and 2 more while fixing it. These have now been amended (changes to the original code can be seen in my answer in the previous question).
The exercise (Copy&Paste from the... |
I want to change (for better performance) or optimize my code, especially for and while loops, maybe with lambdas or list comprehensions.
def getAvailableLetters(lettersGuessed):
'''
lettersGuessed: list, what letters have been guessed so far
returns: string, comprised of letters that represents what letter... |
Please review this implementation of the Hungarian Algorithm. Having gone through the code a few days after I wrote it, then having written some randomly generated test cases for it, it seems to work as intended.
Does this solve the assignment problem as intended, or are there edge cases that I have missed?
Primary Cla... |
I'm working on a Swift app for macOS, where I take input from MIDI devices and transform that input. The MIDI devices being supported come in for flavors.
What my code does is scan for MIDI devices, filter all the MIDI devices to only leave the ones I want, initiates classes on them and puts them in a array.
However, w... |
I have a protocol where I send lots of different messages using two or three different header types (let's call them "Type A" and "Type B" messages).
To simplify unit testing, my idea was to do something like:
typedef struct
{
u32 timestamp; // unix
u32 deviceId;
}
CommonHeader;
void buildMessage(Buffer * ou... |
THIS IS JUST FOR LEARNING PURPOSES. I WON'T BE USING THIS TO HACK ANYONE.
Here is a small algorithm I made to crack a password. This is just the background of a more complex code I'm going to make.
To be honest, this code is TERRIBLY written, so I need help on making it more efficient and flexible. It is limited to 5-c... |
I just started picking up Elixir (I don't have any functional programming background either), I would appreciate any feedback you have!
The kata is about writing two functions:
uppercase/1: takes a string and upcases every other word
unvowel/1: takes a string and removes the vowels from every other word
And here's my... |
This is generic logic for handling network requests that load data based on pages. It is assumed that the view controller would implement the UISource protocol. I have a test suite as well. I'm especially interested in any ideas for doing away with the Variable. I'm also interested in ideas for refactoring this code in... |
You've all heard of neural nets, no? One of the "hello world"s of neural nets is OCR with the MNIST dataset. My idea for speech recognition is to train the neural net with short labeled spectrograms instead of characters. Unfortunately I don't know of a database for doing this, so I have to create my own software fo... |
What I have: I am trying to find what words you can make out of Linux command options like ls -cat or ps -elf. To do that I am iterating through an array of 50 commands, trying to run each with flags -[a-z] and then making anagrams out of the successful options. It is working and here is what I have:
#!/bin/bash
# Pul... |
I'd like to see if there's any code reuse I'm missing, or anything else that can be rewritten in a better way, but always following the same data structures (without adding more classes or using the C++ list implementation).
Node* merge(Node* list1, Node* list2){
if (list1 == nullptr){
return list2;
}
... |
This program uses user-input variables to calculate the iDays a person has been alive for (or the iDays between two input dates), taking into account for leap years and iDays in each month.
Can I please have some feedback on my code formatting and if you think this would get good marks?
//-------- Author: pumpkin
//--... |
The function traverse takes an element and a map, and returns another element and a new (updated) map.
Given a list of elements xs0 and an initial map m0, I need to apply traverse to each element of the list while passing in the updated map to each new invocation of traverse, to produce a list of resulting elements and... |
I'm working on a custom (self-hosted) ads solution that allows the users to create ad units (by uploading the banner image and target URL) and get the ad display code. A JSON response is returned (by the endpoint) for the requested ad. As of now, here is what I do to get and display the ad on the page where ad code is ... |
I was making a simple currency converter utility and had to cache the conversion factors after fetching from server. Came up with the below interface. I have basically delegated the caching responsibility to OkHttp itself. Review appreciated.
public interface CurrencyConverter {
Interceptor CACHE_CONTROL_INTERCEPT... |
I'm using this class so that objects can find other objects that are near them. Each object has a position and radius. Objects are added to the Grid. If they move then they call update with their new position. An object can call retrieve to find which objects are around it. How can I optimize it, specifically the ret... |
Here is my solution for a fixed table header with scrollable body and aligning columns.
The requirements I wanted to achieve were:
Fix <thead> while <tbody> can scroll while the all the <th> and <td> cells of one column all have the same width
No fixed width
Pure HTML, CSS, JS
Bonus points for pure CSS solution
... |
Here is another reference solution, that I discovered after writing my own:
https://insight.io/github.com/beloglazov/haskell-course/blob/HEAD/hw2.hs
I am following this lecture course as a complete beginner to Haskell. As there is no one to check my solutions to the homework assignments, I am posting here.
Until now,... |
This actually belongs to a larger interview question. But here it is just the "tally up" part:
var i, a, tally = {}, arr = [1, 3, 7, 9, 3, 1, 6, 3, 3, 2, 11, 2];
for (i = 0; i < arr.length; i++) {
a = arr[i];
tally[a] = (tally[a] || 0) + 1;
}
console.log(tally);
I had some feeling the interviewers were not im... |
I'm writing a chunk of a file from an offset to a socket.
This is my implementation and it's working OK from my tests.
Any comments or speed improvements?
private func sendChunk(_ source: Int32, _ target: Int32, _ offset: off_t, _ count: UInt64) -> Int64 {
let bufferSize:Int = 1024
var buffer = [UInt8](repeatin... |
Just started out with CIS 194 on Haskell and wonder what the more idiomatic way to solve this problem would have been.
This code is supposed to generate all possible combinations of 6 given colors up to a given length. It works, but I think my solution is not that elegant. The suggested solution included this hint:
Hi... |
I just wrote a PHP code to register users.
It's called through AJAX and it looks like it's too slow because it often sent me a .status = 0 that it means it took too much time to proceed.
If i replace my php function that register only by :
echo "Ok";
It always sent me a .status = 200
Could someone helps me to improve ... |
I was solving this question:
Given there is a 6 sided dice. Find the total number of ways W, in which a sum S can be reached in N throws.
Example:
S = 1, N = 6 => W = 0
S = 6, N = 6 => W = 1
S = 7, N = 6 => W = 6
S = 3, N = 2 => W = 2
How to improve its complexity and make it more readable?
def get_sum_dp(n,s):
t... |
I have a template I've been using with Swift for UIViewController and UIView subclasses without a .xib or .storyboard. I want to know how this stacks up against other people's implementations. One weird thing about it is you have to use contentView to access the view, which is kind of similar to UITableViewCell.
Exampl... |
While executing a SQL script in production like sensitive database, usually I do the following
BEGIN TRANSACTION
--Declare of test variables
DECLARE @ExpectedAffectedRows INT = 10 -- Manually count this
DECLARE @ActualAffectedRows INT = 0
-- Its a demo code, don't take it seriously ;P
DELETE * FROM SomeTable AS st ... |
Exercise description:
"Write a program that takes a double word (4 bytes) as an argument, and then adds all the 4 bytes. It returns the sum as output.
Note that all the bytes are considered to be of unsigned value.
Example: For the number 03ff0103 the program will calculate 0x03 + 0xff + 0x01 + 0x3 = 0x106, and the out... |
Over the weekend this article inspired me to write an ASCII string implementation that avoids memory allocation during basic operations like Substring and Trim. It's still a work-in-progress but I think this is a solid foundation to build off of and wanted some help checking my logic/maths.
The main method of interest ... |
I would like to hear your recommendations on when to use JavaScript's const over let, especially when applied to mutable objects as demonstrated in the following comparative code samples:
Strict preference of let:
// Create 100 x 100 zero-filled matrix:
let matrix = new Array(100);
for (let i = 0, length = matrix.lengt... |
I've been working on a Tokeniser/Lexer in Rust. I would like to have the tokeniser take input from different sources, such as files or in-memory strings. To abstract over this concern i've created a trait Source. This has left me with a wonky situation where I appear to need a PhantomData member in the token iterator. ... |
While trying to understand monad transformers in Haskell I came up with a sudoku solver based on a combination of the ST and Reader monad.
I am positively surprised with the performance, however solving particularly difficult sudokus still takes about 3 - 4 seconds on my computer while using the same strategy in Java t... |
This is a follow-up from this post.
It all works, but I think the code could be made to work faster and to be more stable. I have made improvements and updated the code in this new question.
Basically, when I activate the worksheet the weather information updates and three listboxes in the worksheet updates.
Public Sub... |
Implement addition, subtraction, division and multiplication of given numbers of different base and provide result in desired base:
Example:
n1,b1 = 1010, 2
n2,b2 = 100, 10
desired_base = 9
addition(n1,b1,n2,b2,desired_base) = 22
subtraction(n1,b1,n2,b2,desired_base) = 0
multiplication(n1,b1,n2,b2,desired_base) = 121
... |
How can I improve the code? Specifically, is there any way that I can move the code from App.handle into separate functions?
from tkinter import *
import operator
# tuple of buttons in the calculator
# string = command
# function = operation
# number = number input
BUTTONS = (
(('E', 'exit'), ('<-', 'backspace'), ... |
I am writing a pretty simple REST service in ASP.NET WebAPI with Entity Framework and I decided to use it as an opportunity to learn N-layered enterprise application architecture with some unit/integration tests coverage. I've spent a few days on reading articles about the topic and that lead me to creating a part of t... |
this is the first time I' implementing a Trie. My goal was to make it as simple as possible. So here is the result:
Can I simplify anything else? Are there some things I can change to increase performance ? Also any feedback on code quality/design is welcome :)
Node.java
package trie;
public class Node {
final Nod... |
The code beyond approximates the error-function erf(x) with following formular \$erf(x)=1-(a_1t+a_2t^2+a_3t^3)e^{-x^2})\$ for \$x\geq0\$ inclusive the identity \$erf(-x)=-erf(x)\$.
Is it okay to end the program in the middle of a code with exit(EXIT_FAILURE)? I just tried to avoid it and came to following solution, wh... |
To multiple Polygon objects in Google maps, I have to set same strokeWeight, fillColor and fillOpacity attributes. Is there a way how to add these only once or do it in a better way?
var hospitalPath = new google.maps.Polygon({
path: hospitalPathCoords,
strokeWeight: 0,
fillColor: '#add78b',
fillOpacit... |
Asks the user for the chance of a coin landing on heads, the number of trials per experiment, and the number of experiments. For example, given 5 trials per experiment and 20 experiments, the program will flip a coin 5 times and record the results 20 times. Then, it displays the results, as well as the theoretical and ... |
Solved the below problem. Would love to hear your feedback, especially on performance improvements (granted, the solution should remain recursive).
Especially concerned about the obj.include? elem check I had to add to prevent duplicates. Don't know a better way to do without it.
# Implement an algorithm to print all v... |
I recently wrote this OpenGL buffer wrapper which covers the 4.5 Core specification. I feel like the typed interface could be done better. Any feedback is greatly appreciated.
#ifndef MAKINA_CORE_RENDERING_BACKENDS_OPENGL_BUFFER_HPP_
#define MAKINA_CORE_RENDERING_BACKENDS_OPENGL_BUFFER_HPP_
#include <cstddef>
#include... |
I received my code review comments for the following method:
private RequiredDocumentEntity GenerateRequiredDocumentMapping(string documentTypeCode, params string[] alternativeDocumentIds)
{
int alternativeDocumentCount = alternativeDocumentIds?.Length ?? 0;
List<DocumentTypeEntity> satisfyingDocuments = new Li... |
I am new to programming and have been having a lot of trouble with user input validation. Everything I found online I could break and I finally put this function together that appears to be unbreakable. It is for int and double specifically.
I am curious about how it might be critiqued by experienced programmers. How d... |
I am working on an rc4 encryption implementation for s3fs and I'd like to better optimize my design so I'd like feedback on my encryption/decryption here.
Below is the code which accepts a file descriptor of an open file for a parameter:
void crypty(int fd){
// Initial steps, read the file into a buffer
ssize_... |
I have a program that monitors real-time air waves and demodulates them into useable data. The program runs fine and with very little issues over time. The only thing I am really interested in is whether the calls to memcpy can be handled differently.
I have tried using valgrind and this code does not seem to be leakin... |
I was reading binary search from an interview book and changed some part of the algorithms.
It is working for all the values I tested with: i.e. all the values in array and outside the array extremes. I would appreciate another person's glance on my use of lower <= upper condition. Any other opinion is welcome, too.
st... |
I am pretty new to Clojure & am loving it so far. After going through a few resources, I decided to make a hangman game.
I'm wondering how idiomatic is my code & where can I improve it stylistically & reduce complexity. It is divided into two files. Both of them are shown below.
src/core.clj
(ns hangman.core
(:gen-cl... |
I have implemented this MIPS code to determine the length of given ASCII character strings.
Is there a simpler way to implement this code? Is there is a built-in function in MIPS?
Given String:
"Hello\n"
Output:
6
.data
message: .asciiz "Hello\n"
.text
main:
li $t1,0
la $t0,message
loop:
lb $a0,0(... |
After answering Monty hall python simulation I wondered what the outcome were to be if there were more than three doors, say four or seven. And so I decided to modify the problem slightly to adjust for this.
There are \$x\$ amount of doors. Behind one door is a car, the others are goats. You pick a door, and the host r... |
Just completed a piece of code - a credit card validation program in python - as a little side project. Having no experience with classes in the past, I decided to employ classes in this project.
I am wondering if you could review my code, both appraising the actual code, but also evaluate my use of OOP/classes.
The re... |
I am trying to ad nested to some flat data, which is nested.
Basically this code works the following way:
"taglevel":1 tags should be key of the array
"taglevel":2 or higher tags should be nested within an array and not be duplicated in its' array
If no "taglevel":1 exists add, it to a generic "NoLevel_1" array
The c... |
Return the number of bits (N) that will need to be changed in order to convert an integer(X), into another integer(Y).
Constraint: 0 <= X <= Y <= 2**128
Example:
X = 1, Y = 2 => N = 2
X = 2, Y = 3 => N = 1
X = 0, Y = 4 => N = 1
I have written following code, how to improve it?
def bit_diff(n1,n2):
cmn_d = n1 & n2... |
Find the kth smallest element in row wise and column wise sorted element:
Example:
matrix[row][col] < matrix[row+1][col]
matrix[row][col] < matrix[row][col+1]
mat=
1 2 21
11 23 25
31 36 41
I have written following code, How to make more readable and improve its complexity:
import heapq
def kth_smallest(k, mat):
... |
I have implemented a play fair cipher. The code works fine but I would like to improve the clarity and/or performance of the code. First a quick description of how it works.
You are given a string to encode along with a key. The text can only contain alphabets (i.e. no spaces or punctuation). Also this cipher is case-i... |
(See the next iteration.)
Problem definition
We are given an undirected graph \$G = (V, E)\$ and a weight function \$w \colon
E \to (0, 1]\$. The weight of the edge \$e \in E\$, \$w(e)\$, describes its reliability, or, in other words, the probability that the edge is available. Given two distinguished nodes \$s, t \i... |
I have a big txt file containing some specific IP addresses, and all of them appear more than once (the file has around 13 million lines). The file looks like this (the first octet is set to zero for anonimity):
0.169.252.233
0.140.165.113
0.112.0.44
0.89.149.36
What I want is to read all those addresses and print in ... |
I have seen many examples which the results of a Producer/Consumer queue implemented using BlockingCollection<T> are independent, e.g. each result can be consumed independently in parallel. For example, here the produces calculate a square root and consumers grab each result to update the UI.
I wonder whether explicit ... |
I wanted to do a practice and randomly picked: Hackerland Radio Transmitters. I highly encourage you to give it a shot, I at least enjoyed working on it.
Please do not proceed if you want to solve it yourself!
To summarize, challenge goes as follows:
Hackerland is a one-dimensional city with n houses, where each house... |
I have a form with listboxes used for unit conversions. I'm using the UnitsNet package.
Here are my questions:
Is this the proper approach?
If any changes must be made to this code, what are they?
private void listBoxControl1_SelectedIndexChanged(object sender, EventArgs e)
{
UnitTypes enumValue = (UnitTypes)Enu... |
I was interviewed for one position and had the following task.
The goal is to design system according step 1, then adapt it to additional requirements in step 2.
Step 1: Shopping cart
You are building a checkout system for a shop which only sells apples and oranges.
Apples cost 60p and oranges cost 25p.
Build a checko... |
I read some questions/answers related to functions in C# to calculate the working days; some use an extended code to achieve that.
I have a data table with more than 50,000 rows and I required an effective method to calculate this information.
I created the following extension in C# that return a number of days (Intege... |
This is my attempt at a Sudoku solver using a DFS approach.
I mainly developed it to become a better Rust developer, but if you have any performance tips, I will be glad to hear them :)
My program works for any dim > 1, but these take a long time to calculate. You may wish to limit running the code to 2 or 3 dimensions... |
This is a project that grew out of the React Tutorial
and is one of my first efforts at solving React problems on my own. There is a lot of code
here and I am sure that there are more concise ways to have completed aspects of this project.
Any suggestions, insights or positive comments would be greatly appreciated.
... |
Solved the classic Tower of Hanoi problem in Ruby, using recursion. Would love your feedback on this.
# Excellent explanation of the solution at
# http://www.mathcs.emory.edu/~cheung/Courses/170/Syllabus/13/hanoi.html
Move =
Struct.new :disk, :from, :to do
def to_s
"Disk #{disk}: #{from} -> #{to}"
en... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.