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 |
|---|---|---|---|---|---|---|---|
JavaScript | UTF-8 | 75,368 | 2.75 | 3 | [] | no_license | //import funkcji sprawdzających czy user lub komputer może postawić statek
import {
oneSquareHorizontal,
twoSquaresHorizontal,
threeSquaresHorizontal,
fourSquaresHorizontal,
oneSquareVertical,
twoSquaresVertical,
threeSquaresVertical,
fourSquaresVertical,
} from './conditions.js';
//zmienne dla planszy... |
Java | UTF-8 | 1,659 | 3.3125 | 3 | [] | no_license | import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
class ListOps {
static <T> List<T> append(List<T> list1, List<T> list2) {
Arra... |
Markdown | UTF-8 | 7,673 | 2.859375 | 3 | [] | no_license | ---
title: Head First Python 笔记
date:
tags: python入门
categories: python
---
### 第一章
点记法调用方法
append()--列表末尾添加
pop()--列表末尾删除
extend()--列表末尾添加数据项集合
remove()--删除特定项
insert(0,'able')--特定位置前添加项
len()--长度
for 目标标识符 in 列表:
列表处理
(!for 只打印外列表的各数据项)
isinstance()--判断当前处理的特定标识符是否本身为某特定类型数据
dir(_bulitins_)... |
Markdown | UTF-8 | 1,202 | 2.9375 | 3 | [] | no_license | #序列化-Rustful

序列化过程
````
在Python的Django框架中,解释就很明显了。将ORM对象(queryset)等转化为JSON或者XML编码格式的数据。
反序列化与之相反。
restful,请求进来(经过视图层),获取数据库中需要的数据,然后转为json格式,那样可以给前端,
或者其他程序调用。或者请求数据以JSON格式进来,转化为数据库能接收的形式,
存到数据库(反序列化)。
````
````
1.我们可以通过统一资源标识符(Universal Resource Identifier,URI)来识别和定位资源,
并且针对这些资源而执行的操作是通过 HT... |
Java | UTF-8 | 2,451 | 2.40625 | 2 | [] | no_license | /*
* Created on 18 Apr 2017 ( Time 13:24:45 )
* Generated by Telosys Tools Generator ( version 2.1.1 )
*/
package org.trams.hello.business.service.mapping;
import org.modelmapper.ModelMapper;
import org.modelmapper.convention.MatchingStrategies;
import org.springframework.stereotype.Component;
import org.trams.hell... |
Java | UTF-8 | 6,016 | 2.5 | 2 | [] | no_license | package com.whatmygpa.dao;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.persistence.TypedQuery;
import com.whatmygpa.models.CourseEnrollment;
import com.whatmygpa.models.CourseEnrollmentPK;
import com.wha... |
JavaScript | UTF-8 | 944 | 4.03125 | 4 | [] | no_license | //takes JSON and converts it to HTML recursively
function convertJsonToHtml(jsonObject) {
const content = jsonObject.content;
const tag = jsonObject.tag;
//if the next level down is an object, wrap it in element defined by tag and pass it recursively
if (isObject(content))
{
return (`<${tag}>${convertJso... |
Java | UTF-8 | 3,232 | 2 | 2 | [] | no_license | package ru.fitnessmanager.controller.userparameters;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotat... |
C++ | UTF-8 | 2,032 | 3.8125 | 4 | [] | no_license | #include<iostream.h>
#include<conio.h>
#include<process.h>//for exit function
#include<dos.h> //for delay function
struct node
{
int data;
node *next;
};
class STACK
{
node *top;
public:
STACK()
{
top=NULL;
}
void push();
void pop();
void display();
~STACK();
};
void STACK::push()/*functio... |
Java | UTF-8 | 1,529 | 2.34375 | 2 | [] | no_license | package teqvirtual.deep.fashionbook.Adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import teqvirtual.deep.fa... |
Ruby | UTF-8 | 214 | 3.109375 | 3 | [] | no_license | original = "Welcome to the forum.\nHere you can learn Ruby.\nAlong with other members.\n"
string_list = original.split("\n")
string_list.with_index(0) do |index, line|
puts "Line %d: %s" % [index + 1, line]
end |
Java | UTF-8 | 2,412 | 2.65625 | 3 | [] | no_license | import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.junit.Assert.*;
public class HamletParserTest {
private String hamletText;
private HamletParser hamletParser;
@Before
public void setUp() {
... |
Python | UTF-8 | 3,100 | 2.65625 | 3 | [] | no_license | import re
from commcare_export.minilinq import Apply, Literal, Reference
SELECTED_AT = 'selected-at'
SELECTED = 'selected'
TEMPLATE = 'template'
SUBSTR = 'substr'
class ParsingException(Exception):
def __init__(self, message):
self.message = message
def parse_function_arg(slug, expr_string):
"""
... |
PHP | UTF-8 | 7,890 | 2.828125 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Console\Commands;
use App\Shortcode;
use Goutte\Client;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
class ScapeShortcodes extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'scrape:sh... |
JavaScript | UTF-8 | 1,204 | 2.703125 | 3 | [] | no_license | const createTooltip = require('./src/createTooltip');
const removeTooltip = require('./src/removeTooltip');
const insertElement = require('./src/helpers/insertElement');
const getDefaultConfig = require('./src/helpers/getDefaultConfig');
const objectAssign = require('./src/helpers/objectAssignPolyfill');
objectAssign.... |
Shell | UTF-8 | 343 | 2.90625 | 3 | [] | no_license | #!/bin/bash
set -ex
cd docker
names=`echo push-go-{app,endpoint,log,notification,subscription}`
for name in $names
do
sed -e "s/{NAME}/$name/g" Dockerfile.template > $name
docker build -f $name -t nokamotohub/$name .
docker push nokamotohub/$name
done
./test.sh
for name in $names
do
docker push ... |
Python | UTF-8 | 1,899 | 2.609375 | 3 | [] | no_license | from luma.core.render import canvas
from luma.core.interface.serial import i2c
from luma.oled.device import ssd1306
from PIL import ImageFont
import time
import datetime
from pygame import mixer
serial = i2c(port=0, address=0x3C)
device = ssd1306(serial)
running = True
mixer.pre_init(22050, -8, 2, 512, None)
mixer.ini... |
C | UTF-8 | 7,416 | 2.515625 | 3 | [
"MIT"
] | permissive | /**
* @file web_server.c
* @brief implementation of web server.
* @author Xiangyu Guo
*/
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>
#include <event2/event.h>
#include <event2/http.h>
#inclu... |
Shell | UTF-8 | 259 | 2.78125 | 3 | [] | no_license | #!/bin/bash
for process in $(ps -A -o pid | tail -n +2)
do
status="/proc/$process/status"
sched="/proc/$process/sched"
ppid=$(grep -hsi "PPid:" "$status" | awk 'BEGIN{FS="\t"}{print $2}')
sleepavg=$(grep -hsi "avg_atom" "$sched" | grep -o "[0-9.]\+
"
done
|
SQL | UTF-8 | 1,900 | 3.828125 | 4 | [
"MIT"
] | permissive | \connect mypostgraphile;
create schema mygraphile;
/*Create user table in mygraphile schema*/
CREATE TABLE mygraphile.user (
id SERIAL PRIMARY KEY,
username VARCHAR (255) NOT NULL,
created_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
COMMENT ON TABLE mygraphile.user IS
'Forum users.';
/*Create post table ... |
C++ | GB18030 | 1,673 | 3.453125 | 3 | [] | no_license | /**
* POJ1328 Radar Installation
* ̰
* ÿ״ﰲõĺ䣬Щ䰴˵
* ұһϲ˵ܱͬһ״̽⣬Ϊ佻
*/
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
struct node {
double left, right;
bool operator<(const node &b) const
{
return left < b.left;
}
};
int main()
{
std::ios... |
C# | UTF-8 | 1,747 | 3.109375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StringGraph
{
public class Node
{
public Graph Graph { get; internal set; }
public string Value { get; set; }
public List<Node> Nodes { get; set; } = new List<N... |
TypeScript | UTF-8 | 2,922 | 2.859375 | 3 | [] | no_license | // console.log('My first typescript server'); //debug purposes
// do not use ts-node! Use "node ..."
// import * as express from 'express'; //commented due to import error
/*
import express = require('express');
// import INC = require("./incident");
// import INC = require("c:/Users/Kta/Documents/firstAngularApp/serve... |
Java | UTF-8 | 1,393 | 2.796875 | 3 | [] | no_license | package DataMapper;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.io.*;
@Test
public... |
Python | UTF-8 | 928 | 2.671875 | 3 | [] | no_license | import networkx as nx
import matplotlib.pyplot as plt
import numpy as np
from graph import Graph
from mingus.containers import Track
from mingus.midi import midi_file_out
from mingus.containers.instrument import MidiInstrument
from mingus.containers import NoteContainer
def generate_track(g, n, name):
root = np.ran... |
Markdown | UTF-8 | 509 | 2.734375 | 3 | [] | no_license | # Read-mem
从指定位置读取七个内存单元的内存值,进行加40操作后,再重新读一次。
# 指令
./read_mem
相应内存地址下的值会显示出来,在进行+40操作后,重新读取内存值,验证操作是否有效。
# 注意
如果想读取其他位置的内存单元,可修改程序:
map_base = (unsigned char *)mmap((void *)0x42000000, 0xff, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
将0x42000000修改为自己想访问的地址即可
需要重新make clean;make
|
Markdown | UTF-8 | 1,508 | 2.609375 | 3 | [] | no_license | #Kaardirakendus
##Sissejuhatus:
See rakendus võimaldab kaardile märkida punktobjekte. Igale objektile peab määrama
nime, kirjeldus on valikuline.
Kui objektile asub lähemal kui 500 meetrit mõni teine
objekt, on objekti ikoon punane, muul juhul roheline. Enne vastava arvutuse tegemist
on ikoon kollane.
##Kasutamine:
... |
Java | UTF-8 | 1,077 | 2.140625 | 2 | [] | no_license | package com.fisnikz.coffee_express.finance.control;
import com.fisnikz.coffee_express.finance.entity.BankAccount;
import com.fisnikz.coffee_express.finance.entity.CreditCardInfo;
import io.quarkus.runtime.StartupEvent;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Observes;
import javax... |
Java | UTF-8 | 262 | 2.109375 | 2 | [
"Apache-2.0"
] | permissive | package com.google.errorprone.annotations;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.METHOD;
@Target({CONSTRUCTOR, METHOD})
public @interface MustBeClosed {}
|
Java | UTF-8 | 691 | 1.890625 | 2 | [] | no_license | package com.itheima.health.service;
import com.itheima.health.pojo.OrderSetting;
import java.util.Date;
import java.util.List;
/**
* @author zhangmeng
* @description 预约设置SERVICE
* @date 2019/9/29
**/
public interface OrderSettingService {
/**
* 批量添加
* @param orderSettings
*/
void addAll(L... |
Python | UTF-8 | 4,306 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Here every gf is a gfvec, i.e every green-function is a vector of green function.
To lighten the writing we supress the "vec". Maybe consider putting everything as in the README.txt.
"""
import numpy as np
from .import abc_iomodel
class IOTriangle(abc_iomodel.ABCI... |
Python | UTF-8 | 5,395 | 3 | 3 | [] | no_license | # coding: utf-8
'''城市相关的公共函数
'''
import os
city2code = None
code2city = None
code2province = {}
province2code = {}
def gen_province(location_json):
global code2province, province2code
location = location_json["location"]
china = location["coutryregion"][0]
for s in china["state"]:
code = int(s... |
JavaScript | UTF-8 | 1,222 | 4.15625 | 4 | [] | no_license | /*
* Difficulty:
* Medium
*
* Desc:
* Given two numbers, hour and minutes.
* Return the smaller angle (in sexagesimal units) formed between the hour and the minute hand.
*
* Example 1:
* Input: hour = 12, minutes = 30
* Output: 165
*
* Example 2:
* Input: hour = 3, minutes = 30
* Output: 75
*
* Example ... |
C++ | UTF-8 | 1,295 | 2.59375 | 3 | [] | no_license | //-------------------------------------------------------------------
// ADXL345_ex
//-------------------------------------------------------------------
#include "OLED.h" // OLED
OLED myOLED;
//-------------------------------------------------------------------
#include "CCS811.h" // DS18B20
#define SDA_PIN PA4 ///< ... |
Java | UTF-8 | 160 | 1.804688 | 2 | [] | no_license | package controller;
public class Controller implements Core {
@Override
public void init() {
}
@Override
public void update() {
}
}
|
PHP | UTF-8 | 890 | 2.53125 | 3 | [] | no_license | <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
* Dashboard Model
* These are used by the Dashboard library to populate the dashboard UI.
* Without this file, the exiting module will not display in the dashboard.
*
* Model should return an array of objects, and include 'helper'... |
Java | UTF-8 | 498 | 3.78125 | 4 | [] | no_license | import java.util.Scanner;
public class PP2_10 {
public static void main(String arg[]){
Scanner sc = new Scanner(System.in);
System.out.print("Enter the length of a square's side: ");
int num = sc.nextInt();
System.out.println("Perimeter is " + num * 4 + "\nArea is " + Math.pow(num,2... |
Python | UTF-8 | 1,746 | 2.953125 | 3 | [] | no_license | #!/usr/bin/python
import sys
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def make_class():
if len(sys.argv) == 1:
print(bcolors.FAIL + "Error:" + b... |
Java | UTF-8 | 390 | 2.140625 | 2 | [] | no_license | package RemoteControl;
interface IRemoteControl {
public abstract void turnOn();
public abstract void turnOff();
public abstract void openMenu();
public abstract void closeMenu();
public abstract void volumeUp();
public abstract void volumeDown();
public abstract void mute();
public abstract void unmut... |
C# | UTF-8 | 396 | 2.65625 | 3 | [] | no_license | class Foo
{
public static void Main()
{
Process p1 = new Process();
p1.StartInfo.FileName = "pdftotext";
p1.StartInfo.Arguments = "test.pdf test.txt";
p1.StartInfo.UseShellExecute = false;
p1.StartInfo.WorkingDirectory = @"C:\";
... |
C++ | UTF-8 | 2,650 | 2.734375 | 3 | [] | no_license | //Author: Manan Patel, mvp5542@psu.edu, Thursday 8:00 AM - 9:50 AM
//Class: CMPSC 121
//Experiment 05
//File: P:\Private\CMPSC 121\Experiments\exp05\exp5\exp5
//purpose: To find the assesment value and property tax for a piece of property
//Academic Integrity Affidavit: I certify that, this program code is my work... |
Markdown | UTF-8 | 421 | 3.15625 | 3 | [] | no_license | # SomeUnitConversions
This is a C program to do some common unit conversions, as follows:-
1. Km to miles
2. Inch to feet
3. Cm to inch
4. Pound to kg
5. Inches to metres.
This menu driven program asks everytime for an input from the user which contains his/her choice of conversions as follows:-
A for km to miles,
... |
C++ | UTF-8 | 645 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include "Factory.h"
int main(){
Container< Shape * > con;
try{
con.push_back(Factory::create("Point"));
con.push_back(Factory::create("Circle"));
con.push_back(Factory::create("Rect"));
con.push_back(Factory::create("Square"));
con.push_back(Factory::create("Polyline"));
con.push_bac... |
Java | UTF-8 | 601 | 2.109375 | 2 | [] | no_license | package test.provider;
import test.API.HelloService;
import rpc.RPCFramwork2;
import java.io.IOException;
/**
* @author: zhun.huang
* @create: 2018-05-02 上午11:29
* @email: nolan.zhun@gmail.com
* @description:
*/
public class Provider {
public static void main(String[] args) throws InterruptedException, IOE... |
JavaScript | UTF-8 | 1,883 | 3.28125 | 3 | [] | no_license | const labelMap = {
1: {
name:'Car', color:'lime'
},
2: {
name:'Handphone', color:'yellow'
}
}
// Main drawing function
export const drawRectCustomModel = (boxes, classes, scores, threshold, imgWidth, imgHeight, ctx) =>{
// Loop through each prediction
for(let i=0; i <= boxes.length; ... |
Python | UTF-8 | 3,638 | 3.34375 | 3 | [] | no_license | """
author rochanaph
October 23 2017"""
import w3,w4,w5, os
def main():
path = './text files'
this_path = os.path.split(__file__)[0]
path = os.path.join(this_path, path)
# membaca sekaligus pre-processing semua artikel simpan ke dictionary
articles = {}
for item in os.listdir(path):
i... |
TypeScript | UTF-8 | 1,078 | 2.609375 | 3 | [
"Apache-2.0",
"MIT",
"BSD-3-Clause"
] | permissive | import { Component, ElementRef, Input, ViewEncapsulation } from '@angular/core';
import { AbstractFdNgxClass } from '../../utils/abstract-fd-ngx-class';
/**
* Label component, used to indicate status, without any background or border
* Colors, generally in combination with text, are used to easily highlight the stat... |
Java | UTF-8 | 1,343 | 2.453125 | 2 | [] | no_license | package com.example.medicalcart;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
public class ProductListAdapter extends Recycl... |
Markdown | UTF-8 | 15,353 | 2.6875 | 3 | [] | no_license | ---
title: "gin源码"
categories: [coder]
tags: [go,源码]
date: 2021-07-21
fancybox: true
---
gin是go开发的一个开源高性能http框架,其主要是把go官方的`net/http`进行了扩展,前缀树实现了动态路由、支持了中间件、对请求信息进行封装方便用户层使用等。本文基于 `gin v1.7.2`版本
## 创建流程
一个Engine实例可以使用`New` 或者 `Default`进行创建,唯一区别就是`Default`默认增加了两个中间件:日志Logger(), panic捕获 Recovery()
初始化会初始化以下内容:
```go
/... |
C++ | UTF-8 | 1,508 | 2.890625 | 3 | [] | no_license | #include "pch.h"
#include "JobManager.h"
using namespace Jobs;
JobManager* JobManager::instance = nullptr;
JobManager* JobManager::GetInstance()
{
if (instance == nullptr)
instance = new JobManager();
return instance;
}
void JobManager::ReleaseInstance()
{
if (instance != nullptr)
{
delete instance;
ins... |
Java | UTF-8 | 3,762 | 3.59375 | 4 | [] | no_license | package hard;
import java.util.Stack;
/**
* @program: leetcode
* @description: 84. Largest Rectangle in Histogram
* array stack
* @author: Liu Hanyi
* @create: 2019-05-07 16:02
**/
public class LargestRectangleArea84 {
public static void main(String[] args) {
int[] heights = {2, 1, 5, 6, 2, 3};
... |
Go | UTF-8 | 1,380 | 4.1875 | 4 | [] | no_license | package main
import (
"fmt"
"time"
)
type Node struct {
Next *Node
Value interface{}
}
//Creating Struct For link list
type LinkedList struct {
Length int // will be used for counting the Length
Head *Node
Tail *Node
}
// to push a new node at the end of the link list
func (l *LinkedList) Push(val in... |
Java | UTF-8 | 636 | 2.578125 | 3 | [] | no_license | package com.lamp.commons.lang.time;
import java.util.Date;
/**
* @author muqi
*
*/
public class TimeTuple<T> {
private T beginTime;
private T endTime;
public TimeTuple(T beginTime , T endTime){
this.beginTime = beginTime;
this.endTime = endTime;
}
public T getBeginTime() {
return beginTime;
}
... |
Java | UTF-8 | 511 | 2.65625 | 3 | [] | no_license | package builder.ejercicioTarea7;
public class Cocinero_Director {
private BuilderPizza builderPizza;
public void setBuilderPizza(BuilderPizza builderPizza) {
this.builderPizza = builderPizza;
}
public Pizza getPizza(){
return builderPizza.getPizza();
}
public void armarPizza... |
Python | UTF-8 | 2,024 | 2.96875 | 3 | [] | no_license | from ejers_1.utils import clean_tonkenize
class InvertexIndex:
index = {}
def __init__(self, path_list):
"""
initializes the new InvertexIndex instance by indexing file content of files from path_list
:param path_list: list of file paths to be indexed
"""
for file_pat... |
Java | UTF-8 | 224 | 1.632813 | 2 | [] | no_license | package org.donghyun.mreview.repository;
import org.donghyun.mreview.entity.Member;
import org.springframework.data.jpa.repository.JpaRepository;
public interface MemberRepository extends JpaRepository<Member, Long> {
}
|
Python | UTF-8 | 2,001 | 2.84375 | 3 | [] | no_license | """ Export RTL-SDR barometer readings to prometheus
http://www.smbaker.com/
Dependencies:
sudo pip install prometheus_client
"""
import sys
import json
import traceback
from prometheus_client import Gauge, start_http_server
class Exporter(object):
def __init__(self):
start_http_server(8000)
... |
Python | UTF-8 | 534 | 4.09375 | 4 | [] | no_license | # Grid with Randomness
def setup():
size(800, 800)
smooth()
noLoop()
def draw() :
background(255)
strokeWeight(2)
stroke(0)
noFill()
n = 8
w = width/n
for y in range(0, n):
for x in range(0, n):
px = x*w
py = y*w
#the chance of drawing a circle is... |
C++ | UTF-8 | 5,180 | 3 | 3 | [] | no_license | //Ian Forsyth
//CPSC 478
//Final Project
#include <iostream>
#include <string>
#include <GL/gl.h>
#include <GL/glut.h>
#include <cstdlib>
#include <ctime>
#include <math.h>
#include <sstream>
#include "createMaze.h"
createMaze::createMaze(float height, float width){
goal = location(width-1, height-1); //Start the... |
C | UTF-8 | 722 | 3.15625 | 3 | [] | no_license | /*
* LedDriver.c
*
* Created: 21/03/2018 9:00:51
* Author: Kris
*/
#include "../headers/LedDriver.h"
/**
LEDS init
@param void.
@return void
*/
void ledsInit(void)
{
// All output
DDRA = 0b11111111;
}
/**
LEDS on
@param bitmask char.
@return void
*/
void ledsOn(char bitmask)
{
PORTA = PORTA |... |
PHP | UTF-8 | 2,597 | 2.640625 | 3 | [] | no_license | <?php
namespace CGG\ConferenceBundle\Tools;
use CGG\ConferenceBundle\Repository\PageRepository;
use Symfony\Bundle\TwigBundle\TwigEngine;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\SecurityContext;
class MailAdminConferenceCreated {
private $request;
private $conf... |
Java | UTF-8 | 1,181 | 3 | 3 | [] | no_license | package physics;
import game.Object;
import geometry.*;
public class RigidBody{
public double mass;
public double drag;
public Object object;
public RigidBody(Object object, double mass){
this.object = object;
this.mass = mass;
this.drag = 0;
this.object.setAcceleration(Vector.DOWN().scalar(9.8f));
}... |
Shell | UTF-8 | 575 | 2.765625 | 3 | [] | no_license | #!/bin/bash
./gradlew clean build -x test
java -jar eureka-server/build/libs/eureka-server*.jar &>/dev/null &
EUREKA_PID=$!
java -jar sample-application/build/libs/sample-application*.jar &>/dev/null &
SAMPLE_PID=$!
java -jar gateway-server/build/libs/gateway-server*.jar > log &
GATEWAY_PID=$!
echo "wait for ini... |
PHP | UTF-8 | 2,723 | 3.078125 | 3 | [] | no_license |
<?php
//分页的函数
function news($pageNum = 1, $pageSize = 3)
{
include 'mysql.php';
$array = array();
// limit为约束显示多少条信息,后面有两个参数,第一个为从第几个开始,第二个为长度
$rs = "select * from news limit " . (($pageNum - 1) * $pageSize) . "," . $pageSize;
$r = mysqli_query($conn, $rs);
while ($obj = mysqli_... |
C++ | UTF-8 | 1,863 | 3.171875 | 3 | [
"MIT"
] | permissive | /*
* 2520 is the smallest number that can be divided by each of the numbers from 1 to 10
* without any remainder.
*
* What is the smallest positive number that is evenly divisible by all of the numbers
* from 1 to 20?
*/
#ifndef PROBLEM0005_HPP__
#define PROBLEM0005_HPP__
#include <iostream>
#include <algorithm>... |
Markdown | UTF-8 | 12,200 | 3.078125 | 3 | [] | no_license | 1. Data
2. Software
3. Key commands
[TOC]
>为防止系统出现操作失误或系统故障导致数据丢失,我们需要将全部或部分数据集合从应用主机的硬盘或阵列复制到其它存储介质。
## Part1:备份知多少
### Q1:当我们谈备份时,我们在谈论着什么?
上周技能树里的小伙伴提到因为服务器断电而不慎丢失数据的悲惨事件,因此觉得有必要在这信息爆炸的时代学会保护自己的数据,不然哪天丢了都不知该怎么办好(经费充足且及时补救还存在数据恢复服务这一选项)。暗自推算,按照一般价格算50RMB/GB价格,恢复2000G的硬盘……
>
// int age int age
//С
typedef struct LinkNode {
struct LinkNode *next;//
}LinkNode;
//
typedef str... |
C | UTF-8 | 922 | 2.703125 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include "agenda.h"
int main(){
void* buffer;
int* aux_int;
float* aux_float;
char* aux_char;
Header* aux_header;
Contact* aux_contact;
buffer = (void*) malloc(sizeof(char)+sizeof(int)+sizeof(float)+sizeof(Header)+10*sizeof(Contact));
aux_char = (char*) buffer;
aux_int ... |
Markdown | UTF-8 | 2,515 | 3.5625 | 4 | [
"CC-BY-SA-4.0",
"BSD-3-Clause",
"CC-BY-4.0"
] | permissive | ---
id: 5a2efd662fb457916e1fe604
title: do...while 循环
challengeType: 1
videoUrl: 'https://scrimba.com/c/cDqWGcp'
forumTopicId: 301172
dashedName: iterate-with-javascript-do---while-loops
---
# --description--
这一节我们将要学习的是`do...while`循环,它会先执行`do`里面的代码,如果`while`表达式为真则重复执行,反之则停止执行。我们来看一个例子。
```js
var ourArray = [];
var ... |
Markdown | UTF-8 | 547 | 2.640625 | 3 | [] | no_license | # Code-Snippet-WPF-and-PowerShell
This code is to provide a generic PowerShell code template so that we just need to paste the XAML code of a WPF form in the here-string provided.
You can also choose to get the XAML content from a file (using Get-Content and storing it in a PowerShell variable), instead of using a He... |
C++ | UTF-8 | 1,593 | 3.03125 | 3 | [] | no_license | #include <fstream>
#include "JsonBagIdea.h"
int main(int argc, char* argv[])
{
std::cout << "//////////// Struct Profile to Json //////////////" << std::endl << std::endl;
Profile user1, user2, user3;
std::vector<Profile> profileList;
user1.name = "Thanawat Suriya";
user1.school_name = "BagIdea";
user1.age =... |
Java | WINDOWS-1250 | 1,788 | 2.171875 | 2 | [] | no_license | package bean;
import javax.validation.constraints.NotNull;
import org.springframework.format.annotation.NumberFormat;
import org.springframework.format.annotation.NumberFormat.Style;
public class ZuzycieBeanWzorzec {
@NotNull(message="Prosz wypeni pole")
@NumberFormat(style=Style.NUMBER)
private Double finalne;... |
Java | UTF-8 | 1,140 | 3.703125 | 4 | [] | no_license | import java.util.Stack;
public class BasicCalculator {
public static int calculate(String s) {
s = s.replaceAll("\\s+", "");
Stack<Integer> stack = new Stack<Integer>();
if(s.length() == 0){
return 0;
}
s = "(" + s + ")";
int sign = 1;
int sum = 0;
... |
Java | UTF-8 | 9,957 | 1.867188 | 2 | [] | no_license | package com.perficient.test.cat.catinspectweb.basepages;
import static com.perficient.test.cat.catinspectweb.util.CustomizedFunctionUtil.click;
import static com.perficient.test.cat.catinspectweb.util.FunctionUtil.tryAllConvertStringToDate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
im... |
C++ | UTF-8 | 2,307 | 3.03125 | 3 | [
"MIT"
] | permissive | #include <string>
#include "Direction.hpp"
#include "Board.hpp"
#include "Direction.hpp"
using namespace std;
using std::string;
namespace ariel
{
void Board::post(unsigned int row, unsigned int column, Direction direction, std::string message)
{
unsigned int siz = (message.size());
if (direct... |
C++ | UTF-8 | 1,162 | 3.359375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int n;
bool is_attacked(int x, int y, bool board[n][n])
{
// if queen is in any cell in xth row
for(int j=0;j<n;j++)
{
if(board[x][j])
return true;
}
// if queen is in any cell in yth column
for(int i=0;i<n;i++)
{
if... |
C | UTF-8 | 333 | 2.953125 | 3 | [] | no_license | #include <stdio.h>
#include <signal.h>
#include <unistd.h>
//here is the signal handler
void catch_int(int sig_num){
//re-set the signal handler again to catch_int, for next time
signal(SIGINT, catch_int);
printf("Ouch!-I got signal %d\n", sig_num);
}
int main(){
signal(SIGINT, catch_int);
for( ; ; )
pause();
... |
Ruby | UTF-8 | 288 | 3.59375 | 4 | [] | no_license | #!/usr/bin/ruby
# -*- coding: utf-8 -*-
# create a hash
books = {} # or Hash.new(0)
# :splendid is a symbol
books["Gravity's Rainbow"] = :splendid
puts books.keys
puts books.values
books.keys.each { |title| puts title }
books.each { |title, symbol| print title, " => ", symbol, "\n"}
|
C# | UTF-8 | 1,565 | 3.5 | 4 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TSP
{
class RouletteWheelSelector
{
private Random rnd;
private Func<TSPSolution, double> fitness;
public RouletteWheelSelector(Random rnd, Func<TSPSolution, double> fitness)
{
... |
Python | UTF-8 | 4,325 | 2.84375 | 3 | [] | no_license | #!usr/bin/env python3
#-*- coding:utf-8 -*-
"""
version: 1.3
author: hunta
this script will compare two test result xml file of iTest,
find all same case with two different result.
if a case run for two times(for exp. fail at first time, rerun after clear up),
it will take the second result to compare.
no clear-up cas... |
Java | UTF-8 | 1,011 | 3.515625 | 4 | [] | no_license | package com.Java.Questions;
import java.util.Scanner;
import com.Java.Questions.Util.NumberUtils;
public class Q15 {
private static final Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
System.out.println("enter three inputs : ");
String Input1 = sc.next();
String Input2 = sc.n... |
Shell | UTF-8 | 192 | 2.546875 | 3 | [] | no_license | #!/bin/sh
pass="123anh"
echo "Moi ban nhap mat khau: "
read mk;
while [ $mk != $pass ]
do
echo "Mat khau ban da nhap khong dung !!!"
echo "Moi ban nhap lai mat khau:"
read mk
done
|
C# | UTF-8 | 167 | 3.21875 | 3 | [] | no_license | DateTime endDate = DateTime.Today;
for (DateTime dt = startDate; dt <= endDate; dt = dt.AddMonths(1))
{
Console.WriteLine("{0:M/yyyy}", dt);
}
|
Markdown | UTF-8 | 1,551 | 2.53125 | 3 | [
"MIT"
] | permissive | Test cases to cover all functionality that's to be achieved by the first demo
**Functions in project report**
* RobotStability
* Robot remains upright with no arm
* Robot remains upright with arm at 'minimum extension'
* Robot remains upright with arm at 'maximum extension'
* Robot remains upright during sim... |
Java | UTF-8 | 1,189 | 3.5 | 4 | [] | no_license | package _316去除重复字母;
import java.util.*;
/**
*
*单调栈
*/
class Solution {
public static String removeDuplicateLetters(String s) {
boolean visit[] = new boolean[26];
int last[] = new int[26];
char[] chars = s.toCharArray();
for (int i = 0; i < chars.length; i++) {
last[chars... |
Python | UTF-8 | 775 | 3.03125 | 3 | [] | no_license | # -*- coding=UTF-8 -*-
from PIL import Image
im = Image.open('in.jpg') #打开图片
width = im.size[0]
height = im.size[1]
print width, height
new_width = width / 8
new_height = height / 8
im = im.convert('L').resize((new_width, ... |
Ruby | UTF-8 | 1,418 | 2.609375 | 3 | [
"MIT"
] | permissive | class Location < ActiveRecord::Base
has_one :event
validates_associated :event
#TODO: When going back to spaital db, put code below in appropriate html files in script section.
# // Should work for point and multipoint but no other types yet.
# <% @event.location.each {|g| %>
# <%= raw 'xxxMap.addMark... |
Swift | UTF-8 | 630 | 3.09375 | 3 | [] | no_license | //
// Bubble.swift
// Pop
//
// Created by Megan Lim on 3/12/15.
// Copyright © 2015 Megan Lim. All rights reserved.
//
import Foundation
import UIKit
class Bubble {
// MARK: Properties
var title: String
var comment: String?
var location: String
var noOfPeople: Int
// MARK: Initialisa... |
C# | UTF-8 | 2,524 | 2.5625 | 3 | [] | no_license | using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using Microsoft.Azure.Documents.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace TradeAssist.DocumentStorage
{
public class DynamicDocumentClient
... |
C# | UTF-8 | 2,490 | 3.6875 | 4 | [] | no_license | using System;
namespace RadioControlledCar
{
class MonsterTruck : Car
{
public MonsterTruck(int positionX, int positionY, char direction)
{
direction = Char.ToLower(direction);
if(positionX < 0 || positionY < 0)
{
throw new Argument... |
Java | UTF-8 | 988 | 3.34375 | 3 | [
"Apache-2.0"
] | permissive | package com.kevin.streams;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class Simple
{
List<String> myList =
Arrays.asList("a1", "a2", "b1", "c2", "c1", "c1");
public void mapToObject()
{
IntStream.range(1... |
JavaScript | UTF-8 | 3,559 | 2.71875 | 3 | [] | no_license | // TODO reduce the amount of global
var gameLevel;
var camera, scene, renderer;
//////////////////////////////////////////////////////////////////////////////////
// ctor/dtor //
//////////////////////////////////////////////////////////////////////////////////
Marble.PageGameLife = function()
{
this._contai... |
Markdown | UTF-8 | 9,026 | 3.03125 | 3 | [] | no_license | # Directions for Space scene
## __NOTICE: This section assumes you have fully completed the Setup Instructions.__
## Getting Started
Once you've followed the instructions from the Setup_Instructions document and have installed the software, next you need to download some textures in preparation for the creation of t... |
Java | UTF-8 | 604 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | package ru.job4j.tracker.singleton;
import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
/**
* Test.
*
* @author Plaksin Arseniy (arsp93@mail.ru)
* @version 0.1
* @since 26.12.2018
*/
public class TrackerStaticFinalFieldTest {
/**
* Тест на равенство двух объ... |
Markdown | UTF-8 | 1,192 | 2.828125 | 3 | [
"MIT"
] | permissive | ##### Mandatory Data Elements and Terminology
The following data-elements are mandatory (i.e data MUST be present). These are presented below in a simple human-readable explanation. Profile specific guidance and examples are provided as well. The [**Formal Profile Definition**](#profile) below provides the formal ... |
Markdown | UTF-8 | 9,338 | 3.1875 | 3 | [] | no_license | ---
title : 新的旅程
data : 2017-11-1 11:07:42
tags : [目录]
---
一年没有更新博客了,这一年忙忙碌碌的就过去了,简单做个回顾记录一下大三一年。
<!--more-->
# 大三上
## 六级
大三上是非常令我烦躁的一个学期,主要的问题是六级还没过。因为那个时候还不确定政策是什么样的,听说要取消省一的竞赛保研,而我个弱渣最多只拿到了省一和国三,所以当时我就打算放弃走竞赛这条路了。但是因为大二的时候太过浪,两次六级都没过,到那个时候才知道一切事情都要早做准备,不然会很痛苦的。于是我就提前三四个月买了考虫这套教材,正好从网上看到了他的宣传(其实我也忘记从哪里看到的了),下定决心... |
C++ | UHC | 1,190 | 2.90625 | 3 | [] | no_license | #include <iostream>
#include <thread>
#include <mutex>
#include <chrono>
#include <atomic>
using namespace std;
using namespace chrono;
volatile int sum;
mutex sum_lock;
volatile bool flag[2] = { false, false };
volatile int victim;
void p_lock(const int tid) {
int other = 1 - tid;
flag[tid] = true;
victim = tid;... |
Java | UTF-8 | 6,053 | 2.296875 | 2 | [
"Apache-2.0"
] | permissive | package org.ovirt.engine.ui.uicommon.models.userportal;
import java.util.Collections;
import org.ovirt.engine.core.compat.*;
import org.ovirt.engine.ui.uicompat.*;
import org.ovirt.engine.core.common.businessentities.*;
import org.ovirt.engine.core.common.vdscommands.*;
import org.ovirt.engine.core.common.queries.*;
im... |
C | UTF-8 | 1,558 | 4.09375 | 4 | [] | no_license | #include<stdio.h>
#include<malloc/malloc.h>
struct node
{
int data;
struct node *left ,*right;
};
struct node *tree = NULL;
struct node *insert(struct node *,int );
void preorder(struct node *);
int main()
{
int choice , val;
do{
printf("1. INSERT A NODE IN BST 2 .PREORDER 3 .EXIT ");
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.