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 | 4,153 | 2.90625 | 3 | [] | no_license | #include "collision.h"
const double AXIS_ROTATION_FROM_SIDE = M_PI / 2;
typedef struct range {
double min;
double max;
} range_t;
typedef struct collis_deriv_info {
collision_info_t info;
double overlap;
} collis_deriv_info_t;
bool point_within_range(double point, range_t range) {
return range.min <= poin... |
C | UTF-8 | 3,123 | 2.984375 | 3 | [] | no_license | ;#include <stdio.h>
;#include <math.h>
;#include <stdlib.h>
;
;void calculate_e()
;{
; int a;
; float b, c, e, z;
; a = 1;
; b = 1;
; c = 1;
; float y = 1.0;
; float e_6 = 2.718281;
; float prec = 0.00001;
;
; while (a <= 9)
; {
; printf("\n\nIteration number %d\n", a);
; c = c*a... |
Java | UTF-8 | 2,112 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | package cz.net21.ttulka.ant;
import org.apache.tools.ant.BuildException;
import java.io.IOException;
import java.nio.file.*;
import java.util.ArrayList;
import java.util.List;
/**
* Created by ttulka, 2017, http://blog.net21.cz
*
* Reads a directory and returns files with a name suffix (optional).
* The actual f... |
Markdown | UTF-8 | 1,380 | 2.875 | 3 | [
"MIT"
] | permissive | # Gulp integration
Run this to set your project up with a simple Gulp config.
```sh
./bin/rails generate npm_pipeline:gulp
```
## Manual setup
If you don't want to use the generator, here's what it does.
#### package.json
> Set up `gulp`, `gulp-cli`, and some basic Gulp plugins.
```sh
npm init --yes
npm install ... |
Java | UTF-8 | 637 | 1.914063 | 2 | [] | no_license | package com.example.macrz.project;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
Button Boton1;
@Override
protected void onCreate(Bundle sav... |
Java | UTF-8 | 6,635 | 2.125 | 2 | [
"Apache-2.0"
] | permissive | package us.ihmc.humanoidBehaviors.behaviors.complexBehaviors;
import controller_msgs.msg.dds.ArmTrajectoryMessage;
import controller_msgs.msg.dds.GoHomeMessage;
import us.ihmc.euclid.referenceFrame.FramePoint3D;
import us.ihmc.euclid.referenceFrame.FrameQuaternion;
import us.ihmc.euclid.referenceFrame.ReferenceFrame;
... |
C | UTF-8 | 316 | 3.046875 | 3 | [
"BSD-2-Clause"
] | permissive | #include <stdio.h>
void my_strcpy(char * dest, const char * src){
for(int i=0;src[i];i++){
dest[i]=src[i];
}
}
int main(int argc, const char *argv[]){
char buff[16];
int a=1;
printf("hello world,a=%d\n",a);
my_strcpy(buff,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
return 0;
}
|
JavaScript | UTF-8 | 2,390 | 3.0625 | 3 | [] | no_license | const { RemindersStore } = require('../src/reminder/RemindersStore');
const Reminder = require('../src/reminder/Reminder');
const isStoredDataOk = data => {
if (!data) {
throw new Error('Restored data invalid.');
}
if (!data['1']) {
throw new Error('User not found.');
}
if (!data[... |
C++ | UTF-8 | 1,398 | 4.1875 | 4 | [] | no_license | #include<iostream>
using namespace std;
// declare a class
class Wall{
private:
double length;
double height;
public:
//create parameterized constructor
Wall(double len, double hgt) {
//initialize private variables
length=len;
height=hgt;
}
Wall(double len)
... |
Python | UTF-8 | 282 | 3.046875 | 3 | [] | no_license | i=1
k=False
while k==False:
num=sum(range(1,i+1))
numroot=int(num**0.5)
divisor=0
for p in range(1,numroot):
if num%p==0:
divisor+=2
if num%numroot==0:
divisor+=1
if divisor>=500:
k=True
else:
i=i+1
print(num)
|
Java | UTF-8 | 438 | 1.734375 | 2 | [] | no_license | package com.mvc.console.rpc.service;
import com.mvc.api.vo.log.LogInfo;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@FeignClient("mvc-etherenum")
public interface EthernumServic... |
C++ | UTF-8 | 287 | 3.125 | 3 | [] | no_license | #include <iostream>
using namespace std;
class Test {
int i; // private by default
public:
int get_i() { return i; }
void put_i(int j) { i = j; }
};
int main()
{
Test s;
s.put_i(10);
cout << s.get_i();
system ("pause");
return 0;
}
|
Java | UTF-8 | 12,077 | 2.421875 | 2 | [] | no_license | package com.fcott.spadger.utils;
import android.util.Log;
import com.fcott.spadger.model.bean.ItemBean;
import com.fcott.spadger.model.bean.MenuBean;
import com.fcott.spadger.model.bean.NovelListBean;
import com.fcott.spadger.model.bean.NovelListItemBean;
import com.fcott.spadger.model.bean.PageControlBean;
import co... |
Java | UTF-8 | 11,020 | 2.015625 | 2 | [] | no_license | package com.frostox.calculo.activities;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar... |
TypeScript | UTF-8 | 912 | 2.578125 | 3 | [] | no_license | import fs from "fs";
import fetch from 'node-fetch'
import { Folders } from '../enums'
const category: Folders = Folders.skinsCharacter
test('resolver getSkins return the correct files URLs that are on the server', () => {
const references: string[] = []
const images: string[] = fs.readdirSync(`public/skins/... |
Markdown | UTF-8 | 14,624 | 3.890625 | 4 | [] | no_license | ## Chapter 3 线性方程组的解法
### 3.1 基本概念
1、$n$元矩阵表示:$Ax=B$
2、解:$x_1^*,\cdots,x^*_n$
3、解法:
- 直接法:用计算公式直接求出
- 迭代法:用迭代公式计算出满足精度要求近似解(逼近)
### 3.2 线性方程组的迭代解法
*类似非线性方程求根的简单迭代法,Jacobi迭代法、Seidel迭代法及Sor法等。*
基本思想:将线性方程组$Ax=B$等价变形为$x=Bx+g$,然后构造向量迭代公式:
$x^{(k+1)}=Bx^{(k)}+g,k=0,1,2,\cdots$
给定一个初始向量$x^{(0)}$,带入迭代公式计算$x^{(1)},x... |
C | UTF-8 | 352 | 3.359375 | 3 | [] | no_license | #include <stdio.h>
#include <unistd.h>
void printz()
{
sleep(1);
}
void bar()
{
sleep(1);
printz();
sleep(1);
}
void foo()
{
sleep(1);
bar();
sleep(1);
}
int main() {
int a = 0;
int b = 1;
int c = 2;
while (1) {
printf("a=%d b=%d c=%d *c=%d=%08x\n",a,b,c,&c,&c);
c++;
bar();
... |
C# | UTF-8 | 3,965 | 2.890625 | 3 | [
"MIT"
] | permissive | using ReverseRegex.Extensions;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
namespace ReverseRegex
{
class Program
{
static void Main(string[] args)
{
// FIXME: Console unicode support varies widely... |
Go | UTF-8 | 343 | 3.28125 | 3 | [] | no_license | package main
import (
"math/rand"
"time"
)
func randomString(length int) string {
rand.Seed(time.Now().UnixNano())
characters := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
returnString := ""
for i := 0; i < length; i++ {
returnString += string(characters[rand.Intn(len(characters))])
}
... |
Python | UTF-8 | 1,754 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8
import pandas as pd
import dask.dataframe as dd
import fastparquet as fp
import glob
from pprint import pprint
from dask import delayed
pd.set_option('display.expand_frame_repr', False)
def transform_one(series):
"""Takes a Series object representing a grouped dataframe row,
and returns ... |
Java | UTF-8 | 398 | 2.234375 | 2 | [] | no_license | package pathfind;
import item.Inventory;
import item.Item;
import item.ItemTemplate;
import java.util.ArrayList;
import world.Block;
import world.World;
public class ConditionItem implements Condition {
public String t;
public ConditionItem(String t){
this.t = t;
}
@Override
public boolean suits(Block b){
... |
C# | UTF-8 | 4,346 | 2.703125 | 3 | [
"MIT"
] | permissive | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="ModelImporter.cs" company="Helix Toolkit">
// Copyright (c) 2014 Helix Toolkit contributors
// </copyright>
// <summary>
// Imports a model from a file.
// </summary>
// -----... |
C++ | UTF-8 | 1,841 | 2.953125 | 3 | [
"MIT"
] | permissive | #pragma once
#include "QuickModel/QuickItemBase.h"
#include <QObject>
class DeviceAddItem : public QuickItemBase
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
Q_PROPERTY(QString address READ address WRITE setAddress NOTIFY addressChanged)
Q_PROPERTY(QString modelString ... |
Swift | UTF-8 | 1,282 | 2.921875 | 3 | [
"MIT"
] | permissive | //
// PhotoPersistenceHelper.swift
// PhotoJournal-Assignment
//
// Created by Pursuit on 10/3/19.
// Copyright © 2019 Pursuit. All rights reserved.
//
import Foundation
struct PhotoPersistenceHelper {
private init() {}
private let persistenceHelper = PersistenceHelper<Photo>(fileName: "photoJournals.plis... |
Java | UTF-8 | 1,490 | 3.609375 | 4 | [] | 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 ForkJoin;
import java.util.Scanner;
import java.util.concurrent.RecursiveTask;
public class Fibonacci extends Recur... |
Java | UTF-8 | 1,004 | 1.992188 | 2 | [] | no_license | package cn.bx.bframe.service;
import java.io.Serializable;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import cn.bx.bframe.entity.BaseBean;
import cn.bx.bframe.mapper.SqlMapper;
public abstract class DefaultService<M extends SqlMapper<T>, T extends BaseBean> exten... |
C++ | UTF-8 | 4,660 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2020 The Pigweed Authors
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agre... |
PHP | UTF-8 | 1,748 | 2.625 | 3 | [] | no_license | <?php
class Model_Empresa
{
protected $_table;
public function getTable()
{
if(null ===$this->_table)
{
require_once APPLICATION_PATH.'/models/DbTable/Empresa.php';
$this->_table= new Model_DbTable_Empresa;
}
return $this->_table;
}
public function lista()
{
$tab=$this->getTable()
-... |
C++ | UTF-8 | 334 | 2.96875 | 3 | [] | no_license | // Should be compiled with -ftemplate-depth=1000
#include <iostream>
template<int N>
struct SumMult3or5 {
enum {
sum = SumMult3or5<N-1>::sum + ((N % 3 == 0 || N % 5 == 0) ? N : 0)
};
};
template<>
struct SumMult3or5<0> {
enum { sum = 0 };
};
int main() {
std::cout << SumMult3or5<999>::sum <<... |
Python | UTF-8 | 1,103 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | from itertools import combinations, permutations
# outer represents the nodes on the outer ring
# inner represents the nodes on the inner ring
# on the inner ring, middle represents the nodes in the middle of a line
# on the inner ring, end_node represents the nodes on the end of a line
lst = range(1, 11)
numbers = [... |
Java | UTF-8 | 13,117 | 1.796875 | 2 | [] | no_license | /*
* Copyright 2013 WTFrobot. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and th... |
JavaScript | UTF-8 | 466 | 3.640625 | 4 | [
"MIT",
"CC-BY-4.0",
"LicenseRef-scancode-proprietary-license",
"CC-BY-NC-4.0"
] | permissive | //Adapted from https://www.w3schools.com/howto/howto_js_copy_clipboard.asp
function copyText(id, text) {
/* Get the text field */
var copyText = document.getElementById(id);
console.log(text)
/* Select the text field */
copyText.select();
copyText.setSelectionRange(0, 99999); /*For mobile devices*/
/* ... |
Python | UTF-8 | 1,203 | 3.625 | 4 | [] | no_license | #!/usr/bin/env python3
class Holdings:
'''
This class is built for containing a portfolio of stock shares.
The default constructor receives an open file handle for a csv file.
'''
def __init__(self, sharesfile):
import csv
self.holdings = []
with open(sharesfile,'r') as f:
... |
C++ | UTF-8 | 2,228 | 2.96875 | 3 | [
"MIT"
] | permissive | #include <cfloat>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
double washup(double d) {
if (fabs(d - (int)d) < FLT_EPSILON)
return (int)(d);
if (fabs(d - ((int)d + 1)) < FLT_EPSILON)
return ((int)d + 1);
if (fabs(d - ((int)d - 1)) < FLT_EPS... |
C++ | UTF-8 | 1,311 | 3.359375 | 3 | [] | no_license | // By Chandramani Kumar
// Keep moving and must be simple bro!!!!!
// Espérons le meilleur mais préparez-vous au pire 😎
/* Problem Statement :
Given an m x n matrix board where each cell is a battleship 'X' or empty '.', return the number of the battleships on board.
Battleships can only be placed horizontally or ... |
Java | UTF-8 | 6,574 | 2 | 2 | [] | no_license | package com.uplink.carins.utils;
import android.content.Context;
import android.content.res.Resources;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Radio... |
C++ | UTF-8 | 8,126 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Actor.h"
#include "LazerBossHand.generated.h"
UENUM(BlueprintType)
enum class EHandSlamState : uint8
{
Idle,//Not Slamming
Windup,//Moving back, winding up the slam
PreSlam,//Delay before slamming ... |
Markdown | UTF-8 | 980 | 2.75 | 3 | [] | no_license | ---
title: 不删除关联关系表引起的一点思考
date: 2018-03-19 22:13:12
categories:
- MySQL
tags:
- MySQL
---

三张表,其中一张c是另外两张a,b的关系表。如果仅仅考虑删除的情况,那么只要删除a就行了。不用去碰c表(coding的时候最好别这样做)。
a表相当于指向c表的指针,指... |
C# | UTF-8 | 27,027 | 2.78125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Data.SqlClient;
using System.Globalization;
using System.Reflection;
using System.Diagnostics;
//Contians problems that must be fixed before push to master [MASTER]
//Cont... |
Go | UTF-8 | 1,579 | 2.765625 | 3 | [] | no_license | package fcgi
import (
"encoding/binary"
"errors"
"fmt"
"io"
"io/ioutil"
)
// Request ...
type Request struct {
c *conn
Stdout io.Writer
Stderr io.Writer
Stdin io.Reader
}
func writerOrDiscard(w io.Writer) io.Writer {
if w != nil {
return w
}
return ioutil.Discard
}
// StdoutPipe ...
func (r *Req... |
Java | UTF-8 | 1,858 | 3.40625 | 3 | [] | no_license | package ua.privatbank.ilina.hw5;
import java.util.Arrays;
public class Library {
public static void main(String[] args) {
Book[] books = {
new Book("Moydodir", "some author", 1973),
new Book("Cheburashka", "some author", 1985),
new Book("Tom&Jery", "some au... |
C# | UTF-8 | 1,189 | 3.46875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
namespace BlackJack.Classes
{
public class Player
{
public List<Card> Cards; //pasakam, ka būs mainīgais - kāršu saraksts
public Player()
{
Cards = new List<Card>(); //izveido jaunu tukšu sarakstu
}
public voi... |
Python | UTF-8 | 7,427 | 2.546875 | 3 | [] | no_license | import sys
import pathlib
import os
import numpy as np
import librosa
from scipy.io import wavfile
import torch
from art.estimators.speech_recognition.pytorch_deep_speech import PyTorchDeepSpeech
from art.attacks.evasion.imperceptible_asr.imperceptible_asr_pytorch import ImperceptibleASRPyTorch
class AsrAttack():
... |
C | UTF-8 | 270 | 3.5 | 4 | [] | no_license | #include<stdio.h>
void main()
{
int i=0,j,t;
char s[100],r[100];
printf("Enter the string \n");
scanf("%s",s);
printf("%s\n",s);
while(s[i]!='\0')
{
i++;
}
t=0;
for(j=i-1;j>=0;j--)
{
r[t]=s[j];
t++;
}
printf("The reversed string is %s \n",r);
}
|
Python | UTF-8 | 2,109 | 2.8125 | 3 | [] | no_license | # import the necessary packages
from keras.preprocessing.image import img_to_array
from keras.models import load_model
import numpy as np
import argparse
import cv2
import imutils
import pickle
import os
from cv2 import *
class ImgClassifier:
path_model = "model4.h5"
path_pickle = "lb.pickle3"
@cla... |
Java | UTF-8 | 1,500 | 2.296875 | 2 | [] | no_license | package dealvector.lib;
import io.restassured.response.Response;
import io.restassured.response.ValidatableResponse;
import io.restassured.specification.RequestSpecification;
import java.util.HashMap;
import java.util.NoSuchElementException;
import static io.restassured.RestAssured.given;
import static io.restassure... |
Markdown | UTF-8 | 754 | 3.203125 | 3 | [] | no_license | # Countdown JS
## Setup
Set the following IDs on their relevant elements in the HTML:
```
"cd-weeks" - for weeks, no maximum value
"cd-days" - for days, up to 6 if weeks is defined
"cd-hours" - for hours, up to 23 if days is defined
"cd-minutes" - for minutes, up to 59 if hours is defined
"cd-seco... |
JavaScript | UTF-8 | 1,001 | 2.703125 | 3 | [
"MIT"
] | permissive | import './sass/main.scss';
import menuCardsTpl from './templates/menu-cards.hbs';
import menuData from './js/menu.json';
const Theme = {
LIGHT: 'light-theme',
DARK: 'dark-theme',
};
const STORAGE_KEY = 'currentTheme';
const listRef = document.querySelector('.js-menu');
const inputRef = document.querySelector('#them... |
Markdown | UTF-8 | 1,334 | 2.578125 | 3 | [
"MIT"
] | permissive | ## About Ruleta
- Este es un proyecto realizado con laravel version 8.23.1 y vueJs.
## Intalación en linux
- Paso 1) Clonar el proyecto
- Paso 2) Ubicarlo el la carpeta raiz de su servidor web Ej: /var/www/html/ruleta
- Paso 3) Ejecutar composer install
- Paso 4) Crear el archivo .env
4.1) Ejecutar touch .env pa... |
Java | UTF-8 | 660 | 1.9375 | 2 | [] | no_license | package com.banyechan.autocreatedatabase.configuration;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
@Slf4j
@Compone... |
Java | UTF-8 | 1,954 | 2.109375 | 2 | [] | no_license | package com.safely.batch.connector.components.external;
import com.safely.batch.connector.JobContext;
import com.safely.batch.connector.client.AuthorizationClient;
import com.safely.batch.connector.entity.AuthenticationResponseToken;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.s... |
C# | UTF-8 | 1,656 | 3.078125 | 3 | [] | no_license | using GameCampaign.Abstract;
using GameCampaign.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GameCampaign.Consrete
{
class SaleManager : ISaleService
{
public void Order(Game game, Gamer gamer)
{
... |
Markdown | UTF-8 | 720 | 2.703125 | 3 | [] | no_license |
# Deep Detect Drawing
Deep detect Drawing is a app based on a CNN model, to recognize a few draw.
You can check the model construction [here](https://github.com/leersmathieu/deep-detect-drawing/blob/master/modeling%20notebook/object_recognition_model.ipynb)
# Training & accuracy

# Try it ... |
Python | UTF-8 | 1,784 | 2.65625 | 3 | [] | no_license | # coding: utf-8
"""
管理用户
Usage:
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
from flask import Flask, request, redirect
import login
app = Flask(__name__)
login.init(app, 'sign_in')
@app.route('/')
@login.login_required
def index():
return 'Index!'
def sign_up():
pass
@app... |
PHP | UTF-8 | 791 | 2.515625 | 3 | [
"MIT"
] | permissive | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTariffsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tariffs', funct... |
PHP | UTF-8 | 4,716 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | <?php
/**
* Appfuel
* Copyright (c) Robert Scott-Buccleuch <rsb.appfuel@gmail.com>
* See LICENSE file at project root for details.
*/
namespace Appfuel\Filesystem;
use SplFileInfo,
LogicException,
RunTimeException,
InvalidArgumentException,
RecursiveIteratorIterator,
RecursiveDirectoryIterator;... |
Java | UTF-8 | 11,948 | 1.84375 | 2 | [
"Apache-2.0"
] | permissive | /*
* 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 file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
Java | UTF-8 | 7,665 | 2.34375 | 2 | [] | no_license | package com.example.zapal.myapplication;
import android.content.Intent;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
impo... |
PHP | UTF-8 | 440 | 2.859375 | 3 | [
"MIT"
] | permissive | <?php
namespace MoySklad\Exceptions;
use \Exception;
/**
* Invalid key was passed in "create" method of Spec class
* Class UnknownSpecException
* @package MoySklad\Exceptions
*/
class UnknownSpecException extends Exception{
public function __construct($spec = '', $code = 0, Exception $previous = null)
{
... |
Python | UTF-8 | 1,863 | 3.578125 | 4 | [] | no_license | from typing import Optional
class XmasDecoder:
def __init__(self, message_with_preamble: list[int], preamble_length: int):
self.preamble_length = preamble_length
self.message = message_with_preamble
def is_valid_number(self, message_index: int) -> bool:
if message_index < self.preambl... |
Java | UTF-8 | 2,162 | 2.265625 | 2 | [] | no_license | package com.example.admin.safetyapp;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
import android.widget.Toast;
/**
* Created by admin on 10/26/2017.
*/
public class EmailSending extends Service implements ServerResponse {
IBinder mBinder;
in... |
Markdown | UTF-8 | 1,369 | 3.03125 | 3 | [] | no_license | Project 2
This app I built calls the studio ghibli API and lists every movie, person, location, and vehicle! you can even add your favorite movie to your profile for quicker access
MVP goals
I made four models
You can favorite a movie to profile
You can delete a movie from profile
Each item (movie, person, etc.)... |
Rust | UTF-8 | 387 | 3.03125 | 3 | [] | permissive | use nannou::prelude::*;
pub struct Ball {
pub position: Point2,
color: Srgb<u8>,
}
impl Ball {
pub fn new(color: Srgb<u8>) -> Self {
let position = pt2(0.0, 0.0);
Ball { position, color }
}
pub fn display(&self, draw: &Draw) {
draw.ellipse()
.xy(self.position)
... |
JavaScript | UTF-8 | 1,000 | 3.234375 | 3 | [] | no_license | class Jugador {
constructor (color,nombre){
this.color= color;
this.nombre = nombre;
this.turno = false;
this.fichas = [];
}
getPosNombre (){
return this.posX;
}
setPosNombre (nombre){
this.nombre = nombre;
}
getColor (){
return this.co... |
Python | UTF-8 | 516 | 3.75 | 4 | [] | no_license | # 返回子字符串 str 在字符串中最后出现的位置,如果没有匹配的字符串会报异常
# str.rindex(str, beg=0 end=len(string))
# 参数
# str -- 查找的字符串
# beg -- 开始查找的位置,默认为0
# end -- 结束查找位置,默认为字符串的长度。
# 返回值:返回子字符串 str 在字符串中最后出现的位置,如果没有匹配的字符串会报异常。
# 与 rfind() 一样的示例代码
# 唯一不同找不到的时候报错 |
Java | UTF-8 | 227 | 1.914063 | 2 | [] | no_license | package com.jk.algorithm.hackerrank.java.stringTokens;
/**
* string s 를 받아, !/@/,/./?/_ 를 구분자로 쪼개어 쪼개진 string 을 token이라 칭한다. 이후 token의 값 개수와 각 token을 출력하라
**/ |
PHP | UTF-8 | 1,088 | 2.90625 | 3 | [] | no_license | <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Classic Models</title>
<meta name="description" content="Classic Models Admin Panel.">
<link rel="stylesheet" href="cm.php">
<script src=""></script>
</head>
<body>
<?php
include 'header.php';
require_once 'cmconfig.php';
//<!----- C... |
Shell | UTF-8 | 368 | 2.578125 | 3 | [] | no_license | ZSH_DISABLE_COMPFIX=true
if ! source "${HOME}/.zgen/init.zsh"; then
# Load zgen
source "${HOME}/.zgen.zsh"
echo "Creating a zgen save"
zgen load hlissner/zsh-autopair
#zgen load zsh-users/zsh-syntax-highlighting
# Save it to an init script
zgen save
fi
# Completions
fpath=(~/.zsh $fpath)
# ... |
SQL | UTF-8 | 555 | 4.15625 | 4 | [
"MIT"
] | permissive | SELECT TOP(2) [s].[ShowGuid], [t0].[Title], [t0].[ModifiedDate]
FROM [Show] AS [s]
LEFT JOIN (
SELECT [t].[ShowId], [t].[Title], [t].[ModifiedDate]
FROM (
SELECT [s0].[ModifiedDate], [s0].[ShowId], [s0].[Title],
ROW_NUMBER() OVER(
PARTITION BY [s0].[ShowId]
OR... |
C# | UTF-8 | 505 | 2.921875 | 3 | [] | no_license | namespace FactoryMethod
{
public class ChicagoStyleVeggiePizza : Pizza
{
public ChicagoStyleVeggiePizza()
{
Name = "Chicago Style Veggie Pizza";
Dough = "Crust";
Sauce = "Marinara Pizza Sauce";
Toppings.Add("Shredded Mozzarella");
Top... |
PHP | UTF-8 | 2,655 | 2.953125 | 3 | [
"MIT"
] | permissive | <?php
namespace MM\bot\components\sound;
use Exception;
use MM\bot\components\sound\types\AlisaSound;
use MM\bot\components\sound\types\MarusiaSound;
use MM\bot\components\sound\types\TelegramSound;
use MM\bot\components\sound\types\TemplateSoundTypes;
use MM\bot\components\sound\types\ViberSound;
use MM\bot\compone... |
C | UTF-8 | 294 | 2.71875 | 3 | [] | no_license | #include "includes/addRoundKey.h"
#include "includes/byte.h"
#include "includes/constants.h"
/**
* AddRoundKey step: make state XOR roundKey
*/
void addRoundKey(byte state[], const byte roundKey[]) {
for (int i = 0; i < KEY_BYTES_LENGTH; i++) {
state[i] ^= roundKey[i];
}
}
|
C++ | UTF-8 | 535 | 3.375 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
void pusharr(TreeNode* node, vector<int> &a) {
if (node == NULL) return;
pushar... |
PHP | UTF-8 | 578 | 2.578125 | 3 | [] | no_license | <?php
namespace App\Repositories\Eloquent;
use App\Models\Notice as Model;
use App\Repositories\Interfaces\Notice;
class NoticeRepository extends EloquentRepository implements Notice
{
/**
* Specify Model class name
*
* @return \Illuminate\Database\Eloquent\Model|string
*/
public functio... |
Go | UTF-8 | 3,961 | 3.265625 | 3 | [] | no_license | package main
import (
"fmt"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/sha256"
"crypto/x509"
"encoding/base64"
"encoding/json"
"os"
"bufio"
"io/ioutil"
"encoding/pem"
)
//Defining a type that will be used to MarshalJSon in the main function.
type jsonobj struct {
Message string
Signature str... |
Java | UTF-8 | 1,566 | 2.234375 | 2 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | package org.jclouds.elb;
import org.jclouds.collect.PaginatedSet;
import org.jclouds.collect.PaginatedSets;
import org.jclouds.elb.domain.LoadBalancer;
import org.jclouds.elb.features.LoadBalancerClient;
import org.jclouds.elb.options.ListLoadBalancersOptions;
import com.google.common.base.Function;
/**
* Utilities... |
TypeScript | UTF-8 | 6,275 | 2.90625 | 3 | [
"MIT"
] | permissive | import { HotReloadService } from "./HotReloadService";
interface HotMethodOptions {
//restartOnReload?: boolean;
}
const defaultHotMethodOptions: HotMethodOptions = {
//restartOnReload: true
};
/**
* Marks a class as hot reloadable.
* This marks each method with `@hotMethod` and tracks new methods.
*/
export fun... |
PHP | UTF-8 | 245 | 2.65625 | 3 | [] | no_license | <?php
/**
* Created by PhpStorm.
* User: asad.manzoor
* Date: 7/14/16
* Time: 4:42 PM
*/
require_once "Fighter_Jet.php";
class Mashaak implements Fighter_Jet
{
public function purchased()
{
echo "Mashaak purchased";
}
} |
Swift | UTF-8 | 3,481 | 3.15625 | 3 | [] | no_license | //
// ViewController.swift
// UITableViewSample
//
// Created by 박성은 on 2018. 2. 21..
// Copyright © 2018년 SE. All rights reserved.
//
import UIKit
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
let array = ["a", "b", "c", "d", "e"]
let arrayDetail = ["aa", "bb",... |
Java | UTF-8 | 1,439 | 2.859375 | 3 | [] | no_license | package com.pss.chain;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.pss.service.MessageProcessor;
/**
* 责任链模式测试(chain)
*
* @author songsong.peng
*
*/
public class ProcessorChain {
private static final Logger LOGGER = LoggerFactory.ge... |
TypeScript | UTF-8 | 565 | 2.609375 | 3 | [
"MIT"
] | permissive | import * as JWT from 'jsonwebtoken';
const TEN_MINUTES: string = '10m';
class JwtSignProcessor {
static sign(payload: any, globalSecretKey: string): string {
let signedToken: string = '';
let validationStatus = globalSecretKey && payload;
if (!validationStatus) {
throw new Err... |
C++ | UTF-8 | 283 | 3.21875 | 3 | [] | no_license | #include <cstdio>
#include <functional>
#include <string>
class Person {
public:
std::string name;
};
int main() {
Person* p = new Person();
p->name = "Henry";
auto foo = [=](int value1, int value2) -> int {
if (value1 > 0) {
return value1 + value2;
}
};
return 0;
} |
Markdown | UTF-8 | 1,725 | 3.234375 | 3 | [] | no_license | # Future Callable
- Callable 接口 相比 Runnable 接口 ,可以抛出异常,获得返回值
- Future 对象 ,用来获取到 Callable 对象中的call方法的返回值
- 获取方法
- Future<V> f1
- f1.get() 获取到值(结果只能在计算完成后get‘进行检索,如有必要,阻塞,直到准备就绪)
- - ```
package TestSychoronized;
import java.util.concurrent.*;
public class TestCallable {
... |
Markdown | UTF-8 | 5,525 | 3.25 | 3 | [] | no_license | # Rails API
[Video](https://youtu.be/FjEJ2LLkxHk)
### Objectives
- Understand WHY we want to use a Rails API
- Understand how to get a Rails API up and running from scratch
- Understand how to use a Rails API with your SPA
### Why a Rails API?
- JSON is language agnostic. It is just a string that follows rules th... |
Python | UTF-8 | 546 | 4.875 | 5 | [] | no_license | # Errors and Exceptions Exercise 4
# 0 puntos posibles (no calificados)
# Write a program that asks the user for an input and tries to handle the error that may occur when you try to type cast the input to an int using the try ... except ... else clause. Your function should print the result if the operation is success... |
Python | UTF-8 | 1,230 | 2.859375 | 3 | [] | no_license | import pandas as pd
from fpdf import FPDF
import funconstructor as fc
def newPDF():
pdf = FPDF('P', 'mm', 'A4')
pdf.add_page()
#Set Title
pdf.set_font('Arial', 'B', 20)
pdf.cell(0, 10, 'Social Media Report', 0, 1, 'C')
#First row of data
pdf.cell(0, 10, ' ', 0, 1, 'C')
pdf.set_fon... |
JavaScript | UTF-8 | 3,686 | 2.734375 | 3 | [] | no_license | /**
* Created by Namita Malik on 26/5/15.
*/
(function (ng) {
var eduStat = ng.module('eduStat', []);
eduStat.controller('StudentController', ['StudentService',function (StudentService) {
var studentController = this;
studentController.students = StudentService.getStudentList();
functi... |
C# | UTF-8 | 6,020 | 2.515625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SqlConnectionTest
{
struct RBFormat
{
public string code;
public int tradeDate, naturalDate, tradeTime, tradeStatus;
public double ask, bid, askv, bidv, lastPri... |
JavaScript | UTF-8 | 2,723 | 2.59375 | 3 | [
"ISC"
] | permissive | const https = require('https');
const http = require('http');
const url = require('url');
const log = require('./log.js');
var api = (function () {
function request(method, href, headers, data, done) {
var endpoint, options, request, requestContent;
endpoint = url.parse(href);
if (!head... |
JavaScript | UTF-8 | 3,657 | 2.5625 | 3 | [] | no_license | /*var ip = "192.168.1.43";//location.hostname;
var robotPort = "4900";
var robotServer = 'http://'+ip+':'+robotPort;
$('#robotDur').click(function() {
$.post(robotServer+'/robot/dur,0,0');
});
$('#robotIleri').click(function() {
var adimboyu = (parseFloat(35 * $('#AdimBoyu').val())).toString();
var adim = $('#... |
C | UTF-8 | 2,195 | 3.421875 | 3 | [] | no_license | There are two singly linked lists in a system. By some programming error the end node of one of the linked list got linked into the second list, forming a inverted Y shaped list. Write a program to get the point where two linked lists merge.
Y ShapedLinked List
Above diagram shows an example with two linked list havin... |
Markdown | UTF-8 | 2,163 | 2.9375 | 3 | [] | no_license | ---
title: "T3 JavaScript Framework for Large-scale Web Applications"
description: "T3 is a client-side JavaScript framework for building large-scale web applications. T3 is different than most JavaScript frameworks. It’s meant to be a small piece of an overall architecture that allows you to build scalable client-side... |
Python | UTF-8 | 9,524 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | """
The script shows how to train Augmented SBERT (Domain-Transfer/Cross-Domain) strategy for STSb-QQP dataset.
For our example below we consider STSb (source) and QQP (target) datasets respectively.
Methodology:
Three steps are followed for AugSBERT data-augmentation strategy with Domain Trasfer / Cross-Domain -
1. ... |
PHP | UTF-8 | 4,103 | 3.046875 | 3 | [] | no_license | <?php
class DBase {
private $db_host;
private $db_user;
private $db_pass;
private $db_driver;
private $db_name;
public $dbconn;
function __construct()
{
// connet to db
$this->handel_db_vars();
$this->connect();
}
function __destruct()
{
... |
Python | UTF-8 | 1,643 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
from pandas import DataFrame
import uuid,sys
def scrapechart(soup) :
blocks =[]
taglist = soup.find('tbody',{"class" : "lister-list" }).findAll('tr')
for t in taglist :
movie_block={}
try :
movie_block['... |
Python | UTF-8 | 14,659 | 2.75 | 3 | [] | no_license | from matplotlib.backends.backend_agg import RendererAgg
import streamlit as st
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib
from matplotlib.figure import Figure
import altair as alt
import matplotlib.pyplot as plt
import plotly.figure_factory as ff
import plotly.express as px
from mod... |
Java | UTF-8 | 220 | 2.90625 | 3 | [] | no_license | package printer;
public class PrinterImpl implements Printer {
private String lastPrint = "";
public void print(String line) {
lastPrint = line;
}
@Override
public String toString() {
return lastPrint;
}
} |
Python | UTF-8 | 1,287 | 4.0625 | 4 | [] | no_license |
#1
'''def bubble_sort(lst=[7, 30, -8, 414, 9]):
for i in range(len(lst)):
for j in range(len(lst) - i - 1):
if lst[j] > lst[j + 1]:
lst[j], lst[j + 1] = [lst[j + 1], lst[j]]
return lst
print(bubble_sort([7, 30, -8, 414, 9]))'''
#2
'''def mix_lists(lst1=[], ls... |
Python | UTF-8 | 346 | 2.65625 | 3 | [] | no_license | import numpy as np
import cv2
class BackgroundSubstractClass:
def __init__(self, height, width, alpha):
self.height = height
self.width = width
self.alpha = alpha
self.model = np.zeros((self.height, self.width, 3))
def updateModel(self, frame):
self.model = (1 - self.alpha)*self.model + self.alpha*fram... |
Java | UTF-8 | 331 | 1.851563 | 2 | [] | no_license | package com.restwebservices.prac.exception;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ExceptionReponse {
private LocalDateTime timstamp;
private String message;
private String de... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.