blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
cf8b5c82c834ff6fb02a9a2e8975ec14f3b7ca62
c1e567661854bf2b61555ec1a18d3c0e67be9fdb
/src/algorithm/sort/MusicVideo.java
adaa2d25a21f1229d5901a07e03296198648a37f
[]
no_license
daroguzo/dataStructureAndAlgorithm
de5b8c3167a6a0bc951ad2c1593dc169c04b312d
6bcaddd34c502ecf232cf24b466a2e7b01b08b0d
refs/heads/master
2022-09-13T07:50:40.455558
2022-09-04T12:10:08
2022-09-04T12:10:08
211,848,230
0
0
null
null
null
null
UTF-8
Java
false
false
1,192
java
package algorithm.sort; import java.util.Arrays; import java.util.Scanner; public class MusicVideo { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } System.out.println(new MusicVideo().solution(n, m, arr)); } private int solution(int n, int m, int[] arr) { int answer = 0; int lt = Arrays.stream(arr).max().getAsInt(); int rt = Arrays.stream(arr).sum(); while (lt <= rt) { int mid = (lt + rt) / 2; if (count(arr, mid) <= m) { answer = mid; rt = mid - 1; } else { lt = mid + 1; } } return answer; } private int count(int[] arr, int capacity) { int cnt = 1, sum = 0; for (int i : arr) { if (sum + i > capacity) { cnt++; sum = i; } else { sum += i; } } return cnt; } }
[ "kjw2122@naver.com" ]
kjw2122@naver.com
15c3abca8fd736e52cdceeb213ff6ebbe5019128
0e2673f6fc468886f319c01fa9d2373e43050521
/src/com/jda/Algorithms/Nibble.java
7944e97e71bd5fe37cfd75e8544b6c14ffc3c80b
[]
no_license
vinaysowmya/BasicJavaPrograms
2207ffdf7088778aca8ea2d50a51d971edc2f81f
16773332edaf6f7cc2833e92d049506164db4384
refs/heads/master
2020-03-22T07:31:33.862491
2018-07-16T10:34:59
2018-07-16T10:34:59
139,705,989
0
0
null
2018-07-24T06:10:11
2018-07-04T10:18:37
Java
UTF-8
Java
false
false
474
java
package com.jda.Algorithms; import com.jda.utility.utility; public class Nibble { public static void main(String args[]) { utility util=new utility(); System.out.println("Enter the number"); int num=util.inputInteger(); int value=util.nibble(num); System.out.println(value); boolean rslt=util.powOfTwo(value); if(rslt) { System.out.println("Result is a power of two"); } else { System.out.println("Result is not a power of two"); } } }
[ "Sowmya.Saragadam@jda.com" ]
Sowmya.Saragadam@jda.com
fa5707ee8c5b6becfadfd93f7398f4b903db978d
13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3
/crash-reproduction-new-fitness/results/LANG-35b-1-24-Single_Objective_GGA-IntegrationSingleObjective-/org/apache/commons/lang3/time/DateUtils_ESTest_scaffolding.java
0d9115e9a62a002014e0a447cb99b663df6020cf
[ "MIT", "CC-BY-4.0" ]
permissive
STAMP-project/Botsing-basic-block-coverage-application
6c1095c6be945adc0be2b63bbec44f0014972793
80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da
refs/heads/master
2022-07-28T23:05:55.253779
2022-04-20T13:54:11
2022-04-20T13:54:11
285,771,370
0
0
null
null
null
null
UTF-8
Java
false
false
1,989
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Mon May 18 01:58:11 UTC 2020 */ package org.apache.commons.lang3.time; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class DateUtils_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.lang3.time.DateUtils"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(DateUtils_ESTest_scaffolding.class.getClassLoader() , "org.apache.commons.lang3.time.DateUtils$DateIterator", "org.apache.commons.lang3.time.DateUtils" ); } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
bfa717297f7cd22aac1b11afc2b1580b13358966
ab0cecfd6e447b0e2516370a7c2b18a3a127e1e3
/DebateAppWEB/src/data/IssCatDAO.java
eb8241c938e3c7b0a877e7473161d5333d2e233e
[]
no_license
Teratopia/DebateApp
755339569a5b3afd747e0a729a97c1d795818de2
5f40eb621531f43019415a52400a2c5b74451184
refs/heads/master
2021-01-11T23:08:16.999813
2017-03-07T01:13:14
2017-03-07T01:13:14
78,551,232
0
0
null
2017-02-10T02:17:20
2017-01-10T16:21:22
JavaScript
UTF-8
Java
false
false
1,931
java
package data; import java.util.Collection; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.springframework.transaction.annotation.Transactional; import com.fasterxml.jackson.databind.ObjectMapper; import entities.IssCat; public class IssCatDAO implements IssCatDAOI { @PersistenceContext EntityManager em; @Override public Collection<IssCat> index() { String query = "select t from IssCat t where t.id > 0"; Collection<IssCat> IssCats = em.createQuery(query, IssCat.class).getResultList(); return IssCats; } @Override public IssCat show(int id) { IssCat IssCat = em.find(IssCat.class, id); return IssCat; } @Override @Transactional public IssCat update(int id, String IssCatJson) { ObjectMapper mapper = new ObjectMapper(); IssCat updateIssCat = null; try { updateIssCat = mapper.readValue(IssCatJson, IssCat.class); } catch (Exception e) { System.out.println(e); } IssCat oldIssCat = em.find(IssCat.class, id); oldIssCat.setCategory(updateIssCat.getCategory()); oldIssCat.setIssue(updateIssCat.getIssue()); em.flush(); return em.find(IssCat.class, id); } @Override @Transactional public IssCat create(String catJson) { ObjectMapper mapper = new ObjectMapper(); IssCat newIssCat = null; try { newIssCat = mapper.readValue(catJson, IssCat.class); } catch (Exception e) { System.out.println(e); } em.persist(newIssCat); em.flush(); String query = "select i from IssCat i where i.id=(select max(id) from IssCat)"; newIssCat = em.createQuery(query, IssCat.class).getSingleResult(); return newIssCat; } @Override @Transactional public IssCat destroy(int id) { IssCat deleteIssCat = em.find(IssCat.class, id); try { em.remove(deleteIssCat); em.flush(); return deleteIssCat; } catch (IllegalArgumentException iae) { iae.printStackTrace(); return null; } } }
[ "kylewoodennis@gmail.com" ]
kylewoodennis@gmail.com
7c82c54257a9f747a5560c3c6452e1fa12aa7048
fd9c4b739baca62ad77c7139b24c6cef3ed57ba1
/src/main/java/io/spring/movieportal/model/user/UserStatus.java
8855966fc2f7e5b1f91161d1e671e9f6b7e74237
[]
no_license
mihairatiu/spring-movie-portal
bb11d42921f2283b8e3655dd8f6d2fe39c3d10f4
28eef390c5dcbd645d28f0e73e4d70443f810317
refs/heads/master
2021-01-14T13:57:27.099475
2015-07-14T07:01:38
2015-07-14T07:01:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
259
java
package io.spring.movieportal.model.user; public enum UserStatus { regular(0), registered(1), unknown(-1); private int code; UserStatus(int code) { this.code = code; } public int code() { return code; } }
[ "mihai.g.ratiu@gmail.com" ]
mihai.g.ratiu@gmail.com
2c3a0a656641f2c0ca15b0a7422fc641efcc226e
dff07fc0e2542c367ff3cc34c149aed582121d90
/src/com/company/lesson10/tools/Drum.java
48f895b0ecd1d11b8ba0d47489d283cf2a5aa713
[]
no_license
vladddooonnn96/vladddooonnn
e6e833a0d102882634783e4515b5730ca5da712d
e8f95f023fa27e18df2d44ae16e6727572a1cb14
refs/heads/master
2021-04-29T17:33:12.308962
2018-03-19T15:02:58
2018-03-19T15:02:58
121,659,888
0
0
null
null
null
null
UTF-8
Java
false
false
929
java
package com.company.lesson10.tools; import java.util.Objects; public class Drum implements Tool { private double size; public Drum(double size) { this.size = size; } public double getSize() { return size; } public void setSize(double size) { this.size = size; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Drum drum = (Drum) o; return Double.compare(drum.size, size) == 0; } @Override public int hashCode() { return Objects.hash(size); } @Override public String toString() { return "Drum{" + "size=" + size + '}'; } public void play(){ System.out.println("Играет барабан с такими характеристиками: " + size); } }
[ "madara110@mail.ru" ]
madara110@mail.ru
44ebbcf128b4cd515dbbeccbc2b874fda3b129a2
2d8bf23b8c1f93c4aa049400704b6e2ae745f28b
/src/Additionals.java
9d70e7f280510dc4dd72a842baba5b86e1ff800e
[ "BSD-2-Clause" ]
permissive
bablushaw23/StringCalculator
21bee6a1006c3ae73b4cd33b8d447bbe8e4269b7
f9f12a597efb94b86cf513427cafce142d0c51f1
refs/heads/master
2020-04-13T08:55:11.623208
2018-12-25T16:19:48
2018-12-25T16:19:48
163,096,004
0
0
null
null
null
null
UTF-8
Java
false
false
2,175
java
import java.text.DecimalFormat; public class Additionals { public String replacePartOfString(int startingIndex, int endingIndex, String dataToReplace, String data) throws Exception { String newData = ""; String rightPart = ""; String leftPart = data.substring(0, startingIndex); if (data.substring(endingIndex + 1).length() > 0) { rightPart = data.substring(endingIndex + 1); } newData = String.valueOf(leftPart) + dataToReplace + rightPart; return newData; } public String calculatorFormat(Double data) throws Exception { DecimalFormat f = new DecimalFormat(); if (data >= 1.0E7 || data <= -1.0E7) { f = new DecimalFormat("##.####E0"); return data.toString(); } f = new DecimalFormat("0.####"); return data.toString(); } public char[] invalidVarSet() { //used to ensure that char used in variable might not get matched with any of char in function int[] frequency = new int[26]; frequency[15] = 1; frequency[2] = 1; Name name = new Name(); String funcName = ""; funcName = String.valueOf(funcName) + name.sin(); funcName = String.valueOf(funcName) + name.cos(); funcName = String.valueOf(funcName) + name.tan(); funcName = String.valueOf(funcName) + name.cosec(); funcName = String.valueOf(funcName) + name.sec(); funcName = String.valueOf(funcName) + name.cot(); funcName = String.valueOf(funcName) + name.ln(); funcName = String.valueOf(funcName) + name.log(); char[] arrc = funcName.toCharArray(); int n = arrc.length; int n2 = 0; while (n2 < n) { char i = arrc[n2]; int[] arrn = frequency; int n3 = i - 97; arrn[n3] = arrn[n3] + 1; ++n2; } char[] charSet = new char[26]; int index = -1; int i = 0; while (i < 26) { if (frequency[i] != 0) { charSet[++index] = (char)(i + 97); } ++i; } return charSet; } }
[ "bablushaw23@github.com" ]
bablushaw23@github.com
5b83cb1ab283f57dff08ae4bbf514aa46f6408c2
05cf0c027427fd3c4091746f0176915950c7db92
/Module_main/vehicleslibrary/src/main/java/com/mbcq/vehicleslibrary/fragment/trunkdeparture/TrunkDepartureBean.java
22a88da01ed2b3ad30d957d4b223230a664e8f30
[]
no_license
surpreme/ChuanQiLians
5da2d7a8da0b1a7326f6174af28fcd8c6d92bc19
6ebd27e20840da52fd201c03f4be66da56f7696d
refs/heads/master
2023-02-13T00:25:30.947783
2021-01-14T10:07:18
2021-01-14T10:07:18
288,069,965
0
1
null
null
null
null
UTF-8
Java
false
false
11,608
java
package com.mbcq.vehicleslibrary.fragment.trunkdeparture; public class TrunkDepartureBean { /** * id : 289 * vehicleState : 1 * vehicleStateStr : 发货 * companyId : 2001 * ecompanyId : 2001 * inoneVehicleFlag : DB1003-20201221-003 * contractNo : DB1003-20201221-003 * sendOpeMan : lzy * arriOpeMan : * webidCode : 1003 * webidCodeStr : 汕头 * ewebidCode : 1004 * ewebidCodeStr : 潮州彩塘 * vehicleNo : 浙G12370 * chauffer : 张凯 * chaufferMb : 16276665366 * transneed : 1 * transneedStr : 普运 * sendDate : 2020-12-21T09:19:55 * arrivedDate : 1900-01-01T00:00:00 * accNow : 0.0 * accBack : 0.0 * accYk : 0.0 * ykCard : * ewebidCode1 : 0 * ewebidCodeStr1 : * accArrived1 : 0.0 * ewebidCode2 : 0 * ewebidCodeStr2 : * accArrived2 : 0.0 * ewebidCode3 : 0 * ewebidCodeStr3 : * accArrived3 : 0.0 * accZx : 0.0 * accJh : 0.0 * accArrSum : 0.0 * accTansSum : 0.0 * accOther : 0.0 * vehicleInterval : 汕头-潮州彩塘 * remark : * fromType : 3 * fromTypeStr : 安卓APP * isScan : 2 * scanPercentage : 0.0 * ps : 1 * weight : null * volumn : null * yf : 0.0 * accdache : 0.0 * accSum : null * sfWeight : null * accwz : null */ private int id; private int vehicleState; private String vehicleStateStr; private int companyId; private int ecompanyId; private String inoneVehicleFlag; private String contractNo; private String sendOpeMan; private String arriOpeMan; private int webidCode; private String webidCodeStr; private int ewebidCode; private String ewebidCodeStr; private String vehicleNo; private String chauffer; private String chaufferMb; private int transneed; private String transneedStr; private String sendDate; private String arrivedDate; private double accNow; private double accBack; private double accYk; private String ykCard; private int ewebidCode1; private String ewebidCodeStr1; private double accArrived1; private int ewebidCode2; private String ewebidCodeStr2; private double accArrived2; private int ewebidCode3; private String ewebidCodeStr3; private double accArrived3; private double accZx; private double accJh; private double accArrSum; private double accTansSum; private double accOther; private String vehicleInterval; private String remark; private int fromType; private String fromTypeStr; private int isScan; private double scanPercentage; private int ps; private String weight; private String volumn; private double yf; private double accdache; private String accSum; private String sfWeight; private String accwz; private boolean isChecked; private boolean isLookInfo; public boolean isLookInfo() { return isLookInfo; } public void setLookInfo(boolean lookInfo) { isLookInfo = lookInfo; } public boolean isChecked() { return isChecked; } public void setChecked(boolean checked) { isChecked = checked; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getVehicleState() { return vehicleState; } public void setVehicleState(int vehicleState) { this.vehicleState = vehicleState; } public String getVehicleStateStr() { return vehicleStateStr; } public void setVehicleStateStr(String vehicleStateStr) { this.vehicleStateStr = vehicleStateStr; } public int getCompanyId() { return companyId; } public void setCompanyId(int companyId) { this.companyId = companyId; } public int getEcompanyId() { return ecompanyId; } public void setEcompanyId(int ecompanyId) { this.ecompanyId = ecompanyId; } public String getInoneVehicleFlag() { return inoneVehicleFlag; } public void setInoneVehicleFlag(String inoneVehicleFlag) { this.inoneVehicleFlag = inoneVehicleFlag; } public String getContractNo() { return contractNo; } public void setContractNo(String contractNo) { this.contractNo = contractNo; } public String getSendOpeMan() { return sendOpeMan; } public void setSendOpeMan(String sendOpeMan) { this.sendOpeMan = sendOpeMan; } public String getArriOpeMan() { return arriOpeMan; } public void setArriOpeMan(String arriOpeMan) { this.arriOpeMan = arriOpeMan; } public int getWebidCode() { return webidCode; } public void setWebidCode(int webidCode) { this.webidCode = webidCode; } public String getWebidCodeStr() { return webidCodeStr; } public void setWebidCodeStr(String webidCodeStr) { this.webidCodeStr = webidCodeStr; } public int getEwebidCode() { return ewebidCode; } public void setEwebidCode(int ewebidCode) { this.ewebidCode = ewebidCode; } public String getEwebidCodeStr() { return ewebidCodeStr; } public void setEwebidCodeStr(String ewebidCodeStr) { this.ewebidCodeStr = ewebidCodeStr; } public String getVehicleNo() { return vehicleNo; } public void setVehicleNo(String vehicleNo) { this.vehicleNo = vehicleNo; } public String getChauffer() { return chauffer; } public void setChauffer(String chauffer) { this.chauffer = chauffer; } public String getChaufferMb() { return chaufferMb; } public void setChaufferMb(String chaufferMb) { this.chaufferMb = chaufferMb; } public int getTransneed() { return transneed; } public void setTransneed(int transneed) { this.transneed = transneed; } public String getTransneedStr() { return transneedStr; } public void setTransneedStr(String transneedStr) { this.transneedStr = transneedStr; } public String getSendDate() { return sendDate; } public void setSendDate(String sendDate) { this.sendDate = sendDate; } public String getArrivedDate() { return arrivedDate; } public void setArrivedDate(String arrivedDate) { this.arrivedDate = arrivedDate; } public double getAccNow() { return accNow; } public void setAccNow(double accNow) { this.accNow = accNow; } public double getAccBack() { return accBack; } public void setAccBack(double accBack) { this.accBack = accBack; } public double getAccYk() { return accYk; } public void setAccYk(double accYk) { this.accYk = accYk; } public String getYkCard() { return ykCard; } public void setYkCard(String ykCard) { this.ykCard = ykCard; } public int getEwebidCode1() { return ewebidCode1; } public void setEwebidCode1(int ewebidCode1) { this.ewebidCode1 = ewebidCode1; } public String getEwebidCodeStr1() { return ewebidCodeStr1; } public void setEwebidCodeStr1(String ewebidCodeStr1) { this.ewebidCodeStr1 = ewebidCodeStr1; } public double getAccArrived1() { return accArrived1; } public void setAccArrived1(double accArrived1) { this.accArrived1 = accArrived1; } public int getEwebidCode2() { return ewebidCode2; } public void setEwebidCode2(int ewebidCode2) { this.ewebidCode2 = ewebidCode2; } public String getEwebidCodeStr2() { return ewebidCodeStr2; } public void setEwebidCodeStr2(String ewebidCodeStr2) { this.ewebidCodeStr2 = ewebidCodeStr2; } public double getAccArrived2() { return accArrived2; } public void setAccArrived2(double accArrived2) { this.accArrived2 = accArrived2; } public int getEwebidCode3() { return ewebidCode3; } public void setEwebidCode3(int ewebidCode3) { this.ewebidCode3 = ewebidCode3; } public String getEwebidCodeStr3() { return ewebidCodeStr3; } public void setEwebidCodeStr3(String ewebidCodeStr3) { this.ewebidCodeStr3 = ewebidCodeStr3; } public double getAccArrived3() { return accArrived3; } public void setAccArrived3(double accArrived3) { this.accArrived3 = accArrived3; } public double getAccZx() { return accZx; } public void setAccZx(double accZx) { this.accZx = accZx; } public double getAccJh() { return accJh; } public void setAccJh(double accJh) { this.accJh = accJh; } public double getAccArrSum() { return accArrSum; } public void setAccArrSum(double accArrSum) { this.accArrSum = accArrSum; } public double getAccTansSum() { return accTansSum; } public void setAccTansSum(double accTansSum) { this.accTansSum = accTansSum; } public double getAccOther() { return accOther; } public void setAccOther(double accOther) { this.accOther = accOther; } public String getVehicleInterval() { return vehicleInterval; } public void setVehicleInterval(String vehicleInterval) { this.vehicleInterval = vehicleInterval; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public int getFromType() { return fromType; } public void setFromType(int fromType) { this.fromType = fromType; } public String getFromTypeStr() { return fromTypeStr; } public void setFromTypeStr(String fromTypeStr) { this.fromTypeStr = fromTypeStr; } public int getIsScan() { return isScan; } public void setIsScan(int isScan) { this.isScan = isScan; } public double getScanPercentage() { return scanPercentage; } public void setScanPercentage(double scanPercentage) { this.scanPercentage = scanPercentage; } public int getPs() { return ps; } public void setPs(int ps) { this.ps = ps; } public String getWeight() { return weight; } public void setWeight(String weight) { this.weight = weight; } public String getVolumn() { return volumn; } public void setVolumn(String volumn) { this.volumn = volumn; } public double getYf() { return yf; } public void setYf(double yf) { this.yf = yf; } public double getAccdache() { return accdache; } public void setAccdache(double accdache) { this.accdache = accdache; } public String getAccSum() { return accSum; } public void setAccSum(String accSum) { this.accSum = accSum; } public String getSfWeight() { return sfWeight; } public void setSfWeight(String sfWeight) { this.sfWeight = sfWeight; } public String getAccwz() { return accwz; } public void setAccwz(String accwz) { this.accwz = accwz; } }
[ "1740747328@.com" ]
1740747328@.com
baef796465b10b7e98b9b977ebd7c2a028b11ae2
3fbd667a4b1fb85ac4ab54d845eb9fe9ef5d6cef
/mskl-facade/mskl-dao/src/main/java/com/mskl/dao/model/MsklPromotionInfo.java
4bf55a5e80d96eeebfd2e46b8f1eefaa4e19098f
[]
no_license
ivivisoft/mskl
05e21d99478c7b87c102751d1d5cb947e4731334
ead6b47495c18a645a4f9f1dcc8b7d05cb4a5062
refs/heads/master
2021-01-10T10:27:28.033716
2016-04-15T09:32:34
2016-04-15T09:32:34
54,645,217
0
1
null
2016-04-06T03:09:18
2016-03-24T13:47:46
Java
UTF-8
Java
false
false
2,017
java
package com.mskl.dao.model; import java.util.Date; public class MsklPromotionInfo { private Long id; private String promotionName; private String infoChannel; private String infoTitle; private String bannerUrl; private String contentUrl; private Short sort; private Date createDatetime; private String infoContent; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getPromotionName() { return promotionName; } public void setPromotionName(String promotionName) { this.promotionName = promotionName == null ? null : promotionName.trim(); } public String getInfoChannel() { return infoChannel; } public void setInfoChannel(String infoChannel) { this.infoChannel = infoChannel == null ? null : infoChannel.trim(); } public String getInfoTitle() { return infoTitle; } public void setInfoTitle(String infoTitle) { this.infoTitle = infoTitle == null ? null : infoTitle.trim(); } public String getBannerUrl() { return bannerUrl; } public void setBannerUrl(String bannerUrl) { this.bannerUrl = bannerUrl == null ? null : bannerUrl.trim(); } public String getContentUrl() { return contentUrl; } public void setContentUrl(String contentUrl) { this.contentUrl = contentUrl == null ? null : contentUrl.trim(); } public Short getSort() { return sort; } public void setSort(Short sort) { this.sort = sort; } public Date getCreateDatetime() { return createDatetime; } public void setCreateDatetime(Date createDatetime) { this.createDatetime = createDatetime; } public String getInfoContent() { return infoContent; } public void setInfoContent(String infoContent) { this.infoContent = infoContent == null ? null : infoContent.trim(); } }
[ "yangxu@jinlianchu.com" ]
yangxu@jinlianchu.com
1c42e7efdc05bf9988feab46d009261ebf54ee60
93ac298897fb0b8df30882028254e48857684217
/lecture/src/jdbc1/StudentDAO3.java
5d2d4f752be76e01bc31c6afea07052c3c3b1c5f
[]
no_license
KimJye/jsp_practice
976361f908bc06691f02fcc408a7009f782fc294
8e9b871b9d4d817a99bb6e2737cdbfd5e58ba8e4
refs/heads/master
2021-04-06T19:25:24.423360
2018-11-07T04:08:13
2018-11-07T04:08:13
124,510,993
0
0
null
null
null
null
UTF-8
Java
false
false
2,966
java
package jdbc1; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class StudentDAO3 { public static Student createStudent(ResultSet resultSet) throws SQLException{ Student student = new Student(); student.setId(resultSet.getInt("id")); student.setStudentNumber(resultSet.getString("studentNumber")); student.setName(resultSet.getString("name")); student.setDepartmentId(resultSet.getInt("departmentId")); student.setYear(resultSet.getInt("year")); student.setDepartmentName(resultSet.getString("departmentName")); return student; } public static List<Student> findAll() throws Exception {//리턴타입이 List 타입인데 이렇게 가급적 부모타입으로 적어주는것이 좋다. 이유는 다형성때문. 다형성 구현할때는 1. 부모클래스나 인터페이스가 있어야 한다. 2. 자식이 부모 메소드를 재정의(오버라이딩)해야한다. 3. 부모타입의 변수로 메소드를 호출해야 다형성 호출이다. String sql = "SELECT s.*, d.departmentName " + "FROM student s LEFT JOIN department d ON s.departmentId = d.id"; //d.departmentName 이후 반드시 공백을 써준다. 안써주면 쿼리문 에러난다. try (Connection connection = DB.getConnection("student1"); PreparedStatement statement = connection.prepareStatement(sql); ResultSet resultSet = statement.executeQuery()) { ArrayList<Student> list = new ArrayList<Student>(); while (resultSet.next()) list.add(createStudent(resultSet)); return list; } } public static List<Student> findByName(String name) throws Exception{ String sql = "SELECT s.*, d.departmentName " + "FROM student s LEFT JOIN department d ON s.departmentId = d.id " + //d.departmentName 이후 반드시 공백을 써준다. 안써주면 쿼리문 에러난다. "WHERE s.name LIKE ?"; try (Connection connection = DB.getConnection("student1"); PreparedStatement statement = connection.prepareStatement(sql)){ statement.setString(1,name + "%"); try(ResultSet resultSet = statement.executeQuery()){ ArrayList<Student> list = new ArrayList<Student>(); while (resultSet.next()) { list.add(createStudent(resultSet)); } return list; } } } public static List<Student> findByDepartmentId(int departmentId) throws Exception{ String sql = "SELECT s.*, d.departmentName " + "FROM student s LEFT JOIN department d ON s.departmentId = d.id " + "WHERE s.departmentId = ?"; try(Connection connection = DB.getConnection("student1"); PreparedStatement statement = connection.prepareStatement(sql)){ statement.setInt(1, departmentId); try(ResultSet resultSet = statement.executeQuery()){ ArrayList<Student> list = new ArrayList<Student>(); while(resultSet.next()) list.add(createStudent(resultSet)); return list; } } } }
[ "eoeogudgud@naver.com" ]
eoeogudgud@naver.com
4990cd9e25e04d2b9361520ad68b9062c0ef272f
295cce6b04479d313eb3a7ef4f294a812a949441
/Algorithmie et Complexité/TP1/AC_tp1_donnees/Tri.java
4d51e3a4e6f4dac6a64bf434406adafb44d3bd72
[]
no_license
Starbeuck/ESIR1
fa204c6f065ac62c133f508b600324579ba60f61
9d39d75770ad6ee7a31d5a11736b31df42be836f
refs/heads/master
2020-05-25T22:54:35.662881
2017-06-26T19:49:10
2017-06-26T19:49:10
93,241,530
0
1
null
null
null
null
ISO-8859-1
Java
false
false
1,765
java
public class Tri { /*Tri le tableau t via la méthode "Tri par insertion" * cf TD1 exo 2 */ public static void triInsertion(int[] t){ //A FAIRE } /*Tri le tableau t via la méthode "Tri fusion" * cf TD2 exo 5 */ public static void triFusion(int[] t){ if (t.length>0) triFusion(t, 0, t.length-1); } /* Sous-fonction (récursive) pour le tri fusion * Trie le sous-tableau t[debut]..t[fin] */ private static void triFusion(int[] t, int debut, int fin){ //A FAIRE } /* Sous-fonction pour le tri fusion * Suppose que, dans le tableau t, * les 2 sous-tableaux t[deb1]..t[fin1] et t[fin1+1]..[t[fin2] sont déjà triés * Fusionne ces 2 sous-tableaux pour que le sous-tableau t[deb1]..t[fin2] soit trié */ private static void fusionner(int[] t, int deb1, int fin1, int fin2){ int deb2 = fin1+1; //on recopie les éléments du début du tableau int[] t1 = new int[fin1-deb1+1]; for(int i=deb1;i<=fin1;i++){ t1[i-deb1]=t[i]; } int compt1=deb1; int compt2=deb2; for(int i=deb1;i<=fin2;i++){ if (compt1==deb2) //c'est que tous les éléments du premier tableau ont été utilisés break; //tous les éléments ont donc été classés else if (compt2==(fin2+1)){ //c'est que tous les éléments du second tableau ont été utilisés t[i]=t1[compt1-deb1]; //on ajoute les éléments restants du premier tableau compt1++; } else if (t1[compt1-deb1]<t[compt2]){ t[i]=t1[compt1-deb1]; //on ajoute un élément du premier tableau compt1++; } else{ t[i]=t[compt2]; //on ajoute un élément du second tableau compt2++; } } } }
[ "keroullasolenn@gmail.com" ]
keroullasolenn@gmail.com
3df443f9505bc1e5074bdbed1a57197817523b80
f378ddd47c8b7de6e9cf1d4228c84f73e9dc59f1
/projetos/LearnEnglishApp/src/program/SoundEngine.java
3920ab891249adcac345fc88784c6e8582b8873e
[]
no_license
charles-marques/dataset-375
29e2f99ac1ba323f8cb78bf80107963fc180487c
51583daaf58d5669c69d8208b8c4ed4e009001a5
refs/heads/master
2023-01-20T07:23:09.445693
2020-11-27T22:35:49
2020-11-27T22:35:49
283,315,149
0
1
null
null
null
null
UTF-8
Java
false
false
1,161
java
/* * SoundEngine.java 1.1 2012/6/1 * * Copyright (c) 2012 Northeastern University Software Engineering College * Software International 1001 Group Three * * All rights reserved. */ package program; import java.io.BufferedInputStream; import java.io.FileInputStream; import javazoom.jl.player.Player; /** * A class uses to play sound according to the audio file name. * * @author Eric * @version 1.1 */ public class SoundEngine { /** * lay sound according to the audio file name * * @param filename the audio file name. */ public static void playSound(String filename) { Player player = null; try { FileInputStream fis = new FileInputStream("sounds/" + filename + ".mp3"); BufferedInputStream bis = new BufferedInputStream(fis); player = new Player(bis); } catch (Exception e) { System.out.println("Problem playing file " + filename); System.out.println(e); } final Player soundPlayer = player; // run in new thread to play in background new Thread() { public void run() { try { soundPlayer.play(); } catch (Exception e) { System.out.println(e); } } }.start(); } }
[ "suporte@localhost.localdomain" ]
suporte@localhost.localdomain
601c60543abb23ae6a528a4acdc99758ad76089f
2a787fecf28d7eb23cde07896ccf148cecfda830
/app/src/main/java/citycircle/com/Adapter/Camadapter.java
db171276f3ea667000fa3d8ab81a3ea1379ab9b1
[]
no_license
643063150/CityCircle
fe2b5683d828ea402fb45a0de204bdccb45a556b
b1cde0ccb481e0a5e18a28486e417e5086cafe65
refs/heads/master
2020-12-24T07:43:24.221453
2016-10-27T06:16:22
2016-10-27T06:16:22
50,401,339
0
0
null
null
null
null
UTF-8
Java
false
false
3,663
java
package citycircle.com.Adapter; import android.content.Context; import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; import com.nostra13.universalimageloader.core.listener.ImageLoadingListener; import java.util.ArrayList; import java.util.HashMap; import citycircle.com.R; import citycircle.com.Utils.DateUtils; import citycircle.com.Utils.ImageUtils; /** * Created by admins on 2016/6/14. */ public class Camadapter extends BaseAdapter { ArrayList<HashMap<String, String>> arrayList; Context context; com.nostra13.universalimageloader.core.ImageLoader ImageLoader; DisplayImageOptions options; citycircle.com.Utils.ImageUtils ImageUtils; ImageLoadingListener animateFirstListener; ArrayList<HashMap<String, String>> list; public Camadapter(ArrayList<HashMap<String, String>> arrayList, Context context,ArrayList<HashMap<String, String>> list) { this.arrayList = arrayList; this.context = context; this.list = list; ImageUtils = new ImageUtils(); ImageLoader = ImageLoader.getInstance(); ImageLoader.init(ImageLoaderConfiguration.createDefault(context)); animateFirstListener = new ImageUtils.AnimateFirstDisplayListener(); } @Override public int getCount() { return arrayList.size(); } @Override public Object getItem(int position) { return arrayList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { getitem getitem=new getitem(); convertView= LayoutInflater.from(context).inflate(R.layout.cam_item,null); getitem.title=(TextView)convertView.findViewById(R.id.title); getitem.time=(TextView)convertView.findViewById(R.id.time); getitem.banner=(ImageView) convertView.findViewById(R.id.banner); getitem.statimg=(ImageView) convertView.findViewById(R.id.statimg); if (!setlist(position)) { getitem.title.setTextColor(Color.parseColor("#8e8e8e")); } getitem.title.setText(arrayList.get(position).get("title")); String sTime=DateUtils.getDateToString(Long.parseLong(arrayList.get(position).get("s_time"))); String eTime=DateUtils.getDateToString(Long.parseLong(arrayList.get(position).get("e_time"))); getitem.time.setText("活动时间:"+sTime+"-"+eTime); options=ImageUtils.setcenterOptions(); String url=arrayList.get(position).get("url"); ImageLoader.displayImage(url,getitem.banner,options,animateFirstListener); long time=System.currentTimeMillis(); if (time>Long.parseLong(arrayList.get(position).get("e_time"))){ getitem.statimg.setImageResource(R.mipmap.indexstateing); }else { getitem.statimg.setImageResource(R.mipmap.indexstateend); } return convertView; } private class getitem{ TextView title,time; ImageView banner,statimg; } private boolean setlist(int position) { boolean a = true; for (int i = 0; i < list.size(); i++) { if (list.get(i).get("id").equals(arrayList.get(position).get("id"))) { a = false; return a; } } return a; } }
[ "643063150@qq.com" ]
643063150@qq.com
a4d989df589e5e1d62a896e9d8d843e521ffdf64
9585e5bc766340e79f719dd99bbe600f0dff2fec
/week08/Animal/src/AnimalMain.java
9351a7670ab039dede33accd78100f0431d66445
[]
no_license
green-fox-academy/szutsj
5e2a1aa8b5c371d2e762270ffdc6071e7fc32e19
59843c328881a394aced973bb7214681be65ea3a
refs/heads/master
2020-04-04T06:55:09.575527
2019-05-05T20:50:29
2019-05-05T20:50:29
155,761,729
0
2
null
null
null
null
UTF-8
Java
false
false
464
java
public class AnimalMain { public static void main(String[] args) { Animal cat = new Animal(); Animal dog = new Animal(); Animal bird = new Animal(); System.out.println(cat.toString()); System.out.println(dog.toString()); System.out.println(bird.toString()); cat.drink(); dog.eat(); bird.play(); System.out.println(cat.toString()); System.out.println(dog.toString()); System.out.println(bird.toString()); } }
[ "judit.szuts.mob@gmail.com" ]
judit.szuts.mob@gmail.com
8195da99594ab8715da42308758a1eea9451fb87
63b308d7fa8e5920a208f61505d6ae6dd5eda6b1
/src/main/java/com/example/generator/StateFlat.java
962869de80241dd7857cc148cf2c1ad4a3e00449
[]
no_license
Arsenii020194/demo
8c1bf99323814b2503429d1f3f3e160ca2eed53f
32bd2e4ff96b335c86f98bb3c9444f2029a32b7a
refs/heads/master
2021-06-08T13:27:22.153413
2016-11-20T02:22:36
2016-11-20T02:22:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,082
java
package com.example.generator; import java.io.IOException; import java.util.Random; import com.example.DemoApplication; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; /** * Class for generation random state of flat. */ @RestController public class StateFlat { /** * Generates random state of the flat. * @return String random state of the flat. */ @RequestMapping("/stateFlat") public String stateFlat () { Random random = new Random(); String [] states ={"отличное","хорошее", "удовлетворительное", "неудовлетворительное"}; int k=random.nextInt(states.length); String str = states[k]; try { DemoApplication.out.write((str+"-/stateFlat"+"\n").getBytes()); DemoApplication.out.flush(); } catch (IOException ex) { ex.printStackTrace(); } return str; } }
[ "arsenii.kuteinitsyn@gmail.com" ]
arsenii.kuteinitsyn@gmail.com
5f476d787ad09c0999679ed5d72d9ceeb6ab4550
bff1e5c051b2210fd988931131c754eb687ce0dd
/loadbeans/src/main/java/com/mine/api/impl/TestConstructorInject.java
20d6d620a2e90b103ca124e01beeafaf078ee0c0
[]
no_license
s-nail/spring-learning
a0fd9d19887a9a8c7f7adc43c302419ea6a43922
1c3e5c86ee62bb0346f2cd6c9511bf0d65c1038e
refs/heads/master
2022-07-15T05:08:22.507010
2021-01-04T08:58:08
2021-01-04T08:58:08
184,968,210
0
0
null
2022-06-17T02:48:27
2019-05-05T02:29:54
Java
UTF-8
Java
false
false
703
java
package com.mine.api.impl; public class TestConstructorInject { private String name; private Integer age; /** * <constructor-arg name="name" value="zhangsan"/> * @param name */ public TestConstructorInject(String name) { super(); this.name = name; System.out.println("name=" + name); } /** * <constructor-arg name="name" value="zhangsan"/> * <constructor-arg name="age" value="22"/> * @param name * @param age */ public TestConstructorInject(String name, Integer age) { super(); this.name = name; this.age = age; System.out.println("name=" + name + ",age=" + age); } }
[ "1945227880@qq.com" ]
1945227880@qq.com
97db254c8a8ab8f016f23bf671b6450fc165f78c
ad6746706a47f697c30bdbdd82e87c0f3b9ab21b
/LoginFx/src/sample/BarChartController.java
d89bf7c5127c07e6f6c3e9fa01b47ccab46efb65
[]
no_license
connorbridle/predicting-nutritional-value
bb1b96b9a83a060403b483f1fe18f175e87297a4
3b43b58c958593b3c9132ef6d5174327c8a3c9a5
refs/heads/master
2020-03-23T16:36:19.907411
2018-07-21T14:41:43
2018-07-21T14:41:43
141,819,583
0
0
null
null
null
null
UTF-8
Java
false
false
4,140
java
package sample; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.chart.BarChart; import javafx.scene.chart.CategoryAxis; import javafx.scene.chart.NumberAxis; import javafx.scene.chart.XYChart; import javafx.scene.input.MouseEvent; import javafx.scene.layout.VBox; import javafx.stage.Stage; import java.io.IOException; import java.net.URL; import java.util.List; import java.util.ResourceBundle; public class BarChartController { @FXML VBox myBox; private static String macroInput = ""; private static double RDAInput = 0.0; private static double actualInput = 0.0; private static int testing; private static List<String> outputRDA; //Storing things to pass back private static FoodItem outputFooditem; private static DecisionObject outputDecision; private static ProfileObject outputProfile; public void takeData(List<String> rdaRow, FoodItem food, ProfileObject profile, DecisionObject decision, int macroIndex) { outputFooditem = food; outputProfile = profile; outputDecision = decision; outputRDA = rdaRow; RDAInput = Double.parseDouble(outputRDA.get(macroIndex)); testing = macroIndex-1; //Deciding which macro switch (testing) { case 0: actualInput = outputFooditem.getItemCals(); break; case 1: actualInput = outputFooditem.getItemFat(); break; case 2: actualInput = outputFooditem.getItemSatFat(); break; case 3: actualInput = outputFooditem.getItemCarbs(); break; case 4: actualInput = outputFooditem.getItemSugar(); break; case 5: actualInput = outputFooditem.getItemFibre(); break; case 6: actualInput = outputFooditem.getItemProtein(); break; case 7: actualInput = outputFooditem.getItemSodium(); break; } createGraph(); } //Function that creates the graph private void createGraph() { //Creation of the axis CategoryAxis xAx = new CategoryAxis(); xAx.setLabel("Macro Intakes"); NumberAxis yAx = new NumberAxis(); yAx.setLabel("Amount"); //Creation of bar chart BarChart macroBarChart = new BarChart(xAx,yAx); XYChart.Series myDataSeries = new XYChart.Series(); XYChart.Series myDataSeries2 = new XYChart.Series(); // myDataSeries.setName("RDA value"); // myDataSeries2.setName("Actual Value"); myDataSeries.getData().add(new XYChart.Data("Recommended Intake", RDAInput)); myDataSeries2.getData().add(new XYChart.Data("Actual Intake", actualInput)); macroBarChart.getData().add(myDataSeries); //Add data to the bar chart macroBarChart.getData().add(myDataSeries2); //Add data to the bar chart myBox.getChildren().add(macroBarChart); //Adds chart to anchor pane } public void returnToOutput(ActionEvent event) { try { FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource("DetailedResults.fxml")); Parent outputView = loader.load(); //access the controller and call the method DetailedResultsController controller = loader.getController(); controller.storeValues(outputDecision, outputFooditem, outputProfile, outputRDA); Scene newScene = new Scene(outputView); Stage primaryStage = (Stage) ((Node) event.getSource()).getScene().getWindow(); primaryStage.setTitle("Home"); primaryStage.setScene(newScene); primaryStage.show(); //end new window code }catch (IOException e) { e.printStackTrace(); } } }
[ "cbridle121@googlemail.com" ]
cbridle121@googlemail.com
23df749ce318e1c061e3133cbd34df2a928697a6
aff159c4270ddb6c552f5ce7a1f342b6eedc56bf
/src/org/jetbrains/android/run/DebugLauncher.java
bc0c49448d4f8721a6ac71ec0fcb16f0608e0ad6
[]
no_license
vahitserifsaglam1/idea-android
3cca03d29484e76e1e82e9371753ec2c82442131
2701198a7aca2104e48d5f1f6dbe0746f6b53446
refs/heads/master
2020-03-30T08:35:18.326364
2008-12-26T14:13:06
2008-12-26T14:13:06
33,262,248
0
0
null
null
null
null
UTF-8
Java
false
false
145
java
package org.jetbrains.android.run; /** * @author coyote */ public interface DebugLauncher { void launchDebug(String debugPort); }
[ "jkudel@mail.ru@db6d6eb8-cd3e-0410-97d0-afb2eff4f138" ]
jkudel@mail.ru@db6d6eb8-cd3e-0410-97d0-afb2eff4f138
0887d1af5e3db0912ec2da53105d67d9e5bddbf4
b9c33f168da503abaedbe12dbcc5c5f73c5b2a6f
/ tpalus --username racezhang/Palus/toyexperiment/arrayexamples/VarInfo.java
0c569a135a41f69f2840cf259bab5b881f2c24ae
[]
no_license
minhtran83/tpalus
cc48a3eac611edfa39a656f611ddef902268659b
0b88621116df77a0fc0b895ce5457fe1771a36af
refs/heads/master
2021-05-29T01:22:09.689712
2011-05-23T02:33:08
2011-05-23T02:33:08
35,160,330
1
0
null
null
null
null
UTF-8
Java
false
false
290
java
// Copyright 2010 Google Inc. All Rights Reserved. package arrayexamples; /** * @author saizhang@google.com (Your Name Here) * */ public class VarInfo { public VarInfo(VarInfoName name, ProlangType type, ProlangType retType, VarComparability comp, VarInfoAux aux) { } }
[ "racezhang@454cb45b-5f8a-43e4-73d6-c6a0c25fc75f" ]
racezhang@454cb45b-5f8a-43e4-73d6-c6a0c25fc75f
9a70972679d0538cfcfa081bce2c72f54361a02e
cc109222071be2d7286b60ae823cdedd6916a735
/Ticketing_Management_System/src/com/tolo/tabcs/server/dao/SecondBalanceDao.java
93ed4701373689b1555f7614d654dda07b6df64a
[]
no_license
2724869229/Ticket-management-System
e0283d9978aae504dc198ab8d91cd7d60012d114
e49ce2c9e4dc82d84387cb81acdd7e99855d0fcd
refs/heads/master
2021-05-30T09:57:45.102094
2014-08-31T05:09:29
2014-08-31T05:09:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
108
java
package com.tolo.tabcs.server.dao; public interface SecondBalanceDao { Boolean getResult(int branchId); }
[ "279962296@qq.com" ]
279962296@qq.com
ace350903a14e679a1e6e9e22460e07d731987e7
dfa884601814bec2a1e6bd34a5de6fd73ab3d814
/src/main/java/com/solarmc/eclipse/util/RemappingUtils.java
820dfeb7a9b3e689afdc1a37db831ed1cab92000
[]
no_license
Solar-MC/solar-eclipse
aefddec7dc6a0c80ba41c0560d464454bbf23331
f26df9db9a5ad21038debe5daffdf5e8fd9a47fe
refs/heads/master
2023-05-07T05:50:25.978703
2021-05-28T10:31:27
2021-05-28T10:31:27
370,492,933
17
0
null
null
null
null
UTF-8
Java
false
false
4,575
java
package com.solarmc.eclipse.util; import com.solarmc.eclipse.bytecode.SolarClassRemapper; import com.solarmc.eclipse.util.lunar.PatchInfo; import net.fabricmc.tinyremapper.*; import org.cadixdev.lorenz.MappingSet; import org.cadixdev.lorenz.io.TextMappingsWriter; import org.cadixdev.lorenz.model.*; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.commons.ClassRemapper; import org.objectweb.asm.commons.Remapper; import java.io.*; import java.nio.file.Files; import java.nio.file.Path; import java.util.Map; import java.util.function.Consumer; public class RemappingUtils { public static byte[] remap(PatchInfo info, byte[] originalBytecode) { Remapper remapper = new SolarClassRemapper(info); ClassWriter writer = new ClassWriter(0); ClassRemapper classRemapper = new ClassRemapper(writer, remapper); new ClassReader(originalBytecode).accept(classRemapper, ClassReader.SKIP_DEBUG); return writer.toByteArray(); } public static MappingSet toMappingSet(Map<String, String> classMappings) { MappingSet mappings = MappingSet.create(); for (String obf : classMappings.keySet()) { String mapped = classMappings.get(obf); mappings.getOrCreateClassMapping(obf).setDeobfuscatedName(mapped); } return mappings; } public static void writeMappings(MappingSet mappings, Path path, String from, String to) { try (Writer writer = new StringWriter()) { new TinyWriter(writer, from, to).write(mappings); Files.writeString(path, writer.toString()); } catch (IOException e) { throw new RuntimeException("Failed to write tiny mappings", e); } } public static void createAndWriteMappingSet(Map<String, String> classMappings, Path path, String from, String to) { MappingSet set = toMappingSet(classMappings); writeMappings(set, path, from, to); } public static void remapJar(Path mappingPath, String from, String to, Path inJar, Path outJar) { TinyRemapper remapper = TinyRemapper.newRemapper() .withMappings(TinyUtils.createTinyMappingProvider(mappingPath, from, to)) .ignoreConflicts(true) .fixPackageAccess(true) .build(); try (OutputConsumerPath outputConsumer = new OutputConsumerPath.Builder(outJar).build()) { outputConsumer.addNonClassFiles(inJar, NonClassCopyMode.FIX_META_INF, remapper); remapper.readInputs(inJar); remapper.apply(outputConsumer); } catch (IOException e) { throw new RuntimeException("Failed to remap jar", e); } } private static class TinyWriter extends TextMappingsWriter { private final String from; private final String to; public TinyWriter(Writer writer, String from, String to) { super(writer); this.from = from; this.to = to; } @Override public void write(MappingSet mappings) { writer.println("tiny\t2\t0\t" + from + "\t" + to); iterateClasses(mappings, classMapping -> { writer.println("c\t" + classMapping.getFullObfuscatedName() + "\t" + classMapping.getFullDeobfuscatedName()); for (FieldMapping fieldMapping : classMapping.getFieldMappings()) { fieldMapping.getType().ifPresent(fieldType -> writer.println("\tf\t" + fieldType + "\t" + fieldMapping.getObfuscatedName() + "\t" + fieldMapping.getDeobfuscatedName())); } for (MethodMapping methodMapping : classMapping.getMethodMappings()) { writer.println("\tm\t" + methodMapping.getSignature().getDescriptor() + "\t" + methodMapping.getObfuscatedName() + "\t" + methodMapping.getDeobfuscatedName()); } }); } private static void iterateClasses(MappingSet mappings, Consumer<ClassMapping<?, ?>> consumer) { for (TopLevelClassMapping classMapping : mappings.getTopLevelClassMappings()) { iterateClass(classMapping, consumer); } } private static void iterateClass(ClassMapping<?, ?> classMapping, Consumer<ClassMapping<?, ?>> consumer) { consumer.accept(classMapping); for (InnerClassMapping innerClassMapping : classMapping.getInnerClassMappings()) { iterateClass(innerClassMapping, consumer); } } } }
[ "haydenv06@gmail.com" ]
haydenv06@gmail.com
3f9a26210fc6670268bbaa7fb402096522ecbfff
696228c0b07ea207310f97cfb94fd661722aa74a
/MyPrograms/src/main/java/folder/RemoveDuplicates.java
b6cb16dc10d83790e928da9f444a5defe67b2898
[]
no_license
ramalakshmi95/MyPrograms
db5de04ddfffc02a95704121963efd2623c6bbb0
1c8dcb0aa49d1349c8f05ee89e09b78074b72a03
refs/heads/master
2023-05-12T00:14:09.711285
2019-09-28T16:45:34
2019-09-28T16:45:34
207,124,575
0
0
null
2023-05-09T18:15:44
2019-09-08T14:28:35
Java
UTF-8
Java
false
false
1,671
java
package folder; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.TreeSet; public class RemoveDuplicates { public static void main(String[] args) { int[] arr= {10,20,10,30,50,20,60,60}; RemoveDuplicates rd=new RemoveDuplicates(); rd.findDuplicates1(arr); rd.findDuplicatesAfterSort(arr); rd.findDuplicatesUsingSet(arr); } public void findDuplicates1(int[] arr) { //using normal for loops boolean duplicate; List<Integer> unique=new ArrayList<Integer>(); for(int i=0;i<arr.length;i++) { duplicate=false; for(int j=i+1;j<arr.length;j++) { if(arr[i]==arr[j]) { duplicate=true; break; } } if(!duplicate) unique.add(arr[i]); } System.out.println(unique); } public void findDuplicatesAfterSort(int[] arr) { //find duplicates by sorting array using collections List<Integer> list=new ArrayList<Integer>(); List<Integer> unique=new ArrayList<Integer>(); for(int a:arr) { list.add(Integer.valueOf(a)); } Collections.sort(list); for(int i=0;i<list.size();i++) { if(i==list.size()-1) { unique.add(list.get(i)); } else if(list.get(i)!=list.get(i+1)) { unique.add(list.get(i)); } } System.out.println(unique); } public void findDuplicatesUsingSet(int[] arr) { List<Integer> list=new ArrayList<Integer>(); for(int a:arr) { list.add(Integer.valueOf(a)); } Set<Integer> unique=new HashSet<Integer>(list); System.out.println(unique); } }
[ "jayashrishankaran04@gmail.com" ]
jayashrishankaran04@gmail.com
5b10407a4ee7945599b2289750105134458dca57
c11e6fa67b1aa9e6f144b4032d8ae474fa961ac0
/src/org/usfirst/frc/team558/robot/scale_Paths/doubleCenterRightFrontArc.java
22b382ba212d52e94e8d5d6fb13d3475f233ca46
[]
no_license
m4nik1/SnapBack2018
4ce99af6b7e615c6cb790d3e8ab32ebca5f8c40e
38dbd920b5ba3bab7002fef59190cc28c01a5d7e
refs/heads/master
2020-03-09T15:36:16.190862
2018-05-11T20:25:38
2018-05-11T20:25:38
128,863,231
0
0
null
null
null
null
UTF-8
Java
false
false
6,751
java
package org.usfirst.frc.team558.robot.scale_Paths; import org.usfirst.frc.team558.robot.util.*; public class doubleCenterRightFrontArc extends SrxTrajectory{ // WAYPOINTS: // (X,Y,degrees) // (2.58,13.18,0.00) // (7.58,13.18,0.00) public doubleCenterRightFrontArc() { super(); this.highGear = false; centerProfile = new SrxMotionProfile(centerPoints.length, centerPoints); } public doubleCenterRightFrontArc(boolean flipped) { super(); this.highGear = false; this.flipped = flipped; centerProfile = new SrxMotionProfile(centerPoints.length, centerPoints); } public boolean highGear = false; double[][] centerPoints = { {0.073,1.454,10.000,0.000}, {0.363,4.362,10.000,0.000}, {1.018,8.723,10.000,0.000}, {2.181,14.538,10.000,0.000}, {3.998,21.808,10.000,0.000}, {6.615,30.531,10.000,0.000}, {10.177,40.707,10.000,0.000}, {14.829,52.338,10.000,0.000}, {20.717,65.423,10.000,0.000}, {27.986,79.961,10.000,0.000}, {36.782,95.953,10.000,0.000}, {47.250,113.399,10.000,0.000}, {59.535,132.299,10.000,0.000}, {73.782,152.653,10.000,0.000}, {90.138,174.460,10.000,0.000}, {108.747,197.722,10.000,0.000}, {129.682,220.983,10.000,0.000}, {152.944,244.244,10.000,0.000}, {178.531,267.506,10.000,0.000}, {206.445,290.767,10.000,0.000}, {236.684,314.028,10.000,0.000}, {269.250,337.290,10.000,0.000}, {304.142,360.551,10.000,0.000}, {341.361,383.813,10.000,0.000}, {380.905,407.074,10.000,0.000}, {422.775,430.335,10.000,0.000}, {466.972,453.597,10.000,0.000}, {513.495,476.858,10.000,0.000}, {562.344,500.119,10.000,0.000}, {613.519,523.381,10.000,0.000}, {667.020,546.642,10.000,0.000}, {722.847,569.904,10.000,0.000}, {781.000,593.165,10.000,0.000}, {841.480,616.426,10.000,0.000}, {904.286,639.688,10.000,0.000}, {969.418,662.949,10.000,0.000}, {1036.876,686.210,10.000,0.000}, {1106.660,709.472,10.000,0.000}, {1178.770,732.733,10.000,0.000}, {1253.206,755.995,10.000,0.000}, {1329.969,779.256,10.000,0.000}, {1409.057,802.517,10.000,0.000}, {1490.472,825.779,10.000,0.000}, {1574.213,849.040,10.000,0.000}, {1660.280,872.301,10.000,0.000}, {1748.673,895.563,10.000,0.000}, {1839.393,918.824,10.000,0.000}, {1932.438,942.085,10.000,0.000}, {2027.810,965.347,10.000,0.000}, {2125.508,988.608,10.000,0.000}, {2225.532,1011.870,10.000,0.000}, {2327.882,1035.131,10.000,0.000}, {2432.558,1058.392,10.000,0.000}, {2539.560,1081.654,10.000,0.000}, {2648.889,1104.915,10.000,0.000}, {2760.543,1128.176,10.000,0.000}, {2874.524,1151.438,10.000,0.000}, {2990.831,1174.699,10.000,0.000}, {3109.464,1197.961,10.000,0.000}, {3230.423,1221.222,10.000,0.000}, {3353.708,1244.483,10.000,0.000}, {3479.319,1267.745,10.000,0.000}, {3607.257,1291.006,10.000,0.000}, {3737.521,1314.267,10.000,0.000}, {3870.038,1336.075,10.000,0.000}, {4004.663,1356.429,10.000,0.000}, {4141.251,1375.329,10.000,0.000}, {4279.656,1392.775,10.000,0.000}, {4419.733,1408.767,10.000,0.000}, {4561.337,1423.305,10.000,0.000}, {4704.321,1436.390,10.000,0.000}, {4848.542,1448.020,10.000,0.000}, {4993.853,1458.197,10.000,0.000}, {5140.109,1466.920,10.000,0.000}, {5287.164,1474.189,10.000,0.000}, {5434.874,1480.005,10.000,0.000}, {5583.092,1484.366,10.000,0.000}, {5731.674,1487.274,10.000,0.000}, {5880.461,1488.466,10.000,0.000}, {6029.222,1486.751,10.000,0.000}, {6177.739,1483.582,10.000,0.000}, {6325.866,1478.959,10.000,0.000}, {6473.458,1472.882,10.000,0.000}, {6620.370,1465.351,10.000,0.000}, {6766.455,1456.367,10.000,0.000}, {6911.570,1445.929,10.000,0.000}, {7055.568,1434.036,10.000,0.000}, {7198.305,1420.691,10.000,0.000}, {7339.634,1405.891,10.000,0.000}, {7479.410,1389.637,10.000,0.000}, {7617.489,1371.930,10.000,0.000}, {7753.723,1352.768,10.000,0.000}, {7887.970,1332.153,10.000,0.000}, {8020.081,1310.084,10.000,0.000}, {8149.927,1286.823,10.000,0.000}, {8277.446,1263.561,10.000,0.000}, {8402.639,1240.300,10.000,0.000}, {8525.506,1217.039,10.000,0.000}, {8646.047,1193.777,10.000,0.000}, {8764.261,1170.516,10.000,0.000}, {8880.150,1147.255,10.000,0.000}, {8993.712,1123.993,10.000,0.000}, {9104.949,1100.732,10.000,0.000}, {9213.859,1077.470,10.000,0.000}, {9320.443,1054.209,10.000,0.000}, {9424.701,1030.948,10.000,0.000}, {9526.632,1007.686,10.000,0.000}, {9626.238,984.425,10.000,0.000}, {9723.517,961.164,10.000,0.000}, {9818.470,937.902,10.000,0.000}, {9911.098,914.641,10.000,0.000}, {10001.399,891.379,10.000,0.000}, {10089.374,868.118,10.000,0.000}, {10175.022,844.857,10.000,0.000}, {10258.345,821.595,10.000,0.000}, {10339.341,798.334,10.000,0.000}, {10418.012,775.073,10.000,0.000}, {10494.356,751.811,10.000,0.000}, {10568.374,728.550,10.000,0.000}, {10640.066,705.288,10.000,0.000}, {10709.432,682.027,10.000,0.000}, {10776.471,658.766,10.000,0.000}, {10841.185,635.504,10.000,0.000}, {10903.572,612.243,10.000,0.000}, {10963.633,588.982,10.000,0.000}, {11021.368,565.720,10.000,0.000}, {11076.777,542.459,10.000,0.000}, {11129.860,519.198,10.000,0.000}, {11180.617,495.936,10.000,0.000}, {11229.047,472.675,10.000,0.000}, {11275.152,449.413,10.000,0.000}, {11318.930,426.152,10.000,0.000}, {11360.382,402.891,10.000,0.000}, {11399.508,379.629,10.000,0.000}, {11436.308,356.368,10.000,0.000}, {11470.782,333.107,10.000,0.000}, {11502.929,309.845,10.000,0.000}, {11532.751,286.584,10.000,0.000}, {11560.246,263.322,10.000,0.000}, {11585.415,240.061,10.000,0.000}, {11608.258,216.800,10.000,0.000}, {11628.775,193.538,10.000,0.000}, {11646.979,170.538,10.000,0.000}, {11662.956,148.992,10.000,0.000}, {11676.850,128.900,10.000,0.000}, {11688.808,110.262,10.000,0.000}, {11698.975,93.077,10.000,0.000}, {11707.497,77.346,10.000,0.000}, {11714.517,63.070,10.000,0.000}, {11720.183,50.246,10.000,0.000}, {11724.639,38.877,10.000,0.000}, {11728.031,28.962,10.000,0.000}, {11730.504,20.500,10.000,0.000}, {11732.204,13.493,10.000,0.000}, {11733.276,7.939,10.000,0.000}, {11733.864,3.839,10.000,0.000}, {11734.116,1.192,10.000,0.000}, {11734.176,0.000,10.000,0.000}, {11734.176,0.000,10.000,0.000} }; }
[ "maniksoomro@gmail" ]
maniksoomro@gmail
842ffa2df08351b50d561a8eb2fc4c70dbcdd6fc
952e6c8e6a2cc1f48cc6e7f0defb952c8f9ab58a
/backend/src/main/java/com/udacity/gradle/builditbigger/backend/MyEndpoint.java
5570f98b1c577f3bca36a17c3c7db00014f289b8
[]
no_license
kae-udacity/build-it-bigger
3c22e945cee9d35bfbc7d27a50142506833e4ef6
13e0c5773ca1072443cf1844369d492ce566c69e
refs/heads/master
2021-09-02T20:18:17.580689
2018-01-03T21:22:10
2018-01-03T21:22:10
115,810,819
0
0
null
null
null
null
UTF-8
Java
false
false
1,214
java
/* For step-by-step instructions on connecting your Android application to this backend module, see "App Engine Java Endpoints Module" template documentation at https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints */ package com.udacity.gradle.builditbigger.backend; import com.example.android.jokejavalibrary.JokeManager; import com.google.api.server.spi.config.Api; import com.google.api.server.spi.config.ApiMethod; import com.google.api.server.spi.config.ApiNamespace; import javax.inject.Named; /** An endpoint class we are exposing */ @Api( name = "myApi", version = "v1", namespace = @ApiNamespace( ownerDomain = "backend.builditbigger.gradle.udacity.com", ownerName = "backend.builditbigger.gradle.udacity.com", packagePath = "" ) ) public class MyEndpoint { /** A simple endpoint method that returns a response with a joke. */ @ApiMethod(name = "getJoke") public MyBean getJoke() { MyBean response = new MyBean(); JokeManager jokeManager = new JokeManager(); response.setData(jokeManager.getJoke()); return response; } }
[ "kennethrogers.kr@gmail.com" ]
kennethrogers.kr@gmail.com
2db2524239b5c7414a545739218ff357d24a0364
e155926f97c3bebd9352126d92a1d00826972d11
/Java/Interfaces/Exercicio1/BicicletaEstrada.java
3ba5d51f4b5fac399e11c8e59643b49b41b87e0d
[]
no_license
jefethibes/Aulas
3f941cf4903d239b882cc48883c3b28fb786c99f
8662da4ae641a216848fd2ba66eac39999351e08
refs/heads/master
2021-06-20T06:23:13.535635
2021-04-29T01:01:45
2021-04-29T01:01:45
200,735,696
0
0
null
null
null
null
UTF-8
Java
false
false
446
java
package Exercicio1; public class BicicletaEstrada implements Bicicleta { public int qtdMarchas() { return 18; } public String tipoFreio() { return "Boracha"; } public String modelo() { return "Estrada"; } public String marca() { return "Caloi"; } public String material() { return "Aço"; } public String velocidade() { return "10 Km/h"; } }
[ "jefepatytony@gmail.com" ]
jefepatytony@gmail.com
65766a6fe0a684cba10d487b3869c05af238e716
04178323a2f54947fae5a792ebbdb47037c49658
/src/main/java/lk/ijse/dep/web/api/CustomerServlet.java
89dd0f4ae7e505ac6ee49b7c46ac999a8c8787b5
[]
no_license
dep-6-playground/layerd-architecture-pos
be92af554784ae5416ba1e79108cd55ce6bee7d6
5653ce8ec681f1390d570c394d724714a606cd08
refs/heads/master
2023-03-02T23:33:29.612844
2021-01-19T00:32:29
2021-01-19T00:32:29
334,323,612
0
0
null
null
null
null
UTF-8
Java
false
false
6,273
java
package lk.ijse.dep.web.api; import lk.ijse.dep.web.business.BOFactory; import lk.ijse.dep.web.business.BOTypes; import lk.ijse.dep.web.business.custom.CustomerBO; import lk.ijse.dep.web.dto.CustomerDTO; import lk.ijse.dep.web.exception.HttpResponseException; import lk.ijse.dep.web.exception.ResponseExceptionUtil; import org.apache.commons.dbcp2.BasicDataSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.json.bind.Jsonb; import javax.json.bind.JsonbBuilder; import javax.json.bind.JsonbException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.sql.*; @WebServlet(urlPatterns = "/api/v1/customers/*") public class CustomerServlet extends HttpServlet { final Logger logger = LoggerFactory.getLogger(CustomerServlet.class); @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { // logger.error("Error: "+req.getServletPath()); // logger.warn("Warn:"+req.getServletPath()); // logger.info("Info : "+req.getServletPath()); // logger.debug("Debug: "+req.getServletPath()); // logger.trace("Trace : "+req.getServletPath()); super.service(req, resp); }catch (Throwable t){ ResponseExceptionUtil.handle(t,resp); } } @Override protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { final BasicDataSource cp = (BasicDataSource) getServletContext().getAttribute("cp"); try (Connection connection = cp.getConnection()) { if (req.getPathInfo() == null || req.getPathInfo().replace("/", "").trim().isEmpty()){ throw new HttpResponseException(400, "Invalid customer id", null); } String id = req.getPathInfo().replace("/", ""); CustomerBO customerBO = BOFactory.getInstance().getBO(BOTypes.CUSTOMER); customerBO.setConnection(connection); if (customerBO.deleteCustomer(id)){ resp.setStatus(HttpServletResponse.SC_NO_CONTENT); }else{ throw new HttpResponseException(404, "There is no such customer exists", null); } } catch (Exception e) { throw new RuntimeException(e); } } @Override protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{ final BasicDataSource cp = (BasicDataSource) getServletContext().getAttribute("cp"); try (Connection connection = cp.getConnection()) { if (req.getPathInfo() == null || req.getPathInfo().replace("/", "").trim().isEmpty()){ throw new HttpResponseException(400, "Invalid customer id", null); } String id = req.getPathInfo().replace("/", ""); Jsonb jsonb = JsonbBuilder.create(); CustomerDTO dto = jsonb.fromJson(req.getReader(), CustomerDTO.class); if (dto.getId() != null || dto.getName().trim().isEmpty() || dto.getAddress().trim().isEmpty()){ throw new HttpResponseException(400, "Invalid details", null); } CustomerBO customerBO = BOFactory.getInstance().getBO(BOTypes.CUSTOMER); customerBO.setConnection(connection); if (customerBO.updateCustomer(dto)){ resp.setStatus(HttpServletResponse.SC_NO_CONTENT); }else{ throw new HttpResponseException(500, "Failed to update the customer", null); } }catch (JsonbException exp){ throw new HttpResponseException(400, "Failed to read the JSON", exp); } catch (Exception e) { throw new RuntimeException(e); } } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Jsonb jsonb = JsonbBuilder.create(); final BasicDataSource cp = (BasicDataSource) getServletContext().getAttribute("cp"); try (Connection connection = cp.getConnection()) { resp.setContentType("application/json"); CustomerBO customerBO = BOFactory.getInstance().getBO(BOTypes.CUSTOMER); customerBO.setConnection(connection); resp.getWriter().println(jsonb.toJson(customerBO.findAllCustomers())); } catch (Throwable t) { ResponseExceptionUtil.handle(t, resp); } } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{ Jsonb jsonb = JsonbBuilder.create(); final BasicDataSource cp = (BasicDataSource) getServletContext().getAttribute("cp"); try (Connection connection = cp.getConnection()) { CustomerDTO dto = jsonb.fromJson(req.getReader(), CustomerDTO.class); if (dto.getId() == null || dto.getId().trim().isEmpty() || dto.getName() == null || dto.getName().trim().isEmpty() || dto.getAddress()== null || dto.getAddress().trim().isEmpty()) { throw new HttpResponseException(400, "Invalid customer details" , null); } CustomerBO customerBO = BOFactory.getInstance().getBO(BOTypes.CUSTOMER); customerBO.setConnection(connection); if (customerBO.saveCustomer(dto)) { resp.setStatus(HttpServletResponse.SC_CREATED); resp.setContentType("application/json"); resp.getWriter().println(jsonb.toJson(dto)); } else { throw new HttpResponseException(500, "Failed to save the customer", null); } }catch (SQLIntegrityConstraintViolationException exp){ throw new HttpResponseException(400, "Duplicate entry", exp); } catch (JsonbException exp) { throw new HttpResponseException(400, "Failed to read the JSON", exp); } catch (Exception e) { throw new RuntimeException(e); } } }
[ "d.c.0729439631@gmail.com" ]
d.c.0729439631@gmail.com
8c2c93db670425ce2611477c84cbd4fd6cf4d820
6c23b389b2eadd9df942a6464cb9bf8cbac68416
/src/demos/robot/MouseSignZorro.java
4e8c4ee6fe84ef500959a7a03876a69c0b7b4406
[]
no_license
DF4ze/ArduiBot_Java
13e407c0f3ea698344c1f845f274706c15219b2b
548b1a16064fad13bfb46ab4d76982b5724fc781
refs/heads/master
2021-01-17T15:36:21.645420
2016-04-19T21:41:04
2016-04-19T21:41:04
25,223,107
0
0
null
2014-10-27T23:36:24
2014-10-14T19:33:38
Java
ISO-8859-1
Java
false
false
1,207
java
package demos.robot; import java.awt.AWTException; import java.awt.Robot; /** * Déplacer le curseur de la souris sur l'écran * Exemple de zorro * fobec.com 2010 */ public class MouseSignZorro { public MouseSignZorro() throws AWTException { Robot robot = new Robot(); /** * Fixer le delai entre chaque mouvement à 500 ms */ robot.setAutoDelay(50); /** * Appeler OnIdle après le déplacement de la souris */ robot.setAutoWaitForIdle(false); /** * Barre du haut */ for (int i = 0; i < 20; i++) { robot.mouseMove(300+(20*i), 400); } /** * Diagonale */ for (int i = 0; i < 20; i++) { robot.mouseMove(700-(20*i), 400+(20*i)); } /** * Barre du bas */ for (int i = 0; i < 20; i++) { robot.mouseMove(300+(20*i), 800); } /** * Quitter l'application */ System.exit(0); } public static void main(String[] args) throws AWTException { new MouseSignZorro(); } }
[ "CDI12@31010B6014537.balma.stagiaires.ad.afpanet" ]
CDI12@31010B6014537.balma.stagiaires.ad.afpanet
6c5508fd1ff5dac7a870aab167902b1a23b66e87
027e93461d4034f04e0ce7f2c1a9a08011ea2c8e
/club/src/test/java/org/zerock/club/security/JWTTests.java
64e925f9bef8a8cc1369919d992403bbe253c62b
[]
no_license
jinyedo/SpringBoot-Study
787198833be2d1846de892036796c7da9cd371fc
91647c2b31281d3ce6ac5d933386241c18201749
refs/heads/master
2023-04-15T03:31:21.061906
2021-04-20T04:16:32
2021-04-20T04:16:32
348,406,069
0
0
null
null
null
null
UTF-8
Java
false
false
845
java
package org.zerock.club.security; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.zerock.club.security.util.JWTUtil; public class JWTTests { private JWTUtil jwtUtil; @BeforeEach public void testBefore() { System.out.println("testBefore.........."); jwtUtil = new JWTUtil(); } @Test public void testEncode() throws Exception { String email = "user95@zerock.org"; String str = jwtUtil.generateToken(email); System.out.println(str); } @Test public void testValidate() throws Exception { String email = "user95@zerock.org"; String str = jwtUtil.generateToken(email); Thread.sleep(5000); String resultEmail = jwtUtil.validateAndExtract(str); System.out.println(resultEmail); } }
[ "whereyedo@naver.com" ]
whereyedo@naver.com
70534b5d58958643ef8f60da17df60aad006088c
9a9309e2254cc1343d3f492b704d1b3518736c17
/src/main/java/lt/java/uzduotys/uzduotishelpme/LabelRepository.java
3c530faf5be7836118a372a59e528943cc5685c5
[]
no_license
leskauskas/9-swing-rest-api
30c45b05d50bc20a99a3d9257caef52be7d83a67
960eea3ec743c6daea32f9e7d0da530fd6be9045
refs/heads/master
2021-08-28T16:29:46.694969
2017-12-12T18:59:33
2017-12-12T18:59:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
452
java
package lt.java.uzduotys.uzduotishelpme; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.repository.query.Param; import java.util.List; public interface LabelRepository extends JpaRepository<Label, Long>{ List<Label> findAllById(@Param("id") Long id); List<Label> findAllByLabelName(@Param("name") String name); List<Label> findAlbumsByLabelNameContaining(@Param("letter") String letter); }
[ "leskauskas25@gmail.com" ]
leskauskas25@gmail.com
36f8522820778261bb50de8b3f85a1988a6f09ed
f3d5667d71bf4aea5104ac789547b15241499b2f
/app/src/main/java/com/gsy/ml/prestener/message/EaseChatPrestener.java
670f4908e5c96a443de91922d92cf03c8593c406
[]
no_license
ax3726/MaiLi
c55c3482c0fe2e7e646fc1f3a0dbe1a01eb1f73c
cefb0d66f4b2ce838e420d0354a1ab4e74b19ee2
refs/heads/master
2021-07-14T11:48:56.104111
2018-09-14T09:43:40
2018-09-14T09:43:40
135,269,966
0
0
null
null
null
null
UTF-8
Java
false
false
2,033
java
package com.gsy.ml.prestener.message; import com.gsy.ml.common.Api; import com.gsy.ml.common.Link; import com.gsy.ml.common.MaiLiApplication; import com.gsy.ml.model.common.HttpErrorModel; import com.gsy.ml.model.message.EaseChatFragmentModel; import com.gsy.ml.prestener.common.ILoadPVListener; import java.util.HashMap; import java.util.Map; import ml.gsy.com.library.utils.ParseJsonUtils; /** * Created by Administrator on 2017/9/11. */ public class EaseChatPrestener { final int SEESERVICECHARGE = 1; int requestType = SEESERVICECHARGE; private final ILoadPVListener mListener; public EaseChatPrestener(ILoadPVListener mListener) { this.mListener = mListener; } public void messageFee(String phone, String city) { requestType = SEESERVICECHARGE; Map<String, String> map = new HashMap<String, String>(); map.put("phone", phone); map.put("city", city); Api.getInstance(MaiLiApplication.getInstance()).getData(Link.SEESERVICECHARGE, map, callback); } Api.CustomHttpHandler callback = new Api.CustomHttpHandler() { @Override public void onFailure(HttpErrorModel errorModel) { mListener.onLoadComplete(errorModel); } @Override public void onSuccess(Object object) { switch (requestType) { case SEESERVICECHARGE: try { if (object instanceof HttpErrorModel) { mListener.onLoadComplete(object); } else { EaseChatFragmentModel modle = ParseJsonUtils.getBean((String) object, EaseChatFragmentModel.class); mListener.onLoadComplete(modle); } } catch (Exception e) { e.printStackTrace(); mListener.onLoadComplete(HttpErrorModel.createError()); } break; } } }; }
[ "15970060419lma" ]
15970060419lma
3bb666941213d2d99d675cda83fbf84f291597b2
22c0ea86a3a73dda44921a87208022a3871d6c06
/Source/com/tv/xeeng/base/protocol/messages/json/BanTruongJSON.java
ac3f0df81fb947965d55bc667a5ef4fd8b998dbd
[]
no_license
hungdt138/xeeng_server
e9cd0a3be7ee0fc928fb6337e950e12846bd065a
602ce57a4ec625c25aff0a48ac01d3c41f481c5a
refs/heads/master
2021-01-04T14:06:51.158259
2014-08-01T09:52:00
2014-08-01T09:52:00
22,504,067
1
0
null
null
null
null
UTF-8
Java
false
false
2,225
java
package com.tv.xeeng.base.protocol.messages.json; import org.json.JSONObject; import org.slf4j.Logger; import com.tv.xeeng.base.common.LoggerContext; import com.tv.xeeng.base.common.ServerException; import com.tv.xeeng.base.protocol.messages.BanTruongRequest; import com.tv.xeeng.base.protocol.messages.BanTruongResponse; import com.tv.xeeng.game.data.ResponseCode; import com.tv.xeeng.protocol.IMessageProtocol; import com.tv.xeeng.protocol.IRequestMessage; import com.tv.xeeng.protocol.IResponseMessage; public class BanTruongJSON implements IMessageProtocol { private final Logger mLog = LoggerContext.getLoggerFactory().getLogger(BanTruongJSON.class); public boolean decode(Object aEncodedObj, IRequestMessage aDecodingObj) throws ServerException { try { // request data JSONObject jsonData = (JSONObject) aEncodedObj; // plain obj BanTruongRequest ban = (BanTruongRequest) aDecodingObj; // decoding ban.money = jsonData.getLong("money"); ban.matchID = jsonData.getLong("match_id"); return true; } catch (Throwable t) { mLog.error("[DECODER] " + aDecodingObj.getID(), t); return false; } } public Object encode(IResponseMessage aResponseMessage) throws ServerException { try { JSONObject encodingObj = new JSONObject(); // put response data into json object encodingObj.put("mid", aResponseMessage.getID()); BanTruongResponse ban = (BanTruongResponse) aResponseMessage; encodingObj.put("code", ban.mCode); // System.out.println(" chat.mUsername : " + chat.mUsername); if (ban.mCode == ResponseCode.FAILURE) { encodingObj.put("error_msg", ban.mErrorMsg); } else if (ban.mCode == ResponseCode.SUCCESS) { encodingObj.put("money", ban.money); encodingObj.put("uid", ban.mUid); } // response encoded obj return encodingObj; } catch (Throwable t) { mLog.error("[ENCODER] " + aResponseMessage.getID(), t); return null; } } }
[ "hungdt138@outlook.com" ]
hungdt138@outlook.com
99811091c1ce0262801474f35df8c73f7741b127
9718b7f879a48815dd52c715ef1f2cbc4fd1bd02
/Profiler/src/eu/artist/migration/pt/user/BenchmarkPanel.java
836233c70ff6e09a76da807a7c31e53412a1f6b6
[ "Apache-2.0" ]
permissive
cloudperfect-project/CloudPerfect
55d81bfb15995460674d6f31424dd97d52e502ad
c76e1d5cd9fdef110122b9f31070d8e23b4273eb
refs/heads/master
2020-12-02T23:01:42.736477
2019-01-10T15:24:22
2019-01-10T15:24:22
96,218,711
4
5
null
2017-09-15T14:13:36
2017-07-04T13:00:36
HTML
UTF-8
Java
false
false
4,413
java
/* * Copyright 2014 ICCS/NTUA * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Initially developed in the context of ARTIST EU project www.artist-project.eu * */ package eu.artist.migration.pt.user; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import java.util.ArrayList; import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; public class BenchmarkPanel extends JPanel { private static final long serialVersionUID = 1L; public JTextField vmIPField; public JTextField vmUserField; public JTextField inputFile; public JPasswordField passField; public JPasswordField passForSudoField; BenchmarkPanel(){ super(); setBorder(BorderFactory.createTitledBorder(BorderFactory.createBevelBorder(1, Color.gray, Color.lightGray), "Benchmark Info")); JLabel vmIPLabel; JLabel passLabel; JLabel passForSudoLabel; JLabel vmUserLabel; JLabel inputFileLabel; GridLayout textAreaPanelLayout = new GridLayout(0,1); FlowLayout eachRowLayout = new FlowLayout(); //Configuring Layouts textAreaPanelLayout.setVgap(10); //Creation of Panels JPanel vmIPPanel = new JPanel(); JPanel vmUserPanel = new JPanel(); JPanel inputFilePanel = new JPanel(); JPanel passPanel = new JPanel(); JPanel passForSudoPanel = new JPanel(); //Configuring Panels setLayout(textAreaPanelLayout); vmIPPanel.setLayout(eachRowLayout); vmUserPanel.setLayout(eachRowLayout); inputFilePanel.setLayout(eachRowLayout); passPanel.setLayout(eachRowLayout); passForSudoPanel.setLayout(eachRowLayout); //Creation of individual elements vmIPField= new JTextField(15); passField = new JPasswordField(15); passForSudoField = new JPasswordField(15); vmUserField = new JTextField(15); inputFile = new JTextField(15); vmIPLabel= new JLabel("VM IP", JLabel.CENTER); vmUserLabel= new JLabel("VM user", JLabel.CENTER); inputFileLabel= new JLabel("Input file", JLabel.CENTER); passLabel = new JLabel("password", JLabel.CENTER); passForSudoLabel = new JLabel("root password", JLabel.CENTER); //Configuring individual elements vmIPField.setPreferredSize(new Dimension(80, 20)); vmUserField.setPreferredSize(new Dimension(80, 20)); inputFile.setPreferredSize(new Dimension(80, 20)); passField.setPreferredSize(new Dimension(80, 20)); passForSudoField.setPreferredSize(new Dimension(80, 20)); //Attaching elements to panels vmIPPanel.add(vmIPLabel); vmIPPanel.add(vmIPField); vmUserPanel.add(vmUserLabel); vmUserPanel.add(vmUserField); inputFilePanel.add(inputFileLabel); inputFilePanel.add(inputFile); passPanel.add(passLabel); passPanel.add(passField); passForSudoPanel.add(passForSudoLabel); passForSudoPanel.add(passForSudoField); add(vmIPPanel); add(vmUserPanel); add(inputFilePanel); add(passPanel); add(passForSudoPanel); } public ArrayList<String> getValues(){ String pass=""; char[] passChars = passField.getPassword(); for (int i=0; i<passChars.length; i++){ pass=pass+Character.toString(passChars[i]); } String passForSudo=""; char[] passForSudoChars = passForSudoField.getPassword(); for (int i=0; i<passForSudoChars.length; i++){ passForSudo=passForSudo+Character.toString(passForSudoChars[i]); } ArrayList<String> values = new ArrayList<String>(); values.add(vmIPField.getText()); values.add(vmUserField.getText()); values.add(inputFile.getText()); values.add(pass); values.add(passForSudo); return values; } public boolean allValuesCompleted(){ if (!(inputFile.getText().equals("")) && !(vmIPField.getText().equals("")) && !(vmUserField.getText().equals("")) && !(passField.getPassword().length==0) && !(passForSudoField.getPassword().length==0)){ return true; }else return false; } }
[ "fotais@mail.ntua.gr" ]
fotais@mail.ntua.gr
c4dcd59809987e93c5518222dd2d098a7bf37d53
17c1f7fc8f73990da33becfb03484232b71f006a
/src/main/java/gg/bayes/challenge/service/impl/CombatLogLineProcessorImpl.java
a7f69c854fffe83e5126ed05f06d2cf8ae8f9cce
[]
no_license
degez/bayes-java-code-challenge-1
cd8dc6ca0873645150178e0109bc5123103bd684
86ef939fca804e34884b2e9c790a7175322163d9
refs/heads/master
2022-06-06T16:43:46.032885
2020-05-07T04:36:13
2020-05-07T04:36:13
261,949,706
0
0
null
null
null
null
UTF-8
Java
false
false
4,815
java
package gg.bayes.challenge.service.impl; import gg.bayes.challenge.exception.InvalidTimeFormatException; import gg.bayes.challenge.service.CombatLogLineProcessor; import gg.bayes.challenge.service.model.HeroDamageAction; import gg.bayes.challenge.service.model.HeroItemsAction; import gg.bayes.challenge.service.model.HeroKillsAction; import gg.bayes.challenge.service.model.HeroSpellsAction; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.sql.Timestamp; import java.text.ParseException; import java.text.SimpleDateFormat; @Slf4j @Service public class CombatLogLineProcessorImpl implements CombatLogLineProcessor { @Value("${prefix.to.remove.hero:npc_dota_hero_}") private String prefixToRemoveHero; @Value("${prefix.to.remove.item:item_}") private String prefixToRemoveItem; @Value("${input.bulk.index.time:0}") private Integer timeIndex; @Value("${input.bulk.index.hero:1}") private Integer heroNameIndex; @Value("${input.bulk.index.item:4}") private Integer itemIndex; @Value("${input.bulk.index.target:3}") private Integer targetIndex; @Value("${input.bulk.index.damage:7}") private Integer damageIndex; @Value("${input.bulk.index.kill:5}") private Integer killIndex; @Value("${input.bulk.index.spell:4}") private Integer spellIndex; @Autowired SimpleDateFormat simpleDateFormat; @Override public HeroItemsAction extractHeroItemAction(String line) { HeroItemsAction heroItemsAction = new HeroItemsAction(); String[] lineParts = StringUtils.split(line); String timeRaw = lineParts[timeIndex]; String heroNameRaw = lineParts[heroNameIndex]; String itemRaw = lineParts[itemIndex]; Long time = convertTimeValue(timeRaw); String heroName = StringUtils.removeStart(heroNameRaw, prefixToRemoveHero); String item = StringUtils.removeStart(itemRaw, prefixToRemoveItem); heroItemsAction.setTimestamp(time); heroItemsAction.setHeroName(heroName); heroItemsAction.setItem(item); log.info("extracted hero item: {}", heroItemsAction); return heroItemsAction; } @Override public HeroDamageAction extractHeroDamageAction(String line) { HeroDamageAction heroDamageAction = new HeroDamageAction(); String[] lineParts = StringUtils.split(line); String heroNameRaw = lineParts[heroNameIndex]; String targetRaw = lineParts[targetIndex]; String damageRaw = lineParts[damageIndex]; String heroName = StringUtils.removeStart(heroNameRaw, prefixToRemoveHero); String target = StringUtils.removeStart(targetRaw, prefixToRemoveHero); Integer damage = Integer.valueOf(damageRaw); heroDamageAction.setDamage(damage); heroDamageAction.setHeroName(heroName); heroDamageAction.setTarget(target); log.info("extracted hero damage action: {}", heroDamageAction); return heroDamageAction; } @Override public HeroKillsAction extractHeroKillsAction(String line) { HeroKillsAction heroKillsAction = new HeroKillsAction(); String[] lineParts = StringUtils.split(line); String killerHeroNameRaw = lineParts[killIndex]; String heroName = StringUtils.removeStart(killerHeroNameRaw, prefixToRemoveHero); heroKillsAction.setHero(heroName); log.info("extracted hero kills action: {}", heroKillsAction); return heroKillsAction; } @Override public HeroSpellsAction extractHeroSpellsAction(String line) { HeroSpellsAction heroSpellsAction = new HeroSpellsAction(); String[] lineParts = StringUtils.split(line); String heroNameRaw = lineParts[heroNameIndex]; String spellNameRaw = lineParts[spellIndex]; String heroName = StringUtils.removeStart(heroNameRaw, prefixToRemoveHero); String spellName = StringUtils.removeStart(spellNameRaw, heroName + "_"); heroSpellsAction.setHero(heroName); heroSpellsAction.setSpell(spellName); log.info("extracted hero spells action: {}", heroSpellsAction); return heroSpellsAction; } private Long convertTimeValue(String timeRaw) { Timestamp time = null; timeRaw = StringUtils.removeEnd(timeRaw, "]"); timeRaw = StringUtils.removeStart(timeRaw, "["); try { time = new Timestamp(simpleDateFormat.parse(timeRaw).getTime()); } catch (ParseException e) { throw new InvalidTimeFormatException(); } return time.getTime(); } }
[ "degezz@gmail.com" ]
degezz@gmail.com
c99a0d87103339024b8afcb0f4aa516c70fd993b
2caa2e42bc1b985a3899e90db94df429e40590ba
/src/main/java/com/jeffpeng/jmod/forgeevents/JMODAddBuffsEvent.java
5a37715e6e02a7e312f19cdc9b7954a7612ee50b
[ "MIT" ]
permissive
donniereese/JMOD
3848d356e129d8394b8a249b9fcf7d6a543776d3
5e3d739a92a7ea7ddef61ed98bf879bcd7a37a9d
refs/heads/master
2021-04-10T00:33:58.886134
2017-03-21T10:26:51
2017-03-21T10:26:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
281
java
package com.jeffpeng.jmod.forgeevents; import java.util.Map; import net.minecraft.potion.Potion; public class JMODAddBuffsEvent extends JMODForgeEvent { public Map<String,Potion> buffMap; public JMODAddBuffsEvent(Map<String,Potion> buffMap){ this.buffMap = buffMap; } }
[ "sk@urbanhosting.de" ]
sk@urbanhosting.de
11f1b6a1e29d3bf0c1ca75d25f913a95277f7d8d
28d51728bc334ba93c20405073758e44e308c6e1
/ jssp-and-immunes/JSSP_inmune/src/ch17/fig17_09_10/ReadTextFile.java
1122a56c6759153cba475e5d7f37fabae797c218
[]
no_license
blackynay/jssp-and-immunes
9f3cffa36508bf587a5215e3b39520a16f12bcea
82261db52998242cc64889691713de12b051b96b
refs/heads/master
2021-01-10T14:13:12.203644
2012-10-26T01:22:05
2012-10-26T01:22:05
47,899,849
0
0
null
null
null
null
UTF-8
Java
false
false
3,435
java
// Fig. 17.09: ReadTextFile.java // This program reads a text file and displays each record. package ch17.fig17_09_10; import java.io.File; import java.io.FileNotFoundException; import java.lang.IllegalStateException; import java.util.NoSuchElementException; import java.util.Scanner; import ch17.fig17_04.AccountRecord; public class ReadTextFile { private Scanner input; // enable user to open file public void openFile() { try { input = new Scanner( new File( "C:\archivos nelson\proyecto inmune\JSSP_inmune\src\aia_g_jssp\clients.txt") ); } // end try catch ( FileNotFoundException fileNotFoundException ) { System.err.println( "Error opening file." ); System.exit( 1 ); } // end catch } // end method openFile // read record from file public void readRecords() { // object to be written to screen AccountRecord record = new AccountRecord(); System.out.printf( "%-10s%-12s%-12s%10s\n", "Account", "First Name", "Last Name", "Balance" ); try // read records from file using Scanner object { while ( input.hasNext() ) { record.setAccount( input.nextInt() ); // read account number record.setFirstName( input.next() ); // read first name record.setLastName( input.next() ); // read last name record.setBalance( input.nextDouble() ); // read balance // display record contents System.out.printf( "%-10d%-12s%-12s%10.2f\n", record.getAccount(), record.getFirstName(), record.getLastName(), record.getBalance() ); } // end while } // end try catch ( NoSuchElementException elementException ) { System.err.println( "File improperly formed." ); input.close(); System.exit( 1 ); } // end catch catch ( IllegalStateException stateException ) { System.err.println( "Error reading from file." ); System.exit( 1 ); } // end catch } // end method readRecords // close file and terminate application public void closeFile() { if ( input != null ) input.close(); // close file } // end method closeFile } // end class ReadTextFile /************************************************************************* * (C) Copyright 1992-2012 by Deitel & Associates, Inc. and * * Pearson Education, Inc. All Rights Reserved. * * * * DISCLAIMER: The authors and publisher of this book have used their * * best efforts in preparing the book. These efforts include the * * development, research, and testing of the theories and programs * * to determine their effectiveness. The authors and publisher make * * no warranty of any kind, expressed or implied, with regard to these * * programs or to the documentation contained in these books. The authors * * and publisher shall not be liable in any event for incidental or * * consequential damages in connection with, or arising out of, the * * furnishing, performance, or use of these programs. * *************************************************************************/
[ "epsilon1530@gmail.com" ]
epsilon1530@gmail.com
3bf80e6866b2ecd189db88dbd767ad3047ad825d
6ba99b06cb794aaebc87b4a0aefcbdf7471c2f8c
/src/main/java/com/geektry/console/framework/HandlerInterceptorImpl.java
ba80d19082279cffe220edd910c2f1def3e92594
[]
no_license
geektry/console
cb367cbea0fdd28c7955edeacf3959bb7569a4b5
6c89d8d50471d501b6530e7e3334f713a4fcbda1
refs/heads/master
2020-04-05T04:26:32.630831
2019-01-15T12:40:40
2019-01-15T12:40:40
156,551,562
2
0
null
null
null
null
UTF-8
Java
false
false
1,882
java
package com.geektry.console.framework; import org.springframework.stereotype.Component; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * @author Chaohang Fu */ @Component public class HandlerInterceptorImpl implements HandlerInterceptor { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException { if (!(handler instanceof HandlerMethod)) { return true; } HandlerMethod handlerMethod = (HandlerMethod) handler; boolean isMethodBeanAnnotated = handlerMethod.getBeanType().isAnnotationPresent(TokenRequired.class); boolean isMethodAnnotated = handlerMethod.getMethod().isAnnotationPresent(TokenRequired.class); if (!isMethodBeanAnnotated && !isMethodAnnotated) { return true; } boolean isTokenValid = this.isTokenValid(request.getCookies()); if (isTokenValid) { return true; } boolean isReturnTypeModelAndView = handlerMethod.getMethod().getReturnType().equals(ModelAndView.class); if (isReturnTypeModelAndView) { response.sendRedirect("/login"); return false; } throw new ServiceRuntimeException(RuntimeExceptionMessage.SESSION_EXPIRED); } private boolean isTokenValid(Cookie[] cookies) { if (cookies == null) { return false; } for (Cookie cookie : cookies) { if ("token".equals(cookie.getName())) { return true; } } return false; } }
[ "495337349@qq.com" ]
495337349@qq.com
1e03e7dd7fdaac8c9d7f0b9c4af614b6adf03281
adb88a1a5547fce4657d5329ba0b8dc07840e569
/FreeWalker/libraries/volley/src/main/java/com/android/volley/RequestQueue.java
bad1666afd050aca40193101965dd289bd97a439
[]
no_license
YanyeZhang/Volley-Gson-OkHttp
73db1e75d8ef4decf4467843824222680c805da3
254986cf40afa838bb4de6ad4f0b439d109beab9
refs/heads/master
2016-08-12T09:10:51.481224
2015-11-17T07:03:00
2015-11-17T07:03:00
44,713,982
10
2
null
null
null
null
UTF-8
Java
false
false
11,782
java
/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.volley; import android.os.Handler; import android.os.Looper; import android.util.Log; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Queue; import java.util.Set; import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.atomic.AtomicInteger; /** * A request dispatch queue with a thread pool of dispatchers. * <p/> * Calling {@link #add(Request)} will enqueue the given Request for dispatch, * resolving from either cache or network on a worker thread, and then delivering * a parsed response on the main thread. */ public class RequestQueue { /** * Callback interface for completed requests. */ public interface RequestFinishedListener<T> { /** * Called when a request has finished processing. */ void onRequestFinished(Request<T> request); } /** * Used for generating monotonically-increasing sequence numbers for requests. */ private AtomicInteger mSequenceGenerator = new AtomicInteger(); /** * Staging area for requests that already have a duplicate request in flight. * <p/> * <ul> * <li>containsKey(cacheKey) indicates that there is a request in flight for the given cache * key.</li> * <li>get(cacheKey) returns waiting requests for the given cache key. The in flight request * is <em>not</em> contained in that list. Is null if no requests are staged.</li> * </ul> */ private final Map<String, Queue<Request<?>>> mWaitingRequests = new HashMap<String, Queue<Request<?>>>(); /** * The set of all requests currently being processed by this RequestQueue. A Request * will be in this set if it is waiting in any queue or currently being processed by * any dispatcher. */ private final Set<Request<?>> mCurrentRequests = new HashSet<Request<?>>(); /** * The cache triage queue. */ private final PriorityBlockingQueue<Request<?>> mCacheQueue = new PriorityBlockingQueue<Request<?>>(); /** * The queue of requests that are actually going out to the network. */ private final PriorityBlockingQueue<Request<?>> mNetworkQueue = new PriorityBlockingQueue<Request<?>>(); /** * Number of network request dispatcher threads to start. */ private static final int DEFAULT_NETWORK_THREAD_POOL_SIZE = 4; /** * Cache interface for retrieving and storing responses. */ private final Cache mCache; /** * Network interface for performing requests. */ private final Network mNetwork; /** * Response delivery mechanism. */ private final ResponseDelivery mDelivery; /** * The network dispatchers. */ private NetworkDispatcher[] mDispatchers; /** * The cache dispatcher. */ private CacheDispatcher mCacheDispatcher; private List<RequestFinishedListener> mFinishedListeners = new ArrayList<RequestFinishedListener>(); /** * Creates the worker pool. Processing will not begin until {@link #start()} is called. * * @param cache A Cache to use for persisting responses to disk * @param network A Network interface for performing HTTP requests * @param threadPoolSize Number of network dispatcher threads to create * @param delivery A ResponseDelivery interface for posting responses and errors */ public RequestQueue(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery) { mCache = cache; mNetwork = network; mDispatchers = new NetworkDispatcher[threadPoolSize]; mDelivery = delivery; } /** * Creates the worker pool. Processing will not begin until {@link #start()} is called. * * @param cache A Cache to use for persisting responses to disk * @param network A Network interface for performing HTTP requests * @param threadPoolSize Number of network dispatcher threads to create */ public RequestQueue(Cache cache, Network network, int threadPoolSize) { this(cache, network, threadPoolSize, new ExecutorDelivery(new Handler(Looper.getMainLooper()))); } /** * Creates the worker pool. Processing will not begin until {@link #start()} is called. * * @param cache A Cache to use for persisting responses to disk * @param network A Network interface for performing HTTP requests */ public RequestQueue(Cache cache, Network network) { this(cache, network, DEFAULT_NETWORK_THREAD_POOL_SIZE); } /** * Starts the dispatchers in this queue. */ public void start() { stop(); // Make sure any currently running dispatchers are stopped. // Create the cache dispatcher and start it. mCacheDispatcher = new CacheDispatcher(mCacheQueue, mNetworkQueue, mCache, mDelivery); mCacheDispatcher.start(); // Create network dispatchers (and corresponding threads) up to the pool size. for (int i = 0; i < mDispatchers.length; i++) { NetworkDispatcher networkDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork, mCache, mDelivery); mDispatchers[i] = networkDispatcher; networkDispatcher.start(); } } /** * Stops the cache and network dispatchers. */ public void stop() { if (mCacheDispatcher != null) { mCacheDispatcher.quit(); } for (int i = 0; i < mDispatchers.length; i++) { if (mDispatchers[i] != null) { mDispatchers[i].quit(); } } } /** * Gets a sequence number. */ public int getSequenceNumber() { return mSequenceGenerator.incrementAndGet(); } /** * Gets the {@link Cache} instance being used. */ public Cache getCache() { return mCache; } /** * A simple predicate or filter interface for Requests, for use by * {@link RequestQueue#cancelAll(RequestFilter)}. */ public interface RequestFilter { boolean apply(Request<?> request); } /** * Cancels all requests in this queue for which the given filter applies. * * @param filter The filtering function to use */ public void cancelAll(RequestFilter filter) { synchronized (mCurrentRequests) { for (Request<?> request : mCurrentRequests) { if (filter.apply(request)) { request.cancel(); } } } } /** * Cancels all requests in this queue with the given tag. Tag must be non-null * and equality is by identity. */ public void cancelAll(final Object tag) { if (tag == null) { throw new IllegalArgumentException("Cannot cancelAll with a null tag"); } cancelAll(new RequestFilter() { @Override public boolean apply(Request<?> request) { return request.getTag() == tag; } }); } /** * Adds a Request to the dispatch queue. * * @param request The request to service * @return The passed-in request */ public <T> Request<T> add(Request<T> request) { // Tag the request as belonging to this queue and add it to the set of current requests. request.setRequestQueue(this); synchronized (mCurrentRequests) { mCurrentRequests.add(request); } // Process requests in the order they are added. request.setSequence(getSequenceNumber()); request.addMarker("add-to-queue"); // If the request is uncacheable, skip the cache queue and go straight to the network. if (!request.shouldCache()) { mNetworkQueue.add(request); return request; } // Insert request into stage if there's already a request with the same cache key in flight. synchronized (mWaitingRequests) { String cacheKey = request.getCacheKey(); if (mWaitingRequests.containsKey(cacheKey)) { // There is already a request in flight. Queue up. Queue<Request<?>> stagedRequests = mWaitingRequests.get(cacheKey); if (stagedRequests == null) { stagedRequests = new LinkedList<Request<?>>(); } stagedRequests.add(request); mWaitingRequests.put(cacheKey, stagedRequests); if (VolleyLog.DEBUG) { VolleyLog.v("Request for cacheKey=%s is in flight, putting on hold.", cacheKey); } } else { // Insert 'null' queue for this cacheKey, indicating there is now a request in // flight. mWaitingRequests.put(cacheKey, null); mCacheQueue.add(request); } return request; } } /** * Called from {@link Request#finish(String)}, indicating that processing of the given request * has finished. * <p/> * <p>Releases waiting requests for <code>request.getCacheKey()</code> if * <code>request.shouldCache()</code>.</p> */ <T> void finish(Request<T> request) { // Remove from the set of requests currently being processed. synchronized (mCurrentRequests) { mCurrentRequests.remove(request); } synchronized (mFinishedListeners) { for (RequestFinishedListener<T> listener : mFinishedListeners) { listener.onRequestFinished(request); } } if (request.shouldCache()) { synchronized (mWaitingRequests) { String cacheKey = request.getCacheKey(); Queue<Request<?>> waitingRequests = mWaitingRequests.remove(cacheKey); if (waitingRequests != null) { if (VolleyLog.DEBUG) { VolleyLog.v("Releasing %d waiting requests for cacheKey=%s.", waitingRequests.size(), cacheKey); } // Process all queued up requests. They won't be considered as in flight, but // that's not a problem as the cache has been primed by 'request'. mCacheQueue.addAll(waitingRequests); } } } } public <T> void addRequestFinishedListener(RequestFinishedListener<T> listener) { synchronized (mFinishedListeners) { mFinishedListeners.add(listener); } } /** * Remove a RequestFinishedListener. Has no effect if listener was not previously added. */ public <T> void removeRequestFinishedListener(RequestFinishedListener<T> listener) { synchronized (mFinishedListeners) { mFinishedListeners.remove(listener); } } }
[ "419776494@qq.com" ]
419776494@qq.com
b3984e68547fd20e4e2e91e0795c36517c54bda1
e7765fef3d90e6ee59cbba5bdea3e8f028239c38
/src/com/start/netty/httpfile/HttpProxyConfig.java
b618248bafa1fb8384a0771d8944a71d0fad560d
[]
no_license
BrightStarry/socket
55cda3ed428b99bae80cc95fb52f14f4ee05fa32
0ef606b6b692b9b4d499815cc6c8c6e6bd5e2c0e
refs/heads/master
2021-01-20T10:20:57.384051
2017-05-05T07:08:35
2017-05-05T07:08:35
90,347,533
1
2
null
null
null
null
UTF-8
Java
false
false
479
java
package com.start.netty.httpfile; /** * <br> * 类 名: HttpCallerConfig <br> * 描 述: http属性配置参数 <br> */ public class HttpProxyConfig { /** * 最大连接数 */ public static int MAX_TOTAL_CONNECTIONS = 800; /** * 每个路由最大连接数 */ public static int MAX_ROUTE_CONNECTIONS = 400; /** * 连接超时时间 */ public static int CONNECT_TIMEOUT = 10000; /** * 读取超时时间 */ public static int READ_TIMEOUT = 10000; }
[ "970389745@qq.com" ]
970389745@qq.com
d8223c72798b1d372262f44099d80c20516279d0
c591166f577f4eb3b5281167ea7c8b5cec7b204e
/src/main/java/com/tekwill/java/fundamentals/triviaspringboot/TriviaSpringBootApplication.java
7d792e58c42b8a116de8715f8c25c1592d56ac46
[ "MIT" ]
permissive
alexica3000/trivia-spring-boot
0fa83578b8a2f643b259b937e9b3c2303c51a994
7bc58cd6363c803be69d25edde774dbd3b4e16cf
refs/heads/main
2023-03-19T03:35:41.515825
2021-03-08T21:19:26
2021-03-08T21:19:26
344,262,033
0
0
null
null
null
null
UTF-8
Java
false
false
1,736
java
package com.tekwill.java.fundamentals.triviaspringboot; import com.tekwill.java.fundamentals.triviaspringboot.engine.TriviaAdmin; import com.tekwill.java.fundamentals.triviaspringboot.engine.TriviaGame; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import java.util.Scanner; @SpringBootApplication @Slf4j public class TriviaSpringBootApplication { public static void main(String[] args) { SpringApplication.run(TriviaSpringBootApplication.class, args); } @Bean public CommandLineRunner commandLineRunner(TriviaAdmin triviaAdmin, TriviaGame triviaGame){ return args -> { log.info("Game is loading up..."); Scanner scanner = new Scanner(System.in); boolean gameMenuRunning = true; do { System.out.println("Enter [START] to start the game or [EXIT] to quit..."); String response = scanner.nextLine(); if (response.equalsIgnoreCase("START")) { triviaGame.startGame(); } else if (response.equalsIgnoreCase("ADMIN")) { triviaAdmin.start(); } else if (response.equalsIgnoreCase("EXIT")) { System.out.println("Bye, bye!"); gameMenuRunning = false; } else { System.out.println("Enter [START] to start the game or [EXIT] to quit..."); } } while (gameMenuRunning); log.info("Game shutdown..."); }; } }
[ "sanatateacom@gmail.com" ]
sanatateacom@gmail.com
49e0e2478bad820ad53fa4cd6e61540453e3e41b
5d8eb6f4f93c50b38ceaad7813d5d625faacf37d
/app/src/main/java/lcs/android/creature/health/BodyPart.java
9592bababae9ba191b0d6285ab68bf836278ec8d
[]
no_license
sidav/LCS-android
376d692e6d5b2d5568417d14eb56efcb47657783
77d39f7fdc6255133b5510cf1b29794576b605b7
refs/heads/master
2020-04-02T06:10:01.649140
2018-10-22T12:21:11
2018-10-22T12:21:34
154,133,595
0
0
null
null
null
null
UTF-8
Java
false
false
956
java
package lcs.android.creature.health; import java.util.EnumSet; import java.util.Set; import lcs.android.util.DefaultValueKey; // import org.eclipse.jdt.annotation.NonNullByDefault; /** Parts of the body. * @author addie */ public enum BodyPart implements DefaultValueKey<Set<Wound>> { ARM_LEFT("left arm", 20), ARM_RIGHT("right arm", 20), BODY("body", 100), HEAD("head", 10), LEG_LEFT("left leg", 40), LEG_RIGHT("right leg", 40); BodyPart(final String name, final int sever) { displayName = name; severAmount = sever; } private final String displayName; private final int severAmount; @Override public Set<Wound> defaultValue() { return EnumSet.noneOf(Wound.class); } /** Amount of damage required to sever. * @return a damage amount. */ public int severAmount() { return severAmount; } @Override public String toString() { return displayName; } }
[ "vkovun@phoenixit.ru" ]
vkovun@phoenixit.ru
b1e07c02e67bae51d92cec2e97c9a61a460b46d7
bea97ead6a2f17f47b793838f3197715ab915fd2
/src/se450finalproject/Item.java
8bae8bb98df35b5f171c221b769a5af806a00f08
[]
no_license
ericalunkle/SE450
9a108fc7557a5babad3e27a4c44ca5b44a7b226b
24ecaa95f530f339b76db958259b004aea045d3c
refs/heads/master
2020-04-20T22:24:39.886621
2019-02-04T19:57:45
2019-02-04T19:57:45
169,138,385
0
0
null
2019-02-04T19:55:49
2019-02-04T19:48:30
null
UTF-8
Java
false
false
692
java
package se450finalproject; public class Item { private String itemId; private int price; public Item(String itemId, int price) throws InvalidDataException{ super(); setItemId(itemId); setPrice(price); } public String getItemId() { return itemId; } public void setItemId(String itemId) { this.itemId = itemId; } public int getPrice() { return price; } public void setPrice(int price) throws InvalidDataException{ if(price < 0){ throw new InvalidDataException("Item price is negative"); } this.price = price; } @Override public String toString() { return "Item [itemId=" + itemId + ", price=" + price + "]"; } }
[ "31661664+ericalunkle@users.noreply.github.com" ]
31661664+ericalunkle@users.noreply.github.com
277d09b5f4afcbadffb2f7da2051d4f458e9b341
a4cb372ced240bf1cf0a9d123bdd4a805ff05df6
/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicatorTests.java
1d151e882544dab1bf13ed1e13a4147d427376c9
[]
no_license
ZhaoBinxian/spring-boot-maven-ben
c7ea6a431c3206959009ff5344547436e98d75ca
ebd43548bae1e35fff174c316ad154cd0e5defb3
refs/heads/master
2023-07-18T12:53:49.028864
2021-09-07T04:55:54
2021-09-07T04:55:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,690
java
/* * Copyright 2012-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.boot.actuate.system; import java.io.File; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.boot.actuate.health.Status; import org.springframework.util.unit.DataSize; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; /** * Tests for {@link DiskSpaceHealthIndicator}. * * @author Mattias Severson * @author Stephane Nicoll */ @ExtendWith(MockitoExtension.class) class DiskSpaceHealthIndicatorTests { private static final DataSize THRESHOLD = DataSize.ofKilobytes(1); private static final DataSize TOTAL_SPACE = DataSize.ofKilobytes(10); @Mock private File fileMock; private HealthIndicator healthIndicator; @BeforeEach void setUp() { this.healthIndicator = new DiskSpaceHealthIndicator(this.fileMock, THRESHOLD); } @Test void diskSpaceIsUp() { given(this.fileMock.exists()).willReturn(true); long freeSpace = THRESHOLD.toBytes() + 10; given(this.fileMock.getUsableSpace()).willReturn(freeSpace); given(this.fileMock.getTotalSpace()).willReturn(TOTAL_SPACE.toBytes()); Health health = this.healthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getDetails().get("threshold")).isEqualTo(THRESHOLD.toBytes()); assertThat(health.getDetails().get("free")).isEqualTo(freeSpace); assertThat(health.getDetails().get("total")).isEqualTo(TOTAL_SPACE.toBytes()); assertThat(health.getDetails().get("exists")).isEqualTo(true); } @Test void diskSpaceIsDown() { given(this.fileMock.exists()).willReturn(true); long freeSpace = THRESHOLD.toBytes() - 10; given(this.fileMock.getUsableSpace()).willReturn(freeSpace); given(this.fileMock.getTotalSpace()).willReturn(TOTAL_SPACE.toBytes()); Health health = this.healthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.DOWN); assertThat(health.getDetails().get("threshold")).isEqualTo(THRESHOLD.toBytes()); assertThat(health.getDetails().get("free")).isEqualTo(freeSpace); assertThat(health.getDetails().get("total")).isEqualTo(TOTAL_SPACE.toBytes()); assertThat(health.getDetails().get("exists")).isEqualTo(true); } @Test void whenPathDoesNotExistDiskSpaceIsDown() { Health health = new DiskSpaceHealthIndicator(new File("does/not/exist"), THRESHOLD).health(); assertThat(health.getStatus()).isEqualTo(Status.DOWN); assertThat(health.getDetails().get("free")).isEqualTo(0L); assertThat(health.getDetails().get("total")).isEqualTo(0L); assertThat(health.getDetails().get("exists")).isEqualTo(false); } }
[ "zhaobinxian@greatyun.com" ]
zhaobinxian@greatyun.com
1c157f639b60b0ddde79bd8131d2fa4353371f95
abc8c713d508aa0809eb3e053d239c4133bc6671
/src/main/java/com/laver/design/pattren/creational/builder/CourseActualBuilder.java
70ee4f04d84abbed6da950185e7f423d7a5ad389
[]
no_license
Laverrr/design_pattern
16f31f3872cec0c218661d440ae3e79dea77bfd3
f9285d624ea3e702c30a5b05f63173716a0fc754
refs/heads/master
2020-04-09T08:47:41.960620
2018-12-20T12:19:50
2018-12-20T12:19:50
160,208,465
0
0
null
null
null
null
UTF-8
Java
false
false
799
java
package com.laver.design.pattren.creational.builder; public class CourseActualBuilder extends CourseBuilder { private Course course = new Course(); @Override public void buildCourseName(String courseName) { course.setCourseName(courseName); } @Override public void buildPPT(String coursePPT) { course.setCoursePPT(coursePPT); } @Override public void buildVideo(String courseVideo) { course.setCourseVideo(courseVideo); } @Override public void buildArticle(String courseArticle) { course.setCourseArticle(courseArticle); } @Override public void buildCourseQA(String courseQA) { course.setCourseQA(courseQA); } @Override public Course makeCourse() { return course; } }
[ "447205752@qq.com" ]
447205752@qq.com
54e999c5bccfaba7ab398155649c6ca46826de2f
3bf35d9b6edd150d7fea0df16a21487dda826303
/app/src/main/java/com/example/mwx337293/splash/Splash.java
0d5c467af83eb6e4f091f0179574e7bc18b45111
[]
no_license
mohamedmagdy710/Splash
211278ee2f68baf4fdf9141ac0e4232163c51020
cc02e60672f2662ef5badb84b8fd69ab81689a6b
refs/heads/master
2020-09-20T18:44:39.279325
2016-08-23T21:01:54
2016-08-23T21:01:54
66,291,886
0
0
null
null
null
null
UTF-8
Java
false
false
942
java
package com.example.mwx337293.splash; import android.content.Intent; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.Window; import android.view.WindowManager; public class Splash extends AppCompatActivity { private final int SPLASH_DISPLAY_LENGTH = 3000; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); new Handler().postDelayed(new Runnable(){ @Override public void run() { /* Create an Intent that will start the Menu-Activity. */ Intent mainIntent = new Intent(Splash.this,MainActivity.class); Splash.this.startActivity(mainIntent); Splash.this.finish(); } }, SPLASH_DISPLAY_LENGTH); } }
[ "mWX337293@china.huawei.com" ]
mWX337293@china.huawei.com
c09f1bdbd2b14e05f7b5bb13d0b91fb08bbdc242
58822b5c6c22bc6ac9e301989b068c714d177587
/src/main/java/aws/example/s3/GetObject.java
a68c24c6658550a413c99ea191b3e0b6a7b22011
[]
no_license
bofei222/s3examples
5f52bf5f526a9c9f8be822241b347edbcac70ef7
406f8fab26153dcbcb4b899f874a2bd9273d22a7
refs/heads/master
2020-04-15T04:30:26.115649
2019-04-19T03:01:38
2019-04-19T03:01:38
163,961,785
0
0
null
null
null
null
UTF-8
Java
false
false
3,091
java
//snippet-sourcedescription:[GetObject.java demonstrates how to get an object within an Amazon S3 bucket.] //snippet-keyword:[Java] //snippet-keyword:[Code Sample] //snippet-keyword:[Amazon S3] //snippet-keyword:[getObject] //snippet-service:[s3] //snippet-sourcetype:[full-example] //snippet-sourcedate:[] //snippet-sourceauthor:[soo-aws] /* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. This file is licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at http://aws.amazon.com/apache2.0/ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package aws.example.s3; import com.amazonaws.AmazonServiceException; import com.amazonaws.regions.Regions; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.amazonaws.services.s3.model.S3Object; import com.amazonaws.services.s3.model.S3ObjectInputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; /** * Get an object within an Amazon S3 bucket. * * This code expects that you have AWS credentials set up per: * http://docs.aws.amazon.com/java-sdk/latest/developer-guide/setup-credentials.html */ public class GetObject { public static void main(String[] args) { final String USAGE = "\n" + "To run this example, supply the name of an S3 bucket and object to\n" + "download from it.\n" + "\n" + "Ex: GetObject <bucketname> <filename>\n"; if (args.length < -2) { System.out.println(USAGE); System.exit(1); } String bucket_name = "com.bf"; String key_name = "图片/杰尼龟.jpg"; System.out.format("Downloading %s from S3 bucket %s...\n", key_name, bucket_name); AmazonS3 s3 = AmazonS3ClientBuilder.standard().withRegion(Regions.AP_NORTHEAST_1).build(); try { S3Object o = s3.getObject(bucket_name, key_name); S3ObjectInputStream s3is = o.getObjectContent(); FileOutputStream fos = new FileOutputStream(new File(key_name)); byte[] read_buf = new byte[1024]; int read_len = 0; while ((read_len = s3is.read(read_buf)) > 0) { fos.write(read_buf, 0, read_len); } s3is.close(); fos.close(); } catch (AmazonServiceException e) { System.err.println(e.getErrorMessage()); System.exit(1); } catch (FileNotFoundException e) { System.err.println(e.getMessage()); System.exit(1); } catch (IOException e) { System.err.println(e.getMessage()); System.exit(1); } System.out.println("Done!"); } }
[ "bofei222@163.com" ]
bofei222@163.com
f13ff7d65826134abb36754dc29029a76fbb884f
4aa085345ba4a154d51b23969cabfd00e906eda5
/JAVA/BinarySearchTrees/src/com/abhisheksingh/Main.java
e0e4143faefc0df671bf15af48677ccaf4498a19
[]
no_license
abhishekxix/Programs
f2f807c84daa550333d9abec64e01d0d41e2dc2a
cf3c98bef6558df3ffa7839eb9258b30c6cdade9
refs/heads/main
2023-03-09T18:45:11.728929
2021-02-26T15:15:36
2021-02-26T15:22:24
341,647,945
0
0
null
null
null
null
UTF-8
Java
false
false
4,444
java
package com.abhisheksingh; import java.util.ArrayList; public class Main { public static void main(String[] args) { /* BinarySearchTree binarySearchTree = new BinarySearchTree(5); binarySearchTree.insert(1); binarySearchTree.insert(2); binarySearchTree.insert(3); binarySearchTree.insert(4); binarySearchTree.insert(6); binarySearchTree.insert(7); binarySearchTree.insert(8); binarySearchTree.insert(9); binarySearchTree.insert(10); BinarySearchTree.Node result = BinarySearchTree.find(5, binarySearchTree.getRootOfTheTree()); System.out.println(result.getKey()); result = BinarySearchTree.find(6, binarySearchTree.getRootOfTheTree()); System.out.println(result.getKey()); result = BinarySearchTree.find(7, binarySearchTree.getRootOfTheTree()); System.out.println(result.getKey()); result = BinarySearchTree.find(8, binarySearchTree.getRootOfTheTree()); System.out.println(result.getKey()); result = BinarySearchTree.find(9, binarySearchTree.getRootOfTheTree()); System.out.println(result.getKey()); result = BinarySearchTree.find(10, binarySearchTree.getRootOfTheTree()); System.out.println(result.getKey()); // binarySearchTree.delete(6); result = BinarySearchTree.find(6, binarySearchTree.getRootOfTheTree()); System.out.println(result.getKey()); binarySearchTree.delete(6); ArrayList<BinarySearchTree.Node> rangeResult = binarySearchTree.rangeSearch(5, 12); for(var i : rangeResult) System.out.print(i.getKey() + " ");*/ AVLTree binarySearchTree = new AVLTree(10); // binarySearchTree.insert(1); // binarySearchTree.insert(2); // binarySearchTree.insert(3); // binarySearchTree.insert(4); // binarySearchTree.insert(6); // binarySearchTree.insert(7); // binarySearchTree.insert(8); // binarySearchTree.insert(9); // binarySearchTree.insert(10); // // AVLTree.Node result = AVLTree.find(5, binarySearchTree.getRoot()); // System.out.println(result.getKey()); // // result = AVLTree.find(6, binarySearchTree.getRoot()); // System.out.println(result.getKey()); // // result = AVLTree.find(7, binarySearchTree.getRoot()); // System.out.println(result.getKey()); // // result = AVLTree.find(8, binarySearchTree.getRoot()); // System.out.println(result.getKey()); // // result = AVLTree.find(9, binarySearchTree.getRoot()); // System.out.println(result.getKey()); // // result = AVLTree.find(10, binarySearchTree.getRoot()); // System.out.println(result.getKey()); // //// binarySearchTree.delete(6); // result = AVLTree.find(6, binarySearchTree.getRoot()); // System.out.println(result.getKey()); //// binarySearchTree.delete(6); // //// for(int i = 1; i <= 10; i++){ //// binarySearchTree.delete(i); //// System.out.println(binarySearchTree.getSize()); //// } // binarySearchTree.inorderTraversal(); // System.out.println(); // // ArrayList<AVLTree.Node> rangeResult = binarySearchTree.rangeSearch(0, 12); // // if(rangeResult != null) // for(var i : rangeResult) // System.out.print(i.getKey() + " "); // // System.out.println(); // result = binarySearchTree.getMax(); // System.out.println("Max : " + result.getKey()); // // result = binarySearchTree.getMin(); // System.out.println("Min : " + result.getKey()); for(int i = 10; i < 16; i++) binarySearchTree.insert(i); binarySearchTree.inorderIt(); System.out.println("The size is : " + binarySearchTree.getSize()); System.out.println("Height is : " + binarySearchTree.height()); AVLTree tree2 = new AVLTree(0); for(int i = 0; i < 10; i++) tree2.insert(i); tree2 = AVLTree.mergeTrees(tree2, binarySearchTree); tree2.inorderIt(); System.out.println(); System.out.println("The size is : " + tree2.getSize()); System.out.println("Height is : " + tree2.height()); AVLTree[] result = tree2.split(6); result[0].inorderIt(); System.out.println(); result[1].inorderIt(); } }
[ "abhisheksinghxix@gmail.com" ]
abhisheksinghxix@gmail.com
c34e1dc0f1ac71a843eba3c9b3505878d22d3469
5b194292814eef63440a6782ea37dcafc1509295
/src/main/java/com/satori/giftlist/repository/DaoImpl/UserDaoImpl.java
ff9bcc01057df36dc54ff2477b30312a302d302c
[]
no_license
LadislavBrecka/GiftList-GenericDAO
9a7c4e40686c4d42c69fcefd2469542075d09e2a
a619c394b3988d467cedcbe867a101a789a11e57
refs/heads/master
2023-02-24T00:13:21.866868
2021-01-25T18:11:48
2021-01-25T18:11:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
524
java
package com.satori.giftlist.repository.DaoImpl; import com.satori.giftlist.domain.User; import com.satori.giftlist.repository.DaoApi.BaseDao; import com.satori.giftlist.repository.DaoApi.UserDao; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import javax.persistence.EntityManager; import java.util.List; @Repository public class UserDaoImpl extends BaseDaoImpl<User> implements UserDao { public UserDaoImpl() { setClazz(User.class); } }
[ "lacoobrecka@gmail.com" ]
lacoobrecka@gmail.com
836f7b5a1520e4adcce2c218223ce83a13264ceb
1dc52c46fa5ea18a3dc4565467cb364a5829a0db
/lacuna/lacuna-core/src/test/java/cx/corp/lacuna/core/windows/WindowsRawMemoryWriterTest.java
230bf5478ee8d8acc22a4ac985b54a1fdd9d1e67
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
huudev/lacuna
f6aba984b1e575844fe7b395d1015646667eacf8
9a22ca30bb7a592cf775a3737b9ae3c4fd593406
refs/heads/master
2023-03-16T07:02:37.288715
2019-01-20T22:46:39
2019-01-20T22:46:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,539
java
package cx.corp.lacuna.core.windows; import cx.corp.lacuna.core.MemoryAccessException; import cx.corp.lacuna.core.ProcessOpenException; import cx.corp.lacuna.core.domain.NativeProcess; import cx.corp.lacuna.core.domain.NativeProcessImpl; import cx.corp.lacuna.core.windows.winapi.WriteProcessMemory; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; public class WindowsRawMemoryWriterTest { private WindowsRawMemoryWriter writer; private MockProcessOpener opener; private WriteProcessMemory writeProcessMemory; private MockProcessHandle handle; private NativeProcess process; @Before public void setUp() { handle = new MockProcessHandle(123); opener = new MockProcessOpener(); writeProcessMemory = (handle, offset, data, numberOfBytes, bytesWritten) -> false; writer = new WindowsRawMemoryWriter( (pid, flags) -> opener.open(pid, flags), (h, o, d, n, b) -> writeProcessMemory.writeProcessMemory(h, o, d, n, b) ); process = new NativeProcessImpl( 12345, NativeProcess.UNKNOWN_DESCRIPTION, NativeProcess.UNKNOWN_OWNER ); } @Test(expected = NullPointerException.class) public void ctorThrowsIfOpenerIsNull() { new WindowsRawMemoryWriter(null, writeProcessMemory); } @Test(expected = NullPointerException.class) public void ctorThrowsIfWriterIsNull() { new WindowsRawMemoryWriter(opener, null); } @Test(expected = NullPointerException.class) public void writeThrowsIfProcessIsNull() { writer.write(null, 0, new byte[]{1}); } @Test(expected = IllegalArgumentException.class) public void writeThrowsIfBufferDoesntHaveElements() { writer.write(process, 0, new byte[0]); } @Test(expected = MemoryAccessException.class) public void writeThrowsIfWriteProcessMemoryFails() { opener.setOpenReturnValue(handle); writeProcessMemory = (handle1, offset, data, numberOfBytes, bytesWritten) -> false; writer.write(process, 0, new byte[]{123}); } @Test(expected = ProcessOpenException.class) public void writeThrowsIfProcessCannotBeOpened() { opener.throwExceptionOnOpen(); writer.write(process, 0, new byte[]{52, 4}); } @Test public void writeUsesCorrectHandleWhenWriting() { int expectedHandle = 4125; handle.setNativeHandle(expectedHandle); opener.setOpenReturnValue(handle); opener.doNotThrowExceptionOnOpen(); writeProcessMemory = (handle1, offset, data, numberOfBytes, bytesWritten) -> { assertEquals(expectedHandle, handle1); return true; }; writer.write(process, 0, new byte[]{5}); } @Test public void writeWritesToRightOffset() { int writeOffset = 0xBA1BA1; opener.setOpenReturnValue(handle); opener.doNotThrowExceptionOnOpen(); writeProcessMemory = (handle1, offset, data, numberOfBytes, bytesWritten) -> { assertEquals(writeOffset, offset); return true; }; writer.write(process, writeOffset, new byte[]{5}); } @Test public void writeWritesCorrectBytes() { byte[] expectedData = { 1, 2, 52, -42, 98, -58, -123 }; opener.setOpenReturnValue(handle); opener.doNotThrowExceptionOnOpen(); writeProcessMemory = (handle1, offset, data, numberOfBytes, bytesWritten) -> { assertArrayEquals(expectedData, data); return true; }; writer.write(process, 0, expectedData); } @Test public void writeUsesCorrectAmountOfBytes() { byte[] expectedData = { 1, 2, 52, -42, 98, -58, -123 }; opener.setOpenReturnValue(handle); opener.doNotThrowExceptionOnOpen(); writeProcessMemory = (handle1, offset, data, numberOfBytes, bytesWritten) -> { assertEquals(expectedData.length, numberOfBytes); return true; }; writer.write(process, 0, expectedData); } @Test public void writeWritesOneByteCorrectly() { byte[] expectedData = {1}; opener.setOpenReturnValue(handle); opener.doNotThrowExceptionOnOpen(); writeProcessMemory = (h, o, data, n, b) -> { assertArrayEquals(expectedData, data); return true; }; writer.write(process, 0, expectedData); } }
[ "joona.o.heikkila@gmail.com" ]
joona.o.heikkila@gmail.com
cf31bd258098823f6877020e18de22f6a0ee3bd7
f1a1ec177622016519634ee9a81fc3fa2b2d1964
/app/src/main/java/com/bikeapp/xueyi/fragment/WeatherFragment.java
4608f32b4d756c68581d752028db07ccc0b8c575
[]
no_license
xueyigithub/MyBikeApp
9375fc360c1af75fe30097eb0156e91df87f9659
e05e34560b8fdf692874f1bf95d48aefafb6ca24
refs/heads/master
2021-01-10T01:20:46.259481
2016-01-11T04:32:55
2016-01-11T04:32:55
48,795,101
0
0
null
null
null
null
UTF-8
Java
false
false
971
java
package com.bikeapp.xueyi.fragment; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.WebView; import android.webkit.WebViewClient; import com.bikeapp.xueyi.mybikeapp.R; import butterknife.Bind; import butterknife.ButterKnife; public class WeatherFragment extends Fragment { @Bind(R.id.web_view) WebView webView; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_weather, container, false); ButterKnife.bind(this, view); webView.getSettings().setJavaScriptEnabled(true); webView.setWebViewClient(new WebViewClient()); webView.loadUrl("http://1-blog.com/weather"); return view; } }
[ "494431829@qq.com" ]
494431829@qq.com
933c0142b28a7c7584a770ffa0c5b57493e0bee7
4799f218836969a659815086034d3ff449f2162a
/src/com/rsc/erp/utils/parse/cognos/SplitHtmlReportFileHandlingUtils.java
a4aaa455df0fc368202d46352b2ea603eed929d3
[]
no_license
pjpalath/CognosSalesforceIntegration
950756a7d8ec07e37a0b20f81124b5d9abd1f40a
08f30e6df82003d89d9848eaf258d48e2a68a785
refs/heads/master
2021-01-17T10:49:44.249902
2017-03-06T02:22:17
2017-03-06T02:22:17
84,020,497
0
0
null
null
null
null
UTF-8
Java
false
false
6,967
java
/** * */ package com.rsc.erp.utils.parse.cognos; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.Logger; /** * @author PAUL * */ public class SplitHtmlReportFileHandlingUtils { // Logger private static final Logger LOG = Logger.getLogger(SplitHtmlReportFileHandlingUtils.class.getName()); // Log String Builder private StringBuilder logStringBuilder; /** * */ public SplitHtmlReportFileHandlingUtils() { } /** * * @param logFileHandler */ public SplitHtmlReportFileHandlingUtils(Handler logFileHandler, StringBuilder logStringBuilder) { LOG.addHandler(logFileHandler); LOG.setUseParentHandlers(false); this.logStringBuilder = logStringBuilder; } /** * Create a new sub folder under the date folder. This is * done every time there is a new report run. * @param folderPath */ public String createSubFolderForSplitFiles(String splitFilesRootFolder) { String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); String newSplitReportsFolder = splitFilesRootFolder + "/" + today; // Check to see if the folder for this date and for this // report has already been created. If so then just move ahead. File splitReportsFileFolder = new File(newSplitReportsFolder); if (!splitReportsFileFolder.exists()) { splitReportsFileFolder.mkdirs(); } // Use folder 0 to replicate what is in current folder and hold all the files // across multiple runs of the script (On report files arriving at diferent times) // and use SplitScriptTodaysRun<folderCounter> to hold files from each individual run int folderCounter = ((splitReportsFileFolder.listFiles() == null) || (splitReportsFileFolder.listFiles().length == 0)) ? 0 : (splitReportsFileFolder.listFiles().length - 1); // Create the new sub folder String newSplitReportsSubFolder = newSplitReportsFolder + "/SplitScriptTodaysRun" + (folderCounter + 1); File splitReportsSubFolder = new File(newSplitReportsSubFolder); splitReportsSubFolder.mkdirs(); logStringBuilder.append("Created the new subfolder " + newSplitReportsSubFolder + " to store the split files\r\n\r\n"); return newSplitReportsSubFolder; } /** * * @param counter * @param splitFileString * @throws IOException */ public void createFileAndWriteSplitString(String accountString, String newSplitReportsFolder, String splitFileString) throws IOException { String splitFileName = newSplitReportsFolder + "/" + accountString + ".html"; File splitFile = new File(splitFileName); FileOutputStream fileOutputStream = new FileOutputStream(splitFile); // if file doesnt exists, then create it if (!splitFile.exists()) { splitFile.createNewFile(); } // get the content in bytes byte[] contentInBytes = splitFileString.getBytes(); fileOutputStream.write(contentInBytes); fileOutputStream.flush(); fileOutputStream.close(); } /** * Delete split file folders older than a * certain date * @throws IOException */ public void deletePastHistory(String splitFilesRootFolder, int numOfDaysReportHistory) throws IOException { File rootFolder = new File(splitFilesRootFolder); // Get the list of directories that need to be deleted List<File> listOfFoldersToDelete = new ArrayList<File>(); if (rootFolder.exists()) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); for (File splitFilesDateFolder : rootFolder.listFiles()) { if (splitFilesDateFolder.isDirectory()) { try { Date folderDate = sdf.parse(splitFilesDateFolder.getName()); Calendar folderCalendar = Calendar.getInstance(); Calendar todayCalendar = Calendar.getInstance(); folderCalendar.setTime(folderDate); todayCalendar.setTime(new Date()); // Get the number of days between this folder date and today long daysBetween = 0; while (folderCalendar.before(todayCalendar)) { folderCalendar.add(Calendar.DAY_OF_MONTH, 1); daysBetween++; } // If the number of days in between is greater than a // certain number of days delete it if (daysBetween > numOfDaysReportHistory) { listOfFoldersToDelete.add(splitFilesDateFolder); } } catch (ParseException e) { } } } } for (File folderToDelete : listOfFoldersToDelete) { invokeDelete(folderToDelete.getCanonicalPath()); logStringBuilder.append("Deleted the folder " + folderToDelete.getCanonicalPath() + " because it is " + "older than " + numOfDaysReportHistory + " days.\r\n\r\n"); } } /** * * @param fileName * @return */ public boolean invokeDelete(String fileName) { File file = new File(fileName); if (file.exists()) { //check if the file is a directory if (file.isDirectory()) { if ((file.list()).length > 0) { for(String s:file.list()) { //call deletion of file individually invokeDelete(fileName+"\\"+s); } } } boolean result = file.delete(); // test if delete of file is success or not if (!result) { logStringBuilder.append("File was not deleted, unknown reason " + fileName + "\r\n\r\n"); } return result; } else { logStringBuilder.append("File delete failed, file does not exists " + fileName + "\r\n\r\n"); return false; } } /** * * @return * @throws Exception */ public boolean isReportFileAvailabe(String reportFilePath, String reportName) throws Exception { // Set the report file (A report file could come in many parts with different // ending names) File multipleReportFilesFolder = new File(reportFilePath); if (!multipleReportFilesFolder.isDirectory()) { LOG.log(Level.SEVERE, "The reports folder " + reportFilePath + " defined in the properties file " + "is not a directory. Please correct in the properties file and run script again\r\n\r\n"); throw new Exception(); } for (File multipleReportFile : multipleReportFilesFolder.listFiles()) { if (multipleReportFile.getName().startsWith(reportName)) { return true; } } return false; } /** * * @return */ public String getCurrentSplitFilesFolder(String splitFilesRootFolder) { return splitFilesRootFolder + "/" + "Current"; } /** * * @param splitFilersRootFolder * @return */ public String getTodayZeroSplitFilesFolder(String splitFilesRootFolder) { String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); return splitFilesRootFolder + "/" + today + "/0"; } /** * @param args */ public static void main(String[] args) { } }
[ "PAUL PALATHINGAL" ]
PAUL PALATHINGAL
de2293c2a90e8c84e744722ca6d12717056fb5c0
f2fcbf6704eaf09e600ea20d31434d6e530e2115
/app/src/test/java/com/duanlei/game2048/ExampleUnitTest.java
a549af6b5d307a13fece055278f4273da6aaea9c
[]
no_license
nspduanlei/Game2048
13cf35e9f76c39774e0c1f9d90209afeeb8bdb61
4d6b8cd5a4ba488e71110acf6ba4342648e0e8f0
refs/heads/master
2021-01-10T05:49:09.363244
2016-01-11T02:35:43
2016-01-11T02:35:43
48,742,018
0
0
null
null
null
null
UTF-8
Java
false
false
313
java
package com.duanlei.game2048; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "455483293@qq.com" ]
455483293@qq.com
668c7a7aa090b67ec3947182c06eb98e5648d344
6b12d45bd7e2765bd394626d9b85e462f52c3764
/src/main/java/com/japcdev/contactbook/repository/ContactRepositoryImpl.java
43408c4c1cd107f0e693af6b5412a071dccbb605
[]
no_license
japc78/udemy-javaEE-servlet-jpa-contact-list-spring
efc75bf710ebc6ce2324d5c3221b7e8746ea2aa9
5f6eaac028a8d043e20babb75648c9f4253e5435
refs/heads/main
2023-07-20T06:31:35.197212
2021-08-31T19:19:19
2021-08-31T19:19:19
401,443,549
0
0
null
null
null
null
UTF-8
Java
false
false
1,901
java
package com.japcdev.contactbook.repository; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; import com.japcdev.contactbook.model.Contact; @Repository public class ContactRepositoryImpl implements ContactRepository { @Autowired JdbcTemplate template; @Override public void addContact(Contact contact) { String sql = "INSERT INTO contacts (name, email, phoneNumber) VALUE(?,?,?)"; template.update(sql, contact.getName(), contact.getEmail(), contact.getPhoneNumber()); } @Override public Contact getContactEmail(String email) { String sql="SELECT * FROM contacts WHERE email = ?"; List<Contact> contacts= template.query(sql, (resultSet, row)-> new Contact( resultSet.getInt("idContacto"), resultSet.getString("nombre"), resultSet.getString("email"), resultSet.getInt("telefono")), email); return contacts.size() > 0 ? contacts.get(0) : null; } @Override public Contact getContactId(int id) { String sql="SELECT * FROM contacts WHERE id = ?"; List<Contact> contacts= template.query(sql, (resultSet, row)-> new Contact( resultSet.getInt("idContacto"), resultSet.getString("nombre"), resultSet.getString("email"), resultSet.getInt("telefono")), id); return contacts.size() >0 ? contacts.get(0) : null; } @Override public void deleteContact(int id) { String sql = "DELETE FROM contacts WHERE id = ?"; template.update(sql, id); } @Override public List<Contact> getContactList() { String sql = "SELECT * FROM contacts"; return template.query(sql, (resultSet, row)->new Contact( resultSet.getInt("id"), resultSet.getString("name"), resultSet.getString("email"), resultSet.getInt("phoneNumber") )); } }
[ "japc.grafico@gmail.com" ]
japc.grafico@gmail.com
8d49ef00777c6898d1b7fe763d7d69108ef22012
d1afec3b8d17475176b515d971d2333273e75fc5
/webAppMundoVideo/src/java/cr/ac/una/prograiv/video/controller/PeliculasServlet.java
da80c05762475442dceacd2c84ff9d7dcbc94e64
[]
no_license
Josueroman12/webAppVideo
b61937d143ceca90f543177294dc7e92af58cd20
b5ea2e5d61f916a1e616f62baa8594128ab523f5
refs/heads/master
2016-09-13T13:46:03.717451
2016-05-16T04:56:59
2016-05-16T04:56:59
58,901,251
0
0
null
null
null
null
UTF-8
Java
false
false
6,865
java
/* * 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 cr.ac.una.prograiv.video.controller; import com.google.gson.Gson; import cr.ac.una.prograiv.video.bl.PeliculasBL; import cr.ac.una.prograiv.video.domain.Peliculas; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author Josue Roman */ @WebServlet(name = "PeliculasServlet", urlPatterns = {"/PeliculasServlet"}) public class PeliculasServlet extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { //String para guardar el JSON generaro por al libreria GSON String json; //Se crea el objeto Persona Peliculas p = new Peliculas(); //Se crea el objeto de la logica de negocio PeliculasBL pBL = new PeliculasBL(); //Se hace una pausa para ver el modal Thread.sleep(1000); //********************************************************************** //se consulta cual accion se desea realizar //********************************************************************** String accion = request.getParameter("accion"); switch (accion) { case "consultarPeliculas": json = new Gson().toJson(pBL.findAll(Peliculas.class.getName())); /*Realiza la busqueda*/ out.print(json); break; case "eliminarPeliculas": p.setPkIdPeliculas(Integer.parseInt(request.getParameter("pkIdPelicula"))); //Se elimina el objeto pBL.delete(p); //se consulta la persona por ID //Se imprime la respuesta con el response out.print("La pelicula o serie fue eliminada correctamente"); break; case "consultarPeliculasByID": p = pBL.findById(Integer.parseInt(request.getParameter("pkIdPelicula"))); //se pasa la informacion del objeto a formato JSON json = new Gson().toJson(p); out.print(json); break; case "agregarPeliculas": case "modificarPeliculas": //Se llena el objeto con los datos enviados por AJAX por el metodo post p.setPkIdPeliculas(Integer.parseInt(request.getParameter("cedula"))); //p.setCategoria(request.getClass().asSubclass(null); p.setNombre(request.getParameter("nombre")); p.setDirector(request.getParameter("apellido1")); p.setActorPrincipal(request.getParameter("apellido2")); p.setCantExistentes(Integer.parseInt(request.getParameter("cedula"))); p.setCantVendidas(Integer.parseInt(request.getParameter("nombre"))); p.setCantAlquiladas(Integer.parseInt(request.getParameter("apellido1"))); p.setObservaciones(request.getParameter("apellido2")); p.setEstado(Boolean.parseBoolean(request.getParameter("cedula"))); p.setCostoVenta(Integer.parseInt(request.getParameter("nombre"))); p.setCantAlquiladas(Integer.parseInt(request.getParameter("apellido1"))); if(accion.equals("agregarPelicula")){ //es insertar personas //Se guarda el objeto pBL.save(p); //Se imprime la respuesta con el response out.print("C~La pelicula o serie fue ingresada correctamente"); }else{//es modificar persona //Se guarda el objeto pBL.merge(p); //Se imprime la respuesta con el response out.print("C~La pelicula o serie fue modificada correctamente"); } break; default: out.print("E~No se indico la acción que se desea realizare"); break; } } catch (NumberFormatException e) { out.print("E~" + e.getMessage()); } catch (Exception e) { out.print("E~" + e.getMessage()); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "Josue Roman@pc" ]
Josue Roman@pc
a213be5ba5dff5ae31d822be4bbe57651ff286fc
246fafcfa6c354b5bc147cb306d22de866ee06c6
/Integration/trunk/com.bluexml.side.Integration.m2.warPatchArchetype34d/src/main/resources/archetype-resources/src/main/java/Exemple.java
a962f43f73b7bc211c89d4c86ef1339527e889e4
[]
no_license
moreljunior/SIDE
16f8bf0588bc99bccde3fb451d43a7fa7e45f37b
9e1b0fb7d0ea1743780ffb06fccc69e8225afd5e
refs/heads/master
2021-01-15T10:24:45.571699
2013-04-12T07:41:33
2013-04-12T07:41:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
134
java
#set( $symbol_pound = '#' ) #set( $symbol_dollar = '$' ) #set( $symbol_escape = '\' ) package ${package}; public class Exemple { }
[ "dabad@c4e9bb49-730a-0410-b52d-bc9a0859fdfe" ]
dabad@c4e9bb49-730a-0410-b52d-bc9a0859fdfe
021dd6fdcae698be6c3190c3a327d12d7b63bb23
b49ee04177c483ab7dab6ee2cd3cabb44a159967
/dgroupDoctorCompany/src/main/java/com/dachen/dgroupdoctorcompany/entity/BaseCompare.java
82805f7e25acb5caa649fba09a8208d171a7719a
[]
no_license
butaotao/MedicineProject
8a22a98a559005bb95fee51b319535b117f93d5d
8e57c1e0ee0dac2167d379edd9d97306b52d3165
refs/heads/master
2020-04-09T17:29:36.570453
2016-09-13T09:17:05
2016-09-13T09:17:05
68,094,294
0
1
null
null
null
null
UTF-8
Java
false
false
171
java
package com.dachen.dgroupdoctorcompany.entity; import java.io.Serializable; /** * Created by Burt on 2016/5/20. */ public class BaseCompare implements Serializable{ }
[ "1802928215@qq.com" ]
1802928215@qq.com
6cf12d40cc1fb053abc1a606bb1a0468f7e37576
763701ac870fc5d1c6247f3a733939631919a477
/ServidorCentral/src/logica/Colaborador.java
e15ae4e1f6da958f523e69be4fcba1cb45cc6ca9
[]
no_license
matteo95g/Tarea-Final-tprog-2017
4354f2d1caa970fdab8dddba4876d87e84bafb8c
23a8315f67b8fe34d3ec199a64b872133df0fff5
refs/heads/master
2021-08-24T11:23:05.198959
2017-12-09T14:20:57
2017-12-09T14:20:57
113,674,879
0
0
null
null
null
null
UTF-8
Java
false
false
1,705
java
package logica; import java.util.Calendar; import java.util.HashMap; import java.util.Map; public class Colaborador extends Usuario { private Map<Integer, Colaboracion> colaboraciones; private Map<String, Comentario> comentarios; public Colaborador(String nickname, String nombre, String apellido, String correoElectronico, Calendar fechaNacimiento, String contra) { super(nickname, nombre, apellido, correoElectronico, fechaNacimiento, contra); this.colaboraciones = new HashMap<Integer, Colaboracion>(); } public Map<Integer, Colaboracion> getColaboraciones() { return colaboraciones; } // public void setColaboraciones(Map<Integer, Colaboracion> colaboraciones) { // this.colaboraciones = colaboraciones; // } public void agregarColaboracion(Colaboracion colab) { if (!colaboraciones.containsKey(colab.getId())) { colaboraciones.put(colab.getId(), colab); } } public void eliminarColaboracion(int ident) { colaboraciones.remove(ident); } @Override public String toString() { return getNombre() + " " + getApellido() + " - NickName: " + getNickname(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; Colaborador other = (Colaborador) obj; if (colaboraciones == null) { if (other.colaboraciones != null) return false; } else if (!colaboraciones.equals(other.colaboraciones)) return false; return true; } public Map<String, Comentario> getComentarios() { return comentarios; } public void setComentarios(Map<String, Comentario> comentarios) { this.comentarios = comentarios; } }
[ "matteo.guerrieri@fing.edu.uy" ]
matteo.guerrieri@fing.edu.uy
98c464ee6ae8dad9b398b290ec3090daf810dc7c
3314bde6ee6f141ff4634bff6fc9a3978d10cca2
/src/main/java/sticklings/util/Location.java
44f79a6a87b2de016f78e28945bb880d5db89c4d
[]
no_license
Sticklings/Sticklings-Game
bbce40f92df2c6e0729d895c6f3bc3377b96e968
5079dc50c4a8afd8f81bf0de7484973997957d45
refs/heads/master
2020-07-28T17:44:02.698795
2016-11-04T05:40:09
2016-11-04T05:40:09
67,479,603
0
0
null
null
null
null
UTF-8
Java
false
false
1,061
java
package sticklings.util; /** * Represents a location in 2D space */ public class Location { public double x; public double y; /** * Creates a new locatoin at 0,0 */ public Location() { this(0, 0); } /** * Creates a new location at the given coords * * @param x The x coord * @param y The y coord */ public Location(double x, double y) { this.x = x; this.y = y; } @Override public String toString() { return String.format("Location{%.2f,%.2f}", x, y); } @Override public boolean equals(Object obj) { if (obj instanceof Location) { Location other = (Location) obj; return x == other.x && y == other.y; } else { return false; } } @Override public int hashCode() { int hash = 7; hash = hash * 31 + Double.hashCode(x); hash = hash * 31 + Double.hashCode(y); return hash; } /** * Clones this Location * * @return A new Location that is exactly the same as this */ public Location copy() { return new Location(x, y); } }
[ "steven.schmoll@gmail.com" ]
steven.schmoll@gmail.com
f505c938ba5a9e043e105c93484978b0db6a5c15
6050281ed07ac7e541a6b57d142fd382eb2f2d05
/app/src/main/java/de/host/connectionmanagerapp/activityFragments/SshSessionFragment.java
abd4a8d93af50657b105794151126d5626f4e375
[]
no_license
mobile-systeme-team-j/Connection-Manager-App
b89fdf8f95cb2453665c5f92ab6afc2055f5c6e2
db62a2f5b5b29fd3dc2834347941f4a202c36e25
refs/heads/master
2020-05-20T13:08:38.429446
2019-06-23T22:06:41
2019-06-23T22:06:41
185,590,135
3
1
null
null
null
null
UTF-8
Java
false
false
15,167
java
package de.host.connectionmanagerapp.activityFragments; import android.Manifest; import android.app.Activity; import android.content.pm.PackageManager; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.text.method.ScrollingMovementMethod; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.EditText; import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProviders; import net.schmizz.sshj.SSHClient; import net.schmizz.sshj.common.LoggerFactory; import net.schmizz.sshj.common.StreamCopier; import net.schmizz.sshj.connection.ConnectionException; import net.schmizz.sshj.connection.channel.direct.Session; import net.schmizz.sshj.transport.TransportException; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import de.host.connectionmanagerapp.R; import de.host.connectionmanagerapp.database.Connection; import de.host.connectionmanagerapp.database.Identity; import de.host.connectionmanagerapp.ssh.SshConfig; import de.host.connectionmanagerapp.ssh.SshConn; import de.host.connectionmanagerapp.viewmodels.ConnectionViewModel; public class SshSessionFragment extends Fragment { public static final String TAG = SshSessionFragment.class.getSimpleName(); private long connection_ID; private TextView terminal; private EditText command; private ImageButton send; private ByteArrayOutputStream baos; private PrintStream ps; private boolean firstConn, calledFromRemoteFragment; private Future future; private ConnectionViewModel connectionViewModel; private Connection connection; private String host, user, password, keyPath, keyPassword; private int port; public SshSessionFragment() { // Required empty public constructor } // Konstruktor mit connection_ID Parameter für Verbindungsaufbau public static SshSessionFragment newInstance(long connection_ID, boolean calledFromRemoteFragment) { SshSessionFragment fragment = new SshSessionFragment(); Bundle args = new Bundle(); args.putLong("connection_ID", connection_ID); args.putBoolean("remote", calledFromRemoteFragment); fragment.setArguments(args); return fragment; } public static SshSessionFragment newInstance(String host, String user, int port, String password, String keyPath, String keyPassword, boolean calledFromRemoteFragment) { SshSessionFragment fragment = new SshSessionFragment(); Bundle args = new Bundle(); args.putString("host", host); args.putString("user", user); args.putInt("port", port); args.putString("password", password); args.putString("keyPath", keyPath); args.putString("keyPassword", keyPassword); args.putBoolean("remote", calledFromRemoteFragment); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { if (getArguments().size() < 3) { connection_ID = getArguments().getLong("connection_ID"); calledFromRemoteFragment = getArguments().getBoolean("remote"); } else { host = getArguments().getString("host"); user = getArguments().getString("user"); port = getArguments().getInt("port"); password = getArguments().getString("password"); keyPath = getArguments().getString("keyPath"); keyPassword = getArguments().getString("keyPassword"); calledFromRemoteFragment = getArguments().getBoolean("remote"); } } // Non-Ui Variablen initialisieren baos = new ByteArrayOutputStream(); ps = new PrintStream(baos); System.setOut(ps); firstConn = false; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_ssh_session, container, false); // Ui initialisieren terminal = view.findViewById(R.id.tv_Terminal); // Autoscroll aktivieren terminal.setMovementMethod(new ScrollingMovementMethod()); command = view.findViewById(R.id.et_Command); send = view.findViewById(R.id.btn_Send); connectionViewModel= ViewModelProviders.of(getActivity()).get(ConnectionViewModel.class); // Wirft Error: Cannot access database on the main thread since it may potentially lock the UI for a long period of time. connection = connectionViewModel.getConnection(connection_ID); // Soft-Keyboard automatisch anzeigen, notwendige Ui-Elemente resizen getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); // Baue Verbindung zu Server auf if (calledFromRemoteFragment) { future = connectToServer(); }else{ future = connectToServer(connection_ID); } send.setOnClickListener((v) -> { // Wenn ET nicht empty, schicke Befehl an AsyncTask if (!TextUtils.isEmpty(command.getText().toString())) { try { SshConn conn = (SshConn) future.get(); Object[] objects = new Object[2]; objects[0] = conn; objects[1] = command.getText().toString(); new SshAsyncTask().execute(objects); // Clear command when executed command.getText().clear(); } catch (Exception e) { e.printStackTrace(); createToast(e.getMessage()); } } }); // Enter-/ Return Taste des Soft-Keyboards abfangen zur "click"-Ausführung auf Button command.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {} @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // Wenn return gedrückt, also new line if (before == 0 && count == 1 && s.charAt(start) == '\n') { // Führe Click aus send.performClick(); } } @Override public void afterTextChanged(Editable editable) {} }); return view; } @Override public void onStop() { super.onStop(); // Verbindung beenden über Conn // In neuem Thread, da wieder Netzwerk Thread thread = new Thread(new Runnable() { @Override public void run() { try { SshConn conn = (SshConn) future.get(); conn.getClient().disconnect(); } catch (Exception e) { Log.e(TAG, e.getMessage()); } } }); thread.start(); } private Future connectToServer(long connection_ID) { ExecutorService executorService = Executors.newSingleThreadExecutor(); Future<SshConn> future = executorService.submit(new Callable<SshConn>() { @Override public SshConn call() { Identity identity = connectionViewModel.getIdentityFromTitel(connection.getIdentity_Id()); String host = connection.getHostip(); String password = identity.getPassword(); String username = identity.getUsername(); String keyPass = identity.getKeypassword(); //TODO DB: Pfad für HostKey String hostKey = connection.getHostKey(); int port = connection.getPort(); String keyPath = ""; if (!TextUtils.isEmpty(identity.getKeypath())) { keyPath = identity.getKeypath(); } // Setup Connection SshConfig config; if (port != 0) { config = new SshConfig(host, port, username); } else { config = new SshConfig(host, username); } if (!TextUtils.isEmpty(keyPath)) { // Request READ_EXTERNAL_STORAGE Permission if not already set int permissionCheck = ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.READ_EXTERNAL_STORAGE); if (permissionCheck == PackageManager.PERMISSION_GRANTED) { // Permission granted } else { requestPermissions(new String []{Manifest.permission.READ_EXTERNAL_STORAGE},99); } config = config.useKey(keyPath); } if (!TextUtils.isEmpty(keyPass)) { config = config.useKeyPass(keyPass); } if (!TextUtils.isEmpty(password)) { config = config.usePassword(password); } config = config.useHostKey(false); SshConn conn = new SshConn(config, new SSHClient()); try { conn.openConnection(); } catch (Exception e) { Log.e(TAG, e.getMessage()); createToast(e.getMessage()); } return conn; } }); return future; } private Future connectToServer() { ExecutorService executorService = Executors.newSingleThreadExecutor(); Future<SshConn> future = executorService.submit(new Callable<SshConn>() { @Override public SshConn call() { // Setup Connection SshConfig config; if (port != 0) { config = new SshConfig(host, port, user); } else { config = new SshConfig(host, user); } if (!TextUtils.isEmpty(keyPath)) { // Request READ_EXTERNAL_STORAGE Permission if not already set int permissionCheck = ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.READ_EXTERNAL_STORAGE); if (permissionCheck == PackageManager.PERMISSION_GRANTED) { // Permission granted } else { requestPermissions(new String []{Manifest.permission.READ_EXTERNAL_STORAGE},99); } config = config.useKey(keyPath); } if (!TextUtils.isEmpty(keyPassword)) { config = config.useKeyPass(keyPassword); } if (!TextUtils.isEmpty(password)) { config = config.usePassword(password); } config = config.useHostKey(false); SshConn conn = new SshConn(config, new SSHClient()); try { conn.openConnection(); } catch (Exception e) { Log.e(TAG, e.getMessage()); createToast(e.getMessage()); } return conn; } }); return future; } // AsyncTask zur Ausführung des Befehls in der Shell public class SshAsyncTask extends AsyncTask<Object, Integer, String> { @Override protected String doInBackground(Object[] objects) { SshConn conn = (SshConn) objects[0]; String command = (String) objects[1]; SSHClient client = conn.getClient(); try { Session session = client.startSession(); session.allocateDefaultPTY(); Session.Shell shell = session.startShell(); InputStream in = shell.getInputStream(); InputStream err = shell.getErrorStream(); new StreamCopier(in, System.out, LoggerFactory.DEFAULT) .bufSize(session.getLocalMaxPacketSize()) .spawn("stdout"); new StreamCopier(err, System.out, LoggerFactory.DEFAULT) .bufSize(session.getLocalMaxPacketSize()) .spawn("stderr"); // modt und co. anzeigen bei erster Verbindung if (!firstConn) { Thread.sleep(200); terminal.append(baos.toString()); firstConn = true; } // Befehl senden String result = ""; result = conn.sendCommand(command); // Befehl an Outputstream hängen baos.write((command).getBytes()); return result; } catch (Exception e) { Log.e(TAG, e.getMessage()); createToast(e.getMessage()); } /* // Befehl direkt über Outputstream an Shell senden try { // Befehl an Shell senden und close out.write((cmd + "\n").getBytes()); out.close(); } catch (IOException e) { e.printStackTrace(); } */ return ""; } @Override protected void onPostExecute(String s) { try { // Outputstream mit Result füllen baos.write(s.getBytes()); terminal.setText(baos.toString()); // Append notwendig, da sonst Autoscroll nicht funktioniert terminal.append(" "); } catch (IOException e) { Log.e(TAG, e.getMessage()); createToast(e.getMessage()); } } } private void createToast(String message) { getActivity().runOnUiThread(() -> Toast.makeText(getContext(),message,Toast.LENGTH_LONG).show()); } }
[ "phillip.kuehling@web.de" ]
phillip.kuehling@web.de
c8d882720834a08c1270e4da1d341a0c8b52233a
88d32b4434e5d64e14787efa426e7cdc742ee221
/Web-Automation/src/com/sgtesting/pageobjectmodel/Assignment4.java
4a096586f6325fd2db8309c4bc5c0aa90f949605
[]
no_license
reethureddy007/TestAutomation
7790efa04080c04ed19e5a2f50939a58f7b57803
220a8541bef3f67147f61e3dc9db2dec4ca733c1
refs/heads/master
2023-09-04T19:28:10.847558
2021-11-05T09:48:43
2021-11-05T09:48:43
424,888,299
0
0
null
null
null
null
UTF-8
Java
false
false
2,807
java
package com.sgtesting.pageobjectmodel; import java.time.Duration; import org.openqa.selenium.Alert; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Assignment4 { public static WebDriver oBrowser=null; public static MainPmg oPage=null; public static void main(String[] args) { launchBrowser(); navigate(); login(); minimize(); createCustomer(); modifyCustomer(); deleteCustomer(); logout(); closeApplication(); } static void launchBrowser() { try { System.setProperty("webdriver.chrome.driver","E:\\ExampleAutomation\\Automation\\Web-Automation\\Library\\drivers\\chromedriver.exe"); oBrowser=new ChromeDriver(); oPage=new MainPmg(oBrowser); }catch(Exception e) { e.printStackTrace(); } } static void navigate() { try { oBrowser.navigate().to("http://localhost:82/user/submit_tt.do"); oBrowser.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(60)); }catch(Exception e) { e.printStackTrace(); } } static void login() { try { oPage.getUserName().sendKeys("admin"); oPage.getPassword().sendKeys("manager"); oPage.getLogIn().click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void minimize() { try { oPage.minimizeFlyoutWindow().click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void logout() { try { oPage.getLogout().click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void closeApplication() { try { oBrowser.quit(); }catch(Exception e) { e.printStackTrace(); } } static void createCustomer() { try { oPage.getClickOnTasks().click(); Thread.sleep(2000); oPage.getAddnewButton().click(); Thread.sleep(2000); oPage.getCeateNewcustomer().click(); Thread.sleep(2000); oPage.getWriteCustomerName().sendKeys("Customer1"); oPage.getCreateButton().click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void modifyCustomer() { try { oPage.getdeleteButton().click(); Thread.sleep(2000); oPage.getNameField().click(); Thread.sleep(2000); oPage.getClearName().clear(); oPage.getModifyName().sendKeys("Maximus1"); oPage.getdeleteButton().click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } static void deleteCustomer() { try { oPage.getdeleteButton().click(); Thread.sleep(2000); oPage.getActionsButton().click(); Thread.sleep(2000); oPage.getDeleteButton1().click(); Thread.sleep(2000); oPage.getDeleteButton2().click(); Thread.sleep(2000); }catch(Exception e) { e.printStackTrace(); } } }
[ "reethureddy007@gmail.com" ]
reethureddy007@gmail.com
b0a90a3ce2453da11f875fa58e825888a3e93f9d
e55947f7834bfef4f71e116e0557ab92cdf89a47
/Pass-One/ProjectThree/Globals.java
ea08ea24b33103009cc0ef65974e69a618c5d455
[]
no_license
honya99/Systems-Software
9e1e2aea4a0e8615d7f41dcaf6457ae3182f1ea8
7687ccf3a01e5af55de64086116eb13d97ef92f0
refs/heads/master
2020-04-10T10:11:59.263678
2018-12-08T16:37:53
2018-12-08T16:37:53
160,954,845
0
0
null
null
null
null
UTF-8
Java
false
false
295
java
/* Honya Elfayoumy Systems Software COP3404 - Reddivari November 3, 2018 */ class Globals { public String knownAddress; public String labelName; /*private Global(String add, String labelna) { this.knownAddress = add; this.labelName = labelna; } */ }
[ "honyaelfayoumy@gmail.com" ]
honyaelfayoumy@gmail.com
c6dde016520f73ea5ff21370a6f5d2e683da10ff
5fe0f962d7876cb587e44623237cd3e19f018bf9
/trace-log-pom/trace-framework/src/main/java/com/candao/trace/framework/annotation/JsonExclusionStrategys.java
0c1311c8d70a4ba2435fb0f56d99eb3f6e1d90b1
[]
no_license
rucky2013/tarce-log
d81cbda799f671e1912a3fba869df74d1d54f28c
225dd324e38a5ad234affd72280215459adabf6f
refs/heads/master
2021-06-24T17:25:30.135860
2017-09-12T11:00:14
2017-09-12T11:00:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
545
java
package com.candao.trace.framework.annotation; import com.google.gson.ExclusionStrategy; import com.google.gson.FieldAttributes; /** * josn排除策略 * */ public class JsonExclusionStrategys { /** * 排除标记有@JsonExcludable字段的策略 */ public static ExclusionStrategy skipFieldExclusionStrategy = new ExclusionStrategy() { public boolean shouldSkipClass(Class<?> arg0) { return false; } public boolean shouldSkipField(FieldAttributes fa) { return fa.getAnnotation(JsonExcludable.class) != null; } }; }
[ "jemore@can-dao.com" ]
jemore@can-dao.com
1219d17936de77a256b8884f4814ea34eee3408f
08a95d58927c426e515d7f6d23631abe734105b4
/Project/bean/com/dimata/harisma/form/masterdata/FrmDocMasterActionParam.java
c596f2f2620f4081ff0a48192e336e7cde09f550
[]
no_license
Bagusnanda90/javaproject
878ce3d82f14d28b69b7ef20af675997c73b6fb6
1c8f105d4b76c2deba2e6b8269f9035c67c20d23
refs/heads/master
2020-03-23T15:15:38.449142
2018-07-21T00:31:47
2018-07-21T00:31:47
141,734,002
0
1
null
null
null
null
UTF-8
Java
false
false
3,014
java
/* Created on : 30 September 2011 [time] AM/PM * * @author : Ari_20110930 * @version : [version] */ /******************************************************************* * Class Description : FrmCompany * Imput Parameters : [input parameter ...] * Output : [output ...] *******************************************************************/ package com.dimata.harisma.form.masterdata; /** * * @author Priska */ /* java package */ import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; /* qdep package */ import com.dimata.qdep.form.*; /* project package */ import com.dimata.harisma.entity.masterdata.*; public class FrmDocMasterActionParam extends FRMHandler implements I_FRMInterface, I_FRMType{ private DocMasterActionParam docMasterAction; public static final String FRM_NAME_DOC_MASTER_ACTION_PARAM = "FRM_NAME_DOC_MASTER_ACTION_PARAM"; public static final int FRM_FIELD_DOC_ACTION_PARAM_ID = 0; public static final int FRM_FIELD_ACTION_PARAMETER = 1; public static final int FRM_FIELD_OBJECT_NAME = 2; public static final int FRM_FIELD_OBJECT_ATTRIBUTE = 3; public static final int FRM_FIELD_DOC_ACTION_ID = 4; public static String[] fieldNames = { "FRM_FIELD_DOC_ACTION_PARAM_ID", "FRM_FIELD_ACTION_PARAMETER", "FRM_FIELD_OBJECT_NAME", "FRM_FIELD_OBJECT_ATTRIBUTE", "FRM_FIELD_DOC_ACTION_ID" }; public static int[] fieldTypes = { TYPE_LONG, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_LONG }; public FrmDocMasterActionParam() { } public FrmDocMasterActionParam(DocMasterActionParam docMasterAction) { this.docMasterAction = docMasterAction; } public FrmDocMasterActionParam(HttpServletRequest request, DocMasterActionParam docMasterAction) { super(new FrmDocMasterActionParam(docMasterAction), request); this.docMasterAction = docMasterAction; } public String getFormName() { return FRM_NAME_DOC_MASTER_ACTION_PARAM; } public int[] getFieldTypes() { return fieldTypes; } public String[] getFieldNames() { return fieldNames; } public int getFieldSize() { return fieldNames.length; } public DocMasterActionParam getEntityObject() { return docMasterAction; } public void requestEntityObject(DocMasterActionParam docMasterAction) { try { this.requestParam(); docMasterAction.setDocActionParamId(getLong(FRM_FIELD_DOC_ACTION_PARAM_ID)); docMasterAction.setObjectAtribut(getString(FRM_FIELD_OBJECT_ATTRIBUTE)); docMasterAction.setObjectName(getString(FRM_FIELD_OBJECT_NAME)); docMasterAction.setActionParameter(getString(FRM_FIELD_ACTION_PARAMETER)); docMasterAction.setDocActionId(getLong(FRM_FIELD_DOC_ACTION_ID)); } catch (Exception e) { System.out.println("Error on requestEntityObject : " + e.toString()); } } }
[ "agungbagusnanda90@gmai.com" ]
agungbagusnanda90@gmai.com
e29f6938310d6a527d1ca0ff3f5470f66d5ed49b
3ab1dcce96d16e388ca1a0913f8df396718d54a6
/src/main/java/me/kalpha/natural/configs/ResourceServerConfig.java
19240accd16ecd3a6753ef9849eb8581578e4631
[]
no_license
kalphageek/natural
0a8bb80214871f46bfcfe31bb4b64c74184ce86f
6f3baa637782e1536a11caa4c1090bcebe47db75
refs/heads/master
2022-07-22T14:45:17.212757
2020-05-10T23:53:03
2020-05-10T23:53:03
260,661,684
0
0
null
2020-05-10T23:53:04
2020-05-02T10:18:28
HTML
UTF-8
Java
false
false
1,493
java
package me.kalpha.natural.configs; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer; import org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler; @Configuration @EnableResourceServer public class ResourceServerConfig extends ResourceServerConfigurerAdapter { @Override public void configure(ResourceServerSecurityConfigurer resources) throws Exception { resources.resourceId("natural"); } @Override public void configure(HttpSecurity http) throws Exception { http .anonymous() .and() .authorizeRequests() .mvcMatchers(HttpMethod.GET, "/api/**").permitAll() .mvcMatchers(HttpMethod.POST, "/api/**").authenticated() .mvcMatchers(HttpMethod.PUT, "/api/**").authenticated() .mvcMatchers(HttpMethod.DELETE, "/api/**").authenticated() .and() .exceptionHandling() .accessDeniedHandler(new OAuth2AccessDeniedHandler()); } }
[ "kalphageek@outlook.com" ]
kalphageek@outlook.com
d328d6f907d904223514ee24ea0db9a66b54fc7b
e15d3776ef2c024e8985c1d92007471d63231529
/app/src/main/java/com/hrobbie/netchat/rts/doodle/Transaction.java
60bf09551720c02cd8a6a8d3b051f17a76cbaa4f
[]
no_license
HRobbie/NetChat
88928a0dbde08c558a6880f7302da78e101ea7bf
74f01fa958c5f569390becf6106650743a71a6cb
refs/heads/master
2021-01-02T08:58:22.787210
2017-08-07T02:50:24
2017-08-07T02:50:24
98,604,581
0
0
null
null
null
null
UTF-8
Java
false
false
3,092
java
package com.hrobbie.netchat.rts.doodle; import android.util.Log; import java.io.Serializable; /** * Created by huangjun on 2015/6/24. */ public class Transaction implements Serializable { public interface ActionStep { byte START = 1; byte MOVE = 2; byte END = 3; byte REVOKE = 4; byte CLEAR_SELF = 6; byte CLEAR_ACK = 7; } private byte step = ActionStep.START; private float x = 0.0f; private float y = 0.0f; public Transaction() { } public Transaction(byte step, float x, float y) { this.step = step; this.x = x; this.y = y; } public static String pack(Transaction t) { return String.format("%d:%f,%f;", t.getStep(), t.getX(), t.getY()); } public static String packIndex(int index) { return String.format("5:%d,0;", index); } public static Transaction unpack(String data) { int sp1 = data.indexOf(":"); if (sp1 <= 0) { return null; } int sp2 = data.indexOf(","); if (sp2 <= 2) { return null; } String step = data.substring(0, sp1); String x = data.substring(sp1 + 1, sp2); String y = data.substring(sp2 + 1); try { byte p1 = Byte.parseByte(step); if (p1 == 5) { Log.i("Transaction", "RECV DATA:" + x); } else { float p2 = Float.parseFloat(x); float p3 = Float.parseFloat(y); return new Transaction(p1, p2, p3); } } catch (Exception e) { e.printStackTrace(); } return null; } private void make(byte step, float x, float y) { this.step = step; this.x = x; this.y = y; } public Transaction makeStartTransaction(float x, float y) { make(ActionStep.START, x, y); return this; } public Transaction makeMoveTransaction(float x, float y) { make(ActionStep.MOVE, x, y); return this; } public Transaction makeEndTransaction(float x, float y) { make(ActionStep.END, x, y); return this; } public Transaction makeRevokeTransaction() { make(ActionStep.REVOKE, 0.0f, 0.0f); return this; } public Transaction makeClearSelfTransaction() { make(ActionStep.CLEAR_SELF, 0.0f, 0.0f); return this; } public Transaction makeClearAckTransaction() { make(ActionStep.CLEAR_ACK, 0.0f, 0.0f); return this; } public int getStep() { return step; } public float getX() { return x; } public float getY() { return y; } public boolean isPaint() { return !isRevoke() && !isClearSelf() && !isClearAck(); } public boolean isRevoke() { return step == ActionStep.REVOKE; } public boolean isClearSelf() { return step == ActionStep.CLEAR_SELF; } public boolean isClearAck() { return step == ActionStep.CLEAR_ACK; } }
[ "hwwyouxiang@163.com" ]
hwwyouxiang@163.com
5306d4da0597d642503ee71142064211f4484442
b28cd15d937184ac1749110a04095cbb8a2906a9
/_ Essentials/src/net/eduard/essentials/command/WhiteListAddCommand.java
a85227969c72bb36506c1730f316b16d87a08939
[]
no_license
ScoltBr/plugins
9a061ebe283390756d5ce58ebe134223e4120d15
f3e7a589b1bfe059d87de64c757fd6c43382fe36
refs/heads/master
2020-04-21T18:33:10.505101
2019-01-25T23:47:09
2019-01-25T23:47:09
null
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
891
java
package net.eduard.essentials.command; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import net.eduard.api.lib.manager.CommandManager; public class WhiteListAddCommand extends CommandManager { public WhiteListAddCommand() { super("add", "adicionar"); } public String message = "§bVoce adicionou o §3$player§b na Lista Branca"; @SuppressWarnings("deprecation") @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (args.length <= 1) { sender.sendMessage("§c/" + label + " " + args[0]+" <player>"); return true; } String name = args[1]; OfflinePlayer target = Bukkit.getOfflinePlayer(name); target.setWhitelisted(true); sender.sendMessage(message.replace("$player", target.getName())); return true; } }
[ "eduardkiller@hotmail.com" ]
eduardkiller@hotmail.com
cdbd9abddf890c2f6c54df9e6d313a098aae1fbe
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.mm/classes.jar/com/tencent/mm/r/a/l.java
47a986c26a424849d0ad3711eb8321bf18441302
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
3,524
java
package com.tencent.mm.r.a; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.mm.protocal.protobuf.esc; import com.tencent.mm.protocal.protobuf.kd; import i.a.a.b; import java.util.LinkedList; public final class l extends esc { public String msg; public int ret; public final int op(int paramInt, Object... paramVarArgs) { AppMethodBeat.i(231425); if (paramInt == 0) { paramVarArgs = (i.a.a.c.a)paramVarArgs[0]; if (this.BaseResponse == null) { paramVarArgs = new b("Not all required fields were included: BaseResponse"); AppMethodBeat.o(231425); throw paramVarArgs; } if (this.BaseResponse != null) { paramVarArgs.qD(1, this.BaseResponse.computeSize()); this.BaseResponse.writeFields(paramVarArgs); } paramVarArgs.bS(2, this.ret); if (this.msg != null) { paramVarArgs.g(3, this.msg); } AppMethodBeat.o(231425); return 0; } if (paramInt == 1) { if (this.BaseResponse == null) { break label436; } } label436: for (paramInt = i.a.a.a.qC(1, this.BaseResponse.computeSize()) + 0;; paramInt = 0) { int i = paramInt + i.a.a.b.b.a.cJ(2, this.ret); paramInt = i; if (this.msg != null) { paramInt = i + i.a.a.b.b.a.h(3, this.msg); } AppMethodBeat.o(231425); return paramInt; if (paramInt == 2) { paramVarArgs = new i.a.a.a.a((byte[])paramVarArgs[0], unknownTagHandler); for (paramInt = esc.getNextFieldNumber(paramVarArgs); paramInt > 0; paramInt = esc.getNextFieldNumber(paramVarArgs)) { if (!super.populateBuilderWithField(paramVarArgs, this, paramInt)) { paramVarArgs.kFT(); } } if (this.BaseResponse == null) { paramVarArgs = new b("Not all required fields were included: BaseResponse"); AppMethodBeat.o(231425); throw paramVarArgs; } AppMethodBeat.o(231425); return 0; } if (paramInt == 3) { Object localObject = (i.a.a.a.a)paramVarArgs[0]; l locall = (l)paramVarArgs[1]; paramInt = ((Integer)paramVarArgs[2]).intValue(); switch (paramInt) { default: AppMethodBeat.o(231425); return -1; case 1: paramVarArgs = ((i.a.a.a.a)localObject).aMP(paramInt); i = paramVarArgs.size(); paramInt = 0; while (paramInt < i) { localObject = (byte[])paramVarArgs.get(paramInt); kd localkd = new kd(); if ((localObject != null) && (localObject.length > 0)) { localkd.parseFrom((byte[])localObject); } locall.BaseResponse = localkd; paramInt += 1; } AppMethodBeat.o(231425); return 0; case 2: locall.ret = ((i.a.a.a.a)localObject).ajGk.aar(); AppMethodBeat.o(231425); return 0; } locall.msg = ((i.a.a.a.a)localObject).ajGk.readString(); AppMethodBeat.o(231425); return 0; } AppMethodBeat.o(231425); return -1; } } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes.jar * Qualified Name: com.tencent.mm.r.a.l * JD-Core Version: 0.7.0.1 */
[ "98632993+tsuzcx@users.noreply.github.com" ]
98632993+tsuzcx@users.noreply.github.com
d6e58a85ab5d928d4bfdc56e1da93f148e1fe7cf
68de9ba2dc1ed171fe42b6fdbc18f747a8220a7c
/pagamento/src/main/java/com/pierredev/repositories/VendaRepository.java
a9ebe7989116bed1827958976f04e826b5448aa2
[]
no_license
pierreEnoc/ms-vendas-3
0feb2aa30ba43ec97f95d964337a860eea0e84b5
333b32e856981aeb1bf81791137e8c5504b58536
refs/heads/main
2023-03-29T07:10:15.048975
2021-04-07T02:27:37
2021-04-07T02:27:37
355,265,197
0
0
null
null
null
null
UTF-8
Java
false
false
273
java
package com.pierredev.repositories; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.pierredev.entities.Venda; @Repository public interface VendaRepository extends JpaRepository<Venda, Long> { }
[ "pierre.enoc@gympass.com" ]
pierre.enoc@gympass.com
992d65068c62fc938d5258b9939f8ea397aad8d8
1b8de8d639aa19bc6a2680388372a19f7392a7c5
/src/main/java/pages/HomePage.java
9871579ba58d8c5145acccacaeb20ae5b5b1204f
[]
no_license
hakanakc/testAutomationUniSelenium
9398043d8126236c1239fc3ef2d9ea63828b9d8d
2fb50d19a484331087bacfcc35242aaa9e72dc1d
refs/heads/master
2023-06-05T00:29:38.861654
2021-06-30T23:48:42
2021-06-30T23:48:42
379,637,060
0
0
null
null
null
null
UTF-8
Java
false
false
1,225
java
package pages; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; public class HomePage { private WebDriver driver; // asagi satiri silmeyi dene // private By formAuthenticationLink = By.linkText("Form Authentication"); public HomePage(WebDriver driver){ this.driver =driver; } public LoginPage clickFormAuthentication(){ clickLink("Form Authentication"); return new LoginPage (driver); } public DropdownPage clickDropDown(){ clickLink("Dropdown"); return new DropdownPage(driver); } public HoversPage clickHovers() { clickLink("Hovers"); return new HoversPage(driver); } public KeyPressesPage clickKeyPresses() { clickLink("Key Presses"); return new KeyPressesPage(driver); } private void clickLink(String linkText) { driver.findElement(By.linkText(linkText)).click(); } public HorizontalSliderPage clickHorizonalSlider(){ clickLink("Horizontal Slider"); return new HorizontalSliderPage(driver); } public AlertsPage clickJavaScriptAlerts() { clickLink("JavaScript Alerts"); return new AlertsPage(driver); } }
[ "akkayahakan3448@gmail.com" ]
akkayahakan3448@gmail.com
4f79b06657d40297f008915e7f2bf1ab25a7fd00
b69111a18d0f3bfdde9cf1e48d2a724182bb4f8d
/src/main/java/Locators/BasicPageLocators.java
34a135f1202bc3e11afca2decda00f7df20f19e5
[]
no_license
LDubych/PageObjectTests
5a6e689dcbcb716be0476ef7d765452231876d84
348de5930fca59197a726ca2f8268afee06457d4
refs/heads/master
2020-04-11T19:16:59.341594
2018-12-16T17:34:13
2018-12-16T17:34:13
162,028,895
0
0
null
null
null
null
UTF-8
Java
false
false
192
java
package Locators; public interface BasicPageLocators { String SEARCH_FIELD_ID = "search_field"; String SEARCH_BUTTON_ID = "search_button"; String CART_TOTAL_ID = "cart-total"; }
[ "liudmyla.dubych@gmail.com" ]
liudmyla.dubych@gmail.com
53d5f842da6f6349edcb8a935fa7b7337162d864
4b0bf4787e89bcae7e4759bde6d7f3ab2c81f849
/aliyun-java-sdk-ens/src/main/java/com/aliyuncs/ens/model/v20171110/DeleteVSwitchResponse.java
8cca9ef31422ae2923d48bb25a2a5135a880576f
[ "Apache-2.0" ]
permissive
aliyun/aliyun-openapi-java-sdk
a263fa08e261f12d45586d1b3ad8a6609bba0e91
e19239808ad2298d32dda77db29a6d809e4f7add
refs/heads/master
2023-09-03T12:28:09.765286
2023-09-01T09:03:00
2023-09-01T09:03:00
39,555,898
1,542
1,317
NOASSERTION
2023-09-14T07:27:05
2015-07-23T08:41:13
Java
UTF-8
Java
false
false
1,212
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.ens.model.v20171110; import com.aliyuncs.AcsResponse; import com.aliyuncs.ens.transform.v20171110.DeleteVSwitchResponseUnmarshaller; import com.aliyuncs.transform.UnmarshallerContext; /** * @author auto create * @version */ public class DeleteVSwitchResponse extends AcsResponse { private String requestId; public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } @Override public DeleteVSwitchResponse getInstance(UnmarshallerContext context) { return DeleteVSwitchResponseUnmarshaller.unmarshall(this, context); } }
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
161beff2d29e4c35b5b817b17e6f9b14eeff73c6
dd4188444d5c1c7388d4e83415f18436fee19973
/cloud-alibaba-microservice-commons/src/main/java/prev/fengb/cloud/commons/model/BaseResponse.java
65136bddc46a156b8fdce2f8d4ff63c398a29e00
[]
no_license
fengbiao-hub/cloud-alibaba-microservice-parent
8249fc8bf5d165d31502ad954fd73a27c2811fc6
12bf6b0a0307d636571baa7e5f92d4f800f93e3f
refs/heads/main
2023-01-13T06:56:52.483027
2020-11-10T09:33:37
2020-11-10T09:33:37
311,517,626
0
0
null
null
null
null
UTF-8
Java
false
false
794
java
package prev.fengb.cloud.commons.model; import java.io.Serializable; import lombok.Data; /** * 基础响应类 * * @author fengb * @date 2020年11月10日 上午10:42:34 */ @Data public class BaseResponse implements Serializable { /** * 序列号 */ private static final long serialVersionUID = 1L; /** 响应码 */ private Integer code; /** 响应信息 */ private String message; /** 响应数据 */ private Object data; public BaseResponse() { super(); } public BaseResponse(Integer code, String message) { super(); this.code = code; this.message = message; } public BaseResponse(Integer code, String message, Object data) { super(); this.code = code; this.message = message; this.data = data; } }
[ "211682875@qq.com" ]
211682875@qq.com
28de8d1705caa18da5115b67093ee561cf101827
ab49c7489179837a49ece683273682b302de87ea
/com/syntax/ckass05/Height.java
495508e3af30146662817cca8fb41d843b35be06
[]
no_license
keo703/JavaBatch8
a469b1f410bcb671d017bfaf3866215c408f93f9
45bc25440095d49f2f1d3d14db9a7700349272d3
refs/heads/main
2023-01-05T14:48:37.405844
2020-10-23T01:07:41
2020-10-23T01:07:41
304,908,890
0
0
null
null
null
null
UTF-8
Java
false
false
889
java
package com.syntax.ckass05; import java.util.Scanner; public class Height { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int quiz; int midTerm; int finalTest; int finalScore; System.out.println("Please type your quiz number"); quiz = scan.nextInt(); System.out.println("Please type your midterm"); midTerm = scan.nextInt(); System.out.println("Please type your final test"); finalTest = scan.nextInt(); finalScore = (quiz + midTerm+ finalTest) / 3; System.out.println(finalScore); if (finalScore >= 90) { System.out.println("Your final Score is A"); }else if (finalScore >= 70 && finalScore < 90) { System.out.println("Your final Score is B"); }else if (finalScore >= 50 && finalScore < 70) { System.out.println("Your final Score is C"); }else System.out.println("Your final Score is F"); } }
[ "keoma703@gmail.com" ]
keoma703@gmail.com
02ceb59f02966c3d3f8cb39e15f28a0be67cff1b
a1fd98920f0811eb02a59c1e354a2cb6cc44dea0
/in/test/SampleApp.java
3da13aad8ae68497185bb62bd2b60d769631aa32
[ "MIT" ]
permissive
mepcotterell/elcScriptedGrader
97fa6bf2ba91270a3c2fd8d9eec3047a4e6efd2f
8ca007a841eb17b57ff63a6bb2b885c30326f96a
refs/heads/master
2021-01-01T18:27:48.867716
2012-02-29T17:12:17
2012-02-29T17:12:17
3,582,390
0
0
null
null
null
null
UTF-8
Java
false
false
893
java
/* SampleApp.java * * This is a short description... * * Pretend that the Academic Honesty Statement is here! */ import static java.lang.System.in; import static java.lang.System.out; import java.util.Scanner; /** A sample application */ public class SampleApp { /** Scanner for keyboard input */ public static Scanner kb = new Scanner(in); /** The main program method * @param args any command line arguments passed the program */ public static void main (String[] args) { out.println("Welcome to SampleApp!"); out.println("This program will take in two integers and add them!"); out.println(); out.print("Please enter the first integer: "); int a = kb.nextInt(); out.print("Please enter the second integer: "); int b = kb.nextInt(); out.println(); out.printf("The sum of %d and %d is %d.\n", a, b, a+b); } // main } // SampleApp
[ "mepcotterell@gmail.com" ]
mepcotterell@gmail.com
c82ce99f52f9bb9a5c58cea5291541da413a3ad9
1b9878b1defb914f5f65cb14ee3ef9eb292988c3
/cooper-webserver/src/main/java/jdepend/webserver/web/WebRelationGraphUtil.java
d7b1c178a81fdde321503ca20cf6f696b290ff84
[ "Apache-2.0" ]
permissive
tokyobs/cooper
116303ca5e3852d86db5df069cafd36c92732587
baac23d8372a4ece5c103a815b2a573a55ee59cb
refs/heads/master
2022-01-07T10:56:50.155287
2019-04-28T08:14:33
2019-04-28T08:14:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,593
java
package jdepend.webserver.web; import java.util.ArrayList; import java.util.Collection; import java.util.List; import jdepend.model.Element; import jdepend.model.Relation; import net.sf.json.JSONArray; public class WebRelationGraphUtil { static RelationGraphData getGraphData(Collection<Relation> relations) { Collection<Element> elements = Relation.calElements(relations); List<Node> nodes = new ArrayList<Node>(); Node node; for (Element element : elements) { node = new Node(); node.setCategory(0); node.setName(element.getName()); nodes.add(node); } List<Edge> edges = new ArrayList<Edge>(); Edge edge; for (Relation relation : relations) { edge = new Edge(); edge.setSource(getPosition(elements, relation.getCurrent())); edge.setTarget(getPosition(elements, relation.getDepend())); edges.add(edge); } return new RelationGraphData(nodes, edges); } private static int getPosition(Collection<Element> elements, Element obj) { int i = 0; for (Element element : elements) { if (obj.equals(element)) { return i; } i++; } throw new RuntimeException("数据错误!"); } public static class RelationGraphData { private List<Node> nodes; private List<Edge> edges; public RelationGraphData(List<Node> nodes, List<Edge> edges) { super(); this.nodes = nodes; this.edges = edges; } public String getNodeInfo() { return JSONArray.fromObject(nodes).toString(); } public String getEdgeInfo() { return JSONArray.fromObject(edges).toString(); } } public static class Node { private int category; private String name; private int value; public int getCategory() { return category; } public void setCategory(int category) { this.category = category; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } } public static class Edge { private int source; private int target; private int weight; public int getSource() { return source; } public void setSource(int source) { this.source = source; } public int getTarget() { return target; } public void setTarget(int target) { this.target = target; } public int getWeight() { return weight; } public void setWeight(int weight) { this.weight = weight; } } }
[ "wangdg@neusoft.com" ]
wangdg@neusoft.com
7220052e5c36ad5386395cd7bc61f3666c2b7edb
36492979a56583e6c77c86f40d325b6c789c2c51
/example/android/app/src/main/java/com/example/gps_example/MainActivity.java
a2fdbd420241fa45127ed577a5426f1d8571e32a
[ "MIT" ]
permissive
muarachmann/flutter_gps
3012d96528885af9ac093e773d16cc9e3c2434b7
4a1700064c9ad754f2971e2ccca3326cd3285169
refs/heads/master
2023-05-01T18:54:42.732082
2021-05-27T16:01:33
2021-05-27T16:01:33
371,420,332
0
1
MIT
2021-05-27T15:25:45
2021-05-27T15:25:44
null
UTF-8
Java
false
false
368
java
package com.example.gps_example; import android.os.Bundle; import io.flutter.app.FlutterActivity; import io.flutter.plugins.GeneratedPluginRegistrant; public class MainActivity extends FlutterActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GeneratedPluginRegistrant.registerWith(this); } }
[ "cjl_spy@163.com" ]
cjl_spy@163.com
4f8f0dadc0f612788f05d1cdd73093ab993ba151
d7df3b8cd2cd25a75c9891e6c73e26d7fb9fb322
/testbuild/JavaZip.java
d542a3fe35fde7ffe612bd1eb74a5680b8c6449f
[]
no_license
aaronsamuel137/zipout
097444e672cfb418d099532f8d4796b602c407c0
9f162ad92785a5bacaa1c761151ccdfb7c930f36
refs/heads/master
2020-05-18T19:48:58.345836
2013-07-08T21:18:54
2013-07-08T21:18:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,815
java
import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; // Our code must be able to do this public class JavaZip { public static void main(String[] args) { byte[] buffer = new byte[1024]; String workingDir = System.getProperty("user.dir"); File testFile = new File(workingDir, "test.txt"); if (testFile.exists()) try { testFile.delete(); } catch (Exception e) {} writeTestFile(testFile); File outputFile = new File(workingDir, "java.zip"); if (outputFile.exists()) { try { outputFile.delete(); } catch (Exception e) { System.out.println("File not deleted"); } } try { FileOutputStream outFile = new FileOutputStream(outputFile); ZipOutputStream outZip = new ZipOutputStream(outFile); InputStream inFile = new FileInputStream(testFile); ZipEntry entry = new ZipEntry("test.txt"); outZip.putNextEntry(entry); int len = 0; while ((len = inFile.read(buffer)) > 0) { outZip.write(buffer, 0, len); //for (byte b : buffer) //if (b != 0) //System.out.println(Integer.toHexString(b)); } inFile.close(); outZip.closeEntry(); outZip.close(); } catch (IOException e) { System.out.println("Exception caught"); } } public static void writeTestFile(File file) { try { if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write("this is a test"); bw.close(); } catch (IOException e) { System.out.println("No test file"); } } public static void readBytesFromZip () { } }
[ "aaron.davis@readytalk.com" ]
aaron.davis@readytalk.com
d848c71c0f106364d05ca9eee583347418ad84a4
72643c62ff940ce8acbbb2443c77df8c5f13194a
/src/marvelsgroup/Printer.java
d0de09f6ee4dfdd3f4062f86bb666ab15da00f3c
[]
no_license
pranavacharekar/Pharmacy-Management
d65fb553209fabefd32e798da3cfe4c64e400761
984264b7725f732ab7c7ae2df78412b6ecb1c80b
refs/heads/master
2020-03-18T19:47:02.546228
2018-05-28T15:16:32
2018-05-28T15:16:32
135,177,305
0
0
null
null
null
null
UTF-8
Java
false
false
3,546
java
/* * 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 marvelsgroup; import javax.swing.*; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.util.logging.Level; import java.util.logging.Logger; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.Paragraph; import com.itextpdf.text.pdf.PdfPTable; import com.itextpdf.text.pdf.PdfWriter; //import com.itextpdf.text.Image; //import java.awt.*; /** * * @author hp-pc */ public class Printer { String finaldate; private String getFormattedDate(String unformatteddate) { String[] parts1=new String[2], parts2=new String[3]; parts1=unformatteddate.split(" "); parts2=parts1[0].split("-"); return (parts2[2]+" / "+parts2[1]+" / "+parts2[0]); } public String printPDF(JTable x, FinalBillElement f) { FileOutputStream file = null; String URL="C:\\Users\\hp-pc\\Documents\\INVOICES\\"+f.pname+f.billID+".pdf"; try { file = new FileOutputStream(new File(URL)); } catch (FileNotFoundException e1) { e1.printStackTrace(); } Document document = new Document(); try { PdfWriter.getInstance(document, file); } catch (DocumentException ex) { Logger.getLogger(Printer.class.getName()).log(Level.SEVERE, null, ex); } document.open(); Paragraph p = new Paragraph(); try { //Image img = Image.getInstance("caduceus.jpg"); //img.setAbsolutePosition(100f, 500f); //img.scaleAbsolute(200,200); p.add("\n\t\t\t\t\t"); p.add(" MEDICAL STORE"); p.add("\n =========================================================================="); p.add("\n Invoice no.: " + f.billID); p.add("\n Invoice date: " + getFormattedDate(f.indate)); p.add("\n Patient Name: " + f.pname); p.add("\n Doctor Name: " + f.dname); p.add("\n Patient Address: " + f.addr); p.add("\n ==========================================================================\n\n"); PdfPTable pdfTable = new PdfPTable(x.getColumnCount()); //adding table headers for (int i = 0; i < x.getColumnCount(); i++) { pdfTable.addCell(x.getColumnName(i)); } //extracting data from the JTable and inserting it to PdfPTable for (int rows = 0; rows < x.getRowCount(); rows++) { for (int cols = 0; cols < x.getColumnCount(); cols++) { pdfTable.addCell(x.getModel().getValueAt(rows, cols).toString()); } } Paragraph ps = new Paragraph(); ps.add("\n =========================================================================="); ps.add("\n Subtotal := Rs."+f.total); ps.add("\n Discount :="+f.dis+" %"); ps.add("\n Net Total := Rs."+f.ntotal); document.add(p); //document.add(img); document.add(pdfTable); document.add(ps); document.close(); System.out.println("PDF created!"); } catch (Exception e) { e.printStackTrace(); } return URL; } }
[ "pranav.acharekar@gmail.com" ]
pranav.acharekar@gmail.com
30af34ead8ab58b061597e2020aa9c09f23f6bce
70448098958ff376e2f96cf798e76e593341e18f
/MVCProj06-DataRendering/src/main/java/com/nt/bo/EmployeeBO.java
2681840eeeaf49f9fda7d24a06ce344e37032692
[]
no_license
8341849309/spring-mvc
285fca9bf0a4f8100bab8ff5dd79ff4875d3f28c
c7bec3000ae439dce4f7fa9305d5bfdd7c1141b3
refs/heads/master
2023-05-23T20:18:51.253857
2021-06-18T14:40:01
2021-06-18T14:40:01
349,339,808
0
0
null
null
null
null
UTF-8
Java
false
false
271
java
package com.nt.bo; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NonNull; @Data @AllArgsConstructor public class EmployeeBO { private int empId; @NonNull private String ename; private float salary; private String addrs; }
[ "hp@venkat" ]
hp@venkat
203a9fffbdd7cf28335f53139712df74bddac7b5
6707354eea7d590a2ab0b30ca86dd21dfa69d22a
/Avve/src/main/java/avve/textpreprocess/PartOfSpeechTagger.java
4054218c88c57d5d12e7df2afb0bb1fefe2bb008
[]
no_license
sermo-de-arboribus/Avve
bcb1b3d4ba594f4d4163fcfed9717e5e7762fb33
8c7fb3bc319fe6cffbf1c37f4e316bdb0daaad74
refs/heads/master
2020-09-14T02:41:10.432143
2018-10-20T15:05:26
2018-10-20T15:05:26
94,465,722
0
0
null
null
null
null
UTF-8
Java
false
false
4,568
java
package avve.textpreprocess; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Locale; import java.util.ResourceBundle; import java.util.SortedMap; import org.apache.commons.cli.CommandLine; import org.apache.logging.log4j.Logger; import avve.epubhandling.EbookContentData; import avve.extractor.CommandLineArguments; import opennlp.tools.postag.POSModel; import opennlp.tools.postag.POSTaggerME; /** * This class populates an EbookContentData object's part of speech statistics (via setPartsOfSpeech()). It required a tokenized input text * (from EbookContentData object's getTokens()). * * @author Kai Weber * */ public class PartOfSpeechTagger implements TextPreprocessor { private static final ResourceBundle errorMessageBundle = ResourceBundle.getBundle("ErrorMessagesBundle", Locale.getDefault()); private static final ResourceBundle infoMessagesBundle = ResourceBundle.getBundle("InfoMessagesBundle", Locale.getDefault()); CommandLine cliArguments; HashMap<String, String> correctionMap; private Logger logger; private POSTaggerME tagger; @Override public String getName() { return "PartOfSpeechTagger"; } public PartOfSpeechTagger(Logger logger, CommandLine cliArguments) { this.cliArguments = cliArguments; this.logger = logger; try (InputStream modelIn = this.getClass().getClassLoader().getResourceAsStream("opennlp/de-pos-maxent.bin")) { POSModel model = new POSModel(modelIn); tagger = new POSTaggerME(model); } catch (IOException exc) { this.logger.error(errorMessageBundle.getString("avve.textpreprocess.partOfSpeechTaggerModelInitError"), exc); } // if we have a command line argument set for POS-tag correction, we use a resource text file for correction values if(cliArguments.hasOption(CommandLineArguments.POSCORRECTION.toString())) { correctionMap = new HashMap<String, String>(); try (InputStream modelIn = this.getClass().getClassLoader().getResourceAsStream("opennlp/postag-de-dict.txt")) { BufferedReader reader = new BufferedReader(new InputStreamReader(modelIn, "UTF-8")); String line; while((line = reader.readLine()) != null) { if(!line.startsWith("//")) { String[] tokens = line.split("\\s+"); correctionMap.put(tokens[0] + "_" + tokens[1], tokens[2]); } } } catch (IOException exc) { this.logger.error(errorMessageBundle.getString("avve.textpreprocess.PartOfSpeechTaggerCorrectionFileInitError"), exc); } } } @Override public void process(EbookContentData ebookContentData) { logger.info(infoMessagesBundle.getString("avve.textpreprocess.partOfSpeechTaggingStarted")); if(ebookContentData.getTokens() == null || ebookContentData.getTokens().length == 0) { ebookContentData.setPartsOfSpeech(new String[0][0]); this.logger.error(String.format(errorMessageBundle.getString("avve.textpreprocess.noTokensAvailable"), "PartOfSpeechTagger.process()")); } else { boolean isCorrectionRequired = cliArguments.hasOption(CommandLineArguments.POSCORRECTION.toString()) && null != correctionMap; String[][] partsOfSpeech = new String[ebookContentData.getTokens().length][]; for(int i = 0; i < partsOfSpeech.length; i++) { String[] currentSentence = ebookContentData.getTokens()[i]; partsOfSpeech[i] = tagger.tag(currentSentence); // if we have a command line argument set for POS-tag correction, we process the tagging results through a replacement table if(isCorrectionRequired) { for(int j = 0; j < partsOfSpeech[i].length; j++) { String tokenAndPosTag = ebookContentData.getTokens()[i][j].toLowerCase() + "_" + partsOfSpeech[i][j]; if(correctionMap.containsKey(tokenAndPosTag)) { partsOfSpeech[i][j] = correctionMap.get(tokenAndPosTag); } } } } ebookContentData.setPartsOfSpeech(partsOfSpeech); // this counting is only done for logging purposes SortedMap<String, Integer> posMap = ebookContentData.getPartsOfSpeechFrequencies(); for(String[] sentence : ebookContentData.getPartsOfSpeech()) { for(String tag : sentence) { if(posMap.containsKey(tag)) { posMap.put(tag, posMap.get(tag) + 1); } else { posMap.put(tag, 1); } } } logger.trace(String.format(infoMessagesBundle.getString("avve.textpreprocess.partOfSpeechTaggerDifferentPos"), posMap.keySet().size())); } } }
[ "sermo_de_arboribus@seznam.cz" ]
sermo_de_arboribus@seznam.cz
09f2c20e6d5eeb6572170529cc6d17f1233d0875
efb7efbbd6baa5951748dfbe4139e18c0c3608be
/sources/org/bitcoinj/store/BlockStore.java
deaa30f90abd984af4b60addf9b1c885cb958fa0
[]
no_license
blockparty-sh/600302-1_source_from_JADX
08b757291e7c7a593d7ec20c7c47236311e12196
b443bbcde6def10895756b67752bb1834a12650d
refs/heads/master
2020-12-31T22:17:36.845550
2020-02-07T23:09:42
2020-02-07T23:09:42
239,038,650
0
0
null
null
null
null
UTF-8
Java
false
false
537
java
package org.bitcoinj.store; import org.bitcoinj.core.NetworkParameters; import org.bitcoinj.core.Sha256Hash; import org.bitcoinj.core.StoredBlock; public interface BlockStore { void close() throws BlockStoreException; StoredBlock get(Sha256Hash sha256Hash) throws BlockStoreException; StoredBlock getChainHead() throws BlockStoreException; NetworkParameters getParams(); void put(StoredBlock storedBlock) throws BlockStoreException; void setChainHead(StoredBlock storedBlock) throws BlockStoreException; }
[ "hello@blockparty.sh" ]
hello@blockparty.sh
7ec5376149473a133d974963b5557a2169b08e05
7f3f9be71479f48b6dbc75f8180f4540f590a48d
/src/main/java/com/eduspace/dao/email/interfac/EmailLogDaoI.java
c1aa787ea40c85e5f816725f06491982b5236b98
[]
no_license
hechenwe/uutool
d721521f9c1b87de79633230f45ddcf49c2fb6c2
b8e66f22d3d89ba9d43d3445641aa6dcf227af58
refs/heads/master
2021-01-17T14:51:22.941572
2016-08-08T09:14:43
2016-08-08T09:14:43
55,034,318
0
0
null
null
null
null
UTF-8
Java
false
false
1,271
java
package com.eduspace.dao.email.interfac; import java.util.List; import com.eduspace.entity.email.EmailDayTypeStat; import com.eduspace.entity.email.EmailLog; import com.sooncode.jdbc.DaoI; public interface EmailLogDaoI extends DaoI<EmailLog> { /** * 获取 产品的编号 集 * @param requestDate 短信发送日期 * @param messageState 短信状态 * @return 产品的编号 集 */ public List<String> getProductIds(String requestDate,String messageState); /** * * @param productId 产品编号 * @param requestDate 请求时间 * @param messageState 短信状态 * @return 短信数量 */ public Long getNumber(String productId, String requestDate, String messageState) ; /** * 获取当日 短信类型 和短信类型对应的短信数量 * @param productId 产品编号 * @param requestDate 请求时间 * @return 把 短信类别 和短信数量 封装在 SmsDayTypeStat 内 */ public List<EmailDayTypeStat> getTypeOfNumber(String productId, String requestDate); /** * 获取某日 短信日志条数 */ public Long getSmsSize(String dateString) ; /** * 删除某日 短信日志条数 */ public Long deleteSms(String dateString) ; }
[ "hechen@e-eduspace.com" ]
hechen@e-eduspace.com
a6a173d99f935379c5e9617505a68ad33edba8ad
674be2c771960c6a3a3a25f081c97acc484e2e01
/CleanCoders/kr/4. Function (2)/src/main/java/NumberPrinter.java
6c851ce02b3deb135a3655b9fa264c8ab2979f13
[]
no_license
gaonK/TIL
58c2486a060f11bb264fd93affd9c0da03005771
eca1ee782d1fd8d2aa8361977a599624c78d0581
refs/heads/master
2021-07-06T19:23:54.385715
2020-10-28T22:19:06
2020-10-28T22:19:06
202,530,683
14
2
null
null
null
null
UTF-8
Java
false
false
971
java
public class NumberPrinter { private int linesPerPage; private int columns; NumberPrinter(int linesPerPage, int columns) { this.linesPerPage = linesPerPage; this.columns = columns; } public void printNumber(int[] primes, int numberOfPrimes) { int pagenumber = 1; int pageoffset = 1; while (pageoffset <= numberOfPrimes) { System.out.println("The First " + numberOfPrimes + " Prime Numbers --- Page " + pagenumber); System.out.println(""); for (int rowoffset = pageoffset; rowoffset < pageoffset + linesPerPage; rowoffset++) { for (int column = 0; column < columns; column++) if (rowoffset + column * linesPerPage <= numberOfPrimes) System.out.format("%10d", primes[rowoffset + column * linesPerPage]); System.out.println(""); } System.out.println("\f"); pagenumber = pagenumber + 1; pageoffset = pageoffset + linesPerPage * columns; } } }
[ "gaon.kim.dev@gmail.com" ]
gaon.kim.dev@gmail.com
627736cdabf03cb8d1924f9235c91aafe00218d2
85c8a4b7df9d5bcc2918724e34708a6c28556b14
/app-service/src/main/java/com/chenyifaer/app/entity/dto/WechatTokenDTO.java
6dd64eb013d34cbd6a2431b85f21047766d30285
[]
no_license
wudonghe1996/chenyifaer-shop
9b38f59a81bc08a129ad15aa4d838ebea66c0c9b
ca51946af31dec7b154c5b0de685c1408761ccdd
refs/heads/master
2022-06-24T06:17:07.753068
2020-05-09T03:58:27
2020-05-09T03:58:27
178,018,127
1
1
null
2022-06-17T02:05:40
2019-03-27T15:02:41
Java
UTF-8
Java
false
false
879
java
package com.chenyifaer.app.entity.dto; import lombok.Data; import lombok.experimental.Accessors; /** * _____ _ __ ___ ______ ________ ____ ______ ____ * / ____| | \ \ / (_) ____| / /____ |___ \____ |___ \ * | | | |__ ___ _ _\ \_/ / _| |__ __ _ ___ _ __ / /_ / / __) | / / __) | * | | | '_ \ / _ \ '_ \ / | | __/ _` |/ _ \ '__| '_ \ / / |__ < / / |__ < * | |____| | | | __/ | | | | | | | | (_| | __/ | | (_) / / ___) |/ / ___) | * \_____|_| |_|\___|_| |_|_| |_|_| \__,_|\___|_| \___/_/ |____//_/ |____/ * */ /** * 获取微信token返回值 * @Author:wudh * @Date: 2019/7/9 10:57 */ @Data @Accessors(chain = true) public class WechatTokenDTO { /** accessToken */ private String access_token; /** 过期时间 */ private String expires_in; }
[ "1044717927@qq.com" ]
1044717927@qq.com
395163433bc93c53dc8efb9f4c033cde414d30ce
e7f1fd3f136c7c3be12b4a47fdc8dd92ae8fde9c
/dropwizard-0.7-opentracing/src/main/java/io/opentracing/contrib/dropwizard/ServerRequestTracingFilter.java
9e1b4572daf45b6d874bfde41e68f52dacbcc36c
[ "Apache-2.0" ]
permissive
kcamenzind/dropwizard-opentracing
9ea8e4f85c92d7eab85d2c511e3ea8a13109fad9
9b06d1dd1bb7c9f9fdd786a881578e3f0da88cd3
refs/heads/master
2021-01-17T17:45:40.648805
2016-07-28T22:28:04
2016-07-28T22:28:04
63,451,594
0
0
null
null
null
null
UTF-8
Java
false
false
7,850
java
package io.opentracing.contrib.dropwizard; import com.sun.jersey.spi.container.ContainerRequest; import com.sun.jersey.spi.container.ContainerRequestFilter; import io.opentracing.Span; import io.opentracing.SpanContext; import io.opentracing.propagation.TextMapReader; import io.opentracing.contrib.dropwizard.DropWizardTracer; import io.opentracing.contrib.dropwizard.ServerAttribute; import java.io.IOException; import java.util.Map; import java.util.HashMap; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import javax.ws.rs.core.MultivaluedMap; /** * When registered to a DropWizard service along with a ServerResponseTracingFilter, * this filter creates a span for any requests to the service. */ public class ServerRequestTracingFilter implements ContainerRequestFilter { private final DropWizardTracer tracer; private final Set<ServerAttribute> tracedAttributes; private final Set<String> tracedProperties; private final String operationName; /** * @param tracer to trace requests with * @param tracedAttributes any ServiceAttributes to log to spans * @param tracedProperties any request properties to log to spans */ private ServerRequestTracingFilter( DropWizardTracer tracer, String operationName, Set<ServerAttribute> tracedAttributes, Set<String> tracedProperties ) { this.tracer = tracer; this.operationName = operationName; this.tracedProperties = tracedProperties; this.tracedAttributes = tracedAttributes; } public static class Builder { private final DropWizardTracer tracer; private Set<ServerAttribute> tracedAttributes = new HashSet<ServerAttribute>(); private Set<String> tracedProperties = new HashSet<String>(); private String operationName = ""; public Builder(DropWizardTracer tracer) { this.tracer = tracer; } public Builder withTracedAttributes(Set<ServerAttribute> attributes) { this.tracedAttributes = attributes; return this; } public Builder withTracedProperties(Set<String> properties) { this.tracedProperties = properties; return this; } public Builder withOperationName(String operationName) { this.operationName = operationName; return this; } public ServerRequestTracingFilter build() { return new ServerRequestTracingFilter(this.tracer, this.operationName, this.tracedAttributes, this.tracedProperties); } } @Override public ContainerRequest filter(ContainerRequest request) { String operationName; if(this.operationName == "") { operationName = request.getRequestUri().toString(); } else { operationName = this.operationName; } // format the headers for extraction Span span; MultivaluedMap<String, String> rawHeaders = request.getRequestHeaders(); final HashMap<String, String> headers = new HashMap<String, String>(); for(String key : rawHeaders.keySet()){ headers.put(key, rawHeaders.get(key).get(0)); } // extract the client span try { SpanContext parentSpan = tracer.getTracer().extract(new TextMapReader() { public Iterator<Map.Entry<String, String>> getEntries() { return headers.entrySet().iterator(); } }); if(parentSpan == null){ span = tracer.getTracer().buildSpan(operationName).start(); } else { span = tracer.getTracer().buildSpan(operationName).asChildOf(parentSpan).start(); } } catch(IllegalArgumentException e) { span = tracer.getTracer().buildSpan(operationName).start(); } // trace attributes for(ServerAttribute attribute : this.tracedAttributes) { switch(attribute) { case ABSOLUTE_PATH: try { span.setTag("Absolute Path", request.getAbsolutePath().toString()); } catch(NullPointerException npe) {} break; case ACCEPTABLE_LANGUAGES: try { span.setTag("Acceptable Languages", request.getAcceptableLanguages().toString()); } catch(NullPointerException npe) {} break; case ACCEPTABLE_MEDIA_TYPES: try { span.setTag("Acceptable Media Types", request.getAcceptableMediaTypes().toString()); } catch(NullPointerException npe) {} break; case AUTHENTICATION_SCHEME: try { span.setTag("Authentication Scheme", request.getAuthenticationScheme()); } catch(NullPointerException npe) {} break; case BASE_URI: try { span.setTag("Base URI", request.getBaseUri().toString()); } catch(NullPointerException npe) {} break; case COOKIES: try { span.setTag("Cookies", request.getCookies().toString()); } catch(NullPointerException npe) {} break; case HEADERS: try { span.setTag("Headers", request.getRequestHeaders().toString()); } catch(NullPointerException npe) {} break; case IS_SECURE: try { span.setTag("Is Secure", request.isSecure()); } catch(NullPointerException npe) {} break; case LANGUAGE: try { span.setTag("Language", request.getLanguage().toString()); } catch(NullPointerException npe) {} break; case METHOD: try { span.setTag("Method", request.getMethod()); } catch(NullPointerException npe) {} break; case MEDIA_TYPE: try { span.setTag("Media Type", request.getMediaType().toString()); } catch(NullPointerException npe) {} break; case PATH: try { span.setTag("Property Names", request.getPath().toString()); } catch(NullPointerException npe) {} break; case QUERY_PARAMETERS: try { span.setTag("Query Paramters", request.getQueryParameters().toString()); } catch(NullPointerException npe) {} break; case SECURITY_CONTEXT: try { span.setTag("Security Context", request.getSecurityContext().getAuthenticationScheme()); } catch(NullPointerException npe) {} break; case URI: try { span.setTag("URI", request.getRequestUri().toString()); } catch(NullPointerException npe) {} break; case USER_PRINCIPAL: try { span.setTag("User Principal", request.getUserPrincipal().getName()); } catch(NullPointerException npe) {} break; } } // trace properties for(String propertyName : this.tracedProperties) { Object property = request.getProperties().get(propertyName); if(property != null) { span.log(propertyName, property); } } // add the new span to the trace tracer.addServerSpan(request, span); return request; } }
[ "kacamenzind@gmail.com" ]
kacamenzind@gmail.com
be63fc65fa2d8f4d3441b65d0c6b877bc1851a1f
55d7bfd04f4fe32560831afdd87e395487ea5013
/TravelAgency-master/app/src/main/java/com/luispc/travelangency/JSONParser.java
006ff2f1e564a758a2321c08fcfa4c75eacf510a
[]
no_license
guti2510/agenciadeviajes
5129647abea62ca4173eda6c9c61b6f740987f8c
5cc15d54d4e3e06c038be4432fd46e9fa2ba6b26
refs/heads/master
2016-09-01T19:47:50.989294
2015-04-23T22:34:04
2015-04-23T22:34:04
34,147,768
0
0
null
null
null
null
UTF-8
Java
false
false
3,258
java
package com.luispc.travelangency; import android.util.Log; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.utils.URLEncodedUtils; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.util.List; /** * Created by JuanJose on 15-Apr-15. */ public class JSONParser { static InputStream is = null; static JSONObject jObj = null; static String json = ""; // constructor public JSONParser() { } // function get json from url // by making HTTP POST or GET mehtod public JSONObject makeHttpRequest(String url, String method, List params) { // Making HTTP request try { // check for request method if(method == "POST"){ // request method is POST // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); }else if(method == "GET"){ // request method is GET DefaultHttpClient httpClient = new DefaultHttpClient(); String paramString = URLEncodedUtils.format(params, "utf-8"); url += "?" + paramString; HttpGet httpGet = new HttpGet(url); HttpResponse httpResponse = httpClient.execute(httpGet); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); json = sb.toString(); } catch (Exception e) { Log.e("Buffer Error", "Error converting result " + e.toString()); } // try parse the string to a JSON object try { jObj = new JSONObject(json); } catch (JSONException e) { Log.e("JSON Parser", "Error parsing data " + e.toString()); } // return JSON String return jObj; } }
[ "juanjo10guti@gmail.com" ]
juanjo10guti@gmail.com
b492aaa59dbd03dedad3fba94be1a6e025469909
dde7a97243c5154067826e2724e5a2fcc356fff9
/src/main/java/com/tts/techtalenttwitter/repository/RoleRepository.java
d6b8b896ed77e0ea382b973a9fd7e1e2070443e2
[]
no_license
jodlr/TechTalentTwitter
9250aaf80c4d2d09a3aec02870f107afab44bc9e
9db5644e5c0a9d3dd85538d7fd0642f27ce1fc68
refs/heads/main
2023-03-13T22:25:48.003070
2021-03-02T15:10:19
2021-03-02T15:10:19
343,812,482
0
0
null
null
null
null
UTF-8
Java
false
false
313
java
package com.tts.techtalenttwitter.repository; import javax.management.relation.Role; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface RoleRepository extends CrudRepository<Role, Long> { Role findByRole(String role); }
[ "johndelarosa_netplus@yahoo.com" ]
johndelarosa_netplus@yahoo.com
1a1aebd1d1d616356f96db4d90520202559a6fac
654bd368f6641f8f1f0cf75f80bdd143670f1856
/src/com/hjcrm/system/service/ITodayNoteService.java
038173debce2488fc324e6a54a42e41785d0b95b
[]
no_license
fuchen1994/CRM-1
b10ed49a990d484f5df97f29ea242116662468b3
5bb5103827abeb0042e5bde62d243fb2cc013a67
refs/heads/master
2020-07-09T09:09:39.088452
2018-11-10T01:03:06
2018-11-10T01:03:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
584
java
package com.hjcrm.system.service; import java.util.List; import com.hjcrm.system.entity.Todaynote; /** * 今日目标接口 * @author likang * @date 2016-10-25 下午4:20:38 */ public interface ITodayNoteService { /** * 增加/修改今日目标 * @param todaynote * @author likang * @date 2016-10-25 下午4:22:48 */ public void saveOrUpdate(Todaynote todaynote); /** * 查询 * @param userid * @return * @author likang * @date 2016-10-25 下午4:22:56 */ public List<Todaynote> queryTodaynote(Long userid); }
[ "947752894@qq.com" ]
947752894@qq.com
dc0d61b718ae63f061999535118a89494f84fa19
df3339eb3f0eb86025adafbdbcd349f5355a016b
/app/src/main/java/com/example/zues/healthok/HealthOK.java
418b927f4e94c4585ffed9010d45d3f08f0084e8
[]
no_license
saurabhrt/PrivateProject
d81978f26c76322c24d10b6aefba8dc89d3064a7
00591e33e7e00709a135460313d24e7225e3228e
refs/heads/master
2020-06-24T01:15:40.861783
2017-12-06T06:16:40
2017-12-06T06:16:40
96,913,660
1
1
null
null
null
null
UTF-8
Java
false
false
351
java
package com.example.zues.healthok; import android.app.Application; import com.beardedhen.androidbootstrap.TypefaceProvider; /** * Created by Abhay-Jaiswal on 7/16/2016. */ public class HealthOK extends Application { @Override public void onCreate() { super.onCreate(); TypefaceProvider.registerDefaultIconSets(); } }
[ "saurabhramtripathi2011@gmail.com" ]
saurabhramtripathi2011@gmail.com
f2091d435887de7014aa723996800fcef6c13080
0df9448f6ce7775280f77d3844abc75566254745
/app/src/androidTest/java/id/ac/poliban/mi/nia/mycrud/ExampleInstrumentedTest.java
e27acddc853d295a87ea1f73f4773a6c4ee8995e
[]
no_license
niakarlida/MyCRUD
084bdce3e62fd9af20335dd662e9ac5f85f3d527
6448e7b04a6db916da70b35b0896343372a29d2c
refs/heads/master
2020-12-07T12:54:00.593993
2020-01-09T06:00:50
2020-01-09T06:00:50
232,726,045
0
0
null
null
null
null
UTF-8
Java
false
false
725
java
package id.ac.poliban.mi.nia.mycrud; import android.content.Context; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("id.ac.poliban.mi.nia.mycrud", appContext.getPackageName()); } }
[ "niakarlida@gmail.com" ]
niakarlida@gmail.com
3798e28c3c96fb95b39128ebfc4d4a400686624b
92cef46b7f9890f8e3ed2a00f02f10208eca02dc
/ffmpeg-cmd/src/androidTest/java/com/m4399/ffmpeg_cmd/ExampleInstrumentedTest.java
e37538df341e5f6fc55874a54f6dc49ca9e3ce5e
[]
no_license
GeJieZhang/ffmpeg_video
e1ab23dfd4f109f88d125111d370dad3683bc08b
1d79deb4a90cfb4f3c8ce300cd28b988603be9dd
refs/heads/master
2020-05-21T05:09:17.157082
2019-05-10T09:26:51
2019-05-10T09:26:51
185,914,698
0
0
null
null
null
null
UTF-8
Java
false
false
754
java
package com.m4399.ffmpeg_cmd; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented change_code, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under change_code. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.m4399.ffmpeg_cmd.change_code", appContext.getPackageName()); } }
[ "1241577948@qq.com" ]
1241577948@qq.com
1c0f87de16da696f63aaebc97edc0140c4cfd544
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_45_buggy/mutated/1697/QueryParser.java
3c607dbfe3369274cc8466f15609dd85da2f9e96
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,279
java
package org.jsoup.select; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; import org.jsoup.helper.StringUtil; import org.jsoup.helper.Validate; import org.jsoup.parser.TokenQueue; /** * Parses a CSS selector into an Evaluator tree. */ class QueryParser { private final static String[] combinators = {",", ">", "+", "~", " "}; private TokenQueue tq; private String query; private List<Evaluator> evals = new ArrayList<Evaluator>(); /** * Create a new QueryParser. * @param query CSS query */ private QueryParser(String query) { this.query = query; this.tq = new TokenQueue(query); } /** * Parse a CSS query into an Evaluator. * @param query CSS query * @return Evaluator */ public static Evaluator parse(String query) { QueryParser p = new QueryParser(query); return p.parse(); } /** * Parse the query * @return Evaluator */ Evaluator parse() { tq.consumeWhitespace(); if (tq.matchesAny(combinators)) { // if starts with a combinator, use root as elements evals.add(new StructuralEvaluator.Root()); combinator(tq.consume()); } else { findElements(); } while (!tq.isEmpty()) { // hierarchy and extras boolean seenWhite = tq.consumeWhitespace(); if (tq.matchChomp(",")) { // group or CombiningEvaluator.Or or = new CombiningEvaluator.Or(evals); evals.clear(); evals.add(or); while (!tq.isEmpty()) { String subQuery = tq.chompTo(","); or.add(parse(subQuery)); } } else if (tq.matchesAny(combinators)) { combinator(tq.consume()); } else if (seenWhite) { combinator(' '); } else { // E.class, E#id, E[attr] etc. AND findElements(); // take next el, #. etc off queue } } if (evals.size() == 1) return evals.get(0); return new CombiningEvaluator.And(evals); } private void combinator(char combinator) { tq.consumeWhitespace(); String subQuery = consumeSubQuery(); // support multi > childs Evaluator e; if (evals.size() == 1) e = evals.get(0); else e = new CombiningEvaluator.And(evals); evals.clear(); Evaluator f = parse(subQuery); if (combinator == '>') evals.add(new CombiningEvaluator.And(f, new StructuralEvaluator.ImmediateParent(e))); else has(); if (combinator == ' ') evals.add(new CombiningEvaluator.And(f, new StructuralEvaluator.Parent(e))); else if (combinator == '+') evals.add(new CombiningEvaluator.And(f, new StructuralEvaluator.ImmediatePreviousSibling(e))); else if (combinator == '~') evals.add(new CombiningEvaluator.And(f, new StructuralEvaluator.PreviousSibling(e))); else throw new Selector.SelectorParseException("Unknown combinator: " + combinator); } private String consumeSubQuery() { StringBuilder sq = new StringBuilder(); while (!tq.isEmpty()) { if (tq.matches("(")) sq.append("(").append(tq.chompBalanced('(', ')')).append(")"); else if (tq.matches("[")) sq.append("[").append(tq.chompBalanced('[', ']')).append("]"); else if (tq.matchesAny(combinators)) break; else sq.append(tq.consume()); } return sq.toString(); } private void findElements() { if (tq.matchChomp("#")) byId(); else if (tq.matchChomp(".")) byClass(); else if (tq.matchesWord()) byTag(); else if (tq.matches("[")) byAttribute(); else if (tq.matchChomp("*")) allElements(); else if (tq.matchChomp(":lt(")) indexLessThan(); else if (tq.matchChomp(":gt(")) indexGreaterThan(); else if (tq.matchChomp(":eq(")) indexEquals(); else if (tq.matches(":has(")) has(); else if (tq.matches(":contains(")) contains(false); else if (tq.matches(":containsOwn(")) contains(true); else if (tq.matches(":matches(")) matches(false); else if (tq.matches(":matchesOwn(")) matches(true); else if (tq.matches(":not(")) not(); else // unhandled throw new Selector.SelectorParseException("Could not parse query '%s': unexpected token at '%s'", query, tq.remainder()); } private void byId() { String id = tq.consumeCssIdentifier(); Validate.notEmpty(id); evals.add(new Evaluator.Id(id)); } private void byClass() { String className = tq.consumeCssIdentifier(); Validate.notEmpty(className); evals.add(new Evaluator.Class(className.trim().toLowerCase())); } private void byTag() { String tagName = tq.consumeElementSelector(); Validate.notEmpty(tagName); // namespaces: if element name is "abc:def", selector must be "abc|def", so flip: if (tagName.contains("|")) tagName = tagName.replace("|", ":"); evals.add(new Evaluator.Tag(tagName.trim().toLowerCase())); } private void byAttribute() { TokenQueue cq = new TokenQueue(tq.chompBalanced('[', ']')); // content queue String key = cq.consumeToAny("=", "!=", "^=", "$=", "*=", "~="); // eq, not, start, end, contain, match, (no val) Validate.notEmpty(key); cq.consumeWhitespace(); if (cq.isEmpty()) { if (key.startsWith("^")) evals.add(new Evaluator.AttributeStarting(key.substring(1))); else evals.add(new Evaluator.Attribute(key)); } else { if (cq.matchChomp("=")) evals.add(new Evaluator.AttributeWithValue(key, cq.remainder())); else if (cq.matchChomp("!=")) evals.add(new Evaluator.AttributeWithValueNot(key, cq.remainder())); else if (cq.matchChomp("^=")) evals.add(new Evaluator.AttributeWithValueStarting(key, cq.remainder())); else if (cq.matchChomp("$=")) evals.add(new Evaluator.AttributeWithValueEnding(key, cq.remainder())); else if (cq.matchChomp("*=")) evals.add(new Evaluator.AttributeWithValueContaining(key, cq.remainder())); else if (cq.matchChomp("~=")) evals.add(new Evaluator.AttributeWithValueMatching(key, Pattern.compile(cq.remainder()))); else throw new Selector.SelectorParseException("Could not parse attribute query '%s': unexpected token at '%s'", query, cq.remainder()); } } private void allElements() { evals.add(new Evaluator.AllElements()); } // pseudo selectors :lt, :gt, :eq private void indexLessThan() { evals.add(new Evaluator.IndexLessThan(consumeIndex())); } private void indexGreaterThan() { evals.add(new Evaluator.IndexGreaterThan(consumeIndex())); } private void indexEquals() { evals.add(new Evaluator.IndexEquals(consumeIndex())); } private int consumeIndex() { String indexS = tq.chompTo(")").trim(); Validate.isTrue(StringUtil.isNumeric(indexS), "Index must be numeric"); return Integer.parseInt(indexS); } // pseudo selector :has(el) private void has() { tq.consume(":has"); String subQuery = tq.chompBalanced('(', ')'); Validate.notEmpty(subQuery, ":has(el) subselect must not be empty"); evals.add(new StructuralEvaluator.Has(parse(subQuery))); } // pseudo selector :contains(text), containsOwn(text) private void contains(boolean own) { tq.consume(own ? ":containsOwn" : ":contains"); String searchText = TokenQueue.unescape(tq.chompBalanced('(', ')')); Validate.notEmpty(searchText, ":contains(text) query must not be empty"); if (own) evals.add(new Evaluator.ContainsOwnText(searchText)); else evals.add(new Evaluator.ContainsText(searchText)); } // :matches(regex), matchesOwn(regex) private void matches(boolean own) { tq.consume(own ? ":matchesOwn" : ":matches"); String regex = tq.chompBalanced('(', ')'); // don't unescape, as regex bits will be escaped Validate.notEmpty(regex, ":matches(regex) query must not be empty"); if (own) evals.add(new Evaluator.MatchesOwn(Pattern.compile(regex))); else evals.add(new Evaluator.Matches(Pattern.compile(regex))); } // :not(selector) private void not() { tq.consume(":not"); String subQuery = tq.chompBalanced('(', ')'); Validate.notEmpty(subQuery, ":not(selector) subselect must not be empty"); evals.add(new StructuralEvaluator.Not(parse(subQuery))); } }
[ "justinwm@163.com" ]
justinwm@163.com
5f9b2ca880fdbd45ffd862111e4db90e776f841a
a636c3956252dcc6cc1687ce6b3676c25898e360
/ritmvb-middleware/src/test/java/com/ritmvb/middleware/dao/AboutDAOTest.java
7ebeed7db8726001410c12764927ea6238c101a5
[]
no_license
michaeljohnbarton/ritmvb
ff9b9d0c1109fe0c753c602fdd3a8379b8cfb44a
8d743ed159a782717f3550d33d7a74c20f83acd9
refs/heads/main
2023-02-02T12:46:14.280161
2020-12-18T23:18:43
2020-12-18T23:18:43
257,116,663
0
0
null
null
null
null
UTF-8
Java
false
false
1,443
java
package com.ritmvb.middleware.dao; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.when; import java.util.Arrays; import java.util.List; import com.ritmvb.middleware.extractor.AboutTextExtractor; import com.ritmvb.middleware.extractor.TitleExtractor; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.jdbc.core.JdbcTemplate; @ExtendWith(MockitoExtension.class) public class AboutDAOTest { @InjectMocks AboutDAO CuT; @Mock JdbcTemplate jdbcTemplateMock; @Test public void getTitle_defaultCall_returnsTitle() { // Arrange when(jdbcTemplateMock.query(anyString(), any(TitleExtractor.class))).thenReturn("title"); // Act String actual = CuT.getTitle(); // Assert assertEquals("title", actual); } @Test public void getText_defaultCall_returnsListOfText() { // Arrange when(jdbcTemplateMock.query(anyString(), any(AboutTextExtractor.class))).thenReturn(Arrays.asList("text")); // Act List<String> actual = CuT.getText(); // Assert assertEquals(Arrays.asList("text"), actual); } }
[ "mjb7480@rit.edu" ]
mjb7480@rit.edu
34986c90d4a67e6d5abd67330ba03c321d2fb935
964e7f9e14b3801de40be091bc621e807e907d7a
/Tema03/Ejercicio07/Ejercicio7.java
8e7c71a38749ff3f1e3c062ddc8f8653be6383ad
[]
no_license
jorgegarcia1996/ejercicios-de-programacion
1cb6a7daa8bfc540bcaa2c0ae0035745511dc147
80ccc831f2332ba383090863e37b62ea490057a6
refs/heads/master
2020-03-29T19:17:36.223500
2019-02-12T11:53:25
2019-02-12T11:53:25
150,255,678
4
0
null
null
null
null
UTF-8
Java
false
false
757
java
/** * Ejercicio 7 del Tema 3 * Calcular el total de una factura a partir de una base imponible que se pide * por pantalla * * @author Jorge García Molina */ public class Ejercicio7 { public static void main(String[] args) { System.out.println("Calcular el total de una factura a partir de la base" + " imponible."); //Pedir labase imponible System.out.print("Introduzca la base imponible: "); double baseImponible = Double.parseDouble(System.console().readLine()); //Calcular el total de la factura double IVA = baseImponible * 0.21; double total = baseImponible + IVA; System.out.printf("El IVA de la factura es %.2f euros\n", IVA); System.out.printf("El total de la factura es %.2f euros", total); } }
[ "jorgetrapiche1996@gmail.com" ]
jorgetrapiche1996@gmail.com
805c4eaee162cd998f07d20f930825c2b0368eac
8d7f30ce917cbdbcf3bdbc158759750d16cefa7a
/device/src/main/java/me/pixka/device/c/Updatefw.java
a1c1eacf408f4af97b55bb64dabe064d0bbe6a1c
[]
no_license
kykub/device
651cd3d828f2a7bd4a4eef8e8a1f9032a644f628
be54efc02ff83da29bcab14f431cc4b0ad104602
refs/heads/master
2021-01-01T05:46:27.658257
2017-02-12T03:13:39
2017-02-12T03:13:39
77,663,821
0
0
null
null
null
null
UTF-8
Java
false
false
3,197
java
package me.pixka.device.c; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import me.pixka.device.d.Fw; import me.pixka.device.s.FwService; @Controller public class Updatefw { @Autowired private FwService service; public static final String path = "./"; @RequestMapping(value = "/updatefw") // @RequestBody String body, public ResponseEntity get(@RequestHeader HttpHeaders headers) throws IOException { // System.out.println("Body "+body); List<String> version = headers.get("x-esp8266-version"); Fw last = service.getLast(); if (last == null) { System.out.println("no update for " + headers.get("x-esp8266-sta-mac") + " version :" + version); return new ResponseEntity(HttpStatus.FORBIDDEN); } String boardver = version.get(0); int lastver = Integer.parseInt(last.getVersion()); int bv = Integer.parseInt(boardver); if (bv < lastver) { System.out.println("update for " + headers.get("x-esp8266-sta-mac") + " version :" + version + " new version " + lastver); byte[] array = Files.readAllBytes(new File(path + "" + last.getId() + ".bin").toPath()); return ResponseEntity.ok().contentType(MediaType.APPLICATION_OCTET_STREAM).body(array); } return new ResponseEntity(HttpStatus.FORBIDDEN); } @RequestMapping(value = "/rest/addfw", method = RequestMethod.POST) @ResponseBody public ResponseEntity<String> uploadFile(@RequestParam("xxx") MultipartFile file, @RequestParam("ver") String n) { try { Fw fw = new Fw(); fw.setVersion(n); fw.setDescription(file.getName()); fw = service.save(fw); FileOutputStream fo = new FileOutputStream(new File(path + fw.getId() + ".bin")); InputStream input = file.getInputStream(); int read = 0; byte buf[] = new byte[1024]; while ((read = input.read(buf)) != -1) { fo.write(buf, 0, read); } fo.close(); input.close(); System.out.println("test upload :" + file + " version " + n); } catch (Exception e) { return new ResponseEntity<String>("error", HttpStatus.BAD_REQUEST); } return new ResponseEntity<String>("ok", HttpStatus.OK); } // method uploadFile @RequestMapping(value = "/lastfw", method = RequestMethod.GET) @ResponseBody public String lastfw() { Fw fw = service.getLast(); if (fw != null) { return fw.getVersion(); } return "no have fw"; } }
[ "ky@pixka.me" ]
ky@pixka.me
c867f960d9cf6842d7d4a607a3dd850eed14f140
6e73b59c4a871d8c8c668745191bf837d123fba2
/paoding-rose-web/src/main/java/net/paoding/rose/web/paramresolver/ParamMetaData.java
40e4536aaa72e1eb70c20980603b6a08213ec51b
[ "Apache-2.0" ]
permissive
fushengzhang/paoding-rose
65137229de2cc1a8565d0a768ecd0e69c09c07d0
db1723c553ab1c4232dc3d4b6e9e3f47f31682f0
refs/heads/master
2020-04-09T07:31:51.878449
2019-03-22T04:55:04
2019-03-22T04:55:04
160,159,788
3
0
Apache-2.0
2018-12-03T08:47:01
2018-12-03T08:47:01
null
UTF-8
Java
false
false
2,069
java
/* * Copyright 2007-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.paoding.rose.web.paramresolver; import java.lang.annotation.Annotation; import java.lang.reflect.Method; /** * {@link ParamMetaData} 封装对一个控制器方法的某个参数的描述 * * @author 王志亮 [qieqie.wang@gmail.com] */ public interface ParamMetaData { /** * 所在的控制器类 * * */ public Class<?> getControllerClass(); /** * 所在的方法 * * */ public Method getMethod(); /** * 该参数在方法所有参数中的位置,从0开始 * * */ public int getIndex(); /** * 该参数的声明类型 * * */ public Class<?> getParamType(); /** * 该参数的名字 * * */ public String getParamName(); /** * 增加一个别名 * * @param aliasParamName * */ public void addAliasParamName(String aliasParamName); /** * 返回所有别名,数组元素如果为null,表示无效 * * */ public String[] getParamNames(); public <T extends Annotation> T getAnnotation(Class<T> annotationClass); public <T extends Annotation> boolean isAnnotationPresent(Class<T> annotationClass); public void setUserObject(Object key, Object userObject); public Object getUserObject(Object key); }
[ "qieqie.wang@gmail.com" ]
qieqie.wang@gmail.com
501eff0fe021cf450048756f27c38f6218dba908
e26a8434566b1de6ea6cbed56a49fdb2abcba88b
/model-setr-types/src/generated/java/com/prowidesoftware/swift/model/mx/dic/StayOnSideType1Code.java
4b5ef77e28cecf8020d04c199c8b0b3ca1633bb6
[ "Apache-2.0" ]
permissive
adilkangerey/prowide-iso20022
6476c9eb8fafc1b1c18c330f606b5aca7b8b0368
3bbbd6804eb9dc4e1440680e5f9f7a1726df5a61
refs/heads/master
2023-09-05T21:41:47.480238
2021-10-03T20:15:26
2021-10-03T20:15:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,105
java
package com.prowidesoftware.swift.model.mx.dic; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for StayOnSideType1Code. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="StayOnSideType1Code"&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"&gt; * &lt;enumeration value="OFFR"/&gt; * &lt;enumeration value="BIDE"/&gt; * &lt;enumeration value="DCAR"/&gt; * &lt;/restriction&gt; * &lt;/simpleType&gt; * </pre> * */ @XmlType(name = "StayOnSideType1Code") @XmlEnum public enum StayOnSideType1Code { /** * An order pegged against the offer price. * */ OFFR, /** * An order pegged against the bid price. * */ BIDE, /** * Indicates a voluntary absence of choice/decision. * */ DCAR; public String value() { return name(); } public static StayOnSideType1Code fromValue(String v) { return valueOf(v); } }
[ "sebastian@prowidesoftware.com" ]
sebastian@prowidesoftware.com
b2d2f2ec5c5017b9e82590a83e2d036d3f276eea
d0ff6cdb489f127f081bfd0682f3366de47b6a34
/control-ws/src/main/java/com/control/ws/xmpp/providers/SOAPProvider.java
85dc2346b93079ac9f1c1ba4502f89b32bc77f65
[]
no_license
yurifariasg/upnp-cloud
2f214f617e86a9fd863e387e7996581bc1645734
b1987f3c4efa949d9ffcb773882c961a5ec7d80b
refs/heads/master
2021-01-17T11:04:54.810042
2016-09-06T02:01:45
2016-09-06T02:01:45
45,313,616
0
0
null
null
null
null
UTF-8
Java
false
false
8,053
java
/** * * Copyright 2013-2014 UPnP Forum All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE FREEBSD PROJECT "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE OR WARRANTIES OF * NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are * those of the authors and should not be interpreted as representing official * policies, either expressed or implied, by the UPnP Forum. * **/ /** * */ package com.control.ws.xmpp.providers; import java.io.IOException; import java.util.HashMap; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.provider.IQProvider; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import com.control.ws.xmpp.packet.SoapResponseIQ; public class SOAPProvider extends IQProvider<SoapResponseIQ> { public final static String ELEMENT_NAME = "Envelope"; public static final String NAMESPACE = "http://schemas.xmlsoap.org/soap/envelope/"; @Override public SoapResponseIQ parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException { boolean stop = false; String name = null; SoapResponseIQ iq = null; while(false == stop) { name = parser.getName(); switch (parser.getEventType()) { case XmlPullParser.START_TAG: { if(ELEMENT_NAME.equals(name)) { iq = parseSoap(parser); stop = true; } break; } case XmlPullParser.END_TAG: { stop = ELEMENT_NAME.equals(name); break; } } if(!stop){ parser.next(); } } name = null; return iq; } private static final String extractActionName(final String responseTag) { int pos = responseTag.indexOf("Response"); if (pos < 1) { return null; } return responseTag.substring(0, pos); } public SoapResponseIQ parseSoap(XmlPullParser parser) throws XmlPullParserException, IOException { String actionName = null; HashMap<String, String> arguments = new HashMap<String, String>(); boolean stop = false; String lastOpenTag = null; while (false == stop) { if(parser.getEventType() == XmlPullParser.START_TAG){ lastOpenTag = parser.getName(); if(parser.getName().endsWith("Response")){ actionName = extractActionName(parser.getName()); //arguments = parseArguments(parser); } }else if(parser.getEventType() ==XmlPullParser.TEXT){ String argName = lastOpenTag; String value = parser.getText(); arguments.put(argName, value); }else if(parser.getEventType() == XmlPullParser.END_TAG){ if(parser.getName().equalsIgnoreCase(ELEMENT_NAME)){ stop=false; break; } } if(!stop){ parser.next(); } } return new SoapResponseIQ(actionName, arguments); } @SuppressWarnings("unused") private HashMap<String, String> parseArguments(XmlPullParser parser) throws XmlPullParserException, IOException { HashMap<String, String> arguments = new HashMap<String, String>(); boolean stop = false; while (false == stop) { if(parser.getEventType() == XmlPullParser.START_TAG){ arguments.put(parser.getName(),getContent(parser,parser.getName())); }else if(parser.getEventType() == XmlPullParser.END_TAG){ if(parser.getName().equalsIgnoreCase(ELEMENT_NAME)){ stop=false; break; } } if(!stop){ parser.next(); } } return arguments; } private String getContent(XmlPullParser parser, String elementName) throws XmlPullParserException, IOException { StringBuilder content = new StringBuilder(); while(true){ switch(parser.getEventType()){ case XmlPullParser.END_TAG: if(parser.getName().equals(elementName)){ return content.toString(); } if(parser.isEmptyElementTag()){ content.append("<"); if(!parser.getNamespace().isEmpty()){ content.append(parser.getNamespace()+":"); } content.append(parser.getName()); for(int i=0;i<parser.getAttributeCount();++i){ content.append(" "); if(!parser.getAttributeNamespace(i).isEmpty()){ content.append(parser.getAttributeNamespace(i)+":"); } content.append(parser.getAttributeName(i)); content.append("="+parser.getAttributeValue(i)); } content.append(" />"); }else{ content.append("</"); if(!parser.getNamespace().isEmpty()){ content.append(parser.getNamespace()+":"); } content.append(parser.getName()); content.append(">"); } break; case XmlPullParser.START_TAG: content.append("<"); if(!parser.getNamespace().isEmpty()){ content.append(parser.getNamespace()+":"); } content.append(parser.getName()); for(int i=0;i<parser.getAttributeCount();++i){ content.append(" "); if(!parser.getAttributeNamespace(i).isEmpty()){ content.append(parser.getAttributeNamespace(i)+":"); } content.append(parser.getAttributeName(i)); content.append("="+parser.getAttributeValue(i)); } content.append(" >"); break; case XmlPullParser.TEXT: content.append(parser.getText()); break; } parser.next(); } } }
[ "yurifariasg@gmail.com" ]
yurifariasg@gmail.com
c5ddfafb42e010308803ceeacfad0c6a9c05ee94
e3758c7b1481da8e39ac4aab01f45639e15a5dc7
/app/src/main/java/com/moreclub/moreapp/main/ui/adapter/SignInterLiveAdapter.java
77479f9225b62c4048033f870caf3f36ce17d717
[]
no_license
leigong2/more
c8e55112aed36164f5190187e615a9dbbf07e96b
1163a55906f738e0a9fc4aa6805508af50ebb5d0
refs/heads/master
2020-04-10T13:13:20.048111
2018-12-09T14:37:18
2018-12-09T14:40:47
161,044,367
0
0
null
null
null
null
UTF-8
Java
false
false
10,018
java
package com.moreclub.moreapp.main.ui.adapter; import android.content.Context; import android.content.Intent; import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityOptionsCompat; import android.view.View; import com.bumptech.glide.Glide; import com.moreclub.common.adapter.RecyclerAdapter; import com.moreclub.common.adapter.RecyclerViewHolder; import com.moreclub.common.util.TimeUtils; import com.moreclub.moreapp.R; import com.moreclub.moreapp.main.model.MerchantsSignInters; import com.moreclub.moreapp.main.ui.activity.MySignInterListActivity; import com.moreclub.moreapp.main.ui.activity.SignInterActivity; import com.moreclub.moreapp.main.ui.activity.SignInterDetailActivity; import com.moreclub.moreapp.main.ui.activity.SignInterTotalActivity; import com.moreclub.moreapp.ucenter.ui.activity.UseLoginActivity; import com.moreclub.moreapp.ucenter.ui.activity.UserDetailV2Activity; import com.moreclub.moreapp.util.AppUtils; import com.moreclub.moreapp.util.MoreUser; import java.text.SimpleDateFormat; import java.util.List; import de.hdodenhof.circleimageview.CircleImageView; import static com.moreclub.moreapp.main.constant.Constants.MYSIGNINTERLISTACTIVITY; import static com.moreclub.moreapp.main.constant.Constants.SIGNINTERACTIVITY; import static com.moreclub.moreapp.main.constant.Constants.SIGNINTERTOTALACTIVITY; /** * Created by Administrator on 2017-06-21. */ public class SignInterLiveAdapter extends RecyclerAdapter<MerchantsSignInters> { private String mid; private int mySid = -1; // 436512 private int[] resTypeSelectorIds = {R.drawable.pinzuo_pgz, R.drawable.pinzuo_llt, R.drawable.pinzuo_wyx , R.drawable.pinzuo_qhd, R.drawable.pinzuo_bgm, R.drawable.pinzuo_bsh}; private int[] resTypeIds = {R.drawable.pinzuo_pgz_grey, R.drawable.pinzuo_llt_grey, R.drawable.pinzuo_wyx_grey , R.drawable.pinzuo_qhd_grey, R.drawable.pinzuo_bgm_grey, R.drawable.pinzuo_bsh_grey}; private int[] resIds = {R.drawable.buyuadrink_white, R.drawable.cocktail_white, R.drawable.beerbrew_white , R.drawable.wine_white, R.drawable.whiskey_white, R.drawable.importbeer_white, R.drawable.champagne_white, R.drawable.brandy_white, R.drawable.saki_white}; private String[] str = {"", "鸡尾酒", "精酿啤酒", "威士忌", "鸡尾酒", "进口啤酒", "香槟", "白兰地", "清酒"}; private int[] drawables = {R.drawable.interaction_sit, R.drawable.interaction_talk, R.drawable.interaction_play, R.drawable.interaction_qa, R.drawable.interaction_help, R.drawable.interaction_dont_talk}; public SignInterLiveAdapter(Context context, int layoutId, List<MerchantsSignInters> datas, String mid) { super(context, layoutId, datas); this.mid = mid; } @Override public void convert(RecyclerViewHolder holder, final MerchantsSignInters merchantsSignInters) { if (getPosition(holder) == 1) { for (int i = mDatas.size() - 1; i >= 0; i--) { if (mDatas.get(i).getUid().equals(MoreUser.getInstance().getUid()) && mDatas.get(i).getExprise() == 2) { mySid = mDatas.get(i).getSid(); } } } View view_weight = holder.getView(R.id.view_weight); int exprise = merchantsSignInters.getExprise(); switch (exprise) { case 1: //已结束 case 3: //过期 switch (merchantsSignInters.getType()) { case 5: holder.setImageResource(R.id.iv_type, resTypeIds[0]); break; case 3: holder.setImageResource(R.id.iv_type, resTypeIds[1]); break; case 6: holder.setImageResource(R.id.iv_type, resTypeIds[2]); break; case 4: holder.setImageResource(R.id.iv_type, resTypeIds[3]); break; case 1: holder.setImageResource(R.id.iv_type, resTypeIds[4]); break; case 2: holder.setImageResource(R.id.iv_type, resTypeIds[5]); break; } view_weight.setBackgroundResource(R.drawable.sign_detail_content); break; case 2: //在线 switch (merchantsSignInters.getType()) { case 5: holder.setImageResource(R.id.iv_type, resTypeSelectorIds[0]); view_weight.setBackgroundResource(drawables[0]); break; case 3: holder.setImageResource(R.id.iv_type, resTypeSelectorIds[1]); view_weight.setBackgroundResource(drawables[1]); break; case 6: holder.setImageResource(R.id.iv_type, resTypeSelectorIds[2]); view_weight.setBackgroundResource(drawables[2]); break; case 4: holder.setImageResource(R.id.iv_type, resTypeSelectorIds[3]); view_weight.setBackgroundResource(drawables[3]); break; case 1: holder.setImageResource(R.id.iv_type, resTypeSelectorIds[4]); view_weight.setBackgroundResource(drawables[4]); break; case 2: holder.setImageResource(R.id.iv_type, resTypeSelectorIds[5]); view_weight.setBackgroundResource(drawables[5]); break; } break; } Glide.with(mContext) .load(merchantsSignInters.getUserThumb()) .placeholder(R.drawable.profilephoto_small) .dontAnimate() .into((CircleImageView) holder.getView(R.id.civ_user_thumb)); holder.setOnClickListener(R.id.civ_user_thumb, new View.OnClickListener() { @Override public void onClick(View v) { ActivityOptionsCompat compat_merchant = ActivityOptionsCompat.makeCustomAnimation( mContext, R.anim.slide_in_from_right, R.anim.slide_out_to_left); Intent intent_merchant = new Intent(mContext, UserDetailV2Activity.class); intent_merchant.putExtra("toUid", "" + merchantsSignInters.getUid()); ActivityCompat.startActivity(mContext, intent_merchant, compat_merchant.toBundle()); } }); holder.setText(R.id.tv_user_name, merchantsSignInters.getNickName()); holder.setText(R.id.age, merchantsSignInters.getAge() + ""); if (merchantsSignInters.getGender() != null && merchantsSignInters.getGender().equals("0")) { holder.setImageResource(R.id.iv_gender, R.drawable.femenine); } else { holder.setImageResource(R.id.iv_gender, R.drawable.masculine); } holder.setText(R.id.tv_content, merchantsSignInters.getContent()); if (merchantsSignInters.getGift() == 0) { holder.getView(R.id.drinks).setVisibility(View.GONE); holder.getView(R.id.tv_drinks).setVisibility(View.GONE); } else { holder.setImageResource(R.id.drinks, resIds[merchantsSignInters.getGift() - 1]); holder.setText(R.id.tv_drinks, "请你喝一杯" + str[merchantsSignInters.getGift() - 1]); } String time = getTime(merchantsSignInters.getTimestamp()); holder.setText(R.id.time, time); holder.setOnClickListener(R.id.rl_root, new View.OnClickListener() { @Override public void onClick(View v) { //Todo 进入签到互动详情 if (MoreUser.getInstance().getUid() != null && MoreUser.getInstance().getUid().equals(0L)) { AppUtils.pushLeftActivity(mContext, UseLoginActivity.class); return; } ActivityOptionsCompat compat = ActivityOptionsCompat.makeCustomAnimation( mContext, R.anim.slide_in_from_right, R.anim.slide_out_to_left); Intent intent = new Intent(mContext, SignInterDetailActivity.class); intent.putExtra("sid", merchantsSignInters.getSid()); if (mContext instanceof SignInterActivity) { intent.putExtra("tag", SIGNINTERACTIVITY); } else if (mContext instanceof SignInterTotalActivity) { intent.putExtra("tag", SIGNINTERTOTALACTIVITY); } else if (mContext instanceof MySignInterListActivity) { intent.putExtra("tag", MYSIGNINTERLISTACTIVITY); } intent.putExtra("mySid", mySid); ActivityCompat.startActivity(mContext, intent, compat.toBundle()); } }); } private String getTime(long timestamp) { long now = Long.valueOf(TimeUtils.getTimestampSecond()); SimpleDateFormat sdr = new SimpleDateFormat("MM月dd日"); java.sql.Date date = new java.sql.Date(timestamp * 1000); String format = sdr.format(date); long time = now - timestamp; if (time < (10 * 60)) { return "刚刚"; } else if (time > (10 * 60) && time < (60 * 60)) { return (time / (60)) + "分钟"; } else if (time > (60 * 60) && time < (24 * 60 * 60)) { return (time / (60 * 60)) + "小时"; } else if (time > (24 * 60 * 60) && time < (3 * 24 * 60 * 60)) { return (time / (24 * 60 * 60)) + "天前"; } else { return format; } } }
[ "mwangzhilong@163.com" ]
mwangzhilong@163.com
187fe00b00fdd605f52de522aa94886a74de1cb3
511bfba8fbbbd8b1bb35d6f0144639c2f54ab7ed
/TTMS/src/com/ttms/view/MainView.java
a47a347342976dea78c016efbc7d7681568de185
[]
no_license
Hss533/TTMS
d241cf83c5db24202180c19841f4993809a19d39
c8a8ee3cf28f2f0cb624eefbdc7a3e54b83ac5d5
refs/heads/master
2021-04-12T04:42:07.908883
2018-04-22T03:32:40
2018-04-22T03:32:40
125,829,055
11
2
null
2018-04-21T17:49:33
2018-03-19T08:56:40
Java
WINDOWS-1252
Java
false
false
5,436
java
package com.ttms.view; import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Image; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import com.ttms.test.MovieView; import javax.swing.GroupLayout; import javax.swing.ImageIcon; import javax.swing.GroupLayout.Alignment; import java.awt.Color; import javax.swing.JButton; import javax.swing.LayoutStyle.ComponentPlacement; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.Font; public class MainView extends JFrame { private JPanel contentPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MainView frame = new MainView(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public MainView() { setResizable(false); setTitle("\u5F52\u674E\u4EAE\u7684\u7238\u7238\u4EEC\u7968\u52A1\u7BA1\u7406\u7CFB\u7EDF"); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setBounds(400, 100, 1126, 699); contentPane = new JPanel(); contentPane.setBackground(new Color(255, 228, 225)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); JPanel panel1 = new JPanel(){ protected void paintComponent(Graphics g) { ImageIcon icon = new ImageIcon("src/icon/buy.png"); Image img = icon.getImage(); g.drawImage(img, 0, 0, icon.getIconWidth(), icon.getIconHeight(), icon.getImageObserver()); this.setSize(icon.getIconWidth(), icon.getIconHeight()); } }; panel1.setBackground(new Color(255, 228, 225)); JButton btnNewButton = new JButton("\u8D2D\u7968"); btnNewButton.setFont(new Font("ËÎÌå", Font.PLAIN, 24)); btnNewButton.setBackground(new Color(255, 228, 225)); JPanel panel = new JPanel() { protected void paintComponent(Graphics g) { ImageIcon icon = new ImageIcon("src/icon/managers.png"); Image img = icon.getImage(); g.drawImage(img, 0, 0, icon.getIconWidth(), icon.getIconHeight(), icon.getImageObserver()); this.setSize(icon.getIconWidth(), icon.getIconHeight()); } }; panel.setBackground(new Color(255, 228, 225)); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup( gl_panel.createParallelGroup(Alignment.TRAILING) .addGap(0, 72, Short.MAX_VALUE) .addGap(0, 82, Short.MAX_VALUE) ); gl_panel.setVerticalGroup( gl_panel.createParallelGroup(Alignment.TRAILING) .addGap(0, 92, Short.MAX_VALUE) .addGap(0, 92, Short.MAX_VALUE) ); panel.setLayout(gl_panel); JButton button = new JButton("\u7BA1\u7406"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new ManageChoose().setVisible(true); } }); button.setFont(new Font("ËÎÌå", Font.PLAIN, 24)); button.setBackground(new Color(255, 228, 225)); GroupLayout gl_contentPane = new GroupLayout(contentPane); gl_contentPane.setHorizontalGroup( gl_contentPane.createParallelGroup(Alignment.LEADING) .addGroup(gl_contentPane.createSequentialGroup() .addGap(200) .addComponent(panel1, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 92, GroupLayout.PREFERRED_SIZE) .addGap(274) .addComponent(panel, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(button, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE) .addContainerGap(294, Short.MAX_VALUE)) ); gl_contentPane.setVerticalGroup( gl_contentPane.createParallelGroup(Alignment.TRAILING) .addGroup(gl_contentPane.createSequentialGroup() .addContainerGap(474, Short.MAX_VALUE) .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) .addComponent(panel, GroupLayout.PREFERRED_SIZE, 92, GroupLayout.PREFERRED_SIZE) .addComponent(panel1, GroupLayout.PREFERRED_SIZE, 92, GroupLayout.PREFERRED_SIZE)) .addGap(88)) .addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup() .addGap(484) .addComponent(button, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE) .addContainerGap(133, Short.MAX_VALUE)) .addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup() .addGap(488) .addComponent(btnNewButton) .addContainerGap(129, Short.MAX_VALUE)) ); GroupLayout gl_panel1 = new GroupLayout(panel1); gl_panel1.setHorizontalGroup( gl_panel1.createParallelGroup(Alignment.TRAILING) .addGap(0, 277, Short.MAX_VALUE) ); gl_panel1.setVerticalGroup( gl_panel1.createParallelGroup(Alignment.TRAILING) .addGap(0, 129, Short.MAX_VALUE) ); panel1.setLayout(gl_panel1); contentPane.setLayout(gl_contentPane); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { buyfilmticket(e); } }); } private void buyfilmticket(ActionEvent e) { new MovieView().setVisible(true); } }
[ "1097260937@qq.com" ]
1097260937@qq.com
c24de3205e692cd804cd89083093797db5c84e74
0b096090957a9ea957a283c3e6bb0da22de8c627
/src/main/java/com/mycompany/myapp/config/DatabaseConfiguration.java
79bda1b3a78a19d467144921aa30c52935ed9803
[]
no_license
asjrosabal/gradleJH
d554fe653a8b236a14b58de94f022ec3702d132d
06b3ab27e5c29dc98cea4595a8d364f475653962
refs/heads/master
2023-08-14T04:43:32.726769
2021-10-08T13:23:41
2021-10-08T13:23:41
414,981,085
0
0
null
null
null
null
UTF-8
Java
false
false
6,699
java
package com.mycompany.myapp.config; import io.r2dbc.spi.ConnectionFactory; import java.sql.SQLException; import java.time.Duration; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.BitSet; import java.util.Collections; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.springframework.core.convert.converter.Converter; import org.springframework.core.env.Environment; import org.springframework.data.convert.CustomConversions; import org.springframework.data.convert.ReadingConverter; import org.springframework.data.convert.WritingConverter; import org.springframework.data.elasticsearch.repository.config.EnableReactiveElasticsearchRepositories; import org.springframework.data.r2dbc.convert.MappingR2dbcConverter; import org.springframework.data.r2dbc.convert.R2dbcCustomConversions; import org.springframework.data.r2dbc.core.ReactiveDataAccessStrategy; import org.springframework.data.r2dbc.dialect.DialectResolver; import org.springframework.data.r2dbc.dialect.R2dbcDialect; import org.springframework.data.r2dbc.query.UpdateMapper; import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories; import org.springframework.data.relational.core.dialect.RenderContextFactory; import org.springframework.data.relational.core.sql.render.SqlRenderer; import org.springframework.transaction.annotation.EnableTransactionManagement; import tech.jhipster.config.JHipsterConstants; import tech.jhipster.config.h2.H2ConfigurationHelper; @Configuration @EnableR2dbcRepositories("com.mycompany.myapp.repository") @EnableTransactionManagement @EnableReactiveElasticsearchRepositories("com.mycompany.myapp.repository.search") public class DatabaseConfiguration { private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class); private final Environment env; public DatabaseConfiguration(Environment env) { this.env = env; } /** * Open the TCP port for the H2 database, so it is available remotely. * * @return the H2 database TCP server. * @throws SQLException if the server failed to start. */ @Bean(initMethod = "start", destroyMethod = "stop") @Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) public Object h2TCPServer() throws SQLException { String port = getValidPortForH2(); log.debug("H2 database is available on port {}", port); return H2ConfigurationHelper.createServer(port); } private String getValidPortForH2() { int port = Integer.parseInt(env.getProperty("server.port")); if (port < 10000) { port = 10000 + port; } else { if (port < 63536) { port = port + 2000; } else { port = port - 2000; } } return String.valueOf(port); } // LocalDateTime seems to be the only type that is supported across all drivers atm // See https://github.com/r2dbc/r2dbc-h2/pull/139 https://github.com/mirromutth/r2dbc-mysql/issues/105 @Bean public R2dbcCustomConversions r2dbcCustomConversions(R2dbcDialect dialect) { List<Object> converters = new ArrayList<>(dialect.getConverters()); converters.add(InstantWriteConverter.INSTANCE); converters.add(InstantReadConverter.INSTANCE); converters.add(BitSetReadConverter.INSTANCE); converters.add(DurationWriteConverter.INSTANCE); converters.add(DurationReadConverter.INSTANCE); converters.add(ZonedDateTimeReadConverter.INSTANCE); converters.add(ZonedDateTimeWriteConverter.INSTANCE); converters.addAll(R2dbcCustomConversions.STORE_CONVERTERS); return new R2dbcCustomConversions( CustomConversions.StoreConversions.of(dialect.getSimpleTypeHolder(), converters), Collections.emptyList() ); } @Bean public R2dbcDialect dialect(ConnectionFactory connectionFactory) { return DialectResolver.getDialect(connectionFactory); } @Bean public UpdateMapper updateMapper(R2dbcDialect dialect, MappingR2dbcConverter mappingR2dbcConverter) { return new UpdateMapper(dialect, mappingR2dbcConverter); } @Bean public SqlRenderer sqlRenderer(R2dbcDialect dialect) { RenderContextFactory factory = new RenderContextFactory(dialect); return SqlRenderer.create(factory.createRenderContext()); } @WritingConverter public enum InstantWriteConverter implements Converter<Instant, LocalDateTime> { INSTANCE; public LocalDateTime convert(Instant source) { return LocalDateTime.ofInstant(source, ZoneOffset.UTC); } } @ReadingConverter public enum InstantReadConverter implements Converter<LocalDateTime, Instant> { INSTANCE; @Override public Instant convert(LocalDateTime localDateTime) { return localDateTime.toInstant(ZoneOffset.UTC); } } @ReadingConverter public enum BitSetReadConverter implements Converter<BitSet, Boolean> { INSTANCE; @Override public Boolean convert(BitSet bitSet) { return bitSet.get(0); } } @ReadingConverter public enum ZonedDateTimeReadConverter implements Converter<LocalDateTime, ZonedDateTime> { INSTANCE; @Override public ZonedDateTime convert(LocalDateTime localDateTime) { // Be aware - we are using the UTC timezone return ZonedDateTime.of(localDateTime, ZoneOffset.UTC); } } @WritingConverter public enum ZonedDateTimeWriteConverter implements Converter<ZonedDateTime, LocalDateTime> { INSTANCE; @Override public LocalDateTime convert(ZonedDateTime zonedDateTime) { return zonedDateTime.toLocalDateTime(); } } @WritingConverter public enum DurationWriteConverter implements Converter<Duration, Long> { INSTANCE; @Override public Long convert(Duration source) { return source != null ? source.toMillis() : null; } } @ReadingConverter public enum DurationReadConverter implements Converter<Long, Duration> { INSTANCE; @Override public Duration convert(Long source) { return source != null ? Duration.ofMillis(source) : null; } } }
[ "asjrosabal@gmail.com" ]
asjrosabal@gmail.com