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 | 1,957 | 4.375 | 4 | [] | no_license | """
Given a string check if it can be constructed by taking a substring of it and appending multiple copies of the substring
together. You may assume the given string consists of lowercase English letters only and its length will not exceed 10000.
Example 1:
Input: "abab"
Output: True
Explanation: It's the substring ... |
C++ | UTF-8 | 3,045 | 2.8125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"MIT"
] | permissive | // MemPool.h
// Created by Robin Rowe on 12/2/2015
// Copyright (c) 2015 Robin.Rowe@CinePaint.org
#ifndef AtomicMemPool_h
#define AtomicMemPool_h
#include <memory>
#include <atomic>
#include <mutex>
namespace Atomic
{
// Usage: HiddenMemPool intended for internal use
class HiddenMemPool
{ std::unique_ptr<char[]> d... |
C++ | UTF-8 | 1,350 | 2.71875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define WHITE 0
#define BLACK 2
#define GREY 1
#define MAX 100000
void dfs(int s);
void reset();
vector <int> graph[10000];
int n,m,t=0,d[200],f[200],vis[200],task[200];
int main()
{
//freopen("Ordering-Task.txt","r",stdin);
int i,j,x,y;
n=200;
w... |
JavaScript | UTF-8 | 787 | 3.109375 | 3 | [] | no_license | var fn1 = function(){
return async function(next){
console.log('go1');
await next();
console.log('back1');
}
}
var fn2 = function(){
return async function(next){
console.log('go2');
await next();
console.log('back2');
}
}
var fn3 = function(){
return async function(next){
console.l... |
Python | UTF-8 | 417 | 4.1875 | 4 | [] | no_license | #functions:
def gcd(x,y):
if (x==y):
ans=x
else:
if(x>y):
ans=gcd((x-y),y)
else:
ans=gcd(x,(y-x))
return ans
#code:
print("I will give you the Greatest Common Divisor of two int. numbers")
a=int(input("give me the first number: "))
b=int(input("give me the sec... |
SQL | ISO-8859-9 | 303 | 3.46875 | 3 | [] | no_license | --4. 01.02.2007 - 05.03.2014 tarihleri arasnda hangi rnden ka adet sipari edildiini bulan SQL kodunu yaznz.
use Dukkan
select u.urunKod, u.urunAd, sd.adet, s.siparisTarih
from tblUrun u,tblSiparisDetay sd, tblSiparis s
where s.siparisTarih between '2007-02-01' and '2014-03-05'
|
PHP | UTF-8 | 1,285 | 3.4375 | 3 | [] | no_license | <?php
$str1 = 'aabbaa';
$str2 = 'race a car';
function checkpalimdronie($str){
$str2 = (strrev(preg_replace("/[^A-Za-z0-9]/", '', str_replace(' ', '', strtolower($str)))));
return ($str2 == $str) ? TRUE : FALSE;
}
echo'<pre>';var_dump( (checkpalimdronie($str1)) );echo'</pre>';
$arrValues = [1, 1, 2, 2, 3, 4, 4, 5, ... |
Java | UTF-8 | 1,018 | 2.8125 | 3 | [] | no_license | package com.astontech.bo;
import java.time.LocalDate;
import java.util.Date;
public class Vehicle extends BaseBO{
//Params
private int VehicleId;
private VehicleModel Model;
private LocalDate Year;
private String VIN;
//Constructors
public Vehicle() {}
public Vehicle(LocalDate year, S... |
JavaScript | UTF-8 | 3,213 | 2.578125 | 3 | [] | no_license | import React from 'react'
import Post from './component/Post'
import './scss/App.scss'
import Input from '@material-ui/core/Input'
import Button from '@material-ui/core/Button'
import { filtersPosts } from './shared/utils'
import * as _ from 'lodash'
function App() {
const [ data, setData ] = React.useState([])
cons... |
C | UTF-8 | 1,166 | 3.3125 | 3 | [] | no_license | #include "case.h"
int main(int argc, char* argv[])
{
case1();
case2();
case3();
case4();
case5();
case6();
case7();
case8();
case9();
case10();
return 0;
}
void case1()
{
int i = add(1, 2);
}
int __fastcall add(int i, int j)
{
return i + j;
}
void case2()
{
int i = 1;
int a[4];
a[0] = 6;
a[1] = 7... |
JavaScript | UTF-8 | 2,569 | 2.65625 | 3 | [] | no_license | const Course = require('../models/Course');
const { mongooseToObject } = require('../../utils/mongoose');
class CourseController {
// [GET] /courses/:slug
show(req, res, next) {
const slug = req.params.slug;
Course.findOne({ slug: slug })
.then((course) => res.render('courses/show', { course: mongoo... |
Markdown | UTF-8 | 1,522 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | ---
layout: post
title: "开发者可通过 Google Analytics 来跟踪自己扩展的使用率了"
date: 2010-09-10 07:40
author: Eyon
comments: true
tags: [Chrome, Chrome扩展, Chrome新闻, Chromium]
---
Google 的软件工程师 Qian Huang(中国人?)今天在 Chromium 官方博客上[宣布](http://blog.chromium.org/2010/09/get-more-data-about-your-extensions.html) Chrome 扩展开发者可以使用 Goog... |
Java | UTF-8 | 202 | 2 | 2 | [] | no_license | package com.hoolai.Service;
public class TestService {
public static int num = 1;
public static int getNum() {
return num;
}
public static void setNum(int num) {
TestService.num = num;
}
}
|
TypeScript | UTF-8 | 2,309 | 3.296875 | 3 | [] | no_license |
/**
* Get the user logged from the local storage
*/
export function getUserLogged() {
return JSON.parse(localStorage.getItem('userLogged') || 'null');
}
/**
* Remove the user logged from the local storage
*/
export function removeUserLogged() {
localStorage.removeItem('userLogged');
}
/**
* Set the user lo... |
C | UTF-8 | 261 | 2.96875 | 3 | [] | no_license | //hashing function for use in assignment
int hashName(char *string)
{
int i = 0;
int value = 0;
while(*(string + i) != '\0')
{
value = value + *(string + i) - 64;
i = i + 1;
}
return value % 1000000;
}
int hashID(int id)
{
return id % 1000000;
}
|
C++ | UTF-8 | 1,362 | 3.046875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
vector<vector<int>> dir ={{-2,1} , {-1,2} , {1,2} , {2,1} , {2,-1}, {1,-2} , {-1,-2} ,{-2,-1}};
// bool isValid(int x, int y, vector<vector<int>> ans)
// { //cout<<"a"<<isVisited[0].size();
// //cout<<"b"<<isVisited.size();
// if( x >= 0 && y >= 0 && x < ans.... |
JavaScript | UTF-8 | 221 | 2.859375 | 3 | [] | no_license | function firstDuplicate(a) {
let obj = {}
let duplicate = -1;
for (let num of a) {
obj[num] = (obj[num]|| 0) + 1;
duplicate = obj[num] > 1 && duplicate < 0 ? num : duplicate;
}
return duplicate;
} |
Java | UTF-8 | 476 | 3.046875 | 3 | [] | no_license | package com.umbertoloria.integrates;
import com.umbertoloria.bitting.Bit;
import com.umbertoloria.interfaces.Clockable;
public class AND implements Clockable {
private Bit[] in;
private Bit out;
public AND(int size) {
in = new Bit[size];
}
public void set(int index, Bit val) {
in[index] = val;
}
public... |
PHP | UTF-8 | 1,277 | 2.6875 | 3 | [] | no_license | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
function stringShort($title,$limitLengthTitle){
$length_title=strlen($title);
if($length_title>$limitLengthTitle)
{ $title_new=array();
unset($title_new);
$title_new=$title;
$title_new = explode(" ", $title_new);
... |
Python | UTF-8 | 882 | 3.75 | 4 | [] | no_license | #! /usr/bin/env python
# -*- coding:utf-8 -*-
# @Time : 2017/6/17 22:46
# @Author : xiongyaokun
# @Site :
# @File : practice36.py
# @Software: PyCharm
# 'and' example
print "'and'example:"
print "False and 12 is:", False and 12
# 'del' example, 'del'只是删除引用,
if __name__ == "__main__":
a = 1
b = a
... |
C# | UTF-8 | 1,069 | 2.890625 | 3 | [] | no_license | using Microsoft.AspNetCore.Http;
using System;
using System.Threading.Tasks;
namespace MyWebsite.Middlewares
{
public class FirstMiddleware
{
private readonly RequestDelegate _next;
public FirstMiddleware(RequestDelegate next)
{
_next = next;
}
public asyn... |
Markdown | UTF-8 | 6,285 | 3.4375 | 3 | [] | no_license | # day_1
1. 引擎: 负责整个js程序的编译和执行过程
2. 编译器: 负责语法分析和代码生成
3. 作用域: 负责收集并维护由所有声明的标识符(变量)组成的一系列查询,并且实施一套非常严格的规则,确定当前执行的代码对这些标志符有访问权限。
分析:`var a = 1;`
- 声明a: 当前作用域是否有a,如果有,跳过声明,如果没有声明a
- 给a赋值: 从作用域查找是否有a,如果有,给a赋值,如果没有继续查找
## LHS,RHS
当变量出现在赋值操作的左侧时进行LHS查询,出现在右侧时进行RHS查询。
**RHS: 查找某个变量的值, 谁是赋值操作的源头**
**LHS: 找到变量的容器, 赋值操作的目标是谁**
LH... |
Java | UTF-8 | 321 | 1.773438 | 2 | [] | no_license | package com.defysope.service;
import java.util.List;
import java.util.Map;
import com.defysope.model.DeliveryMethod;
public interface DeliveryMethodSettingsManager {
List<Map<String, Object>> getDelivery();
DeliveryMethod saveMethod(DeliveryMethod delivery);
void removeDelivery(int id);
}
... |
Markdown | UTF-8 | 4,061 | 3.75 | 4 | [] | no_license | # 필드 이름 바꾸기
> 이름은 중요하다. 그리고 프로그램 곳곳에서 쓰이는 레코드 구조체의 필드 이름들은 특히 더 중요하다. 프로그램을 이해하는데 큰 역할을 한다.
> 데이터 구조가 중요한 만큼 반드시 깔끔하게 관리해야 한다. 다른요소와 마찬가지로 개발을 진행할수록 데이터를 더 잘이해하게 된다. 따라서 그 깊어진 이해를 프로그램에 반드시 반영해야 한다.
ex:)
```js
class Organization {
get name() {...}
}
//Refactoring
class Organization {
get title() {...}
}
``... |
Java | UTF-8 | 271 | 1.84375 | 2 | [] | no_license | package com.htc.day3;
public class EmployeeTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
Employee ram = new Employee();
// ram.readInputs();
ram.display();
// ram.tryThis(); wont work
}
}
|
Java | UTF-8 | 1,109 | 2.4375 | 2 | [
"Apache-2.0"
] | permissive | /*
* Taken from https://bitbucket.org/atlassian/jira-testkit
* which is licenced under Apache 2.0
*/
package com.corefiling.jira.plugins.workflowdata;
public class CacheControl
{
private static final int ONE_YEAR = 60 * 60 * 24 * 365;
/**
* Returns a CacheControl with noStore and noCache set to true.
... |
Python | UTF-8 | 677 | 3.40625 | 3 | [] | no_license | import sqlite3
conn = sqlite3.connect("sqlite3-python/my_friends.db")
"""
to check if connection is working do: sqlite3 my_friends.db
check: .tables
check. schema + table_name
the db most already be creat inorder for code to run; first run learning_to_insert.py
"""
# create cursor object
c = conn.cursor()
p... |
C# | UTF-8 | 4,533 | 3.078125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HumaneSocietyApp
{
class HumaneSociety
{
public double money;
Kennel kennel;
Adopter adopter;
public Adopter nina = new Adopter();
public Human... |
Python | UTF-8 | 498 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
def sketch(image):
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# gray_blur = cv2.GaussianBlur(gray, (3,3), 0)
edges = cv2.Canny(gray, 100, 200)
ret, thresh1 = cv2.threshold(edges, 20, 255, cv2.THRESH_BINARY_INV)
retur... |
Java | UTF-8 | 3,682 | 1.960938 | 2 | [] | no_license | package org.power_systems_modelica.psm.dd;
/*
* #%L
* Dynamic Data
* %%
* Copyright (C) 2017 - 2018 RTE (http://rte-france.com)
* %%
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://m... |
Java | UTF-8 | 7,065 | 1.96875 | 2 | [] | no_license | package com.example.patricia.matrix.Notifications;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.media.Ringtone;
import android.media.Rington... |
Markdown | UTF-8 | 1,080 | 2.6875 | 3 | [] | no_license | # Isometric-GPU-Voxel-Raytracer

A parking lot looking building rendered from my engine.
[Video demo with voxel selection via raycasting the mouse](https://youtu.be/5lf5ftyHCI8)

Simple noise. Algorithm found from [scratchapixel](https://scratchapixel.com);
Us... |
JavaScript | UTF-8 | 4,270 | 2.625 | 3 | [] | no_license | const SouthAfricanIdNumberValidation = require("../lib/southafricanidnumbervalidation.js");
const assertions = require("../lib/assertions.js");
module.exports = {
when_asking_a_south_african_client_for_their_id_number_given_on_site_and_it_is_thirteen_digits_it_should_pass: () =>{
//arrange
let idN... |
Java | UTF-8 | 1,051 | 4.0625 | 4 | [] | no_license | /**
* LeetCode
* Problem_04.java
*/
package com.deepak.leetcode.Arrays;
/**
* <br> Problem Statement :
*
* Given a non-empty integer array of size n, find the minimum number of moves
* required to make all array elements equal, where a move is incrementing n - 1 elements by 1.
*
* Example:
* Input: [1,2,3... |
JavaScript | UTF-8 | 3,096 | 2.59375 | 3 | [] | no_license | var lands=[];
var buleMap={};
var money=10000;
var wood=1000;
var v_wood=$("#wood");
updateWoodView(wood);
function updateWoodView(amount){
v_wood.html("wood:"+amount);
}
var v_money=$("#money");
updateMoneyView(money);
function updateMoneyView(amount){
v_money.html("money:"+amount);
}
function isE... |
Java | UTF-8 | 2,210 | 2.234375 | 2 | [
"MIT"
] | permissive | package springfive.cms.domain.resources;
import java.util.Arrays;
import java.util.List;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.spring... |
Ruby | UTF-8 | 234 | 3.515625 | 4 | [] | no_license | total_letter_array = ('a' .. 'z').to_a
vowel_array = ['a','e','i','o','u','y']
vowel_hash = {}
total_letter_array.each_with_index do |value, index|
vowel_hash[value] = index + 1 if vowel_array.include?(value)
end
puts vowel_hash
|
C++ | UTF-8 | 8,708 | 3.109375 | 3 | [
"MIT"
] | permissive | /****************************************************************
memoizer.h
Template library for generic "memoization"/caching structures.
Created by Mark A. Caprio, 2/23/11.
- 6/9/17 (mac): Move into namespace mcutils.
****************************************************************/
#ifndef MCUTILS_MEMO... |
Python | UTF-8 | 611 | 3.671875 | 4 | [] | no_license | """
Decorator Recipe #1: Easy Event Binding (version 1)
"""
from Tkinter import *
class MyButton(Button):
def command(self, func):
self['command'] = func
return func
if __name__ == '__main__':
frame = Frame()
frame.master.title("Event binding with de... |
C# | UTF-8 | 515 | 2.71875 | 3 | [] | no_license | using System;
namespace Rivet.Broker.Impl
{
public class WaitForSpecificMessage : IConversation
{
public WaitForSpecificMessage(Type type)
{
_type = type;
_complete = false;
}
private bool _complete;
private Type _type;
public void Peek... |
Java | UTF-8 | 3,159 | 2.328125 | 2 | [] | no_license | package tw.iii.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.springframework.stereotype.Component;
@... |
SQL | ISO-8859-1 | 13,435 | 3.0625 | 3 | [] | no_license | --------------------------------------------------------
-- DDL for Package Body PAC_IAX_MARCAS
--------------------------------------------------------
CREATE OR REPLACE EDITIONABLE PACKAGE BODY "AXIS"."PAC_IAX_MARCAS" AS
/******************************************************************************
NOM... |
Java | UTF-8 | 825 | 2.453125 | 2 | [
"MIT"
] | permissive | package link.infra.jdwp;
public class TypeSizeManager {
// Default to long (8 bytes)
private int fieldID = 8;
private int methodID = 8;
private int objectID = 8;
private int referenceTypeID = 8;
private int frameID = 8;
public synchronized void setSizes(int fieldID, int methodID, int objectID, int referenceTyp... |
Java | UTF-8 | 5,306 | 2.5 | 2 | [] | no_license | package com.zipcodewilmington.froilansfarm.storage;
import com.zipcodewilmington.froilansfarm.mammal.Chicken;
import com.zipcodewilmington.froilansfarm.mammal.Horse;
import com.zipcodewilmington.froilansfarm.mammal.Person;
import com.zipcodewilmington.froilansfarm.crop.CornStalk;
import com.zipcodewilmington.froilansf... |
Markdown | UTF-8 | 3,529 | 3.328125 | 3 | [
"MIT"
] | permissive | ## Arduino Computer Vision Finger Counter
By using serial communication it's possible to combine the power of a pc with a low cost Arduino micro-controller. This opens up a world of possibilities to experiment with building your own Ai powered devices and robotics products.
This project demonstrates how to send data ... |
Markdown | UTF-8 | 577 | 2.609375 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | # How to run your first project
## Steps
1. Upload your source dataset (raw) to AzureML Datasets
2. Upload your dependencies to AzureML Datasets (stopwords, custom ner)
3. Customize custom.py with any required pre-processing steps
4. Create a *.config.json where * = project name
5. Run deploy/training.py
6. Run deploy... |
Java | UTF-8 | 1,062 | 3.859375 | 4 | [] | no_license | package com.note.design_patterns.creational;
/**
* @Classname SimpleFactory
* @Date 2019-09-16 13:59
* @Created by chenpan
* @Description 简单工厂模式
*/
public class SimpleFactory {
enum Type {
A, B
}
public AB create(Type type) {
switch (type) {
case A:
return ... |
Java | UTF-8 | 7,381 | 1.703125 | 2 | [] | no_license | /*
* 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 may ... |
Markdown | UTF-8 | 5,568 | 2.625 | 3 | [] | no_license | ---
title: The Next Step
author: Justin Lascek
type: post
date: 2013-01-10T16:04:37+00:00
url: /blog/2013/01/the-next-step/
categories:
- Programming
---
Last Friday you were tasked with pulling your balls out from between your legs and committing to a competition. The day you sign up will be one of the greatest day... |
Java | UTF-8 | 1,579 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | package BULMADependences;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
public class GenerateShapes {
private static final String FILE_SEPARATOR = ",";
public static void main(Stri... |
Markdown | UTF-8 | 947 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | ---
title: "Lesson 8: Overview"
module: "dagster_essentials"
lesson: "8"
---
# Overview
In the previous lesson, you learned about schedules and running your pipelines regularly. Going back to the cookie analogy, imagine that your cookie business is blossoming, and you’ve started taking orders in advance. Making every... |
Java | UTF-8 | 2,430 | 2.265625 | 2 | [
"BSD-3-Clause"
] | permissive | package dyvil.tools.compiler.ast.access;
import dyvil.reflect.Opcodes;
import dyvil.tools.compiler.ast.classes.IClass;
import dyvil.tools.compiler.ast.context.IContext;
import dyvil.tools.compiler.ast.expression.IValue;
import dyvil.tools.compiler.ast.generic.ITypeContext;
import dyvil.tools.compiler.ast.member.Name;
... |
Markdown | UTF-8 | 972 | 2.671875 | 3 | [] | no_license | ---
title: 存到多少錢才敢退休?學習投資理財才是退休無慮之道
date: '2017-10-05 00:00:00'
layout: page
categories: finance
---
「 存到多少才敢退休?」這個問題幾乎可說是所有投資理財行為的最終目標。學習錢滾錢就是為了當自己沒有薪資收入時,能拿出之前省吃儉用加上投資獲利所得的儲蓄,讓生活過著和退休之前同樣水平的日子。
依照近年來的幾項調查指出,台灣人民普遍認為存到1,000萬至1,500萬,才讓自己的退休生活游刃有餘,這數字說高不高,說低也不算低,但國人最常使用的理財商品是以儲蓄險為主的保險工具,以目前預定利率在歷史低點徘徊的情況來看,若在退休金累積階段就將... |
PHP | UTF-8 | 3,511 | 2.65625 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | <?php
namespace lav45\behaviors\traits;
use yii\helpers\ArrayHelper;
/**
* Trait WatchAttributesTrait
* @package lav45\behaviors\traits
*/
trait WatchAttributesTrait
{
/**
* @var array
* [
* [
* - watch: string|array|true => watch for changes in a few fields,
* - f... |
JavaScript | UTF-8 | 8,846 | 2.671875 | 3 | [] | no_license | (function(){
function onload (moment) {
(function(){
moment.lang('en', {
longDateFormat : {
LT : "h:mma",
L : "MM/DD/YYYY",
LL : "MM/DD",
LLL : "MMMM D, LT",
LLLL : "MMMM D YYYY, LT"
}
});
})();
(function(){
// moment.js language configuration
// language : spanish (e... |
PHP | UTF-8 | 1,754 | 2.96875 | 3 | [
"MIT"
] | permissive | <?php
namespace Boscho87\ChangelogChecker\Checkers;
use Boscho87\ChangelogChecker\Options\Option;
/**
* Class DefaultChecker
*/
class DefaultChecker extends AbstractChecker
{
public function __construct()
{
$options = new Option(true, false, true, []);
parent::__construct($options);
}
... |
Markdown | UTF-8 | 2,886 | 2.703125 | 3 | [
"MIT"
] | permissive | # [REST2MERN-Book-API-Refactor](https://github.com/SmithBWare89/MERN-Book-API-Refactor) -- [Deployed](https://rest2mern-movieapi-refactor.herokuapp.com/)
## Description
This project is intended to be a demonstration of a MERN (Mongo, Express, REACT, and Node) application. I've taken the source code provided for the pr... |
Markdown | UTF-8 | 3,949 | 3.359375 | 3 | [] | no_license | ## 什麼是 Ajax?
#### 前情提要
網頁能夠動態的產生資料給使用者看,是瀏覽器在 client 端與 server 端之間不停地交換資訊訊所造就的成果。透過使用者在網頁上觸發了某種事件(例如點擊按鈕),透過瀏覽器發送 Request 到 server,server 收到後再回傳 Response 給瀏覽器,瀏覽器再根據收到東西重新渲染(render)出使用者看到的頁面。
早期的網頁,還沒發展出非同步的方式,要傳送資料給 server,通常是用 `<form>` 來發送 Request。在這種方式下,每一個跟 Javascript 相關的動作,對於使用者來說,都要等待很久很久才會有回應出現在網頁上。
為了改善這種情況... |
Python | UTF-8 | 1,086 | 3.234375 | 3 | [] | no_license | #AlgoPrak2_Cherinda Maharani
print (" /$$ /$$ /$$ ")
print (" | $$ |__/ | $$ ")
print (" /$$$$$$$| $$$$$$$ /$$$$$$ /$$$$$$ /$$ /$$$$$$$ /$$$$$$$ /$$$$$$ ")
print (" /$$_____/| $$__ $$ /... |
JavaScript | UTF-8 | 1,468 | 3.25 | 3 | [] | no_license | //comments' page script
var input = document.getElementById("userInput");
var firstName = document.getElementById("firstn");
var lastName = document.getElementById("lastn");
var email = document.getElementById("email");
var post = document.getElementById("post");
var ul = document.querySelector(".cmt ul");
var i... |
Markdown | UTF-8 | 1,124 | 2.5625 | 3 | [] | no_license | ---
title: Art Home School - Perspective 1, Week 4
---
<div class="ahs-update">
# Perspective 1, Week 4*
Week of July 25 \
5h 7m of drawing
This week wasn't very productive due to an expected traumatic event that occurred Tuesday evening. Took me most of the week to get back in the groove.
<div class="ahs-pics">
!... |
C++ | UTF-8 | 935 | 3.078125 | 3 | [] | no_license | #include "stdafx.h"
#include "Stats.h"
//Default constructor
FStats::FStats()
{
Strength = 0;
Dexterity = 0;
Wisdom = 0;
Charisma = 0;
}
/*
Constructor with parameters
*/
FStats::FStats(int strength, int dexterity, int wisdom, int charisma)
{
Strength = strength;
Dexterity = dexterity;
Wisdom = wisdom;
Charis... |
Java | UTF-8 | 771 | 2.171875 | 2 | [] | no_license | package mobile.project.dtos;
import java.time.LocalDate;
import java.time.LocalTime;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class CommentDto {
private Integer commentId;
private String content;
private LocalDate postDate;
private Loc... |
C# | UTF-8 | 949 | 2.625 | 3 | [] | no_license | using System;
using CoreApp.Models.Authentication;
using CoreApp.Models.Repositories;
using CoreApp.Repositories;
namespace CoreApp.Services
{
public interface ITokenService
{
TokenModel Get(string Token);
string Create(string UserId);
string Delete(string Token);
}
public class TokenService : ServiceBase, I... |
PHP | UTF-8 | 2,802 | 2.59375 | 3 | [] | no_license | <?php
include("include/appTop.inc.php");
$explodeHeure = explode("-", $_POST['heure'], 2);
$heure = explode("-", substr($explodeHeure[1], 1));
$d = explode("/",$_POST["date"]);
$heure = new DateTime($d[2]."-".$d[1]."-".$d[0]." ".$heure[0].":".$heure[1].":00");
$dateTravail = substr($explodeHeure[0], 1);
// $d[0] == ... |
C++ | UTF-8 | 7,783 | 3.90625 | 4 | [] | no_license | //Coded by Username77177
//C++ Basics in a week challenge
/// Day 1 - Conditions, Cycles, Switch operator(Topic: 2 of 10)
////1
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
bool new_bool; // Новая переменная, которая принимает только два значения: true или false ( П... |
TypeScript | UTF-8 | 3,286 | 2.515625 | 3 | [] | no_license | import { Injectable } from '@angular/core';
import { Crawler } from '../classes/crawler';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import 'rxjs/add/operator/toPromise';
@Injectable()
export class CrawlerService {
private CrawlersUrl = '/queen/crawler';
constructor (private http... |
Python | UTF-8 | 1,188 | 4.3125 | 4 | [] | no_license | # Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:
# 1634 = 1**4 + 6**4 + 3**4 + 4**4
# 8208 = 8**4 + 2**4 + 0**4 + 8**4
# 9474 = 9**4 + 4**4 + 7**4 + 4**4
# As 1 = 1**4 is not a sum it is not included.
# The sum of these numbers is 1634 + 8208 + 9474 = 193... |
PHP | UTF-8 | 1,507 | 2.765625 | 3 | [] | no_license | <?php
require_once 'connect.php';
$id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
$stmt = $pdo->prepare('SELECT * FROM books WHERE id=:id');
$stmt->execute(['id' => $id]);
$book = $stmt->fetch();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="widt... |
Rust | UTF-8 | 8,240 | 2.953125 | 3 | [
"BSD-3-Clause"
] | permissive | use openexr_sys as sys;
use crate::core::error::Error;
type Result<T, E = Error> = std::result::Result<T, E>;
/// A KeyCode object uniquely identifies a motion picture film frame.
/// The following fields specifiy film manufacturer, film type, film
/// roll and the frame's position within the roll.
///
/// # Fields
... |
Python | UTF-8 | 1,646 | 3.109375 | 3 | [] | no_license | import unittest
from main.question22 import my1, book1, my2
class MSTestCase(unittest.TestCase):
def setUp(self):
self.nums = list(range(10))
def test_my1_create_linklist(self):
head = my1.create_linklist(nums=self.nums)
self.assertEqual(self.nums, my1.display_linklist(head))
d... |
C++ | UTF-8 | 457 | 2.5625 | 3 | [] | no_license | #include <LiquidCrystal.h>
int x,i ;
LiquidCrystal lcd(4,5,6,7,8,9);
void setup() {
// put your setup code here, to run once:
lcd.begin(16,2);
lcd.clear();
}
void loop() {
// put your main code here, to run repeatedly:
x = analogRead(A0);
i=x/205;
lcd.setCursor(1, 0);
lcd.print(x);
lcd.setCursor(1, 1... |
Go | UTF-8 | 387 | 2.609375 | 3 | [] | no_license | package utils
import (
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"testing"
)
func TestInitLogger(t *testing.T) {
w := InitLogger()
field := Log.WithField("test", "test")
assert.Equal(t, "test", field.Data["test"])
assert.IsType(t, Log.Formatter, &logrus.JSONFormatter{})
assert.Equal(t,... |
Java | UTF-8 | 5,121 | 2.765625 | 3 | [] | no_license | package my_collection;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
public class Main {
public static void main(String[] args) {... |
Java | UTF-8 | 98 | 1.851563 | 2 | [] | no_license | package Oppgave1;
public class KlasseEn {
public double tall() {
return 2.0;
}
}
|
C# | UTF-8 | 2,519 | 3.140625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.IO;
namespace PhraseSet
{
class Tool
{
public static Stopwatch watch;
public static double basetime = 0;
public static int getTime(... |
Java | UTF-8 | 4,728 | 2.9375 | 3 | [] | no_license | package com.sps.game.sprites;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector2;
import com.sps.game.animation.NpcAnimation;
import com.sps.game.maps.MapFactory;
import java.util.ArrayList;
import java.util.Random;
/**
* This class creates the Interactive NPC
* @author Miraj Sh... |
Java | UTF-8 | 1,176 | 1.710938 | 2 | [] | no_license | package com.jf.dao;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import com.jf.entity.CombineOrderExtendExt;
import com.jf.entity.CombineOrderExtendExtExample;
@Repository
public interface CombineOrderExtendExtMapper {
// ----------------... |
Java | UTF-8 | 20,732 | 2.546875 | 3 | [] | no_license | package com.googlecode.n_orm;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import com.googlecode.n_orm.PropertyManagement.PropertyFamily;
import com.googlecode.n_orm.cf.ColumnFamily;
import com.googlecode.n_orm.consoleannotatio... |
PHP | UTF-8 | 2,468 | 3.109375 | 3 | [
"MIT"
] | permissive | <?php
/**
* @copyright A. Forster, 2014
* @link http://www.forster.io
**/
declare(strict_types=1);
namespace Acfo\Validation\Form\FormField;
/**
* Number
*
* http://www.w3.org/TR/html-markup/input.number.html
*/
class Number extends FormFieldImpl
{
const STEP_ANY = 'any'; // the value of 'any' on the HTML5... |
C# | UTF-8 | 2,192 | 3.40625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Veterinaria
{
enum EspeciePajaro
{
Canario, Periquito, Agapornis // canario: 0
}
class Pajaro : Animal
{
// Atributos
private EspeciePajaro especi... |
Python | UTF-8 | 82 | 3.015625 | 3 | [] | no_license | words = str(input("Your words: "))
probel = (words.count(' ') + 1)
print(probel)
|
Shell | UTF-8 | 540 | 3.53125 | 4 | [] | no_license | #!/bin/bash
#
# dmine uninstaller for linux.
#
# Remove recursively the install dir.
install_dir="/opt/dmine"
if [[ ! -d $install_dir ]]; then
echo "Error: The install directory '$install_dir' is not found. "\
"Uninstallation failed." 1&>2
fi
rm -rf "/opt/dmine"
# Remove the sym link.
sym_link_path="/us... |
Python | UTF-8 | 15,296 | 3.84375 | 4 | [] | no_license | import tkinter
from tkinter import*
#clase que realiza validaciones de fechas de calendario
#Atributos: mensaje: sirve para guardar algun mensaje de error
class ValidatorTipoDatosCalendario:
#Funcion es_numero
#Entradas: un string
#Salidas: Booleano que determina si string es unicamente numerico
#Proceso: recorre ca... |
C | UTF-8 | 7,695 | 2.875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"LicenseRef-scancode-public-domain",
"CC-BY-3.0",
"X11",
"Zlib"
] | permissive | /*
* one.c
*
* Hey! This was the original file where freeglut development started. Just
* note what I have written here at the time. And see the creation date :)
*
* : This is a wrapper. I still have to figure out
* : how to build shared libraries under *nix :)
*
* Copyright (c) 1999 by Pawel W. Olszta
* Writ... |
C# | UTF-8 | 1,071 | 3.015625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DAL
{
public abstract class SerializationDA : IDataAccess
{
protected readonly string pathForFile;
protected SerializationDA(string nameOfClassToSeria... |
C++ | GB18030 | 3,127 | 3.328125 | 3 | [] | no_license | #ifndef RBTREE_H
#define RBTREE_H
#include"RBNode.h"
#include<vector>
template<typename T> class RBTree {
public:
RBTree();
~RBTree();
bool leftRotate(RBNode *node);
bool rightRotate(RBNode *node);
void RBInsert(const T &key);
void RBInsertFixUp(RBNode *node);
bool isEmpty() const;
private:
RBNode<T> *root;
RB... |
Markdown | UTF-8 | 935 | 3.34375 | 3 | [] | no_license | ### 响应
`frog` 并不像传统的控制器类框架那样,要业务逻辑调用 `res.*`之类的方法来返回结果。
`frog`要求 **handler** 导出一个 `async function`, 如:
```javascript
module.exports = async (Event) => {
let model = EventModel.create(Event);
let saved = await model.save(true);
if (saved === true) {
return model;
}
return error.INTERNAL_ERROR.withMessa... |
Markdown | UTF-8 | 637 | 2.71875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # How to contribute
Thanks for considering to contribute to JSON Patch for PHP. Please follow these guidelines:
- You must follow the PSR-2 coding standard. More info [here](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). With these tweaks:
- Always use spaces.
- Ens... |
Python | UTF-8 | 1,108 | 3.375 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def subtreeWithAllDeepest(self, root: TreeNode) -> TreeNode:
if root is None:
return Non... |
Java | UTF-8 | 859 | 3.65625 | 4 | [
"MIT"
] | permissive | class Example01
{
Example01(){}
public void printDownToUp() {
for (int r=0; r<5; r++)
{
for (int c=0; c<r+1; c++) System.out.printf("*");
System.out.println();
}
}
public void printUptoDown()
{
for (int r=0; r<5; r++)
{
for... |
Python | UTF-8 | 1,103 | 2.953125 | 3 | [] | no_license | #!python3
#!从 www.xkcd.com 连续下载图片
import requests,os,bs4
url='http://xkcd.com'
os.makedirs('xkcd',exist_ok=True)
print('current work directory:')
cwd=os.getcwd()
print(cwd)
while not url.endswith('#'):
#下载网页
print('Downloading page %s...' %url)
res=requests.get(url)
res.raise_for_status()
soup=bs... |
Markdown | UTF-8 | 661 | 3.203125 | 3 | [] | no_license | # Data Types
<img src="../images/DataTypes.png" width="400">
## Nominal Variables
Intrinsic order of the labels:
- Country of birth (Argentina, England, Germany)
- Postcode
- Vehicle make (Citroen, Peugeot, ...)
## Ordinal Variables
Can be meaningfully ordered are called ordinal:
- Student's grade in an exam (A,... |
Java | UTF-8 | 2,082 | 1.960938 | 2 | [] | no_license | package com.lifeSharing.pojo;
public class StoryReply {
private String replyCode;
private String commentsCode;
private String replyToId;
private String replyContext;
private String replierNo;
private String replierName;
private String replyType;
private String toId;
private ... |
JavaScript | UTF-8 | 5,072 | 2.828125 | 3 | [] | no_license | // Invocar modo JavaScript 'strict'
'use strict';
// Cargar las dependencias del módulo
var mongoose = require('mongoose'),
Factura = mongoose.model('Factura'),
Counters = mongoose.model('Counters');
// Crear un nuevo método controller para el manejo de errores
var getErrorMessage = function(err) {
if (err.errors... |
Ruby | UTF-8 | 406 | 3.421875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | # Don't forget! This file needs to be 'required' in its spec file
# See README.md for instructions on how to do this
def fizzbuzz(integer)
if integer/15 == integer/15.0
answer = "FizzBuzz"
else
if integer/3 == integer/3.0
answer = "Fizz"
else
if integer/5 == integer/5.0
... |
C | UTF-8 | 318 | 3.671875 | 4 | [] | no_license | #include <stdio.h>
void main () {
int a, b, c, min, max;
printf ("Enter two numbers\n");
scanf ("%d%d", &a, &b);
max = (a > b) ? a : b;
min = (a < b) ? a : b;
while (min > 0) {
c = min;
min = max % min;
max = c;
}
printf ("HCF of %d and %d is %d\n", a, b, c);
}
|
Java | UTF-8 | 1,329 | 2.859375 | 3 | [] | no_license | package Factory.Products;
import Factory.Food.Food;
import Factory.Ingredients.*;
/**
* Created by FAB3659 on 2017-07-04.
*/
public abstract class Pizza extends Food {
private Cheese cheese;
private Doe doe;
private Meat meat;
private SeaFood seaFood;
private Vegetable[] vegetables;
public ... |
C# | UTF-8 | 4,474 | 3 | 3 | [] | no_license | using PinsGenerator.Repository;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PinsGenerator
{
publ... |
C# | UTF-8 | 4,995 | 3.234375 | 3 | [
"MIT"
] | permissive | using System;
namespace StereoKit
{
/// <summary>A Sprite is an image that's set up for direct 2D rendering, without using
/// a mesh or model! This is technically a wrapper over a texture, but it also includes
/// atlasing functionality, which can be pretty important to performance! This is used
/// ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.