instruction stringlengths 71 95.1k |
|---|
I have written a very simple algorithm vizualizer where all input is coming from the mouse and I needed an event manager for that. Since I never wrote one before, I wrote a 30 min implementation to act as a placeholder. Now my question is, whether or not I get the idea of an event manager right, does it look the right ... |
I've written a solution to make creating new interactions easier but wanted feedback to see if there is a more effective way of going about this.
I've written a script called interactable which is what the raycast on the player looks for. The interactable than says that the player has interacted with it. Then, another ... |
I have the following dataframe:
country_ID
ID
direction
date
ESP_1
0
IN
2021-02-28
ENG
0
IN
2021-03-03
ENG
0
OUT
2021-03-04
ESP_2
0
IN
2021-03-05
FRA
1
OUT
2021-03-07
ENG
1
OUT
2021-03-09
ENG
1
OUT
2021-03-10
ENG
2
IN
2021-03-13
I have implemented the following functionality:
ef create_columns... |
Can I improve this code and make it more beautiful? For example, for expressions in ReadConsole method is ugly for me.
string _name;
public string Name
{
get => _name;
set
{
// Only letters, whitespaces and '-' are avaiable
if (value.All(c => char.IsLetter(c) || new string(" -").Contains(c)... |
I am new to BDD/Specflow and was wondering if I could get some feedback on my definitions
Here is what I have for a simple customer creation feature/command:
Scenario: Creating a customer with an account number that already is used
Given a customer already exists with the account number CUSTOMER001
When I try t... |
I have a c++ project written as a Matlab Mex program that is constructing an image composed of IxJ pixels. Each pixel value is calculated by finding the contributions to that pixel from all the channels (columns) in a KxL RF data matrix. The exact value of the row index 'k' of a given column 'l' that contributes to the... |
Are there any thing that I have to consider to improve the following code in either performance and others? Any comments and suggestions are welcome!
#include <iostream>
#define PI 3.1415926535897932
double sin(double x, int n = 100)
{
double term = x;
double sum = term;
for (int i = 1; i < n; ++i)
{
... |
I'm new to Unity/C# and I'm trying to get a 3D GameObject in a square pattern, using transform.position:
void Update()
{
bool flag = true;
if (transform.position.x < 4 && transform.position.y >= -4 && flag == true)
{
Debug.Log("right");
... |
I'm using the SerialPort in C# using Visual Studio 2019.
My SerialPort has 2 "pump" tasks, which are private members of my SerialPort, and are started during an Initialization method:
private Task _RxPump; // Task to receive commands in the background
private Task _TxPump; // Task to transmit commands in the background... |
I have designed a class to perform float compare. I used Knuth's strong compare to do it. Float compare is really really tricky, I'm sure there's something wrong :) Any comments?
#include <limits>
#include <cmath>
#include <assert.h>
class FloatUtils {
private:
FloatUtils();
template<typename T>
static T s... |
This exercise comes from Automate the Boring Stuff Ch 7. The assignment is to use regular expressions to test the strength of a password. Password must be >= 8 characters, contain at least one uppercase letter, one lowercase letter, and one number.
Any and all criticisms/suggestions for improving the code are welcome.
... |
I'm going to use these classes in a program I'm working on, so I want to see if they're correct or could be improved.
https://pastebin.com/qx7ccteT
#include <cstdio>
#include <cstdlib>
class FileHelper
{
public:
FILE* f = NULL;
char buffer[8192];
int bufferPosition = 0;
int bytesRead = 0;
FileHelp... |
I've been studying design patterns from GOF for a few weeks, especially in C#, and I'm struggling with Memento Pattern. I know there are a lot of C# implementations on the web, but I came up with my own version of it. The question is: although it diverges from GOF UML, is it still reasonable and valid considering SOLID... |
Occasionally, I do some web dev on computers where "inspect" is disabled, which can make debugging JavaScript (a language that is really good at dodging errors) a real pain.
I've created a JavaScript file that when you include it via a script tag on an HTML page, it will rewrite the console handlers and add some elemen... |
I'm having an implementation using SerialPort in C# using Visual Studio 2019. I'm using it in a Windows Application, using .NET Framework 4.7.2.
When I open and initialize the SerialPort, I'm launching 2 "message pump tasks", one for receiving data and one for transmitting data.
The SerialPort has a ConcurrentQueue to ... |
I am currently still using a ListBox. In this, all products are displayed one below the other. For each individual product, properties are separated with tab characters. I would like to align the properties sensibly, but only look at the BrandName for now. Therefore, I get the length of the longest brand name and check... |
Given the following dataframe:
| ID | date |
|---------------------|--------------------------------|
| 1 | 2022-02-03 22:01:12+01:00 |
| 2 | 2022-02-04 21:11:21+01:00 |
| 3 | 2022-02-05 11:11:21+01:00 |
| ... |
I have implemented an array based pseudo-generic stack in C using macros. The code works fine for all data types. Is it a good idea to implement such a data structure using macros?
array_stack.h
#ifndef ARRAY_STACK_H
#define ARRAY_STACK_H
#include<stdlib.h>
#define array_stack(type) struct{size_t _size;size_t _capac... |
I am using the following VBA to fetch multiple specified Email addresses from inbox and sent items folder also including cc and bcc
for eg(gmail.com;yahoo.com) must return all mails having that domain name.
the problem is it takes a whole lot of time and I mean if a person has 2k emails (overall) he might have to wait ... |
I'm wrote a basic chatterbot. What would you do to pretty much improve it and make it better than this?
Because I want this chatterbot to be the best it could be, and I really want other peoples' opinion of how they would improve it. Here is the code:
import tkinter as tk
# --- functions ---
def cmd3():
# defau... |
Basic implementation of a leaky bucket, the idea is you call it by saying I will allow e.g. 5 login attempts per 60 seconds.
//Leaky Bucket algorithm with chrono
class RateController {
int n;
std::chrono::steady_clock::duration interval;
int cnt;
std::chrono::time_point<std::chr... |
I am trying to solve a heat diffusion type PDE using a finite difference method.
I would like to preface that I have seriously simplified the code. Just so that anyone who tries to help me, doesn't get caught up in the coefficients of the PDE.
I am trying to move away from using the 4x nested for loops, and instead wou... |
I'm trying to build a Kraken portfolio bot and started out with a simple layout for loading the balances. If possible, I would like to get some feedback on this initial design.
The API key provided is only to read funds so don't bother to try out something else.
After this, the idea is to set one account as the main ac... |
In a Pong-style 2D game, a ball (a circle of radius BALLRADIUS) can bounce (with perfect elasticity) on the top or bottom of the screen. When it hits the left or right side of the screen, one of the players scores a point. This function calculates the y-coordinate at which a ball initially at coordinates (x, y) and tra... |
I am reviewing the database class for a live website. I am not sure if the current connect function is the best way to create a pdo object as it appears to create a new connection every time it is called. I have read so many different opinions and examples I'm not sure which approach to take.
This quote from https://ph... |
This is a simple implementation of an Entity Component System manager. Components are stored in arrays of uint8_ts, because I couldn't figure out how to just have arrays of the raw components.
// ecs.hpp
#include <unordered_map>
#include <vector>
namespace ecs {
class Pool;
class Registry;
using Component... |
This post presents my take on TSP (travelling salesman problem). The idea is to:
Take an input node i,
Compute the entire graph G reachable from i
Compute the all-pairs shortest paths for G
Shuffle the current tour specified number of times and choose the shortest one
GeneticTSPSolver.java:
package com.github.coderod... |
I recently took part in an algorithm challenge to create a Fuzzy search with the following criteria:
Given a set array, create a function that receives one argument and returns a new array containing only the values that start with either:
A) The argument provided
B) The argument provided but with 1 difference (i.e. 1 ... |
I have written a program in C, which encrypts and decrypts a c-styled string (const char *) and print the result to stdout. It requires key (const char *) and it's hash is calculated using Polynomial Rolling Hash.
My program makes sure that the hash of key must be in-between 0...128, using statement like size_t hash = ... |
I'm trying to convert a data set that is split into two rows into a single row. This was my solution.
Public Sub Convert()
Dim a, b, c, d, e, f, i As Integer
Sheets("UASHEET").Cells.Clear
a = Application.WorksheetFunction.CountIf(Worksheets("DATA").Range("I1:I15000"), "*/*")
'Find how many time iteratio... |
I am new to C programming and DSA. This is my implementation of a Linked List. I am looking for feedback and tips to improve the code design.
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
int number;
struct node *next;
}
node;
// Function declarations
node *createList(node *head, int number);
v... |
Discussion
I just started learning about Merkle Trees and wanted to get some practice by attempting to implement a very simple Merkle Tree.
The constructor for the tree takes some type of hash function, and an array of byte[] values that represent the "leaf" node values.
I construct a tree by first hashing the leaf nod... |
I have been practicing C and I wanted to reverse each word in a string. I wrote this code and although it works, I am not happy with my solution. It requires twice the length of the original string to store the result and buffer respectively and there are too many if statements which makes the code hacky. I am wonderin... |
I would like to share this post with the community since at first glance it is very promising. Storing flags in the database is something that I have been interested in doing for a while since it seems like a lean way to store some bit options which become ugly with Is[this], Is[That], and Is[Whatever]. However, I have... |
I have a std::unordered_map where a key will map to a value that is an array of a simple type (a type with no dynamically allocated members). The array can't be templated (to my knowledge) because it has to be stored in the std::unordered_map. This is the implementation that I came up with to deal with this.
class Pool... |
I am working on Word Ladder - LeetCode
Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:
Only one letter can be changed at a time.
Each transformed word must exist in the word list. Note that beginWord is no... |
Discussion
I've been trying to increase my knowledge of Java Streams and for practice, I devised up the requirement of partitioning a Stream of values into a Stream of a List of values.
Implementation
package data.structures.streams.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.Spliterator... |
Is the following an acceptable way to change an object column to numeric if cardinality threshold (cardinality_threshold) is being breached? I think it would be good to check if column values are numeric though. Thanks!
data = {
'col1':['1', '2', '3'],
'col2':['1', '1', '2'],
}
df = pd.DataFrame(data)
df
c... |
I'm creating custom classes to represent Planes and Lines on a 3d graph. To help improve the performance of my process I've started implementing __eq__ so that I can eliminate duplicate objects in a list using objList = set(objList).
I'm wondering how to efficiently expand the __eq__ methods so that it can compare if t... |
What does the code do?
Albeit unfinished (it does work, it's just not complete yet), the code creates a database (members.db) where telephone numbers, IDs, and names are stored. After which, the user can input what they'd like to do, e.g. show every telephone number in the db, every surname etc. The plan further down t... |
I'm trying to read quite big file with around 28 million of rows in the following way:
var jobs = new ActionBlock<string[]>((jobs) =>
{
//Some code
});
var pool = ArrayPool<string>.Shared;
var items = pool.Rent(1000);
using (FileStream fs = File.Open("test.csv", FileMode.Open))
using (B... |
I wrote a program that uses the sigpending () function. The program returns blocked or pending signals.
My question is, what else could I improve or what problems does implementation have? Possible bugs?
code:
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
void catcher(int signum) {
puts("inside catche... |
The code below removes trailing zeros exist for each row id.
This question has been resolved here https://stackoverflow.com/questions/69452882/delete-column-depending-on-the-date-and-code-you-choose. However, I wouldn't want to use a long pipeline as done, using pivot_longer. Is there any reasonable way to do this? The... |
Airlines need to provide their customers with flights to every corner, so they need an app that allows them to do so. The customer must be able to transfer when there is no direct connection.
The developer's task is to prepare the following functionalities:
selection of airport A and airport B
showing the shortest pos... |
During 2021 I was learning to code but I left it because I didn't have enough time and energy. Today I started my come back to coding so I created a simple tic-tac-toe game.
I didn't use objects, classes and related stuff because my main goal was to write something simple and completeable in 1 to 2 hours. I had to goog... |
Problem on Algorithm for same like 'stations'
Problem is to use weather data to run ARIMA model fit on each group of like named 'stations' with their associated precipitation data, then finally execute a 30 day forward forecast. Looking to process specific same named stations and then next process the next unique same ... |
I wrote a quick algorithm that detects a win in a TicTacToe Game.
fn game() loops through a simulated ticTacToe board, finds all the index's of a given value, then loops through all the possible winning combos, finds any index's where the actual value is equal to the index's from the first loop, (I know :/) then replac... |
Yesterday I build some generic functions for the new official Golang 1.18 release. What do you think about it and what could be added and improved?
package main
import (
"fmt"
"log"
"reflect"
)
func ToString(this any) string {
return fmt.Sprintf("%v", this)
}
type List[V any] []V
func (this List[V])... |
I have lots of switch statements. These are may be more than 200. We are update the object according to conditions.
How can improve this script
function getJSONFormat(content) {
const attrbutesArr = [];
let attributes = content.attributes;
for (let i = 0; i < attributes.length; i++) {
let attr... |
I'm writing a vector class for 2D geometry applications, and below is a rough draft for a unit test using Cpputest. I'm familiar with unit tests, but this is the first I've done for a purely mathematical class, and I'd really appreciate any insight or feedback no matter how small; even personal preference and knit-pick... |
Can I improve this code and make it more beautiful? For example, I am using a switch statement and for each page but I only add edits to page 1 and page 2?
byte[] b = null;
MemoryStream stream = new MemoryStream(buffer);
string _Number = "4.2021";
string _disclaimer = "Text";
using (MemoryStream returnMemoryStream = ... |
I wrote the following bash script to run queries saved in files and save them to csv files. The queries have to be run against a BigQuery database. I use the bq-cli for this purpose (link to documentation). The script looks as follows:
#/bin/bash
# Setup filepaths:
ROOT="/app"
QUERIES="${ROOT}/queries"
RAW="${ROOT}/tm... |
Here's my code - I've a lot to learn so any advice, tips etc would be welcome!
A few notes:
I'm using OpenCV and numpy for other features in this code, not just for this snippet.
The main readon for making frameDelay a class was as a way of passing another variable into the on_press function
The weird infinite while lo... |
Solving the problem
Write a function that accepts a string of words with a similar prefix,
separated by spaces, and returns the longest substring that prefixes
all words. Sample input and output
The string “swift switch swill swim” should return “swi”. The string
“flip flap flop” should return “fl”.
I have
import Fou... |
I wrote this code in Java as a "Truth or Dare" game where if you type "truth" or "dare", it will pick a random number from the switch and then output the truth question or dare. The code works great but what I am looking for is critique.
I'm self taught and pretty new at coding so do you have any suggestions on cleanin... |
I wanted to share my first experience with JavaScript. I've been taking JS courses for the past 2 months and finally got the first chance to code a small guess-my-number project.
(Everything is completely coded by me and took 4 hours in total. I wanted to test my skills.)
Am I on the right path? Is the code clean enoug... |
I am a PhD student working on a machine learning project with binary classification and RESNET architecture in TensorFlow. I believe I have done everything correctly but I am looking for some validation that the code is correct as I have no one to check my work. I am working in Google Colab with two programs: 1 to spli... |
I did this the way I could (I mean this way I find it okay for my knowledge and of course the most important output is the correct one , but as I know it is also important that the code looks clean and minimal).
I have to figure out some tasks that you will see in the output, apart one where I have to implement bi dire... |
I wrote a program that calculates the multiplication of two matrices (of compatible dimensions) where each element of the resulting matrix is calculated by a separate thread. Each thread calculates a single element in the resulting matrix
My question is, what else could I improve or what problems does implementation ... |
I have a query that can be seen on this fiddle and I'm relatively new to PSQL, having a few months of experience.
DB Fiddle
As mentioned in the comment I should put the query here and the code is perfectly working. The reason for this question is to find an improvement on it.
The link to the third party is to show the ... |
In Dungeons and Dragons, we have many spells, e.g. the Charm spell to get anyone to do what you want, the Web spell to entangle someone, the Invisibility spell to make yourself invisible (but once you attack or cast another spell,
you lose your invisibility). Implementing these spells is not a problem, and each spell ... |
Do you have any criticisms or corrections or improvements?
I need to read only numbers(and this numbers could be from 0 to 1000000)
void fast_input(int* int_input)
{
*int_input=0;
char next_char=0;
while( next_char < '0' || next_char > '9' ){ // Skip non-digits
next_char = getchar... |
While solving an online excersise I have written some basic implementation for a visit function that works with std::any.
The idea is to facilitate the declarative approach for handling std::any instead of using switch of nested if else constructions which are very hard to maintain.
Unfortunatelly, C++ lacks reflection... |
There is a String.Replace method in C# and it is 1-1 mapping replacing operation, i.e. single Unicode character / string source replaced with another single Unicode character / string target. Considering the case of 1-to-multiple replacing task, for example, replacing "1" in "123" with "A", "B" and "C" separately (res... |
I need to find the number of five-digit octal numbers in which all digits are different and no two odd or even digits are adjacent.
My code below gives the correct answer, but I'm not satisfied. Can you help me improve it or how would you solve this task?
from itertools import product
c = 0
for args in product((0, 1, ... |
I'm using Haskell to interpret a dynamically-typed language. I have a sum type called Value which can represent some basic objects:
data Value
= Integer Integer
| Float Double
| Char Char
| List [Value]
deriving Show
(For now I'm not adding a special case for strings - they'll just be lists of characters.)
I... |
I am a freshman Computer Engineering student.
Variable names are pretty straightforward; I believe it would be easy to understand.
Program explanation:
First you have to create an account and deposit money into it. Create method that runs and writes your id and password in separate text files and calls deposit_first w... |
I created custom hooks, which allows to fetch the API using two request methods 'GET' and 'POST'.
Use cases:
const { data: fetchData, loading: fetchLoading, error: fetchError } = useFetch('/url');
const { data: postData, loading: postLoading, error: postError, post } = useFetch('/url', 'POST');
<DisplayData data={fet... |
The exercise is Write a JavaScript package that is able to:
fetch an array of URLs which contain JSON data
return their contents in a promise
I have already made a solution to this exercise, but I would like some input on how to improve this solution in terms of efficiency, security and complexity. I have also includ... |
import random
myNumbers = [random.randint(1, 10) for i in range(0, 7)]
myNumbers.sort() #Binary search works on a sorted list.
print(myNumbers)
#How about this code:
binSearch = lambda anyList, item: anyList[int(len(anyList)/2)] \
if anyList[int(len(anyList)/2)] == item \
else None \
if int(len(anyList)/2) == 0 \... |
I've updated some of the type hinting/documentation in a lib called pygrib. The source documentation
can be found here.
The goal is to extend the Cython api with the associated native type hints and maintain an open ended platform for future growth, IE more methods like to_dataframe()
pygrib uses Cython to read gridded... |
Working through a book problem
Write a function that accepts two values and returns true if they are isomorphic. That is, each part of the value must map to precisely one other, but that might be itself.
Tip: Strings A and B are considered isomorphic if you can replace all instances of each letter with another. For ex... |
I have written a program for the SPOJ PALIN problem:
A positive integer is called a palindrome if its[decimal representation is the same]from left to right and from right to left. For a given positive integer K of not more than 1000000 digits, write the value of the smallest palindrome larger than K to output. …
My p... |
I'm into Python from only about a month, coming from nothing.
I didn't make any complex program yet, but I'm almost there, as one is almost ready to be used, like if I'd sit there for another hour or so I could finish it.
This is the first function I consider myself proud of, as it's the most complex one I created, for... |
This snippet processes every regular (\w+) word in a text and reinserts the processed version:
import re
import time
def process(word: str) -> str:
time.sleep(0.05) # Processing takes a while...
return word.title()
text = """This is just a text!
Newlines should work.
Multiple ones as well, as w... |
Thumbnail Scraper
I'm a C# programmer learning F#. For my first program I created a console youtube thumbnail scraper. It parses command line arguments with argu and then downloads the thumbnails, displaying download progress with spectre console.
Usage
Example arguments:
--channel-name (chanel name) --save-path (valid... |
My goal is to take an input stream (text file), and then parse it into a tree node based on each line's indentation.
My rules are
Lines can be indented using either tabs or spaces, but the file must only consist of one type of indentation.
A line can be indicated as a child by having a larger indent than the previous ... |
I was wondering on how to make the execution time faster. Is there a way to make it faster with this method or do I need to make with another method? If someone have any solution please help me. because I'm really struggling with this and I tried many different things and my lecture said that this code's execution time... |
I made conditional calculator in Vue js but I need help to make it more efficient.
https://jsfiddle.net/wbrx9cyp/1/
example of code:
essentialPackage(){
this.essentialToggle = true;
this.mediumToggle = false;
this.extraToggle = false;
if(this.shortToggle && this.essentialToggle){
this.packagePrice = 1.2;
... |
Is there a simpler way to get this result?
Also what is the syntax in fish for adding numbers to an array index before executing the lookup? arr[$i+1] did not seem to work...
desired output:
1-6
6-11
11-16
etc
but it would also be good to know if there was a generic unix tool to get the above output or similar:
1-6
7-... |
I'm unsure whether the way I'm performing initialization is recommended, and whether there is a simpler way to save out a struct like the one I'm using. The main points of feedback I'm looking for are around the use of memcpys and reinterpret_casts or (char*)& casts and whether they are unavoidable.
Additional backgrou... |
Background: I am learning web dev and decided on the Django framework as an excuse to learn Python at the same time. (Background is stats with lots of R and C++).
I wrote a Django app to assist with a popular word guessing game. There is a very simple model:
from django.db import models
class FiveLetterWord(models.Mod... |
I have designed Conway's Game of Life in Java, the solution follows Object Oriented design and paradigm, please review and let me know the feedback
Class Cell
Cell has one property alive and behavior to update alive status
public class Cell {
private boolean alive;
public Cell( boolean alive) {
this.al... |
Following the avro schema documentation for decimals I've created a method to turn a decimal into a byte array. The goals are:
Should be represented by a non-scaled integer
Should be big-endian
I've tested the code I wrote, but I'd like to know if the program still works in any unforeseen corner cases.
private static... |
Just started learning Go recently. Did some questions from Cracking the Coding Interview book. Wrote the solutions in Go. Let me know what you think.
https://github.com/samjingwen/ctci
Below is question 1.2 from the book:
// CheckPermutation Given two strings, write a method to
// decide if one is a permutation of the ... |
I create a 4-dimensional (x, y, z, t) array of zero values. I then set the initial values at t = Tmax. To do this, I use a nested for loop. I attempted to improve on the code by getting rid of the nested for loops, and replacing it with a single line of code. It works, however, I am not sure if the line
f[:, :, :, N] =... |
I'm writing a function that validates array-like container to have correct type, length or to be hashable. Some of conditions may not be used for validation.
def check_container(container, type_=None, length=None, hashable=None):
"""
Validates container to have correct type and length, or hashable parameter.
... |
I found two ways in which I can use a custom C++ function (returning a 2D matrix) in Python. One approach that uses the Python module ctypes and another that uses the Python module pybind11.
Approach 1 using ctypes:
I followed this tutorial (e.g., https://stackoverflow.com/questions/64084033/modern-2020-way-to-call-c-c... |
Motivation
I am interested in optimising the execution time of code with short (fast) execution times on the order of microseconds (µs), but that will be used with high frequency (e.g. like min(array) and max(array) or arrays accessed through a class interface). The code execution time can then be shorter than the reso... |
In the script below I need to search in multiple files, and find a string, and replace with another.
It's basically version numbers (which need incrementing). Every time I find the old version number, and replace with a new version number.
The script is working well, but maybe has a cleaner way to search the old versio... |
I program in Python as a hobby and this week I decided to write a program that generates 16 character long passwords. I wrote this program as a class, which i rarely do. Because of this I think I still have a lot of room to improve with the setup and build of the class. I wrote this to use for my work and it's (fully) ... |
I have been learning Rust for a few days (This is my third) now, and I've really fallen in love with the language, this is my first real project, Hangman. I was wondering what I could do better / what is currently fine.
lib.rs:
use rand::Rng;
use std::fs;
use std::io;
#[derive(PartialEq)] // im not even sure what this... |
This question is related to my first post on this forum. Since the rules are not to make the questions too broad, I thought I'd create a new question.
I'm not experiencing any issues with this piece of code - it seems to work as intended - but is there a way to make this less... "spaghetti"? I'd like to refactor it to ... |
I won't restate the problem in full, but in a nutshell you have to parse a file with a "direction" and a "magnitude", for instance:
forward 8
forward 3
down 8
down 2
up 1
forward affects your horizontal position and up and down your vertical position. There are no other directions.
At the end, you're asked to multiply... |
I have a method that iterate over my table question in database and then will split a column commentaires and finnally put results in table propositions column commentaire
so I have a code that read a large set of data DicCom 16400 rows and then lstProp with 7 rows so in total we have 116000 rows to modify.
Here is my ... |
This logic get data from a database and checks if the inbound ipAddress is within the range or if its equal to one we have stored in the system. In production its using a SqlDataReader but in the working sample I am just using a DataTable. How I could possibly improve the code quality with using the SqlDataReader
publi... |
I want to sum up and flatten the structure of an API response. Since I didn't succeed by iterating over the key/value pairs of input.statistic I came up with another solution which does the job but I'm not happy with it.
What I do recieve is:
input = {
"data": some unimportant stuff,
"statistic": [
{
"valueId... |
The following script changes start and end dates of several queries saved as files in the folder /app/queries. It is used by executing the script and passing two date strings as arguments, for example:
./config_query.sh 2022-03-28 2022-03-30
This would change all start dates of all queries in the folder /app/queries w... |
I am trying to process a very large binary file using MappedByteBuffer from java.nio package.
This is how the data looks like in the file:
[0, 12, 83, 0, 0, 0, 0, 9, -11, -66, -116, -91, 100, 79,
39, 82, 0, 1, 0, 0, 10, 52, 126, -35, 45, -75, 65, 32, 32, 32, 32, 32, 32, 32, 78,
32,0,0, 0, 100, 78, 67, 90, 32, 80, 78... |
(A more efficient version of the GA.)
This is my the very first take ever on GA:
GeneticTSPSolverV1.java:
package com.github.coderodde.tsp.impl;
import com.github.coderodde.tsp.AllPairsShortestPathData;
import com.github.coderodde.tsp.Node;
import com.github.coderodde.tsp.Utils;
import java.util.ArrayList;
import jav... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.