import mysql.connector
conecction = mysql.connector.connect(host = '192.168.0.20', user = 'root', password = 'admin', database = 'FeedLot')
cursor = conecction.cursor()
def menu():
print("***************************************")
print("* 1. Archivo: *")
print("* 2. Reporte: *")
print("* 3. Consulta: *")
print("* 4. Salir: *")
print("***************************************")
def submenu():
print("***************************************")
print("* 1. Reporte semanal: *")
print("* 2. Reporte mensual: *")
print("* 3. Reporte anual: *")
print("* 4. Salir: *")
print("***************************************")
def crearReporte():
print("***************************************")
print("* 1. Reporte semanal: *")
print("
function sumaCubos(n) {
if (n > 0) {
return n * n * n + sumaCubos(n - 1);
} else {
return 0;
}
}
sumaCubos(3);
func plot(data: [(a: String, b: Double, c: Double, d: Double)]) {
let data = data.map { ($0.a, $0.b, $0.c, $0.d) }
let data2 = data.map { ($0.a, $0.b, $0.c, $0.d) }
let data3
public class Movimiento
{
public bool MovimientoBasico(int[] posicion, int[] destino)
{
if ( destino == posicion )
{
return false;
}
else if ( destino[0] >= posicion[0] )
{
posicion[0] ++;
}
else if ( destino[0] <= posicion[0] )
{
posicion[0] --;
}
else if ( destino[1] >= posicion[1] )
{
posicion[1] ++;
}
else if ( destino[1] <= posicion[1] )
{
posicion[1] --;
}
else
{
return false;
}
return true;
}
}
int a, b;
Console.WriteLine("Dame dos numeros para dividirlos");
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
Console.WriteLine("El resultado de la división entera es {0}", DivEntera(a, b));
Console.WriteLine("El resultado de la división decimal es {0}", DivDecimal(a, b));
int DivEntera(int a, int b)
{
return a / b;
}
double DivDecimal(int a, int b)
{
return (double) a/b;
}
var name = "Mauricio"
var age = 30
var isDeveloper = true
var birthDate = new Date(1990, 7, 17)
var list = [name, age, isDeveloper, birthDate]
console.log(list)
def backtest_aapl(window):
b = backtesting.Backtest(aapl['Close'], aapl['Close'].rolling(window).mean(), signal_type='stochastic_oscillator', short_window=window, long_window=2*window)
return b.signal
def find_max_square(arr):
max_square = 0
pos = 0
for i, x in enumerate(arr):
if x ** 2 > max_square:
max_square = x ** 2
pos = i
return pos, max_square
Python
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,
int a, b;
Console.WriteLine("Dame dos numeros para dividirlos");
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
Console.WriteLine("El resultado de la división entera es {0}", DivEntera(a, b));
Console.WriteLine("El resultado de la división decimal es {0}", DivDecimal(a, b));
int DivEntera(int a, int b)
{
return a / b;
}
double DivDecimal(int a, int b)
{
return (double) a/b;
}
public class Ejercicio02 {
public static void main(String[] args) {
int[] numeros = new int[20];
int suma = 0;
int media;
System.out.println("Array original:");
for (int i = 0; i < 20; i++) {
numeros[i] = (int)(Math.random() * 401);
System.out.print(numeros[i] + " ");
suma += numeros[i];
}
System.out.println("\n\nArray modificado:");
media = suma / 20;
for (int i = 0; i < 20; i++) {
if (numeros[i] < media) {
numeros[i] = numeros[i] * -1;
}
System.out.print(numeros[i] + " ");
}
}
}
def reparto(monto):
carolina = 0.8*0.35*monto
diana = 0.35*monto
alfredo = 0.23*(diana + 0.25*monto)
cindy = 0.25*monto
pablo = monto - carolina - diana - alfredo - cindy
return carolina, diana, alfredo, cindy, pablo
reparto(1000)
docstringFri, 10 Feb 2023 def add(a, b):
"""Returns the sum of a and b."""
return a + b
#include <stdio.h>
#include <pthread.h>
void *thread_func(void *arg) {
printf("New thread created\n");
return NULL;
}
int main() {
pthread_t tid;
pthread_create(&tid, NULL, thread_func, NULL);
pthread_join(tid, NULL);
return 0;
}
categories.of.variable <- function(x){
return(length(levels(x)))
}
public class Movimiento
{
public bool MovimientoBasico(int[] posicion, int[] destino)
{
if ( destino == posicion )
{
return false;
}
else if ( destino[0] >= posicion[0] )
{
posicion[0] ++;
}
else if ( destino[0] <= posicion[0] )
{
posicion[0] --;
}
else if ( destino[1] >= posicion[1] )
{
posicion[1] ++;
}
else if ( destino[1] <= posicion[1] )
{
posicion[1] --;
}
else
{
return false;
}
return true;
}
}
def even(x):
if x == 1 or x == 0:
return False
else:
return even(x - 2)
even(3)
public static void addToLast(int[] a, int b) {
int count = a.length + 1; // 要素数が変わるので、別途 count 変数を用意する
int[] newArray = new int[count];
for (int i = 0; i < a.length; i++) {
newArray[i] = a[i];
}
newArray[count - 1] = b;
for (int i : newArray) {
System.out.print(i);
}
}
int[] arr = {1, 2, 3, 4, 5};
addToLast(arr, 6);
System.out.println(arr);
function palindrome_check($string){
if (strrev($string) == $string){
echo "The string is a palindrome";
} else {
echo "The string isn't a palindrome";
}
}
palindrome_check("madam");
int a, b;
Console.WriteLine("Dame dos numeros para dividirlos");
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
Console.WriteLine("El resultado de la división entera es {0}", DivEntera(a, b));
Console.WriteLine("El resultado de la división decimal es {0}", DivDecimal(a, b));
int DivEntera(int a, int b)
{
return a / b;
}
double DivDecimal(int a, int b)
{
return (double) a/b;
}
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
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"]);
1: Create table clientes (
id int not null primary key,
name varchar(255) not null,
email varchar(255) not null,
password varchar(255) not null)
2: Create table admin (
id int not null primary key,
name varchar(255) not null,
email varchar(255) not null,
password varchar(255) not null)
categories.of.variable <- function(x){
return(length(levels(x)))
}
import unittest
class TestCadena(unittest.TestCase):
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_isupper(self):
self.assertTrue('FOO'.isupper())
self.assertFalse('Foo'.isupper())
def test_split(self):
s = 'hello world'
self.assertEqual(s.split(), ['hello', 'world'])
# check that s.split fails when the separator is not a string
with self.assertRaises(TypeError):
s.split(2)
if __name__ == '__main__':
unittest.main()
Future<void> signUp(String email, String password) async {
var result = await _cognitoUserPool.signUp(email, password, [
AttributeArg(name: 'email', value: email),
AttributeArg(name: 'name', value: 'minh'),
AttributeArg(name: 'phone_number', value: '0932919800'),
AttributeArg(name: 'gender', value: 'male'),
]);
print('signUp result: $result');
}
func plot(data: [(a: String, b: Double, c: Double, d: Double)]) {
let data = data.map { ($0.a, $0.b, $0.c, $0.d) }
let data2 = data.map { ($0.a, $0.b, $0.c, $0.d) }
let data3
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.
function Add(a, b) {
console.log(a + b)
}
Add(1, 2)
def reparto(monto):
carolina = 0.8*0.35*monto
diana = 0.35*monto
alfredo = 0.23*(diana + 0.25*monto)
cindy = 0.25*monto
pablo = monto - carolina - diana - alfredo - cindy
return carolina, diana, alfredo, cindy, pablo
reparto(1000)
function aumento(n){
var i = 0;
do{
n += 5;
i += 1;
}while(i<8)
return n;
}
aumento(5)
def agregar_verdura(lista, verdura):
if verdura not in lista:
lista.append(verdura)
return "{} agregada exitosamente".format(verdura)
else:
return "La verdura ya está en la lista"
verduras = ['lechuga', 'cebolla']
agregar_verdura(verduras, 'tomate')
fix invalid codeSat, 20 May 2023 @media (prefers-reduced-motion: no-preference) {
* {
scroll-behavior: smooth;
}
}
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
float hipotenusa;
float cateto1,cateto2;
printf("Cateto 1: ");
scanf("%f",&cateto1);
printf("Cateto 2: ");
scanf("%f",&cateto2);
hipotenusa= sqrt(pow(cateto2,2)+pow(cateto1,2));
printf("La hipotenusa es: %f\n ",hipotenusa);
printf("El area es: %f\n",cateto1*cateto2/2);
return 0;
}
int add(int a, int b) {
return a + b;
}
// This is a "stub" file. It's a little start on your solution.
// It's not a complete solution though; you have to write some code.
// Package greeting should have a package comment that summarizes what it's about.
// https://golang.org/doc/effective_go.html#commentary
package greeting
// HelloWorld needs a comment documenting it as package does.
func HelloWorld() string {
return "Hello, World!"
}
b <- c(1,1,1,1,1,1,1,0,0,0,0,0,0,0)
while (mean(b) > 0.40) {
b[sample(which(b==1), 1)] <- 0
}
onsole
mango
$1.00
pera
$1.50
tomate
$0.75
using System;
using Classes;
namespace SevenWonders
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
import java.util.Scanner;
public class Empleado{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String nombre, cargo;
int id, horario, salario, numeroID;
boolean horarioTurno = false, identificacion = true;
System.out.println("Ingrese el número de empleados a registrar: ");
int numeroEmpleados = sc.nextInt();
for(int i=0; i < numeroEmpleados; i++){
if(numeroEmpleados <= 10){
System.out.println("Ingrese el nombre: ");
nombre = sc.nextLine();
System.out.println("Ingrese el cargo: ");
cargo = sc.nextLine();
System.out.println("Ingrese el número de identificación: ");
numeroID = sc.nextInt();
System.out.println("
/*
Tema: Presentacion de animal
Autor: @ricardoifc
*/
String[] frases = {
"Bienvenidos a mi presentación.",
"Hoy les voy a hablar de gatos",
"Los gatos son animales muy inteligentes."
};
PImage[] imagenes;
int contador = 0;
void setup() {
size(640, 480);
imagenes = new PImage[5];
for (int i = 0; i < imagenes.length; i++) {
String numero = str(i+1);
imagenes[i] = loadImage("gato" + numero + ".jpg");
}
}
void draw() {
background(0);
image(imagenes[contador], 0, 0);
textFont(createFont("Arial", 32));
fill(255);
text(frases[contador], 40, 40, 600, 400);
}
void mousePressed() {
def agregar_verdura(lista, verdura):
if verdura not in lista:
lista.append(verdura)
return "{} agregada exitosamente".format(verdura)
else:
return "La verdura ya está en la lista"
verduras = ['lechuga', 'cebolla']
agregar_verdura(verduras, 'tomate')
Future<void> signUp(String email, String password) async {
var result = await _cognitoUserPool.signUp(email, password, [
AttributeArg(name: 'email', value: email),
AttributeArg(name: 'name', value: 'minh'),
AttributeArg(name: 'phone_number', value: '0932919800'),
AttributeArg(name: 'gender', value: 'male'),
]);
print('signUp result: $result');
}
def age(name, age, address, phone, sex):
if age > 18:
print("Es mayor de edad")
else:
print("Es menor de edad")
if sex == "M":
print("Es hombre")
else:
print("Es mujer")
age("Maria", 26, "Calle 6", "123-4567", "F")
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
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
plt.axes(projection=ccrs.PlateCarree())
plt.contourf(lon, lat, temp_data[0, :, :], 60, transform = ccrs.PlateCarree())
plt.colorbar(orientation='horizontal', shrink = 0.8)
plt.show()
The query selects the minimum value of Fees from the table Course and renames it as Course_Fees.
#LMM
library(lme4)
m2 <- clm(categorical_FOD_FODs ~ 0 + Condition_FODs:Language_used_FODs - 1, random = ~1|subject, data = indvar_FODs)
summary(m2)
#LM
m2 <- clm(categorical_FOD_FODs ~ Condition_FODs:Language_used_FODs - 1, data = indvar_FODs)
summary(m2)
#post-hoc analysis
library(lsmeans)
contrast(m2, "pairwise", list(Condition_FODs = c("A", "B", "C", "D")))
library(emmeans)
emmeans(m2, pairwise~Condition_FODs, adjust = "bonferroni")
++
bool S1 = 0;
bool S2 = 0;
bool S3 = 0;
bool S4 = 0;
bool S5 = 0;
bool S6 = 0;
bool S7 = 0;
bool S8 = 0;
bool S9 = 0;
bool S10 = 0;
bool S11 = 0;
bool S12 = 0;
bool S13 = 0;
bool S14 = 0;
bool S15 = 0;
bool S16 = 0;
void setup() {
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
pinMode(S3, OUTPUT);
pinMode(S4, OUTPUT);
pinMode(S5, OUTPUT);
pinMode(S6, OUTPUT);
pinMode(S7, OUTPUT);
pinMode(S8, OUTPUT);
pinMode(S9, OUTPUT);
pinMode(S10, OUTPUT);
pinMode(S11, OUTPUT);
pinMode(S12
func round(input float64) float64 {
return math.Floor(input*1000) / 1000
}
onsole
mango
$1.00
pera
$1.50
tomate
$0.75
fun hola(name: String) {
println("Hola $name")
}
hola("Miguel")
int main(int argc, char** argv) {
// Create a file reader
cv::VideoCapture cap;
// Open the video file
cap.open(0);
// Create a window to display the video
cv::namedWindow("Video");
// Show the image in the window
cv::imshow("Video", video);
// Wait for the user to press a button
cv::waitKey(0);
}
void programar(a, z) {
if (a == z)
return a;
}
ALCULADORA DE PENTAGONO CON UN LADO
import math
def area(lado):
area = lado * lado * math.sqrt(25 + 10 * math.sqrt(5)) / 4
return area
area(2)
#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
Script
def push_notice(message):
for user in users:
user.receive_message(message)
push_notice('hello!')
onsole
mango
$1.00
pera
$1.50
tomate
$0.75
# -*- coding: utf-8 -*-
# Copyright (c) 2019, DigiThinkIT and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ProductDetector(Document):
pass
fun calculateInterest(plan: Int, price: Double): Double {
return when (plan) {
12 -> price * 1.12
24 -> price * 1.17
else -> price
}
}
def print_people(people_list):
for p in people_list:
print(p[0], p[1])
print_people(people)