instruction stringlengths 71 95.1k |
|---|
Given the following generic memoize utility for pure functions with type hints:
function memoize(callable $fn, callable $serialize = null): callable {
$serialize = $serialize ? $serialize : 'serialize';
return function(...$args) use ($fn, $serialize) {
static $cache = [];
$k = $serialize($args)... |
I am trying to solve the warning, which avoids the call of a virtual method, I have seen different answers, but none of them seems to solve my doubt, I understand why this warning appears and is one of the ones you should not suppress. My code gets data from Matlab and uses a method to configure the limits in a usercon... |
I'm working through the classic "99 problems in prolog" collection. But trying to do them Pythonically. Flatten a list is problem 07.
I am flattening a list of lists of arbitrary depth. I have two solutions below. Which is more Pythonic?
# helper function
def isList( x ): return isinstance( x, list )
def flatten3_h( *... |
I started learning functional programming with JavaScript and I have the basic idea of Functors, container types and etc. I was trying to experiment with arrays but I don't know how to solve the problem of a function call that iterates over a array and returns returns another array. So the first call ends up with an ar... |
Goal:
My goal is to filter datagrid by selected month from dropdown options.
January, February, March etc...
I'd like to know if there are easier methods to my current method..
Code:
public Schedule()
{
InitializeComponent();
RefreshGrid();
Dictionary<string, string> allOptions = new Dictionary<string, str... |
I feel like there is a redundency between:
def _determine_nodes_with_no_predecessors(nodes:List[Node])->List[str]:
"""
Given the list of nodes returns the identifiers of nodes that doesn't have any predecessor.
"""
nodes_ids_without_prdecessors = []
for node in nodes:
if not node.predecesso... |
I am trying to solve the following problem:
Input: Input is two arrays (Nx4, sorted in column-2) stored in datasets-1 and 2 in HDF5 file (input.h5). N is huge (originally belonging to 10 GB of file, hence stored in HDF5 file).
Output: Subtracting each column-2 element of dataset-2 from dataset-1, such that the differen... |
Working on finding a way to reduce in-cell formula size and memory usage of my excel workbook, i came up with the idea to "load" (copi-paste) the reference sheet i was mentioning a lot with a workbook open. To make it more efficient i had a loop that verifies if the sheet has changed and only copy-paste it if there a d... |
I have developed NoSQL database.
At the moment it has no threads (async).
When the database needs to save data to disk, it blocks connections until it saves.
This method works OK, because save is fast - 3-4 sec, but I still can improve by background save.
Here is the prototype of the background save facility.
I have th... |
Im currently running an employee name substitution on card scan.
Overall the code takes the entry trough the gun scan, "scan" trough the hidden reference sheet to find a match and then input the actual complete name.
I had to implement that feature to my code so that names are always written the same (for futur data tr... |
Thanks in advance for your interest in my first PyPI project.
While there happen to be a number of projects out there to help with creating & consuming Excel workbooks, I was unable to find one that made working with pywin32 any easier, so I built it myself. Using pywin32 for automating Excel with best practices happen... |
I have this bit of code that works for copy and pasting an autofiltered range. I just wanted to see if anyone knew a more efficient way to do so as it does take quite a while to complete it the way I have it now. I looked into trying to do so with a copying into an array but did not seem to work so I'm happy to hear so... |
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time!
Problem
(This problem is the same as Minimize Malware Spread, with the differences bolded.)
In a network of nodes, each node i is directly connected to another node j if and only if graph[i][j] = 1.
Some nodes in... |
There is a Name class with properties that represent different components that make up a person's name. A Name object requires a FirstName and Surname. All other fields are optional.
class Name
{
public string FirstName { get; set; } = String.Empty;
public string Surname { get; set; } = String.Empty;
public... |
I would like request for a code review and feedback my calculator web page because I want to improve my coding ability.
Basic calculator
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
<m... |
Background
The basics of this project have already been discussed here.
I've improved the following things:
Sᴀᴍ Onᴇᴌᴀ mentioned that I shouldn't use multiple elements with the same id. I corrected that and use classes instead. I also removed units from style.css when the value is 0. Furthermore I removed !important.
Sᴀ... |
I’ve created a function that takes a number and, if it’s prime, tells you so, or if it’s composite, gives you the prime factors of the number (and if it’s 1, tells you that it’s neither).
Theoretically it should work for an infinitely large number, but at 8 digits it starts to slow down significantly, particularly if t... |
I created a simple text-based Tic Tac Toe game in Python using OOP. Currently the computer moves are completely random - I plan to add some sort of algorithm later (no idea how to do that yet though)
Any suggestions about how to improve it are welcome.
from random import randint
from itertools import cycle
class Boar... |
I'm writing an a11y widget with vanilla js, but my code got messy.
Here's my code:
class A11yError extends Error {
constructor(msg) {
super(msg);
this.name = "A11yError";
}
}
class A11y {
constructor(options) {
this.color = options?.color || "#17384c";
this.position = options?.position || "left";... |
I would like a code review for my simple pomodoro utility web page because I want to improve my coding ability.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="refresh" content="55">
<meta http-equiv="Content-type" content="text/html; ch... |
I am redesigning a library, which at the moment uses a lot of boilerplate code in a double hierarchy of classes / metaclasses, to attempt to make it much cleaner and reuse as much as possible what dataclasses already provides.
For the library itself it is not an issue to add the @dataclass decorator when defining each ... |
I've made a very simple book list console app in C#. You can add the name, author and the page number of the book. You can also edit the infos or remove the book from the list if you want to. The code is working but I think it's very messy and don't know how to make it better.
using System;
using System.Collections.Gen... |
As an exercise, I've made a text processing utility that wraps arbitrarily long lines of text, but only using fixed-size arrays and other basic C features.
I have mostly programmed in Python, C++ and Java so far, and I recently picked up K&R (second edition) to learn some C. I have only gone through the first chapter s... |
I'm learning OOP and also trying to learn and implement some design patterns.
This question is a follow-up of Stopwatch interface OOP (Vanilla JS)
The app is available in https://nacho-p5.github.io/
Here's the code:
Repo: https://github.com/nacho-p5/nacho-p5.github.io
The community gave me good feedback and I made the ... |
I'm a new programmer who is currently working on a personal project. It is supposed to be a login program which stores user data in a SQLite database.
I was wondering if anyone could look at my code and provide any constructive criticism. Please contribute, regardless of how insignificant the flaw may seem.
Anyway with... |
I need to download a fairly large xml (up to 2 GB) then load it into memory or possibly an empty db on a stand alone machine on a semi-regular basis. I need to grab a large amount of very specific data from the xmls for a statistical treatment. I realize ETLs like this are usually a one time deal for migrations and the... |
How could this Firestore function be improved, please? This is a question to help us learn to write better code. So by improved, I don't mean made shorter... I mean made clearer as to what it is doing, more efficient in terms of its operations, easier to understand and maintain. I found getting this code working very f... |
I recently build a simple image editor in Python. There is nothing specific that I am dissatisfied about regarding this code. I am just asking for general criticism to help me improve.
import pygame
import random
import time
x = input("Do you want to edit an image?")
if x == "yes":
image_url = input("please ente... |
I was trying to solve a problem that was briefly mentioned at the beginning of the "The Algorithm Design Manual" by Steven Skiena (Ch 1, Problem 26).
It took me some time to build a working program from the pseudocode, and I think I've got it pretty close to the described idea. However my C++ knowledge is lacking, and ... |
This is part of a larger c++ project that I want to migrate to rust (a pdp11 emulator). This is one of the gnarliest bits of the c++ code so I thought I would start with it - its also self contained and relatively small.
Its purpose. It maintains a queue of tasks to be run at some time in the future (typically less tha... |
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time!
Problem
Storekeeper is a game in which the player pushes boxes around in a warehouse trying to get them to target locations.
The game is represented by a grid of size m x n, where each element is a wall, floor, o... |
This program implements the back propagation algorithm of neural network with an example. Can we make it more efficient?
from setuptools.namespaces import flatten
import numpy as np
import math
inputvalues = [0.1, 0.9, 0.5, 0.2]
initialweights = [[0.1, 0.2], [0.3, 0.4], [0.5, 0.6], [0.7, 0.8]]
hidden_initial_weights... |
This is my 2nd attempt at this game, I took advice and tips on the last one from here.
I took tips on how to not let memory stack overflow and to write a bit better story. Do suggest on how I can improve my code in general ? Thank you.
import time #added to enable pause
#A text based vampire survival game
#possible a... |
First post.
Can you please review my code and help me improve my coding. Please also suggest improvements if there is a miss in this post.
Problem Statement
Given two sorted arrays X[] and Y[] of size m and n each, merge elements of X[] with elements of array Y[] by maintaining the sorted order.
i.e. fill X[] with fir... |
After watching Tom Scott explain Huffman coding in this YouTube video, I wanted to implement it myself. I want to use this project to further my understanding of Python. Additionally this tool should be easily usable on the command line e.g. normally input is read from stdin and output is written to stdout.
Did I miss ... |
I am looking forward to an answer to improve this code?
Thanks.
Test class
package test;
import main.algorithms.LargestSumContiguousSubarray;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class LargestSumContiguousSubarrayTest {
LargestSumContiguousSubarray largestSumContiguousS... |
I've seen few similar post about dynamic array in C released as macros, but I tried a new approach to make it looks more like a template, wrapped in a big macros. However I need a review for suggestions or improvements also. Here is the trivial implementation:
dynarray_t.h
#ifndef DYNARRAY_T_H
#define DYNARRAY_T_H
#inc... |
I was looking at a code review of a Tic Tac Toe game in Python when I recalled a talk about not using classes, and I wanted to see if I could write a readable, working implementation of the game without classes.
In order, I am interested in improving the code's:
readability,
simplicity,
idiomatic ("Pythonic") usage.
... |
This is an alternative parser based on the specifications from this question. Briefly stated, the input file is a text file which has at least 33 fields separated by semicolons.
If the fourth field begins with either a T or an E, the line is valid and a subset of it written to the output file. Specifically, fields as... |
I am learning Dynamic Programming and tried to solve the nth ugly number problem using it. Here's my code for the problem in Java:
import java.util.HashSet;
public class UglyNum {
//using DP bottom up
public static int getUgly(int n) {
HashSet<Integer> u = new HashSet<>();
if (n < 6)
... |
As a preface, I'm very new to coding (self-learning) so if you notice any bad habits please let me know, it would be GREATLY appreciated.
I'm self-learning Ruby so I don't really have a frame of reference of if my coding is appropriate, easy to read, difficult to read etc... so I'm thankful for any feedback you guys ha... |
I'm posting a follow-up code on this question, which seems to be a version of Sokoban.
If you'd like to review, please do so. Thank you for your time!
Problem
Storekeeper is a game in which the player pushes boxes around in a warehouse trying to get them to target locations.
The game is represented by a grid of size m... |
I am a beginner programmer trying to go past the simple tutorials like Codecademy. I decided to make a rock paper scissors game to get some practice in making projects. Any feedback is welcome!
using System;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.CompilerServices;
namespace ConsoleApp1
{
cl... |
I have developed the following short JavaScript function to convert numbers to the Indian Numbering System formats; both the Official Numbering System and the Common-Use System (i.e. using the Lakh-Crore System) using the method of converting the number into strings of Siptlets and Duplets.
Based on this wiki article t... |
This is a Bash script that runs commands which builds code using the parameters given.
Code
The task:
I have multiple instances of websites which need to be build individually using individual yarn commands and then copied out of a build folder and placed into their own individual folder. I found this very repetitive a... |
I have implemented a depth first search using a stack (in a separate class). Any suggestions please on improvements for the below code:
class Stack:
"""(LIFO) queuing policy implemented using python list."""
def __init__(self):
self.list = []
def push(self, item):
"""Push 'item' onto the s... |
I'm learning Python and would appreciate any (and all) feedback to improve myself.
input/output example:
>>> list_of_words = ['deltas', 'retainers', 'desalt', 'pants', 'slated', 'generating', 'ternaries', 'smelters', 'termless', 'salted', 'staled', 'greatening', 'lasted', 'resmelts']
>>> sort_anagrams(list_of_words)
[... |
I need to run over all the IP addresses on the CIDR 10.96.0.0/12 network.
There are 1,048,574 IP addresses.
I created a multi threaded program in Go to do it, but even when I use 100 threads it takes lots of time (didn't check exactly but it is more than 10 minutes).
Is there are way I can do it more efficient?
By the ... |
Context of the Problem
I am running a discrete event simulation where at the end of each event I store the state of the system in a row of a dataframe. Each simulation run has a clock which determines which events are run and when, all the simulation have the same initial clock (0) and the same end clock (simulation en... |
I have implemented some meta functions to create sequence for exponents of 2. I would love to know if there is any way to make the code more optimized.
Note: int main() should not be modified. From the requirements of my school:
This program must implement three definitions: sequence<Ts...>, print() and printing_type(... |
I wanted to learn C and Win32 so I thought the best way to start would be to create a simple game to get familiar with the language, so I made Snake. The games works perfectly except for sometimes seeing the game window flash for a split second, don't know what causes it.
Code:
#include <stdio.h>
#include <windows.h>
... |
I'm rehashing some of the basics of c++ and I just want to find useful points along the way of things I can do to improve my coding.
This program has the user enter a number, then the computer try to guess it, with some higher/lower logic.
#include <iostream>
#include <cstdlib>
#include <ctime>
int main()
{
srand(... |
So i read about simple series for Pi named Leibniz Series for Pi. Here is its Link:-
Series . I made a program for it and soon realised that it converges very slows . So i did Euler accelerate for Alternating Series https://en.wikipedia.org/wiki/Series_acceleration#Euler's_transform and made this recursive program:-
im... |
I am solving a problem on Leetcode that requires me to design a hash set. I intend to solve it using linked lists where each linked list would represent a bucket.
I am intending to implement this:
However, I am failing in one large test case.
This is my solution that failed a test case mentioned below:
class MyHashSet... |
When asked to increment / decrement a particular value I usually create specific functions to handle this functionality. Like this:
const increaseQuantity = index => {
const currentItems = [...stock];
currentItems[index].quantity += 1;
setStock(currentItems);
};
const decreaseQuantity = index => {
... |
I coded a registration form and was wondering if anyone could give me feedback on whether I'm lacking any major security mechanisms. I've done loads of reading around the topic and feel it should be secure but expert feedback would be great.
Registration script
<?php
// User/pass only used locally
$host = 'localhost';... |
I wrote code to filter for duplicate elements in an array. I'd like to know your opinion, whether it's efficient at all, or if there's too many objects created, use of both array and list. That's in preparation for an interview. I'm not interested in lambdas (distinct) or helper methods, I'd like to see where I can imp... |
I started learning programing with C++. It runs perfectly, but I wonder what things I can improve following the principles of class inheritance, access, overwriting, virtual functions and destructors, and why.
#include <iostream> // allows program to output data to the screen
using namespace std;
struct Base {
v... |
Back with another Reddit bot. This one provides games of Hangman to an arbitrary number of players simultaneously. Users interface with the bot by mentioning it for a new game. Once that game is started, the user guesses continuously and the bot replies until win, loss, or forfeit. A user is limited to playing only the... |
I wrote this little hook so I could fetch some remote resources:
import {DependencyList, useEffect, useRef, useState} from "react";
export default function useAsyncValue<T>(cb: () => Promise<T>, deps?: DependencyList): T | undefined {
const [value, setValue] = useState<T | undefined>(undefined)
const nonce = u... |
I would like to transform the input
elems = [a, b, c]
terms = [t1, t2]
@spec contains?(term, elem) :: boolean
def contains?(term, elem), do: #implementation
to either of
%{t1 => [a, b], t2 => [c]}
or
%{t1 => [a], t2 => [b, c]}
where
t1 |> contains?(a) #=> true
t1 |> contains?(b) #=> true
t1 |> contains?(c) #=> fals... |
I have implemented a customized memory allocation class template for an assignment. Codes are commented; Hopefully it's clear. I would love to know if there is any way to make the code more optimized.
Note: int main() should not be modified. From the requirements of my school (Must be adhered to):
Implement an alloc c... |
I made a helper function for drawing the map(OpenLayers).
Then I made another helper function for fetch(axios.get) the map URL.
So my question is should I switch from
from .then() (loadMap_before())
to async/await (loadMap()) ?
Which way is better?
Or option3 is the best where loadMapUrl() helper is totally unneces... |
FEN strings are compact representations of chess board positions which allows you to derive the necessary information to start playing a chess game from that position. This includes things like the pieces on the board, castle statuses, etc. More information here: https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_No... |
I have a class as follows, where I want the user of the class to know that setting the Slug property to null is supported, and its getter will still return a valid value:
public class Post
{
public string Title { get; }
public Post(string title)
{
Title = title;
}
private string? slug;
... |
I'm trying to write a script that would (a) fetch StackOverflow questions and (b) update a markdown table with new entries.
With github actions I automated this script to run daily.
Idea borrowed from simonw
Code:
import re
import requests
from pathlib import Path
from datetime import datetime
URL = "https://api.stac... |
I'm implementing a kind of 'heartbeat pattern' with websocket in JS.
The idea is: the server keeps a dictionary holding a Websocket object for each uuid (an uuid is a client).
const WebSocket = require('ws');
const wss = new WebSocket.Server({ port: 8080 });
const DELAY_TO_DECLARE_DEATH_CLIENT = 15000
let websocketsDi... |
I have a class that opens a text file and reads out its content.
This class has a member function that will extract a substring between two given delimiters.
My application needs to extract between 6000 and 7000 substrings of this text file content on start up. Even though speed is not the most important concern, the w... |
I have implemented a zigzag array which will sort smaller greater smaller and goes on...
For example :
3 7 4 8 2 6 1 is a valid ordering.
The relationship between numbers is
3 < 7 > 4 < 8 > 2 < 6 > 1
3 smaller than 7
7 greater than 4
4 smaller than 8
8 greater than and so on
the ordering always has to be "smaller tha... |
I have a List that I want to compare to an Enum.
If a.Value is found in the Enum we return true.
I feel that I should be able to make this a single line, but have struggled.
private bool IsFound(IEnumerable<SomeAttribute> attributes)
{
foreach (AttributesInMethod option in Enum.GetValues(typeof(AttributesInMethod))... |
I have an Excel file containing a free-form text column (that sometimes is structured like an email), where I need to find all first and last names and add an extra columns saying TRUE/FALSE to these fields. I do not need to extract matched data (i.e. note it down in an adjacent column), although that could be an advan... |
Description
A class representing an undirected graph. At the moment, it supports integer values as vertices. An example of the type of graph represented is shown in the following diagram:
It is represented internally as an array of adjacency lists. Each index of this array corresponds to a vertex number, and contains ... |
I have implemented a solution for finding all anagrams. Are there any other suggestions for improving the solution?
package main.algorithms;
import java.util.ArrayList;
import java.util.List;
public class AllAnagrams {
// Sliding window
public static void main(String args[]) {
// s: "cbaebabacd" p: "a... |
I have a script that makes a bunch of api calls (xml) and it's not adhering to DRY because I am repeating a lot of the code in the functions, what would be the best way to clean this up and reduce the amount of repeat code?
def get_api_key(hostname, username, password):
url = 'https://' + hostname + '/api'
valu... |
So I started this question, I believe i have synchronized the methods correctly, need some insight on whats wrong and what should be done. I have to modify ths class Purse so that the method AddCoin is synchronized and implement a synchronized RemoveCoin method with a Coin argument, I believe that is done just fine. ... |
I decided that in order to get better at programming, I should focus on building and improving simple projects. I have made a library program that contains collections of unique books of varying quantities. Although this runs as expected, I am not satisfied with the potential of expanding it to complexities. What are t... |
I would like your opinion of my PowerShell function. Does it follow conventions, and what could can I do to improve it. It is made to create LDAP friendly username from a full name in Serbian language.
function Get-UsernameFromFullName
{
[CmdletBinding()]
param
(
[Parameter(Position = 0, Mandatory =... |
I wanted to make a script that would parse a main file (with int main()) look in its #include "..." local headers, and if they were not in the current dir, then find those headers, then its source files and provided them as implementation in g++. In other words, I wanted to have a script-helper, that would watch for de... |
I write code in a Test-Driven way and I often build my functions starting with tests for the easy edge cases.
For example, given a flat array of Items that have a category property, return an array of Groups, each built with all the items for one of the categories in the input.
One edge case I find helpful to test firs... |
I have two Python lists, label and presence. I want to do cross-tabulation and get the count for each block out of four, such as A, B, C, and D in the below code.
Both the lists have values True and False.
I have tried Pandas' crosstab function. However, it's slower than my code which is below.
One problem with my cod... |
I've created the following SEDE query which calculates the reputation averages of users on a particular site. It also optionally excludes "new" users (users with rep of 1 or 101 so note 100% accurate).
DECLARE @exclude_new_users INT
SET @exclude_new_users = ##ExcludeNewUsers:int?0##
DECLARE @excluded_rep_table TABLE (... |
I have a numpy array called contour of \$N\$ coordinates (x,y) of dimension (N, 2).
For each point in this table, I would like to create a square centered at that point and perform a test on the square formed.
My current code is slow, probably due to the for loop. Can the execution speed be improved?
My code:
def neigh... |
In Python 3.7, I frequently find myself writing something like this in __init__:
self.foo: Optional[Foo] = None
For example:
window = Window()
# do some more setup here before going to user
path = get_path_from_user()
window.build(path)
class Window:
def __init__(self):
self.image: Optional[Image] = N... |
The challenge is to sort an integer array containing only ones and zeros with the lowest complexity possible.
As always, I am interested in any improvements suggested but in this question I am most interested in whether the complexity that I have assigned to the algorithm is correct (as well as the lowest possible). I ... |
I just completed the first release for my first game on Python, called Dungeon Ball. I'm looking for people to test out the app and give me some feedback and constructive criticism. I'd like to use this project as a way to improve my programming skills and hopefully learn some efficient programming practices.
The game ... |
This is mostly an exercise for me to try to understand the differences between semaphores and locks. It's a long and rambling because it took me quite a few tries to understand the concepts. Please bear with me. I am hoping you can either confirm that the lesson I learned was correct or pointing out my misunderstanding... |
I've written a python code for finding the distribution of the leading zeros of SHA-1. Using random inputs and hashing-then-counting. Normally it is expected to fit the n/2^i curve where n is the number of trials. After this, a plot is drawn.
import hashlib
import random
import matplotlib.pyplot as plt
leading = [0] *... |
I use the following code which works as expected. The code uses open ID connect to login user. Because I'm pretty new to node and express, it will be great if I can get some tips for the async usage- e.g. if I’m doing it and the error handling correctly.
The code is doing connect via oidc layer
https://en.wikipedia.org... |
I have a Spring service that calls a few methods to
@Service
@RequiredArgsConstructor
@Slf4j
public class CarService {
private final CarRepository carRepo;
private final Mail mail;
public void syncCars(Set<CarInfo> carInfos) {
carInfos.forEach(carInfo ->
carRepo.findByCarI... |
Previously, I built a scraper to get ranking data for ATP # 1 over the years. See Webscraping tennis data, and follow ups.
Now, I use the data to rank the players on the basis of how many weeks they've spent at #1.
I'd appreciate general feedback on code style and structure. The Scraper class is unchanged, so really ev... |
When I first tried to implement std::function I thought it would as easy as creating a class that holds a function pointer. Consequently, I quickly figured out that I was wrong when I tried to use it with a capturing lambda and got an error message. As a result, I quit and until recently I wondered how std::function wa... |
Purpose. Provides a background task queue so that code can ask for a function to be run at a specified point in the future. They indicate what to run (a closure) and when to run it (also a name just used for tracing). My use case is typically 2-3 items queued at any time, typical items are very fast (think read 100 by... |
I am using the library geoip2 to get Geolocation of many IP adderesses
"""
input:
str: IP
output ordered list:
[0] str: City, State, Country
[1] tuple: (Lat; Log)
[2] str: Postal
"""
for i in pd.unique(df_to_print['requesterIp']):
res = reader.city(i)
# NOTE: Second snippet is added... |
I am trying to extract and save images from a Dicom dataset. It is taking approximate 4-5 hours to process 1000 files. (Also, I am reading and saving files in an external hard drive so there is a time lag due to this factor too)
Is there a way to expedite the program as I have more than 10k files and it'll take me fore... |
Client
From a POST request I get a mixed structure of an array and JSON. To handle multiple type of elements I am using var_dump to get the passes. For $_POST I get this:
array(2) {
["json_data"]=>
string(677) "[{"firstname":""},{"lastname":""},{"email":""},{"countryCode":""},{"phone":""},{"i_signup_password":""},{... |
I have a set of connections and protocols for which I am writing unit tests. Their purpose is to assess 2 vectors for validity and consistency; that is there must be not any elements that have been lost, received out of order or are invalid.
Vector to send is always sorted.
I came up with a naive function to make such ... |
from enum import Enum
from fastapi import FastAPI
app = FastAPI()
Hi Defined a route and a Enum Class for the same but the Enum Class looks ugly.
class Subjects(str, Enum):
path1="AcceptedEventRelation"
path2="Account"
path3="AccountChangeEvent"
path4="AccountCleanInfo"
path5="AccountContactRole"
... |
This question is abut coding style. I'd like to see how would you improve this code look considering readability as well. Feel free to upvote others solutions you find good.
#1 Initial version:
SELECT greatest(
0,
least(
500,
(SELECT g.c_daily_limit * (
SELECT count(*)
FROM rivals.t_rival_gr... |
I have a React functional component where users can add a movie from a list to their dashboard. I'm displaying a toast (Material UI Snackbar) to show the result. The result can be good: movie has been added, or bad: movie is already added to your watchlist.
const addMovie = (movie: IMovie) => {
const isMovieDuplicate... |
Microcontroller receive data on uart and call parser_i2c function when user presses enter
e.g. parser_i2c(I2C scan)
I want to parse following input from user communicated through uart
I2C scan
I2C read read_adress
I2C Write Write_address data
I have wrote following code
void parser_i2c(unsigned char str[20])
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.