text stringlengths 184 4.48M |
|---|
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddValueAndTimestampsToCurrencyTypesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::... |
package 双指针
/*
对双指针的理解:
left从左向右遍历,right从右向左遍历;
则对left来说,leftMax一定准确,rightMax不一定准确,因为区间(left, right)的值还没有遍历,
但是left的rightMax一定 >= right的rightMax,所以只要leftMax < rightMax时,
我们不关心left的rightMax是多少了,因为它肯定比leftMax大,我们可以直接计算出left的存水量leftMax - nums[left];
对right来说,rightMax一定准确,leftMax不一定准确,因为区间(left, right)的值还没有遍历,
但是right的... |
//
// PlayHistory.swift
// TenTunes
//
// Created by Lukas Tenbrink on 24.02.18.
// Copyright © 2018 ivorius. All rights reserved.
//
import Cocoa
extension Array {
mutating func removeAll(keepTrackOf index: inout Int, where remove: (Element) -> Bool) {
let realisticIndex = (0...count).clamp(index)
... |
package co.lepelaka.controller;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
impo... |
@extends('base.base')
@section('start')
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel c нуля</title>
<link href="https://unpkg.com/tailw... |
#ifndef DATABASE_H
#define DATABASE_H
// STL
#include <map>
// Local
#include "AbstractTableFactory.h"
#include "VirtualDatabase.h"
#include "CustomSaveLoadStrategy.h"
#include "MongoDbSaveLoadStrategy.h"
namespace core
{
namespace save_load
{
class CustomFileStrategy;
}
class Database: public VirtualDatabase
... |
const {
uploadFile,
getFileListPerBucket,
deleteFile,
getFileById,
} = require("../services/fileService");
const response = require("responsify-requests");
const { messages, status } = require("../constants/messages");
const { convertLocalFileToUrl } = require("../helpers/fileHelpers");
const uploadFileControl... |
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCandidateQuestionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cand... |
import React, { lazy, Suspense } from 'react';
import { Route, Routes } from 'react-router-dom';
import Container from './Container';
import HomeView from '../views/HomeView';
import SharedLayout from './SharedLayout';
const Tweets = lazy(() => import('../views/Tweets'));
export default function App() {
return (
... |
package data_structures.tuple.mutable;
import com.google.common.primitives.Longs;
import data_structures.tuple.iterators.TupleIteratorLong;
import org.apache.commons.lang3.ArrayUtils;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
public class Tup... |
import {createGlobalStyle} from "styled-components";
const globalStyles = createGlobalStyle`
body {
background: ${({theme}) => theme.body};
color: ${({theme}) => theme.text};
transition: background 0.2s ease-in, color 0.2s ease-in;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
bo... |
import React, { useState } from 'react';
import { View, Text, TextInput, TouchableOpacity, ActivityIndicator } from 'react-native';
import StarRating from 'react-native-star-rating-widget'
import styles from "./styles";
import { getDatabase, ref, push, set} from "firebase/database";
import Toast from '../../components/... |
"""
File of metrics computations
"""
import numpy as np
from scipy.signal import butter, filtfilt, find_peaks, fftconvolve
import sys
def sum_torques(joints_data, sim_fraction=1.0):
"""Compute sum of torques"""
nsteps = joints_data.shape[0]
nsteps_considered = round(nsteps * sim_fraction)
return np.s... |
"use client"
import {useQuery, useQueryClient} from "@tanstack/react-query";
import {fetchProjects} from "@/services/project-service";
import {DataTable} from "@/components/ui/data-table/data-table";
import {projectColumns} from "@/types/project-types";
import {ApiQueryParams, defaultApiQueryParams} from "@/types/reque... |
use anyhow::{anyhow, Context, Result};
use nand2tetris::jack::tokenizer::TokenIterator;
use nand2tetris::jack::xml_analyzer::XMLAnalyzer;
use std::fs::{self, File};
use std::io::{BufReader, BufWriter, Write};
use std::path::{Path, PathBuf};
const JACK_EXT: &str = ".jack";
const XML_EXT: &str = ".xml";
fn main() -> R... |
<%@page import="com.bus.booking.dto.Bus"%>
<%@page import="java.util.List"%>
<%@page import="com.bus.booking.dao.BusDataBase"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>BUS BOOKING</title>
</head>
<body>
<%
Str... |
import React, { useState, useEffect, useRef } from "react";
import { Link } from "react-router-dom";
import styles from "./Navbar.module.css";
import RegisterModal from "../RegisterModal/RegisterModal";
import LoginModal from "../LoginModal/LoginModal";
import StoryModal from "../StoryModal/StoryModal";
import { FontAw... |
import { injectable, inject } from 'tsyringe';
import { isBefore } from 'date-fns';
import AppError from '@shared/errors/AppError';
import IAppointmentsRepository from '@modules/appointments/repositories/IAppointmentsRepository';
import IUsersRepository from '@modules/users/repositories/IUsersRepository';
import ICr... |
import React, { useState } from 'react';
import './Cadastro.css';
import "react-datepicker/dist/react-datepicker.css";
import AlertComponent from '../template/Alert';
import { Form } from 'react-bootstrap';
import { Row, Col } from 'react-bootstrap';
import Modal from 'react-bootstrap/Modal';
import { BsFillCloudDownlo... |
import torch
import torch.nn.functional as F
import torchvision.transforms.functional as TF
import os
from runpy import run_path
from skimage import img_as_ubyte
from natsort import natsorted
from glob import glob
import cv2
from tqdm import tqdm
import argparse
from pdb import set_trace as stx
import numpy as np
pars... |
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Categoria } from '../core/model';
import { environment } from 'src/environments/environment';
export class CategoriaFiltro {
nome: string;
pagina = 0;
itensPorPagina = 5;
}
@Injectab... |
import pygame, sys, asyncio
from pygame.locals import *
import defs
import button
import menu
pygame.init()
p1 = defs.PLAYER
e1 = defs.ENEMY
pygame.time.set_timer(defs.MORE_SPEED, 1000)
#Collision Checker
def checkIfCollision(p1,e1):
if(p1.rect.colliderect(e1.rect)):
return True
#Score Counter ... |
package cleanups
import (
"context"
"github.com/docker/docker/internal/multierror"
)
type Composite struct {
cleanups []func(context.Context) error
}
// Add adds a cleanup to be called.
func (c *Composite) Add(f func(context.Context) error) {
c.cleanups = append(c.cleanups, f)
}
// Call calls all cleanups in r... |
import Head from 'next/head';
import type { GetStaticProps } from 'next';
import { TopChampionsByLane } from '@/components';
interface PageProps {
title: string;
description: string;
}
export const getStaticProps: GetStaticProps<PageProps> = async () => {
return {
props: {
title: 'LoL DataHub',
... |
import React, { ReactNode, createContext, useContext } from "react";
import { Theme, pageThemes } from "./themes";
interface ThemeContextProps {
theme: Theme;
}
const ThemeContext = createContext<ThemeContextProps | undefined>(undefined);
export const ThemeProvider: React.FC<{ page: string; children: ReactNode }> ... |
#ifndef FEUP_DA1_STATION_H
#define FEUP_DA1_STATION_H
#include <string>
/**
* @brief Represents a station
*/
class Station {
private:
/**
* @brief Station name
*/
std::string _name;
/**
* @brief Station district
*/
std::string _district;
/**
* @brief Station municipa... |
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/... |
import { Vector2D } from '../utils'
/**
* Check if a polygon and a point intersect
*
* Source: https://www.jeffreythompson.org/collision-detection/poly-point.php
*
* @param vertices polygon verticies
* @param px point x position
* @param py point y position
* @returns
*
* @example
* ```js
* import { polyPo... |
import tensorflow as tf
import numpy as np
from tensorflow import keras
xs = np.array([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float)
ys = np.array([-3.0, -1.0, 1.0, 3.0, 5.0, 7.0], dtype=float)
model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])
model.compile(optimizer='sgd', loss='mean_squared... |
// import logo from './logo.svg';
import "./App.css";
import React, { useState } from "react";
function App() {
const [value, setValue] = useState("");
const [results, setResults] = useState([]);
const fetchImages = () => {
fetch(
`https://api.unsplash.com/search/photos?client_id=mtmVjlZVowBLDttrAKdnfNw3H... |
pragma solidity 0.5.11;
contract Votacion {
address ine;
struct Votante {
bool votante_autorizado;
bool voto_emitido;
}
modifier onlyINE() {
require(ine == msg.sender, 'No tienes permiso para autorizar');
_;
}
bytes32[] candidatos;
mapping... |
import * as React from 'react';
import renderer, { act } from 'react-test-renderer';
import { ActivityIndicator, Platform } from 'react-native';
import { Input, Button } from 'react-native-elements';
import { KeyboardAvoidingContainer } from '@core/styled';
import { AUTH_TYPES } from '@core/models';
import { _Auth } fr... |
import { AnimatePresence, motion } from "framer-motion";
import { DateTime } from "luxon";
import { Header } from "./Header";
import { InlineLoader } from "~/components/InlineLoader";
import { isNil, isNull } from "shared/lib/identity";
import { locationToUrl } from "~/lib/maps";
import { ReloadButton } from "../compon... |
import numpy as np
from numpy import polyval
import matplotlib.pyplot as plt
import os
import pandas as pd
import math
from scipy import interpolate, signal
from tqdm import tqdm
from astropy.stats.sigma_clipping import sigma_clip
import itertools, json
from sklearn.metrics import mean_squared_error
from scipy.optimize... |
import React, {ReactNode} from 'react';
import {Link} from 'gatsby';
import {AnchorLink} from 'gatsby-plugin-anchor-links';
// import AnimatedLink from '@app/components/AnimatedLink';
import AnimatedUnderline from '@app/components/AnimatedUnderline';
type MenuItemsProps = {
href: string,
anchorLink: boolean,
ani... |
import {createSlice, PayloadAction} from '@reduxjs/toolkit';
import {signIn, signUp} from './actions';
export type UserState = {
token: string | null;
};
const initialState: UserState = {
token: null,
};
const slice = createSlice({
name: 'user',
initialState,
reducers: {},
extraReducers: builder => {
... |
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 5.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For ... |
//
// Copyright (C) University College London, 2007-2012, all rights reserved.
//
// This file is part of HemeLB and is provided to you under the terms of
// the GNU LGPL. Please see LICENSE in the top level directory for full
// details.
//
#ifndef HEMELB_UNITTESTS_LBTESTS_STREAMERTESTS_H
#define HEMELB_UNITTESTS_... |
import { useState } from 'react';
import './App.scss'
import Container from '@mui/material/Container'
import CircularProgress from '@mui/material/CircularProgress';
import PastLaunchesGrid from './past-launches-grid/PastLaunchesGrid';
import { LaunchModel } from './models/LaunchModel';
import SearchBox from './search-f... |
# Ingenio DevOps test
## Table of Contents
- [Table of Contents](#table-of-contents)
- [Summary](#summary)
- [Architecture](#architecture)
- [Infrastructure as Code](#infrastructure-as-code)
- [Kubernetes](#kubernetes)
- [Continuous Integration & Continuous Deployment](#continuous-integration--continuous... |
{% extends 'main.html' %} {% load static %} {% block content %}
<!--------------------------------------- mini navbar --------------------------------------->
<nav
class="mb-4 mx-auto flex flex-wrap items-center gap-2 items-center text-xs w-full max-w-[1350px]"
>
<a
href="{{request.META.HTTP_REFERER}}"
clas... |
import React, { Fragment, useState } from 'react'
import { SalesForm } from '../components/sales-form'
import SaleReview from '../components/sale-review'
import { useNavigate } from 'react-router-dom'
import {
Box,
Button,
Container,
Paper,
Step,
StepLabel,
Stepper,
Typography,
} from '@mui/material'
im... |
<div class="operations">
<div class="operations__filter">
<input
[(ngModel)]="searchTerm"
class="operations__filter-input"
type="text"
placeholder="Filtrar por Nome"
/>
</div>
<div class="operations__table">
<table>
<thead>
<tr>
<th class="operations__ta... |
## DESCRIPTION
## Modeling with linear functions and equations
## ENDDESCRIPTION
## KEYWORDS('linear modeling')
## DBsubject('Algebra')
## BookTitle('Algebra: Form and Function')
## DBchapter('Linear Functions')
## BookChapter('Linear functions, expressions, and equations')
## DBsection('Linear Modeling')
## BookS... |
/* Project Supermarkt - OOP & Software Ontwerp
* Klant.java
* Hidde Westerhof | i2A
* In samenwerking met:
* Rik de Boer
* Tjipke van der Heide
* Yannick Strobl
*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package supermarkt;
import java.util.ArrayList;
i... |
package com.cg.mm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.NoSuchElementException;
@RestController
@RequestMappi... |
import { Controller, Get, Post, Body, Patch, Param, Delete, Logger } from '@nestjs/common';
import { AlgorithmService } from './algorithm.service';
import { CreateAlgorithmDto } from './dto/create-algorithm.dto';
import { UpdateAlgorithmDto } from './dto/update-algorithm.dto';
import { ApiTags } from '@nestjs/swagger';... |
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:selaty/core/utils/styles.dart';
class SochialButton extends StatelessWidget {
const SochialButton({
super.key,
required this.text,
required this.color,
required this.icon,
});
fina... |
---
title: "getting started with MLJ"
---
## 1. loading package and data
```{julia}
import MLJ:evaluate
using MLJ,DataFrames
iris=load_iris()|>DataFrame
display(first(iris,10))
```
## 2. build DecisionTree model
```{julia}
y, X = unpack(iris, ==(:target); rng=123);
Tree = @load DecisionTreeCl... |
/**
* ref로 지정한 요소 외부를 클릭할 시 callback함수를 실행
*/
import { useEffect } from 'react';
function useOutsideClick(ref, callback) {
useEffect(() => {
const handleClick = (event) => {
if (ref.current && !ref.current.contains(event.target)) {
callback?.();
}
};
window.addEventListener('moused... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Design principles </title>
<style>
body
{
background-color: gray;
color: lightblue;
}
.collapsible
{
backg... |
/**
*Submitted for verification at Etherscan.io on 2018-11-06
*/
pragma solidity 0.6.12;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint... |
import { Add, ChevronRightOutlined, FilterListOutlined, Search, SearchOffOutlined } from "@mui/icons-material";
import { Button, Dialog, DialogActions, DialogContent, Divider, Grid, InputAdornment, Paper, TextField, ToggleButton, ToggleButtonGroup, Typography } from "@mui/material";
import { useMemo, useState } from "r... |
require 'rails_helper'
RSpec.describe AgentBuilder, type: :model do
subject(:agent_builder) { described_class.new(params) }
let(:account) { create(:account) }
let!(:current_user) { create(:user, account: account) }
let(:email) { 'test@example.com' }
let(:name) { 'Test User' }
let(:role) { 'agent' }
let(... |
import 'package:flutter/material.dart';
import 'package:job_app/src/components/styles/constants/images_string.dart';
import 'package:job_app/src/components/styles/constants/sizes.dart';
import 'package:job_app/src/components/widgets/custom_shape/header_container.dart';
import 'package:job_app/src/components/widgets/cus... |
import usePatients from "../../hooks/usePatients";
const Patient = ({patient} : any ) => {
const { name, appointmentDate, email, owner, symptom} = patient;
const { updatePatient, deletePatient } = usePatients();
const getTimeFormat = (originalFormat : string) => {
const formattedDate = new Date(o... |
import os
from .base_dataset import BaseDataset
from ltr.data.image_loader import default_image_loader
import torch
import random
from collections import OrderedDict
from ltr.admin.environment import env_settings
import numpy as np
import time
from ltr.dataset.COCO_tool import COCO
from lib.utils.lmdb_utils import deco... |
---
changelog:
- 2024-02-03, gpt-4-0125-preview, translated from English
date: 2024-02-03 19:06:49.371745-07:00
description: "Hur man g\xF6r: TypeScript, som \xE4r en ut\xF6kning av JavaScript,\
\ till\xE5ter olika metoder f\xF6r att g\xF6ra f\xF6rsta bokstaven i en str\xE4\
ng stor, allt fr\xE5n rena\u2026"
lastmo... |
from src.horn_knowledge_base import HornKnowledgeBase
from src.inference_algorithm import InferenceAlgorithm
from src.query import HornKnowledgeBaseQuery
from src.result.chaining_result import ChainingResult
from src.syntax.literal import PositiveLiteral
class BackwardChaining(InferenceAlgorithm):
def __init__(se... |
---
title: axios 手写
order: 30
group:
order: 1
title: js Basic
path: /interview/js
nav:
order: 3
title: 'interview'
path: /interview
---
简单手写版
```js
var dispatch = (config) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
// 模拟xhr 结果响应值
resolve('cpp', config);
}, 1000... |
import { useEffect, useState } from "react";
import { NavLink, useNavigate } from "react-router-dom";
import {
Card,
CardBody,
CardTitle,
CardText,
CardSubtitle,
Button,
NavItem,
FormGroup,
Label,
Input,
} from "reactstrap";
import { getWorkerProfiles } from "../../managers/userProfileManager";
//^... |
class GetProductsDataModel {
String? product_id;
String? name;
String? price;
String? description;
String? folder_name;
String? subcategory2_id;
String? subcategory2;
String? subcategory1_id;
String? subcategory1;
String? category_id;
String? category;
String? region_id;
String? region;
Stri... |
import { Public } from '@/auth/decorators/public.decorator';
import {
BadRequestException,
Body,
ConflictException,
Controller,
Post,
UsePipes,
} from '@nestjs/common';
import { NestCreateUserUseCase } from '../representations/use-cases/nest-create-user.use-case';
import { z } from 'zod';
import { ZodValida... |
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import {Comment, Icon, Button, Label} from 'semantic-ui-react';
import styles from './styles.module.scss';
const UserMesage = ({
userName,
imgSrc,
text,
id,
date,
canEdit,
like,
setLike,
onEdit,
deleteO... |
#pragma once
#include <QObject>
#include <QDateTime>
#include <QString>
#include <QList>
#ifdef QTDROPBOX_DEBUG
#include <QDebug>
#endif
#include "qdropbox2common.h"
//! Provides information and metadata about an entry in the Dropbox account
/*!
This class is a more specialized version of QDropboxJson. It provide... |
import React from 'react';
import './App.css';
import Navbar from './components/Navbar';
import { BrowserRouter as Router, Routes, Route} from 'react-router-dom';
import Home from './components/pages/Home';
import Services from './components/pages/Services';
import Marketing from './components/pages/Marketing';
import ... |
import React from "react";
interface IButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
children: React.ReactNode;
className?: string;
}
const Button = ({ children, className, ...rest }: IButtonProps) => {
return (
<button
className={`flex h-8 w-8 items-center justify-center border-d... |
package dailyquest.common
import java.time.DayOfWeek
import java.time.Duration
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.temporal.TemporalAdjuster
import java.time.temporal.TemporalAdjusters
private val firstDayOfYearAdjusters: TemporalAdjuster = TemporalAdjusters.firstDayOfYear()
pri... |
package com.testscripts.demoblaze;
import java.io.IOException;
import org.openqa.selenium.support.PageFactory;
import org.testng.Assert;
import org.testng.Reporter;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import com.genericlib.demoblaze.Base;
import com.genericlib.demoblaze.Event... |
/*
* Copyright 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... |
package com.bitio.productscomponent.domain.repository
import com.bitio.productscomponent.data.remote.request.CartItemBody
import com.bitio.productscomponent.data.remote.response.CartItemResponse
import com.bitio.productscomponent.data.remote.response.CartResponse
import com.bitio.productscomponent.data.remote.response... |
import numpy as np
class ARTNetwork:
def __init__(self, input_size, vigilance):
self.input_size = input_size
self.vigilance = vigilance
self.weights = np.zeros((input_size,1))
def train(self, input_data,epochs):
normalized_input = input_data / np.linalg.norm(input_data)
... |
import Navbar from "./Components/Shared/Navbar";
import Footer from "./Components/Shared/Footer";
import Home from "./Components/Home/Home";
import Presentation from "./Components/Presentation/Presentation"
import Project from "./Components/Project/Projects";
import Adhesions from "./Components/Adhesion/Adhesions";
imp... |
# 내 풀이 (정답) (45분 소요)
# 1. 각 학생 점수에서 평균 점수를 빼고 절대값 씌우기
# 2. |점수-평균| 가장 낮은 index만 추출해서, 그 index에 해당하는 실제 점수만 추출
# 3. 추출한 점수 모두 같을 때 -> 빠른 학생 번호 출력
# 4. 추출한 점수 다를 때
# 4-1. 높은 점수만 남겨서 빠른 학생 번호 출력
import sys
sys.stdin = open("input.txt", "r")
n = int(input())
scores = list(map(int, input().split()))
mean_score = int((su... |
---
date: 2022-10-01
title: Voice Chat
aliases:
- /docs/voice-chat
- /voice-chat
- /docs/voice-chat
- /decentraland/voice-chat
description: In-World Voice Chat
categories:
- Decentraland
type: Document
url: /player/general/in-world-features/voice-chat
---
### Accessing the chat
When you enter the world, the... |
package jpabook.jpashop.domain;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import static javax.persistence.FetchType.*;
@Entity
@Table(name = "ORDERS")
public class Order extends BaseEntity{
@Id @GeneratedValue
@Column(name = "ORDER_ID")
... |
from torchmetrics import Metric
from torchmetrics.image import PeakSignalNoiseRatio
from torchmetrics.image import StructuralSimilarityIndexMeasure
from torchmetrics.image.fid import FrechetInceptionDistance
import torchvision
import torch
import torch.nn.functional as F
class ZaloMetric(Metric):
def __init__(self... |
// rivet project
// Copyright (c) 2023 <https://github.com/yretenai/rivet>
// SPDX-License-Identifier: MPL-2.0
#pragma once
#include <ankerl/unordered_dense.h>
#include <cstdint>
#include <memory>
#include <string_view>
#include <unordered_set>
#include <utility>
#include <rivet/rivet_array.hpp>
#include <rivet/rive... |
fn main() {
// `n` will take the values: 1, 2, ..., 100 in each iteration
for n in 1..101 {
if n % 15 == 0 {
println!("fizzbuzz");
} else if n % 3 == 0 {
println!("fizz");
} else if n % 5 == 0 {
println!("buzz");
} else {
println!("{}", n);
}
}... |
// This file is part of the MDCII project.
//
// Copyright (c) 2022. stwe <https://github.com/stwe/MDCII>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License... |
/*
* Funambol is a mobile platform developed by Funambol, Inc.
* Copyright (C) 2003 - 2007 Funambol, Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by
* the Free Software Foundation with the addit... |
import { ApplicationRef, Injectable, inject } from '@angular/core';
@Injectable({
providedIn: 'root',
useFactory: () => inject(AnimationFrameTickScheduler),
})
export abstract class TickScheduler {
abstract schedule(): void;
}
@Injectable({
providedIn: 'root',
})
export class AnimationFrameTickScheduler exten... |
let hargaKamar = 0 ; // Variabel ini menyimpan harga kamar per malam.
let durasiMenginap = 0 ; // Variabel ini menyimpan durasi hari yang diinginkan untuk menginap.
let hargaBreakfast = 0; // Variabel ini menyimpan harga tambahan untuk sarapan per hari.
let isDiskon = false; // Varia... |
package com.ssafy.guestbook.controller;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Contr... |
#include <ctime>
#include <fstream>
#include <iostream>
#include "constants.hpp"
#include "group.hpp"
std::vector<Group> GroupForming(std::ifstream& ifs, int number) {
std::vector<Group> groups;
for (int i = 0; i < number; i += kSizeGroups) {
Group group;
std::string name;
int exp = 0;
int stam = ... |
import { Body, Controller, Get, Param, Post, Req, UseGuards } from '@nestjs/common';
import { CommentsService } from './comments.service';
import { ApiOperation, ApiResponse } from '@nestjs/swagger';
import { AuthGuard } from 'src/auth/auth-guard';
import { Comment } from './comments.model';
import { CreateCommentDto }... |
<script setup lang="ts">
import * as THREE from "three";
import { onBeforeUnmount, onMounted, ref } from "vue";
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
import { DRACOLoader } from "three/examples/jsm/loaders/DRACOL... |
---
title: python学习
date: 2024-02-08 12:11:12
tags: [python]
categories: 学习笔记
---
# python基础
## 1.字面量
>写在代码里固定的值
1. 数字
2. 字符串
3. 列表 (list)
>有序的可变序列
4. 元组(tuple)
>有序的不可变的python数据集合
5. 集合(set)
>无序不重复集合
6. 字典(dictionary)
>无序 key-value集合
```python
mylist=[1,2,3]
# 列表while进行循环
index =0
while index... |
/*
* Simple Timer Module
* Read & calculate elapsed time with 32-bit timestamps
* Note that the hardware_time module provides similar
* functions using 64-bit timestamps
*
* Caution: Rollover on 32-bit time measurementswill occur
* once every 2^32 microseconds (11.93 hours). We handle one
* rollover with the... |
@extends('admin.layouts.app')
@section('title',__('Empresas'))
@section('content')
<div class="row">
<div class="col-md-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">@yield('title')</h3>
<div class="box-tools pull-right">
... |
import {
AssetRelationship,
AssetTwin,
ADTPatch,
IAssetProperty
} from '../../Constants';
export class Asset {
public name: string;
public relationships: Array<AssetRelationship>;
public twins: Array<AssetTwin>;
public properties: Array<IAssetProperty<any>>;
public getDoubleValue =... |
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
<!--${} tells thymeleaf to look in model for value-->
<head th:replace="fragments :: head"></head>
<body class="container">
<h1 th:text="${title}"></h1>
<nav th:replace="fragments :: navigation"></nav>
<!--create form that will post da... |
package server
import (
"context"
"fmt"
"net/http"
"strings"
"time"
"github.com/google/uuid"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/pkg/errors"
echoSwagger "github.com/swaggo/echo-swagger"
apiv1 "github.com/usememos/memos/api/v1"
apiv2 "github.com/usememos/memo... |
import Foundation
class WeakBox {
weak var value: AnyObject?
var sourceInfo: SourceInfo
init(_ value: AnyObject, sourceInfo: SourceInfo) {
self.value = value
self.sourceInfo = sourceInfo
}
}
struct SourceInfo {
var file: String
var function: String
var line: Int
... |
/mob/living/simple_animal/mouse
name = "mouse"
real_name = "mouse"
desc = "It's a small, disease-ridden rodent."
icon_state = "mouse_gray"
icon_living = "mouse_gray"
icon_dead = "mouse_gray_dead"
speak = list("Squeek!","SQUEEK!","Squeek?")
speak_emote = list("squeeks","squeeks","squiks")
emote_hear = list("squ... |
/* Este es un componente de React llamado `LeftBar` que muestra un menú de navegación en la barra
lateral izquierda con varios enlaces e íconos. También incluye funcionalidad para un menú
desplegable, autenticación de usuario y un botón de cierre de sesión. El componente importa varios
íconos y módulos de bibliotecas e... |
/*
จงเขียนฟังก์ชันการตัดเกรดในแต่ละรายวิชาของนักเรียนจำนวน 3 คน โดยนักเรียนแต่ละคนจะมีข้อมูลดังต่อไปนี้
ชื่อ, นักศักศึกษา, คะแนนในวิชาที่ 1, คะแนนในวิชาที่ 2, คะแนนในวิชาที่ 3, คะแนนในวิชาที่ 4, คะแนนในวิชาที่ 5
แสดงได้ดังโครงสร้างข้อมูลต่อไปนี้
struct Student {
char Name[20] ;
char ID[... |
<script lang="ts">
// Interfaces
import type { IUserProfile } from '$lib/types';
// Utils
import { getUserInitials } from './utils';
// Props
/**
* @description User's account data
*/
export let userProfile: Omit<IUserProfile, 'display_name'>;
/**
* @description Avatar Size
*/
export let... |
import org.junit.Before;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.*;
import static org.junit.Assert.*;
public class ShortestPathFinderTest {
public Graph graph;
publi... |
import * as React from 'react';
import { styled, useTheme } from '@mui/material/styles';
import Box from '@mui/material/Box';
import Drawer from '@mui/material/Drawer';
import CssBaseline from '@mui/material/CssBaseline';
import MuiAppBar, { AppBarProps as MuiAppBarProps } from '@mui/material/AppBar';
import Toolbar fr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.