instruction stringlengths 71 95.1k |
|---|
I'm designing an algorithm that creates optimum teams based on everyone's availabilities (maximizes the amount of shared availability). To this end, I've made a function that takes in a dictionary of availabilities mapping person to an array of their availabilities throughout the week at every 15 minute point (e.g. [Tr... |
I recently developed code that can run as a function parameter but I'm not quite sure how vulnerable it is to hacks and/or cheats.
Also, is there anything I could improve?
const h1 = document.getElementById('hi')
world = "world";
function testCode(codeEntered) {
var code = codeEntered;
var run = code *= 1;
... |
A few weeks ago, I wrote a Reverse Polish Notation program for my Ti-84+CE calculator. It was a successor to a program I wrote in TI-BASIC a while back, but since that one had too much input lag to be usable, I decided to write this one in C and compile it to native z80 assembly.
I wrote this program the night before a... |
I have looked at many topics related to this topic, but I could not find or understand for datagridview table. Finally I made the undo / redo implementation myself using datatable lists. This solution is valid for small tables, I think. I don't know if it will work efficient on tables with lots of data. I will share th... |
How can I avoid repeating code fragments between the mutations and types with graphene in a FastAPI app? I really want to avoid repeating any codes for obvious reasons.
graphql\mutations.py
import graphene
from models.customers import CustomerLogin, CustomerLogin_PydanticIn
from graphql.types import CustomerLoginType... |
The following code is an async beginner exploration into asynchronous file downloads, to try and improve the download time of files from a specific website.
Tasks:
The tasks are as follows:
Visit https://digital.nhs.uk/data-and-information/publications/statistical/mental-health-services-monthly-statistics
Extract th... |
I made a test job to the position of Junior Java Developer. I did not receive any answer from the employer, so I would like to get a review here.
Task description
A simple text file with IPv4 addresses is given. One line is one address, something like this:
145.67.23.4
8.34.5.23
89.54.3.124
89.54.3.124
3.45.71.5.
...
... |
I have below bash script which i have written to check the health of different storage component and then creates an incident through service-now tool.
This is script is working fine for me but i think this can be improved as i written this while learning through different google sources.
I would appreciate any help on... |
I am trying to learn C++, so I started coding a custom string class (using only c-style strings) to get familiar with concepts like operator overloading etc. in the case we have a pointer attribute. I wanted to know if there is a smarter/better/neater way to implement the += operator (or the others).
So I am basically ... |
In a TED talk Linus Torvalds made a point about “good taste” at approximately 14:10 in the interview. I read through his examples of “bad taste” and “good taste” and wanted to implement the same principle for a function that deletes the last node in a singly linked list. I also followed his coding style.
#include <stdi... |
I am trying to using HttpClient for making API calls from a different domain and for that purpose I have created the following service class after doing some research. It is 4.7.2 framework and not a .NET core system. I have created library class for this with following classes. Please give me your valuable suggestions... |
I have been coding 'Pac-Man' with my 16yo. A hopefully not too boring project to help improve his Python coding. We have just moved the 'Ghosts' into a class which was a good first introduction to objects for him.
My coding is far from perfect, and especially not in Python. Which was only just being invented when I wa... |
I'm writing the C++ program that involves a twist on Rock, Paper, Scissors. How the added Lizard and Spock affect the game is very simple and you could look it up if you want, but its not needed as I'm 99% sure my issue lies with the formatting of my if-else statements.
In every iteration, no matter what configuration ... |
While writing simple text rendering I found a lack of utf-8 decoders. Most decoders I found required allocating enough space for decoded string. In worse case that would mean that the decoded string would be four times as large as the original string.
I just needed to iterate over characters in a decoded format so I wo... |
I've recently started learning elixir, and the following is my attempt at fetching the local IP address of the system.
It can definitely be improved further, but as this would be my first ever project in a functional language; I'd be open to any criticisms.
defmodule Systemip do
def private_ipv4() do
{:ok, addrs}... |
I have written a (recursive) deep clone method for ES/JS-objects. It seems to work fine, but maybe I'm missing things. Please, feel free to comment!
Note: the method will not clone cyclic structures. If it should be somehow necessary to be able to clone such structures, maybe Crockfords cycle.js can be used - but it wi... |
I have created this basic use case of .sort() for my own reference. I am asking for a review to see if there are bad practices present or areas that could be optimised.
Is my use of modifying the array correct? Do I need to place the newly sorted list into a new array?
Using .map() I found it was parsing it as a strin... |
I've created a little GUI where the text entered in the text-fields is stored in a property of the currently selected button. If a different button is clicked, the contents stored for that button are inserted into the text-fields.
For storing the information I'm currently using a class where each text-field's contents ... |
I come from an OOP background, and have recently delved into C and embedded systems.
As an exercise I wanted to see if I could wrap some OOP concepts into a macro header.
It works as I intended, is fairly simple to use and get a grip on if you know OOP terminology / concepts.
Would love any feedback to see if I'm doing... |
Introduction
Sometimes, especially in more complex class structures, I feel uncertain in some way whether undiscovered circular dependencies might exist.
So I thought about how I can easily have their existence checked.
The idea behind
I came up with the idea of using a central place where I automatically register all... |
This is my function to generate all possible unique combinations of positive numbers these have sum equal to N.
For example:
If the input is 4
The output should be: [ '4', '1+3', '1+1+2', '1+1+1+1', '2+2' ]
You can try it online here
const f=n=>{ // n is a positive number
if(n==0) return ["0"]
if(n==1) return [... |
My requirements are:
Create a .net 5 class that encapsulates a task runner (i.e. a wrapper around a Task object)
The class should be thread-save
Consumer of the class should be able to know if the task is running
Consumer should be able to start/stop and start again the runner
I would love any expert advice regarding... |
I am translating this next permutation algorithm in C++:
template<class BidirIt>
bool next_permutation(BidirIt first, BidirIt last)
{
if (first == last) return false;
BidirIt i = last;
if (first == --i) return false;
while (true) {
BidirIt i1, i2;
i1 = i;
if (*--i < *i1) {... |
Ive been learning c for the past few weeks, I made a simple turn-based game to show off what I know. Is there anything I can do to improve the code or make the game run better?
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <windows.h>
#include <time.h>
#include <stdbool.h>
int main(){
srand(tim... |
Example of use:
var users = await usernames.SelectTaskResults(GetUserDetails, 4);
where GetUserDetails(string username) is a method that calls HttpClient to access an API and returns a User object. The SelectTaskResults returns the awaited tasks. At most, there will be 4 concurrent threads calling the API at the same ... |
It's only my second code in C so far. I've some knowledge about this language, dynamic memory allocation etc. but I'm still far to be good in it. Earlier I used to program in Java, so I could have passed some habits from there. In general - what should I change to make this code somehow more perfect, what I shouldn't d... |
I have a use case, where I want to take screenshots via scrot without leaving behind residual files:
"""Takes screenshots."""
from pathlib import Path
from subprocess import check_call
from tempfile import TemporaryDirectory
from digsigclt.os.posix.common import SCROT
from digsigclt.types import Screenshot
__all__ ... |
I have written a function that copies memory from one destination to another. I would like you to view my code and tell me if I have to fix something. That's the code:
void* memCopy(void* destination, const void* source, size_t size)
{
double *a = (double*)source, *b = (double*)destination;
void* end = a + (siz... |
I'm working on a mini-framework in Python, designed largely for backend REST APIs. One important aspect I'm working on now is testing, and I'm designing a drop-in backend replacement that switches it from using an actual database on the backend to using an in-memory data store. The goal is to simplify testing since y... |
The purpose of this code is apply a function to each selected cell. This works on contiguous and non-contiguous selections.
function assignText(value, prepend)
Returns a closure that encapsulates the original parameter values and a callback function which takes a single cell as a parameter. This closure is then passe... |
For the past week or two I have been working on a small library that aims to ease development of SFML games, and after finishing it I would love to get some feedback on it. I don't have access to any tutors so feedback is very valuable to me when trying to get better at coding. Thanks in advance to anyone who sets some... |
Project Description:
Chess without checks: A chess variant where you can take the enemy king.
This engine implementation is for chess without checks. Since checks don't exist, expect the code to not account for pinned pieces. Kings can move to dangerous squares (and be captured next turn). Castling is not implemented y... |
Here is the problem:
Given a numpy array 'a' that contains n elements, denote by b the set
of its unique values in ascending order, denote by m the size of
array b. You need to create a numpy array with dimensions n×m , in
each row of which there must be a value of 1 in case it is equal to
the value of the given in... |
Today I have learned alot and still learning. I have came to a situation where I have realized that I have created a database with multiple functions that does similar stuff but different queries. However by looking at the code we can see a similar "path" of these functions and I have tried and tried to know how I can ... |
I made a module called "matrix-py" in python to add, subtract, multiply, transpose matrices
I want to know how to improve the code quality and if there's something wrong about my code
here's the code on github:
https://github.com/FaresAhmedb/matrix-py
#!/usr/bin/python3
"""Matrix Manipulation module to add, substract, ... |
While answering this code review question, I proposed a solution with List<DataTable>. I am trying to encapsulate this data structure into a "DataGridView Undo/Redo Manager" class DataGridViewManager and there are several build-in methods including IsUndoable, IsRedoable, Push, Redo, Undo, etc. The following methods ar... |
Here's an example script I wrote for Instagram (Facebook)'s Basic Display API. I did this for myself because I haven't used Instagram's API since their Legacy API was disabled, and I needed to familiarize myself for upcoming projects. It's super easy to understand and is meant for learning purposes. It covers every fun... |
I have two functions. Both have to have unique elements, one with Integers and the other a String which returns a list of Char. My runtime is currently quite high and I'm not allowed to use imports, but I was wondering how to improve them:
uniqueInt:: [Int] -> [Int]
uniqueInt[] = []
uniqueInt xs = [x | (x,y) <- zip xs ... |
I build this simple function, trying to use PEP 8 Style, something that I discovered recently thanks to this previous question.
The function works, but I was wondering if there is a better way to do it.
import datetime
def quarter_values_builder():
"""A function that returns an array
with all the actual year q... |
I wrote the code to log in php to the admin panel. Everything works as it should. But I am not sure if it is well written code and if it is safe. I care about security. I have read a lot about it but I am still not sure. Please, help me.
<form method="post">
<input type="email" name="email" placeholder="Email">
<... |
My current project is a Settlers of Catan server in Haskell. I often manage to achieve my goals within Haskell, but the code is getting messier as the project grows.
My question is about the placeBuilding :: Board -> Building -> VertexCoordinate -> Board function that places a building on the board at a specified Verte... |
To bootstrap our application we have a configuration stored in a JSON file. This config holds different settings, like definition of endpoints (e. g. an API or SMS gateway etc.) or some default values for login.
endpoint.ts
export const isEndpoint = (candidate: any): candidate is Endpoint => {
return (
candidate ... |
I've created an IValueConverter in order to Bind to the index value of a Collection.
However it seems to be rather slow/infefficient and I wonder if there is a better/different way to do this.
public class IndexValueConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter,... |
I'm new to coding and working on a text based game moving from room to room. The code works in pycharm but according to an instant feedback program I entered it into, it gave some tips on it and I am not exactly sure how how to improve upon it. Here is what it gave me:
The Great Hall string is a key in main dictionary... |
I have a list of key:
list_date = ["MON", "TUE", "WED", "THU","FRI"]
I have many lists of values that created by codes below:
list_value = list()
for i in list(range(5, 70, 14)):
list_value.append(list(range(i, i+10, 3)))
Rules created that:
first number is 5, a list contains 4 items has value equal x = x + 3, a... |
I'm having doubts about which is the best strategy to manage the many service clients in this web app.
"Best" in terms of a good compromise between user's device RAM and Javascript execution speed (main thread ops).
This is what I'm doing right now, this is the main file:
main.ts:
import type { PlayerServiceClient } ... |
I've learned that in C++17, std::invoke isn't constexpr. To make a constexpr version, I could copy the implementation provided here: https://en.cppreference.com/w/cpp/utility/functional/invoke , OR I can complicate things by making my own version that relies on SFINAE, which may potentially be slow or have errors (whic... |
The goal of each frame of the animation to be the same length as the one before it, regardless of the amount of processing that takes place as the frame is being built.
This is a little animation demo that I wrote to show off the basics of a game loop in Python. With a newbies eyes in mind I have tried to keep to a lim... |
I build a small web-app using flask for my parents to text their customers about promotions. I am using Twilio API. I just finished the myapp.com/new-campaign page and I would like to have some suggestions as it's my first full stack applicaton as I just added a new feature: estimated cost of the campaign (coût)
Wha... |
I have created a thread before regarding the similar code review I had before Previous code review - I have updated a small piece of advice I got from previous answer and I did realized I have forgotten the comments to be added as well as I could add exists(SELECT 1...). However I replaced the code where I use dict ins... |
I have a table called dfmt that lists the location, revenue and franchise. I want to find the franchise pairs that operate together in more than one location.
So far, I have a query that finds the franchise pairs that operate in the same location:
select T1.fr, T2.fr2 from dfmt T1 join (select fr as fr2, loc as loc2 f... |
Since writing your own C++ game engine seems to be really popular these days (seriously just look at the amount of people presenting their WIPs on YouTube) I figured I'd try it myself.
My mental model of an event system looks like this:
Events are basically signals that tell you that something has happened. Certain ty... |
Code is Working Review and Recommend What Are Best Practice
What I am trying to achieve.
API with Flask that runs any python file from the current directory.
Run the file and get output in JSON
Below is the code for the app.py
from flask import Flask,jsonify
from flask_restful import Api,Resource
import os
app = F... |
I'm trying to implement a re_sub and it's been quite tricky for me to do. I wanted to take the python code to replace a string -- re.sub(r";.+", " ", s) -- and do it in C. Examples of grabbing a single regex match were pretty easy to find (and do) but doing multiple matches and then substituting proved to be quite tri... |
I need to split a string by a separator but don't want to split if the separator is prefixed by the escape string.
For example:
"This works\\ but it\\ isn't pretty." with " " as the separator and "\\" as the escape string should produce the following: []string{"This", "works but", "it isn't", "pretty."}
I wrote the fo... |
I wrote a short function that should check if user input does contain any bad words that I predefined inside $bad_words array. I don't even care to replace them - I just want to ban if there are any. The code seems to work as it should - in the example below will detect the quoted string badword and the function does r... |
While I understand that "V is a simple language," I find myself repeating a lot of stuff. For instance the whole first block, "measure column widths," could beautifully be accomplished by two simple list comprehension lines in Python. Is there some way to simplify the allocate array, initialize the index pointer, loop-... |
I'm new to Haskell, and I figured that pairwise summation is something I could do easily. I wrote this:
pairwiseSum :: (Num a) => [a] -> a
pairwiseSum [] = 0
pairwiseSum [x] = x
pairwiseSum (x:xs) = (pairwiseSum (everyOther (x:xs))) + (pairwiseSum (everyOther xs))
everyOther :: [a] -> [a]
everyOther [] = []
everyOther... |
I wrote my first working website in ReactJs as a beginner and I have a few questions.
First question is about meta-tags. I used react-snap for generate meta-tags, because it was the only solution I have found so far, that didnt use server side rendering. But, I have two pages on webpage, one for content and one for Coo... |
There are systems that when you duplicate an asset, the new assets are created with an index, so that the name do not collide. For instance, if I have an asset called House, and I press "Duplicate", a new asset will be created called House (1), and if I press again, it will be called House (2)
I wanted to make a system... |
I want to create clickable rows in an html table. Each row should be a link leading to a different page. I can of course add onclick handler, but that will create kind of a crappy UI - poor accessibility, no keyboard navigation, no right/middle click...
I found a better way to do it. Instead of using normal table eleme... |
I am trying to get an array of all regex matches. For example, something like this:
PATTERN: (\d+)[a-z]+
STRING: 123asd
RESULT: ["123asd", "123"]
^ ^
full capture group 1
Additionally, if there are multiple matches, it should continue matching, for example:
123asd 123asd
[ ... |
I am solving one binary search problem in LeetCode.
I have accomplished such code:
struct Solution;
impl Solution {
pub fn search(nums: Vec<i32>, target: i32) -> i32 {
if nums.is_empty() {
return -1;
}
if nums.len() == 1 {
return if nums[0] == target { 0 } else { -1 }... |
I have a function that takes in a string and based on the string hits different APIs to fetch images.
I have solved it by writing an interface and then as the return type of the function, it returns a Promise<Interface> as shown in the code below.
interface IAnimal {
image?: string | null
message?: stri... |
The following is just a working example.
I have a DataFrame containings a monotonous growing function.
Some of the values are actuals, some are forecasted.
I need to filter specific actuals values based on a set of milestones and I have to avoid to take forecasted values from the dataframe
I created this following scri... |
I made a snake game implementation in console with rust.
Would like to hear what I'm doing wrong and what can be improved.
main.rs
mod apple;
mod board;
mod game;
mod position;
mod snake;
pub const TAIL_SIGN: char = '#';
pub const HEAD_SIGN: char = 'O';
pub const APPLE_SIGN: char = '@';
pub const BOARD_SIGN: char = '.... |
I've written a simple Hash Table implementation in C, in order to use it in an IRC bot, so mostly storing nicknames, channel names, etc (small strings). I'm using linear probind to resolve collision.
Here is the public API (hash.h):
#pragma once
#include <stdbool.h>
typedef struct hash {
struct hash_node* nodes;
... |
I'm learning Rust by implementing basic data structures and algorithms. I implemented a binary heap (max heap):
mod binary_heap {
#[derive(Debug)]
pub struct MaxHeap<T> {
pub data: Vec<T>,
}
impl<T> MaxHeap<T>
where
T: PartialOrd,
{
pub fn new() -> MaxHeap<T> {
... |
I just started doing preparation for interviews, but im having trouble recognizing the optimal solution
Problem: For a given IP Address, replace every "." with "[.]"
Example:
Input: address = "1.1.1.1"
Output: "1[.]1[.]1[.]1"
My solutions:
First:
def defang(x):
lst = []
for i in x:
if i == ".":
... |
I thought of doing the following to mock/test functions in Go and wanted some advice. Let's say you have an interface for a repository:
type Creator interface {
CreateUser(User) (*User, error)
}
type Updater interface {
UpdateUser(User) (*User, error)
}
type Retreiver inter... |
I have been working with requests where I as easy as it is. Scraping the webpage and add it into a dict and print the payload if we find a new value or not.
import json
import re
import requests
from selectolax.parser import HTMLParser
payload = {
"store": "Not found",
"name": "Not found",
"price": "Not f... |
I'm trying to write a factory class that essentially provides a user-friendly frontend to creating objects of different kinds depending on keywords. So the user will just have to import this module, and then use module.factory.make_new with the relevant keywords.
The directory structure will be pretty flat: this file w... |
This is based on this leetcode question. I get the correct answer, but I know it could be much, much cleaner. I also know there is supposed to be an O(n) space solution, but I'm not sure how to implement cleanly.
It is a dynamic programming problem, I tried to add some helpful code comments, I know it's pretty messy ... |
The ideas are
When multiple async calls are made, to be able to start consuming from the first resolving one regardless in what order the promises are fired.
To construct a modern emitter of async values to be consumed by the for await loop.
One may achieve this functionality by making repeated (promise many times) Pr... |
I have decided to make snake game as my first project with C++ (using OOP) and I didn't follow any tutorial while doing it, now I am frustrated and need to know if it the code is good or not and what can be improved in it?
Map class header file:
#pragma once
#include <vector>
#include <iostream>
#include "Snake.h"
#inc... |
This is a follow-up question for A get_extents helper function for Boost.MultiArray in C++. In order to retrieve, manipulate and calculate size information in each dimension from Boost.MultiArray in some better ways. Besides the get_extents helper function, I am attempting to implement extents_to_array and array_to_ext... |
I wrote a barebones version of wc in rust. wc is a program that counts the number of characters, words, and lines in a file and outputs those values to the command line. Here is an example of the output:
9 25 246 Cargo.toml
52 163 1284 src/main.rs
61 188 1530 total
My version currently lacks the proper out... |
I have written a code snippet to use HashMap<String, Vec<&String>> as the main data structure, and finally, I want to return a collected Vec<Vec<String>>, I can archive it by a for-loop, it there any pure iterator way to do this? (I have tried several times, but got tons of
confused compiler errors)
pub fn group_anagra... |
Here is my solution for Advent of Code 2020, Day 4, Part 1 in C. I tried using fscanf or fgets, but couldn't find a nice of doing it, so I ended up using getc. Is there a way of using fscanf or fgets that makes this code better? Also, how does the code look in general?
#include <stdio.h>
#include <stdlib.h>
#include <... |
I've written my Huffman archiver in modern c++ (at the moment of writing), could you review it, please?
this is the main routine:
#ifndef ENCODING_HUFFMAN_ENCODING_H_
#define ENCODING_HUFFMAN_ENCODING_H_
#include <cassert>
#include <istream>
#include <iterator>
#include <memory>
#include <ostream>
#include <stack>
#in... |
I'm learning about how to create a good and clean code. I just need to review something like that, and I really not sure how can I fix this code into a clean code.
bool isValidUserName(const std::string& username)
{
bool valid = false;
if (username.length() >= MIN_NAME_LENGTH)
{
if (username.length... |
I am trying to replace in an adapted code from internet, a thread pooling class, named ThreadPool:
void ThreadPool::Wait()
{
// we're done waiting once all threads are waiting
while (m_threads_waiting != m_threads.size())
{
;
}
}
where m_threads_waiting is defined as:
std::atomic<size_t> m_threads_wai... |
Use case
This is an event loop and signaling system I created for a piece of software which will have multiple asynchronous server/clients/event-emitters/ui, some of those components will have their own event loop running on a separate thread, some will just post events in the main thread event loop.
I used to work wit... |
This code review is for my Stack Exchange Marathon Bot project, a Telegram bot for playing a dumb little game involving the Stack Exchange network. Since the codebase is not that small, in this post I want to focus on only one aspect, namely the Telegram bot -related code, which uses the python-telegram-bot library. In... |
This shell script, with only a few configurations, has the goal of initializing a project on Gitlab.com without having to go through the go through the website's ui.
This means: Let's say you just a project with a few source files, but you haven't done anything with git yet. The goal of this script is to allow you to w... |
Where should i put print statements describing the flow of the program? Is there any convetion or code style for this?
Should they be in higher level functions?
def create_collage():
print('finding images ...')
image_paths = get_image_paths()
print('loading images ...')
images = load_images(image_paths... |
As an exercise to get to know C a bit more, I decided to implement a dynamic array implementation in C99 with generic support.
Everything is implemented with series of macros. The array_list struct definition itself is an anonymous struct, which allows client (user) to have very easy access to it. When capacity is reac... |
The prompt is: that I should write a program for a customer management system for registering customers (in C programming language).
The program should allow registration management members to:
Add customer record (id, name, age, gender and city) to the file.
Print customer details (ID, name, age, gender and city)
(N... |
I worked on a problem from Automate the Boring Stuff Chapter 7:
Write a regular expression that can detect dates in the DD/MM/YYYY
format. Assume that the days range from 01 to 31, the months range
from 01 to 12, and the years range from 1000 to 2999. Note that if the
day or month is a single digit, it’ll have a leadi... |
In a current project of I have multiple modules that need to read from and write to a config.json file, where the settings are saved as nested dictionaries. I chose json here, because I want the config file to be human-readable.
Simplified example config.json:
{
"server_data": {
"email_address": "something@somewh... |
I don't program much in c, but cobbled together some code from different places in google. I'm sure this is backwards especially in how it works with strings and directory files. Please let me know what the best practices would have been.
/* usbresetall -- reset all of the usb devices on bus 001 */
#include <stdio.h>
... |
For my current job, I've been told that soon I'm going to be porting our Python code to Cython, with the intent of performance upgrades. In preparation of that, I've been learning as much about Cython as I can. I've decided that tackling the Fibonacci sequence would be a good start. I've implemented a Cython + Iterativ... |
I have a Vec with value default [0], and then I want to append into the vec with an iterator which is read from stdin, now my code is not performant since I use an insert to shift all the values behind index 0, how to improve this code with rusty style?
#[allow(unused_imports)]
use std::cmp::{max, min};
use std::io::{s... |
I have been working on where I want to improve my knowledge to do a safe JSON scraping. By that is that I could pretty much do a ugly workaround and wrap it into a try-except but that is not the case. I would like to know where it goes wrong and how I can improve the code I have been working with:
import json
from json... |
I have a 4 list of posts. I am trying to load more posts (clones of the "original" ones) when I reach the bottom of the container.
class InfiniteScroll {
constructor() {
this.observer = null;
this.isLoading = false;
this.postsContainer = document.querySelector('#postsContainer');
this.postsArary = p... |
I wrote this simple shell in C for a university assignment on operating systems
(My guess is that it's just the beginning and the next assignments will add to this code).
The program prints the prompt to the user, receives an input and try to execute it. The program ends when the input is 'done', and prints some statis... |
What I am wanting to do, is record the status of a HTTP call, so that I can give the user some feedback in the UI, rather than either succeeding silently, or showing a grim error.
What I have done is created a Result class. For ease, I will show the simple class, but I also have this as a generic class, so it can also ... |
I got this data structure and I am checking to see which properties are true, then I am adding the key for all the properties that are true to that object on a new property called combined
const data = [
{
keyword: 'banana',
yellow: true,
sweet: true
},
{
keyword: 'pineapple',
yellow: true,
... |
The objective was to write a locale-independent function that prints floating-point numbers (i.e. one that always uses . as a decimal point regardless of the locale) that was going to be used in a library that was meant to produce JSON. I was aiming for the following:
Implementation simplicity
Ability to be used on di... |
template<typename T>
class object_pool {
public:
explicit object_pool(std::size_t initial_size = 1048u);
object_pool(const object_pool&) = delete;
object_pool(object_pool&&) = delete;
~object_pool();
object_pool& operator=(const object_pool&) = delete;
object_pool& operator=(object_pool&&) = delete;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.