text stringlengths 27 775k |
|---|
use std::collections::HashMap;
pub fn can_reorder_doubled(arr: Vec<i32>) -> bool {
let mut table = HashMap::new();
arr.into_iter().for_each(|v| {
let entry = table.entry(v).or_insert(0);
*entry += 1
});
let mut keys = table.keys().cloned().collect::<Vec<_>>();
keys.sort_by(|a, b| m... |
class QueueModel {
String title, url, album, artist, id, lyrics;
QueueModel(
{this.title, this.url, this.album, this.artist, this.id, this.lyrics});
Map<String, dynamic> toMap() {
return {
'title': title,
'url': url,
'album': album,
'artist': artist,
'lyrics': lyrics,
... |
# frozen_string_literal: true
module PageObjects
module Support
class UserShow < PageObjects::Base
set_url "/support/users/{id}"
sections :provider_rows, PageObjects::Sections::Provider, ".qa-provider_row"
end
end
end
|
# pylint: disable=no-self-use
"""
Module that deals with all logic related to consent forms
"""
import os
import random
import traceback
import datetime
from flask import request
from flask import current_app
from flask_jwt_extended import jwt_required
from flask_restful import Resource
from api.endpoints.constants i... |
module Terrafile
class Dependency
def initialize(name:, source:, version:)
@name = name
@source = source
@version = version
end
attr_reader :name, :source, :version
def self.build_from_terrafile
(YAML.safe_load(File.read(TERRAFILE_PATH)) || []).map do |module_name, details|
... |
pluginManagement {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("de.fayard.refreshVersions") version "0.10.1"
id("com.gradle.enterprise") version "3.6.3"
}
rootProject.name = "sandbox"
includeBuild("../")
include(":node", ":browser", ":both", ":mpp")
|
require 'test_helper'
class Api::ProxyConfigsTest < ActionDispatch::IntegrationTest
def setup
@provider = FactoryBot.create(:provider_account)
login_provider @provider
host! @provider.admin_domain
end
def test_index
service = FactoryBot.create(:simple_service, account: @provider)
service... |
#!/bin/bash
# Runs the Hubot butler bot, using 'symphony' adapter
BUILD_FOLDER=./butler-build
BOT_NAME=$1
cd $BUILD_FOLDER
. ./env.sh
./bin/hubot -a symphony --name $BOT_NAME
|
#/bin/sh
#reveal-md slide_reveal.md -w
reveal-md slide.md --static .
|
<?php
namespace MonkeyLearn;
use MonkeyLearn\Config;
use MonkeyLearn\MonkeyLearnException;
class HandleErrors {
static function check_batch_limits($data, $batch_size) {
if ($batch_size > Config::MAX_BATCH_SIZE || $batch_size < Config::MIN_BATCH_SIZE) {
throw new MonkeyLearnException(
... |
import { Spin } from "antd";
import React, { useEffect } from "react";
import { useDispatch } from "react-redux";
import { useLocation, useParams } from "react-router";
import { FilterArea, ProductList } from "../../components";
import { MainLayout } from "../../layouts";
import { useSelector } from "../../redux/hooks"... |
package health
type HealthState string
// String representations of the canonical health states
var (
Critical = HealthState("critical")
Unknown = HealthState("unknown")
Warning = HealthState("warning")
Passing = HealthState("passing")
)
// Integer enum representations of the canonical health states. These ar... |
package com.coursework.velotracker.ViewModels
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.coursework.velotracker.BL.Model.Training.ParcelableTraining
class SharedViewModel(): ViewModel() {
var parcelableTraining:MutableLiveData<ParcelableTraining> = MutableLiveData<Par... |
module tensor_module
use, intrinsic :: iso_fortran_env, only : int64
use :: data_storage_module, only : data_storage
implicit none
private
public :: tensor
type, abstract :: tensor
class(data_storage), allocatable :: storage
integer :: datatype, rank
integer(int64) ::... |
package de.twometer.neko.util
import org.lwjgl.glfw.GLFW.glfwGetTime
class Timer(tps: Int) {
private val delay: Double = 1.0 / tps
private var lastReset = 0.0
private var lastFrame = 0.0
val tickProgress: Double
get() = 1.0 - ((lastReset + delay - glfwGetTime()) / delay)
val elapsed: Bo... |
require 'rails_helper'
RSpec.describe PaymentsController, type: :controller do
let(:c100_application) { instance_double(C100Application) }
let(:payment_intent) { instance_double(PaymentIntent) }
describe '#validate' do
before do
allow(controller).to receive(:current_c100_application).and_return(c100_a... |
use crate::boid::Boid;
use crate::math::Vector2D;
use crate::settings::Settings;
use gloo::timers::callback::Interval;
use yew::{html, Component, Context, Html, Properties};
pub const SIZE: Vector2D = Vector2D::new(1600.0, 1000.0);
#[derive(Debug)]
pub enum Msg {
Tick,
}
#[derive(Clone, Debug, PartialEq, Propert... |
#pragma once
/**
Utility header for header only cuda vector and cpu vector implementations
*/
#include <cstdio>
#include <cassert>
#include "TracerError.h"
#ifdef METU_CUDA
#include <cuda.h>
#include <cuda_runtime.h>
inline static constexpr void GPUAssert(cudaError_t code, const char *file, int line)
... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: wxnacy@gmail.com
"""
枚举
"""
from enum import Enum
__all__ = ['Action']
class Action(Enum):
STORE = 'store'
STORE_TRUE = 'store_true'
APPEND = 'append'
|
--CREATE TABLE Logs
--( LogId INT IDENTITY PRIMARY KEY,
-- AccountId INT NOT NULL REFERENCES Accounts(Id) ,
-- OldSum MONEY NOT NULL,
-- NewSum MONEY NOT NULL
--)
--CREATE TABLE LogsWithTime
--( LogId INT IDENTITY PRIMARY KEY,
-- AccountId INT NOT NULL REFERENCES Accounts(Id) ,
-- OldSum MONEY NOT NULL,
-- NewS... |
---
title: 관리 포털에 로그인할 때 관리할 계약이 표시되지 않음
description: 슈퍼 관리자 또는 관리자가 관리 포털에 로그인했지만 계약이 표시되지 않음
ms.topic: include
ms.assetid: e276637d-8a22-4bb2-a574-7ba9442b92f0
author: CaityBuschlen
ms.author: cabuschl
ms.date: 06/02/2021
user.type: admin
tags: agreement
subscription.type: vl, cloud, retail, partner
sap.id: 17a2bf94-... |
import tkinter as tk
import tkinter.font
import tkinter.scrolledtext as tkscroledtext
from functools import partial
from uuid import uuid4
def create_frames(root):
frames = {
'config': tk.LabelFrame(root, name='config', text='Configuration'),
'options': tk.LabelFrame(root, name='options', text='Op... |
let baseStr = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/';
let valCharMap = {}
let charValMap = {}
baseStr.split('').forEach((item, idx) =>{
valCharMap[idx] = item
charValMap[item] = idx
})
function decimalToNScale(n) {
if(n > 64) {
throw new RangeError('不支持64以上进制');
}
return (n... |
# TODO-List-Day-66
This a todo list made by using only HTML, CSS, and JavaScript.
|
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| ... |
import os
from hashkernel.bakery import CakeRole
from hashstore.bakery.lite import dal
from hashstore.bakery.lite.node import (
ServerConfigBase, GlueBase, CakeShardBase, User, UserType,
UserState, Permission, Portal, ServerKey, PermissionType as PT)
from hashstore.bakery.lite.node.blobs import BlobStore
from... |
package at.hannesmoser.gleam.transforms.generator
import io.github.serpro69.kfaker.Faker
import org.apache.beam.sdk.schemas.Schema
import org.apache.beam.sdk.schemas.Schema.FieldType
import org.apache.beam.sdk.schemas.logicaltypes.EnumerationType
import org.apache.beam.sdk.values.Row
import org.joda.time.Instant
inte... |
{-# LANGUAGE OverloadedStrings #-}
module Raindrops (convert) where
import Data.Maybe (fromMaybe)
import qualified Data.Text as T
import Data.Text (Text)
convert :: Int -> Text
convert n = fromMaybe (T.pack $ show n) $
sound "Pling" 3 <>
sound "Plang" 5 <>
sound "Plong" 7
where
sound ... |
import { MouseEvent, useEffect, useState } from 'react'
import HeroCard from './HeroCard'
const Hero = ({ episodes: initialEpisodes }: { episodes: TEpisode[] }) => {
// Only render episodes with title and cover image
const episodes = initialEpisodes.filter(
(episode) =>
episode.title &&
(episode.ur... |
<?php
namespace Application\Model\Admin\Question;
class Table extends \System\Libraries\Table
{
public function __construct()
{
parent::__construct();
$this->columns = array('<input type="checkbox" />', 'No.', 'Nội dung câu hỏi', 'Loại câu hỏi', 'Điểm');
//$this->
}
protected function Source()
{
$data = ... |
import objectframework.models.ObjectContexts
import org.json4s.jackson.JsonMethods._
import phoenix.failures.AddressFailures.NoCountryFound
import phoenix.models.cord.lineitems._
import phoenix.models.location.Addresses
import phoenix.models.product.{Mvp, SimpleContext}
import phoenix.models.rules.QueryStatement
import... |
#!/bin/sh
echo "Cleaning Up..."
aws sesv2 delete-contact --contact-list-name ExampleContactListName --email-address dave@davelemons.com
aws sesv2 delete-contact-list --contact-list-name ExampleContactListName
echo "Done!" |
#!/bin/bash
# author: yonglong.wyl
# date: 2021/06/09
!<<EOF
#简单实例
echo "input website:"
read website #没带任何参数,默认一直等待用户输入
echo "your website is: ${website}"
exit 0 #退出当前的Shell 进程,0:执行成功,n(n>0): 其他值代表执行失败
# 执行exit可以使shell以指定的状态值退出
# exit 也可以用在script,离开正在执行的script,回到shell
EOF
!<<EOF
# 演示 -p 参数
read -p "输入网址名:" website
... |
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#include <AP_HAL/AP_HAL.h>
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
#include "AnalogIn.h"
#include <drivers/drv_adc.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <nuttx/analo... |
#include <value.h>
#include <vm.h>
#include <gc.h>
#include "lib.h"
static VAL BinaryUtils;
static VAL BinaryUtils_readU64(js_vm_t* vm, void* state, VAL this, uint32_t argc, VAL* argv)
{
VAL buff;
uint32_t offset;
js_scan_args(vm, argc, argv, "SI", &buff, &offset);
js_string_t* str = &js_value_get_poi... |
export default {
statics: {
background: require("./assets/elements.png"),
logo: require("./assets/logo.png"),
buttonPlay: require("./assets/play.png"),
buttonHighscore: require("./assets/highscore.png"),
buttonInstructions: require("./assets/intructions.png"),
backgro... |
package org.ml4j.gpt3.prompt.processors;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.ml4j.gpt3.GPT3Request;
public class DefaultPromptFileProcessor ... |
package com.wsinz.network.items
import com.wsinz.network.base.BaseResponse
import com.wsinz.network.items.modelresponse.UserItemsResponse
import io.reactivex.Single
interface ItemsListFeedApi {
fun getUserItems(authToken: String): Single<UserItemsResponse>
fun deleteItem(authToken: String, itemToken: String... |
## 操作系统OS
Windows or Linux or Mac
## 应用版本
在设置里有显示当前版本号,如果没有版本号,说明该版本<=1.1.4,请先下载最新版本尝试后再发起issue,并填下版本号
## 问题描述
问题复现流程,操作截图等,建议把刚点开连接时展示的Redis Info信息页截图,方便查看Redis概况
|
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Shashlik.Kernel;
using Shashlik.Kernel.Attributes;
// ReSharper disable CheckNamespace
namespace Sbt.Invoice.Service
{
[ConditionOnProperty(typeof(bool), "Ji... |
#!/bin/bash
shopt -s expand_aliases
export WEBDIR=/var/www/html
export MYSQLDIR=/var/www/mysql
alias msql="mysql -uroot -p\"$MYSQL_ROOT_PASSWORD\" -e"
alias wpc="su www-data -s /bin/bash -c"
SQLHEADER=$(cat <<EOF
-- MySQL dump 10.13 Distrib 5.5.52, for debian-linux-gnu (i686)
--
-- Host: localhost Database: xc218... |
<?php namespace Stevenmaguire\Services\Trello\Exceptions;
use Exception as BaseException;
class Exception extends BaseException
{
/**
* Response body
*
* @var object
*/
protected $responseBody;
/**
* Retrieves the response body property of exception.
*
* @return object
... |
#!/bin/sh
export GVAR="Global Var"
LVAR="Local Var"
echo $GVAR
echo $LVAR
echo $VAR1
echo $VAR2
echo "done."
|
const assert = require('assert')
const { Node, LinkedList} = require('../merge-linked/linked-list')
const { removenth } = require('./remove')
if (require.main === module) {
let n1 = new Node(1)
let n2 = new Node(2)
let n3 = new Node(3)
let n4 = new Node(4)
let n5 = new Node(5)
n1.next = n2
... |
module GA (
initialPopulation,
ga,
nextGen
) where
import GABase
import Random
import Selection
import Cross
import Mutation
import Replace
type NextGenerationFunctionGenerator =
SelectionMethod ->
Int ->
CrossMethod ->
Double ->
MutateMethod ->
Double ->
ReplaceMethod ->
SelectionMethod ->
... |
package org.nms.anxova.string.process;
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.nms.anxova.process.beans.BaseElement;
import org.nms.anxova.process.beans.IElement;
import org.nms.anxova.string.process.impl.StringExtract... |
---
layout: post
title: "AI Inside"
posturl: http://www.commitstrip.com/en/2017/06/07/ai-inside/
tags:
- Comics
- Fun
---
{% include post_info_header.md %}
"I knew it. It's just 'IFs'"
<!--more-->
{% include post_info_footer.md %}
|
using System;
using System.Runtime.InteropServices;
namespace AtenSharp.Raw {
// High-performance linear algebra operations.
internal static class Lapack {
// Solve AX=B
//
// Corresponds to the following TH definition:
//
// TH_API void THLapack_(gesv)(
// ... |
(in-package :bknr-user)
(define-persistent-class question ()
((name :read
:index-type string-unique-index
:index-reader question-with-name
:index-values all-questions)
(quizz :read :initform nil
:index-type hash-index
:index-reader quizz-questions)
(question :update)
(answers :update :initf... |
#!/bin/bash
rm -r consul
rm nohup.out
mkdir consul
print_help() {
cat <<EOF
Usage:cmd bind_ip
example:
./consul_agent.sh 192.168.1.123
EOF
}
main() {
if [ $# -lt 1 ]; then
print_help
return
fi
bind_ip=$1
nohup consul agent -server -ui -bootstrap-expect=1 -node=s1 -bind=${bind_ip}... |
import { createComponent } from '../../utils'
const labelClassModifiers = {
small: 'label-sm',
large: 'label-lg',
inline: 'form-inline',
}
const Label = createComponent('label', 'form-label', labelClassModifiers)
export default Label
|
#ifdef CH_LANG_CC
/*
* _______ __
* / ___/ / ___ __ _ / / ___
* / /__/ _ \/ _ \/ V \/ _ \/ _ \
* \___/_//_/\___/_/_/_/_.__/\___/
* Please refer to Copyright.txt, in Chombo's root directory.
*/
#endif
#include <cmath>
#include <cstdio>
#include <iostream>
#include "ParmParse.... |
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Examen;
use Carbon\Carbon;
class ExamenController extends Controller{
public function index(){
$datosExamen = Examen::all();
return response()->json($datosExamen);
}
public function guardar(Request $request){
$datosExamen = new E... |
$(document).ready(function() {
$('.delete_form').on('beforeSubmit', function() {
return confirm('Подтвердите удаление');
});
$('.uploadFileForm').on('beforeSubmit', function() {
$(this).find('.submitButton').replaceWith('<span>Идет загрузка...</span>');
});
$('#multipleDe... |
package hartman.websub.publisher.atom
import org.springframework.data.annotation.Id
import java.time.ZonedDateTime
data class AtomLink(val rel: String, val href: String)
data class AtomEntry(
val id: String,
val title: String,
val updated: ZonedDateTime,
val author: String?,
v... |
using Newtonsoft.Json;
namespace commercetools.Zones
{
/// <summary>
/// A geographical location representing a country with an optional state.
/// </summary>
/// <see href="http://dev.commercetools.com/http-api-projects-zones.html#location"/>
public class Location
{
#region Properties... |
{-# LANGUAGE ExistentialQuantification, TypeInType #-}
module BadTelescope4 where
import Data.Proxy
import Data.Kind
data SameKind :: k -> k -> Type
data Bad a (c :: Proxy b) (d :: Proxy a) (x :: SameKind b d)
data Borked a (b :: k) = forall (c :: k). B (Proxy c)
-- this last one is OK. But there was a bug involv... |
/*
Copyright 2019-2020 vChain, Inc.
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 applicable law or agreed to in writing, software
... |
# React Forms
React Forms library provides a set of tools for [React][] to handle form
rendering and validation.
It provides a **schema language** to define form structure and validation and a
set of **form components** to render schemas into UI.
Data flow between React Forms components provides strong **immutabilit... |
library bitcoin.scripts.output.pay_to_pubkey;
import "dart:typed_data";
import "package:bitcoin/core.dart";
import "package:bitcoin/script.dart";
class PayToPubKeyOutputScript extends Script {
/**
* Create a new output for a given public key.
*
* The public key can be either of type Uint8List or KeyPair.... |
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.awslambda.v1_0;
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.instrumentation.awslambda.v1_0.AwsLambdaMessageTracer;
import io.opentelemetry.instrumentatio... |
package de.visualdigits.bannermatic
import java.io.{File, FileOutputStream}
import de.visualdigits.bannermatic.model.pixelmatrix.Color
import de.visualdigits.bannermatic.model.pixelmatrix.`type`.{Align, Placement, VAlign}
import org.apache.commons.io.IOUtils
import org.junit.Assert
import org.junit.runner.RunWith
impo... |
#!/bin/bash
LOCAL_ADDRESS=$(ip route get 8.8.8.8 | awk '{print $NF; exit}')
LOCAL_DNS=$(dig +short -x $LOCAL_ADDRESS)
PUBLIC_ADDRESS=$(dig +short myip.opendns.com @resolver1.opendns.com)
PUBLIC_DNS=$(dig +short -x $PUBLIC_ADDRESS)
#Put the DBMS install commands here
#ulimit -n 65536
YUGABYTE_VERSION=1.0.3.0
rm /e... |
require 'neography'
require 'benchmark'
# If you want to see more, uncomment the next few lines
# require 'net-http-spy'
# Net::HTTP.http_logger_options = {:body => true} # just the body
# Net::HTTP.http_logger_options = {:verbose => true} # see everything
def generate_text(length=8)
chars = 'abcdefghjkmnpqrstuv... |
package handlerlist
import (
"fmt"
"github.com/kgysu/oc-apm/client/util"
"github.com/kgysu/oc-apm/web/html/pages/list"
"github.com/kgysu/oc-apm/web/server/serverutil"
"net/http"
)
func HandleListPage(rw http.ResponseWriter, req *http.Request) {
serverutil.SetHeaders(rw, req, "text/html")
labelSelector, kinds :... |
package git
import (
"fmt"
"os"
"path/filepath"
"strings"
)
func findGitFile(fileName string) (string, string, error) {
var err error
dir, err := os.Getwd()
if err != nil {
return "", "", err
}
for {
gitDir := filepath.Join(dir, ".git/"+fileName)
exists, err := fileExists(gitDir)
if err != nil {
... |
# global_miles_airline_api
#
# This file was automatically generated by APIMATIC v2.0
# ( https://apimatic.io ).
require 'date'
require 'json'
require 'faraday'
require 'certifi'
require 'logging'
require_relative 'global_miles_airline_api/api_helper.rb'
require_relative 'global_miles_airline_api/global_m... |
package gtt43a
import (
"encoding/binary"
"fmt"
"unicode/utf16"
)
/**/
type GTT25PropertyType []byte
var GaugeValue GTT25PropertyType = []byte{0x03, 0x02}
var LabelText GTT25PropertyType = []byte{0x09, 0x06}
var LabelFontSize GTT25PropertyType = []byte{0x09, 0x0A}
var SliderValue GTT25PropertyType = []byte{0x0A, ... |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GazeMarker : MonoBehaviour
{
public static List<Vector3> gazePath = new List<Vector3>();
public static List<List<Vector3>> savedGazePath = new List<List<Vector3>>();
private RayCaster rCaster;
void Start()
... |
package com.groupnine.oss.seller.service;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Random;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
imp... |
#define MAX_UTHREADS 64
#define SIGALRM 14
#define UTHREAD_QUANTA 5
#define STACKSZ 4096
typedef void (*start_func)(void*);
enum thread_state {RUNNING, READY, SLEEPING, BLOCKED, TERMINATED};
struct threadtrapframe {
uint edi;
uint esi;
uint ebp;
uint oesp;
uint ebx;
uint edx;
uint ecx;
uint eax;
... |
-- MySQL dump 10.15 Distrib 10.0.34-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: scanner
-- ------------------------------------------------------
-- Server version 10.0.34-MariaDB-0ubuntu0.16.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACT... |
@testset "distributions" begin
Random.seed!(1234)
# Create random vectors and matrices
dim = 3
a = rand(dim)
b = rand(dim)
c = rand(dim)
A = rand(dim, dim)
B = rand(dim, dim)
C = rand(dim, dim)
# Create random numbers
alpha = rand()
beta = rand()
gamma = rand()
... |
class WelcomeController < ApplicationController
theme 'triangle'
layout 'landing'
def index
end
end
|
<?php
namespace Admin\Controller;
use Think\Controller;
use Think\Upload;
class HmessageController extends Controller
{
public function index(){
//主持人信息遍历
// $db = M('host');
// $select = $db->select();
// $this->assign('hostselect', $select);
//// $this->show();
// $db = ... |
---
title: Requesting Parameter Values
author: Natalia Kazakova
legacyId: 117554
---
# Requesting Parameter Values
The Web Dashboard provides a built-in **Dashboard Parameters** dialog, which provides the capability to change dashboard parameter values. This dialog is created automatically, depending on the parameter t... |
<?php
namespace NGS\Symfony\Form\Type;
use NGS\Symfony\Form\DataTransformer\IdentifiableToUriTransformer;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
/**
* Extended reference field with custo... |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using BuildXL.Cache.ContentStore.Hashing;
using BuildXL.Cache.ContentStore.Interfaces.Results;
using BuildXL.Cache.ContentStore.Interfaces.Sessions;
using B... |
package com.awscherb.cardkeeper.ui.create
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.awscherb.cardkeeper.R
class CodeTypesAdapter(
private val co... |
// Type definitions for chai-withintoleranceof
// Project: https://github.com/RmiTtro/chai-withintoleranceof
// Definitions by: Matthew McEachen <https://github.com/mceachen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="chai" />
interface WithinTolerance {
(expected: numb... |
require 'hydroponic_bean/protocol'
module HydroponicBean
class Connection
include HydroponicBean::Protocol
attr_accessor :waiting
alias_method :waiting?, :waiting
def initialize
@_read, @_write = IO.pipe
@worker, @producer = false
@waiting = false
HydroponicBean.add_connecti... |
package g0201_0300.s0297_serialize_and_deserialize_binary_tree;
import com_github_leetcode.TreeNode;
/*
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
public class Codec {
private static fin... |
-- SPDX-License-Identifier: Apache-2.0
-- Licensed to the Ed-Fi Alliance under one or more agreements.
-- The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
-- See the LICENSE and NOTICES files in the project root for more information.
PRINT N'Updating [edfi].[StudentAcademicRecord]'
G... |
import * as fonts from "../fonts";
import * as colors from "../colors";
import { color } from "csx";
import { types } from "typestyle";
import { deepMergeStyles, multi } from "../helpers";
export const button = (
params: {
width?: number | string;
} = {}
): types.NestedCSSProperties => ({
fontSize: "18px",
... |
package main
import (
"context"
"net/http"
"time"
// _ "net/http/pprof"
"github.com/gsmcwhirter/go-util/v8/deferutil"
"github.com/gsmcwhirter/go-util/v8/logging/level"
"github.com/gsmcwhirter/go-util/v8/pprofsidecar"
"golang.org/x/sync/errgroup"
"github.com/gsmcwhirter/discord-bot-lib/v23/bot"
)
func star... |
/*
Navicat Premium Data Transfer
Source Server : localpg
Source Server Type : PostgreSQL
Source Server Version : 140002
Source Host : localhost:5432
Source Catalog : my_blog_db
Source Schema : public
Target Server Type : PostgreSQL
Target Server Version : 140002
File E... |
/*
* @author Philip Stutz
* @author Mihaela Verman
*
* Copyright 2013 University of Zurich
*
* 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/li... |
using System;
using System.Windows.Threading;
namespace Tools.Extension
{
static public class DispatcherExtension
{
static public void InvokeAction(this Dispatcher dispatcher, Action action)
{
dispatcher?.Invoke(new Action(() =>
{
action?.Invo... |
<?php
/**
* Copyright 2015, Eduardo Trujillo <ed@chromabits.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* This file is part of the Illuminated package
*/
namespace Chromabits\Illuminated\Database\Migrations;
use Chromabi... |
import { EMPTY_ADDRESS, ROOT_NODE } from './utils'
import { Domain } from '../generated/schema'
export function createDomain(id: string): Domain {
let domain = new Domain(id)
if(id == ROOT_NODE) {
domain.owner = EMPTY_ADDRESS
domain.label = ''
domain.fqn = ''
domain.save()
}
return domain
... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Third
{
//Check is AD is key sensitive
class Third
{
static List<Planet> listPlanets = new List<Planet>();
static void Main()
{
int me... |
require "list_node"
def reverse_list(head)
prev_node = nil
curr_node = head
while curr_node != nil
next_temp = curr_node.next
curr_node.next = prev_node
prev_node = curr_node
curr_node = next_temp
end
prev_node
end
def reverse_list_1(head)
prev_node = nil
curr_node = head
next_node = c... |
helpers do
# methods defined here are able to be called in any place.
def current_user
if session[:user_id]
@current_user ||= User.find_by_id(session[:user_id])
end
end
def logged_in?
!current_user.nil?
end
def logged_in_redirect(login_route, redirect_url)
# byebug
if logged_in? then
case
... |
---
author: leon
comments: true
date: 2022-01-01 10:10+00:00
layout: post
title: '[算法]关于vector的push_back扩容过程的经典问题'
categories:
- 算法
tags:
- 算法
---
在面试c++开发过程中,我经常问STL vector的内容,这里面挖掘的内容比较丰富,不限于:
- vector的内存配置器实现(经典内存池)
- vector扩容策略
- at和[]操作符的区别
- 迭代器失效问题
- 打码实现一个vector
## 内存配置器
在STL标准下,内存配置器(allocator)是有标准的
```c++
... |
# Tumblr download script:
It will help to download all kind of images from tumblr blogs.
### First install script requirements
```sh
$ pip install -r requirements.txt
```
### Run it like this for http://quotes.tumblr.com
```sh
$ python td.py quotes
```
OR
```sh
$ ./td.py quotes
```
It will download all your pics int... |
#include <cgreen/cgreen.h>
#include <cgreen/constraint_syntax_helpers.h>
Ensure(failing_test_is_listed_by_xml_reporter) {
assert_that(false);
}
Ensure(passing_test_is_listed_by_xml_reporter) {
assert_that(true);
}
Ensure(error_message_gets_escaped_by_xml_reporter) {
char *test_string =
"<?xml ver... |
package org.apache.helix;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2... |
package client
import (
"context"
"fmt"
"github.com/lomoval/otus-golang-project-sysmon/api"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/status"
"net"
"strings"
)
type Client struct {
host string
port string
table *table
}
... |
# @transmute/did-key-test-vectors
This module aggregates all test vectors associated with `did:key` packages.
|
require 'spec_helper'
module StellarLookout
RSpec.describe Operation, type: %i[model] do
describe "associations" do
it { is_expected.to belong_to(:ward) }
it do
is_expected.to belong_to(:txn).
with_primary_key(:external_id).
with_foreign_key(:txn_external_id)
end
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.