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 |
|---|---|---|---|---|---|---|---|
Python | UTF-8 | 568 | 2.84375 | 3 | [] | no_license | #13 : Red / 19 : Green / 26 : Blue , led RGB를 번갈아 키는 실습
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(13,GPIO.OUT) #Red
GPIO.setup(19,GPIO.OUT) #Green
GPIO.setup(26,GPIO.OUT) #Blue
try:
while True:
GPIO.output(13,True)
time.sleep(0.5)
GPIO.output(13,False)
... |
JavaScript | UTF-8 | 2,553 | 3.453125 | 3 | [] | no_license | // from data.js
ufo_data = data;
// Use d3 to create a bootstrap striped table
var table = d3.select("table");
// Use d3 to create a bootstrap striped table...This is already done in html file but is a good practice to have this piece of code
// http://getbootstrap.com/docs/3.3/css/#tables-striped
table.attr("class... |
C++ | UTF-8 | 1,777 | 2.6875 | 3 | [
"MIT"
] | permissive | #include "WebNotificationEngine.h"
#include "DHASLogging.h"
#include <sstream>
// This is used for Server Sent Events
WebNotificationEngine::WebNotificationEngine()
{
pthread_mutex_init(&mSocketListLock,0);
}
WebNotificationEngine::~WebNotificationEngine()
{
pthread_mutex_destroy(&mSocketListLock);
}
void W... |
C# | UTF-8 | 487 | 2.59375 | 3 | [] | no_license | using System;
using System.ComponentModel.DataAnnotations;
namespace BattleshipContestFunc
{
public class AbsoluteUriAttribute : ValidationAttribute
{
public AbsoluteUriAttribute() { }
public override bool IsValid(object? objValue)
{
if (objValue == null) return true;
... |
Java | UTF-8 | 3,021 | 2.375 | 2 | [
"Apache-2.0"
] | permissive | package com.contentful.tea.java.services.http;
import com.contentful.tea.java.services.contentful.Contentful;
import com.contentful.tea.java.services.settings.Settings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Enumeration;
import... |
Markdown | UTF-8 | 565 | 2.5625 | 3 | [] | no_license | # API_Project
NASA APIs used: MARS MAAS & APOD (Astronomy Picture Of The Day)
Project title- NASAPI
Using the NASA {MAAS} API and the APOD API This project is a fully functional web application that has user inputs which will show information from JPLs Mars Rovers Curiosity, Spirit, and Opportunity. The web app also c... |
Python | UTF-8 | 621 | 3.5 | 4 | [] | no_license |
from Binary_Trees_utils import binary_tree_to_string, equal_binary_trees
class BinaryTreeNode:
def __init__(self, data=None, left=None, right=None, size=None):
self.data = data
self.left = left
self.right = right
self.size = size
def __eq__(self, other):
retur... |
C# | UTF-8 | 4,415 | 2.953125 | 3 | [] | no_license | using Microsoft.Kinect;
using System;
using System.Windows.Media.Imaging;
using System.Windows.Controls;
using System.Windows;
using System.Windows.Media;
namespace Kinect_Recorder
{
class DepthRenderer
{
#region instance variables
/// <summary>
/// Size of the RGB pixel in the bitmap
/// </summary>
priv... |
JavaScript | UTF-8 | 602 | 2.53125 | 3 | [] | no_license | import axios from 'axios'
const GET_NOTIFICATIONS = 'GET_NOTIFICATIONS'
export function getNotifications(userId) {
return {
type: GET_NOTIFICATIONS,
payload: axios
.get(`/api/notification/${userId}`)
.then(res => {
return res.data
})
.catch(err => {
console.log('err',... |
C++ | UTF-8 | 3,128 | 2.96875 | 3 | [] | no_license | #include "Mesh.h"
#if BUILD_DIRECTX
#include "VBO_DX.h"
#endif
#if BUILD_OPENGL
#include "VBO_GL.h"
#endif
#include "Vector4.h"
#include <iostream>
#include <fstream>
using namespace std;
/******************************************************************************************************************/
Mesh::Mesh()
... |
C# | UTF-8 | 167 | 2.71875 | 3 | [] | no_license | #pragma warning disable 1998
public async Task<string> PullText()()
#pragma warning restore 1998
{
return Task.Run(() => "hello world");
}
|
Python | UTF-8 | 384 | 3.3125 | 3 | [] | no_license | # function drawLine(p1, p2, varargin)
# %DRAWLINE Draws a line from point p1 to point p2
# % DRAWLINE(p1, p2) Draws a line from point p1 to point p2 and holds the
# % current figure
#
# plot([p1(1) p2(1)], [p1(2) p2(2)], varargin{:});
#
# end
import matplotlib.pyplot as plt
def drawLine(p1, p2):
plt.plot(
... |
Java | UTF-8 | 2,443 | 2.171875 | 2 | [] | no_license | package com.group6.service.impl;
import com.group6.service.OBSService;
import com.obs.services.ObsClient;
import com.obs.services.model.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.util.List;
... |
C# | UTF-8 | 2,354 | 2.59375 | 3 | [] | no_license | using MC_Server_Test.Network;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace MC_Server_Test.Minecraft
{
public class MinePacket : DataBuffer
{
private const int ReservedHeaderBytes = 24;
p... |
TypeScript | UTF-8 | 810 | 2.75 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import { RicardianContractRenderError } from './RicardianContractRenderError'
describe('RicardianContractRenderError', () => {
it('constructs message from string properly', () => {
const expected = 'Danger, Will Robinson!'
const error = new RicardianContractRenderError(expected)
expect(error.message).toE... |
JavaScript | UTF-8 | 7,432 | 2.921875 | 3 | [
"MIT"
] | permissive | /**
* Board viewer UI generator
*
* Copyright (c) 2016-2017, Evan Moritz.
* Licensed under the MIT license. See accompanying LICENSE file for terms.
*/
define(
["board"],
function(Board) {
"use strict";
var WIDTH_MAX = 30;
var HEIGHT_MAX = 24;
var Viewer =... |
JavaScript | UTF-8 | 3,163 | 2.671875 | 3 | [
"ISC"
] | permissive | /* global describe, it */
const CovSource = require('../lib/source')
require('tap').mochaGlobals()
require('should')
describe('Source', () => {
describe('relativeToOffset', () => {
it('returns an offset in the middle of a file', () => {
const sourceRaw = `const a = 99
const b = 33
for (va... |
Java | UTF-8 | 5,022 | 1.960938 | 2 | [] | no_license | package com.example.eventplanner.controller;
import com.example.eventplanner.model.Course;
import com.example.eventplanner.model.User;
import com.example.eventplanner.model.appliedcourse;
import com.example.eventplanner.repository.Courserepository;
import com.example.eventplanner.repository.UserRepository;
import com.e... |
Java | UTF-8 | 2,494 | 3.0625 | 3 | [] | no_license | package com.study.seventyseven.websecutity.day001;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import cn.hutool.core.io.file.FileReader;
/**
* @author SeventySeven
* @Title: HttpAddress... |
Markdown | UTF-8 | 195 | 2.84375 | 3 | [] | no_license | # portfolioSite
First step: recreate a mockup of a responsive website (mobile, tablet, desktop), then
Second step: adapt it with our own resources (images, contents) to personalize the portfolio. |
Python | UTF-8 | 621 | 4.09375 | 4 | [] | no_license |
# версия 1, с числом
a= 9
print("Молодец ты угадал! Да это число", a)
# ответ Молодец ты угадал! Да это число 9
# версия 2, со строкой
#
num = 10
num = str(num)
end = ("Молодец ты угадал! Да это число ")
print(end + num)
# ответ Молодец ты угадал! Да это число 10
# версия 3, с f-строкой
#
num = 20
print(f"Молоде... |
Python | UTF-8 | 2,599 | 2.96875 | 3 | [] | no_license | import os
def get_time_id(timestamp):
t = timestamp.split()[1].split(':')
return int(t[0]) * 6 + int(t[1]) / 10 + 1
def get_timestamp_by_id(id):
return "{0:0>2}:{1:0>2}:00".format(id / 6, (id % 6) * 10)
def fill_data(dic):
sorted(dic.items(), key=lambda i: i[0])
tmp = {}
itr = iter(dic.ite... |
C++ | UTF-8 | 1,140 | 3.046875 | 3 | [] | no_license | //
// Created by gzq on 4/26/19.
//
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
int splitArray(vector<int> &nums, int m) {
int n = nums.size();
vector<vector<long long>> dp(m, vector<long long>(n + 1, 0));
vect... |
Markdown | UTF-8 | 1,329 | 2.828125 | 3 | [] | no_license | # for P.I WORKS
 (We write the image link here.)
## This is the interface to add a user and show these added users.
---
Let's examine the details of this interface.
___
To add a new user, click the "+New User" button at the top left of the page and enter the required data for... |
Java | UTF-8 | 874 | 2.5 | 2 | [] | no_license | package com.app.runner;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import com.app.model.Product;
import com.app.repo.ProductRepository;
@Component
public class Con... |
Java | UTF-8 | 779 | 2.375 | 2 | [] | no_license | package com.penzgtuar;
import android.content.Context;
import android.content.res.Resources;
import rajawali.Object3D;
import rajawali.materials.textures.TextureManager;
import rajawali.parser.LoaderOBJ;
public class MeshObject extends ARObject {
public MeshObject(String entname, String meshname, Context mContext,
... |
C++ | UTF-8 | 1,500 | 3.40625 | 3 | [] | no_license | #include "MyInt.hpp"
#include "Array.hpp"
#include <iostream>
#include <utility>
#include <assert.h>
int main() {
std::size_t before;
// Creates an array. The contained element should be of type MyInt.
cs540::Array a1{1, 2, 3};
std::cout << a1 << std::endl;
// Both a2 and a1 should be identica... |
Python | UTF-8 | 205 | 3.40625 | 3 | [
"Python-2.0",
"BSD-3-Clause",
"MIT"
] | permissive | def classify(number):
""" A perfect number equals the sum of its positive divisors.
:param number: int a positive integer
:return: str the classification of the input integer
"""
pass
|
Java | UTF-8 | 7,228 | 2.875 | 3 | [] | no_license | //@author Ethan Young
package edu.wm.cs.cs301.EthanYoung.generation;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
public class MazeBuilderEller extends MazeBuilder implements Runnable {
/**
* constructor for MazeBuilderEller.java
*/
public MazeBuil... |
Java | UTF-8 | 10,040 | 1.640625 | 2 | [] | no_license | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 Oracle and/or its affiliates. All rights reserved.
*
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.
*
* The contents of this file are subject... |
C# | UTF-8 | 2,987 | 2.796875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace VeeamTaskLib {
public class ChunkManager : IDisposable {
private List<IChunk> _chunkList = new List<IChunk>();
public Result Status = Result.Ok();
private int _processorCount = 1;
p... |
C++ | UTF-8 | 958 | 2.65625 | 3 | [] | no_license | #include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#includ... |
Java | UTF-8 | 2,178 | 2.609375 | 3 | [] | no_license | package org.beccaria.hub;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import java.util.logging.Logger;
public class MessagePublisher {
... |
Shell | UTF-8 | 628 | 3.75 | 4 | [] | no_license | #!/bin/bash
YELLOW=`tput setaf 3`
RESET=`tput sgr0`
echo "${YELLOW}All files in current working dir:${RESET}"
echo * # echoes all files in current working dir
echo
echo "${YELLOW}MD files in current working dir:${RESET}"
echo *.md # echoes all files matching the predicate (anything.md) in the working dir
ech... |
TypeScript | UTF-8 | 2,000 | 2.65625 | 3 | [] | no_license | /**
* # 「SEOを意識したHTMLを書いてみよう!」 - SEO Basics
*
* ## 概要
* `<meta>`タグでOGPの設定をする.
*/
import { isLeft, isRight } from "fp-ts/lib/Either"
import { OgpVisitor } from "../utils/ogpValidator"
const cardTypes = [
'summary',
'summary_large_image',
'app',
'player',
]
describe('Station6', function () {
beforeEach(... |
C++ | UTF-8 | 3,365 | 3.15625 | 3 | [] | no_license | #include <string>
#include <iostream>
#include <fstream>
#include <string.h>
#include "headers/Cartridge.hpp"
using namespace std;
Cartridge::Cartridge(string path)
{
if (!path.empty()) {
rom.open(path, ios::in | ios::binary);
if (!rom.is_open()) {
cerr << "Could not open: " << path << endl;
exit(1);
}
... |
Java | UTF-8 | 985 | 3.015625 | 3 | [] | no_license | package jianzhioffer;
import java.util.ArrayList;
/**
* \* Created with IntelliJ IDEA.
* \* User: TTT
* \* Date: 2018/6/3
* \* Time: 21:34
*/
/*输入一颗二叉树和一个整数,打印出二叉树中结点值的和为输入整数的所有路径。
路径定义为从树的根结点开始往下一直到叶结点所经过的结点形成一条路径。
* */
public class Solution25 {
private ArrayList<ArrayList<Integer>> listAll=new ArrayList<Ar... |
Java | UHC | 1,347 | 2.203125 | 2 | [] | no_license | package com.model2.mvc.view.user;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.model2.mvc.framework.Action;
import com.model2.mvc.service.domain.User;
import com.model2.mvc.service.user.UserService... |
C# | UTF-8 | 2,221 | 2.65625 | 3 | [] | no_license | using MvvmHelpers;
using SeedShare.Services;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Xamarin.CommunityToolkit.ObjectModel;
using Xamarin.Forms;
namespace SeedShare.ViewModels
{
[QueryProperty(nameof(Name), nameof(Name))]
public class AddLibraryVie... |
C | UTF-8 | 907 | 4 | 4 | [] | no_license | /*
* Program to count frequency of particular digit in number
*/
#include<stdio.h>
int CountFreq(long, int);
int main()
{
long lNum = 0;
int iDig = 0, iRet = 0;
printf("Enter the number:\t");
scanf("%ld", &lNum);
printf("Enter the digit:\t");
scanf("%d", &iDig);
iRet = CountFreq(lNum, iDig);
printf("Number of... |
Markdown | UTF-8 | 2,784 | 3.015625 | 3 | [] | no_license | # VPAT-HTML
VPAT-HTML is a tool for generating Voluntary Product Accessibility Template html tables from json 🏗ℹ

# Usage
```
const VPAT = require('vpat-html');
const support = {
// ...
}
const html = new VPAT(support);
```
# Features
```
// define sup... |
C# | UTF-8 | 2,806 | 2.609375 | 3 | [] | no_license | using AppCore.Data;
using AppCore.Interfaces;
using AppCore.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace WebAPI.Controllers
{
[Route("api/wool... |
Java | UTF-8 | 1,234 | 3.625 | 4 | [] | no_license | package knowledge.currenttestexample;
import java.util.concurrent.TimeUnit;
/**
* 6-13
*/
public class Join {
public static void main(String[] args) throws Exception {
Thread previous = Thread.currentThread();
for (int i = 0; i < 10; i++) {
Thread thread = new Thread(new Domino(previ... |
Python | UTF-8 | 15,045 | 2.828125 | 3 | [] | no_license | from __future__ import division
import re
import sys
import StringIO
class Procedure(object):
"""A user-defined Scheme procedure."""
def __init__(self, params, exp, env, runtime):
self.params = params
self.exp = exp
self.env = env
self.runtime = runtime
def __call__(self,... |
PHP | UTF-8 | 3,598 | 2.765625 | 3 | [
"MIT"
] | permissive | <?php
namespace Helpers;
use Hyper\Functions\Str;
use Hyper\Reflection\Annotation;
use ReflectionClass;
use ReflectionClassConstant;
use ReflectionMethod;
use ReflectionProperty;
use Reflector;
abstract class ReflectionHelper
{
#region Public
public static function getClass(ReflectionClass $ref): object
... |
C# | UTF-8 | 855 | 2.59375 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GlobalFade : MonoBehaviour
{
public static GlobalFade instance;
public Animator animator;
#region[Awake]
public void Awake()
{
if (instance == null)
{
instance = this;
... |
C++ | UTF-8 | 1,020 | 3.6875 | 4 | [] | no_license |
#include <iostream>
#include <vector>
using namespace std;
string stringCompressor(string A){
string result = "";
vector<pair<char, int>> currentTuples;
int Reps = 1;
for(int i = 0; i < A.length(); i++){
while(A[i] == A[i+1]){
Reps++;
i++;
}
curren... |
JavaScript | UTF-8 | 966 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
const fs = require('fs');
const github_events = 'jsonexamples/github_events.json';
var file = fs.readFileSync(github_events, 'utf-8');
var JSONObj = JSON.parse(file);
// Display object content
//console.log(JSONObj);
// Display Object Keys
//console.log(Object.keys(JSONObj));
// Display Object length
... |
Ruby | UTF-8 | 1,685 | 2.890625 | 3 | [] | no_license | require 'spec_helper'
module ToySimulator
describe Bearing do
describe '.new' do
it 'is private and cannot be called from outside the class' do
expect {Bearing.new(facing: :south, forward: nil)}.to raise_error
end
end
describe '.for' do
let(:direction) {:south}
let(... |
TypeScript | UTF-8 | 1,960 | 2.765625 | 3 | [] | no_license | import { SimulatedPeripheral } from "../simulated-peripheral";
import { SimulatedBleError, BleErrorCode } from "../ble-error";
import { Base64 } from "../types";
let id = 0
export const IdGenerator = {
nextId() {
return id++
}
}
export function delay(delay: number): Promise<void> {
return new Pro... |
Shell | UTF-8 | 1,076 | 3.34375 | 3 | [] | no_license | #!/bin/bash
# From https://github.com/sunyal/gradle-profiler
if [ -z "$ANDROID_HOME" ]
then
echo "ANDROID_HOME needs to be set"
exit;
fi
if ! [ -x "$(command -v bazel)" ]; then
echo 'Error: bazel is not installed.' >&2
exit 1
fi
targets="cleanWithColdLocalCache cleanWithColdLocalCacheWithDaemon abiChangeWithL... |
C# | UTF-8 | 1,135 | 3.203125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Text;
namespace SuperHeroAcademy
{
class Melee : Hero
{
int maxStamina;
int stamina;
string weapon;
public Melee(int _stamina, string _weapon, int _hp, int _def, int _dmg, string _name) : base(_hp, _def, _dmg, _name)... |
Shell | UTF-8 | 186 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env bash
base=`dirname "$0"`
root="$base/.."
if [ "$1" = "--dev" ]; then
export NODE_ENV="development"
echo "activating development mode"
fi
"$root/src/server/index.mjs"
|
Markdown | UTF-8 | 2,660 | 3.390625 | 3 | [] | no_license | #### SignUp User
This week you will create an authentication system from stratch; that measn SignUp, SignIn, SignOut & a way to check if the user is signedIn. Today you only need to create a signUp page; Very important is that you set the validations for the email and password's.
1. The password should be at least 8 c... |
Java | UTF-8 | 689 | 2.265625 | 2 | [] | no_license | package com.android.promosee.core;
import android.content.Context;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
/**
* Created by imam on 26/09/16.
*/
public class Alert {
public static void dialog(Context context, String error) {
AlertDialog.Builder builder = new Al... |
Java | UTF-8 | 1,709 | 2.5625 | 3 | [] | no_license | import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import javax.mail.MessagingException;
import javax.mail.internet.AddressException;
import static org.testng.AssertJUnit.fail;
/**
* Created by fd on 03.07.2016.
*/
public class TestNegativeEmail ... |
Java | UTF-8 | 1,166 | 1.921875 | 2 | [
"Apache-2.0"
] | permissive | /* 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 applicable law or agreed to in writing, software
* distribut... |
Python | UTF-8 | 6,251 | 2.78125 | 3 | [] | no_license | # semantic.py
# author: Christophe VG
# unit tests for the foo-lang semantic model
import unittest
from foo_lang.semantic.model import *
from foo_lang.semantic.domains.nodes import Nodes, AllNodes, OwnNode
from foo_lang.semantic.dumper import Dumper
dumper = Dumper()
def dump(model):
return model.accept(d... |
PHP | UTF-8 | 318 | 2.53125 | 3 | [] | no_license | <?php
namespace Migrations;
use Codeframe\Schema;
class CreateRoles {
public function run() {
Schema::dropIfExists('roles');
Schema::create('roles', function($table) {
$table->increments('id');
$table->string('name');
$table->timestamps();
});
}
} |
Python | UTF-8 | 616 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python3
"""
Uses SQLAlchemy to print state objects
"""
from sys import argv
from model_state import Base, State
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
if __name__ == "__main__":
Session = sessionmaker()
engine = create_engine('mysql+mysqldb://{}:{}@localhost/{}... |
Swift | UTF-8 | 1,582 | 2.9375 | 3 | [] | no_license | //
// CatalogVC+TableViewDataSource.swift
// Testflix
//
// Created by Victor Valfre on 14/04/19.
// Copyright © 2019 Victor Valfre. All rights reserved.
//
import Foundation
import UIKit
//Extensao responsavel pela Tabela da tela Inicial
extension CatalogViewController {
override func numberOfSections(i... |
Java | UTF-8 | 14,184 | 1.648438 | 2 | [] | no_license | package hami.mainapp.train.Services.Fragment;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.AppCompatButt... |
JavaScript | UTF-8 | 1,423 | 2.96875 | 3 | [] | no_license | "use strict";
function loadDoc(){
console.log("loadDoc");
console.log(this);
let text_client = new XMLHttpRequest();
text_client.onreadystatechange = () => {
if(text_client.readyState == 4 && text_client.status == 200){
document.getElementById("textarea").innerHTML =
... |
Markdown | UTF-8 | 4,447 | 3.59375 | 4 | [] | no_license | # AndroidLaunchMode
> 我们都知道,开启一个Activity,系统会在任务栈中创建实例,而任务栈是一种“后进先出”的栈结构。默认情况下,开启一个Activity,系统会创建实例,如果多次创建同一个实例,难道还要栈中创建多个相同的实例 ? 当然 是不可以的。由此,Android在设计的时候提供了启动模式来修改系统的默认行为。
* **standard**
```
标准模式,也是系统的默认模式。每次启动一个Act的时候都会创建一个新的实例,系统不管这个实例是否已经存在。
例如:Activity A 启动了Activity B (标准模式),此时在Act A的栈中 就会新建一个Act B 的实例,此时栈中 A... |
PHP | UTF-8 | 2,469 | 3.0625 | 3 | [
"MIT"
] | permissive | <?php
namespace MyProject\Models\Articles;
use MyProject\Exceptions\InvalidArgumentException;
use MyProject\Models\ActiveRecordEntity;
use MyProject\Models\Users\User;
class Article extends ActiveRecordEntity
{
protected $name;
protected $text;
protected $authorId;
protected $createdAt;
pub... |
Python | UTF-8 | 344 | 2.75 | 3 | [] | no_license | from django.http import HttpResponse
def home_page(request):
return HttpResponse("Hello, django!")
def html_response(request):
html = \
"""
<html>
<head>
</head>
<body>
<h1>Hello, django!</h1>
<p>HTML 문서를 응답으로 보내줍니다.</p>
</body>
</html>
"""
return HttpResponse(html) |
Java | UTF-8 | 3,385 | 1.726563 | 2 | [] | no_license | package outdoorapp.utils;
/**
* Interfaccia che contiene tutte le chiavi-valore per far visualizzare le view
*
* @author Andrea Zito
* @author Francesco Ventura
*
*/
public interface Views {
public static final String VIEW_LOGIN = "VIEW_LOGIN";
public static final String VIEW_DASHBOARD_WELCOME = "VIEW_DASHBO... |
Java | UTF-8 | 1,261 | 2.484375 | 2 | [] | no_license | package usu.cs.Sensys.Messages;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.SignatureException;
import usu.cs.Sensys.util.PublicKeyManager;
public class MessageRequest... |
Markdown | UTF-8 | 16,987 | 3.5625 | 4 | [] | no_license | ## synchronized概述
Synchronized是Java中解决并发问题的一种最常用的方法,也是最简单的一种方法。
Synchronized主要有三个作用:
(1)确保线程互斥的访问同步代码。
(2)保证共享变量的修改能够及时可见。
(3)有效解决重排序问题。
## synchronized使用场景
### 普通同步方法,锁是当前实例对象
```java
public class SynchronizedTest {
public synchronized void method1() {
System.out.println("Method 1 start");
t... |
Ruby | UTF-8 | 213 | 2.71875 | 3 | [] | no_license | #Looked at your solution(ashamedly).
result = {}
letters = ('A'..'Z').to_a.concat( ('a'..'z').to_a )
letters.each do |letter|
count = statement.scan(letter.to_s).count
result[letter] = count if count > 0
end |
TypeScript | UTF-8 | 1,511 | 3.09375 | 3 | [] | no_license | import { AxiosError, AxiosResponse } from 'axios';
export function handleResponse(response: {
text: () => Promise<any>;
ok: boolean;
statusText: string;
}) {
// The `response` object has `text()` method which is also a Promise.
return response.text().then(text => {
const data = text && JSON.parse(text);
... |
Markdown | UTF-8 | 4,452 | 2.921875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | ---
layout: post
date: 2020-07-03 13:43:35 -0600
title: Independence Day Fun With JavaScript
permalink: independence_day_fun_with_javascript
---
If you live in the USA, Happy Independence Day! I've been busy this week doing family stuff, so I honestly haven't touched the COVIDiary project. We'll hopefully get back int... |
Python | UTF-8 | 2,491 | 2.6875 | 3 | [] | no_license | # coding:utf-8
import torch
import shutil
import numpy as np
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0
def reset(self):
self.val = 0
self.avg... |
C++ | UTF-8 | 2,855 | 2.9375 | 3 | [] | no_license |
// Print Anagrams Together....
// Using A trie..
#include<iostream>
#include<cstdio>
#include<ctime>
#include<cstring>
#include<unistd.h>
#include<algorithm>
#include<stack>
#include<deque>
#include<vector>
using namespace std;
void swap(int &a,int &b)
{
int temp;
temp=a;
a=b;
b... |
PHP | UTF-8 | 2,432 | 3.078125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"GPL-3.0-or-later",
"LGPL-2.0-or-later",
"LGPL-2.1-or-later",
"GPL-3.0-only",
"GPL-1.0-or-later",
"MIT"
] | permissive | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\DataTable\Filter;
use Piwik\DataTable;
use Piwik\DataTable\BaseFilter;
/**
* Deletes all rows for which a callback returns true.
*
* **Basic us... |
Python | UTF-8 | 444 | 2.640625 | 3 | [] | no_license | from functions import gapCount
import numpy as np
def test_sequence():
data = np.zeros((526,1))
i = 0
with open('fastaOutput.txt') as file:
for line in file.readlines():
for num in line.split():
data[i] = int(num)
i += 1
outputRef = np.zeros((526, 1)... |
Java | UTF-8 | 1,727 | 2.25 | 2 | [] | no_license | package com.xc.service.InitServiceFactory;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.SimpleBeanDefinition... |
Java | UTF-8 | 13,291 | 2.25 | 2 | [] | no_license | package com.libra.cloud.poetry.webmagic;
import com.libra.cloud.poetry.entity.Detail;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.util.List;
public class PoetryDetailProcessor {
... |
Java | UTF-8 | 579 | 2.953125 | 3 | [] | no_license | /**
* Simulates the effect of executing the given basic block. This modifies the passed-in frame to represent the end result.
* @param bb {@code non-null;} the basic block
* @param frame {@code non-null;} frame to operate on
*/
public void simulate(ByteBlock bb,Frame frame){
int end=bb.getEnd();
visitor.setFra... |
Java | UTF-8 | 813 | 2.96875 | 3 | [] | no_license | package hackerrank.mkh.samsung;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;
public class Cryptogenerator {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while(true) {
String num = scan.nextLine();
if(num == null) break;
String ... |
Python | UTF-8 | 463 | 3.578125 | 4 | [] | no_license | def main():
corrida = int(input('Quantas corridas voce fez hoje:'))
qto = 0
for i in range(0, corrida):
valor = int(input('qual o valor da corrida?:'))
qto += valor
valor_aplicativo = qto / 4
valor_motorista = qto - valor_aplicativo
print('valor total é igual {}'.format(... |
Rust | UTF-8 | 11,394 | 3.140625 | 3 | [
"MIT"
] | permissive | #![allow(dead_code)]
//! A 3dsMax / Blender style camera that orbits about a target position
use vecmath::{ Vector3, vec3_add, vec3_scale };
use vecmath::traits::Float;
use quaternion;
use quaternion::Quaternion;
use input::{ GenericEvent, Key, MouseButton };
use input::Button::{ Keyboard, Mouse };
use Camera;
bi... |
Markdown | UTF-8 | 4,882 | 3.96875 | 4 | [] | no_license | ---
layout: post
categories: Java
title: 教你 Java 编程中五个奇技淫巧
tagline: by 子悠
tags:
- 子悠
---
枯燥的编程中总得有些乐趣,今天我们不谈论那些高深的技能,教你几个在编程中的奇技淫巧,说不定在某些时候还能炫耀一番呢。
<!--more-->
### 1、找到最大值和最小值
不使用 `if` `else` `switch` 和三元运算符,在给定的三元组中找到最大值和最小值:比如给定 3,14,8,在不使用 `if` `else` `switch` 和三元运算符的情况下找到最大值和最小值。
话不多说,我们先看代码
```java
public... |
C++ | ISO-8859-1 | 1,416 | 2.828125 | 3 | [] | no_license | #include <stdio.h>
#include "C:\Projetos\MyClassTeste\MyClassTeste\stdafx.h"
#include "C:\Projetos\MyClassTeste\MyClassTeste\header.h"
#include "C:\Projetos\MyClassTeste\MyClassTeste\body.cpp"
#include "dll_function.h"
extern "C"
{
_declspec(dllexport) void DisplayHelloFromDLL() {
printf("Hello from DLL !\n");
i... |
SQL | UTF-8 | 2,788 | 3.640625 | 4 | [] | no_license |
CREATE TABLE winds (
id_wind int(11) NOT NULL AUTO_INCREMENT,
speed int(11) DEFAULT NULL,
direction int(11) DEFAULT NULL,
PRIMARY KEY (id_wind)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8;
CREATE TABLE atmospheres (
id_atmosphere int(11) NOT NULL AUTO_INCREMENT,
humidity int(11) DEF... |
PHP | UTF-8 | 4,121 | 2.734375 | 3 | [] | no_license | <?php
use Ackintosh\Higher\Table\Record;
use Ackintosh\Higher\Table;
class RecordTest extends PHPUnit_Framework_TestCase
{
/**
* @test
*/
public function constructorSetsProperty()
{
$table = new Table();
$record = new Record($table);
$this->assertSame($table, TestHelper::g... |
C | UTF-8 | 2,602 | 2.6875 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* color_fun.c :+: :+: :+: ... |
Java | UTF-8 | 533 | 1.71875 | 2 | [] | no_license | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.google.android.gms.games.leaderboard;
import android.os.Bundle;
public final class b
{
private final Bundle nw;
public b(... |
C++ | UTF-8 | 1,792 | 4.125 | 4 | [] | no_license | /*
给定一棵二叉搜索树,请找出其中的第k小的结点。例如,(5,3,7,2,4,6,8)中,
按结点数值大小顺序第三小结点的值为4。
*/
#include <iostream>
#include <stack>
using namespace std;
struct TreeNode{
int val;
struct TreeNode* left;
struct TreeNode* right;
TreeNode(int x=0) : val(x), left(NULL), right(NULL){}
};
int count = 0;
TreeNode* K... |
Go | UTF-8 | 1,160 | 3.15625 | 3 | [
"MIT"
] | permissive | package config
import (
"fmt"
"net"
"strconv"
)
type TypeHostPort struct {
Value string
Host string
Port uint
}
func (t *TypeHostPort) Set(value string) error {
host, port, err := net.SplitHostPort(value)
if err != nil {
return fmt.Errorf("incorrect host:port value (%v): %w", value, err)
}
portValue, ... |
Markdown | UTF-8 | 1,902 | 3.359375 | 3 | [
"Apache-2.0"
] | permissive | ## print_to_logging
[](https://asciinema.org/a/mSw4uEVJrvxoKW6so3b5RPjAj)
This is an interactive tool for refactoring Python code.
The mission is to replace `print` statements with calls to `logging` instead.
`print_to_logging` features:
- it will as... |
TypeScript | UTF-8 | 918 | 2.65625 | 3 | [
"MIT"
] | permissive | import { REQUEST_DRIVER_TYPE } from './request-driver-type';
import { RequestDriver } from './request-driver';
import { NodeRequestDriver } from './node-request-driver';
import { buildMockRequestDriver } from './mock-request-driver';
import { BrowserRequestDriver } from './browser-request-driver';
import { RequestError... |
Python | UTF-8 | 1,541 | 2.765625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import logging
logging.basicConfig()
logger = logging.getLogger('pageparser')
class Parser:
def __init__(self, resource_config, page):
self.config = resource_config
self.page = page
def parse(self):
soup = BeautifulSoup(self.page, "lxml")
el... |
C++ | UTF-8 | 2,797 | 2.75 | 3 | [
"MIT"
] | permissive | ///////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2006-2009, Universidad de Alcala //
// //
// See accompanying LICENSE.TXT ... |
Java | ISO-8859-1 | 10,899 | 2.90625 | 3 | [] | no_license | /**
* Auteurs : Franois Mathieu et Soti
* Fichier : PrincipalTp5.java
* Cours : 420-165-MO (TP5, Bibliothque)
* Date : 6 mai 2015
*/
// Packages du systme.
import java.io.*;
import java.nio.file.*;
import java.util.*;
// Package du programmeur.
import outilsjava.*;
/**
* La classe PrincipalTp5 permet de g... |
C++ | UTF-8 | 8,208 | 3.734375 | 4 | [] | no_license | /*==========================================================*\
| 伸展树(splay tree)
| 区间操作:
| (1)对一段区间都增加一个值value
| (2)翻转一个区间
| (3)对一个区间向右移动k步(转化成交换两个相邻的区间)
| (4)插入一段区间
| (5)删除一段区间
| (6)返回一段区间的最小值
\*==========================================================*/
#include <iostream>
#include <stdio.h>
#include <string.h... |
Python | UTF-8 | 2,860 | 3.4375 | 3 | [] | no_license | import pygame
import random
pygame.init()
width = 1000
height = 500
screen = pygame.display.set_mode((width,height))
white = 255,255,255
red = 255,0,0
black = 0,0,0
img = pygame.image.load("0.png")
imgWidth = img.get_width()
imgHeight = img.get_height()
imgX = random.randint(0, width - imgWidth)
imgY... |
PHP | UTF-8 | 2,679 | 2.6875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | <?php require_once("../includes/session.php"); ?>
<?php require_once("../includes/db_connection.php"); ?>
<?php require_once("../includes/functions.php"); ?>
<?php require_once("../includes/validation_functions.php"); ?>
<!--doctor access only-->
<?php confirm_logged_in(); ?>
<?php
if (isset($_POST['submit'])) {
... |
C | UTF-8 | 615 | 3.46875 | 3 | [] | no_license | #include <stdlib.h>
#include "symbol.h"
symbol * symbol_new_char(int frequency, char c) {
symbol * new_symbol = malloc(sizeof(symbol));
new_symbol->data.c = c;
new_symbol->frequency = frequency;
new_symbol->is_leaf = true;
return new_symbol;
}
symbol * symbol_new_children(int frequency, symbol * left, sym... |
C# | UTF-8 | 3,231 | 2.515625 | 3 | [] | no_license | using CritiquesShelfBLL.RepositoryInterfaces;
using CritiquesShelfBLL.Entities;
using Microsoft.EntityFrameworkCore;
using System.Linq;
using CritiquesShelfBLL.Utility;
using System;
using CritiquesShelfBLL.ViewModels;
using CritiquesShelfBLL.Mapper;
using System.Collections.Generic;
namespace CritiquesShelfBLL.Manag... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.