instruction stringlengths 71 95.1k |
|---|
I would like to build a common helper for my application that will manage all the amqplib calls from all of my nodeJS microservices.
I would like to import my amqplibHelper to every microservice and use only my helper commands that they will call internally to the amqplib node.js library so I will be able to use differ... |
I am using the TPL library to parallelize a 2D grid operation. I have extracted a simple example from my actual code to illustrate what I am doing. I am getting the desired results I want and my computation times are sped up by the number of processors on my laptop (12).
I would love to get some advice or opinions on m... |
Yes, I know we have a lot of these.
I'm new to Clojure, but not to lisps. After the recent (javascript?) parentheses-balancing Q, I decided to do an implementation in Clojure for practice with the language. (It also happened to make a nice accompaniment to my rant about students learning what is and isn't possible with... |
Folding in vim has bugged me for a while. What I intuitively want is for the details to be folded, but the overall structure of a file to remain unfolded. This way I can navigate around a file to see the structure quickly, and open folded sections when I need to dive into the details.
What I have been doing before toda... |
I have solved the MinRouterPeripherality task in codility using javascript using Breadth First Search(BFS) approach.
However time complexity is O(N^2). I am really struggling to make performance improvement necessary so I can get the time complexity to possibly O(N) or close to it
Task: https://app.codility.com/progra... |
I'm very new to Rust and as I've been going through the book I became very interested in its macros. To better understand them I tried to write something of a usable list comprehension like those in Haskell and Python. I've asked and had answered a question on SO in the process: Rust macro error: local ambiguity: multi... |
Is it possible to automate the array inside the while loop and automatically assign the key name based on the row so I don't have to spell out each one?
$stmt = $conn->prepare("SELECT * FROM tickets_info WHERE ticket = ?");
$stmt->execute(array($_POST['ticket']));
if ($stmt->rowCount()) {
while ($row = $stmt->fet... |
Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list.
Example: given words = ["practice","makes","perfect","coding","makes"]
Input: word1 = "coding", word2 = "practice"
Output: 3
We assume word1 does not equal to word2, and both are in the list. Lis... |
Mainly used Stack Overflow, so first time over here for a code review. I am trying to make some enhancements to a legacy application. I have some minor experience using Laravel, but this application is using quite a heavy procedural approach, and I am struggling to work out the best way to structure thing in an OO sens... |
My custom Logger class works just fine. However, the class is not intended for making instances of. Because there is really no reason to make instances of my class, or so I think.
Any constructive criticism? Is this considered good "design"?
I have a feeling that I shouldn't open and close my file for each method call... |
I have recently finished a "django for beginners" book that ended with creating a small articles site. The last chapter adds a Comment model which is linked to Article model. However the comments are just created in the admin page. As a continuation of the book I wanted to test what I have learned and add the ability t... |
I have this code that works, but I'm sure that it can be done better, any suggestions?
Dictionary<string, StrainGroupings> GetOperationStrainGroupings(string locale)
{
var result = new Dictionary<string, StrainGroupings>();
try
{
Open();
setDatabaseTables();
... |
This is assignment from codesignal:
Given a sequence of integers as an array, determine whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the array.
fn almostIncreasingSequence(sequence: Vec<i32>) -> bool {
if sequence.len() == 2
|| sequence.len() ==... |
I have write a normal programm "Transpose the matrix" in go. Suppose input are always correct. I also read the article An Efficient Matrix Transpose in CUDA C/C++. So I keen to know how I can use Go-routines or another efficient way to problem in go way
package main
import (
"fmt"
)
func main() {
a := [][... |
I am new to COM programming in C++ and while this code works welcome suggestions to improve readability/reliability. This creates a blank word document and adds the text Hello, World.
// The Microsoft Office Object type library (mso.dll)
#import "libid:2DF8D04C-5BFA-101B-BDE5-00AA0044DE52" raw_interfaces_only, name... |
This time I wanted to make a board game that is very popular in Brazil, it's called 'resta um', it means 'there's only one left'. The idea of the game is that there are holes in which there are pieces inside, the player has to pick pieces and 'jump' one another until there is only one left on the board. For a move to b... |
This object structure, that I think might be useful for a number of projects, attempts to:
learn the use objects (classes are not available in Google Apps Script) and inheritance
minimize calls to the Spreadsheet Service by summoning a data table once per sheet
use the Named Ranges on the spreadsheet to access the dat... |
I wrote the following class for a connect four game in C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConnectFour
{
class Board
{
private string _moves = ""; // stores the moves. This helps in... |
My job for now is to teach a trainee how to program. I told him to solve the following task, given by a book (I try to translate it):
Write a program for compound interest calculation. The user has to
enter the amount of money, the years, and the interest rate. The
program should look like this:
Money in Euro: 100... |
As it is now the end of my semester for my programming class, we had a final test were we were supposed to make a short hangman game. I have since added some small improvements, such as showing the word when you lose and dynamic difficulty.
import random
def word_loader():
"""Loads a random word from the word lis... |
I am working on a system and I can see myself using repetitive code that does not look right. I want to clean up my code but I don't really know many ways to do so. I have 2 methods (store and update). They both look like this
store
public function store(Request $request)
{
$user = Auth::user();
$v... |
In a project, we have a file that contains something like a script which we need to parse. At the moment the validation is tough since we have an array of functions returing variable and taking variableList (basically std::variant<>and vector of variants, see definition below)
I am trying to have function metadata avai... |
This encryption class RSA encrypts an AES key and then when the encrypt method is called it decrypts the AES key and uses the key to encrypt the message and basically the same thing with the decryption.
However I am very very new to cryptography so I do not know if this is considered "good" or if this could be improved... |
I have a dictionary with author names as keys and values of None. I want to use fuzzywuzzy to compare these author names to see if there are similar ones that I can combine.
So far I am using two dictionaries (they have the same data in both of them, and ideally I would just use one) and then using a double for loop. I... |
I have written a function/script to simulate data for sample size estimation. The following code samples from a vector of generated values with varying numbers of sample sizes and then concatenates means and standard deviations for a number of simulations.
I am using nested loops but would like to vectorize the code fo... |
So I am working with Terraform and I feel like there must be a faster or, at the very least, a prettier way to perform the operation I'm attempting.
For some boilerplate, I have a data block that looks like the following:
data "aws_subnet_ids" "lambda_subnet_ids" {
count = length(var.lambda_subnet_tags)
vpc_id = .... |
I have written a python 2 program for a school project to convert from hexadecimal to decimal without using built-in functions and vice versa in python. I would like to know how I can make my code more concise - specifically, the "d_func" function.
d_dict = {"0" : 0, "1" : 1, "2" : 2, "3" : 3, "4" : 4, "5" : 5, "6" : ... |
Normally I code in Java but have recently been trying to teach myself C for a university course I will be taking next semester. (I'm about to enter my third year). I wouldn't consider myself the best programmer, or even a good one.
Now, I was just wondering if anyone would be able to take a quick look through my attem... |
I'm new to C programming but this is my attempt at a Scene/State machine. I haven't had a code review before so I'm guessing this is gonna hurt :D
§ Preliminary
SceneFSM manages Scenes, one Scene "active" at a time. A Scene is just a C file with method definitions;
Each scene may (or may not) contain three methods;
St... |
I am trying to sort vectors based on a reference vector. First I am getting the indexes for the reference vector and then using that I am doing inplace sorting for the rest of the vectors.
#include <vector>
#include <cassert>
#include <iostream>
#include <algorithm>
using iter = std::vector<int>::iterator;
using order... |
This query executes very slowly and I wonder if it can be improved?
We have an Access database split to front end / back end with around 50 users. BE is in a network folder and FE is on users' hard drives.
Data entered into the FE is stored in FE tables until the user has finished inputting all the required data for ... |
I'm the creator of the plugin Prettier Pug Plugin. Everything works fine and I have a lot of tests because I used TDD
I currently have a large index.ts (permalink). In this file mainly an array of tokens is iterated in the parse function and each token is specifically treated in a huge switch case.
Please report anythi... |
I have this code working but its using IndexOf I am not sure if that is the best or only option for search for a string value. What I have is a list that will need to remove a world from the child name if it is the same as the name.
Is this the best way to complete this task?
namespace DupName
{
public class Prog... |
I wrote the following snipet code within Cumulocity platform.
runForTenant
must be in a separate thread. What is your an opinion about my code. is there any need for optimization? Thanks
LinkedList<CompletableFuture<Void>> asyncThreads = new LinkedList<CompletableFuture<Void>>();
CompletableFuture<Iterable<M... |
I tried to write a small header-only library that provides a type similar to iterators for std::tuple as well as some STL-like algorithms. I would be grateful for your comments and suggestions.
Code on GitHub: https://github.com/Nicholas42/Cpp-Bits-and-Pieces/tree/master/tup_iter
// tup_iter.hpp
#ifndef TUP_ITER_HPP
#d... |
I've made a HTTP client and would like some tips to improve my code, it's supposed to be built for xamarin forms but should work with any implementation.
My goal of this project was to learn more about HTTP client and also create a project that I can just copy the class into any new project where I need web access, eve... |
Write a program that creates a linked list of bunny objects.
Each bunny object must have
Sex: Male, Female (random at creation 50/50)
color: white, brown, black, spotted
age : 0-10 (years old)
Name : randomly chosen at creation from a list of bunny names.
radioactive_mutant_vampire_bunny: true/false (decid... |
I'm learning algorithm and this is my implementation of quick sort, please guide how can i improve it further and what are other more optimal ways to implement quick sort?
def quick_sort(arr):
length = len(arr)
if length <= 1:
return arr
else:
pivot = arr.pop()
items_greater = []
i... |
How can I vectorize this function? It takes an array of array of tuples as input and computes the distance between elements using Levenshtein's method. I found some simpler examples but they weren't of much use for me since I couldn't apply the same logic for my problem. Any help with making this code more efficient wi... |
I am trying to improve my skills and I'd like to work on avoiding bad practices and mistakes.
Can anyone skim over my code and point out what should have been implemented more efficiently or in a more compact way?
I am a newbie to RXJS and I would appreciate if you give some hint on organizing the code (pipes, eventL... |
I have created a wrapper for Fetch to send requests to my API. The module exports api, and requests can be made with:
api.get({ url: '/users' })
or
api.post({ url: '/users', data: {id: 1, name: myName} })
After receiving the HTTP response from fetch I do some additional tasks, like update a token, then extract the J... |
I build a C# Rest Client library / framework. I noticed that it seemed to be significantly faster than RestSharp for GET at least. So, I decided to put together some benchmarks comparing it to other clients. I'm a bit new to bench-marking, but I don't want to get hung up on best practice.
I'd just like to know,
Have... |
I’m using Python IDE 3. My goal is this:
If I have a string of text, ‘ABCDEFGHIJKL’, I want to sort it into groups, like three groups (‘ADGJ’,’BEHK’,’CFIL’).
I require input for this, but the prompts aren’t showing up and I can’t type in input. Here’s my code:
#data
code_text = input('Text: ').lower()
code_skip = int(i... |
So I have a view which shows recent 5 staff users and 5 customers for a restaurant app. I am storing this in user default.
I am also managing the currently selected object.
Here is my class.
//----------------------------------------------------------------------------------------
//------------------------------------... |
I want to be able to log the time spent by a certain Web API action in an ASP.NET Core 3.x application.
This is a very old question from ASP.NET which relies on global action filters, but in ASP.NET Core, I think middlewares are more appropriate.
From a client's perspective I want to measure as accurately as possible ... |
Looking for code review, suggestions for improvement, best practices etc.
Given N leaves numbered from 1 to N . A caterpillar at leaf 1, jumps from leaf to leaf in multiples of Aj (Aj, 2Aj, 3Aj).
j is specific to the caterpillar. Whenever a caterpillar reaches a leaf, it eats it a little bit.. You have to find out h... |
This post is based on A multi-thread Producer Consumer, where a Consumer has multiple Producers (C++17). I am trying to build a Consumer that consumes data from multiple Producers in a thread-safe manner. I extended the code in such a way that it is now possible to have an n:m relationship (many Producers and many Cons... |
For my package dealing with pptx-files I need to create a temporary *.pptx file, to open in PowerPoint (e.g. to export as PDF). After some research I found that tempfile.NamedTemporaryFile is broken on Windows (you could have a temporary file, or you could get a filename - but you cannot have both). So I tried to build... |
I'm trying to parse a char* into an int without using atoi(). I walk through the string, check if it's a valid digit, then add that digit to my integer by multiplying by 10 and adding the digit. I am not accepting negative integers.
Here's the code I'm using:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
... |
I've written a service for firebase that handles all my Firestore calls. The goal is to only read the database once on app init( load() function) and then keep a copy of the database inside local storage so that we won't be charged for unnecessary database reads every time we write to the database, this code works and ... |
I have built this very simple Connection Pool in Java Using Factory pattern. My thought here was to try on 2 connection Types e.g. SQL and NoSQL. Please review and suggest if my approach is fine. I am trying my hands on Java design patterns, so your review will help me to see where I need to improve in my design proces... |
Background
If you buy something from our facility, you will get a box with a shipping label on it. The two main numbers it will have are a FedEx tracking number and a carton number. For cartons that are not already in a manifested or invoiced status within our warehouse management system, it is necessary to check the F... |
So, as an exercise I wanted to write a dynamic array, like std::vector. I wanted to know if there are any things that could be done better or anything I did wrong. Thank you!
template<typename T>
class myVector {
using size_type = size_t;
public:
void pop(void) {
changeSize(--m_Used);
}
... |
I am currently learning Rust. To allow myself to practice, I created the following program that helps the user to practice hamming codes (the goal is for the user to use this program to be able to write the hamming code for a particular code word). I am aware of a very small algorithmic error in the program that appear... |
Let's say I have 2 repository classes:
public class XRepository {
private XDao xDao;
private LiveData<List<X>> allXs;
public XRepository(Application application) {
AppDatabase database = AppDatabase.getInstance(application);
xDao = database.xDao();
allXs = xDao.getAllXs();
}
... |
I have finished a school project recently which was a recipe manager to be implemented in C. Coming from C# I am really struggling on getting used to the programming style of C. I feel like the code is super clumsy and not really neat. They've taught us that potential errors should always be caught. This is why I came ... |
I am doing a pre-cohort coursework for General Assembly and I am somewhat stuck. I have tried making several changes, but it never seems to work right. I am trying to use Career Karma to get assistance, but if you've ever worked with them, it is all dependent on how many people are online and who actually knows what th... |
I do not program PHP too often. I wanted to write a dice-roller bbc code parser for my forums. What do you see that can be improved?
You can see the code running live here: https://joshuad.net/misc/dice-test.php
<html>
<body>
<p>
<h2>Syntax</h2>
<ul>
<li><strong>Basic Rolls:</strong> NdM: Roll N dice with M sides. i.e... |
I wrote a code for one of the leetcode problems but I am not satisfied. I believe I could improve it. Here is my code:
class MovingAverage {
Queue<Integer> myQueue;
int size;
/** Initialize your data structure here. */
public MovingAverage(int size) {
myQueue = new LinkedList<Integer>();
... |
I need some help to understand if the code below could be refactored to something less straightforward, less repetitive and more towards any appropriate pattern.
What I feel uncomfortable with in the code is the flow of repetitive tasks with the same pattern like:
// Get the result from some operation (API call / or a... |
I am trying to pass 2 values from a function to the class and get a result from the class. For example, if I send value "dog" I should get the result as "dog runs" as a returned result. Need help with the code.
class secrets:
def __init__(self,which,why):
self.which=which
self.why=why
def mixe... |
I'm toggling a state when the browser is resized:
const [expanded, setExpanded] = useState(true)
useEffect(() => {
const listener = () => {
if (document.documentElement.clientWidth > 1024) return
setExpanded(false)
}
window.addEventListener('resize', listener)
return () => window.removeEventListener('re... |
I have implemented a very simple idea of HashMap, I tried to cover cases like "get, put, delete, containsKey, resize," etc in the following implementation. Please take a look and suggest improvements to my coding styles and thought processes.
Interface
public interface Map<K, V> {
boolean isEmpty();
int size()... |
this week I learned about QuickSort and used the technique to solve the Dutch National Flag problem. I would appreciate it if someone would review my code and give feedback.
The Dutch national flag problem is a computer science programming problem proposed by Edsger Dijkstra. The flag of the Netherlands consists of th... |
Consider my simple business requirement as follows:
There is a list of talks and they need to be scheduled in tracks. Each track has a morning session starting at 9am and an afternoon session starting at 1pm ending by 4pm and a lunch break from 12pm to 1pm.
Given: A list of talks - Talk.txt
Python session 90min
Java s... |
The following test demonstrates the functionality of Time class which is supposed to be used instead of DateTime.Now. You could just read the static Time.Now property to get current UTC time. In case of unit testing though you could wrap the code under test in a using statement in the form of using(new Time(2019, 12, ... |
I'm learning Rust coming from an intermediate background in Python. I've completed the first 8 chapters of the book and I wanted a project that would solidify the concepts I learned, so I made a Brainf*** interpreter designed around the things I wanted to make sure I knew. This meant that I wanted it to use structs, en... |
I wrote a code that requests user input and then converts binary to bcd then back to binary using bitwise operations.
While I think my code is good I want to know if there is a better way to write the code.
Is there also a way to keep the code mostly the same but getting rid of the arrays for printing out the bit posit... |
I wrote a function that checks what's the ratio of the number of positive, negative and null values inside an array in relation to its length.
The code I wrote is the following:
function plusMinus(arr) {
/**first I declare 3 variables to store the positive, negative and null elements inside them*/
let numPosi... |
Sock Merchant
John works at a clothing store. He has a large pile of socks that he must pair by color for sale. Given an array of integers representing the color of each sock, determine how many pairs of socks with matching colors there are.
For example, there are \$ n = 7\$ socks with colors \$ar = [1,2,1,2,1,3,2]\$.... |
I am trying to show the following results to the user
All:8000 enabled:8000 disabled:0
What can I do to improve this code?
$Val = explode(",", urldecode($_POST['Val']));
$table = mysqliChkData($Val[0]);
$addSQL = '';
if (!empty($Val[2])) {
// parrent.guid
$addSQL.= " and up_cls='".mysqliChkData($Val[2])."'";
}
... |
I have a set of 2d vertices (x,y) and a set of triangles referring to the vertices' index (p1,p2,p3).
The vertices represent a closed polygon shape, however those are not in order.
When 'merging' all the triangles together, we get a the area of the desired polygon (from which we can conclude the contour).
I've manage t... |
Looking for some advice on whether or not this can be improved in terms of efficiency and speed, it would need to work on large data sets.
public class Anagrams {
public static boolean isAnagram(String str1, String str2) {
String s1 = str1.replaceAll("\\s", "");
String s2 = str2.replaceAll("\\s", ""); ... |
The algorithm:
Place seed at the center of the canvas.
Release a random walker from the edge.
Random walker sticks to the neighboring sites of the seed/previous points.
Repeat N(particles) times.
For a 500x500 matrix with 50k iterations, it would easily take one full day to compute. How to reduce the computation time... |
I have a method in Laravel controller. How can I improve this code? How can I implement single responsibilty here or maybe there are some other tips I can use in this code? I know that controller methods should be kept as small as possible,but I don't know if it's better idea to split this code in separate methods.
pub... |
I'm mainly working with Java and Gradle, but for my current project I have to use C++ with CMake and thus I would like to have some feedback on my current folder structure and project setup.
root_project
|─── .gitignore
|─── CMakeLists.txt
|─── build
|─── src
| | |─── [...].hpp
| └─── [...].cpp
... |
I cannot figure out how I am supposed to unit test the implementation of GetFilteredEntites(IEnumerable<MyEntity> myEntities).
public class MyEntity
{
public int Rank { get; set; }
public int Points { get; set; }
}
public interface IMyMethodClass
{
ICollection<MyEntity> RemoveBadRanking(IEnumerable<MyEntit... |
I am solving some questions on HackerRank for practice purposes. This morning I solved one called Maximum sum of hourglass in an array.
Given an array:
1 1 1 0 0 0
0 1 0 0 0 0
1 1 1 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
the hourglass sum is 7 and we need to find the maximum sum of all hourglass in an array.
My imp... |
I have Dijkstra's algorithm:
# ==========================================================================
# We will create a dictionary to represent the graph
# =============================================================================
graph = {
'a' : {'b':3,'c':4, 'd':7},
'b' : {'c':1,'f':5},
'c' : {'f'... |
I am a CS student and I was wondering is this code looks clean. I tested it and it passed every tested but I think the delete(Node node) is a bit long, I did not find a way to reduce it
Node class
public class Node {
private int data;
private Node next;
Node(int data){
this.data = data;
... |
I have been working on creating a code solution for the Hungarian Algorithm, and from the testing, the slowest and buggiest part has been the bipartite matching. The most recent rendition is based on this GeeksforGeeks article, but, I removed the recursion since that was a stack-overflow waiting to happen for my inten... |
I have a piece of code that calculates the edit distance between words and works, but it's apparently not fast enough.
ClosestWords.java:
import java.util.LinkedList;
import java.util.List;
public class ClosestWords {
LinkedList<String> closestWords = null;
int closestDistance = -1;
public int dynamicEditDista... |
Yesterday, I asked this question because I was asked to implement a software that used variably sized matrices with C89's limitation, so I had to practise dynamic pointer-to-pointer allocation. After the useful answers I got, I started working on a solution to a problem that I was assigned as an exercise.
Here's the as... |
I'm working on a project for digital marketing, I want to automate the upload of pictures. The program itself isn't done but here I came up with a way to keep track of which and when pictures have been posted.
from os import listdir, rename
from random import choice
from _datetime import datetime
# The main directory ... |
Just an Rx wrapper around Kafka to represent topic consumption as IObservable<T>:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Confluent.Kafka;
using PM.TT.Live.Kafka.Rx.ConfluentKafka;
using Reactive = System.Reactive;
namespace PM.TT.Live.Kafka.Rx
{
public static class Cons... |
For my Networking class, we learned about subnetting and subnet masks.
I decided to write a little "calculator" (a generous term) that when given n-many network bits, generates a 32-bit subnet mask, then displays it as octets, and as binary with the leading 0s removed. Example main:
int main() {
int nNetworkBits = ... |
I have a standard tableview app that displays information from a data model array that uses a custom class. There is a UISearchController to filter the data.
A simplified version of the custom class is shown. I use a computed property for a string that is checked when searching the data.
class myObject: NSObject {
... |
hackerearth.com practice problem Can you solve it?:
Given an array 'A' consisting of 'n' integers, find the maximum value of the following expression:
\$\lvert A_i - A_j\rvert + \lvert i - j\rvert\$
where \$A_i\$ is the element of the array at the i-th position (0-indexed array)
My solution:
def solve(n,l):
ans... |
Before we get started I need to let you know a critical piece of information: Due to permissions within an offsite database I am NOT allowed to create tables even temporary ones within the database that I am getting the data from.
With that being said: All of the code below works as expected, but I would like a revie... |
I was curious how vectorization works and how to write suck code. To start simple I choose 7-bit encoding as my test suspect. I'm not expecting improved throughput in any way. My implementation works just fine, until we go over 2^31 due to compare not doing unsigned comparison. I would like to know how this could be ta... |
I need a unique_ptr and shared_ptr like structure, but instead of pointers, I would like to store some kind of reference to a resource. It is usually just an int and maybe some attributes. I would like to avoid using pointers, so these objects can be kept on the stack.
I usually use these containers in my OpenGL projec... |
I have a list of orders (each order is a dict) which looks like this (simplified version) :
[{'name' : XXX,
'id' : { 'order_id_local' : 'xxx_001'}},
{'name' : XXX,
'id' : { 'order_id_local' : 'xxx_002'}},
{'name' : XXX,
'id' : {}},
{'name' : XXX,
'id' : { 'order_id_local' : 'xxx_002'}},
{'name' : XXX,
'id... |
I used the minimum edit distance algorithm to find the bundle of the most similar strings in an array. So, I have to travel double for loop to compare all elements.
If the data is large enough, this algorithm is Inefficient.
Values have rules:
value's length is 10
value is A-Z and can't be duplicated
Is there a way ... |
I'm solving this simple challenge:
Given a vector A with N unique elements greater than 0 and lower or equal than N+1, find the missing element. Example:
A = [1,3,2,5] -> missing number 4
A = [1,3,5,4] -> missing number 2
I've come to the following solution. I'm interested in thoughts and ideas on how to write it as ex... |
Preliminaries
I am working on a software that controls CAEN digitizer. The current step is to provide an ability to save/load configuration to/from an external source (hereafter - "config file"). I decided config file to be a simple text file and consisting of lines like this one:
PARAMETER VALUE
For example, this is ... |
I have made a small Python script that will generate some test sets for my project.
The script generates 2 datasets with the same dimensions n*m. One contains binary values 0,1 and the other contains floats.
The script runs fine and generates the output I need, but if I want to scale to many dimensions the for-loop in ... |
Note: this code will be run using portable WinPython 3.7.6.0 (Python 3.7.6, package list here) on Win10x64. Installing new packages or upgrading the Python version are not an option for this project.
Disclosure: this code is heavily inspired by Janos' excellent answer here.
I've written a piece of crap that's going to... |
I've written up a key-value store that runs on SSTables in python.
import json
import tempfile
import time
import uuid
from contextlib import contextmanager
import attr
from sortedcontainers import SortedDict
TOMBSTONE = str(uuid.uuid5(uuid.NAMESPACE_OID, 'TOMBSTONE')).encode('ascii')
def make_new_segment():
f... |
This is a big script with a GUI basically. I have 4 page classes, that are children of the main Wizard class. I do most of the threading in Step3 and the scripts are simple - creating a new user, editing reg files and installing chrome. Everything works perfectly here, until the main window is dragged - then the app la... |
I'm not an expert in authentication, so I want to make sure I have done everything right.
I am using crypto.createCipheriv and crypto.createDecipheriv for authentication.
I will store the key in the database, and the initialization vector, IV, and encrypted data in cookies. When requested the server will try to decrypt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.