language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
Python | UTF-8 | 1,328 | 2.890625 | 3 | [] | no_license | from requests_html import HTMLSession
class Website:
__proto = 'HTTP'
def __init__(self, url):
self.url = url
self.domain = url.split('/')[2]
def print_something(self):
print('AAAAAAAAAAAAAAA')
print('This is Website!')
def print_title(self):
with HTMLSession... |
Markdown | UTF-8 | 10,202 | 2.859375 | 3 | [] | no_license |
---
MySQL基础
---
1. ## MySQL基本概念
1. #### MySQL驱动是什么东西?
1. 访问数据库则进行网络连接
2. 这个网络连接则需要由MySQL驱动创建
3. 基于网络连接建立各种CRUD操作
2. #### 数据库连接池解决了什么问题?
1. 当并发过高时候,如果此时只有一个数据库连接,多个线程抢占一个数据库连接,肯定会导致效率低下
2. 如果每个请求去访问数据库都创建一个连接,使用后进行销毁,那么创建和销毁线程的开销过大,会导致程序效率低下
3. 故引进连接池,需要的时候从池里取,不需要的时候放回... |
Java | UTF-8 | 331 | 2.78125 | 3 | [] | no_license | package com.demo;
public class Employee {
private String name;
private int age;
public Employee(String name, int age){
this.name = name;
this.age = age;
}
@Override public int hashCode() {
return 1;
}
@Override public boolean equals(Object obj) {
return tru... |
Java | UTF-8 | 1,121 | 2.28125 | 2 | [] | no_license | package com.hcl.service;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hcl.dao.TskRepository;
import com.hcl.exception.FailedDatabaseActionException;
import com.hcl.model.Task;
@Service
publi... |
Python | UTF-8 | 1,016 | 4.5 | 4 | [] | no_license | """
While Loop
Disadvantage: infinite loop!
"""
#start, condition-boundary, manage!
l=list(range(10))
for number in l:
if number%2==0:
print("\tNumber ",number," is Even")
else:
print("\tNumber ",number," is ODD")
print("For ended!! ",number)
#----------
number=0
while number <= 10: #perform... |
Markdown | UTF-8 | 2,425 | 2.5625 | 3 | [] | no_license | xState
======
A state machine editot and runtime. Can be used to model simple workflow
# 简介
xState编辑器是一个允许开发人员创建状态机的编辑器,通过通用直观的解决方案。

# 适用场景
状态机用处极其广泛,适用于订单,用户,任务等等具有确定状态的领域模型
# 特点
1. 结合模型和代码
1. 可以创建仅包含状态和变迁的状... |
Java | UTF-8 | 1,782 | 2.46875 | 2 | [] | no_license | package persistence.jdbc;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.postgis.PGgeometry;
import persistence.hibernate.HibernateConfig;
import persistence.util.Coordin... |
Java | UTF-8 | 2,540 | 2.265625 | 2 | [] | no_license | package au.com.carsguide.pages;
import au.com.carsguide.utility.Utility;
import com.cucumber.listener.Reporter;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class SearchCarsPage extends Utility {
priva... |
JavaScript | UTF-8 | 4,064 | 2.9375 | 3 | [] | no_license |
var player;
var intv;
var slider;
//Init
////////////////////////////
window.onload = function() {
document.getElementById('btnPlay').addEventListener('click', playMusic, false);
document.getElementById('btnPause').addEventListener('click', pauseM... |
Markdown | UTF-8 | 4,762 | 2.875 | 3 | [] | no_license | #includ<stdio.h>
void main(){
InitStack(S);
InitQueue(Q);
printf(" \n");
printf(" \n");
printf(" 欢迎进入停车场系统\n");
printf(" ************************************... |
Python | UTF-8 | 2,312 | 3.21875 | 3 | [] | no_license | import csv
from utils import settings
def get_features():
with open(settings.BALABIT_FEATURES_INPUT, 'r') as csv_file:
data_reader = csv.reader(csv_file, delimiter=',')
user_ids = ['7', '9', '12', '15', '16', '20', '21', '23', '29', '35']
row = next(data_reader)
row = next(data_rea... |
Java | UTF-8 | 3,377 | 2.546875 | 3 | [] | no_license | package pangame;
import Display.Visual;
import Graphic.Assests;
import Graphic.Camera;
import Input.Keymanager;
import Input.MouseManager;
import State.State;
import State.GameState;
import State.Menu;
import State.Endgame;
import java.awt.*;
import java.awt.image.BufferStrategy;
public class Game implements Runnabl... |
Java | UTF-8 | 920 | 1.976563 | 2 | [] | no_license | package com.forezp.phoenix.service;
import com.forezp.phoenix.dao.ProcessDataMapper;
import com.forezp.phoenix.domain.ProcessData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by fangzhipeng on 2017/4/20.
*/
@Serv... |
Markdown | UTF-8 | 7,892 | 3.03125 | 3 | [] | no_license | 九二
曾国藩面无表情地听着,这些事他早已看得很清楚,一点都不感到意外。但这的确是一件棘手的事。这些首功将官们自恃功大,要价很高,朝廷的封赏既不能全部满足他们的欲望,又只是空衔而无实惠,现在要把他们围攻两三年,自以为靠性命换来的财产再掏出来,这无异于挖他们的心肝。真的闹起事来,后果不堪设想。“老九,你要说服他们顾全大局,不管多少都要拿出一些,一则好向朝廷交代,二则也要堵塞天下悠悠之口。”
“杀人放火,我可以指挥他们干,要他们拿出自己的性命钱,我做不到。况且我也不干,我的银子就已经运走了。”
“九帅,你一碗水没有端平!”
曾国荃正要说下去,门口突然传进一声雷似的吼叫,只见焕字营营官朱洪章喝得醉醺... |
Python | UTF-8 | 88 | 3.140625 | 3 | [] | no_license | N=int(input())
k=int(input())
sum=0
for N in range(0:4):
sum=sum+N
print(N)
|
Java | UTF-8 | 586 | 2.421875 | 2 | [] | no_license | package com.example.alexmao.tp2final.firebase;
import java.util.ArrayList;
import java.util.List;
/**
* Created by filou on 01/04/16.
*/
public class Events {
private List<MeetingFinalChoice> meetings;
public Events() {
meetings = new ArrayList<>();
}
public List<MeetingFinalChoice> getMee... |
Python | UTF-8 | 4,774 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
from optparse import OptionParser
import glob, sys
import numpy as np
from mirnylib import h5dict
###########################################################################################
# get_interaction_matrix.py
#
# Hi-C data is binned into 40 kb sequences and there is an interaction matrix... |
Java | UTF-8 | 1,633 | 2.921875 | 3 | [] | no_license | package com.zjkhzgm.echo;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;
import io.netty.util.CharsetUtil;
import io.netty.util.ReferenceCountUtil;
/**
* @author zgm
* @Description:
* @Date 2018/10/7 9:37
*/
public class EchoServerHand... |
Markdown | UTF-8 | 3,026 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | ---
layout: post
title: "流程审批系统测试经验"
subtitle: ""
date: 2016-06-27
author: "Tesla9527"
header-img: "img/home-bg-o.jpg"
catalog: true
tags:
- 工作
---
> 从去年开始一直测试流程审批系统,也算是对流程系统的测试有了一些经验,总结了下,如果能做好以下几点,能够让测试
工作做的更加高效和自信。
## 需求整理
#### 需求文档管理(OneDrive)
文档真的是一个蛮贵重的东西,OneDrive提供30G的免费空间,用来管理文档是... |
Java | UTF-8 | 153 | 1.953125 | 2 | [] | no_license | package drawing.commands;
/**
* Interface for a command
*
* @author paude
*
*/
public interface ICommand {
public void execute();
}
|
Python | UTF-8 | 3,033 | 2.734375 | 3 | [] | no_license | # coding=utf8
"""Demo download views."""
from cStringIO import StringIO
from os.path import abspath, dirname, join
from django.core.files.storage import FileSystemStorage
from django_downloadview.files import VirtualFile
from django_downloadview import views
from demoproject.download.models import Document
# Some i... |
Python | UTF-8 | 755 | 3.171875 | 3 | [] | no_license | import sys
def stack_push(inp):
stack_data.append(inp)
def stack_pop():
if stack_empty():
return -1
else:
return stack_data.pop()
def stack_empty():
return 1 if len(stack_data) == 0 else 0
def stack_top():
if stack_empty():
return -1
else:
return stack_data[-1... |
Python | UTF-8 | 888 | 2.53125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from telegram.ext.dispatcher import Dispatcher
from telegram import TelegramError
from threading import Event
class BlockDispatcher(Dispatcher):
def __init__(self, updater, user_manager):
# Build a new dispatcher based on the same settings as we get from the
# updater.
# TODO Probably shou... |
Java | UTF-8 | 2,321 | 2.265625 | 2 | [] | no_license | package com.eurodyn.qlack2.fuse.mailing.impl.monitor;
import com.eurodyn.qlack2.fuse.mailing.api.MailQueueMonitorClock;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.apache.aries.blueprint.annotation.config.ConfigPropert... |
C++ | UTF-8 | 376 | 2.84375 | 3 | [] | no_license | #include<bits/stdc++.h>
//#define max 100
//int memo[max];
int fib(int n,int *memo){
if(memo[n-1]!=0){
return memo[n-1];
}
else if(n==1||n==2){
return 1;
}
else{
int f=fib(n-1,memo)+fib(n-2,memo);
memo[n-1]=f;
return f;
}
}
using namespace std;
int main(){
int n;
cin>>n;
int memo[n]={0};
int resul... |
Java | UTF-8 | 2,975 | 2.3125 | 2 | [] | no_license | package com.demo.jfinal.util;
import com.demo.jfinal.controller.LoginController;
import com.demo.jfinal.controller.TestController;
import com.demo.jfinal.model.db._MappingKit;
import com.demo.jfinal.shiro.ShiroInterceptor;
import com.demo.jfinal.shiro.ShiroPlugin;
import com.jfinal.config.*;
import com.jfinal.kit.Prop... |
Markdown | UTF-8 | 1,120 | 3.375 | 3 | [
"MIT"
] | permissive | # Reddit To Twitter Bot
Bot that takes reddit posts from subreddit of your choosing and tweets them. The bot also has the option of only selecting specific posts based on keywords of your choosing from your chosen subreddit.
## Things you will need:
1. "Client ID" & "Client Secret" from your reddit account. [Instru... |
Python | UTF-8 | 4,573 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | import numbers
import six
from ...cereal import serializable
from ..core import typecheck_promote
from ..primitives import Int, Float, Str, Bool
from ..containers import Struct, Tuple
from .timedelta import Timedelta
def _binary_op_casts_to(a, b):
if isinstance(a, Datetime) and isinstance(b, Timedelta):
... |
Python | UTF-8 | 2,490 | 4.0625 | 4 | [] | no_license | # Sorting Algorithm
# Insertion Sort
# Time: O(n^2)
# Space: O(1)
# pick each item insert to the right place
def insertionSort(alist):
for i in range(1,len(alist)):
cur = alist[i]
pos = i
while pos > 0 and alist[pos - 1] > cur:
alist[pos] = alist[pos - 1]
pos -= 1
... |
Markdown | UTF-8 | 1,264 | 3.1875 | 3 | [] | no_license | # Sequence Labeling
The problem here is: Given a sequence of tokens, infer the most probable
sequence of lables for these tokens.
Examples are:
* Part of Speech Tagging (POS Tagging)
* Named Entity Recognition (NER)
For POS tagging we can use tags from the "Universal Dependencies Project".
So here we want to underst... |
Markdown | UTF-8 | 1,932 | 3.40625 | 3 | [] | no_license | ---
title: "算法 - 最好、最坏、平均复杂度"
author: "颇忒脱"
tags: ["ARTS-A"]
date: 2019-02-13T20:24:48+08:00
---
<!--more-->
[极客时间 - 数据结构与算法之美 - 04 | 复杂度分析(下):浅析最好、最坏、平均、均摊时间复杂度][1]
## 最好、最坏时间复杂度
略,比较容易分析。
## 平均时间复杂度
需考虑概率来计算。
概率论中的**加权平均值**,也叫作**期望值**,所以平均时间复杂度的全称应该叫**加权平均时间复杂度**或者**期望时间复杂度**。
## 均摊时间复杂度
均摊时间复杂度及对应的摊还分析法。
对... |
Java | UTF-8 | 754 | 3.203125 | 3 | [] | no_license | package com.learning.net;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
public class ServerListener implements Runnable {
int port;
ServerSocket server;
Socket client;
public ServerListener(int port) {
this.... |
Java | UTF-8 | 464 | 2.953125 | 3 | [] | no_license | package com.myspringprojects.rnd.mockitolearning.testdoubles.spy;
public class BookRepositorySpy implements BookRepository {
int saveCalled = 0;
Book lastAddedBook = null;
@Override
public void save(Book book) {
this.saveCalled++;
this.lastAddedBook = book;
}
public int times... |
Python | UTF-8 | 1,322 | 3.3125 | 3 | [] | no_license | import talib as ta
import pandas as pd
import numpy as np
# This funciton can be replaced by your trading strategy.
# The function must one of the following three
# 1 - BUY
# 0 - HOLD
# -1 - SELL
def trading_strategy(inputs):
# This demo trading strategy is build on cross over of moving averages of 5... |
Markdown | UTF-8 | 2,632 | 2.828125 | 3 | [
"CC0-1.0"
] | permissive | ---
layout: post
title: "Shooting Star Chase: Sunrise Walk - 1 June 2014"
permalink: /archives/2014/03/shooting_star_chase_sunrise_walk_1_june_2014.html
commentfile: 2014-03-21-shooting_star_chase_sunrise_walk_1_june_2014
category: around_town
date: 2014-03-21 22:03:08
image: "/assets/images/2014/SHOOTIGN_sunrise-w... |
Markdown | UTF-8 | 6,621 | 3.21875 | 3 | [] | no_license | ## FLock(), IsFLocked(), IsRLocked(), Sys(2011)
FLOCK() locks all records in a table, preventing any other user from obtaining a lock on the file. Records are still visible for others to view, browse and report on. SYS(2011) can be used to detect the status of the current record, without attempting to actually place... |
PHP | UTF-8 | 1,361 | 2.59375 | 3 | [
"MIT"
] | permissive | <?php
declare(strict_types=1);
namespace Spires\Contracts\Core;
use Spires\Contracts\Container\Container;
interface Core extends Container
{
/**
* Get the version number of the application.
*
* @return string
*/
public function version();
/**
* Get the base path of the Laravel i... |
Python | UTF-8 | 948 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
class find_code:
def __init__(self):
self.words_dict = {}
self.input_word = ''
self.out_string = 'Human Rights'
def open_file(self, file='filtered_words.txt'):
with open(file) as f:
for line in f:
if not self.words_dict.has_key... |
Python | UTF-8 | 1,460 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# encoding:utf8
import pika
# 建立到达RabbitMQ Server的connection
# 此处RabbitMQ Server位于本机-localhost
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
# 声明queue,确认要从中接收message的queue
# queue_declare函数是幂等的,可运行多次,但只会创建一次
# 若可以确信queue... |
Shell | UTF-8 | 252 | 2.640625 | 3 | [] | no_license | #!/bin/bash
function nsrequest() {
./nsrequest/DerivedData/nsrequest/Build/Products/Release/nsrequest $1
}
tempfile=$(mktemp -t rules.pac)
yaml2pac data/rules.yaml > $tempfile
echo "File path: $tempfile"
yaml2pac data/rules.yaml -t $tempfile
|
Java | GB18030 | 1,057 | 3.609375 | 4 | [] | no_license | package javaSourceDemo;
import java.util.Scanner;
public class ShoppingCart {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double price; // Ʒ
int count; // Ʒ
double total = 0; // ܼ
// 1.Ʒĵۺ
System.out.print("MacBook Proĵ:");
price = input.nextDouble();
System.out.p... |
Ruby | UTF-8 | 887 | 2.609375 | 3 | [] | no_license | require 'base64'
module Kodi
# Use the HTTP JSON-RPC API of Kodi to refresh the Kodi DB
#
# @param [String] login_pass
# The 'login:pass' pair to use to access Kodi's HTTP API
# @param [String] host
# The host to use to access Kodi's HTTP API
# @param [Int] port
# The port to use t... |
C | UTF-8 | 475 | 3.515625 | 4 | [] | no_license | #include <stdio.h>
#include <time.h>
#include <stdlib.h>
double get_pi(int n)
{
int k = 0;
int i;
double x;
double y;
srand(time(NULL));
for (i = 0; i < n; i++)
{
x = (double)rand() / RAND_MAX;
y = (double)rand() / RAND_MAX;
if (x * x + y * y <= 1.0)
{
k++;
}
}
return 4.0 * k / n;
}
int main... |
Java | UTF-8 | 478 | 2.171875 | 2 | [] | no_license | package com.example.cassa.entrainementprojettut.geometry.setGeometry;
import com.example.cassa.entrainementprojettut.geometry.figure.Figure;
import java.util.Random;
public class SetGeometryLV3 implements I_SetGeometry {
public SetGeometryLV3(){
}
@Override
public String getFalsePropertie(Figure ... |
SQL | UTF-8 | 1,843 | 3.734375 | 4 | [] | no_license |
-----------------------------------------------------------------
-- Version 0.3.0
-----------------------------------------------------------------
-- Fix to some column character sets
alter table characters modify column cname varchar(20) character set latin1;
alter table character_owners modify column pname varcha... |
Python | UTF-8 | 4,618 | 2.6875 | 3 | [] | no_license | from DGM import GraphMatrix
import numpy as np
'''
All bees leave hive and search for a path. Then they return and we keep for exapmle top 10%. Each bee follows one of these
other bees based on waggle dance.
'''
class Forager(GraphMatrix):
def __init__(self, filename):
GraphMatrix.__init__(self, filename... |
Java | UTF-8 | 3,464 | 2 | 2 | [] | no_license | package py.com.excelsis.sicca.entity;
// Generated 14/10/2011 09:15:23 AM by Hibernate Tools 3.4.0.Beta1
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull... |
C++ | BIG5 | 704 | 3.734375 | 4 | [] | no_license | # include <iostream>
# include <stdlib.h>
using namespace std;
int rFibonacci(int n);
int main(void){
while(true){
cout << "пJwpFibonacciƦCĴX(J0Y)G";
int arr_length = 0;
cin >> arr_length;
if (arr_length == 0)
break;
cout << "==>fib(" << arr_length << ") = " << rFibonacci(arr_length) << "\... |
SQL | UTF-8 | 1,208 | 3.546875 | 4 | [
"BSD-2-Clause"
] | permissive | use progettok19;
drop TABLE IF EXISTS LOT;
drop TABLE IF EXISTS BID;
drop TABLE IF EXISTS USER;
drop TABLE IF EXISTS TIMER;
drop TABLE IF EXISTS AUCTION;
CREATE TABLE USER
( username CHAR(20),
pass CHAR(40),
loggedstatus BOOLEAN,
PRIMARY KEY(username));
CREATE TABLE AUCTION
( id INTEGER AUTO_INCREMENT,
closi... |
Markdown | UTF-8 | 1,456 | 2.640625 | 3 | [
"MIT"
] | permissive | ---
guide: User Guide
section: Overview
overview: true
menu: getting-started
---
**Lita** is a [chat bot](https://en.wikipedia.org/wiki/Chatterbot) written in [Ruby](https://www.ruby-lang.org/) with persistent storage provided by [Redis](http://redis.io/). It uses a plugin system to connect to different chat services ... |
Python | UTF-8 | 890 | 2.796875 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
import scipy.spatial.distance as distance
"""
This module contains routines for managing and validating kCSD parameters.
"""
def check_for_duplicated_electrodes(elec_pos):
"""
**Parameters**
elec_pos : np.array
**Returns**... |
JavaScript | UTF-8 | 7,370 | 3.171875 | 3 | [] | no_license |
// Displays day at top of the page
var today = moment();
$('#currentDay').text(today.format('dddd'));
console.log(today);
// .css? .attr? Add or remove class?
$("#hour-9").parent().css("background-color", "yellow !important");
const inpKey = document.getElementById("inpKey");
const btnInsert = document.getElementB... |
Markdown | UTF-8 | 283 | 2.875 | 3 | [] | no_license | # BFS-Pacman
A self-solving pacman console game, where according to several variables (The initial position of the "Pacman", the exit and the position of the walls) the pacman is able to perform a BFS through all the possible paths, selecting the shortest one and moving through it.
|
Java | UTF-8 | 1,201 | 2.1875 | 2 | [
"MIT"
] | permissive | package com.gtc.tradinggateway.service.huobi.dto;
import com.google.common.collect.ImmutableMap;
import com.gtc.model.gateway.data.OrderDto;
import com.gtc.model.gateway.data.OrderStatus;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Map;
/**
* Created by mikro on 01.04.2018.
*/
@Data
public cl... |
Markdown | UTF-8 | 767 | 2.765625 | 3 | [] | no_license | - Do a little more each day than you think you possibly can.
- The ability to speak is a short cut to distinction. It puts a man in the limelight, raises him head and shoulders above the crowd.
- In Istanbul I met a man who said he knew beyond a doubt that God was a cat. I asked why he was so sure, and the man said,... |
Java | UTF-8 | 617 | 3.1875 | 3 | [] | no_license | package tree.problems.easy;
public class IsSumProperty {
public static int isSumProperty(Node root)
{
if (root == null || (root.left == null && root.right == null)) {
return 1;
}
int left = 0, right = 0;
if (root.left != null) {
left = root.left.data;
... |
JavaScript | UTF-8 | 974 | 2.59375 | 3 | [
"MIT"
] | permissive | var fs = require('fs')
var path = require('path')
var Canvas = require('..')
var canvas = new Canvas(150, 150)
var ctx = canvas.getContext('2d')
ctx.fillRect(0, 0, 150, 150) // Draw a rectangle with default settings
ctx.save() // Save the default state
ctx.fillStyle = '#09F' // Make cha... |
Python | UTF-8 | 1,979 | 3.703125 | 4 | [] | no_license | import sys
import io
sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding = 'utf-8')
# https://wikidocs.net/7033
# for문과 range 구문을 사용해서 0~99까지 한 라인에 하나씩 순차적으로 출력하는 프로그램을 작성하라.
'''
for i in range(100):
print(i)
'''
# 월드컵은 4년에 한 번 개... |
Python | UTF-8 | 853 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
Created on 06/12/2012
@author: User
'''
from django.db import models
escolhas = (
('A','Ativada'),
('D','Desativada')
)
class Noticia(models.Model):
class Meta:
verbose_name = 'Nova Notícia'
verbose_name_plural = 'Notícias'
ordering = ('-d... |
C# | UTF-8 | 1,735 | 2.59375 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum GameState { Play, Pause }
public class GameController : MonoBehaviour
{
private GameState state;
static private GameController _instance;
private int score;
int dragonHitScore;
int dragonKillScore;
[Seri... |
Java | UTF-8 | 1,822 | 2.953125 | 3 | [] | no_license | package Basico;
public class Generator {
public static int IFGOTO = -35;
public static int GOTO = -36;
public static int LABEL = -37;
private static int indiceTemp = 0;
private static int indiceLabel = 0;
public static String nuevaTemp() {
return "_t" + indiceTemp++;
}
publi... |
Markdown | UTF-8 | 1,662 | 2.78125 | 3 | [] | no_license | title: Python 连接 Mysql 数据库
date: 2016-03-14 15:01:19
tags:
- Python
- Mysql
- MySQLdb
- 数据库
- database
---
## 连接 mysql 数据库
使用 MySQLdb 来做为连接 mysql 数据库。
``` python
import MySQLdb
try:
# host 表示主机类型
# user 登录的用户
# passwd 登录密码
# db 登录的数据库
# port 端口号,在本地情况下可以不用写
conn=MySQLdb.con... |
PHP | UTF-8 | 4,644 | 2.875 | 3 | [] | no_license | <?php
if ( ! class_exists( 'ProSites_Helper_Session' ) ) {
class ProSites_Helper_Session {
private static $token = 'prosites_';
private static $add_time = '+1 hour';
/**
* IMPORTANT: Only works for logged in users.
*
* To use this for registration, create the user first and login immediately
*
... |
SQL | UTF-8 | 877 | 3.9375 | 4 | [
"Apache-2.0"
] | permissive |
/*********
FIELD_IS_STANDARD_VALID_CONCEPT
all standard concept id fields are standard and valid
Parameters used in this template:
cdmDatabaseSchema = @cdmDatabaseSchema
cdmTableName = @cdmTableName
cdmFieldName = @cdmFieldName
**********/
SELECT num_violated_rows, CASE WHEN denominator.num_rows = 0 THEN 0 ELSE 1.0... |
PHP | UTF-8 | 2,029 | 2.5625 | 3 | [] | no_license | <?php
namespace Admin\Controller;
use Think\Controller;
class CommonController extends Controller{
public function __construct(){
header("Content-Type: text/html; charset=utf-8");
parent::__construct();
// 检测当前访问者是否登录了。
$this->checkLogin();
// 检测当前管理员是否具有访问当前[控制器-方法]的权限
$t... |
C | UTF-8 | 546 | 3.765625 | 4 | [] | no_license | #include <stdio.h>
#define INVALID -1
int sumup(int v[])
{
int i;
int sum = 0;
for(i = 0; v[i] != INVALID; i++)
sum += v[i];
return sum;
}
int main(void)
{
int i;
int a[128];
int na = sizeof(a) / sizeof(a[0]);
printf("input %d elements (end element : -1).\n", na - 1);
f... |
C++ | GB18030 | 875 | 3.03125 | 3 | [] | no_license | //ءɢ롢ռ
#ifndef MONEY_H
#define MONEY_H
#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;
namespace Space1
{
class Money
{
public:
Money();
Money(double amount);
Money(int theDollars,int theCents);
double getAmount() const;
int getDollars()const;
int getCents()const;
void input();
void ou... |
C | UTF-8 | 2,591 | 3.546875 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libgen.h>
#include <stdarg.h>
#include <unistd.h>
#include <fcntl.h>
void strTrim(char* str) {
int readIndex = 0;
int writeIndex = 0;
while (str[readIndex] == ' ') { //loop past all leading spaces
readIndex++;
}
while (str[readIndex] != '\0... |
Markdown | UTF-8 | 1,493 | 2.546875 | 3 | [] | no_license | ---
authors:
- admin
bio: My teaching interests are data science, statistics, and science communication.
education:
courses:
- course: PhD in Environmental Science and Management
institution: Bren School, UC Santa Barbara
year: 2012
- course: MS in Mechanical Engineering
institution: UC Santa Barbara
... |
Python | UTF-8 | 2,038 | 4.0625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019/12/9 9:50 下午
# @Author : lihm
# @File : sort.py
import random
def quicksort(seq):
if len(seq) < 2:
return seq
else:
base = seq[0]
left = [elem for elem in seq[1:] if elem < base]
right = [elem for elem in seq[1:] if elem > base]
... |
Python | UTF-8 | 530 | 3.34375 | 3 | [] | no_license | import sys
from collections import Counter
N = int(sys.stdin.readline())
nums = []
for n in range(N):
num = int(sys.stdin.readline())
nums.append(num)
print(int(round((sum(nums) / N), 0))) # 1
nums.sort()
answer4 = max(nums) - min(nums)
print(nums[N // 2]) # 2
if len(nums) == 1: # 3
print(nums[0])
els... |
C++ | UTF-8 | 1,382 | 3.109375 | 3 | [] | no_license | // we have defined the necessary header files here for this problem.
// If additional header files are needed in your program, please import here.
#include<vector>
int main()
{
// please define the C++ input here. For example: int a,b; cin>>a>>b;;
// please finish the function body here.
// please define th... |
Java | UTF-8 | 313 | 1.835938 | 2 | [] | no_license | package universetournament.shared.logic.gamemode.events;
import universetournament.shared.events.SubType;
/**
*
* @author Bernd Marbach
*
*/
public enum GameModeSubType implements SubType
{
SET_TIME,
PLAYER_JOINED,
PLAYER_LEFT,
PLAYER_SCORE_CHANGED,
TEAM_SCORE_CHANGED,
PLAYER_KILLED,
PLAYER_DIED;
}
|
SQL | UTF-8 | 1,941 | 3 | 3 | [] | no_license | CREATE OR REPLACE PACKAGE "GUIUTILS" AS
TYPE CURSOR_TYPE IS REF CURSOR;
PROCEDURE GETKEYCONTAINERATTRIBUTES
(pContainerIDList IN varchar2:=NULL,
pContainerBarcodeList IN varchar2:=NULL,
O_RS OUT CURSOR_TYPE);
PROCEDURE GETKEYPLATEATTRIBUTES
(pPlateIDList IN varchar2:=NULL,
... |
C# | UTF-8 | 41,119 | 2.796875 | 3 | [] | no_license | using PetAdopt.DTO;
using PetAdopt.DTO.Animal;
using PetAdopt.Models;
using PetAdopt.Utilities;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.IO;
using System.Linq;
namespace PetAdopt.Logic
{
/// <summary>
/// 動物Logic
/// </summary>
public class AnimalLogic : _... |
Python | UTF-8 | 2,551 | 2.796875 | 3 | [] | no_license | from matplotlib import pyplot as plt
import numpy as np
from tkinter import *
from tkinter import ttk
def m2py(fom):
fom = fom.replace("^","**")
fom = fom.replace("sin","np.sin")
fom = fom.replace("cos","np.cos")
fom = fom.replace("tan","np.tan")
fom = fom.replace("pi","np.pi")
fom = fom.replace("e","... |
PHP | UTF-8 | 269 | 3.59375 | 4 | [] | no_license | <?php
class Person
{
public $firstName = "Samuel Langhorne";
public $lastName = "Clement";
public $yearBorn = 1899;
}
$myObject = new Person();
echo $myObject->firstName . "\n"; // accessing the properties
$myObject->firstName = 'S.L.';
echo $myObject->firstName; |
C++ | UTF-8 | 875 | 3.140625 | 3 | [] | no_license | //Leetcode 1175
class Solution {
public:
int MOD;
int numPrimeArrangements(int n) {
MOD = 1000000007;
vector<int> is_prime(n+1, true);
is_prime[1] = false;
for(int i=2;i<=n;++i) {
for(int m=2;;++m) {
int v=i*m;
if(v>n) break;
... |
Python | UTF-8 | 3,049 | 4.4375 | 4 | [] | no_license | #https://leetcode.com/problems/flatten-nested-list-iterator/
'''
Given a list of lists, design an iterator that implements a next() and hasNext() function
Inp: [[1,1],2,[1,1]]
Out: [1, 1, 2, 1, 1]
Inp: [1,[4,[6]]]
Out: [1, 4, 6]
'''
#class NestedInteger(object):
# def isInteger(self):
# """
... |
TypeScript | UTF-8 | 3,561 | 3.046875 | 3 | [] | no_license | import { types, getParent, destroy, flow, getSnapshot } from "mobx-state-tree"
import { createHistory } from './History'
export type ITodoItem = typeof TodoItem.Type;
export type ITodoStore = typeof TodoStore.Type;
// A TodoItem contains the information describing a Task
export const TodoItem = types
.model("Todo",... |
Markdown | UTF-8 | 1,202 | 3.203125 | 3 | [] | no_license | ---
layout: post
title: 行ごとに異なるインデックスに” 1 ”を持つ numpy 配列を作成するには
date: 2018-10-29 05:36:59
categories: python numpy
---
<p>タイトルのような配列を作成したいのですが、効率の良いプログラムが思い浮かばないので<br>
質問させてください。<br>
作成したい配列は、例えば0行目は 0, 2, 4 列目、1行目は 1, 3, 4 列目成分に"1"を持ちそれ以外は"0"を持つといった配列をpythonのfor文を用いずに作成したいです。例で上げた行列は、</p>
```
array = [[1,0,1,0,1],
... |
C | UTF-8 | 3,280 | 3.328125 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "storage_mgr.h"
#include "dberror.h"
#include "test_helper.h"
RC readBlock (int pageNum, SM_FileHandle *fHandle, SM_PageHandle memPage){
if(pageNum>=1&&pageNum<=totalNumPages){
fseek(fHandle->mgmtInfo, (pageNum-1)*PA... |
Java | UTF-8 | 926 | 3.015625 | 3 | [] | no_license | package co.edu.unicauca.facade.access;
import co.edu.unicauca.facade.domain.order.Order;
import java.util.ArrayList;
import java.util.List;
/**
* Esta clase representa la lista de pedidos en la cual se almacenan en dicha lista
*
* @author Jefferson Eduardo Campo, Hector Esteban Coral
*/
public class OrderReposit... |
C++ | UTF-8 | 763 | 2.828125 | 3 | [] | no_license | //hashTable.h
// Author: Benjamin Fogiel
#include<iostream>
#include<cstring>
#include<climits>
#include<fstream>
#include "minHeap.h"
#ifndef HASHTABLE_H
#define HASHTABLE_H
using namespace std;
// A class for Min Heap
class HashTable
{
private:
vector<Node> htarr;
int numElm;
int cap;
int tableLen... |
Java | UTF-8 | 3,702 | 1.992188 | 2 | [] | no_license | package com.ejemplo.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import c... |
C++ | GB18030 | 373 | 2.859375 | 3 | [] | no_license | #include<iostream>
#include<string.h>
using namespace std;
int a[]={2,5,5};
int b[]={2,2,3,5,5,7};
int main()
{
int cnt=0;
int i=0,j=0;
while(i<3&&j<6)
{
if(a[i]==b[j])
{
cout<<a[i]<<" ";
cnt++;
i++,j++;
}
else if(a[i]<b[j])
{
i++;
cnt++;
}
else if(a[i]>b[j])
{
j++;
cnt++;
}
}
cout<... |
Java | UTF-8 | 1,147 | 2.6875 | 3 | [] | no_license | package com.zhua.spring.webserver.controller;
import com.zhua.spring.webserver.publish.service.MyWebService;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import java.net.URL;
/**
* @ClassName JdkWsClient
* @Description jdk原生调用(需要获取服务接口文件)
* @Author zhua
* @Date 2020/8/13 12:42
* @Version 1.0
... |
Java | UTF-8 | 318 | 1.648438 | 2 | [] | no_license | package com.hmetrix1.dao.imp;
import com.hmetrix1.dao.ClusterComponentsDAO;
import com.hmetrix1.dto.ClusterComponentDTO;
public class ClusterComponentsDAOImp implements ClusterComponentsDAO{
@Override
public ClusterComponentDTO accessClusterComponent() {
// TODO Auto-generated method stub
return null;
}
}
|
Java | UTF-8 | 676 | 2.234375 | 2 | [] | no_license | package service.faultWarning;
import dao.LineDataDao;
import bll.predict.PredictInput;
import tool.highcharts.LineData;
import tool.highcharts.LineDataBuilder;
public class WarnViewService {
private PredictInput input;
public WarnViewService(String tableName, Long time, String ID) {
input = LineDataDao.read(ta... |
Swift | UTF-8 | 2,652 | 2.515625 | 3 | [] | no_license | //
// StartViewController.swift
// Math
//
// Created by William Peroche on 23/06/18.
// Copyright © 2018 William Peroche. All rights reserved.
//
import Foundation
import UIKit
class StartViewController : UIViewController {
@IBOutlet var firstTextField: UITextField!
@IBOutlet var operationTextField:... |
Java | UTF-8 | 355 | 1.703125 | 2 | [] | no_license | package org.mis.bean;
import org.hibernate.Session;
import org.sky.test.HibernateSessionFactory;
/**
* Data access object (DAO) for domain model
* @author MyEclipse Persistence Tools
*/
public class BaseHibernateDAO implements IBaseHibernateDAO {
public Session getSession() {
return HibernateSes... |
JavaScript | UTF-8 | 2,297 | 2.59375 | 3 | [
"MIT"
] | permissive | import mongoose from 'mongoose';
import Follower from '../models/follower';
/**
* This function is responsible for returning list
* of users that user specified by req.id is following
*
* @param {Object} req - Router request object
* @param {Object} res - Router response object
*/
export const getFollowers = (r... |
PHP | UTF-8 | 1,757 | 2.59375 | 3 | [] | no_license | <?php
if(!checklogin()){
exit();
}
if($_POST){ //if user did input
$studentno=$_SESSION['studentno'];
$PostID = (@$_GET['PostID'] ? $_GET['PostID'] : $_POST['PostID']); // if get is null then get post
$text = $_POST['text'];
//filter
$text=addslashes(htmlspecialchars($text));
// Po... |
C | UTF-8 | 359 | 3.625 | 4 | [] | no_license | #include <stdio.h>
/* 1-11/12: Write a program that prints its input one word per line */
#define IN 1 /* inside a word */
#define OUT 0 /* outside a word */
#if defined EOF
# undef EOF
# define EOF '^'
#endif
main()
{
char c;
while ( (c = getchar()) != EOF) {
if (c == '\t' || c == ' ')
putchar('... |
PHP | UTF-8 | 2,939 | 3.03125 | 3 | [] | no_license | <!--
Programmed By: DJ Booker
June 15, 2021
This program will demonstrate 2d arrays
-->
<html>
<head>
<style>
.error {
color: red;
}
</style>
<title>
Lab 6
</title>
</head>
<body>
<?php
$search = $searchMSG = "";
function validate_input($input)
{
$input = trim($input);
$input = htm... |
Java | UTF-8 | 2,753 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | package com.tinkerpop.gremlin.util.optimizers;
import com.tinkerpop.blueprints.Compare;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.tinkergraph.TinkerFactory;
import com.tinkerpop.gremlin.Gremlin;
import com.tinkerpop.gremlin.oltp.filter.HasPipe;
import com.tinkerpop.gremlin.oltp.map.GraphQ... |
Markdown | UTF-8 | 3,388 | 2.84375 | 3 | [
"Unlicense"
] | permissive |
# نتنياهو: لن نسمح أبداً لإيران بتطوير أسلحة نووية
Published at: **2019-11-06T00:00:00+00:00**
Author: ****
Original: [الشرق الأوسط](https://aawsat.com/home/article/1978641/%D9%86%D8%AA%D9%86%D9%8A%D8%A7%D9%87%D9%88-%D9%84%D9%86-%D9%86%D8%B3%D9%85%D8%AD-%D8%A3%D8%A8%D8%AF%D8%A7%D9%8B-%D9%84%D8%A5%D9%8A%D8%B1%D8%A7%... |
TypeScript | UTF-8 | 418 | 3 | 3 | [] | no_license | export type ProcessMessage = {type: string, data: any}
export type IListener = (msg: any) => void
export default class Process {
constructor() {
}
public exit: number = 0
private listeners:Array<IListener> = []
async wait(exit: Promise<void>) {
try {
await exit
} catch(e) {
this.handleUn... |
Java | UTF-8 | 437 | 2.015625 | 2 | [] | no_license | package com.example.demo.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.demo.entity.Board;
public interface BoardRepository extends JpaRepository<Board, Long> {
/*
insert -> save(엔티티 객체)
select -> findById(키 타입), getOne(키 타입)
update -> save... |
Java | UTF-8 | 900 | 1.953125 | 2 | [] | no_license | package cn.flyrise.android.protocol.entity.knowledge;
import java.util.List;
import cn.flyrise.feep.core.network.request.ResponseContent;
import cn.flyrise.feep.knowledge.model.SearchFile;
/**
* Created by klc on 2016/9/23.
*/
public class SearchFileResponse extends ResponseContent {
public Result result;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.