instruction stringlengths 71 95.1k |
|---|
I just started learning python yesterday, I have prior experience of C++. So I think I am able to get most of it pretty fast. I wrote a duplicate file finder for testing and practicing.
Can you guys look on this and give me some opinion if I am doing this right?
import argparse
import os
import fnmatch
import hashlib
... |
I am working on SEPA XML generator in F#.
I developed two solutions that are roughly equivalent, one relies on the XmlSerializer while the other relies on XmlProvider, I am wondering what is the most idiomatic one?
Using the XmlSerializer:
module SepaConversion.SepaXmlA
open System
open System.Collections.ObjectModel
... |
Write a function that will format a string and return it
A fixed length of string is malloc-ed. snprintf is used to format the string and then the buffer is returned.
const char *format_string(void)
{
char *buf = malloc(128);
snprintf(buf, 128, "%s/%d/%s/path", "here", 69, "is the");
return buf;
}
format... |
I have designed a compile time Finite State Machine generator. I have chosen to use some of the features of C++17 such as parameter pack expansion, fold expressions and lambdas to keep the complexity of this class structure and its hierarchy as simple and readable as possible.
It is currently in its infancy as I have ... |
A short script to make a CSRF token to be used in my html elements such as inputs, file-uploads, scripts, iframes & svgs.
<?php
session_start();
if (NULL || empty($_SESSION['csrf_token'])){ // Cross Site Request Forgery ::(Token.).
$_SESSION['csrf_token']= bin2hex(random_bytes(28).openssl_rand... |
I am writing a console application. CRUD functionality.I would like to try to apply the pattern. Is it possible to apply a "state" pattern? In the AddCustomer () method at the end, the call to the InputMenu () method, I do not think that this is correct. I would like to remake the "InputMenu", is it possible to apply t... |
Could be useful?
OrdinalIgnoreCase s1 = "a";
OrdinalIgnoreCase s2 = "A";
Assert.AreEqual(s1, s2);
Where:
public class OrdinalIgnoreCase : IEquatable<OrdinalIgnoreCase>
{
public static StringComparer Comparer { get; } = StringComparer.OrdinalIgnoreCase;
public static implicit operator OrdinalIgnoreCase(string ... |
I have this code that asks the user for inputs and validates the inputs if they are Integers (no other inputs are allowed). I'd like to ask for some help in terms of elegance of the code or performance, or just the overall code.
Also, I have found myself repeating these lines of code
Console.Write("Enter weight of p... |
Today after watching a getting started course about React, I tried to code my very first React component, a "treeview" as the title says. It does work, but as a newbie I know there are many improvement that can be done.
It receives a data array like the one below:
[{
descp: 'UNE',
url: '/tree/une',
icon: '... |
After taking advice from Reinderien, I have completely rewritten the code for my Window() subclass.
EDIT *reason for posting was unclear:
I would like for someone to suggest improvements or other features to add to this subclass. Either that, or give a general review.
EDIT *compatibility bug:
In root.config(), I change... |
i have the following json object
const file = [
{
"seatNumber": "1A",
"price": "£19.99",
"available": true,
"disabilityAccessible": true
},
{
"seatNumber": "2A",
"price": "£19.99",
"available": false,
"disabilityAccessible": false
},
{
"seatNumber": "3A",
"price": "... |
This is my first project using Go to study, I've built a simple utility to export output of commands or other scripts in the Prometheus metrics format.
The utility basically get's the output of a command or from a script and stores it into a map, which I'll later use to re-format the output to the Prometheus metric sta... |
https://leetcode.com/explore/interview/card/top-interview-questions-easy/99/others/601/
In Pascal's triangle, each number is the sum of the two numbers directly above it.
Example:
Input: 5
Output:
[
[1],
[1,1],
[1,2,1],
[1,3,3,1],
[1,4,6,4,1]
]
Please review for performance.
using System.Collections.Ge... |
A shipping company has a warehouse of Containers. Basically, a Container is a data structure with the following fields:
price
commercial campaign id
a list of possible shipment countries (empty list allows all counties)
internal id
The task is to implement a function taking the following parameters:
a list of contai... |
I'm relatively new to coding with PHP and mySQLi. I want to learn more but I'm really limited in resources. Most of my research went into W3Schools, PHP.net, and of course whatever I could find on StackOverflow. Now I'm trying to learn with practical projects like this account registration form.
Really I just want fee... |
Dropdown Screenshot
I have 3 dropdowns with multiple components in the UI.
Have incorporated data driven java selenium framework, data is fetched from excel sheet:
Excel sheet- where data is fetched
This data I am taking in to main class:
public class TC01_newDesign extends TestBase{
login obj_login;
createNew... |
I've been working on a Google Pub/Sub client library for golang. Fairly new to golang and my intention is to learn the language. Not really sure what are the best practices, aiming to learn them over a period of time.
Let me get straight into what the library is trying to do:
Create a topic.
Create a subscription.
Pub... |
I'm trying to improve on examples from Clean Code* while re-implementing them in C++. This time it's the Sieve of Eratosthenes prime-computing example from pp. 71-74.
Below is the original adapted for C++, without improvements:
.h
class PrimeGenerator {
public:
PrimeGenerator() = default;
~PrimeGenerator() = ... |
I've written a simple app that draws with a kaleidoscope effect in javascript, could someone please review the code? I'm especially interested in functional practices and design patterns.
const game = {
pi2: Math.PI*2,
sides: 12,
background: '125,125,125',
load: function () {
game.canvas = document.create... |
I'd like to write a script that receives text input from the clipboard that will be from a song lyric sheet with chords. The goal is for the function to return the text to the clipboard after transposing the chord names up or down a half-step. If the solution is with shell commands, I might still wrap it in an AppleScr... |
In CentOS I have a Web Application Root on which I have a website directory.
I would like to make an immediate backup of that website's directory by using the zip utility. The code works and tested.
Although I already use set -x and zipping is verbose (I'm not sure if due to set -x or zip default behavior), the trace i... |
I implemented Linked List data structure in C++ for practice purpose. The LinkedList.h uses Node.h as nodes. Creates and insert nodes dynamically to the list. I included function descriptions as comments just above the functions.
I would like to receive comments and suggestions regarding the code, algorithms (although ... |
This is a "Help me make a choice" script where the user can input two options and then, based on the (3) reasons why they are good options, and the reasons weight the script will tell you which option you should choose.
This is my first Python script based on an idea I had and I'd like to know how I could make it bette... |
As a follow-up on isosceles' question, I have created a small API to generate the notes of a scale given the pitch class set and key note. I've added the reinventhing-the-wheel tag because I know there exist far superior frameworks that deal with notes, chords, scales, musical notations.
Description
A pitch class set ... |
Is this the correct way to block requests in Express?
app.js
app.use("/", indexRouter);
app.use(function(req, res, next) {
next(createError(404));
});
app.use(function(err, req, res, next) {
res.locals.message = err.message;
res.locals.error = req.app.get("env") === "development" ? err : {};
console.log(err);... |
I am just starting to learn programming. I had already coded some functions and stuff in other languages, and whilst trying to complete this Python challenge
Kevin and Stuart want to play the 'The Minion Game'.
Game Rules
Both players are given the same string. Both players have to make
substrings using the letters ... |
I wrote a script to calculate document distance. It seems working but I couldn't be sure. (I tried for the small strings and it seems working) Also I am not sure that its fast enough for large texts.
Here is the Document Distance formula:
The frequency is the number of occurrences for each object. Such as for
"D1: be... |
Code Review has a Zombie Problem and, in comparison to The Walking Dead TV Show, our survival doesn't depend on killing them all day every day.
As a potential solution, I though it would be interesting to setup a friendly zombie killing competition (this wasn't talked about in meta yet), but in order for this to work w... |
I'm new at Rust and I'm trying to implement a cards' deck on Rust, I'm trying to use most idiomatic code I can, but since I'm new at this language, I'd like to hear advice from more experienced programmers. There's my code.
(P.D: Thanks in advance! :>)
use std::fmt;
use rand::seq::SliceRandom;
use rand::thread_rng;
#... |
I have a series of Events (roughly 10-20 events that will be dynamically created per month):
Event Model:
import { Schema, model } from "mongoose";
const eventSchema = new Schema({
callTimes: { type: Array, of: Date, required: true },
eventDate: { type: Date, required: true },
employeeResponses: [
{
_... |
I am building a simple calculator with jQuery.
I can append the value to the screen and when the user clicked the operator the first values are clear or empty.
My question is, how can I store first and second values from the input field to use those values to perform the calculation?
$(document).ready(function() {
co... |
For implementing Singleton we can use Traditional way like this Article,
but i think that to write it in another way:
public class Person
{
private static Person personInstance;
static Person()
{
personInstance = new Person();
}
private Person() { }
public static Person GetPersonInsta... |
I am creating introduction app to java ee and APIs of java ee and i want know if my code is ok (like its working but if it could be done better) and what should i avoid in future
package sk.studenthosting.simec.API;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/rest")
pub... |
I have base Controller for Attachments, here is code of it
In this controller, I pass data from the request and return URL of the posted object.
public class ApiAttachmentControllerBase<T> : PM101MobileApiController where T : Entity<int>
{
private readonly IObjectStorageManager _storageManager;
protected readon... |
I have SQL scripts that I want to be executable directly in the editor (like DataGrip or SSMS) and also in automated integration tests. However, in each use-case they require different environment and version parameters. I cannot use string_split because we use an ancient SQL Server 2012.
In order to differentiate betw... |
I've created a simple data visualization in python that shows the movement of refugees around the world. The code works but I feel it is a bit slow. it takes about 10 s (on my hardware at least) to generate the plot.
I'm using a python graphing library called plotly to create the graphics. The user can click an origin ... |
I am working on an RPG in Java and I am using a tile-based map. The characters will not be building, so I will not need to store the maps outside of the game, but I feel as if there is a more efficient way to initialize my maps.
public static int[][] spawnWorld = {
{ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, ... |
I am building a color sorting machine using a Arduino uno and a TCS3200 color sensor. I have a code that is working perfectly fine however I feel like the code could be a bit more clean seeing that I am using 3 almost identical for loops. Could anyone help me re-write these 3 for loops into one loop. Thank you in advan... |
I'm working on improving my Python skills and have been doing a daily code problem. For the problem:
Given a word W and a string S, find all starting indices in S which are anagrams of W
For example s = "abxaba" and w = "ab" should return [0, 3, 4],
s = "cbaebabacd", w = "abc" should return [0, 6]
Is there more efficie... |
I use c++ 11 enum class usually instead of the old enums because many enums can contain the same value
but as known they don't have the bitwise operators out of the box so we should define them manually
in windows it's already done for us with this macro in windows.h header :
DEFINE_ENUM_FLAG_OPERATORS
but I then enco... |
I created the class ContinuousDimensionInterval, to model an interval of a continuous dimension interval, presented below.
namespace Minotaur.Math.Dimensions {
using System;
public sealed class ContinuousDimensionInterval: IDimensionInterval {
public int DimensionIndex { get; }
public readonly... |
My code:
import re
mbox = open('mailbox.txt')
ndict = {}
for line in mbox:
domain = re.findall('From [^ ].*@([^ ]*)', line)
if domain:
if domain[0] in ndict:
ndict[domain[0]] += 1
else:
ndict[domain[0]] = 1
print_list = [print(i) for i in sorted([(i, ndict[i]) for i in
... |
I wrote some code to return how many prime numbers are in a specific range and what they are. It also tells you whether the number of primes is also a prime!
I feel like this seems like a fairly long winded approach for something that's probably very simple, can someone please tell me how I can improve this?
def prime_... |
I have made a website where people write about their day and see it analyzed. In particular, the website takes event titles and groups them together if they have any common words (after stemming the event titles). It also finds miscellaneous features that I feel would be important for machine learning later. The python... |
LeetCode: Group Anagrams C#
Given an array of strings, group anagrams together.
Example:
Input: ["eat", "tea", "tan", "ate", "nat", "bat"],
Output:
[
["ate","eat","tea"],
["nat","tan"],
["bat"]
]
Note:
All inputs will be in lowercase.
The order of your output does not matter.
using System;
using System.Collecti... |
I have a function whose responsibility is to send a push notification to a user. I call this function from a view in flask framework.
I have read multiple articles around refactoring and good designs but I want to know from those who have been doing this for a while what I can improve.
Here is the function.
def send_p... |
[Posted yesterday on Software Engineering, but was apparently "disappeared"...maybe better here]
Background: I am just starting to get my head around the idea of separating the domain model from the persistence layer (per Uncle Bob), service layer/IoC/separation of concerns/dependency injection, looking at some aspects... |
I am a newbie in the scientific computing in python. The function I am trying to calculate is the response of the wave equation for a given source term (For reference, See: Equation 11.67 in https://webhome.phy.duke.edu/~rgb/Class/phy319/phy319/node75.html).
$$\phi(\pmb{x},t) = \int_V G_+(\pmb{x}, t; \pmb{x'}, t)\rho(... |
I have an AWS Elastic Search server.
Using mapping template and an index strategy.
{
"index_patterns": "users*",
"order": 6,
"version": 6,
"aliases": {
"users": {}
},
"settings": {
"number_of_shards": 5
},
"mappings": {
"_doc": {
"dynamic": "strict",
"properties": {
"id"... |
There aren't enough questions about creating immutable objects... so why not try it again with another approach. This time, it's a builder that maps properties to constructor parameters. Properties are selected via the With method that also expects a new value for the parameter. Constructor parameters must match proper... |
I have to transform a response into the internal Coordinate record, some of the fields are lists and I need to handle empty lists case.
Records:
newtype GeoResponse =
GeoResponse
{ results :: [ResultResponse]
}
deriving (Eq, Show, Generic)
newtype ResultResponse =
ResultResponse
{ locations :: [Locat... |
The input is a set of alphabets.
The output is a string of 32 in length.
For any letter in the set if it is preceded by a '¬' we replace the n-th character in our output string with '0', such that n is the position of the letter in the alphabets. If it is not preceded by a '¬' and was there in the set then we replace i... |
I am trying to get better at Powershell and was wondering if I could get some advice on how to make this code more efficient/cleaner/anything.
This code is intended to launch three batch windows running robocopy at the same time with unique log names.
I looked into using a foreach loop but wasn't sure how I could do th... |
I have written a Regex to validate XML/HTML, along with any attributes. It aims to:
Match any XML-like text
Not match any unclosed tags
Adapt for any spacing, newlines, etc.
Be as generous as possible: match as much as possible.
Match self-closing tags (in edit)
I initially created this to validate API requests I was... |
I got caught in the trap of implementing my own data structure. I've created a very general tree structure, where each node gets one parent, some children, and holds a value.
I'm mostly looking for advice on how to make this code more idiomatic, but also functionality that might be missing from this class, or that isn'... |
I am a member of a university team designing a nanosatellite.
We decided to implement our own (more lite) logging library to use, instead of, say, Google's glog, spdlog, plog and Boost::Log.
The concept of different log levels is introduced, as a means of dividing the log messages into subcategories, according to thei... |
I'd like to know if there's any issues with this implementation of qsort_r (which is not available in all implementations, so I'm trying to provide one that allows to compare values in a dynamic environment) and whether it could be improved upon.
typedef int32_t compare_fn(void *data, const void *val1, const void *val2... |
I adapted a makefile to re-compile for changed header files by generating a list of dependencies.
The code framework already existed and all I had to do was adding a little bit of code for the compiling rules.
Now I get linker warnings. Which is confusing because when I compile my program, the linker links all object f... |
I have written a cashflow calculator.
Any suggestions on how to improve the code below?
Income and expenses have a similar pattern.
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QStringListModel>
#include <QSettings>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindo... |
I am trying to send data from an Arduino into Python via USB every 100 ms. What improvements can be made to my code? I feel like it is kind of bloated and can be better written, but I'm not sure which improvements should be made.
read_arduino.py
import serial
def _has_digits(string):
return any(char.isdigit() for ... |
This takes a user inputted string, then tries to randomly 'guess' it. The problem is that whenever the input's length is 6 digits or more, it takes an incredibly long time to process it. Is there a more efficient way of doing this?
import random as rand
import string
def main(word):
len_word = len(word)
ntries... |
In this SO post Dynamically choose class from string Alexander Platonov creates a Function on the fly and then uses Application.Run() to instantiate an Object by it's class name. Eureka Reflection in VBA!! How evil! How inspiring!! So that began my journey into the darkness.
My quest for power over Reflection spawn ... |
There are different methods to get data from server in Angular application:
Get Observable from the service and subscribe to it at component
Create Subject at the service and subscribe to the Subject at component
Both of this methods work for me but I can't understand which should I use.
First method. Get Observable... |
I wrote an helper class which allow me to request the body content from a site that is created by AJAX, for doing so I'm using Puppeteer Sharp. This is the class:
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using PuppeteerSharp;
namespace App.Helpers
{
public c... |
I wrote the following Bash script to upgrade All-core MediaWiki websites (no added extensions/skins or images - besides logo image).
I already tested the essence of this script and it worked for me; MediaWiki was upgraded from 1.32.0. to 1.33.0 and I can use the site regularly; yet I'd be glad for a review:
#!/bin/sh
... |
I was feeling like writing a new Uri parser. The previous one was too limited and wasn't able to parse the authority part. This one is also based on the pretty image here and can tokenize all parts. I drew the image as an ascii art below.
follow-up
Core
The implementation has a single method Tokenize that is the sta... |
I download a page to get it's source code. I then extract the first segment of the page that is between two strings that appear in the source code more than once.
How can my code be improved?
url = "https://www.zapimoveis.com.br/lancamento/apartamento+venda+vl-mariana+zona-sul+sao-paulo+sp+ibirapuera-boulevard+mofarrej... |
I have implemented the introductory challenge of University of Pennsylvania's CIS 194: Introduction to Haskell (Spring 2013) course. I have added the most important information of the problem statement below, and the full assignment is available as a PDF on the course website.
Problem statement
It starts with a short d... |
In many cases, we want a variable-size array like std::vector, but we know an upper limit on the size. In such cases, the vector can be allocated on the stack. We have been doing this in C:
char a[100];
fgets(a, 100, STDIN);
The problem is that the array doesn't know how many elements are actually there. All it k... |
Description
In a time where thin clients, web browsers, web services and micro services are prevalent, we tend to forget we still have to deal with thick and smart clients. Many applications in B2B still use the latter. It is common in such clients that the user can perform a set of actions on the client before synchro... |
I have been trying to solve this HackerRank problem:
We're going to make our own Contacts application! The application must perform two types of operations:
add name, where is a string denoting a contact name. This must store as a new contact in the application.
find partial, where is a string denoting a partial ... |
I have made a project at Github that uses computer vision to solve Sudokus. Since this is my first project I would really like to get some feedback on my code. Since it is not allowed to link my repository I took one class that I have created.
I am mostly looking for feedback on how I write my code, not necessarily on ... |
The goal is to make a word generator. The program takes a word list (typically, it may be the full dictionary of a language, or a list of names), analyses it, and then invents word that sound alike the one in the list.
There is multiple parts of the program, which is embedded in a Qt GUI. I used Qt Creator 4.9.2 (based... |
This is a follow-up on bank ATM mockup app in .NET Core framework and Entity Framework Core. I have 2 user interfaces: Console and Web.
Previously I have UOW and repository layer but I have removed them as it is considered overkill by many. Now that I have removed repository layer, just wondering where should I have my... |
Immediate Smaller Element The code is working fine Code is here. For each element in the array, check whether the right adjacent element (on the next immediate position) of the array is smaller. If the next element is smaller, print that element. If not, then print -1. The only problem is I'm getting "Time Limit Exceed... |
I have this long line of code:
enc = encoder.predict(np.array([data[stock][4*i:4*(i+30)] for i in range(lens[stock]+days-30)]))
The problem is, the number of characters (97) exceed 79, which is not allowed by PEP 8. To follow the PEP 8 guideline I can
temp = [data[stock][4*i:4*(i+30)] for i in range(lens[stock]+days-3... |
Abstract
I am a beginner of Rust language. As my practice I want to create simple train reservation system.
I know little about the "best practice" in Rust, so I want some advises in my code. In terms of the function there are much luck to improve, but I want advises about how to write codes "in Rust".
Code structure
... |
In the last days I've written a number guessing game that I've posted on this site.
I have now written a lottery simulation in which I tried to acknowledge the criticisms of the project mentioned above. I also tried to add error handling. If the user enters invalid numbers or complete bullshit, the program will not cra... |
Challenge
Link on geeksforgeeks: Binary Tree to DLL
Given a Binary Tree (BT), convert it to a Doubly Linked List(DLL)
In-Place. The left and right pointers in nodes are to be used as
previous and next pointers respectively in converted DLL. The order of
nodes in DLL must be same as Inorder of the given Binary Tr... |
I have found that there is a distinct lack of an RPN calculator available to me, so I decided to make my own. I am still adding new functions to it, but as of now, I would like to refactor my code.
Main of JavaRPN
Because this is a small problem, and I haven't made a GUI for it, I only use one class.
package owl;
impo... |
Part 2: Error Handling (and anything else that can be improved)
(Part 1 focused on general cleanup.)
I received this comment in an unrelated post (thanks @Milton):
...Since it is obvious you are using a GIS endpoint, I would note that
a lot can go wrong with your script if the GIS were to go down, move
url, reque... |
Bit Swapping
You’re given two binary matrices, m rows and n columns. Both matrices have the same size i.e. same number of rows and same number of columns. Each cell is a bit either 0 or 1. You need to find the minimum number of swaps are required in the first matrix in order for it’s arrangement to match that of the se... |
I am new to Python (it's my first language), been coding for a couple of weeks now.
I have already made a couple of simple scripts to download and manipulate some financial data, but lately I thought about making a simple hangman game. I tested it thoroughly and it seems to work just fine.
However, as I do not yet know... |
I built a simple console version of the rock paper scissors game. I would love to get some constructive criticism!
Questions
How could I code this in an object-oriented way?
Did my code follow the DRY principle?
Link to code
Repl: https://repl.it/@antgotfan/CrowdedGreenFlatassembler
var moves, result, images,... |
I am working on a basic blog application in Codeigniter 3.1.8 and Bootstrap 4.
The application allows Registration and Login. I have concerns about the security level of the Registration system I have put together.
The Register controller:
class Register extends CI_Controller {
public function __construct()
{
... |
I solved the following problem:
Write a function expand that takes in an expression with a single, one character variable, and expands it. The expression is in the form (ax+b)^n where a and b are integers which may be positive or negative, x is any one-character long variable, and n is a natural number. If a = 1, no c... |
source.Bottom(n, x => x) should be the same as well known LINQ source.OrderBy(x => x).Take(n) but is more memory/run-time efficient as it does not keep all items in memory as OrderBy does:
public static class BottomN
{
public static async IAsyncEnumerable<T> Bottom<T, TValue>(
this IAsyncEnumerable<T> sourc... |
Permutate() is supposed to generate all possible permutations of the source sequence:
foreach(var s in "abc".Permutate())
Console.WriteLine(s); // abc
// acb
// bac
// bca
// cab
//... |
I completed an algorithm problem just as a personal study, and I can't help but feel like my solution is a bit needlessly complicated, although I can't figure out a better way to do it. Here's the problem :
Given a number N, and a list of users currently on a stage, find out the failure rate of each stage up to N, an... |
This code works as it is intended. What I seek is a feedback on the quality of my code. Where should I have written it differently or how should have I approached instead of the way that I have?
These functions will be moved to a separate file to be used on other pages as well. My goal is to have this code reusable as ... |
I'm still new in javascript and learning. I want to create a date picker using html and javascript. Below is what I have tried and it's working, so my question is "how can I do it better?" My idea is to create a custom tag in HTML and allow multiple of these tags. The javascript part will then handle the build and func... |
Make() takes projects with a list of tuples representing project references in the form of (Dependency, Dependent) and returns projects in the order to be build:
static void Main(string[] args)
{
var projects = new[] { "a", "b", "c", "d", "e", "f" };
var dependencies = new[] { ("a", "b"), ("a", "c"), ("e", "f")... |
I have an algorithm that performs the base conversion. The input is a string and two ints b1 and b2. The string represents an int in base b1 and converts it into base in b2.
My code is:
def convert_base(num_as_string, b1, b2):
if num_as_string == '0' or num_as_string == '-0':
return num_as_string
base10... |
I want to write my own Work-In-Progress form to use it throughout my app (for the time being, mostly as an exercise).
I came up with the following code, I would like to know what are the design issues, if this is not the way to go, if it could be simpler or more generic.
Main form:
public partial class Form1 : Form
{
... |
I fetch a bunch of categories for a DropDown tree, and have to implement search in this dropdown. If there is a match in one of the elements, it should also get all parents to display in the dropdown hierarchy. The number of childnodes is unknown, and can be changed at any given time (example has only 3 levels but can ... |
Still learning JS and I made the following function to convert degrees into cardinal directions respectively. My first iteration of the code was over 50 lines and I was able to get it down to 13 using a for loop.
Is there a way to optimize or simplify the code down even more? Is my logic and implementation ideal?
https... |
Python has amazing sci-kit learn library but I am building some projects on C++ with involves some machine learning algorithms. I found machine learning libraries in C++ involves more dependencies so I have decided to implement a library without dependencies It would be nice if you could review the code.
I have impleme... |
I have a dataframe (obtained from a csv saved from mysql) with several columns, and one of them consist of a string which is the representation of a json. The data looks like:
id email_id provider raw_data ts
1 aa@gmail.com A {'a':'A', 2019-23-08 00:00:00
'b':'B',
... |
Prerequisites
The typedef name uint128_t designates an unsigned integer type with width exactly 128 bits.
The UINT128_MAX is maximum value for an object of type uint128_t.
Function int ctz(uint128_t n) returns the number of trailing 0-bits in n, starting at the least significant bit position. If n is 0, the result is u... |
Here is App.js
const listItems=document.querySelector(".student-list").children;
const studentList=document.querySelector('.student-list');
const numberOfItems=10;
const page=document.querySelector(".page");
displayPage=(list,pageNumber)=> {
const SI=(pageNumber*numberOfItems)-numberOfItems;
const EI=pageNumber*... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.