instruction stringlengths 71 95.1k |
|---|
In my project, so this controller is working perfectly, my objective is to read the log file from the server which is created on daily basis, so I have to read the log file which is heavier in size around maybe 2GB, so my question is that please review the below code and advise my is my code is smart enough to read suc... |
This program displays a list of TV characters. You can kill them off by random or bring them back by name. I have used the random.choice function. I've defined a couple of functions so that the while loop looks a little more clean. In two of the functions, bring_back and check_decision, we assign True to invalid_input ... |
I am working on a utility to manage shared content libraries for Work from Home scenarios. Basically I have libraries of thousands of Autodesk Revit family files, and I want to host those files on AWS S3, and then manage a local copy of the library based on what is hosted on S3. To that end I have developed an XML "ind... |
I have designed a logger class to log messages to a file. It uses an independent thread to log the messages save to a queue previously using the main thread. I want to receive reviews about it.
#include <iostream>
#include <queue>
#include <mutex>
#include <condition_variable>
#include <fstream>
#include <atomic>
#incl... |
It's an assignment from the Odin Project.
Here's my implementation:
#!/usr/bin/env ruby
def caesar_cipher(str, shift)
low_alpha = ("a".."z").to_a
high_alpha = ("A".."Z").to_a
length_alpha = low_alpha.length
chars = str.split("")
ciphered = ""
chars.each do |char|
if low_alpha.inclu... |
The array "scores" tells the total points for each person involved in a contest. So for example:
User A: 100 points
User B: 90 points
User C: 90 points
User D: 80 points
User E: 75 points
User F: 60 points
According to above scores we also have this ranking:
User A: #1
User B: #2
User C: #2
User D: #3
User E: #4
Use... |
Inheritance Challenge 2 - Employees, Bosses and Trainees
Create a main class with a Main Method, then a base class Employee with the properties Name, FirstName, Salary and the methods Work() and Pause().
Create a deriving class boss with the propertie CompanyCar and the method Lead(). Create another deriving class... |
So I have a 12 x 6 2D numpy array for input which consists of 7 possible board objects (characters from 'abcdefg'). From a 2D numpy array I wish to generate all the possible unique 2D arrays, in whose parent array 2 adjacent elements in each row have been swapped. In the worst case this means 60 (5*12) swaps for each p... |
I've been writing a little task manager in C++ in my spare time. It's also the first time I am posting here for a review, I hope someone can spot any mistakes.
There's still a lot to implement and optimise, but the idea is for this to be a task manager that optionally uses any platform-dependent threading API (otherwis... |
I'm posting my C++ code for LeetCode's LRU Cache. If you have time and would like to review, please do so. Thank you!
Problem
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.
get(key) - Get the value (will always be positive) of the k... |
I am looking for a way to speed up my basic IP scanner/port scanner in Python 3.8.
My IP portion works, the port scan work, I just want to speed it up, in a format that someone learning python would understand.
#testing scanner.py
import socket
import subprocess
import sys
from datetime import datetime
def scan():
... |
I'm posting my code for a LeetCode problem. If you'd like to review, please do so.
Problem
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.
get(key) - Get the value (will always be positive) of the key if the key exists in the cache, ... |
I'm posting my Java code for LeetCode's LRU Cache. If you have time and would like to review, please do so. Thank you!
Problem
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.
get(key) - Get the value (will always be positive) of the ... |
I'm looking for a code review and code improvement for my own small server.
The server accepts the requests:
User Join,User Leave,User Text Notify Group Join, Group Leave, Group Notify Request Time.
The syntax for User Join/Left Group Join/Left:
**
DSLP-3.0
User Join
NameOfUser
DSLP-Body
**
The syntax for Group Notify... |
This is an interview question to generate the below pattern of numbers in a sequence, which is: 12.34, 23.45, 45.67, 78.910, 1112.1314, 1617.1819, 2223.2425, 2930.3132, 3738.3940, 4647.4849, 5657.5859, 6768.6970, 7980.8182, 9293.9495, 106107.108109, 121122.123124 We can use starting seed number as 12 and have to genera... |
I am implementing a binary search algorithm and my code is as shown bellow:
def binary_search(a, x):
left, right = 0, len(a) ... |
it's the second object oriented program i've worked on,
more details on https://hyperskill.org/projects/96?goal=391.
I've added as much documentation as needed, as a first time, to explain each component.
class Matrix:
def __init__(self, dimension, elements=None):
"""
Use:
Matrix([num_o... |
I have made a script that syncs one folder to another. So if, for example, you saved some changes in a file in directory A, then that file would have the same contents om directory B if you set it up.
It runs on Python 3 and the watchdog module. If you are wishing to try it out (and please do), make sure to install wat... |
I am developing a statistics library in .net. I have developed a Set<T> data structure. Now, I want to derive a data structure named DescriptiveStatisticalSet<T>, and I want this set to be able to operate only on integer and double types.
Problem:
I want to implement a generic type that is able to work with integer
an... |
I have a form on my page. I am using jQuery validation for client-side and PHP for server-side validation. I am using PDO. I don't have any issues with client-side and server-side validation. My form is working. I want to know that is this code is the best code with serverside validation with logic?
Client-side validat... |
I create https://github.com/storenth/react-redux-todo and ask to review my Todo-react-app for programming pattern: dividing components into presentational components and container components.
Here’s the basic idea behind it: if a component has to have state, make calculations based on props, or manage any other complex... |
This Q&A was iteration 1. Now there is
Iter 2: Reusable, robust c++ std::hash<mpz_class> for GMP's big integer type
1. Goal
My intention is to provide a fast hashing algorithm to hash GMP's big integer type mpz_class and mpz_t so I can use these types as keys for an unordered_map. The code shall be reusable for others... |
As you can see these functions differ only in keys []int and keys []*int (and in name).
func (db *myDB) QueryWithKeys(keys []int) ([]*models.Player) {
var players = make([]*models.Player, len(keys))
_ := db.Model(&players).Where("id in (?)", pg.In(keys)).Select()
// several other equal code here
return play... |
The problem was using single Stream from the HTTP response in multiple consumers simultaneously. For example: while data is loading, I want write it to the some cache file and deserealize it at the same time.
This code will not work for an obvious reason. But it represents some desired things.
private readonly HttpClie... |
I have the following class:
public class UpdateData {
public static boolean updateHasMessage(Update update) {
return update.hasMessage() && update.getMessage().hasText();
}
public static boolean updateHasCallbackQuery(Update update) {
return update.hasCallbackQuery() && (update.getCallback... |
As a beginner coder in js, I'd like to hear about further improvements of the following code, but nothing too advanced, please.
The program is meant to work the following way:
A user inputs a color array like this one: ["blue", "green"]
The code checks if those words are valid inputs (they should be found in a referen... |
I have implementing a simple version of Dijkstra's algorithm in C#. Could this be made more efficient? Does it need to be modified?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace dijkstra
{
class Program
{
static void Main(string[] arg... |
The challenge can be found here.
In short we have a recursive function, and we need to find when \$z_i\$ is equal to one.
$$
\begin{align}
z_1 &= 1\\
z_i &= z_{i-1} * a\ \%\ n\\
\text{find}\ z_i &= 1
\end{align}
$$
Input range:
$$ 2 \le a \lt n \le 10^9 $$
I have written the following. It is simple, but too... |
I am using below code to rename and delete video.
Need review for the following:
Code optimization
Performance
Overall code review
renameVideo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int index = filePath.lastIndexOf('.');
... |
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time!
Problem
Given a 2d grid map of '1's (land) and '0's (water), count the number
of islands. An island is surrounded by water and is formed by
connecting adjacent lands horizontally or vertically. You may assume
al... |
I'm posting my C++ code for LeetCode's Guess Number Higher or Lower II. If you have time and would like to review, please do so.
Problem
We are playing the Guess Game. The game is as follows:
I pick a number from 1 to n. You have to guess which number I picked.
Every time you guess wrong, I'll tell you whether the n... |
I'm running MicroPython on an ESP32 relaying sensor data to my MQTT server for Home Assistant. I only want it to emit a message when state has changed and a motion detected state to hold for a minute before returning to a clear state. I see a lot of examples using sleep, but I don't like the blocking nature of sleep as... |
How can I simplify this functioning JQuery validation process:
class UserEdit {
addUser(uobj) {
if(uobj.adduser == "" && uobj.addfullname == "" && uobj.addemail == "" && uobj.addlevel == "")
{
$('#adduserError').show();
$('#addfullnameError').show();
$('#addemailError').show();
... |
I'm posting my C++ code for LeetCode's 1320. If you have time and would like to review, please do so. Thank you!
Problem
You have a keyboard layout as shown above in the XY plane, where each English uppercase letter is located at some coordinate, for
example, the letter \$A\$ is located at coordinate \$(0,0)\$, the ... |
I'm trying to create a component that receives an array, this component is going to show a list with props data
const Mesas = [{
id: 1,
valor: 500,
produtos:['COCA COLA', 'FANTA']
},{
id: 2,
valor: 100,
produtos:['PRATO1', 'PRATO2']
}]
const App = () => {
return (<ListaMe... |
The code below iterates through the nodes of an XML file and updates values based on a Regex expression in the rule child node from an XPath expression. XML is included at the bottom.
Are there better alternatives to this approach? Would using LINQ be a good approach?
using System;
using System.Text.RegularExpressions;... |
I'm posting my Python code for LeetCode's 1320. If you have time and would like to review, please do so.
Problem
You have a keyboard layout as shown above in the XY plane, where each English uppercase letter is located at some coordinate, for
example, the letter \$A\$ is located at coordinate \$(0,0)\$, the letter
\... |
I am a Math tutor and I found the site https://www.yksityisopetus.fi/ where one can search pupils. I made a Python parser to find pupils that want Math teaching with at least 25 €/hour. Are there any improvements for this code?
import requests
import tkinter as tk
link = "https://www.yksityisopetus.fi/opiskelijat/mate... |
Looking for any feedback to improve practices on the following logic, and I have removed large chunks of documentation to reduce noise. I feel the areas that could expect heavy criticism are the win/tie condition checking.
Main.cpp
#include "Board.h"
int main() {
//initialize board
Board gameboard;
for (i... |
I was playing around with sorting methods, brushing up on my algorithms. I have made the following implementation of quicksort:
def quicksort(l):
def inner_qs(list_, start, end):
if end - start > 1:
piv = list_[end - 1]
aux_index = start
for i in range(start, end):
... |
This code unzips the downloaded subtitle files and maps them to their corresponding video file. Currently, after pairing video files with their corresponding subtitle files, it links them by renaming the subtitle file to the same file name as that of its corresponding video file.
#!/usr/bin/env python3
import os, os.pa... |
I need to identify the different markdown files I have so I can create a unique url structure for them. I can already identify "notes" files, and want to create a second type called "projects".
My gatsby-node.js file looks like this right now
const path = require('path');
const { createFilePath } = require('gatsby-sour... |
Submitting for expert review.
I am trying to create a Chart - Crosshair cursor in excel chart sheet. Chart - Crosshair cursor lines are two lines (one horizontal and other vertical) moving along with the cursor/pointer/mousemove on the chart. Most of the stock market online charts have such interactive tool. I have ref... |
I need to extract all member accesses to expression parameter (and make sure, that they are not nested). For instance, for expression: a => a.A + a.B I need to receive list {"A", "B"}. For expression a => a.B.C exception should be thrown, as we have nested member access.
I wrote the following class, but I'm not too sat... |
I have a dataframe like so:
id variable value
1 x 5
1 y 5
2 x 7
2 y 7
Now for every row, I want to add a calculated row. This is what I am doing as of now:
a = 2
b = 5
c = 1
d = 3
df2 = pd.DataFrame(columns = ["id", "variable", "value"])
for index, row in df.iterrows(... |
I have a large image and I am extracting and processing tiles in batches of a given size. A tile is normally a 256x256 region and batches are normally a power of 2.
In the below example the number of tiles per cols is 3 and the number of tiles per rows is 5, and I want batches of 3.
Legend: Yellow rectangle = tile, Re... |
I'm not sure if I'm even approaching this correctly (still very much learning), but this is what I'm attempting to accomplish:
My script gets an array from a column (tab names of the sheet) and then calls another function to copy those tabs (this part works fine). What I'm attempting to add is a separate list of prope... |
I have a query that outputs a list of products with some fields from other tables. That query works fine.
Now, I'm attempting to retrieve the available stock for each product in that list. I'm not sure if I'm doing it correctly or in the most performant way. Here's what I've got working so far.
select distinct
p.id,
... |
Update:
This is an older version of the question/script. The new version can be found here: Part 2: Send HTTP request for each row in Excel table
I have an Excel spreadsheet where users can batch-enter records and load them into an external system (via HTTP).
This is what the VBA in the spreadsheet does:
A custom fu... |
Our testing suite is configured using a type of hierarchical config file similar to .ini or .toml files. Each 'block' is a test that is run on our cluster. I'm working on adding unique ids to each test that will help map results to tests over time. A small example of a config file would be:
[Tests]
[test1]
type =... |
I needed a tool to monitor VM's running on my server in relatively real-time (similar to top or the many variants out there). The main things I need to keep track of are:
All VM's listed via virsh list --all;
Id Name State
----------------------------------------------------
13 Experi... |
I'm posting my code for a LeetCode problem copied here. If you have time and would like to review, please do so. Thank you!
Problem
Given a positive integer n, return the number of all possible
attendance records with length n, which will be regarded as
rewardable. The answer may be very large, return it after mod 109... |
This is a beginner's class. I just need help verifying if this code is correct, or edit the parts that need fixing.
n = int(input("Enter a number"))
sum = 0
for i in range(1,n+1):
sum = sum + i
print("The sum is:", sum)
|
This is an implementation of a 2D peak finder from MIT's Intro to Algos.
I'm a C beginner and I would really like some feedback on coding style, documentation and any other general C bad practices.
Additionally have I correctly freed the memory of the recursive calls?
#include <stdio.h>
#include <stdlib.h>
typedef str... |
I am studying and practicing Python; this is my Rock-Paper-Scissors game I've built from scratch.
I saw this task is for beginners. When writing this in all the examples I saw dozens of lines of code with if elif else statements.
I decided to write the shortest program for this game.
I'm just looking for any comments, ... |
I'm new to sh and I would like to get feedback on how I can improve my code.
The purpose is simple; I want to open the Jenkins JOB related to a service based on its possible aliases. If I map a service with its aliases, READ_JOB="rj readjob read-job", I want to open it by calling the script opendeploy readjob or opende... |
I solved this problem statement on dear old codeforces.
The Problem Statement wants users to replace occurrences of '10' in the given string with either '1' or '0' until there is no occurrence of '10' left and the string formed is the lexicographically smallest string from the set of all valid answers.
This is my solut... |
I created an algorithm to create lists of anagrams
The input is ["eat", "tea", "tan", "ate", "nat", "bat"]
Then, the output should be:
[["eat","tea","ate"],["tan","nat"],["bat"]]
Each array is words that are anagram.
My solution is:
function group(input) {
let result = [];
if(input.length === 0){
return... |
I have small question. I don't know much about JavaScript (jQuery) or AJAX and I don't know whether I'm doing it safe from XSS Attacks, SQL injection and that stuff. I think the PHP with MySQL would be written right. The code works, I have added it below.
This is PHP with database call which is called by AJAX
if(isse... |
The task:
Determine if a word or phrase is an isogram.
An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed to appear multiple times.
Examples of isograms:
lumberjacks
background
downstream
six-year-old
The word isograms, however, is n... |
In a game of Tic-TacToe given a gamestate:
game_board = [ [1, 0, 1],
[0, 1, 0],
[0, 1, 0] ]
I have written the following piece of code to display the output of the gamestate in regards to wins:
game_board = [ [1, 1, 1],
[0, 1, 0],
[0, 1, 0] ]
# Horizontals
h... |
I'm working on a solution to the Following problem on Hackerrank, and I seem to have found a function that works for the purpose.
However, I feel as though this is a very overdesigned solution to a problem that appears, at first glance, to be simple. This is what I've come up with so far:
This code takes in two arrays,... |
I am creating Monopoly using react hooks. I am using cypress for testing it. The first test I have to create is to check about dice rolls. I have three tests in which I am repeating the same kind of code. How can I refactor this?
//A funcction to get the rolls of dice in number
function getDiceRolls() {
const dices ... |
This is part of my code.
List all files and read them into the list files.
Now I have a dictionary my_dict. The values are the parquet files. all files must have same schema.
I have more than 2000 files is my folder, so files is large.
For each file I firstly gunzip all of them.
Next I find all the JSON files.
Problem... |
For game AI development, I am currently using a slight modification on the DFS "count the islands" problem (specification below) as a solution to the One Hive Rule for the game of Hive. This may not be the ideal solution so I am open to any other ideas if you note DFS is not the best approach. Thank you.
Given a 2d gr... |
I'm an experienced Java developer, however I don't have experience with reflection or Annotation classes. For fun, I tried to develop a CSV Reader class which can parse each row into a particular type.
Here is my code:
package com.richardrobinson;
import java.io.BufferedReader;
import java.lang.annotation.*;
import ja... |
I'm building a dead simple CLI app that parses a RSS feed and prints it to stdout. I needed a simple word wrapping function to, well, wrap lines to an arbitrary length (say 80 or 120 chars).
I ended up using this, as it gets the job done. However, as I'm still new to Go, I was wondering if this can be improved?
func wo... |
It's the first time a write a non-trivial mongodb query, and I came up with one that does work, but is 123 lines long! Surely there must be a way to write it in a more concise way.
The purpose of the query is to return aggregated (average) values, using groups that are determined by the $interval parameter in seconds. ... |
I am currently learning Java; I could really use some help from more experienced programmers.
How can I clean up my Tic-Tac-Toe code? What mistakes have I made? Can I use more exception handling? I tried to use exception handling, in isValidStepCheck and takenFieldCheck, but I don't think I used it efficiently.
public ... |
I have a simple class to ensure the date entered into a form is a valid date. Where can I improve it, have I missed anything?
public class ValidDate : ValidationAttribute
{
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
var dateToParse = value.ToString()... |
// variables
// arr has elements to be sorted
var arr = []
// temp is to store the intermediate results after merging
var temp = []
// seen is for marking visited i.e. sorted half as green
var seen = []
// length of array
var len = 50
// canvas initialisations
var canvas = document.getElementById("myCanvas")
canvas.... |
I'm a solo developer and a friend told me that my code is not very readable. I always write code trying to keep it DRY while not taking longer than it would take doing it in an "easier" way.
Here is the skeleton for My Profile feature which will initially have read-only values. When the user wants to update it, it turn... |
The code below works as intended but I'm not sure the way I'm passing it to a component is correct. Also, I don't think the way I wrote this function is recommended. It's not a pure function and probably should be split into two functions where one needs the output of the other.
'books' and 'authors' are 'state' object... |
I am a beginner in programming with Python. I am going to start my first job in this specialization. Can I use this code for presenting my skills at an interview?
import os
import time
import datetime
import sys
from PyQt5 import QtWidgets, QtGui, QtCore
class MainForm(QtWidgets.QMainWindow):
# atribute to save... |
I had the below problem in a coding test and I got 28/30 tests passes and 2 failed due to a time-out.
Problem You have created a programming language and now you have decided to add hashmap support to it. It was found that in
common programming languages, it is impossible to add a number to all
hashmap keys/values. So... |
I'm solving a knapsack problem here. It works, but gives time limit exceeds on a certain test case.
Problem statement
There are N
items, numbered 1,2,…,N. For each i (1≤i≤N), Item i has a weight of wi and a value of vi
Taro has decided to choose some of the N
items and carry them home in a knapsack. The capacity of th... |
I have written a few classical Python functions in JavaScript. I would appreciate any kind of feedback. The main goal is to learn about JavaScript. For example errors, improvements or existing JavaScript functions that I missed. Additionally, challenges that would be interesting to tackle next would be appreciated.
// ... |
This JavaScript code generates the full name of the numeral scales for large numbers under the "Short Scale Numeral System" using the Conway-Guy system for forming number prefixes.
Some very brief information on how this is done can be found at the end of this Wikipedia article.
However, I have tried in this article to... |
The first part of the code opens Chrome and navigates to GitHub. If I don't find my solution, I open a new tab with ctrlt. Then my code goes to Stack Overflow and searches there for solutions.
from selenium import webdriver
from selenium.webdriver.common.keys import *
import time
import keyboard
q = input("what is you... |
First time working with any type of graph traversal. The algorithm determines whether a path exists between two nodes using breadth first searching (BFS). The BFS method returns a tuple; indicating whether a match has been found and the length between the two nodes. I implemented it this way since it's part of a privat... |
I wrote a script to compute the polarity of sentences. The script is based on this:
The lexicon based approach assigns a sentiment tags to words in a text based on dictionaries of positive and negative words. A sentiment score is then calculated for each document as:
$$\frac{\text{number of positive words} - \text{num... |
I have created a simple HealthCheck service. I have two approaches:
Create a task canceling the previous one if the system is active, rescheduling the new task.
Create a periodic task and regularly check the last active time.
Which one is better?
Recommendations on how to improve my usage of synchronized, volatile, A... |
The Source code is maintained on GitHub and may be cloned via the following commands. A Live demo is hosted online, thanks to GitHub Pages.
mkdir -vp ~/git/hub/javascript-utilities
cd ~/git/hub/javascript-utilities
git clone git@github.com:javascript-utilities/decimal-to-base.git
The build target is ECMAScript version... |
I recently wrote a mathematical expression parser in C++. The software can read valid mathematical expressions and evaluate them. An example of an expression the code can parse is (sin(pi)*e^(-3)). I would love to receive constructive feedback if possible for the code. Such as compiler optimizations, memory optimizatio... |
I'm looking for advice on how to improve this program and use Pandas more effectively.
I have a data set of orders from a market. Each order has four properties:
A type_id representing the good
Whether the order is either a buy or sell order
The price of the order
The order's volume.
I process the market data to crea... |
I am creating a NAME column in a DataFrame and set its value based on substrings contained in another column.
Is there a more efficient way to do this?
import pandas as pd
df = pd.DataFrame([['www.pandas.org','low'], ['www.python.org','high']],
columns=['URL','speed'])
print(df.head())
df['Name'] = df['URL']
p... |
This class validates that a name contains only letters and optionally spaces, hyphens and apostrophes.
public class NameAttribute : ValidationAttribute
{
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
if (value == null) return ValidationResult.Success;
... |
I am starting with Java and at the beginning I would like someone to catch what mistakes I make. I would like my code to look its best and I want to learn good Java writing habits. Could anyone explain to me where I am making mistakes or what I should do differently for this purpose?
My program presents a music playlis... |
As more fully detailed in my question here, I'm in the process of starting a small, local business and wanted to avoid showing sequential invoice IDs to clients, and instead generate completely random ones. Thanks to the advice in the comments to that question, I decided to eliminate the risk of any collisions by incor... |
I'm posting my code for a LeetCode problem copied here. If you have time and would like to review, please do so.
Problem
Given a m * n grid, where each cell is either 0 (empty) or 1 (obstacle). In one step, you can move up, down, left or right from and to an empty cell.
Return the minimum number of steps to walk fro... |
I found this Powershell command useful in comparing folders and find common and different files.
Since I really like C and C++, I've decided to create a program to do that.
It will get all files in 2 folders given as arguments, will store them in an std::map.
After, it will compare the 2 maps and give the common files.... |
I want to understand if I got this concept correctly.
I should start work from ViewState; a reference type object holding the state of a view. Here it is called PageIndicatorVM. It is bad-to-impossible to have any internal state in a View.
No logic in the View or so they say. Yet here and there in the code samples I s... |
Recently I've been doing some challenges on HackerRank and came across this one. First, I tried with Python, and then C. Both of my codes failed due to timeout restrictions.
It would be very helpful, if someone can tell me what can be improved in (one of) my codes (performance-wise).
Challenge description:
Alice purch... |
I made this Tic Tac Toe game in C. It works but I thinks it could be programmed better. You have the option to play alone or between two players. It also lets the player select if he uses 'X' or 'O'.
Please check it out and review.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
char marks[3][3]; /*stores eac... |
This piece of code does a linear generation with two 'tweaks':
It sets a global loop as an index to reference variables that are holding values that need to be exclusive to that value of loop. These variable are those using pointers and double pointers. That way we can play on the loop value with each word's generatio... |
I wrote a script to execute a service on the Forestry TEP platform via its REST API. This service has certain input parameters, some of them are numerical values, other strings or files. The current workflow is:
There is a configuration file that has options for file and literal inputs. Each option is a dictionary, wh... |
For a library I am working on, I have created a class WatchableCollection which will monitor an endpoint of an API for updates and issue events (WatchableCollection extends EventEmitter). The constructor of WatchableCollection takes an initial set of values to store and an async function to check for new endpoints.
Use... |
I'm doing Project Euler problems as a learning platform for Forth. Currently I'm solving Project Euler Problem 8 which involves a 1000-long string, which I entered directly in the source code.
My questions are:
What options are common for dealing with input?
If I put the locals on the stack, won't that make the loop t... |
My program makes API requests to Pinnacle Sports to retrieve future events and saves them to the database.
Questions:
Do I manage the database resources correctly? It takes about 3 seconds to check whether there are duplicate entries so that apparently it is very inefficient. The previous approach was to have global c... |
This is a Biopython alternative with pretty straightforward code. How can I make this more concise?
def genbank_to_fasta():
file = input(r'Input the path to your file: ')
with open(f'{file}') as f:
gb = f.readlines()
locus = re.search('NC_\d+\.\d+', gb[3]).group()
region = re.search('(\d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.