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 |
|---|---|---|---|---|---|---|---|
C | UTF-8 | 919 | 3.09375 | 3 | [] | no_license | /*
* TCP/IP
* => Socket Programming: Client
*
* Server
* 1. socket
* 2. connect
*/
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
// Need for Internet Protocol
#include <arpa/inet.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
struct sockaddr_in saddr... |
PHP | UTF-8 | 309 | 3.203125 | 3 | [] | no_license | <!DOCTYPE html>
<html>
<head>
<title>My age</title>
</head>
<body>
<h1>This is a Heading</h1>
<?php
$birthyear = 1995;
$age = date("Y") - $birthyear;
echo "<p>Jeg er født i " . $birthyear . ", og er i år " . $age . "år gammel.</p>";
?>
<p>This is a paragraph.</p>
</body>
</html>
|
Java | UTF-8 | 1,347 | 2.125 | 2 | [
"Apache-2.0"
] | permissive | package org.iskycode.jeewe.adm.service;
import org.apache.commons.collections.CollectionUtils;
import org.iskycode.jeewe.adm.dao.UserDao;
import org.iskycode.jeewe.adm.entity.AdmUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util... |
Python | UTF-8 | 1,698 | 2.8125 | 3 | [
"MIT",
"ISC"
] | permissive | #!/usr/bin/python
import optparse
import time
def get_args():
parser = optparse.OptionParser()
#parser.add_option("-x", "--x_bytes", dest ="xb", help = "Recieved bytes (rx) or Transmited bytes (tx)")
parser.add_option("-d", "--dev", dest ="dev", help = "Device used in transmission (wlan0, wl01, eth0)")
... |
JavaScript | UTF-8 | 3,560 | 2.96875 | 3 | [] | no_license | var mysql = require("mysql");
var inquirer = require("inquirer");
// ------------------------------- CONNNECTION
var connection = mysql.createConnection({
host: "localhost",
// Your port; if not 3306
port: 3306,
user: "root",
password: "rootroot",
database: "bamazon"
});
connection.connect(funct... |
Java | UTF-8 | 935 | 2.90625 | 3 | [] | no_license | public class Solution {
public boolean isValidSerialization(String preorder) {
String[] strs=preorder.split(",");
List<String> list=new ArrayList<String>();
for (int i = 0; i < strs.length; i++) {
list.add(strs[i]);
}
return isValid(list);
}
public boolean... |
C# | UTF-8 | 2,378 | 2.78125 | 3 | [] | no_license | using HotelFinder.Entities;
using Microsoft.Extensions.Configuration;
using Microsoft.IdentityModel.Tokens;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Security.Cryptography;
using System.Text;
using System.Threadi... |
Java | UTF-8 | 1,691 | 2.703125 | 3 | [] | no_license | package xogame.is_complete.any_diagonal;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
import xogame.is_complete.GameOver;
import xogame.models.Board;
public class IsAnyDiagonalCompleteTest {
@Test
pu... |
C++ | UTF-8 | 3,494 | 2.875 | 3 | [] | no_license | #include "ScrambleFind.h"
#include "..\ApplicationManager.h"
#include "..\GUI\Output.h"
ScrambleFind::ScrambleFind(ApplicationManager * pApp) :Action(pApp)
{
validCount = 0;
inValidCount = 0;
}
ScrambleFind::~ScrambleFind()
{
}
//The game logic happens here
void ScrambleFind::Execute()
{
pManager->DeSelectAll... |
JavaScript | UTF-8 | 2,231 | 2.578125 | 3 | [
"MIT"
] | permissive | const express = require('express');
const router = express.Router();
const bodyParser = require('body-parser');
// Require the contact model
User = require('../models/user');
Contact = require('../models/contact');
// Use body-parser middleware
router.use(bodyParser.json());
// API router to GET all users
router.get... |
C++ | UTF-8 | 4,981 | 2.828125 | 3 | [] | no_license | #include <exception>
#include <algorithm>
#include <bitset>
#include "include/parser.h"
namespace nand2tetris{
Parser::Parser(std::string input_file){
if(input_file.substr(input_file.find_last_of('.')+1)!="asm"){
std::cout << "Wrong file type" << std::endl;
exit(0);
}
this->file_name = in... |
Python | UTF-8 | 2,603 | 2.515625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ##########################################################
# testStreamline.py
# Author: Akito D. Kawamura
# This program tests my streamline.py for 3D.
#
# This program is published under BSD 3-Clause License.
# This program is a beta version.
# Please use this program under your responsibility.
##############... |
Java | UTF-8 | 33,626 | 1.820313 | 2 | [] | no_license | package ch.ethz.globis.isk.Zoo;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.util.Collection;
import java.util.Collections;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import ... |
Java | UTF-8 | 3,513 | 1.953125 | 2 | [] | no_license | package Hibernate.model;
// Generated 2015�~6��23�� �U��07:41:21 by Hibernate Tools 4.3.1
import java.util.HashSet;
import java.util.Set;
/**
* Shop generated by hbm2java
*/
public class Shop implements java.io.Serializable {
private int shopId;
private int shopName;
private String shopType;
pr... |
Java | UTF-8 | 250 | 3.0625 | 3 | [] | no_license | package Week3;
public class ReverseBasics {
public static void main(String[] args) {
StringBuilder sb = new StringBuilder("ABC");
sb.reverse(); // execute reverse on sb
System.out.println(sb); // CBA
}
} |
Python | UTF-8 | 2,252 | 2.90625 | 3 | [] | no_license | __author__ = 'apurvapawar'
from random import randint
from Models import Item
from Config import info
MAX_ITEMS=5
CARD_PROBABILITY=75
LEGAL_AGE=21
AGE_PROOF_PROBABILITY=80
MAX_CASH_IN_HAND=700
class Customer:
def __init__(self):
self.isAdult = False
self.hasAgeProof = False
self.hasDeb... |
Markdown | UTF-8 | 27,541 | 2.578125 | 3 | [] | no_license | # Image Instance Segmentation with Mask R-CNN
---
# Abstract
Deep Learning 기술을 Computer Vision분야에 적용함으로써 많은 전문적인 분야들이 파생되었다. classification, segmentation, object detection, GAN 등이 이에 해당하는데, 특히 segmentation과 object detection을 접목해서 성능을 높인 ‘Mask R-CNN’ 모델을 깊이 연구하기로 한다. 구체적인 사항으로는 Mask R-CNN의 논문을 리뷰하고 토의하는 방식을 통해 모델을 이해... |
Python | UTF-8 | 781 | 3.265625 | 3 | [
"MIT"
] | permissive | from nltk.probability import FreqDist
from os import path
from wordcloud import WordCloud
items = ["Computer Science", "foo", "bar"]
fd = FreqDist(items)
print(fd)
for i in fd.keys():
print(i, fd[i])
freq_dist = {}
for key in fd.keys():
freq_dist[key] = fd[i]
d = path.dirname(__file__)
# Read the whole tex... |
C# | UTF-8 | 467 | 2.640625 | 3 | [
"MIT"
] | permissive | using System.IO;
namespace ctorx.Core.SmtpMail
{
public class EmailAttachment
{
/// <summary>
/// Gets the attachment Name
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets the attachment content bytes
/// </summary>
public byte[] Content { get; set; }
/// <summary>
/// Ge... |
Java | UTF-8 | 765 | 2.65625 | 3 | [] | no_license | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class heart here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class heart extends Actor
{
/**
* Act - do whatever the heart wants to do. This method is c... |
C++ | UTF-8 | 6,283 | 2.546875 | 3 | [
"MIT-Modern-Variant"
] | permissive | // main.cc
// Bootstrap code to initialize the operating system kernel.
//
// Allows direct calls into internal operating system functions,
// to simplify debugging and testing. In practice, the
// bootstrap code would just initialize data structures,
// and start a user program to print the login prompt.
//
// Most... |
Python | UTF-8 | 1,358 | 2.5625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
from PIL import Image
from tensorflow.python.keras.preprocessing import image as kp_image
def gram_matrix(input_tensor):
channels = int(input_tensor.shape[-1])
a = tf.reshape(input_tensor, [-1, channels])
n = tf.shape(a)[0]
gram = tf.matmul(a, a, transpose_a=... |
Ruby | UTF-8 | 1,401 | 3.078125 | 3 | [] | no_license | require'rexml/document'
def cs(parent, x1, y1, x2, y2)
c = parent.add_element "line"
c.attributes["x1"] = x1
c.attributes["y1"] = y1
c.attributes["x2"] = x2
c.attributes["y2"] = y2
c.attributes["stroke"] = "black"
c.attributes["stroke-width"] = "1"
end
def line(parent, x1, y1, x2, y2)
c = parent.add_element "... |
Java | UTF-8 | 1,160 | 2.28125 | 2 | [] | no_license | package com.mc.wechat.vo.menu;
import com.mc.EventType;
import lombok.Data;
import org.nutz.json.JsonField;
import java.util.List;
/**
* @ClassName Menu
* @Author ZhengRongZe
* @Date 2019/3/11 13:29
**/
@Data
public class Menu {
/**
* 菜单的响应动作类型,view表示网页类型,click表示点击类型,miniprogram表示小程序类型
*/
priva... |
SQL | UTF-8 | 203 | 3.4375 | 3 | [
"MIT"
] | permissive | SELECT
`salesmen`.`Scode`,
`salesmen`.`Sname`,
COUNT(`salesman`) AS family_members
FROM
`family`
INNER JOIN
`salesmen` ON family.salesman = salesmen.Scode
GROUP BY salesman;
|
Java | UTF-8 | 857 | 2.34375 | 2 | [] | no_license | /**
*
*/
package com.ncs.myblog.dao;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import com.ncs.myblog.domain.User;
/**
* @author zhangyong
*
*/
public class UserMapperImpl implements UserMapper {
final String NAMESPACE = "com.ncs.myblog.dao.UserMapper";
private SqlSession session... |
C | UTF-8 | 7,304 | 3.203125 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* Header file for functions related to the creation, deallocation,
* copying, and converting of color images. Other function headers cover
* the more complex operations. Implementation of these functions is in
* "image.c".
*/
#ifndef SIMPL_IMAGE_H_
#define SIMPL_IMAGE_H_
#ifdef __cplusplus
extern "C" {
#endif... |
Python | UTF-8 | 2,406 | 2.609375 | 3 | [] | no_license | from Image import Image3D
from SaveImage import SaveImage
__author__ = 'Agnieszka'
from os import walk
from os.path import join
import dicom
import numpy as np
class ReadDirWithDicom(object):
def __init__(self, path):
my_path = path
files_in_dir = [join(my_path, fn) for fn in next(walk(my_path... |
Java | UTF-8 | 3,054 | 2.1875 | 2 | [] | no_license | package com.example.AwesomeCompan.demo.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.models.auth.In;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
@Entity
@Table(name = "location")
public class Location {
... |
C++ | UTF-8 | 638 | 2.625 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char str[200005],ptr[200005];
int NEXT[200005];
int main()
{
memset(str,0,sizeof(str));
memset(ptr,0,sizeof(ptr));
scanf("%s",str);
scanf("%s",ptr);
NEXT[0]=-1;
int k=-1;
int l=strlen(ptr);
int ans=0;
for(int i=1;i<l;i++)
{
while(k>-... |
JavaScript | UTF-8 | 3,390 | 2.90625 | 3 | [
"MIT"
] | permissive | /*
* akiha-circuit
*
* Copyright (c) 2019 Yuichiro MORIGUCHI
*
* This software is released under the MIT License.
* http://opensource.org/licenses/mit-license.php
**/
var undef = void 0;
function isArray(anObject) {
return Object.prototype.toString.call(anObject) === '[object Array]';
}
function deepcopy(a... |
Markdown | UTF-8 | 667 | 2.9375 | 3 | [] | no_license | # API
## Requests
### **POST** - /product/update/{sku}
## Update Product
Updates a product. It is just as particular as the create route, and is also identical. It requires all fields to be overwritten and does not load the old default values. You can do this however on the front end by doing a get route hit to popu... |
Python | UTF-8 | 8,963 | 2.515625 | 3 | [] | no_license | from flask import render_template, url_for, flash, redirect, request, abort
from mainpackage import app, db, bcrypt, mail
from mainpackage.form import RegistrationForm, LoginForm, UpdateAccountForm, PostForm, RequestResetForm, ResetPasswordForm
from mainpackage.models import User, Post
from flask_login import login... |
Java | UTF-8 | 3,209 | 2.234375 | 2 | [] | no_license | package com.wgz.ant.antmove.fragment;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.V... |
Python | UTF-8 | 336 | 3.34375 | 3 | [] | no_license |
def friend(n):
if(n <= 2):
return n
return friend(n-1) + (n-1)*friend(n-2)
def friendDp(n):
if(dp[n] != -1):
return dp[n]
if(n <= 2 ):
dp[n] = n
return dp[n]
dp[n] = friendDp(n-1)+(n-1)*friendDp(n-2)
return dp[n]
n = 4
dp = [-1] *(n+1)
print(friend... |
C++ | UTF-8 | 2,265 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #include<SPI.h>
#include<RF24.h>
#include<nRF24L01.h>
#include "printf.h"
//receiver
//NRF ARDUINO
//1 GND GND
//2 VCC 3.3V
//3 CE 9 out
//4 CSN 10 out
//5 SCK 13 out
//6 MOSI 11 out
//7 MISO 12 in
//int radio_led = 13;
int CE_PIN = 7, CSN_PIN = 8;
RF24 Radio(CE_PIN, CSN_PIN);
const uint64_t... |
PHP | UTF-8 | 2,185 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | <?php
// +----------------------------------------------------------------------
// | rootCMS 栏目权限与角色之间的授权
// +----------------------------------------------------------------------
// | Copyright (c) 2015-2016 http://www.rootcms.cn, All rights reserved.
// +------------------------------------------------------------... |
Java | UTF-8 | 509 | 2.1875 | 2 | [] | no_license | package io.github.totom3.commons.binary;
import java.io.IOException;
/**
*
* @author Totom3
*/
public class DeserializingException extends IOException {
private static final long serialVersionUID = 1L;
public DeserializingException() {
}
public DeserializingException(String message) {
super(mess... |
C++ | UTF-8 | 6,722 | 3.546875 | 4 | [] | no_license | #include <vector>
#include <string>
#include <iostream>
#include <AutomatoFinito.hpp>
AutomatoFinito::AutomatoFinito(int n, std::string terminalSymbols, std::vector<int> initStates,
std::vector<int> acceptingStates, std::vector<Transition> transitions)
{
this->numStates = n;
this->terminal... |
C++ | UHC | 1,290 | 3.71875 | 4 | [] | no_license | //ڷᱸ 9 ǽ 4 _correct
#include<iostream>
#include<vector>
using namespace std;
class isLess {
public:
bool operator()(const int a, const int b)const {
//int a,b Է¹Ƽ
if (a>b) {
return true;
}
else {
return false;
}
}
};
class PQ {
private:
vector<int>v;
public:
int size() {
return v.size();
}
boo... |
Java | UTF-8 | 1,809 | 2.40625 | 2 | [] | no_license | import java.util.ArrayList;
public class AdminOperation {
public static void updateGames(String game_name, String console, int players, String genre, String year, String developer, String publisher, String price, String discount, int quantity, String description) throws ClassNotFoundException{
GameGa... |
C++ | UTF-8 | 3,291 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <regex>
#include <string>
#include <fstream>
#include <vector>
class Mange{
public:
std::fstream f;
std::string tmp = "" , res = "" , data = "";
public : std::string readFile(std::string path){
res = "";tmp = "";
f.open(path,std::ios::in);
while(getline(f,tmp)){
res.append(tmp);
re... |
C++ | UTF-8 | 1,346 | 3.28125 | 3 | [] | no_license | //
// maximize_distance_to_closest_person.cpp
//
// Created by omlenka on 21/04/20.
// Copyright © 2020 omkar lenka. All rights reserved.
//
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int maxDistToClosest(vector<int>& seats)
{
vector<int> dist(seats.size(),... |
JavaScript | UTF-8 | 324 | 4.15625 | 4 | [] | no_license | //Write a function that rearranges an integer into its largest possible value.
superSize(123456) //654321
superSize(105) // 510
superSize(12) // 21
function superSize(num){
if (num < 10) {
return num;
} else {
var r = String(num).split("").sort().reverse().join("");
return Number(r);
}
}
superSize(... |
Java | UTF-8 | 568 | 2.71875 | 3 | [] | no_license | package com.aos.dynatrace.lambda.monitor.exception;
/**
* @author Wagner Alves
*/
public class ExceptionUtils {
/**
* It returs stackTrace as a string
*
* @param e
* @return
*/
public static String getStackTrace(Exception e) {
StringBuilder str = new StringBui... |
C++ | UTF-8 | 232 | 3.03125 | 3 | [] | no_license | #include <stdio.h>
int main()
{
long long n, i, sum=0;
scanf("%lld",&n);
/* if the number can be divide by 3, then add it to sum */
for(i=1;i<=n;i++){
if(i%3==0) sum+=i;
}
printf("%lld\n",sum);
return 0;
}
|
C++ | UTF-8 | 2,801 | 3.3125 | 3 | [] | no_license | #include <iostream>
using namespace std;
#include <vector>
#include <queue>
#include <string>
#include <cstring>
/*
This is actually an extension of the 1-D rain trapping problem.
Reccll the 1-D situation, we can have a two-pointer solution.
We maintain two pointers pointed to current positions as well as... |
JavaScript | UTF-8 | 3,730 | 2.625 | 3 | [] | no_license | define(function(require) {
var utils = require('utils');
var Cell = require('cell');
var DEFAULTWIDTH = 100;
function createStyleSheet(id, numCols, widths) {
var width = widths[0];
var left = width - 1;
var rules = '#sheet-' + id + ' .cell.label-col {' +
'left: 0; ' +
'width: ' + ... |
C++ | UTF-8 | 1,802 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | /**
* Copyright @ 2014 - 2017 Personal
* All Rights Reserved.
*/
#ifndef ANT_ABSTRACTDATABLOCK_H
#define ANT_ABSTRACTDATABLOCK_H
#ifndef __cplusplus
# error ERROR: This file requires C++ compilation (use a .cpp suffix)
#endif
/*---------------------------------------------------------------------------*/
// Incl... |
Java | UTF-8 | 2,466 | 2.6875 | 3 | [] | no_license | package com.mivas.myharmonicasongs.util;
import android.util.Log;
import com.mivas.myharmonicasongs.database.handler.NoteDbHandler;
import com.mivas.myharmonicasongs.database.handler.SongDbHandler;
import com.mivas.myharmonicasongs.database.model.DbNote;
import com.mivas.myharmonicasongs.database.model.DbSong;
impor... |
Swift | UTF-8 | 1,202 | 2.96875 | 3 | [] | no_license | //
// SoundAsset.swift
// MyWayy
//
// Created by Robert Hartman on 12/2/17.
// Copyright © 2017 MyWayy. All rights reserved.
//
import Foundation
enum SoundAsset: String {
case activityComplete = "activity complete"
case addTime = "add time"
case pause = "pause"
case resume = "resume"
case do... |
Python | UTF-8 | 689 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
# _*_ coding:utf-8 -*-
import pyautogui as pyag
import time
import cv2
print(pyag.position())
print(pyag.size())
while 1:
img = cv2.imread('/home/chen/datasets/5222.jpg')
cv2.imshow('1', img)
if cv2.waitKey(1) & 0xFF == ord('0'):
break
if cv2.waitKey(1) & 0xFF == ord('8'... |
C++ | UTF-8 | 2,683 | 2.546875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;
typedef vector<vector<long long>> mll;
typedef vector<pair<long long, long long>> vpl;
typedef long double ld;
typedef vector<long double> vld;
typedef vector<vector<long double>> ... |
Java | UTF-8 | 377 | 2.625 | 3 | [
"MIT"
] | permissive | package utilities;
import java.io.IOException;
public class Console {
public void clear() {
try {
if (System.getProperty("os.name").contains("Windows")) new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
else Runtime.getRuntime().exec("clear");
} catch (I... |
Markdown | UTF-8 | 2,100 | 2.671875 | 3 | [] | no_license | # Working with Mongo
Some notes on how to get the most out of Mongo.
## Text search
For text search, Mongo supports [these languages](https://docs.mongodb.com/manual/reference/text-search-languages/), at time of writing:
danish da
dutch nl
english en
finnish fi
french fr
german de
hungarian hu
italian it
norwegian n... |
Java | UTF-8 | 1,268 | 2.390625 | 2 | [] | no_license | package aljoschaRydzyk.viewportDrivenGraphStreaming.FlinkOperator.Batch;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.types.Row;
import aljoschaRydzyk.viewportDrivenGraphStreaming.FlinkOperator.GraphObject.EdgeGVD;
import aljoschaRydzyk.viewportDrivenGraphStreaming.FlinkOperator.G... |
JavaScript | UTF-8 | 631 | 2.859375 | 3 | [] | no_license | "use strict";
window.component_input = function() {
// Input type : File
let nodesArray = Array.prototype.slice.call(document.querySelectorAll('input[type=file]'));
nodesArray.forEach(function(element) {
element.addEventListener('change', function() {
let elementID = element.id;
... |
Go | UTF-8 | 523 | 2.65625 | 3 | [
"MIT"
] | permissive | package main
import (
uuid "github.com/satori/go.uuid"
"log"
"os"
)
func main() {
var (
bufferSize = 2000
bufferLimit = 1900
)
buf := make([]byte, 0, bufferSize)
file, err := os.Create("/tmp/uuid_single")
if err != nil {
panic(err)
}
defer func() {
_ = file.Close()
}()
for {
uid := uuid.NewV... |
C++ | UTF-8 | 779 | 3.0625 | 3 | [] | no_license | #ifndef __ADJ_LIST_NETWORK_ARC_H__
#define __ADJ_LIST_NETWORK_ARC_H__
#include <bits/stdc++.h>
// 邻接表网边类
template <class WeightType>
struct ArcNode
{
int _adjVex; //弧头顶点的序号,指向目标节点
WeightType _weight; //边的权值
ArcNode<WeightType> *_nextArc; //下一条边结点的指针
ArcNode();
ArcNode(i... |
Python | UTF-8 | 271 | 2.828125 | 3 | [] | no_license | """Toplevel script for pymaze game - instanciate Game and then play it."""
import sys
from Game import Game
if len(sys.argv) != 2:
host, port = 'localhost', '8089'
else:
host, port = sys.argv[1].split(":")
game = Game("maze1.txt", host, int(port))
game.play()
|
Java | UTF-8 | 1,066 | 2.46875 | 2 | [] | no_license | package com.baidu.langshiquan.cache;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.junit.Test;
import com.baidu.langshiquan.base.FreeUnitTestBase;
import com.baidu.langshiquan.model.User;
/**
* Created by langshiquan on 17/9/30.
*/
public class SecondLevelUpdateCacheTest extends FreeUn... |
SQL | ISO-8859-1 | 604 | 4.09375 | 4 | [] | no_license | -- sub-consultas: single-row - retornam apenas uma linha
-- realiza uma consulta a partir do resultado de outra consulta
-- sub-consulta executada antes da principal
-- fazem uso dos operadores de comparao de linhas simples: =, >, <, <>, !=
SELECT first_name, last_name, job_id, salary
FROM employees
WHERE salary > (SE... |
Java | UTF-8 | 408 | 2.28125 | 2 | [] | no_license | package ca.cours5b5.nicolasparr.donnees.partie;
import ca.cours5b5.nicolasparr.enumerations.ECouleur;
import ca.cours5b5.nicolasparr.global.GLog;
public class DCase {
private ECouleur couleur;
public ECouleur getCouleur() {
GLog.appel(this);
return couleur;
}
public void setCouleur... |
C++ | UTF-8 | 8,260 | 3.75 | 4 | [] | no_license |
#include <cstdlib>
#include <string>
#include <iostream>
#include <sstream>
#include "MyRational.h"
using namespace std;
/**
* Stores, displays, and manipulates rational numbers
*
* @author rwmeyer3
* @version 19.08.2020
*/
/**
* Default Constructor initializes 0/1.
* Rational number starts in simplifie... |
PHP | UTF-8 | 532 | 2.65625 | 3 | [] | no_license | <?php
//1、建立连接(连接数据库)(搭桥)
$conn = mysql_connect('localhost','root','root');
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}else{
//2、选择数据库(目的地)
mysql_select_db("mydb1902",$conn);
//3、执行数据库的SQL语句(增删改查)
$sqlstr = "insert into usertable(username,userpass,usersex) value... |
PHP | UTF-8 | 3,496 | 2.75 | 3 | [] | no_license | <?php
class Complaint{
private $conn;
private $table_name = "complaint";
//object properties
public $complaint_id;
public $customer_id;
public $amc_id;
public $date;
public $complaint_type_id;
public $status;
public function __construct($db){
$this->conn = $db;
}
function createComplaint(){
... |
C++ | UTF-8 | 2,645 | 2.875 | 3 | [] | no_license | #pragma once
#include <bits/stdc++.h>
namespace NodeFlow
{
double uniform_random()
{
return rand()*1.0/INT_MAX;
}
double guass_random(double m=0,double delta=1.0)
{
double u1 = NodeFlow::uniform_random();
double u2 = NodeFlow::uniform_random();
double z = sqrt(-2*log... |
Python | UTF-8 | 1,424 | 3.9375 | 4 | [] | no_license | # Lazy buttons 2
# demonstrate using class in program which is using tkinter
from tkinter import *
# creating new class application on class frame
# it works because class object application is specialise type of object frame
class Application(Frame):
"""Application based on GUI with three buttons."""
def _... |
Java | UTF-8 | 9,107 | 2.765625 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* Copyright (c) 2017 Ariel Favio Carrizo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list o... |
Swift | UTF-8 | 4,311 | 2.609375 | 3 | [] | no_license | //
// speciesVC.swift
// CofeeGo
//
// Created by NI Vol on 10/15/18.
// Copyright © 2018 Ni VoL. All rights reserved.
//
import UIKit
import XLPagerTabStrip
class speciesVC: UIViewController, UITableViewDelegate,UITableViewDataSource,IndicatorInfoProvider {
func indicatorInfo(for pagerTabStripController: ... |
Shell | UTF-8 | 507 | 3.3125 | 3 | [
"ISC"
] | permissive | #!/bin/bash
set -e
if [ ! -f "scripts/gcc.sh" ]
then
echo "Error: does not look like a root of Dancy source tree" 1>&2
exit 1
fi
if [ -f "./external/bin/x86_64-w64-mingw32-gcc" ]
then
echo "./external/bin/x86_64-w64-mingw32-gcc"
exit 0
fi
if [ -f "/usr/bin/x86_64-pc-msys-gcc.exe" ]
then
echo "x86... |
C# | UTF-8 | 2,541 | 2.890625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using Autofac;
using Autofac.Features.Indexed;
public class Program
{
private static IContainer _Container;
public static void Main()
{
InitDependencyInjection();
var rd1 = _Container.Resolve<RequiresDependency>(new Nam... |
JavaScript | UTF-8 | 1,818 | 4.28125 | 4 | [] | no_license | /* 字符串 */
/* 普通字符串 */
// 1. 换行
const str_normal = '32131\n123123'
console.log(str_normal);
// 2. 数字运算(括号提高优先级)
const a = 20, b = 30, c = 'str'
console.log('我的年龄是:' + (a + b) + c);
/* 模板字符窜 */
// 可嵌套
// 带标签的模板字符串(函数式的高级用法)
// 第一个参数是没有变量的字符串组成的数组,其余为变量;若以变量结尾,则a中会多包含一个空字符串
const foo = (a, b, c, d) => { console.log(a);... |
Java | UTF-8 | 888 | 1.53125 | 2 | [] | no_license | /*
* IBungeniForm.java
*
* Created on December 20, 2007, 3:55 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.bungeni.editor.selectors;
import java.util.HashMap;
import org.bungeni.editor.fragments.FragmentsFactory;
/**
*
... |
Java | UTF-8 | 907 | 3.640625 | 4 | [] | no_license | import java.util.Scanner;
public class DaysInAMonth {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a month to get the number of days: ");
String month = sc.nextLine();
if(month.equals("January") || month.equals("March") || mon... |
Python | UTF-8 | 3,227 | 2.96875 | 3 | [] | no_license | from http import cookiejar
from urllib import request,error
from urllib.parse import urlparse
'''
如下是使用 Python3 内置模块实现的一个比上一篇稍微健壮一点点的下载器。
通过内置 urllib 进行 header 设置或者代理设置或者启用会话,支持简单的 HTTP CODE 5XX 重试机制,支持 GET\POST。
(实际项目考虑和封装的要比这更加健壮)
'''
class HtmlDownloader(object):
def download(self,url,retry_count=3,headers=Non... |
C++ | UTF-8 | 6,433 | 2.53125 | 3 | [] | no_license | /******************************************************************************
* Copyright (C) 2011 by Jerome Maye *
* jerome.maye@gmail.com *
* *
... |
C# | UTF-8 | 1,699 | 2.640625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using UNACH.CALCULADORA.WS.Clases;
namespace UNACH.CALCULADORA.WS
{
/// <summary>
/// Descripción breve de CalcularService
/// </summary>
[WebService(Namespace = "http://tempuri.... |
Go | UTF-8 | 658 | 4.40625 | 4 | [] | no_license | package main
import "fmt"
func main() {
// In Go language, a channel is a medium through which a goroutine communicates with another goroutine and this communication is lock-free. Or in other words, a channel is a technique which allows to let one goroutine to send data to another goroutine. By default, a channel is... |
Markdown | UTF-8 | 7,068 | 2.546875 | 3 | [] | no_license | ---
title: Get started with Campaign Standard
description: Discover key capabilities, user interface and global guidelines.
audience: start
content-type: reference
topic-tags: about-adobe-campaign
feature: Overview
role: User
level: Beginner
exl-id: b62c70fe-c838-4a0e-9b0a-2e916a06ff39
---
# Get Started with Campaign ... |
Java | UTF-8 | 3,421 | 2.046875 | 2 | [] | no_license | package com.nxt.ott.activity.account;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import com.nxt.ott.MyApplication;
import com.nxt.ott.R;
import com.nxt.ott.base.BaseTitleActivity;... |
C++ | UHC | 2,170 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <vector>
#include <memory.h>
#define MAX_N 651
using namespace std;
int n, m;
int aMatch[MAX_N];
int bMatch[MAX_N];
vector<int> adj[MAX_N];
int visit[MAX_N];
int visitCnt;
char map[51][51];
int cArr[51][51];
int rArr[51][51];
bool chkNum[MAX_N];
int num = 1;
... |
C++ | UTF-8 | 1,365 | 3.078125 | 3 | [
"MIT"
] | permissive | /*
*
* DirectInteract this is a helper class to direct interaction with a set of Arduino pins.
*
* @author Valeriy V Dmitriev aka valmat <ufabiz@gmail.com>
* @coauthor Nikolai Tikhonov aka Dragon_Knight <dubki4132@mail.ru>, https://vk.com/globalzone_edev
* @licenses MIT https://opensource.org/licens... |
Python | UTF-8 | 1,277 | 2.90625 | 3 | [] | no_license | from Patient import *
from Personnel import *
import uuid
# quarantine is very similar to hospital therefore so are the functions
class quarantine:
def __init__(self, name, capacity):
self.ID = str(uuid.uuid1())
self.name = name
self.capacity = int(capacity)
self.patient... |
C++ | UTF-8 | 643 | 2.9375 | 3 | [] | no_license | class Solution {
public:
string convert(string s, int numRows) {
vector<string> tmp(numRows);
string res;
int size = s.size();
if(1 == numRows) return s;
if(s.empty() || numRows < 1) return res;
for(int i = 0; i < size; i++){
int ans = i / (numRows - 1);... |
JavaScript | UTF-8 | 1,844 | 2.578125 | 3 | [] | no_license | import React, { Component } from "react";
import { Form, Button, Col } from "react-bootstrap";
import { toast } from "react-toastify";
/* Services*/
import { saveDepot, updateDepot, getDepot } from "../Services/depotservice";
export default function ArticleForm(props) {
/*Form State*/
const [name, setName] = Reac... |
Python | UTF-8 | 120 | 2.578125 | 3 | [] | no_license | import time
if __name__=='__main__':
s = 60
print("Delaying other process by {} seconds".format(s))
time.sleep(s)
|
Java | UTF-8 | 917 | 2.40625 | 2 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.bonarea.myfirstwebapp.interceptores;
import java.util.Arrays;
import javax.interceptor.AroundInvoke;
import javax.intercep... |
C | UTF-8 | 3,824 | 2.921875 | 3 | [] | no_license | #include <stdlib.h>
#include <math.h>
#include "../include/structures.h"
#define SWAP(a, b) dumm=(a); (a)=(b); (b)=dumm
void ec_init(struct ec_parameters *ec, const int points_count){
void *buf = NULL;
int buf_size;
ec->a = 486662;
ec->b = 1;
ec->sign1 = ec->sign2 = 1;
ec->xs_4_y0 = NULL;
ec->points = NULL;
... |
JavaScript | UTF-8 | 207 | 3.828125 | 4 | [] | no_license | // String repeat
function repeatStr(n, s) {
let newString = "";
for (let i = 0; i < n; i++) {
newString += s;
}
return newString;
}
let test = repeatStr(5, "Ade");
console.log(test);
|
Markdown | UTF-8 | 5,583 | 3.890625 | 4 | [] | no_license | # 列挙子 Enum の使い方(発展)
ここでは、日本の硬貨を例にして、Enum の発展した使い方を見ていく。
日本の硬貨を enum にすると次のようになる。
``` java
enum CoinType {
ONE,
FIVE,
TEN,
FIFTY,
HUNDRED,
FIVE_HUNDRED,
;
}
```
Enum の基本的な取り扱い方を知りたい場合は、以下にアクセスしてほしい。
列挙子 Enum の使い方(基本)
https://github.com/fs5013-furi-sutao/java-enum-basic
## 定数と値を対応させる
... |
C++ | UTF-8 | 4,173 | 2.6875 | 3 | [] | no_license | #include <PDFdeal.h>
int extract_pdf(char *pdf_path, char **pageslist, char *out_path,char *password){
int count = 1; //源代码中是为了获取后续的命令行参数,这里不用
fz_context* ctx = NULL;
ctx = fz_new_context(NULL, NULL, FZ_STORE_UNLIMITED);
if (!ctx) {
cerr << "程序异常,不能创建mupdf上下文" << endl;
exit(EXIT_FAILURE);
}
pdf_write_op... |
JavaScript | UTF-8 | 911 | 3.453125 | 3 | [] | no_license | let img;
function preload(){
img = loadImage('bird.png');
}
function setup() {
createCanvas(img.width*18, img.height*18);
background(255);
btn1 = createButton('픽셀을 원으로 그리기');
btn2 = createButton('픽셀을 네모로 그리기');
btn1.mousePressed(circlePixels);
btn2.mousePressed(squarePixels);
image(img, 0, 0);
}
func... |
Markdown | UTF-8 | 6,286 | 2.703125 | 3 | [] | no_license | # vue2.0仿手机版美图官网
看着各位大神的vue项目泉涌而出,本阶段正在学习Vue的小小白也打算亲自操起键盘来感受一把Vue世界的美好~~
**线上体验** <br>
[在线demo](https://zsqio.github.io/vue-meitu-demo/vuex-meitu-demo/index.html#/) (切换到移动端模式预览效果更佳~)<br>
[Github源码](https://github.com/zsqio/vue-meitu) <br>
**技术栈** <br>
* vue2.0
* vue-router spa开发
* vuex 专为 V... |
PHP | UTF-8 | 1,043 | 2.734375 | 3 | [
"MIT"
] | permissive | <?php
class ValidateIntegerValueObject extends PHPUnit_Framework_TestCase
{
public function testCreateInteger()
{
$integer = new Enabler\Object\Integer(10);
$this->assertEquals(10, $integer->getValue());
}
/**
* @expectedException InvalidArgumentException
*/
public function testWrongValueForInteger()
{
... |
Python | UTF-8 | 539 | 3.0625 | 3 | [] | no_license | class Solution:
# @param num, a list of integers
# @return an integer
def majorityElement(self, num):
dict = {}
n = len(num)
if n == 1:
return num[0]
for i in num:
if i in dict:
count = dict[i]
count += 1
... |
Markdown | UTF-8 | 11,091 | 3.0625 | 3 | [
"MulanPSL-2.0",
"LicenseRef-scancode-mulanpsl-2.0-en",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ## 重构巨石应用至服务
本章节本电子书的第七章。章节一介绍了微服务架构模式,讨论了使用微服务的优缺点。接下来的章节,讨论了微服务架构图的不同方面:使用API网关,进程间通信,服务发现,事件驱动的数据管理和微服务部署。本章节我们将讨论将巨石应用迁移到微服务的策略方案。
我希望这本电子书能让你充分了解微服务架构,它的优点和缺点,以及何时使用它。也许微服务架构非常适合你的组织。
但是,你很可能正在处理一个大型的、复杂的巨石应用。你每天对开发与部署巨石应用的体验是缓慢与痛苦。微服务看起来是遥不可及的天堂。幸运的是,有一些策略可以用来摆脱巨石的地狱。在本篇中,我将会描述如何循序渐进的将巨石应用重构成一组微服务。
### 微服务重构概... |
Markdown | UTF-8 | 4,400 | 3.359375 | 3 | [] | no_license | ---
layout: post
title: Java Unit Test
date: 2014-12-06
---
最近在用Java进行一些开发,在写的过程中需要进行单元测试工作。选用的是JUnit作为单测框架,后续使用了EasyMock,和PowerMock进行一些mock工作。EasyMock主要来完成对对象级别的Mock,而PowerMock则是用来完成对于静态方法、构造函数的Mock。
至于上述mock是怎么做的,暂时还没有进行深入研究。这篇博客主要是记录下怎么使用的,为的是后面再用的时候能够快速的使用。
## 要测试的类
有A,B,C三个类,其中A是我们要测试的类,A类中包含B类,又会调用C的静态函数。
{... |
Markdown | UTF-8 | 624 | 2.640625 | 3 | [
"MIT"
] | permissive | # People.framework
[](https://github.com/Carthage/Carthage)
This is an example framework for iOS & Mac.
## Installation
[Carthage](https://github.com/carthage/carthage) is the recommended way to install People. Add the fol... |
C++ | UTF-8 | 650 | 3.5625 | 4 | [] | no_license | #include "MergeSort.h"
void MergeSort(int* arr, int s, int e) {
if(e > s) {
int mid = (s + e) / 2;
MergeSort(arr, s, mid);
MergeSort(arr, mid + 1, e); // Divide array into two parts.
int p = s, q = mid + 1, i = 0;
int* temp = (int*) malloc((e - s + 1) * sizeof(int));
while(true) { // Merge two a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.