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 | 8,153 | 3.03125 | 3 | [] | no_license | from team01 import*
print("=====Process Scheduling=====")
print("Please Choose CPU scheduling technique")
print("1.Non-Preemptive Scheduling\n2.Preemptive Scheduling ")
choose_algorithm = int(input("Choose Scheduling (1/2): "))
if choose_algorithm ==1 :
print("Non-Preemptive Scheduling")
print("====Process Sch... |
Java | UTF-8 | 600 | 2.71875 | 3 | [] | no_license | /**
* Objeto.java
*
* Created on 03-11-2014 09:15 AM
*
*/
public class Objeto {
private Individuo genes;
private int valor =0;
private String nombre;
public void setIndividuo(Individuo ind){
genes=ind;
}
public Individuo getIndividuo (){
return genes;
}
public void setNombre(String nombre){
... |
C# | UTF-8 | 953 | 2.84375 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | using System;
using System.Configuration;
namespace ConfigurationManagerExample
{
public sealed class CustomSection : ConfigurationSection
{
[ConfigurationProperty("name", DefaultValue = "Contoso", IsRequired = true, IsKey = true)]
public string Name
{
get { return (string)... |
Python | UTF-8 | 994 | 3.203125 | 3 | [] | no_license | import tkinter as tk
from tkinter import *
import tkinter.font as tkFont
class Window(tk.Frame):
def __init__(self):
tk.Frame.__init__(self, width=30, height=20, bg='white')
self.grid()
self.create_widgets()
def create_widgets(self):
font2 = tkFont.Font(size = 16, family = "華康POP3體W12(P)")
self.image = tk.... |
PHP | UTF-8 | 2,573 | 3.078125 | 3 | [
"MIT"
] | permissive | <?php
session_start();
include("config.php");
// menambah barang ke cart
if (isset($_POST["add_to_cart"])) {
// tampung kode_buku dan jumlah Beli
$kode_buku = $_POST["kode_buku"];
$jumlah_beli = $_POST["jumlah_beli"];
// ambil data buku dari database sesuai
// dengan kode buku yang dipilih
... |
Java | UTF-8 | 1,289 | 3.3125 | 3 | [] | no_license | package week07;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author : admin
* @version V1.0
* @Project: leecode
* @Package week07
* @Description: 1eecode15 三数之和
* @date Date : 2021年05月22日 13:07
*/
public class ThreeSum {
public List<List<Integer>> threeSum(int[] nums)... |
C# | UTF-8 | 7,898 | 2.578125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Syst... |
Python | UTF-8 | 8,133 | 2.6875 | 3 | [] | no_license | import A
from sklearn.feature_extraction import DictVectorizer
import nltk
from nltk.tokenize import RegexpTokenizer,WhitespaceTokenizer
from nltk.corpus import stopwords
from nltk.stem.lancaster import LancasterStemmer
from collections import defaultdict
import math
from sklearn import svm
from sklearn import neighbo... |
Markdown | UTF-8 | 1,921 | 2.984375 | 3 | [] | no_license | ## ACH System
## Chargebacks
## Interchange
Fee paid between banks for the acceptance of card based transactions.
Usually for sales/services transactions it is a fee that a merchant's bank (the "acquiring bank") pays a customer's bank (the "issuing bank"); and for cash transactions the interchange fee is paid from t... |
JavaScript | UTF-8 | 1,250 | 3.21875 | 3 | [
"MIT"
] | permissive | //Last Version
var agent ={};
agent.runAgent = function(callback){
console.log('Hello World!');
setTimeout(function(){
callback(null,true);
},3000);
};
agent.moveDevices = function(){
return "random";
};
module.exports = agent;
//version 003
exports.runAgent = function(){
console.log('Example 001 with API');
... |
Python | UTF-8 | 1,155 | 4.15625 | 4 | [] | no_license | def say_yeah(name, age):
print("やあ、 " + name + "。あなたは、" + str(age) + "歳だったよね。")
say_yeah("かずき",41)
say_yeah("きん",109)
def cube(num):
return num*num*num
result = cube(5)
print(result)
def exception_test(value_1, value_2):
print('☆☆開始☆☆')
result = 0
try:
result = value_1 + value_2
... |
Markdown | UTF-8 | 474 | 2.640625 | 3 | [] | no_license | #### IOClass
###### 类 IOClass
父类:`Object`
##### 方法
###### IOClass.Close()
关闭。
###### IOClass.Flush()
刷新。
###### IOClass.GetFilePos()
获取文件位置。
###### IOClass.GetFileSize()
获取文件大小。
###### IOClass.Read()
读取。
###### IOClass.ReadLine()
读取行。
###### IOClass.Seek()
移动游标。
###... |
Java | UTF-8 | 4,356 | 3.796875 | 4 | [] | no_license | package weeksix;
import java.util.Scanner;
import java.util.Stack;
public class BalancedParethesis {
static class stack {
int top=-1;
char items[] = new char[100];
void push(char x)
{
if (top == 99)
{
System.out.println("Stack full... |
Markdown | UTF-8 | 757 | 2.78125 | 3 | [] | no_license | Damazon
Damazon is a basic e-commerce storefront created using a MySQL database and a javascript node application.
Customers are presented with a list of items, prices and quantities available and are prompted to enter the ID number of the item they wish to purchase as well as the number of units of each item. See I... |
Swift | UTF-8 | 5,340 | 2.578125 | 3 | [] | no_license |
import UIKit
import CoreData
protocol AlertControllerDelegate {
func loaded(answerId: Int)
}
protocol ControllerReload {
func reloadCount()
}
class BasketViewController: UIViewController {
var copyBasketCoreData = BasketCoreData()
var product: Collections!
@IBOutlet weak var tableBasket... |
Rust | UTF-8 | 3,330 | 3.296875 | 3 | [
"MIT"
] | permissive | use core::convert::{TryFrom, TryInto};
use std::collections::HashMap;
use super::computer::*;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Position {
pub x: i64,
pub y: i64,
}
impl Position {
pub fn new(x: i64, y: i64) -> Position {
Position { x, y }
}
}
#[derive(Debug, Clon... |
Markdown | UTF-8 | 3,421 | 2.53125 | 3 | [
"MIT"
] | permissive | <div align="center">
<img src="assets/images/icon_new.png" alt="Chatify" width="70">
# Chatify
[](https://flutter.dev/docs)
[](ht... |
Markdown | UTF-8 | 3,294 | 2.65625 | 3 | [] | no_license | # download-celebA-HQ
Python script to download and create the celebA-HQ dataset.
**WARNING from the author.** I believe this script is broken since a few months (I have not try it for a while). I am really sorry about that. If you fix it, please share you solution in a PR so that everyone can benefit from it.
To get... |
Python | UTF-8 | 896 | 2.75 | 3 | [] | no_license | from PIL import Image
import numpy as np
import time
import psutil
#im = Image.open( "30_black.jpg" )
#array=np.array(im)
#im.show()
#print 'array.shape:',array.shape
for interval in xrange(0,30,5):
#add noise
#array = np.random.randint(50,size=[30,30])
#array=np.random.randint(50,size=[30,30])
array = np.zeros... |
Java | UTF-8 | 1,948 | 2.578125 | 3 | [] | no_license | package com.ruyicai.activity.buy.guess.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.View;
/**
* 带箭头的进度条
*
* @author yejc
*
*/
public class RectangularProgressBar extends V... |
Java | UTF-8 | 1,377 | 3.296875 | 3 | [] | no_license | import java.security.InvalidParameterException;
public class StudentUtil {
public static double[] calculateGPA(int[] studentIdList, char[][] studentsGrades) {
double[] result = new double[studentIdList.length];
int i = -1;
for (char[] studentGrades : studentsGrades) {
... |
JavaScript | UTF-8 | 8,880 | 2.703125 | 3 | [] | no_license | /* Lead author: Dora */
var mongoose = require('mongoose');
var ObjectId = mongoose.Schema.Types.ObjectId;
var User = require("./User.js");
var Loc = require("./Location.js");
/* Schema to represent the Event model */
var eventSchema = mongoose.Schema({
name: { type: String, required: true },
description: { t... |
Markdown | UTF-8 | 1,068 | 2.546875 | 3 | [] | no_license | # Swift Chat!
This tutorial is in progress... The steps you need to follow are very simple, and so they are inline in the code!
Download the code to get started:
```console
git clone https://github.com/exis-io/ExisChatSwift.git
cd ExisChatSwift
pod install
```
### Setup for your app
```console
open /ExisChatSwift/V... |
Python | UTF-8 | 1,002 | 3.484375 | 3 | [] | no_license | lst = []
dic = {}
step = 1
d = {"название": [], "цена": [], "количество": [], "ед": []}
product_quantity = int(input('Введите общее количество наименований товаров: '))
while product_quantity >= step:
n = input('Введите название товара: ')
p = int(input('Введите цену товара: '))
q = int(input('Вве... |
Markdown | UTF-8 | 642 | 2.6875 | 3 | [] | no_license | # Simple Todo CRUD App with Vue, Vuex, and Typescript
> Yeah, I know. Another Todo app. But hey, a todo app has all the basics of CRUD covered.
* Using [@michaelolof](https://github.com/michaelolof)'s repository [vuex-class-component](https://github.com/michaelolof/vuex-class-component) , I was able to create a simpl... |
Java | UTF-8 | 2,270 | 2.375 | 2 | [] | no_license | package ua.nure.hrabovska.SummaryTask4.web.command.user.enrollee;
import org.apache.log4j.Logger;
import ua.nure.hrabovska.SummaryTask4.database.dao.ApplicationDAO;
import ua.nure.hrabovska.SummaryTask4.database.entity.Enrollee;
import ua.nure.hrabovska.SummaryTask4.exception.DBException;
import ua.nure.hrabovska.Summ... |
Java | UTF-8 | 2,653 | 2.640625 | 3 | [] | no_license | package org.dimigo.servlet;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse... |
JavaScript | UTF-8 | 1,253 | 2.8125 | 3 | [] | no_license | export const UserReducer = (state, action) => {
switch (action.type) {
case 'SET_USER':
return {
...state,
users: [...state.users, ...action.payload],
isLoading: false
};
case 'CREATE':
return {
...s... |
Java | GB18030 | 1,305 | 2.28125 | 2 | [] | no_license | package com.gt.myshop.entities.user;
import java.util.Date;
/**
*
* @author Gongtao
* @date 2017-4-3 12:49:09
* @description ûϢ
*
*/
public class OnlineUserInfo {
private int olid; //û
private int uid; //ûid
private String sid; //ûsid
private String nickname; //ûdz
private String ip; //... |
Java | UTF-8 | 6,492 | 2.015625 | 2 | [] | no_license | package com.cdkj.core.ao.impl;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cdkj.core.ao.IPublicityAO;
import com.cdkj.core.bo.IPublicityBO;
import com.cdkj.core.bo.base.Paginable;
import com.cdk... |
Java | UTF-8 | 5,178 | 2.265625 | 2 | [
"Apache-2.0"
] | permissive | package org.lcsb.lu.igcsa.hbase.filters;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.filter.*;
import org.apache.hadoop.hbase.util.Bytes;
import org.lcsb.lu.igcsa.genome.Band;
import org.lcsb.lu.igcsa.genome.Location;
import org.lcsb.lu.igcsa.hbas... |
Python | UTF-8 | 227 | 3.328125 | 3 | [] | no_license | with open('Codeit/Chicken/chicken.txt', 'r', encoding='utf-8') as f:
total = 0
days = 0
for line in f:
line = line.strip().split(": ")
total += int(line[1])
days += 1
print(total / days) |
Ruby | UTF-8 | 925 | 4 | 4 | [] | no_license | # Pentagonal numbers are generated by the formula, P(n)=n(3n−1)/2. The first ten
# pentagonal numbers are:
# 1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ...
# It can be seen that P(4) + P(7) = 22 + 70 = 92 = P(8). However, their difference,
# 70 − 22 = 48, is not pentagonal.
# Find the pair of pentagonal numbers, P(j... |
Java | UTF-8 | 421 | 2.015625 | 2 | [] | no_license | package com.gizwits.lease.card.dto;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
public class CardDetailQueryDto {
@ApiModelProperty("卡券ID")
@NotNull(message = "cardId may not be null")
private String cardId;
public String getCardId() {
return... |
Markdown | UTF-8 | 3,044 | 3.109375 | 3 | [
"MIT"
] | permissive | # Essential Templating
Essential Templating is a set of libraries to render templated objects (like web pages, documents or emails).
- Allows to render complex objects from a single-file template.
- Provides easy to use template engine interface with C# 5.0 async methods.
- Unified template location (you can use file... |
C | UTF-8 | 678 | 3.515625 | 4 | [] | no_license | /* Напишете програма, която сравнява два файла, като отпечатва
първият ред на който се различават и на двата файла */
#include <stdio.h>
int main(void){
FILE *f1 = NULL;
FILE *f2 = NULL;
f1 = fopen("test.txt", "r");
f2 = fopen("test1.txt", "r");
int counter = 1;
if(NULL == f1 || NULL == f2)
... |
Java | UTF-8 | 1,320 | 2.4375 | 2 | [] | no_license | package com.dt.learning.adapter;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.dt.learning.R;
import java.util.ArrayList;
import java.util.List;
/**
* Created by... |
Python | UTF-8 | 20,012 | 3.40625 | 3 | [] | no_license | import numpy as np
import os
import json
import matplotlib.pyplot as plt
class Object(object):
"""
This class represents an AIDA object which is envisioned to be the parent of most of the AIDA related classes.
At a high level this class is a wrapper around a single dictionary object which provides sup... |
C++ | UTF-8 | 752 | 2.8125 | 3 | [] | no_license | class Solution {
public:
int trap(vector<int>& height) {
int total = 0;
int sz = height.size();
if (sz <=2 )
return total;
int leftmax[sz];
int rightmax[sz];
leftmax[0] = 0;
for (int i=1;i<sz;i++) {
l... |
Python | UTF-8 | 2,944 | 2.515625 | 3 | [] | no_license | __author__ = '@iRodGit'
def weigths2loss(Y):
"""This function calculates the weighted for imbalanced train set.
It returns a dictionary with the labels as keys and the weight are..."""
from numpy import unique
if len(unique(Y)) != 2:
raise ValueError("Y must have only two labels 0 and 1.")
... |
Python | UTF-8 | 901 | 3.046875 | 3 | [] | no_license | from mrjob.job import MRJob
import re
class partB3_Sorting(MRJob):
def mapper(self, _, line):
ds_row = line.split("\t") #split by tab
contract = ds_row[0] #get contract address
amount = ds_row[1] #get value
yield(None,(contract,int(amount))) #everything should go to the same reduce... |
Go | UTF-8 | 917 | 2.578125 | 3 | [] | no_license | package db
import (
"database/sql"
"log"
"os"
"testing"
_ "github.com/mattn/go-sqlite3"
)
func TestUpsertUserVoiceToken(t *testing.T) {
os.Remove("./test.db")
if db != nil {
db.Close()
}
var err error
db, err = sql.Open("sqlite3", "./test.db")
if err != nil {
log.Fatal(err)
}
defer func() {
db.Cl... |
C# | UTF-8 | 4,793 | 3.296875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using UnityEngine;
/**
* Base idea of what Achievements are
* Logan Hobbs
*
* Inspiration : https://unitylist.com/p/jdu/Achievements-Unity
*/
/// <summary>
/// Types of Achievements
/// Used for checking in Manager
/// </summary>
[Serializable]
public enum Achiev... |
C++ | UTF-8 | 415 | 3.125 | 3 | [] | no_license | #include <iostream>
using namespace std;
string month[12] = {"january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"};
int main() {
int year; cin>>year;
string mon; cin>>mon;
int res[12]={0,4,3,0,6,0,3,1,2,2,1,0};
for(int i=0;i<12;i++... |
Python | UTF-8 | 448 | 4.125 | 4 | [] | no_license | # continue 语句用以告诉 Python 跳过当前循环块中的剩余语句,并继续该循环的下一次迭代。
def for_continue():
while True:
s = input('Enter something : ')
if s == 'quit':
break
if len(s) < 3:
print('Too small')
continue
print('Input is of sufficient length')
# 自此处起继续进行其它任何处理
if __name__ ... |
PHP | UTF-8 | 354 | 2.953125 | 3 | [] | no_license | <?php
namespace Domain\Message;
final class Recipient
{
public function __construct($recipient)
{
if (!is_string($recipient)) {
throw new \LogicException('Recipient should be a string');
}
$this->recipient = $recipient;
}
public function __toString()
{
... |
Shell | UTF-8 | 386 | 3.3125 | 3 | [] | no_license | #! /bin/zsh
# shamelessly stolen from @chneukirchen
local op=print
[[ -t 1 ]] && op=cd
case "$1" in
'') up 1;;
-*|+*) $op ~$1;;
<->) $op $(printf '../%.0s' {1..$1});;
*) local -a seg; seg=(${(s:/:)PWD%/*})
local n=${(j:/:)seg[1,(I)$1*]}
if [[ -n $n ]]; then
$op /$n
else
print -u2 u... |
Java | UTF-8 | 5,339 | 2.609375 | 3 | [
"MIT"
] | permissive | package dao;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.WebApplicationException;
import vos.Usuario;
p... |
Java | UTF-8 | 485 | 2.140625 | 2 | [] | no_license | package org.jojo7070;
import org.jojo7070.cmd.FileUploader;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
/**
* Hello world!
*/
public class App {
public static void main(String[] args) throws X... |
C++ | UTF-8 | 1,299 | 2.984375 | 3 | [] | no_license | /*
ID: hasan.a5
LANG: C++
TASK: friday
*/
#include<iostream>
#include<memory.h>
#include<cstdio>
using namespace std;
int is_leap_year(int x)
{
if(x%400==0||(x%4==0&&x%100!=0))
return 1;
else
return 0;
}
int main()
{
int week[7],month[13];
int n,i,j,temp1,temp;
for(i=1;i<=12;i++)
if(4==i||6==i||9==i||11==i... |
PHP | UTF-8 | 12,533 | 2.921875 | 3 | [] | no_license | <?php
// Include connect file
require_once "connect.php";
// Define variables and initialize with empty values
$username = $password = $confirm_password = "";
$username_err = $password_err = $confirm_password_err = "";
$department = "";
$department_err = "";
// Processing form data when form is submitted
if($_SERVE... |
JavaScript | UTF-8 | 1,239 | 2.796875 | 3 | [] | no_license | /**
* Load comment
*/
function loadMessages(e)
{
e.preventDefault();
var postId = this.value;
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://localhost/socialbook/posts/get?postId='
+postId, true);
xhr.onload = function() {
if (this.status == 200) {
var users ... |
PHP | IBM852 | 1,086 | 2.703125 | 3 | [] | no_license | <?php
class stat
{
public static function get_jour_semaine($date)
{
$date = convertDate($date);
$jour = date('d', strtotime($date));
$mois = date('m', strtotime($date));
$annee = date('Y', strtotime($date));
$jour_fr = array("Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi... |
Python | UTF-8 | 399 | 3.3125 | 3 | [] | no_license |
def searchInsert(nums, target):
a = len(nums)
if nums[0] >= target:
a = 0
# nums.insert(0, target)
else:
for i in range(len(nums)):
if target <= nums[i]:
a = i
break
# nums.insert(i, target)
return a
# for i in range(len(nums)):
# if target <= nums[i]:
# return i
# r... |
Markdown | UTF-8 | 2,096 | 3.09375 | 3 | [
"MIT"
] | permissive | ---
title: Vores fælles menneskelighed
date: 04/09/2019
---
Gennem sin tjeneste og undervisning formanede Jesus til en radikal, ikke-diskriminerende holdning. Alle, som med et ærligt motiv søgte ham, hvad enten det var kvinder med et dårligt rygte, toldere, spedalske, samaritanere, romerske soldater, religiøse leder... |
Markdown | UTF-8 | 1,473 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | ---
title: "计费说明"
description:
draft: false
---
## 费用说明
Kafka创建页面上的**费用预览**计费仅包括集群基础资源(CPU、RAM、磁盘)费用,集群创建完成之后绑定的公网 IP 资源、VPC网络资源等费用将会另外计算。使用Kafka时用户扩容后的资源费用也将另外计算。Kafka基础资源费用的计算周期以Kafka集群创建时间为起点,以Kafka集群销毁时间为终点。
除了支持弹性计费,Kafka也支持包年、包月等[合约方式](https://docsv3.qingcloud.com/billing/intro/billing_zhinan/)。
## 价格影响因素
##... |
C++ | UTF-8 | 349 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int Max(vector<int>& v, int size){
if(size == 1) return v[0];
int m = Max(v,v[size]);
if(m > v[size-1]){
return m;
}
return v[size-1];
}
int Max(vector<int>&v){
return Max(v, v.size()-1);
}
int main() {
vector<int> v = {3,5,7,9,1};
cout << M... |
Python | UTF-8 | 484 | 3.234375 | 3 | [] | no_license | import sys
def get_input():
return map(int, input().split(' '))
def gcd(i,j):
if i > j:
if i % j == 0:
return j
else:
return gcd(j, i % j)
else:
if j % i == 0:
return i
else:
return gcd(i, j % i)
def main():
for line ... |
Java | UTF-8 | 1,374 | 2.203125 | 2 | [] | no_license | package com.swapi.api.domain;
import lombok.NonNull;
import org.springframework.data.mongodb.core.mapping.Document;
import javax.persistence.Id;
@Document(collection = "Planeta")
public class Planeta {
public Planeta(String name, String climate, String terrain) {
this.name = name;
... |
C | UTF-8 | 9,759 | 3.109375 | 3 | [] | no_license | #include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <string.h>
#include <pthread.h>
//#define _PRINT_INFO
long
get_usecs(void)
{
struct timeval t;
gettimeofday(&t,NULL);
return t.tv_sec*1000000+t.tv_usec;
}
void
usage(const char* app_name)
{
printf("Argument error! Usage: %s <input_file> [n... |
Java | UTF-8 | 1,594 | 3.3125 | 3 | [] | no_license | /**
* Created by xhu on 2/20/17.
*/
public class SerializeDeserializeBST {
public String serialize(TreeNode root){
if(root ==null){
return null;
}
StringBuilder result = new StringBuilder();
serializeHelper(root,result);
return result.toString().substring(0,re... |
Markdown | UTF-8 | 1,176 | 2.703125 | 3 | [
"BSD-3-Clause",
"CC-BY-3.0"
] | permissive | # Application Data Exchange
The application data exchange features cover the various methods you have to communicate with other applications. You can exchange data between applications through message ports and data controls, and use data bundles to package the data to be communicated.
You can use the following appl... |
Python | UTF-8 | 636 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python2
# -*- coding:utf-8 -*-
from urllib2 import Request, urlopen, URLError, HTTPError
def main() :
req = Request("http://www.zhihu.com")
try:
response = urlopen(req)
except URLError, e :
if hasattr(e, "code"):
print "The server couldn't fulfill the request."
... |
Java | UTF-8 | 848 | 3.796875 | 4 | [] | no_license | package org.dimigo.interfaces;
public interface IAnimal {
// 인터페이스 필드: 모두 상수로 인식함
String FARM_NAME = "디미 동물농장"; // 상수처리됨!! --> public static final이 자동으로 붙음
// = public static final String FARM_NAME
// 인터페이스안의 메소드: 추상 메소드
// void eat(); // 앞에 자동으로 public abstract가 설정됨
// // = public abstract voi... |
C++ | UTF-8 | 3,778 | 3.21875 | 3 | [] | no_license | //
// main.cpp
// uHunt
//
// Created by FB on 6/18/19.
// 383 Shipping Routes
//
#include <iostream>
#include <queue>
#include <unordered_map>
#include <vector>
#include <sstream>
#include <algorithm>
std::unordered_map<std::string, std::string> parent;
std::vector<std::string> queries;
std::unordered_map<std::s... |
Ruby | UTF-8 | 518 | 2.71875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | palindrome = /\A(?<palindrome>
(?# nothing )
|
.
|
(?:
(?<somecharacter>.)
\g<palindrome>
\k<somecharacter+0>
... |
PHP | UTF-8 | 999 | 2.515625 | 3 | [] | no_license | <?php
namespace Modules\OrgManagement\Entities;
use Illuminate\Database\Eloquent\Model;
use Modules\PartnerManagement\Entities\Partner;
class OrgLicense extends Model
{
const name = 'license_name';
const slug = 'license_slug';
const key = 'license_key';
const max_use... |
Java | UTF-8 | 18,921 | 1.921875 | 2 | [] | no_license | package ru.skypathway.jsontest;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TextInputLayout;
im... |
C++ | UTF-8 | 2,895 | 2.71875 | 3 | [] | no_license | #include <Servo.h>
Servo servo1;
Servo servo2;
Servo servo3;
void setup() {
// put your setup code here, to run once:
servo1.attach(2);
servo2.attach(3);
servo3.attach(4);
servo1.write(45);
servo2.write(45);
servo3.write(45);
pinMode(52,OUTPUT);
digitalWrite(52,HIGH);
pinMode(53,OUTPUT);
digital... |
Markdown | UTF-8 | 3,373 | 2.9375 | 3 | [
"MIT"
] | permissive | # multiplayer-web-pong
###Online Pong using Websockets and ZMQ
##Project
The goal of this project is to expand my knowledge of the HTML 5 canvas, websockets, and ZeroMQ, and bring them together to form a working client/server online web-based game.
Each client runs in browser, and is created with Angular 2 and Dart.
... |
C++ | UTF-8 | 1,131 | 2.90625 | 3 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include "lcdd/id/Id64bit.hh"
#include <iostream>
Id64bit::Id64bit() :
_value(0) {
_ids[0] = 0;
_ids[1] = 0;
encode();
}
Id64bit::Id64bit(ElementType id0, ElementType id1) :
_value(0) {
_ids[0] = id0;
_ids[1] = id1;
encode();
}
Id64bit::Id64bit(const Id64bit &right) :
... |
Python | UTF-8 | 6,965 | 2.84375 | 3 | [] | no_license | #!/bin/python
#import pandas as pd
import numpy as np
#import math
import copy
import QSTK.qstkutil.qsdateutil as du
import datetime as dt
import QSTK.qstkutil.DataAccess as da
#import QSTK.qstkutil.tsutil as tsu
import QSTK.qstkstudy.EventProfiler as ep
"""
Accepts a list of symbols along with start and end date
Ret... |
Java | UTF-8 | 1,991 | 2.203125 | 2 | [] | no_license | package evolution.service;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.apache.commons.lang3.reflect.FieldUtils;
impor... |
Java | UTF-8 | 1,543 | 2.296875 | 2 | [] | no_license | package com.app.controller;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.... |
Python | UTF-8 | 567 | 3.8125 | 4 | [] | no_license | # 方法一
class Solution(object):
def deleteNode(self, node):
# 把下一位的值赋给待删值
node.val = node.next.val
# 结点得到新值,next指针指向下下位,即删除了一个同值结点
node.next = node.next.next
# 方法二:依次往前赋值,将倒数第二个结点的next指向空,即删除了最后一个同值结点
class Solution(object):
def deleteNode(self, node):
while node.next:
... |
Java | UTF-8 | 653 | 1.898438 | 2 | [
"Apache-2.0"
] | permissive | /**
*
*/
package br.com.sistemaescolar.controller;
import java.io.Serializable;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
import br.com.sistemaescolar.modelo.Usuario;
/**
* @author Daniel Correia
* @since 03/12/2015
*
*/
@SessionScoped
@Named
public class... |
Shell | UTF-8 | 911 | 3.515625 | 4 | [] | no_license | #!/bin/bash
PROFILING="FALSE"
while getopts "h?P" opt; do
case "$opt" in
h|\?)
echo "[-h] Print help messages"
echo "[-P] Profiling mode"
exit 0
;;
P) PROFILING="TRUE"
;;
esac
done
shift $((OPTIND-1))
[ "$1" = "--" ] && shift
#echo $LOCAL,$SEGLEN,Leftovers: $@... |
Python | UTF-8 | 2,770 | 2.96875 | 3 | [] | no_license | import cv2
import numpy as np
import matplotlib.pyplot as plt
from skimage.segmentation import slic
from skimage.segmentation import mark_boundaries
from skimage.color import label2rgb
from src.load_data import load_images
from src.gabor_filter import gabor_feature_extractions
from src.clustering import apply_k_means... |
C++ | UTF-8 | 662 | 3.34375 | 3 | [] | no_license | 小球排列
现有R个红球,B个蓝球,G个绿球。我们来把这所有的小球排成一排。我们定义“浩神排列”是满足条件“每连续的3个小球颜色都不一样”的排列。问有多少种浩神排列。
两种排列A和B,只要有color(Ai) != color(Bi), (1 <= i <= n),我们就说A和B排列不一样。
input : 一个整数T(T < 100),表示有多少组测试数据
接下来T行,每行3个整数R, G, B (1 <= R+G+B <= 10^6),代表红球、绿球、蓝球的个数
output :
T行,每行一个整数ans,代表不同排列的方案数
sample input :
4
5 5 5
3 3 2
0 0 1
3 4 ... |
C# | UTF-8 | 2,749 | 3.1875 | 3 | [] | no_license | using System;
using System.Security.Cryptography;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace TestPasswordManagement
{
[TestClass]
public class UnitTest1
{
const int POSTIONS_TO_BE_TESTED = Helpers.PasswordManagement.HASH_LENGTH;
[TestMethod]
public void TestCre... |
Java | UTF-8 | 5,398 | 2.21875 | 2 | [] | no_license | package com.example.chatbot;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.inp... |
Java | UTF-8 | 5,816 | 2.46875 | 2 | [] | no_license | package demo.controller;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.spri... |
Java | UTF-8 | 1,862 | 2.140625 | 2 | [] | no_license | package com.umeng.soexample.mvp.ui.widget;
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.wi... |
C++ | UTF-8 | 709 | 2.625 | 3 | [] | no_license | //
//
// Filename: uartsim.h
//
// Project: FPGA library development (S6 development board)
//
// Purpose: To emulate the external parameters of a UART device, providing
// the UART output to, and input from, the command
// console/terminal while also providing the controller with
// appropriate busy lines as necess... |
Java | UTF-8 | 350 | 3.0625 | 3 | [] | no_license | import java.util.Scanner;
public class Convercion_CmApulgadas {
public void Pulgada(){
double Cm;
Scanner A = new Scanner(System.in);
System.out.println("Introduce los CM a convertir");
Cm = A.nextDouble();
System.out.println("Las Pulgadas son: ... |
TypeScript | UTF-8 | 2,719 | 3.71875 | 4 | [] | no_license | import { Component, OnInit } from '@angular/core';
import { of, from } from 'rxjs';
import {map,tap, take} from 'rxjs/operators';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent implements OnInit {
name = 'Angular';
ngOnI... |
TypeScript | UTF-8 | 256 | 2.703125 | 3 | [
"MIT"
] | permissive | export class comments{
public comment;
public name;
public date;
constructor(name,comment){
this.name=name;
this.comment=comment;
this.date=new Date().toISOString().substr(0, 19).replace('T', ' ');
}
} |
Python | UTF-8 | 791 | 4.71875 | 5 | [] | no_license | # Strings, characters put together in a list
# defined by '' or ""
# Joining of two strings, just add, concatenation
first_name = 'James'
last_name = 'Murphy'
print (first_name + ' ' + last_name)
# polymorphism
print (first_name, last_name) # to achieve the above function
full_name = (first_name + ' ' + last_name)
pri... |
Java | UTF-8 | 10,631 | 2.28125 | 2 | [] | no_license | package test.com.adagio.language.chords.intervals;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import org.modelcc.types.IntegerModel;
import test.com.adagio.InitTest;
import com.adagio.language.musicnotes.AbsoluteMusicNote;
import com.adagio.language.music... |
Swift | UTF-8 | 1,591 | 2.71875 | 3 | [
"MIT"
] | permissive | //
// EnemyWaveCreatorTest.swift
// GameOfRunesTests
//
// Created by Brian Yen on 28/3/20.
// Copyright © 2020 TeamHoWan. All rights reserved.
//
import XCTest
@testable import GameOfRunes
class EnemyWaveCreatorTest: XCTestCase {
func testCreateStageEnemyWave_testClosenessToTargetDifficulty() {
let t... |
TypeScript | UTF-8 | 115 | 3.140625 | 3 | [] | no_license | const divisorGame = (n: number) : boolean => {
return n % 2 === 0 ? true : false;
}
console.log(divisorGame(5)); |
C# | UTF-8 | 1,545 | 2.671875 | 3 | [] | no_license | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="When_two_instances_has_the_same_business_value.cs" company="Daniel Dabrowski - rod.42n.pl">
// Copyright (c) Daniel Dabrowski - rod.42n.pl. All rights reserved.
// </copyright>
/... |
C++ | UTF-8 | 376 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
int ary[4];
int main()
{
int a, b;
while (scanf("%d%d%d", &ary[0], &ary[1], &ary[2]) == 3)
{
std::sort(ary, ary+3);
a = ary[1] - ary[0];
b = ary[2] - ary[1];
if (a == b)
{
printf("%d\n", ary[2]+a);
}
else if (a > b)
{
printf("%d\n", ary[0]+b);
}
el... |
Java | UTF-8 | 3,838 | 2.0625 | 2 | [] | no_license | package com.demo.csc214.socialmediaapp.view;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android... |
Java | UTF-8 | 1,724 | 1.734375 | 2 | [] | no_license | package com.example.a12thnotes;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.WindowManager;
import com.daimajia.androidanimations.library.Techniques;
import com.viksaa.sssplash.lib.activity.Aweso... |
Java | UTF-8 | 3,265 | 2.390625 | 2 | [
"Apache-2.0"
] | permissive | package com.example.simple_delivery.simpledelivery;
import android.app.Activity;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.... |
Python | UTF-8 | 1,335 | 2.546875 | 3 | [] | no_license | from util import *
import scipy.io.wavfile as wavfile
from torch.utils.data import Dataset
import os
class AudioDataset(Dataset):
def __init__(self, root_dir, quantiles=256, non_linear=True):
if root_dir.endswith("/"):
root_dir = root_dir[:-1]
self.root_dir = root_dir
self.files = os.listdir(root_dir)
... |
Python | UTF-8 | 45 | 3.125 | 3 | [] | no_license | func = lambda x, y: x + y
print(func(2,3))
|
JavaScript | UTF-8 | 882 | 3.265625 | 3 | [] | no_license | slowMath.add (6, 2)
.then (
(sum) => {
console.log(sum);
return slowMath.multiply (sum, 2);
})
.then (
(product) => {
console.log(product);
return slowMath.subtract (product, 3);
})
.then (
(difference) => {
console.log(difference);
return slowMath.add (differ... |
TypeScript | UTF-8 | 287 | 2.71875 | 3 | [
"MIT"
] | permissive | import {PipeTransform, Pipe} from '@angular/core';
@Pipe({name: 'some'})
export class SomePipe implements PipeTransform {
transform(arr: any, predicate: (value: any, index: number, array: any[]) => boolean): boolean {
return Array.isArray(arr) ? arr.some(predicate) : arr;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.