instruction stringlengths 71 95.1k |
|---|
This is my first time writing an authentication system. Here's how it works, first client needs to send credential within authorization header like { Authorization : 'Basic ' + credential } through API. I encoded the credential with base64 encoder ('username:password') and then if the authentication is successfully it ... |
I have written some Python code that opens files one by one, does some work, and writes data onto the filesystem. I figured, I want to make use of my cores.I've refactored the program into this.
from multiprocessing import Pool
import glob
def work(file_name):
# do work
pass
if __name__ == "__main__":
poo... |
The code returns a string ready to seed at sites like sudoku-solutions.com.
It works great but as I couldn't find other simple examples for my level I hope for some insights on this and ways to correct what is wrong.
let sudoku = [];
function shuffle(a) {
for (let i = a.length - 1; i > 0; i--) {
const j ... |
I'm not certain if my implementation is correct, it appears to be, but looking for any feedback as far as readability and efficiency goes. Obviously using dictionaries isn't particularly efficient space wise, but how else could you achieve O(1) lookup?
import os
def get_suffixes(string):
return [string[i:] + "$" f... |
I have a business requirement where I have to read excel files and match each cell with a given keyword list and find the matches and write it into a dataframe.
I have written the code, but when the excel size is increasing (7 MB - 5 sheets, 30k * 9), the code is taking unusually long time (40 minutes), and I know that... |
This is an extension of Block Bootstrap Estimation in Java - Part 2. The text file text.txt can be found at https://drive.google.com/open?id=1vLBoNmFyh4alDZt1eoJpavuEwWlPZSKX (please download the file directly should you wish to test it; there are some odd things about it that you will not pick up through even Notepad)... |
I created a dynamic insert function for PDO.
It does work, but I want to be sure that it is secure and well coded.
function insertNewRows($pdo, $table, $fields, $placeholders, $values=''){
if($values){
$result = $pdo->prepare("INSERT INTO $table ($fields) VALUES ($placeholders)");
$result->execute(... |
I am assigned to a task of creating a function int logBase10Estimate(int n) that returns the log of a number base 10. The answer is integer part only.(w/o using the Math class)
Is this okay?
static int logBase10Estimate(int n){
int count = 0;
for(int x = 10; ;x*=10){
if(x < n){
count+=1;
... |
I am working on a Code Kata
// There is a queue for the self-checkout tills at the supermarket.
// Your task is write a function to calculate the total time
// required for all the customers to check out!
// input
// customers: an array of positive integers representing the queue.
// Each integer represents a cu... |
I wrote a program where the computer guesses a random number.
To do this, I implemented a form of binary search. This correctly handles any edge-cases that I know of, including 0 and std::numeric_limits<int>::max(). This doesn't handle negative numbers (since rand will never return one) but that could easily be fixed.
... |
The gist of my program is to simulate the growth of some virus. I used (attempted) OOP concepts to break down the problem into chunks and have the chunks talk to each other.
Not sure if my implementation is effective but it seems to work pretty good. Currently, the bottleneck seems to be in the plotting. I'm still le... |
I'm trying to develop a web application for documentation..
The tool is functional.. Please review the code & help me with performance tuning & simplifying the JavaScript part..
Any suggestions or comment most welcome. Thanks in advance!
Note: Please type something on the <textarea> to see the live preview
$(functio... |
I wanted to try and learn multi-threading, so I thought it would be good to make a small program normally first and make it multi-threaded, so I made this prime finder.
from time import sleep
def prime_finder(num: int) -> bool:
"""Checks to see if a number is prime"""
if num == 2:
return True
divi... |
I use zypper to download and install for openSUSE Tumbleweed (much like everyone else of course). Unfortunately it downloads packages serially, and having about a thousand packages to update a week, it gets quite boring. Also, while zypper can download packages one-by-one in advance, it can't be called concurrently. I ... |
https://leetcode.com/problems/search-a-2d-matrix/
Write an efficient algorithm that searches for a value in an m x n
matrix. This matrix has the following properties:
Integers in each row are sorted from left to right. The first integer
of each row is greater than the last integer of the previous row.
Example 1:
... |
I finally finished my Conway's game of life in c++ project and i'd love to find out how to improve the code.
main.cpp
#include "Engine/Engine.h"
int main()
{
Conway::Engine Engine(1280, 1024);
Engine.Run();
return 0;
}
Engine.h
#pragma once
#include <SDL2/SDL.h>
#include <memory>
#include "Board.h"
//... |
I have two tables with a 1-many relationship, Device and TestResult.
My application has a filter builder front-end that allows a user to retrieve TestResults based on whatever filters they specify. This generates queries similar to this:
SELECT d.id,
d.serialNumber,
d.createdAt,
r.id,
r.tes... |
I had a coding assignment task(interview) for a senior data engineer role, JSON data validation. Every record in the input json indicates a customer record, I need to write a script to validate that all records confirms to few business rules and few more field type/length restrictions.
I used object-oriented, meta-data... |
I am attempting to animate the series of button presses in the simon game I am creating with tkinter. The animate method is called for each button that needs to be pressed in the series. It currently presses all of the buttons at the same time rather than in a series as it is meant to.
from tkinter import *
from random... |
I'm trying to recreate the method inject (Works like Reduce) from ruby Enumerable Module.
Using Rubocop (A Linter) I got the error:
Cyclomatic complexity for my_inject is too high. [7/6]
The code is:
module Enumerable
def my_inject(*args)
list = to_a if Range
reduce = args[0] if args[0].is_a?(Integer)
o... |
I've built a simple Book list app. It allows users to enter the name, author and isbn of a book into a form. Then when this is submitted successfully, the details get added to a new row in the table.
I've tried to make the code as optimal as possible. Any feedback would be greatly appreciated.
const bookList = document... |
I've always wondered what's the most elegant way of implementing PrintLn in C++. I have not yet come with perfect conclusion. This is my shot.
Shortcut for std::cout, std::cerr and std::clog "print line" version. So you can type
CoutLn << "Hello world!"; instead of std::cout << "Hello world!" << '\n';
CoutLn, CerrLn, ... |
Wrote my first mini-script to get data from the german football league table and save the data to a csv file. Do you like the approach or could I be more efficient? Thanks in advance!
from bs4 import BeautifulSoup
import requests
import csv
url = "https://www.bundesliga.com/de/bundesliga/tabelle"
r = requests.get(url... |
I just care if it's any of the common formats so that later when I list all files, for those that are images, I can generate previews based on mime type.
So PHP.NET suggest to use exif_imagetype function to check if file is an image. In case of success an integer will be returned indicating one of 18 constants.
The che... |
My task is to run a subprocess using asyncio.create_subprocess_shell and yield the lines of output. I am using asyncio to avoid creating threads just to pump the streams.
It is necessary to separate stdout lines from stderr lines.
Both outputs need to be read simultaneously, it is not possible to read all of stdout or... |
I've written a function to copy files remote-to-remote using SCP command, paramiko, pexpect, and paramiko-sftp.
I want to make my code efficient; I'm new to Python and I don't know how.
Here's my logic in 3 steps:
Find checksum of a file by executing cksum command in remote-1.
Executing SCP command from my local to co... |
For my CS minor I was assigned to implement the Quicksort algorithm in C#. I gave it a go and found that I like the implementation of the algorithm more than Mergesort. Now that I've got my Quicksort implementation running, I'm very curious about what optimizations could be done.
using System.Collections.Generic;
name... |
The find function is designed to start at the given node and return the index of the node with the value valueInput (indices start at 0). Return -1 if valueInput does not exist.
How can this code be improved, optimized and free of potential runtime errors?
Please note I am new to data structures and algorithms.
#includ... |
I am trying to make a script that compares 2 .txt files.
It works, but I wanted to double-check if there's something I missed about these system calls (since I'm new at this). Is there any improvement you would've done or anything else you think can help me improve with it (especially with this mmap thing)?
The script ... |
This is a small program to implement the FVP algorithm (outlined here). I'm still quite new to C++ and don't have a strong grasp of basically any concepts. Concepts I tried to use in this program:
OOD
Header files
Lambda functions
std::list and std::vector
I would be grateful for any suggestions on code style, any bu... |
I wrote a function that takes as input a vector with two integers between 1 and 8 representing a position in a chessboard and that should output a vector where each cell is a similar vector of integers, with the positions that a knight in the input position could reach.
E.g. for the input 1 1, my function should output... |
Please review my Python Alien Blitz Game code.
There are several points I'm keen to hear about.
I used globals. Was that an evil choice given the context? In the past when I've tried to refactor these kinds of programs to pass arguments instead, I've got in a real muddle keeping track of them all.
Is this code at a le... |
I have functions nested here in setTimeout
function startWorker (obj) {
if (!code) {
return setTimeout(2000, () => {
startWorker(obj)
});
}
console.log('worker started')
}
How do I correctly use startWorker as the callback without using more functions than needed.
What I'm trying to do:
I'm trying... |
I happened to delve into tkinter and created a couple of mini projects so I could get more familiar with it. I was wondering if there was any portion of my code or code structure that is sloppily written and could be more python-esque. As a beginner in both python and tkinter (been learning during this quarantine) it w... |
I'm learning how to use Kafka, I've never used something similar in the past. In my job I was required to create a POC using it and integrate it to Spring Boot and save information on MongoDB (because we will need to retrieve information on-demand and I thought that it would be the best approach).
At the consumer I cre... |
After a March update, Adobe Indesign will resurrect removed directories it was responsible for creating in the first place, but not any files except for one file called "AdobeFnt.lst". So where once you had a complex folder structure, but then deleted it, you'll now have the whole structure back, but one folder somewhe... |
This is a recreational project, I was trying to make a parser generator with a grammar inspired from: https://docs.python.org/3/reference/grammar.html
Unfortunately, understanding that specific grammar's syntax (meta-grammar?) ended up being way harder than I expected so, I ended up creating my own.
I call it KiloGramm... |
I am writing unit test for this function -
public void DeleteExpiredArchiveFiles(string directory, int daysInArchive)
{
//Delete files from the directory which are older than parameter - daysInArchive
}
I need to access some sample files in the code for this unit test.
What is the correct approach -
- Add sample ... |
With this code, i loop through similar xml files and add them to a DataFrame.
How can i make this code better so it is more pythonic?
Dados = pd.DataFrame([])
folder = os.listdir(path)
for file in folder:
if file.endswith('.xml'):
with open(os.path.join(path, file), encoding="utf8") as fd:
doc ... |
I need to read multiple CSV files that have the same number of rows, and compute some results for each row. For simplification purposes, and in the scope of this code review, this computation would be "sum each column of each row".
I would like to be able to do so using the fast-csv parser that triggers events on each... |
I am kind of new to python, so I am pretty sure there are way better elegant ways to do this.
I have made a function that is able to compare two list of possible json object paths, and detect what elements do not belong to the other list.
In the docstring you will find a better description with examples.
I will also pr... |
I timed a few ways to look for a string in a string array (with 82 elements in the example) in a case sensitive manner plus ignoring case.
I am kind of suprised, that the plain for loops are faster than all other variants.
Sure, there are no checks, but are there any other flaws here?
Does Linq not do some vectoriz... |
You're given the number of rows and columns and the indices for the reference point. Reference point is = 0.
i.e:
3 4 3 3
output:
4 3 2 3
3 2 1 2
2 1 0 1
I managed to solve the problem using the easiest solution there is. I calculated the elements from the same column, and then using 2 for loops I used for every single... |
Good Morning
This is a builder design pattern .. the builder problem is duplication so
I want to know from an expert with explanation which is better on quality on this code:
(1)
public class Animal {
private String animalName;
private int animalAge;
public static class Builder {
private Animal an... |
I have created a flocking simulation based on Craig Reynolds Boids. Could you give me some feedback on my code? I am a newbie and would really appreciate some criticism.
Files:
Boid - this is the representation of a bird like object.
Flock - this controls and manages the flock of boids.
Flock.h:
#include "Boid.h"
#i... |
I'm following a tutorial into pygame. I realized the example code was written for the sake of being easy to understand. I wondered if I could 'improve' the code, with a focus on keeping the exact same functionality. I tried, but I'm not really sure if this is an improvement.
This is the original code from the instruct... |
To begin, I have an XML file at /Users/gaze/lab/lab/gpib_lib/out.xml that contains lines like...
<MemberCall method_name="setFastCoupleMode" callee_name="GPIB_7280" fname="/Users/gaze/lab/lab/gpib_lib/../apps/capbridge/capbridge.C" lineno="394" colno="9" />
<MemberCall method_name="setInputLineFilter" callee_name="GPI... |
I wrote an algorithm that returns all k-sized subgraphs of another given graph. Because I don't want to make the runtime of the next() call of the iterator depended on k, I don't want to return a new object every time. Instead I have one fixed instance-variable subG in the iterator that is changed between the calls und... |
I have to implement a priority queue using a heap without any library / package for priority queue or heap. I made a BinHeap class which is a min heap, and I made a priority queue class with enqueque, dequeque methods that uses it. The priority queue class works fine but i'm not sure if the code its correct. Can you pl... |
The program reads in a queue of integers and returns determines whether or not it is valid (ascending).
How can this code be improved?
I assume iterator include statement is unnecessary?
#include <iostream>
#include <queue>
#include <deque>
#include <iterator>
template<typename T, typename Container=std::deque<T> >
cl... |
I am learning Dyalog APL. I implemented a binary heap, which seems to work. How could I make it look more like APL (and less like Python)?
⎕io←0
heappush←{(⍺,⍵)siftdown 0(≢⍺)}
heappop←{
heap←⍵
last←⊃¯1↑heap ⋄ rest←¯1↓heap
0=≢rest:rest last
r←heap[0]
(((last@0)rest)siftup 0)r
}
siftdown←{
heap←⍺
start pos←⍵
it... |
The problem / background
I have a project, BusinessProject, that currently stores some static data in memory using the Singleton pattern - we'll call this class GlobalData. This project is used in multiple applications, with different requirements on what data should be loaded into memory. One application, lets call th... |
I wanted to be sure the thread being tested would complete its job by the Assert statement of the unit test, but I couldn't be sure bc of the way I designed the threads. I designed them to run forever in the background, performing a task - logging, assembling, or disassembling - at regular timed intervals. What I ended... |
For my student job, I have been logging work times with the org-mode in emacs for quite some time. Now since I can only work from remote, I figured it would be nice to automatically use the entries from the .org files into readily-formatted entries. I am doing this because the job requires me to write an Excel sheet wi... |
I want to calculate the intersection of two squares where the coordinates of the input square are given by the bottom left corner and the top right corner. The other square is 6 units wide and has a variable positive integer height h (to make the task simpler).
For that I defined some functions:
The first one is to ma... |
The other week I faced the struggle of scraping dynamically generated content. So I used the selenium library with combination of requests & bs4, the thing is I am unsure of the quality of the implementation as I just learned how to use those tools. I want to have a general feedback on the way I used the libraries, the... |
Typing in something like Encoding.UTF8.GetString(...) and Encoding.UTF8.GetBytes(...) everywhere in your code could be eliminated by a helper UTF8 type:
public class UTF8_Should
{
[Test]
public void Convert()
{
var text = "Hello World";
byte[] array = (UTF8)text;
string copy = (UTF8)... |
I'm new to React hooks and trying to learn to write custom hooks. Today I wrote a hook that I believe works as an effective debouncer of a setter function, to prevent excessive updates when data changes rapidly. I'm trying to keep this as simple as possible so as to be reusable throughout the app and by other developer... |
This question is a follow-up to this previous question of mine. Assuming I understood correctly what is outlined in this meta post.
I wrote (and now, re-wrote) a function that takes as input a vector with two integers between 1 and 8 representing a position in a chessboard. This function should output a vector where ea... |
I have an adjacency matrix "A" which I am using to represent a graph for a social network. Each node of the graph represents a person's name, and I am storing people's names in an 2-d array (the index of the person's name in the array is the same as the node's row index in the adjacency matrix). I wrote an algorithm to... |
I need to get values from a Map by Adapter position i get from a RecyclerView.
As you can see each time i click on an Album Art i create a new array of album objects.
final Album[] albums = new Album[albumMap.size()];
for (Map.Entry<Integer,Album> e : albumMap.entrySet()){
albums[i++] = e.getValue();
}
Th... |
I have hierarchical table for my features with a parent-child relation. There was an unique constraint missing, why I have branches in the data, where multiple children relate to one parent. To add the constraint, I have to remove the branches.
CREATE TABLE feature_log
(
feature_id UUID DEFAULT uuid_generate_v4(),
... |
So my task was to make a lottery function, but the instructor only provides half the code when explaining and going through my resources i was unable to find proper examples on how to complete it aside from this part.
import random
def user(startval, endval, numberpicked):
somelist = []
while len(somelist) < n... |
Listening to messages from the udp socket, I would like to somehow determine where packets come from and scatter in sessions to get a more detailed report on the received data, I just did it forehead, looking for the current session and recording in its channel, I would like to know if more elegant methods? full code
... |
I implement BinaryTree (K extends Comparable, V) concept to binarySearchTree and I have written get and put method. As far as I check, there is no problem in my code. So now I wonder that are there any problem or weak point in my code? and m,
public void put(K key, V value) {
Node newNode = new Node(key, v... |
I am interested in doing a 2D numerical integration. Right now I am using the scipy.integrate.dblquad but it is very slow. Please see the code below. My need is to evaluate this integral 100s of times with completely different parameters. Hence I want to make the processing as fast and efficient as possible. The code i... |
I wrote factorial and power functions with nasm but I don't know if it is the right to write assembly code. For example, by executing the functions I make some changes in the registers and I don't know if I have to revert them to their original value a the end with push and pop.
To write the factorial function, I first... |
I need a class to generate json content from data retrieved from a database. This gave me an excuse to play at creating a json library. This is my first attempt so it could probably be improved in many ways.
Features are:
feed in json from stdin to populate internal structures.
output json to stdout.
insert into jso... |
Thanks for all the great feedback in Part 1. I implemented a lot of it. Here is version 2. I am looking for feedback on:
Recursive solve algorithm. It's too slow. I used Chrome DevTools Performance Profiler to optimize slow functions and I sped it up a lot. But fundamentally I think the algorithm just sucks.
The slowe... |
Im at the point where I am designing my api security and I was going with a custom attribute I don't want to use third party systems as they cost money.
I was going to use the client id and the secret id approach and I am asking is this a safe enough way to accomplish it I am interacting to my api through a database la... |
Python script that can download images and videos of the user, like Gallery with photos or videos. It saves the data in the folder.
How it works:
Log in in instragram using selenium and navigate to the profile
Check the availability of Instagram profile if it's private or existing
Gathering urls from images or videos
... |
I have a validator class, whose purpose is to validate input data. Initially I wrote the class like this:
export class ValidatorForInputs {
constructor(inputData) {
this._data = inputData;
}
validate() {
let results = {};
let validateInputDataForMissingKeys = checkInputDataForMissingKeys(thi... |
The following is working, no errors. But It's crazy long, not a real js developer here, so I did it the way I knew it. But I am pretty sure this can be resolved much, much easier and shorter.
We have data in countData and I loop it. For each data within countData I need to do "last item minus previous to last item", ba... |
I'm parsing commandline arguments in lua with a command parser library (penlight lapp). This works fine, is easy to design and flexible enough for me.
However, now I have a table containing all the parsed arguments, so I'm still stuck with the processing, that is calling functions or changing settings etc. within my pr... |
Here is a class that I have implemented in order to sort rows of parameters in the form of an array of strings.
public class ParameterLinesSorter : IParameterLinesSorter
{
private int identiferIndex;
private IEnumerable<string[]> parameterLines;
public IEnumerable<IEnumerable<string[]>> Sort(IEnumerable<st... |
I wrote a class that contains a static method that reads in files from NetworkRepository and converts them into a list of integer-arrays, each representing an edge. The file format from NetworkRepository is, that each line which is not a comment contains two integer numbers, the IDs of vertices connected by an edge, se... |
This is a follow-up from my previous review on this site. To be clear, the code is stand-alone, and does not depend on the previous review.
As before my goal is to come up with a design for a chess engine in Kotlin that hides implementation details, and that ensures that the implementation cannot accidentally become sp... |
I am learning python and trying to solve different problems i came across this program which is name mashup which is in Get Programming:Learn to code with Python.
problem statement: Write a program that automatically combines two names given by
the user. That’s an open-ended problem statement, so let’s add a few more d... |
I'm trying to build a customer email generator in java using the abstract factory pattern. I understand how to use the factory method pattern; however, I'm a bit confused about the abstract factory pattern. I'm trying to generate an email based on customer type. Could you look at my code below and tell me if I'm using ... |
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="1200" height="1000" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
const maxWidth = 1200;
const maxHeight = 1000;
const radius = 5;
const numberOfPeople = 250;
const velocity = 5;
... |
The program below results in a stackoverflow exception in C# for the input provided. I am trying to see if there are any enhancements that can be made to avoid the stack-overflow.
When using BFS approach the program works which is obvious as there's no recursion. The BFS approach is also provided below.
public cla... |
I wrote some code and I'm trying to get some feedback on it. I'll try to summerize the essential only. I have a function that based on a condition returns a promise or something else:
this.isActive = function(){
if(this.disableApplePay && window.ApplePaySession){
return window.ApplePaySession.canMakePaymentsWithA... |
I have two questions.
Does it make sense to test that an event will not be fired?
If yes, what is the best way to accomplish that using the xUnit framework?
For example I have a class with a single property Mark,
public class Box : INotifyPropertyChanged
{
private Marking mark = Marking.None;
... |
I made the following code. It's a simple animation of 'raindrops' falling and splattering once they reach the ground. The images I use can be found here: https://i.stack.imgur.com/oKOVA.jpg
import pygame, sys
from pygame import locals
import random
import itertools
def listenToQuit():
for event in pygame.event.... |
In one of my projects I wrote a little tournament platform, but the way I handle participants is a bit messy and I want to clean this up.
So in my case a Tournament can have participants, but either a User or a Team can signup to become a participant. A participant now holds a user_id or a team_id in the database, and ... |
I have implemented a solution for the knapsack problem while breaking an item is allowed. I've used the dictionary data structure where I used weight as a key and value per weight as a value. After that, I sorted the dictionary by value and filled the knapsack until there's no space left.
Here is my python code -
def ... |
To ensure there are no naming conflicts within our project (C++) I was tasked with writing a python script to check all of our header files for any occurrences of a using namespace ... within the file. If an occurrence is found, it's appended to a list then written to a log file. It's a fairly simple script, but I feel... |
I've only been learning Python for a few days after a Humble Bundle book sale, but I made a functional Blackjack game on which I'd like some constructive criticism as far as my coding structure and any suggestions for improvement from more experienced coders.
Edit: This is coded in Python 3.8.2
import random
import tim... |
I am writing a script that is supposed to retrieve some data from a MYSQL database but I need to make it happen live and after lots of research I learned that this thing can be done using something called "Web Sockets" but since it seemed too complicated and I haven't even learned javascript that well, I chose to keep ... |
Out of boredom, I decided to start my personal project and I've chosen a simple Text Password Manager.
Note: For anyone out there, I strongly recommend you NOT to use this for any sensitive storage purposes as it DOESN'T provide encryption yet!. That'll probably come in a later release.
About Safer
My project is going... |
// TODO: https://codereview.stackexchange.com/questions/240011/js-schedule-conflict-detection-algorithm-logic-length
// List with handle
Sortable.create(dashboard, {
handle: '.fa-bars',
animation: 150
});
// To Instantiate & Control the Modal
var modal = document.getElementById("modal");
var addSchedule = docu... |
I always try to port the roman numeral conversion algorithm to learn new languages. Reading the Go manual as a beginner, this is the most idiomatic way I've been able to write it.
I would love it if you could give me comments/advice on the following code, and also maybe on some questions I have regarding it:
About the... |
After some hours of coding trying to implement "algorithms" to make a Tic-Tac-Toe game, I came up with something I'm not really proud of.
Here's the code:
const TicTacToe = (function(){
const grids = document.querySelectorAll(".box");
const winning_combinations = [
[0, 1, 2],
[3, 4, 5],
... |
I'm working towards plotting a large GIS dataset of which I've shown a sample above of about 1/6 of the data. I'm happy with how quickly the data loads in, and bokeh renders the html nearly instantaneously. However, I've encountered a pretty hot loop in my code that is not scaling well as I increase the 1) number of ... |
I have come up with a sequence of steps to find the maximum product of y positive numbers which add up to x. But the program is highly inefficient.
Here's my code:
from itertools import product
from functools import reduce
from operator import mul
for i in range(int(input())): # <-- number of pairs of in... |
I am trying to validate a HTTP REST API request in my python code. It checks for some request headers (X-Foo and X-Bar) and two keys in the json body/payload (someKey and someNestedKey). I have written this code with if/else conditions as well as a simple try-catch.
headers = event["headers"]
if "X-Foo" not in headers... |
I am trying to plot the standing wave modes in a 2D box over time. The equation for this is:
$$ A(x,y,t) = \sum\limits_{n,m} sin \left( \frac{n \pi x}{L_x} \right) sin \left( \frac{m \pi y}{L_y} \right) cos \left( w_{n,m}t + \phi_{n,m} \right) $$ where $$ w_{n,m} = \sqrt{ {\left( \frac{n \pi}{L_x}\right)}^2 + {\left( \... |
I have the following code that transforms a string to upper/lowercase:
#include <iterator>
#include <algorithm>
#include <type_traits>
#include <vector>
#include <vector>
#include <iostream>
#include <string>
#include <locale>
#include <functional>
namespace ae
{
template <typename StrT>
auto toLower(StrT& str... |
I have a sample code and some question.
Simple type property
member val CabinetNetworkState : uint8 = 0uy with get, set
member this.CabinetNetworkStateAsValues : (CabinetNetworkStateHosts * uint8) array =
let cabinetNetworkStateMap = new ResizeArray<(CabinetNetworkStateHosts * uint8)> ()
let extNetwor... |
I just started learning Rust and my first project is a command line tool generating a pairwise distance matrix for binary data while ignoring missing values. The input files look like so:
001N0
011N0
10N10
with N denoting missing values that should be ignored. The example yields
0,1,1
1,0,2
1,2,0
After parsing the c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.