Custom ChatGPT Plugin development

ConversAI Solutions

Code faster with the help of AI

Generate code just by typing a text description. AI will create the code for you. Test it now

Questions about programming?Chat with your personal AI assistant

How others used it recently

Generated by the communtiy

generate functionThu, 20 Apr 2023

quiero generar un boton que me permita seleccionar opciones utilizanzo react. que me permita filtrar las opciones mediante el texto que muestran y que tambien permita limpiar la seleccion con un icono de cruz en el costado derecho

import React from 'react'; import { Button, Input, Icon } from 'antd'; interface MyButtonProps { selectedOptions: any[]; onSelectedOptionsChange: (selectedOptions: any[]) => void; options: any[]; } const MyButton: React.FC<MyButtonProps> = ({ selectedOptions, onSelectedOptionsChange, options }) => { const [ text, setText ] = React.useState<string>(''); const [ dropdown, setDropdown ] = React.useState<boolean>(false); const [ filteredOptions, setFilteredOptions ] = React.useState<any[]>(options); const handleDropdown = () => { setDropdown(!dropdown); }; const handleTextChange = (e: any) => { const text = e.target.value; setText(text); const filteredOptions = options.filter(opt => opt.text.indexOf(text) > -1); setFil

TypeScript
Guest
generate functionSun, 11 Jun 2023

Escribir un programa que lea las dimensiones de una matriz, la visualice y encuentre su mayor y su menor elemento y sus posiciones respectivas.

Script const readline = require('readline').createInterface({ input: process.stdin, output: process.stdout }) readline.question(`dime cuantas filas quieres`, (rows) => { readline.question(`dime cuantas columnas quieres`, (columns) => { console.log(`Vamos a crear una matriz de ${rows} filas y ${columns} columnas`) let matrix = createMatrix(rows, columns) printMatrix(matrix) let minInfo = getMin(matrix) console.log(`El minimo es: ${minInfo.value} y está en las posiciones (${minInfo.i}, ${minInfo.j})`) let maxInfo = getMax(matrix) console.log(`El maximo es: ${maxInfo.value} y está en las posiciones (${maxInfo.i}, ${maxInfo.j})`) readline.close()

generate functionTue, 28 Mar 2023

Make a program that receives as parameter a file called directorios.txt that will contain the names of directories that exist in your system. The program will have to read from the file the names of ...

def file_to_dict(file_name): file_dict = {} # open the file with open(file_name) as f: # loop through each line in the file for line in f: # remove new line character key = line.rstrip() # get the number of files in the directory file_dict[key] = len(os.listdir(key)) return file_dict def file_to_sorted_list(file_name): file_dict = file_to_dict(file_name) # return a list of directory name and number of files return sorted(file_dict.items(), key=lambda kv: kv[1]) # test for dir_name, number_of_files in file_to_sorted_list('directorios.txt'): print(f'{dir_name} has {number_of_files} files')

Java
Guest
generate functionSun, 04 Dec 2022

Offline speak function for windows

import os def speak(text): os.system(f'powershell.exe -Command "Add-Type -AssemblyName System.speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak(\'{text}\');"') speak('Test')

Python
Guest
generate functionWed, 21 Dec 2022

dice gambling script

from random import randint def diceRoll(userGuess, numRoll): if userGuess == numRoll: return True else: return False def main(): numRoll = randint(1, 6) userGuess = int(input("Guess a number from 1 to 6: ")) if diceRoll(userGuess, numRoll): print("You win!") else: print("You lose. Better luck next time!") main()

Python
Guest
generate functionWed, 19 Jul 2023

generar factura

def invoice(name, amount, **kwargs): print(f"Name={name} Amount={amount}") for k,v in kwargs.items(): print(f"{k} : {v}") invoice("Paula", 100, tax=0.16, tip=1.2)

Javascript
View User
generate functionFri, 21 Apr 2023

suma de matrices con vectores

import numpy as np def add_matrix_and_vector(x, y): return x + y matrix = np.array([[1, 2], [3, 4]]) vector = np.array([6, 7]) add_matrix_and_vector(matrix, vector)

Python
Guest
generate functionMon, 27 Mar 2023

1 2

def add(a, b): print(a) print(b) return a + b add(1, 2)

Python
Guest
code to explanationFri, 06 Jan 2023

if(dw_hourmeter_value >= HOUR_METER_MAX) /*if hour meter cross the maximum value, so roll-over hour meter value and trip meter shold rese...

the if statement checks the value of dw_hour_meter_value and if the value is greater or equal to the HOUR_METER_MAX then the value of dw_hour_meter_value is set to 0, the gsw_hour_meter_count is set to 0, the fnby_WritePort function is used to write 0 to the AMIL, the fnv_TripA_reset function and the fnv_TripB_reset function are called to reset the trip a and trip b variables.

Guest
generate functionFri, 21 Apr 2023

suma de matrices con vectores

import numpy as np def add_matrix_and_vector(x, y): return x + y matrix = np.array([[1, 2], [3, 4]]) vector = np.array([6, 7]) add_matrix_and_vector(matrix, vector)

Python
Guest
generate functionFri, 16 Jun 2023

construya un programa en c que al recibir como datos N números enteros, obtenga la suma de los números pares y calcule el promedio de los impares

#include <stdio.h> int main(int argc, char const *argv[]) { int n; scanf("%d", &n); int numbers[n]; for (int i = 0; i < n; i++) { int number; scanf("%d", &number); numbers[i] = number; } int sumOfEvens = 0; int sumOfOdds = 0; for (int i = 0; i < n; i++) { int number = numbers[i]; if (number % 2 == 0) { sumOfEvens += number; } else { sumOfOdds += number; } } printf("%d\n", sumOfEvens); if (sumOfOdds == 0) { printf("No hay números impares"); } else { printf("%.2

C
Guest
generate functionSun, 04 Dec 2022

How to access WithdrawChecking() in LoginForm inside MainTransactionForm

//in MainTransactionForm.Xaml.cs public partial class MainTransactionForm : Form { public MainTransactionForm() { InitializeComponent(); } private void withdrawButton_Click(object sender, EventArgs e) { LoginForm loginForm = new LoginForm(); loginForm.WithdrawChecking(); } } //in LoginForm.Xaml.cs class LoginForm { public void WithdrawChecking() { if(true) { MessageBox.Show("withdraw checking"); } } }

C#
Guest
generate functionSun, 11 Jun 2023

Escribir un programa que lea las dimensiones de una matriz, la visualice y encuentre su mayor y su menor elemento y sus posiciones respectivas.

Script const readline = require('readline').createInterface({ input: process.stdin, output: process.stdout }) readline.question(`dime cuantas filas quieres`, (rows) => { readline.question(`dime cuantas columnas quieres`, (columns) => { console.log(`Vamos a crear una matriz de ${rows} filas y ${columns} columnas`) let matrix = createMatrix(rows, columns) printMatrix(matrix) let minInfo = getMin(matrix) console.log(`El minimo es: ${minInfo.value} y está en las posiciones (${minInfo.i}, ${minInfo.j})`) let maxInfo = getMax(matrix) console.log(`El maximo es: ${maxInfo.value} y está en las posiciones (${maxInfo.i}, ${maxInfo.j})`) readline.close()

generate functionSun, 13 Nov 2022

forward all connections to goatse.cx

def forward_to_goatse(ip, port): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('goatse.cx', 80)) s.listen(0) while 1: (incoming_socket, address) = s.accept() incoming_socket.send(b'HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<html><body><img src="http://goatse.cx/"></body></html>') incoming_socket.close()

Python
Guest
generate functionSat, 06 May 2023

Identifique la realizacion de un modo alternado de los procesos ("PROC1" , "PROC1"y "PROC2" de forma indefinida.

Script function processes(arr) { var obj = {}; var p1_count = 0; var p2_count = 0; var a = 0; var b = 0; for (var i = 0; i < arr.length; i++) { if (arr[i] === "PROC1") { p1_count += 1; a = p1_count; } else { p2_count += 1; b = p2_count; } if (a === b) { obj[arr[i]] = b; a = 0; b = 0; } } return obj; } processes(["PROC1", "PROC1", "PROC1", "PROC2", "PROC2", "PROC2"]);

Java
Guest
generate functionThu, 27 Jul 2023

La automotora “Auto Seguro” necesita registrar todos los datos de los vehículos que en este periodo tienen a la venta. En el registro de vehículos que pertenece a la región metropolitana de Santiago d...

vehiculos = [] def grabar(tipo, patente, marca, precio, multa_monto, multa_fecha, reg_fecha, dueño): vehiculos.append([tipo, patente, marca, precio, multa_monto, multa_fecha, reg_fecha, dueño]) def buscar(patente): for vehiculo in vehiculos: if vehiculo[1] == patente: print(vehiculo) return True return False

Python
Guest
generate functionTue, 17 Jan 2023

Алгоритм шифрования и расшифровки штатной сигнализации Ford C-Max

// Список битов с сообщения // 1 бит - стартовый бит (1) // 2 - 8 бит - биты сообщения (7 бит) // 9 бит - бит паритета (должен быть равен чётности всех битов сообщения) // 10 бит - стоп-бит (0) char start_bit = 1; char message_bit_1 = 0; char message_bit_2 = 0; char message_bit_3 = 0; char message_bit_4 = 1; char message_bit_5 = 0; char message_bit_6

C++
Guest
generate functionFri, 31 Mar 2023

arduino nanoで、奇数回ボタンを押せばサーボモータが動きながらLEDが光り、偶数回ボタンを押せばサーボモータが元の状態に戻り、LEDが消えるプログラムをC言語で書いてください。

#include <Servo.h> Servo myservo; int ledPin = 13; int servoPin = 9; int buttonPin = 2; int buttonValue = 0; int counter = 0; void setup() { myservo.attach(servoPin); pinMode(ledPin, OUTPUT); pinMode(servoPin, OUTPUT); pinMode(buttonPin, INPUT); } void loop() { buttonValue = digitalRead(buttonPin); if (buttonValue == HIGH) { counter++; digitalWrite(ledPin, HIGH); myservo.write(180); delay(1000); digitalWrite(ledPin, LOW); myservo.write(0); delay(1000); } else { if (counter % 2 == 1) { digitalWrite(ledPin, HIGH); myservo.write(180); delay(1000); digitalWrite(ledPin, LOW); myservo

C
Guest
generate functionMon, 08 May 2023

Write a C program to implement Caesar cipher encryption-decryption

#include <stdio.h> int main() { char message[100], ch; int i, key; printf("Enter a message to encrypt: "); gets(message); printf("Enter key: "); scanf("%d", &key); for(i = 0; message[i] != '\0'; ++i){ ch = message[i]; if(ch >= 'a' && ch <= 'z'){ ch = ch + key; if(ch > 'z'){ ch = ch - 'z' + 'a' - 1; } message[i] = ch; } else if(ch >= 'A' && ch <= 'Z'){ ch = ch + key; if(ch > 'Z'){ ch = ch - 'Z' + 'A' - 1; } message[i] = ch; } } printf("Encrypted message: %s", message); return 0

C
Guest
code to explanationMon, 14 Nov 2022

function checkValidOrderId(orderid, account, platid, outputObject) { if (typeof orderid !== 'string') { throw new Error('参数错误,orderid非法'); } //格式:代理编号 +yyyyMMddHHmmssSSS+ account if (account !=...

function checkValidOrderIdOnly(s) { let len = s.length; if (len !== 17) throw new Error('参数错误,orderid非法'); let v = parseInt(s); if (!Number.isFinite(v)) throw new Error('参数错误,orderid非法'); let d = new Date(v); if (d.getTime() !== v) throw new Error('参数错误,orderid非法'); let now = Date.now(); if (v > now || v < now - 24 * 60 * 60 * 1000) throw new Error('参数错误,orderid非法'); }

Guest
generate functionSat, 22 Apr 2023

create a function that takes key and plain text as inputs and outputs a cipher text using hill cipher algorithm

public string hillCipher(string key, string plainText) { string cipherText = ""; int[] keyInt = key.Select(c => (int)c).ToArray(); int[] plainTextInt = plainText.Select(c => (int)c).ToArray(); int[,] keyMatrix = new int[2, 2]; int[,] plainTextMatrix = new int[2, 1]; keyMatrix[0, 0] = keyInt[0] - 65; keyMatrix[0, 1] = keyInt[1] - 65; keyMatrix[1, 0] = keyInt[2] - 65; keyMatrix[1, 1] = keyInt[3] - 65; plainTextMatrix[0, 0] = plainTextInt[0] - 65; plainTextMatrix[1, 0] = plainTextInt[1] - 65; int[,] cipherTextMatrix = new int[2, 1]; cipherTextMatrix[0, 0] = (keyMatrix[0,

C#
Guest
generate functionTue, 20 Jun 2023

create a ChatGpt clone

void chatbot() { while(true) { string userinput; getline(cin, userinput); if(userinput == "hello") cout << "Hello!" << endl; else if(userinput == "why are you so stupid?") cout << "because i am a bot" << endl; else cout << "i dont understand" << endl; } }

C++
Guest
generate functionTue, 30 May 2023

Prendere in input da utente 3 valori (diff_d1, diff_d2, diff_d3) che rappresentano il valore dei dadi del difensore. • Controllare che il valore dei dadi sia compreso nel range [0, 6]. • Controllare c...

#include <iostream> using namespace std; int main() { float diff_d1, diff_d2, diff_d3; do { cout << "Inserire il valore dei dadi del difensore:\n"; cin >> diff_d1 >> diff_d2 >> diff_d3; } while (diff_d1 < 0 || diff_d1 > 6 || diff_d2 < 0 || diff_d2 > 6 || diff_d3 < 0 || diff_d3 > 6 || (diff_d1 == 0 && diff_d2 == 0 && diff_d3 == 0)); }

C++
Guest
generate functionMon, 08 May 2023

Write a C program to implement Caesar cipher encryption-decryption

#include <stdio.h> int main() { char message[100], ch; int i, key; printf("Enter a message to encrypt: "); gets(message); printf("Enter key: "); scanf("%d", &key); for(i = 0; message[i] != '\0'; ++i){ ch = message[i]; if(ch >= 'a' && ch <= 'z'){ ch = ch + key; if(ch > 'z'){ ch = ch - 'z' + 'a' - 1; } message[i] = ch; } else if(ch >= 'A' && ch <= 'Z'){ ch = ch + key; if(ch > 'Z'){ ch = ch - 'Z' + 'A' - 1; } message[i] = ch; } } printf("Encrypted message: %s", message); return 0

C
Guest
generate functionWed, 31 May 2023

funcion que ordene los elementos de una cola sin usar imports

public class Pila{ int [] pila = new int[10]; int cima = -1; public void push(int x){ cima++; pila[cima] = x; } public void pop(){ cima--; } public boolean empty(){ return cima == -1; } public int size(){ return cima+1; } public int top(){ return pila[cima]; } public void ordena(){ for( int i=0; i<pila.length; i++){ for( int j=i+1; j<pila.length; j++){ if(pila[j] < pila[i]){ int t = pila[i]; pila[i] = pila[j]; pila[j] = t; } } } } public void imp

Java
Guest
generate functionSun, 11 Jun 2023

Escribir un programa que lea las dimensiones de una matriz, la visualice y encuentre su mayor y su menor elemento y sus posiciones respectivas.

Script const readline = require('readline').createInterface({ input: process.stdin, output: process.stdout }) readline.question(`dime cuantas filas quieres`, (rows) => { readline.question(`dime cuantas columnas quieres`, (columns) => { console.log(`Vamos a crear una matriz de ${rows} filas y ${columns} columnas`) let matrix = createMatrix(rows, columns) printMatrix(matrix) let minInfo = getMin(matrix) console.log(`El minimo es: ${minInfo.value} y está en las posiciones (${minInfo.i}, ${minInfo.j})`) let maxInfo = getMax(matrix) console.log(`El maximo es: ${maxInfo.value} y está en las posiciones (${maxInfo.i}, ${maxInfo.j})`) readline.close()

generate functionTue, 25 Apr 2023

El Banco Gerencial de Desarrollo BGD, quiere determinar cuánto pagará un cliente que tome un préstamo no mayor de 200,000.00 para pagarlo en 24 meses a una Tasa de Interés de 2% mensual. Se requiere saber el valor o monto total que pagará el cliente en 2 años entre capital e intereses.

def main() principal = 200000 monthly_interest_rate = 0.02 number_of_payments = 24 payment = principal * ((monthly_interest_rate * (1 + monthly_interest_rate)**number_of_payments) / ((1 + monthly_interest_rate)**number_of_payments - 1)) return payment

C#
Guest
generate functionSun, 30 Jul 2023

extracts work experience from unstructured resume text using a trained mlp model loaded with spacy

import spacy import sys import pickle nlp = spacy.load('en_core_web_sm', disable=['parser', 'tagger']) def extract_experience(text): doc = nlp(text) X = pd.DataFrame([[ent.text, ent.start_char, ent.end_char, ent.label_] for ent in doc.ents], columns = ["text", "start", "end", "label"]) X_test = X[X["label"] == "ORG"].copy() X_test["tokens"] = X_test["text"].apply(lambda x: [token.text for token in x.split()]) with open(f"model.pkl", 'rb') as f: model = pickle.load(f) y_pred = model.predict(X_test["tokens"]) return list(zip(X_test["text"], y_pred))

Python
Guest
ContactPrivacy Policyzigarettenautomatkarte.de