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 |
|---|---|---|---|---|---|---|---|
Java | UTF-8 | 1,711 | 1.9375 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2012 the original author or authors.
*
* 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 applicab... |
TypeScript | UTF-8 | 1,061 | 2.53125 | 3 | [] | no_license | const {ccclass, property} = cc._decorator;
@ccclass
export default class MyGame extends cc.Component {
@property(cc.Node)
private titleNode:cc.Node=null;
@property(cc.Node)
private selectLevelNode:cc.Node=null;
@property([cc.Node])
private levelIntroList:cc.Node[]=[];
@property(cc.Node)
... |
Java | UTF-8 | 2,847 | 2.140625 | 2 | [] | no_license | package com.honglu.quickcall.user.web.filter;
import com.alibaba.fastjson.JSONObject;
import com.honglu.quickcall.account.facade.code.AccountBizReturnCode;
import com.honglu.quickcall.common.api.exception.BizException;
import com.honglu.quickcall.common.api.util.ConstantUtils;
import com.honglu.quickcall.common.... |
Java | UTF-8 | 10,403 | 1.84375 | 2 | [] | no_license | package com.example.friedegg.adapter;
import android.app.Activity;
import android.app.Dialog;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Typeface;
import android... |
PHP | UTF-8 | 484 | 2.8125 | 3 | [] | no_license | <?php
namespace SimUDuck;
use SimUDuck\Fly\FlyWithWings;
use SimUDuck\Quack\Quack;
/**
* MallardDuck can swim, Quack, fly.
*/
class MallardDuck extends AbstractDuck
{
/**
* Init fly and quack behavior.
*/
public function __construct()
{
$this->flyBehavior = new FlyWithWings();
... |
PHP | UTF-8 | 3,053 | 2.9375 | 3 | [] | no_license | <?php
declare(strict_types=1);
namespace App\CryptoGatewayEngine\WalletGenerator\Util;
class TronHelper
{
public static function getBase58CheckAddress(string $addressBin): string
{
$checksum = substr(self::makeHash(self::makeHash($addressBin)), 0, 4);
$checksum = $addressBin . $checksum;
... |
Java | UTF-8 | 306 | 1.796875 | 2 | [
"Apache-2.0"
] | permissive | package com.glh.glwdialog;
/**
* <pre>
* author : 高磊华
* e-mail : 984992087@qq.com
* time : 2018/08/13
* desc : 拍照中的按钮 被点击后 的回调监听
* </pre>
*/
public interface OnTakePhotoDialogLitener {
void onTakePhotoDialogTypeClick(int mPlatform);
}
|
JavaScript | UTF-8 | 579 | 2.78125 | 3 | [
"WTFPL"
] | permissive | /* global document window */
// const ready = require('../../js/utils/documentReady.js');
// ready(function(){
//
// });
window.addEventListener('DOMContentLoaded', function () {
let likeBtn = document.querySelectorAll('.likeBtn');
likeBtn.forEach(function (elem) {
let span = elem.querySelector('.likeBtn_... |
Python | UTF-8 | 3,441 | 2.953125 | 3 | [] | no_license | from pymysql import *
from hashlib import *
from redis import *
class MYSQL(object):
def __init__(self):
self.con = connect(host='localhost', port=3306,
database='python_info', user='root',
password='mysql', charset='utf8')
self.cur = self.con.... |
Markdown | UTF-8 | 922 | 3.125 | 3 | [
"BSD-2-Clause"
] | permissive | # Discounts
Discounts can be:
* Temporary price markdowns - restricted by various chosen constraints.
* Coupon/Voucher codes - unique code entered at checkout, and can also be restriced to the same various constraints.
The discount actions can be either marking down by percent or a fixed amount.
These markdowns ca... |
Python | UTF-8 | 289 | 2.9375 | 3 | [] | no_license | #暴力
#hash表
def many(s:str):
dic = {}
for i in range(len(s)):
if s[i] not in dic:
dic[s[i]] = 1
else:
dic[s[i]] += 1
for i in s:
if dic[i] == 1:
return s.index(i)
return -1
print(many('aabcc'))
#count数组
|
SQL | WINDOWS-1251 | 2,228 | 3.46875 | 3 | [] | no_license |
PROMPT =====================================================================================
PROMPT *** Run *** ========== Scripts /Sql/BARS/function/nbs_vp.sql =========*** Run *** ===
PROMPT =====================================================================================
CREATE OR REPLACE FUNCTION BA... |
Shell | UTF-8 | 3,122 | 3.8125 | 4 | [
"MIT"
] | permissive | #!/bin/bash
set -xv
#adam-BL# . BonnLogger.sh
#adam-BL# . log_start
# CVSId: $Id$
# 30.06.2008 (AvdL):
# normalizes images by the highest mode value of the
# individual chips
# the script creates normaliced images.
# It puts the result into new directories ..._norm.
# The script assumes a threshhold. Pixels under
# t... |
Java | UTF-8 | 991 | 2.625 | 3 | [] | no_license | package de.stevenschwenke.java.javafx.workLifeBalance.client;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Holds all the data for one day.
*
* @author Steven Schwenke
*
*/
public class DayRecord {
private Long id;
private Date date;
private List<TimeReco... |
Markdown | UTF-8 | 990 | 3.40625 | 3 | [] | no_license | ---
title: "The :target pseudo-class"
date: 2018-04-27T14:50:03-04:00
draft: false
---
I just learned about the `:target` pseudo-class in CSS and it is pretty amazing. It targets the element with an id equal to the URL's fragment (the hash part at the end.) This can be used with plain old links to create features that... |
PHP | UTF-8 | 803 | 2.5625 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Filters;
use Atnic\LaravelGenerator\Filters\BaseFilter;
/**
* DatumFilter Filter
*/
class DatumFilter extends BaseFilter
{
/**
* Searchable Field
* @var array
*/
protected $searchables = [
'dataset' => [ 'name' ],
'parameter' => [ 'name' ],
'value'... |
Java | UTF-8 | 3,319 | 2.296875 | 2 | [
"Apache-2.0"
] | permissive | package org.medibloc.vc.verifiable.jwt;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.jwk.Curve;
import com.nimbusds.jose.jwk.ECKey;
import com.nimbusds.jose.jwk.gen.ECKeyGenerator;
import org.junit.Test;
import org.medibloc.vc.VerifiableCredentialException;
import org.medibloc.vc.model.Presentation... |
SQL | UTF-8 | 862 | 3.796875 | 4 | [
"MIT"
] | permissive | SELECT COUNT(*) FROM books;
SELECT released_year, COUNT(*) FROM books GROUP BY released_year;
SELECT SUM(stock_quantity) FROM books;
SELECT CONCAT(author_fname, ' ', author_lname) AS author, AVG(released_year)
FROM books
GROUP BY author;
SELECT CONCAT(author_fname, ' ', author_lname) AS full_name
FROM books
ORDER B... |
C# | UTF-8 | 1,927 | 2.828125 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace SuperFastDB.Data
{
public class FastDBTransaction : IDbTransaction
{
public IDbConnection Connection => throw new NotImplementedException();
public IsolationLevel IsolationLevel => throw new NotImp... |
Java | UTF-8 | 44,201 | 1.773438 | 2 | [] | no_license | import com.sun.org.apache.xpath.internal.operations.Bool;
import java.util.*;
public class SystemSetup {
// variable to convert map scale to real length
private final double METER_CONVERSION = 0.05;
public static Junction rootNode;
public static Junction J2, J5, J6, J7, J8, J9, J10, J11, J12, J13, ... |
Markdown | UTF-8 | 961 | 2.65625 | 3 | [] | no_license | # Bike-sharing_Multi-linear_Regression
• This project aims to classify the bikes rides based on the different attributes from the given data.
• The algorithms used for this regression dataset is Multi-Linear Regression which is implemented using R programming and it's libraries.
• The code is present in Bike-Sharing_... |
JavaScript | UTF-8 | 1,652 | 2.84375 | 3 | [] | no_license | $(document).ready(function() {
// MENU
function toggleNav() {
var mainNav = $('.main-nav');
var content = $('.content');
var navLinks = $('.main-nav ul li span');
var logoWord = $('.word');
mainNav.mouseover(function() {
$(this).addClass("nav-toggle");
navLinks.addClass("hide");
logoWord.addClass... |
Java | UTF-8 | 2,451 | 2.5625 | 3 | [] | no_license | package edu.ou.spacewar.objects;
import edu.ou.mlfw.gui.Shadow2D;
import edu.ou.spacewar.objects.shadows.BulletShadow;
import edu.ou.spacewar.simulator.Object2D;
import edu.ou.utils.Vector2D;
public class Bullet extends Object2D {
public static final float BULLET_RADIUS = 2;
public static final float... |
Shell | UTF-8 | 3,432 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/bash
# Copyright 2018 Ryohei Kamiya <ryohei.kamiya@lab2biz.com>
#
# 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 b... |
Java | UTF-8 | 422 | 1.96875 | 2 | [] | no_license | package com.course.mvc.service;
import java.util.Map;
/**
* Created by Admin on 10.06.2017.
*/
public interface WebSocketService {
void saveBroadcastMessage(String broadcastMessage, String senderLogin);
Map<String,String> getMessagesByLogin(String receiverLogin);
Map<String,String> getBroadcastMessages(... |
PHP | UTF-8 | 2,525 | 2.6875 | 3 | [] | no_license | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="../css/foundation.css" />
<script type="text/javascript">
<!--
function ValidateCreate() {
var today1 = new Date().getDate(),
today... |
JavaScript | UTF-8 | 366 | 3.09375 | 3 | [] | no_license | //function statement named zeroFuel with parameters
//distanceToPump, mpg, fuelLeft
const zeroFuel = (distanceToPump, mpg, fuelLeft)=> {
//if mpg times fuelLeft greaterequal distanceToPump
if (mpg * fuelLeft >= distanceToPump){
//return true
return true
//else
}else{
//re... |
C# | UTF-8 | 2,534 | 2.5625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Driver.Builders;
namespace Repository
{
public class MongoProvider : IMongoProvider
{
private readonly IMongoDatabase _database;
private string _collectionName... |
C++ | UTF-8 | 1,782 | 2.640625 | 3 | [
"MIT"
] | permissive | /*
Acknowledgment of code on HTTP POSTing:
Complete project details at Complete project details at https://RandomNerdTutorials.com/esp32-http-get-post-arduino/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files.
The above copyrigh... |
Python | UTF-8 | 3,044 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | from contextlib import contextmanager
from bentoml.exceptions import LockUnavailable
import logging
import random
import time
from bentoml.yatai.db.stores.lock import LockStore, LOCK_STATUS
logger = logging.getLogger(__name__)
# enum of read or write lock
class LockType:
READ = LOCK_STATUS.read_lock
WRITE ... |
C | GB18030 | 2,987 | 2.53125 | 3 | [] | no_license | /*
* inf.c
*
* Created on: 2018119
* Author: Jack
*/
#include"inf.h"
extern unsigned char RECV_FLAG;
extern unsigned char ircode[4];
extern unsigned char data[33];
extern unsigned char VALUE;
/*
* ƣinfrared_decode()
* ܣ
*
* ֵ
*/
void infrared_decode()
{
if(RECV_FLAG == 1) //ɹյһݣ33½ش... |
Java | UTF-8 | 2,099 | 2.4375 | 2 | [] | no_license | package com.ubb.gymapp;
import static org.hamcrest.CoreMatchers.hasItems;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.contains;
import java.util.Array... |
Ruby | UTF-8 | 1,206 | 2.90625 | 3 | [
"MIT"
] | permissive | module PCBR
class Error < RuntimeError
# def initialize body
# super "#{Module.nesting[1]} error: #{body}"
# end
end
def self.new &block
Storage.new &block
end
class Storage
attr_reader :table
attr_reader :set
@@default_lambda = lambda do |a_, b_|
raise Error.new "compari... |
C++ | UTF-8 | 1,988 | 3.65625 | 4 | [] | no_license | //bysouffle
/**
实验2.4队列的链式表示和实现
编写一个程序实现链队列的各种基本运算,并在此基础上设计一个主程序,完成如下功能:
(1)初始化并建立链队列。
(2)入链队列。
(3)出链队列。
(4)遍历链队列。
**/
#include<stdio.h>
#include<stdlib.h>
#define OK 1
#define ERROR 0
#define OVERFLOW -2
typedef struct QNode
{
int data;
struct QNode *next;
}QNode, *QueuePtr;
typedef stru... |
Java | UTF-8 | 255 | 1.507813 | 2 | [] | no_license | package operator.services.api;
import operator.entities.AccessLevel;
/**
* Created by Artyom Karnov on 8/27/16.
* artyom-karnov@yandex.ru
**/
/**
* Interface for AccessLevelService
*/
public interface AccessLevelService extends GenericService<AccessLevel, Integer> {
}
|
JavaScript | UTF-8 | 289 | 2.515625 | 3 | [] | no_license | import { ERROR, CLEAR_ERROR} from '../constants/actionTypes';
const errorReducer = (state = null, action) => {
switch(action.type) {
case ERROR:
return action.error;
case CLEAR_ERROR:
return null;
default: return state;
}
};
export default errorReducer; |
SQL | UTF-8 | 776 | 3.34375 | 3 | [
"MIT"
] | permissive |
USE employee_tracker;
INSERT INTO department(name)
VALUES
('Management')
, ('Sales')
, ('Engineering')
, ('Finance')
, ('legal');
INSERT INTO role(title, salary, department_id)
VALUES
('Legal Team Lead', 200000, 1)
, ('Lawyer', 150000, 2)
, ('Lead Engineer', 125000, 3)
, ('A... |
Markdown | UTF-8 | 4,899 | 3.640625 | 4 | [] | no_license | ## IIFE와 비동기적 코드
[6장](../CHAPTER_6/preview.md)에서 <b>IIFE(즉시 호출하는 함수 표현식)</b>에 대해 알아봤습니다. IIFE를 이용해서 클로저를 만들 수 있다는 것도 알았습니다. 이제 IIFE로 비동기적 코드를 처리하는 중요한 예제를 하나 살펴봅시다. 이 예제는 14장에서 다시 살펴보게 될 겁니다.
IIFE를 사용하는 사례 중 하나는 비동기적 코드가 정확히 동작할 수 있도록 새 변수를 새 스코프에 만드는 겁니다. 5초에서 시작하고 카운트다운이 끝나면 "go"를 표시하는 고전적 타이머 예제를 만들어 봅시다. 이 코드는 자바스... |
C# | UTF-8 | 4,461 | 3.34375 | 3 | [] | no_license | using System;
namespace Sampan.Common.Extension
{
public static class DateTimeExtension
{
/// <summary>
/// 一年的第一天
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
public static DateTime FirstDayOfYear(this DateTime date)
{
... |
Java | UTF-8 | 530 | 2.8125 | 3 | [] | no_license | package com.two95.cards;
import java.util.List;
public class Suites {
private String cardName;
private String colour;
private List<CardValue> cardValue;
public Suites() {
}
public Suites(String cardName, String colour, List<CardValue> cardValue) {
super();
this.cardName = cardName;
... |
Java | UTF-8 | 6,365 | 1.90625 | 2 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | package vn.evolus.castr;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.MediaRouteChooserDialog;
import android.support.v7.media.MediaControlIntent;
import... |
Python | UTF-8 | 1,182 | 3.40625 | 3 | [] | no_license | class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
#recursion method
def maxDepth(self, root: TreeNode) -> int:
if not root :
return 0
else:
return 1+max(self.maxDepth(root.left),self.maxDepth... |
Python | UTF-8 | 788 | 3.203125 | 3 | [] | no_license | #use libarary
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn import metrics
from sklearn.tree import DecisionTreeClassifier
from sklearn import datasets
import matplotlib.pyplot as plt
import pandas as pd
#read datasets
data=pd.read_csv('diabetes.csv')
#split data
f... |
PHP | UTF-8 | 1,378 | 2.75 | 3 | [
"MIT"
] | permissive | <?php
namespace PlanBundle\Schedule\Common\Logger;
use Symfony\Bridge\Monolog\Logger as Monolog;
class SchedulerLogger
{
private $logger;
private $options;
public function __construct(Monolog $monolog, array $options = array())
{
$this->logger = $monolog;
$this->options = $options;
... |
C# | UTF-8 | 1,325 | 3.015625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
namespace SerializeHome
{
class Program
{
static void Main(string[] args)
{
string file = "book... |
Swift | UTF-8 | 3,105 | 2.71875 | 3 | [] | no_license | //
// FlickrAPIController.swift
// SwiftFlickrSearcher3
//
// Created by suraj poudel on 26/07/2016.
// Copyright © 2016 suraj poudel. All rights reserved.
//
import Foundation
import UIKit
public class FlickrAPIController{
public typealias FlickrAPICompletion = (success:Bool,resultsDictionary:[String:An... |
Markdown | UTF-8 | 688 | 2.578125 | 3 | [] | no_license | ---
id: gen
title: Generate Key
sidebar_label: gen
---
# gen
The `gen` command generates an ed25519 key pair.
## Usage
```bash
kit key gen [options]
```
```bash
Usage:
kit key gen [flags]
Flags:
-h, --help help for gen
-s, --seed int Provide a strong seed (not recommended)
```
## Options
* `-s, --... |
Java | ISO-8859-1 | 954 | 3.75 | 4 | [] | no_license | package controle;
import java.util.Scanner;
public class DesafioSemana {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
System.out.println("Digite o dia da semana: ");
String dia = entrada.next();
if(dia.equalsIgnoreCase("Domingo")) {
System.ou... |
Java | UTF-8 | 523 | 1.867188 | 2 | [
"Apache-2.0"
] | permissive | package com.uaa.ponzi.dto;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
@Data
public class SysPermissionNewDto {
@NotEmpty(message = "请填写权限名称")
private String permissionName;
@NotEmpty(message = "请填写权限代码")
private String permissionCode;
... |
Java | UTF-8 | 1,475 | 2.421875 | 2 | [
"MIT"
] | permissive | package me.coderleo.chitchat.client.packethandlers;
import javafx.application.Platform;
import me.coderleo.chitchat.client.packethandlers.auth.PacketLoginResponseHandler;
import me.coderleo.chitchat.client.packethandlers.auth.PacketRegisterResponseHandler;
import me.coderleo.chitchat.common.api.Packet;
import java.ut... |
Java | UTF-8 | 92 | 1.953125 | 2 | [] | no_license | package composite.pattern.demo;
public interface ITeacher {
public String getDetails();
}
|
C | UTF-8 | 789 | 3.03125 | 3 | [] | no_license | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
void handle(int sig)
{
if (SIGINT == sig)
{
sigset_t set;
sigset_t old;
sigemptyset(&set);
sigaddset(&set, SIGTSTP);
sigaddset(&set, SIGQUIT);
//sigprocmask(SIG_BLOCK, &set, NULL);
sigprocmask(SIG_BLOC... |
C | UTF-8 | 443 | 3.21875 | 3 | [] | no_license | #include "hash_tables.h"
/**
* hash_table_create - that function create a new node
* @size: length of the table
* Return: a new node
*/
hash_table_t *hash_table_create(unsigned long int size)
{
hash_table_t *new;
new = malloc(sizeof(hash_table_t));
if (new == NULL)
{
return (NULL);
}
new->array = callo... |
TypeScript | UTF-8 | 6,568 | 2.75 | 3 | [
"MIT"
] | permissive | import { ValidationTrigger } from "../src/constants/validationTrigger";
import { field } from "../src/fields/FieldCreatorInstance";
import { FormConfig } from "../src/form-config/FormConfig";
import { FormConfigHelper } from "../src/form-config/FormConfigHelper";
import { setTrigger } from "./test-utils/setTrigger";
c... |
Shell | UTF-8 | 101 | 2.546875 | 3 | [] | no_license | #!/bin/bash
#set -x
#set -e
echo="name is name"
var=5
set -x
echo $var
set +x
test = 10
echo "test" |
Python | UTF-8 | 1,401 | 2.828125 | 3 | [] | no_license | # with문을 사용하여 close 처리 및 기타 닫는 부분 보정
# 비정상 종료를 없애고 -> try~
# 정상적인 처리 부분의 틀을 완성했다
import pymysql as my
connection = None
try:
connection = my.connect(host='localhost', # 디비 주소
user='root', # 디비 접속 계정
password='12341234', # 디비 접속 비번
db=... |
Python | UTF-8 | 112 | 3.3125 | 3 | [] | no_license | #print.py
#此示例示意print的用法和关键字参数的作用
print()
print(1,2,3,4)
print(1,2,3,4,sep='') |
Python | UTF-8 | 4,395 | 3.3125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import re
from basic.bupt_2017_11_28.type_deco import prt
import joblib
from sklearn import preprocessing
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from basic.bupt_2017_11_28.type_deco import pr... |
Ruby | UTF-8 | 338 | 3.421875 | 3 | [] | no_license | class Book
def title=(input)
expect_array=["and","in","the","of","a","an"]
not_first_word=false
input_array=input.split(" ")
input_array.each do |x|
if(!expect_array.include?(x))||(not_first_word==false)
x.capitalize!
not_first_word=true
end
end
@title=input_array.join(" ")
end
def title
... |
C | UTF-8 | 4,162 | 3.21875 | 3 | [] | no_license |
#include <mpi.h>
#include <stdio.h>
#include <math.h>
#include<string.h>
/*
mcd (Maximo Comun Divisor)
Descripcion: Funcion que devuelve el maximo comun divisor de 2 numeros.
El intervalo sera de 134217728 a 4294967295 para poder hacer uso de unsigned ints
*/
unsigned long long int mcd(unsigned long long int a, u... |
C++ | UTF-8 | 1,437 | 2.765625 | 3 | [] | no_license |
#include <cmath>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
const int N = 500005;
const int M = N << 1;
using namespace std;
inline int read()
{
int x=0,f=1;char ch = getchar();
while(ch < '0' || ch > '9'){if(ch == '-')f=-1;ch = getchar();}
while(ch >='0' && ch <='9'){x=(x<<1)+... |
Java | UTF-8 | 34,340 | 1.65625 | 2 | [] | no_license | package aidc.aigui.box;
/* $Id$
*
* :Title: aigui
*
* :Description: Graphical user interface for Analog Insydes
*
* :Author:
* Adam Pankau
* Dr. Volker Boos <volker.boos@imms.de>
*
* :Copyright:
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU... |
Java | UTF-8 | 466 | 2.15625 | 2 | [] | no_license | package dto;
public class DocumentStatisticsDto {
private int wordsQuantity;
private long indexTime;
public DocumentStatisticsDto() {
}
public void setWordsQuantity(int wordsQuantity) {
this.wordsQuantity = wordsQuantity;
}
public int getWordsQuantity() {
return wordsQuantity;
}
... |
C++ | UTF-8 | 1,785 | 3.171875 | 3 | [] | no_license | #include "stdafx.h"
#include <iostream>
#include <string>
#include <thread>
#include <chrono>
#include <mutex>
#include <condition_variable>
using namespace std;
std::mutex m;
std::condition_variable cv;
const int MAX_SIGNALS = 4; //Max signals count
const int MAX_STOP = 10; //Signal program max stop c... |
Markdown | UTF-8 | 1,548 | 3.65625 | 4 | [
"Apache-2.0"
] | permissive | # 方阵中战斗力最弱的 K 行
给你一个大小为 m * n 的方阵 mat,方阵由若干军人和平民组成,分别用 0 和 1 表示。
请你返回方阵中战斗力最弱的 k 行的索引,按从最弱到最强排序。
如果第 i 行的军人数量少于第 j 行,或者两行军人数量相同但 i 小于 j,那么我们认为第 i 行的战斗力比第 j 行弱。
军人 总是 排在一行中的靠前位置,也就是说 1 总是出现在 0 之前。
示例 1:
``` javascript
输入:mat =
[[1,1,0,0,0],
[1,1,1,1,0],
[1,0,0,0,0],
[1,1,0,0,0],
[1,1,1,1,1]],
k = 3
输出:[2,0,3]
... |
Markdown | UTF-8 | 1,022 | 3.125 | 3 | [] | no_license | # Dicee 🎲
## Goal
The objective of this app is to lern the core programming concepts that form the foundation of most of the apps. This app teaches how to make apps with functionality using setState() inside Stateful Flutter widgets.
## What I create
I did a a Las Vegas dice app. You can make the die roll at the ... |
Markdown | UTF-8 | 1,456 | 2.96875 | 3 | [] | no_license | ---
title: Android 调用PowerManager 实现延时锁屏
---
今天公司项目有一个需求,就是再语音通话过程中保持聊天界面屏幕常亮。于是查阅资料,发现使用Android 的 *WakeLock* 机制可以很轻松的实现。
首先我们要清楚,在手机锁屏的时候,android 系统为了达到省电的和减少CPU的消耗,在锁屏的一段时间后进入休眠的状态,这时候Android 的CPU会保持在一个功耗较低状态。那么如何在Android 休眠的状态执行消息的接收并且点亮屏幕呢?
直接上代码:
```java
WakeLock wakeLock = null;
//获取电源锁,保持该服... |
Ruby | UTF-8 | 482 | 3.703125 | 4 | [] | no_license | def fibs (n)
if (n == 0)
""
else
first = 0
second = 1
third = second
total = []
n.times do
total.push(first)
first = second
second = third
third = first + second
end
total
end
end
def fibs_rec (ary, n)
if (n == 0)
return ary
end
if (n == 1)
ar... |
TypeScript | UTF-8 | 5,261 | 2.546875 | 3 | [] | no_license | import path from "path";
import fs from "fs";
import { getMocks } from "./get_mocks";
export function mockExternalComponents(component: any): void;
export function mockExternalComponents(componentPath: string, testPath?: string): void {
if (!componentPath || !testPath) {
throw new Error("Either babel plugi... |
Python | UTF-8 | 1,070 | 2.65625 | 3 | [] | no_license | import numpy as np
import cv2
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
smile_cascade = cv2.CascadeClassifier('haarcascade_smile.xml')
def detectFunct(img):
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_cascade.... |
Markdown | UTF-8 | 1,819 | 2.671875 | 3 | [] | no_license | # 科学网—一本书换一所房子 - 李泳的博文
# 一本书换一所房子
已有 3044 次阅读2013-6-8 08:53|个人分类:[札记](http://blog.sciencenet.cn/home.php?mod=space&uid=279992&do=blog&classid=113747&view=me)|系统分类:[人文社科](http://blog.sciencenet.cn/home.php?mod=space&do=blog&view=all&uid=279992&catid=10)
**——旧札新钞(141)**
@ **赵萝蕤**... |
JavaScript | UTF-8 | 563 | 3.515625 | 4 | [] | no_license | var arreglo = [0,5,10,1000];
console.log(arreglo);
//push nos va a permitir agregar un valor al final de nuestro arreglo
arreglo.push(9);
console.log(arreglo);
arreglo.push(90);
console.log(arreglo);
console.log("Vamos a retirar valores del arreglo")
//El método pop no va a permitir quitar un elemento del arreg... |
JavaScript | UTF-8 | 1,093 | 2.765625 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Room {
constructor(__capacity, name) {
this.__capacity = __capacity;
this.name = name;
this._capacity = __capacity;
this._name = name;
}
add(socket) {
console.log('capacity : ', this._c... |
Python | UTF-8 | 1,050 | 2.828125 | 3 | [] | no_license | from wpilib.command.command import Command
from wpilib.joystick import Joystick
from subsystems.Grabber import Grabber
class GrabberMoveWithPOV(Command):
GRABBER_SPEED_UP = 0.7
GRABBER_SPEED_DOWN = -0.4
first_stop = False
grabber: Grabber
joystick: Joystick
def __init__(self, grabber: Grabber... |
Java | UTF-8 | 319 | 1.640625 | 2 | [] | no_license | package com.buzz.exception;
public class CommonException extends Exception {
/**
*
*/
private static final long serialVersionUID = -6256717472813064682L;
public CommonException() {
// TODO Auto-generated constructor stub
}
public CommonException(String arg0) {
super(arg0);
}
}
|
Python | UTF-8 | 1,341 | 2.75 | 3 | [
"MIT"
] | permissive | """Script that uses scikit-bio to convert fasta files to fastq files."""
import argparse
from skbio import io as skbio_io
def main():
"""Main function."""
args = parse_args()
if args.output.endswith('.gz'):
compression = 'gzip'
else:
compression = 'auto'
with skbio_io.open(arg... |
C++ | UTF-8 | 3,794 | 3.71875 | 4 | [] | no_license | /*
Program: Adventure Map
Author: Jason Custodio
Class: CS202
Date: 04/16/2014
Description: This program simulates a math riddle game
There will be a menu class that acts as an interface
A player roster will be implemented in the future
... |
C++ | GB18030 | 1,423 | 3.453125 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
//
class Animal
{
public:
int m_Age; //
};
//Animal Ϊ
//virtual ؼ̳֮ΪΪ ̳
//
class Sheep :virtual public Animal {};
//
class Tuo :virtual public Animal {};
//
class SheepTuo :public Sheep, public Tuo {};
void test01()
{
//μ̳еһ⣺游ԣʹʱжԣԽ
//μ̳е... |
Markdown | UTF-8 | 23,616 | 3.546875 | 4 | [
"MIT"
] | permissive | ---
layout: post
title: 第十四章 STL算法第一节
category: CPP基础
tags: CPP基础
description: CPP基础
---
## 算法简介
1. 算法概述
1. 算法部分主要由头文件`<algorithm>`,`<numeric>`和`<functional>`组成。
2. `<algorithm>`是所有STL头文件中最大的一个,其中常用到的功能范围涉及到:比较、交换、查找、遍历操作、复制、修改、反转、排序、合并等等
3. `<numeric>`体积很小,只包括几个在序列上面进行简单数学运算的模板函数,包括加法和乘法在序列上的一些操作。
... |
Java | UTF-8 | 588 | 2.46875 | 2 | [] | no_license | package com.mycompany.serverside.business;
import com.mycompany.serverside.data.Stone;
/**
* The ThreeStonesServerGameDAO defines the rules that any implementation of a
* Three Stones server-side game logic class must follow.
*
* @author Hannah Ly
* @author Werner Castanaza
* @author Peter Bellefleur MacCaul... |
PHP | UTF-8 | 2,031 | 2.515625 | 3 | [] | no_license | <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=windows-874″ />
<title>สร้าง Form สำหรับค้นหาข้อมูล</title>
</head>
<body b... |
Java | UTF-8 | 1,312 | 2.453125 | 2 | [] | no_license | package com.khalimudin;
import com.khalimudin.resources.HelloResource;
import com.khalimudin.health.TemplateHealthCheck;
import io.dropwizard.Application;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
public class HelloDropwizardApplication extends Application<HelloDropwizardConfigurat... |
JavaScript | UTF-8 | 456 | 3.28125 | 3 | [] | no_license |
pseudoElt = document.getElementById("pseudo");
/*
elmtPseudo.value = "douze";*/
// Affichage d'un message contextuel pour la saisie du pseudo
pseudoElt.addEventListener("focus", function () {
document.getElementById("aidePseudo").textContent = "Entrez votre pseudo";
});
// Suppression du message contextuel pour ... |
C# | UTF-8 | 7,271 | 3.5 | 4 | [] | no_license | using System;
namespace laba3
{
class Program
{
static void Main(string[] args)
{
}
static void Task1_2()
{
int fir = 0, last = 0;
int n = Convert.ToInt32(Console.ReadLine());
double[] arr = new double[n];... |
PHP | UTF-8 | 471 | 2.84375 | 3 | [
"MIT"
] | permissive | <?php
namespace NewsReader\Contracts;
interface NewsReaderInterface
{
/**
* @param $url
* @return mixed
*/
public function setUrl($url);
/**
* @param $queryString
* @return mixed
*/
public function with($queryString);
/**
* @return mixed
*/
public func... |
JavaScript | UTF-8 | 1,931 | 2.921875 | 3 | [] | no_license | document.addEventListener('DOMContentLoaded', function(){
// Size options
const sizesBtns = document.querySelectorAll('.card__size');
function changeActiveSize(e) {
if(e.target.classList.contains('active')){
return;
}
sizesBtns.forEach(btn => {
if(btn.classList.contains('active')) {
btn.classList.r... |
C++ | UTF-8 | 888 | 3.015625 | 3 | [] | no_license | ///
/// @file Condition.cc
/// @author patrick(730557219@qq.com)
/// @date 2016-03-04 21:26:17
///
#include "Condition.h"
//由于该实现文件是真正要使用MutexLock函数,即跟实现有关系了,故加上头文件
#include "MutexLock.h"
Condition::Condition(MutexLock & lock)//类外实现函数
: _mutex(lock)//由于是引用,必须在初始化列表中进行初始化
{
pthread_cond_init(&_cond, NUL... |
Java | UTF-8 | 2,582 | 2.34375 | 2 | [] | no_license | package br.com.mvppoa.kafka.retries.config;
import com.hazelcast.config.Config;
import com.hazelcast.config.EvictionPolicy;
import com.hazelcast.config.MapConfig;
import com.hazelcast.config.MaxSizeConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import lombok.extern.slf4j.Slf4... |
Python | UTF-8 | 2,096 | 3.59375 | 4 | [] | no_license | import utils
# heap
# array A, with A[0] used to store size(A)
def parent(i): return i/2
def left(i): return 2*i
def right(i): return 2*i+1
def check_heap(A,i):
if (i==0 or i>A[0]):
return True
if (i==1):
return check_heap(A,left(i)) and check_heap(A,right(i))
else:
return (A[i]<=A[parent(i)]) and check_h... |
Python | UTF-8 | 2,003 | 2.578125 | 3 | [
"MIT"
] | permissive | import appdaemon.plugins.hass.hassapi as hass
class LowBattery(hass.Hass):
def initialize(self):
# Init an empty dict in the global_vars, used for storing data
self.global_vars['battery'] = {}
# Iterate over the entity list, setting listeners, etc.
for entity in self.args.get('ent... |
Markdown | UTF-8 | 288 | 3.375 | 3 | [] | no_license | ---
title: Log in Python
updated: '2021-09-10 08:00:39'
reference: ''
tags:
- python
- programming
---
In python, we should use `math.log10` instead of `math.log` for better float number processing:
```python
math.log(243, 3) #4.9999999999
math.log10(243) / math.log10(3) # 5.0
```
|
Java | UTF-8 | 841 | 2.046875 | 2 | [] | no_license | package ek.zhou.crm.web.interceptor;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import ek.zhou.crm.domain.User;
public class PrivilegeInte... |
Python | UTF-8 | 886 | 3.671875 | 4 | [] | no_license | try:
print('Proporcione los siguientes datos del libro:')
name = input('Proporciona el nombre: ')
id = int(input('Proprociona el ID: '))
precio = float(input('Proporcione el precio: '))
envio = input('Indica si el envio es gratuito (True/False): ')
if envio == "True":
envio = True
e... |
C# | UTF-8 | 462 | 2.859375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Extensions;
namespace ShiftArray
{
class Program
{
static void Main()
{
var collection = new List<int>().FillOrdered(10);
collection.ShiftRight(3);
... |
Python | UTF-8 | 2,238 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import gensim
import numpy as np
from nltk.corpus import stopwords
from math import sqrt
import _pickle as pickle
stopword = set(stopwords.words('english'))
def cosine_similarity(v1, v2):
dist = np.dot(v1, v2) / sqrt(np.dot(v1, v1) * np.dot(v2, v2))
return dist
def ge... |
Go | UTF-8 | 424 | 2.65625 | 3 | [] | no_license | package main
import (
"cflog/functions"
"flag"
)
func main() {
var date string
var hour int
flag.StringVar(&date, "d", "", "Date for the log in format: 2019-01-24")
flag.IntVar(&hour, "h", 0, "Starting hour for the log, Only the hour: example: 12, 20, 23, 00, 1, 2 ,3.. etc , If hour is not specified 00:00 is... |
Java | UTF-8 | 1,756 | 3.953125 | 4 | [
"Apache-2.0"
] | permissive | package competitive.programming.timemanagement;
/**
* @author Manwe
*
* Time management class in order to measure elapsed time and avoid time outs
* The Timer class uses the System.nanoTime() method to get the time. It is not executed in a separated thread, you must use the timeCheck method in order to ver... |
Java | UTF-8 | 2,040 | 3.40625 | 3 | [] | no_license | /**
* NinjaBookShelf was created by Phillip Feist
* Using the NetBeans IDE 7.2.1
* For the Zappos TechU Coding Challenge
* Thanks for viewing!
**/
package ninjabookshelf;
import java.util.Arrays;
import javax.swing.JOptionPane;
/**
* @author Phil Feist
*/
public class NinjaBookShelf {
public static void ma... |
Python | UTF-8 | 5,632 | 2.765625 | 3 | [
"BSD-3-Clause",
"BSD-3-Clause-Open-MPI"
] | permissive | #!/usr/bin/env python
## category General
## desc Find and mark PCR duplicates
## experimental
'''
For a BAM file, find and mark all possible PCR duplicates. This is meant to be
used primarily with paired-end reads, since these have better resolution to
verify that we care seeing a legitimate PCR duplicate and not just... |
C++ | UTF-8 | 3,146 | 2.75 | 3 | [
"BSD-2-Clause"
] | permissive | #include "themehandler.hpp"
CThemeHandler::CThemeHandler()
{
}
CThemeHandler::~CThemeHandler()
{
}
void CThemeHandler::ReadDir(const char *dir, CLinkedList *list)
{
file_t d;
dirent_t *de(NULL);
char* tmp;
d=fs_open(dir,O_RDONLY|O_DIR);
while((de=fs_readdir(d)))
{
tmp=new char[strlen(dir)+strlen(de->name)+5]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.