instruction stringlengths 71 95.1k |
|---|
I am looking to see which aspects of this code could use improvement.
In both design, and basic implementation and coding.
I'm using IntelliJ and Java SE 20.
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
public class BlackJack {
... |
Here is some code I've written. I am welcoming any critiques, whether it is style/formatting, correctness (I believe it is correct) -- I would appreciate any advice on formatting unit tests, and any other thing that people may think of.
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
/*
* all functions e... |
I am learning dependency injection and trying to use this pattern on practice. I am trying to write simple program where the user can write something to database, delete row and clear all rows from db. So is it right realization of dependency injection?
import os
from enum import Enum
import pymysql
class Properties... |
I've written a tree data structure that takes in input from the user, and stores the each letter based on the previous letter in the text. I'm not sure what this is called, but the closest I can find is an auto complete type of tree, where someone would traverse this tree to find the next letter with the highest freque... |
I have revised the implementation I originally posted here. Thank you all who responded; I took your comments to heart. Please let me know if you have any additional feedback.
Here are some notes to make:
I implemented all changes suggested by @vnp
I implemented all by @chux, except for the "apply" function and the sa... |
I am training a neural network to use approximately 600 features (4103rd to last column of a df) to predict approximately 4000 values (7th to 4102nd column of the same df). I have standardized the values using standard scaler. I use rmsprop as optimizer and sigmoid as the activation function.
Can someone help me unders... |
Given a binary search tree, the problem requires calculating the minimum absolute difference between any two keys in the tree. Given the binary search property, the minimum difference must be between in-order neighbors.
I am basically a C++ beginner and this was my attempt at writing "idiomatic" and readable C++17. I a... |
I needed to find a way to convert a bunch of enums to string for displaying in C++. The two main ways I found when searching was using dark magic macros or voodoo magic template metaprogramming.
As I don't know much about any of them I thought building something myself would be a good opportunity to learn new things. H... |
Recently I wanted to use the gtest library to unit test my program but for some reason, it's incredibly hard to make it work and configure (at least for me it was), so I decided to make my own, following the style Google uses.
I set a goal for this summer and it is to make a Linked List library similar to std::list. I ... |
Please evaluate and help me understand if my attempted implementation of a tail recursive directory traversal function is actually tail recursive or not. I wrote this from my understanding that a tail recursion happens if the recursive call is the last thing done by a function. The output of traversal matches the neste... |
I started learning C++ about a week ago and I was hoping somebody can critique my code. I decided to implement my own basic String class just for the sake of applying all that I've learned about pointers, C-style strings, and move semantics. I know there is already such a class in the standard library but as I said, I ... |
I'm designing a board game with my wife, and am writing a console based program that can track and analyze the statistics of playtests to see if the game is balanced, what the dominant strategies are, etc.
My first goal is to write a console based program for our own use, and maybe add a GUI on top later (which would b... |
I have written the following JavaScript small script to do three things in a web browser:
Block all or most News websites (send your browser to google.com instead)
Block automatic playing of any video (use another browser to play the video)
Block specific websites (send your browser to google.com instead)
The axioms ... |
I wrote a basic app for measuring time it takes to execute any given block of code. What do you think?
@NoArgsConstructor
public class Measurer {
private LoggingType loggingType = LoggingType.DISABLED;
public Measurer(LoggingType loggingType) {
this.loggingType = loggingType;
}
public long mea... |
I am trying to remake Super Mario Bros. in JavaScript and I am trying to figure out if there is a more efficient/shorter way to create and store the level data. I have created 1-1 and here's what the code looks like:
const repeatBlock = (block, start, end, array) => {
let newData = {
"tp1": "tlp",
"... |
I've been learning C++ on and off, and recently learnt about overloading and templates. I wanted to used these concepts to create classes about matrices using std::array.
Note that this has to be compiled using std=c++17 or newer, following a clarification involving constexpr.
#include <array>
#include <iostream>
temp... |
I'm new to Python and only started learning a couple months ago. I get that this is a really unsophisticated code and I'm a newbie, but are there any blatant issues with it that I can improve upon? I just kind of threw everything I know together to see if I'm cut out for this kind of thing.
Also I'm a first time poster... |
I wanted to be able to run a series of Python functions and capture every exception that happens. The solution uses a AggregateException class and tries to leverage Python scoping in order to aggregate a sequence of Exceptions raised.
The Solution
class AggregateException(Exception):
def __init__(self, errors: Li... |
I wrote a web scraper library to parse articles from HTML documents where they are encoded in a JSON object in JavaScript element.
I wrote the example HTML file and main.rs so that you can test the library here for review. The subject of the review should only be lib.rs.
./Cargo.toml
[package]
name = "webscraper"
versi... |
Background
I'm attempting to write a physics simulation code, one portion of which involves simulating the triggering system of some equipment. The equipment works as follows: environmental noise (which we may model as a Gaussian-distributed random variable) is taken in as data in numChannels independent streams at som... |
I wrote an algorithm to solve the New York Times' Puzzle: Digits.
You could play the game here.
The rules of the game are as follow:
You were given 6 numbers and you could use simple operations (plus, minus, multiply, and divide) to reach a specific number given by the problem.
You DO NOT need to use all 6 number and y... |
I have designed a layout that includes recipe details and three CTAs in the app bar to share, delete, and edit recipes. I need feedback regarding the architecture of my Compose UI.
RecipeDetailFragment
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceStat... |
I would like my program to check what account I am currently logged in to (it works, I entered it (login4) in a variable for testing)
and when it reaches the end of txt I want it to go back to the beginning. It also saves the current position in case the program is closed.
my txt file:
login1:password1
login2:password2... |
Here's some background information: I was working on a Chrome extension called Netflix Hotkeys (you can find it here), and I realized that I needed a persistent storage solution for storing user preferences.
Initially, I had a lot of boilerplate code in my storage implementation for each preference, including keys, get... |
I am synchronizing two MS-Access databases.
One of them on a network drive, the other one on the local machine.
(For testing purposes both in the same directory)
The Databases both contain a table named "tblCheckup" with an essential ID Field called "checkGUID"
I am aware that this will probably fail if there are no re... |
I wrote a small LKM that opens the /proc/cpuinfo file, reads it line by line, and attempts to the cpu model name.
If the function fails to extract the cpu model name, or for some reason it can't read the cpuinfo file, it should return "N/A".
While I am aware that I can also achieve this with a user-space application, I... |
I have greatly improved and expanded my my performance testing app
New features include:
Builder for type safe creation of a Measurer instances
Performs 10 runs of each procedure (default), or any number of runs a user chooses, and then calculates the average for each procedure
Provides more comprehensive comparison s... |
Can you review the following code to check to see if the Minimum Image Convention is properly implemented?
import random
import math
import matplotlib.pyplot as plt
polymer_chain_vec = []
N = 9
sigma = 2
epsilon = 2
periodic_boundary_int = 5 # size of the periodic box in A
temperature_float = 2 # temperature of the ... |
I want to store some 512x512 icons for my Android app in a Room database. This is so each item in a list can have all the text data along with the image data stored in a single record.
The answers to this question https://stackoverflow.com/questions/46337519/how-insert-image-in-room-persistence-library indicate this is... |
I have various functions which attempt to insert into a PostgreSQL database. In an attempt to remove redundancy for common errors that I was occurring I have created a context manager.
Solution
from contextlib import contextmanager
import psycopg2
class DomainSpecificException(Exception):
...
@contextmanager
d... |
I'm creating a simple yet fast OrderBook, that only adds orders and matches them (no cancelling or modifications, etc.). I'm using partial template specialization to reduce branching in the hotpath, and I'm preallocating the price ladder to avoid expensive allocation operations (that and this being a lot more cache fri... |
I would like to vastly improve the speed of the second part of this algorithm to find clusters of points on a 2D grid.
Each point is represented by a Region on the grid (which is the same idea as a Range in Excel, just renamed here to not conflict with System.Range. In future iterations of the code, the concept of a "p... |
I've recently started to learn Python and the task was to create a "hot or cold" game. They gave me the basic structure for the code and so far so good. But the bonus objective is to find a way to display how long it takes the player to find the block or even limit the amount of time they have to play the game.
I came ... |
So I spend a day trying to understand how could I resize components, I came up with this method which surely isn't the best, but I liked it:
Create component
This component uses mouse events to change a CSS variable for another component
It doesnt use much of the react syntax or stuff, as I am a beginner
What I woul... |
The code creates 4 timers that control 4 semaphores with which the tasks will work when they take the semaphore. There are 3 sender tasks and 1 receiver, the sender sends to the queue that was created (first 2 senders are of same priority while the third is of higher priority) in a random period of time that is passed ... |
const usecases = [
{ usecaseId: 'Bill Gates', id: 1, description: 'CEO & founder, Microsoft' },
{ usecaseId: 'Mark Zuckerberg', id: 2, description: 'CEO, Facebook' },
{ usecaseId: 'Steve Jobs', id: 3, description: 'CEO & co-founder, Apple' },
{ usecaseId: 'Satya Nadella', id: 4, description: 'CEO, Mi... |
I am trying to write a basic Hartee-Fock program that computes the total energies and some properties of a molecule given as an input. The code uses Cython to statically compile the computationally expensive parts, and there is a basic parallelization implemented using mpi4py. However, the code is still very slow for a... |
I am designing a solution to store employee day attendance, which can be recorded either as hours or as an interval within a day. The goal is to maintain a monthly attendance list for each employee.
Depending on hours or interval values, timeSheet view will be generated containing either intervals or hours (each employ... |
So, I have a list with some nan values, out of which some are continuous. e.g, list = [1, 2, 3, np.nan, np.nan, 6, 7, np.nan, 9, np.nan,np.nan,np.nan, 12] For some necessary reason, I'd want to get the length of individual continuous gaps.
def find_continuous_gaps(data):
gap_starts = []
gap_lengths = []
cur... |
About the Reasoning
I wrote a flat_multimap because it was slightly more efficient to read/write from disk (contiguous memory block) and because it would keep the logarithmic efficiency from a tree (using binary search). I tried to keep to the std::multimap standard, but there were several operations from std::vector w... |
I am a beginner in a class and recently given a problem where I have to design a income tax calculator but using the 1913 tax standards. I was able to get it down I think but I was just wondering if it at all looks sloppy or if there is any productive criticism people are willing to give.
Have I over complicated things... |
For learning purposes and maybe later on implementing it in React, I made an event system that responds to mouse event to allow element resizing, both in width and height.
For now is just Vanilla JS and a few lines of CSS.
I would appreciate any criticism especially for the event system that I use.
Basically, the black... |
I added an enum for my webscraper to deserialize data from a JSON field that represents an HTML image size, which can either be an unsigned int like 1080 or a string like "100%":
use serde::Deserialize;
use std::fmt::{Display, Formatter};
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum HtmlSize {
String(String),
... |
The following is a Rust implementation of polymer simulation where the PBC(periodic boundary condition) has been implemented using the Ewald Summation technique.
Can you review the code?
Is the PBC properly implemented using the Ewal Summation?
use rand::Rng;
use std::f64::consts::PI;
use std::f64::consts::E;
use plott... |
According to my current design various processes and threads(written in .net core or framework) will call this stored procedure to change the status of various entities in a multi threaded environment:
CREATE TABLE Table1(
[Id] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY,
[Status] [int] NOT NULL,
[StatusChange... |
I'm playing with data from a Time Use survey as a beginner SQL user.
Gender is represented as 1's (Male) and 2's (Female), and the age of each participant is listed. I would like to divide them into age brackets with a total count, and see how many are male/female within each bracket.
What I have is this:
SELECT co... |
I would like to give users the ability to enter formulas which will later perform calculations with a small number of variables in scope.
While use of ECMAScript's Function constructor to parse user input introduces plenty of potential for introducing malicious code, the counter argument is that building and executing ... |
I need to insert or update a row that has created_at and last_update timestamps.
created_at should only be set when the record is created while last_update is updated whenever the record is updated.
I am not using Eloquent in this case, so I can't use methods like updateOrCreate(). Also, using Query Builder's updateOrI... |
I wanted to detect when a user stops typing. I encountered this answer from SO (Not the selected answer, but the second one which seem to be better):
https://stackoverflow.com/a/5926782/17746636
But I edited it slightly to use keydown instead of keyup. Also the target is window for my example (I need to detect any key ... |
As part of a project to pull data from our purchasing system (Sage) back into our quoting system (an Excel template) to automate variations to existing quotes, I wanted to grab the original quote number from the Sage listing.
Different members of the purchasing team key the quote number into the sales order in differen... |
In working on something else, I have come across this little brain-burner.
I want to return an array of all the arrays that satisfy this.
There are elArr elements in the array. Eg if elArr = 3 then the array looks like [x,y,z] where x, y and z are numbers.
The maximum entry in any position of the array is maxNum and t... |
I am inputting a file of uniq -c | sort -nr and I need to
take the string from the file,
generate a unique id of the string and then
Output a pipe separated value of cksum|$string
The code below works, but I definitely feel like it could be improved. Perhaps removing the tr or not using xargs since I can parallelize ... |
A friend of mine and me are running a modded DayZ server.
One of the common tasks when adding mods that include new items is to update the server's types.xml file (example).
My mate did this by hand until now, but asked me to write a program so that he can automate this annoying task. So I wrote the below library and p... |
I'm designing an application that will broadcast messages to various heterogeneous systems. Slack, JIRA, Database to name a few. Users can pass their various configurations using a yaml file.
While this works fine, it seems verbose and somewhat excessive. Each run only ever needs a single instance of each, so having a ... |
I need to format total number of seconds to total time in the following format: Days:Hours:Minutes:Seconds.
This is what I did:
function formatTime(totalSeconds) {
let days = Math.floor(totalSeconds / 86400);
let hours = Math.floor((totalSeconds - (days * 86400)) / 3600);
let minutes = Math.floor((totalSeconds ... |
Thanks for taking the time to read this. I could use a few pointers. I have written much better code but wrote this as a quick test. There is obviously a major issue/s somewhere except for the functionality as it was dismissed immediately. There is another question on same code but a different topic.
/*
* Assessme... |
I coded stuff for an embedded device where int is 24bits. I wanted to port uint24_t and int24_t to windows, so I made a header file to handle it.
The goal was to have uint24_t and int24_t work as it did when I coded for the embedded device, and for it to be 3 bytes long and unpadded.
My current implementation uses 3 by... |
Edit 2: For anyone interested, you can play the game at buggysnake.com
Edit 1: I have typed up the code for making the body of the snake move. It's not perfect and there are small problems I need to fix. But I have updated the javascript code below to include that code.
Background: I recently started learning Javascrip... |
I'm trying to implement a simple type-generic Vector with macros using the newest features of C23. Looking for any advice about macro design and pitfalls because I generally avoid macros at all costs. Wondering how to extend this code to handle more complex data types as well.
Also, I'm not particularly happy with the ... |
I'm getting back into C and I wrote this variadic logger as part of a chess application I'm writing. As such I'm looking for feedback about the general approach (I'm going to give it another pass to catch any possible errors, edge cases etc... later on). Mainly I'm concerned with side effects and trade-offs that I may ... |
The problem given was: "You will be given an array of numbers. You have to sort the odd numbers in ascending order while leaving the even numbers at their original positions."
I developed a solution that works, but I want to know if I'm redundant or if I'm engaging in some bad habit. I'm relatively new to python. I see... |
I am working with videos. So, the input of my model has the shape of [batch_size,channels,frames,height,width]. So, my goal is to extract the the features from each frame separately using ResNet2D and also I expect to have a tensor with the same shape for my output. Thus, I wrote the following code and I am not sure if... |
I'm developing a model in Python which produces IFRS and SII balance sheets for a hypothetical life insurance company. To value the hypothetical company's insurance liabilities, I need to project the probability of a policy being redeemed in a given year.
Policies may be redeemed in two possible ways:
The policy holde... |
Since I am not a fan of having using large web-frameworks and libraries just to setup a simple blog, I decided to write my own static blog site generator in pure shell script.
The script uses pandoc, to convert markdown files to html files.
To test the script, check out the μblog repository.
It contains documentation +... |
I am learning about user-defined exceptions in python and I have tried to incorporate them in a basic python implementation of a stack. Objects of Stack class support push, pop and top operations. I have defined the following exceptions:
StackEmptyError: Raise an exception when pop/top operation is performed on an emp... |
I am working on a personal project, and one of the things it does is to call a blocking operation on a file descriptor while a forked+exec'ed child process is running. It needs to know when the forked process exits while reading events from that file descriptor.
After some discussion on libera.chat's #posix channel, w... |
For the following Julia code:
mutable struct MutationWeights
mutate_constant::Float64
optimize::Float64
end
const mutations = [fieldnames(MutationWeights)...]
@generated function MutationWeights(;
mutate_constant=0.048,
optimize=0.0,
)
return :(MutationWeights($(mutations...)))
end
"""Convert Mut... |
Task-description: Implement a function, which returns a string with all consecutive whites-spaces replaced as a single-space.
Example: "a[space][space][space]b[space][space][space]c" shall become "a[space]b[space]c"
My implementation:
func removeConsecutiveWhitespaces(str: String) -> String {
return str.replacing(/... |
I have developed a calorie-tracker webpage and would appreciate some feedback on it. I'm particularly interested in optimizing performance, improving code readability, and ensuring best practices are followed.
<!DOCTYPE html>
<html lang='eng'>
<head>
<title>FITIFY | Fitness Tracker</title>
<!--CSS Sty... |
When I talk to people regarding connection pooling in SQLite most of them always laugh and say "You don't know about SQLite", "It is not a client server DB, and only overhead in creating new connection is opening a file connection".
I agree but connection pooling helps in SQLite if we want to make use of PRAGMA cache_s... |
Let's say you have a hashmap of sub-systems that a spaceship is currently directing power to and a second hash of sub-systems where the power should now be directed to.
Create a function that returns a hash of where the spaceship should move the power from and where it should go so that the power can be taken from the ... |
Given a public key, I want to generate a corresponding private key. I know this will take at least decades or centuries on average to achieve.
I am wanting to increase performance as my current code is not likely to finish within my lifetime. It does not need to use Bash or calling ssh-keygen as a new process each time... |
Task: Implement a function which loops from 1 to 100 and prints "Fizz" if the counter is divisible by 3. Prints "Buzz" if the counter is divisible by 5 and "FizzBuzz", when the counter is divisible by 3 and 5.
The instructor gave me the hint, that it's solvable using the ternary operator. Otherwise I would have used an... |
It's a task from a C#-course I'm currently taking.
The task is to write a method, which returns the first twenty Fibonacci-numbers.
I have done it the following way.
using System;
namespace CrashCourse
{
public class Fibonacci
{
// ... The actual method
public static List<int> GetNumbers() {
... |
I wanted to improve a crypter from internet. I found it poor and modified it.
Do you like it?
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
//Simple C program to encrypt and decrypt a string
#include <stdio.h>
int main()
{
int scnt;
int scnt2;... |
Following up from: Fast OrderBook Implementation
Here is the updated version (I've also implemented some extra functionality)
==> Order.hpp <==
struct Order {
int id;
int quantity; // hiddenQuantity needs to be >= peakSize
int peakSize;
int hiddenQuantity;
short price; // we don't really need this, ... |
I would appreciate a review of my Python script that interacts with the YouTube API and downloads videos or audio from YouTube URLs or playlists. The script uses the pytube library for downloading and PySimpleGUI for the GUI.
Here is the script:
#!/usr/bin/env python3
import os
import sys
import threading
import urlli... |
I wrote the following C code that takes a couple of arguments on the command line and calculates a given number of iterations of the Mandelbrot set complex mapping using MPFR arbitrary precision arithmetic. Is it well-written? Does it have undefined behaviour or is unsafe?
Here is the code:
Makefile
CC := gcc
O := 1
CF... |
This is a Python script that maps natural numbers to lattice points in a spiral like manner. It maps all natural numbers to all points with integer coordinates, and it produces a list of coordinates of the first n vertices in the spiral for given input n.
The spiral is grown in such a manner, start at the origin, go ri... |
Function
Gives the mass needed of specific basic (pH above 7) substance in order to neutralise the pH of a specific acidic substance.
from decimal import Decimal as d
# m = mass
# n = moles
# M = molar mass
MkHCO3 = 100.11
MnaKHCO3 = 84.007
MphenHCl = 215.67
moles = lambda m,M: m/M
nPhenHCl = moles(1.54, MphenHCl)
... |
I wrote this code to find kth smallest element in the array by renowned algorithm quickselect. Here is the link where you can see the working code.
What points are there to be improved? Could you please leave your valuable comments?
I tested its time complexity by countFindElement and countPartition together. It is al... |
I have written code as below:
bool binary_search(const std::vector<int>& v, const int& target) {
int left = 0, right = v.size() - 1;
while (left <= right) {
int mid = left + (right - left) / 2;
if (v[mid] == target)
return true;
if (target > v[mid])
left = mid ... |
I am using OpenCV’s findchessboardcornersSB function to find the corners in the image. I am using below code/ header file:
#pragma once
#include"opencv2/opencv.hpp"
#include<Eigen/core>
#include<vector>
namespace MAL_Vision_Dushyant {
class ChessBoardDetector {
public:
int CB_Width, CB_Height;
... |
Code below successfully processes and submits data to database. Is there anything else that needs to be included / considered?
PHP (note-process.php):
$data = array();
if ( (empty($_POST['name'])) || (empty($_POST['note'])) ) {
$data['success'] = FALSE;
$data['message'] = 'Name and note is required.';
} else ... |
Can someone help me to understand and give me code review of my small todos APP, why my code in backend is bad? Also give me a answers for some of my questions, please:
Where my code is bad?
Where do I use bad combinations with callback and async/await?
And show me how it should look in a best code practices, please.... |
I am excited to share that I have developed an event system in C++. I have always been passionate about programming and have long aspired to create a low-level game engine solely using C++, OpenGL, and GLFW. This project has been a personal challenge and really fun too.
To begin with, I created my own Event System. The... |
Working on a project of mine, I wanted to parallelize mapping operations on an input stream. I found pariter on crates.io but it did not fit my needs, because its generic's bounds require the iterator to be 'static, which is not what I want (the iterators I work with are not 'static).
I am not too experienced with para... |
I am excited to share that I have developed an event system in C++. I have always been passionate about programming and have long aspired to create a low-level game engine solely using C++, OpenGL, and GLFW. This project has been a personal challenge and really fun too.
To begin with, I created my own Event System. The... |
Problem:
According to a recent survey, Biryani is the most ordered food. Chef
wants to learn how to make world-class Biryani from a MasterChef. The
chef will be required to attend the MasterChef's classes for X weeks
and the cost of classes per week is Y coins. What is the total amount
of money that the Chef will hav... |
An absolute beginner here who is practising linked list problems in hackerrank. Stumbled upon this question which is categorised as easy.
Given a pointer to the head node of the linked list, print each node's data element. Link to question https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list/proble... |
My challenge is to transfer examples from textbooks or videos into something I am coding on my own.
Environment
Visual Studio 2022
Net 7.0
ConsoleApp
My goal
My idea is to have a solution to provide messages to a console. Like "press enter to continue ..." or "you are leaving the app ...". And some functions like "clea... |
I used cppreference list to implement this simplified std::list.
The CXX_STANDARD is 11.
My questions are the usual:
Is the design is ok?
Did I miss any bugs?
Anything else?
The list implementation in list.h
//
// Created by shiby on 23-6-26.
//
#ifndef CPPDATASTRUCTURE_LIST_H
#define CPPDATASTRUCTURE_LIST_H
#incl... |
Intro:
I am learning about the model view controller (MVC) architecture and I am looking for feedback from more experienced/knowledgeable people so I can check if my understanding is sound, and learn about where I can improve.
Background (optional):
I have separately implemented a simple metronome app. While developin... |
Is there an existing class in .Net for representing and querying hierarchical data; i.e. providing methods which allow you to test whether one item is an ancestor or descendant of another, or to provide a way to fetch all ancestors/descendants recursively from a given object?
Failing that, I've created a very basic exa... |
I decided to implement a Makefile for a personal project I'm working on (I've never created Makefile before) but I need to learn for an upcoming work assignment. The Makefile it's supposed to build the unit test binary(graphs_test/graphtest) for my graph API code. My directory structure for the project is as follows:
.... |
My plan is to allocate a fixed amount of static memory at initialization (a few MBs), and use a stack allocator for quick temporary buffers. The idea is to avoid calls to malloc() for these kinds of temporary buffers (should be safer this way), but still being able to return it from a function (and then freed) if neede... |
I am new to C++, so please take me easy. I want to make a low-level game engine only using C++, OpenGL and GLFW. This is a continuation of Event System using C++ ; I added the suggestions from there. Here's a diagram of the improved event system:
I also added an InputManager:
I know I could implement a FSM for the In... |
Background: I'm a BI developer building a new dashboard for a client. They want to track performance for the week/month/year to date against the prior period. Unfortunately, I don't have direct access to the data source and I only have an extract containing two weeks of data. This means that most of my period over peri... |
Recently I have been attempting to develop a ray caster in python pygame. I managed to get it to work fairly efficiently when using basic colors, but when I altered the program to use textures instead, it led to many performance issues, even when using low resolutions. So I am curious to know how I can optimize my code... |
I have 10 or 20 tests with the same structure which I would like to improve. The test itself is nested within a try/except/finally clause to make sure that some of the variables are deleted at the end.
def test_time_correction():
"""Test time_correction method."""
sinfo = StreamInfo("test", "", 2, 0.0, "int8", ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.