instruction stringlengths 71 95.1k |
|---|
The Locker Problem is as followed:
Twenty bored students take turns walking down a hall that contains
a row of closed lockers, numbered 1 to 20. The first student opens all the
lockers; the second student closes all the lockers numbered 2, 4, 6, 8, 10, 12, 14,
16, 18, 20; the third student operates on the lockers numb... |
The live version is at my github
Lingo is a game where the host secretly picks a 5 letter word, then provides the first letter to the player. The player then guesses a word, and the host gives feedback on what letters are right, wrong, or in the wrong position.
I call this feedback match_string and use the following fo... |
I recently completed the following exercise, but wanted some feedback on how idiomatic etc. my haskell program is. This is from a course which introduces us to file IO before we cover the theory of monads, so my monad-knowledge is still in its infancy. Any feedback much appreciated.
Here's the task:
In StudentTeacher.... |
I am writing a credit card generator. I have method GenerateVisa() who will return either a 13 or 16 numbers string.
This is the default value but GenerateVisa can also take a parameter. THis parameter will allow us to force the output to either 13 or 16.
What is this parameter? I could use a int like GenerateVisa(int ... |
I have been working on porting my PowerShell 7 scripts to Python 3.9.5 lately, re-implementing the same logic in a different programming language, keeping what makes it work and removing unnecessary parts, improving the code, and this is one of the scripts that has been re-implemented.
The code is simple, and I know t... |
I have a list of path I want to filter out. I want to keep only paths matching a specific pattern and remove all paths matching another specific pattern.
To achieve this I pattern matched on each pattern. Here is the code:
let stringToSpan (s: string) =
System.ReadOnlySpan<char>(s.ToCharArray())
let matchWildcard ... |
If we apply outward curving, inward curving, and no curving at all, individually to each of the 4 corners of the rectangle, we get next 81 variations:
The code implements next BASIC command:
BOX X1%, Y1%, X2%, Y2% RADII Radii%
BOX draws the rectangle between the opposite corners at (X1%, Y1%) and (X2%, Y2%).
The firs... |
I have recently come across a use case where I need to lump many maps into a single container. These maps can have different combinations of key/value types, but they all differ from one another.
For a certain set of key types Key1, Key2, ... and value types Val1, Val2,... the obvious implementation is
class LumpedMap ... |
I have written a function that takes as input a list of 5 numbers, then the program's goal is to return the largest drop in the list. It is important to understand that [5, 3, ...] is a decrease of 2 and that [5, 20, .....] is a decrease of 0. In short, a decrease can only be from left to right and the largest decrease... |
I work with a charity that does a number of jobs, more than 100, less than 1000 a year. Jobs are identified with a year, and an up to 3 digit serial number, so 2021#123 for instance.
I'm writing a Python report program to pull jobs out of our database, and I'd like be be able to specify ranges of jobs rather like a pri... |
I've been creating a math engine in C++. I have decided now is a good time to ask for feedback from the community. Right now the main "good" things it has is complex numbers, calculus and a fraction class. I am planning to add set theory sometime in the future, although I don't know how useful it would be to programmer... |
I have a bash script that fixes or creates, and syncs the asciidoc attributes and yaml header for blog posts. It does what it is supposed to. But notice I have put sleep commands in between the sed -i insert commands. This is because I was getting unusual error messages such as:
sed: -e expression #1, char 40: unkn... |
This Program is a simple phonebook, user is given 3 choice, add a number to the phone book, dial a number or exit the program. Are there Any Improvements that i can make, either efficient or cleaning the code or something useful i can add?
import java.util.ArrayList;
import java.util.Scanner;
public class PhoneBookV2 ... |
There is a personal program of mine which logs in, scrape links and then download them. The downloader part is based on Youtube-dl and I think it's a smell code. Is there any way to improve this code?
import requests
import subprocess
import getpass
import time
from bs4 import BeautifulSoup as bs
import argparse
def... |
I have a contact model, on change I set the state of the contact object, how can I make the below function more readable?
The address field is different because it's an object: ['address', 'city', 'state', 'zip']
const onFieldChange = (
key,
index = 0,
isMulti = false,
isAddress = false
) => event =... |
I'm very new to programming and I decided to start my journey with Python. It's my fifth day of learning and decided to try myself out and make a very simple slot machine. I was stuck for hours because I had issues with the balance counter but finally managed to make it work.
Would you please rate it or give your opini... |
This is my attempt at simulating an eco system.
Basically this thing is suppost to simulate how an eco system works.
Its not the most accurate thing but it's something.
Let me know what you think about it.
using System;
using System.Collections.Generic;
using System.Linq;
namespace Ecosystemsimulation
{
class... |
I made a 52 standard deck generator for practicing my C#. Just to let you know I am using the unity editor.
I would your feedback as to whether my code is good/bad or whatever you may desire.
using System;
using System.Collections.Generic;
using UnityEngine;
public class Standard52Deck {
List<Card> deck = new List... |
This is a follow-up question for Android APP connect to FTP server in Java. I am attempting to create a tiny FTP host manager with FTPHostProfile class and FTPHostProfiles class.
The experimental implementation
Project name: FTPHostManagement
FTPHostProfile class implementation:
package com.example.ftphostmanagement;... |
I'm constructing a homework from my Spring Boot Course and so far I did the JPA layer and want to have some feedback, before start the business rules, about if the I could improve something or change a type of relationship in my app. Any suggestions will be welcome.
Here is the exercise:
"Assume we have a big legacy sy... |
Question:
Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".
Example :
Input: strs = ["flower","flow","flight"]
Output: "fl"
Source: https://leetcode.com/problems/longest-common-prefix/
My Code:
public String longestCommonPref... |
I understand there is another question on this already, however this is what I coded and wanted to know if this would raise any red flags?
Regarding the Character picture exercise located at the end the following page:
https://automatetheboringstuff.com/chapter4/
Say you have a list of lists where each value in the in... |
I'm testing here ways to find prime number. But it looks weird because of repeating parts. Are there any options to make it prettier. Probably I should use cycle or wrap it in an interface.
start = System.nanoTime();
res = PoKrestyanski.letsUseit(numbers);
duration = (System.nanoTime() - start) ... |
I am trying to implement a cache which can be persisted. Also, some of the functions that I am trying to cache takes arguments that are not python objects (external library objects). But they seem to have a hash value. My first try was to use lru_cache but it didn't have an option to persist across sessions. Then I stu... |
I am attaching the code here. I am very new to VBA and trying to do a complex calculation using Macro. Please help me improve the speed of the attached code. The code works fine and produces the end output. The program is intended to do the following. I am calling the below two subs after data is filled in the sheet.
C... |
Time ago I had a header implemented with a Bootstrap carousel: You know, something like this:
<div class="carousel">
<div class="item"><img src="pic1.jpg"></div>
<div class="item"><a href="example.com"><img src="pic2.jpg"></a></div>
</div>
Pay attention to that link on "pic2.jpg", this will be fun...
Recently,... |
I am learning numpy, pandas, and sklearn for machine learning now. My teacher gives me code like below, but I guess it is ugly. This code is for splitting the data into training set and testing set, and later we could manipulate the entire data or just training/testing set by the [True, False, True, False ... ] idx_tra... |
Link to full problem description: https://www.codewars.com/kata/534e01fbbb17187c7e0000c6
My code:
def spiralize(size):
def get_change_values():
change_x = 0
change_y = 0
if direction == 'right':
change_x = 1
elif direction == 'left':
change_x = -1
elif... |
I have an enumerable source for which I do not know how big it is. I want to select a random element from it, without having to hold the whole collection in memory and with uniform distribution. I read about the reservoir sampling algorithm, and created a simple implementation for the very basic case where the reservoi... |
How can this code be improved by "closuring" of functions here?
// Your code here.
let countBs = countChar();
function countChar(str, letter = 'B') {
if (letter === 'B') return (str, letter = 'B') => String(str).split('').filter(ltr => ltr == letter).length;
return String(str).split('').filter(ltr => ltr == lett... |
I have method that fetches all orders from Database and filtering, sorting that data(I know better to do It by specific query to Database but I dont know how).
I have Order entity that has following
public class Order {
private int orderId;
private int userId;
private int carId;
private String userAddre... |
Here is the code for the game :
#include <iostream>
#include <sstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <vector>
using std::vector;
using std::cout;
using std::cin;
using std::endl;
using std::time;
using std::stringstream;
using std::string;
using std::to_string;
con... |
My .bash_aliases file contains several aliases.
In the beginning, when I wanted to see the aliases, I print the .bash_aliases file,
The output wasn't readable at all, so I created a python script to make it better.
To call my python script, I use the alias print_aliases_manual
What is the most pythonic way to write the... |
I've made this script to automate blocking some deviant hosts on my router, and was curious if there's anything much else that can be done to make it quicker and more efficient.
Presently I'm restricted to using packages available on the Entware repository and the latest Busybox/ash shell environment. So, for example, ... |
I am here to ask for some more experienced programmers to critique my first project. I wanted to see where I lack and what I can improve on. Thank you for taking time out of your day to help me better my skills as a programmer! I hope I did a good job for being a beginner but I know there is much more to learn!
game_bo... |
Is there any room for improvement, in terms of simplicity and efficiency?
from random import randint
class Dice():
def __init__(self):
"""Making a dice instance with 6 sides."""
self.sides = 6
class Roller(Dice):
def __init__(self,name,age):
"""Making a Dice Roller Instance"""
... |
Hmm, I know this has been implemented countless times, and Python 3.9.5 math standard library has a built-in gcd() method that does exactly this, but this is how I do this, I think completing simple programming challenges using new ways will let gain experience that will help me find ingenious ways to overcome unpreced... |
Hi I was just asked by stackoverflow to move this question into this forum (https://stackoverflow.com/questions/67685433/how-to-design-the-react-component-properly).
Hi I am pretty new to react and I want to achieve something that turns out to be real pain for me and I am not sure what the best solution might be.
I got... |
I wrote a Pi Calculator using the BBP Algorithm in Cython. My specific goals are make the code more legible and more performant. This is a purely academic script in order to teach me how to implement complex algorithms with arbitrary precision (so no monetary gain, it's not homework, but is a personal goal). I have nev... |
Please review this code
I have written a function to find the successor of BST in c. It takes three arguments, i.e root pointer to the binary search tree, node value of which we have to find a successor and parent pointer (for first call it is also root pointer. It will return an integer that is the successor of the no... |
I have recently started to work with C++ and I do consider myself quite basic in C++ coding.
I have made the following two functions and I was wondering whether someone could give me some hints on how to improve and speed up this code.
Please, note that the second function is then used in R through Rcpp R package.
#inc... |
I am implementing a fixed point type, which mostly is used to be able store numbers as multiples of some base (power of 2). Apart from that, the type should be able to replace double/float values without the need of modifying some code. In its current implementation only basic arithmetic operations are possible but it ... |
I am new to python, and developing a moderate application for which I need to setup a logging mechanism.
The below program sets up log handling, which gives the user an option to specify whether log rotation is required or not.
The rest is my application. The code is mostly written in terms of functions (not using clas... |
This is a follow-up question for Android APP User class implementation. I am attempting to create a password strength assessment class which is named PasswordStrengthAssessment in Java. Instead of adding "111111", "123123" or the other weak passwords one by one in program, the 10k-most-common.txt on Github is used as t... |
I wanted to implement a short and functional brainfuck interpreter with minimal code repetition. It uses a little bit of macro magic, and does nested loops iteratively rather than using a cache, but it seems to do fine for most tasks I've given it.
One of my goals was to use the absolute minimum in external libraries, ... |
I am new to python and I am trying to write a function with various actions based on the parameters sent. I am checking if the data has valid format then it publishes to /accepted otherwise to /rejected. If the data is fine then it does the function and then publishes to /success otherwise to /failure
Here is what i am... |
Follow-up from this question using @Toby Speight's answer:
The primary concern is jq improvement/optimization, but please detail any others.
#!/bin/sh
set -eu
sources=$(mktemp)
trap 'rm "$sources"' EXIT
curl -s -o "$sources" https://raw.githubusercontent.com/T145/packages/master/net/adblock/files/adblock.sources
... |
I'm brushing up on Python, working my way through Python Workout. One of the exercises is to emulate the Python zip() function, assuming each iterable passed to the function is of the same length. Here's what I've come up with:
def myzip(*args):
result = [[] for _ in range(len(args[0]))]
for i, v in enumerate(a... |
I am trying to implement a basic hash table using a list of tuples. The code produce the desired output. Please help me improve my code as I feel there are a lot of while loops.
#global variables to keep track of the hash table
count = 0
size = 1000
def hash_table(size):
return [None] * size
def hash_item(key... |
This is a follow-up to this phonebook code.
This Phone Book allows the user to Enter a value between 1-3.
Entering 1 lets the user Add a number to the phone book, when the process is finished, the user is asked again to pick 1 of the 3 tasks.
Entering 2 lets the user speed dial a number. If the number exists, it will... |
I am really new to React and I worked on some challenges. I need to mention I did most of the stuff on my own without much dependence on the internet beside what functions do. I'd like to know if I did something wrong in regard to code structure and if there are better ways to achieve what I did.
The purpose of the cod... |
This program will get data from a folder called Data which has txt files and will return the filename with a score but I don't think it's really good.
Can I get any kind of feedback on this program. Is there anyway this can be written in a better way or something that should be added to?
import os, nltk, re
from nltk i... |
I was doing the following exercise:
Create an algorithm which asks the user a number from 1 to 7, and each number represents a day on the week. For example, 1 represents Sunday, 2 represents Monday and so on. The user will type this number and the program will show them the name of the day on the week and if it's a bu... |
need some help or advice, HackerRank's frequency-queries challenge,
the challenge of this Hackerrank problem is to check if the frequencies of number in your data structure matches the queries.
small integer values, that occupy the first 2 bytes of the integer datatype are fast and passes the test, but for values close... |
I am a newbie to JS and I am working on a FizzBuzz challenge. Below is what I have tried. Essentially when the function takes a value then it would iterate from 1 up to the value and an array would result.
I am seeking advice on adding conditional checking such as:
If the value of n is less than 4, it will return the ... |
I'm learning the file system library and thought nothing could be better than a project, so I thought of recreating the basic Linux commands such as ls, cd etc using C++ and <filesystem>.
As I said, I'm learning C++ and exploring libraries, so there could be weird code and all those things; could you review my code and... |
I have a data frame that has several columns, one of which contains html objects (containing tables). I want a column of table arrays.
My problem is that this piece of code takes a long time to run. Is there any way I can optimize this? I tried list comprehension, which doesn't significantly improve run time.
Some sugg... |
Looking a way to reduce the below code to get comma separated values from the list of arrays
By using ECMA or plain old vanilla JS. How should we achieve this?
Actual Array Data:
[{
ansBook: "046H",
ansPersonId: "2044000102",
bookNbr: "046H",
dns: "0",
examCode: "20717010",
examShortTitle: "QA-A... |
Here is a code I experimented with recently:
let br = [0]:[n:(concat $ take n br) | n <- [1..]] in concat br
This code produces the binary rule 0 1 0 2 0 1 0 3 ...
Here is the idea of how it works:
create a list starting with [0]
each step, concatenate all the current elements in the list, put the next number at the... |
I would like to transform my dataframe into an array of fixed-sized chunks from each unique segment. Specifically, I would like to transform the df to a list of m arrays each sized (1,100,4). So at last, I would have an (m,1,100,4) array.
Since I require that the chunks be of fixed-size (1,100,4), and on splitting it i... |
I created a backup script in bash to basically backup my webservers using cron commands.
The script reads one or multiple config file(s), downloads a target directory, and can send by mail the rsync log. It can also keep a number of backup increments.
https://github.com/kokmok/my-simple-backup
#!/bin/bash
SCRIPT_DIR=... |
This is code for a caesar cipher that I wrote, I would love for anyone who can to offer any improvements/corrections/more efficient methods they can think of. Thanks.
alphabet=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","1","2","3","4","5","6","7","8","9"... |
A few weeks ago, I developed a terminal game that increases your typing speed. The game is all about typing, providing difficulty levels from easy to hard. I feel like this terminal game won't become as popular as my others, so I need tips on how I could improve this code to make it shorter, easier to run, and more ent... |
I’m working with the Google Books API and I’m not so sure about the way I’m going to get the search data and return it to the user. I will describe the path here and I would like to know if you would do something different.
First, I receive a search request from the user via a form inside index.html:
<form action='/loo... |
The following code is working as expected but I'm wondering if there's a way to use Object.assign, or some other approach, to build the derivedData object so that it doesn't need to be initialized as an empty object and then populated in a subsequent step.
const data = [
{"period": "2021-05-01", "quantity": "28"},
... |
It is quite long so I'm not sure I can ask you to review my code. But I have no choice indeed.
What I'm doing is analyzing the Korean language. To do this, first I collect data and loaded the data via pd.DataFrame. Then, I chunk the text data ('contents' column in the dataframe) into morpheme units by using TextAnalyze... |
One of my main goals regarding this script has been to figure out a way to use the "adblock.sources" file available on its main repository and not my fork. That version has some syntax issues with its JSON, preventing it from being directly piped into jq.
After some research, I came across the jq -n -f {file} command t... |
I was wondering if it's possible to simplify this regex string (JS):
function validateDateString(date){
const regex = /[0-1][0-9]-[0-3][0-9]-[0-9]{4} [0-2][0-9]:[0-5][0-9] [A|P][M]/;
return regex.test(date)
}
It is supposed to validate a string in the following format: MM-DD-YYYY hh:mm A
|
I made a small rust snake game in order to teach myself rust. I would like to know what I am doing well and poorly, and how to improve my rust code
Cargo.toml
[package]
name = "snake-rs"
version = "0.1.0"
authors = ["Hurricane996 <levijwillrich@gmail.com>"]
edition = "2018"
# See more keys and their definitions at htt... |
An Object-relational mapper built using php.
This was done for educational purposes, and curious to know what kind of improvement has to be done to use in production.
Please refer to the complete source code in the Github repository - (https://github.com/maleeshagimshan98/infinite-simple-orm)
Below, I've described the ... |
Link: https://leetcode.com/problems/reverse-nodes-in-k-group/
Problem description:
Given a linked list, reverse the nodes of a linked list k at a time
and return its modified list.
k is a positive integer and is less than or equal to the length of the
linked list. If the number of nodes is not a multiple of k then
lef... |
Well this a re-implementation of a PowerShell script that I wrote which does exactly the same thing, and I have ported it into Python.
After a quick Google search I found that there is only one other script that does the same thing, which can be found here: https://reg2ps.azurewebsites.net, though the output of Get rem... |
Sum of Pairs
Given a list of integers and a single sum value, return the first two values (parse from the left please) in order of appearance that add up to form the sum.
sum_pairs([11, 3, 7, 5], 10)
# ^--^ 3 + 7 = 10
== [3, 7]
sum_pairs([4, 3, 2, 3, 4], 6)
# ^-----^ ... |
I'm working with a pandas dataframe which describes the start and end time of visits. A toy example of the data could be as follows:
import pandas as pd
data = pd.DataFrame({"start": [pd.Timestamp("2020-01-01 01:23:45"), pd.Timestamp("2020-01-01 01:45:12")], "end": [pd.Timestamp("2020-01-01 02:23:00"), pd.Timestamp("20... |
I have put together the back-end (API) with the Slim framework (v3) and MySQL.
In index.php I have:
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require '../vendor/autoload.php';
require '../src/config/db.php';
$app = new \Slim\App;
// Todos Routes
re... |
Hello everyone
In today's assignment I had to write a function to determine if (and how many) the quadratic function defined by the formula f(x) = ax^2 + bx +c has roots. I had decorators to write.
Here is my solution:
from typing import List, Tuple
from math import sqrt
from datetime import datetime
class DeltaError(... |
The task is to get the most recent login time of the day for each user. Then send such a result to an API.
The log file (file.log) looks like the following (only the last two days):
2021-05-26 09:28:40.720+0000 INFO [alice]: logged in
2021-05-26 09:47:44.714+0000 INFO [alice]: logged in
2021-05-26 09:48:47.379+0000 I... |
I'm trying to keep a bunch of Objects called Machine in their proper order. I was wondering if it'd be possible to further optimize the function HandleLocationCount for performance.
Any general feedback is of course also welcome. The function HandleLocationCount is only executed when a new Machine object is added.
The ... |
How to make my script shorter and better? This code allows only digits, auto-format card number like this XXXX XXXX XXXX XXXX. if user hits delete or backspace to delete space in between digits, nothing happens caret just moves 1 space forward or backward, it depends on which key user pressed (delete or backspace). If ... |
Background
I am creating a tool to locate a small bitmap in a large bitmap by comparing each pixel.
Since I am by far no professional programmer, I was searching for some code snippets and found this.
The code from the link uses pointers and requires therefor the “unsafe” keyword and is working perfectly. With the usag... |
I have method that fetches sorted and filtered data from Mysql Database, Firstly I had done It by using Java. Now I did it by Mysql but I don't like the way the code looks
I have entity that named Order and It looks like this
public class Order implements Serializable {
private int orderId;
private int userId;
... |
Progress. I managed to fix the remaining GF fields, including QRCode and the various Aztec fields. Verified with the RS Java code. Loading the latest ProCrypto-1-1-1 and ProCryptoTests-1-1-1 will load the latest RSFEC.
Installer ss
project: 'Cryptography';
install: 'ProCrypto-1-1-1';
install: 'ProCryptoTest... |
I am currently participating in research on transient absorption spectroscopy and four wave mixing. In the experimental design, an extreme ultraviolet (XUV) laser pulse and infrared (IR) laser pulse are sent through a finite gas sample with a certain time delay between them. My current task is to develop a function tha... |
Basic paging function, is there logical problems with the JavaScript part?
very basic paging function.
I want to know if there are some problems in the logic of the code.
I feel the JS code is a bit bloated.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device... |
The general problem I'm trying to solve is that I have a code base that has zero documentation so I'm trying to automatically generate some diagrams of classes in package that I'm analyzing using erdantic.
Trying to make this as reusable as possible, so I have a generate_diagrams() function that should take in one argu... |
daily data:
ts_code close low
2021-03-10 APPL 6.67 6.66
2021-03-10 AMA 20.24 20.12
2021-03-11 APPL 6.75 6.50
2021-03-11 AMA 21.10 20.40
2021-03-12 AMA 21.31 21.03
2021-03-12 APPL 6.81 6.76
2021-03-15 AMA 21.43 20.95
2021-03-15 APPL 6.74 6.68
2021-03-16 AMA 21.... |
I have some Python code that runs as part of an Azure Synapse Analytics Apache Spark Notebook (or Synapse Notebook) and would like to add effective error handling. The code simply executes a given SQL script against the database. The code runs but I sometimes see errors like attempt to use closed connection. I would... |
The code's gonna be pretty simple and YES, I do know, what a proper UUID4 implementation is and what are possible approaches to implement RFC 4122.
But somewhere there exists a small piece of software, where possible dependencies should be minified if possible. Because of this and some other reason let's consider the f... |
Anybody mind providing an opinion on whether or not this is a good or bad example of Task Cancellation and why. I have my own opinion and I've been told that its baseless, just trying to find out who is off base. I don't think its me, but I am okay with it being me. I just need to know its me so I can evolve if require... |
I have a legacy winForms application that now I'm in charge of maintaining and developing.
This app has a lot of singleton instance....
Some are very similar to service that wrap other component or class other instead wrap some entities to making a cache-like pattern
This is an example of this cached class
public class... |
I have the following data bindings set up:
<DataGrid x:Name="dataGridReflections" Width="auto" MaxWidth="1570" HorizontalContentAlignment="Center" AutoGenerateColumns="False" SelectionMode="Single" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" Margin="0,0,240,0">
<DataGrid.RowStyle>
... |
I wrote my own logger, but I dislike how many times I overloaded the log() function. If anyone knows of another way of doing that, feel free to share.
/*
* Syml, a free and open source programming language.
* Copyright (C) 2021 William Nelson
* mailto: catboardbeta AT gmail DOT com
* Syml is free software, licensed... |
I created this working sample and the code is below. Any advice on how to make this code; cleaner, more effective, just overall better! The data is coming from an API and I need to parse, select the value in location 0 set the title and then rebuild the drop down control.
can it be done without the JSON.parse(data) or... |
from datasets import load_dataset #Huggingface
from transformers import BertTokenizer #Huggingface:
def tokenized_dataset(dataset):
""" Method that tokenizes each document in the train, test and validation dataset
Args:
dataset (DatasetDict): dataset that will be tokenized (train, test, validation)
... |
This is a follow-up question for Android APP User class implementation. I am attempting to build a user registering system and this post shows the user registration page implementation.
The experimental implementation
Project name: UserRegistrationAPP
birthday.xml Layout file:
<vector xmlns:android="http://schemas.an... |
I've written the following module to generate arbitrary triangles based on a subset of lengths and angles, like what https://www.calculator.net/triangle-calculator.html provides. It works well enough but as-written it's fairly repetitive. I'm new to OpenSCAD so I'd love some feedback if there are cleaner ways to expres... |
My Python code (part of a Django site) queries data from a redis database and loads it into a Pandas dataframe. I'm new to redis, and I think I'm not using the redis library as efficiently as I could.
The database keys are timestamps in epocho format. The values are all json strings. Here's a sample:
Keys:
['1622235486... |
this is my first post here!
I am working on a Tic Tac Toe AI in Python that uses the Minimax Algorithm to beat either a computer or a normal player. As of now, It has approximately 70% chance of winning each game, but I am trying to increase that number. Here are a few tests that show results of the Perfect Player, whi... |
I'm using Flask on Python and I'm displaying the username at the top of the site (and it's working) as follows:
@app.route("/")
@login_required
def index():
"""Queries the user's First Name to display in the title"""
names = db.execute("""
SELECT first_name
FROM users
WHERE id=:user_id
... |
After wrestling with CMake I now have a fully working solution.
It works, however, I completely massacred the CMake File:
This is my main cmake file:
cmake_minimum_required(VERSION 3.17)
project(Odin)
include(ProcessorCount)
ProcessorCount(N)
if(NOT N EQUAL 0)
set(CMAKE_BUILD_PARALLEL_LEVEL ${N})
endif()
message(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.