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 | 1,715 | 2.640625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoffeeManagement
{
class Invoice
{
private int invoiceID,tableID;
private string employeeUser, status;
private DateTime dateSale;
pri... |
C++ | SHIFT_JIS | 1,827 | 2.578125 | 3 | [] | no_license | // gpwb_[t@C
#include"GameL/DrawTexture.h"
#include"GameL/WinInputs.h"
#include"GameL/SceneManager.h"
#include"GameL/DrawFont.h"
#include"GameL/Audio.h"
#include"GameL/UserData.h"
#include"GameHead.h"
void CObjEnding::Init()
{
key_flag = false;
move_flag = false;//Qڂ̃tF[hNp
m_fade_f = false;//1ڂ̃tF[hNp
m_fade = ... |
Python | UTF-8 | 308 | 3.703125 | 4 | [
"Unlicense"
] | permissive | class Car:
def __init__(self, make, petrol_consumption):
self.make = make
self.petrol_consumption = petrol_consumption
def petrol_calculation(self, price = 22.5):
return self.petrol_consumption * price
ford = Car("ford", 10)
money = ford.petrol_calculation()
print(money)
|
Java | UTF-8 | 3,418 | 2.328125 | 2 | [] | no_license | package com.wurmonline.server.creatures;
import com.wurmonline.server.bodys.BodyFactory;
import java.io.IOException;
public class FakeCreatureStatus extends CreatureStatus {
public String savedCreatureName = "UNSET";
public FakeCreatureStatus(Creature creature, float x, float y, float rot, int layer) {
... |
C | UTF-8 | 717 | 2.71875 | 3 | [
"MIT"
] | permissive | #include <assert.h>
#include <stdlib.h>
#include "new.h"
void * new(Class_t class, ...) {
Object_t * p = calloc(1, class->size); // Allocate space needed for object
assert(p);
p->class = class;
if(p->class->constructor) {
va_list ap;
va_start(ap, class);
p = p->class->constructor(p, &ap);
v... |
C++ | UTF-8 | 2,281 | 3.421875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
// Algorithm:
// Step - 1: Preprocess the pattern. Make an array that stores the size of the longest prefix which
// is also a suffix for pattern[0:i]
// Step - 2: Searching
// Start comparison of pat[j] with j = 0 with characters o... |
Markdown | UTF-8 | 2,081 | 3.203125 | 3 | [] | no_license | # Sprint Review Title (02-12-2019)
## Work Scheduled/Performed
| Action | Brief Description | Completed
|---|---|---|
| Back-End Creation | Create an API that will be our web application back-end | [Yes] |
| Admin Front-End Creation | Create a visual web page which will be used for application adminstrators ... |
SQL | UTF-8 | 6,839 | 3.1875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.5.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: 2016 年 10 月 20 日 19:02
-- サーバのバージョン: 10.1.10-MariaDB
-- PHP Version: 5.6.19
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */... |
Ruby | UTF-8 | 471 | 3.21875 | 3 | [] | no_license | class Market
attr_reader :name,
:vendors
def initialize(name)
@name = name
@vendors = []
@vendor_names = vendor_names
end
def add_vendor(vendor)
@vendors << vendor
end
def vendor_names
@vendor_names = @vendors.map do |vendor|
vendor.name
end
end
# def vend... |
Java | UTF-8 | 1,207 | 2.546875 | 3 | [] | no_license | package schedule.microservice;
import java.util.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.stereotype.*;
import schedule.model.*;
import schedule.repositories.*;
@Service
public class ServiceMicro {
@Autowired
ServiceRepo serviceRepo;
public ScheduleService save... |
Shell | UTF-8 | 377 | 3.59375 | 4 | [] | no_license | #!/usr/bin/env bash
append_suffix(){
case $1 in
1?) echo "${1}%{T5}th%{T-}" ;;
*1) echo "${1}%{T5}st%{T-}" ;;
*2) echo "${1}%{T5}nd%{T-}" ;;
*3) echo "${1}%{T5}rd%{T-}" ;;
*) echo "${1}%{T5}th%{T-}" ;;
esac
}
IFS=_ read -r month day rest < <(date "+%^B_%-d_%{F#4a4f4f}%... |
Java | UTF-8 | 3,869 | 2.296875 | 2 | [] | no_license | package cityBuilder.gameScreen;
import java.util.ArrayList;
import cityBuilder.load.Screen;
import cityBuilder.load.TilesLoad;
import cityBuilder.load.build.buildActor;
import cityBuilder.load.build.buildInventory;
import cityBuilder.load.inventory.Inventory;
import cityBuilder.load.inventory.InventoryActor;
import c... |
Python | UTF-8 | 504 | 4.3125 | 4 | [] | no_license | # Definiamo delle funzioni per l'esecuzione delle operazioni
# Addizione
def add(x, y):
return x+y
# Sottrazione
def subtract(x, y):
return x-y
# Moltiplicazione
def multiply(x, y):
return x*y
# Divisione
def divide(x, y):
if (y == 0):
raise ValueError("Can not divide by zero")
return x ... |
Markdown | UTF-8 | 1,586 | 3.265625 | 3 | [] | no_license | # Селектор даты
[importance 5]
Создайте тройной селектор даты, который выступает как единый компонент. То есть, можно подписываться на `"select"` сразу у этого компонента.
Конструктор:
```js
var dateSelector = new DateSelector({
yearFrom: 2010, // начальный год в селекторе
yearTo: 2020, // конечный год в селект... |
Ruby | UTF-8 | 464 | 2.546875 | 3 | [] | no_license | require_relative 'blog'
require_relative 'tweetable'
post = Blog::Post.new author: 'Lin Dong',
title: 'My Title',
body: 'Hi'
post.extend Tweetable
post.insert_comment Blog::Comment.new user: 'User1', body: "user1 body!"
post.insert_comment Blog::Comment.new user: nil, body:... |
Markdown | UTF-8 | 2,647 | 3.28125 | 3 | [] | no_license | #Command Line (Windows)
This is an alternative interface to Windows which it is important to become familiar with. In this window you can type what are sometimes called 'DOS' commands. These commands let you have a finer level of control of your PC, and are particularly important for programmers to master.
Here are s... |
JavaScript | UTF-8 | 2,351 | 3.09375 | 3 | [
"MIT"
] | permissive | import { getCameras } from './Modules/fetchCameras.mjs';
import { displayCamera } from './Modules/displayCamera.mjs';
import { cart, addToCart, updateBadgeIcon, displayCartItems } from './Modules/cart.mjs';
main();
// Main function
/**
* Get and display the cameras.
* Add an event listener to add an item in the ca... |
Java | UTF-8 | 202 | 1.507813 | 2 | [] | no_license | package net.boklab.core.client.user;
import com.google.gwt.event.shared.EventHandler;
public interface LoginRequestHandler extends EventHandler {
void onLoginRequest(LoginRequestEvent event);
}
|
C | UTF-8 | 1,272 | 3.984375 | 4 | [] | no_license |
/* Merge Sort
*
* COMPLEXITY: O(n log n)
*
* IMPLEMENTATION:
* Base Case: when the problem size is 1 or 0 the array is already sorted.
* Inductive Case: has three steps - recursively sort each half of the array and then
* merge the two together.
* Merging: set i and j to 1. If A1[i] is smaller than A2[j... |
Ruby | UTF-8 | 127 | 2.515625 | 3 | [] | no_license | #!/usr/bin/ruby
str = <<END
This is super long strings
with multiple lines
and different special characters.
END
print str
|
C# | UTF-8 | 1,417 | 2.8125 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum PlayerType
{
Player,
AI
};
public class PlayerModel
{
string name = "";
int money = 0;
int score = 0;
int stayFieldId = 0;
PlayerType playerType;
public PlayerModel(string name, int money, int ... |
C++ | UTF-8 | 312 | 2.5625 | 3 | [] | no_license | #include<iostream>
#include<cmath>
#include<string>
#include<omp.h>
#include<stdio.h>
#include<cstring>
using namespace std;
int main()
{
int T;
cin >> T;
while (T--)
{
int n, a, b;
scanf("%d%d%d",&n,&a,&b);
if ((n - 1) % (a + b) >= a)
printf("Alice\n");
else
printf("Bob\n");
}
return 0;
}
|
C | UTF-8 | 805 | 3.484375 | 3 | [
"MIT"
] | permissive | #include <stdio.h>
#include <stdlib.h>
int main(){
int queue[100], q_size, head, seek =0, diff;
float avg;
printf("%s\n", "***FCFS Disk Scheduling Algorithm***");
printf("%s\n", "Enter the size of the queue");
scanf("%d", &q_size);
printf("%s\n", "Enter queue elements");
for(int i=1... |
Java | UTF-8 | 341 | 1.867188 | 2 | [] | no_license | package in.uskcorp.tool.dmt.dao;
import java.util.List;
import in.uskcorp.tool.dmt.domain.Trainee;
import in.uskcorp.tool.dmt.domain.TrainingSummary;
public abstract class TraineeDAO extends APIDAO<Trainee> {
public abstract List<TrainingSummary> getSummary();
public abstract List<Trainee> readByValues... |
Java | UTF-8 | 616 | 3.09375 | 3 | [] | no_license |
public final class Employee {
private final String firstName;
private final String lastName;
private final Address address;
Employee(String firstName, String lastName, Address address)
{
this.firstName = firstName;
this.lastName = lastName;
this.address = new Address(address... |
Python | UTF-8 | 1,811 | 2.625 | 3 | [] | no_license | from flask import Blueprint, render_template, session, request
from AccessManagement import login_required
from Database import database
from Utilities import get_text_input, logger
create = Blueprint('create', __name__, template_folder='templates')
# Checks if the april tag id is valid.
# Returns the id as an int ... |
Java | UTF-8 | 714 | 3.078125 | 3 | [] | 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 graphic;
import javafx.scene.paint.Color;
/**
* Enum to manage the color of the Pawn
* @author p1509283
*/
... |
Java | UTF-8 | 1,432 | 1.984375 | 2 | [] | no_license | package com.rjxx.taxeasy.dao.bo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.rjxx.comm.json.JsonDatetimeFormat;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* t_wxkb 实体类
* 由GenEntityMy... |
Java | UTF-8 | 3,070 | 2.03125 | 2 | [] | no_license | package tw.InHouse.order_model;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
i... |
Java | UTF-8 | 2,023 | 2.375 | 2 | [] | no_license | package com.linzhijia.boot.domain;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
@Entity
public class TradeInfo {
... |
C++ | UTF-8 | 1,086 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <functional>
#include <unistd.h>
#include "nf_event.h"
#include "nf_event_iotask.h"
using namespace std::placeholders;
void cbfunc(EventLoop *loop, task_data_t data, int mask) {
IOTask &task = *((IOTask *)data.data.ptr);
std::cout << task.GetFd() << std::endl;
std::cout << mask << ... |
JavaScript | UTF-8 | 3,297 | 3.015625 | 3 | [] | no_license | // ** Notes ** //
// all actions associated with the dashboard components
// Importing the request functionality from the api.js that enables us to check auth with all our requests
import request from '../utils/api'
// Dispatched when getting all shopping list data - see dispatch in getShoppingLists() - and used to ... |
Java | UTF-8 | 2,462 | 2.59375 | 3 | [] | no_license | package com.modelmetrics.cloudconverter;
import com.modelmetrics.common.sforce.SalesforceSession;
import com.modelmetrics.common.sforce.SalesforceSessionFactory;
import com.modelmetrics.common.util.TestCaseWithDevOrg;
import com.sforce.soap.partner.DescribeSObjectResult;
import com.sforce.soap.partner.Field;
/**
* T... |
C++ | UHC | 655 | 3.03125 | 3 | [] | no_license | #include <iostream>
// https://www.acmicpc.net/problem/15552
//C++ ϰ ְ cin/cout ϰ Ѵٸ, cin.tie(NULL) sync_with_stdio(false) ְ, endl (\n) . , ̷ ϸ ̻ scanf/printf/puts/getchar/putchar C ϸ ȴ.
//cin.tie(NULL) sync_with_stdio(false) ӵ ش.
using namespace std;
int sum()
{
cin.tie(NULL);
ios_base::sync_with_stdi... |
Markdown | UTF-8 | 1,748 | 2.859375 | 3 | [] | no_license | # Cadastro de carro
**RF**
Deve ser possivel cadastrar um carro
**RN**
Não deve ser possivel cadastrar um carro com uma placa ja existente.
Não deve ser possivel alterar a placa de um carro para uma placa ja existente.
O carro deve ser cadastrado por padrao com disponibilidade.
Não deve ser possivel cadastrar um carr... |
Python | UTF-8 | 4,836 | 2.84375 | 3 | [] | no_license | import random
from cs231n.data_utils import load_CIFAR10
import numpy as np
import matplotlib
matplotlib.use('Agg')
import pylab
import matplotlib.pyplot as plt
from cs231n.classifiers import KNearestNeighbor
def time_function(f, *args):
import time
tic = time.time()
f(*args)
toc = time.time()
... |
C# | UTF-8 | 3,739 | 2.53125 | 3 | [
"BSD-2-Clause",
"ISC"
] | permissive | using System;
using FluentAssertions;
using NextLevelSeven.Core;
using NextLevelSeven.Core.Encoding;
using NextLevelSeven.Test.Testing;
using NUnit.Framework;
namespace NextLevelSeven.Test.Core
{
[TestFixture]
public class EscapeFunctionalTestFixture : CoreBaseTestFixture
{
private static void Tes... |
Python | UTF-8 | 112 | 2.875 | 3 | [] | no_license | import math
import sys
a, b, v = map(int, sys.stdin.readline().split())
print(math.ceil((v - a) / (a - b)) + 1) |
Go | UTF-8 | 217 | 2.625 | 3 | [] | no_license | package solution
import "sort"
// Runtime 76 ms
// Memory 6.7 MB
func arrayPairSum(nums []int) int {
sort.Sort(sort.IntSlice(nums))
sum := 0
for i := 0; i < len(nums); i += 2 {
sum += nums[i]
}
return sum
}
|
Markdown | UTF-8 | 578 | 2.8125 | 3 | [
"MIT"
] | permissive |
# Individual reflection Dino Paslic – Week 4
## what do I want to learn or understand better?
Making good website design
## how can I help someone else, or the entire team, to learn something new?
Continue learning about the backend so that I can help the rest of the team
## what is my contribution towards the team... |
C++ | UTF-8 | 2,588 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | /*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 13. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http:/... |
JavaScript | UTF-8 | 94 | 2.75 | 3 | [] | no_license | function solution(numbers) {
return numbers.reduce((acc,e)=>acc+e, 0) / numbers.length;
}
|
C# | UTF-8 | 2,034 | 2.75 | 3 | [
"MIT"
] | permissive | using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text;
using Jurassic;
using SquishIt.Framework;
namespace SquishIt.CoffeeScript.Coffee
{
public class NativeCoffeeScriptCompiler
{
public string Compile(string file)
{
StringBuilder ... |
C# | UTF-8 | 1,177 | 2.828125 | 3 | [] | no_license | using System.Collections.Generic;
using System.Threading.Tasks;
using AutoMapper.Configuration;
namespace SmokeEnGrill.API.Data
{
public class RetrofitRepository : IRetrofitRepository
{
private readonly DataContext _context;
private readonly IConfiguration _config;
public RetrofitReposi... |
Java | UTF-8 | 770 | 2.765625 | 3 | [] | no_license | package Eventials.mailbox;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Base64;
public class MailboxUtils{
static String readBinaryFileAsString(File file){
try{
String data = Base64.getEncoder().encodeToString(Files.readAllBytes(f... |
Python | UTF-8 | 3,966 | 2.8125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from sklearn.preprocessing import LabelBinarizer
from keras import datasets, layers, models, callbacks
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix
#load data
(train_images, train_labels), (tes... |
SQL | UTF-8 | 14,955 | 3.078125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jan 06, 2017 at 01:04 PM
-- Server version: 10.1.13-MariaDB
-- PHP Version: 5.6.23
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CL... |
PHP | UTF-8 | 76 | 2.8125 | 3 | [] | no_license | <?php
// search text within a string
echo strpos("Hello world", "world");
?> |
Java | UTF-8 | 839 | 1.90625 | 2 | [] | no_license | /**
*
*/
package com.storm.core.bolts;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import backtype.storm.topology.BasicOutputCollector;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.base.BaseBasicBolt;
import backtype.storm.tuple.Tuple;
/**
* @author vinaybhore
*... |
Java | UTF-8 | 3,390 | 2.578125 | 3 | [] | no_license | package com.keepfit.stepdetection.algorithms.kornel;
import android.content.Context;
import com.keepfit.stepdetection.algorithms.AccelerationData;
import com.keepfit.stepdetection.algorithms.BaseAlgorithm;
import java.util.ArrayList;
import java.util.List;
/**
* Created by kornelkotan on 23/02/2016.
*/
public cla... |
Go | UTF-8 | 1,209 | 2.859375 | 3 | [
"MIT"
] | permissive | package commands
import (
"github.com/urfave/cli"
"github.com/dveselov/go-libreofficekit"
"errors"
)
var (
DOC_ERR = "cannot load document to libre office"
SAVE_ERR = "cannot save as document to libre office"
)
func Convert(path string) *cli.Command{
format := ""
return &cli.Command{
Name: "convert",
A... |
SQL | UTF-8 | 263 | 2.671875 | 3 | [] | no_license |
CREATE proc actionUpdateSpeed as begin
set noCount on
if exists(select * from actions where actionN=1 and timeOfOldestRequest is not null)
begin
update actions set timeOfOldestRequest=null where actionN=1;
exec dbo.updateSpeed
end
end
|
Markdown | UTF-8 | 787 | 3.671875 | 4 | [
"MIT",
"LicenseRef-scancode-free-unknown"
] | permissive | # Ranking
A Ranking anomaly detector is one that assigns anomaly scores to samples in a dataset. The interface provides the `rank()` method which returns a set of scores from a dataset object.
## Score a Dataset
Return the anomaly scores for each sample in a dataset:
```php
public rank(Dataset $dataset) : array
```
*... |
C++ | UTF-8 | 2,915 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <vector>
#include <map>
static uint64_t const N = 524288;
static uint64_t const P = 524812289;
static uint64_t const G = 194516551;
struct big_integer {
explicit big_integer(std::string const &str) {
sign = str[0] == '-';
for (size_t i = str.length()... |
Java | UTF-8 | 653 | 1.90625 | 2 | [] | no_license | package com.nokia.application.ossuamws.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.nokia.application.ossuamws.model.Request.OperatorDetailsRequest;
import com.no... |
C++ | UTF-8 | 658 | 3.25 | 3 | [] | no_license | #ifndef __REVERSE__
#define __REVERSE__
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class Solution {
public:
void reverseWords(string &s) {
vector<string> strVec;
int start, end;
start = end = 0;
int cur = 0;
while(cur != string::npos){
start = s.find_first_not_o... |
C# | UTF-8 | 3,711 | 3.5625 | 4 | [] | no_license | using System;
using System.Collections.Generic;
namespace myfirstdotnet
{
class Program
{
static void Main(string[] args)
{
// string place = "Coding Dojo";
// Console.WriteLine($"My name is {0}, I am " + 28 + " years old", "Tim");
// for (in... |
Java | ISO-8859-1 | 1,588 | 2.640625 | 3 | [] | no_license | /**
*
*/
package org.airhispania.xplane2rc.apt.model;
import java.util.List;
/**
* @author Jose Manuel Garca Valladolid - josemanuelgv@gmail.com
*
* AIRPORT DATA (APT.DAT) FILE SPECIFICATION VERSION 1000
*/
public class LandRunway {
public static int APT_CODE = 100;
/**
* Width ... |
Java | UTF-8 | 768 | 2.3125 | 2 | [
"MIT"
] | permissive | package org.fluentjava.mockodore.util.sidripper;
import java.util.Arrays;
import java.util.List;
import org.fluentjava.mockodore.model.sid.SidRegisterAddress;
public class SidWriteListenerHub implements SidWriteListener {
private final List<SidWriteListener> delegates;
private SidWriteListenerHub(List<SidWriteLi... |
Markdown | UTF-8 | 2,779 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | ---
layout: post
title: mysql中多版本并发控制
date: 2019-05-13
---
> 为了解决写数据时,不可以对数据进行读的问题。mysql引入的多版本并发控制(MVCC)

提innodb中对于数据表,系统会在表的上增加3列系统列,分别是:DB_ROW_ID、DB_TRX_ID、DB_ROLL_PTR。我们可以从代码中看到:
```
dict_table_add_system_columns(
/*===========... |
C++ | UTF-8 | 3,002 | 3 | 3 | [
"Unlicense"
] | permissive |
// Required includes
// #include <stdint.h>
// #include <iostream>
// #include <vector>
class Histogram final
{
public:
class HistogramValue final
{
friend class Histogram;
public:
HistogramValue();
~HistogramValue();
private:
int64_t valueIteratedTo;
int64_t ... |
Shell | UTF-8 | 4,620 | 3.5625 | 4 | [] | no_license | #!/bin/bash
set -e
if [ $# -ne 3 ];then
echo "usage: $0 TestType Platform TestCase"
exit 1
fi
#----------------------------------------------------------------------------------------
TestType="$1"
Platform="$2"
TestCase="$3"
#----------------------------------------------------------------------------------------
... |
C++ | UTF-8 | 1,604 | 2.875 | 3 | [] | no_license | String toHex(uint16_t dec){
//double majorD = dec/16;
//Serial.println("dec = " + String(dec));
int major = dec/16;
//double minor = majorD - major;
int minor = dec%16;
//Serial.println("major = " + String(major));
//Serial.println("minor = " + String(minor));
int intVal[2];
intVal[0] = major;
int... |
JavaScript | UTF-8 | 2,611 | 2.875 | 3 | [] | no_license | var xhr = new XMLHttpRequest()
xhr.open("GET","https://raw.githubusercontent.com/Rajavasanthan/jsondata/master/pagenation.json", true)
xhr.send()
xhr.onload=function() {
var data = JSON.parse(this.response);
let final = document.createElement('div');
final.setAttribute('id','final1');
documen... |
PHP | UTF-8 | 242 | 2.6875 | 3 | [] | no_license | <?php
namespace App;
class Option
{
public $id;
public $name;
public $sub;
public function __construct($id, $name, $sub = false)
{
$this->id = $id;
$this->name = $name;
$this->sub = $sub;
}
} |
C# | UTF-8 | 1,357 | 3.3125 | 3 | [] | no_license | namespace P2_06_ByteBank
{
class ContaCorrente
{
private Cliente _titular;
public Cliente Titular
{
get => _titular;
set { _titular = value; }
}
public int _agencia;
public int Agencia { get => _agencia; set { _agencia = value; } }
... |
PHP | UTF-8 | 692 | 2.515625 | 3 | [] | no_license | <?php
$courseID = $_GET['id'];
try {
$con = new PDO("mysql:host=localhost;dbname=youthcyb_cs160s4g2;charset=utf8mb4", "youthcyb_160s4g2", "group2gumface");
$con->exec("set names utf8");
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "INSERT INTO roadmap_data (course_id)
VALUES (... |
Python | UTF-8 | 2,316 | 2.515625 | 3 | [
"MIT"
] | permissive | from django.urls import reverse, resolve
from django.test import TestCase
from users.views import signup
from users.models import CustomUser
from users.forms import CustomUserCreationForm
class SignUpTests(TestCase):
def setUp(self):
url = reverse('signup')
self.response = self.client.get(url)
... |
Markdown | UTF-8 | 713 | 3.078125 | 3 | [] | no_license | # Scrabble-Game
It takes input as a bag of letters and finds a word of maximum score(based on a formula) from a dictionary of words which is broken into smaller dictionaries on the basis of word's length.
Words selected from dictionary can be created from letters in bag.
# Sample-Inputs
- O* tbLush
- Zy ms*e
... |
Java | UTF-8 | 937 | 2.359375 | 2 | [] | no_license | package com.apps.testpackage;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class scrolldown {
public static void main(String[] args) {
//Wait <WebDriver> wait = null;
System.setProperty("webdriver.chrome.driver", "/U... |
TypeScript | UTF-8 | 774 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | import { ScaleConfig } from '../../common/types';
import { ScaleType } from '../../common/constants';
import { Size } from '../../../../utils/types';
const X_TICK_DISTANCE_PX = 100;
// Y ticks can be closer since the height of a label is much less than the max width of a label across multiple resolutions
const Y_TICK_... |
Java | UTF-8 | 232 | 1.75 | 2 | [
"Apache-2.0"
] | permissive | package com.common.android.utils.input;
import android.view.KeyEvent;
public interface KeyListener {
boolean onKeyUp(final int keyCode, final KeyEvent event);
boolean onKeyDown(final int keyCode, final KeyEvent event);
} |
SQL | UTF-8 | 28,215 | 3.125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.7.0-dev
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 29, 2016 at 10:45 PM
-- Server version: 10.1.10-MariaDB
-- PHP Version: 7.0.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET... |
Markdown | UTF-8 | 1,711 | 2.890625 | 3 | [] | no_license | # Custom block page
The original Pi-Hole code has been modified, first modified 26/06/2018. [License](https://github.com/pi-hole/pi-hole/blob/master/LICENSE).
Info/steps on my custom Pi-Hole block page. It's not finished yet I don't think, but I hope this works as a helpful guide for others.
Thanks to Pi-Hole (Ori... |
Java | UTF-8 | 2,116 | 3.046875 | 3 | [] | no_license | package modele;
import java.util.ArrayList;
import java.util.HashMap;
import javax.swing.ButtonGroup;
import javax.swing.JRadioButton;
import dao.HeuresSessionModuleDao;
import dao.ModuleDao;
/**
* Objet qui contient la liste des boutons reliés aux matières de la session
*
* @author Jerome
*
*/
public class B... |
Markdown | UTF-8 | 1,094 | 2.921875 | 3 | [] | no_license | # ReactAPILAyer
JavaScript API Layer
Fetching data from an API is not a React specific concept however; there Axios is a tool that helps
Axios is a PROMISE based HTTP client for making HTTP requests from a browser to any web server.
Features of Axios :
• Makes XMLHttpRequests from browser to web server
• M... |
Markdown | UTF-8 | 821 | 2.75 | 3 | [
"MIT"
] | permissive | # mshenfield.dev
This is the source code for my resume/vanity project/spot to plop random crap down [mshenfield.dev](https://mshenfield.dev).
This is a site that is just POHTML and POJS and POCSS. It shows in some spots, but it's refreshing to see how powerful
these foundational tools have become.
## Running
The e... |
Markdown | UTF-8 | 7,300 | 2.6875 | 3 | [] | no_license | # 가상환경 구축
* 가상환경을 구축하는 이유
* 여러 패키지를 사용하다 보면, 패키지의 버전차이, 또는 각종 이유로 충돌이 발생하게 된다. 따라서 최소한의 기능을 가진 깨끗한 공간이 필요하기에 가상환경을 구축한다.
* 가상환경을 구축하기 위해서는 우선 내 기준으로 설명하자면 다른 번잡스러운 것들을 없애기 위해서 바탕화면을 기준으로 시작한다
* python 터미널에서 python -m venv 폴더이름을 생성
* 폴더이름을 project라고 가정 후
* project 폴더로 이동 : cd project
* Scripts 폴더로 이동 : cd Scripts
* ... |
PHP | UTF-8 | 822 | 2.65625 | 3 | [] | no_license | <?php
// Mulai session
session_start();
// Load twig.php
require_once __DIR__.'/twig.php';
// Load konfigurasi database
include 'connection.php';
//ambil data dari database
$sql = "SELECT * FROM product";
$result = $conn->query($sql);
$data =null;
if ($result->num_rows > 0) {
foreach ($result as $index => $value)... |
Go | UTF-8 | 825 | 3.140625 | 3 | [] | no_license | package main
/* Stolen from https://github.com/bitly/go-notify/blob/master/notify.go */
import (
"sync"
)
var subscriber = &subscriptions{
count: 0,
clients: make(map[int]chan string),
}
type subscriptions struct {
count int
clients map[int]chan string
sync.RWMutex
}
type client struct {
id int
cha... |
PHP | UTF-8 | 2,399 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | <?php declare(strict_types = 1);
namespace ForkNetwork\StrictPHPUnit\Tests\Framework;
use ForkNetwork\StrictPHPUnit\StrictTestTrait;
use ForkNetwork\StrictPHPUnit\Tests\Framework\Fixtures\GenericClass;
use PHPUnit\Framework\ExpectationFailedException;
use PHPUnit\Framework\TestCase;
class StrictTestCaseTest extends ... |
Java | UTF-8 | 1,797 | 2.640625 | 3 | [] | no_license | package com.demo.spring;
import javax.jms.JMSException;
import javax.jms.TextMessage;
import org.apache.activemq.Message;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;
@Component
public ... |
Markdown | UTF-8 | 2,144 | 3.578125 | 4 | [] | no_license | # Single Responsibility Principle
Single Responsibility Principle ,中文含义是 单一职责原则。
## 定义
There should never be more than one reason for a class to change.
## 单一职责原则的优点
* 类的复杂性降低
* 可读性提高
* 可维护性提高
* 变更引起的风险降低
注:单一职责原则提出了一个编写程序的标准,用“职责”或“变化原因”衡量接口或类设计得是否优良,但这些都是不可度量的,所以,我们需要因项目而异,因环境而异
# 单一职责原则同样适用于方法
即一个方法尽可能做一件事。... |
C++ | UTF-8 | 5,998 | 3.25 | 3 | [] | no_license | // Base Module Code
// s - show, t - test, a - act, A - address, B - on selectout, C - off selectout
// mode 1- initial(ask is device there), 2 - send an address to set, 3 - send command to on (B)/off (C) select or request to act or test
// a (act), t (test) : 1-forward, 2- reverse, 3-right, 4- left, 5- stop (no test t... |
Java | UTF-8 | 2,489 | 2.140625 | 2 | [] | no_license | package com.zhongjian.shedule;
import java.net.URISyntaxException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
impor... |
Java | UTF-8 | 26,274 | 1.585938 | 2 | [] | no_license | package com.oxigenoxide.balls;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture... |
Markdown | UTF-8 | 1,841 | 2.703125 | 3 | [] | no_license | ## Angular material datepicker

This small component is still in production it's a simple date picker based on the angular-material port of polymer by the people behind ionic
https://material.angularjs.org/
##Install
This component is bower and npm registered
```css
bower... |
Go | UTF-8 | 2,781 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | package rabbitmq
import (
"net"
"time"
"github.com/jpillora/backoff"
"github.com/julienbreux/rabdis/pkg/logger"
"github.com/julienbreux/rabdis/pkg/rabbitmq/consumer"
"github.com/julienbreux/rabdis/pkg/rabbitmq/message"
"github.com/julienbreux/rabdis/pkg/url"
"github.com/streadway/amqp"
)
// RabbitMQ represen... |
Java | UTF-8 | 1,605 | 2.46875 | 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 dominiobroker;
import java.util.ArrayList;
/**
*
* @author javie
*/
public class Curso {
private ArrayList<Maestro... |
C++ | UTF-8 | 662 | 2.96875 | 3 | [] | no_license | #include "student_data.h"
student_data::student_data(QString& in_student_id,QString& in_name,QString& in_sex,QString& in_nation,QString& in_department,QString& in_native_place)
{
this->student_id = in_student_id;
this->name = in_name;
this->sex = in_sex;
this->nation = in_nation;
this->depa... |
C++ | UTF-8 | 725 | 2.9375 | 3 | [] | no_license | #include <stdio.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <stdint.h>
int main() {
std::vector<long> vec;
int n;
scanf("%d", &n);
vec.resize(n);
for (int i = 0; i < n; ++i) {
scanf("%ld", &vec[i]);
}
int negative = 0;
uint64_t ret = 0;
bool has_z... |
SQL | UTF-8 | 5,532 | 3.03125 | 3 | [] | no_license |
CREATE DATABASE IF NOT EXISTS hh_test;
\connect hh_test;
-- Enables heavy_hitters plugin and plpython2u plugin
CREATE EXTENSION IF NOT EXISTS plpython2u;
CREATE EXTENSION IF NOT EXISTS heavy_hitters;
-- Sample table, imagining data being collected for different sites
DROP TABLE IF EXISTS stats;
CREATE TABLE stats ... |
Python | UTF-8 | 1,800 | 3.296875 | 3 | [] | no_license | from statistics import mean
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
import random
style.use('fivethirtyeight')
#xs = np.array([1,2,3,4,5,6], dtype=np.float64)
#ys = np.array([5,4,6,5,6,7], dtype=np.float64)
def create_dataset(hm, variance, step=2,correlation = False):
... |
Java | UTF-8 | 337 | 3.25 | 3 | [] | no_license | import java.util.Scanner;
public class Odd {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
System.out.println("enter the number");
int n=s.nextInt();
int even=0;
for(int i=0;i<=n;i++)
{
if(i%2==0)
{
even=even+i;
}
}
System.out.println(... |
Python | UTF-8 | 138 | 3.75 | 4 | [] | no_license | def areYouPlayingBanjo(name):
if name[0].upper() == 'R':
return f'{name} plays banjo'
return f'{name} does not play banjo' |
Java | UTF-8 | 294 | 1.703125 | 2 | [] | no_license | package com.xjw.service.message;
import com.xjw.base.service.BaseServcie;
import com.xjw.entity.po.message.MessageUser;
import com.xjw.utility.BizException;
public interface MessageUserService extends BaseServcie<MessageUser>{
public void deleteById(Long id) throws BizException;
}
|
Java | UTF-8 | 3,046 | 2.234375 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2013 IIT , NCSR Demokritos - http://www.iit.demokritos.gr,
* SciFY NPO - http://www.scify.org
*
* This product is part of the PServer Free Software.
* For more information about PServer visit http://www.pserver-project.org
*
* Licensed under the Apache License, Version 2... |
C++ | BIG5 | 953 | 3.84375 | 4 | [] | no_license | #include <iostream>
using namespace std;
class Polynomial
{
int p1,p2,p3;
public:
// Polynomial()
// {
// p1=0;
// p2=0;
// p3=0;
// }
Polynomial(int _p1=0,int _p2=0,int _p3=0); //w]غcl
void print_data()
{
cout<<p1<<"x^2";
judge(p2); //P_᭱O_Ʀr ܥ[W[ S X
if(p2!=0)
cout<<p2<<"x";
judge(... |
Java | UTF-8 | 1,734 | 2.328125 | 2 | [
"Apache-2.0"
] | permissive | package com.octopus.utils.xml.auto.pointparses;
import com.octopus.utils.alone.StringUtils;
import com.octopus.utils.xml.XMLObject;
import com.octopus.utils.xml.auto.IPointParse;
import com.octopus.utils.xml.auto.XMLParameter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import... |
Java | UTF-8 | 2,636 | 3.96875 | 4 | [
"MIT"
] | permissive | package calculator;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try(Scanner sc = new Scanner(System.in)) {
System.out.println("Enter your first number");
int a = sc.nextInt();
System.out.println("Enter your second number");
int b = sc.nextInt();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.