language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
Java | UTF-8 | 1,333 | 2.109375 | 2 | [
"MIT"
] | permissive | package com.great.cms.test.dao;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration("file:src... |
Java | UTF-8 | 1,007 | 2.53125 | 3 | [] | no_license | package com.cavalry.androidlib.toolbox.utils;
import android.widget.Toast;
import com.cavalry.androidlib.LibApplication;
import com.cavalry.androidlib.toolbox.managers.HandlerManager;
/**
* @author Cavalry Lin
* @since 1.0.0
*/
public class LibToastUtils {
public static void toast(String text){
Toast... |
Python | UTF-8 | 295 | 3.140625 | 3 | [] | no_license | import random
sequence = ['00','01','10','11']
input = []
for i in range(0, 16):
input = input + [random.choice(sequence)]
#print(input)
filename = 'Inputs.txt'
for el in input:
with open(filename, 'a+') as file_object:
file_object.write(el[0]+"\n")
file_object.write(el[1]+"\n")
|
PHP | UTF-8 | 1,130 | 2.515625 | 3 | [] | no_license | <?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<?php
include 'BDconnect.php';
include 'MenuJogador.php';
?>
<div class="container">
<table class="table table-striped" style="background-color: white">
<th><b>#</b></th>
<th>UserName</th>
<th>Matéria</t... |
TypeScript | UTF-8 | 3,019 | 2.515625 | 3 | [
"MIT"
] | permissive | import { Component, getComponentDefId, toObject } from '../../component';
import { ComponentDef, toShortObject } from '../../component_def';
import { EntitySet } from "../../entity_set";
import { BitField, get as bfGet } from "@odgn/utils/bitfield";
import { stringify } from '@odgn/utils';
const log = (...args) => c... |
C# | UTF-8 | 1,817 | 3.4375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace algorithmStudy.Services.LeetCode
{
class _47
{
/*
* 给定一个可包含重复数字的序列,返回所有不重复的全排列。
示例:
输入: [1,1,2]
输出:
[
[1,1,2],
... |
C++ | UTF-8 | 1,088 | 3.375 | 3 | [] | no_license |
#ifndef MYVECTORASLINKEDLIST_H_
#define MYVECTORASLINKEDLIST_H_
#include "linked-list.h"
class myVector{
public:
// Constructor method
myVector(void);
// Destructor method
~myVector(void);
// Other useful methods
unsigned int size(void);
void push_back(int);
int at(unsigned int);
... |
Java | UTF-8 | 416 | 1.898438 | 2 | [] | no_license | package com.mall.mobile.dao;
import com.mall.mobile.domen.CustAdress;
import java.util.List;
@org.apache.ibatis.annotations.Mapper
public interface CustAdressMapper {
List<CustAdress> getCustAddressList(Integer custid);
CustAdress getcustadressByid(Integer id);
void addcustadress(CustAdress custAdre... |
Swift | UTF-8 | 7,910 | 2.828125 | 3 | [] | no_license | //
// studentAttendance.swift
// schoolDashboard
//
// Created by admin on 2021/6/15.
//
import SwiftUI
import CoreData
struct studentAttendance: View {
@Environment(\.managedObjectContext) var moc
@FetchRequest(entity: Attendance.entity(), sortDescriptors: []) private var attendances:FetchedResults<Attend... |
Python | UTF-8 | 1,062 | 3.4375 | 3 | [] | no_license | #!/bin/env python
# coding: utf-8
# 实现 int sqrt(int x) 函数。
#
# 计算并返回 x 的平方根,其中 x 是非负整数。
#
# 由于返回类型是整数,结果只保留整数的部分,小数部分将被舍去。
#
# 示例 1:
#
# 输入: 4
# 输出: 2
#
#
# 示例 2:
#
# 输入: 8
# 输出: 2
# 说明: 8 的平方根是 2.82842...,
# 由于返回类型是整数,小数部分将被舍去。
#
# Related Topics 数学 二分查找
# 👍 666 👎 0
# leetcode submit... |
Java | UTF-8 | 285 | 1.882813 | 2 | [] | no_license | package org.duomn.naive.cxf.model.soap.service;
import java.util.List;
import javax.jws.WebService;
import org.duomn.naive.cxf.model.soap.entity.UserInfo;
@WebService
public interface IHelloWorld {
String sayHello(String text);
String sayHelloToAll(List<UserInfo> users);
}
|
Java | UTF-8 | 1,086 | 2.140625 | 2 | [] | no_license | package com.o2o.service;
import com.o2o.dto.ProductCategoryExecution;
import com.o2o.entity.ProductCategory;
import com.o2o.exceptions.ProductCategoryOperationException;
import java.util.List;
/**
* @Author Jiusen Guo
* @Date 2020/12/7 9:45
* @Description
*/
public interface ProductCategoryService {
/**
... |
Java | UTF-8 | 746 | 1.898438 | 2 | [] | no_license | package com.hhly.lottosplit.mapper;
import java.util.List;
import com.hhly.lottosplit.bo.CooperateCdkeyBO;
public interface CooperateCdkeyMapper {
int selectCount(CooperateCdkeyBO vo);
int deleteByPrimaryKey(Integer id);
int insert(CooperateCdkeyBO record);
int insertSelective(CooperateCdkeyBO r... |
Java | UTF-8 | 1,104 | 3.5625 | 4 | [] | no_license | /**
*Java 1. Homework 1.
*
*@author Ivan Iov
*@version dated Nov 22, 2017
*/
public class Homework1 {
public static void main(String[] args) {
byte a = 15;
short b = 126;
int c = 2356;
long d = 12033L;
float e = 155.0f;
double f = 16.2265;
boolean g = true;
char h = 'G';
System.out.println(calc... |
Shell | UTF-8 | 1,065 | 4.1875 | 4 | [] | no_license | #!/usr/bin/env bash
# Clean out old libs in ~/.stack/snapshot to free up space.
# Works on machines with bash and the usual unix tools.
# Eg: stack-clean-libs '(8.8.4|8.10.2)'
name=stack-clean-libs
if [[ $1 == "" ]]; then
echo >&2 "Usage: $name KEEP_VERSIONS_REGEX, eg: $name '(8.8.4|8.10.2)'"
else
keepvers... |
C++ | UTF-8 | 4,005 | 3.078125 | 3 | [] | no_license | /*
* Compartment.h
*
* Created on: 28/05/2010
* Author: matthias
*/
// TODO: move to just using x,y,width,height ?
#ifndef __gpgmp_Compartment_h__
#define __gpgmp_Compartment_h__
#include "Base.h"
#include <hdf5.h>
#include <map>
#include <ostream>
namespace gpgmp {
class Species;
/**
* En... |
Python | UTF-8 | 323 | 3.4375 | 3 | [] | no_license | foo = [1,2,3,4]
actors = {
"Kyle MacLachlan": "Dale Cooper",
"Sheryl Lee": "Laura Palmer",
"Lara Flynn Boyle": "Donna Hayward",
"Sherilyn Fenn" : "Audrey Horne"
}
for (key, value) in actors.iteritems():
print "{} => {}".format(key, value)
for key in actors:
value = actors[key]
print "The a... |
Java | UTF-8 | 1,043 | 2.6875 | 3 | [] | no_license | package salud.isa.gsonMedDB;
import java.io.*;
import com.google.gson.stream.JsonReader;
public class ActiveIngredients extends CDM{
private static final String ACTINGREF_FIELD_TAGNAME = "activeIngredients";
private static final String NAME_FIELD_TAGNAME = "name";
public ActiveIngredients(CDM s) {
super(s);
... |
Python | UTF-8 | 465 | 3.65625 | 4 | [] | no_license | def reverse(word):
string=list(word)
lenght=len(word)-1
i=0
while i<lenght:
string[i],string[lenght]=string[lenght],string[i]
i+=1
lenght-=1
return "".join(string)
def reverseWords(string):
if not string:
return None
else:
string=string.split()
temp=[]
i=0
while i<len(string):
temp.append(rev... |
Java | UTF-8 | 515 | 2.546875 | 3 | [] | no_license | package org.tondo.myhome.thyme.converter;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import org.springframework.core.convert.converter.Converter;
public class DoubleConverter implements Converter<Double, String> {
@Override
public String convert(Double source) {
if (source == null)... |
Python | UTF-8 | 144 | 2.9375 | 3 | [] | no_license | x=int(input())
xx=bin(x).replace('0b','')
ans=True
for i in range(1,len(xx)):
if(xx[i]==xx[i-1]):
ans=False
break
print(ans) |
Markdown | UTF-8 | 4,519 | 3.015625 | 3 | [] | no_license | +++
type = "blog"
author = "gabrielhartmann"
title = "UVC Driver -- GSoC Quarter-term Report"
date = "2011-06-13T20:45:16.000Z"
tags = ["gsoc", "gsoc2011", "UVC", "driver"]
+++
On June 7, I turned in my dissertation and my semester ended. On June 10, I had my first final exam. Now it's time to produce a progress rep... |
Java | UTF-8 | 5,113 | 2.734375 | 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 axiom.reader;
import axiom.model.AXIOMException;
import axiom.model.Model;
import axiom.probabilityAdjusters.ProbabilityAdjust... |
Python | UTF-8 | 2,663 | 3.484375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@author: mattia
"""
import math
import numpy as np
class PathTracker():
"""
Simple path tracking algorithm implementation with speed and steering control
"""
@staticmethod
def next_state(X,u,dt,L):
"""
Very simple bicycle kinematic model for vehicle.
... |
Java | UTF-8 | 800 | 2.25 | 2 | [
"MIT"
] | permissive | package md.frolov.legume.client.events;
import com.google.gwt.event.shared.GwtEvent;
/** @author Ivan Frolov (ifrolov@tacitknowledge.com) */
public class ScrollableStateChangedEvent extends GwtEvent<ScrollableStateChangedEventHandler>
{
private final boolean isScrollable;
public ScrollableStateChangedEvent(f... |
Markdown | UTF-8 | 905 | 2.734375 | 3 | [] | no_license | ## Instructions
The runner.json file in this directory contains the CloudFormation required
to build an EC2 instance in your AWS account with an IAM Role &
associated instance profile that allows the GitHub self-hosted runners to upload
artifacts to S3.
After you have built your EC2 instance with the CF/runner.jso... |
C++ | UTF-8 | 1,330 | 2.734375 | 3 | [] | no_license |
#include <cstdint>
#include <functional>
#include "context.hpp"
#ifndef _H_ACTIVE
#define _H_ACTIVE
struct Greedy_Makespace : public PriorityAssigner
{
// ................ return holders ................
size_t * r_norm_inf;
// ................ worst case limit ................
size_t worst_case_limit(Context*... |
Markdown | UTF-8 | 269 | 2.546875 | 3 | [
"MIT"
] | permissive | ## plusFive Walkthrough
<iframe src="https://player.vimeo.com/video/206313597" width="100%" height="400" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
## Solution Code
```js
function plusFive(number) {
return number + 5;
}
```
|
Go | UTF-8 | 337 | 3.34375 | 3 | [
"MIT"
] | permissive | package sum
// All returns the sum of the given values.
func All(vs ...int) int {
return recursive(vs)
}
func recursive(vs []int) int {
if len(vs) == 0 {
return 0
}
return vs[0] + recursive(vs[1:])
}
func iterative(vs []int) int {
res := 0
for i := 0; i < len(vs); i++ {
//for _, i := range vs {
res += i
... |
C | UTF-8 | 4,982 | 2.953125 | 3 | [] | no_license | gTable *gStart = NULL;
lTable *lStart = NULL;
extern int lineNo;
void provideMemoryToGlobal(){
gTable *temp;
temp = gStart;
while(temp != NULL){
if (temp->nodeType == VAR){
temp->binding = memory;
if (temp->size == 0)
memory += 1;
memory += temp->size;
}... |
Markdown | UTF-8 | 3,657 | 3.1875 | 3 | [] | no_license | # Structured Programs and Data
These next two weeks really are *Python bootcamp*. If you have never seen Python before, there is quite a bit of material to cover. **Please ask for help**.
## Python Videos
The following videos are part of my CMPS 130 course material. For those of you who are very new to programming ... |
PHP | UTF-8 | 1,840 | 2.578125 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Event;
use App\Models\Usuario;
class FullCalenderController extends Controller
{
public function index(Request $request)
{
if($request->ajax())
{
$data = Event::whereDate('start', '>=', $request->start)
... |
JavaScript | UTF-8 | 1,246 | 2.984375 | 3 | [] | no_license | function Oscillator(context) {
var gainNode;
var node = null;
var nodeNeedsNulling = false;
var waveType = 'sine';
var frequency = 440;
gainNode = context.createGain();
function ensureNodeIsLive() {
if(nodeNeedsNulling || node === null) {
node = context.createOscillator();
node.type = wa... |
Markdown | UTF-8 | 2,124 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # Webhint DevTools integration
Use webhint directly from your browser DevTools to get feedback while debugging.
## DevTools integration (Edge)
As of 2021, webhint is included by default in Edge DevTools. With DevTools
open, webhint will analyze sites automatically, and results and recommended
fixes will appear in th... |
Java | UTF-8 | 1,819 | 2.546875 | 3 | [] | no_license | package com.flchen.designpatternpractice.createPatterns.factoryMethodPattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ResourceUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
i... |
JavaScript | UTF-8 | 588 | 3.28125 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | function getFirstSelector(selector){
return document.querySelector(selector);
}
function nestedTarget(){
return document.querySelector('#nested .target');
}
function increaseRankBy(n){
const lists = document.querySelectorAll('ul.ranked-list li');
for(var i = 0; i<lists.length; i++)
{
lists[i].innerHTML = ... |
Java | UTF-8 | 4,066 | 2.515625 | 3 | [] | no_license | package poker.server.session.model.visual;
import java.util.List;
import poker.common.Rect;
import poker.server.session.model.ModelError;
import poker.server.session.model.data.Field;
import poker.server.session.model.data.ScreenData;
import poker.server.session.model.data.chat.Chat;
import poker.util.xml.XmlObject;
... |
Python | UTF-8 | 542 | 4.65625 | 5 | [] | no_license | ## Simple Python Decorator Functions
import time
def delay_decorator(function):
def wrapper_function():
time.sleep(2)
#Do something before
function()
function()
#Do something after
return wrapper_function
@delay_decorator
def say_hello():
print("Hello")
#With the @... |
Python | UTF-8 | 2,637 | 2.734375 | 3 | [] | no_license | """
parse caffe log.txt and display the performance curve
"""
from matplotlib import pyplot as plt
import numpy as np
root = 'E:\\program\\python\\center_bias\\'
log = 'log.txt'
max_iteration = 320000
test_interval = 1000
epoches = 64.0
# loss and accuracy
train_loss = []
train_accuracy = []
val_loss = []
val_accur... |
Java | UTF-8 | 6,040 | 2.109375 | 2 | [] | no_license | /*
* Copyright (c) 2005-2012 www.china-cti.com All rights reserved
* Info:rebirth-search-core ScanContext.java 2012-7-6 14:29:48 l.xue.nong$$
*/
package cn.com.rebirth.search.core.search.scan;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;
import org.apache.lucene.index.IndexReader;... |
PHP | UTF-8 | 5,370 | 2.515625 | 3 | [] | no_license | <?php
//init connection
$db = new mysqli('localhost', 'f38ee', 'f38ee', 'f38ee');
//check connection
if (mysqli_connect_errno()) {
echo 'Error: Could not connect to database. Please try again later.';
exit;
}
session_start();
$query = "SELECT * from users WHERE name = '".$_SESSION['valid_user']."' "... |
Java | UTF-8 | 5,939 | 1.765625 | 2 | [] | no_license | /*
* (C) Copyright 2018 Nuxeo (http://nuxeo.com/) and others.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by... |
Python | UTF-8 | 255 | 3.1875 | 3 | [] | no_license | def findMissing(array):
if not array:
return None
else:
for x in xrange(1,len(array)+1):
found=0
for y in xrange(0,len(array)):
if array[y]==x:
found=1
if found==0:
print "Missig no",x
A = [8, 2, 1, 4, 6, 5, 9]
findMissing(A) |
Markdown | UTF-8 | 1,931 | 2.671875 | 3 | [] | no_license | This repository contains a summary of my 10 week summer research project at Imperial College London. Hopefully there is enough information and code for someone to pick up this project some time in the future. Feel free to contact me with any questions at <eloise.lardet@gmail.com>.
## Overview
For a detailed overview o... |
Markdown | UTF-8 | 4,209 | 2.578125 | 3 | [] | no_license | <!-- Please do not change this html logo with link -->
<a href="https://www.microchip.com" rel="nofollow"><img src="images/microchip.png" alt="MCHP" width="300"/></a>
# Blink an LED using PWM with PIC16F15244
The 'pic16f15244-pwm-led-blink' code example uses the PIC16F15244 Curiosity Nano Development board to demonst... |
Markdown | UTF-8 | 3,958 | 2.828125 | 3 | [] | no_license | ---
title: "Image uploader/browser with only Caddy"
description: "Making an image uploader and browser server with the cleanest stack ever"
date: 2019-11-10T10:56:17-08:00
draft: false
---
## Prelude
Recently a lot of people have been asking me about setting up a file server, mainly to serve their screenshots. As I h... |
Java | UTF-8 | 1,606 | 2.03125 | 2 | [] | no_license | package com.zlsoft.domain;
import com.zlsoft.utils.domain.AbstractBaseEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
@Entity
@Table(name = "d_paper_audit")
public class PaperAudit extends AbstractBase... |
PHP | UTF-8 | 1,934 | 3.15625 | 3 | [] | no_license | <?php
namespace App\libs\pagination;
class Pagination
{
public $current_page;
public $per_page;
public $total_count;
public function __construct($page = 1, $per_page = 20, $total_count = 0)
{
$this->current_page = (int) $page;
$this->per_page = (int) $per_page;
$this->tota... |
C++ | UTF-8 | 965 | 2.703125 | 3 | [] | no_license | #include "Game.h"
/**
* Constructor of the class.
*/
Game::Game() {
renderer = new Renderer;
soundmanager.LoadSounds("../resources/Music/tokyo-drift-8-bit.mp3", "game");
soundmanager.Play("game");
}
/**
* Function that closes window and audio.
*/
void Game::finish() {
soundmanager.Stop("game");
... |
Markdown | UTF-8 | 1,421 | 2.515625 | 3 | [] | no_license | # ionNavView常见问题
## 源码说明
`/www/lib/ionic/js/ionic-angular.js`
ionNavView (占位符)
:12163
```
IonicModule
.directive('ionNavView', [
```
$ionicNavView (ionNavView 的 控制器)
:6455
```
IonicModule
.controller('$ionicNavView', [
```
ionView (页面容器)
:14384
```
IonicModule
.directive('ionView', function() {
```
$ionicVi... |
C# | UTF-8 | 337 | 3.109375 | 3 | [] | no_license | using System;
namespace CanWeDivideIt
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(is_divide_by(-12, 2, -5 ));
}
private static bool is_divide_by(int number, int a, int b)
{
return number % a == 0 && number % b == 0;
... |
C++ | UTF-8 | 714 | 2.859375 | 3 | [] | no_license | class Solution {
public:
vector<int> nextGreaterElement(vector<int>& findNums, vector<int>& nums) {
unordered_map<int, int> mp;
stack<int> st;
for(auto num : nums)
{
while(!st.empty() && st.top() < num)
{
mp[st.top()] = num;
st.... |
TypeScript | UTF-8 | 2,767 | 2.65625 | 3 | [
"MIT"
] | permissive | import Pubnub from 'pubnub';
import { SpaceActionType } from '../SpaceActionType.enum';
import { fetchSpaceById } from './FetchSpaceById';
import { createMockStore } from '../../../foundations/Test-utils';
function fixturePubnubGetSpaceSuccess() {
const pubnub = {
getSpace: (
_params: Pubnub.GetSpaceParame... |
C# | UTF-8 | 1,718 | 3.484375 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace _03WordCount
{
class Program
{
static void Main(string[] args)
{
string textPath = "text.txt";
string wordsPath = "words.txt";
var textLines = File.ReadAllLines(te... |
TypeScript | UTF-8 | 565 | 3 | 3 | [
"MIT"
] | permissive | import { MAGIC_PROXY_SYMBOL } from './constants';
export interface AccessProxy<T> {
[MAGIC_PROXY_SYMBOL]: T;
}
export interface WithProxyArray<T, U> extends ReadonlyArray<WithProxy<T | U>> {}
export type WithProxyObject<T, U> = { [P in keyof T]-?: WithProxy<T[P] | U> };
export type WithProxy<
T,
U = T extends... |
C++ | UTF-8 | 1,557 | 3.34375 | 3 | [] | no_license | #include <iostream>
using namespace std;
void inplaceHeapSort(int pq[], int n){
//Build heap
for(int i=1; i< n; i++){
int childIndex = i;
while(childIndex > 0){
int parentIndex = (childIndex-1)/2;
if(pq[childIndex] < pq[parentIndex]){
int... |
Java | UTF-8 | 2,879 | 2.578125 | 3 | [] | no_license | /*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be us... |
Markdown | UTF-8 | 909 | 3.21875 | 3 | [] | no_license | The goal of the game is to avoid incoming obstacles:
The player starts on the left side of the screen.
The obstacles enter randomly from the right and move left in a straight line.
The player can move left, right, up, or down to avoid the obstacles.
The player cannot move off the screen.
The game ends either when the p... |
Markdown | UTF-8 | 2,972 | 3.28125 | 3 | [] | no_license | ---
title: 数据结构与算法基础——第02周-线性表的类型定义(2.3)
categories:
- 开发
- N-数据与算法
- 数据结构与算法基础
tags:
- 数据结构与算法基础
abbrlink: e6d5b3f9
date: 2021-12-23 17:09:39
---
## 一 抽象数据类型线性表定义
```
ADT List{
数据对象:D={ai|ai属于Elemeset,(i=1,2,..n,n>=0)}
数据关系:R={<ai-1,ai>|ai-1,ai属于D,(i=2,3,..,n)}
基本操作:
InitList(&L); DestroyList(&L);
... |
C++ | UTF-8 | 463 | 3.390625 | 3 | [] | no_license | #include<cmath>
#include<iostream>
using namespace std;
class point {
double x;
double y;
public:
point() {
x = 0;
y = 0;
}
point(double a, double b) {
x = a;
y = b;
}
friend void dist(point p1,point p2);
};
void dist(point p1, point p2) {
double distance;
p2.x = pow((p2.x - p1.x),2);
p2.y = pow((p2.y... |
C++ | UTF-8 | 713 | 2.640625 | 3 | [] | no_license | #include "fartoy.h"
#include <string>
#include <iostream>
using namespace std;
fartoy::fartoy(){
sign = "signal";
navn = "fartøynavn";
reder = rederi();
}
void fartoy::settSign(string a){
sign = a;
}
void fartoy::settNavn(string a){
navn = a;
}
void fartoy::settRederi(rederi a){
reder = a;
}
string fartoy::fi... |
Python | UTF-8 | 662 | 3.265625 | 3 | [] | no_license |
#from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
def hover_over_element(driver, selector, by=By.XPATH):
"""
Fires the hover event for the specified element by the given selector.
@Params
driver - t... |
Rust | UTF-8 | 15,015 | 2.8125 | 3 | [
"MIT"
] | permissive | // Copyright (c) 2017-2019 Rene van der Meer
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge,... |
Java | UTF-8 | 1,207 | 2.046875 | 2 | [] | no_license | package com.me;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.core.Application;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
public class MyApplicationConfig extends Application {
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> resources = new java.... |
Java | UTF-8 | 1,139 | 3.671875 | 4 | [] | no_license | import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;
class Point{
int x;
int y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
}
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc... |
Markdown | UTF-8 | 1,594 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | ---
title: Automatic Offline Replica Rebuilding
weight: 4
---
## Introduction
Currently, Longhorn does not support online replica rebuilding for volumes that use the V2 Data Engine. To overcome this limitation, an automatic offline replica rebuilding mechanism has been implemented. When a degraded volume is detac... |
C++ | UTF-8 | 642 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <stack>
#include <vector>
struct BinaryTreeNode {
BinaryTreeNode* right;
BinaryTreeNode* left;
int value;
}
bool isBinarySearchTree(BinaryTreeNode* T) {
std::stack<BinaryTreeNode*> s;
std::vector<int> preOrder;
s.push(T);
while (!s.empty()) {
BinaryTreeNode* current = s.top();
... |
Python | UTF-8 | 330 | 2.953125 | 3 | [] | no_license | L = [4,5,7,1,0,10,8,4]
def totalSum(s):
if len(s) == 0:
return 0
else:
return s[0] + totalSum(s[1:])
sum = totalSum(L)
print(sum)
def totalSum(s):
sum = 0
if len(s) == 0:
return sum
else:
sum += s[0]
return sum
s.pop(0)
print (s)
totalSum(s)
fullSum = totalSum(L)
prin... |
JavaScript | UTF-8 | 4,099 | 2.859375 | 3 | [] | no_license | function WheelsDebug(){}
WheelsDebug.prototype.initialize = function(){
if(this.persistance.Unit === undefined){
this.persistance.Unit = "metric";
}
this.data = {
"factor":{
"metric": 3.6,
"imperial": 2.2369
},
"unitname":{
"... |
PHP | UTF-8 | 3,210 | 2.703125 | 3 | [
"MIT"
] | permissive | <?php
/**
* Created by PhpStorm.
* User: AM
* Date: 10/3/2017
* Time: 3:09 PM
*/
namespace Com\Mh\Ds\Infrastructure\Languages\Php\Reflection\DocBlock;
use Com\Mh\Ds\Infrastructure\Languages\Php\Reflection\DocBlock\Tags\MhProperty;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflec... |
Markdown | UTF-8 | 953 | 3 | 3 | [] | no_license | # Kubernetes
## API Versions
In kubernetes, there is a lot of api resources and version and it supports multiple versions of same resource type.
Each one has a different API path, such as
- /api/v1
- /apis/
- extensions/v1beta1
###### The different API versions are below:
- alpha [when the resource type wh... |
Markdown | UTF-8 | 2,094 | 2.90625 | 3 | [
"Unlicense"
] | permissive |
# Meghan Markle Dresses in a Blue Coat and Khaki Trench for Two Events in Two Days
Published at: **2019-11-07T12:06:00+00:00**
Author: **Alyssa Bailey**
Original: [Elle](https://www.elle.com/culture/celebrities/a29722088/meghan-markle-blue-coat-khaki-trench-remembrance-day-event-outfits/)
Meghan Markle and Prince ... |
Python | UTF-8 | 845 | 3.59375 | 4 | [] | no_license | #-*- coding:utf8 -*-
#author : Lenovo
#date: 2018/10/1
dic={'2':['a','b','c'],'3':['d','e','f'],
'4':['g','h','i'],'5':['j','k''l'],
'6':['m','n','o'],'7':['p','q','r','s'],
'8':['t','u','v'],'9':['w','x','y','z']
}
def letterCombinations(digits):
"""
:type digits: str
:rtype: List[str]
... |
TypeScript | UTF-8 | 473 | 2.859375 | 3 | [] | no_license | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'formatPrice'
})
export class FormatPricePipe implements PipeTransform {
transform(value: string, formated = true, starting = '₹', ending = ''): any {
let val: any = parseFloat(value);
if (formated && val >= 1000000) val = (val / 1000000).t... |
C++ | UTF-8 | 1,091 | 3.046875 | 3 | [] | no_license | /**
* @Author: Avinash Kadimisetty <avinash>
* @Date: 2019-02-06T11:37:31-06:00
* @Email: kavinash366@gmail.com
* @Project: Leetcode
* @Filename: 113.cpp
* @Last modified by: avinash
* @Last modified time: 2019-02-06T11:38:16-06:00
* @License: MIT License
*/
/**
* Definition for a binary tree node.
*... |
JavaScript | UTF-8 | 542 | 3.03125 | 3 | [] | no_license |
function boldtext(){
document.getElementById("divmodify").style.fontWeight = 'bold' ;
}
function italictext(){
document.getElementById("divmodify").style.fontStyle = 'italic' ;
}
function underlinetext(){
document.getElementById("divmodify").style.textDecoration = 'underline' ;
}
fun... |
Java | UTF-8 | 10,634 | 2.1875 | 2 | [] | no_license | /*
* Levels Beyond CONFIDENTIAL
*
* Copyright 2003 - 2014 Levels Beyond Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Levels Beyond Incorporated and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are pro... |
Java | UTF-8 | 3,806 | 2.6875 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"W3C",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-generic-cla"
] | permissive | /**
* **********************************************************************
*
* <p>Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this f... |
Java | UTF-8 | 673 | 2.171875 | 2 | [] | no_license | package solution2.mainApp;
import solution2.controller.PuzzleController_AnotherSolution;
import solution2.view.PuzzleView_AnotherSolution;
/*
* 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... |
Java | UTF-8 | 873 | 3.125 | 3 | [] | no_license | package org.onestonesoup.core.data;
public class KeyValuePair {
private String key;
private String value;
public static KeyValuePair parseKeyAndValue(String data) {
return parseKeyAndValue(data, "=");
}
public static KeyValuePair parseKeyAndValue(String data,String separator) {
String[] parts = data.split(... |
C++ | UTF-8 | 16,667 | 2.984375 | 3 | [] | no_license | #include "MotorController.h"
#include "LabUtilities.h"
using namespace std;
static const int STEP_WAIT_TIME = 10000; //this is the timeout time for checking for '^' this stops the program from hanging if it is not found
//this should be set such that it is long enough where the motor waits for the longest possible move... |
Python | UTF-8 | 2,063 | 4.3125 | 4 | [] | no_license | #Setting a score variable to an integer value that the user will input
score = int(input('Enter a score greater than 1: '))
#Setting Variables
touchdown = 0
fieldgoal = 0
safety = 0
#Starting a while loop and ensuring that any number inputted less than or equal to 1 will not count
while (score <= 1) :
score = ... |
Python | UTF-8 | 973 | 3.484375 | 3 | [] | no_license | '''
@author:noc
@time:2020年3月16日
@url:https://leetcode-cn.com/problems/compress-string-lcci/
'''
'''
题解:简单的题,一开始自己写了一下,发现和算法题解运行速度满了一倍,才发现,自己的代码里对了太多没必要的运算,比如 len() 之类的
照样时间复杂度只有O(n),遍历一遍数组,用 a 保存当前字符的长度,ch 保存当前字符,当遇到 S{i} != ch 时,就讲 ch + str{a}添加到答案中
并且将 ch更新成 S[i]
'''
class Solution(object):
def compress... |
Go | UTF-8 | 44,655 | 2.71875 | 3 | [] | no_license | package day7
var nb = map[string]map[string]int{
"bright beige": {
"drab red": 4,
"dull silver": 4,
"pale violet": 2,
"vibrant brown": 5,
},
"bright black": {
"plaid tan": 5,
},
"bright blue": {
"faded violet": 2,
"light aqua": 3,
"light lime": 5,
"vibrant coral": 4,
},
"bright... |
Go | UTF-8 | 1,711 | 3.765625 | 4 | [] | no_license | package main
import (
"bufio"
"fmt"
"log"
"os"
"strings"
"unicode"
)
const (
inputFile = "input"
alphabet = "abcdefghijklmnopqrstuvwxyz"
)
func main() {
data, err := readInput(inputFile)
if err != nil {
log.Fatal(err)
}
solve1(data)
solve2(data)
}
func readInput(path string) ([]string, error) {
fil... |
Python | UTF-8 | 3,583 | 3.046875 | 3 | [] | no_license | from cfed.pairwise import euclidean_distances
import pandas as pd
import numpy as np
import sklearn.metrics.pairwise as pw
def test_basic_functionality():
df1 = pd.DataFrame.from_dict({
'col1': [1, 2, 3],
'col2': [4, 5, 6],
'col3': [7, 8, 9]
})
df2 = pd.DataFrame.from_dict({
... |
Swift | UTF-8 | 423 | 3.109375 | 3 | [] | no_license | public enum ArticleDescriptionSource: String {
case none
case unknown
case central
case local
public static func from(string: String?) -> ArticleDescriptionSource {
guard let sourceString = string else {
return .none
}
guard let source = ArticleDescriptionSou... |
Shell | UTF-8 | 1,220 | 3.53125 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env bash
# Print Travis environment variables and migration count.
echo "TRAVIS_EVENT_TYPE: ${TRAVIS_EVENT_TYPE}"
echo "TRAVIS_TAG: ${TRAVIS_TAG}"
echo "TRAVIS_BRANCH: ${TRAVIS_BRANCH}"
echo "TWLIGHT_MISSING_MIGRATIONS: ${TWLIGHT_MISSING_MIGRATIONS}"
echo "TWLIGHT_TRANSLATION_FILES_CHANGED: ${TWLIGHT_TRANSL... |
Java | UTF-8 | 1,139 | 2.4375 | 2 | [] | no_license | /*******************************************************************************
* @author Reika Kalseki
*
* Copyright 2015
*
* All rights reserved.
* Distribution of the software in any form is only allowed with
* explicit, prior permission from the owner.
****************************************************... |
Java | UTF-8 | 3,297 | 2.171875 | 2 | [] | no_license |
package com.vriche.adrm.service.impl;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.vriche.adrm.Constants;
import com.vriche.adrm.dao.PriceTypeDao;
import com.vriche.adrm.model.PriceType;
import com.vriche.adrm.model.Resource;
import co... |
Python | UTF-8 | 5,759 | 2.765625 | 3 | [
"MIT"
] | permissive | import unittest
from evoplotter.dims import *
class TestsDims(unittest.TestCase):
def test_Dim_mult0(self):
dim1 = Dim([Config("A1", lambda p: True, valueA="1"),
Config("A2", lambda p: False, valueA="2")])
dim2 = Dim([])
prod = dim1 * dim2
self.assertEqual(2, le... |
Java | UTF-8 | 942 | 2.25 | 2 | [] | no_license | package com.kanhan.widget;
import com.kanhan.had.unit.constant.LanguageConstant;
import com.kanhan.had.utils.LangUtils;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.Switch;
public class WHCSwitch extends Switch {
public static Typeface cac... |
JavaScript | UTF-8 | 3,447 | 2.53125 | 3 | [] | no_license | (function() {
"use strict";
App.Tests.PrototypeClassTests = function(Class, asserts) {
var instance = new Class();
asserts.undefined(
instance.PRIVATE_STATIC_PROP, "[prototype-instance] --> PRIVATE_STATIC_PROP shoud be undefined.");
asserts.undefined(
instance.P... |
Python | UTF-8 | 698 | 4.15625 | 4 | [
"MIT"
] | permissive | """
根据成绩判断等级,如果录入空字符串,程序退出
如果录入成绩错误达到3次,则退出程序并显示成绩输入错误
"""
count = 0
while count < 3:
str_score = input("请输入一个成绩:")
if str(str_score) == "":
break
score = int(str_score)
if 90 <= score <= 100:
print("优秀")
elif 80 <= score < 90:
print("良好")
elif 70 <= score < 80:
... |
Java | UTF-8 | 16,767 | 1.890625 | 2 | [] | no_license | package com.cmall.familyhas.api;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import com.cmall.familyhas.api.input.ApiCollageTeamInfoInput;
import com.cmall.familyhas.api.result.ApiCollagePersonIn... |
C++ | UTF-8 | 525 | 2.609375 | 3 | [] | no_license | /*
to know about this more check out>>
https://www.youtube.com/watch?v=cH-5KcgUcOE&feature=youtu.be
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
string a,b;
cin>>a>>b;
for(int i=0;i<a.length();i++)
{
if(a[i]==b[0] && a.length()-i>=b.length())
{
string c;
c=a.substr(i,b.length());
... |
Go | UTF-8 | 4,046 | 2.765625 | 3 | [] | no_license | package main
import (
"encoding/binary"
"encoding/json"
"github.com/boltdb/bolt"
"github.com/pkg/errors"
"log"
"sync"
"time"
)
var AnalyticsStore *bolt.DB
func init() {
db, err := bolt.Open("analytics.db", 0600, nil)
if err != nil {
log.Fatal(err)
}
AnalyticsStore = db
AnalyticsStore.Update(func(tx ... |
JavaScript | UTF-8 | 1,001 | 2.5625 | 3 | [
"MIT"
] | permissive | /**
*
* Message
*
*/
import React from 'react';
import styled from 'styled-components';
const User = styled.p`
color: #6ec2ec;
font-size: 1em;
`;
const DateMsg = styled.p`
color: #919a9d;
position: relative;
float: right;
top: 2.5em;
font-size: 0.8em;
`;
const MessageData = styled.p`
padding: 0.... |
C++ | WINDOWS-1251 | 1,702 | 3.359375 | 3 | [] | no_license | #ifndef CUNIQUE_ARRAY_PTR
#define CUNIQUE_ARRAY_PTR
//====================================================================================================
//
//====================================================================================================
//
//===============================================... |
C++ | UTF-8 | 4,082 | 2.703125 | 3 | [] | no_license | //
// LineBrush.cpp
//
// The implementation of Line Brush. It is a kind of ImpBrush. All your brush implementations
// will look like the file with the different GL primitive calls.
//
#include "impressionistDoc.h"
#include "impressionistUI.h"
#include "LineBrush.h"
#include "transformations.h"
#include <math.h>
#d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.