instruction stringlengths 71 95.1k |
|---|
I am new to Go and wrote program to download and save bulk URLs concurrently. It is working correctly, but I would like to make it more efficient and follow best practices.
package main
import (...)
// Connection String
const connectionString = "connectionString"
// Declare Channels
var wg sync.WaitGroup
var ch = ma... |
This is my first Array in VBA for Excel, but I need some help to optimize the code and try to reduce the number of If statements.
The long and short of the code is that it checks to see if there is a Customer name in Column B and checks that against Column A; if there is no value in Column A then an input box opens to... |
I am automating a scenario of flight booking on Cleartrip.com(https://www.cleartrip.com/flights) in which I have to enter depart date, 5 days from today and return date, 6 days from today. I have written below code.
Date dt = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(dt);
calendar.add(Cal... |
Remains
You've recently stumbled upon the remains of a ruined ancient city. Luckily, you've studied enough ancient architecture to know how the buildings were laid out.
The city had \$n\$ buildings in a row. Unfortunately, all but the first two buildings have deteriorated. All you can see in the city are the heights o... |
I've written the below code to validate user input but I feel it's quite excessive for what seems to be a simple operation. I want to only accept non-negative integers or doubles as an input. This block of code is required three times in my program so I will need to put it into a method or something but in the mean tim... |
Using feedback from my previous implementation I'm writing a very simple Queue of struct Nodes with only these methods get_front(), get_back(), pop_front(), push_back(), and a ostream friend method. I want this to be reviewed as production code and is to be treated as code that could be used in an interview. I'm really... |
I am looking to simplify my main() function. The nested if statements contain four lines of the same code, and I'm unsure of how to refactor and simplify it. I was attempting to use booleans, which seemed like a safe bet, but the logic gets skewed in the process.
#include <bits/stdc++.h>
#include <iostream>
#include <s... |
This simple implementation of the HangMan game in Java is a side project, unlike the usual programs I write which are either school assignments or problems on coding websites.
It feels great to have something simple working, but I know for sure this can be improved. This only runs through the command line now, but I'm... |
I work with YML files that include SIDs and the following structure:
title:
"2": "content a" # key: comment
"3": "content b" # key: comment
"4": "content c" # key: comment
"5": "content d" # key: comment
"6": "content e" # key: comment
Usually, I have to remove some strings (note I never remove the ... |
I want to group by id, apply a custom function to the data, and create a new column with the results. It seems there must be a faster/more efficient way to do this than to pass the data to the function, make the changes, and return the data. Here is an example.
Example
dat = pd.DataFrame({'id': ['a', 'a', 'a', 'b', 'b'... |
I implemented a PhoneBook utilizing a Trie data structure.
Could I ask you to evaluate it?
Did I apply Trie correctly for such case or is it better to store data somehow else?
I'm looking not only for working solution but also for an optimal one in terms of run-time and storage.
From my calculations, it takes NlogT to ... |
Good day, I am a college student and lately we had an assignment where we were tasked to write SQL commands on various questions depending on the information that is needed to be displayed from 3 different tables. Here are the instructions and a sample question with a provided solution:
And below are my answers:
"Que... |
Come across this problem once again in the book The Modern C++ Challenge.
18. Minimum function with any number of arguments
Write a function template that can take any number of arguments and returns the minimum value of them all, using operator < for comparison. Write a variant of this function template that can be p... |
I'm very much a beginner at programming, and hoping to get some advice!
I'm having some trouble with a tripadvisor scraper being slow, and have identified the part of my code that is taking a while. It's likely because of the long selector, but i'm not sure how to use anything more specific because there are randomly g... |
I want your suggestions about this shell script. I use it to backup some configurations on my home media server.
What improvements would you do? Keep in mind, I want to optimize space and speed and at the same time, backup the maximum configurations over time.
p.-s. For more informations about the hanoi scheme: https:/... |
I have module called printer allocator (PrinterAllocator) which will allocate the next available printer to the requester.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.List;
public class PrinterAllocator {
private static final int TOTAL_AVAILABLE_PRINTERS = 25;
... |
The aim of this code, written in Python3.6, was to write a function that will non-recursively walk over a N-branching tree structure.
It works by using a list of indices that keep track of visited nodes and by retracing prior steps when a tree branch ends. The function non_recurs visits nodes top down left to right (as... |
I'm working on an apllication that needs to process a lot of objects in realtime. I've separated the logic from the UI so that it isn't as much of a mess. The basic idea is that every tick I'm trying to populate a list of objects to process and once they are processed I update the UI accordingly.
I've written this coll... |
I am writing a noise blur convolution kernel in CUDA
__global__ void noiseReduction(float *im, float *NR, int height, int width)
{
// Definition
int i, j, bi, bj;
// Retrieve global id
i = threadIdx.y + blockDim.y*blockIdx.y + 2;
j = threadIdx.x + blockDim.x*blockIdx.x + 2;
// Retrieve id wi... |
My goal in creating this project was to create a password generator that was simple enough to be useful as well as sophisticated enough in its random-number generator so as to not be contrived.
I used Boost Program Options for argument parsing. The interface seems extremely easy to use, and the fact that it's both more... |
Am I doing this right? I do not know how to properly connect functions with pagination. To make everything work, I have to duplicate this variables. When I add variables to the function and to the index, then everything works.
$rowperpage = 10;
$page = $_GET['page'] ?? 1;
$page = $page - 1;
$p = $page * $rowperp... |
Introduction
This is my first attempt to mess with memory allocation using C and create something close to a python dictionary. Coming from a high level programming language like Python or Java, I am not really used to correctly handling low level code. I tried to follow C conventions/style but I can tell I already fai... |
I want to add custom punctuations in a given string.
eg:
US 8012999 B2 --> US 8,012,999 B2
US 20170107206 A1 --> US 20170107206 A1
EP 2795605 B1 --> EP 2 795 605 B1
US 09700674 --> US 09/700,674
This is what I wrote
def punctuate(text, punctuations):
"""Given text and list of tuple(index, puncuation)
returns p... |
Problem
Given an array and a number \$t\$, write a function that determines if there exists a contiguous sub-array whose sum is \$t\$.
Source (Note that the URL may not link to the exact problem as it's from a quiz site, and questions seem to be randomly generated).
I was able to come up with a \$O(n^2)\$ solution, a... |
I needed to substitute variables of the syntax {FIRST_NAME} in a HTML template. The problem is that the template comes from a WYSIWYG system, and so the placeholders may be intermixed with HTML tags. For example in the following input, the {SECOND_NAME} placeholder should also be substituted, and the formatting tags in... |
I have a deviceList of more than 10k items and want to send data by calling another method.
I tried to use Parallel.Foreach but I'm not sure is this the correct way to do it.
I have published this webapp on azure,
I have tested this for 100 it works fine but for 10k it got timeout issue.
This is working code , I need ... |
I am working on a pseudo graphical interface for a Chess engine I wrote. I want to draw a colored Chess board with ASCII pieces. To abstract the pure std::cout << std::endl; I wrote this little class to organize an ASCII-character "framebuffer":
#include <iostream>
#include <sys/ioctl.h>
#include <unistd.h>
#include <v... |
I have googled and read many tutorials about fetching data and posting data to Rest API. But i have never seen a tutorial with how to handle the getting of new data after a POST or an PUT in a best practice way. So i experimented a bit and codes this. It is working but I don't know if it is the correct way of doing th... |
Problem
I've written a timer module in C for an SDL game. I'd like to get some eyeballs on. I wrote this for 2 requirements: I needed a timer that would signal on an elapsed interval, AND that was pausable and restartable. The timers in SDL signal a callback on a set interval, but they aren't pausable. I've seen other ... |
Class SectorController calculates weight coefficients for sector performances in equity exchange markets using minute data from an API (for instance, if a group of equities are up in the past 5 minutes, then coefficient is positive, if not, is negative, ranging from -1 to +1). Most of calculations are based on other sc... |
I'm working on a simple text based adventure game. I've just finished working on the character creation portion. The code works perfectly fine when run, but I would just like to get some feedback to ensure that it checks off from a professional and efficient standpoint.
The values of the materials, weapons, and spells ... |
I am currently study the basic data structure and trying to implement everything as I go. can anyone give me some feedback about class LinkedList how to make the code more elegant. any review are appreciated.
class Node(object):
def __init__(self, data, n=None):
self.val = data
self.next = n
... |
Code Review
I have two functions of styleAppend and getCss, which generate and append a style tag to a document.
Would you be so kind and review them and help me to possibly make it faster, simpler or more efficient? I'm hoping it would work with earlier versions of IE and other browsers.
styleAppend
/*style append*/... |
First, I am aware that this can be done in sklearn - I'm intentionally trying to do it myself.
I am trying to extract the eigenvectors from np.linalg.eig to form principal components. I am able to do it but I think there's a more elegant way. The part that is making it tricky is that, according to the documentation, th... |
Problem
This project gets the past ~20 days of an equity data (such as $AAPL, $AMZN, $GOOG) plus the current equity "quote" (which comes every 60 seconds using a free API) and estimates seven "real-time" future price targets. It only uses one main class, EQ and slowly does this task using a CRON job.
Code in the EQ cla... |
I have a list of strings. I need to list them in rows and columns. Each row should not have more than "cols" number of values. Each of the values in a given row should be "step" away from the previous value. The values should appear only once in the output. Here is what I have. Any better way to write this code?
cols =... |
I wanted to load every page under index.php with a simple index.php?do=login
For example when the link index.php?do=login or /login/ is opened, the file login.php is loaded (from outside public_html), and so everything is done under index.php instead of having a separate php file in public_html for each action!
This is... |
I have a problem similar to the question, namely reading in text which describes a date - in various formats. I want to use the parseTimeM function from Date.Time module in time package.
My current solution can probably be improved style wise but it should remain easy to read and easy to extend. Suggestion?
readDate3 ... |
BrainFreeze
This is my implementation of a brainfuck compiler in C. The instruction to build/run the project (GitHub repo) can be found here.
I am first converting the brainfuck source to x86 assembly and then using ld and as to generate the executable file (currently generates a 32 bit executable for linux only). I wa... |
I am experimenting with Perlin Noise and random map generation. I have a 2D numpy ndarray full of 16-bit floats called map_list that I call from the singleton ST. It has 900 rows with 1600 elements each. I am iterating through it to display different colored pixels to represent terrain at different points in the map. A... |
Please review my serial port class written in C++. It is completely asynchronous, ie event driven. My idea for later is to inherit from this a sync_serial, where timeouts can be specified and it waits for responses. But that is not the purpose of this review. It is Windows only and I have tested on a Conexant voice... |
I have tried to write a large string (~100-120 Kb of HTML) on an md file, and am pretty sure it's not the fastest method, even though it only has to iterate ~8000-10,000 times and few times per hour.
There is also a low (~1%-2%) probability that the target filename has an old name (previousName), not exactly matched wi... |
This takes a user password, hashes password to SHA1 and does a check against the Pwnedpasswords database.
I know I need to use unwrap less and do more real checking to improve the clarity of errors. In what other places is my code lacking and what should I learn or look at to improve in the future.
The current resource... |
I wrote a script using Python that gets data from several sources (news sites, Twitter, Yahoo), puts it into a dict and then formats it as a string to be sent through email.
I wonder if there is possibility to write the code more neatly in a shorter way. Maybe I'm doing some steps that are a bit unnecessary and maybe f... |
I am a hobbyist computer programmer trying to learn modern C++ (in this case C++17). I thought it might be an interesting challenge to write a Binary Search Tree similar to std::map while using heap-like array structure to store the elements of the tree such that the index of the parent node is always half that of the ... |
I decided to write a function divisorSum that sums the divisors of number. For instance 1, 2, 3 and 6 divide 6 evenly so:
$$ \sigma(6) = 1 + 2 + 3 + 6= 12 $$
I decided to use Euler's recurrence relation to calculate the sum of divisors:
$$\sigma(n) = \sigma(n-1) + \sigma(n-2) - \sigma(n-5) - \sigma(n-7) + \sigma(n-12) ... |
Background
I decided to write build script as a gentle introduction to PowerShell. It builds and packages this Go application, which is an internal tool I decided to open source, and not the focus of this review.
This script is used primarily for packaging artifacts for release.
My approach
The script below gets, vets ... |
I wrote this program to check the number of times that each letter appears in a string input by the user. It works fine, but is there a more efficient or alternative solution of going about this task than reiterating through a twenty-six-element-long array for every single character?
import java.util.Scanner;
public cl... |
This is a practice problem on Kattis
I have exceeded the time limit for the 5th out of 11 test case. Can anyone inspire me what could be done to optimize the code?
Problem Description
Quido plans to send a New Year greeting to his friend Hugo. He has
recently acquired access to an advanced high-precision plotter and... |
I would like to define some constant sequences (of bytes, specifically) in my C# library/API. Both length and content should not vary, preferably by any means (barring reflection). To this end, a byte[] array would not be sufficient, and a ReadOnlyCollection<T> can still be mutated. I have not done a full comparison ye... |
Application Logic
I wrote a web scraper that store some football data inside my database. Those data need to be update if 7 days are passed since the last update.
I have three types of record:
Team
Season
Player
The table structure of those records is essentially this:
id | season_id | update_at
only the second colu... |
This is my implementation of lowest common ancestor problem,I tried to solve it using square root decomposition
pre processing time : O(n)
query time:O(sqrt(h))
h -> height of tree
This was LCA on spoj
Well i added comments in my code and
My approach very well explained here with every line of code https://www.gee... |
I just started learning programming a few months ago, and I'm intrigued by Haskell. To learn a bit I tried to adapt some code I have in Java so I can see what are equivalent solutions in Haskell.
The problem I had was to see how many different numbers can be “represented” by a string of roman numbers (0, .., 9, where X... |
I found a couple of similar questions, but they were mostly outdated.
Here's the problem: create a flat array from the values in several arrays contained in several nested objects.
const data = [
{ id: 1, items: ['one', 'two', 'three'] },
{ id: 2, items: ['two', 'one', 'four'] },
]
Expected result const result = ... |
I am trying to implement a bank account with Java in a thread safe way. My code looks like:
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* Class to represent an account, it also provides with ... |
I am aware that my VBA code can be improved.I would like to standardize and reduce repeating same procedures. Can I have some guide lines for this? Where to start? I would be glad to have some examples from you! I would like to learn to write code more efficiently. Also does this will improve efficiency too?
' Color_c... |
I've created the following code to try and find the optimum "diet" from a game called Eco. The maximum amount of calories you can have is 3000, as shown with MAXCALORIES.
Is there any way to make this code faster, since the time predicted for this code to compute 3000 calories is well over a few hundred years.
Note: I... |
I was asked to code a TextPad with following functionality:
display() – to display the entire content
display(n, m) – to display from line n to m
insert(n, text) – to insert text at line n
delete(n) – delete line n
delete(n, m) – delete from line n to m
copy(n, m) – copy contents from line n to m to clipboard
paste(... |
This is my implementation of a hash function described below. The (compiled) program can be run as follows:
$ java Hash1 < input.txt
The program reads a text file (of any size) with 8-digit student numbers on each line, splits each number into three numbers such that they have 3, 3 and 2 digits and then sums these num... |
Recently, I became very interested in a probability practice problem in my textbook for my class. I decided to implement it in code and I think I got most of it implemented. Right now, I'm hoping to see if there is any possible way that I can improve upon it.
The question reads as follows:
A particle starts at (0, 0)... |
I have forked a previous version of my script, critiqued here: Generate public/private keys, encrypt, decrypt, sign, verify
This program allows you to encrypt and decrypt raw files using RSA keys generated by the program. When generating the key pairs, the private key gets protected with aes 256.
I'm fond of the prime ... |
I want to write my snake game procedurally, using as much windows call as I can so as to practice. Looking into GetAsyncKeyState to capture keyboard inputs and play sound functions. Also making a sweet user interface. Fun!
Also shout to bytecomb for providing example as to how to traverse the array structure, used his ... |
This Python script does following activities:
clone repo, as provided from the list
creating a new branch "jenkinsMigrate"
rename Jenkinsfile to Jenkinsfile.migrate
push code to GitHub in a new branch.
NOTE: credentials were configured already.
import git
import os
import subprocess
gitUrl = "https://*****"
cwd = "... |
I have a Vue.js computed property as follows.
odds() {
if(this.course && this.time && this.runner) {
let race = this.data.events.runners.filter(item => item.course === this.course && item.time === this.time)
let runner = race[0].data.filter(item => item.name === this.runner)
return runner[0].odds
... |
I want to convert an integer to a perfect square by multiplying it by some number. That number is the product of all the prime factors of the number which not appear an even number of times. Example 12 = 2 x 2 x 3; 2 appears twice (even number of times) but 3 just once (odd number of times), so the number I need to mul... |
An exam requires me to create a program for an interactive board for an auction:
An auction company has an interactive auction board at their sale rooms, which allows buyers to place bids at any time during the
auction. Before the auction starts, the sellers place their items in
the sale room with a unique number att... |
Link: https://www.hackerrank.com/contests/hackerrank-all-womens-codesprint-2019/challenges/name-the-product/
Problem
You are contesting to name a new product in your company given the following conditions:
You are given an array of \$n\$ different names, \$names\$, where \$names_i\$ denotes the \$i^{th}\$ name and al... |
I have a method that works perfectly well and does what it's supposed to, albeit a little slow (30 - 40 seconds). I would like to be able to speed it up or at least make it more efficient, any ideas please?
The purpose is to generate a list of which customers are buying the top requested (topN) lines from a supplier. ... |
I wrote the following code to deal with possible network problems.
def getPage(browser: Browser, page: String): Document =
{
var attempts = 5
while (attempts > 0) {
try {
return browser.get(page)
} catch {
case ste: java.net.SocketTimeoutException if attempts == 1 => ... |
I have created this login script for a website I'm making; basically I want to make it as secure as possible, but also I want it to keep users logged in for 30 minutes. For example if I've logged in but accidentally go back to the login page for some reason I want it to recognise I've already logged in and take me to t... |
Looking for hints on style and clarity re. below. While I'm not saying speed is irrelevant, it's less of a priority than style & avoiding bad habits at this point. Focus is on clean use of fundamentals of the language.
Summary of task:
Take a list and return a list indicating the number of times each (eql)
element... |
In my WordPress theme I have built a function that uses Isotope Layout by Metafizzy to accomplish filtering and sorting.
I have used a mix of AJAX and JQuery to accomplish this, however I feel the code is very repetitive and potentially overly long.
/**
* Get posts using AJAX
*/
jQuery(document).ready(function ($) {
... |
I'm trying to implement a free list by using a std::vector as its growable buffer. The reason I made this instead of just adding/removing elements directly into a vector, is because I'd like the indices to remain valid after an item is removed. Please take a look at the code below. I think it works pretty well with my ... |
I have a loop which insert rows on specific cases. The loop goes through ~2000 rows and insert about 500.
Due to the inserted rows it doesn't loop the full range I want. I have solved that problem by counting the number of row I will insert with a first loop and then looping up to LastRow + Counter.
I feel as if there ... |
I am searching for an optimization solution, which is a 8d vector representing 4 complex elements, where each element is within the complex circle with maximal radius 1.2.
The objective function is:
$$f: \left\|\mathbf{c}_{ref}-\mathbf{c}\right\|_{2}+\left|2-\|\mathbf{c}\|_{2}\right|$$
I am using the scipy.optimize.bas... |
Link: https://www.hackerrank.com/contests/hackerrank-all-womens-codesprint-2019/challenges/visually-balanced-sections/problem
Problem Description
A rack has \$n\$ horizontal compartments. The leftmost compartment is the \$1^{st}\$ compartment and the rightmost compartment is the \$n^{th}\$ compartment. Each of the co... |
This is in continuation with my synchronized implementation of a bank account in Java. I am trying to implement bank accounts repository and method to transfer money from one account to another. My implementation for the account and the repository looks like:
Account:
import java.math.BigDecimal;
import java.math.Round... |
So I am trying to implement a menu in a program I am writing. My goal is to have zero errors when collecting user input. So I thought the best way to validate was to capture the input as a string and then test against it and prompt for input again until it is valid.
As far as I can tell, my code works as I want it to. ... |
After a bit of a break away from any coding, I decided to return with something simple. As I haven't done much of GUI programming with python, and I would like to do more, I decided to make a simple calculator. If anyone is so kind, I'd like some feedback on anything that might be improved. If it makes a difference in ... |
I am making a code with basic RSA encryption/decryption. My professor wants me to speed up this function but it is already so simple and I am lost. Any ideas?
def decrypt(kenc,d,n):
kdec=(kenc**d)%n
return kdec
|
I tried to learn Python during the weekend and after getting some knowledge decided to make a small rock-paper-scissors game. I would be grateful for your input on how I could improve my code. All feedback is highly appreciated.
import random
def round_winner(choice):
ai_chosen = str(random.randint(1, 3))
pri... |
I am developing another bigger project, I want to try a simple DatingApp and currently I try to develop a Login and Registration Form. There is no special register / login button, the code will later decide wether email is registered (-> login) or not (-> register). But even though it's working I am not sure if I make ... |
A Java program that writes each digit on a new line, from 1 to max integer. We should end up with 2.4 Billion lines. After looping to near the maximum integer, the text file becomes really huge. Like 55gb after running for 16 minutes. How can I optimize it to be faster, and also reduce the file size?
Below is the code... |
So I decided to make a more efficient solution to a Google interview question where they ask you to either find the lowest or second lowest value in an array without using the max or min methods. I believe it is more efficient because you can use my method to find any nth lowest value in the array so it solves for all ... |
Regarding the use of the file system as a database to simply hold JSON files.
Any input on this matter from people who know will be appreciated...
class JDB{
public $path;
function JDB( $path = __DIR__.'/jdb/' ){
$this->path = $path;
if( !file_exists($this->path) ) mkdir($this->path);
}
... |
There is no intended end use for this. It is for learning and development only.
I got carried away following an example and ended up with a miniaturised vehicle registration system. You can bulk generate records, each of which is given a unique registration number in keeping with British registration format. I've writt... |
I have a matrix of fewer than 1021 rows. I'd like to take its transpose, but it is too big for GNU datamash and awk solutions to fit into memory.
To keep memory overhead low, my thought is that I keep a list of read-only file pointers to the start of each row. I then read out bytes from each pointer until I hit a delim... |
I wrote a script to fetch the location for the ISS using two simple APIs.
This is my first time writing a python script. Any advice or modifications would be highly appreciated. How is the code, and where are the areas I can improve upon?
This code is also on GitHub.
import urllib.request # to make requests to the api
... |
The problem is to take a list of integers and map them to another list containing those integers added to their respective position in the list.
Example runs with required outputs:
> (pos+ '(1 1 1 1))
(1 2 3 4)
> (pos+ '(7 5 1 4))
(7 6 3 7)
We are required to develop three alternate solutions. One using recursion, one... |
i am currently learning to do things with vanilla Javascript. No plugins, libraries or code snippets. I want to do things on my own, so that I understand 100% of what is happening.
I wrote a little script which checks, if a section of the page is in view.
Now, the script works as expected, but I was wondering, if I had... |
I have question about my code. It should swap words from an array into an HTML Element and it does so like expected. However, I was wondering about the style of my code. I would like to get some feedback on how to improve the code.
Javascript
const words = [
"Webdesigner",
"Frontend Entwickler",
"Webentwick... |
I am working on a program that checks for the browser support of a CSS file. Below you can find my working code, so far it supports CSS At-Rules & Properties. In the next few weeks, I will need to expand this code so that I can slowly support the entire language.
I am trying to come up with a readable and efficient sys... |
I'm putting together a basic web app in .NET core 2.1 MVC to try and better understand how it works. Currently I'm working on returning validation to the UI. Once I have this working I then want to use the same service class for a Web API front end too.
Currently the Create Action in the Controller calls the service la... |
I've recently vectorized most of the code for an optimization problem but this one still eludes me. As the procedure and not the actual values are important here, I have replaced the original matrices with random dummies.
Problem:
Given a matrix A of shape (m x n) and a three dimensional matrix B of shape (n x (n-1)*r ... |
I want to create a RESTful API with Apache/PHP and the Slim Framework (3.x). The API should support URI-based versioning like <host>/rest/api/v1/<resource> and <host>/rest/api/latest/<resource>.
Overall I found a solution which works, but I not really happy with my solution and I'm want to known what can I make better.... |
I´m currently working on a small microservice application, which will in it´s simplest form just receive a Request from a Formular and and based on containing information perform several other Server-request to different API´s using the Fetch API.
For now I´m just about to create a prototype that contains the Applicati... |
I've been working on a library that includes a list-like structure, which I use internally multiple times to store different types of structs. However, I'm not entirely confident with my ability to safely manage memory in C yet, so I'd appreciate if someone could let me know if there's anything wrong with my code (it s... |
Here is my TCP socket that sends eight images per second to a connected Client.
The images are taken from a thermal camera.
static void HandleServer()
{
Console.WriteLine("Server is starting...");
byte[] data = new byte[1024];
IPEndPoint ipep = new IPEndPoint(IPAddress.Any, ... |
I am looking for a undo redo system that allows me to log changes of properties.
After searching a bit I found the memento pattern.
I took the idea and wrote it in my classes:
Basic Structure:
public class Face
{
List<Vertex> vertices;
}
public class Vertex : ValueLog<Vertex>
{
Vector3 _position;
public ... |
I found an optimization problem written in Finnish but I will translate it into English. The following is an example case.
I have \$n=120\$ lamps in a circle, and enumerated by \$L_1,…,L_{120}\$. Some of
them are switched on and some of them are switched off. I also have
been given a positive integer \$m=7\$. One ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.