instruction stringlengths 71 95.1k |
|---|
I have a function like this
def findById(id: UUID): Future[Option[Item]]
case class Item(subject: String)
Now I want to retrieve the subject if the item exists else I want the subject to be empty string.
val subject: Future[String] = repository
.findById(someId)
.map(_.map(i => i.subject))
.map(_.getOrElse(""))... |
I have a getter in my vuex module which gets data from a nested object, then check if there is any key match to the string and push these matched objects into an array. ESLint says that for..in loops iterate over the entire prototype chain, which is virtually never what I want. Its suggests to use Object.{keys,values,e... |
As part of learning Haskell, I'm solving few problems, usually solved imperatively.
I've come up with a naive solution for the problem described here, which is to find a sequence in which to burst a row of balloons that will earn the maximum number of coins. Each time balloon \$i\$ is burst, we earn \$C_{i-1} \cdot C_... |
I have a tree structure where at every node there is a list of documents (document length can vary from 5 to 500), and each document contains a number of words.
I want to calculate relative frequency of each word at a particular node by taking the ratio between the percentage of time that word appears in all the docume... |
My teacher gave us an exercise. We have to sort as quickly as possible. The fastest one gets a reward. On my own system, I am sorting 125000 words within 1.2 seconds. On my teacher's system that is 0.6s.
In my main.cpp I wrote the following code:
#include "FileStructure.h"
#include "Value.h"
template<typename T>
T* Me... |
I created an example of a simple form for a last name input in React, where I can check the validation of the data at the time of input. The last name should contain only small and capital letters. If the user enters other characters, the error text is displayed. I will be grateful for tips on improving the style.
inde... |
This is a simple 2D rendering abstraction that I've been using for my game. It's basically a vector of quads. It has functions for defining quads (position, rotation, texture coordinates) and a function to render the quads using my OpenGL rendering abstraction. I had to comment out the render function because it depend... |
The following is a summary from the top of my head so please correct me if I'm wrong. See the Wikipedia article for more.
This is about determining the (score / edit distance of the) most similar substrings of two given strings.
For example, given the two sequences
TGTTACGG and
GGTTGACTA
the optimal (w.r.t. to a certa... |
I created an example of a simple form for multiple inputs (name and phone number) in React. If the user enters invalid data in input field, error text is displayed near the same field. I learned a lot of different examples of the form validation using React and I don't understand where is the better place for validatio... |
What I'm trying to achieve is the following:
Given a Map, where the values may contain duplicates, I want to change the values so that they are incrementing by 1, starting from 1.
Example:
{"One"=1, "Three"=3, "Another three"=3, "Seven"=7} should result in:
{"One"=1, "Three"=2, "Another three"=2, "Seven"=3}
I do this n... |
This follows from a post I made here. I made changes according to the answer I accepted in the following link. I tried to make all the changes necessary that I could. I just want to see if there are any other further adjustments that I need to have for this generic single linked list.
Here is my header file:
#ifndef Li... |
This is a pong style game which is very basic but involves sending and receiving data using TCP. The data is encoded using pickle which seems to be very inefficient yet I am still using it.
The Server:
The server calculates the new positions of the paddles and balls depending on the inputs from each player.
import soc... |
I didn't make it to the next stage in this interview process, because another applicant did better than me, which wasn't surprising given that this was my first foray into Node.js.
I'd like some tips on how I could have made this a better submission, and also more generally I'd like to know how I could do things more i... |
I have a bidimensional array like this:
const bArray =
[ [ 'Hello World',
'Hi everybody',
'How are you?'
],
[ { text: 'Hola Mundo',
from: [Object],
raw: '' },
{ text: 'Hola a todos',
from: [Object],
raw: '' },
{ text: 'Cómo estás?',
from: [Object],
raw: '' },
]... |
I'm trying to find all possible paths made of 0 from bottom left to top right, only by moving either up or to the right. The input file contains a grid of characters, where 1 represents an obstacle and 0 represents a vacant cell.
The problem I have is the code not finishing/ taking too long. The code works correctly wi... |
Continuing where I left off previously to solve the problem described here, I've now solved the same using dynamic programming (following Tikhon Jelvis blog on DP).
To refresh, the challenge is to find a sequence in which to burst a row of balloons that will earn the maximum number of coins. Each time balloon \$i\$ is ... |
Summary: a templated class, whose main purpose is to store a binary representation of a decimal number. I choose array of booleans as a storage, since bitset was forbidden. One of the requirements was to overload every arithmetic operation, i.e. every operation should be bitwise.
Note: at this moment relational operat... |
I wrote a matrix library to replace my old matrix library. I was using my old matrix library to do basic operations for 3D rendering but that library grew old and now I'm seeking to replace it. I'm mostly looking for comfort while writing code and I want to know what you think about the coding style and the simplicity ... |
I'm practicing to write c++11/14 and I implemented a RW lock. Does everything look ok?
class RWLock {
public:
void readLock() {
std::unique_lock<std::mutex> lock(mutex);
waitingReaders.wait(lock, [this]{!writer && queuedWriters == 0});
++readers;
}
void readUnlock() {
std::unique_lock<std::mutex> lock(... |
In a Ruby on Rails application I want to have this routing:
for URL www.example.com/reports go to controller documents and action reports
for URL www.example.com/charts go to controller documents and action charts
In the routes.rb file I currently have:
scope controller: :documents do
get 'reports' => :reports
ge... |
I have a set of functions that retrieve words from some arbitrary dictionary based on what letters they have. For example, this function gets words that use only the specified letters:
function getWordsWithOnlySpecifiedLetters(array $dictionary, string $letters)
{
foreach ($dictionary as $key => $value) {
i... |
I've created 3 different charts all drawn from the same dataset,
my reasoning for building it this way is so that it'll be easier to add and remove additional rows of charts.
What I'm mainly interested in knowing is if the code is well structured and/or if it's idiomatic d3 code.
Here's a link to all the code: Plunke... |
This is a simple script which inserts data into a couple of tables. I'm very new to SQL so any feeback, of any kind, would be much appreciated!
DECLARE
@Model_ID INT
, @ModelVersion VARCHAR(10)
, @ExistsInDM INT
, @IsActive BIT
SET @ModelVersion = '2.46.7' -- new version number
SET @IsActive = '1'
... |
I've created a small tool that fetches and stores the newest self-posts from a specific subreddit. The posts are stored in a redis store.
I'm going to write another couple of applications at a future date that will read from the redis store. I will want to be able to pick from the stored posts at random.
This is one of... |
I have to store some temporal meta data used primarily in bulk processing of a time-series (sensor measurements).
Each value of this meta data is valid for a potentially half-open range of time.
These valid time ranges can be set up ahead of time, and changed for past periods of times.
This is basically the SQL 2011 "A... |
This is my first time using RxJS (or any observable library). It seems to work okay but I'm not sure about best practices.
The thing that I am most unsure about is subscribing to the observable multiple times. I couldn't decide if it would be better to subscribe to it once with one big function, or to use many smaller ... |
I am trying to write a function in Go which adds an uint64 value and an int64 value and which detects whether the result can be represented as an uint64.
func addUintInt64(x uint64, y int64) (uint64, bool) {
if y >= 0 {
z := x + uint64(y)
if z < x {
return 0, false
}
retu... |
I have some code that is used to convert a decimal currency to an integer with precision being a function of which currency is being converted.
This code is more of a "brute-force" method to do the conversion and just doesn't feel right to me. Is there a better way to achieve the result?
public static int CurrencyT... |
I was refactoring some of my utility code modules used in my test projects, and wanted to apply my knowledge of clean OOP design patterns and SOLID principles to make these modules more useful and easier to use.
I have an interface called IFtpFileCleaner:
/// <summary>
/// Responsible for deleting a single file located... |
Me and a couple of mates sometimes play a game called Warhammer.
When playing the game you have options of what each model attacks.
This can lead to situations where you know if you shoot with 100% of your units into one enemy unit you know the unit will be killed, but you don't know how many you should fire to kill th... |
I'm learning clojure. A while back I made a python bank account for my kids, teaching them to save. Have a look here.
The Python one was a class and it created a table that had a little interest function that showed what their money will do if it sits there. Needless to say that teenagers are not impressed even by 15% ... |
I am solving interview questions from here.
Problem : Given a N cross M matrix in which each row is sorted, find the overall median of the matrix. Assume N*M is odd.
Note: No extra memory is allowed.
For example:
Matrix= [1, 3, 5]
[2, 6, 9]
[3, 6, 9]
A = [1, 2, 3, 3, 5, 6, 6, 9, 9]
Me... |
The given code gives correct output but exceeds the time limit and I have no idea how to optimize it. I know it is of \$O(n^2)\$ complexity but I am not able to get anywhere near to optimizing it. Even a few hints would be appreciated.
The question is this:
The problem is given an array \$A\$ having \$N\$ integers, fo... |
I'm creating a mini game for Android inspired by space invaders and Moon Patrol. I have completed the important part except for collision detection. Before I do collision detection I want to clean the code and make it more idiomatic but I am not sure how. It has several global variables and difficult to read and with ... |
I'm learning iOS through this past Stanford CS193P course. I've just completed the first assignment and would love a code review as I can't actually turn in an assignment for feedback since the course has already completed.
The requirements can be found here but any suggestions on best practices and my implantation wou... |
Here's my function that creates a bitmap file from an array of pixels. It can write a bitmap both with transparency and without transparency. Please review my code and give constructive criticism on how to increase the overall quality of it. :)
typedef unsigned char BYTE;
inline int bmpEncoder(const std::string &lo... |
I'm getting started on template meta-programming and I wrote a template to compute compile-time positive and negative float powers of 2. I would like some feedback on readability and overall code complexity as I feel like I might be defining too many structures for such a simple computation. The code has to be C++98 co... |
I was trying to answer a question on Stack Overflow found here. I took the idea that the OP was trying to do and I wrote my own program based off of their question. I was trying to provide the user with some tips and suggestions while illustrating some of the similarities and differences between C and C++. My goal was... |
Here is a sample code to explain the approach I am going for.
public class LogWriter
{
#region Private Members
// If writer is not static class, still need to keep single message list; same for other members
private static ConcurrentQueue<string> _logMessages = new ConcurrentQueue<string>();
private s... |
Is there a way to simplify this function? I tried to use the std::min_element function inside the lambda, but i don't get it to work with *var.
const auto miniFunc = [](const std::vector<std::vector<KEntryContact>> & entryContact, double KEntryContact::*var) -> double
{
double min = DBL_MAX;
for (const std::vec... |
Background:
I have been working on a service which allows users to signup on different apps and on each login checks if the request is valid or not based on a series of checks.
The below snippet is small part of the whole application but covers my question and is working fine for now:
Code:
'use strict';
const bcrypt ... |
I have the following query that counts the number of vessels in each zone for each week:
SELECT zone, DATE_FORMAT(creation_date, '%Y%u') AS date, COUNT(DISTINCT vessel_imo) AS vessel_count FROM vessel_position
WHERE zone IS NOT NULL
AND creation_date >= DATE_SUB(CURDATE(), INTERVAL 12 MONTH)
GROUP BY zone, date;
The t... |
I try to write a GUI for practicing with one Window, containing two frames in a ttk.Notebook. Each of these Custom Widget Frames should have a scrollbar and the MouseWheel bound to a yscroll for the canvas which is placed in this frame.
My questions are:
- Is this a common/recommended way to do that?
- If I do it like... |
I have a function add that adds two lists of integers:
add [1, 2] [4, 5, 8] == [4, 7, 0]
add [9, 8, 9] [1, 3] == [1, 0, 0, 2]
I know that Integer from Prelude is already arbitrary large, I'm reinventing the wheel for exercise.
Here's the code:
import Data.Int(Int8)
-- Adds two integer lists.
-- Examples:
-- add [1, 2... |
In my current project I found the need to concurrently track the progress of multiple concurrent components, and having all of them output their (debug) information into a single console window made things very unorganised. So I wrote this little library so I can now display each component's output in a dedicated conso... |
What am I trying to do
I'm trying to scan a disk and save (cache) all the paths of files and directories into an array so that I could perform a quick file/directory search later on.
Implementation
I'm using a Node.js module called walkdir.
cacheDisk () {
let searchDir = 'C:/'
let cache = []
let options = {
... |
I'm new around here and want to involve myself with fellow developers and hopefully improve my skills here while attempting to help in any way I can with the knowledge I have so far. I'm a new Python programmer, been on and off it for years but have stuck to it recently officially.
I plan on making a career off of deve... |
This is the 2nd half of my Memory game. The first half can be found here. The repository can be found on Github.
I am using SFML 2.4.2. In this project I focused on a few key aspects of design and development.
Top-down Design
DRY & SRP
Encapsulation & Abstraction
In an effort to eliminate magic numbers I shoved all o... |
I decided to study EventEmitter and play around with it in React JS for on example of a simple form.
I built EventEmitter and added event 'newdata' to it. On event 'newdata' is called function where the data for form's rendering changes. Then event 'newdata' is emitted with the new data.
I repeated emitting of event us... |
I'm using Laravel 5.6 and MySQL. I need to search multiple columns for a single word or multiple words (e.g., "camhandle", "cam handle").
The way I was originally doing it was just using column like %$request->keyword% but if I typed in "cam handle" it wasn't returning results matching "camhandle". So I had to search w... |
Challenge Story:
"7777...8?!??!", exclaimed Bob, "I missed it again! Argh!" Every time there's an interesting number coming up, he notices and then promptly forgets. Who doesn't like catching those one-off interesting mileage numbers?
Let's make it so Bob never misses another interesting number. We've hacked into hi... |
I have written code in Kotlin with the objective of computing Pi in few enough lines so that it looks good on a t-shirt.
Can be cut and paste into http://try.kotlinlang.org under "My Programs" and run from browser - I just tested it with version 1.2.41 and it's working.
import kotlin.math.*
import java.math.BigInteger ... |
Introduction
I started going through some basic algorithms as I'll have algorithms course next semester. The last time I've written any heap operations is around 5 years ago. This time around it took me an hour to debug the case where the right child wouldn't exist, but left child did. Otherwise it was straightforward.... |
I am a mathematician trying to learn how to become a better programmer in C++. I am currently now trying to write the main data structures from scratch. I have now completed a generic array class and I wanted to see if I was missing anything or if there is anything I can improve on.
Here is the header file:
#ifndef Arr... |
I started playing around recently with F# and I find it quite elegant and succinct language.
A common problem I like to solve in every language I start to learn is the coin flip problem, with the code below being the solution to this particular problem.
What the code does is to flip a coin N times and perform M tests f... |
I have this method that takes a list of my individuals (class has public field fitnessValue). I sum all fitnessValue and then draw a random value between 0 and sum of fitnessValue. In the end, I check for each individual where cumulative sum of fitnessValue passes the point I counted before and return the one which pas... |
I'm given N integers. I need to find the maximum number of unique integers among all the possible contiguous subarrays of size M.
Scanner in = new Scanner(System.in);
Deque deque = new ArrayDeque<Integer>();
int n = in.nextInt();
int m = in.nextInt();
in.nextLine();
String s = in.nextLine();
in.close();
int maxUnique ... |
After cleaning up & some refactoring, one module of my code became like below.
However, I'm feeling like there's still some unnecessary redundancy, and it can be improved further and look neater.
But I can't come up with exactly how to do it.
'use strict';
// === showing the execution context ==============
const e... |
I made this to track my variable changes while I experiment in Python. I tend to use the same variable names and fit different values to them so it's nice to be able to see what I've tried, especially if I'm constructing a huge code block.
I copy text onto my clipboard before starting this code.The code asks for the va... |
I am writing a script to automate the install and configuration of vim, zsh, ohmyzsh and tmux, on a Linux/Mac. I'd like to perform all operations in Python, rather than using subprocess to streamline some of the operations (e.g. git clone).
I would also like to use this script as an example to myself of good Python co... |
I have the following script which works, but takes a lot of time to run on a worksheet with 2000+ rows. Anyone know of a way to speed it up?
The code runs through the workbook and ignores the pages I do not want it to touch. Then, it runs through any pages that I want it to, looks for rows with a zero in column C and C... |
I'm developing programs on Golang. But now you have to study at the university and have the following task.
Calculate the continued fraction using the function indicators. The
number of fractional elements must be specified from the keyboard. 1 +
1 / (1 + 1 / (1 + 1 / (1 + 1 / ....))). The number of elements of th... |
This code returns a list of widgets from spreadsheet ranges that are enabled for processing. The code works but it is poorly implemented, especially in terms of proper use of zip and layout.
The code needs to run on various ranges but was initially hard-coded for development. In openpyxl row/column processing is more e... |
Here's a simple LCG that I've made to learn a bit more about pseudo random number generation.
Is this implementation correct, and if so, how can I improve it further?
The following code is self contained and it should run without problems.
#include <chrono>
#include <iostream>
#include <map>
namespace Random {
cla... |
Because I don't want to download an entire library for a single function (which I do understand, was made better than I made mine), I decided to implement my own string formatting function.
I am not very proud of it, as I find it pretty ugly and unreadable.
This is only a string formatter with string-only arguments.
... |
I had an interview with a global company yesterday. They had given me a programming assignment. I shared my screen and I must have finished the task in 1.5 hours.
Task was programming Reverse Polish Notation calculator in Java. I had developed as I shared my code below. I was rejected by not being stick to KISS and DR... |
I am solving interview questions from here.
Problem : Print concentric rectangular pattern in a 2d matrix. The outermost rectangle is formed by A, then the next outermost is formed by A-1 and so on. You will be given number as an argument to the function you need to implement, and you need to return a 2D array.
Exampl... |
I've used Abstract classes and static methods wherever they seemed to be convenient. I've serialized the hashmap entry and read/write it from/to a file.
Please review my code and point me to the mistakes I made. How far away am I from writing production quality code? What are the major drawbacks in my code/design?
impo... |
I want to distinguish between people who have likes to posts and those who have dislikes. I want to find a way to improve my code without thinking it is efficient.
<% if current_user.voted_up_on? @post %>
<%= link_to "LIKE #{@post.get_upvotes.size}", like_post_path(@post), method: :post, class: "btn btn-outline-prima... |
I want to get familiar with PyTorch and decided to implement a simple neural network that is essentially a logistic regression classifier to solve the Dogs vs. Cats problem.
I move 5000 random examples out of the 25000 in total to the test set, so the train/test split is 80/20.
I was able to achieve the accuracy of 59 ... |
This is the adder method of my binary calculator. I did not cover for the case that someone passes a non binary number into the calculator yet.
I am pretty sure I have covered every other edge case for the calculator. I am trying to learn refactoring and how to look for simpler ways to do things. I know that I have a ... |
I created a script to scrape this website and gather the eclipse data (date, type, and location):
class Eclipse():
def __init__(self, eclipse_date, eclipse_type, eclipse_location):
self._eclipse_date = eclipse_date
self._eclipse_type = eclipse_type
self._eclipse_location = eclipse_location
... |
What I'm hoping my code is doing is instead of making 99 comparisons on every pass of a 100 element array, it will now make 98 comparisons on the second pass, 97 on the third pass and so on and thus decreasing the iteration through the array.
st.Reset();
st.Start();
double temp;
for (int pass = 1; pass < _arr.Length - ... |
I am writing a program that compresses and decompresses data using the Huffman Coding algorithm.
About compression: this program will export 2 files: header file (contains characters' frequency for re-constructing the Huffman Code Tree for decompressing data) and actual compressed data.
About decompression: After join... |
I'd like to write a function to split strings in C++ to check my template learning. I've also read some relavent questions in this site but most of them don't use templates or string_view. A related question in StackOverflow I asked is here.
My goal is to write a function such that:
The function can split std::basic_s... |
I am writing an interpreter for a simple mathematical programming language.
Below is a simple program written in it that prints 41.22:
let $x = 35; # This is a comment
$x + 6.22;
Below is the code for the lexer. As this is my first attempt at writing an interpreter, I would appreciate any general suggestions for impro... |
The exercise is from a Java-course in which I'm enrolled.
The classes Book and APIResponseParser were provided by the instructor.
For Book I had to add just a few getter- and setter-methods.
For APIResponseParser the instance-version of parse() had to be written. The static version of parse() had to be completed. Ple... |
A Factory Pattern or Factory Method Pattern says that just define an interface or abstract class for creating an object but let the subclasses decide which class to instantiate. In other words, subclasses are responsible to create the instance of the class.
Advantage of Factory Design Pattern
Factory Method Pattern all... |
I am trying to implement an efficient collision detection between a line joining two points and a bitmap mask.
Example:
Currently I am using Bresenham's line drawing algorithm to draw each pixel of the line between the two points and comparing that pixel with the bitmap (If the pixel is black return true else continue... |
Given an array of integers arr where each element is at most k places
away from its sorted position, code an efficient function
sortKMessedArray that sorts arr. For instance, for an input array of
size 10 and k = 2, an element belonging to index 6 in the sorted array
will be located at either index 4, 5, 6, 7 ... |
I'm going to write a Huffman Coding implementation, and decided to write from scratch a priority queue to help out. I've never written a priority queue before, in any language, so this was interesting.
After mulling over the design for a bit, I finally settled on a linked list design. The queue is essentially just a li... |
Given a multiset (i.e., allow repeated elements), enumerate all distinct multi-subsets without using itertools(order is not important).
Example: Let s = 'a,a,b' then print to the console,
a
a,a
b
a,b
a,a,b
I am wondering if my approach (presented below) is efficient, and would appreciate stylistic advice. For example,... |
I am trying to create a validator abstraction layer. These are the points I am trying to achieve:
My abstraction should be open for extension but closed for modification
The clients should not have a if...else block to handle success or failure scenario.
Validation statuses
public interface ValidationStatus {
def... |
I'm trying out some different programming styles to experiment with the new C++ concepts. Within the experiment I was looking into how constexpr could be helpful for writing unit tests at compile time.
This code represents a single cell in a Sudoku, where this cell is represented as some kind of bitset with true/false ... |
I use the native crypto . I use the pbkdf2 and the randomBytes for salting, and the timingSafeEqual to check for the password validity when logging in.
I wrote the following functions, based on various examples and the aforementioned APIs and functions. Here is my code
(stack : node 8.11.1 + express 4.16.3 + PostgreSQL... |
I've been studying C++ (my first language) for about two months with books and Udemy courses. I would like some comments about my first real project that I put together for my teacher.
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
class Caesar {
private:
int userChoic... |
This is my example program for a single commodity market. It's meant to demonstrate filling of orders for a single product. Right now it doesn't deal with anything more than updating quantities, I plan to implement remaining money and money received. I would like feedback about my use of typedefs, and any way to better... |
I've been using logging libraries recently and somebody told me to try and write my own. I've kept it minimal but the only drawback is I can't log in static classes, due to TClass.
Follow-up
I'm looking for constructive criticism on how to improve it.
How do I declare a logger variable?
private static readonly Logger... |
I'm a junior developer and I've recently created a simple npm module that was designed to allow users to create Sets of objects in JavaScript. This was done by implementing a single class ObjectSet that would provide all of the functionality that I needed. This class made use of an attribute called innerMap that I woul... |
I've asked a question about this particular code before, although it was a little different back then. I took the suggestions from people who replied to my question and decided to post a follow up to that question, in attempt to improve the class even more.
Simple console logger used instead of packages like log4net an... |
This not-so-little Python project I was working on for over 8 hours, is actually the skeleton of my RPG engine.
Basically the test script uses the engine module to load a game world, including entities (which can be of random variants and even amounts), and then prints the name and location of every entity ingame. (Luc... |
I know several there have been several posts about Tic Tac Toe games previously, nonetheless I was really hoping that you may take a look at my attempt. I have tried to keep it as modularized as possible to minimize side effects. I started teaching myself C only about a month ago, so any and all advice would be greatly... |
Description:
An array-based Stack class. Since this class is designed using an array the size of the Stack is limited to whatever the program gives you. The key reason was not to use any outside help like Arrays.copyOf(array, size) to increase size etc. (In future, LinkedStack will solve size problem). MAX_SIZE is mad... |
I have the function below which is used to process an input image using probability predicted by a CNN network model.
def interp_map(prob, zoom, width, height):
zoom_prob = np.zeros((height, width, prob.shape[2]), dtype=np.float32)
for c in range(prob.shape[2]):
for h in range(height):
for w... |
Edit
I noticed some negative values being calculated lately. I'm still unsure why it's happening. Investigating and will post back when I have an answer.
I'm calculating the time it took a consultant to respond to a client using a start time and end time as input. I need to strip out any after hours, weekend, holiday... |
I want to generate an array where each row and column needs to have a random generated amount (between 2 and total size of dimension -1) of true values.
Currently I am running each row then columns and check if it validates. If it does not it regenerates and has to do another full loop to check if all rows and columns ... |
I am developing JSafebox, a portable safebox project written in Java. The goal is to provide a secured environment where the user can browse encrypted files without leaking data on the drive.
The project is highly focused on security and I would appreciate any feedback that would help improve the quality of the code.
T... |
Example: I want to select tuple in an array(t_bet), which contains just one element from judge_tpl = (5,12,24). For example, (3, 4, 5, 16, 30) is ok while (3, 12, 24, 29, 30) is not because it contains two elements.
t_bet = [(3, 12, 24, 29, 30),
(3, 13, 18, 19, 22),
(1, 11, 16, 17, 22),
(3, 4, 5, 16, 30),
(1, 11, 1... |
Edit 1 after first review: I changed to use malloc / free since apparently it's also easier to optimize than new[] / delete[] : https://godbolt.org/g/CZy28o ; of course this adds an additional requirement on the alignment.
template <class T>
struct pod_allocator
{
static_assert(std::is_pod_v<T>, "can only be used w... |
I just made this simple generator as a side-project to one big project I'm working on (demo on github pages here) and would like some opinions, feedback or suggestions on how to improve it. I hope you guys like it despite it being so bad. Edit: Names added as suggested!
index.html
<!doctype html>
<html lang="en">
<hea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.