language
stringclasses
15 values
src_encoding
stringclasses
34 values
length_bytes
int64
6
7.85M
score
float64
1.5
5.69
int_score
int64
2
5
detected_licenses
listlengths
0
160
license_type
stringclasses
2 values
text
stringlengths
9
7.85M
JavaScript
UTF-8
1,974
2.59375
3
[]
no_license
angular.module("supercoach") .service('JsonService', function($http){ var self = this; self.updateLiveData = updateLiveData; self.writing = false; self.writeToGameJson = function(data) { if(self.writing) return; data = angular.toJson(data); self.writing = true; $http({ method:"POST", url: "/json.php", data: data }) .then(function(){ self.writing=false; }); } self.getGameJson = function(game_id) { return $http({ method:"GET", url: "/json.php?game_id="+game_id }) } //update live data function updateLiveData(team, opponent, aflgames) { console.log("Updating live data"); var data = []; for(var k in team.player_list.field.players) { data.push(checkForLiveUpdate(team.player_list.field.players[k], aflgames)); } for(var k in team.player_list.bench.players) { data.push(checkForLiveUpdate(team.player_list.bench.players[k], aflgames)); } for(var k in opponent.player_list.field.players) { data.push(checkForLiveUpdate(opponent.player_list.field.players[k], aflgames)); } for(var k in opponent.player_list.bench.players) { data.push(checkForLiveUpdate(opponent.player_list.bench.players[k], aflgames)); } var i = data.length while (i--) { if(typeof(data[i]) == 'undefined'){ data.splice(i,1); } } self.writeToGameJson(data); } function checkForLiveUpdate(player, aflgames) { if(player.match_status=='In Play') { response = {}; //get game id for(var i in aflgames) { if(aflgames[i].team1_abbrev == player.team || aflgames[i].team2_abbrev == player.team){ response.game_id = aflgames[i].id; break; } } response.player = player.fi + ". " + player.ln; response.score = player.livepts; response.team = player.team; //console.log(response); return response; // self.writeToGameJson(game_id, name, score, team); } } });
Python
UTF-8
5,733
3.203125
3
[]
no_license
# -*- coding: utf-8 -*- import numpy from numpy import matrix import time import pickle import matplotlib.pyplot as plt import sklearn.linear_model as lin #Question 1 ############################################################################### def multiply(matr_a, matr_b): ''' :param matr_a: The matrix A represented as lists of list :param matr_b: The matrix B represented as lists of list :return: return_matr: matrix to return after done mulplying A and N ''' if len(matr_a[0]) != len(matr_b): return "The matrices cannot be multiplied" final_rows = len(matr_a) final_cols = len(matr_b[0]) return_matr = [[0 for x in range(final_cols)] for y in range(final_rows)] for k in range (0, final_rows): for i in range (0, final_cols): value = 0 for j in range (0, len(matr_b)): value += matr_a[k][j]*matr_b[j][i] return_matr[k][i] = value return return_matr ''' matrixA = matrix([[1,2],[3,4],[5,6]]) matrixB = matrix([[7,8,9],[10,11,12]]) print(multiply(matrixA, matrixB)) ''' def mymeasure(I, K, J): #I x K matrix: rows, cols = I, K matrix1 = [] for i in range(rows): col = [] for j in range(cols): col.append(numpy.random.rand()) matrix1.append(col) #K x JK matrix: rows, cols = K, J matrix2 = [] for i in range(rows): col = [] for j in range(cols): col.append(numpy.random.rand()) matrix2.append(col) #compute time & compute the difference: start_time = time.time() numpy.matmul(matrix1, matrix2) finish_time = time.time() time_took_matmul = finish_time - start_time start_time = time.time() multiply(matrix1, matrix2) finish_time = time.time() time_took_mymult = finish_time - start_time diff = time_took_matmul - time_took_mymult print (diff) #Question 3 ############################################################################### def dataMatrix(X, M): return_matr = [] for i in range (0, len(X)): return_matr.append([]); for j in range (0, M+1): return_matr[i].append(X[i]**j) return return_matr def computeY(W, X): Y = [] for x_i in X: y_i = 0 for i in range(0, len(W)): y_i = y_i + W[i]*((x_i)**(i)) Y.append(y_i) return Y def computeError(Y_target, Y_pred): error = 0 for i in range(len(Y_target)): error = error + ((Y_target[i] - Y_pred[i])**2) error = error/len(Y_target) return error def fitPoly(M): with open("C:\datafile\data1.pickle", "rb") as f: dataTrain,dataTest = pickle.load(f, encoding='latin1') X_train = [] Y_train = [] for i in range (len(dataTrain)): X_train.append(dataTrain[i][0]) Y_train.append(dataTrain[i][1]) #A = numpy.vstack([x, numpy.ones(len(x))]).T Z = dataMatrix(X_train, M) result = numpy.linalg.lstsq(Z, Y_train) W = result[0] X_test = [] Y_test = [] for i in range (len(dataTest)): X_test.append(dataTest[i][0]) Y_test.append(dataTest[i][1]) Y_pred_train = computeY(W, X_train) Y_pred_test = computeY(W, X_test) err_train = computeError(Y_train, Y_pred_train) err_test = computeError(Y_test, Y_pred_test) return W, err_train, err_test ''' fitPoly(4) ''' def plotPoly(w): x = numpy.linspace(0, 1, num=1000) y = computeY(w,x) with open("C:\datafile\data1.pickle", "rb") as f: dataTrain,dataTest = pickle.load(f, encoding='latin1') X = [] for i in range (len(dataTrain)): X.append(dataTrain[i][0]) Y = [] for i in range (len(dataTrain)): Y.append(dataTrain[i][1]) plt.plot(X, Y, 'o', label='Original data', markersize=10) plt.plot(x, y, 'r', label='Fitted line') plt.legend() plt.show() ''' W = fitPoly(4)[0] plotPoly(W) ''' def bestPoly(): M_lst = [] err_train_lst = [] err_test_lst = [] for i in range(16): M_lst.append(i) W, err_train, err_test = fitPoly(i) err_train_lst.append(err_train) err_test_lst.append(err_test) #plotPoly(result[0]) plt.plot(M_lst, err_train_lst, 'o', label='Training error', markersize=8) #plt.plot(M_lst, err_test_lst, 'o', label='Test error', markersize=8) plt.legend() plt.show() bestPoly() #Question 4 ############################################################################### def fitRegPoly(M, alpha): with open("data1.pickle", "rb") as f: dataTrain,dataTest = pickle.load(f, encoding='latin1') with open("data2.pickle", "rb") as f: dataVal,dataTest = pickle.load(f, encoding='latin1') X_val = [] Y_val = [] for i in range (len(dataVal)): X_val.append(dataVal[i][0]) Y_val.append(dataVal[i][1]) Z = dataMatrix(X_val, M) ridge = lin.Ridge(alpha) ridge.fit(Z, Y_val) W = ridge.coef_ W[0] = ridge.intercept_ X_test = [] Y_test = [] for i in range (len(dataTest)): X_test.append(dataTest[i][0]) Y_test.append(dataTest[i][1]) Y_pred_val = computeY(W, X_val) Y_pred_test = computeY(W, X_test) err_val = computeError(Y_val, Y_pred_val) err_test = computeError(Y_val, Y_pred_test) return W, err_val, err_test def bestRegPoly(): pass #Question 5 ############################################################################### def regGrad(Z, t, w, alpha): pass def fitPolyGrad(M, alpha, lrate): pass
JavaScript
UTF-8
4,506
2.9375
3
[]
no_license
import dotenv from 'dotenv'; import jwt from 'jsonwebtoken'; import bcrypt from 'bcryptjs'; import nodemailer from 'nodemailer'; import stubTransport from 'nodemailer-stub-transport'; import sgTransport from 'nodemailer-sendgrid-transport'; dotenv.config(); /** * @exports Helper * @class Helper * @description Helps to generate token and passwor hashing * */ class Helper { /** * Check the environment * @function generateToken * @param {object} userinfo - accept object with user info * @return {string} Returns strategy */ static generateToken(userinfo) { const Issuetoken = jwt.sign(userinfo, process.env.SECRET, { expiresIn: '1d' }); return Issuetoken; } /** * Check the environment * @function hashPassword * @param {string} password - user password * @return {string} Returns hashedPassword */ static hashPassword(password) { const hashedPassword = bcrypt.hashSync(password, bcrypt.genSaltSync(8)); return hashedPassword; } /** * Check the environment * @function comparePassword * @param {string} passwordHash - a hashed password * @param {string} password - a user password * @return {boolean} comparedPassword -Returns true if they are matching or false */ static comparePassword(passwordHash, password) { const comparedPassword = bcrypt.compareSync(password, passwordHash); return comparedPassword; } /** * @description function to generate token * @function tokenGenerator * @param { number } tokenLength * @returns { string } returns string of tokenLength length * */ static tokenGenerator(tokenLength) { const token = []; const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; for (let i = 0; i < tokenLength; i += 1) { token.push(chars[this.getRandomInt(0, chars.length - 1)]); } return token.join(''); } /** * @param { number } min * @param { number } max * @return { number } return random number between min and max */ static getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } /** * @description Function to chack whether email is valid * @function validateEmail * @param { string } email * @return { boolean } return true or false */ static validateEmail(email) { const reg = /\S+@\S+\.\S+/; return reg.test(email.toLowerCase()); } /** * @function mailTransport * @return { * } return transport */ static mailTransport() { const options = { auth: { api_key: process.env.SENDGRID_API_KEY, } }; const transport = process.env.NODE_ENV === 'test' ? stubTransport() : sgTransport(options); return nodemailer.createTransport(transport); } /** * Check the environment * @function emailValidator * @param {string} email - Check the email * @return {string} Validate the email and username */ static emailValidator(email) { if (!/\S+@\S+\.\S+/i.test(email)) { return 'E-mail is invalid'; } return true; } /** * Check the environment * @function passwordValidator * @param {string} password - Check the password * @return {string} Validate the password criteria */ static passwordValidator(password) { const specialcharacter = /[ !@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/; const regexdigits = /(.*\d.*)/; const regexlowercase = /(.*[a-z].*)/; const regexuppercase = /(.*[A-Z].*)/; if (!regexdigits.test(password)) { return 'The password Must contain at least one number'; } if (!regexlowercase.test(password)) { return 'The password must contain a lower case character'; } if (!regexuppercase.test(password)) { return 'the password should contain an uppercase character'; } if (!specialcharacter.test(password)) { return 'the password should contain a special character'; } if (password.length < 8) { return 'password must not be less than 8 characters'; } return true; } /** * Check the environment * @function emailUsernamevalidator * @param {string} email - Check the email * @param {string} username - Check the username * @return {string} Validate the email and username */ static emailUsernamevalidator(email, username) { if (email) { return 'email is already in use'; } if (username) { return 'Username is already in use'; } return true; } } export default Helper;
Python
UTF-8
522
2.6875
3
[]
no_license
import re import pandas as pd import json import sys import requests commandArgs = sys.argv a = str(commandArgs[1]).lower() # requests.put('https://dsci551-2-default-rtdb.firebaseio.com/.json', data = final_use3_json) gotthis = requests.get('https://dsci551-2-default-rtdb.firebaseio.com/.json') data1 = gotthis.json() df = pd.DataFrame.from_dict(data1, orient='columns') df['Name'] = df['Name'].str.lower() df1 = df['Name'].tolist() for name in df1: if a in str(name).split(): print(name)
Java
UTF-8
285
2.234375
2
[]
no_license
import org.junit.Assert; import static org.junit.Assert.assertEquals; public class Test { @org.junit.Test public void add() { PerSon s1 = new PerSon("hung"); assertEquals("Hello hung", s1.hello()); assertEquals("Hello hai", s1.hello("hai")); } }
JavaScript
UTF-8
1,494
2.515625
3
[]
no_license
import React, { useState, useEffect, useCallback } from "react"; import GetStargazerList from "../Services/GetStargazerList"; const StargazerList = ({ repos }) => { const [stargazers, setStagazers] = useState(null); const [pageStargazer, setPageStargazer] = useState(1); const handleClick = useCallback(async () => { setPageStargazer(1); setStagazers(await GetStargazerList(repos.full_name, pageStargazer)); }, [repos.full_name]); useEffect(() => { async function fetchStargazer() { const data = await GetStargazerList(repos.full_name, pageStargazer); if (pageStargazer > 1) { setStagazers([...stargazers, ...data]); } } fetchStargazer(); }, [pageStargazer]); return ( <div style={{ display: "inline" }}> <i className="fa fa-star" onClick={handleClick}></i> {stargazers ? ( <ul> {stargazers && stargazers.map((star, i) => <li key={i}>{star.login}</li>)} {stargazers ? ( <p>{stargazers.length + "/" + repos.stargazers_count}</p> ) : null} {repos.stargazers_count && repos.stargazers_count >= 30 && stargazers.length < repos.stargazers_count ? ( <button onClick={() => { setPageStargazer(pageStargazer + 1); }} > Load More </button> ) : null} </ul> ) : null} </div> ); }; export default StargazerList;
Java
UTF-8
2,742
2.75
3
[]
no_license
package com.example.YT_8.cytrition.tools; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.example.YT_8.cytrition.R; import com.example.YT_8.cytrition.bugs.ResolveBugActivity; import java.util.ArrayList; /** * This activity allows the user to create and modify an list of grocery items. They can add new items and delete list items by clicking on them. * @author Ryan */ public class GroceryListActivity extends AppCompatActivity { private ArrayList<String> groceryList; private ArrayAdapter<String> arrayAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_grocery_list); /* Initialization */ final EditText newItemET = (EditText) findViewById(R.id.newItemET); groceryList = new ArrayList<>(); ListView groceryListView = (ListView) findViewById(R.id.listView); //noinspection Convert2Diamond arrayAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,groceryList); groceryListView.setAdapter(arrayAdapter); /* When a item in the list is clicked on, it is removed. */ groceryListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { // strikethrough or delete from list groceryList.remove(i); arrayAdapter.notifyDataSetChanged(); } }); /* Tries to add string item from EditText to list. (Duplicates are not allowed. */ Button addItemButton = (Button) findViewById(R.id.addItemButton); addItemButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String item = newItemET.getText().toString(); if(!groceryList.contains(item)) { groceryList.add(item); newItemET.setText(""); Toast.makeText(getApplicationContext(),item + " added to grocery list.",Toast.LENGTH_SHORT).show(); arrayAdapter.notifyDataSetChanged(); } else { Toast.makeText(getApplicationContext(),"Item already in list.",Toast.LENGTH_SHORT).show(); } } }); } }
Java
GB18030
11,298
1.71875
2
[]
no_license
/* *@(#)xx.kgt.action *@TkAction.java.java *@ʱ:2011-8-208:12:10 *@ߣ *@Copyright 2009-2010 ӱѧԺϢѧ빤ѧԺ */ package xx.kgt.action; import java.io.UnsupportedEncodingException; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.ParentPackage; import org.apache.struts2.convention.annotation.Result; import org.springframework.stereotype.Controller; import xx.collection.bean.Tk; import xx.collection.bean.Yhzdymc; import xx.collection.bean.Zsd; import xx.collection.bean.ZsdId; import xx.kgt.bean.Tko; import xx.md5.module.MD5Builder; import xx.quanxian.service.BaseService; import com.googlecode.jsonplugin.annotations.JSON; import com.opensymphony.xwork2.ActionSupport; /** * @TkAction <code>{}</code> * @author {} * @version {汾,ʱ} * @{} */ @Controller @ParentPackage("default-package") @Namespace("") public class TkAction extends ActionSupport { @Resource(name="baseService") private BaseService baseservice; private int page;//ǰҳ private int rows_s;//ÿҳʾ private int total;//¼ private List<Tk> tklist =new ArrayList<Tk>(); private List<Tko> rows = new ArrayList<Tko>(); private Tk tk; private int CId; private int zbh; private int zsdbh; private Integer th; private Zsd zsd; private String tg; private String da; private Integer csrcs; private Integer zqrcs; private Integer nyd; private String md5; private String queryType; //ѯʱIJѯҪݲѯ private String queryWord; //ѯʱIJѯҪݲѯĹؼ private String CName; private String zmc; private String zsdmc; private List<Yhzdymc> listy = new ArrayList<Yhzdymc>(); @JSON(serialize=false) public BaseService getBaseservice() { return baseservice; } public void setBaseservice(BaseService baseservice) { this.baseservice = baseservice; } public int getPage() { return page; } public void setPage(int page) { this.page = page; } public int getRows_s() { return rows_s; } public void setRows_s(int rows_s) { this.rows_s = rows_s; } public int getTotal() { return total; } public void setTotal(int total) { this.total = total; } @JSON(serialize=false) public List<Tk> getTklist() { return tklist; } public void setTklist(List<Tk> tklist) { this.tklist = tklist; } public List<Tko> getRows() { return rows; } public void setRows(List<Tko> rows) { this.rows = rows; } @JSON(serialize=false) public Tk getTk() { return tk; } public void setTk(Tk tk) { this.tk = tk; } @JSON(serialize=false) public int getCId() { return CId; } public void setCId(int id) { CId = id; } @JSON(serialize=false) public int getZbh() { return zbh; } public void setZbh(int zbh) { this.zbh = zbh; } @JSON(serialize=false) public int getZsdbh() { return zsdbh; } public void setZsdbh(int zsdbh) { this.zsdbh = zsdbh; } @JSON(serialize=false) public Integer getTh() { return th; } @JSON(deserialize=true) public void setTh(Integer th) { this.th = th; } @JSON(serialize=false) public Zsd getZsd() { return zsd; } public void setZsd(Zsd zsd) { this.zsd = zsd; } @JSON(serialize=false) public String getTg() { return tg; } public void setTg(String tg) { this.tg = tg; } @JSON(serialize=false) public String getDa() { return da; } public void setDa(String da) { this.da = da; } @JSON(serialize=false) public Integer getCsrcs() { return csrcs; } public void setCsrcs(Integer csrcs) { this.csrcs = csrcs; } @JSON(serialize=false) public Integer getZqrcs() { return zqrcs; } public void setZqrcs(Integer zqrcs) { this.zqrcs = zqrcs; } @JSON(serialize=false) public Integer getNyd() { return nyd; } public void setNyd(Integer nyd) { this.nyd = nyd; } @JSON(serialize=false) public String getMd5() { return md5; } public void setMd5(String md5) { this.md5 = md5; } @JSON(serialize=false) public String getQueryType() { return queryType; } @JSON(deserialize=true) public void setQueryType(String queryType) { this.queryType = queryType; } @JSON(serialize=false) public String getQueryWord() { return queryWord; } @JSON(deserialize=true) public void setQueryWord(String queryWord) { this.queryWord = queryWord; } @JSON(serialize=false) public String getCName() { return CName; } public void setCName(String name) { CName = name; } @JSON(serialize=false) public String getZmc() { return zmc; } public void setZmc(String zmc) { this.zmc = zmc; } @JSON(serialize=false) public String getZsdmc() { return zsdmc; } public void setZsdmc(String zsdmc) { this.zsdmc = zsdmc; } //================== @JSON(serialize=false) public List<Yhzdymc> getListy() { return listy; } public void setListy(List<Yhzdymc> listy) { this.listy = listy; } /** * @{tk.action} * ÷ѯ */ @Action(value="/tk",results={@Result(name="root",type="json")}) public String tk(){ tklist = this.baseservice.findAll(Tk.class, "Tk", page, rows_s);//ҳѯ total = this.baseservice.getTotal("Tk"); for(int i=0;i<tklist.size();i++){ Tko tk1 =new Tko(); tk1.setInt1(tklist.get(i).getTh()); tk1.setInt2(tklist.get(i).getCsrcs()); tk1.setInt3(tklist.get(i).getNyd()); tk1.setInt4(tklist.get(i).getZqrcs()); tk1.setInt5(tklist.get(i).getZsd().getId().getCId()); tk1.setInt6(tklist.get(i).getZsd().getId().getZbh()); tk1.setInt7(tklist.get(i).getZsd().getId().getZsdbh()); tk1.setStr1(tklist.get(i).getDa()); tk1.setStr2(tklist.get(i).getTg()); tk1.setStr3(tklist.get(i).getMd5()); rows.add(tk1); } return "root"; } /** * @{inserttk.action} * ÷һ */ @Action(value="/inserttk",results={@Result(name="success",type="json")}) public String inserttk(){ String md5 = this.getTg(); MD5Builder md5b = new MD5Builder(); String xzmd5; try { xzmd5 = md5b.EncoderByMd5(md5);//MD5ɼܣѼܺMD5ֵŵpdmd5С System.out.println(xzmd5); //ͨCNameCId String[] keys=new String[1]; keys[0]="CName"; Object[] values=new Object[1]; values[0]=CName; List<Integer> CId=this.baseservice.find(Integer.class, "Kcxx", "CId", keys, values); //ͨzmcõzbh String[] keys1=new String[1]; keys1[0]="zmc"; Object[] values1=new Object[1]; values1[0]=zmc; List<Integer> zbh=this.baseservice.find(Integer.class, "Zinfo", "id.zbh", keys1, values1); //ͨzsdmczsdbh String[] keys2=new String[1]; keys2[0]="zsdmc"; Object[] values2=new Object[1]; values2[0]=zsdmc; List<Integer> zsdbh=this.baseservice.find(Integer.class, "Zsd", "id.zsdbh", keys2, values2); ZsdId id1 = new ZsdId(); id1.setCId(CId.get(0)); id1.setZbh(zbh.get(0)); id1.setZsdbh(zsdbh.get(0)); Zsd zsd1 = new Zsd(); zsd1.setId(id1); Tk tk2 = new Tk(); if(zqrcs!=null&&csrcs!=null){ int nyd1; //׶ȣķתΪΡ nyd1 =Integer.parseInt(new java.text.DecimalFormat("0").format(zqrcs*100/csrcs)); tk2.setNyd(nyd1); } tk2.setMd5(xzmd5); tk2.setCsrcs(csrcs); tk2.setDa(da); tk2.setTg(tg); //tk2.setTh(th); tk2.setZqrcs(zqrcs); tk2.setZsd(zsd1); this.baseservice.save(tk2); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return SUCCESS; } /** * @{deletetk.action} * ÷ɾij */ @Action(value="/deletetk",results={@Result(name="success",type="json")}) public String deletetk(){ tk=this.baseservice.find(Tk.class, th); this.baseservice.delete(tk); return SUCCESS; } /** * @{updatetk.action} * ÷ij */ @Action(value="/updatetk",results={@Result(name="success",type="json")}) public String updatetk(){ String md5 = this.getTg(); MD5Builder md5b = new MD5Builder(); String xzmd5; try { xzmd5 = md5b.EncoderByMd5(md5);//MD5ɼܣѼܺMD5ֵŵpdmd5С System.out.println(xzmd5); ZsdId id1 = new ZsdId(); id1.setCId(CId); id1.setZbh(zbh); id1.setZsdbh(zsdbh); Zsd zsd1 = new Zsd(); zsd1.setId(id1); Tk tk2 = new Tk(); if(zqrcs!=null&&csrcs!=null){ int nyd1; //׶ȣķתΪΡ nyd1 =Integer.parseInt(new java.text.DecimalFormat("0").format(zqrcs*100/csrcs)); tk2.setNyd(nyd1); } tk2.setMd5(xzmd5); tk2.setCsrcs(csrcs); tk2.setDa(da); tk2.setTg(tg); tk2.setTh(th); tk2.setZqrcs(zqrcs); tk2.setZsd(zsd1); this.baseservice.update(tk2); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return SUCCESS; } /** * @{queryxz.action} * ÷ѯѡģѯʱҳqueryTypequeryWord * queryTypeҪѯʱݵͣqueryWordǹؼ * ѯĽҳҪԷҳʽʾ */ @Action(value="/querytk",results={@Result(name="root",type="json")}) public String querytk(){ tklist = this.baseservice.findByTypage(Tk.class, "Tk", queryType, queryWord, "order by th asc", page, rows_s);//ؼֲѯ total = this.baseservice.getTotal("Tk"); for(int i=0;i<tklist.size();i++){ Tko tk1 =new Tko(); tk1.setInt1(tklist.get(i).getTh()); tk1.setInt2(tklist.get(i).getCsrcs()); tk1.setInt3(tklist.get(i).getNyd()); tk1.setInt4(tklist.get(i).getZqrcs()); tk1.setInt5(tklist.get(i).getZsd().getId().getCId()); tk1.setInt6(tklist.get(i).getZsd().getId().getZbh()); tk1.setInt7(tklist.get(i).getZsd().getId().getZsdbh()); tk1.setStr1(tklist.get(i).getDa()); tk1.setStr2(tklist.get(i).getTg()); tk1.setStr3(tklist.get(i).getMd5()); rows.add(tk1); } return "root"; } /** * @{xuanze.action} * ÷ָתҳ */ @Action(value="/tko",results={@Result(name="success",location="/kgt/tk.jsp")}) public String tko(){ listy = this.baseservice.find(Yhzdymc.class); return SUCCESS; } }
Java
UTF-8
5,289
2.171875
2
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
package org.burningokr.service.okrUnit.departmentservices.unitServiceManagersTest; import static org.mockito.AdditionalAnswers.returnsFirstArg; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.UUID; import org.burningokr.model.okrUnits.OkrDepartment; import org.junit.Assert; import org.junit.Test; public class OkrUnitServiceManagersTest_Okr_Department extends OkrUnitServiceManagersTest<OkrDepartment> { @Test public void updateDepartmentMemberList_expectedOkrMemberIdsAreChangedInSavedDepartment() { OkrDepartment insertedOkrDepartment = new OkrDepartment(); Collection<UUID> insertedOkrMemberIds = Arrays.asList(UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()); insertedOkrDepartment.setOkrMemberIds(insertedOkrMemberIds); insertedOkrDepartment.setId(100L); insertedOkrDepartment.setName("Test"); OkrDepartment originalOkrDepartment = new OkrDepartment(); Collection<UUID> originalOkrMemberIds = new ArrayList<>(); originalOkrDepartment.setOkrMemberIds(originalOkrMemberIds); originalOkrDepartment.setId(100L); originalOkrDepartment.setName("Test"); when(unitRepository.findByIdOrThrow(100L)).thenReturn(originalOkrDepartment); when(unitRepository.save(any(OkrDepartment.class))).then(returnsFirstArg()); okrUnitServiceManagers.updateUnit(insertedOkrDepartment, user); verify(unitRepository).save(originalOkrDepartment); Assert.assertEquals(originalOkrDepartment.getOkrMemberIds(), insertedOkrMemberIds); } @Test public void updateDepartmentMemberList_expectedOtherVariablesUnchangedInSavedDepartment() { OkrDepartment insertedOkrDepartment = new OkrDepartment(); Collection<UUID> insertedOkrMemberIds = Arrays.asList(UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()); insertedOkrDepartment.setOkrMemberIds(insertedOkrMemberIds); insertedOkrDepartment.setId(100L); insertedOkrDepartment.setName("Insert"); insertedOkrDepartment.setOkrMasterId(UUID.randomUUID()); insertedOkrDepartment.setOkrTopicSponsorId(UUID.randomUUID()); OkrDepartment insertedParentUnit = new OkrDepartment(); insertedParentUnit.setName("insertedParentUnit"); insertedOkrDepartment.setParentOkrUnit(insertedParentUnit); insertedOkrDepartment.setObjectives(new ArrayList<>()); OkrDepartment originalOkrDepartment = new OkrDepartment(); Collection<UUID> originalOkrMemberIds = new ArrayList<>(); originalOkrDepartment.setOkrMemberIds(originalOkrMemberIds); originalOkrDepartment.setId(100L); originalOkrDepartment.setName("Original"); originalOkrDepartment.setOkrMasterId(UUID.randomUUID()); originalOkrDepartment.setOkrTopicSponsorId(UUID.randomUUID()); OkrDepartment originalParentUnit = new OkrDepartment(); originalParentUnit.setName("originalParentUnit"); originalOkrDepartment.setParentOkrUnit(originalParentUnit); originalOkrDepartment.setObjectives(new ArrayList<>()); when(unitRepository.findByIdOrThrow(100L)).thenReturn(originalOkrDepartment); when(unitRepository.save(any(OkrDepartment.class))).then(returnsFirstArg()); okrUnitServiceManagers.updateUnit(insertedOkrDepartment, user); verify(unitRepository).save(originalOkrDepartment); Assert.assertNotEquals(originalOkrDepartment.getName(), insertedOkrDepartment.getName()); Assert.assertNotEquals( originalOkrDepartment.getOkrMasterId(), insertedOkrDepartment.getOkrMasterId()); Assert.assertNotEquals( originalOkrDepartment.getOkrTopicSponsorId(), insertedOkrDepartment.getOkrTopicSponsorId()); Assert.assertNotEquals( originalOkrDepartment.getParentOkrUnit(), insertedOkrDepartment.getParentOkrUnit()); Assert.assertNotSame( originalOkrDepartment.getObjectives(), insertedOkrDepartment.getObjectives()); } @Test public void updateDepartmentMemberList_expectedReturnsFromSaveCall() { OkrDepartment insertedOkrDepartment = new OkrDepartment(); Collection<UUID> insertedOkrMemberIds = Arrays.asList(UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()); insertedOkrDepartment.setOkrMemberIds(insertedOkrMemberIds); insertedOkrDepartment.setId(100L); insertedOkrDepartment.setName("Test"); OkrDepartment originalOkrDepartment = new OkrDepartment(); Collection<UUID> originalOkrMemberIds = new ArrayList<>(); originalOkrDepartment.setOkrMemberIds(originalOkrMemberIds); originalOkrDepartment.setId(100L); originalOkrDepartment.setName("Test"); OkrDepartment saveCallReturnedOkrDepartment = new OkrDepartment(); when(unitRepository.findByIdOrThrow(100L)).thenReturn(originalOkrDepartment); when(unitRepository.save(any(OkrDepartment.class))).thenReturn(saveCallReturnedOkrDepartment); OkrDepartment actualOkrDepartment = okrUnitServiceManagers.updateUnit(insertedOkrDepartment, user); verify(unitRepository).save(originalOkrDepartment); Assert.assertEquals(saveCallReturnedOkrDepartment, actualOkrDepartment); } @Override protected OkrDepartment createUnit() { return new OkrDepartment(); } }
Python
UTF-8
1,435
2.578125
3
[]
no_license
from instagram_private_api.instagram_web_api import Client AUTH_USERNAME = '' AUTH_PASSWORD = '' TARGET_ACCOUNT = '' # authenticate client try: api = Client(username=AUTH_USERNAME, password=AUTH_PASSWORD, authenticate=True) except Exception as e: print('auth error', e) raise e if api.is_authenticated: print('Client authenticated') else: print('Client not authenticated') # retrieve user id from target account result = api.user_info2(TARGET_ACCOUNT) user_id = result['id'] print('user id retrieved: {}'.format(user_id)) # loop until we scrape all followers has_next_page = True end_cursor = None while has_next_page: # note the additional end_cursor parameter results = api.user_followers(user_id, count=50, extract=False, end_cursor=end_cursor) user = results['data']['user'] edge_followed_by = user['edge_followed_by'] # do what you want with the data! followers = [] followers.extend(edge_followed_by.get('edges', [])) for follower in followers: print('username: {}'.format(follower['node']['username'])) print('full name: {}'.format(follower['node']['full_name'])) print('user id: {}'.format(follower['node']['id'])) print('is private: {}'.format(follower['node']['is_private'])) # pagination attributes end_cursor = edge_followed_by['page_info']['end_cursor'] has_next_page = edge_followed_by['page_info']['has_next_page']
Java
UTF-8
768
2.359375
2
[]
no_license
package com.zviproject.common.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "subject", catalog = "Student") public class Subject { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id_subject") private Integer id_subject; @Column(name = "subject") private String subject; public Integer getId_subject() { return id_subject; } public void setId_subject(Integer id_subject) { this.id_subject = id_subject; } public String getSubject() { return subject; } public void setSubject(String subject) { this.subject = subject; } }
Java
UTF-8
3,947
2.140625
2
[]
no_license
package tagbin.in.myapplication; import tagbin.in.myapplication.util.SystemUiHider; import android.annotation.TargetApi; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.location.LocationManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.provider.Settings; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.auth.api.Auth; /** * An example full-screen activity that shows and hides the system UI (i.e. * status bar and navigation/system bar) with user interaction. * * @see SystemUiHider */ public class SplashActivity extends Activity { private ProgressBar progressBar; private Handler mHandler = new Handler(); AlertDialog alert; TextView messageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_splash); progressBar = (ProgressBar) findViewById(R.id.progress); customDialog(); } public void customDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); LayoutInflater inflater = getLayoutInflater(); View customView = inflater.inflate(R.layout.dialog, null); builder.setView(customView); messageView = (TextView)customView.findViewById(R.id.tvdialog); alert = builder.create(); } public void showDialog(){ alert.show(); } public void dismissDialog(){ alert.dismiss(); } @Override public void onStart() { // When the aplication starts, show the progressbar for 2 seconds. After that, execute loadHomeActivity runnable. long mStartTime = 0; if (mStartTime == 0L) { mStartTime = System.currentTimeMillis(); mHandler.removeCallbacks(loadHomeActivity); progressBar.setVisibility(ProgressBar.VISIBLE); progressBar.setProgress(0); mHandler.postDelayed(loadHomeActivity, 3000); } super.onStart(); } // A runnable executed when the progressbar finishes which starts the HomeActivity. private Runnable loadHomeActivity = new Runnable() { public void run() { SharedPreferences sharedPreferences = getSharedPreferences(LoginActivity.LOGINDETAILS, Context.MODE_PRIVATE); String username = sharedPreferences.getString("username", ""); final LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { turnGPSOn(); } else { if (username.equals("")) { Intent i = new Intent(SplashActivity.this, LoginActivity.class); startActivity(i); finish(); } else { Intent i = new Intent(SplashActivity.this, StartService.class); startActivity(i); finish(); } } } }; public void turnGPSOn() { startActivity(new Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS)); Toast.makeText(this,"Enable GPS",Toast.LENGTH_LONG).show(); } }
Rust
UTF-8
3,917
3.25
3
[ "BSD-3-Clause" ]
permissive
use std::collections::HashMap; extern crate uuid; use self::uuid::Uuid; use network::peer::{Peer}; use std::fs::{File,OpenOptions}; extern crate serde; extern crate serde_json; #[derive(Debug, Serialize, Deserialize)] pub struct Node { pub uuid: Uuid, pub peers: HashMap<Uuid, Peer>, } impl Default for Node { fn default() -> Node { Node{ uuid: Uuid::new_v4(), peers: HashMap::new(), } } } impl Node { pub fn new() -> Node { /* we persist the node uuid and peers in a state file. Load it. */ File::open("state.json") /* Since File::open(...) and serde_json::from_reader(...) return * different error types, we convert both of them to a string. */ .map_err(|err| err.to_string()) .and_then(|file| -> Result<Node,_> { serde_json::from_reader(file) .map_err(|err| err.to_string()) }) /* If opening the file or deserialization failed, return the * default value with a random UUID and no peers. */ .unwrap_or(Default::default()) .save() } fn save(self) -> Node { OpenOptions::new() .write(true) .create(true) .open("state.json") /* Since File::open(...) and serde_json::to_writer(...) return * different error types, we convert both of them to a string. */ .map_err(|err| err.to_string()) .and_then(|file| { serde_json::to_writer(file, &self) .map_err(|err| err.to_string()) }).and_then(|_|Ok(self)).unwrap() } } #[cfg(test)] mod tests { use std::sync::Mutex; use std::panic; use std::env; extern crate tempdir; /* For some of the tests we need to cd to a temporary directory. Use a * static mutex to serialize these. */ lazy_static! { static ref TEST_MUTEX: Mutex<()> = Mutex::new(()); } macro_rules! guarded { ($body:block) => { { let guard = TEST_MUTEX.lock().unwrap(); if let Err(e) = panic::catch_unwind(|| { $body }) { drop(guard); panic::resume_unwind(e); } } } } #[test] fn test_uuid_persistence() { /* Test that the UUID is persisted to file */ guarded! ({ use self::tempdir::TempDir; use std::env; extern crate tempdir; let dir = TempDir::new("test_persistence") .expect("Could not create temporary directory"); let pushd = env::current_dir().unwrap(); /* make sure we cd back even if we panic, so that we leave a clean * slate for other tests. */ if let Err(e) = panic::catch_unwind(|| { env::set_current_dir(dir.path()) .expect("could not cd to temporary directory"); /* Make sure we changed directory */ assert_ne!(pushd, dir.path()); let uuid = { let n = super::Node::new(); n.uuid }; let uuid_reloaded = { let n = super::Node::new(); n.uuid }; assert_eq!(uuid, uuid_reloaded); use std::fs; fs::remove_file("state.json") .expect("could not delete state file"); let uuid_renewed = { let n = super::Node::new(); n.uuid }; assert_ne!(uuid,uuid_renewed); }) { env::set_current_dir(pushd) .expect("could not cd back"); panic::resume_unwind(e); } }) } }
C++
UTF-8
3,329
2.90625
3
[ "MIT" ]
permissive
#include "Particle.h" BEGIN_NAMESPACE_COOLPHYSICS2D Particle::Particle(bool overlappable,double radius,double mass,double elasticity,Vector position,Vector velocity,Vector acceleration,double lifeTime,Color color) { _particle=new raw::Particle(overlappable,radius,mass,elasticity,position,velocity, acceleration,lifeTime,color); } Particle::Particle(Particle const& particle):_retainCount(particle._retainCount),_particle(particle._particle){} Particle::~Particle() { // _destructorMutex.lock(); if (_retainCount.only()) { delete _particle; } // _destructorMutex.unlock(); } std::string Particle::description()const { return _particle->description(); } void Particle::update(double timeInterval) { _particle->update(timeInterval); } void Particle::reflectAbout(const Vector& axis) { _particle->reflectAbout(axis); } double Particle::distanceTo(const Particle& p)const { return _particle->distanceTo(*p._particle); } bool Particle::collide(const Particle& p1,const Particle& p2) { return raw::Particle::collide(*p1._particle, *p2._particle); } void Particle::handleCollision(Particle& e1,Particle& e2) { raw::Particle::handleCollision(*e1._particle, *e2._particle); } double Particle::lifeTime()const { return _particle->lifeTime(); } double Particle::radius()const { return _particle->radius(); } const Vector& Particle::position()const { return _particle->position(); } const Vector& Particle::velocity()const { return _particle->velocity(); } Vector& Particle::acceleration()const { return _particle->acceleration(); } const Color& Particle::color()const { return _particle->color(); } Circle Particle::range()const { return _particle->range(); } double Particle::mass()const { return _particle->mass(); } bool Particle::overlappable()const { return _particle->overlappable(); } ParticleBuilder::ParticleBuilder():_overlappable(false),_radius(0),_mass(0),_elasticity(0),_position(Vector(0,0)),_velocity(Vector(0,0)),_acceleration(Vector(0,0)),_lifeTime(0),_color(Color::whiteColor){} ParticleBuilder& ParticleBuilder::overlappable(bool overlappable) { _overlappable=overlappable; return *this; } ParticleBuilder& ParticleBuilder::radius(double radius) { _radius=radius; return *this; } ParticleBuilder& ParticleBuilder::mass(double mass) { _mass=mass; return *this; } ParticleBuilder& ParticleBuilder::elasticity(double elasticity) { _elasticity=elasticity; return *this; } ParticleBuilder& ParticleBuilder::position(const Vector& position) { _position=position; return *this; } ParticleBuilder& ParticleBuilder::velocity(const Vector& velocity) { _velocity=velocity; return *this; } ParticleBuilder& ParticleBuilder::acceleration(const Vector& acceleration) { _acceleration=acceleration; return *this; } ParticleBuilder& ParticleBuilder::lifetime(double lifetime) { _lifeTime=lifetime; return *this; } ParticleBuilder& ParticleBuilder::color(const Color& color) { _color=color; return *this; } Particle* ParticleBuilder::build()const { Particle* particle = new Particle(_overlappable,_radius,_mass,_elasticity,_position,_velocity,_acceleration,_lifeTime,_color); return particle; } END_NAMESPACE_COOLPHYSICS2D
Markdown
UTF-8
583
2.671875
3
[]
no_license
# cfg-website The primary reason for creating this social enterprise website is to assist people living or visiting different London Boroughs in order to find information about support, social events and volunteering in the community more readily. Although different boroughs have their own websites, it would be very useful if we could create a UX (user experience) that is similar across the boroughs and this will lead to better information dispersal and successful outcomes. The London Borough map is an open source map from https://jsmaps.io/ and is free to download and use.
Python
UTF-8
17,508
2.765625
3
[]
no_license
#!/usr/bin/env python # coding=UTF-8 ''' @Description: COMP7405 Assignment 3 @Author: CJJ && HXZ @LastEditors: Cai Jiajun @Date: 2019-04-02 17:12:19 @LastEditTime: 2019-04-11 16:28:38 ''' import numpy as np import math import scipy.stats as si class OptionCalculation(object): def __init__(self): ''' Generate the test cases ''' # @list,tThe first THREE Asian options are put options, the last THREE are call options self.Asian = self._init_Asian_testcases() # @list, the first SIX Asian options are put options, the last THREE are call options self.Basket = self._init_Basket_testcases() # risk-free rate self.r = 0.05 # maturity self.T = 3 # current asset value self.S0 = 100.0 pass def _init_Asian_testcases(self): sigma = [0.3, 0.3, 0.4, 0.3, 0.3, 0.4] K = [100.0]*6 n = [50, 100, 50, 50, 100, 50] Type = ['Put']*3 + ['Call']*3 return [{'sigma':p1, 'K': p2, 'n': p3, 'Type': p4} for (p1, p2, p3, p4) in zip(sigma, K, n, Type)] def _init_Basket_testcases(self): S1 = [100.0]*12 S2 = [100.0]*12 K = list(map(float, [100]*3+[80, 120]+[100]*4+[80, 120, 100])) sigma1 = [.3]*2 + [.1] + [.3]*2 + [.5] + [.3]*2 + [.1] + [.3]*2 + [.5] sigma2 = [.3]*5 + [.5] + [.3]*5 + [.5] rho = [.5] + [.9] + [.5]*5 + [.9] + [.5]*4 Type = ['Put']*6 + ['Call']*6 return [{'S1':p1, 'S2': p2, 'K': p3, 'sigma1': p4, 'sigma2': p5, 'rho': p6, 'Type': p7} \ for (p1, p2, p3, p4, p5, p6, p7) in zip(S1, S2, K, sigma1, sigma2, rho, Type)] def BSFormulas(self, other_para)-> float: S = other_para['S'] K = other_para['K'] ttm = other_para['t'] r = other_para['r'] sigma = other_para['vol'] Type = other_para['type'] d1 = (np.log(S / K) + (r + 0.5 * sigma ** 2) * (ttm)) / (sigma * np.sqrt(ttm)) d2 = (np.log(S / K) + (r - 0.5 * sigma ** 2) * (ttm)) / (sigma * np.sqrt(ttm)) if Type == "Call": result = (S * si.norm.cdf(d1, 0.0, 1.0) - K * np.exp(-r * (ttm)) * si.norm.cdf(d2, 0.0, 1.0)) return result if Type == "Put": result = (K * np.exp(-r * (ttm)) * si.norm.cdf(-d2, 0.0, 1.0) - S * si.norm.cdf(-d1, 0.0, 1.0)) return result return -1 def ImpVol(self, other_para = None)-> float: S = other_para['S'] K = other_para['K'] T = other_para['t'] value = other_para['value'] r = other_para['r'] q = other_para['q'] Type = other_para['type'] sigmahat = np.sqrt(2*np.abs((np.log(S/K)+(r-q)*(T))/ T)) tolerance = 0.00000001 xnew = sigmahat increment = 1 n = 1 nmax = 100 while (abs(increment) > tolerance) & (n < nmax): d1 = (np.log(S / K) + (r - q + 0.5 * xnew ** 2) * T) / (xnew * np.sqrt(T)) d2 = (np.log(S / K) + (r - q - 0.5 * xnew ** 2) * T) / (xnew * np.sqrt(T)) if Type == "Call": fx = S * np.exp(-q * T) * si.norm.cdf(d1, 0.0, 1.0) - K * np.exp(-r * T) * si.norm.cdf(d2, 0.0, 1.0) - value if Type == "Put": fx = K * np.exp(-r * T) * si.norm.cdf(-d2, 0.0, 1.0) - S * np.exp(-q * T) * si.norm.cdf(-d1, 0.0, 1.0) - value vega = 1 / np.sqrt(2 * np.pi) * S * np.exp(-q * T) * np.exp(-(d1 ** 2) * 0.5) * np.sqrt(T) increment = fx/vega xnew = xnew - increment n += 1 return abs(xnew) def ClosedFormFormulas(self, other_para = None)-> float: """Calculate the Asian option value using closed-form formulas Args: self: you can get the testcases from self.Asian other_para: if you want to test you functions using other samples, please input a dictionary with the same format as \ the element of @self.Asian (i.e. {'sigma':p1, 'K': p2, 'n': p3, 'Type': p4}) Returns: A float number with the value of Asian option """ #TODO(Big Huang): 请开始你的表演 K = other_para['K'] T = other_para['T'] S0 = other_para['S'] r = other_para['r'] sigma = other_para['sigma'] Type = other_para['type'] n = other_para['n'] sigma_hat = sigma * np.sqrt((n + 1) * (2 * n + 1)/(6 * n ** 2)) u_hat = (r - 0.5 * sigma ** 2) * (n + 1) / (2 * n) + 0.5 * sigma_hat ** 2 d1 = (np.log(S0 / K) + (u_hat + 0.5 * sigma_hat ** 2) * T ) / (sigma_hat * np.sqrt(T)) d2 = d1 - sigma_hat * np.sqrt(T) if Type == "Call": option_value = np.exp(-r * T) * (S0 * np.exp(u_hat * T) * si.norm.cdf(d1, 0.0, 1.0) - K * si.norm.cdf(d2, 0.0, 1.0) ) return option_value if Type == "Put": option_value = np.exp(-r * T) * (K * si.norm.cdf(-d2, 0.0, 1.0) - S0 * np.exp(u_hat * T) * si.norm.cdf(-d1, 0.0, 1.0)) return option_value return -1 def ClosedFormForBasketOption(self, other_para =None)->float: K = other_para['K'] T = other_para['t'] S_0 = other_para['S'] r = other_para['r'] sigma = other_para['sigma'] Rho_input = other_para['rho'] Type = other_para['type'] n = 2 sigma_hat_1 = 0 B_1 = 1 Rho = np.zeros(shape=(n,n)) #Rho_input的输入为相关系数,如果是3个以上的Rho = [0.3, 0.4, 0.5] 则分别为第一个期权与第二个期权,第一个期权和第三个期权,第二个和第三个的相关系数,以此类推 #生成Rho矩阵 for i in range(n): for j in range(i,n): if i == j: Rho[i][j] = 1.0 else: Rho[i][j] = Rho_input[i + j - 1] Rho[j][i] = Rho[i][j] #参数 for i in range(n): for j in range(n): sigma_hat_1 += sigma[i] * sigma[j] * Rho[i][j] B_1 *= S_0[i] sigma_hat = np.sqrt(sigma_hat_1) / n u_hat = r - 0.5 * np.sum(np.multiply(sigma,sigma)) / n + 0.5 * sigma_hat ** 2 B_0 = B_1 ** (1 / n) d1 = (np.log(B_0/ K) + (u_hat + 0.5 * sigma_hat ** 2) * T ) / (sigma_hat * np.sqrt(T)) d2 = d1 - sigma_hat * np.sqrt(T) if Type == "Call": option_value = np.exp(-r * T) * (B_0 * np.exp(u_hat * T) * si.norm.cdf(d1, 0.0, 1.0) - K * si.norm.cdf(d2, 0.0, 1.0) ) return option_value if Type == "Put": option_value = np.exp(-r * T) * (K * si.norm.cdf(-d2, 0.0, 1.0) - B_0 * np.exp(u_hat * T) * si.norm.cdf(-d1, 0.0, 1.0)) return option_value return -1 def MonteCarloAsianOption(self, other_para = None)-> float: """Calculate the Asian option value using Monte Carlo method Args: self: you can get the testcases from self.Asian other_para: if you want to test you functions using other samples, please input a dictionary with the same format as \ the element of @self.Asian (i.e. {'sigma':p1, 'K': p2, 'n': p3, 'Type': p4}) Returns: A float number with the value of Asian option """ #TODO(Big Huang): 请开始你的表演 S0 = other_para['S'] K = other_para['K'] T = other_para['T'] r = other_para['r'] sigma = other_para['sigma'] M = other_para['n'] I = other_para['I'] Type = other_para['type'] c_v = other_para['c_v'] dt = T / M drift = np.exp((r - 0.5 * sigma ** 2) * dt) arith_Payoff = [] geo_Payoff = [] np.random.seed(10) for i in range(I): growth_factor = drift * np.exp(sigma * np.sqrt(dt) * np.random.randn()) path = [] for t in range(M): if t == 0: path.append(S0 * growth_factor) else: growth_factor = drift * np.exp(sigma * np.sqrt(dt) * np.random.randn()) S_t = path[t-1] * growth_factor path.append(S_t) arith_Mean = np.mean(path) geo_Mean = np.exp(np.sum(np.log(path)) / M) if Type == 'Call': arith_Payoff.append(np.exp(- r * T) * max(arith_Mean - K, 0)) geo_Payoff.append(np.exp(- r * T) * max(geo_Mean - K, 0)) elif Type == 'Put': arith_Payoff.append(np.exp(- r * T) * max(K - arith_Mean, 0)) geo_Payoff.append(np.exp(- r * T) * max(K - geo_Mean, 0)) Pmean = np.mean(arith_Payoff) Gmean = np.mean(geo_Payoff) Pstd = np.std(arith_Payoff) confmc = [Pmean - 1.96 * Pstd / np.sqrt(M),Pmean + 1.96 * Pstd / np.sqrt(M)] result_for_Standard_MC = {'Price':Pmean,'95% Confidence Interval':confmc} print(result_for_Standard_MC) if c_v == 'False': return result_for_Standard_MC elif c_v == 'True': #MC with Control Variate covXY = np.mean(np.multiply(arith_Payoff, geo_Payoff)) - Pmean * Gmean theta = covXY / np.var(geo_Payoff) geo_payoff_1 = [] para ={ 'K': K, 'T': T, 'S': S0, 'r': r, 'sigma': sigma, 'type': Type, 'n': M } geo = self.ClosedFormFormulas(para) for item in geo_Payoff: geo_payoff_1.append(geo - item) z = arith_Payoff + np.multiply(theta,geo_payoff_1) z_mean = np.mean(z) z_std = np.std(z) confcv = [z_mean - 1.96 * z_std / np.sqrt(M),z_mean + 1.96 * z_std / np.sqrt(M)] result_with_Control_Variate = {'Price':z_mean,'95% Confidence Interval':confcv} print(result_with_Control_Variate) return result_with_Control_Variate return -1 def MonteCarloBasketOption(self, other_para = None)-> float: """Calculate the Basket option value using Monte Carlo method Args: self: you can get the testcases from @self.Basket other_para: if you want to test you functions using other samples, please input a dictionary with the same format as \ the element of @self.Asian (i.e. {'S1':p1, 'S2': p2, 'K': p3, 'sigma1': p4, 'sigma2': p5, 'rho': p6, 'Type': p7}) Returns: A float number with the value of Basket option """ #TODO(Big Huang): 请开始你的表演 S0 = other_para['S'] K = other_para['K'] T = other_para['T'] r = other_para['r'] sigma = other_para['sigma'] #M = other_para['M'] M = 50 Type = other_para['type'] Rho_input = other_para['rho'] c_v = other_para['c_v'] I = other_para['I'] dt = T / M drift = {} for i in range(2): drift[i] = np.exp((r - 0.5 * sigma[i] ** 2) * dt) arith_Payoff = [] geo_Payoff = [] growth_factor = {} arith_Mean_1 = {} geo_Mean_1 = {} path_1 = {} np.random.seed(10) z_1 = np.random.randn() np.random.seed(5) z_2 = np.random.randn() for i in range(I): #calculate the initial growth factor if i == 0: growth_factor[0] = drift[0] * np.exp(sigma[0] * np.sqrt(dt) * z_1) growth_factor[1] = drift[1] * np.exp(sigma[1] * np.sqrt(dt) * (Rho_input[0] * z_1 + np.sqrt(1 - Rho_input[0]** 2) * z_2)) #calculate the growth factor else: z = np.random.randn() growth_factor[0] = drift[0] * np.exp(sigma[0] * np.sqrt(dt) * z) growth_factor[1] = drift[1] * np.exp(sigma[1] * np.sqrt(dt) * (Rho_input[0] * z + np.sqrt(1 - Rho_input[0]** 2) * np.random.randn())) path_1 = {} for j in range(2): path_1[j] = [] path_1[j].append(S0[j] * growth_factor[j]) #calculate the full path for t in range(1, M): #calculate the two standard normal distribution with Rho_input z = np.random.randn() growth_factor[0] = drift[0] * np.exp(sigma[0] * np.sqrt(dt) * z) growth_factor[1] = drift[1] * np.exp(sigma[1] * np.sqrt(dt) * (Rho_input[0] * z + np.sqrt(1 - (Rho_input[0])** 2) * np.random.randn())) #calculate the full path path_1 for j in range(2): S_t = path_1[j][t-1] * growth_factor[j] path_1[j].append(S_t) for j in range(2): arith_Mean_1[j] = np.mean(path_1[j]) geo_Mean_1[j] = np.exp(np.sum(np.log(path_1[j])) / M) sum_1 = 0 sum_2 = 0 if Type == 'Call': for j in range(2): sum_1 += np.exp(- r * T) * (arith_Mean_1[j] - K) sum_2 += np.exp(- r * T) * (geo_Mean_1[j] - K) arith_Payoff.append(np.exp(- r * T) * max(sum_1, 0)) geo_Payoff.append(np.exp(- r * T) * max(sum_2, 0)) elif Type == 'Put': for j in range(2): sum_1 += np.exp(- r * T) * (K - arith_Mean_1[j]) sum_2 += np.exp(- r * T) * (K - geo_Mean_1[j]) arith_Payoff.append(np.exp(- r * T) * max(K - arith_Mean_1[j], 0)) geo_Payoff.append(np.exp(- r * T) * max(K - geo_Mean_1[j], 0)) Pmean = np.mean(arith_Payoff) Gmean = np.mean(geo_Payoff) Pstd = np.std(arith_Payoff) confmc = [Pmean - 1.96 * Pstd / np.sqrt(M),Pmean + 1.96 * Pstd / np.sqrt(M)] result_for_standrad_MC = {'Arith_Price':Pmean,'Geo_Price':Gmean,'95% Confidence Interval':confmc} print(result_for_standrad_MC) if c_v == 'False': return result_for_standrad_MC elif c_v == 'True': #control Variate covXY = np.mean(np.multiply(arith_Payoff, geo_Payoff)) - Pmean * Gmean theta = covXY / np.var(geo_Payoff) para = { 'K': K, 't': T, 'S': S0, 'r': r, 'sigma': sigma, 'n': 2, 'rho': Rho_input, 'type': Type } geo = self.ClosedFormForBasketOption(other_para=para) geo_payoff_1 = [] for item in geo_Payoff: geo_payoff_1.append(geo - item) z = arith_Payoff + np.multiply(theta,geo_payoff_1) z_mean = np.mean(z) z_std = np.std(z) confcv = [z_mean - 1.96 * z_std / np.sqrt(M),z_mean + 1.96 * z_std / np.sqrt(M)] result_for_control_variate = {'Arith_Price':z_mean,'95% Confidence Interval':confcv} print(result_for_control_variate) return result_for_control_variate return -1 def BinomialTreeAmericanOption(self, other_para = None)-> float: S = other_para['S'] vol = other_para['vol'] r = other_para['r'] T = other_para['T'] K = other_para['K'] N = other_para['N'] Type = other_para['type'] dt = T/N u = math.exp(vol*math.sqrt(dt)) d = 1/u p = (math.exp(r*dt)-d)/(u-d) DF = math.exp(-r*dt) initial_asset = [S*(u**i *(d**(N-i))) for i in range(N+1)] if Type == 'Call': initial_asset = [max(0,s-K) for s in initial_asset] for i in range(N,0,-1): # in the i-round new_asset = [] for j in range(i-1,-1,-1): cur_S = S*(u**(j))*(d**(i-1-j)) op = max(cur_S-K,DF*(p*initial_asset[j+1]+(1-p)*initial_asset[j])) new_asset.append(op) initial_asset = new_asset[::-1] return initial_asset[0] elif Type == 'Put': initial_asset = [max(0,K-s) for s in initial_asset] for i in range(N,0,-1): # in the i-round new_asset = [] for j in range(i-1,-1,-1): cur_S = S*(u**(j))*(d**(i-1-j)) op = max(K-cur_S,DF*(p*initial_asset[j+1]+(1-p)*initial_asset[j])) new_asset.append(op) initial_asset = new_asset[::-1] return initial_asset[0] if __name__ == "__main__": ## example code OC = OptionCalculation() para = { 'S':100.0, 'vol': 0.3, 'r': 0.05, 'T': 3, 'K': 100.0, 'N': 50, 'type': 'Put' } value = OC.BinomialTreeAmericanOption(other_para=para) print("the option value is %f" %value) pass
C
UTF-8
3,143
2.859375
3
[]
no_license
float max_value1 = 0.00; float max_value2 = 0.00; float max_value3 = 0.00; float max_value4 = 0.00; float max_flag1 = 0; float max_flag2 = 0; float max_flag3 = 0; float max_flag4 = 0; int x; int count = 0; float sum_1 = 0; float sum_2 = 0; float sum_3 = 0; float sum_4 = 0; void setup() { // put your setup code here, to run once: Serial.begin (19200); pinMode(2,OUTPUT); pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); //at first give a HIGH voltage to the relay that will leave the switch on digitalWrite(2,LOW); digitalWrite(3,LOW); digitalWrite(4,LOW); digitalWrite(5,LOW); } void loop() { x=Serial.read(); unsigned long time1 = millis(); //give the command to capture the value of the 470ohm resistor float val_1=analogRead(A0); float val_2=analogRead(A1); float val_3=analogRead(A2); float val_4=analogRead(A3); //calculate the real voltage that pass through the resistors float volt_1=val_1*5.0/1023; float volt_2=val_2*5.0/1023; float volt_3=val_3*5.0/1023; float volt_4=val_4*5.0/1023; //Judgement on the circuit when to stop to protect, give a command to flip the switch on the relay if(volt_1>2.0||volt_2>2.0||volt_3>2.0||curr_4>2.0){ digitalWrite(2,HIGH); digitalWrite(3,HIGH); digitalWrite(4,HIGH); digitalWrite(5,HIGH); } // calculate the current that pass through the resistors float curr_1=volt_1/0.496; float curr_2=volt_2/0.484; float curr_3=volt_3/0.464; float curr_4=volt_4/0.464; //calculate the max_value for a while if (count < 100){ sum_1 = sum_1 + curr_1; sum_2 = sum_2 + curr_2; sum_3 = sum_3 + curr_3; sum_4 = sum_4 + curr_4; //sum_1 = sum_1 + curr_1; count = count + 1; } else{ max_value1 = 1.4142 * (sum_1) / count;max_flag1 = 1; max_value2 = 1.4142 * (sum_2) / count;max_flag2 = 1; max_value3 = 1.4142 * (sum_3) / count;max_flag3 = 1; max_value4 = 1.4142 * (sum_4) / count;max_flag4 = 1; count = 0; } /* if (curr_1 > max_value1){ max_value1 = curr_1; } else{ } if (curr_2 > max_value2){ max_value2 = curr_2; } else{ } if (curr_3 > max_value3){ max_value3 = curr_3; } else{ } if (curr_4> max_value4){ max_value4 = curr_4; } else{ } */ // serial print the voltage capture by the arduino based on // the four channels variable current to the resistor of 470ohm on your screen // this function can only be conducted when you connect your arduino to the computer, click the right-up button and monitor the variation //Serial.print(volt_1);Serial.print(" "); //Serial.print(volt_2);Serial.print(" "); //Serial.print(volt_3);Serial.print(" "); //Serial.print(curr_4);Serial.print(" "); //unsigned long time2 = millis(); //Serial.print(time2-time1);Serial.print(" "); if (max_flag1 == 1 & max_flag2 == 1 & max_flag3 == 1 & max_flag4 == 1){ Serial.print("p");// Serial.print(" "); Serial.print(max_value1 + max_value2,4);Serial.print(" "); //Serial.print(max_value2,4);Serial.print(" "); //Serial.print(max_value3,4);Serial.print(" "); Serial.print(max_value3 + max_value4,4);Serial.print(" "); Serial.print('\n'); //delay(); } /* if(x == 's'){ max_value1 = 0; max_value2 = 0; max_value3 = 0; max_value4 = 0; delay(2000); } */ }
Python
UTF-8
2,552
2.703125
3
[ "MIT" ]
permissive
#!/usr/bin/env python import os import glob import h5py import numpy as np from torch.utils.data import Dataset def download(data_dir): if not os.path.exists(data_dir): os.makedirs(data_dir) if not os.path.exists(os.path.join(data_dir, 'modelnet40_ply_hdf5_2048')): www = 'https://shapenet.cs.stanford.edu/media/modelnet40_ply_hdf5_2048.zip' zipfile = os.path.basename(www) os.system('wget %s; unzip %s' % (www, zipfile)) os.system('mv %s %s' % (zipfile[:-4], data_dir)) os.system('rm %s' % (zipfile)) def load_data(data_dir, partition): download(data_dir) all_data = [] all_label = [] for h5_name in glob.glob(os.path.join(data_dir, 'modelnet40_ply_hdf5_2048', 'ply_data_%s*.h5'%partition)): with h5py.File(h5_name, 'r') as f: data = f['data'][:].astype('float32') label = f['label'][:].astype('int64') all_data.append(data) all_label.append(label) all_data = np.concatenate(all_data, axis=0) all_label = np.concatenate(all_label, axis=0) return all_data, all_label def translate_pointcloud(pointcloud): """ for scaling and shifting the point cloud :param pointcloud: :return: """ scale = np.random.uniform(low=2. / 3., high=3. / 2., size=[3]) shift = np.random.uniform(low=-0.2, high=0.2, size=[3]) translated_pointcloud = np.add(np.multiply(pointcloud, scale), shift).astype('float32') return translated_pointcloud class ModelNet40(Dataset): """ This is the data loader for ModelNet 40 ModelNet40 contains 12,311 meshed CAD models from 40 categories. num_points: 1024 by default data_dir paritition: train or test """ def __init__(self, num_points=1024, data_dir="/data/deepgcn/modelnet40", partition='train'): self.data, self.label = load_data(data_dir, partition) self.num_points = num_points self.partition = partition def __getitem__(self, item): pointcloud = self.data[item][:self.num_points] label = self.label[item] if self.partition == 'train': pointcloud = translate_pointcloud(pointcloud) np.random.shuffle(pointcloud) return pointcloud, label def __len__(self): return self.data.shape[0] def num_classes(self): return np.max(self.label) + 1 if __name__ == '__main__': train = ModelNet40(1024) test = ModelNet40(1024, 'test') for data, label in train: print(data.shape) print(label.shape)
Java
UTF-8
1,371
2.21875
2
[]
no_license
package com.android.systemui.statusbar.policy; import android.content.Context; import android.os.Handler; import dagger.internal.Factory; import javax.inject.Provider; /* loaded from: classes.dex */ public final class HotspotControllerImpl_Factory implements Factory<HotspotControllerImpl> { private final Provider<Handler> backgroundHandlerProvider; private final Provider<Context> contextProvider; private final Provider<Handler> mainHandlerProvider; public HotspotControllerImpl_Factory(Provider<Context> provider, Provider<Handler> provider2, Provider<Handler> provider3) { this.contextProvider = provider; this.mainHandlerProvider = provider2; this.backgroundHandlerProvider = provider3; } @Override // javax.inject.Provider public HotspotControllerImpl get() { return newInstance(this.contextProvider.get(), this.mainHandlerProvider.get(), this.backgroundHandlerProvider.get()); } public static HotspotControllerImpl_Factory create(Provider<Context> provider, Provider<Handler> provider2, Provider<Handler> provider3) { return new HotspotControllerImpl_Factory(provider, provider2, provider3); } public static HotspotControllerImpl newInstance(Context context, Handler handler, Handler handler2) { return new HotspotControllerImpl(context, handler, handler2); } }
Markdown
UTF-8
4,209
2.875
3
[ "Apache-2.0" ]
permissive
# New Action Checklist So you have decided (or been asked to) add a new action to Plywood. That is great! Here are the general steps to do it. Written down to hopefully add some structure to your work. Let's assume that you are adding an action called `foo bar` 1. Make sure your idea is sensible. Think about it and maybe run it by other people who have added more actions than you. 1. Create the file `src/actions/fooBarAction.ts`. It might help to consider which existing actions are most similar to foo bar and to copy their file instead of staring from scratch. 1. Add the newly created file `src/actions/fooBarAction.ts` to [compile-tsc](/compile-tsc). 1. Edit `src/actions/fooBarAction.ts` to implement the action as best you can. * Ensure you implement a `class FooBarAction` that has the *action* type of `"fooBar"` * Ensure that any special properties are added to `ActionValue` and `ActionJS` interfaces in [baseAction.ts](src/actions/baseAction.ts) 1. Add a immutable class test of to [actions.ts](test/overall/actions.ts). Something that looks like `{ action: 'fooBar', ... }`. Ensure it works. 1. Add a `public fooBar(...): ChainExpression` to [baseExpression.ts](src/expressions/baseExpression.ts) that allows for the creation of this action via the JS API. Be mindful of the section that you put this function in. Ideally it should live with its own kind. 1. Add an entry for `*operand*.**fooBar**(...)` in the [expression docs](docs/expressions.md). Ensure that it is in the same relative order as the function in the previous step. Describe what *foo bar* does and add an example or two. 1. Add a test that ensures the native computation of this function is adequate. You probably want to add that test to [compute.mocha.js](test/overall/compute.mocha.js). 1. Add a test that ensures the correct parsing of this function by the expression parser. You probably want to add that test to [expressionParser.mocha.js](test/overall/expressionParser.mocha.js). 1. Think about any special conditions under which this action can be simplified and add the adequate simplification rules to `fooBarAction.ts` and tests to [simplify.mocha.js](test/overall/simplify.mocha.js). Some ideas of what to consider: * Is this action idempotent (`$x.fooBar(blah).fooBar(blah)` => `$x.fooBar(blah)`) or does it generally combine well with itself? Implement `_foldWithPrevAction`. * Is there a special 'zero' literal that, when acted upon, renders this action is irrelevant (e.g. `r(0).multiply(...whatever...)` => `r(0)`)? Implement `_performOnLiteral`. * Is there a special 'zero' condition that, when in the action, nukes the expression (e.g. `(...whatever...).multiply(0)` => `r(0)`)? Implement `_nukeExpression`. * Is there a special 'one' condition that, when in the action, renders the action useless (e.g. `(...whatever...).multiply(1)` => `(...whatever...)`)? Implement `_removeAction`. 1. Add this function to the PlyQL grammar in [plyql.pegjs](src/expressions/plyql.pegjs). * Figure out what names you will give this function. You should allow both `'FOO_BAR'` and whatever is standard to call it in general SQL dialects. In general PlyQL tries to be MySQL compliant so have a look if a similar function is implemented by MySQL. It is also possible that by adding this function you will facilitate some other function to be implemented (for example when `MatchAction` was added it allowed for `LIKE` and `REGEXP` to be implemented as well as `MATCH`). * Add all the names to the `reservedWords` list. * Create tokens for these names. 1. Add tests for `FOO_BAR` and all the other functions in the PlyQL parser. The tests go in [plyqlParser.mocha.js](test/overall/plyqlParser.mocha.js). 1. All actions should (preferably) be supported by all Externals. Add the functionality and tests accordingly. * MySQL External: [code](src/external/mySqlExternal.ts), [test](test/external/mySqlExternal.mocha.js) * Druid External: [code](src/external/druidExternal.ts), [test](test/external/druidExternal.mocha.js) 1. Lastly update the [CHANGELOG](CHANGELOG.md) and make a Pull Request!
Python
UTF-8
6,328
3.21875
3
[]
no_license
''' Qazi Umer Jamil 317920 NUST RIME SMME ''' import pygame #for GUI framework import copy #Initialize PyGame Environment pygame.init() screen = pygame.display.set_mode((720, 480)) clock = pygame.time.Clock() done = False #for quiting pygame window #Fonts for dislaying various texts font = pygame.font.SysFont("comicsansms", 60) fontState = pygame.font.SysFont("comicsansms", 30) fontTitle = pygame.font.SysFont("comicsansms", 45) def convertArray(arr): rslt = arr for i in range(0,3): for j in range(0,3): if arr[i][j] == 0: rslt[i][j] = "_" return rslt #Func to display puzzle state on the PyGame window def displayPuzzzle(STATE): STATE = convertArray(copy.deepcopy(STATE)) pos00 = font.render(str(STATE[0][0]), True, (255, 255, 255)) pos01 = font.render(str(STATE[0][1]), True, (255, 255, 255)) pos02 = font.render(str(STATE[0][2]), True, (255, 255, 255)) pos10 = font.render(str(STATE[1][0]), True, (255, 255, 255)) pos11 = font.render(str(STATE[1][1]), True, (255, 255, 255)) pos12 = font.render(str(STATE[1][2]), True, (255, 255, 255)) pos20 = font.render(str(STATE[2][0]), True, (255, 255, 255)) pos21 = font.render(str(STATE[2][1]), True, (255, 255, 255)) pos22 = font.render(str(STATE[2][2]), True, (255, 255, 255)) screen.blit(pos00, (280 - pos00.get_width() // 2, 160 - pos00.get_height() // 2)) screen.blit(pos01, (350 - pos01.get_width() // 2, 160 - pos01.get_height() // 2)) screen.blit(pos02, (420 - pos02.get_width() // 2, 160 - pos02.get_height() // 2)) screen.blit(pos10, (280 - pos10.get_width() // 2, 220 - pos10.get_height() // 2)) screen.blit(pos11, (350 - pos11.get_width() // 2, 220 - pos11.get_height() // 2)) screen.blit(pos12, (420 - pos12.get_width() // 2, 220 - pos12.get_height() // 2)) screen.blit(pos20, (280 - pos20.get_width() // 2, 280 - pos20.get_height() // 2)) screen.blit(pos21, (350 - pos21.get_width() // 2, 280 - pos21.get_height() // 2)) screen.blit(pos22, (420 - pos22.get_width() // 2, 280 - pos22.get_height() // 2)) #Func to display Start state on the PyGame window def displayStartState(STATE): STATE = convertArray(copy.deepcopy(STATE)) pos00 = font.render(str(STATE[0][0]), True, (255, 255, 255)) pos01 = font.render(str(STATE[0][1]), True, (255, 255, 255)) pos02 = font.render(str(STATE[0][2]), True, (255, 255, 255)) pos10 = font.render(str(STATE[1][0]), True, (255, 255, 255)) pos11 = font.render(str(STATE[1][1]), True, (255, 255, 255)) pos12 = font.render(str(STATE[1][2]), True, (255, 255, 255)) pos20 = font.render(str(STATE[2][0]), True, (255, 255, 255)) pos21 = font.render(str(STATE[2][1]), True, (255, 255, 255)) pos22 = font.render(str(STATE[2][2]), True, (255, 255, 255)) screen.blit(pos00, (50 - pos00.get_width() // 2, 160 - pos00.get_height() // 2)) screen.blit(pos01, (120 - pos01.get_width() // 2, 160 - pos01.get_height() // 2)) screen.blit(pos02, (190 - pos02.get_width() // 2, 160 - pos02.get_height() // 2)) screen.blit(pos10, (50 - pos10.get_width() // 2, 220 - pos10.get_height() // 2)) screen.blit(pos11, (120 - pos11.get_width() // 2, 220 - pos11.get_height() // 2)) screen.blit(pos12, (190 - pos12.get_width() // 2, 220 - pos12.get_height() // 2)) screen.blit(pos20, (50 - pos20.get_width() // 2, 280 - pos20.get_height() // 2)) screen.blit(pos21, (120 - pos21.get_width() // 2, 280 - pos21.get_height() // 2)) screen.blit(pos22, (190 - pos22.get_width() // 2, 280 - pos22.get_height() // 2)) #Func to display Goal State on the PyGame window def displayGoalState(STATE): STATE = convertArray(copy.deepcopy(STATE)) pos00 = font.render(str(STATE[0][0]), True, (255, 255, 255)) pos01 = font.render(str(STATE[0][1]), True, (255, 255, 255)) pos02 = font.render(str(STATE[0][2]), True, (255, 255, 255)) pos10 = font.render(str(STATE[1][0]), True, (255, 255, 255)) pos11 = font.render(str(STATE[1][1]), True, (255, 255, 255)) pos12 = font.render(str(STATE[1][2]), True, (255, 255, 255)) pos20 = font.render(str(STATE[2][0]), True, (255, 255, 255)) pos21 = font.render(str(STATE[2][1]), True, (255, 255, 255)) pos22 = font.render(str(STATE[2][2]), True, (255, 255, 255)) screen.blit(pos00, (520 - pos00.get_width() // 2, 160 - pos00.get_height() // 2)) screen.blit(pos01, (590 - pos01.get_width() // 2, 160 - pos01.get_height() // 2)) screen.blit(pos02, (660 - pos02.get_width() // 2, 160 - pos02.get_height() // 2)) screen.blit(pos10, (520 - pos10.get_width() // 2, 220 - pos10.get_height() // 2)) screen.blit(pos11, (590 - pos11.get_width() // 2, 220 - pos11.get_height() // 2)) screen.blit(pos12, (660 - pos12.get_width() // 2, 220 - pos12.get_height() // 2)) screen.blit(pos20, (520 - pos20.get_width() // 2, 280 - pos20.get_height() // 2)) screen.blit(pos21, (590 - pos21.get_width() // 2, 280 - pos21.get_height() // 2)) screen.blit(pos22, (660 - pos22.get_width() // 2, 280 - pos22.get_height() // 2)) #Func to display Text/Titles on the PyGame window def displayTitles(): pygame.draw.rect(screen, (255,0,0), (30,130,190,175)) pygame.draw.rect(screen, (0,255,0), (260,130,190,175)) pygame.draw.rect(screen, (0,0,255), (490,130,190,175)) start = fontState.render("INITAL STATE", True, (0, 0, 0)) screen.blit(start, (120 - start.get_width() // 2, 320 - start.get_height() // 2)) current = fontState.render("CURRENT STATE", True, (0, 0, 0)) screen.blit(current, (350 - current.get_width() // 2, 320 - current.get_height() // 2)) end = fontState.render("GOAL STATE", True, (0, 0, 0)) screen.blit(end, (580 - end.get_width() // 2, 320 - end.get_height() // 2)) start = fontTitle.render("8 Puzzle Problem using A*- Search", True, (0, 0, 0)) screen.blit(start, (360 - start.get_width() // 2, 50 - start.get_height() // 2)) def diplayResult(str): start = fontTitle.render(str, True, (0, 0, 0)) screen.blit(start, (360 - start.get_width() // 2, 420 - start.get_height() // 2))
C
UTF-8
357
3.28125
3
[]
no_license
#include <stdlib.h> #include <stdio.h> #include <unistd.h> const int PIPE_READ = 0; const int PIPE_WRITE = 1; int myPipe[2]; int main() { if (pipe(myPipe) == 0) { char myArray[8]; write(myPipe[PIPE_WRITE], "hello!\n", 8); read (myPipe[PIPE_READ], myArray, 8); printf(myArray); } return(EXIT_SUCCESS); }
Java
UTF-8
514
2.25
2
[]
no_license
package com.zingking.bricks.event; import com.zingking.bricks.entity.MathPoint; /** * Copyright (c) 2019, Z.kai All rights reserved. * * @author Z.kai * @date 2019/3/14 * @description EventBus 小球碰撞事件 */ public class BallCrashEvent { /** * 发生碰撞的砖块的数学坐标点 */ private MathPoint mathPoint; public BallCrashEvent(MathPoint mathPoint) { this.mathPoint = mathPoint; } public MathPoint getMathPoint() { return mathPoint; } }
C++
UTF-8
1,535
3.234375
3
[]
no_license
#include "Word.h" #include "Tag.h" const Word Word::And("&&", Tag::AND); const Word Word::Or("||", Tag::OR); const Word Word::eq("==", Tag::EQ); const Word Word::ne("!=", Tag::NE); const Word Word::le("<=", Tag::LE); const Word Word::ge(">=", Tag::GE); const Word Word::minus("minus", Tag::MINUS); const Word Word::True("true", Tag::TRUE); const Word Word::False("false", Tag::FALSE); const Word Word::temp( "t", Tag::TEMP); #include <iostream> using namespace std; string Word::toString() { string type; switch( Word::tg ) { case 256: type = "AND"; break; case 257: type = "BASIC"; break; case 258: type = "BREAK"; break; case 259: type = "DO"; break; case 260: type = "ELSE"; break; case 261: type = "EQ"; break; case 262: type = "FALSE"; break; case 263: type = "GE"; break; case 264: type = "ID"; break; case 265: type = "IF"; break; case 266: type = "INDEX"; break; case 267: type = "LE"; break; case 268: type = "MINUS"; break; case 269: type = "NE"; break; case 270: type = "NUM"; break; case 271: type = "OR"; break; case 272: type = "REAL"; break; case 273: type = "TEMP"; break; case 274: type = "TURE"; break; case 275: type = "WHILE"; break; default: type = "BASIC"; break; } return lexeme + "\t\t(" + type + ")"; } bool Word::operator==( Word w ) { return Token::operator==( w ) && this->lexeme == w.lexeme; }
JavaScript
UTF-8
4,396
3.125
3
[ "MIT" ]
permissive
import { CSV_POSTFIX, XML_POSTFIX, TXT_POSTFIX } from '../../../consts'; function checkNumberOrStringTypeByFormat(subjectVariable, format) { switch (format) { case XML_POSTFIX: return typeof subjectVariable['#text'] === 'string' || !Number.isNaN(parseInt(subjectVariable['#text'], 10)); default: return typeof subjectVariable === 'string' || typeof subjectVariable === 'number'; } } function checkStringTypeByFormat(subjectVariable, format) { switch (format) { case XML_POSTFIX: return typeof subjectVariable['#text'] === 'string'; default: return typeof subjectVariable === 'string'; } } function checkNumberTypeByFormat(subjectVariable, format) { switch (format) { case CSV_POSTFIX: return !Number.isNaN(Number.parseInt(subjectVariable, 10)) && typeof Number.parseInt(subjectVariable, 10) === 'number'; case TXT_POSTFIX: return !Number.isNaN(subjectVariable) && typeof subjectVariable === 'number'; case XML_POSTFIX: return !Number.isNaN(parseInt(subjectVariable['#text'], 10)); default: return typeof subjectVariable === 'number'; } } // important - does not check for length function assertObjectType(expectedType, subjectVariable, format) { switch (expectedType) { case 'number': return checkNumberTypeByFormat(subjectVariable, format); case 'string': return checkStringTypeByFormat(subjectVariable, format); case 'number|string': return checkNumberOrStringTypeByFormat(subjectVariable, format); case 'object': return typeof subjectVariable === 'object'; case 'array': return Array.isArray(subjectVariable); case 'array:number': return Array.isArray(subjectVariable) && subjectVariable.filter(entry => typeof entry !== 'number').length === 0; case 'array:object': return Array.isArray(subjectVariable) && subjectVariable.filter(entry => typeof entry !== 'object').length === 0; default: return true; } } function checkArrayElements(array, name, format, { elementsType, length, maxLength, minLength, evenOdd, }) { if (length && array.length !== length) { return { error: true, message: `${name} array must contain ${length} elements but instead found ${array.length}` }; } if (maxLength && array.length > maxLength) { return { error: true, message: `${name} array must contain ${maxLength} elements at most but instead found ${array.length}` }; } if (minLength && array.length < minLength) { return { error: true, message: `${name} array must contain at least ${minLength} elements but instead found ${array.length}` }; } if (evenOdd && ((evenOdd === 'even' && array.length % 2 === 1) || (evenOdd === 'odd' && array.length % 2 === 0))) { return { error: true, message: `${name} array must contain an even number of elements but instead found ${array.length}` }; } if (elementsType && !assertObjectType(elementsType, array, format)) { return { error: true, message: `${name} array contains elements of incorrect type` }; } return { error: false, message: '' }; } function checkObjectProperties(requiredProperties, subjectObject, format, entitiesType) { const undefinedProperties = []; Object.keys(requiredProperties).forEach((property) => { if (subjectObject[property] === undefined) { undefinedProperties.push(property); } }); if (undefinedProperties.length > 0) { return { error: true, message: `The following ${entitiesType} have not been found: ${undefinedProperties.join(', ')}` }; } const nullProperties = []; Object.keys(requiredProperties).forEach((property) => { if (subjectObject[property] === null) { nullProperties.push(property); } }); if (nullProperties.length > 0) { return { error: true, message: `The following ${entitiesType} are null: ${nullProperties}` }; } const incorrectTypeProperties = []; Object.keys(requiredProperties).forEach((property) => { if (!assertObjectType(requiredProperties[property], subjectObject[property], format)) { incorrectTypeProperties.push(property); } }); if (incorrectTypeProperties.length > 0) { return { error: true, message: `The following ${entitiesType} contain an incorrect type: ${incorrectTypeProperties}` }; } return { error: false, message: '' }; } export { assertObjectType, checkObjectProperties, checkArrayElements };
PHP
UTF-8
6,291
2.5625
3
[ "MIT" ]
permissive
<?php /** * Created by PhpStorm. * User: Kuylim * Date: 12/28/2016 * Time: 08:12 */ namespace App\Http\Controllers; use App\Http\Model\Products; use Illuminate\Routing\Controller as BaseController; /** * Class ProductController * * @package App\Http\Controllers */ class ProductController extends ApiController { protected $product = null; public function __construct(Products $product){ $this->product = $product; } /** * Display a listing of the resource. * * @return \Illuminate\Http\JsonResponse * * @SWG\Get( * path="/products", * description="Return all products", * operationId="finadAllProduct", * produces={"application/json"}, * tags={"Product"}, * @SWG\Response( * response=200, * description="Product Not Found" * ), * @SWG\Response( * response=401, * description="Unauthorized action.", * ) * ) */ public function allProducts(){ return response() -> json($this->product->allProducts(), 200); } /** * @SWG\Get( * path="/products/{id}", * description="Returns a product based on a single ID", * operationId="findProductById", * tags={"Product"}, * @SWG\Parameter( * description="ID of product to fetch", * format="int64", * in="path", * name="id", * required=true, * type="integer" * ), * produces={ * "application/json", * "application/xml", * "text/html", * "text/xml" * }, * @SWG\Response( * response=200, * description="product found", * ), * @SWG\Response( * response="default", * description="unexpected error", * ) * ) */ public function getProduct($id){ $product = $this->product->getProduct($id); if(!$product){ return response() -> json(['response' => 'Product not found'], 400); } return response() -> json($product,200); } /** * @SWG\Post( * path="/products", * operationId="addProduct", * description="Add a new product.", * produces={"application/json"}, * tags={"Product"}, * @SWG\Parameter( * name="product", * in="body", * description="Product to add to the Database", * required=true, * ), * @SWG\Response( * response=200, * description="Save Product Success", * ), * @SWG\Response( * response="default", * description="unexpected error", * ) * ) */ public function saveProduct(){ return response() -> json($this->product->saveProduct(), 200); } /** * @SWG\Put( * path="/products/{id}", * operationId="updateProduct", * description="Update old product.", * produces={"application/json"}, * tags={"Product"}, * @SWG\Parameter( * description="ID of product to update", * format="int64", * in="path", * name="id", * required=true, * type="integer" * ), * @SWG\Parameter( * name="user", * in="body", * description="Product to update to the database", * required=true, * ), * @SWG\Response( * response=200, * description="Save Product Success", * ), * @SWG\Response( * response="default", * description="unexpected error", * ) * ) */ public function updateProduct($id){ $product = $this->product->updateProduct($id); if(!$product){ return response() -> json(['response' => 'Product not found'], 400); } return response() -> json($product,200); } /** * @SWG\Delete( * path="/products/{id}", * description="deletes a single product based on the product id", * operationId="deleteProduct", * tags={"Product"}, * @SWG\Parameter( * description="ID of product to delete", * format="int64", * in="path", * name="id", * required=true, * type="integer" * ), * @SWG\Response( * response=200, * description="product deleted success" * ), * @SWG\Response( * response="default", * description="unexpected error", * ) * ) */ public function deleteProduct($id){ $product = $this->product->deleteProduct($id); if(!$product){ return response() -> json(['response' => 'Product not found'], 400); } return response() -> json(['response' => 'delete product success.'],200); } /** * @SWG\Get( * path="/products/search/{name}", * description="Returns a product based on a name", * operationId="findProductByName", * tags={"Product"}, * @SWG\Parameter( * description="name of product to fetch", * format="String", * in="path", * name="name", * required=true, * type="String" * ), * produces={ * "application/json", * "application/xml", * "text/html", * "text/xml" * }, * @SWG\Response( * response=200, * description="product found", * ), * @SWG\Response( * response="default", * description="unexpected error", * ) * ) */ public function getProductName($name){ $product = $this->product->getProductName($name); if(!$product){ return response() -> json(['response' => 'Product not found'], 400); } return response() -> json($product,200); } }
Swift
UTF-8
9,861
2.78125
3
[ "MIT" ]
permissive
// // PrintInformationOperation.swift // // The MIT License (MIT) // // Copyright (c) 2016 Bartosz Janda // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. import Foundation // MARK: - Protocols // MARK: InformationNameStringConvertible private protocol InformationNameStringConvertible { var informationName: String { get } } extension ScaleFactor: InformationNameStringConvertible { fileprivate var informationName: String { switch self { case .scale1x: return "@1x" case .scale2x: return "@2x" case .scale3x: return "@3x" } } } // MARK: InformationPrintable private protocol InformationPrintable { func printWithLabel(label: String) } private extension InformationPrintable where Self: RawRepresentable & IncorrectValueAssertion { func printWithLabel(label: String) { var text = " \(label): \(self) (\(self.rawValue))" if !self.assertIncorrectValue() { text += " INCORRECT!" } print(text) } } private extension InformationPrintable where Self: InformationNameStringConvertible & IncorrectValueAssertion { func printWithLabel(label: String) { var text = " \(label): \(self.informationName)" if !self.assertIncorrectValue() { text += " INCORRECT!" } print(text) } } extension CUIDeviceIdiom: InformationPrintable { } extension CUISubtype: InformationPrintable { } extension CUIUserInterfaceSizeClass: InformationPrintable { } extension CUIRenderMode: InformationPrintable { } extension CUIResizingMode: InformationPrintable { } extension CUIImageType: InformationPrintable { } extension CUIGraphicalClass: InformationPrintable { func printWithLabel(label: String) { } } extension CUIMemoryClass: InformationPrintable { func printWithLabel(label: String) { } } // MARK: - PrintInformationOperation struct PrintInformationOperation: Operation { let verbose: Verbose enum Verbose { case name case verbose case veryVerbose case veryVeryVerbose } func read(catalog: AssetsCatalog) { print("Assets catalog: \(catalog.filePath)") for imageSet in catalog.imageSets { printImageSetData(imageSet: imageSet) } } /** Print image set data depending on the verbosity level, - parameter imageSet: Image set. */ private func printImageSetData(imageSet: ImageSet) { switch verbose { case .name: print("\(imageSet.name)") case .verbose: print("\(escapeSeq+boldSeq)\(imageSet.name)\(escapeSeq+resetSeq): \(imageSetData(imageSet: imageSet))") _ = imageSetData(imageSet: imageSet) case .veryVerbose: print("\(escapeSeq+boldSeq)\(imageSet.name)\(escapeSeq+resetSeq):") for namedImage in imageSet.namedImages { printNamedImageShortData(namedImage: namedImage) } case .veryVeryVerbose: print("Name: \(escapeSeq+boldSeq)\(imageSet.name)\(escapeSeq+resetSeq)") for namedImage in imageSet.namedImages { printNamedImageVerboseData(namedImage: namedImage) } } } /** Returns basic image set data. - parameter imageSet: Image set. - returns: Image set basic data */ private func imageSetData(imageSet: ImageSet) -> String { // Combine information for given idiom. // 1. Filter images for given idiom. // 2. Map image to "string" representation. func deviceInfo(idiom: CUIDeviceIdiom) -> String? { let images = imageSet.namedImages.filter({ $0.idiom() == idiom }).map { image -> String in let pdf = image.acIsPDF ? "PDF" : "" return "\(pdf+image.subtype().name+image.acScale.informationName+image.acSizeClassString)" } guard images.count > 0 else { return nil } return "\(idiom): \(images.joined(separator: ","))" } // Create output for every idiom. let output = CUIDeviceIdiom.allValues.map { deviceInfo(idiom: $0) }.compactMap({ $0 }) return output.joined(separator: ", ") } /** Print named image name. - parameter namedImage: Named image. */ private func printNamedImageShortData(namedImage: CUINamedImage) { print(" \(namedImage.acImageName)") } /** Print named image verbose logs. - parameter namedImage: Named image. */ private func printNamedImageVerboseData(namedImage: CUINamedImage) { func printProperty(label: String, value: Any?) { if let value = value { print(" \(label): \(value)") } else { print(" \(label): \(value ?? "")") } } print(" \(namedImage.acImageName):") // // CUINamedLookup printProperty(label: "name", value: namedImage.name) printProperty(label: "renditionName", value: namedImage.renditionName()) // renditionKey() -> CUIRenditionKey // printProperty("rendition key", value: namedImage.renditionKey()) namedImage.renditionKey().themeGraphicsClass().printWithLabel(label: "rendition key graphical class") namedImage.renditionKey().themeMemoryClass().printWithLabel(label: "rendition key memory class") // _rendition() -> CUIThemeRendition printProperty(label: "rendition name", value: namedImage._rendition().name()) namedImage._rendition().type().printWithLabel(label: "rendition type") printProperty(label: "rendition subtype", value: namedImage._rendition().subtype()) printProperty(label: "rendition UTI type", value: namedImage._rendition().utiType()) printProperty(label: "rendition data", value: namedImage._rendition().data()) printProperty(label: "rendition pdf", value: namedImage._rendition().pdfDocument()) printProperty(label: "rendition image", value: namedImage._rendition().unslicedImage()) // printProperty("rendition slice information", value: namedImage._rendition().sliceInformation()?.description()) printProperty(label: "rendition slice edgeInsets", value: namedImage._rendition().sliceInformation()?.edgeInsets) printProperty(label: "rendition slice destinationRect", value: namedImage._rendition().sliceInformation()?.destinationRect) namedImage._rendition().sliceInformation()?.renditionType.printWithLabel(label: "rendition slice renditionType") printProperty(label: "rendition slice _bottomRightCapSize", value: namedImage._rendition().sliceInformation()?._bottomRightCapSize()) printProperty(label: "rendition slice _topLeftCapSize", value: namedImage._rendition().sliceInformation()?._topLeftCapSize()) // // CUINamedImage namedImage.imageType.printWithLabel(label: "imageType") namedImage.idiom().printWithLabel(label: "idiom") namedImage.subtype().printWithLabel(label: "subtype") printProperty(label: "scale", value: namedImage.acScale.informationName) namedImage.sizeClassHorizontal().printWithLabel(label: "size vlass horizontal") namedImage.sizeClassVertical().printWithLabel(label: "size vlass vertical") namedImage.graphicsClass().printWithLabel(label: "graphics class") namedImage.memoryClass().printWithLabel(label: "memory class") printProperty(label: "opacity", value: namedImage.opacity) printProperty(label: "size", value: namedImage.size) printProperty(label: "blend mode", value: namedImage.blendMode) namedImage.resizingMode.printWithLabel(label: "resizing mode") printProperty(label: "is template", value: namedImage.isTemplate) printProperty(label: "vector based", value: namedImage.isVectorBased) printProperty(label: "hasAlignmentInformation", value: namedImage.hasAlignmentInformation) printProperty(label: "hasSliceInformation", value: namedImage.hasSliceInformation) namedImage.templateRenderingMode.printWithLabel(label: "template rendering mode") printProperty(label: "edge insets", value: namedImage.edgeInsets) printProperty(label: "alignment edge insets", value: namedImage.alignmentEdgeInsets) printProperty(label: "exifOrientation", value: namedImage.exifOrientation) printProperty(label: "image", value: namedImage.image) // baseKey -> CUIRenditionKey // printProperty(label: "base key", value: namedImage.baseKey()) namedImage.baseKey().themeGraphicsClass().printWithLabel(label: "base key graphical class") namedImage.baseKey().themeMemoryClass().printWithLabel(label: "base key memory class") } }
C#
UTF-8
4,195
2.84375
3
[ "MIT" ]
permissive
using Microsoft.Xna.Framework; using Relatus.Graphics; using System; using System.Collections.Generic; using System.Globalization; using System.Text; namespace Relatus.Debug { public class DebugEntry : IDisposable { #region Properties /// <summary> /// A unique name used for retrieval. /// </summary> public string Name { get; private set; } /// <summary> /// A composite format string. /// </summary> public string Format { get; set; } /// <summary> /// The information that will be used during formatting. /// </summary> public string[] Information { get; private set; } /// <summary> /// The final text after formatting the information. /// </summary> public string Content { get { return entryText.Content; } } #endregion #region Fields private readonly Text entryText; #endregion /// <summary> /// Creates a useful text entry that can be added to the <see cref="DebugManager"/> and displayed during in-game debugging. /// </summary> /// <param name="name">A unique name used for retrieval.</param> /// <param name="format">A composite format string.</param> public DebugEntry(string name, string format) { Name = name; Format = format; Information = new string[] { "" }; Vector2 position = DebugManager.NextDebugEntryPosition(); entryText = new Text(position.X, position.Y, "", FontType.Probity); } /// <summary> /// Sets the entries information, formats the new information, and updates the display. /// </summary> /// <param name="information"></param> /// <exception cref="FormatException"></exception> public void SetInformation(params object[] information) { string[] informationAsString = new string[information.Length]; for (int i = 0; i < information.Length; i++) { informationAsString[i] = information[i].ToString(); } try { string.Format(CultureInfo.InvariantCulture, Format, informationAsString); } catch (FormatException e) { throw new RelatusException("The amount of information provided is incompatible with the current format string.", e); } Information = informationAsString; FormatEntry(); } private void FormatEntry() { entryText.SetContent(string.Format(CultureInfo.InvariantCulture, Format, Information)); } public void Draw(Camera camera) { entryText.Draw(camera); } #region IDisposable Support private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { entryText.Dispose(); } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } } // TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources. // ~DebugEntry() // { // // Do not change this code. Put cleanup code in Dispose(bool disposing) above. // Dispose(false); // } // This code added to correctly implement the disposable pattern. public void Dispose() { // Do not change this code. Put cleanup code in Dispose(bool disposing) above. Dispose(true); // TODO: uncomment the following line if the finalizer is overridden above. // GC.SuppressFinalize(this); } #endregion } }
Python
UTF-8
5,097
2.65625
3
[ "MIT" ]
permissive
#!/usr/bin/env python from __future__ import division, absolute_import, print_function """ File list functions. Provided functions ------------------ fullnames Filenames with absolute paths in local directories. fullnames_dates Filenames with absolute paths and modification times in local directories. fullnames_dates_sizes Filenames with absolute paths, modification times, and file sizes in local directories. fullnames_sizes Filenames with absolute paths and file sizes in local directories. fullnames_times Wrapper for fullnames_dates. fullnames_times_sizes Wrapper for fullnames_dates_sizes. last_fullname Filename with absolute paths of last file in local directories. last_fullname_date Filename with absolute paths and modification time of last file in local directories. last_fullname_date_size Filename with absolute paths, modification time, and file size of last file in local directories. last_fullname_size Filename with absolute paths and file size of last file in local directories. last_fullname_time Wrapper for last_fullname_date. last_fullname_time_size Wrapper for last_fullname_date_size. last_name Filename of last file in local directories. last_name_date Filename and modification time of last file in local directories. last_name_date_size Filename, modification time, and file size of last file in local directories. last_name_size Filename and file size of last file in local directories. last_name_time Wrapper for last_name_date. last_name_date_size Wrapper for last_name_date_size. names Filenames in local directories. names_dates Filenames and modification times in local directories. names_dates_sizes Filenames, modification times, and file sizes in local directories. names_sizes Filenames and file sizes in local directories. names_times Wrapper for names_dates. names_times_sizes Wrapper for names_dates_sizes. newest_fullname Wrapper for last_fullname. newest_fullname_date Wrapper for last_fullname_date. newest_fullname_date_size Wrapper for last_fullname_date_size. newest_fullname_size Wrapper for last_fullname_size. newest_fullname_time Wrapper for last_fullname_date. newest_fullname_time_size Wrapper for last_fullname_date_size. newest_name Wrapper for last_name. newest_name_date Wrapper for last_name_date. newest_name_date_size Wrapper for last_name_date_size. newest_name_size Wrapper for last_name_size. newest_name_time Wrapper for newest_name_date. newest_name_date_size Wrapper for newest_name_date_size. Example ------- import os # get .dat filenames with asolute paths in directories 2013, 2014, ... fls = fullnames('*.dat', dirs=glob.glob('[0-9][0-9][0-9][0-9]')) # get .dat filenames and sizes in current directory os.chdir('change/directory') fls, flssize = names_sizes('*.dat') # get all filenames and modification times in current directory fls, flstimes = names_times() License ------- This file is part of the JAMS Python package, distributed under the MIT License. The JAMS Python package originates from the former UFZ Python library, Department of Computational Hydrosystems, Helmholtz Centre for Environmental Research - UFZ, Leipzig, Germany. Copyright (c) 2014 Matthias Cuntz - mc (at) macu (dot) de Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. History ------- Written, MC, Jun-Dec 2014 """ from .files import * # Information __author__ = "Matthias Cuntz" __version__ = '1.0' __revision__ = "Revision: 1923" __date__ = 'Date: 05.12.2014'
Ruby
UTF-8
97
2.515625
3
[]
no_license
de hash = { : elemento1 => 1 , : elemento2 => 2 } pone hash hash.delete ( : elemento2 ) pone hash
JavaScript
UTF-8
1,353
2.734375
3
[]
no_license
window.onload=function(){ search(); secondkill(); }; /*头部搜索*/ var search=function(){ /*搜索框对象*/ var search=document.getElementsByClassName('jd_header_box')[0]; /*搜索框对象*/ var banner=document.getElementsByClassName('jd_nav')[0]; /*高度*/ var height=banner.offsetHeight; window.onscroll=function(){ var top=document.body.scrollTop; /*当滚动高度大于banner的高度的时候颜色不变*/ if(top>height){ search.style.background="rgba(201,21,35,0.85)"; }else{ var op=top/height*0.85; search.style.background="rgba(201,21,35,"+op+")"; } }; }; /*秒杀倒计时*/ var secondkill=function(){ /*首先获取显示时间的6个框*/ /*父盒子*/ var parentTime=document.getElementsByClassName('sk_time')[0]; /*span时间*/ var time_list=parentTime.getElementsByClassName('num'); console.log(time_list.length); var times=4*60*60; setInterval(function(){ times--; var h=Math.floor(times/(60*60)); var m=Math.floor((times/60)%60); var s=times%60; console.log(h+"-"+m+"-"); time_list[0].innerHTML=h>10?Math.floor(h/10):0; time_list[1].innerHTML=h%10; time_list[2].innerHTML=m>10?Math.floor(m/10):0; time_list[3].innerHTML=m%10; time_list[4].innerHTML=s>10?Math.floor(s/10):0; time_list[5].innerHTML=s%10; },1000); }
SQL
UTF-8
21,178
3.15625
3
[]
no_license
CREATE DATABASE IF NOT EXISTS `hibernate` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `hibernate`; -- MySQL dump 10.13 Distrib 5.5.57, for debian-linux-gnu (x86_64) -- -- Host: 127.0.0.1 Database: hibernate -- ------------------------------------------------------ -- Server version 5.5.57-0ubuntu0.14.04.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `A` -- DROP TABLE IF EXISTS `A`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `A` ( `A_ID` int(11) NOT NULL AUTO_INCREMENT, `A_VALUE` varchar(45) NOT NULL, PRIMARY KEY (`A_ID`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `A` -- LOCK TABLES `A` WRITE; /*!40000 ALTER TABLE `A` DISABLE KEYS */; INSERT INTO `A` VALUES (1,'A_VALUE'); /*!40000 ALTER TABLE `A` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `AA` -- DROP TABLE IF EXISTS `AA`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `AA` ( `AA_ID` int(11) NOT NULL AUTO_INCREMENT, `AA_VALUE` varchar(45) NOT NULL, `A_ID` int(11) NOT NULL, PRIMARY KEY (`AA_ID`), KEY `fk_AA_1_idx` (`A_ID`), CONSTRAINT `fk_AA_1` FOREIGN KEY (`A_ID`) REFERENCES `A` (`A_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `AA` -- LOCK TABLES `AA` WRITE; /*!40000 ALTER TABLE `AA` DISABLE KEYS */; INSERT INTO `AA` VALUES (1,'AA_1',1),(2,'AA_2',1); /*!40000 ALTER TABLE `AA` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `AAA` -- DROP TABLE IF EXISTS `AAA`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `AAA` ( `AAA_ID` int(11) NOT NULL AUTO_INCREMENT, `AAA_VALUE` varchar(45) NOT NULL, `AA_ID` int(11) NOT NULL, PRIMARY KEY (`AAA_ID`), KEY `fk_AAA_1_idx` (`AA_ID`), CONSTRAINT `fk_AAA_1` FOREIGN KEY (`AA_ID`) REFERENCES `AA` (`AA_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `AAA` -- LOCK TABLES `AAA` WRITE; /*!40000 ALTER TABLE `AAA` DISABLE KEYS */; INSERT INTO `AAA` VALUES (1,'AAA_1',1),(2,'AAA_2',2),(3,'AAA_3',2); /*!40000 ALTER TABLE `AAA` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `AAAZ` -- DROP TABLE IF EXISTS `AAAZ`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `AAAZ` ( `AAA_ID` int(11) NOT NULL, `AAAZ_VALUE` varchar(45) DEFAULT NULL, PRIMARY KEY (`AAA_ID`), CONSTRAINT `fk_AAAZ_ID` FOREIGN KEY (`AAA_ID`) REFERENCES `AAA` (`AAA_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `AAAZ` -- LOCK TABLES `AAAZ` WRITE; /*!40000 ALTER TABLE `AAAZ` DISABLE KEYS */; INSERT INTO `AAAZ` VALUES (1,'AAAZ_VALUE'); /*!40000 ALTER TABLE `AAAZ` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `AAB` -- DROP TABLE IF EXISTS `AAB`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `AAB` ( `AAB_ID` int(11) NOT NULL AUTO_INCREMENT, `AAB_VALUE` varchar(45) NOT NULL, `AA_ID` int(11) NOT NULL, PRIMARY KEY (`AAB_ID`), KEY `fk_AAB_1_idx` (`AA_ID`), CONSTRAINT `fk_AAB_1` FOREIGN KEY (`AA_ID`) REFERENCES `AA` (`AA_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `AAB` -- LOCK TABLES `AAB` WRITE; /*!40000 ALTER TABLE `AAB` DISABLE KEYS */; INSERT INTO `AAB` VALUES (1,'AAB_1',1),(2,'AAB_2',2),(3,'AAA_3',2); /*!40000 ALTER TABLE `AAB` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `AABZ` -- DROP TABLE IF EXISTS `AABZ`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `AABZ` ( `AAB_ID` int(11) NOT NULL, `AABZ_VALUE` varchar(45) DEFAULT NULL, PRIMARY KEY (`AAB_ID`), CONSTRAINT `fk_AABZ_ID` FOREIGN KEY (`AAB_ID`) REFERENCES `AAB` (`AAB_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `AABZ` -- LOCK TABLES `AABZ` WRITE; /*!40000 ALTER TABLE `AABZ` DISABLE KEYS */; INSERT INTO `AABZ` VALUES (1,'AABZ_VALUE'); /*!40000 ALTER TABLE `AABZ` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `AAC` -- DROP TABLE IF EXISTS `AAC`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `AAC` ( `AAC_ID` int(11) NOT NULL AUTO_INCREMENT, `AAC_VALUE` varchar(45) NOT NULL, `AA_ID` int(11) NOT NULL, PRIMARY KEY (`AAC_ID`), KEY `fk_AAC_1_idx` (`AA_ID`), CONSTRAINT `fk_AAC_1` FOREIGN KEY (`AA_ID`) REFERENCES `AA` (`AA_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `AAC` -- LOCK TABLES `AAC` WRITE; /*!40000 ALTER TABLE `AAC` DISABLE KEYS */; INSERT INTO `AAC` VALUES (1,'AAC_1',1),(2,'AAC_2',2),(3,'AAC_3',2); /*!40000 ALTER TABLE `AAC` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `AACZ` -- DROP TABLE IF EXISTS `AACZ`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `AACZ` ( `AAC_ID` int(11) NOT NULL, `AACZ_VALUE` varchar(45) DEFAULT NULL, PRIMARY KEY (`AAC_ID`), CONSTRAINT `fk_AACZ_ID` FOREIGN KEY (`AAC_ID`) REFERENCES `AAC` (`AAC_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `AACZ` -- LOCK TABLES `AACZ` WRITE; /*!40000 ALTER TABLE `AACZ` DISABLE KEYS */; INSERT INTO `AACZ` VALUES (1,'AACZ_VALUE'); /*!40000 ALTER TABLE `AACZ` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `AAZ` -- DROP TABLE IF EXISTS `AAZ`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `AAZ` ( `AA_ID` int(11) NOT NULL, `AAZ_VALUE` varchar(45) DEFAULT NULL, PRIMARY KEY (`AA_ID`), CONSTRAINT `fk_AAZ_ID` FOREIGN KEY (`AA_ID`) REFERENCES `AA` (`AA_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `AAZ` -- LOCK TABLES `AAZ` WRITE; /*!40000 ALTER TABLE `AAZ` DISABLE KEYS */; INSERT INTO `AAZ` VALUES (1,'AAZ_VALUE'); /*!40000 ALTER TABLE `AAZ` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `AB` -- DROP TABLE IF EXISTS `AB`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `AB` ( `AB_ID` int(11) NOT NULL AUTO_INCREMENT, `AB_VALUE` varchar(45) NOT NULL, `A_ID` int(11) NOT NULL, PRIMARY KEY (`AB_ID`), KEY `fk_AB_1_idx` (`A_ID`), CONSTRAINT `fk_AB_1` FOREIGN KEY (`A_ID`) REFERENCES `A` (`A_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `AB` -- LOCK TABLES `AB` WRITE; /*!40000 ALTER TABLE `AB` DISABLE KEYS */; INSERT INTO `AB` VALUES (1,'AB_1',1),(2,'AB_2',1); /*!40000 ALTER TABLE `AB` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ABA` -- DROP TABLE IF EXISTS `ABA`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ABA` ( `ABA_ID` int(11) NOT NULL AUTO_INCREMENT, `ABA_VALUE` varchar(45) NOT NULL, `AB_ID` int(11) NOT NULL, PRIMARY KEY (`ABA_ID`), KEY `fk_ABA_1_idx` (`AB_ID`), CONSTRAINT `fk_ABA_1` FOREIGN KEY (`AB_ID`) REFERENCES `AB` (`AB_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ABA` -- LOCK TABLES `ABA` WRITE; /*!40000 ALTER TABLE `ABA` DISABLE KEYS */; INSERT INTO `ABA` VALUES (1,'ABA_1',1),(2,'ABA_2',2),(3,'ABA_3',2); /*!40000 ALTER TABLE `ABA` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ABAZ` -- DROP TABLE IF EXISTS `ABAZ`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ABAZ` ( `ABA_ID` int(11) NOT NULL, `ABAZ_VALUE` varchar(45) DEFAULT NULL, PRIMARY KEY (`ABA_ID`), CONSTRAINT `fk_ABAZ_ID` FOREIGN KEY (`ABA_ID`) REFERENCES `ABA` (`ABA_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ABAZ` -- LOCK TABLES `ABAZ` WRITE; /*!40000 ALTER TABLE `ABAZ` DISABLE KEYS */; INSERT INTO `ABAZ` VALUES (1,'ABAZ_VALUE'); /*!40000 ALTER TABLE `ABAZ` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ABB` -- DROP TABLE IF EXISTS `ABB`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ABB` ( `ABB_ID` int(11) NOT NULL AUTO_INCREMENT, `ABB_VALUE` varchar(45) NOT NULL, `AB_ID` int(11) NOT NULL, PRIMARY KEY (`ABB_ID`), KEY `fk_ABB_1_idx` (`AB_ID`), CONSTRAINT `fk_ABB_1` FOREIGN KEY (`AB_ID`) REFERENCES `AB` (`AB_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ABB` -- LOCK TABLES `ABB` WRITE; /*!40000 ALTER TABLE `ABB` DISABLE KEYS */; INSERT INTO `ABB` VALUES (1,'ABB_1',1),(2,'ABB_2',2),(3,'ABB_3',2); /*!40000 ALTER TABLE `ABB` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ABBZ` -- DROP TABLE IF EXISTS `ABBZ`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ABBZ` ( `ABB_ID` int(11) NOT NULL, `ABBZ_VALUE` varchar(45) DEFAULT NULL, PRIMARY KEY (`ABB_ID`), CONSTRAINT `fk_ABBZ_ID` FOREIGN KEY (`ABB_ID`) REFERENCES `ABB` (`ABB_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ABBZ` -- LOCK TABLES `ABBZ` WRITE; /*!40000 ALTER TABLE `ABBZ` DISABLE KEYS */; INSERT INTO `ABBZ` VALUES (1,'ABBZ_VALUE'); /*!40000 ALTER TABLE `ABBZ` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ABC` -- DROP TABLE IF EXISTS `ABC`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ABC` ( `ABC_ID` int(11) NOT NULL AUTO_INCREMENT, `ABC_VALUE` varchar(45) NOT NULL, `AB_ID` int(11) NOT NULL, PRIMARY KEY (`ABC_ID`), KEY `fk_ABC_1_idx` (`AB_ID`), CONSTRAINT `fk_ABC_1` FOREIGN KEY (`AB_ID`) REFERENCES `AB` (`AB_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ABC` -- LOCK TABLES `ABC` WRITE; /*!40000 ALTER TABLE `ABC` DISABLE KEYS */; INSERT INTO `ABC` VALUES (1,'ABC_1',1),(2,'ABC_2',2),(3,'ABC_3',2); /*!40000 ALTER TABLE `ABC` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ABCZ` -- DROP TABLE IF EXISTS `ABCZ`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ABCZ` ( `ABC_ID` int(11) NOT NULL, `ABCZ_VALUE` varchar(45) DEFAULT NULL, PRIMARY KEY (`ABC_ID`), CONSTRAINT `fk_ABCZ_ID` FOREIGN KEY (`ABC_ID`) REFERENCES `ABC` (`ABC_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ABCZ` -- LOCK TABLES `ABCZ` WRITE; /*!40000 ALTER TABLE `ABCZ` DISABLE KEYS */; INSERT INTO `ABCZ` VALUES (1,'ABCZ_VALUE'); /*!40000 ALTER TABLE `ABCZ` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ABZ` -- DROP TABLE IF EXISTS `ABZ`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ABZ` ( `AB_ID` int(11) NOT NULL, `ABZ_VALUE` varchar(45) DEFAULT NULL, PRIMARY KEY (`AB_ID`), CONSTRAINT `fk_ABZ_ID` FOREIGN KEY (`AB_ID`) REFERENCES `AB` (`AB_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ABZ` -- LOCK TABLES `ABZ` WRITE; /*!40000 ALTER TABLE `ABZ` DISABLE KEYS */; INSERT INTO `ABZ` VALUES (1,'ABZ_VALUE'); /*!40000 ALTER TABLE `ABZ` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `AC` -- DROP TABLE IF EXISTS `AC`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `AC` ( `AC_ID` int(11) NOT NULL AUTO_INCREMENT, `AC_VALUE` varchar(45) NOT NULL, `A_ID` int(11) NOT NULL, PRIMARY KEY (`AC_ID`), KEY `fk_AC_1_idx` (`A_ID`), CONSTRAINT `fk_AC_1` FOREIGN KEY (`A_ID`) REFERENCES `A` (`A_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `AC` -- LOCK TABLES `AC` WRITE; /*!40000 ALTER TABLE `AC` DISABLE KEYS */; INSERT INTO `AC` VALUES (1,'AC_1',1),(2,'AC_2',1); /*!40000 ALTER TABLE `AC` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ACA` -- DROP TABLE IF EXISTS `ACA`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ACA` ( `ACA_ID` int(11) NOT NULL AUTO_INCREMENT, `ACA_VALUE` varchar(45) NOT NULL, `AC_ID` int(11) NOT NULL, PRIMARY KEY (`ACA_ID`), KEY `fk_ACA_1_idx` (`AC_ID`), CONSTRAINT `fk_ACA_1` FOREIGN KEY (`AC_ID`) REFERENCES `AC` (`AC_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ACA` -- LOCK TABLES `ACA` WRITE; /*!40000 ALTER TABLE `ACA` DISABLE KEYS */; INSERT INTO `ACA` VALUES (1,'ACA_1',1),(2,'ACA_2',2),(3,'ACA_3',2); /*!40000 ALTER TABLE `ACA` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ACAZ` -- DROP TABLE IF EXISTS `ACAZ`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ACAZ` ( `ACA_ID` int(11) NOT NULL, `ACAZ_VALUE` varchar(45) DEFAULT NULL, PRIMARY KEY (`ACA_ID`), CONSTRAINT `fk_ACAZ_ID` FOREIGN KEY (`ACA_ID`) REFERENCES `ACA` (`ACA_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ACAZ` -- LOCK TABLES `ACAZ` WRITE; /*!40000 ALTER TABLE `ACAZ` DISABLE KEYS */; INSERT INTO `ACAZ` VALUES (1,'ACAZ_VALUE'); /*!40000 ALTER TABLE `ACAZ` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ACB` -- DROP TABLE IF EXISTS `ACB`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ACB` ( `ACB_ID` int(11) NOT NULL AUTO_INCREMENT, `ACB_VALUE` varchar(45) NOT NULL, `AC_ID` int(11) NOT NULL, PRIMARY KEY (`ACB_ID`), KEY `fk_ACB_1_idx` (`AC_ID`), CONSTRAINT `fk_ACB_1` FOREIGN KEY (`AC_ID`) REFERENCES `AC` (`AC_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ACB` -- LOCK TABLES `ACB` WRITE; /*!40000 ALTER TABLE `ACB` DISABLE KEYS */; INSERT INTO `ACB` VALUES (1,'ACB_1',1),(2,'ACB_2',2),(3,'ACB_3',2); /*!40000 ALTER TABLE `ACB` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ACBZ` -- DROP TABLE IF EXISTS `ACBZ`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ACBZ` ( `ACB_ID` int(11) NOT NULL, `ACBZ_VALUE` varchar(45) DEFAULT NULL, PRIMARY KEY (`ACB_ID`), CONSTRAINT `fk_ACBZ_ID` FOREIGN KEY (`ACB_ID`) REFERENCES `ACB` (`ACB_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ACBZ` -- LOCK TABLES `ACBZ` WRITE; /*!40000 ALTER TABLE `ACBZ` DISABLE KEYS */; INSERT INTO `ACBZ` VALUES (1,'ACBZ_VALUE'); /*!40000 ALTER TABLE `ACBZ` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ACC` -- DROP TABLE IF EXISTS `ACC`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ACC` ( `ACC_ID` int(11) NOT NULL AUTO_INCREMENT, `ACC_VALUE` varchar(45) NOT NULL, `AC_ID` int(11) NOT NULL, PRIMARY KEY (`ACC_ID`), KEY `fk_ACC_1_idx` (`AC_ID`), CONSTRAINT `fk_ACC_1` FOREIGN KEY (`AC_ID`) REFERENCES `AC` (`AC_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ACC` -- LOCK TABLES `ACC` WRITE; /*!40000 ALTER TABLE `ACC` DISABLE KEYS */; INSERT INTO `ACC` VALUES (1,'ACC_1',1),(2,'ACC_2',2),(3,'ACC_3',2); /*!40000 ALTER TABLE `ACC` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ACCZ` -- DROP TABLE IF EXISTS `ACCZ`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ACCZ` ( `ACC_ID` int(11) NOT NULL, `ACCZ_VALUE` varchar(45) DEFAULT NULL, PRIMARY KEY (`ACC_ID`), CONSTRAINT `fk_ACCZ_ID` FOREIGN KEY (`ACC_ID`) REFERENCES `ACC` (`ACC_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ACCZ` -- LOCK TABLES `ACCZ` WRITE; /*!40000 ALTER TABLE `ACCZ` DISABLE KEYS */; INSERT INTO `ACCZ` VALUES (1,'ACCZ_VALUE'); /*!40000 ALTER TABLE `ACCZ` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `ACZ` -- DROP TABLE IF EXISTS `ACZ`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ACZ` ( `AC_ID` int(11) NOT NULL, `ACZ_VALUE` varchar(45) DEFAULT NULL, PRIMARY KEY (`AC_ID`), CONSTRAINT `fk_ACZ_ID` FOREIGN KEY (`AC_ID`) REFERENCES `AC` (`AC_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `ACZ` -- LOCK TABLES `ACZ` WRITE; /*!40000 ALTER TABLE `ACZ` DISABLE KEYS */; INSERT INTO `ACZ` VALUES (1,'ACZ_VALUE'); /*!40000 ALTER TABLE `ACZ` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `Z` -- DROP TABLE IF EXISTS `Z`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `Z` ( `A_ID` int(11) NOT NULL, `Z_VALUE` varchar(45) DEFAULT NULL, PRIMARY KEY (`A_ID`), CONSTRAINT `fk_Z_1` FOREIGN KEY (`A_ID`) REFERENCES `A` (`A_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `Z` -- LOCK TABLES `Z` WRITE; /*!40000 ALTER TABLE `Z` DISABLE KEYS */; INSERT INTO `Z` VALUES (1,'Z_VALUE'); /*!40000 ALTER TABLE `Z` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2017-12-25 19:33:05
Markdown
UTF-8
1,800
3.25
3
[ "MIT" ]
permissive
# Cryptocurrencies Quantiacs provides up-to-date hourly data - price and volume - for the following cryptocurrencies: * Bitcoin (BTC); * Bitcoin Cash (BCH); * EOS; * Ethereum (ETH); * Litecoin (LTC); * Ripple (XRP); * Tether (USDT). The available cryptocurrency data for the last 5 years can be loaded using: ```python import qnt.data as qndata crypto_data = qndata.crypto.load_data(tail = 365 * 5) ``` The list of available cryptocurrencies can be obtained writing: ```python crypto_data.asset ``` ![crypto_asset](./pictures/crypto_asset.PNG) For each cryptocurrency data are available on an hourly resolution. **crypto_data** is an xarray.DataArray structure whose coordinates are: * **time**: a date-time in format yyyy-mm-ddTHH-MM-SS; * **field**: an attribute, for example the opening hourly price; * **asset**: the identifying symbol for the asset, for example ETH for Ethereum. ![crypto_coords](./pictures/coords_cry.png) Specific fields are given by: | Data field | Description | | ------------------ | -------- | | open | First price in a given hour.| | close | Last price in a given hour. | | high | Highest price in a given hour. | | low | Lowest price in a given hour. | | vol | Hourly trading volume.| Let us say that we are interested in the highest hourly price for BTC. We can extract it using: ```python BTC_high = crypto_data.sel(field = 'high').sel(asset = 'BTC') ``` The data can be visualized using: ```python import plotly.graph_objs as go trend_fig = [go.Scatter( x = BTC_high.to_pandas().index, y = BTC_high, line = dict(width=1,color='black'))] fig = go.Figure(data = trend_fig) fig.update_yaxes(fixedrange=False) fig.show() ``` ![crypto_high](./pictures/crypto_high.PNG)
Java
UTF-8
842
3.53125
4
[]
no_license
package lintcode; import java.util.ArrayList; import java.util.LinkedList; /** * @Author: Mr.M * @Date: 2019-04-11 09:34 * @Description: **/ class Stack11 { /* * @param x: An integer * @return: nothing */ LinkedList<Integer> arrayList = new LinkedList<>(); public void push(int x) { // write your code here arrayList.push(x); } /* * @return: nothing */ public void pop() { // write your code here arrayList.poll(); } /* * @return: An integer */ public int top() { // write your code here return arrayList.peek(); } /* * @return: True if the stack is empty */ public boolean isEmpty() { // write your code here return arrayList.isEmpty(); } public static void main(String[] args) { Stack11 x = new Stack11(); x.push(1); x.push(2); x.pop(); System.out.println(x.top()); } }
Java
UTF-8
652
3.390625
3
[]
no_license
package com.hackerRank; public class XXXandOOO { public static void main(String[] args) { String x = solution("XOXXXOOOXOOO"); System.out.println(x); } static String solution(String S) { int countX = 0; int countO = 0; if (S.contains("XXX")) { countX += 1; } if (S.contains("OOO")) { countO += 1; } if (countX == 1 && countO == 1) { return "tie"; } else if (countX == 1) { return "X"; } else if (countO == 1) { return "O"; } else { return "tie"; } } }
Go
UTF-8
921
2.6875
3
[ "MIT" ]
permissive
package main import ( "bufio" "flag" "fmt" "github.com/lain-dono/picol.go" "io/ioutil" "os" ) var fname = flag.String("f", "", "file name") func CommandPuts(i *picol.Interp, argv []string, pd interface{}) (string, error) { if len(argv) != 2 { return "", fmt.Errorf("Wrong number of args for %s %s", argv[0], argv) } fmt.Println(argv[1]) return "", nil } func main() { flag.Parse() interp := picol.InitInterp() interp.RegisterCoreCommands() interp.RegisterCommand("puts", CommandPuts, nil) buf, err := ioutil.ReadFile(*fname) if err == nil { result, err := interp.Eval(string(buf)) if err != nil { fmt.Println("ERRROR", result, err) } } else { for { fmt.Print("picol> ") scanner := bufio.NewReader(os.Stdin) clibuf, _ := scanner.ReadString('\n') result, err := interp.Eval(clibuf[:len(clibuf)-1]) if len(result) != 0 { fmt.Println("ERRROR", result, err) } } } }
Java
UTF-8
1,090
2.375
2
[ "Apache-2.0", "GPL-1.0-or-later" ]
permissive
// This file is part of CPAchecker, // a tool for configurable software verification: // https://cpachecker.sosy-lab.org // // SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org> // // SPDX-License-Identifier: Apache-2.0 package org.sosy_lab.cpachecker.util.ltl.formulas; import static java.util.Objects.requireNonNull; import java.util.Objects; public abstract class UnaryFormula implements LtlFormula { private final LtlFormula operand; UnaryFormula(LtlFormula pOperand) { operand = requireNonNull(pOperand); } public LtlFormula getOperand() { return operand; } @Override public final int hashCode() { return Objects.hash(operand, getSymbol()); } @Override public final boolean equals(Object obj) { if (this == obj) { return true; } return obj instanceof UnaryFormula other && getSymbol().equals(other.getSymbol()) && operand.equals(other.operand); } public abstract String getSymbol(); @Override public String toString() { return String.format("%s %s", getSymbol(), operand); } }
Markdown
UTF-8
2,179
3.78125
4
[]
no_license
### 301. Remove Invalid Parentheses ``` # class Solution: # def removeInvalidParentheses(self, s: str) -> List[str]: # left, right = 0, 0 # for ch in s: # if ch == "(": # left += 1 # elif ch == ")": # if left == 0: # right += 1 # else: # left -= 1 # self.ans = [] # self.dfs(s, 0, left, right) # return self.ans # def dfs(self, s, start, left, right): # if left == 0 and right == 0 and self.is_valid(s): # self.ans.append(s) # return # for i in range(start, len(s)): # if i != start and s[i] == s[i - 1]: # continue # if s[i] == "(" or s[i] == ")": # curr = s[:i] + s[i + 1:] # if right > 0 and s[i] == ")": # self.dfs(curr, i, left, right - 1) # elif left > 0 and s[i] == "(": # self.dfs(curr, i, left - 1, right) # def is_valid(self, string): # count = 0 # for ch in string: # if ch == "(": # count += 1 # elif ch == ")": # count -= 1 # if count < 0: # return False # return count == 0 ``` ### 241. Different Ways to Add Parentheses ``` class Solution: def diffWaysToCompute(self, expression: str) -> List[int]: n = len(expression) ans = [] for i in range(n): if expression[i] in ["+", "-", "*"]: part1 = self.diffWaysToCompute(expression[:i]) part2 = self.diffWaysToCompute(expression[i + 1:]) for num1 in part1: for num2 in part2: if expression[i] == "+": ans.append(num1 + num2) elif expression[i] == "-": ans.append(num1 - num2) else: ans.append(num1 * num2) if not ans: ans.append(int(expression)) return ans ```
PHP
UTF-8
525
2.546875
3
[ "MIT" ]
permissive
<?php namespace Kynda\Contracts; use Psr\Container\ContainerInterface; interface Container extends ContainerInterface { public function bound(string $abstract): bool; public function bind(string $abstract, $concrete = null, bool $shared = false): void; public function singleton(string $abstract, $concrete = null): void; public function instance(string $abstract, $instance); public function make(string $abstract, array $parameters = []); public function resolved(string $abstract): bool; }
C#
UTF-8
783
2.65625
3
[]
no_license
using System; public class JoinMessage : IBitBufferSerializable, Message { public int playerId { get; private set; } public JoinMessage (int playerId) { this.playerId = playerId; } public JoinMessage (BitBuffer buffer) { Deserialize (buffer); } public void Apply (MessageListener listener) { listener.onJoin (this); } public byte[] Serialize () { BitBuffer buffer = new BitBuffer (); Serialize (buffer); return buffer.Bytes; } public void Serialize (BitBuffer buffer) { buffer.EnqueueInt (playerId); } public ISerializable Deserialize (byte[] bytes) { BitBuffer buffer = new BitBuffer (); return Deserialize (buffer); } public IBitBufferSerializable Deserialize (BitBuffer buffer) { playerId = buffer.DequeueInt (); return this; } }
Python
UTF-8
578
2.640625
3
[]
no_license
class Solution: def projectionArea(self, grid: List[List[int]]) -> int: height = len(grid) width = len(grid[0]) empty_top = 0 for i in range(height): for j in range(width): if grid[i][j] == 0: empty_top += 1 top = height * width - empty_top right = 0 left = 0 for i in range(height): right += max(grid[i]) for i in range(width): left += max([ grid[j][i] for j in range(height)]) return left + right + top
Python
UTF-8
2,031
4.1875
4
[]
no_license
# -*- coding: utf-8 -*- from __future__ import print_function class Solution(object): def NumberOf1(self, n): """ 输入一个整数,输出该数中1的个数。对于问题一定要有一定的敏捷程度,比如看到整数就需要立马意识到有正整数和 负整数,同时还存在0,在其它问题中也是一样,考虑问题不要太急,要思考全面一点。在这个题目中,题目介绍说对于 负数,需要考虑补码形式,因此对于补码这一简单的计算机概念需要有所了解。 原码:最高表示符号位,其余表示数值 反码:正整数的反码就是原码,负整数的反码就是符号位保持不变,数值位全部取反 补码:正整数的补码就是原码,负整数的补码就是符号位不变,数值位取反,最后加1(即反码的基础上加1) 大体上说一下三种对整数的编码方式存在的原因,虽然对于人来说直接使用原码的表示方式非常直观,因为我们一下就可以 直到最高位表示符号位,但是对于计算机来说,存在符号位的加减运算会让逻辑电路太复杂,而且我们直到对于减法来说就是 加负数,因此计算机的所有计算都可以归结到加法计算。因此我们会发现,使用反码表示的整数二进制进行加法,就可以自然 的实现所有的加减法,但是这个存在一个问题就是对于0有两个不同的表示,一个带符号一个不带符号。为了解决这种冲突, 因此引进补码表示数字的方式在计算机中,这样0就表示为了00000000(假如一个字节的话),而且还会多出一个10000000 的补码表示形式来表示-128,因此为了计算的简单性于解决0的表示冲突,计算机中使用补码表示整数。因此对于一个4个字节 的int来说,它所能表示的范围就是[-2^31, 2^31-1] """ pass
Java
UTF-8
1,078
1.601563
2
[]
no_license
package p000; /* renamed from: dmr */ /* compiled from: PG */ public final class dmr extends dje implements dkl { /* renamed from: d */ public static final dmr f8860d; /* renamed from: a */ public int f8861a; /* renamed from: b */ public dmj f8862b; /* renamed from: c */ public dmi f8863c; static { dmr dmr = new dmr(); f8860d = dmr; dje.m6693a(dmr.class, dmr); } private dmr() { } /* access modifiers changed from: protected */ /* renamed from: a */ public final Object mo3114a(int i, Object obj) { int i2 = i - 1; if (i2 == 0) { return (byte) 1; } if (i2 == 1) { return null; } if (i2 == 2) { return m6691a(f8860d, "\u0001\u0002\u0000\u0001\u0001\u0002\u0002\u0000\u0000\u0000\u0001\t\u0000\u0002\t\u0001", new Object[]{"a", "b", "c"}); } else if (i2 != 3) { return i2 != 4 ? f8860d : new dja((boolean[][]) null); } else { return new dmr(); } } }
Java
UTF-8
10,276
2.125
2
[]
no_license
package org.developerworld.frameworks.weixin.handler.servlet; import java.io.UnsupportedEncodingException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; import java.util.Arrays; import java.util.Set; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.StringUtils; import org.developerworld.commons.codec.digest.AES; import org.developerworld.frameworks.weixin.handler.RequestMessageHandler; import org.developerworld.frameworks.weixin.message.RequestMessage; import org.developerworld.frameworks.weixin.message.ResponseMessage; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.dom4j.Element; /** * 接收信息响应servlet * * @author Roy Huang * @version 20140306 * */ public abstract class AbstractSafeModeRequestMessageHandleServlet extends AbstractRequestMessageHandleServlet { private final static String CHARSET = "utf-8"; /** * 处理请求信息 */ @Override protected void handleRequestMessage(HttpServletRequest request, HttpServletResponse response, String token) throws Exception { // 应用id(当要使用时才实例化) String appId = null; // 消息体的签名 String msgSignature = request.getParameter("msg_signature"); // 时间戳 String timestamp = request.getParameter("timestamp"); // 随机数 String nonce = request.getParameter("nonce"); // 加密类型 String encryptType = request.getParameter("encrypt_type"); // 获取微信提交过来的信息 String xml = IOUtils.toString(request.getInputStream(), request.getCharacterEncoding()); String outXml = null; if (StringUtils.isNotBlank(xml)) { RequestMessage reqMessage = null; // 判定是否为加密消息体 if (StringUtils.isNotBlank(encryptType) && !encryptType.equals("raw")) { appId = getAppId(request); String newXml = decryptXml(request, token, msgSignature, timestamp, nonce, appId, xml); if (StringUtils.isNotBlank(newXml)) reqMessage = requestMessageConverter .convertToObject(newXml); } else reqMessage = requestMessageConverter.convertToObject(xml); if (reqMessage != null) { // 获取处理器 Set<RequestMessageHandler> requestMessageHandlers = getRequestMessageHandlers(request); for (RequestMessageHandler requestMessageHandler : requestMessageHandlers) { // 判断是否支持处理信息 if (requestMessageHandler.isSupport(reqMessage)) { // 处理并反馈响应信息 ResponseMessage repMessage = requestMessageHandler .handle(reqMessage); if (repMessage != null) { // 转化响应信息 outXml = responseMessageConverter .convertToXml(repMessage); if (StringUtils.isNotBlank(outXml)) break; } // 若设置为不再继续查找,则跳出 if (!isFindOtherHandlerWhenHasNotResponse()) break; } } } } if (outXml == null && isOutPrintEmptyWhenHasNotResponse()) outXml = ""; // 信息加密 if (StringUtils.isNotBlank(outXml) && StringUtils.isNotBlank(encryptType) && !encryptType.equals("raw")) outXml = encryXml(request, token, appId, timestamp, nonce, outXml); response.getWriter().print(outXml); } /** * 解密xml内容 * * @param request * @param token * @param msgSignature * @param timestamp * @param nonce * @param appId * @param xml * @return * @throws DocumentException * @throws InvalidKeyException * @throws NoSuchAlgorithmException * @throws InvalidKeySpecException * @throws NoSuchPaddingException * @throws IllegalBlockSizeException * @throws BadPaddingException * @throws InvalidAlgorithmParameterException * @throws UnsupportedEncodingException */ private String decryptXml(HttpServletRequest request, String token, String msgSignature, String timestamp, String nonce, String appId, String xml) throws DocumentException, InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, UnsupportedEncodingException { String msgEncrypt = getXmlMsgEncrypt(xml); if (StringUtils.isBlank(msgEncrypt)) return null; // 构建验证数组 String[] msgSignatureArray = new String[] { token, timestamp, nonce, msgEncrypt }; // 字典排序 Arrays.sort(msgSignatureArray); // 构建验证字符串 String _msgSignature = ""; for (String msa : msgSignatureArray) _msgSignature += msa; // sha1加密 _msgSignature = DigestUtils.shaHex(_msgSignature); // 校验消息签名 if (!_msgSignature.equals(msgSignature)) return null; String encodingAesKey = getEncodingAESKey(request); byte[] aesKey = Base64.decodeBase64(encodingAesKey + "="); // 对消息进行解密 byte[] aesMsg = Base64.decodeBase64(msgEncrypt); byte[] ranMsg = AES.decrypt(aesKey, aesMsg, AES.ALGORITHM_CBC); // 去除补位字符 byte[] bytes = encoderPKCS7(ranMsg); // 分离16位随机字符串,网络字节序和AppId byte[] networkOrder = ArrayUtils.subarray(bytes, 16, 20); int xmlLength = recoverNetworkBytesOrder(networkOrder); // 获取appId String _appId = new String(ArrayUtils.subarray(bytes, 20 + xmlLength, bytes.length), CHARSET); if (!appId.equals(_appId)) return null; // 获取原文内容 return new String(ArrayUtils.subarray(bytes, 20, 20 + xmlLength), CHARSET); } /** * 还原4个字节的网络字节序 * * @param orderBytes * @return */ private int recoverNetworkBytesOrder(byte[] orderBytes) { int sourceNumber = 0; for (int i = 0; i < 4; i++) { sourceNumber <<= 8; sourceNumber |= orderBytes[i] & 0xff; } return sourceNumber; } /** * 获取xml内容中的密文 * * @param xml * @return * @throws DocumentException */ private String getXmlMsgEncrypt(String xml) throws DocumentException { Document doc = DocumentHelper.parseText(xml); Element e = doc.getRootElement(); return e.elementText("Encrypt"); } /** * pkcs7编码 * * @param data * @return */ private byte[] encoderPKCS7(byte[] data) { int pad = (int) data[data.length - 1]; if (pad < 1 || pad > 32) pad = 0; return ArrayUtils.subarray(data, 0, data.length - pad); } /** * 加密xml * * @param request * @param token * @param appId * @param timestamp * @param nonce * @param outXml * @return * @throws UnsupportedEncodingException * @throws InvalidKeyException * @throws NoSuchAlgorithmException * @throws InvalidKeySpecException * @throws NoSuchPaddingException * @throws IllegalBlockSizeException * @throws BadPaddingException * @throws InvalidAlgorithmParameterException */ private String encryXml(HttpServletRequest request, String token, String appId, String timestamp, String nonce, String outXml) throws UnsupportedEncodingException, InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException { String encodingAesKey = getEncodingAESKey(request); byte[] aesKey = Base64.decodeBase64(encodingAesKey + "="); // 16位随机字符串 String random16Str = RandomStringUtils.randomAscii(16); byte[] random16StrByte = random16Str.getBytes(CHARSET); byte[] outXmlByte = outXml.getBytes(CHARSET); byte[] networkBytesOrder = getNetworkBytesOrder(outXmlByte.length); byte[] appIdBytes = appId.getBytes(CHARSET); // randomStr + networkBytesOrder + text + appid byte[] msgEncryptByte = ArrayUtils.addAll( ArrayUtils.addAll(random16StrByte, networkBytesOrder), ArrayUtils.addAll(outXmlByte, appIdBytes)); // 进行加密 msgEncryptByte = AES.encrypt(aesKey, msgEncryptByte, AES.ALGORITHM_CBC); String msgEncrypt = Base64.encodeBase64String(msgEncryptByte); // 构建验证数组 String[] msgSignatureArray = new String[] { token, timestamp, nonce, msgEncrypt }; // 字典排序 Arrays.sort(msgSignatureArray); // 构建验证字符串 String _msgSignature = ""; for (String msa : msgSignatureArray) _msgSignature += msa; // sha1加密 _msgSignature = DigestUtils.shaHex(_msgSignature); // 构建返回xml StringBuilder _outXml = new StringBuilder().append("<xml>"); _outXml.append("<Encrypt>").append(msgEncrypt).append("</Encrypt>"); _outXml.append("<MsgSignature>").append(_msgSignature) .append("</MsgSignature>"); _outXml.append("<TimeStamp>").append(timestamp).append("</TimeStamp>"); _outXml.append("<Nonce>").append(nonce).append("</Nonce>"); _outXml.append("</xml>"); return _outXml.toString(); } /** * 生成4个字节的网络字节序 * * @param sourceNumber * @return */ private byte[] getNetworkBytesOrder(int sourceNumber) { byte[] orderBytes = new byte[4]; orderBytes[3] = (byte) (sourceNumber & 0xFF); orderBytes[2] = (byte) (sourceNumber >> 8 & 0xFF); orderBytes[1] = (byte) (sourceNumber >> 16 & 0xFF); orderBytes[0] = (byte) (sourceNumber >> 24 & 0xFF); return orderBytes; } /** * 根据请求信息,获取AES钥匙信息 * * @param request * @return */ protected abstract String getEncodingAESKey(HttpServletRequest request); /** * 获取appId信息 * * @param request * @return */ protected abstract String getAppId(HttpServletRequest request); }
C#
UTF-8
1,551
2.59375
3
[]
no_license
using UnityEngine; using System.Collections; public class Slingshot : MonoBehaviour { //Fields seen in the Inspector panel public GameObject prefabProjectile; //Internal variable private GameObject launchPoint; private Vector3 launchPos; private GameObject projectile; bool aimingMode; void Awake(){ Transform launchPointTransform = transform.Find ("LaunchPoint"); launchPoint = launchPointTransform.gameObject; launchPoint.SetActive (false); launchPos = launchPointTransform.position; } void OnMouseEnter(){ launchPoint.SetActive (true); } void OnMouseExit(){ launchPoint.SetActive (false); } void OnMouseDown(){ aimingMode = true; // Instantiate a new projectile projectile = Instantiate(prefabProjectile)as GameObject; // Start it at the launchpoint // Set the projectile's position to the launchPos projectile.transform.position = launchPos; // Set isKinematic to true or false projectile.GetComponent<Rigidbody> ().isKinematic = true; } void Update(){ //If we're not in aiming Mode, do nothing if (!aimingMode) { return; } // Get the current mouse position in 2D Vector3 mousePos2D = Input.mousePosition; // Convert it to 3D world coordinates mousePos2D.z = -Camera.main.transform.position.z; Vector3 mousePos3D = Camera.main.ScreenToWorldPoint(mousePos2D); // Find the difference between launchPos and mouse position Vector3 mouseDelta = mousePos3D - launchPos; //Move the projectile to this new position projectile.transform.position = mousePos3D; } }
C#
UTF-8
3,913
3.15625
3
[ "MIT" ]
permissive
namespace AdventOfCode2022; internal class Day18 { private const char Lava = '#'; private const char Steam = '.'; private readonly record struct Point(int X, int Y, int Z) { public IEnumerable<Point> Neighbours { get { yield return this with { X = X + 1 }; yield return this with { X = X - 1 }; yield return this with { Y = Y + 1 }; yield return this with { Y = Y - 1 }; yield return this with { Z = Z + 1 }; yield return this with { Z = Z - 1 }; } } } private readonly ISet<Point> _cubes; private readonly Point _min; private readonly Point _max; public Day18(IEnumerable<string> input) { _cubes = input.Select(line => { var coordinates = line.Split(",").Select(int.Parse).ToArray(); return new Point(coordinates[0], coordinates[1], coordinates[2]); }) .ToHashSet(); _min = new Point(_cubes.Min(c => c.X) - 1, _cubes.Min(c => c.Y) - 1, _cubes.Min(c => c.Z) - 1); _max = new Point(_cubes.Max(c => c.X) + 1, _cubes.Max(c => c.Y) + 1, _cubes.Max(c => c.Z) + 1); } public int PartOne() { var freeSides = from cube in _cubes from side in cube.Neighbours where !_cubes.Contains(side) select side; return freeSides.Count(); } public int PartTwo() { var grid = _cubes.ToDictionary(c => c, _ => Lava); for (var x = _min.X; x <= _max.X; x++) for (int y = _min.Y; y <= _max.Y; y++) for (int z = _min.Z; z <= _max.Z; z++) { grid[new Point(x, y, _min.Z)] = Steam; grid[new Point(x, y, _max.Z)] = Steam; grid[new Point(x, _min.Y, z)] = Steam; grid[new Point(x, _max.Y, z)] = Steam; grid[new Point(_min.X, y, z)] = Steam; grid[new Point(_max.X, y, z)] = Steam; } var hasChanged = true; while (hasChanged) { hasChanged = false; for (var x = _min.X; x <= _max.X; x++) for (int y = _min.Y; y <= _max.Y; y++) for (int z = _min.Z; z <= _max.Z; z++) { var point = new Point(x, y, z); if (grid.ContainsKey(point)) { continue; } if (point.Neighbours.Any(p => grid.TryGetValue(p, out var value) && value == Steam)) { grid[point] = Steam; hasChanged = true; } } } var freeSides = from cube in _cubes from side in cube.Neighbours where grid.TryGetValue(side, out var value) && value == Steam select side; return freeSides.Count(); } } public class Day18Test { private const string InputFile = "Day18.Input.txt"; private const string Example1File = "Day18.Example1.txt"; private const string Example2File = "Day18.Example2.txt"; [Theory] [FileData(Example1File, FileContents.StringPerLine, 10)] [FileData(Example2File, FileContents.StringPerLine, 64)] [FileData(InputFile, FileContents.StringPerLine, 3396)] public void TestPartOne(IEnumerable<string> input, int expected) { var solution = new Day18(input); Assert.Equal(expected, solution.PartOne()); } [Theory] [FileData(Example1File, FileContents.StringPerLine, 10)] [FileData(Example2File, FileContents.StringPerLine, 58)] [FileData(InputFile, FileContents.StringPerLine, 2044)] public void TestPartTwo(IEnumerable<string> input, int expected) { var solution = new Day18(input); Assert.Equal(expected, solution.PartTwo()); } }
Markdown
UTF-8
6,494
2.796875
3
[]
no_license
二三三 阴雪珠哂道:“公于乃堂堂武林男儿,避雨入庙,突问呼救之声,竟连兵刃也不带便循声而去,这已经不符常情;及至遍寻无获,猜疑方浓,忽然在庙里发现两匹无主之马,论情理,公子应该与那怪异的呼救声产生联想,岂会毫不在意,便匆匆上马而去?” 桑琼原是顺口编成的故事,万不料这阴雪珠分析入微,竟然轻易的抓住破绽,一番话,直问得他张口结舌,无言以对。 他本不善作谎,刹时间,面红耳赤,呐呐不能作答,只得撒赖使横,把头一仰,道:“当时在下确未细看,姑娘不信,那也是无可奈何的事。” “小妹”阴美珠怒哼道:“你还想强词夺理,不说实话?” 桑琼道:“在下分明是说的实话,你们不信又怎么办?” 阴美珠冷叱道:“看不出你的嘴倒挺硬,不给你点颜色,你不会实说。”叱声中,双膝一叩马腹,便想催马冲上前去。 “十一姐”阴雪珠左臂疾探,一把扣住阴美珠的马鞍带子,沉声道:“小妹,百事忍耐,取回东西要紧。” 拦住了阴美珠,玉首回转,又换一副楚楚堪怜的神情,对桑琼说道:“公子是伟岸丈夫,何必跟咱们一介女流玩笑呢?咱们知道,取那东西绝不会是公子本意,全是那和尚从中挑拨,如今谁是谁非也甭提了,只当公子可怜咱们姊妹,把那两件东西赏还给咱们吧! 桑琼冷然摇头道:“姑娘所指是什么东西?在下一句也听不懂。” 阴雪珠媚笑道:“公子,玩笑要适可而止,咱们姐妹在求您啦!” 桑琼正色道:“在下并没有跟陌生人开玩笑的习惯。” 阴雪珠阴笑道:“公子何苦要返咱们呢,那东西对公子不值一顾,对咱们姊妹却甚于性命,公子如愿赐还,要怎么谢你,咱们姊妹都依从。” 桑琼摇头道:“两位大约是认错人了,在下不懂两位说的话。” 阴雪珠呢声道:“公子,得饶人处且饶人,咱们姊妹宁愿粉身相谢,只要公子你……” 桑琼断然道:“在下不须两位姑娘相谢.也不知道那东西,两位请让路,在下还有要事。” 说着,一拨马头,便待扬鞭而上。 刹那间—— 阴雪珠横鞍相阻,日中已隐隐射出凶光,但仍低声央求道:“咱们遗失的东西,是一只药瓶和一本绢册,公子如果喜欢,咱们愿将药瓶奉送,只求取回绢册,这样公子总该答应了吧?” 桑琼平生不善说谎,此时破阴雪珠软语相求,几乎忍个住就要承认下来,但转念之间,想到癫僧临别所言,此事关系武林祸福何等重大,自己只要问心无愧,岂能拘谨于个人小节,说不得,只好厚着脸皮杜一次破大荒的大谎了。 想到这里,深深吸了一口气,壮壮胆,扬扬眉,显得十二分不耐地道:“在下已经再三申明,不知道两位姑娘遗物之事,二位凭什么一口咬定东西是在下所取?如此含血喷人,诬良为盗,是可忍孰不可忍,但在下因念二位是女孩儿家,不欲争论,于情于理,已忍让到最大限度,希望二位适可而止,勿再无理纠缠,否则……,, 阴雪珠黛眉一挑,接口道:“否则便怎么样?” 桑琼终因理屈,说不出狠话,只哼了两声,道:“如果二位拿不出证据,在下也不是好欺的。” 阴美珠年轻气做,不禁怒目道:“旷野中别无他人,你既承认在破庙躲过雨,时间也恰好符合,再说你肩后长剑,胯下坐马,件件都是证据,你还想抵赖?” 阴雪珠也冷笑道:“桑公子,咱们姊妹跟你素昧平生,无怨无仇,如此好言相对,礼数已尽,假如一定要弄得彼此翻脸,只怕大家面上都不好看吧?” 桑琼厉声道:“你们凭什么一定断言东西是我拿的?” 阴雪珠道;“是不是公子拿的,这部甚易分辨,只要公了答应让咱们浑身上下内外搜一搜……” 桑琼勃然大怒,喝道:“妖女欺人太甚,冲着这句话,今天也跟你们不得善罢甘休。” 阴美珠毫不畏惧,酥胸向前一挺,娇叱道:“什么叫做妖女,你口里放十净一些,冲着你这‘妖女’两个字,偷东西的不是你也是你,你不罢休,咱得还放不过你呢! 一面说着,一面已翻腕拔出肩后双剑,大有一言不合,当场“开扁”的气势。 桑琼约马略退,冷然道:“此处乃是往来大道,在下也不想光天化日之下,做那惊世骇俗之举,咱们换一个地方如何?” 阴美珠十分横蛮,嗤道:“咱们姊妹连杀人都不在乎,还管什么惊世骇俗,要动于就在这儿,姓桑的,亮兵刃吧广 桑琼仰面哂道:“好一个凶残狂妄的妖女,也罢,不叫你吃点苦头,你只当中原无人。”光华一闪,飞龙剑也应手出鞘。 阴美珠口注飞龙神剑,粉脸微微变色,冷笑道:“中原能人敢情都是仗着兵刃锋利而已。” 桑琼淡然一笑,道:“若以一敌二,即使兵刃锋利些,也算不得占什么便宜。” 阴美珠哼道:“别以为你有一柄好剑,就能吓唬咱们姊妹,你先接这一招。” 声落,蛮腰一弓一弹,娇躯已从马背激射而起,空中一式“巧翻云”,双剑互击,发出“呛”地一声脆响,剑刃交并如剪,疾然向桑琼迎头罩落下来。 也难怪她狂,这出手一招,非仅凌厉泼辣,而且运剑手法大异武林常规,直令人有封架闪避两皆不易的威势。 桑琼心头暗惊,不敢托大,双膝微叩马腹,手中飞龙剑一紧,一式“龙腾九霄”挥洒而出。 漫天剑华,耀眼生耀,只听“铮铮’两声,小妖女阴美珠连人带剑从桑琼顶上一翻而过,紧接着,“啼啼啼”一声刺耳马嘶,桑琼坐上骏马忽然扬蹄人立了起来。 桑琼一惊,猛提真气飘离雕鞍,人刚落地,那匹马已“蓬”然倒毙。 马股上,血肉进裂,剑伤深可见骨,而阴美珠却面色苍白站在一丈以外,左手剑已齐柄折断,臂弯衫袖破开一道长缝,一滴一滴鲜红的血液,正顺着断剑剑柄滴落地面。
Python
UTF-8
1,222
2.8125
3
[]
no_license
# -*- coding: utf-8 -*- import scrapy from challenge16.items import CourseItem class CourseSpider(scrapy.Spider): name = 'course' allowed_domains = ['github.com'] @property def start_urls(self): url = 'https://github.com/shiyanlou?page={}&tab=repositories' return (url.format(i) for i in range(1,5)) def parse(self, response): for course in response.css("li.col-12"): item = CourseItem() item['name'] = course.css('h3 a::text').re_first("[ ]{8}(.+)") item['update_time'] = course.css("relative-time::attr(datetime)").extract_first() course_url = response.urljoin(course.css("h3 a::attr(href)").extract_first()) request = scrapy.Request(course_url, callback=self.parse_author) request.meta['item'] = item yield request def parse_author(self, response): item = response.meta['item'] item['commits'] = response.css("span.num.text-emphasized::text")[0].re_first("\d+") item['branches'] = response.css("span.num.text-emphasized::text")[1].re("\d+") item['releases'] =response.css("span.num.text-emphasized::text")[2].re("\d+") yield item
Python
UTF-8
174
4.1875
4
[]
no_license
message = input("What message would you like to display? > ") times = int(input("How many times would you like to print it? > ")) for i in range(0,times): print(message)
JavaScript
UTF-8
2,125
3.140625
3
[ "MIT" ]
permissive
/** * Class constructor for representing atoms * Defining atoms also adds the atom to a global atoms table in JRTS */ const Atom = (() => { // Private registerAtom token const registerAtom = Symbol("registerAtom"); const registered = Symbol("registered"); return class Atom extends ErlangDatatype { constructor(name) { super(); this.value = name; this.precedence = 1; this[registerAtom](); } match(other) { if (other===null||(Atom.isAtom(other) ? this.getValue() === other.getValue() : this.getValue() === other)) { return other; } else { return undefined; } } toString() { return `${this.getValue()}`; } registerPid(p) { if (Pid.isPid(p)) { if (jrts.atoms[this.value] === registered) { jrts.atoms[this.value] = p; } else { throw "** exception error: this atom has already been registered to a different Pid"; } } else { throw "** exception error: you can only register a Pid to an Atom with a Pid"; } } [registerAtom]() { try { if (!jrts.atoms[this.value]) { jrts.atoms[this.value] = registered; } } catch (e) { console.warn(`Atom '${this.getValue()}' could not be registered to runtime atom table as it doesn't seem to exist`); } } static isAtom(a) { return a instanceof Atom; } static cloneAtom(a) { return a; } static exists(name) { try { return !!jrts.atoms[a]; } catch (e) { console.warn(`Could not check if Atom '${name}' exists in atom table as atom table doesn't seem to exist`); return false; } } }; })();
C++
UTF-8
7,823
2.546875
3
[]
no_license
#include<iostream> #include<cmath> #include<string> #include<cassert> #include<fstream> #include<cstdlib> void tdma(int ibeg , int iend, double* aa, double* bb, double* cc, double* dd); int main(int argc, char* argv[]) { double pi; pi= M_PI; double delta_x, delta_y; int nodes,r; nodes = 50; delta_x = double(2*pi)/double(nodes-1); delta_y = double(2)/double(nodes-1); double w = 1.68; double x[nodes], y[nodes]; double analytical[nodes][nodes]; double p_ans_old[nodes][nodes]; double p_ans_x[nodes][nodes]; double p_ans_y[nodes][nodes]; double perr[nodes][nodes]; double psor[nodes][nodes]; double u[nodes][nodes]; double v[nodes][nodes]; double err; x[0] = 0; y[0] = 0; for(int i=1; i< nodes; i++){ x[i] = x[i-1] + delta_x ; y[i] = y[i-1] + delta_y; } for(int i = 0; i < nodes; i++) { for(int j = 0; j < nodes; j++){ analytical[i][j] = (double(-1*0.1*cos(x[i]))/double(sqrt(1-0.5)))*exp(-y[j]*sqrt(1-0.5)); } } for(int i = 0; i < nodes; i++) { for(int j = 0; j < nodes; j++){ p_ans_old[i][j] = 0.0; p_ans_x[i][j] = 0.0; } } double B,p; B = (pow(delta_x,2))/(0.75*pow(delta_y,2)); p = 1/(2*(1+B)); double* aa = new double[nodes]; double* bb = new double[nodes]; double* cc = new double[nodes]; double* dd = new double[nodes]; // point 1 for(int z=0; z< 100000; z++) { //x sweep //first row for(int j = 0; j<1; j++) { aa[0] = 0; bb[0] =-2*(1+B); cc[0] = 2; dd[0] = -B*(2*p_ans_old[0][j+1] - 2*delta_y*0.1*cos(x[0])); for(int i = 1; i < nodes-1; i++) { aa[i] = 1; bb[i] =-2*(1+B); cc[i] = 1; dd[i] = -B*(2*p_ans_old[i][j+1] - 2*delta_y*0.1*cos(x[i])); } aa[nodes-1] = 2; bb[nodes-1] =-2*(1+B); cc[nodes-1] = 0; dd[nodes-1] = -B*(2*p_ans_old[nodes-1][j+1] - 2*delta_y*0.1*cos(x[nodes-1])); tdma(0,nodes-1, aa, bb, cc, dd); for(int i=0;i< nodes;i++) { p_ans_x[i][j] = dd[i]; } } // rows 2 to nodes-1 for(int j = 1; j<nodes-1; j++) { aa[0] = 0; bb[0] =-2*(1+B); cc[0] = 2; dd[0] = -B*(p_ans_old[0][j+1] + p_ans_x[0][j-1]); for(int i = 1; i < nodes-1; i++) { aa[i] = 1; bb[i] =-2*(1+B); cc[i] = 1; dd[i] = -B*(p_ans_old[i][j+1] + p_ans_x[i][j-1]); } aa[nodes-1] = 2; bb[nodes-1] =-2*(1+B); cc[nodes-1] = 0; dd[nodes-1] = -B*(p_ans_old[nodes-1][j+1] + p_ans_x[nodes-1][j-1]); tdma(0,nodes-1, aa, bb, cc, dd); for(int i=0;i< nodes;i++) { p_ans_x[i][j] = dd[i]; } } // last row for(int j = nodes-1; j<nodes; j++) { aa[0] = 0; bb[0] =-2*(1+B); cc[0] = 2; dd[0] = -B*(2*p_ans_x[0][j-1]); for(int i = 1; i < nodes-1; i++) { aa[i] = 1; bb[i] =-2*(1+B); cc[i] = 1; dd[i] = -B*(2*p_ans_x[i][j-1]); } aa[nodes-1] = 2; bb[nodes-1] =-2*(1+B); cc[nodes-1] = 0; dd[nodes-1] = -B*(2*p_ans_x[nodes-1][j-1]); tdma(0,nodes-1, aa, bb, cc, dd); for(int i=0;i< nodes;i++) { p_ans_x[i][j] = dd[i]; } } //y sweep //first column for(int i = 0; i<1; i++) { aa[0] = 0; bb[0] =-2*(1+B); cc[0] = 2*B; dd[0] = -2*p_ans_x[i+1][0] + 2*B*delta_y*0.1*cos(x[0]); for(int j = 1; j < nodes-1; j++) { aa[j] = B; bb[j] =-2*(1+B); cc[j] = B; dd[j] = -(2*p_ans_x[i+1][j]); } aa[nodes-1] = 2*B; bb[nodes-1] =-2*(1+B); cc[nodes-1] = 0; dd[nodes-1] = -(2*p_ans_x[i+1][nodes-1]); tdma(0,nodes-1, aa, bb, cc, dd); for(int j=0;j< nodes;j++) { p_ans_y[i][j] = dd[j]; } } //from column 2 to N-1 for(int i = 1; i<nodes-1; i++) { aa[0] = 0; bb[0] =-2*(1+B); cc[0] = 2*B; dd[0] = -(p_ans_x[i+1][0]+ p_ans_y[i-1][0]) + 2*B*delta_y*0.1*cos(x[i]); for(int j = 1; j < nodes-1; j++) { aa[j] = B; bb[j] =-2*(1+B); cc[j] = B; dd[j] = -(p_ans_x[i+1][j] + p_ans_y[i-1][j]); } aa[nodes-1] = 2*B; bb[nodes-1] =-2*(1+B); cc[nodes-1] = 0; dd[nodes-1] = -(p_ans_x[i+1][nodes-1]+p_ans_y[i-1][nodes-1]); tdma(0,nodes-1, aa, bb, cc, dd); for(int j=0;j< nodes;j++) { p_ans_y[i][j] = dd[j]; } } //from column N for(int i = nodes-1; i<nodes; i++) { aa[0] = 0; bb[0] =-2*(1+B); cc[0] = 2*B; dd[0] = -(2*p_ans_y[i-1][0]) + 2*B*delta_y*0.1*cos(x[i]); for(int j = 1; j < nodes-1; j++) { aa[j] = B; bb[j] =-2*(1+B); cc[j] = B; dd[j] = -(2*p_ans_y[i-1][j]); } aa[nodes-1] = 2*B; bb[nodes-1] =-2*(1+B); cc[nodes-1] = 0; dd[nodes-1] = -(2*p_ans_y[i-1][nodes-1]); tdma(0,nodes-1, aa, bb, cc, dd); for(int j=0;j< nodes;j++) { p_ans_y[i][j] = dd[j]; } } for(int i = 0; i < nodes; i++) { for(int j = 0; j < nodes; j++){ perr[i][j] = std::abs(p_ans_y[i][j] - p_ans_old[i][j]) ; } } double sum1=0.0; double sum2=0.0; for ( int i = 0; i < nodes; i++ ) { for ( int j = 0; j < nodes; j++ ) { sum1+=perr[i][j]; sum2 += std::abs(p_ans_old[i][j]); } } err= sum1/sum2; std::cout << err << "\n"; if(err < 1.e-8){ std::cout << "Solution is converged" << "\n"; break; } for ( int i = 0; i < nodes; i++ ) { for ( int j = 0; j < nodes; j++ ) { p_ans_old[i][j]=p_ans_y[i][j]; } } } for ( int i = 0; i < nodes; i++ ) { for ( int j = 0; j < nodes; j++ ) { psor[i][j]=p_ans_y[i][j]; } } // inner u velocites and v velocities for(int i = 1; i < nodes-1; i++) { for(int j = 0; j < nodes; j++){ u[i][j] = (psor[i+1][j] - psor[i-1][j])/(2*delta_x) ; } } for(int i = 0; i < nodes; i++) { for(int j = 1; j < nodes-1; j++){ v[i][j] = (psor[i][j+1] - psor[i][j-1])/(2*delta_y) ; } } // u velocities on boundaries for(int i = 0; i < 1; i++) { for(int j = 0; j < nodes; j++){ u[i][j] = (psor[i+1][j] - psor[i][j])/(delta_x) ; } } for(int i = nodes-1; i < nodes; i++) { for(int j = 0; j < nodes; j++){ u[i][j] = (psor[i][j] - psor[i-1][j])/(delta_x) ; } } //v velocities on boundaries for(int i = 0; i < nodes; i++) { for(int j = 0; j < 1; j++){ v[i][j] = (psor[i][j+1] - psor[i][j])/(delta_y) ; } } for(int i = 0; i < nodes; i++) { for(int j = nodes-1; j < nodes; j++){ v[i][j] = (psor[i][j] - psor[i][j-1])/(delta_y) ; } } delete[] aa; delete[] bb; delete[] cc; delete[] dd; std::ofstream write_file("adiu.dat"); // Write numbers as +x.<13digits>e+00 (width 20) write_file.setf(std::ios::scientific); write_file.precision(16); assert(write_file.is_open()); for (int i=0; i< nodes; i++) { for(int j=0; j< nodes; j++){ write_file << u[i][j] << " "; } write_file << "\n"; } write_file.close(); std::ofstream write_v("adiv.dat"); // Write numbers as +x.<13digits>e+00 (width 20) write_v.setf(std::ios::scientific); write_v.precision(16); assert(write_v.is_open()); for (int i=0; i< nodes; i++) { for(int j=0; j< nodes; j++){ write_v << v[i][j] << " "; } write_v << "\n"; } write_v.close(); return 0; } void tdma(int ibeg , int iend, double* aa, double* bb, double* cc, double* dd) { double r; for (int i = ibeg+1; i< iend +1; i++) { r = aa[i]/bb[i-1]; bb[i] = bb[i] - r*cc[i-1]; dd[i] = dd[i]-r*dd[i-1]; } dd[iend] = dd[iend]/bb[iend]; //back substitution for(int i = iend -1; i > ibeg-1; i--) { dd[i] = (dd[i]-cc[i]*dd[i+1])/bb[i]; } }
Java
UTF-8
1,172
2.75
3
[]
no_license
package com.shizhenqiang.design_gupao.design.delegate; import org.springframework.util.StringUtils; import java.util.HashMap; import java.util.Map; public class Leader implements WorkTask { /*private final static Map<String, WorkTask> clazzMap = new HashMap<>(3); static { clazzMap.put(WorkCategoryEnum.COLLECT_DATA.getName(), new EmployeeOne()); clazzMap.put(WorkCategoryEnum.NORM_MANAGE.getName(), new EmployeeTwo()); clazzMap.put(WorkCategoryEnum.RISK_MANAGE.getName(), new EmployeeThree()); }*/ private Map<String, WorkTask> clazzMap = new HashMap<>(3); public Leader() { clazzMap.put(WorkCategoryEnum.COLLECT_DATA.getName(), new EmployeeOne()); clazzMap.put(WorkCategoryEnum.NORM_MANAGE.getName(), new EmployeeTwo()); clazzMap.put(WorkCategoryEnum.RISK_MANAGE.getName(), new EmployeeThree()); } @Override public void delegateWork(String name) { System.out.println(WorkCategoryEnum.COLLECT_DATA.getName()); if (StringUtils.isEmpty(name)) { return; } WorkTask workTask = clazzMap.get(name); workTask.delegateWork(name); } }
Shell
UTF-8
2,970
3.171875
3
[]
no_license
export TMUX_SHELL="`which zsh`" if [[ -o interactive && ! -o login && -z "$TMUX" ]]; then SHELL=${TMUX_SHELL:-SHELL} tmux a -t workspace || SHELL=${TMUX_SHELL:-SHELL} tmux new -s workspace fi fpath=( "$HOME/.zsh/pure" $fpath ) autoload -U promptinit; promptinit prompt pure plugins=(zsh-completions) autoload -U compinit && compinit # for autocompletion # User configuration #Run private setup commands if [ -e ~/.private.rc ]; then source ~/.private.rc fi # Setup case-insensitive mid-word auto completion # - fallback to case insensitive if no exact match zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' # Setup conda for usage - might come from .private.rc if [ -e "${CONDA_FILE}" ]; then . "${CONDA_FILE}" export PATH="${CONDA_BIN}:$PATH" else echo -e "\e[31mWARN: Could not find $CONDA_FILE \e[0m" fi # Golang root path - Arch specific export GOROOT=/usr/lib/go # TODO: Verify authenticity of cuda installation before using # export PATH="/opt/cuda/bin:$PATH" # USER DEPENDENT - Set this option only if CUDA is installed on the system # Also, specific location depends on OS (this is the one for Arch) export CUDA_ROOT="/opt/cuda" export LD_LIBRARY_PATH="/opt/cuda/:$LD_LIBRARY_PATH" #export THEANORC="~/.theanorc" # export MANPATH="/usr/local/man:$MANPATH" # source /usr/lib/python3.5/site-packages/powerline/bindings/zsh/powerline.zsh # You may need to manually set your language environment # export LANG=en_US.UTF-8 # Preferred editor for local and remote sessions if [[ -n $SSH_CONNECTION ]]; then export EDITOR='vim' else export EDITOR='mvim' fi # Compilation flags # export ARCHFLAGS="-arch x86_64" # ssh # export SSH_KEY_PATH="~/.ssh/dsa_id" # Setup readline's vi mode set -o vi # Bind ? to reverse history search # bindkey -M vicmd '?' history-incremental-search-backward alias zconf="vim ~/.zshrc; source ~/.zshrc" alias tconf="vim ~/.tmux.conf" alias l='ls -Flath --color=auto' alias xopen='xdg-open' # MSI GS65 specific alias alias keylight='msi-perkeyrgb -mGS65' alias curgp='export GOPATH=`pwd`' # AWS convenience aliases alias aws-ips="aws ec2 describe-instances | jq -r '.Reservations | .[].Instances | .[] | .PublicIpAddress'" # Less with color highlighting - Most commands require explicit # instructions to emit color codes when their output is piped cless() { if [[ "${1}" = ag ]]; then "${@}" --color | less -R else "${@}" --color=always | less -R fi } if [ -e /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then ZSH_SYNTAX_FILE='/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' else ZSH_SYNTAX_FILE='/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' fi # This _has_ to be the last line of the conf file if [ -e "${ZSH_SYNTAX_FILE}" ]; then source "${ZSH_SYNTAX_FILE}" else echo -e "\e[31mWARN: Could not find $ZSH_SYNTAX_FILE \e[0m" fi
C#
UTF-8
3,957
3.09375
3
[]
no_license
using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DAL { public class SQLDatabase { /// <summary> /// Lấy chuỗi kết nối /// </summary> private static string _connectionString = string.Empty; public static string ConnectionString { get { if (_connectionString.Equals("")) { _connectionString = @"Data Source=.\sqlexpress;Initial Catalog=BanVeRapChieuPhim;User ID=sa;password=MeoLuoi99"; } return _connectionString; } set { _connectionString = value; } } /// <summary> /// Mở chuỗi kết nối /// </summary> /// <returns></returns> public static SqlConnection GetConnection() { SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConnectionString; conn.Open(); return conn; } /// <summary> /// Thực hiện truy vấn ko cần trả về kết quả (delete,update,inser) /// </summary> /// <param name="cmd"></param> public static void ExecuteNoneQuery(SqlCommand cmd) { if (cmd.Connection != null) { cmd.ExecuteNonQuery(); } else { SqlConnection conn = GetConnection(); cmd.Connection = conn; cmd.ExecuteNonQuery(); } } /// <summary> /// Phương thức lấy dữ liệu trả về dataTable /// </summary> /// <param name="cmd"></param> /// <returns></returns> public static DataTable GetData(SqlCommand cmd) { if (cmd.Connection != null) { using (DataSet ds = new DataSet()) { using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); return ds.Tables[0]; } } } else { using (SqlConnection conn = GetConnection()) { cmd.Connection = conn; using (DataSet ds = new DataSet()) { using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); return ds.Tables[0]; } } } } } /// <summary> /// Phương thức lấy dữ liệu trả về tất cả các dataTable /// </summary> /// <param name="cmd"></param> /// <returns></returns> public static DataSet GetData_OverDataset(SqlCommand cmd) { if (cmd.Connection != null) { using (DataSet ds = new DataSet()) { using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); return ds; } } } else { using (SqlConnection conn = GetConnection()) { cmd.Connection = conn; using (DataSet ds = new DataSet()) { using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); return ds; } } } } } } }
Java
UTF-8
1,169
3.140625
3
[]
no_license
import java.awt.Graphics; import java.awt.Canvas; import java.awt.Color; import java.util.Date; import java.io.FileInputStream; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; public class Renderer extends Canvas implements Runnable { public BufferedImage image; public Renderer() throws Exception { super(); image = ImageIO.read(new FileInputStream("cathedral.png")); } float poziceKruhu = 250; float maximum = 500; public void paint(Graphics context){ context.clearRect(0,0,getWidth(),getHeight()); context.setColor(Color.BLACK); context.fillRect(10,10,100,100); context.drawString("This is a black square!", 120,30); context.setColor(Color.BLUE); context.fillOval(Math.round(poziceKruhu),50,50,50); context.drawImage(image, 300,300,this); } boolean running = false; long minulyRender = new Date().getTime(); long limit = 100; public void run(){ running = true; while(running){ if( new Date().getTime() - minulyRender < limit) continue; if(poziceKruhu < maximum) poziceKruhu += 0.3; System.out.println(poziceKruhu); paint(getGraphics()); minulyRender = new Date().getTime(); } } }
C++
UTF-8
402
2.65625
3
[]
no_license
// AcWing 868. 筛质数 // O(N) #include <iostream> using namespace std; const int N = 1e6 + 6; int pri[N], tp, v[N]; int n; int main() { cin >> n; for(int i = 2; i <= n; i ++) { if(!v[i]) pri[++tp] = i, v[i] = i; for(int j = 1; j <= tp; j ++) { if(pri[j] > v[i] || pri[j] > n/i) break; v[pri[j]*i] = pri[j]; } } cout << tp << endl; }
Go
UTF-8
1,723
3.03125
3
[ "MIT" ]
permissive
package login import ( "encoding/json" "log" "net/http" "github.com/snakesneaks/snakesneaks-go-game-server-test/go-game-server/service/auth" "github.com/snakesneaks/snakesneaks-go-game-server-test/go-game-server/service/model" ) // Handler handle request to game type Handler struct { } // NewHandler instantiate func NewHandler() *Handler { //log.Println("login handler") //defer log.Println("login handler end") return nil } /* REQUEST: curl -X POST -H "Content-Type: application/json" -d '{"user":{"username":"1","email":"1","password":"1"}}' localhost:8080/api/auth/login RESPONSE: {"status":"success","session":{"user_id":"0","session_id":"zhF9lO2SQjcIMuvraDmj0vH37Apoi0f9"}} */ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { //get data from request.body var u model.UserReq if err := model.UserReqHTTP(r.Body, &u); err != nil { log.Println("UserRequestHandle error: ", err) loginFailedWrite(w) return } //create new User and get session session, err := auth.Login(u.User) if err != nil { log.Println("Login error: ", err) loginFailedWrite(w) return } //success log.Println("Login success") log.Printf("userID: %d, sessionID: %s\n", session.UserID, session.SessionID) loginSuccessWrite(w, session) return } func loginFailedWrite(w http.ResponseWriter) { if err := json.NewEncoder(w).Encode(&model.SessionRes{ Status: model.AuthError, }); err != nil { w.WriteHeader(http.StatusInternalServerError) } } func loginSuccessWrite(w http.ResponseWriter, session model.Session) { if err := json.NewEncoder(w).Encode(&model.SessionRes{ Status: model.Success, Session: session, }); err != nil { w.WriteHeader(http.StatusInternalServerError) } }
Java
UTF-8
5,430
2.6875
3
[]
no_license
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package is.hi.tripPlanner.hotelPackage.HotelBookings; import is.hi.tripPlanner.hotelPackage.Models.HotelRoom; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * * @author drifasoley */ public class SQLiteJDBC { public static String hotelRoomTableName = "HotelRooms"; private static Connection getConnection() throws ClassNotFoundException { Connection conn = null; try { Class.forName("org.sqlite.JDBC"); //Class.forName("com.mysql.jdbc.Driver") conn = DriverManager.getConnection("jdbc:sqlite:hoteldatabase.db"); } catch(Exception e) { System.out.println(e.getMessage()); } return conn; } public static void createHotelRooms() { Connection c = null; Statement stmt = null; try { c = getConnection(); System.out.println("createHotelRooms: Opened database successfully"); stmt = c.createStatement(); String sql = "CREATE TABLE " + SQLiteJDBC.hotelRoomTableName + " (id INT PRIMARY KEY NOT NULL," + " hotelName TEXT NOT NULL, " + " fromAvailability DATE NOT NULL, " + " toAvailability DATE NOT NULL, " + " price INT NOT NULL, " + " type TEXT NOT NULL, " + " theme TEXT NOT NULL, " + " quality INT NOT NULL, " + " location TEXT NOT NULL);"; stmt.executeUpdate(sql); stmt.close(); c.close(); } catch ( Exception e ) { System.out.println( e.getClass().getName() + ": " + e.getMessage() ); } System.out.println("Table created successfully"); } public static void insertIntoHotelRooms(int id, String hotelName, String fromAvailability, String toAvailability, int price, String type, String theme, int quality, String location) { Connection c = null; try { c = getConnection(); c.setAutoCommit(false); Statement stmt = c.createStatement(); String sql = String.format("INSERT INTO %s VALUES(%d, '%s', '%s', '%s', %d, '%s', '%s', %d, '%s');", /*table name: */ SQLiteJDBC.hotelRoomTableName, /*value field 0:*/ id, /*value field 1:*/ hotelName, /*value field 2:*/ fromAvailability, /*value field 3:*/ toAvailability, /*value field 4:*/ price, /*value field 5:*/ type, /*value field 6:*/ theme, /*value field 7:*/ quality, /*value field 8:*/ location); stmt.executeUpdate(sql); stmt.close(); c.commit(); c.close(); } catch (Exception e) { System.out.println("INSERT ERROR: " + e.getMessage()); return; } System.out.println("Successfully inserted hotel with id: " + id); } public static HotelRoom getHotelForId(int identifier) { HotelRoom hotel = null; Connection c = null; Statement stmt = null; try { c = getConnection(); c.setAutoCommit(false); System.out.println("getHotelForId: Opened database successfully"); stmt = c.createStatement(); String query = String.format("SELECT * FROM %s WHERE id = '%d';", SQLiteJDBC.hotelRoomTableName, identifier); // breyta þessari skipun með LIKE í staðin fyrir = og í staðin fyrir ID nota hotelname, taka á móti streng í staðin fyrir id ResultSet rs = stmt.executeQuery(query); while ( rs.next() ) { int id = rs.getInt("id"); String hotelName = rs.getString("hotelName"); int price = rs.getInt("price"); String fromAvailability = rs.getString("fromAvailability"); String toAvailability = rs.getString("toAvailability"); String type = rs.getString("type"); String theme = rs.getString("theme"); int quality = rs.getInt("quality"); String location = rs.getString("location"); hotel = new HotelRoom(id, hotelName, price, fromAvailability, toAvailability, type, theme, quality, location); } rs.close(); stmt.close(); c.close(); } catch ( Exception e ) { System.out.println("SELECT ERROR:"); System.err.println( e.getClass().getName() + ": " + e.getMessage() ); return null; } System.out.println("Operation done successfully"); return hotel; } }
Shell
UTF-8
2,824
3.109375
3
[]
no_license
#!/bin/bash CD="$(pwd)" rm -rf demo mkdir demo mkdir demo/js ln -s -d $CD/node_modules/jquery/dist demo/js/jquery ln -s -d $CD/node_modules/code-prettify/loader demo/js/code-prettify mkdir demo/js/tinymce ln -s -d $CD/node_modules/tinymce/skins demo/js/tinymce/skins ln -s -d $CD/node_modules/tinymce/themes demo/js/tinymce/themes ln -s $CD/node_modules/tinymce/jquery.tinymce.js demo/js/tinymce/jquery.tinymce.js ln -s $CD/node_modules/tinymce/jquery.tinymce.min.js demo/js/tinymce/jquery.tinymce.min.js ln -s $CD/node_modules/tinymce/tinymce.js demo/js/tinymce/tinymce.js ln -s $CD/node_modules/tinymce/tinymce.min.js demo/js/tinymce/tinymce.min.js mkdir demo/js/tinymce/plugins for f in $CD/node_modules/tinymce/plugins/* do if [ -d $f ] ; then fname=$(basename $f) ln -s -d $f demo/js/tinymce/plugins/$fname fi done ln -s -d $CD/prettifier demo/js/tinymce/plugins/prettifier html_file=demo/index.html touch $html_file echo "<!DOCTYPE html>" >> $html_file echo "<html lang=\"en\">" >> $html_file echo " <head>" >> $html_file echo " <meta charset=\"utf-8\">" >> $html_file echo " <script type=\"text/javascript\" src=\"js/jquery/jquery.min.js\"></script>" >> $html_file echo " <script type=\"text/javascript\" src=\"js/tinymce/tinymce.min.js\"></script>" >> $html_file echo " <script type=\"text/javascript\" src=\"js/tinymce/jquery.tinymce.min.js\"></script>" >> $html_file echo " <script type=\"text/javascript\" src=\"js/code-prettify/prettify.js\"></script>" >> $html_file echo " </head>" >> $html_file echo " <body>" >> $html_file echo " <form action=\"\" method=\"post\">" >> $html_file echo " <textarea name=\"test\"></textarea><br><textarea name=\"test2\"></textarea><br><input type=\"submit\" value=\"Submit\">" >> $html_file echo " </form>" >> $html_file echo " <div id=\"preview\"></div>" >> $html_file echo " <script type=\"text/javascript\">" >> $html_file echo " jQuery('textarea').tinymce({" >> $html_file echo " theme: 'modern'," >> $html_file echo " plugins: 'prettifier preview fullpage code codesample'," >> $html_file echo " toolbar: 'formatselect | bold italic strikethrough forecolor backcolor | link | prettifier | preview | code codesample | fullpage'," >> $html_file echo " height: 500," >> $html_file echo " entity_encoding: 'raw'," >> $html_file echo " prettifier_languages: [{text: 'Java', value: 'java'}, {text: 'JavaScript', value: 'js'}, {text: 'HTML', value: 'html'}]" >> $html_file echo " });" >> $html_file echo " jQuery('textarea').change(function() {" >> $html_file echo " jQuery('#preview').html(jQuery(this).val());" >> $html_file echo " });" >> $html_file echo " </script>" >> $html_file echo " </body>" >> $html_file echo "</html>" >> $html_file
Shell
UTF-8
308
2.84375
3
[]
no_license
#!/bin/bash cp config/server.properties server.properties echo "Is there connect? ${ZOOKEEPER_CONNECT}" if [ ! -z $ZOOKEEPER_CONNECT ]; then sed -i 's/^zookeeper.connect=.*/zookeeper.connect='$ZOOKEEPER_CONNECT'/g' server.properties fi cat server.properties bin/kafka-server-start.sh server.properties
Java
UTF-8
42,523
1.757813
2
[]
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 Views; import Controllers.AreaJpaController; import Controllers.ContactoJpaController; import Controllers.DetalleOrdenJpaController; import Controllers.OrdenCompraJpaController; import Controllers.ProveedorJpaController; import Controllers.TrabajadorJpaController; import Entitys.Area; import Entitys.Contacto; import Entitys.DetalleOrden; import Entitys.OrdenCompra; import Entitys.Producto; import Entitys.Proveedor; import Entitys.Trabajador; import Views.Settings.ClaseJcombobox; import Views.Settings.MT_DetalleOrden; import Views.Settings.TableColumnAdjuster; import Views.Settings.Ventana; import java.awt.Toolkit; import java.util.ArrayList; import java.util.List; import javax.swing.JOptionPane; import javax.swing.JTable; import org.jdesktop.observablecollections.ObservableCollections; import org.jdesktop.observablecollections.ObservableList; /** * * @author Gabriel */ public class frmRegistroOrdenCompra extends Ventana { private static frmRegistroOrdenCompra instancia; List<Trabajador> listTrabajador= new ArrayList<>(); List<Contacto> listContacto= new ArrayList<>(); ObservableList<DetalleOrden> listDetalleOrden; /** * Creates new form frmRegistroOrdenCompra */ public frmRegistroOrdenCompra() { initComponents(); this.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - this.getWidth() / 2,Toolkit.getDefaultToolkit().getScreenSize().height / 2 - this.getHeight() / 2 ); this.presentarDatos(); this.presentarDatos("TablaDetalleOrden"); } public static frmRegistroOrdenCompra getInstancia() { if (instancia == null) { instancia = new frmRegistroOrdenCompra(); } return instancia; } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jComboBoxArea = new javax.swing.JComboBox(); jComboBoxSolicitante = new javax.swing.JComboBox(); txtSupervisor = new javax.swing.JTextField(); txtProyecto = new javax.swing.JTextField(); jDateChooserSolicitud = new com.toedter.calendar.JDateChooser(); jLabel11 = new javax.swing.JLabel(); jComboBoxElaboradox = new javax.swing.JComboBox(); jPanel2 = new javax.swing.JPanel(); jLabel6 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jComboBoxContacto = new javax.swing.JComboBox(); jComboBoxProveedor = new javax.swing.JComboBox(); jScrollPane1 = new javax.swing.JScrollPane(); jTableDetalleOrden = new javax.swing.JTable(); btnEliminar = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); jLabel7 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); txtnumorden = new javax.swing.JTextField(); jComboBoxRefeCompra = new javax.swing.JComboBox(); jComboBoxCondicionPago = new javax.swing.JComboBox(); jComboBoxComprobPago = new javax.swing.JComboBox(); jDateChooserEnvio = new com.toedter.calendar.JDateChooser(); jDateChooserEntrega = new com.toedter.calendar.JDateChooser(); jDateChooserRecepcion = new com.toedter.calendar.JDateChooser(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel19 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); txtsubtotal = new javax.swing.JTextField(); jLabel17 = new javax.swing.JLabel(); txtigv = new javax.swing.JTextField(); jLabel18 = new javax.swing.JLabel(); txtTotal = new javax.swing.JTextField(); btnGuardar = new javax.swing.JButton(); btnCancelar = new javax.swing.JButton(); jButtonListProductos = new javax.swing.JButton(); jLabel20 = new javax.swing.JLabel(); jComboBoxMoneda = new javax.swing.JComboBox(); setClosable(true); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jLabel1.setText("Area :"); jLabel2.setText("Solicitante:"); jLabel3.setText("Supervisor:"); jLabel4.setText("Proyecto:"); jLabel5.setText("Fecha de Solicitud:"); jComboBoxArea.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); jComboBoxArea.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBoxAreaActionPerformed(evt); } }); jComboBoxSolicitante.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); jLabel11.setText("Elaborado Por:"); jComboBoxElaboradox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jLabel2) .addComponent(jLabel3) .addComponent(jLabel11) .addComponent(jLabel4)) .addGap(23, 23, 23)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jComboBoxElaboradox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtSupervisor) .addComponent(jComboBoxSolicitante, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jComboBoxArea, javax.swing.GroupLayout.PREFERRED_SIZE, 316, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtProyecto)) .addGap(216, 216, 216)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jDateChooserSolicitud, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(jComboBoxArea)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jComboBoxSolicitante)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(txtSupervisor)) .addGap(11, 11, 11) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel11) .addComponent(jComboBoxElaboradox)) .addGap(11, 11, 11) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(txtProyecto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jDateChooserSolicitud, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(19, 19, 19)) ); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jLabel6.setText("Proveedor:"); jLabel8.setText("Contacto:"); jComboBoxContacto.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); jComboBoxProveedor.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); jComboBoxProveedor.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBoxProveedorActionPerformed(evt); } }); jTableDetalleOrden.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null, null} }, new String [] { "Marca", "Descripcion", "Garantia", "Unidad", "Cantidad", "PrecioUnit." } ) { Class[] types = new Class [] { java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class, java.lang.Double.class }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } }); jScrollPane1.setViewportView(jTableDetalleOrden); btnEliminar.setIcon(new javax.swing.ImageIcon("Images/Remove_24x24.png")); btnEliminar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnEliminarActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jComboBoxProveedor, javax.swing.GroupLayout.PREFERRED_SIZE, 352, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(49, 49, 49) .addComponent(btnEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(26, 26, 26) .addComponent(jLabel8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jComboBoxContacto, javax.swing.GroupLayout.PREFERRED_SIZE, 352, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 75, Short.MAX_VALUE)) .addComponent(jScrollPane1)) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(jLabel8) .addComponent(jComboBoxContacto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBoxProveedor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(btnEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE) .addContainerGap()) ); jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel3.setMinimumSize(new java.awt.Dimension(0, 0)); jPanel3.setPreferredSize(new java.awt.Dimension(640, 216)); jLabel7.setText("Fecha Envio:"); jLabel15.setText("Orden N°"); txtnumorden.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtnumordenActionPerformed(evt); } }); jComboBoxRefeCompra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " ", "Cotizacion por Correo", "Num. de Cotizacion" })); jComboBoxCondicionPago.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " ", "Cheque a 30 días", "Cheque a 60 días", "Cheque a 90 días", "Cheque a 105 días", "Contado" })); jComboBoxComprobPago.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " ", "Boleta de Pago", "Factura", "Recibo por Honorarios" })); jLabel9.setText("Fecha de Entrega:"); jLabel10.setText("Fecha de Recepcion:"); jLabel12.setText("Referencia de Compra:"); jLabel13.setText("Condiciones de Pago:"); jLabel14.setText("Comprobante de Pago:"); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE) .addGap(26, 26, 26)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jDateChooserEntrega, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jDateChooserRecepcion, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jDateChooserEnvio, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jComboBoxCondicionPago, javax.swing.GroupLayout.Alignment.LEADING, 0, 347, Short.MAX_VALUE) .addComponent(jComboBoxComprobPago, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jComboBoxRefeCompra, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup() .addGap(176, 176, 176) .addComponent(jLabel15) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtnumorden, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(36, 36, 36)))) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel7) .addGap(0, 0, Short.MAX_VALUE)))) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jDateChooserEnvio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel15) .addComponent(txtnumorden))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jDateChooserEntrega, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(11, 11, 11) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jDateChooserRecepcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel10)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jComboBoxRefeCompra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(13, 13, 13) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jComboBoxCondicionPago, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jComboBoxComprobPago, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(0, 0, Short.MAX_VALUE)) ); jLabel19.setIcon(new javax.swing.ImageIcon("Images/ordenescompra_opt.png")); jLabel16.setText("SUB TOTAL:"); jLabel17.setText("IGV:"); jLabel18.setText("TOTAL:"); btnGuardar.setText("Guardar"); btnGuardar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnGuardarActionPerformed(evt); } }); btnCancelar.setText("Cancelar"); jButtonListProductos.setIcon(new javax.swing.ImageIcon("Images/Notepad.png")); jButtonListProductos.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonListProductosActionPerformed(evt); } }); jLabel20.setText("Moneda:"); jComboBoxMoneda.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " ", "$", "S/." })); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 467, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 531, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel19, javax.swing.GroupLayout.DEFAULT_SIZE, 0, Short.MAX_VALUE) .addGap(22, 22, 22)) .addGroup(layout.createSequentialGroup() .addGap(0, 33, Short.MAX_VALUE) .addComponent(btnGuardar) .addGap(18, 18, 18) .addComponent(btnCancelar) .addGap(35, 35, 35)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel16) .addComponent(jLabel17) .addComponent(jLabel18) .addComponent(jLabel20) .addComponent(jButtonListProductos, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(44, 44, 44) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtigv, javax.swing.GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE) .addComponent(txtsubtotal, javax.swing.GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE) .addComponent(txtTotal, javax.swing.GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE) .addComponent(jComboBoxMoneda, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGap(6, 6, 6) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(layout.createSequentialGroup() .addGap(40, 40, 40) .addComponent(jLabel19, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButtonListProductos, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(33, 33, 33) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel20) .addComponent(jComboBoxMoneda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel16) .addComponent(txtsubtotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel17) .addComponent(txtigv, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel18) .addComponent(txtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(42, 42, 42) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnGuardar) .addComponent(btnCancelar)) .addGap(42, 42, 42)))) ); pack(); }// </editor-fold>//GEN-END:initComponents private void txtnumordenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtnumordenActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtnumordenActionPerformed private void jComboBoxAreaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxAreaActionPerformed // TODO add your handling code here: jComboBoxSolicitante.removeAllItems(); while(this.listTrabajador.size()>0)this.listTrabajador.remove(0); ClaseJcombobox cjbxArea = (ClaseJcombobox) jComboBoxArea.getSelectedItem(); Area oarea = new Area(); oarea.setIdArea(cjbxArea.getTipoid()); listTrabajador = controladorTrabajador.buscarXAreas(oarea); for (Trabajador listTrabajador1 : listTrabajador) { jComboBoxSolicitante.addItem(new ClaseJcombobox(listTrabajador1.getNombres(), listTrabajador1.getIdTrabajador())); } txtSupervisor.setText(controladorTrabajador.buscarXResponsable(oarea).get(0).getApellidos()+" "+controladorTrabajador.buscarXResponsable(oarea).get(0).getNombres()); }//GEN-LAST:event_jComboBoxAreaActionPerformed private void jComboBoxProveedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxProveedorActionPerformed // TODO add your handling code here: jComboBoxContacto.removeAllItems(); while(this.listContacto.size()>0)this.listContacto.remove(0); ClaseJcombobox cjbxProveedor = (ClaseJcombobox) jComboBoxProveedor.getSelectedItem(); Proveedor oproveedor = new Proveedor(); oproveedor.setIdProveedor(cjbxProveedor.getTipoid()); listContacto = controladorContacto.buscarXProveedor(oproveedor); for (Contacto listContacto1 : listContacto) { jComboBoxContacto.addItem(new ClaseJcombobox(listContacto1.getNombre(), listContacto1.getIdContacto())); } }//GEN-LAST:event_jComboBoxProveedorActionPerformed private void jButtonListProductosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonListProductosActionPerformed // TODO add your handling code here: frmListProductos lp = new frmListProductos(this); frmPrincipal.jDesktopPane1.add(lp); lp.toFront(); lp.setVisible(true); }//GEN-LAST:event_jButtonListProductosActionPerformed private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed // TODO add your handling code here: if(jTableDetalleOrden.getSelectedRow() == -1 || jTableDetalleOrden.getSelectedRow() >= jTableDetalleOrden.getRowCount()){ JOptionPane.showMessageDialog(this, "Seleccione un Producto","Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE); }else{ int dato = jTableDetalleOrden.getSelectedRow(); this.listDetalleOrden.remove(dato); this.presentarDatos("TablaDetalleOrden"); } }//GEN-LAST:event_btnEliminarActionPerformed private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed // TODO add your handling code here: //////*****Guardando OrdenCompra*****////// OrdenCompra ordenCompra = new OrdenCompra(); ordenCompra.setNumeroOrden(txtnumorden.getText());ordenCompra.setFechaSolicitud(jDateChooserSolicitud.getDate()); ordenCompra.setFechaProcenvio(jDateChooserEnvio.getDate());ordenCompra.setFechaEntrega(jDateChooserEntrega.getDate()); ordenCompra.setFechaRecepcion(jDateChooserRecepcion.getDate());ordenCompra.setNomProyecto(txtProyecto.getText()); ordenCompra.setReferenciaCompra((String) jComboBoxRefeCompra.getModel().getSelectedItem()); ordenCompra.setCondicionPago((String) jComboBoxCondicionPago.getModel().getSelectedItem()); ordenCompra.setComprobantePago((String) jComboBoxComprobPago.getModel().getSelectedItem()); ordenCompra.setMoneda((String) jComboBoxMoneda.getModel().getSelectedItem()); //------->ObteniendoTrabajador<-------// Trabajador trabajador = new Trabajador(); Contacto contacto = new Contacto(); ClaseJcombobox cjbxTrabajador = (ClaseJcombobox) jComboBoxSolicitante.getSelectedItem(); trabajador.setIdTrabajador(cjbxTrabajador.getTipoid()); ordenCompra.setIdSolicitante(trabajador); ClaseJcombobox cjbxTrabajador2 = (ClaseJcombobox) jComboBoxElaboradox.getSelectedItem(); trabajador.setIdTrabajador(cjbxTrabajador2.getTipoid()); ordenCompra.setIdElaborador(trabajador); ClaseJcombobox cjbxContacto = (ClaseJcombobox) jComboBoxContacto.getSelectedItem(); contacto.setIdContacto(cjbxContacto.getTipoid()); ordenCompra.setIdContacto(contacto); controladorOrdenCompra.create(ordenCompra); //creando orden de compra // List<DetalleOrden> listDetalleOrdenGuardar = new ArrayList<>(); // //////*****Guardando Detalle de OrdenCompra*****////// // for (int i = 0; i < jTableDetalleOrden.getRowCount(); i++) { // DetalleOrden detalleOrdenCompra = new DetalleOrden(); // detalleOrdenCompra.setIdOrdenCompra(ordenCompra); // detalleOrdenCompra.setIdProducto(listDetalleOrden.get(i).getIdProducto()); // System.out.println(listDetalleOrden.get(i).getIdProducto()); // detalleOrdenCompra.setGarantia(jTableDetalleOrden.getValueAt(i, 2).toString()); // detalleOrdenCompra.setUnidad(jTableDetalleOrden.getValueAt(i, 3).toString()); // detalleOrdenCompra.setCantidad(Integer.parseInt((String) jTableDetalleOrden.getValueAt(i,4))); // BigDecimal bd=new BigDecimal(jTableDetalleOrden.getValueAt(i,5).toString()); // detalleOrdenCompra.setPrecioorden(bd); // listDetalleOrdenGuardar.add(detalleOrdenCompra); // } // ordenCompra.setDetalleOrdenList(listDetalleOrdenGuardar); // controladorOrdenCompra.create(ordenCompra); // JOptionPane.showMessageDialog(null, "Orden de Compra Registrada Correctamente", "Mensaje del Sistema", JOptionPane.INFORMATION_MESSAGE); }//GEN-LAST:event_btnGuardarActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCancelar; private javax.swing.JButton btnEliminar; private javax.swing.JButton btnGuardar; private javax.swing.JButton jButtonListProductos; private javax.swing.JComboBox jComboBoxArea; private javax.swing.JComboBox jComboBoxComprobPago; private javax.swing.JComboBox jComboBoxCondicionPago; private javax.swing.JComboBox jComboBoxContacto; private javax.swing.JComboBox jComboBoxElaboradox; private javax.swing.JComboBox jComboBoxMoneda; private javax.swing.JComboBox jComboBoxProveedor; private javax.swing.JComboBox jComboBoxRefeCompra; private javax.swing.JComboBox jComboBoxSolicitante; private com.toedter.calendar.JDateChooser jDateChooserEntrega; private com.toedter.calendar.JDateChooser jDateChooserEnvio; private com.toedter.calendar.JDateChooser jDateChooserRecepcion; private com.toedter.calendar.JDateChooser jDateChooserSolicitud; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel20; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTableDetalleOrden; private javax.swing.JTextField txtProyecto; private javax.swing.JTextField txtSupervisor; private javax.swing.JTextField txtTotal; private javax.swing.JTextField txtigv; private javax.swing.JTextField txtnumorden; private javax.swing.JTextField txtsubtotal; // End of variables declaration//GEN-END:variables AreaJpaController controladorArea = new AreaJpaController(); TrabajadorJpaController controladorTrabajador = new TrabajadorJpaController(); ProveedorJpaController controladorProveedor = new ProveedorJpaController(); ContactoJpaController controladorContacto = new ContactoJpaController(); DetalleOrdenJpaController controladorDetalleOrden = new DetalleOrdenJpaController(); OrdenCompraJpaController controladorOrdenCompra = new OrdenCompraJpaController(); @Override public void presentarDatos() { List<Area> listTipoareas = controladorArea.findAreaEntities(); List<Trabajador> listTrabajadores = controladorTrabajador.findTrabajadorEntities(); List<Proveedor> listProveedor = controladorProveedor.findProveedorEntities(); for (Area listtipoarea1 : listTipoareas) {jComboBoxArea.addItem(new ClaseJcombobox(listtipoarea1.getNombre(), listtipoarea1.getIdArea()));} for (Trabajador listTrabajador1 : listTrabajadores) {jComboBoxElaboradox.addItem(new ClaseJcombobox(listTrabajador1.getApellidos()+" "+listTrabajador1.getNombres(), listTrabajador1.getIdTrabajador()));} for (Proveedor listProveedor1 : listProveedor) {jComboBoxProveedor.addItem(new ClaseJcombobox(listProveedor1.getRazonsocial(), listProveedor1.getIdProveedor()));} } @Override public void llenarCampos(Object objeto) { } @Override public void presentarDatos(String opcion) { if (opcion.equals("TablaDetalleOrden")) { listDetalleOrden = ObservableCollections.observableList(listDetalleOrden); MT_DetalleOrden mt = new MT_DetalleOrden(listDetalleOrden); listDetalleOrden.addObservableListListener(mt); this.jTableDetalleOrden.setModel(mt); } } @Override public void llenarCampos(String opcion, Object objeto) { if (opcion.equals("Pedido")) { DetalleOrden odetalleorden = new DetalleOrden(); odetalleorden.setIdProducto((Producto) objeto); odetalleorden.setUnidad("Unid."); this.listDetalleOrden.add(odetalleorden); } } @Override public void limpiarFormulario() { } public void setAnchoColumnas(){ jTableDetalleOrden.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); TableColumnAdjuster tca = new TableColumnAdjuster(jTableDetalleOrden); tca.adjustColumns(); } }
C++
UTF-8
814
2.640625
3
[]
no_license
#ifndef DOS_JUGADORES_H #define DOS_JUGADORES_H #include <SFML/Graphics.hpp> class Dos_Jugadores { public: Dos_Jugadores(); sf::Texture cuadro1,cuadro2,cuadro3,cuadro4,cuadro5,cuadro6,cuadro7,cuadro8,cuadro9; sf::Sprite sp1,sp2,sp3,sp4,sp5,sp6,sp7,sp8,sp9; char tablero[3][3]; char turno='O'; bool cambiarTurno(int x,int y); void inicializarTablero(); void texturas(); void primerCuadro(); void segundoCuadro(); void tercerCuadro(); void cuartoCuadro(); void quintoCuadro(); void sextoCuadro(); void septimoCuadro(); void octavoCuadro(); void novenoCuadro(); char ganar(); virtual ~Dos_Jugadores(); protected: private: }; #endif // DOS_JUGADORES_H
C#
UTF-8
3,948
3.234375
3
[ "MIT" ]
permissive
namespace _02_MatchMaker { using System; using System.Collections.Generic; using System.Linq; public static class Program { private static readonly Dictionary<string, List<string>> interestNodes = new Dictionary<string, List<string>>(); private static readonly HashSet<string> boys = new HashSet<string>(); private static readonly HashSet<string> girls = new HashSet<string>(); private static readonly Queue<string> q = new Queue<string>(); private static readonly Dictionary<string, int> foundMatches = new Dictionary<string, int>(); public static void Main() { ReadInput(); Solve(); } private static void ReadInput() { int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { string name = Console.ReadLine(); string gender = Console.ReadLine(); Console.ReadLine(); var interests = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Distinct(); foreach (var interest in interests) { string startNode; string endNode; if (gender == "m") { startNode = name; endNode = interest; if (!interestNodes.ContainsKey(endNode)) { interestNodes.Add(endNode, new List<string>()); } boys.Add(name); } else { startNode = interest; endNode = name; girls.Add(name); } if (!interestNodes.ContainsKey(startNode)) { interestNodes.Add(startNode, new List<string>()); } interestNodes[startNode].Add(endNode); } } } private static void Solve() { int bestMatch = 0; string bestBoy = string.Empty; string bestGirl = string.Empty; foreach (string boy in boys) { foundMatches.Clear(); q.Enqueue(boy); while (q.Count > 0) { string current = q.Dequeue(); foreach (string next in interestNodes[current]) { if (girls.Contains(next)) { if (!foundMatches.ContainsKey(next)) { foundMatches.Add(next, 0); } ++foundMatches[next]; } else { q.Enqueue(next); } } } int currentMatch = 0; string currentGal = string.Empty; foreach (var match in foundMatches) { if (currentMatch < match.Value) { currentMatch = match.Value; currentGal = match.Key; } } if (bestMatch < currentMatch || (bestMatch == currentMatch && 0 < string.Compare(bestBoy, boy))) { bestMatch = currentMatch; bestBoy = boy; bestGirl = currentGal; } } Console.WriteLine("{0} and {1} have {2} common interest{3}!", bestBoy, bestGirl, bestMatch, bestMatch == 1 ? "" : "s"); } } }
JavaScript
UTF-8
393
3.25
3
[]
no_license
function countingValleys(n, s) { var levelBySea = 0, valleysCount = 0; for (var i = 0; i < n; i++) { levelBySea = s.charAt(i) === "U" ? levelBySea + 1 : levelBySea - 1; if (levelBySea === 0 && s.charAt(i) === "U") valleysCount++; } return valleysCount; } var res = countingValleys(8, "UDDDUDUU"); console.log(res);
Python
UTF-8
278
3.34375
3
[]
no_license
# https://leetcode.com/problems/remove-element/ class Solution: def removeElement(self, arr: List[int], val: int) -> int: l = 0 for i in range(len(arr)): if arr[i] != val: arr[l] = arr[i] l += 1 return l
Java
UTF-8
269
2.234375
2
[]
no_license
package com.iconmaster.aec.aether.flattener; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class ItemFlattener implements IFlattenerHandler<Item> { @Override public ItemStack flatten(Item input) { return new ItemStack(input); } }
Java
UTF-8
594
3.109375
3
[]
no_license
package main.java.sw03; public class BSTNode { private int mData; private BSTNode mLeft; private BSTNode mRight; public BSTNode(int pData) { this.mData = pData; this.mLeft = null; this.mRight = null; } public int getData() { return mData; } public BSTNode getLeft() { return mLeft; } public void setLeft(BSTNode newLeft) { this.mLeft = newLeft; } public BSTNode getRight() { return mRight; } public void setRight(BSTNode newRight) { this.mRight = newRight; } }
C++
UTF-8
49,160
2.765625
3
[]
no_license
#include "simulation.h" int main(int argc, char const *argv[]) { // check arguments number try{ if(argc < 3){ ostringstream oStream; oStream << "Error: Wrong number of arguments!" << endl; oStream << "Usage: ./p2 <username> <logfile>" << endl; throw Exception_t(INVALID_ARGUMENT, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; return 0; } //read the arguments string name = argv[1]; string logname = argv[2]; //open file username ifstream iFile; iFile.open(name); //check whether open successfully try{ if(!iFile){ ostringstream oStream; oStream << "Error: Cannot open file " << name << "!" << endl; throw Exception_t(FILE_MISSING, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; return 0; } //create max number of struct tag_t Tag_t tag[5000]; for(int i = 0; i < 5000; i++){ tag[i].tag_score = 0; } //read the name of users User_t user[MAX_USERS + 1]; int n = 0;//number of users read if (iFile){ string line; while(getline(iFile, line)) { user[n].username = line; n++; if(n > 20) break; } iFile.close(); } iFile.close(); //check user number exception try{ if(n > 20){ ostringstream oStream; oStream << "Error: Too many users! " << endl; oStream << "Maximal number of users is " << MAX_USERS << "." << endl; throw Exception_t(CAPACITY_OVERFLOW, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; return 0; } //open and read user_info ifstream userinfor; //ckech exception missing file int wrong_number = -1; for(int k = 1; k <= n - 1; k++){ string location = user[0].username+ "/" + user[k].username + "/user_info"; userinfor.open(location); if(!userinfor){ wrong_number = k; break; } userinfor.close(); } //check missing file exception try{ if(wrong_number != -1){ ostringstream oStream; oStream << "Error: Cannot open file" << endl; oStream << user[0].username <<"/" << user[wrong_number].username << "/user_info!" << endl; throw Exception_t(FILE_MISSING, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; return 0; } // read user_info for(int k = 1; k <= n - 1; k++){ string location = user[0].username+ "/" + user[k].username + "/user_info"; userinfor.open(location); //post number unsigned int num; string line; getline(userinfor,line); num = atoi(line.c_str()); //check posts number exception try{ if(num > MAX_POSTS){ ostringstream oStream; oStream << "Error: Too many posts for user " << user[k].username << "!" << endl; oStream << "Maximal number of posts is " << MAX_POSTS << "." << endl; throw Exception_t(CAPACITY_OVERFLOW, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; return 0; } user[k].num_posts = num; //following number getline(userinfor,line); num = atoi(line.c_str()); //check following number exception try{ if(num > MAX_FOLLOWING){ ostringstream oStream; oStream << "Error: Too many followings for user " << user[k].username << "!" << endl; oStream << "Maximal number of followings is " << MAX_FOLLOWING << "." << endl; throw Exception_t(CAPACITY_OVERFLOW, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; return 0; } user[k].num_following = num; //read following TODO:need exception exam for(unsigned int i = 0; i < num; i++){ getline(userinfor,line); for(int j = 1; j <= n-1; j++){ if(line == user[j].username){ user[k].following[i] = &user[j];//point to another user } } } //follower number getline(userinfor,line); num = atoi(line.c_str()); //check follower number exception try{ if(num > MAX_FOLLOWERS){ ostringstream oStream; oStream << "Error: Too many followers for user " << user[k].username << "!" << endl; oStream << "Maximal number of followers is " << MAX_FOLLOWERS << "." << endl; throw Exception_t(CAPACITY_OVERFLOW, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; return 0; } user[k].num_followers = num; //read followers TODO:need exception exam for(unsigned int i = 0; i < num; i++){ getline(userinfor,line); for(int j = 1; j <= n; j++){ if(line == user[j].username){ user[k].follower[i] = &user[j]; } } } userinfor.close(); } //open and read posts ifstream postinfo; unsigned int number_tag[MAX_USERS + 1][MAX_POSTS] = {0}; unsigned int number_likes[MAX_USERS + 1][MAX_POSTS] = {0}; unsigned int number_comments[MAX_USERS + 1][MAX_POSTS] = {0}; for(int j = 1; j <= n-1; j++){//every user if(user[j].num_posts > 0){ for(unsigned int i = 1; i <= user[j].num_posts; i++){//every post int num_tag = 0; string lo_num = to_string(i);//post name string location = user[0].username+ "/" + user[j].username + "/posts/" + lo_num; postinfo.open(location); //get title string line; getline(postinfo,line); user[j].posts[i-1].title = line; //get tags number only while(1){ getline(postinfo,line); if(line[0] == '#' && line[line.size()-1] == '#'){ num_tag++; } else break; } number_tag[j][i-1] = num_tag;//jth user's ith post's tag number; //read the text user[j].posts[i-1].text = line; //read the likes number getline(postinfo,line); number_likes[j][i-1] = atoi(line.c_str()); //skip the likes if(number_likes[j][i-1] != 0){ for(unsigned int a = 0; a < number_likes[j][i-1]; a++) getline(postinfo,line); } //read the comments number getline(postinfo,line); number_comments[j][i-1] = atoi(line.c_str()); postinfo.close(); } } } //examine the tag number TODO: find a counterexample! int flag_1 = 0; int wrong_user; int wrong_post; for(int i = 1; i <= n-1; i++){//each user tag number for(unsigned int j = 1; j <= user[i].num_posts; j++){//each post if(number_tag[i][j-1] > MAX_TAGS){ wrong_user = i; wrong_post = j-1; flag_1++; break; } } if(flag_1 == 1) break; } //check tags number exception try{ if(flag_1 == 1){ ostringstream oStream; oStream << "Error: Too many tags for post " << user[wrong_user].posts[wrong_post].title << "!" << endl; oStream << "Maximal number of tags is " << MAX_TAGS << "." << endl; throw Exception_t(CAPACITY_OVERFLOW, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; return 0; } flag_1 = 0; //identify which user's like number is wrong! for(int i = 1; i <= n-1; i++){//each user's like number for(unsigned int j = 1; j <= user[i].num_posts; j++){//each post if(number_likes[i][j-1] > MAX_LIKES){ wrong_user = i; wrong_post = j-1; flag_1++; break; } } if(flag_1 == 1) break; } //check like number exception try{ if(flag_1 == 1){ ostringstream oStream; oStream << "Error: Too many likes for post " << user[wrong_user].posts[wrong_post].title << "!" << endl; oStream << "Maximal number of likes is " << MAX_LIKES << "." << endl; throw Exception_t(CAPACITY_OVERFLOW, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; return 0; } flag_1 = 0; //identify which user's comments number is wrong! for(int i = 1; i <= n-1; i++){//each user comments number for(unsigned int j = 1; j <= user[i].num_posts; j++){//each post if(number_comments[i][j-1] > MAX_COMMENTS){ wrong_user = i; wrong_post = j-1; flag_1++; break; } } if(flag_1 == 1) break; } //check comments number exception try{ if(flag_1 == 1){ ostringstream oStream; oStream << "Error: Too many comments for post " << user[wrong_user].posts[wrong_post].title << "!" << endl; oStream << "Maximal number of comments is " << MAX_COMMENTS << "." << endl; throw Exception_t(CAPACITY_OVERFLOW, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; return 0; } //put the number into each post for(int j = 1; j <= n-1; j++){ for(unsigned int i = 1; i <= user[j].num_posts; i++){ user[j].posts[i-1].num_tags = number_tag[j][i-1]; user[j].posts[i-1].num_likes = number_likes[j][i-1]; user[j].posts[i-1].num_comments = number_comments[j][i-1]; } } //read posts! for(int j = 1; j <= n-1; j++){//every user if(user[j].num_posts > 0){ for(unsigned int i = 1; i <= user[j].num_posts; i++){//every post string lo_num = to_string(i);//post name string location = user[0].username+ "/" + user[j].username + "/posts/" + lo_num; postinfo.open(location); //get title string line; getline(postinfo,line); //read tags int t = 0; while(1){ getline(postinfo,line); if(line[0] == '#' && line[line.size()-1] == '#'){ int size = line.size()-1; for(int k = 1; k < size; k++){ user[j].posts[i-1].tags[t] = user[j].posts[i-1].tags[t] + line[k]; } t++; } else break; } //read text user[j].posts[i-1].text = line; //skip likes number and read number getline(postinfo,line);//skip likes number if(user[j].posts[i-1].num_likes > 0){//assign likes for(unsigned int k = 0; k < user[j].posts[i-1].num_likes; k++){ getline(postinfo,line); for(int m = 1; m <= n; m++){ if(user[m].username == line){ user[j].posts[i-1].like_users[k] = &user[m]; break; } } } } //skip comments number and read comments getline(postinfo,line);//skip comments number if(user[j].posts[i-1].num_comments > 0){//read comments for(unsigned int k = 0; k < user[j].posts[i-1].num_comments; k++){ getline(postinfo,line);//read username for(int m = 1; m <= n; m++){ if(user[m].username == line){ user[j].posts[i-1].comments[k].user = &user[m]; break; } } getline(postinfo,line);//read comments text user[j].posts[i-1].comments[k].text = line; } } //assign owner user[j].posts[i-1].owner = &user[j]; //close the file postinfo.close(); } } } //read the logfile! ifstream log; log.open(logname); string line; while(getline(log,line)){ int order = 0; //trending int position_trending = line.find("trending"); int position_visit = line.find("visit"); int position_refresh = line.find("refresh"); int position_follow = line.find("follow"); int position_post = line.find("post"); int position_like = line.find("like"); int position_comment = line.find("comment"); int position_unlike = line.find("unlike"); int position_uncomment = line.find("uncomment"); int position_delete = line.find("delete"); int position_unfollow = line.find("unfollow"); if(position_trending >= 0/*TODO:WRONG!*/){ cout << ">> trending" << endl; int top_n;//top nth tag string number; while(line[order+9]){ number = number + line[order+9]; order++; } top_n = atoi(number.c_str()); //read all users' all posts' all tags int current_tag_number = 0; //get current tag number for(int j = 1; j <= n-1; j++){//every user if(user[j].num_posts > 0){ for(unsigned int i = 1; i <= user[j].num_posts; i++){//every post current_tag_number += user[j].posts[i-1].num_tags; } } } //get current none-empty struct tag number int current_tag_struct_num = 0; while(1){ if(!tag[current_tag_struct_num].tag_content.empty()){ current_tag_struct_num++; } else break; } for(int j = 1; j <= n-1; j++){//every user if(user[j].num_posts > 0){ for(unsigned int i = 1; i <= user[j].num_posts; i++){//every post for(unsigned int k = 0; k < user[j].posts[i-1].num_tags; k++){ int nth = 0; while(nth < current_tag_struct_num){ if(user[j].posts[i-1].tags[k] == tag[nth].tag_content) break; else nth++; } if(nth == current_tag_struct_num){//if the tag is new! tag[current_tag_struct_num].tag_content = user[j].posts[i-1].tags[k]; tag[current_tag_struct_num].tag_score = 5 + user[j].posts[i-1].num_likes + user[j].posts[i-1].num_comments*3; current_tag_struct_num++; } else{// if the tag is not new tag[nth].tag_score = tag[nth].tag_score + 5 + user[j].posts[i-1].num_likes + user[j].posts[i-1].num_comments*3; } } } } } //rank the tags and post! for(int i = 0; i < current_tag_struct_num - 1; i++) { for(int j = 0; j < current_tag_struct_num - 1 - i; j++) { if(tag[j].tag_score < tag[j+1].tag_score) { // switch two tag structs int temp_score = tag[j+1].tag_score; tag[j+1].tag_score = tag[j].tag_score; tag[j].tag_score = temp_score; //switch two tag content string temp_content = tag[j+1].tag_content; tag[j+1].tag_content = tag[j].tag_content; tag[j].tag_content = temp_content; } } } //rank the tags with the same score for(int i = 0; i < current_tag_struct_num - 1; i++) { for(int j = 0; j < current_tag_struct_num - 1 - i; j++) { if(tag[j].tag_score == tag[j+1].tag_score){ int k = 0; int small_size; int switch_po = 0; if(tag[j].tag_content.size() <= tag[j+1].tag_content.size()){ small_size = tag[j].tag_content.size(); } else{ small_size =tag[j+1].tag_content.size(); } while(k < small_size){ if(tag[j].tag_content[k] == tag[j+1].tag_content[k]){ k++; } else if(tag[j].tag_content[k] < tag[j+1].tag_content[k]){ break; } else{ switch_po = 1; break; } } if(switch_po){ //switch two tag content string temp_content = tag[j+1].tag_content; tag[j+1].tag_content = tag[j].tag_content; tag[j].tag_content = temp_content; } } } } //assign reference to tags if(top_n > current_tag_struct_num){// top is more than current tag struct number for(int i = 0; i < current_tag_struct_num; i++){ // const Tag_t &r_tag = tag[i]; // printTag(r_tag, i+1); printTag(tag[i],i+1); //cout << i+1 << " " << tag[i].tag_content << ": " << tag[i].tag_score << endl; } } else{ for(int i = 0; i < top_n; i++){ // const Tag_t &r_tag = tag[i]; // printTag(r_tag, i+1); printTag(tag[i],i+1); //cout << i+1 << " " << tag[i].tag_content << ": " << tag[i].tag_score << endl; } } //clear all tag score to 0 for(int i = 0; i < current_tag_struct_num; i++){ tag[i].tag_score = 0; tag[i].tag_content = ""; } } else if(position_visit > 0){// not yet test with g++ cout << ">> visit" << endl; string user1name; string user2name; //get the name of two users for(int i = 0; i < position_visit - 1; i++){ user1name = user1name + line[i]; } int j = position_visit + 6; while(line[j]){ user2name = user2name + line[j]; j++; } //figure out the relationship int user1_order = 1; int user2_order = 1; string relationship; int one_following_two = 0; int two_following_one = 0; int following_himself = 0; while(1){//get the order of first users if(user[user1_order].username == user1name) break; else user1_order++; } while(1){//get the order of second users if(user[user2_order].username == user2name) break; else user2_order++; } if(user[user1_order].num_following > 0){// check the first user for(unsigned int i = 0; i < user[user1_order].num_following; i++){ if(user[user1_order].following[i]->username == user[user1_order].username){ following_himself = 1; } else if(user[user1_order].following[i]->username == user[user2_order].username){ one_following_two = 1; } } } if(user[user2_order].num_following > 0){// check the second user for(unsigned int i = 0; i < user[user2_order].num_following; i++){ if(user[user2_order].following[i]->username == user[user1_order].username){ two_following_one = 1; } } } //decide relationship if(following_himself == 1) relationship = ""; else if(one_following_two == 1 && two_following_one == 1) relationship = "friend"; else if(one_following_two == 1 && two_following_one == 0) relationship = "following"; else if(one_following_two == 0) relationship = "stranger"; //print User_t& r_user = user[user2_order]; printUser(r_user,relationship); // cout << user[user2_order].username << endl; // cout << relationship << endl; // cout << "Followers: " << user[user2_order].num_followers // << "\nFollowing: " << user[user2_order].num_following << endl; } else if(position_follow > 0 && position_unfollow < 0){ cout << ">> follow" << endl; string user1name; string user2name; //get the name of two users for(int i = 0; i < position_follow - 1; i++){ user1name = user1name + line[i]; } int j = position_follow + 7; while(line[j]){ user2name = user2name + line[j]; j++; } // get orders of two users int user1_order = 1; int user2_order = 1; while(1){//get the order of first users if(user[user1_order].username == user1name) break; else user1_order++; } while(1){//get the order of second users if(user[user2_order].username == user2name) break; else user2_order++; } //be each other's follower and following user[user2_order].follower[user[user2_order].num_followers] = &user[user1_order]; user[user1_order].following[user[user1_order].num_following] = &user[user2_order]; user[user2_order].num_followers++; user[user1_order].num_following++; } else if(position_refresh > 0){ cout << ">> refresh" << endl; string user1name; //read the name of user1 for(int i = 0; i < position_refresh - 1; i++){ user1name = user1name + line[i]; } //get the order of the user int user1_order = 1; while(1){//get the order of first users if(user[user1_order].username == user1name) break; else user1_order++; } //print user1's own posts if(user[user1_order].num_posts > 0){ for(unsigned int i = 0; i < user[user1_order].num_posts; i++){ printPost(user[user1_order].posts[i]); } } //print following's posts if(user[user1_order].num_following > 0){ for(unsigned int i = 0; i < user[user1_order].num_following; i++){ if(user[user1_order].following[i]->num_posts > 0){ for(unsigned int j = 0; j < user[user1_order].following[i]->num_posts; j++){ printPost(user[user1_order].following[i]->posts[j]); } } } } } else if(position_post > 0){ cout << ">> post" << endl; string user1name; //read the name of user1 for(int i = 0; i < position_post - 1; i++){ user1name = user1name + line[i]; } //get the order of the user int user1_order = 1; while(1){//get the order of first users if(user[user1_order].username == user1name) break; else user1_order++; } //assign the owner of the post to the user user[user1_order].posts[user[user1_order].num_posts].owner = &user[user1_order]; //get title getline(log,line); user[user1_order].posts[user[user1_order].num_posts].title = line; //get tags int t = 0; while(1){ getline(log,line); if(line[0] == '#' && line[line.size()-1] == '#'){ int size = line.size()-1; for(int k = 1; k < size; k++){ user[user1_order].posts[user[user1_order].num_posts].tags[t] = user[user1_order].posts[user[user1_order].num_posts].tags[t] + line[k]; } //user[user1_order].posts[user[user1_order].num_posts].tags[t] = line; t++; } else break; } user[user1_order].posts[user[user1_order].num_posts].num_tags = t;//jth user's ith post's tag number; //read the text user[user1_order].posts[user[user1_order].num_posts].text = line; //initialize likes and comments user[user1_order].posts[user[user1_order].num_posts].num_likes = 0; user[user1_order].posts[user[user1_order].num_posts].num_comments = 0; //add post numbers user[user1_order].num_posts++; } else if(position_like > 0 && position_unlike < 0){ cout << ">> like" << endl; string user1name; string user2name; string post_number; //get the name of two users for(int i = 0; i < position_like - 1; i++){ user1name = user1name + line[i]; } int j = position_like + 5; while(line[j] != ' '){ user2name = user2name + line[j]; j++; } //skip the space j++; //get the post number unsigned int like_post_num; while(line[j]){ post_number = post_number + line[j]; j++; } like_post_num = atoi(post_number.c_str()); // get orders of two users int user1_order = 1; int user2_order = 1; while(1){//get the order of first users if(user[user1_order].username == user1name) break; else user1_order++; } while(1){//get the order of second users if(user[user2_order].username == user2name) break; else user2_order++; } //check exception //1. no user2 post try{ if(user[user2_order].num_posts < like_post_num){ ostringstream oStream; oStream << "Error: " << user[user1_order].username << " cannot like post #" << like_post_num << " of " << user[user2_order].username << "!" << endl; oStream << user[user2_order].username << " does not have post #" << like_post_num << "." << endl; throw Exception_t(INVALID_LOG, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; continue; } //2. user1 alreaday like this post int flag = 0;// judge whether user1 alreaday like this post for(unsigned int i = 0; i < user[user2_order].posts[like_post_num-1].num_likes; i++){ if(user[user2_order].posts[like_post_num-1].like_users[i]->username == user1name){ flag = 1; break; } } try{ if(flag == 1){ ostringstream oStream; oStream << "Error: " << user[user1_order].username << " cannot like post #" << like_post_num << " of " << user[user2_order].username << "!" << endl; oStream << user[user1_order].username << " has already like post #" << like_post_num << " of " << user[user2_order].username << "." << endl; throw Exception_t(INVALID_LOG, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; continue; } //if no exception user[user2_order].posts[like_post_num-1].like_users[user[user2_order].posts[like_post_num-1].num_likes] = &user[user1_order]; user[user2_order].posts[like_post_num-1].num_likes++; } else if(position_comment > 0 && position_uncomment < 0){ cout << ">> comment" << endl; string user1name; string user2name; string post_number; //get the name of two users for(int i = 0; i < position_comment - 1; i++){ user1name = user1name + line[i]; } int j = position_comment + 8; while(line[j] != ' '){ user2name = user2name + line[j]; j++; } //skip the space j++; //get the post number unsigned int comment_post_num; while(line[j]){ post_number = post_number + line[j]; j++; } comment_post_num = atoi(post_number.c_str()); // get orders of two users int user1_order = 1; int user2_order = 1; while(1){//get the order of first users if(user[user1_order].username == user1name) break; else user1_order++; } while(1){//get the order of second users if(user[user2_order].username == user2name) break; else user2_order++; } //check exception //no post of user2 try{ if(user[user2_order].num_posts < comment_post_num){ ostringstream oStream; oStream << "Error: " << user[user1_order].username << " cannot comment post #" << comment_post_num << " of " << user[user2_order].username << "!" << endl; oStream << user[user2_order].username << " does not have post #" << comment_post_num << "." << endl; throw Exception_t(INVALID_LOG, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; continue; } //read the comment getline(log,line); user[user2_order].posts[comment_post_num-1].comments[user[user2_order].posts[comment_post_num-1].num_comments].text = line; user[user2_order].posts[comment_post_num-1].comments[user[user2_order].posts[comment_post_num-1].num_comments].user = &user[user1_order]; user[user2_order].posts[comment_post_num-1].num_comments++; } else if(position_unlike > 0){ cout << ">> unlike" << endl; string user1name; string user2name; string post_number; //get the name of two users for(int i = 0; i < position_unlike - 1; i++){ user1name = user1name + line[i]; } int j = position_unlike + 7; while(line[j] != ' '){ user2name = user2name + line[j]; j++; } //skip the space j++; //get the post number unsigned int unlike_post_num; while(line[j]){ post_number = post_number + line[j]; j++; } unlike_post_num = atoi(post_number.c_str()); // get orders of two users int user1_order = 1; int user2_order = 1; while(1){//get the order of first users if(user[user1_order].username == user1name) break; else user1_order++; } while(1){//get the order of second users if(user[user2_order].username == user2name) break; else user2_order++; } //check exception //1. no user2 post try{ if(user[user2_order].num_posts < unlike_post_num){ ostringstream oStream; oStream << "Error: " << user[user1_order].username << " cannot unlike post #" << unlike_post_num << " of " << user[user2_order].username << "!" << endl; oStream << user[user2_order].username << " does not have post #" << unlike_post_num << "." << endl; throw Exception_t(INVALID_LOG, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; continue; } //2. user1 alreaday unlike this post int flag = 1;// judge whether user1 alreaday unlike this post int like_user_order; for(unsigned int i = 0; i < user[user2_order].posts[unlike_post_num-1].num_likes; i++){ if(user[user2_order].posts[unlike_post_num-1].like_users[i]->username == user[user1_order].username){ flag = 0; like_user_order = i; break; } } try{ if(flag == 1){ ostringstream oStream; oStream << "Error: " << user[user1_order].username << " cannot unlike post #" << unlike_post_num << " of " << user[user2_order].username << "!" << endl; oStream << user[user1_order].username << " has not liked post #" << unlike_post_num << " of " << user[user2_order].username << "." << endl; throw Exception_t(INVALID_LOG, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; continue; } //if no exception //release the pointer!!! and -1 the num_likes; user[user2_order].posts[unlike_post_num-1].like_users[like_user_order] = NULL; user[user2_order].posts[unlike_post_num-1].num_likes--; } else if(position_uncomment > 0){ cout << ">> uncomment" << endl; string user1name; string user2name; string post_number; string comment_number; //get the name of two users for(int i = 0; i < position_uncomment - 1; i++){ user1name = user1name + line[i]; } int j = position_uncomment + 10; while(line[j] != ' '){ user2name = user2name + line[j]; j++; } //skip the space j++; //get the post number unsigned int uncomment_post_num; while(line[j] != ' '){ post_number = post_number + line[j]; j++; } uncomment_post_num = atoi(post_number.c_str()); //skip the space j++; //get the comment number unsigned int uncomment_comment_num; while(line[j]){ comment_number = comment_number + line[j]; j++; } uncomment_comment_num = atoi(comment_number.c_str()); // get orders of two users int user1_order = 1; int user2_order = 1; while(1){//get the order of first users if(user[user1_order].username == user1name) break; else user1_order++; } while(1){//get the order of second users if(user[user2_order].username == user2name) break; else user2_order++; } //check exception //1.no user2 post try{ if(user[user2_order].num_posts < uncomment_post_num){ ostringstream oStream; oStream << "Error: " << user[user1_order].username << " cannot uncomment comment #" << uncomment_comment_num << " of post #" << uncomment_post_num << " posted by " << user[user2_order].username << "!" << endl; oStream << user[user2_order].username << " does not have post #" << uncomment_post_num << "." << endl; throw Exception_t(INVALID_LOG, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; continue; } //2.whether the post of user2 has the comment try{ if(user[user2_order].posts[uncomment_post_num-1].num_comments < uncomment_comment_num){ ostringstream oStream; oStream << "Error: " << user[user1_order].username << " cannot uncomment comment #" << uncomment_comment_num << " of post #" << uncomment_post_num << " posted by " << user[user2_order].username << "!" << endl; oStream << user[user2_order].username << " does not have comment #" << uncomment_comment_num << "." << endl; throw Exception_t(INVALID_LOG, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; continue; } //3.whether user1 is the owner of the comment try{ if(user[user2_order].posts[uncomment_post_num-1].comments[uncomment_comment_num-1].user->username != user[user1_order].username){ ostringstream oStream; oStream << "Error: " << user[user1_order].username << " cannot uncomment comment #" << uncomment_comment_num << " of post #" << uncomment_post_num << " posted by " << user[user2_order].username << "!" << endl; oStream << user[user2_order].username << " is not the owner of comment #" << uncomment_comment_num << "." << endl; throw Exception_t(INVALID_LOG, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; continue; } //if no exception, then remove the comment user[user2_order].posts[uncomment_post_num-1].comments[uncomment_comment_num-1].user = NULL; user[user2_order].posts[uncomment_post_num-1].comments[uncomment_comment_num-1].text = ""; //move the comment behind ahead by 1 for(unsigned int i = uncomment_comment_num; i < user[user2_order].posts[uncomment_post_num-1].num_comments; i++){ user[user2_order].posts[uncomment_post_num-1].comments[i-1].text = user[user2_order].posts[uncomment_post_num-1].comments[i].text; user[user2_order].posts[uncomment_post_num-1].comments[i-1].user = user[user2_order].posts[uncomment_post_num-1].comments[i].user; } //remove the last comment user[user2_order].posts[uncomment_post_num-1].comments[user[user2_order].posts[uncomment_post_num-1].num_comments-1].user = NULL; user[user2_order].posts[uncomment_post_num-1].comments[user[user2_order].posts[uncomment_post_num-1].num_comments-1].text = ""; //number of comments -1 user[user2_order].posts[uncomment_post_num-1].num_comments--; } else if(position_delete > 0){ cout << ">> delete" << endl; string user1name; string post_number; //get the name of two users for(int i = 0; i < position_delete - 1; i++){ user1name = user1name + line[i]; } int j = position_delete + 7; //get the post number unsigned int post_num; while(line[j]){ post_number = post_number + line[j]; j++; } post_num = atoi(post_number.c_str()); // get orders of user1 int user1_order = 1; while(1){ if(user[user1_order].username == user1name) break; else user1_order++; } //check exception //1.no user2 post try{ if(user[user1_order].num_posts < post_num){ ostringstream oStream; oStream << "Error: " << user[user1_order].username << " cannot delete post #" << post_num << "!" << endl; oStream << user[user1_order].username << " does not have post #" << post_num << "." << endl; throw Exception_t(INVALID_LOG, oStream.str()); } } catch (Exception_t &exception){ cout << exception.error_info; continue; } //if no exception //delete comments for(unsigned int i = 0; i < user[user1_order].posts[post_num-1].num_comments; i++){ user[user1_order].posts[post_num-1].comments[i].text = ""; user[user1_order].posts[post_num-1].comments[i].user = NULL; } //delete like users for(unsigned int i = 0; i < user[user1_order].posts[post_num-1].num_likes; i++){ user[user1_order].posts[post_num-1].like_users[i] = NULL; } //delete tags for(unsigned int i = 0; i < user[user1_order].posts[post_num-1].num_tags; i++){ user[user1_order].posts[post_num-1].tags[i] = ""; } //delete owners user[user1_order].posts[post_num-1].owner = NULL; //delete title user[user1_order].posts[post_num-1].title = ""; //delete text user[user1_order].posts[post_num-1].text = ""; //clear all numbers back to zero user[user1_order].posts[post_num-1].num_comments = 0; user[user1_order].posts[post_num-1].num_likes = 0; user[user1_order].posts[post_num-1].num_tags = 0; //move the posts behind ahead by 1 position for(unsigned int i = post_num; i < user[user1_order].num_posts; i++){ user[user1_order].posts[i-1].text = user[user1_order].posts[i].text; user[user1_order].posts[i-1].title = user[user1_order].posts[i].title; user[user1_order].posts[i-1].owner = user[user1_order].posts[i].owner; user[user1_order].posts[i-1].num_comments = user[user1_order].posts[i].num_comments; user[user1_order].posts[i-1].num_likes = user[user1_order].posts[i].num_likes; user[user1_order].posts[i-1].num_tags = user[user1_order].posts[i].num_tags; for(unsigned int j = 0; j < user[user1_order].posts[i].num_comments; j++){ user[user1_order].posts[i-1].comments[j].text = user[user1_order].posts[i].comments[j].text; user[user1_order].posts[i-1].comments[j].user = user[user1_order].posts[i].comments[j].user; } for(unsigned int j = 0; j < user[user1_order].posts[i].num_likes; j++){ user[user1_order].posts[i-1].like_users[j] = user[user1_order].posts[i].like_users[j]; } for(unsigned int j = 0; j < user[user1_order].posts[i].num_tags; j++){ user[user1_order].posts[i-1].tags[j] = user[user1_order].posts[i].tags[j]; } } //remove the last posts //delete comments for(unsigned int i = 0; i < user[user1_order].posts[user[user1_order].num_posts-1].num_comments; i++){ user[user1_order].posts[user[user1_order].num_posts-1].comments[i].text = ""; user[user1_order].posts[user[user1_order].num_posts-1].comments[i].user = NULL; } //delete like users for(unsigned int i = 0; i < user[user1_order].posts[user[user1_order].num_posts-1].num_likes; i++){ user[user1_order].posts[user[user1_order].num_posts-1].like_users[i] = NULL; } //delete tags for(unsigned int i = 0; i < user[user1_order].posts[user[user1_order].num_posts-1].num_tags; i++){ user[user1_order].posts[user[user1_order].num_posts-1].tags[i] = ""; } //delete owners user[user1_order].posts[user[user1_order].num_posts-1].owner = NULL; //delete title user[user1_order].posts[user[user1_order].num_posts-1].title = ""; //delete text user[user1_order].posts[user[user1_order].num_posts-1].text = ""; //clear all numbers back to zero user[user1_order].posts[user[user1_order].num_posts-1].num_comments = 0; user[user1_order].posts[user[user1_order].num_posts-1].num_likes = 0; user[user1_order].posts[user[user1_order].num_posts-1].num_tags = 0; //user1's postnum -- user[user1_order].num_posts--; } else if(position_unfollow > 0){ cout << ">> unfollow" << endl; string user1name; string user2name; //get the name of two users for(int i = 0; i < position_unfollow - 1; i++){ user1name = user1name + line[i]; } int j = position_unfollow + 9; while(line[j]){ user2name = user2name + line[j]; j++; } // get orders of two users int user1_order = 1; int user2_order = 1; while(1){//get the order of first users if(user[user1_order].username == user1name) break; else user1_order++; } while(1){//get the order of second users if(user[user2_order].username == user2name) break; else user2_order++; } //unfollow! following and follower number-- unsigned int unfollow_following = 0; unsigned int unfollow_follower = 0; for(unsigned int i = 0; i < user[user1_order].num_following; i++){ if(user[user1_order].following[i]->username == user[user2_order].username){ user[user1_order].following[i] = NULL; unfollow_following = i; break; } } for(unsigned int i = 0; i < user[user2_order].num_followers; i++){ if(user[user2_order].follower[i]->username == user[user1_order].username){ user[user2_order].follower[i] = NULL; unfollow_follower = i; break; } } //move the following behind ahead by 1 position for(unsigned int i = unfollow_following+1; i < user[user1_order].num_following; i++){ user[user1_order].following[i-1] = user[user1_order].following[i]; } //remove the last following user[user1_order].following[user[user1_order].num_following-1] = NULL; //move the followers behind ahead by 1 position for(unsigned int i = unfollow_follower+1; i < user[user2_order].num_followers; i++){ user[user2_order].follower[i-1] = user[user2_order].follower[i]; } //remove the last follower user[user2_order].follower[user[user2_order].num_followers-1] = NULL; // follower and following number -- user[user1_order].num_following--; user[user2_order].num_followers--; } } //close logfile log.close(); //end project return 0; }
Python
UTF-8
1,589
2.625
3
[]
no_license
import urllib.request, urllib.parse, urllib.error import json # import hidden import twurl import ssl serviceurl = 'https://api.twitter.com/1.1/search/tweets.json?' while True: searchQuery = input('Enter the keyword you would like to lookup on twitter').strip(' ') if len(searchQuery) < 1: continue print('Calling Twitter.......') url = serviceurl + urllib.parse.urlencode({'q':searchQuery}) # This would require hidden.py file to get the important Access Token # hidden.py would return the following dictionary with your twitter keys # {"consumer_key":"", # "consumer_secret":"", # "access_token":"", # "access_token_secret":"" # } furl = twurl.augment(url) ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE connection = urllib.request.urlopen(furl,context=ctx) data = connection.read().decode() headers = dict(connection.getheaders()) try: tweets = json.loads(data) except: tweets = None if tweets == None or headers["status"]!="200 OK": print("Fatal error") continue #print(json.dumps(pythonicJson,indent=4)) inc = 1 for tweet in tweets["statuses"]: print(inc,". ","Posted on: ",tweet["created_at"]) print("Posted by : @" + tweet["user"]["screen_name"]) print("Tweet reads: ", tweet["text"]) if tweet['urls'][0]: inc+=1 print("\n\n") print("Number of API calls remaining: ",headers['x-rate-limit-remaining'])
Shell
UTF-8
448
3.234375
3
[]
no_license
#!/usr/bin/env bash prefix=`LANG=C date +%Y-%m-%d-%H-%M-%S-` for f in "a.cpp" "b.cpp" "c.cpp" "d.cpp" "e.cpp" "f.cpp" do if [ -f "$f" ]; then mv $f $prefix$f fi done for f in "a.cpp" "b.cpp" "c.cpp" "d.cpp" "e.cpp" "f.cpp" do echo -e \ "#include <bits/stdc++.h> #include <boost/multiprecision/cpp_int.hpp> using bint = boost::multiprecision::cpp_int; int main() { int N; std::cin >> N; return 0; }" \ >> $f done
Rust
UTF-8
4,107
3.125
3
[ "Apache-2.0" ]
permissive
use super::Signal; use crate::error::{Error, Result}; use libc::{self, pid_t}; use log::{debug, error}; use std::{ffi::OsString, io, os::unix::process::CommandExt, path::PathBuf, process::Command}; pub type Pid = libc::pid_t; pub(crate) type SignalCode = libc::c_int; pub fn become_command(command: PathBuf, args: &[OsString]) -> Result<()> { become_exec_command(command, args) } /// Get process identifier of calling process. pub fn current_pid() -> Pid { unsafe { libc::getpid() as pid_t } } /// Determines if a process is running with the given process identifier. pub fn is_alive(pid: Pid) -> bool { // Sending a signal to 0 is sending a signal to yourself, so this // would just be checking that the current process itself is alive, // which... *duh*. // // (This is in service of discovering how we would ever end up // with pid == 0 down here in the first place. I think places // where a PID of 0 would be generated have been addressed in the // code, but this is belt-and-suspenders code at the moment.) if pid == 0 { error!(target: "pidfile_tracing","Trying to determine if PID 0 is alive; this is an unexpected situation; returning false!"); return false; } match unsafe { libc::kill(pid, 0) } { 0 => true, _ => { match io::Error::last_os_error().raw_os_error() { Some(libc::EPERM) => true, Some(libc::ESRCH) => false, _ => false, } } } } pub fn signal(pid: Pid, signal: Signal) -> Result<()> { unsafe { match libc::kill(pid as pid_t, signal.into()) { 0 => Ok(()), e => Err(Error::SignalFailed(e, io::Error::last_os_error())), } } } // This only makes sense on Unix platforms, because not all of these // symbols are actually defined on Windows. Also, this is only used // for actually sending the given signal to a process, which only // happens on Unix platforms anyway. impl From<Signal> for SignalCode { fn from(value: Signal) -> SignalCode { match value { Signal::INT => libc::SIGINT, Signal::ILL => libc::SIGILL, Signal::ABRT => libc::SIGABRT, Signal::FPE => libc::SIGFPE, Signal::KILL => libc::SIGKILL, Signal::SEGV => libc::SIGSEGV, Signal::TERM => libc::SIGTERM, Signal::HUP => libc::SIGHUP, Signal::QUIT => libc::SIGQUIT, Signal::ALRM => libc::SIGALRM, Signal::USR1 => libc::SIGUSR1, Signal::USR2 => libc::SIGUSR2, Signal::CHLD => libc::SIGCHLD, } } } /// Makes an `execvp(3)` system call to become a new program. /// /// Note that if successful, this function will not return. /// /// # Failures /// /// * If the system call fails the error will be returned, otherwise this function does not return fn become_exec_command(command: PathBuf, args: &[OsString]) -> Result<()> { debug!("Calling execvp(): ({:?}) {:?}", command.display(), &args); let error_if_failed = Command::new(command).args(args).exec(); // The only possible return for the above function is an `Error` so return it, meaning that we // failed to exec to our target program Err(error_if_failed.into()) } /// This is currently the "master check" for whether the Supervisor /// can behave "as root". /// /// All capabilities must be present. If we can run processes as other /// users, but can't change ownership, then the processes won't be /// able to access their files. Similar logic holds for the reverse. #[cfg(target_os = "linux")] pub fn can_run_services_as_svc_user() -> bool { use caps::{CapSet, Capability}; fn has(cap: Capability) -> bool { caps::has_cap(None, CapSet::Effective, cap).unwrap_or(false) } has(Capability::CAP_SETUID) && has(Capability::CAP_SETGID) && has(Capability::CAP_CHOWN) } #[cfg(target_os = "macos")] pub fn can_run_services_as_svc_user() -> bool { true }
C++
UTF-8
562
2.71875
3
[]
no_license
#ifndef TETRIMINO_H #define TETRIMINO_H #include <stdlib.h> #define SQUARES_IN_TETRIMINO 4 enum shape { I, J, L, O, S, T, Z }; enum rotation{ zero_rad, half_rad, one_rad, three_halves_rad }; class Tetrimino { public: Tetrimino(shape type, rotation orientation, int centerXPosGrid, int centerYPosGrid, int *squareLocations); ~Tetrimino(); shape type; rotation orientation; int centerXPosGrid; int centerYPosGrid; int *squareLocations; int *setLocations(); int copyLocations(int *newLocs); }; #endif //TETRIMINO_H
JavaScript
UTF-8
2,933
2.578125
3
[]
no_license
let url = window.location.href; const pageData = url.split("?") const mainData = pageData[1]; const singleDetail = mainData.split("&"); const token = singleDetail[1].substring(14); const bnum = singleDetail[2].substring(5); const pnum = singleDetail[3].substring(5); const adult = singleDetail[6].substring(7); const children = singleDetail[7].substring(9); const saveBooking = document.getElementById('saveBooking'); console.log(adult, children, pnum) saveBooking.addEventListener('submit',SaveBooking_) function SaveBooking_(event){ event.preventDefault(); let tickTock = setInterval(async () => { const baseurl = 'https://booking-api.skypicker.com/api/v0.1/check_flights?'; const query = `v=2&booking_token=${token}&bnum=${bnum}&pnum=${pnum}&affily=picky_{market}&currency=USD&adults=${adult}&children=${children}&infants=0` console.log(baseurl+query); const response = await fetch(baseurl + query); const data = await response.json(); if(data.flights_checked && !data.flights_invalid){ clearInterval(tickTock); console.log(data); const flightID = data.flights[0].id; let bd = {} bd[flightID] = {"1":0} fetch('https://booking-api.skypicker.com/api/v0.1/save_booking?v=2', { method: 'POST', // or 'PUT' body: JSON.stringify({ lang: "en", bags: 1, passengers: [ { name: "test", surname: "test", title: "mr", phone: "+44 44857282842", birthday: 783657600, expiration: 1639958400, cardno: "D25845222", nationality: "SE", email: "email.address@gmail.com", category: "adults", hold_bags: bd } ], locale: "en", currency: "usd", booking_token: token, partner: "picky", booked_at: "picky", user_id: "test", secret_token: "test", immediate_confirmation: false }), // data can be `string` or {object}! headers:{ 'Content-Type': 'application/json' } }).then(res => res.json()) .then(response => console.log('Success:', JSON.stringify(response))) .catch(error => console.error('Error:', error)); } if (data.flights_checked && data.flights_invalid) { clearInterval(tickTock); alert("Flight has expired or ticket has been sold out"); } }, 5000); }
SQL
UTF-8
106,399
3.203125
3
[ "MIT" ]
permissive
-- phpMyAdmin SQL Dump -- version 5.0.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 11, 2020 at 12:35 PM -- Server version: 10.4.11-MariaDB -- PHP Version: 7.2.27 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `student_progress_management_system` -- -- -------------------------------------------------------- -- -- Table structure for table `academic_term` -- CREATE TABLE `academic_term` ( `id` int(11) NOT NULL, `aca_year` int(4) NOT NULL, `aca_term` int(1) NOT NULL, `is_current_term` int(1) NOT NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `academic_term` -- INSERT INTO `academic_term` (`id`, `aca_year`, `aca_term`, `is_current_term`) VALUES (1, 2020, 1, 1), (2, 2020, 2, 0), (3, 2020, 3, 0); -- -------------------------------------------------------- -- -- Table structure for table `cal_marks` -- CREATE TABLE `cal_marks` ( `id` int(11) NOT NULL, `student_admission_number` bigint(20) NOT NULL, `year` year(4) NOT NULL, `term` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `avg` float NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `cal_marks` -- INSERT INTO `cal_marks` (`id`, `student_admission_number`, `year`, `term`, `avg`, `created_at`, `updated_at`) VALUES (1, 1, 2019, '1', 5, '2020-05-11 20:18:41', '2020-05-11 20:18:41'), (2, 3, 2019, '1', 8.2, '2020-05-11 20:18:41', '2020-05-11 20:18:41'); -- -------------------------------------------------------- -- -- Table structure for table `class_updates` -- CREATE TABLE `class_updates` ( `id` bigint(20) UNSIGNED NOT NULL, `student_admission_number` bigint(20) NOT NULL, `year` year(4) DEFAULT NULL, `class` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `grade` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `class_updates` -- INSERT INTO `class_updates` (`id`, `student_admission_number`, `year`, `class`, `grade`, `created_at`, `updated_at`) VALUES (2, 3, 2020, 'B', '7', '2020-05-13 08:39:12', '2020-05-13 08:39:12'); -- -------------------------------------------------------- -- -- Table structure for table `extra_activities` -- CREATE TABLE `extra_activities` ( `id` bigint(20) UNSIGNED NOT NULL, `admission_number_student` bigint(20) NOT NULL, `category` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `event` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `activity` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `rank` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `level` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `date` date DEFAULT NULL, `grade` varchar(11) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `extra_activities` -- INSERT INTO `extra_activities` (`id`, `admission_number_student`, `category`, `event`, `activity`, `rank`, `level`, `date`, `grade`, `created_at`, `updated_at`) VALUES (35, 1, 'None-Physical', 'sinhala day competition', 'Dancing', '1st', 'Inter national school', '2020-06-19', '6', '2020-06-25 21:42:51', '2020-06-25 21:42:51'), (36, 1, 'Physical', 'Sport meet', 'Running 100m', '3rd', 'Provincial level', '2020-06-24', '6', '2020-06-29 23:25:44', '2020-06-29 23:25:44'), (37, 2000, 'Physical', 'Sport meet', 'Running 100m', '1st', 'Inter house', '2020-01-02', '6', '2020-08-07 17:05:58', '2020-08-07 17:05:58'), (38, 2000, 'Physical', 'Sport meet', 'Triple jump', '2nd', 'Inter house', '2020-01-03', '6', '2020-08-07 17:08:16', '2020-08-07 17:08:16'), (39, 2000, 'Physical', 'Sport meet', 'Relay 100*4', '1st', 'Inter house', '2020-01-04', '6', '2020-08-07 17:08:55', '2020-08-07 17:08:55'), (40, 2000, 'Physical', 'Sport meet', 'Netball', '2nd', 'Inter house', '2020-01-06', '6', '2020-08-07 17:10:10', '2020-08-07 17:10:10'), (41, 2012, 'None-Physical', 'English day competition', 'Easy writing', '2nd', 'Provincial level', '2020-02-07', '6', '2020-08-07 17:11:20', '2020-08-07 17:11:20'), (42, 2012, 'None-Physical', 'English day competition', 'Easy writing', '1st', 'District level', '2020-04-07', '6', '2020-08-07 17:12:02', '2020-08-07 17:12:02'), (43, 2015, 'None-Physical', 'sinhala day competition', 'Dancing', '1st', 'Provincial level', '2020-08-07', '6', '2020-08-07 17:14:39', '2020-08-07 17:14:39'), (44, 2015, 'None-Physical', 'sinhala day competition', 'Dancing', '1st', 'District level', '2020-05-07', '6', '2020-08-07 17:15:32', '2020-08-07 17:15:32'), (45, 2024, 'None-Physical', 'English day competition', 'English Debiting', '2nd', 'Inter national school', '2020-01-07', '6', '2020-08-07 17:16:28', '2020-08-07 17:16:28'), (46, 2060, 'Physical', 'Sport meet', 'Running 400m', '1st', 'Inter house', '2020-05-07', '6', '2020-08-07 17:17:28', '2020-08-07 17:17:28'), (47, 2063, 'Physical', 'Sport meet', 'Karate', '2nd', 'National level', '2020-08-07', '6', '2020-08-07 17:18:15', '2020-08-07 17:18:15'), (48, 2039, 'None-Physical', 'sinhala day competition', 'Poem', '2nd', 'Provincial level', '2020-04-07', '6', '2020-08-07 17:18:52', '2020-08-07 17:18:52'), (49, 1000, 'None-Physical', 'English day competition', 'Western music', '1st', 'Provincial level', '2020-04-07', '7', '2020-08-07 17:20:39', '2020-08-07 17:20:39'), (50, 1012, 'Physical', 'Sport meet', 'Running 800m', '1st', 'Inter house', '2020-06-07', '7', '2020-08-07 17:21:11', '2020-08-07 17:21:11'), (51, 1039, 'Physical', 'Sport meet', 'Javelin_throw', '2nd', 'Inter house', '2020-04-07', '7', '2020-08-07 17:22:20', '2020-08-07 17:22:20'), (52, 1057, 'None-Physical', 'English day competition', 'Dancing', '1st', 'District level', '2020-05-07', '7', '2020-08-07 17:22:52', '2020-08-07 17:22:52'); -- -------------------------------------------------------- -- -- Table structure for table `marks` -- CREATE TABLE `marks` ( `id` int(11) NOT NULL, `admission_number` bigint(20) NOT NULL, `year` year(4) NOT NULL, `student_grade` int(11) NOT NULL, `class` varchar(5) NOT NULL, `term` varchar(20) NOT NULL, `subject_id` int(11) NOT NULL, `marks` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `marks` -- INSERT INTO `marks` (`id`, `admission_number`, `year`, `student_grade`, `class`, `term`, `subject_id`, `marks`) VALUES (4, 1, 2019, 6, 'A', '1', 7, 50), (19, 1, 2020, 6, 'A', '2', 2, 23), (20, 3, 2020, 6, 'A', '2', 2, 87), (24, 2001, 2020, 6, 'B', '2', 1, 89), (25, 2004, 2020, 6, 'B', '2', 1, 90), (26, 2007, 2020, 6, 'B', '2', 1, 78), (27, 2010, 2020, 6, 'B', '2', 1, 49), (28, 2013, 2020, 6, 'B', '2', 1, 56), (29, 2016, 2020, 6, 'B', '2', 1, 92), (30, 2019, 2020, 6, 'B', '2', 1, 75), (31, 2022, 2020, 6, 'B', '2', 1, 79), (32, 2025, 2020, 6, 'B', '2', 1, 69), (33, 2028, 2020, 6, 'B', '2', 1, 68), (34, 2031, 2020, 6, 'B', '2', 1, 90), (35, 2034, 2020, 6, 'B', '2', 1, 88), (36, 2037, 2020, 6, 'B', '2', 1, 79), (37, 2040, 2020, 6, 'B', '2', 1, 67), (38, 2043, 2020, 6, 'B', '2', 1, 89), (39, 2046, 2020, 6, 'B', '2', 1, 49), (40, 2049, 2020, 6, 'B', '2', 1, 81), (41, 2052, 2020, 6, 'B', '2', 1, 80), (44, 2000, 2020, 6, 'A', '2', 1, 87), (45, 2003, 2020, 6, 'A', '2', 1, 95), (46, 2006, 2020, 6, 'A', '2', 1, 78), (47, 2009, 2020, 6, 'A', '2', 1, 69), (48, 2012, 2020, 6, 'A', '2', 1, 92), (49, 2015, 2020, 6, 'A', '2', 1, 21), (50, 2018, 2020, 6, 'A', '2', 1, 98), (51, 2021, 2020, 6, 'A', '2', 1, 50), (52, 2024, 2020, 6, 'A', '2', 1, 69), (53, 2027, 2020, 6, 'A', '2', 1, 71), (54, 2030, 2020, 6, 'A', '2', 1, 79), (55, 2033, 2020, 6, 'A', '2', 1, 49), (56, 2036, 2020, 6, 'A', '2', 1, 69), (57, 2039, 2020, 6, 'A', '2', 1, 96), (58, 2042, 2020, 6, 'A', '2', 1, 87), (59, 2045, 2020, 6, 'A', '2', 1, 84), (60, 2048, 2020, 6, 'A', '2', 1, 79), (61, 2051, 2020, 6, 'A', '2', 1, 81), (62, 2054, 2020, 6, 'A', '2', 1, 78), (63, 2001, 2020, 6, 'B', '2', 1, 70), (64, 2001, 2020, 6, 'B', '2', 1, 70), (65, 2004, 2020, 6, 'B', '2', 1, 72), (66, 2007, 2020, 6, 'B', '2', 1, 89), (67, 2010, 2020, 6, 'B', '2', 1, 65), (68, 2013, 2020, 6, 'B', '2', 1, 80), (69, 2016, 2020, 6, 'B', '2', 1, 92), (70, 2019, 2020, 6, 'B', '2', 1, 23), (71, 2022, 2020, 6, 'B', '2', 1, 92), (72, 2025, 2020, 6, 'B', '2', 1, 90), (73, 2028, 2020, 6, 'B', '2', 1, 78), (74, 2031, 2020, 6, 'B', '2', 1, 59), (75, 2034, 2020, 6, 'B', '2', 1, 62), (76, 2037, 2020, 6, 'B', '2', 1, 95), (77, 2040, 2020, 6, 'B', '2', 1, 70), (78, 2043, 2020, 6, 'B', '2', 1, 63), (79, 2046, 2020, 6, 'B', '2', 1, 50), (80, 2049, 2020, 6, 'B', '2', 1, 49), (81, 2052, 2020, 6, 'B', '2', 1, 89), (82, 1, 2020, 6, 'A', '2', 2, 69), (83, 3, 2020, 6, 'A', '2', 2, 75), (84, 1066, 2020, 6, 'A', '2', 2, 45), (86, 2003, 2020, 6, 'A', '2', 2, 92), (87, 2006, 2020, 6, 'A', '2', 2, 82), (88, 2009, 2020, 6, 'A', '2', 2, 78), (89, 2012, 2020, 6, 'A', '2', 2, 68), (90, 2015, 2020, 6, 'A', '2', 2, 25), (91, 2018, 2020, 6, 'A', '2', 2, 79), (92, 2021, 2020, 6, 'A', '2', 2, 81), (93, 2024, 2020, 6, 'A', '2', 2, 82), (94, 2027, 2020, 6, 'A', '2', 2, 79), (95, 2030, 2020, 6, 'A', '2', 2, 81), (96, 2033, 2020, 6, 'A', '2', 2, 78), (97, 2036, 2020, 6, 'A', '2', 2, 63), (98, 2039, 2020, 6, 'A', '2', 2, 82), (99, 2042, 2020, 6, 'A', '2', 2, 80), (100, 2045, 2020, 6, 'A', '2', 2, 73), (101, 2048, 2020, 6, 'A', '2', 2, 58), (102, 2051, 2020, 6, 'A', '2', 2, 76), (103, 2054, 2020, 6, 'A', '2', 2, 83), (104, 2057, 2020, 6, 'A', '2', 2, 32), (105, 2060, 2020, 6, 'A', '2', 2, 92), (106, 2063, 2020, 6, 'A', '2', 2, 90), (107, 2066, 2020, 6, 'A', '2', 2, 87), (108, 2069, 2020, 6, 'A', '2', 2, 43), (109, 2072, 2020, 6, 'A', '2', 2, 85), (110, 2075, 2020, 6, 'A', '2', 2, 58), (111, 2078, 2020, 6, 'A', '2', 2, 69), (112, 2081, 2020, 6, 'A', '2', 2, 75), (113, 2084, 2020, 6, 'A', '2', 2, 76), (114, 2087, 2020, 6, 'A', '2', 2, 79), (115, 2090, 2020, 6, 'A', '2', 2, 81), (116, 2093, 2020, 6, 'A', '2', 2, 80), (117, 2096, 2020, 6, 'A', '2', 2, 93), (118, 2099, 2020, 6, 'A', '2', 2, 72), (119, 2102, 2020, 6, 'A', '2', 2, 58), (120, 2105, 2020, 6, 'A', '2', 2, 23), (121, 2109, 2020, 6, 'A', '2', 2, 42), (122, 2001, 2020, 6, 'B', '2', 2, 70), (123, 2004, 2020, 6, 'B', '2', 2, 92), (124, 2007, 2020, 6, 'B', '2', 2, 80), (125, 2010, 2020, 6, 'B', '2', 2, 76), (126, 2013, 2020, 6, 'B', '2', 2, 45), (127, 2016, 2020, 6, 'B', '2', 2, 40), (128, 2019, 2020, 6, 'B', '2', 2, 39), (129, 2022, 2020, 6, 'B', '2', 2, 69), (130, 2025, 2020, 6, 'B', '2', 2, 82), (131, 2028, 2020, 6, 'B', '2', 2, 78), (132, 2031, 2020, 6, 'B', '2', 2, 71), (133, 2034, 2020, 6, 'B', '2', 2, 70), (134, 2037, 2020, 6, 'B', '2', 2, 30), (135, 2040, 2020, 6, 'B', '2', 2, 65), (136, 2043, 2020, 6, 'B', '2', 2, 62), (137, 2046, 2020, 6, 'B', '2', 2, 92), (138, 2049, 2020, 6, 'B', '2', 2, 90), (139, 2052, 2020, 6, 'B', '2', 2, 46), (140, 1, 2020, 6, 'A', '2', 3, 70), (141, 3, 2020, 6, 'A', '2', 3, 82), (142, 1066, 2020, 6, 'A', '2', 3, 90), (144, 2003, 2020, 6, 'A', '2', 3, 69), (145, 2006, 2020, 6, 'A', '2', 3, 82), (146, 2009, 2020, 6, 'A', '2', 3, 70), (147, 2012, 2020, 6, 'A', '2', 3, 50), (148, 2015, 2020, 6, 'A', '2', 3, 40), (149, 2018, 2020, 6, 'A', '2', 3, 92), (150, 2021, 2020, 6, 'A', '2', 3, 56), (151, 2024, 2020, 6, 'A', '2', 3, 70), (152, 2027, 2020, 6, 'A', '2', 3, 80), (153, 2030, 2020, 6, 'A', '2', 3, 75), (154, 2033, 2020, 6, 'A', '2', 3, 71), (155, 2036, 2020, 6, 'A', '2', 3, 72), (156, 2039, 2020, 6, 'A', '2', 3, 72), (157, 2042, 2020, 6, 'A', '2', 3, 79), (158, 2045, 2020, 6, 'A', '2', 3, 75), (159, 2048, 2020, 6, 'A', '2', 3, 72), (160, 2051, 2020, 6, 'A', '2', 3, 73), (161, 2054, 2020, 6, 'A', '2', 3, 82), (162, 2057, 2020, 6, 'A', '2', 3, 47), (163, 2060, 2020, 6, 'A', '2', 3, 80), (164, 2063, 2020, 6, 'A', '2', 3, 76), (165, 2066, 2020, 6, 'A', '2', 3, 81), (166, 2069, 2020, 6, 'A', '2', 3, 90), (167, 2072, 2020, 6, 'A', '2', 3, 65), (168, 2075, 2020, 6, 'A', '2', 3, 58), (169, 2078, 2020, 6, 'A', '2', 3, 59), (170, 2081, 2020, 6, 'A', '2', 3, 68), (171, 2084, 2020, 6, 'A', '2', 3, 75), (172, 2087, 2020, 6, 'A', '2', 3, 85), (173, 2090, 2020, 6, 'A', '2', 3, 75), (174, 2093, 2020, 6, 'A', '2', 3, 82), (175, 2096, 2020, 6, 'A', '2', 3, 73), (176, 2099, 2020, 6, 'A', '2', 3, 72), (177, 2102, 2020, 6, 'A', '2', 3, 65), (178, 2105, 2020, 6, 'A', '2', 3, 53), (179, 2109, 2020, 6, 'A', '2', 3, 45), (180, 2001, 2020, 6, 'B', '2', 3, 75), (181, 2004, 2020, 6, 'B', '2', 3, 45), (182, 2007, 2020, 6, 'B', '2', 3, 90), (183, 2010, 2020, 6, 'B', '2', 3, 75), (184, 2013, 2020, 6, 'B', '2', 3, 85), (185, 2016, 2020, 6, 'B', '2', 3, 52), (186, 2019, 2020, 6, 'B', '2', 3, 85), (187, 2022, 2020, 6, 'B', '2', 3, 65), (188, 2025, 2020, 6, 'B', '2', 3, 72), (189, 2028, 2020, 6, 'B', '2', 3, 45), (190, 2031, 2020, 6, 'B', '2', 3, 57), (191, 2034, 2020, 6, 'B', '2', 3, 85), (192, 2037, 2020, 6, 'B', '2', 3, 81), (193, 2040, 2020, 6, 'B', '2', 3, 86), (194, 2043, 2020, 6, 'B', '2', 3, 52), (195, 2046, 2020, 6, 'B', '2', 3, 70), (196, 2049, 2020, 6, 'B', '2', 3, 71), (197, 2052, 2020, 6, 'B', '2', 3, 49), (198, 1, 2020, 6, 'A', '2', 4, 45), (199, 3, 2020, 6, 'A', '2', 4, 85), (200, 1066, 2020, 6, 'A', '2', 4, 52), (201, 2000, 2020, 6, 'A', '2', 4, 95), (202, 2003, 2020, 6, 'A', '2', 4, 52), (203, 2006, 2020, 6, 'A', '2', 4, 63), (204, 2009, 2020, 6, 'A', '2', 4, 75), (205, 2012, 2020, 6, 'A', '2', 4, 75), (206, 2015, 2020, 6, 'A', '2', 4, 96), (207, 2018, 2020, 6, 'A', '2', 4, 52), (208, 2021, 2020, 6, 'A', '2', 4, 75), (209, 2024, 2020, 6, 'A', '2', 4, 65), (210, 2027, 2020, 6, 'A', '2', 4, 56), (211, 2030, 2020, 6, 'A', '2', 4, 75), (212, 2033, 2020, 6, 'A', '2', 4, 85), (213, 2036, 2020, 6, 'A', '2', 4, 65), (214, 2039, 2020, 6, 'A', '2', 4, 52), (215, 2042, 2020, 6, 'A', '2', 4, 78), (216, 2045, 2020, 6, 'A', '2', 4, 88), (217, 2048, 2020, 6, 'A', '2', 4, 85), (218, 2051, 2020, 6, 'A', '2', 4, 81), (219, 2054, 2020, 6, 'A', '2', 4, 56), (220, 2057, 2020, 6, 'A', '2', 4, 75), (221, 2060, 2020, 6, 'A', '2', 4, 75), (222, 2063, 2020, 6, 'A', '2', 4, 87), (223, 2066, 2020, 6, 'A', '2', 4, 71), (224, 2069, 2020, 6, 'A', '2', 4, 72), (225, 2072, 2020, 6, 'A', '2', 4, 76), (226, 2075, 2020, 6, 'A', '2', 4, 97), (227, 2078, 2020, 6, 'A', '2', 4, 91), (228, 2081, 2020, 6, 'A', '2', 4, 90), (229, 2084, 2020, 6, 'A', '2', 4, 92), (230, 2087, 2020, 6, 'A', '2', 4, 93), (231, 2090, 2020, 6, 'A', '2', 4, 87), (232, 2093, 2020, 6, 'A', '2', 4, 88), (233, 2096, 2020, 6, 'A', '2', 4, 71), (234, 2099, 2020, 6, 'A', '2', 4, 70), (235, 2102, 2020, 6, 'A', '2', 4, 76), (236, 2105, 2020, 6, 'A', '2', 4, 46), (237, 2109, 2020, 6, 'A', '2', 4, 76), (238, 2001, 2020, 6, 'B', '2', 4, 45), (239, 2004, 2020, 6, 'B', '2', 4, 85), (240, 2007, 2020, 6, 'B', '2', 4, 80), (241, 2010, 2020, 6, 'B', '2', 4, 82), (242, 2013, 2020, 6, 'B', '2', 4, 81), (243, 2016, 2020, 6, 'B', '2', 4, 80), (244, 2019, 2020, 6, 'B', '2', 4, 76), (245, 2022, 2020, 6, 'B', '2', 4, 76), (246, 2025, 2020, 6, 'B', '2', 4, 70), (247, 2028, 2020, 6, 'B', '2', 4, 71), (248, 2031, 2020, 6, 'B', '2', 4, 69), (249, 2034, 2020, 6, 'B', '2', 4, 65), (250, 2037, 2020, 6, 'B', '2', 4, 75), (251, 2040, 2020, 6, 'B', '2', 4, 78), (252, 2043, 2020, 6, 'B', '2', 4, 29), (253, 2046, 2020, 6, 'B', '2', 4, 56), (254, 2049, 2020, 6, 'B', '2', 4, 78), (255, 2052, 2020, 6, 'B', '2', 4, 45), (256, 1, 2020, 6, 'A', '2', 6, 75), (257, 3, 2020, 6, 'A', '2', 6, 96), (258, 1066, 2020, 6, 'A', '2', 6, 90), (260, 2003, 2020, 6, 'A', '2', 6, 77), (261, 2006, 2020, 6, 'A', '2', 6, 74), (262, 2009, 2020, 6, 'A', '2', 6, 66), (263, 2012, 2020, 6, 'A', '2', 6, 85), (264, 2015, 2020, 6, 'A', '2', 6, 85), (265, 2018, 2020, 6, 'A', '2', 6, 75), (266, 2021, 2020, 6, 'A', '2', 6, 65), (267, 2024, 2020, 6, 'A', '2', 6, 55), (268, 2027, 2020, 6, 'A', '2', 6, 75), (269, 2030, 2020, 6, 'A', '2', 6, 69), (270, 2033, 2020, 6, 'A', '2', 6, 85), (271, 2036, 2020, 6, 'A', '2', 6, 75), (272, 2039, 2020, 6, 'A', '2', 6, 92), (273, 2042, 2020, 6, 'A', '2', 6, 90), (274, 2045, 2020, 6, 'A', '2', 6, 87), (275, 2048, 2020, 6, 'A', '2', 6, 56), (276, 2051, 2020, 6, 'A', '2', 6, 78), (277, 2054, 2020, 6, 'A', '2', 6, 85), (278, 2057, 2020, 6, 'A', '2', 6, 90), (279, 2060, 2020, 6, 'A', '2', 6, 75), (280, 2063, 2020, 6, 'A', '2', 6, 56), (281, 2066, 2020, 6, 'A', '2', 6, 78), (282, 2069, 2020, 6, 'A', '2', 6, 78), (283, 2072, 2020, 6, 'A', '2', 6, 70), (284, 2075, 2020, 6, 'A', '2', 6, 56), (285, 2078, 2020, 6, 'A', '2', 6, 56), (286, 2081, 2020, 6, 'A', '2', 6, 87), (287, 2084, 2020, 6, 'A', '2', 6, 89), (288, 2087, 2020, 6, 'A', '2', 6, 46), (289, 2090, 2020, 6, 'A', '2', 6, 62), (290, 2093, 2020, 6, 'A', '2', 6, 85), (291, 2096, 2020, 6, 'A', '2', 6, 97), (292, 2099, 2020, 6, 'A', '2', 6, 55), (293, 2102, 2020, 6, 'A', '2', 6, 56), (294, 2105, 2020, 6, 'A', '2', 6, 77), (295, 2109, 2020, 6, 'A', '2', 6, 85), (296, 2001, 2020, 6, 'B', '2', 6, 86), (297, 2004, 2020, 6, 'B', '2', 6, 90), (298, 2007, 2020, 6, 'B', '2', 6, 56), (299, 2010, 2020, 6, 'B', '2', 6, 66), (300, 2013, 2020, 6, 'B', '2', 6, 76), (301, 2016, 2020, 6, 'B', '2', 6, 77), (302, 2019, 2020, 6, 'B', '2', 6, 88), (303, 2022, 2020, 6, 'B', '2', 6, 56), (304, 2025, 2020, 6, 'B', '2', 6, 90), (305, 2028, 2020, 6, 'B', '2', 6, 65), (306, 2031, 2020, 6, 'B', '2', 6, 96), (307, 2034, 2020, 6, 'B', '2', 6, 75), (308, 2037, 2020, 6, 'B', '2', 6, 88), (309, 2040, 2020, 6, 'B', '2', 6, 56), (310, 2043, 2020, 6, 'B', '2', 6, 45), (311, 2046, 2020, 6, 'B', '2', 6, 91), (312, 2049, 2020, 6, 'B', '2', 6, 76), (313, 2052, 2020, 6, 'B', '2', 6, 52), (314, 1, 2020, 6, 'A', '2', 7, 78), (315, 3, 2020, 6, 'A', '2', 7, 65), (316, 1066, 2020, 6, 'A', '2', 7, 58), (318, 2003, 2020, 6, 'A', '2', 7, 96), (319, 2006, 2020, 6, 'A', '2', 7, 90), (320, 2009, 2020, 6, 'A', '2', 7, 80), (321, 2012, 2020, 6, 'A', '2', 7, 65), (322, 2015, 2020, 6, 'A', '2', 7, 56), (323, 2018, 2020, 6, 'A', '2', 7, 56), (324, 2021, 2020, 6, 'A', '2', 7, 50), (325, 2024, 2020, 6, 'A', '2', 7, 76), (326, 2027, 2020, 6, 'A', '2', 7, 70), (327, 2030, 2020, 6, 'A', '2', 7, 71), (328, 2033, 2020, 6, 'A', '2', 7, 82), (329, 2036, 2020, 6, 'A', '2', 7, 56), (330, 2039, 2020, 6, 'A', '2', 7, 85), (331, 2042, 2020, 6, 'A', '2', 7, 86), (332, 2045, 2020, 6, 'A', '2', 7, 75), (333, 2048, 2020, 6, 'A', '2', 7, 69), (334, 2051, 2020, 6, 'A', '2', 7, 56), (335, 2054, 2020, 6, 'A', '2', 7, 95), (336, 2057, 2020, 6, 'A', '2', 7, 56), (337, 2060, 2020, 6, 'A', '2', 7, 76), (338, 2063, 2020, 6, 'A', '2', 7, 85), (339, 2066, 2020, 6, 'A', '2', 7, 76), (340, 2069, 2020, 6, 'A', '2', 7, 85), (341, 2072, 2020, 6, 'A', '2', 7, 56), (342, 2075, 2020, 6, 'A', '2', 7, 78), (343, 2078, 2020, 6, 'A', '2', 7, 96), (344, 2081, 2020, 6, 'A', '2', 7, 56), (345, 2084, 2020, 6, 'A', '2', 7, 75), (346, 2087, 2020, 6, 'A', '2', 7, 75), (347, 2090, 2020, 6, 'A', '2', 7, 76), (348, 2093, 2020, 6, 'A', '2', 7, 56), (349, 2096, 2020, 6, 'A', '2', 7, 89), (350, 2099, 2020, 6, 'A', '2', 7, 85), (351, 2102, 2020, 6, 'A', '2', 7, 65), (352, 2105, 2020, 6, 'A', '2', 7, 82), (353, 2109, 2020, 6, 'A', '2', 7, 70), (354, 2001, 2020, 6, 'B', '2', 7, 56), (355, 2004, 2020, 6, 'B', '2', 7, 75), (356, 2007, 2020, 6, 'B', '2', 7, 80), (357, 2010, 2020, 6, 'B', '2', 7, 40), (358, 2013, 2020, 6, 'B', '2', 7, 56), (359, 2016, 2020, 6, 'B', '2', 7, 85), (360, 2019, 2020, 6, 'B', '2', 7, 75), (361, 2022, 2020, 6, 'B', '2', 7, 65), (362, 2025, 2020, 6, 'B', '2', 7, 85), (363, 2028, 2020, 6, 'B', '2', 7, 45), (364, 2031, 2020, 6, 'B', '2', 7, 63), (365, 2034, 2020, 6, 'B', '2', 7, 85), (366, 2037, 2020, 6, 'B', '2', 7, 75), (367, 2040, 2020, 6, 'B', '2', 7, 56), (368, 2043, 2020, 6, 'B', '2', 7, 95), (369, 2046, 2020, 6, 'B', '2', 7, 75), (370, 2049, 2020, 6, 'B', '2', 7, 74), (371, 2052, 2020, 6, 'B', '2', 7, 75), (372, 1, 2020, 6, 'A', '2', 9, 45), (373, 3, 2020, 6, 'A', '2', 9, 75), (374, 1066, 2020, 6, 'A', '2', 9, 85), (376, 2003, 2020, 6, 'A', '2', 9, 85), (377, 2006, 2020, 6, 'A', '2', 9, 65), (378, 2009, 2020, 6, 'A', '2', 9, 75), (379, 2012, 2020, 6, 'A', '2', 9, 85), (380, 2015, 2020, 6, 'A', '2', 9, 75), (381, 2018, 2020, 6, 'A', '2', 9, 69), (382, 2021, 2020, 6, 'A', '2', 9, 75), (383, 2024, 2020, 6, 'A', '2', 9, 52), (384, 2027, 2020, 6, 'A', '2', 9, 85), (385, 2030, 2020, 6, 'A', '2', 9, 75), (386, 2033, 2020, 6, 'A', '2', 9, 96), (387, 2036, 2020, 6, 'A', '2', 9, 75), (388, 2039, 2020, 6, 'A', '2', 9, 75), (389, 2042, 2020, 6, 'A', '2', 9, 65), (390, 2045, 2020, 6, 'A', '2', 9, 85), (391, 2048, 2020, 6, 'A', '2', 9, 46), (392, 2051, 2020, 6, 'A', '2', 9, 62), (393, 2054, 2020, 6, 'A', '2', 9, 85), (394, 2057, 2020, 6, 'A', '2', 9, 75), (395, 2060, 2020, 6, 'A', '2', 9, 65), (396, 2063, 2020, 6, 'A', '2', 9, 71), (397, 2066, 2020, 6, 'A', '2', 9, 70), (398, 2069, 2020, 6, 'A', '2', 9, 56), (399, 2072, 2020, 6, 'A', '2', 9, 45), (400, 2075, 2020, 6, 'A', '2', 9, 75), (401, 2078, 2020, 6, 'A', '2', 9, 65), (402, 2081, 2020, 6, 'A', '2', 9, 65), (403, 2084, 2020, 6, 'A', '2', 9, 75), (404, 2087, 2020, 6, 'A', '2', 9, 85), (405, 2090, 2020, 6, 'A', '2', 9, 65), (406, 2093, 2020, 6, 'A', '2', 9, 80), (407, 2096, 2020, 6, 'A', '2', 9, 76), (408, 2099, 2020, 6, 'A', '2', 9, 46), (409, 2102, 2020, 6, 'A', '2', 9, 75), (410, 2105, 2020, 6, 'A', '2', 9, 96), (411, 2109, 2020, 6, 'A', '2', 9, 45), (412, 2001, 2020, 6, 'B', '2', 9, 75), (413, 2004, 2020, 6, 'B', '2', 9, 85), (414, 2007, 2020, 6, 'B', '2', 9, 96), (415, 2010, 2020, 6, 'B', '2', 9, 85), (416, 2013, 2020, 6, 'B', '2', 9, 75), (417, 2016, 2020, 6, 'B', '2', 9, 85), (418, 2019, 2020, 6, 'B', '2', 9, 80), (419, 2022, 2020, 6, 'B', '2', 9, 45), (420, 2025, 2020, 6, 'B', '2', 9, 65), (421, 2028, 2020, 6, 'B', '2', 9, 75), (422, 2031, 2020, 6, 'B', '2', 9, 69), (423, 2034, 2020, 6, 'B', '2', 9, 65), (424, 2037, 2020, 6, 'B', '2', 9, 62), (425, 2040, 2020, 6, 'B', '2', 9, 85), (426, 2043, 2020, 6, 'B', '2', 9, 75), (427, 2046, 2020, 6, 'B', '2', 9, 56), (428, 2049, 2020, 6, 'B', '2', 9, 85), (429, 2052, 2020, 6, 'B', '2', 9, 43), (430, 1, 2020, 6, 'A', '2', 10, 75), (431, 3, 2020, 6, 'A', '2', 10, 85), (432, 1066, 2020, 6, 'A', '2', 10, 85), (434, 2003, 2020, 6, 'A', '2', 10, 55), (435, 2006, 2020, 6, 'A', '2', 10, 75), (436, 2009, 2020, 6, 'A', '2', 10, 69), (437, 2012, 2020, 6, 'A', '2', 10, 85), (438, 2015, 2020, 6, 'A', '2', 10, 52), (439, 2018, 2020, 6, 'A', '2', 10, 75), (440, 2021, 2020, 6, 'A', '2', 10, 63), (441, 2024, 2020, 6, 'A', '2', 10, 59), (442, 2027, 2020, 6, 'A', '2', 10, 85), (443, 2030, 2020, 6, 'A', '2', 10, 74), (444, 2033, 2020, 6, 'A', '2', 10, 69), (445, 2036, 2020, 6, 'A', '2', 10, 95), (446, 2039, 2020, 6, 'A', '2', 10, 85), (447, 2042, 2020, 6, 'A', '2', 10, 74), (448, 2045, 2020, 6, 'A', '2', 10, 69), (449, 2048, 2020, 6, 'A', '2', 10, 85), (450, 2051, 2020, 6, 'A', '2', 10, 74), (451, 2054, 2020, 6, 'A', '2', 10, 69), (452, 2057, 2020, 6, 'A', '2', 10, 81), (453, 2060, 2020, 6, 'A', '2', 10, 74), (454, 2063, 2020, 6, 'A', '2', 10, 56), (455, 2066, 2020, 6, 'A', '2', 10, 85), (456, 2069, 2020, 6, 'A', '2', 10, 74), (457, 2072, 2020, 6, 'A', '2', 10, 46), (458, 2075, 2020, 6, 'A', '2', 10, 75), (459, 2078, 2020, 6, 'A', '2', 10, 63), (460, 2081, 2020, 6, 'A', '2', 10, 78), (461, 2084, 2020, 6, 'A', '2', 10, 46), (462, 2087, 2020, 6, 'A', '2', 10, 78), (463, 2090, 2020, 6, 'A', '2', 10, 56), (464, 2093, 2020, 6, 'A', '2', 10, 56), (465, 2096, 2020, 6, 'A', '2', 10, 60), (466, 2099, 2020, 6, 'A', '2', 10, 50), (467, 2102, 2020, 6, 'A', '2', 10, 75), (468, 2105, 2020, 6, 'A', '2', 10, 45), (469, 2109, 2020, 6, 'A', '2', 10, 90), (470, 2001, 2020, 6, 'B', '2', 10, 45), (471, 2004, 2020, 6, 'B', '2', 10, 71), (472, 2007, 2020, 6, 'B', '2', 10, 85), (473, 2010, 2020, 6, 'B', '2', 10, 95), (474, 2013, 2020, 6, 'B', '2', 10, 85), (475, 2016, 2020, 6, 'B', '2', 10, 74), (476, 2019, 2020, 6, 'B', '2', 10, 65), (477, 2022, 2020, 6, 'B', '2', 10, 60), (478, 2025, 2020, 6, 'B', '2', 10, 54), (479, 2028, 2020, 6, 'B', '2', 10, 75), (480, 2031, 2020, 6, 'B', '2', 10, 65), (481, 2034, 2020, 6, 'B', '2', 10, 85), (482, 2037, 2020, 6, 'B', '2', 10, 81), (483, 2040, 2020, 6, 'B', '2', 10, 75), (484, 2043, 2020, 6, 'B', '2', 10, 45), (485, 2046, 2020, 6, 'B', '2', 10, 76), (486, 2049, 2020, 6, 'B', '2', 10, 58), (487, 2052, 2020, 6, 'B', '2', 10, 75), (488, 2001, 2020, 6, 'B', '2', 10, 45), (489, 2004, 2020, 6, 'B', '2', 10, 75), (490, 2007, 2020, 6, 'B', '2', 10, 65), (491, 2010, 2020, 6, 'B', '2', 10, 88), (492, 2013, 2020, 6, 'B', '2', 10, 75), (493, 2016, 2020, 6, 'B', '2', 10, 46), (494, 2019, 2020, 6, 'B', '2', 10, 95), (495, 2022, 2020, 6, 'B', '2', 10, 75), (496, 2025, 2020, 6, 'B', '2', 10, 45), (497, 2028, 2020, 6, 'B', '2', 10, 75), (498, 2031, 2020, 6, 'B', '2', 10, 65), (499, 2034, 2020, 6, 'B', '2', 10, 85), (500, 2037, 2020, 6, 'B', '2', 10, 52), (501, 2040, 2020, 6, 'B', '2', 10, 75), (502, 2043, 2020, 6, 'B', '2', 10, 65), (503, 2046, 2020, 6, 'B', '2', 10, 85), (504, 2049, 2020, 6, 'B', '2', 10, 75), (505, 2052, 2020, 6, 'B', '2', 10, 45), (506, 1, 2020, 6, 'A', '2', 11, 45), (507, 3, 2020, 6, 'A', '2', 11, 60), (508, 1066, 2020, 6, 'A', '2', 11, 85), (510, 2003, 2020, 6, 'A', '2', 11, 65), (511, 2006, 2020, 6, 'A', '2', 11, 75), (512, 2009, 2020, 6, 'A', '2', 11, 63), (513, 2012, 2020, 6, 'A', '2', 11, 69), (514, 2015, 2020, 6, 'A', '2', 11, 75), (515, 2018, 2020, 6, 'A', '2', 11, 85), (516, 2021, 2020, 6, 'A', '2', 11, 45), (517, 2024, 2020, 6, 'A', '2', 11, 75), (518, 2027, 2020, 6, 'A', '2', 11, 71), (519, 2030, 2020, 6, 'A', '2', 11, 85), (520, 2033, 2020, 6, 'A', '2', 11, 75), (521, 2036, 2020, 6, 'A', '2', 11, 69), (522, 2039, 2020, 6, 'A', '2', 11, 74), (523, 2042, 2020, 6, 'A', '2', 11, 45), (524, 2045, 2020, 6, 'A', '2', 11, 58), (525, 2048, 2020, 6, 'A', '2', 11, 53), (526, 2051, 2020, 6, 'A', '2', 11, 72), (527, 2054, 2020, 6, 'A', '2', 11, 46), (528, 2057, 2020, 6, 'A', '2', 11, 75), (529, 2060, 2020, 6, 'A', '2', 11, 56), (530, 2063, 2020, 6, 'A', '2', 11, 65), (531, 2066, 2020, 6, 'A', '2', 11, 60), (532, 2069, 2020, 6, 'A', '2', 11, 61), (533, 2072, 2020, 6, 'A', '2', 11, 63), (534, 2075, 2020, 6, 'A', '2', 11, 74), (535, 2078, 2020, 6, 'A', '2', 11, 53), (536, 2081, 2020, 6, 'A', '2', 11, 41), (537, 2084, 2020, 6, 'A', '2', 11, 46), (538, 2087, 2020, 6, 'A', '2', 11, 75), (539, 2090, 2020, 6, 'A', '2', 11, 81), (540, 2093, 2020, 6, 'A', '2', 11, 83), (541, 2096, 2020, 6, 'A', '2', 11, 83), (542, 2099, 2020, 6, 'A', '2', 11, 88), (543, 2102, 2020, 6, 'A', '2', 11, 85), (544, 2105, 2020, 6, 'A', '2', 11, 95), (545, 2109, 2020, 6, 'A', '2', 11, 99), (546, 2001, 2020, 6, 'B', '2', 11, 56), (547, 2004, 2020, 6, 'B', '2', 11, 85), (548, 2007, 2020, 6, 'B', '2', 11, 75), (549, 2010, 2020, 6, 'B', '2', 11, 71), (550, 2013, 2020, 6, 'B', '2', 11, 70), (551, 2016, 2020, 6, 'B', '2', 11, 86), (552, 2019, 2020, 6, 'B', '2', 11, 80), (553, 2022, 2020, 6, 'B', '2', 11, 75), (554, 2025, 2020, 6, 'B', '2', 11, 63), (555, 2028, 2020, 6, 'B', '2', 11, 95), (556, 2031, 2020, 6, 'B', '2', 11, 85), (557, 2034, 2020, 6, 'B', '2', 11, 85), (558, 2037, 2020, 6, 'B', '2', 11, 75), (559, 2040, 2020, 6, 'B', '2', 11, 65), (560, 2043, 2020, 6, 'B', '2', 11, 75), (561, 2046, 2020, 6, 'B', '2', 11, 85), (562, 2049, 2020, 6, 'B', '2', 11, 96), (563, 2052, 2020, 6, 'B', '2', 11, 45), (564, 1, 2020, 6, 'A', '2', 12, 45), (565, 3, 2020, 6, 'A', '2', 12, 75), (566, 1066, 2020, 6, 'A', '2', 12, 85), (568, 2003, 2020, 6, 'A', '2', 12, 90), (569, 2006, 2020, 6, 'A', '2', 12, 56), (570, 2009, 2020, 6, 'A', '2', 12, 85), (571, 2012, 2020, 6, 'A', '2', 12, 65), (572, 2015, 2020, 6, 'A', '2', 12, 85), (573, 2018, 2020, 6, 'A', '2', 12, 72), (574, 2021, 2020, 6, 'A', '2', 12, 79), (575, 2024, 2020, 6, 'A', '2', 12, 71), (576, 2027, 2020, 6, 'A', '2', 12, 70), (577, 2030, 2020, 6, 'A', '2', 12, 65), (578, 2033, 2020, 6, 'A', '2', 12, 85), (579, 2036, 2020, 6, 'A', '2', 12, 45), (580, 2039, 2020, 6, 'A', '2', 12, 65), (581, 2042, 2020, 6, 'A', '2', 12, 85), (582, 2045, 2020, 6, 'A', '2', 12, 46), (583, 2048, 2020, 6, 'A', '2', 12, 67), (584, 2051, 2020, 6, 'A', '2', 12, 62), (585, 2054, 2020, 6, 'A', '2', 12, 60), (586, 2057, 2020, 6, 'A', '2', 12, 68), (587, 2060, 2020, 6, 'A', '2', 12, 85), (588, 2063, 2020, 6, 'A', '2', 12, 75), (589, 2066, 2020, 6, 'A', '2', 12, 56), (590, 2069, 2020, 6, 'A', '2', 12, 56), (591, 2072, 2020, 6, 'A', '2', 12, 65), (592, 2075, 2020, 6, 'A', '2', 12, 85), (593, 2078, 2020, 6, 'A', '2', 12, 45), (594, 2081, 2020, 6, 'A', '2', 12, 23), (595, 2084, 2020, 6, 'A', '2', 12, 35), (596, 2087, 2020, 6, 'A', '2', 12, 65), (597, 2090, 2020, 6, 'A', '2', 12, 85), (598, 2093, 2020, 6, 'A', '2', 12, 75), (599, 2096, 2020, 6, 'A', '2', 12, 56), (600, 2099, 2020, 6, 'A', '2', 12, 45), (601, 2102, 2020, 6, 'A', '2', 12, 65), (602, 2105, 2020, 6, 'A', '2', 12, 75), (603, 2109, 2020, 6, 'A', '2', 12, 62), (604, 2001, 2020, 6, 'B', '2', 12, 56), (605, 2004, 2020, 6, 'B', '2', 12, 75), (606, 2007, 2020, 6, 'B', '2', 12, 85), (607, 2010, 2020, 6, 'B', '2', 12, 56), (608, 2013, 2020, 6, 'B', '2', 12, 89), (609, 2016, 2020, 6, 'B', '2', 12, 85), (610, 2019, 2020, 6, 'B', '2', 12, 82), (611, 2022, 2020, 6, 'B', '2', 12, 46), (612, 2025, 2020, 6, 'B', '2', 12, 75), (613, 2028, 2020, 6, 'B', '2', 12, 95), (614, 2031, 2020, 6, 'B', '2', 12, 65), (615, 2034, 2020, 6, 'B', '2', 12, 46), (616, 2037, 2020, 6, 'B', '2', 12, 73), (617, 2040, 2020, 6, 'B', '2', 12, 85), (618, 2043, 2020, 6, 'B', '2', 12, 65), (619, 2046, 2020, 6, 'B', '2', 12, 65), (620, 2049, 2020, 6, 'B', '2', 12, 75), (621, 2052, 2020, 6, 'B', '2', 12, 32), (622, 1, 2020, 6, 'A', '2', 15, 46), (623, 3, 2020, 6, 'A', '2', 15, 75), (624, 1066, 2020, 6, 'A', '2', 15, 85), (626, 2003, 2020, 6, 'A', '2', 15, 85), (627, 2006, 2020, 6, 'A', '2', 15, 46), (628, 2009, 2020, 6, 'A', '2', 15, 65), (629, 2012, 2020, 6, 'A', '2', 15, 85), (630, 2015, 2020, 6, 'A', '2', 15, 75), (631, 2018, 2020, 6, 'A', '2', 15, 65), (632, 2021, 2020, 6, 'A', '2', 15, 85), (633, 2024, 2020, 6, 'A', '2', 15, 65), (634, 2027, 2020, 6, 'A', '2', 15, 32), (635, 2030, 2020, 6, 'A', '2', 15, 75), (636, 2033, 2020, 6, 'A', '2', 15, 56), (637, 2036, 2020, 6, 'A', '2', 15, 75), (638, 2039, 2020, 6, 'A', '2', 15, 63), (639, 2042, 2020, 6, 'A', '2', 15, 85), (640, 2045, 2020, 6, 'A', '2', 15, 65), (641, 2048, 2020, 6, 'A', '2', 15, 63), (642, 2051, 2020, 6, 'A', '2', 15, 75), (643, 2054, 2020, 6, 'A', '2', 15, 77), (644, 2057, 2020, 6, 'A', '2', 15, 76), (645, 2060, 2020, 6, 'A', '2', 15, 73), (646, 2063, 2020, 6, 'A', '2', 15, 85), (647, 2066, 2020, 6, 'A', '2', 15, 65), (648, 2069, 2020, 6, 'A', '2', 15, 75), (649, 2072, 2020, 6, 'A', '2', 15, 80), (650, 2075, 2020, 6, 'A', '2', 15, 95), (651, 2078, 2020, 6, 'A', '2', 15, 85), (652, 2081, 2020, 6, 'A', '2', 15, 76), (653, 2084, 2020, 6, 'A', '2', 15, 63), (654, 2087, 2020, 6, 'A', '2', 15, 65), (655, 2090, 2020, 6, 'A', '2', 15, 75), (656, 2093, 2020, 6, 'A', '2', 15, 65), (657, 2096, 2020, 6, 'A', '2', 15, 68), (658, 2099, 2020, 6, 'A', '2', 15, 76), (659, 2102, 2020, 6, 'A', '2', 15, 83), (660, 2105, 2020, 6, 'A', '2', 15, 85), (661, 2109, 2020, 6, 'A', '2', 15, 82), (662, 2001, 2020, 6, 'B', '2', 15, 65), (663, 2004, 2020, 6, 'B', '2', 15, 85), (664, 2007, 2020, 6, 'B', '2', 15, 64), (665, 2010, 2020, 6, 'B', '2', 15, 75), (666, 2013, 2020, 6, 'B', '2', 15, 85), (667, 2016, 2020, 6, 'B', '2', 15, 63), (668, 2019, 2020, 6, 'B', '2', 15, 75), (669, 2022, 2020, 6, 'B', '2', 15, 85), (670, 2025, 2020, 6, 'B', '2', 15, 96), (671, 2028, 2020, 6, 'B', '2', 15, 65), (672, 2031, 2020, 6, 'B', '2', 15, 70), (673, 2034, 2020, 6, 'B', '2', 15, 71), (674, 2037, 2020, 6, 'B', '2', 15, 68), (675, 2040, 2020, 6, 'B', '2', 15, 96), (676, 2043, 2020, 6, 'B', '2', 15, 85), (677, 2046, 2020, 6, 'B', '2', 15, 75), (678, 2049, 2020, 6, 'B', '2', 15, 85), (679, 2052, 2020, 6, 'B', '2', 15, 65), (680, 1, 2020, 6, 'A', '2', 16, 75), (681, 3, 2020, 6, 'A', '2', 16, 65), (682, 1066, 2020, 6, 'A', '2', 16, 85), (684, 2003, 2020, 6, 'A', '2', 16, 68), (685, 2006, 2020, 6, 'A', '2', 16, 85), (686, 2009, 2020, 6, 'A', '2', 16, 65), (687, 2012, 2020, 6, 'A', '2', 16, 85), (688, 2015, 2020, 6, 'A', '2', 16, 75), (689, 2018, 2020, 6, 'A', '2', 16, 85), (690, 2021, 2020, 6, 'A', '2', 16, 65), (691, 2024, 2020, 6, 'A', '2', 16, 85), (692, 2027, 2020, 6, 'A', '2', 16, 75), (693, 2030, 2020, 6, 'A', '2', 16, 85), (694, 2033, 2020, 6, 'A', '2', 16, 65), (695, 2036, 2020, 6, 'A', '2', 16, 75), (696, 2039, 2020, 6, 'A', '2', 16, 85), (697, 2042, 2020, 6, 'A', '2', 16, 65), (698, 2045, 2020, 6, 'A', '2', 16, 85), (699, 2048, 2020, 6, 'A', '2', 16, 75), (700, 2051, 2020, 6, 'A', '2', 16, 85), (701, 2054, 2020, 6, 'A', '2', 16, 65), (702, 2057, 2020, 6, 'A', '2', 16, 85), (703, 2060, 2020, 6, 'A', '2', 16, 95), (704, 2063, 2020, 6, 'A', '2', 16, 76), (705, 2066, 2020, 6, 'A', '2', 16, 65), (706, 2069, 2020, 6, 'A', '2', 16, 75), (707, 2072, 2020, 6, 'A', '2', 16, 70), (708, 2075, 2020, 6, 'A', '2', 16, 65), (709, 2078, 2020, 6, 'A', '2', 16, 76), (710, 2081, 2020, 6, 'A', '2', 16, 56), (711, 2084, 2020, 6, 'A', '2', 16, 75), (712, 2087, 2020, 6, 'A', '2', 16, 65), (713, 2090, 2020, 6, 'A', '2', 16, 85), (714, 2093, 2020, 6, 'A', '2', 16, 65), (715, 2096, 2020, 6, 'A', '2', 16, 75), (716, 2099, 2020, 6, 'A', '2', 16, 65), (717, 2102, 2020, 6, 'A', '2', 16, 85), (718, 2105, 2020, 6, 'A', '2', 16, 56), (719, 2109, 2020, 6, 'A', '2', 16, 75), (720, 2001, 2020, 6, 'B', '2', 16, 65), (721, 2004, 2020, 6, 'B', '2', 16, 86), (722, 2007, 2020, 6, 'B', '2', 16, 85), (723, 2010, 2020, 6, 'B', '2', 16, 96), (724, 2013, 2020, 6, 'B', '2', 16, 75), (725, 2016, 2020, 6, 'B', '2', 16, 77), (726, 2019, 2020, 6, 'B', '2', 16, 70), (727, 2022, 2020, 6, 'B', '2', 16, 69), (728, 2025, 2020, 6, 'B', '2', 16, 96), (729, 2028, 2020, 6, 'B', '2', 16, 75), (730, 2031, 2020, 6, 'B', '2', 16, 56), (731, 2034, 2020, 6, 'B', '2', 16, 45), (732, 2037, 2020, 6, 'B', '2', 16, 32), (733, 2040, 2020, 6, 'B', '2', 16, 23), (734, 2043, 2020, 6, 'B', '2', 16, 56), (735, 2046, 2020, 6, 'B', '2', 16, 56), (736, 2049, 2020, 6, 'B', '2', 16, 80), (737, 2052, 2020, 6, 'B', '2', 16, 75), (738, 1, 2020, 6, 'A', '2', 17, 56), (739, 3, 2020, 6, 'A', '2', 17, 85), (740, 1066, 2020, 6, 'A', '2', 17, 85), (742, 2003, 2020, 6, 'A', '2', 17, 77), (743, 2006, 2020, 6, 'A', '2', 17, 56), (744, 2009, 2020, 6, 'A', '2', 17, 55), (745, 2012, 2020, 6, 'A', '2', 17, 75), (746, 2015, 2020, 6, 'A', '2', 17, 50), (747, 2018, 2020, 6, 'A', '2', 17, 66), (748, 2021, 2020, 6, 'A', '2', 17, 35), (749, 2024, 2020, 6, 'A', '2', 17, 56), (750, 2027, 2020, 6, 'A', '2', 17, 77), (751, 2030, 2020, 6, 'A', '2', 17, 56), (752, 2033, 2020, 6, 'A', '2', 17, 68), (753, 2036, 2020, 6, 'A', '2', 17, 69), (754, 2039, 2020, 6, 'A', '2', 17, 75), (755, 2042, 2020, 6, 'A', '2', 17, 85), (756, 2045, 2020, 6, 'A', '2', 17, 80), (757, 2048, 2020, 6, 'A', '2', 17, 85), (758, 2051, 2020, 6, 'A', '2', 17, 81), (759, 2054, 2020, 6, 'A', '2', 17, 75), (760, 2057, 2020, 6, 'A', '2', 17, 63), (761, 2060, 2020, 6, 'A', '2', 17, 95), (762, 2063, 2020, 6, 'A', '2', 17, 82), (763, 2066, 2020, 6, 'A', '2', 17, 45), (764, 2069, 2020, 6, 'A', '2', 17, 75), (765, 2072, 2020, 6, 'A', '2', 17, 65), (766, 2075, 2020, 6, 'A', '2', 17, 85), (767, 2078, 2020, 6, 'A', '2', 17, 35), (768, 2081, 2020, 6, 'A', '2', 17, 75), (769, 2084, 2020, 6, 'A', '2', 17, 85), (770, 2087, 2020, 6, 'A', '2', 17, 56), (771, 2090, 2020, 6, 'A', '2', 17, 46), (772, 2093, 2020, 6, 'A', '2', 17, 75), (773, 2096, 2020, 6, 'A', '2', 17, 65), (774, 2099, 2020, 6, 'A', '2', 17, 56), (775, 2102, 2020, 6, 'A', '2', 17, 66), (776, 2105, 2020, 6, 'A', '2', 17, 75), (777, 2109, 2020, 6, 'A', '2', 17, 88), (778, 2001, 2020, 6, 'B', '2', 17, 65), (779, 2004, 2020, 6, 'B', '2', 17, 42), (780, 2007, 2020, 6, 'B', '2', 17, 65), (781, 2010, 2020, 6, 'B', '2', 17, 75), (782, 2013, 2020, 6, 'B', '2', 17, 85), (783, 2016, 2020, 6, 'B', '2', 17, 56), (784, 2019, 2020, 6, 'B', '2', 17, 65), (785, 2022, 2020, 6, 'B', '2', 17, 85), (786, 2025, 2020, 6, 'B', '2', 17, 56), (787, 2028, 2020, 6, 'B', '2', 17, 85), (788, 2031, 2020, 6, 'B', '2', 17, 77), (789, 2034, 2020, 6, 'B', '2', 17, 65), (790, 2037, 2020, 6, 'B', '2', 17, 85), (791, 2040, 2020, 6, 'B', '2', 17, 65), (792, 2043, 2020, 6, 'B', '2', 17, 88), (793, 2046, 2020, 6, 'B', '2', 17, 56), (794, 2049, 2020, 6, 'B', '2', 17, 75), (795, 2052, 2020, 6, 'B', '2', 17, 65), (799, 2000, 2020, 6, 'A', '1', 1, 80), (800, 2003, 2020, 6, 'A', '1', 1, 75), (801, 2006, 2020, 6, 'A', '1', 1, 70), (802, 2009, 2020, 6, 'A', '1', 1, 65), (803, 2012, 2020, 6, 'A', '1', 1, 65), (804, 2015, 2020, 6, 'A', '1', 1, 85), (805, 2018, 2020, 6, 'A', '1', 1, 63), (806, 2021, 2020, 6, 'A', '1', 1, 85), (807, 2024, 2020, 6, 'A', '1', 1, 75), (808, 2027, 2020, 6, 'A', '1', 1, 65), (809, 2030, 2020, 6, 'A', '1', 1, 52), (810, 2033, 2020, 6, 'A', '1', 1, 50), (811, 2036, 2020, 6, 'A', '1', 1, 45), (812, 2039, 2020, 6, 'A', '1', 1, 40), (813, 2042, 2020, 6, 'A', '1', 1, 41), (814, 2045, 2020, 6, 'A', '1', 1, 23), (815, 2048, 2020, 6, 'A', '1', 1, 52), (816, 2051, 2020, 6, 'A', '1', 1, 45), (817, 2054, 2020, 6, 'A', '1', 1, 75), (818, 2057, 2020, 6, 'A', '1', 1, 65), (819, 2060, 2020, 6, 'A', '1', 1, 85), (820, 2063, 2020, 6, 'A', '1', 1, 85), (821, 2066, 2020, 6, 'A', '1', 1, 63), (822, 2069, 2020, 6, 'A', '1', 1, 75), (823, 2072, 2020, 6, 'A', '1', 1, 62), (824, 2075, 2020, 6, 'A', '1', 1, 42), (825, 2078, 2020, 6, 'A', '1', 1, 44), (826, 2081, 2020, 6, 'A', '1', 1, 77), (827, 2084, 2020, 6, 'A', '1', 1, 88), (828, 2087, 2020, 6, 'A', '1', 1, 92), (829, 2090, 2020, 6, 'A', '1', 1, 52), (830, 2093, 2020, 6, 'A', '1', 1, 74), (831, 2096, 2020, 6, 'A', '1', 1, 75), (832, 2099, 2020, 6, 'A', '1', 1, 65), (833, 2102, 2020, 6, 'A', '1', 1, 39), (834, 2105, 2020, 6, 'A', '1', 1, 85), (835, 2109, 2020, 6, 'A', '1', 1, 60), (839, 2000, 2020, 6, 'A', '3', 1, 90), (840, 2003, 2020, 6, 'A', '3', 1, 75), (841, 2006, 2020, 6, 'A', '3', 1, 65), (842, 2009, 2020, 6, 'A', '3', 1, 85), (843, 2012, 2020, 6, 'A', '3', 1, 56), (844, 2015, 2020, 6, 'A', '3', 1, 85), (845, 2018, 2020, 6, 'A', '3', 1, 65), (846, 2021, 2020, 6, 'A', '3', 1, 75), (847, 2024, 2020, 6, 'A', '3', 1, 52), (848, 2027, 2020, 6, 'A', '3', 1, 55), (849, 2030, 2020, 6, 'A', '3', 1, 65), (850, 2033, 2020, 6, 'A', '3', 1, 34), (851, 2036, 2020, 6, 'A', '3', 1, 75), (852, 2039, 2020, 6, 'A', '3', 1, 63), (853, 2042, 2020, 6, 'A', '3', 1, 65), (854, 2045, 2020, 6, 'A', '3', 1, 75), (855, 2048, 2020, 6, 'A', '3', 1, 85), (856, 2051, 2020, 6, 'A', '3', 1, 65), (857, 2054, 2020, 6, 'A', '3', 1, 42), (858, 2057, 2020, 6, 'A', '3', 1, 85), (859, 2060, 2020, 6, 'A', '3', 1, 65), (860, 2063, 2020, 6, 'A', '3', 1, 65), (861, 2066, 2020, 6, 'A', '3', 1, 75), (862, 2069, 2020, 6, 'A', '3', 1, 56), (863, 2072, 2020, 6, 'A', '3', 1, 63), (864, 2075, 2020, 6, 'A', '3', 1, 84), (865, 2078, 2020, 6, 'A', '3', 1, 63), (866, 2081, 2020, 6, 'A', '3', 1, 80), (867, 2084, 2020, 6, 'A', '3', 1, 74), (868, 2087, 2020, 6, 'A', '3', 1, 69), (869, 2090, 2020, 6, 'A', '3', 1, 75), (870, 2093, 2020, 6, 'A', '3', 1, 63), (871, 2096, 2020, 6, 'A', '3', 1, 45), (872, 2099, 2020, 6, 'A', '3', 1, 74), (873, 2102, 2020, 6, 'A', '3', 1, 85), (874, 2105, 2020, 6, 'A', '3', 1, 69), (875, 2109, 2020, 6, 'A', '3', 1, 53), (876, 2000, 2020, 6, 'A', '3', 2, 93), (877, 2000, 2020, 6, 'A', '3', 3, 90), (878, 2000, 2020, 6, 'A', '3', 4, 98), (879, 2000, 2020, 6, 'A', '3', 5, 96), (880, 2000, 2020, 6, 'A', '3', 6, 98), (881, 2000, 2020, 6, 'A', '3', 7, 92), (882, 2000, 2020, 6, 'A', '3', 9, 89), (883, 2000, 2020, 6, 'A', '3', 10, 75), (884, 2000, 2020, 6, 'A', '3', 11, 91), (885, 2000, 2020, 6, 'A', '3', 12, 82), (886, 2000, 2020, 6, 'A', '3', 13, 91), (887, 2000, 2020, 6, 'A', '3', 15, 95), (888, 2000, 2020, 6, 'A', '3', 16, 88), (889, 2000, 2020, 6, 'A', '3', 17, 91), (890, 2000, 2020, 6, 'A', '2', 2, 91), (891, 2000, 2020, 6, 'A', '2', 3, 90), (892, 2000, 2020, 6, 'A', '2', 5, 98), (893, 2000, 2020, 6, 'A', '2', 6, 97), (894, 2000, 2020, 6, 'A', '2', 7, 91), (895, 2000, 2020, 6, 'A', '2', 9, 83), (896, 2000, 2020, 6, 'A', '2', 10, 73), (897, 2000, 2020, 6, 'A', '2', 11, 90), (898, 2000, 2020, 6, 'A', '2', 12, 79), (899, 2000, 2020, 6, 'A', '2', 13, 90), (900, 2000, 2020, 6, 'A', '2', 15, 90), (901, 2000, 2020, 6, 'A', '2', 16, 80), (902, 2000, 2020, 6, 'A', '2', 17, 83), (903, 2000, 2020, 6, 'A', '1', 2, 85), (904, 2000, 2020, 6, 'A', '1', 3, 92), (905, 2000, 2020, 6, 'A', '1', 4, 98), (906, 2000, 2020, 6, 'A', '1', 5, 95), (907, 2000, 2020, 6, 'A', '1', 6, 97), (908, 2000, 2020, 6, 'A', '1', 7, 90), (909, 2000, 2020, 6, 'A', '1', 9, 80), (910, 2000, 2020, 6, 'A', '1', 10, 70), (911, 2000, 2020, 6, 'A', '1', 11, 90), (912, 2000, 2020, 6, 'A', '1', 12, 78), (913, 2000, 2020, 6, 'A', '1', 13, 90), (914, 2000, 2020, 6, 'A', '1', 15, 90), (915, 2000, 2020, 6, 'A', '1', 16, 82), (916, 2000, 2020, 6, 'A', '1', 17, 88), (917, 1000, 2020, 7, 'A', '1', 1, 75), (918, 1003, 2020, 7, 'A', '1', 1, 45), (919, 1006, 2020, 7, 'A', '1', 1, 86), (920, 1009, 2020, 7, 'A', '1', 1, 59), (921, 1012, 2020, 7, 'A', '1', 1, 59), (922, 1015, 2020, 7, 'A', '1', 1, 36), (923, 1018, 2020, 7, 'A', '1', 1, 47), (924, 1021, 2020, 7, 'A', '1', 1, 95), (925, 1024, 2020, 7, 'A', '1', 1, 28), (926, 1027, 2020, 7, 'A', '1', 1, 68), (927, 1030, 2020, 7, 'A', '1', 1, 63), (928, 1033, 2020, 7, 'A', '1', 1, 79), (929, 1036, 2020, 7, 'A', '1', 1, 88), (930, 1039, 2020, 7, 'A', '1', 1, 52), (931, 1042, 2020, 7, 'A', '1', 1, 35), (932, 1045, 2020, 7, 'A', '1', 1, 75), (933, 1048, 2020, 7, 'A', '1', 1, 67), (934, 1051, 2020, 7, 'A', '1', 1, 42), (935, 1054, 2020, 7, 'A', '1', 1, 54), (936, 1057, 2020, 7, 'A', '1', 1, 65), (937, 1060, 2020, 7, 'A', '1', 1, 73), (938, 1063, 2020, 7, 'A', '1', 1, 44), (939, 1069, 2020, 7, 'A', '1', 1, 29), (940, 1072, 2020, 7, 'A', '1', 1, 50), (941, 1075, 2020, 7, 'A', '1', 1, 46), (942, 1078, 2020, 7, 'A', '1', 1, 66), (943, 1081, 2020, 7, 'A', '1', 1, 80), (944, 1084, 2020, 7, 'A', '1', 1, 91), (945, 1087, 2020, 7, 'A', '1', 1, 40), (946, 1090, 2020, 7, 'A', '1', 1, 55), (947, 1093, 2020, 7, 'A', '1', 1, 62), (948, 1096, 2020, 7, 'A', '1', 1, 53), (949, 1099, 2020, 7, 'A', '1', 1, 94), (950, 1102, 2020, 7, 'A', '1', 1, 43), (951, 1105, 2020, 7, 'A', '1', 1, 71), (952, 1108, 2020, 7, 'A', '1', 1, 60), (953, 1111, 2020, 7, 'A', '1', 1, 40), (954, 1114, 2020, 7, 'A', '1', 1, 82), (955, 1117, 2020, 7, 'A', '1', 1, 74); -- -------------------------------------------------------- -- -- Table structure for table `migrations` -- CREATE TABLE `migrations` ( `id` int(10) UNSIGNED NOT NULL, `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Dumping data for table `migrations` -- INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1, '2020_05_03_054518_create_performances_table', 1), (2, '2020_05_04_055015_create_class_updates_table', 2), (3, '2020_05_05_032523_create_cal_marks_table', 3); -- -------------------------------------------------------- -- -- Table structure for table `news` -- CREATE TABLE `news` ( `id` int(11) NOT NULL, `picture` varchar(255) DEFAULT 'uploads/default.jpg', `topic` varchar(500) DEFAULT NULL, `description` varchar(2000) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `news` -- INSERT INTO `news` (`id`, `picture`, `topic`, `description`) VALUES (8, 'uploads/15867618021-file.jpg', 'parents meeting', 'held on 15th march 2015'), (9, 'uploads/15868323251-file.jpg', 'Sport meet', '2020/10/23'), (10, 'uploads/15868324591-file.png', 'Compitition', '2020/10/23'), (11, 'uploads/15868572731-file.jpg', 'Drama', '2020/10/30'); -- -------------------------------------------------------- -- -- Table structure for table `notifications` -- CREATE TABLE `notifications` ( `admition_number` varchar(100) DEFAULT NULL, `message` varchar(500) NOT NULL, `name` varchar(255) DEFAULT NULL, `telephone` int(20) DEFAULT NULL, `status` varchar(50) NOT NULL DEFAULT 'new', `id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `notifications` -- INSERT INTO `notifications` (`admition_number`, `message`, `name`, `telephone`, `status`, `id`) VALUES ('2542326', 'udygsyfasdgygydfhad', 'kjsdflk', 21536655, 'view', 1), ('21002', 'jgxhgsadcbdabscigdc', 'deyya', 123354456, 'view', 2), ('21002', 'jgxhgsadcbdabscigdc', 'deyya', 123354456, 'view', 3), ('20001', 'earecjnxknkxabsxuoakdbgfugudksssssssssssssssssssssssssssssssssv fkte;hnrnljnslnfvuufkhbihjibhitjibjtibjijbijibirhjfhjkfefevjefgttfevgfevgefvbhjdbgnkjfdnbjlgklfgbgefjnb\r\ngbkmgkfmbklmgrkebmrmekbgm\r\nbkmgdmbkdblgmblmgrmnuoukjmrejlhgiugimbhfndldbbhkfbndlshunlj uhvjlnv hv uhfkvgyifegv ehjlgbefjbbwrhff8iqjopiyeg83u97289895-297809-/', 'kasun', 714569823, 'view', 5), ('2542326', 'uuhauenfhf', 'uhfuds', 123354456, 'view', 6), ('203', 'i want to change my telephone number', 'sunimal', 112548796, 'view', 8), ('203', 'i want to change my telephone number', 'sunimal', 112548796, 'view', 9); -- -------------------------------------------------------- -- -- Table structure for table `prefect_forms` -- CREATE TABLE `prefect_forms` ( `prefect_form_id` bigint(20) NOT NULL, `admission_number` bigint(20) NOT NULL, `photo` varchar(255) NOT NULL, `sport/activity/club` varchar(500) DEFAULT NULL, `post` varchar(200) DEFAULT NULL, `extracurricular_activity` varchar(500) DEFAULT NULL, `level` varchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `roles` -- CREATE TABLE `roles` ( `id` bigint(20) NOT NULL, `role` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `roles` -- INSERT INTO `roles` (`id`, `role`) VALUES (1, 'Admin'), (2, 'Principle'), (3, 'Student'), (4, 'Teacher'), (5, 'Class teacher'); -- -------------------------------------------------------- -- -- Table structure for table `students` -- CREATE TABLE `students` ( `admission_number` bigint(20) NOT NULL, `full_name` varchar(100) NOT NULL, `name_with_initials` varchar(100) DEFAULT NULL, `dob` date NOT NULL, `blood_group` varchar(10) DEFAULT NULL, `religion` varchar(50) DEFAULT NULL, `nationality` varchar(50) DEFAULT NULL, `address` varchar(100) DEFAULT NULL, `transport_method` varchar(10) DEFAULT NULL, `red_cross_participation` varchar(4) DEFAULT NULL, `guiding_participation` varchar(4) DEFAULT NULL, `grade_5_scholarship_marks` int(11) DEFAULT NULL, `guardian_name` varchar(100) DEFAULT NULL, `guardian_tp_number` int(20) DEFAULT NULL, `grade` int(11) NOT NULL, `class` char(2) NOT NULL, `user_id` bigint(20) DEFAULT NULL, `id` bigint(20) NOT NULL, `gender` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `students` -- INSERT INTO `students` (`admission_number`, `full_name`, `name_with_initials`, `dob`, `blood_group`, `religion`, `nationality`, `address`, `transport_method`, `red_cross_participation`, `guiding_participation`, `grade_5_scholarship_marks`, `guardian_name`, `guardian_tp_number`, `grade`, `class`, `user_id`, `id`, `gender`) VALUES (1, 'kasun pradeep', 'k.pradeep', '2020-04-09', 'A', 'Bud', 'sinhala', '123', 'van', 'no', 'yes', 125, 'piyal', 112547896, 6, 'A', 87, 4, 'male'), (3, 'kamal perera', 'k.perera', '1981-12-31', 'O+', 'buddhist', 'sinhala', '234', NULL, 'no', NULL, 50, 'kasun', 714857845, 6, 'A', 94, 5, 'male'), (7, 'ayesha perera', 'a.perera', '2020-07-07', 'B-', 'buddhist', 'sinhala', '234,athidiya', 'van', 'yes', 'no', 29, 'kasun', 714857845, 6, 'H', 97, 6, 'female'), (1000, 'Rajapaksha Mudiyanselage Aseni Malsha', 'R.M.A.Malsha', '2008-04-06', 'AB-', 'Buddhism', 'Sinhala', 'Beach Rd,Eliyakanda , Mathara', 'Bicycle', 'yes', 'no', 198, 'R.M.Rajapaksha', 710712653, 7, 'A', 170, 65, 'female'), (1001, 'Umange Wayomi Nuwanthika', 'U.W.Nuwanthika', '2008-12-08', 'B+', 'Christianity', 'Sinhala', '354/12, Main Rd, Beliaththa', 'Train', 'yes', 'yes', 178, 'U.W.Ranaweera', 712368592, 7, 'B', 171, 66, 'female'), (1002, 'Gampalage Rukshana Gunasekara', 'G.R.Gunasekara', '2009-01-02', 'B+', 'Hinduism', 'Tamil', 'No;57/2 , Wellamadama, Mathara', 'Train', 'no', 'yes', 156, 'G.Gunathilake', 713694582, 7, 'C', 172, 67, 'female'), (1003, 'Hewa Pathiranage Rukshan Hansaka Karunarathne', 'H.P.R.R.Pathirana', '2008-05-06', 'AB-', 'Buddhism', 'Sinhala', 'Green House, 5/7, Mathara', 'Bicycle', 'yes', 'yes', 156, 'H.P.Ravi', 719637412, 7, 'A', 173, 68, 'male'), (1004, 'Diyagu Arachchige Nuwanthi Pavithra', 'D.A.N.Pavithra', '2008-08-01', 'B-', 'Buddhism', 'Sinhala', 'No:287,Beach Rd, eliyakanda, Mathara', 'Foot', 'yes', 'no', 110, 'D.A.Karunarathne', 710719872, 7, 'B', 174, 69, 'female'), (1005, 'Gamage Arachchilage Shanudhri Dilhara', 'G.A.S.Dilhara', '2008-08-06', 'AB-', 'Buddhism', 'Sinhala', 'New home Garden, Nuupe, Mathara', 'School Bus', 'yes', 'yes', 169, 'G.A.Adhikari', 712368594, 7, 'C', 175, 70, 'female'), (1006, 'Gamage Sepalika Dilhani', 'G.S.Dilhani', '2008-11-09', 'A+', 'Buddhism', 'Sinhala', 'No;20/3, Eliyakanda , Mathara', 'Foot', 'yes', 'yes', 168, 'Swarna Herath', 718989894, 7, 'A', 176, 71, 'female'), (1007, 'Pathiranage Dinush', 'Dissanayake Mudiyanselage Dinush Awishka', '2008-08-06', 'B+', 'Buddhism', 'Sinhala', 'No:14 , Polhena, Mathara', 'Train', 'yes', 'yes', 175, 'D.M.D.Awishka', 700718953, 7, 'B', 177, 72, 'male'), (1008, 'Hewa Pathiranage Nuwan Dhananjaya', 'H.P.N.Dhananjaya', '2008-10-06', 'A-', 'Buddhism', 'Sinhala', 'Main Rd, Wellamadama ,Mathara', 'Foot', 'yes', 'no', 146, 'H.P.Kalhara', 713698524, 7, 'C', 178, 73, 'male'), (1009, 'Imihami Mudiyanselage Nadeeka KUmudhuni', 'I.M.N.Kumari', '2008-08-06', 'B+', 'Buddhism', 'Sinhala', '\"Kumudhu House\", Main Rd, Dikwella', 'Bus', 'yes', 'no', 157, 'I.M.Chathur', 710710001, 7, 'A', 179, 74, 'female'), (1010, 'Diyagu Arachchige Nirwan Numesh', 'D.A.N.Numesh', '2008-11-02', 'A+', 'Buddhism', 'Sinhala', 'No:56/2 , Beach Rd, Mathara', 'Bicycle', 'no', 'yes', 195, 'D.A.Dinesh', 728951473, 7, 'B', 180, 75, 'male'), (1011, 'Wrnakula Sooriyage Nadeeka Warnakulasooriya', 'W.S.N.Warnakulasooriya', '2008-08-06', 'B-', 'Buddhism', 'Sinhala', 'Temple Rd, Dikwella', 'School Bus', 'yes', 'no', 189, 'H.P.Hemamali', 752383259, 7, 'C', 181, 76, 'female'), (1012, 'Diyagu Arachchige Nadeesha Karunarathne', 'D.A.N.Karunarathne', '2008-08-06', 'B+', 'Buddhism', 'Sinhala', 'Rahula Mawatha, Mathara', 'Foot', 'no', 'yes', 142, 'H.P.Kumudhuni', 728989203, 7, 'A', 182, 77, 'female'), (1013, 'Kuruppu Arachchige Mayura Dilshan', 'K.A.M.Dilshan', '2008-12-02', 'O+', 'Buddhism', 'Sinhala', '\"Mayura house\", Beach Rd, Mathara', 'Bicycle', 'yes', 'yes', 167, 'K.A.Krishantha', 762323561, 7, 'B', 183, 78, 'male'), (1014, 'Munasinghe Arachchige Gihan Lakshitha', 'M.A.G.Lakshitha', '2008-04-10', 'O+', 'Buddhism', 'Sinhala', '\"Malvila House\" , Temple Rd. Dondra', 'Bus', 'yes', 'yes', 171, 'M.A.Munasinghe', 711431432, 7, 'C', 184, 79, 'male'), (1015, 'Gamage Awantha Pradeep', 'G.A.Pradeep', '2008-11-03', 'B-', 'Christianity', 'Sinhala', 'No:23/8 , Main Rd, Beliaththa', 'Train', 'yes', 'yes', 132, 'G.Sepali', 720726932, 7, 'A', 185, 80, 'male'), (1016, 'Irugal Bandaralage Tharindhu Asela', 'I.B.T.Asela', '2008-08-06', 'B-', 'Buddhism', 'Sinhala', 'Nuupe, Mathara', 'School Bus', 'yes', 'no', 175, 'I.B.Thakshila', 752323000, 7, 'B', 186, 81, 'male'), (1017, 'Thimira Selwanayagam', 'T.Selwanayagam', '2008-05-06', 'B-', 'Hinduism', 'Tamil', 'No:34/1 , New House, Beliaththa', 'Bicycle', 'yes', 'yes', 159, 'G.R.T.AMILA', 711231479, 7, 'C', 187, 82, 'male'), (1018, 'Wasala Arachchige Kushalya Mihirangani Wasala', 'W.A.K.M.Wasala', '2008-12-06', 'B+', 'Buddhism', 'Sinhala', 'No:172, Ipalogama, Maho', 'Foot', 'yes', 'yes', 189, 'Kusum Rathnamalala', 702691458, 7, 'A', 188, 83, 'female'), (1019, 'Kesarani Deepashika', 'K.Deepashika', '2008-05-06', 'B+', 'Buddhism', 'Sinhala', 'Beach Rd, Eliyakanda , Mathara', 'School Bus', 'yes', 'yes', 159, 'D.Gunasekara', 712365892, 7, 'B', 189, 84, 'female'), (1020, 'Hewa Pathiranage Mithma Maheshika', 'H.P.M.Maheshika', '2008-08-06', 'A+', 'Buddhism', 'Sinhala', 'Wellamadama, Mathra', 'School Bus', 'no', 'no', 187, 'Malani Perera', 715987784, 7, 'C', 190, 85, 'female'), (1021, 'Gunathilaka Arachchige Kelum Senaka', 'G.A.K.Senaka', '2008-05-06', 'B-', 'Buddhism', 'Sinhala', '\"Shan vila\", eliyakanda <mathara', 'Bicycle', 'yes', 'no', 189, 'Kasun Kalhara', 715656789, 7, 'A', 191, 86, 'male'), (1022, 'Gamoalage Pubudhu Chathuranga', 'G.P.Chathuranga', '2008-04-06', 'B+', 'Buddhism', 'Sinhala', 'No:5/89 , Main Rd, Mathara', 'Foot', 'no', 'no', 189, 'G.Mihira', 715628965, 7, 'B', 192, 87, 'male'), (1023, 'Sooriyapalage Milina Chathuranga', 'S.M.Chathuranga', '2009-01-10', 'B+', 'Buddhism', 'Sinhala', 'Temple Rd, Nuupe, Mathara', 'School Bus', 'no', 'yes', NULL, 'S.Chandrasena', 712362589, 7, 'C', 193, 88, 'male'), (1024, 'Dissanayake Mudiyanselage Akash Adhithya', 'D.M.A.Adhithya', '2008-08-06', 'O+', 'Christianity', 'Sinhala', 'Beach Rd, Eliyakanda , Mathara', 'Bicycle', 'yes', 'yes', 159, 'D.M.Herath', 710710714, 7, 'A', 195, 90, 'male'), (1025, 'Gonagamage Pavithra Hansani', 'G.P.Hansani', '2008-05-06', 'AB', 'Buddhism', 'Sinhala', 'No:10, Temple Rd, Mathara', 'Foot', 'yes', 'no', 197, 'G.Gunapala', 714892589, 7, 'B', 196, 91, 'female'), (1026, 'Suuriya Arachchilage Pamudhi Dilhara', 'S.A.P.Dilhara', '2008-05-10', 'AB-', 'Buddhism', 'Sinhala', 'Suuriyagaha Gedara, Temple Rd, Beliaththa', 'Train', 'yes', 'yes', 156, 'S.A.Chathura', 710750701, 7, 'C', 197, 92, 'female'), (1027, 'Wijesinghe Ralage Pramodha Lakshani', 'W.R.P.Lakshani', '2008-08-06', 'AB', 'Buddhism', 'Sinhala', 'Green Garden Rd, Mathara', 'Foot', 'yes', 'yes', 75, 'Harshani Wasala', 714562589, 7, 'A', 198, 93, 'female'), (1028, 'Kuruppu Arachchilage Udhula Kalhara', 'K.A.U.Kalhara', '2008-09-02', 'B-', 'Christianity', 'Sinhala', 'No:34/A , Rahula , Mathara', 'Bicycle', 'yes', 'yes', 154, 'K.Karunathilake', 712312315, 7, 'B', 199, 94, 'male'), (1029, 'Gampalage Vinula Ransilu', 'G.V.Ransilu', '2008-08-06', 'AB-', 'Buddhism', 'Sinhala', 'Ground Rd, Eliyakanda,Mathara', 'Bus', 'yes', 'no', 175, 'G.Geethma', 777771234, 7, 'C', 200, 95, 'male'), (1030, 'Rathnamalala Irugal Bandaralage Vinuli Radhinsa', 'R.I.B.V.Radhinsa', '2008-08-06', 'AB', 'Buddhism', 'Sinhala', 'No:56/B, Rahula Mawatha,Mathara', 'Bus', 'no', 'no', 158, 'Sudhrma Kumari', 718889997, 7, 'A', 202, 97, 'female'), (1033, 'Senanayake Mudiyanselage Varsha Sithumi', 'S.M.V.Sithumi', '2008-05-06', 'A+', 'Buddhism', 'Sinhala', 'Ihalagama Rd, Mathara', 'Bicycle', 'no', 'yes', 189, 'S.M.Supun', 701112224, 7, 'A', 203, 98, 'female'), (1036, 'Hettiarachchige Senali Fonseka', 'H.S.Fonseka', '2008-08-06', 'A+', 'Christianity', 'Sinhala', '\"Mahindha House\", Main Street, Mathara', 'School Bus', 'no', 'no', 184, 'H.Athula Fonseka', 725556669, 7, 'A', 204, 99, 'female'), (1039, 'Gonagama Adhikarige Seumini', 'G.A.Seumini', '2008-08-06', 'AB', 'Christianity', 'Sinhala', 'Main Street, Nuupe,Mathara', 'Bicycle', 'yes', 'yes', 158, 'G.R.T.Sethma', 762323500, 7, 'A', 205, 100, 'female'), (1042, 'Gampalage Sithum Imalka', 'G.S.Imalka', '2008-08-06', 'AB-', 'Buddhism', 'Sinhala', 'Main Street, Mathara', 'Bicycle', 'yes', 'no', 172, 'Malsha Gamage', 728889995, 7, 'A', 206, 101, 'male'), (1045, 'Gampalage Adheesha Seumini', 'G.A.Seumini', '2008-04-06', 'AB-', 'Buddhism', 'Sinhala', 'No:10, Temple Rd, Mathara', 'Bus', 'yes', 'yes', 187, 'Tharuka De Silva', 720003232, 7, 'A', 207, 102, 'female'), (1048, 'Wanni Arachchige Sethuni Imalka', 'W.A..S.Imalka', '2008-08-06', 'A+', 'Christianity', 'Sinhala', 'No:23/C , Beliaththa', 'Train', 'yes', 'yes', 178, 'Priyantha Kumara', 412369875, 7, 'A', 208, 103, 'female'), (1051, 'Malvila Arachchige Thisumi Radhinsa Malvila', 'M.A.T.R.Malvila', '2008-08-06', 'A+', 'Buddhism', 'Sinhala', 'Eliyakanda Junction, Mathara', 'Foot', 'yes', 'yes', 172, 'M.A.Shan Malvila', 752323555, 7, 'A', 209, 104, 'female'), (1054, 'Hewa Pathiranage Nesadhi Chaya', 'H.P.N.Chaya', '2008-08-06', 'O+', 'Christianity', 'Sinhala', 'No:28.B, Beach Rd, Mathara', 'Foot', 'no', 'no', 156, 'H.P.Karunathilake', 751231236, 7, 'A', 210, 105, 'female'), (1057, 'Diyagu Arachchige Vinuli Mahima', 'D.A.V.Mahima', '2008-12-02', 'O-', 'Buddhism', 'Sinhala', 'Main Street, Mathara', 'School Bus', 'yes', 'yes', 134, 'D.A.Rajapaksha', 729637415, 7, 'A', 211, 106, 'female'), (1060, 'Ranasinghe Arachchige Reshma Ranasinghe', 'R.A.R.Ranasinghe', '2008-05-07', 'O-', 'Buddhism', 'Sinhala', 'No:152, Mahakoonwewa, Beliaththa', 'Train', 'no', 'no', 102, 'R.A.Kavindhu Ranasinghe', 701237894, 7, 'A', 212, 107, 'female'), (1063, 'Kasthuri Arachchige Akasha Pradeep', 'K.A.A.Pradeep', '2008-08-06', 'A+', 'Buddhism', 'Sinhala', 'Main Rd, Beliaththa', 'Train', 'no', 'no', 90, 'K.A.Ransilu', 412369800, 7, 'A', 213, 108, 'male'), (1066, 'Dilka Geethmi Fonseka', 'D.G.Fonseka', '2008-07-07', 'B-', 'Buddhism', 'Sinhala', 'Main Street, Mathara', 'School Bus', 'no', 'yes', 149, 'Gayan Fonseka', 778255333, 6, 'A', 214, 109, 'female'), (1069, 'Diyagu Arachchige Abhi Lakshan', 'D.A.A.Lakshan', '2008-08-06', 'A-', 'Buddhism', 'sinhala', 'No:34/a, New House, Beliaththa', 'Bicycle', 'yes', NULL, 157, 'D.A.Lavan Rajapaksha', 714987799, 7, 'A', 216, 111, 'male'), (1072, 'Wanasinghe Ralage Lihini Prarthana', 'W.R.L.Prarthana', '2008-08-06', 'AB-', 'Buddhism', 'sinhala', 'No:45/c , Rahula mawatha, Mathara', 'Bus', 'yes', 'yes', 165, 'W.R.Ranasingha', 714545455, 7, 'A', 217, 112, 'female'), (1075, 'Rajapakshage Sunimal Hansaka Rajapaksha', 'R.S.H.Rajapaksha', '2008-04-10', 'B-', 'Buddhism', 'sinhala', 'No:102,Main Street, Mathara', 'School Bus', 'no', 'yes', 168, 'R.Ranaweera', 751497826, 7, 'A', 218, 113, 'male'), (1078, 'Manathunga Arachchige Jayani Samanthika', 'M.A.J. Samanthika', '2008-11-06', 'A+', 'Hinduism', 'Tamil', 'Beach Rd, Eliyakanda, Mathara', 'Foot', 'no', 'yes', 185, 'Nirmala Manathunga', 753697582, 7, 'A', 219, 114, 'female'), (1081, 'Umange Ashen Ransilu', 'U.A.Ransilu', '2008-08-06', 'A-', 'Buddhism', 'sinhala', 'No:23, Temple Rd, Beliaththa', 'Train', 'yes', 'yes', 167, 'U.Anupama', 759873695, 7, 'A', 220, 115, 'male'), (1084, 'Hettiarachchige Tharuki perera', 'H.T.Perera', '2008-10-15', 'B-', 'Buddhism', 'sinhala', 'Ihalagama Rd, Beliaththa', 'Train', 'yes', 'yes', 124, 'H.Namal Perera', 719827539, 7, 'A', 221, 116, 'female'), (1087, 'Gamage Arachchilage Imasha Idhuni Gampala', 'G.A.I.I.Gampala', '2008-08-07', 'A+', 'Buddhism', 'sinhala', 'No:5, Beach rd,Mathara', 'Bus', 'yes', 'yes', 170, 'G.A.Asitha Gampala', 719637852, 7, 'A', 222, 117, 'female'), (1090, 'Hewa Pathiranage Geethma Sandhamali', 'H.P.G.Sandhamali', '2008-01-10', 'B-', 'Buddhism', 'sinhala', 'No:90, Kwkanadhura Rd, Mathara', 'Foot', 'yes', 'no', 185, 'H.P.Jayantha', 705823691, 7, 'A', 223, 118, 'female'), (1093, 'Suuriya Wewa Arachchige Sahan Indhuwara', 'S.W.A.S.Indhuwara', '2008-08-10', 'A+', 'Buddhism', 'sinhala', 'No:01/5, Suuriyawewa ,Mathara', 'School Bus', 'yes', 'no', 143, 'S.W.A.Sumith', 758654289, 7, 'A', 224, 119, 'female'), (1096, 'Manathunga Pereralage Chalini Silva', 'M.P.C.Silva', '2008-05-07', 'A-', 'Buddhism', 'sinhala', 'Beach Rd, Thangalla', 'Bus', 'yes', 'yes', 120, 'M.P.C.M.Silva', 729514789, 7, 'A', 225, 120, 'female'), (1099, 'Diyagu Arachchige Aliya Perera', 'D.A.A.Perera', '2008-08-07', 'AB-', 'Buddhism', 'sinhala', 'N0:20A, Temple Rd, Beliaththa', 'Bus', 'yes', 'no', 129, 'D.A.Athula Perera', 709637521, 7, 'A', 226, 121, 'female'), (1102, 'Senanayake Mudiyanselage Amidhu Lakmal', 'S.M.A.Lakmal', '2008-12-07', 'AB', 'Buddhism', 'sinhala', 'Eliyakanda , Mathara', 'Foot', 'yes', 'yes', 140, 'S.M.Chamara', 416958724, 7, 'A', 227, 122, 'male'), (1105, 'Dissanayake Mudiyanselage Dilsha Dissanayake', 'D.M.D.Dissanayake', '2008-11-11', 'AB', 'Buddhism', 'sinhala', 'Beach Rd, Eliyakanda, Mathara', 'Bus', 'yes', 'no', 180, 'D.M.Bandhula Dissanayake', 713698725, 7, 'A', 228, 123, 'female'), (1108, 'Gampalage Thiwanka Dhilru Perera', 'G.T.D.Perera', '2008-04-26', 'AB', 'Buddhism', 'sinhala', 'Main Rd, Beliaththa, mathara', 'School Bus', 'yes', 'no', 100, 'G.Thilina Perera', 713698521, 7, 'A', 229, 124, 'male'), (1111, 'Diyagu Arachchige Mihindhu Karunarathne', 'D.A.M.Karunarathne', '2008-12-07', 'AB-', 'Buddhism', 'sinhala', '\"Mahindhu House\", Main Street, Mathara', 'Bicycle', 'yes', 'yes', 180, 'D.A.Upul Shantha', 419632579, 7, 'A', 230, 125, 'male'), (1114, 'Yanura Abhises Silva', 'Y.A.Silva', '2008-05-11', 'A+', 'Christianity', 'sinhala', 'Y junction, Nilwella Rd, Mathara', 'School Bus', 'yes', 'no', 130, 'Yohan Silva', 726987521, 7, 'A', 231, 126, 'male'), (1117, 'Malvila Arachchige Yomali Malvila', 'M.A.Y.Malvila', '2008-11-07', 'AB-', 'Buddhism', 'sinhala', 'No:9, Main Street, Dhikwella', 'Bus', 'yes', 'no', 142, 'Amali Ariyawansha', 703697890, 7, 'A', 232, 127, 'female'), (2000, 'Diyagu Arachchige Thanuja Hansamali', 'D.A.Thanuja Hansamali', '2009-03-14', 'A-', 'Buddhism', 'Sinhala', 'Ipalogama,Maho', 'Bus', 'yes', 'no', 165, 'D.A.Karunarathne', 716530125, 6, 'A', 105, 7, 'female'), (2001, 'Dissanayake Mudiyanselage Deuni Imalka', 'D.M.Deuni Imalka', '2009-05-15', 'AB', 'Buddhism', 'Sinhala', 'No:1, Temple Rd, Mathara', 'Bus', 'yes', 'yes', 167, 'D.M.Dissanayake', 714565789, 6, 'B', 106, 8, 'female'), (2002, 'Hewa Pathiranage Kalani Anupama', 'H.P.Kalani Anupama', '2009-09-20', 'A+', 'Buddhism', 'Sinhala', 'Koonwewa, Maho', 'School Bus', 'no', 'yes', 186, 'H.P.Karunarathne', 756709125, 6, 'C', 107, 9, 'female'), (2003, 'Rathnayake Mudiyanselage Kalana Chamara', 'R.M.Kalana Chamara', '2009-09-22', 'O-', 'Sinhala', 'Sinhala', 'Kumbukwewa,Kurunegala', 'Bus', 'no', 'no', 189, 'R.M.Rathnayake', 710098907, 6, 'A', 108, 10, 'male'), (2004, 'Nadeeka Erandhathi Madhana', 'N.E.Madhana', '2009-11-14', 'A+', 'Buddhism', 'Sinhala', 'No:167, Yapahuwa,Maho', 'Bus', 'yes', 'yes', 145, 'Aruna Madhana', 725642083, 6, 'B', 109, 11, 'female'), (2005, 'Rathnamalala Irugal Bandaralage Chalana Pradeep', 'R.I.B.Chalana Pradeep', '2009-01-19', 'B+', 'Buddhism', 'Sinhala', '\"Shanthawasa\", Temple Rd, Maho', 'School Bus', 'no', 'no', 191, 'R.I.B.Rathnamalala', 714987767, 6, 'C', 110, 12, 'male'), (2006, 'Umange Chathura Pradeep', 'U.Chathura Pradeep', '2009-11-21', 'A+', 'Buddhism', 'Sinhala', 'Yapahuwa,Temple Rd, Maho', 'Bus', 'yes', 'no', 123, 'Chamila Herath', 719898000, 6, 'A', 111, 13, 'male'), (2007, 'Niwarthana Gayathree Nandasiri', 'N.G.Nandasiri', '2009-07-18', 'B-', 'Buddhism', 'Sinhala', '259,Dediwala,Waskaduwa', 'Foot', 'yes', 'yes', 187, 'Nandasiri', 710775118, 6, 'B', 113, 15, 'female'), (2008, 'Gayathree Hasara Senarathne', 'G.H.Senarathne', '2009-07-18', 'A-', 'Buddhism', 'Sinhala', 'No:59, Kandawaththa,Uggalbada', 'Bus', 'yes', 'yes', 156, 'Aruna Senarathne', 778892567, 6, 'C', 114, 16, 'female'), (2009, 'Gampalage Rashanthi Thakshila', 'G.R.Thakshila', '2009-06-18', 'B+', 'Buddhism', 'Sinhala', '302C, Andaragaha Rd, Panadura', 'Bus', 'yes', 'yes', 146, 'G.R.T.Fonseka', 714987788, 6, 'A', 115, 17, 'female'), (2010, 'Diyagu Arachchige Nuwan Karunarathne', 'D.A.Nuwan Karunarathne', '2009-05-19', 'AB-', 'Buddhism', 'Sinhala', 'NO;567, Kakirikanda rd, Kurunegala', 'School Bus', 'no', 'no', 101, 'D.A.Karunarathne', 778233556, 6, 'B', 116, 18, 'male'), (2011, 'Hewa Pathiranage Sasini Nikeshala', 'H.P.Sasini Nikeshala', '2009-09-14', 'O+', 'Buddhism', 'Sinhala', 'Mahakoonwewa, Maho', 'School Bus', 'yes', 'yes', 189, 'H.P.Kusumawathi', 714949784, 6, 'C', 117, 19, 'female'), (2012, 'Imihami Mudiyanselage Chathumari Hasini', 'I.M.C.Hasini', '2009-07-18', 'O+', 'Buddhism', 'Sinhala', 'Post Office Rd, Kadubadagama, Nagollagama.', 'School Bus', 'yes', 'yes', 123, 'I.M.Karunathilake', 754987784, 6, 'A', 118, 20, 'female'), (2013, 'Dissanayake Mudiyanselage Saranga Dissanayake', 'D.M.S.Dissanayake', '2009-04-04', 'B-', 'Buddhism', 'Sinhala', 'No:42 ,TB Jayamawatha , Colombo 10', 'Foot', 'yes', 'no', 167, 'D.M.Herath', 718233555, 6, 'B', 119, 21, 'male'), (2014, 'Samantha Jayasundara', 'S.Jayasundara', '2010-01-06', 'B-', 'Hinduism', 'Tamil', 'Wathupalagama,Maho', 'School Bus', 'no', 'yes', 190, 'Jayasundara', 758233556, 6, 'C', 120, 22, 'male'), (2015, 'Hewa Pathiranage Chaya Sandamali', 'H.P.Chaya Sandamali', '2009-10-17', 'O+', 'Buddhism', 'Sinhala', '267/1, Ibbagamuwa,Karuealagedara', 'School Bus', 'no', 'yes', 178, 'Pathirana', 718256999, 6, 'A', 121, 23, 'female'), (2016, 'Irugal Bandaralage Lakshan Chamara', 'I.B.Lakshan Chamara', '2009-07-18', 'O+', 'Buddhism', 'Sinhala', 'Kaduru Kumbura, Kurunagala', 'School Bus', 'yes', 'no', 145, 'I.B.Ranathunga', 758989121, 6, 'B', 122, 24, 'male'), (2017, 'Amarasinghe Arachchige Lakmal Sandaruwan', 'A.A.L.Sandaruwan', '2009-07-18', 'A-', 'Buddhism', 'Sinhala', 'No;107, Melagama, Wadduwa', 'School Bus', 'yes', NULL, 99, 'A.A.Lalith', 714545899, 6, 'C', 125, 26, 'male'), (2018, 'Rathnamalala Irugal Bandaralage Mahesh Sampath Rathnamalala', 'R.I.B.Mahesh Sampath Rathnamalala', '2009-09-21', 'B-', 'Buddhism', 'Sinhala', 'Ihalagama, Ambanpola', 'Foot', 'yes', 'yes', 189, 'R.I.B.Shantha Kumara', 712579831, 6, 'A', 126, 27, 'male'), (2019, 'Adikari Mudiyanselage Nimesh Sampath', 'A.M.Nimesh Sampath', '2009-07-23', 'AB', 'Buddhism', 'Sinhala', 'Nugawela Rd, Gampola', 'Foot', 'yes', 'yes', 170, 'Thamara Kumari', 715654231, 6, 'B', 127, 28, 'male'), (2020, 'Adhikarige Ayeshi Sathsarani', 'A.A.Sathsarani', '2009-07-19', 'AB', 'Buddhism', 'Sinhala', 'no:900, Main street ,Nuupe,Mathara', 'School Bus', 'yes', 'no', 157, 'R.I.B.Rathnamalala', 717812345, 6, 'C', 129, 30, 'female'), (2021, 'Uda Walauwe Mahen Vimukthi', 'U.W.M.Vimukthi', '2009-05-19', 'O+', 'Buddhism', 'Sinhala', 'No:79/2, Rahula, Mathara', 'Bus', 'yes', NULL, 187, 'U.W.Weerasinghe', 713257895, 6, 'A', 128, 29, 'male'), (2022, 'Ranasinghe Pathirajalage Idunil Nimantha', 'R.P.I.Nimantha', '2009-11-22', 'B-', 'Buddhism', 'Sinhala', 'No;10, Ihalawaththa, Mathara', 'Foot', 'no', 'yes', 145, 'R.P.Ranasinghe', 713697215, 6, 'B', 130, 31, 'male'), (2023, 'Umange Tohaj', 'U.Tohaj', '2009-08-19', 'O+', 'Buddhism', 'Sinhala', 'Temple Rd, Kakanadura,Mathara', 'Bus', 'yes', 'yes', 198, 'U.Rathnasiri', 713697521, 6, 'C', 131, 32, 'male'), (2024, 'Amarasinghe Mudalige Chamara Prabath', 'A.M.C.Prabath', '2009-07-19', 'AB-', 'Buddhism', 'Sinhala', 'No:32, Araliyawaththa, Mathara', 'Bicycle', 'yes', 'yes', 156, 'A.M.Amarathunga', 713654789, 6, 'A', 132, 33, 'male'), (2025, 'Ajith Selwanayagam', 'A.Selwanayagam', '2009-07-19', 'AB-', 'Hindu', 'Tamil', 'No:567, Rahula,Mathara', 'Bicycle', 'yes', 'no', 178, 'Rajini Selwanayagam', 712365789, 6, 'B', 133, 34, 'male'), (2026, 'Hewa Pathiranage Sithija Ransilu', 'H.P.S.Ransilu', '2009-07-19', 'B+', 'Buddhism', 'Sinhala', '354/12, Main Rd, Mathara', 'Foot', 'yes', 'no', 178, 'H.P.Sunil', 713698745, 6, 'C', 134, 35, 'male'), (2027, 'Mapa Ralage Nirosha Charuni', 'M.R.N.Charuni', '2009-07-19', 'A-', 'Buddhism', 'Sinhala', 'No:567, Nugawela Junction,Mathara', 'Bus', 'no', 'yes', 156, 'M.R.Karunathilake', 713247859, 6, 'A', 135, 36, 'female'), (2028, 'Kariyawasam Pathiranage Nipuni Wasana', 'K.P.N.Wasana', '2009-07-19', 'A+', 'Buddhism', 'Sinhala', '563/2C, Temple Rd, Mathara', 'School Bus', 'yes', 'yes', 149, 'K.P.Kariyawasam', 713178954, 6, 'B', 136, 37, 'female'), (2029, 'Rupasinghe Jayawardhana Mudiyanselage Nimsara Kalpani Ruupasinghe', 'R.J.M.N.K.Ruupasinghe', '2009-07-19', 'B+', 'Buddhism', 'Sinhala', 'Mihindu Mawatha, Nuupe, Mathara', 'Bicycle', 'yes', 'no', 150, 'R.J.M.Ruupasinghe', 713621758, 6, 'C', 137, 38, 'female'), (2030, 'Kurukula Sooriyage Akhila Dilshan', 'K.S.A.Dilshan', '2009-03-22', 'B+', 'Buddhism', 'Sinhala', 'Daladahama,Maho', 'Bicycle', 'yes', 'yes', 150, 'K.S.Anil', 712753951, 6, 'A', 138, 39, 'male'), (2031, 'Hettiarachchi Gamage Dilan Hansajith', 'H.G.D.Hansajith', '2009-04-19', 'B+', 'Buddhism', 'Sinhala', 'Sunil Niwasa,Temple Rd, Mathara', 'Foot', 'yes', 'no', 186, 'H.G.Dammika', 713759821, 6, 'B', 139, 40, 'male'), (2032, 'Uda Walauwe Sewantha Sudeera', 'U.W.S.Sudeera', '2009-07-19', 'B+', 'Buddhism', 'Sinhala', 'No:168,Nagoda Rd, Maho', 'Bicycle', 'no', 'yes', 103, 'U.W.Sunimal', 713697412, 6, 'C', 140, 41, 'male'), (2033, 'Herath Mudiyanselage Dumidu Sathsara', 'H.M.D.Sathsara', '2009-07-19', 'A+', 'Buddhism', 'Sinhala', 'Kadurukumbura,Pothuhera,Kurunegala', 'Foot', 'yes', 'no', 186, 'H.M.Candrasena', 713753852, 6, 'A', 141, 42, 'male'), (2034, 'Imihami Mudalige Anupama Dilhara', 'I.M.A.Dilhara', '2009-03-19', 'B-', 'Buddhism', 'Sinhala', '7A, Namal Uyana,Mathara', 'Foot', 'yes', 'yes', 189, 'I.M.Karunathilake', 713456285, 6, 'B', 142, 43, 'male'), (2035, 'Narangoda Arachchilage Thisara Chamara', 'N.A.T.Chamara', '2009-07-19', 'B-', 'Buddhism', 'Sinhala', 'No:47B ,Kohilagedara, Mathara', 'Foot', 'yes', 'no', 168, 'N.A.Marasinghe', 712642597, 6, 'C', 143, 44, 'male'), (2036, 'Narangoda Liyanage Sunanda Idunul', 'N.L.S.Idunila', '2009-07-19', 'AB-', 'Buddhism', 'Sinhala', 'No:167, Shantha Niwasa, Daladagama, Maho', 'Foot', 'yes', 'no', 168, 'N.L.Karunarathne', 713759214, 6, 'A', 144, 45, 'male'), (2037, 'Hewa Mudiyanselage Nadun Dilrik', 'H.M.N.Dilruk', '2009-07-06', 'AB', 'Buddhism', 'Sinhala', 'Moragolla ,Ambanpola,Maho', 'Bicycle', 'yes', 'yes', 135, 'H.M.Chandrasena', 713147952, 6, 'B', 145, 46, 'male'), (2038, 'Diyangu Arachchige Thusitha Chamara', 'D.A.T.Chamara', '2009-07-19', 'AB', 'Buddhism', 'Sinhala', 'No:168,Nagoda Rd, Mahara', 'Foot', 'yes', 'no', 156, 'D.A.Karunarathne', 715987423, 6, 'C', 146, 47, 'male'), (2039, 'Hettiarachchi Gamage Sanuka', 'H.G.Sanuka', '2009-07-19', 'AB', 'Buddhism', 'Sinhala', 'Kohila Kumbura,Kuranugala', 'Bicycle', 'yes', 'no', 176, 'H.G.Karunathilaka', 713259745, 6, 'A', 147, 48, 'male'), (2040, 'Senanayake Mudiyanselage Sahansa Lakmal', 'S.M.S.Lakmal', '2009-07-19', 'B+', 'Buddhism', 'Sinhala', 'NUgawela Janction,Daladagama.', 'Bus', 'yes', 'yes', 168, 'S.M.S.Samarathunga', 712698456, 6, 'B', 148, 49, 'male'), (2041, 'Kuruppuge Laknath Minula', 'K.L.Minula', '2009-06-19', 'AB', 'Buddhism', 'Sinhala', 'jayagath Mawatha,Kurunegala', 'Bus', 'yes', 'yes', 167, 'K.L.Kuruppu', 715697268, 6, 'C', 149, 50, 'male'), (2042, 'Diyagu Arachchige Ashan Chamikara', 'D.A.A.Chamikara', '2019-07-19', 'B-', 'Buddhism', 'Sinhala', '35/5, Daladagama,Maho', 'Bicycle', 'yes', 'yes', 167, 'D.D.Karunarathne', 719278643, 6, 'A', 150, 51, 'male'), (2043, 'Rajapaksha Mudiyanselage Onitha Sathsara', 'R.M.O.Sathsara', '2009-03-19', 'B+', 'Buddhism', 'Sinhala', 'No;15, Temple Rd. Mathara', 'Bicycle', 'yes', 'yes', 156, 'R.M.Karunawathi', 715698742, 6, 'B', 151, 52, 'male'), (2044, 'Gampalage Dilmi Wasundara', 'G.D.Wasundara', '2009-07-19', 'AB-', 'Buddhism', 'Sinhala', 'Temple Rd,Mathara', 'Bicycle', 'yes', 'no', 157, 'Kusum Rathnamalala', 713597186, 6, 'C', 152, 53, 'female'), (2045, 'Umange Rashanthi Anuradha', 'U.R.Anuradha', '2009-02-19', 'A+', 'Buddhism', 'Sinhala', '872/3, Main Rd,Mathara', 'Bus', 'yes', 'yes', 193, 'Idunil Gamage', 716479258, 6, 'A', 153, 54, 'female'), (2046, 'Abesinghe Ralage Harshani Nimesha', 'A.R.H.Nimesha', '2009-07-19', 'O-', 'Buddhism', 'Sinhala', 'Araliya Uyana,Mathara', 'Bus', 'yes', 'no', 169, 'A.R.Abeysinghe', 712479318, 6, 'B', 154, 55, 'female'), (2047, 'Herath Mudiyanselage Mekala Chamini', 'H.M.M.Chamini', '2009-03-23', 'AB-', 'Buddhism', 'Sinhala', 'Main Street, Nuupe,Mathara', 'Bus', 'no', 'no', 176, 'Kumudhu Kumari', 715972348, 6, 'C', 155, 56, 'female'), (2048, 'Rathnamalala Arachchige Sulochani Ishara', 'R.A.S.Ishara', '2009-07-19', 'AB', 'Buddhism', 'Sinhala', 'No:4, Wellamadama,Mathara', 'Foot', 'yes', NULL, 156, 'R.A.Namal', 718219726, 6, 'A', 156, 57, 'female'), (2049, 'Gampala Arachchige Hansaka', 'G.A.Hansaka', '2009-07-19', 'AB-', 'Buddhism', 'Sinhala', 'No:09, Temple Rd, Mathara', 'Bicycle', 'yes', 'yes', 167, 'G.Kamal', 719257257, 6, 'B', 157, 58, 'male'), (2050, 'Dewni Ishara Kariyawasam', 'D.A.Kariyawasam', '2009-07-19', 'B+', 'Buddhism', 'Sinhala', 'No:15, Wakwella,Hapugala', 'Bicycle', 'yes', 'yes', 189, 'Karunathilake', 715987149, 6, 'C', 159, 60, 'female'), (2051, 'Hewa Pathiranage Nalaka Heshan', 'H.P.N.Heshan', '2009-07-19', 'B+', 'Buddhism', 'Sinhala', 'N0:23/8, Main Street, Rahula, Mathara', 'Bus', 'yes', 'yes', 165, 'H.P.Nimal', 712694694, 6, 'A', 160, 61, 'male'), (2052, 'Karunathilakage Udharshana Sithuruwan', 'K.U.Sithuruwan', '2009-03-19', 'A+', 'Buddhism', 'Sinhala', 'No:99, A 5 Rd, Mathara', 'Bus', 'yes', 'no', 158, 'K.U.Upali', 715333666, 6, 'B', 161, 62, 'male'), (2053, 'Irugal Bandaralage Achira Lakshan', 'I.B.A.Lakshan', '2013-07-19', 'AB-', 'Buddhism', 'Sinhala', 'No:254, Temple Rd, Mathara', 'Bicycle', 'yes', 'yes', 156, 'I.B.Nilanka', 718244477, 6, 'C', 162, 63, 'male'), (2054, 'Disarala Hamige Sachintha Lakmal', 'D.H.S.Lakmal', '2009-07-19', 'AB-', 'Buddhism', 'Sinhala', 'Sapumal Niwasa, Araliya mawatha,Mathara', 'Foot', 'no', 'no', 143, 'D.H.Saman', 714987777, 6, 'A', 163, 64, 'male'), (2057, 'Gampalage Osandha Sachithra', 'G.O.Sachithra', '2008-08-07', 'AB', 'Buddhism', 'sinhala', 'Mayura Hotel, Beach Rd, Mathara', 'Bus', 'yes', 'no', 128, 'G.Sarath', 703659872, 6, 'A', 234, 128, 'male'), (2060, 'Karunathilakage Sithum Sudharshana', 'K.S.Sudharshana', '2008-06-07', 'B+', 'Buddhism', 'sinhala', 'No:80/D, Dedhiyawala, Mathara', 'Bus', 'yes', 'no', 78, 'K.Kuruppu', 702657231, 6, 'A', 235, 129, 'male'), (2063, 'Diyagu Arachchige Nethuki Ameesha', 'D.A.N.Ameesha', '2009-10-07', 'O-', 'Buddhism', 'sinhala', 'Ihalagedara, Temple Rd, Beliaththa', 'Bus', 'yes', 'no', 146, 'Nuwanthi Pavithra', 729831485, 6, 'A', 236, 130, 'female'), (2066, 'Senanayake Mudiyanselage Tarushini Amaya', 'S.M.T.Amaya', '2009-08-07', 'AB-', 'Buddhism', 'sinhala', 'Beach Rd, Mathara', 'Bicycle', 'no', NULL, 158, 'S.M.Pramitha', 759312345, 6, 'A', 237, 131, 'female'), (2069, 'Wanasinghe Ralage Teshara Prarthana', 'W.R.T.Prarthana', '2009-04-07', 'AB', 'Christianity', 'sinhala', 'Beach Rd, Eliyakanda, Mathara', 'School Bus', 'yes', 'no', 187, 'Ameesha Perera', 702369875, 6, 'A', 238, 132, 'female'), (2072, 'Tehani Silva', 'T.Silva', '2009-06-07', 'AB', 'Buddhism', 'sinhala', 'Araliya Hotel, Eliyakanda, Mathara', 'Bicycle', 'no', 'no', 182, 'Rangith Silva', 713257598, 6, 'A', 239, 133, 'female'), (2075, 'Imihami Mudalige Dhamsilu Dilhara', 'I.M.D.Dilhara', '2009-08-07', 'AB', 'Buddhism', 'sinhala', 'Beach Rd, Mathara', 'Bicycle', 'yes', 'no', 145, 'Karunathilake', 412369876, 6, 'A', 240, 134, 'male'), (2078, 'Hewa Pathiranage Akhitha Ransilu', 'H.P.A.Ransilu', '2009-12-07', 'AB', 'Buddhism', 'sinhala', 'No:40, Wellamadama,Mathara', 'Bus', 'yes', 'no', 95, 'Amal Ariyawansha', 702597531, 6, 'A', 241, 135, 'male'), (2081, 'Suuriya Arachchilage Anupama Prageeth', 'S.A.A.Prageeth', '2009-04-26', 'AB', 'Buddhism', 'sinhala', 'N0:56,\"Mayura house\", Beach Rd, Mathara', 'Bicycle', 'no', 'yes', 163, 'Madhawa Perera', 712364857, 6, 'A', 242, 136, 'male'), (2084, 'Rajasinghe Arachchige Avishka Sulakshana', 'R.A.A.Sulakshana', '2009-08-07', 'AB-', 'Buddhism', 'sinhala', 'Beliahtha, Mathara', 'School Bus', 'yes', NULL, 154, 'Namal Ranasinghe', 768951472, 6, 'A', 243, 137, 'male'), (2087, 'Hewa Pathiranage Dhulanya Prarthana', 'H.P.D.Prarthana', '2009-12-09', 'A-', 'Buddhism', 'sinhala', 'Namal Uyana, Beliaththa', 'Bus', 'yes', 'no', 172, 'Ajith Rohana', 412367589, 6, 'A', 244, 138, 'female'), (2090, 'Pabasari Amodhya Bandara', 'P.A.Bandara', '2009-11-07', 'AB', 'Buddhism', 'sinhala', 'Nuupe,Mathara', 'Bus', 'yes', 'yes', 172, 'Amila Perera', 417892364, 6, 'A', 245, 139, 'female'), (2093, 'Nethuki Amaya Silva', 'N.A.Silva', '2009-05-11', 'A-', 'Buddhism', 'sinhala', 'Main Rd, Mathara', 'Bus', 'no', 'yes', 143, 'Awantha Silva', 702367529, 6, 'A', 246, 140, 'female'), (2096, 'Diyagu Arachchige Amal Perera', 'D.A.A.Perera', '2009-08-07', 'B+', 'Buddhism', 'sinhala', 'Rahula Mawatha, Mathara', 'School Bus', 'yes', 'yes', 141, 'D.A.Perera', 702368592, 6, 'A', 247, 141, 'male'), (2099, 'Dissanayake Mudiyanselage Sajith Perera', 'D.M.S.Perera', '2009-11-10', 'A+', 'Buddhism', 'sinhala', 'Main Street, Mathara', 'Bicycle', 'yes', 'no', 147, 'D.M.Namal', 413657265, 6, 'A', 248, 142, 'male'), (2102, 'Gampalage Thuurya Deshani', 'G.T.deshani', '2009-11-07', 'O+', 'Buddhism', 'sinhala', 'Rahula Mawatha, Mathara', 'Bus', 'yes', 'no', 142, 'G.Rathnasiri', 712345269, 6, 'A', 249, 143, 'male'), (2105, 'Chethiya Lakmal Silva', 'C.L.Silva', '2009-04-11', 'A-', 'Buddhism', 'sinhala', 'Salmal Uyana, Temple Rd, Mathara', 'Foot', 'yes', 'no', 143, 'Saman Silva', 762367895, 6, 'A', 250, 144, 'male'), (2109, 'Vinuu Silva', 'V.Silva', '2009-08-07', 'A+', 'Christianity', 'sinhala', 'Nuupe, Mathara', 'School Bus', 'yes', 'no', 124, 'Saliya Silva', 702365789, 6, 'A', 251, 145, 'female'); -- -------------------------------------------------------- -- -- Table structure for table `subjects` -- CREATE TABLE `subjects` ( `id` int(11) NOT NULL, `subject_name` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `subjects` -- INSERT INTO `subjects` (`id`, `subject_name`) VALUES (1, 'mathematics'), (2, 'science'), (3, 'art'), (4, 'sinhala'), (5, 'buddhism '), (6, 'tamil \r\n'), (7, 'english'), (8, 'catholic '), (9, 'history '), (10, 'geography'), (11, 'information and communication technology '), (12, 'drama '), (13, 'western music '), (14, 'eastern music '), (15, 'life skills & citizenshipn education '), (16, 'health & physical education '), (17, 'practical & technical studies '); -- -------------------------------------------------------- -- -- Table structure for table `teachers` -- CREATE TABLE `teachers` ( `staff_id` bigint(20) NOT NULL, `full_name` varchar(100) DEFAULT NULL, `name_with_initials` varchar(100) DEFAULT NULL, `dob` date DEFAULT NULL, `tp_number` int(11) DEFAULT NULL, `email` varchar(50) DEFAULT NULL, `address` varchar(100) DEFAULT NULL, `user_id` bigint(20) NOT NULL, `id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `teachers` -- INSERT INTO `teachers` (`staff_id`, `full_name`, `name_with_initials`, `dob`, `tp_number`, `email`, `address`, `user_id`, `id`) VALUES (10080, 'Diyagu Arachchige Sunil Karunarathne', 'D.A.S.Karunarathne', '1970-05-07', 714757047, 'karunarathne@gmail.com', 'No:190, Green House,Temple Rd, Mathara', 252, 17), (10100, 'Hewa Pathiranage Lalith Pushpakumara', 'H.P.L.Pushpakumara', '1976-08-07', 179546327, 'lalithkumara@gmail.com', 'No:8, Main Street , Mathara', 254, 19), (10200, 'Gampalage Manel Kumaradhasa', 'G.M.Kumaradhasa', '1968-08-07', 723567892, 'manelkumaradhasa@gmail.com', 'No:276, Main Street, maho', 255, 20), (10300, 'Hewa Pathiranage Salani Tharuka', 'H.P.S.Tharuka', '1989-08-07', 766987253, 'salanit@gmail.com', 'Beach Rd, Mathara', 256, 21), (10400, 'Rathnamalala Irugal Bandaralage Dhammika Herath', 'R.I.B.D.Herath', '1980-08-07', 702364589, 'dhammikarathnamalala@gmail.com', 'No:19/A, Green House,Temple Rd, Mathara', 257, 22), (10500, 'Kuruppu Arachchige Nipuna Herath', 'K.A.N.Herath', '1983-11-07', 702365892, 'nipuna10@gmail.com', 'Beach Rd, Mathara', 258, 23), (10600, 'Selwam Nagaraja', 'S.Nagarajaselwa', '1977-08-07', 715684231, 'selwam@gmail.com', 'No:190, Green town,Temple Rd, Mathara', 259, 24), (10700, 'Johan Silva', 'J.Silva', '1989-08-07', 712367532, 'johan@gmail.com', 'No:2A, Colombo 10', 260, 25), (10800, 'Tharani Fonseka', 'T.Fonseka', '1969-08-07', 703654128, 'tharani@gmail.com', 'No:34, Beach Rd, Mathara', 261, 26), (10900, 'Gamage Pushpa Malkanthi', 'G.P.Malkanthi', '1966-08-07', 714564560, 'pushpa@gmail.com', 'No:34, Beach Rd, Mathara', 262, 27), (11000, 'Herath Mudhiyanselage Nirmala Herath', 'H.M.N.Herath', '1969-08-07', 761231230, 'nirmala@gmail.com', 'Beach Rd, Mathara', 264, 29), (11100, 'Gamage Saliya Herath', 'G.S.Herath', '1977-08-07', 721231236, 'saliya@gmail.com', 'No:276, Main Street, maho', 265, 30), (11200, 'Manathunga Arachchige Chandrani Samalka', 'M.A.C.Samalka', '1970-08-07', 762320001, 'chandrani@gmail.com', 'Beach Rd, Eliyakanda Mathara', 266, 31), (11300, 'Amaya Adhikari', 'A.Adhikari', '1982-08-07', 701235648, 'amaya@gmail.com', 'Namal Uyana, Beliaththa', 267, 32), (11400, 'Gampalage Chethana Dilhani', 'G.C.Dilhani', '1985-08-07', 701236983, 'chethana@gmail.com', 'Eliyakanda Rd, Mathara', 268, 33), (11500, 'Upul Perera', 'U.Perera', '1974-08-07', 701597530, 'upul@gmail.com', 'Beach Rd, Eliyakanda Mathara', 269, 34), (11600, 'Diyagu Arachchige Dinelka Kumara', 'D.A.D.Kumara', '1969-08-07', 756931475, 'dinelka@gmail.com', 'Eliyakanda Rd, Mathara', 270, 35), (11700, 'Dissanayake Mudiyanselage Chamidu Asiri', 'D.M.C.Asiri', '1974-08-07', 703331110, 'chamidhu@gmail.com', 'No:19/B, Green House,Temple Rd, Mathara', 271, 36), (20000, 'Dissanayake Mudiyanselage Hemal', 'D.M.Hemal', '1980-08-07', 772265423, 'hemal@gmail.com', 'Beach Rd, Eliyakanda Mathara', 272, 37); -- -------------------------------------------------------- -- -- Table structure for table `teacher_subjects` -- CREATE TABLE `teacher_subjects` ( `id` bigint(20) NOT NULL, `subject_id` int(11) NOT NULL, `teacher_id` bigint(20) DEFAULT NULL, `grade` int(11) DEFAULT NULL, `class` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `teacher_subjects` -- INSERT INTO `teacher_subjects` (`id`, `subject_id`, `teacher_id`, `grade`, `class`) VALUES (26, 1, 10100, 6, 'B'), (27, 2, 10200, 6, 'B'), (28, 3, 10300, 6, 'B'), (29, 4, 10400, 6, 'B'), (30, 5, 10500, 6, 'B'), (31, 6, 10600, 6, 'B'), (32, 7, 10700, 6, 'B'), (33, 8, 10800, 6, 'B'), (34, 9, 10900, 6, 'B'), (35, 10, 11000, 6, 'B'), (36, 11, 11100, 6, 'B'), (37, 12, 11200, 6, 'B'), (38, 13, 11300, 6, 'B'), (39, 14, 11400, 6, 'B'), (40, 15, 11500, 6, 'B'), (41, 16, 11600, 6, 'B'), (42, 17, 11700, 6, 'B'), (43, 1, 20000, 6, 'A'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` bigint(20) NOT NULL, `username` varchar(50) NOT NULL, `password` varchar(255) NOT NULL, `role_id` bigint(20) NOT NULL, `profile_picture` varchar(255) DEFAULT 'profile_pictures/default.jpg' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `username`, `password`, `role_id`, `profile_picture`) VALUES (1, 'admin', '$2y$10$q2tvZlZpD8fXWSeufT4NuuisTIysYI8Z0gOle19BVVHepPDM4k7bO', 1, 'profile_pictures/default.jpg '), (18, 'student', '$2y$10$JcV0vjW2lqXMDERiNzvMMelnpPi5NAziA7oM3yAaVY2pUOZNjE.Vy', 3, 'profile_pictures/default.jpg \r\n'), (68, 'asela', '$2y$10$UPJLUYthvro3TBSLbF2r/uyIhEFyEmrmkJGWE4USvc8g.IpTjEGa.', 3, 'profile_pictures/15865285681-file.jpg'), (87, 'kasun', '$2y$10$0zq7h8HFTrm6U6QJh0P7gOMHMQuY8lAA24DWNraMLQLS8fuzs6LZK', 3, 'profile_pictures/158752501287-file.jpg'), (94, 'kamal', '$2y$10$c7Xhmr5J5r/FyZPTa5ux9OoSQDcJZXP8WVKoYjuNpswPpgVbEBZjm', 3, 'profile_pictures/default.jpg'), (97, 'ayesha', '$2y$10$KgVImdRP5Nj2I.3xy6oFjOzx9tFqTcBx6LFXihN3iq9DuJ124vs3W', 3, 'profile_pictures/15942646491-file.jpg'), (105, 'thanuja', '$2y$10$bcNNFLWfSq8YByJytfFzd.06CXJ9c.4Uu7aU1n9eo8d/Y5g43XEQK', 3, 'profile_pictures/1596841008105-file.jpeg'), (106, 'deuni', '$2y$10$Y1CA.C/DS1UmND5HobVCe.TbZ4D1UqHSEvhUWvrEQWM7kVnPYRpDa', 3, 'profile_pictures/15950720071-file.jpg'), (107, 'kalani', '$2y$10$248hJxB11T2LLf1F1H.B4.BbDJhYowMsKaGV9iyZ8GzdVIN31vQd.', 3, 'profile_pictures/15950722811-file.jpeg'), (108, 'kalana', '$2y$10$xulPLnskeNwhYnaB.z57L.59GnxbcBN5kF1Ph3lY84Px8BsbRWYJG', 3, 'profile_pictures/15950765381-file.jpg'), (109, 'nadeeka', '$2y$10$q1DBBrVdbj70HSJ5sRc82uIAJDlD7jI8OPa2BROpKZOLKziCJt84m', 3, 'profile_pictures/15950768681-file.jpeg'), (110, 'chalana', '$2y$10$K4kAZPc2HK91nJPHXMtHt.rFHY6ezKj4bQWxupOt7v19LYXAgxoCi', 3, 'profile_pictures/15950771091-file.jpeg'), (111, 'chathura', '$2y$10$51ci8vtAtx5yNY6pOBYcR.ArYIgjGR6l0GYdR8kOqe9l5BOwN4rgS', 3, 'profile_pictures/15950773671-file.jpg'), (112, 'jeewani', '$2y$10$/t5u9vuCx4pqX7Ire0QfkeKds9YWQu0NeaKX36i23eJGDnv4uGV/K', 3, 'profile_pictures/15950775721-file.jpeg'), (113, 'niwarthana', '$2y$10$NyVUZG213nAlxW4El7iHeeYQZowd6N5ybJLJjWejyRIbqTqchZXPm', 3, 'profile_pictures/15950784811-file.jpeg'), (114, 'gayathree', '$2y$10$wWU.caOO/mKoQBxEiFY...KMbrBuN5jTIMeoRVU.QLs2WItA9DxAW', 3, 'profile_pictures/15950787151-file.jpeg'), (115, 'thakshila', '$2y$10$uECOUcsefNfyRgjhje4w9uMyWx93LRIw8V3Ffui5rN1o75/nD3mZm', 3, 'profile_pictures/15950870561-file.jpeg'), (116, 'nuwan', '$2y$10$AkUOem.YMPGGdpkqY5XRTeTR.K20lNCEEWkvLetgaRZRLOSqmFY4O', 3, 'profile_pictures/15950946241-file.jpg'), (117, 'sasini', '$2y$10$/W8gYVJNYPgneZN3uS458.fTR5CdesGIyLLnfWTVQF78ttseg2hcO', 3, 'profile_pictures/15950948371-file.jpg'), (118, 'chathumari', '$2y$10$sjJYT39PE5HmkXX6r.kWV.7N5FlEZhi72sFOAT/Ut8nPzbnA4YRPq', 3, 'profile_pictures/15950954481-file.jpg'), (119, 'yasas', '$2y$10$Mb6X/P58p5JvdRa/9liUrem2x4mvhIuaypVhEPdD4jXfNfcJtmfPK', 3, 'profile_pictures/15950961051-file.jpg'), (120, 'samantha', '$2y$10$NfjIMIXk9pMZ1gg9RvIFTe6GnraBMmTNVf.QNq4t0GfSMG39xYHTy', 3, 'profile_pictures/15950966051-file.jpg'), (121, 'chaya', '$2y$10$wyZc3QJgxaJVSpwTb63L8erefpe9GBBiUVKBhDNS6Q9rSgV7zWjna', 3, 'profile_pictures/15950969461-file.jpg'), (122, 'lakshan', '$2y$10$07MVMDqkJD0TfnsdOcYt3.lPKENSJr8rHiw.IZRzoMnb0WviftVOy', 3, 'profile_pictures/15950977871-file.jpg'), (123, 'lasitha', '$2y$10$Cy0Wi7wLT/qVUxufa2IZyOcnJqxd8KY6/sstMahIIkSOSfcBb40Ym', 3, 'profile_pictures/15950985591-file.jpg'), (124, 'lasith', '$2y$10$qNMZzHF0QoOfzULHR0PyZuoVUcZ2VGgQGs9ueVC1cK3MTXBSS5NfC', 3, 'profile_pictures/15950987191-file.jpg'), (125, 'lakmal', '$2y$10$jo2tfVstyGca.CvNNpEkmu4C.0RYI9426x7/3h5PR0zO2ApoLnTUe', 3, 'profile_pictures/default.jpg'), (126, 'mahesh', '$2y$10$CT7WKY9JyOc4Y3A2WI0zHu3GCdmKdUdgPhVGT/P6DqcdYPdM1dVAK', 3, 'profile_pictures/15951008011-file.jpg'), (127, 'nimesh', '$2y$10$ouue69ID3PZ2aM2HniRFyOOayvYPgRyHuzGSbN.l1fR71Yw6OSIZa', 3, 'profile_pictures/15951010181-file.jpeg'), (128, 'mahen', '$2y$10$JYDU.AIXcTgvBaLlhN5Qy.MLHZa91IbTo3RpHNl09ZAxRcBuWWKP2', 3, 'profile_pictures/default.jpg'), (129, 'ayeshi', '$2y$10$1KLep.7WImKGvcXBV.LIa.VdzWhmpYH5fjFcTcznel5kx.sGxM7h2', 3, 'profile_pictures/15951331641-file.jpg'), (130, 'idunil', '$2y$10$KEggYRFRyflxRx8uYVsXLOFAqk9SDuxJ6b.pPcu7X6WRBciewguTW', 3, 'profile_pictures/15951334841-file.jpeg'), (131, 'tohaj', '$2y$10$XC42PuPyq5KSm8LY/IJVgeN9YH8g3/ITl7FQA7so2OObNaX4loCRG', 3, 'profile_pictures/15951343301-file.jpeg'), (132, 'chamara', '$2y$10$uaXqT1zECLnA9Pbts45bDelsJIyuvJqbD1aTmX4b4Rwo3Xm/GeuNa', 3, 'profile_pictures/15951346931-file.jpeg'), (133, 'ajith', '$2y$10$vVcZ.9QQ1YmZAiY0OVRB9eewhz4nxloc1EputAeiqWPgRfgfk3XZG', 3, 'profile_pictures/15951351911-file.jpeg'), (134, 'sithija', '$2y$10$dli7WehHYcw0BZ1lNsiOEufc4OvQ2vFmq4na/tkpFSp2cypKKKdx.', 3, 'profile_pictures/15951360151-file.jpg'), (135, 'nirosha', '$2y$10$v57wNwZkbeVG042wvj65JOaeAbTsJs9tL5D/DdDK7N3wwIi8GYEIW', 3, 'profile_pictures/15951362421-file.jpeg'), (136, 'nipuni', '$2y$10$Z.sR9SSy47mXug1vtCuwJef/FGDG1hMTi2Qy/OAdFC89QfQRAcqBC', 3, 'profile_pictures/15951365451-file.jpeg'), (137, 'nimsara', '$2y$10$STdLjLI1vJBkU9Fo6nEbFeD6t464kxMkrHqIuAlrJ.H2CMlG0/rPO', 3, 'profile_pictures/15951368651-file.jpeg'), (138, 'akhila', '$2y$10$Shm.QjnEohQhoVahqzUX..lL196B1LKdhdF0WEj5q3tIJAIfURz8e', 3, 'profile_pictures/15951370591-file.jpeg'), (139, 'dilan', '$2y$10$bNPdYTnENGE7O8sMZs0VQeYwjNJAu41/487I5MqBC9ZxMQ7IFiLqq', 3, 'profile_pictures/15951374981-file.jpeg'), (140, 'sewantha', '$2y$10$by7yNVTBXGpGcJ1Z48w04eNGNkEAS9jq9f8DFmlruZ0gMs15IwUHm', 3, 'profile_pictures/15951377171-file.jpeg'), (141, 'dumidu', '$2y$10$17XMLNI1qrpBD5wq1lwdn.mVeO67.4nnIDaxlEOckiUH9B8GgImw.', 3, 'profile_pictures/15951379161-file.jpeg'), (142, 'anupama', '$2y$10$X83K39T9jePvxJZnuRSnCOaXF1n5IW.dTem26dAguoAgBBcsVEp.6', 3, 'profile_pictures/15951380971-file.jpeg'), (143, 'thisara', '$2y$10$Woo.XuvtEDdmfU3p3O0Jc.3c6EubvigJ4a/8nC.7GJ0nMTOBMmWI.', 3, 'profile_pictures/15951383941-file.jpeg'), (144, 'sunanda', '$2y$10$MM/yMPydg0r6OuE.fY9rGezNEeIjzmqlxuez87ihzoO6eOy5/spMS', 3, 'profile_pictures/15951386321-file.jpeg'), (145, 'nadun', '$2y$10$.1MfoK7StDwHgUO1KTR2gulf9lMbDbOB17W4fh9l17xKRL4qj0p0u', 3, 'profile_pictures/15951388781-file.jpeg'), (146, 'thusitha', '$2y$10$EGNSgENMWwq4mi/oT4SQM.6wEWRuI4i4byN3/6m2L0w1b9HQt.kKW', 3, 'profile_pictures/15951395971-file.jpeg'), (147, 'sanuka', '$2y$10$R58LFcvNczw60zZjX9W24Oknz2Au9O.qCtS3bmUyN6WU2XfOVuIXi', 3, 'profile_pictures/15951400311-file.jpeg'), (148, 'sahansa', '$2y$10$fzsO6IDoq47.Ghgjcv9uvujX8axJuFL7d0EBGKw1SPoPJZUfpWwIC', 3, 'profile_pictures/15951437841-file.jpeg'), (149, 'laknath', '$2y$10$2AMbjrStuQLCkQDxHoeY5OSTRVcYBNwlDIjGFzJEOfTS6hh9hun12', 3, 'profile_pictures/15951439351-file.jpeg'), (150, 'ashan', '$2y$10$BO9WQHHN60Bxt4Ua5oicbuV32mhyZjNwl.EAh.SzqJaIEV0Scdnte', 3, 'profile_pictures/15951441671-file.jpeg'), (151, 'onitha', '$2y$10$aPgxfbv8TRCxUNxzMyEhleRO5mPmFLSAn7YLgjH33H/YJTSRhpWci', 3, 'profile_pictures/15951460921-file.jpeg'), (152, 'dilmi', '$2y$10$OJ/j6DedLZvM6Fr7b0FMueYfBs.8O4ZlVN0ue08LJlsdRRLVhVcCW', 3, 'profile_pictures/15951462521-file.jpeg'), (153, 'rashanthi', '$2y$10$MvS6OZ4qrLY5nGayjIsUj.kUGQv6ajHqB4XiAdMPmx7FxQ66/4aGG', 3, 'profile_pictures/15951464421-file.jpeg'), (154, 'harshani', '$2y$10$AI0s8z8H4wLYo5xs0Su1peX1XR/ZlRSULOoIiPXReFvuEZkKKfV.y', 3, 'profile_pictures/15951466191-file.jpg'), (155, 'mekala', '$2y$10$We03ZK.gwG3aFtDOGUwuB.yWO118gGKaApHmU8sBRATeHbn5tgzPK', 3, 'profile_pictures/15951467661-file.jpg'), (156, 'sulochani', '$2y$10$52WqcQlKXPQyTtw.V.FS8uts1xEksHFqf6U5rUVpTwsmo9RWmgHnC', 3, 'profile_pictures/default.jpg'), (157, 'hansaka', '$2y$10$w/R.qqsmd4jdopNi1epufezFZ0A/5kojgA5t2PPfwR4q6B8ziecJG', 3, 'profile_pictures/15951474291-file.jpeg'), (158, 'nilanka', '$2y$10$nZp4CUkN60IgqAFo56zWweG7MSbIkYpycn6f0P7Wtd18aPQZfaDja', 3, 'profile_pictures/15951477401-file.jpeg'), (159, 'dewni', '$2y$10$MNYuCytZJDmy.CA6oRqQqeVAxNxY7jgbT8ehRoR7NJARc0H28D.mi', 3, 'profile_pictures/15951606791-file.jpg'), (160, 'Nalaka', '$2y$10$KYWtTorO3G8/y1S96j5vn.SXJ61sDYE02p5P/Z5VzV6aJFKI383W6', 3, 'profile_pictures/15951614781-file.jpeg'), (161, 'udharshana', '$2y$10$2tQJiD4SkpfwYaMi/aen4OvPrdhF8m0xxGgeUkfktKcGAAIIIbOgK', 3, 'profile_pictures/15951616891-file.jpeg'), (162, 'achira', '$2y$10$6F9xo0lLFBfUrGsk0/oH0eZt0FRIDxLmStnSXtbLC/bqUZeWTUJJ6', 3, 'profile_pictures/15951618661-file.jpeg'), (163, 'sachintha', '$2y$10$M4hSNhpzUEL4yi1Jixn2NeZ0YLg15KRNJ.qJlsYGumWqliyilSBY6', 3, 'profile_pictures/15951620271-file.jpeg'), (164, 'athula', '$2y$10$OzqSzrdqNeX451Hia55HUeMxuyf7chbJ0dAmLMyceUJ7t4Imuzbo6', 2, 'profile_pictures/15951634521-file.jpg'), (170, 'aseni', '$2y$10$Pz7PypSIGalpnrg3anSape13uf6JP2HHTDYhlUFJd7ch5SASpUNva', 3, 'profile_pictures/15966932921-file.jpg'), (171, 'wayomi', '$2y$10$IJXzR4ux0mDaspTP3mxGBeEbVBCw8VbHFgjPzvCy2R3w4PqWGeOPS', 3, 'profile_pictures/15966937301-file.jpg'), (172, 'rukshana', '$2y$10$oA9nxf4Y/5Iz23gsGztbnOkJkqfQIMwL7ulZLQB2tsqnZHp/q3Ww2', 3, 'profile_pictures/15966939451-file.jpg'), (173, 'rukshan', '$2y$10$h0w9LpODI1W6n8kJwCiZweOmh5N13jno1ZE.eGfRB40WN.q5IS5dO', 3, 'profile_pictures/15966947681-file.jpg'), (174, 'nuwanthi', '$2y$10$gsNx/dEolC2Y.hUg2SyP5ezPUxVUKSX3mxMQY2TaPQumDSKecoKk2', 3, 'profile_pictures/15966950211-file.jpg'), (175, 'shanudhri', '$2y$10$GXnGn6Zbp4Frhwi1TlN2.eAQNX711l.CsDHk856nq9Rez/y4952hK', 3, 'profile_pictures/15966952311-file.jpg'), (176, 'sepalika', '$2y$10$2vpH72jRuIfEK/jOGXIyeOXTONelBGTTZD/Q6iAs.kFfXI89z7UjS', 3, 'profile_pictures/15966955631-file.jpg'), (177, 'dinush', '$2y$10$DVI9x.89NPSWIM1i0ZbqheYAamBWRtUFbGVPRZzq2Fzpl3.pqUIrq', 3, 'profile_pictures/15966966101-file.jpeg'), (178, 'nuwan1', '$2y$10$5n.JWJdmu./WqyV6XeVbIed6AcHD8YVxThLSMAHdWNpRd8LR8Gjya', 3, 'profile_pictures/15966968791-file.jpg'), (179, 'nadeeka1', '$2y$10$1vrNYv1p.T.oMJfMXVs9Zut9epkiBXLaL5VAOPiVpslgWMgXvYBKy', 3, 'profile_pictures/15966997931-file.jpg'), (180, 'nirwan', '$2y$10$SgM3iknR7lCeYoWaQoqiT.UWqMFJ37ZAD4gzE0UZTVPS0wskLplhq', 3, 'profile_pictures/15967002641-file.jpeg'), (181, 'nadeeka2', '$2y$10$hrSaJW9ejGXsXj7BUHgPf.KYOOk1Y9fnRLbzorjDJ3pAKhTY4BWFK', 3, 'profile_pictures/15967004491-file.jpeg'), (182, 'nadeesha', '$2y$10$IzmcaIj7KeTVAtljG0taJuSa338hCab5nKmO1iFERkXhTxrBlk3Km', 3, 'profile_pictures/15967006851-file.jpeg'), (183, 'muyura', '$2y$10$syvDa3KD3GJR3jqujJRpJOph2d2Ys2vQued5x0jqdBMqLSk4vbIQ.', 3, 'profile_pictures/15967009561-file.jpeg'), (184, 'gihansa', '$2y$10$DihExxK7K7EGqvxHzpYuUOYwNYU7/QhOVHbKTJ3LIzYtGV6LFsa7C', 3, 'profile_pictures/15967011741-file.jpeg'), (185, 'awantha', '$2y$10$gYdfnwZVDu1s9V68Lw/RwOe4Jm5rsa/MvMPpDBOLppfPoZ5ORiKT2', 3, 'profile_pictures/15967013751-file.jpeg'), (186, 'tharindhu', '$2y$10$e6JHXx0MIadY7PgMCsBgpuEaG2jcFe0CFPEb.B9PZ.sXyzNq0qutO', 3, 'profile_pictures/15967017211-file.jpeg'), (187, 'thimira', '$2y$10$zCP.sWYgwWwZFns9517xtuoRhwwDSuhFOnNgP4h4v/Y0fu6XgLwRu', 3, 'profile_pictures/15967019451-file.jpeg'), (188, 'kushalya', '$2y$10$9DyvAPDNoar2VXUZJBokUeKyLpAgeiHpf78wFl5f3ghO5hC6Kz5fK', 3, 'profile_pictures/15967022771-file.jpeg'), (189, 'ksarani', '$2y$10$2GBnY0aLzyWJfoqt6nOuMOoSk5D82k9yBo9a3iOqHeN1sn1lbDZAC', 3, 'profile_pictures/15967029801-file.jpeg'), (190, 'mithma', '$2y$10$aM96tkaoB5lXdViYgihoZuV8MWaLcOFRtXp8vWdLYw9kJI4EQD1g6', 3, 'profile_pictures/15967034111-file.jpeg'), (191, 'kelum', '$2y$10$DwLGnEz4pXv3R98bevX/ceLAzdd5CskNLMX93wO8FMk0Wpgt1Pxfi', 3, 'profile_pictures/15967035721-file.jpeg'), (192, 'pubudhu', '$2y$10$MuOE4qoD1hipISi1dtefbu2q/QjYZ7O0.cDA0np3kj4xZKAgMLH5W', 3, 'profile_pictures/15967052671-file.jpeg'), (193, 'milina', '$2y$10$LqvKaB8lbW.Spl4vhlGpKO4gZqsqianNSahW.uHj9AcI7yDMhDvw.', 3, 'profile_pictures/15967054301-file.jpeg'), (194, 'mahi', '$2y$10$xHA/WHSaRNjepvXxc0DwluBALdHGP4O2SbO5CuXwQHWJ2/FaovFy6', 3, 'profile_pictures/15967066661-file.jpeg'), (195, 'akash', '$2y$10$GKwXt76QD/LitCUTuPdwsetFG/eQsvzH2iqmY/yTSOmUqlbXSRx.q', 3, 'profile_pictures/15967069231-file.jpeg'), (196, 'pavithra', '$2y$10$VtNlcW/PYG91Q0xgEiGUFu9mr.6/g9Y81S6d827yVM6lCk3sjEZPq', 3, 'profile_pictures/15967071001-file.jpeg'), (197, 'pamudhi', '$2y$10$Phvey4Pjd/LtyAs0aJJAourC1YimAxRs.6LOxCZ0df.V837x69zqG', 3, 'profile_pictures/15967072581-file.jpeg'), (198, 'pramodha', '$2y$10$SHARwhvnTVwnXlVWbm1Uj.Sj6I2u.8stXMqgVNG1U.Slk6HDdKnmy', 3, 'profile_pictures/15967075511-file.jpeg'), (199, 'udhula', '$2y$10$hrzMwNZO6xae/jyFJs8G2ewXTtielZjfQDczS0F1K3BBNFwjVfeNe', 3, 'profile_pictures/15967077301-file.jpeg'), (200, 'vinula', '$2y$10$vMUK6.BNUddTeoNUicBof.gc1RpHH2KTKJCvsxDuUotJl4OLUhWDC', 3, 'profile_pictures/15967078831-file.jpeg'), (201, 'vihanga', '$2y$10$8P7BcSvFgN5zn6YHgL5kU.28dx9K5bAUInt6RzWK.O4yEj6QVOL2a', 3, 'profile_pictures/15967090041-file.jpeg'), (202, 'vinuli', '$2y$10$4KtFNtM8c/z8SWBsT88AZOYolAYDvIKchVqlqagXkyKL3PCPC.G2a', 3, 'profile_pictures/15967108171-file.jpeg'), (203, 'varsha', '$2y$10$cMJcTXvwEp6qoxvJXP4M0uunOCT0PmNcYavMVXX9AlTJhm8lp4vvm', 3, 'profile_pictures/15967111191-file.jpeg'), (204, 'senali', '$2y$10$zOcGbM2BnNwSc0JnDu4dlOa7Ym6tSCpykVB3MHL73KivA4qhroAfq', 3, 'profile_pictures/15967112901-file.jpeg'), (205, 'seumini', '$2y$10$c83xw9k7g/4dAt5YuysmWOceLFOJrdE1M3P/YUheblp5sR.80/RIe', 3, 'profile_pictures/15967119201-file.jpeg'), (206, 'sithum', '$2y$10$xY33FFY.zvf9CsuOR2nfF..lUQS9AzMOJAb5KNMASVHVAeqNOI90y', 3, 'profile_pictures/15967121231-file.jpeg'), (207, 'adheesha', '$2y$10$a/wm6.y2xkhc86rP.nq5PuZLHKf5ABfjRUqz7cCgTMczAuVYljUCW', 3, 'profile_pictures/15967126211-file.jpeg'), (208, 'sethuni', '$2y$10$lHZ1fzQsUAS64UdEhxoG0eVx3oShx2K2GQADtdFytRp6h7Vs56YhS', 3, 'profile_pictures/15967127761-file.jpg'), (209, 'thisumi', '$2y$10$H5nJxAclLdidLGE7Q3PeWOAXnpLU3XvC7hk2wc.193QySMuhGs7Sy', 3, 'profile_pictures/15967130621-file.jpg'), (210, 'nesadhi', '$2y$10$K9qUsp6kOlaiC7iVb4Odgu2135zFG2fnd2J1r8uiILMF05z3Ey17K', 3, 'profile_pictures/15967132031-file.jpeg'), (211, 'vinuli1', '$2y$10$NvMF1Z4nbeaD3SQUvbbm1uPaF1oMW97kd38HQfyCoYuAX.JsBWumq', 3, 'profile_pictures/15967133371-file.jpg'), (212, 'reshma', '$2y$10$0QvqhxrmJIOy3jn5h2pjh.VxG8QHGIZNZbP9NTZSNmhhQ1bd.0WUy', 3, 'profile_pictures/15967135001-file.jpeg'), (213, 'akasha', '$2y$10$zfCyc5GyH6fed4u/gtdm0.NdE/iLsC.cG/.ieg./9yeZSy8ZIRp6i', 3, 'profile_pictures/15967138111-file.jpg'), (214, 'dilka', '$2y$10$MSUFXjGeHxH13qna.9trEOV34/NDrOIvdpB/QgJwHdM8Idixb.IxS', 3, 'profile_pictures/15967167421-file.jpeg'), (215, 'abhises', '$2y$10$45XErc7gKLtnP7j1DaAGVubWdn74UbLevvS/BtftBKKja4/SwwA7W', 3, 'profile_pictures/default.jpg'), (216, 'abhi', '$2y$10$xQaXqFdO0jzhR9R.afRiuugrztXnmT4/17f/3OeIAUcC4a682RMQW', 3, 'profile_pictures/default.jpg'), (217, 'lihini', '$2y$10$i4hGEr20H4LjcHKgMTb2gOunZYfgNCU7y.N1xIPUeQOSCnafyXW4K', 3, 'profile_pictures/15967490281-file.jpg'), (218, 'sunimal', '$2y$10$i/9bOmcJj59WtxvrUTUuKutTZIWW0joQc98f3EBw/HjwVO8JylZCC', 3, 'profile_pictures/15967492001-file.jpeg'), (219, 'jayani', '$2y$10$IvCbs.Yo3x.GR8TgAopCHOkqMSFcsYlxkEYdnhgBj7.MQvmuaRJNq', 3, 'profile_pictures/15967493761-file.jpg'), (220, 'ashen', '$2y$10$zyug8skRFH/LsXfpoXaWjuKM24CNIpEYWtMUJZJbvmD8A9Sg.qw/G', 3, 'profile_pictures/15967495661-file.jpeg'), (221, 'tharuki', '$2y$10$0ahkNGGOaLVNbO.lvbHmEOe5B5S74o4.vRfFmV9fX320YDCuyzs3q', 3, 'profile_pictures/15968044291-file.jpeg'), (222, 'imasha', '$2y$10$VrsR6RaliPymxUmiZKk4aOVhhKCQAbGO1DC6FvmScQezsh1cNs1yy', 3, 'profile_pictures/15968045751-file.jpg'), (223, 'geethma', '$2y$10$kvCwJ9UAPm4pT1Isb.vcOOGM7oQ9l6tHXu5TRwCyL8iIAMiPK27oO', 3, 'profile_pictures/15968048281-file.jpg'), (224, 'sahan', '$2y$10$EK12ln64PqC90w65f1alzu07V485701AdmeYts3hyedRuP5wt2F..', 3, 'profile_pictures/15968049811-file.jpeg'), (225, 'chalini', '$2y$10$D5ItjvMXLqi7a7povwcgsOen1upjK7UIh5pjQOVe9A6L6oN4Ij9Ry', 3, 'profile_pictures/15968051281-file.jpg'), (226, 'aliya', '$2y$10$zfvJTzOHp2MsOczJuBmTb.GIqcVuhSVturS./W2WMP4HYvk7F2cte', 3, 'profile_pictures/15968052621-file.jpeg'), (227, 'amidhu', '$2y$10$Pb6jPidYzBz8Kbn5cywh9Os6Fs2xIrvDU4pk2UQAX2ZU13s9gjZw6', 3, 'profile_pictures/15968053961-file.jpeg'), (228, 'dilsha', '$2y$10$h6ZD1MnIMPuIoH3rDdXYmOYy1FdOT5DNUkPiq6XvpZZ8LMT894Yp2', 3, 'profile_pictures/15968055431-file.jpeg'), (229, 'thiwanka', '$2y$10$avb/hzTTc5fML1g/BU87h.AUKDK76bIP0eO0wKdyLzEgc6Vs/7FXO', 3, 'profile_pictures/15968060641-file.jpeg'), (230, 'mihindhu', '$2y$10$OZLCFH855tpV9tmDhzoYYefVM02EP32eY7iDRlZcW/1MkXkz1ZVj.', 3, 'profile_pictures/15968062081-file.jpeg'), (231, 'yanura', '$2y$10$dw9mITzry/5oDtzrLYPY7OSOkzGqdKN5FQbGgxvFexLR4CF2KJgEC', 3, 'profile_pictures/15968063581-file.jpeg'), (232, 'yomali', '$2y$10$u3gD6VoOz6ult4NAQUgLLuA7mY2LpWLoFLm5eLQdegP/z8MS08p.S', 3, 'profile_pictures/15968065891-file.jpeg'), (233, 'onila', '$2y$10$utd8tBv0ncTQWjxOZ0P7j.V5VNAp5TLtchJKDC/DrZsY1gv8Rho0W', 3, 'profile_pictures/15968068631-file.jpg'), (234, 'osandha', '$2y$10$Ujpxs6vNvbLdm7w/.YcFdOsDT/3GqkPs/.G/GOdzdWVtIFNMP8PSq', 3, 'profile_pictures/15968070421-file.jpg'), (235, 'sithum1', '$2y$10$XyARWwmSxS3l4O4M05ITkeYO1yG7qe/d91X3sskUFfnQ7GY/Adtjq', 3, 'profile_pictures/15968072131-file.jpeg'), (236, 'nethuki', '$2y$10$ohB.bhGvKo31JKrIQlAW5O341zezgtGYyJK/QSAykPRnPsHk5Hsh2', 3, 'profile_pictures/15968073711-file.jpg'), (237, 'tarushini', '$2y$10$vms4.pW2JlCRhOKOgXfrh.SgAl/wcNloNu.z/ZrJVkoHsUlsCZZEa', 3, 'profile_pictures/default.jpg'), (238, 'teshara', '$2y$10$jz9VCM.fnck8Cs1SVDMBQOoqjaQPrBIigSNv1C4x64T7.Pm8XtAiy', 3, 'profile_pictures/15968077661-file.jpg'), (239, 'tehani', '$2y$10$6iuoYjv24SVR/3yHQB31ieO3XN3KIKTCdtytkV6MO5vh.DXC8z1Q.', 3, 'profile_pictures/15968079161-file.jpg'), (240, 'dhamsilu', '$2y$10$xyDoMTIqVNcZmx8vRNOJNewDS9S/PBCF6LT.KUM9.sHKGQRDiSoIu', 3, 'profile_pictures/15968081641-file.jpg'), (241, 'akhitha', '$2y$10$dX8p6MNqqjPpVSDRFFIcnOV.GoF0PDXg75mIwpNDUuhjs5qg7yuzG', 3, 'profile_pictures/15968082991-file.jpg'), (242, 'anupama1', '$2y$10$UW69qkpT5R.MpgTA5dNfsOqGl8td8SSUtAF0JjdaU1H7vtRQfHYUm', 3, 'profile_pictures/15968084511-file.jpeg'), (243, 'avishka', '$2y$10$x5/rzRX6jfIFqXSYTuiNmeTuTT/nSvVK6u2fH88Ig0.ktfl7q.2gO', 3, 'profile_pictures/default.jpg'), (244, 'dhulanya', '$2y$10$A3YRxEpuaGNQt5/2nK12TeY6jTraLkqktIpZGEHVe8jxJrU0MIpYS', 3, 'profile_pictures/15968088791-file.jpeg'), (245, 'pabasari', '$2y$10$MHC7XE860UEhJygKXb98gutWiXlW1Mjvs322xgq6YLT7hd6wubNvK', 3, 'profile_pictures/15968089921-file.jpeg'), (246, 'nethiki', '$2y$10$b6vv4Yu0.VXXXGmTkk2ExeSYGZa5MRTmittmiAx0gIMJNRgoJLq4i', 3, 'profile_pictures/15968091201-file.jpg'), (247, 'amal', '$2y$10$uguNghCgVqFwKoO6b6hivewRf1ZNSSsn4oPJOYoAZ5IEflsvk6Jri', 3, 'profile_pictures/15968146221-file.jpeg'), (248, 'sajith', '$2y$10$bYTkVEnRuK3eQ/1NFLHyreUuwhOviUyr7aWLoEJcFDv1JzbS.Actm', 3, 'profile_pictures/15968155381-file.jpeg'), (249, 'thuurya', '$2y$10$.C2msJCwHI.fgRV8MNn7KuMpdUTmh4AGQNshRRhU1LkvbBqW1X352', 3, 'profile_pictures/15968156951-file.jpeg'), (250, 'chethiya', '$2y$10$RCPbCfTf6M5NU4ALzxwAVenw3fqEU8gohFmu0LeSzbC/fU8UFWLI2', 3, 'profile_pictures/15968159351-file.jpeg'), (251, 'vinuu', '$2y$10$nKjOpJejUo.U0HW4redaLuQgA2JGuQXCIdww.9TUeHOWO817Mnm5m', 3, 'profile_pictures/15968165451-file.jpeg'), (252, 'principle', '$2y$10$ARaQhXj/COhsS0p7NFcZA.9IR4pJbn2Y3UpdfjtjpyM95XA/6Bg7m', 2, 'profile_pictures/15968175481-file.jpeg'), (253, 'principal', '$2y$10$VVi/pM1I2fWbsJVdVxfibuzMTMdTFqQrIHWN.E0R3QmQ4zH1mMWli', 2, 'profile_pictures/15968176911-file.jpeg'), (254, 'lalith', '$2y$10$.UW.gjxFaQQAXUB.cFQ0i.ZT8uEXEbAYVUfQC6R5nPiHBtMO07vVG', 4, 'profile_pictures/15968182741-file.jpg'), (255, 'manel', '$2y$10$BtOL5YnzapauMgtdqfhOAuWWatjO1B2c33fum3S0t0gLVemn66PKK', 4, 'profile_pictures/15968185431-file.jpeg'), (256, 'salani', '$2y$10$y52N0el/oj.83Yhy.BHzOu97WpGKkOPQai9fj.Y6XHv0CD8y38/r2', 4, 'profile_pictures/15968186921-file.jpg'), (257, 'dhammika', '$2y$10$vs47PUEYpvidd5XHVypM1.PoWSS1RK7oc.QcQd21wlpd9j/DSVfpG', 4, 'profile_pictures/15968188691-file.jpeg'), (258, 'nipuna', '$2y$10$SN1cFaKjY0sJlVvML/zSl.2U4Mw8uu6jiCoCKj92od1r/OLB4m2g2', 4, 'profile_pictures/15968192121-file.jpg'), (259, 'selwam', '$2y$10$kIhJ6veUuWgojSQyScffWuRZe9G54GY3/6RITkmsl7lENgiSOMVza', 4, 'profile_pictures/15968197011-file.jpg'), (260, 'johan', '$2y$10$hO2lmkOqhlHK/mfktezjL.KsJuQS4M7EAGAKo0vdrmPYQn7SnZCMK', 4, 'profile_pictures/15968201191-file.jpg'), (261, 'tharani', '$2y$10$3A.r3HLwpCVWJK3jo/3e.ug0eQDLEOtUeQXWmky0TYuixAtE0mBI.', 4, 'profile_pictures/15968202951-file.jpeg'), (262, 'pushpa', '$2y$10$zRNnHsCrqt4wEW7pB.F3i.5ubMPIe2JjexnOgkhW1ApFRiPWRd2Mm', 4, 'profile_pictures/15968205141-file.jpeg'), (263, 'pushpa1', '$2y$10$6h3/.YMiSc2XZbn2gmecLeJdW.1kki7hER.DVAnoPhgA.rGhwKH6.', 4, 'profile_pictures/15968208041-file.jpeg'), (264, 'nirmala', '$2y$10$Tg5Ef/x60PMCKTmsoC9JuOx5NlHLXWLBWmv/u4lmffoka18qRZ4dK', 4, 'profile_pictures/15968210141-file.jpeg'), (265, 'saliya', '$2y$10$cu/oW2B38SmIegRKvzaytemRanrH3p7L3ApXhA3s3iwfM3lTwBASm', 4, 'profile_pictures/15968212241-file.jpeg'), (266, 'chandrani', '$2y$10$/eiygAXMq6hGnhQ/Rf5/x.LyrESnM.deR/5mA8qOzTPas85qrCBN6', 4, 'profile_pictures/15968227771-file.jpeg'), (267, 'amaya', '$2y$10$u2oKrYapIRKqu0ec./yNtekffT0JY4aI93C18b367fF9BRh4BodCy', 4, 'profile_pictures/15968229021-file.jpeg'), (268, 'chethana', '$2y$10$sOPTpODCJJFsXKtLIiuc2uF0h6Z8Qlg6VFEFprG0OrMQLwtivobeO', 4, 'profile_pictures/15968230431-file.jpg'), (269, 'upul', '$2y$10$7RttvhT0wgh/0yd.rlpx6.q74nwCQfuMoLNGEIP57vt6gxaz9dGg2', 4, 'profile_pictures/default.jpg'), (270, 'dinelka', '$2y$10$F.2xdDROVAC5nVz.60WZ.uTU1gayj3TeKXonnE6Heoo3yyBGrwPWa', 4, 'profile_pictures/default.jpg'), (271, 'chamidhu', '$2y$10$7AAEMyTc3vPf1jYsuEvHTOihcn2MqmEh05tHWy0C/lL4VsOmtjz5S', 4, 'profile_pictures/15968236821-file.jpeg'), (272, 'hemal', '$2y$10$M6chzLBZA.xUh/BEPk4h0e/oxoRPp0jCK8GvMeAJ8kx7Hmo0Wezs.', 5, 'profile_pictures/15968413031-file.jpeg'); -- -- Indexes for dumped tables -- -- -- Indexes for table `academic_term` -- ALTER TABLE `academic_term` ADD PRIMARY KEY (`id`); -- -- Indexes for table `cal_marks` -- ALTER TABLE `cal_marks` ADD PRIMARY KEY (`student_admission_number`,`year`), ADD UNIQUE KEY `id` (`id`); -- -- Indexes for table `class_updates` -- ALTER TABLE `class_updates` ADD PRIMARY KEY (`id`), ADD KEY `class_updates_student_admission_number_foreign` (`student_admission_number`); -- -- Indexes for table `extra_activities` -- ALTER TABLE `extra_activities` ADD PRIMARY KEY (`id`), ADD KEY `extra_activities_admission_number_student_foreign` (`admission_number_student`); -- -- Indexes for table `marks` -- ALTER TABLE `marks` ADD PRIMARY KEY (`id`), ADD KEY `fk_subject` (`subject_id`), ADD KEY `fk_admission_number` (`admission_number`); -- -- Indexes for table `migrations` -- ALTER TABLE `migrations` ADD PRIMARY KEY (`id`); -- -- Indexes for table `news` -- ALTER TABLE `news` ADD PRIMARY KEY (`id`); -- -- Indexes for table `notifications` -- ALTER TABLE `notifications` ADD PRIMARY KEY (`id`); -- -- Indexes for table `prefect_forms` -- ALTER TABLE `prefect_forms` ADD PRIMARY KEY (`prefect_form_id`), ADD KEY `fk_prefect_forms` (`admission_number`); -- -- Indexes for table `roles` -- ALTER TABLE `roles` ADD PRIMARY KEY (`id`); -- -- Indexes for table `students` -- ALTER TABLE `students` ADD PRIMARY KEY (`admission_number`), ADD UNIQUE KEY `unique` (`id`), ADD KEY `fk_students` (`user_id`); -- -- Indexes for table `subjects` -- ALTER TABLE `subjects` ADD PRIMARY KEY (`id`); -- -- Indexes for table `teachers` -- ALTER TABLE `teachers` ADD PRIMARY KEY (`staff_id`), ADD UNIQUE KEY `id` (`id`), ADD KEY `fk_teachers` (`user_id`); -- -- Indexes for table `teacher_subjects` -- ALTER TABLE `teacher_subjects` ADD PRIMARY KEY (`id`), ADD KEY `fk_subjects` (`teacher_id`), ADD KEY `fk_sub` (`subject_id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD KEY `fk_users` (`role_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `academic_term` -- ALTER TABLE `academic_term` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `cal_marks` -- ALTER TABLE `cal_marks` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `class_updates` -- ALTER TABLE `class_updates` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; -- -- AUTO_INCREMENT for table `extra_activities` -- ALTER TABLE `extra_activities` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53; -- -- AUTO_INCREMENT for table `marks` -- ALTER TABLE `marks` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=956; -- -- AUTO_INCREMENT for table `migrations` -- ALTER TABLE `migrations` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `news` -- ALTER TABLE `news` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- AUTO_INCREMENT for table `notifications` -- ALTER TABLE `notifications` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- AUTO_INCREMENT for table `prefect_forms` -- ALTER TABLE `prefect_forms` MODIFY `prefect_form_id` bigint(20) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `roles` -- ALTER TABLE `roles` MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `students` -- ALTER TABLE `students` MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=146; -- -- AUTO_INCREMENT for table `subjects` -- ALTER TABLE `subjects` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18; -- -- AUTO_INCREMENT for table `teachers` -- ALTER TABLE `teachers` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=38; -- -- AUTO_INCREMENT for table `teacher_subjects` -- ALTER TABLE `teacher_subjects` MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=44; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=273; -- -- Constraints for dumped tables -- -- -- Constraints for table `cal_marks` -- ALTER TABLE `cal_marks` ADD CONSTRAINT `cal_marks_student_admission_number_foreign` FOREIGN KEY (`student_admission_number`) REFERENCES `students` (`admission_number`); -- -- Constraints for table `class_updates` -- ALTER TABLE `class_updates` ADD CONSTRAINT `class_updates_student_admission_number_foreign` FOREIGN KEY (`student_admission_number`) REFERENCES `students` (`admission_number`); -- -- Constraints for table `extra_activities` -- ALTER TABLE `extra_activities` ADD CONSTRAINT `extra_activities_admission_number_student_foreign` FOREIGN KEY (`admission_number_student`) REFERENCES `students` (`admission_number`); -- -- Constraints for table `marks` -- ALTER TABLE `marks` ADD CONSTRAINT `fk_admission_number` FOREIGN KEY (`admission_number`) REFERENCES `students` (`admission_number`), ADD CONSTRAINT `fk_marks` FOREIGN KEY (`admission_number`) REFERENCES `students` (`admission_number`), ADD CONSTRAINT `fk_subject` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`); -- -- Constraints for table `prefect_forms` -- ALTER TABLE `prefect_forms` ADD CONSTRAINT `fk_prefect_forms` FOREIGN KEY (`admission_number`) REFERENCES `students` (`admission_number`); -- -- Constraints for table `students` -- ALTER TABLE `students` ADD CONSTRAINT `fk_students` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`); -- -- Constraints for table `teachers` -- ALTER TABLE `teachers` ADD CONSTRAINT `fk_teachers` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Constraints for table `teacher_subjects` -- ALTER TABLE `teacher_subjects` ADD CONSTRAINT `fk_sub` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`), ADD CONSTRAINT `fk_subjects` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`staff_id`); -- -- Constraints for table `users` -- ALTER TABLE `users` ADD CONSTRAINT `fk_users` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Python
UTF-8
1,960
3.890625
4
[]
no_license
# # @lc app=leetcode.cn id=402 lang=python3 # # [402] 移掉 K 位数字 # # https://leetcode-cn.com/problems/remove-k-digits/description/ # # algorithms # Medium (32.53%) # Likes: 756 # Dislikes: 0 # Total Accepted: 96.7K # Total Submissions: 297.2K # Testcase Example: '"1432219"\n3' # # 给你一个以字符串表示的非负整数 num 和一个整数 k ,移除这个数中的 k 位数字,使得剩下的数字最小。请你以字符串形式返回这个最小的数字。 # # # 示例 1 : # # # 输入:num = "1432219", k = 3 # 输出:"1219" # 解释:移除掉三个数字 4, 3, 和 2 形成一个新的最小的数字 1219 。 # # # 示例 2 : # # # 输入:num = "10200", k = 1 # 输出:"200" # 解释:移掉首位的 1 剩下的数字为 200. 注意输出不能有任何前导零。 # # # 示例 3 : # # # 输入:num = "10", k = 2 # 输出:"0" # 解释:从原数字移除所有的数字,剩余为空就是 0 。 # # # # # 提示: # # # 1 # num 仅由若干位数字(0 - 9)组成 # 除了 0 本身之外,num 不含任何前导零 # # # # @lc code=start from collections import deque class Solution: def removeKdigits(self, num: str, k: int) -> str: if k == len(num): return '0' result = deque() for char in num: while result and result[-1] > char and k: result.pop() k -= 1 result.append(char) while k: result.pop() k -= 1 while result and result[0] == '0': result.popleft() return "".join(result) if result else '0' # @lc code=end s = Solution() print(s.removeKdigits("1432219", k = 3)) print(s.removeKdigits( "10200", k = 1)) print(s.removeKdigits("10", k = 2)) print(s.removeKdigits("0", k = 1)) print(s.removeKdigits("10000000", k = 2)) print(s.removeKdigits("10000001", k = 2)) print(s.removeKdigits("12345", k = 2))
Markdown
UTF-8
6,501
3.0625
3
[]
no_license
# 9. 일반적인 프로그래밍 원칙 ## 지역변수의 범위를 최소화하라 * 지역변수의 범위를 줄이는 가장 강력한 기법은 '가장 처음 쓰일 때 선언하기' 다. * 모든 지역변수는 선언과 동시에 초기화 해야 한다. try-catch 문은 예외다. * 메서드를 작게 유지하고 한 가지 기능에 집중해야 한다. <br/> ## 전통적인 for 문보다는 for-each 문을 사용하라 전통적인 for 문과 비교했을 때 for-each 문은 명료하고, 유연하고, 버그를 예방해준다. 성능 저하도 없으므로 가능한 모든 곳에서 for 문이 아닌 for-each 문을 사용하는 것이 좋다. <br/> ## 라이브러리를 익히고 사용하라 일반적으로 라이브러리의 코드는 내가 직접 작성한 것보다 품질이 좋고, 개선될 가능성이 크다. 라이브러리가 내게 필요한 기능을 제공하지 못할 경우가 아니라면 쓰는 것을 지향하자. <br/?> ## 정확한 답이 팔요하다면 float와 double은 피하라 float와 double은 값을 보여주지 않는다. 특히 금융 계산에는 BigDecimal, int, long을 사용해야 한다. BigDecimal은 여덟 가지 반올림 모드를 이용하여 반올림을 완벽히 제어할 수 있다. 숫자를 아홉 자리 십진수로 표현할 수 있다면 int, 열여덟 자리 십진수로 표현할 수 있다면 long, 열여덟 자리를 넘어가면 BigDecimal을 사용해야 한다. <br/> ## 박싱된 기본 타입보다는 기본 타입을 사용하라 기본 타입과 박싱된 기본 타입의 차이점은 다음과 같다. * 기본 타입은 값만 가지고 있으나, 박싱된 기본 타입은 값에 더해 식별성이란 속성을 갖는다. * 기본 타입의 값은 언제나 유효하나, 박싱된 기본 타입은 유효하지 않다. 즉, null을 가질 수 있다. * 기본 타입이 박싱된 기본 타입보다 시간과 메모리 사용면에서 더 효율적이다. 박싱된 기본 타입은 값이 같더라도 다르다고 식별될 수 있다. 성능상 문제 또한 있으니 박싱된 기본 타입이 필요한 경우가 아니라면 기본 타입을 사용하는 것이 좋다. 기본 타입을 박싱하는 작업은 필요 없는 객체를 생성하는 부작용을 나을 수 있다. <br/> ## 다른 타입이 적절하다면 문자열 사용을 피하라 문자열은 다른 값 타입을 대신하기에 적합하지 않다. 받은 데이터가 수치형이라면 해당 타입으로 변환을 해야한다. '예/아니오'의 답이라면 열거 타입이라 boolean으로 변환해야 한다. 상수를 열거할 때는 문자열보다 열거 타입이 월등히 낫다. 혼합 타입을 대신하기에도 적절하지 않다. 각 요소를 개별로 접근하려면 문자열을 파싱해야 해서 느리고, 오류 가능성도 커진다. 적절한 equals, toString, compareTo 메서드를 제공할 수 없다. 문자열은 권한을 표현하기에도 적합하지 않다. <br/> ## 문자열 연결은 느리니 주의하라 문자열 연결 시에 StringBuilder를 호출하게 된다. 미리 선언을 해두고 ``.append()``를 통해 연결하자. <br/> ## 객체는 인터페이스를 사용해 참조하라 적합한 인터페이스만 있다면 매개변수뿐 아니라 반환값, 변수, 필드를 전부 인터페이스 타입으로 선언하라. 인터페이스를 타입으로 사용하는 습관을 길러두면 프로그램이 훨씬 유연해질 것이다. ```java Set<Son> sonSet = new LinkedHashSet<>(); // O LinkedHashSet<Son> sonSet = new LinkedHashSet<>(); // X ``` 적합한 인터페이스가 없다면 당연히 클래스로 참조해야 한다. 적합한 인터페이스가 없다면 클래스의 계층구조 중 필요한 기능을 만족하는 가장 덜 구체적인(상위의) 클래스를 타입으로 사용하자. <br/> ## 리플렉션보다는 인터페이스를 사용하라 리플렉션을 사용하게 되면 컴파일타임 타입 검사가 주는 이점을 누릴 수 없다. 코드가 지저분하고 장황해진다. 성능이 떨어진다. 리플렉션은 아주 제한된 형태로만 사용해야 그 단점을 피하고 이점만 취할 수 있다. 리플렉션은 인스턴스 생성에만 쓰고, 이렇게 만든 인스턴스는 인터페이스나 상위 클래스로 참조해 사용하자. <br/> ## 네이티브 메서드는 신중히 사용하라 자바 네이티브 인터페이스는 자바 프로그램이 네이티브 메서드를 호출하는 기술이다. 여기서 네이티브 메서드란 C나 C++ 같은 네이티브 프로그래밍 언어로 작성한 메서드를 말한다. 네이티브 메서드의 주요 쓰임은 다음 3가지다. * 레지스트리 같은 플랫폼 특화 기능을 사용하는 경우 * 네이티브 코드로 작성된 기존 라이브러리를 사용하는 경우 * 성능 개선을 목적으로 성능에 결정적인 영향을 주는 영역만 따로 작성하는 경우 성능을 개선할 목적으로 네이티브 메서드를 사용하는 것은 거의 권장하지 않는다. JVM은 많이 발전을 했으며 튜닝이 계속되면서 원래의 네이티브 구현보다도 빨라졌다. 네이티브 메서드에서는 심각한 단점이 있다. 네이티브 언어가 안전하지 않으므로 네이티브 메서드를 사용하는 애플리케이션도 메모리 훼손 오류로부터 더 이상 안전하지 않다. 이식성도 낮다. 디버깅도 더 어렵다. 주의하지 않으면 속도가 오히려 느려질 수도 있다. 가비지 컬렉터가 메모리를 자동 회수하지 못하고, 추적도 할 수 없다. 자바 코드와 네이티브 코드의 경계를 넘나들 때마다 비용도 추가된다. 마지막으로 네이티브 메서드와 자바 코드 사이의 '접착 코드'를 작성해야 한다. 이는 귀찮고 가독성도 떨어진다. <br/> ## 최적화는 신중히 하라 성능 때문에 견고한 구조를 희생하지 말자. 빠른 프로그램보다는 좋은 프로그램을 작성하라. 성능을 제한하는 설계를 피하고, API를 설계할 때 성능에 주는 영향을 고려해야 한다. 그러나 성능을 위해 API를 왜곡하는 건 매우 안 좋은 생각이다. <br/> ## 일반적으로 통용되는 명명 규칙을 따르라 표준 명명 규칙을 체화하여 자연스럽게 베어 나오도록 하자. ***
Markdown
UTF-8
545
3.1875
3
[]
no_license
# 1158 ## Python ```python from collections import deque N, K = map(int, (input().split())) lst = [i for i in range(1, N+1)] result = [] q = deque(lst) while q: q.rotate(-K+1) result.append(q.popleft()) print(f'<{", ".join(map(str, result))}>') ``` index용 풀이 ``` python from collections import deque N, K = map(int, (input().split())) lst = [i for i in range(1, N+1)] result = [] index = 0 while lst: index = (index + K - 1) % len(lst) result.append(lst.pop(index)) print(f'<{", ".join(map(str, result))}>') ```
Markdown
UTF-8
4,009
3.5
4
[ "MIT" ]
permissive
# Chapter 1. The Big Picture ## Levels and Layers of Abstraction in a Linux System * The kernel is the core of the operating system * It is software residing in memory that tells the CPU what to do * The kernel manages the hardware and acts primarily as an interface between the hardware and any running program * User space is made up of user processes, which are the running programs that the kernel managers * The kernel runs in kernel mode and the user processes run in user mode * Code running in kernel mode has unrestricted access to the processor and main memory * The area that only the kernel can access is called kernel space * User mode restricts access to a comparatively small subset of memory and safe CPU operations * If a process makes a mistake and crashes, the consequences are limited and can be cleaned up by the kernel ## The Kernel * The kernel is responsible for determining which processes are allowed to use the CPU * The kernel needs to keep track of all memory - what is currently allocated to a particular process, what might be shared between processes, and what is free * The kernel acts as an interface between hardware (like a disk) and processes * Processes normally use system calls to communicate with the kernel ### Process Management * In a system with a one-core CPU, many processes may be able to use the CPU, but only one process may actually use the CPU at any given time * In practice, each process uses the CPU for a small fraction of a second, pauses, then another process uses the CPU for another small fraction of a second, etc. (context switching) * Situation is a process running in user mode, but it stime slice is up * The CPU interrupts the current process based on an internal timer, switches into kernel mode, and hands control back to the kernel * The kernel records the current state of the CPU and memory, which will be essential to resuming the process that was just interrupted * The kernel analyzyes the list of processes that are ready to run and chooses one * The kernel prepares the memory for this new process, and then prepares the CPU * The kernel tells the CPU how long the time slice for the new process will last * The kernel switches the CPU into user mode and hands control of the CPU to the process * The kernel "runs" between process time slices during a context switch ### Memory Management * The kernel must have it's own private area of memory that user processes can't access * Each user process needs its own section of memory * One use process may not access the private memory of another process * User processes can share memory * Some memory in user processes can be read-only * The system can use more memory than is physically present by using disk space as auxillary * Modern CPUs include a memory management unit, that enables a memory access scheme called virtual memory * A process does not directly access the memory by its physical location in the hardware * The kernel sets up each process to act as if it had an entire machine to itself * When the process accesses some of its memory, the MMU intercepts the access and uses a memory address map to translate the memory location from the process into an actual physical memory location on the machine * During a context switch, the kernel has to change the map from the outgoing process to the incoming process ## System Calls and Support * A system call is an interaction between a process and the kernel * When a process calls `fork`, the kernel creates a nearly identical copy of the process * When a process calls `exec` the kernel starts the program specified as an argument to `exec`, replacing the current process * All user processes start as a result of `fork` * When you enter `ls` into a terminal window, the shell (i.e. the program that the terminal sends user input to) running inside the terminal window calls `fork()` to create a copy of the shell, and then the new copy of the shell calls `exec(ls)` to run `ls`
Swift
UTF-8
2,292
2.671875
3
[]
no_license
// // ViewController.swift // CameraApp // // Created by Vinay Ponnuri on 7/22/18. // Copyright © 2018 Vinay Ponnuri. All rights reserved. // import UIKit class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate { @IBOutlet weak var imageView: UIImageView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } @IBAction func saveButtonClicked(_ sender: Any) { // let imageData = UIImageJPEGRepresentation(imageView.image!, 0.6) // let compressedJPGImage = UIImage(data: imageData!) // UIImageWriteToSavedPhotosAlbum(compressedJPGImage!, nil, nil, nil) // // var alert = UIAlertView(title: "Wow", // message: "Your image has been saved to Photo Library!", // delegate: nil, // cancelButtonTitle: "Ok") // alert.show() } @IBAction func openCamera(_ sender: Any) { if UIImagePickerController.isSourceTypeAvailable(.camera) { let imagePicker = UIImagePickerController() imagePicker.delegate = self imagePicker.sourceType = .camera imagePicker.allowsEditing = false self.present(imagePicker, animated: true, completion: nil) } } @IBAction func openLibrary(_ sender: Any) { if UIImagePickerController.isSourceTypeAvailable(.photoLibrary) { let imagePicker = UIImagePickerController() imagePicker.delegate = self imagePicker.sourceType = .photoLibrary imagePicker.allowsEditing = true self.present(imagePicker, animated: true, completion: nil) } } private func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String: AnyObject]) { let image = info[UIImagePickerControllerOriginalImage] as! UIImage imageView.image = image dismiss(animated: true, completion: nil) } }
Java
UTF-8
4,389
2.078125
2
[]
no_license
package com.example.mykitchen; import android.os.Bundle; import android.app.Activity; import android.app.AlertDialog; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.support.v4.app.NavUtils; import android.annotation.TargetApi; import android.content.Intent; import android.os.Build; import android.app.*; import android.view.View; import android.content.DialogInterface; import android.widget.*; import android.content.Context; import android.view.View.OnClickListener; public class MyKitchenActivity extends Activity { final Context context = this; private Activity activity = this; ScrollView scrollview = (ScrollView)findViewById(R.id.sv1); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_kitchen); // Show the Up button in the action bar. setupActionBar(); Intent intent = getIntent(); Button button = (Button)findViewById(R.id.buttonAdd); button.setOnClickListener(new OnClickListener(){ public void onClick(View view){ final Dialog dialog = new Dialog(context); dialog.setContentView(R.layout.dialogue); dialog.setTitle("Title..."); TextView text1 = (TextView) dialog.findViewById(R.id.tv1); text1.setText("Ingredient:"); final EditText editI = (EditText) dialog.findViewById(R.id.etI); editI.setText(""); TextView text2 = (TextView) dialog.findViewById(R.id.tv2); text2.setText("Quantity:"); final EditText editQ = (EditText) dialog.findViewById(R.id.etq); editQ.setText(""); Button dButton = (Button)dialog.findViewById(R.id.buttonOk); dButton.setOnClickListener(new OnClickListener(){ public void onClick(View v){ String ingredient = editI.getText().toString(); TextView viewText1 = new TextView(context); viewText1.setText("Ingredient:" + ingredient); String quantity = editQ.getText().toString(); TextView viewText2 = new TextView(context); viewText1.setText("#:" + quantity); LinearLayout lila = new LinearLayout(context); lila.setOrientation(LinearLayout.HORIZONTAL); lila.addView(viewText1); lila.addView(viewText2); scrollview.addView(lila); dialog.dismiss(); } ; }); dialog.show(); } }); } /** * Set up the {@link android.app.ActionBar}, if the API is available. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void setupActionBar() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { getActionBar().setDisplayHomeAsUpEnabled(true); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.my_kitchen, menu); return true; } public void addToScroll(){ final Dialog dialog = new Dialog(context); dialog.setContentView(R.layout.dialogue); dialog.setTitle("Title..."); TextView text1 = (TextView) dialog.findViewById(R.id.tv1); text1.setText("Ingredient:"); EditText editI = (EditText) dialog.findViewById(R.id.etI); editI.setText("Yo nig"); TextView text2 = (TextView) dialog.findViewById(R.id.tv2); text2.setText("Quantity:"); EditText editQ = (EditText) dialog.findViewById(R.id.etq); editQ.setText("yoyonig"); Button dButton = (Button)dialog.findViewById(R.id.buttonOk); dButton.setOnClickListener(new OnClickListener(){ public void onClick(View v){ dialog.dismiss(); } }); dialog.show(); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } }
C
UTF-8
1,843
2.921875
3
[]
no_license
/*for compilation, link the following library: jsmn/libjsmn.a jsmn library structures (documentation: https://github.com/zserge/jsmn): typedef struct { jsmntype_t type; // Token type int start; // Token start position int end; // Token end position int size; // Number of child (nested) tokens } jsmntok_t; typedef enum { JSMN_UNDEFINED = 0, JSMN_OBJECT = 1, JSMN_ARRAY = 2, JSMN_STRING = 3, JSMN_PRIMITIVE = 4 } jsmntype_t; */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include "jsmn/jsmn.h" #define BUFFER_SIZE 500 #define INIT_TOKEN 4 #define FINAL_TOKEN 26 void read_file(char* filepath, char* fileContent) { int c; int index=0; FILE* f = fopen(filepath, "rt"); while((c = fgetc(f)) != EOF){ fileContent[index] = c; index++; } fileContent[index] = '\0'; } int get_json_bonsai_reader_size() { return (FINAL_TOKEN-INIT_TOKEN)/2 + 1; } /*returns an array with all parameters in the json files of the bonsai simulations: 0 vr 1 vt 2 vt_phi 3 size_ratio 4 mass_ratio 5 Rsep 6 lMW 7 bMW 8 lM31 9 bM31 10 lR 11 bR Note: the pointer has to be freed by the caller! Do 'free((float*)pointer)' */ float* json_bonsai_reader(char* file, float *out) { char json_str[BUFFER_SIZE]; read_file(file, json_str); jsmn_parser parser; jsmntok_t tokens[100]; //this can be optimized jsmn_init(&parser); jsmn_parse(&parser, json_str, strlen(json_str), tokens, 50); int i_tok; for(i_tok=INIT_TOKEN; i_tok<=FINAL_TOKEN; i_tok=i_tok+2) { jsmntok_t key = tokens[i_tok]; unsigned int l = key.end - key.start; char* key_str = (char*)malloc((l+1)*sizeof(char)); memcpy(key_str, &json_str[key.start], l); key_str[l] = '\0'; int out_idx = (i_tok-INIT_TOKEN)/2; out[out_idx]=(float)atof(key_str); free((char*)key_str); } return out; }
Swift
UTF-8
1,177
2.625
3
[ "MIT" ]
permissive
// // MainInterfaceController.swift // WatchApp Extension // // Created by Massimiliano Bigatti on 20/07/15. // Copyright © 2015 Massimiliano Bigatti. All rights reserved. // import WatchKit import Foundation class MainInterfaceController: WKInterfaceController { @IBOutlet var table: WKInterfaceTable! let controllers = [ "Appare", "Scompare", "Pulsa", "Blocco completamento", "Riposizionamento", "Visualizzazione in sequenza", "Animazione gruppo" ] override func willActivate() { super.willActivate() table.setNumberOfRows(controllers.count, withRowType: "RowController") for index in 0..<controllers.count { let row = table.rowControllerAtIndex(index) as! RowController row.setText(controllers[index]) } } // ========================================================================= // MARK: WKInterfaceTable override func table(table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int) { let name = controllers[rowIndex] self.pushControllerWithName(name, context: nil) } }
Markdown
UTF-8
4,828
2.796875
3
[ "MIT" ]
permissive
--- title: 'Computing Innovations - Share, Reflection' metaTitle: 'Computing Innovations - Share, Reflection' order: 0 --- ## Summary ### Materials * [Day 11 PowerPoint deck](https://1drv.ms/w/s!AqsgsTyHBmRBkA4vRFCEM20mHtlF?e=y9rJsg) * [Seeing AI app from Microsoft](https://youtu.be/bqeQByqf_f8) * [Impact of a Computing Innovation - Recurring Assignment Handout](/unit-1/day-11/impact-computing-innovation) * [Impact of a Computing Innovation - Recurring Assignment Handout](https://1drv.ms/w/s!AqsgsTyHBmRBkANWszAEPHMdqLBT?e=bPgDlu) (in Word) ### Instructional Activities and Classroom Assessments 1. Computing Innovations - Group Work (20 minutes) 2. Share Top Innovations (10 minutes) 3. Synthesize Purpose of Computing Innovations (5 minutes) 4. Seeing AI (5 minutes) 5. Introduction to Impact of Computing Recurring Assignment (5 minutes) ### Learning Objectives * [CRD-2.A](https://apcentral.collegeboard.org/pdf/ap-computer-science-principles-course-and-exam-description.pdf#page=41) Describe the purpose of a computing innovation. * [IOC-1.A](https://apcentral.collegeboard.org/pdf/ap-computer-science-principles-course-and-exam-description.pdf?course=ap-computer-science-principles#page=121) Explain how an effect of a computing innovation can be both beneficial and harmful. ### Essential Knowledge * [CRD-2.A.1](https://apcentral.collegeboard.org/pdf/ap-computer-science-principles-course-and-exam-description.pdf#page=41) The purpose of computing innovations is to solve problems or to pursue interests through creative expression. * [CRD-2.A.2](https://apcentral.collegeboard.org/pdf/ap-computer-science-principles-course-and-exam-description.pdf#page=41) An understanding of the purpose of a computing innovation provides developers with an improved ability to develop that computing innovation. * [IOC-1.A.1](https://apcentral.collegeboard.org/pdf/ap-computer-science-principles-course-and-exam-description.pdf?course=ap-computer-science-principles#page=121) People create computing innovations. * [IOC-1.A.2](https://apcentral.collegeboard.org/pdf/ap-computer-science-principles-course-and-exam-description.pdf?course=ap-computer-science-principles#page=121) The way people complete tasks often changes to incorporate new computing innovations. * [IOC-1.A.3](https://apcentral.collegeboard.org/pdf/ap-computer-science-principles-course-and-exam-description.pdf?course=ap-computer-science-principles#page=121) Not every effect of a computing innovation is anticipated in advance. * [IOC-1.A.4](https://apcentral.collegeboard.org/pdf/ap-computer-science-principles-course-and-exam-description.pdf?course=ap-computer-science-principles#page=121) A single effect can be viewed as both beneficial and harmful by different people, or even by the same person. * [IOC-1.A.5](https://apcentral.collegeboard.org/pdf/ap-computer-science-principles-course-and-exam-description.pdf?course=ap-computer-science-principles#page=121) Advances in computing have generated and increased creativity in other fields, such as medicine, engineering, communications, and the arts. ## Details ### 1. Computing Innovations - Collaborative Work (10 minutes) * Ask students to organize into groups of 3 * Once in groups, ask students to share their lists from their Computing Innovations activity with their teammates * As a team, select the most important beneficial innovations from among your group ### 2. Share Top Innovations (10 minutes) * Ask each group to share with the rest of the class which innovation they selected and why ### 3. Synthesize Purpose of Computing Innovations (5 minutes) * Ask students questions regarding what they have observed through their research and discussion: * What is the purpose of computing innovations? * What common threads run through the computing innovations that we have discussed? * What purpose do they serve? * Why were they created? * How do they help people? * The point of the discussion should be to help students reach the conclusion that computing innovations are created to solve problems or pursue interests through creative expression. CRD-2.A.1 ### 4. Seeing AI (5 minutes) * Watch video about Seeing AI * Discuss the beneficial impact of the app * Discuss the process designers would have used to develop the app (Review of design thinking principles students have learned) * Share the AI for Accessibility site for students who may be interested in exploring it later ### 5. Introduction to Impact of Computing Recurring Assignment (5 minutes) * Set the date for the first Impact of Computing recurring assignment. * Explain the details of the Impact of Computing assignment that students will complete every other Friday. * Tell students when the first report will be due. * Share the Impact of Computing document with the students.
C++
UTF-8
590
2.9375
3
[ "MIT" ]
permissive
#include <iostream> int main() { int primenum[10000] = {0}; bool prime[10000] = {true, true}; for (int i=2; i<10000; i++) { primenum[i] = primenum[i-1]; if (prime[i] == true) { continue; } for (int j=i+i; j<10000; j+=i) { prime[j] = true; } primenum[i]++; } int a, b; std::cin>>a>>b; while (a!=-1 || b!=-1) { if (a<=0) { a=1; } std::cout<<primenum[b]-primenum[a-1]<<std::endl; std::cin>>a>>b; } return 0; }
C++
UTF-8
1,059
2.90625
3
[]
no_license
#ifndef RIGIDBODY3D_H #define RIGIDBODY3D_H #include "../Rigidbody.h" #include "glm/glm.hpp" class Rigidbody3D : public Rigidbody { private: float m_Mass = 1; glm::vec3 m_Velocity = glm::vec3(0, 0, 0); glm::vec3 m_Acceleration = glm::vec3(0, 0, 0); float m_Bounciness = 0.5f; public: Rigidbody3D() = default; virtual ~Rigidbody3D() { }; const float GetMass() const { return m_Mass; } void SetMass(float mass) { m_Mass = mass; } const glm::vec3& GetVelocity() const { return m_Velocity; } void SetVelocity(const glm::vec3& velocity) { m_Velocity = velocity; } void AddVelocity(const glm::vec3& velocity) { m_Velocity += velocity; } void SetBounciness(const float bounciness) { m_Bounciness = bounciness; } const float GetBounciness() const { return m_Bounciness; } const bool IsIntersecting(const Rigidbody3D& other) const; public: static bool AreIntersecting(const Rigidbody3D& a, const Rigidbody3D& b); }; #endif
Python
UTF-8
5,804
2.71875
3
[]
no_license
import os import csv import matplotlib.pyplot as plt # root_directory = 'C:\\Users\\Jazz\\VSCODE\\Repo\\ASECP\\data\\thesis_data\\comparison_of_feature_weighting' # root_directory = 'C:\\Users\\Jazz\\VSCODE\\Repo\\ASECP\\data\\thesis_data\\comparison_of_feature_transformations' root_directory = 'C:\\Users\\Jazz\\VSCODE\\Repo\\ASECP\\data\\thesis_data\\effect_of_selection_operator' file_paths = os.listdir(root_directory) metrics = ['SSD'] #['EUC', 'SSD', 'SAD'] metrics2 = ['bark', 'mel', 'cent'] sounds = set([x.split('.wav')[0] for x in file_paths]) target_formants = {'Primary1': (274, 1947, 'steelblue'), 'Primary4': (639, 1145, 'lightgreen'), 'Primary8': (335, 936, 'darkred')} def read_all(direcs, metric, color): scale = 20 f1 = [] f2 = [] print(direcs) for directory in direcs: print(directory) with open('{}\\{}\\Generation20\\individual_info_table.csv'.format(root_directory, directory), 'r') as csvfile: spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|') for row in spamreader: if row[-4] == "True": f1.append(float(row[5])) f2.append(float(row[6])) if len(f1) == 0: f1.append(1) f2.append(1) #a = sum(f1)/len(f1) #b = sum(f2)/len(f2) print(len(f1)) plt.scatter(f1,f2, c=color, s=scale, alpha=1, marker="o", edgecolors='none') def read_average(direcs, metric, color): scale = 50 print(direcs) for directory in direcs: print(directory) f1 = [] f2 = [] with open('{}\\{}\\Generation20\\individual_info_table.csv'.format(root_directory, directory), 'r') as csvfile: spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|') for row in spamreader: if row[-4] == "True": f1.append(float(row[5])) f2.append(float(row[6])) if len(f1) == 0: f1.append(1) f2.append(1) a = sum(f1)/len(f1) b = sum(f2)/len(f2) plt.scatter(a,b, c=color, s=scale, alpha=1, marker="o", edgecolors='none') def plot_vowel(metric): directories = [path for path in file_paths if metric in path] for sound in sounds: new_direcs = [path for path in directories if sound in path] color = target_formants[sound][2] read_average(new_direcs, metric, color) plt.axis([200, 900, 400, 2400]) for sound in sounds: f1, f2, color = target_formants[sound] plt.scatter(f1, f2, c=color, s=200, label = sound, marker="*", alpha=1.0, edgecolors='none') plt.annotate(sound, (f1, f2)) plt.xlabel('F1 Hz') plt.ylabel('F2 Hz') plt.show() plt.legend() plt.grid(True) #plt.savefig(("%s_%s_Average.pdf" % (ff,metric)), format='pdf') plt.clf() #print(directories) print() def plot_vowel_all(metric): directories = [path for path in file_paths if metric in path] for sound in sounds: new_direcs = [path for path in directories if sound in path] color = target_formants[sound][2] read_all(new_direcs, metric, color) plt.axis([200, 900, 400, 2400]) for sound in sounds: f1, f2, color = target_formants[sound] plt.scatter(f1, f2, c=color, s=200, label = sound, marker="*", alpha=1.0, edgecolors='none') plt.annotate(sound, (f1, f2)) plt.xlabel('F1 Hz') plt.ylabel('F2 Hz') plt.show() #print(directories) print() for metric in metrics: plot_vowel(metric) for metric in metrics: plot_vowel_all(metric) def read_average_csv(metric, ff, vowel, color): scale = 100 for i in range(1,6): f1 = [] f2 = [] directory = ("vowel-%s-mono.wav Gen 20 Pop 75 Mut 0.15 SD 0.15 %s %s 0%d" % (vowel, ff, metric, i)) with open('%s\\Generation20\\Stats.csv' % directory, 'rb') as csvfile: spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|') for row in spamreader: if row[0] == "4000": pass else: f1.append(float(row[0])) if row[1] == "6000": pass else: f2.append(float(row[1])) if len(f1) == 0: f1.append(1) f2.append(1) a = sum(f1)/len(f1) b = sum(f2)/len(f2) plt.scatter(a,b, c=color, s=scale, alpha=1, marker="*", edgecolors='none') def formant_average_plot(metric, ff): """ Plots the F1 and F2 information of all individuals of a given generation from n runs""" vowels =[("Primary1","steelblue"),("Primary4","lightgreen"),("Primary8","darkred")] scale = 100 for s in vowels: read_average_csv(metric, ff, *s) plt.scatter(760, 1179, c="darkred", s=scale, label = "/a/", marker="o", alpha=1.0, edgecolors='none') plt.annotate("Target /a/", (760,1179)) plt.scatter(519,830, c="lightgreen", s=scale, label = "/o/", marker="o", alpha=1.0, edgecolors='none') plt.annotate("Target /o/", (519,830)) plt.scatter(319,1944, c="steelblue", s=scale, label = "/e/", marker="o", alpha=1.0, edgecolors='none') plt.annotate("Target /e/", (319,1944)) plt.axis([200, 900, 400, 2400]) plt.xlabel('F1 Hz') plt.ylabel('F2 Hz') plt.title("Generation %s" % generation) plt.legend() plt.grid(True) plt.savefig(("%s_%s_Average.pdf" % (ff,metric)), format='pdf') plt.clf()
Python
UTF-8
1,002
2.609375
3
[]
no_license
import socket import threading import json import sys nickname = None fail = False addr = {} with open('configs/cl-config.json','r') as f: addr = json.load(f) client = socket.socket(socket.AF_INET,socket.SOCK_STREAM) client.connect((addr['ip'],addr['port'])) def nick(): global nickname nickname = input('Enter your nickname to be shown to all : ') client.send(nickname.encode('ascii')) def rec(): try: while True: print(client.recv(1024).decode('ascii')) except ConnectionResetError as ex: print('Server stopped listening to the specified address. Press enter to exit...') global fail fail == True sys.exit() def send(): global fail global nickname while True: mssg = input("") try: client.send(f"{mssg}".encode('ascii')) except: sys.exit() nick() sender = threading.Thread(target=send) sender.start() recver = threading.Thread(target=rec) recver.start()
C#
UTF-8
824
2.65625
3
[]
no_license
using System; using SpeechModulo4.speech; using Microsoft.CognitiveServices.Speech; using Microsoft.CognitiveServices.Speech.Audio; namespace SpeechModulo4 { class Program { static void Main(string[] args) { var cliente = SpeechClient.cliente; Console.WriteLine("Habla en micrófono"); getText(cliente); Console.ReadKey(); } private static async void getText(SpeechConfig cliente) { var audioConfig = AudioConfig.FromDefaultMicrophoneInput(); var speechRecognizer = new SpeechRecognizer(cliente, "es-MX", audioConfig); var respuesta =await speechRecognizer.RecognizeOnceAsync(); Console.WriteLine($"texto: {respuesta.Text}"); } } }
C#
UTF-8
1,006
2.578125
3
[]
no_license
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Business.Entities { public class DocenteCurso:BusinessEntity { private string cargo; private Persona docente; private Curso curso; public DocenteCurso() { this.docente = new Persona(); this.curso = new Curso(); } public string Cargo { get { return cargo; } set { cargo = value; } } public Persona Docente { get { return docente; } set { docente = value; } } public Curso Curso { get { return curso; } set { curso = value; } } public string ApellidoDocente { get { return this.Docente.Apellido; } } public string NombreDocente { get { return this.Docente.Nombre; } } } }
Python
UTF-8
2,072
3.078125
3
[]
no_license
#!/usr/bin/python ## Nicolae Erast - 10.05.2017 import sys, re, os class mygrep(): def __init__(self, tipar): self.path = os.getcwd() print('Directory to search: "%s"' % self.path) self.tipar = re.compile(tipar) print(os.linesep + 'Searching for: "%s"' % self.tipar.pattern) def files(self): self.files = [] for paths in os.walk(self.path): if not paths[1]: for f in paths[2]: self.files.append(os.path.join(paths[0],f)) print(os.linesep + 'Checked files:') for f in self.files: print (' - %s ' % f) def search(self): self.founds = [] for f in self.files: with open(f,'r') as openfile: fetchfile = openfile.readlines() for linenr, line in enumerate(fetchfile,1): found = re.search(self.tipar, line) if found: self.founds.append([f,linenr,line,found.group()]) def __str__(self): self.files() self.search() founds = len(self.founds) if founds: prev_file = None for found in self.founds: if prev_file != found[0]: prev_file = found[0] print(os.linesep + 'In file:\t%s' % prev_file) print('Line %d:\t%s\t\ti found: %s' \ % (found[1], found[2].strip(), found[3])) return os.linesep + 'Finished search ... with ' + str(founds) + ' result(s)' else: return os.linesep + 'No match found ...' def main(): print ''' Demo os.walk si re, win/*nix ''' tipar = '' arg_len = len(sys.argv) if arg_len > 1: tipar = ' '.join(sys.argv[1:arg_len]) else: while len(tipar) == 0: tipar = raw_input('Enter pattern to search: ') mysearch = mygrep(tipar) print(mysearch) raw_input(os.linesep + 'Press any key to exit') sys.exit(0) if __name__ == '__main__': main()
Java
UTF-8
1,361
2.015625
2
[]
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 View; import Controller.ClientController; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.stage.Stage; /** * * @author bo */ public class profile_Style_Controller implements Initializable { @FXML private Label label; @FXML private ComboBox comboStatus; @FXML ObservableList<String> states=FXCollections.observableArrayList("available","busy","away"); ClientController controller; @Override public void initialize(URL url, ResourceBundle rb) { // TODO comboStatus.getItems().addAll(states); comboStatus.getSelectionModel().selectFirst(); } public void setCon(ClientController con){ this.controller= con; } }
Python
UTF-8
3,311
2.671875
3
[ "MIT" ]
permissive
from flake8.formatting import base from junit_xml import TestSuite, TestCase class JUnitXmlFormatter(base.BaseFormatter): """JUnit XML formatter for Flake8.""" # Override show_statistics to always print to stdout instead of to the file def show_statistics(self, statistics): for error_code in statistics.error_codes(): stats_for_error_code = statistics.statistics_for(error_code) statistic = next(stats_for_error_code) count = statistic.count count += sum(stat.count for stat in stats_for_error_code) print( "{count:<5} {error_code} {message}".format( count=count, error_code=error_code, message=statistic.message, ), end=self.newline ) # Override show_benchmarks to always print to stdout instead of to the file. def show_benchmarks(self, benchmarks): float_format = "{value:<10.3} {statistic}".format int_format = "{value:<10} {statistic}".format for statistic, value in benchmarks: if isinstance(value, int): benchmark = int_format(statistic=statistic, value=value) else: benchmark = float_format(statistic=statistic, value=value) print(benchmark, end=self.newline) def after_init(self): self.test_suites = {} def beginning(self, filename): name = '{0}.{1}'.format("flake8", filename.replace('.', '_')) self.test_suites[filename] = TestSuite(name, file=filename) # This formatter overwrites the target file, in contrast to flake8 base formatter which appends to the file. def start(self): if self.filename: self.output_fd = open(self.filename, 'w') # Do not write each error def handle(self, error): name = '{0}, {1}'.format(error.code, error.text) test_case = TestCase( name, classname="%(path)s:%(row)d:%(col)d" % { "path": error.filename, "row": error.line_number, "col": error.column_number, }, file=error.filename, line=error.line_number ) test_case.add_failure_info(message=self.format(error), output=self.show_source(error)) self.test_suites[error.filename].test_cases.append(test_case) def format(self, error): return '%(path)s:%(row)d:%(col)d: %(code)s %(text)s' % { "code": error.code, "text": error.text, "path": error.filename, "row": error.line_number, "col": error.column_number, } # Add a dummy test if no error found def finished(self, filename): if len(self.test_suites[filename].test_cases) == 0: dummy_case = TestCase("Check passed", file=filename) self.test_suites[filename].test_cases.append(dummy_case) # sort to generate a stable output def sorted_suites(self): return map(lambda x: x[1], sorted(self.test_suites.items())) # writes results to file after all files are processed def stop(self): self._write(TestSuite.to_xml_string(iter(self.sorted_suites()))) super(JUnitXmlFormatter, self).stop()
Python
UTF-8
5,322
2.546875
3
[ "MIT" ]
permissive
import numpy as np import scipy.constants as cs from numpy import pi, sqrt import dataproc.print as dpr import general as gen import symmetric as sym import asymmetric as asym ## Data tl = np.array([[0.65, 14.06], [2.75, 17.29], [2.09, 17.86]]) # 5 Periods and 10 with beats tr = np.array([[1.10, 15.01], [2.34, 16.90], [1.71, 18.07]]) tl_b = np.array([[8.78, 52.24], [8.81, 84.62], [17.11, 187.32]]) tr_b = np.array([[4.68, 47.50], [16.08, 91.78], [33.98, 204.40]]) d_tl = np.array([[0.1, 0.1], [0.1, 0.1], [0.1, 0.1]]) d_tr = np.array([[0.1, 0.1], [0.1, 0.1], [0.1, 0.1]]) d_tl_b = np.array([[0.5, 0.5], [0.5, 0.5], [0.5, 0.5]]) d_tr_b = np.array([[0.5, 0.5], [0.5, 0.5], [0.5, 0.5]]) f = np.array([0.735, 0.686, 0.649]) d_f = np.array([0.009, 0.006, 0.003]) f_b = np.array([0.620, 0.620, 0.619]) d_f_b = np.array([0.009, 0.006, 0.003]) ## Data preparation Tl, d_Tl = np.zeros(3), np.zeros(3) Tr, d_Tr = np.zeros(3), np.zeros(3) Tl_b, d_Tl_b = np.zeros(3), np.zeros(3) Tr_b, d_Tr_b = np.zeros(3), np.zeros(3) for i in range(3): Tl[i] = (tl[i][1] - tl[i][0]) / 10.0 d_Tl[i] = sqrt(d_tl[i][0]**2 + d_tl[i][1]**2) / 10.0 Tr[i] = (tr[i][1] - tr[i][0]) / 10.0 d_Tr[i] = sqrt(d_tr[i][0]**2 + d_tr[i][1]**2) / 10.0 Tl_b[i] = 2.0 * (tl_b[i][1] - tl_b[i][0]) / 5.0 d_Tl_b[i] = 2.0 * sqrt(d_tl_b[i][0]**2 + d_tl_b[i][1]**2) / 5.0 Tr_b[i] = 2.0 * (tr_b[i][1] - tr_b[i][0]) / 5.0 d_Tr_b[i] = 2.0 * sqrt(d_tr_b[i][0]**2 + d_tr_b[i][1]**2) / 5.0 omega_l = 2.0 * pi / Tl d_omega_l = omega_l * d_Tl / Tl omega_r = 2.0 * pi / Tr d_omega_r = omega_r * d_Tr / Tr omega_l_b = 2.0 * pi / Tl_b d_omega_l_b = omega_l_b * d_Tl_b / Tl_b omega_r_b = 2.0 * pi / Tr_b d_omega_r_b = omega_r_b * d_Tr_b / Tr_b omega = 0.5 * (omega_l + omega_r) d_omega = 0.5 * sqrt(d_omega_l**2 + d_omega_r**2) omega_b = 0.5 * (omega_l_b + omega_r_b) d_omega_b = 0.5 * sqrt(d_omega_l_b**2 + d_omega_r_b**2) omega_spec_2 = 2.0 * pi * f d_omega_spec_2 = 2.0 * pi * d_f omega_spec_1 = 2.0 * pi * f_b d_omega_spec_1 = 2.0 * pi * d_f_b ## Evaluation omega_spec = 0.5 * (omega_spec_1 + omega_spec_2) d_omega_spec = 0.5 * sqrt(d_omega_spec_1**2 + d_omega_spec_2**2) omega_b_spec = 0.5 * (omega_spec_2 - omega_spec_1) d_omega_b_spec = 0.5 * sqrt(d_omega_spec_1**2 + d_omega_spec_2**2) omega_theo = 0.5 * (sym.omega + asym.omega) d_omega_theo = 0.5 * sqrt(sym.omega**2 + asym.d_omega**2) omega_theo_b = 0.5 * (asym.omega - sym.omega) d_omega_theo_b = 0.5 * sqrt(sym.d_omega**2 + asym.d_omega**2) kappa = (asym.omega**2 - sym.omega**2) / (sym.omega**2 + asym.omega**2) d_kappa = kappa * sqrt(4 * (asym.omega**2 * asym.d_omega**2 + sym.omega**2 * sym.d_omega**2) * (1 / (asym.omega**2 - sym.omega**2)**2 + 1 / (sym.omega**2 + asym.omega**2)**2)) kappa_ratio = np.zeros(len(kappa) - 1) d_kappa_ratio = np.zeros(len(d_kappa) - 1) l2_ratio = np.zeros(len(gen.l) - 1) d_l2_ratio = np.zeros(len(gen.d_l) - 1) for i in range(len(kappa_ratio)): kappa_ratio[i] = kappa[i + 1] / kappa[i] d_kappa_ratio[i] = kappa_ratio[i] * sqrt((d_kappa[i + 1] / kappa[i + 1])**2 + (d_kappa[i] / kappa[i])**2) l2_ratio[i] = gen.l[i + 1]**2 / gen.l[i]**2 d_l2_ratio[i] = l2_ratio[i] * sqrt((2 * gen.d_l[i + 1] / gen.l[i + 1])**2 + (2 * gen.d_l[i] / gen.l[i])**2) ## Output if __name__ == '__main__': print(dpr.tbl([ dpr.lst(gen.l, gen.d_l, name='l', unit='m'), dpr.lst(Tl_b, d_Tl_b, name='TL', unit='s'), dpr.lst(Tr_b, d_Tr_b, name='TR', unit='s'), dpr.lst(omega_l_b, d_omega_l_b, name='ω_L', unit='s'), dpr.lst(omega_r_b, d_omega_r_b, name='ω_R', unit='s') ])) print(dpr.tbl([ dpr.lst(gen.l, gen.d_l, name='l', unit='m'), dpr.lst(Tl_b, d_Tl_b, name='TL', unit='s'), dpr.lst(Tr_b, d_Tr_b, name='TR', unit='s'), dpr.lst(omega_l_b, d_omega_l_b, name='ω_L', unit='s'), dpr.lst(omega_r_b, d_omega_r_b, name='ω_R', unit='s') ])) print(dpr.tbl([ dpr.lst(omega, d_omega, name='ω1', prefix=False, unit='1/s'), dpr.lst(omega_spec, d_omega_spec, name='ω2', prefix=False, unit='1/s'), dpr.lst(omega_theo, d_omega_theo, name='ω_E', prefix=False, unit='1/s'), dpr.dev(omega, d_omega, omega_spec, d_omega_spec, name='ω1, ω2'), dpr.dev(omega, d_omega, omega_theo, d_omega_theo, name='ω1, ω_E'), dpr.dev(omega_spec, d_omega_spec, omega_theo, d_omega_theo, name='ω2, ω_E'), ], name='Mixed excitation frequencys')) print(dpr.tbl([ dpr.lst(omega_b, d_omega_b, name='ω1', prefix=False, unit='1/s'), dpr.lst(omega_b_spec, d_omega_b_spec, name='ω2', prefix=False, unit='1/s'), dpr.lst(omega_theo_b, d_omega_theo_b, name='ω_E', prefix=False, unit='1/s'), dpr.dev(omega_b, d_omega_b, omega_b_spec, d_omega_b_spec, name='ω1, ω2'), dpr.dev(omega_b, d_omega_b, omega_theo_b, d_omega_theo_b, name='ω1, ω_E'), dpr.dev(omega_b_spec, d_omega_b_spec, omega_theo_b, d_omega_theo_b, name='ω2, ω_E'), ], name='Mixed excitation beat frequencys')) print() print(dpr.tbl([ dpr.lst(kappa, d_kappa, name='κ', prefix=False) ], name='coupling factors')) print(dpr.tbl([ dpr.lst(kappa_ratio, d_kappa_ratio, name='κ_ratio', prefix=False), dpr.lst(l2_ratio, d_l2_ratio, name='l²_ratio', prefix=False), dpr.dev(kappa_ratio, d_kappa_ratio, l2_ratio, d_l2_ratio, name='κ_ratio, l²_ratio') ], name='coupling factor ratios'))
C#
UTF-8
7,797
2.53125
3
[]
no_license
using SSLS.Domain.Abstract; using SSLS.Domain.Concrete; using SSLS.WebUI.Models; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.UI.HtmlControls; namespace SSLS.WebUI.Controllers { public class ShelfController : Controller { // GET: Shelf private IBooksReopository repository; private IOrderProcessor borrowProcessor; public ShelfController(IBooksReopository repo, IOrderProcessor Processor) { repository = repo; borrowProcessor = Processor; } public ViewResult Index(Shelf shelf, string returnUrl) { return View(new CurrentReaderModel { ReturnUrl = returnUrl, Shelf = shelf }); } //加入购物车 public ActionResult AddToShelf(Reader reader, Shelf shelf, int Id, string returnUrl) { //根据Id获取Book(BookSummary的表单只传递了id参数) Book book = repository.Books.FirstOrDefault(p => p.Id == Id); //将该书放入书架 shelf.AddItem(book); return RedirectToAction("Index", new { returnUrl }); } //从购物车中删除 public RedirectToRouteResult RemoveFromShelf(Shelf shelf, int Id) { Book Book = repository.Books .FirstOrDefault(p => p.Id == Id); if (Book != null) { shelf.RemoveLine(Book); } return RedirectToAction("Index"); } //查看本次借阅的图书 public ActionResult Completed(Shelf shelf, Reader reader, string returnUrl, int[] bookid) { List<Book> books = new List<Book>(); if (reader.Id == 0) { return RedirectToAction("Login", "Reader"); } else if (bookid.Length == 0) { return View("Index", new { returnUrl }); } else { for (var i = 0; i < bookid.Length; i++) { Book book = repository.FindBookById(bookid[i]); books.Add(book); } //注意一定要先生成一条新的订单,再生成一条新的借阅记录(借阅记录具有外键FineId) borrowProcessor.ProcessFine(books); borrowProcessor.ProcessBorrow(books, reader); Session["Shelf"] = null; ViewBag.readerName = reader.Name; ViewBag.BorrowTime = DateTime.Now; ViewBag.DateShouldBeReturn = DateTime.Now.AddMonths(1); ViewBag.ReturnUrl = returnUrl; return View(books); } } //查看尚未归还的图书 public ActionResult Borrowing(Reader reader, string returnUrl) { if (reader.Id == 0) { return RedirectToAction("Login", "Reader"); } else { IEnumerable<Borrow> borrows = repository.Borrows.Where(u => u.ReaderId == reader.Id && u.ReturnTime == null); foreach (var br in borrows) { /* * 因为存在用户先查看"我的借阅",再查看"我的罚款"的情况(即Borrowing()先于MyFine()执行); * 因此有必要在Borrowing中进行罚款状态的数据改写 */ if (br.DateShouldBeReturn < DateTime.Now && br.NeedtoFine == "暂无需要") { br.Fine.FinePrice = (Decimal)(DateTime.Now.Day - br.DateShouldBeReturn.Day); } } ViewBag.readerName = reader.Name; ViewBag.ReturnUrl = returnUrl; return View(borrows); } } //查看已归还的图书 public ActionResult BorrowHistory(Reader reader) { if (reader.Id == 0) { return RedirectToAction("Login", "Reader"); } else { IEnumerable<Borrow> borrows = repository.Borrows.Where(u => u.ReaderId == reader.Id && u.ReturnTime != null); return View(borrows); } } //归还图书 public ActionResult ReturnBook(int Id, Reader reader) { Book book = repository.FindBookById(Id); Borrow borrow = repository.Borrows.FirstOrDefault(br => br.BookId == book.Id && br.Reader.Id == reader.Id && br.ReturnTime == null); //如果逾期,需要先缴罚款 if (borrow.DateShouldBeReturn < DateTime.Now) { //前台reader修改 Borrow br = repository.Borrows.FirstOrDefault(b => b.BookId==Id&&b.ReaderId==reader.Id&&b.ReturnTime==null); reader.Price = reader.Price - (Decimal)(DateTime.Now.Day - br.DateShouldBeReturn.Day); HttpContext.Session["Reader"] = reader; borrowProcessor.ProcessPayFine(reader, borrow.Fine.Id); } borrowProcessor.ProcessReturn(book, reader); return RedirectToAction("Borrowing", reader); } //确认续借 public ActionResult SureAgain(int Id) { Book book = repository.FindBookById(Id); return View(book); } //续借 public ActionResult BorrowAgain(int Id, Reader reader) { Book book = repository.FindBookById(Id); if (repository.Borrows.FirstOrDefault(b => b.BookId == book.Id && b.ReaderId == reader.Id).WhetherToRenew == 3) { TempData["msg"] = string.Format("抱歉,'{0}'的续借上限次数为三次", book.Name); } else { borrowProcessor.ProcessBorrowAgain(book, reader); } return RedirectToAction("Borrowing", reader); } //我的罚款 /* * 注意返回的模型类为IEnumerable<Borrow>,而非IEnumerable<Fine> */ public ActionResult MyFine(Reader reader, string returnUrl) { if (reader.Id == 0) { return RedirectToAction("Login", "Reader"); } else { borrowProcessor.ProcessShowFine(reader); IEnumerable<Borrow> borrows = repository.Borrows.Where(u => u.ReaderId == reader.Id && u.DateShouldBeReturn < DateTime.Now); FineViewModel fv = new FineViewModel(borrows); return View(fv); } } //确认缴纳罚款 /* * Id为Fine的Id */ public ActionResult SureFine(Reader reader, int Id) { Borrow br = repository.Borrows.FirstOrDefault(u => u.FineId == Id); return View(br); } //缴纳罚款 public ActionResult PayFine(Reader reader, int Id) { //前台reader修改 Borrow br = repository.Borrows.FirstOrDefault(b => b.FineId == Id); reader.Price = reader.Price - (Decimal)(DateTime.Now.Day - br.DateShouldBeReturn.Day); HttpContext.Session["Reader"] = reader; //后台reader修改 /* * 先缴款 * 再归还 */ borrowProcessor.ProcessPayFine(reader, Id); borrowProcessor.ProcessReturn(br.Book, reader); return RedirectToAction("MyFine", reader); } } }
Java
UTF-8
2,002
2.328125
2
[]
no_license
package com.zxl.mycustomer; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.zxl.mycustomer.satellite.SatelliteMenu; import java.util.Random; public class MainActivity extends AppCompatActivity { private SatelliteMenu satelliteMenu; private Button btn_set_position; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); satelliteMenu= (SatelliteMenu) findViewById(R.id.sm_menu); satelliteMenu.setOnMenuItemClickListener(new SatelliteMenu.onMenuItemClickListener() { @Override public void onItemClick(View view, int position) { Toast.makeText(MainActivity.this, view.getTag().toString(), Toast.LENGTH_SHORT).show(); } }); btn_set_position= (Button) findViewById(R.id.btn_set_position); btn_set_position.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //随机调整位置,0:左上;1:左下;2:右上;3:右下。 Random rand=new Random(); int position=rand.nextInt(4); switch (position) { case 0: satelliteMenu.setPosition(SatelliteMenu.Position.POS_LEFT_TOP); break; case 1: satelliteMenu.setPosition(SatelliteMenu.Position.POS_LEFT_BOTTOM); break; case 2: satelliteMenu.setPosition(SatelliteMenu.Position.POS_RIGHT_TOP); break; case 3: satelliteMenu.setPosition(SatelliteMenu.Position.POS_RIGHT_BOTTOM); break; } } }); } }
C++
UTF-8
253
2.9375
3
[]
no_license
#include "Card.hpp" Card::Card(const std::string& name, const std::string& effect) { this->effect = effect; this->name = name; } std::string Card::get_name()const { return this->name; } std::string Card::get_effect()const { return this->effect; }
Python
UTF-8
1,295
3.875
4
[ "MIT" ]
permissive
# Best Time to Buy and Sell Stock: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/ # You are given an array prices where prices[i] is the price of a given stock on the ith day. # You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock. # Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0. # Initial thought here is to take the lowest price if you see a lower one else check if the dif between lowest and cur is greater than max # This was correct however I didn't write the brute force which is that You can do a double for loop checking each combo class Solution: def maxProfit(self, prices: List[int]) -> int: if len(prices) <= 1: return 0 profit, lowest = 0, prices[0] for i in range(len(prices)): if prices[i] <= lowest: lowest = prices[i] else: profit = max(profit, prices[i] - lowest) return profit # Score Card # Did I need hints? N # Did you finish within 30 min? Y # Was the solution optimal? Yes this is an o(n) time and o(1) space which is optimal over brute force o(n^2) # Were there any bugs? None :D # 5 5 5 5 = 5
C++
UTF-8
3,861
2.921875
3
[]
no_license
#include "huffman.h" #include <vector> #include <algorithm> #include "outputbitstream.h" namespace { unsigned int reverse(unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); } } unsigned huffman::reverse(unsigned value, int len) { auto mask = ~((1 << len) - 1); if ((value & mask) != 0) { assert(false); } return ::reverse(value) >> (32 - len); } std::vector<int> huffman::defaultTableLengths() { std::vector<int> lengths(288); for (int i = 0; i < 288; ++i) { if (i <= 143 || i >= 280) { lengths[i] = 8; continue; } lengths[i] = i <= 255 ? 9 : 7; } return lengths; } class greater { public: bool operator()(const record a, const record b) const { return a.frequency > b.frequency; } }; static int CalculateTree(const std::vector<int>& symbolFreqs, int minFreq, std::vector<treeItem>& tree) { tree.clear(); std::vector<record> records; for (int i = 0; i < symbolFreqs.size(); ++i) { if (symbolFreqs[i] == 0) { tree.push_back({ 0, i, -1 }); continue; } int freq = std::max(minFreq, symbolFreqs[i]); tree.push_back({ freq, i, -1 }); record rec = { freq, i }; records.push_back(rec); } greater pred = greater(); make_heap(records.begin(), records.end(), pred); while (records.size() >= 2) { pop_heap(records.begin(), records.end(), pred); record a = records.back(); records.pop_back(); pop_heap(records.begin(), records.end(), pred); record b = records.back(); records.pop_back(); auto sumfreq = a.frequency + b.frequency; tree.push_back({ sumfreq, a.id, b.id }); records.push_back({ sumfreq, safecast(tree.size() - 1) }); push_heap(records.begin(), records.end(), pred); } int maxLength = 0; for (auto i = tree.size() - 1; i != 0; --i) { auto item = tree[i]; if (item.right == -1) { maxLength = std::max(maxLength, item.bits); continue; } tree[item.left].bits = item.bits + 1; tree[item.right].bits = item.bits + 1; } return maxLength; } void CalcLengths(const std::vector<int>& symbolFreqs, std::vector<int>& lengths, int maxLength) { int minFreq = 0; std::vector<treeItem> tree; tree.reserve(2 * symbolFreqs.size()); while (true) { int max = CalculateTree(symbolFreqs, minFreq, tree); if (max <= maxLength) { lengths.resize(symbolFreqs.size()); for (auto t : tree) { if (t.right != ~0) break; lengths[t.left] = t.frequency == 0 ? 0 : std::max(1,t.bits); } return; } int total = 0; for (auto n : symbolFreqs) { total += n; } minFreq += std::max(1,total / (1 << maxLength)); } } void AddRecords(std::vector<lenghtRecord>& vector, int value, int count) { if (count == 0) return; if (value == 0) { while (count >= 3) { int writeCount = std::min(count, 138); count -= writeCount; vector.push_back(lenghtRecord(writeCount < 11 ? 17 : 18, writeCount)); } } else { vector.push_back({ value, 0 }); count--; while (count >= 3) { int writeCount = std::min(count, 6); count -= writeCount; vector.push_back({ 16, writeCount }); } } for (int i = 0; i < count; ++i) { vector.push_back({ value, 0 }); } } std::vector<lenghtRecord> FromLengths(const std::vector<int> lengths, std::vector<int>& freqs) { std::vector<lenghtRecord> records; int currentValue = -1; int count = 0; for (auto n : lengths) { if (n == currentValue) { count++; continue; } AddRecords(records, currentValue, count); currentValue = n; count = 1; } AddRecords(records, currentValue, count); for (lenghtRecord element : records) { freqs[element.value]++; } return records; }
Rust
UTF-8
836
2.515625
3
[]
no_license
extern crate crypto_pals; fn main() { use crypto_pals::ops::{bin_to_base64, hexstr_to_base64}; println!("{}", bin_to_base64("Test")); println!("{}", bin_to_base64(&vec![ 0x49, 0x27, 0x6d, 0x20, 0x6b, 0x69, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x62, 0x72, 0x61, 0x69, 0x6e, 0x20, 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x61, 0x20, 0x70, 0x6f, 0x69, 0x73, 0x6f, 0x6e, 0x6f, 0x75, 0x73, 0x20, 0x6d, 0x75, 0x73, 0x68, 0x72, 0x6f, 0x6f, 0x6d,])); println!("{}", hexstr_to_base64("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d")); println!("{}", bin_to_base64("⚙️🔋❤️")); }
Java
UTF-8
502
2.578125
3
[]
no_license
package robotturtles.g45.board; import robotturtles.g45.BoardSprite; import robotturtles.g45.Sprite; public enum Void implements Sprite { VOID; private int posI; private int posJ; @Override public Integer[] getPos() { return new Integer[]{this.posI, this.posJ}; } public void setPos(int posI, int posJ) { this.posI = posI; this.posJ = posJ; } @Override public BoardSprite getSprite() { return new BoardSprite(null); } }