id
stringlengths 36
36
| meta
stringlengths 429
697
| url
stringlengths 27
109
| tokens
int64 137
584
| domain_prefix
stringlengths 16
106
| score
float64 0.16
0.3
| code_content
stringlengths 960
1.25k
|
|---|---|---|---|---|---|---|
00e0b29e-5800-4ba5-a695-baadf55e8fb1
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-11-03 06:09:05", "repo_name": "tanjun54/storage-box-backend", "sub_path": "/storage-box-backend/src/main/java/com/neusoft/project/storage/user/controller/UserController.java", "file_name": "UserController.java", "file_ext": "java", "file_size_in_byte": 1227, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "b739fedf3b89f217da1c1d8e3a38505faf64c9dc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/tanjun54/storage-box-backend
| 237
|
FILENAME: UserController.java
| 0.26588
|
package com.neusoft.project.storage.user.controller;
import com.neusoft.framework.web.controller.BaseController;
import com.neusoft.framework.web.domain.AjaxResult;
import com.neusoft.framework.web.page.TableDataInfo;
import com.neusoft.project.storage.user.domain.User;
import com.neusoft.project.storage.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/backend/user")
public class UserController extends BaseController {
@Autowired
private IUserService userService;
@GetMapping("/list")
public TableDataInfo list(){
startPage();
// 调用service
List<User> list = userService.queryList();
return getDataTable(list);
}
//新增用户
@PostMapping("/create")
public AjaxResult add(@RequestBody User userName){
logger.info("user:{}", userName);
userService.incon(userName);
return toAjax(1);
}
//删除用户
@DeleteMapping("delete/{userId}")
public AjaxResult delete(@PathVariable Long userId){
userService.delete(userId);
return toAjax(userId);
}
}
|
8062afaa-cc58-46a7-9975-42230df29f52
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-22 04:11:09", "repo_name": "jameshardenfan5/oo", "sub_path": "/src/hw12/fs/FSElement.java", "file_name": "FSElement.java", "file_ext": "java", "file_size_in_byte": 1034, "line_count": 59, "lang": "en", "doc_type": "code", "blob_id": "a2b239c69053ec25c1eda695f1616abcf093ed6b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/jameshardenfan5/oo
| 204
|
FILENAME: FSElement.java
| 0.275909
|
package hw12.fs;
import java.time.LocalDateTime;
public abstract class FSElement{
protected FSElement parent;
protected String name;
protected int size;
protected LocalDateTime creationTime;
public FSElement(FSElement parent,String name,int size,LocalDateTime creationTime){
this.parent=parent;
this.name=name;
this.size=size;
this.creationTime=creationTime;
}
public FSElement getParent(){
return this.parent;
}
public void setName(String name){
this.name = name;
}
public String getName(){
return name;
}
public void setSize(int size){
this.size = size;
}
public int getSize(){
return this.size;
}
public void setCreationTime(LocalDateTime creationTime){
this.creationTime = creationTime;
}
public LocalDateTime getCreationTime(){
return this.creationTime;
}
public abstract boolean isDirectory();
public abstract boolean isFile();
}
|
0be7517a-400b-4660-b1c6-a48577231300
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-08-26 23:37:24", "repo_name": "milo2005/A2B_BroadcastReceiver", "sub_path": "/app/src/main/java/creatic/movil/broadcastreceiver/AlarmaActivity.java", "file_name": "AlarmaActivity.java", "file_ext": "java", "file_size_in_byte": 1058, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "cd8ee715377789b4a992d4e637836985cedc0e02", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/milo2005/A2B_BroadcastReceiver
| 188
|
FILENAME: AlarmaActivity.java
| 0.17441
|
package creatic.movil.broadcastreceiver;
import android.app.AlarmManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
public class AlarmaActivity extends AppCompatActivity implements View.OnClickListener {
Button start, stop;
AlarmManager alarmManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alarma);
start = (Button) findViewById(R.id.btn_start);
stop = (Button) findViewById(R.id.btn_stop);
start.setOnClickListener(this);
stop.setOnClickListener(this);
alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
}
@Override
public void onClick(View view) {
switch(view.getId()){
case R.id.btn_start:
break;
case R.id.btn_stop:
break;
}
}
}
|
56926ed1-ec89-466b-a283-6bc6641536c0
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-22 01:11:06", "repo_name": "ZhaoMengYang1/lysoft", "sub_path": "/lysoft-bas/src/test/java/com/IO/FileTest.java", "file_name": "FileTest.java", "file_ext": "java", "file_size_in_byte": 1330, "line_count": 41, "lang": "zh", "doc_type": "code", "blob_id": "897ef4515720e8035662f12770810d345720e7ac", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/ZhaoMengYang1/lysoft
| 353
|
FILENAME: FileTest.java
| 0.255344
|
package com.IO;
import com.arcsoft.face.toolkit.ImageInfo;
import com.lysoftbas.util.Base64.FileBase64;
import org.junit.jupiter.api.Test;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import static com.arcsoft.face.toolkit.ImageFactory.getRGBData;
/**
* lysoft
* Creat by zmy on 2021-05-13 11:26
*/
public class FileTest {
/**
* 后来在网上查找ImageIO用法知道,它可读取的图片类型是有限制的,可以读取图片的格式为:[BMP, bmp, jpg, JPG, wbmp, jpeg, png, PNG, JPEG, WBMP, GIF, gif]
* 可是文件后缀是jpg格式,按道理说应该支持啊,后来将文件下载下来放到notepad++上查看才发现前缀是:RIFF? WEBPVP8 这说明该文件的实际格式是webp格式.文件后缀名有时候不是实际的文件格式.
* @throws IOException
*/
FileBase64 fileBase64 = new FileBase64();
@Test
public void FileTest() throws IOException {
File sourceimage = new File("F:\\home\\swkj\\faceResource\\lfw-bush\\lfw\\George_W_Bush\\George_W_Bush_0006.jpg");
ImageInfo imageInfo = getRGBData(sourceimage);
BufferedImage image = ImageIO.read(sourceimage);
System.out.println(imageInfo);
System.out.println(sourceimage.exists());
}
}
|
4a7c1a93-47b7-4cb5-ab88-d4dc99265a2c
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-20 08:05:58", "repo_name": "PacktPublishing/Diving-into-JSF-API-", "sub_path": "/Section 5/5.5/c3_s5_v5.5_1/src/main/java/beans/NameValidator.java", "file_name": "NameValidator.java", "file_ext": "java", "file_size_in_byte": 1050, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "8cd334a0e2a733e8d1a99ee2c094770ef9816e4e", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/PacktPublishing/Diving-into-JSF-API-
| 190
|
FILENAME: NameValidator.java
| 0.262842
|
package beans;
import java.util.regex.Pattern;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.FacesValidator;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
/**
*
* @author Anghel Leonard
*/
@FacesValidator
public class NameValidator implements Validator {
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
Pattern pattern = Pattern.compile("[^a-zA-Z0-9]");
boolean has = pattern.matcher(String.valueOf(value)).find();
if (has) {
FacesMessage message = new FacesMessage();
message.setDetail("The name should contain only alphanumeric characters!");
message.setSummary("Name not valid ...");
message.setSeverity(FacesMessage.SEVERITY_ERROR);
throw new ValidatorException(message);
}
}
}
|
4b88f793-196e-41f8-b08d-0b471e0c5d59
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-07-24T19:24:30", "repo_name": "timothydijamco/vexteamanalyzer", "sub_path": "/app/src/main/java/com/timothydijamco/vexteamanalyzer/TeamListAdapter.java", "file_name": "TeamListAdapter.java", "file_ext": "java", "file_size_in_byte": 1040, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "195618ee8f89d1038c2517212f0503e2cff6d7cd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/timothydijamco/vexteamanalyzer
| 226
|
FILENAME: TeamListAdapter.java
| 0.240775
|
package com.timothydijamco.vexteamanalyzer;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Timothy Dijamco on 8/3/2015.
*/
public class TeamListAdapter extends BaseAdapter {
private Context context;
public TeamListAdapter(Context context) {
this.context = context;
}
@Override
public int getCount() {
DatabaseHandler dbh = new DatabaseHandler(context);
return dbh.getTeamsCount();
}
@Override
public TeamHook getItem(int position) {
DatabaseHandler dbh = new DatabaseHandler(context);
List<TeamHook> teams = new ArrayList<TeamHook>();
teams = dbh.getListOfTeams();
return teams.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return null;
}
}
|
bfca5570-d7af-4945-b354-02b5c0ad56f8
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-04-29T13:00:46", "repo_name": "artdecocode/erte", "sub_path": "/CHANGELOG.md", "file_name": "CHANGELOG.md", "file_ext": "md", "file_size_in_byte": 1206, "line_count": 64, "lang": "en", "doc_type": "text", "blob_id": "d88f975aef9f97967398190f04270c8abb34f327", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/artdecocode/erte
| 432
|
FILENAME: CHANGELOG.md
| 0.277473
|
## 29 April 2019
### [1.2.0](https://github.com/artdecocode/erte/compare/v1.1.7...v1.2.0)
- [package] Vendor `diff` package's source module modified to remove callback and fix _GCC_ warning of unused property in self.
- [externs] Manually write externs to make `Color` a string.
## 24 January 2019
### 1.1.7
- [fix] Restore missing new line handling.
## 24 January 2019
### 1.1.6
- [fix] Make Google Closure Compiler friendly with quoted props.
## 16 January 2019
### 1.1.5
- [feature] Add more colors.
- [package] Add `module` field.
- [package] Build with [ÀLaMode](https://alamode.cc)
## 26 May 2018
### 1.1.4
- [build] source maps
- [test] test build, class context
- [package] artdeco eslint
## 15 May 2018
### 1.1.3
- [fix] correct order when replacing new lines.
### 1.1.2
- [feature] indicate new lines better
## 12 May 2018
### 1.1.1
- [doc] add badge
### 1.1.0
- [doc] move image to right, JSDoc
- [tests] remove bug from the `same` test where `missing` was tested as snapshot instead.
- [feature] export `c` and `b` functions for foreground and background colors.
## 10 May 2018
### 1.0.0
- Create `erte` with [`mnp`][https://mnpjs.org]
- [repository]: `src`, `test`
|
07d8798f-7961-45ca-9e30-01714836145b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-30 21:56:31", "repo_name": "mremondi/CurateRestaurant", "sub_path": "/app/src/main/java/curatetechnologies/com/curate/models/Curate/CurateMenuSection.java", "file_name": "CurateMenuSection.java", "file_ext": "java", "file_size_in_byte": 1066, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "66b5b3331b9bba81521aededc72a7f94bdcd8b42", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/mremondi/CurateRestaurant
| 244
|
FILENAME: CurateMenuSection.java
| 0.240775
|
package curatetechnologies.com.curate.models.Curate;
/**
* Created by mremondi on 11/22/17.
*/
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import curatetechnologies.com.curate.models.Curate.CurateMenuItem;
public class CurateMenuSection {
@SerializedName("MenuSection_Name")
@Expose
private String section;
@SerializedName("MenuSection_ID")
@Expose
private Integer menuSectionID;
@SerializedName("Items")
@Expose
private List<CurateMenuItem> items;
public String getSection() {
return section;
}
public void setSection(String section) {
this.section = section;
}
public Integer getMenuSectionID() {
return menuSectionID;
}
public void setMenuSectionID(Integer menuSectionID) {
this.menuSectionID = menuSectionID;
}
public List<CurateMenuItem> getItems() {
return items;
}
public void setItems(List<CurateMenuItem> items) {
this.items = items;
}
}
|
35694a9f-8e9e-47b1-b906-fbee632b6200
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-04 20:13:53", "repo_name": "PavelLunak/fmDriver", "sub_path": "/app/src/main/java/com/example/fmdriver/retrofit/responses/ResponseAllCheckedPositions.java", "file_name": "ResponseAllCheckedPositions.java", "file_ext": "java", "file_size_in_byte": 1113, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "ddf5c37545ad7e01a5e602f52c6974392fdba809", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/PavelLunak/fmDriver
| 211
|
FILENAME: ResponseAllCheckedPositions.java
| 0.218669
|
package com.example.fmdriver.retrofit.responses;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ResponseAllCheckedPositions {
@SerializedName("positions")
private List<ResponseCheckedPosition> positions;
@SerializedName("message")
private String message;
@SerializedName("count")
private int count;
public ResponseAllCheckedPositions() {}
public ResponseAllCheckedPositions(List<ResponseCheckedPosition> positions, String message, int count) {
this.positions = positions;
this.message = message;
this.count = count;
}
public List<ResponseCheckedPosition> getPositions() {
return positions;
}
public void setPositions(List<ResponseCheckedPosition> positions) {
this.positions = positions;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
}
|
42d02611-bd0c-4547-94bf-635dd5bfeebd
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-13 01:04:44", "repo_name": "zhenghuan12/nhis-web", "sub_path": "/src/main/java/com/zebone/nhis/webservice/vo/wechatvo/WebChatReqVO.java", "file_name": "WebChatReqVO.java", "file_ext": "java", "file_size_in_byte": 1236, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "fb6d9503b2ebf221db608759318ac05b4b4b86a4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/zhenghuan12/nhis-web
| 290
|
FILENAME: WebChatReqVO.java
| 0.243642
|
package com.zebone.nhis.webservice.vo.wechatvo;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "req")
@XmlAccessorType(XmlAccessType.FIELD)
public class WebChatReqVO {
/**
* 院区编码
*/
@XmlElement(name="hospId")
private String hospId;
/**
* 设备编码
*/
@XmlElement(name="deviceId")
private String deviceid;
/**
* 开始时间
*/
@XmlElement(name="startDate")
private String startDate;
/**
* 结束时间
*/
@XmlElement(name="endDate")
private String endDate;
public String getHospId() {
return hospId;
}
public void setHospId(String hospId) {
this.hospId = hospId;
}
public String getDeviceid() {
return deviceid;
}
public void setDeviceid(String deviceid) {
this.deviceid = deviceid;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
}
|
fc19715e-a11c-4e9d-951e-773affa5c02e
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-19 13:59:49", "repo_name": "ksb39/ionic-angular-spring-boot-practice", "sub_path": "/backend/spring-boot/src/main/java/com/example/demo/component/social/kakao/connect/KakaoConnectionFactory.java", "file_name": "KakaoConnectionFactory.java", "file_ext": "java", "file_size_in_byte": 1033, "line_count": 24, "lang": "en", "doc_type": "code", "blob_id": "6a0f14d857acb14dbd1c594751ec92fc7aebb3c9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/ksb39/ionic-angular-spring-boot-practice
| 208
|
FILENAME: KakaoConnectionFactory.java
| 0.243642
|
package com.example.demo.component.social.kakao.connect;
import com.example.demo.component.social.kakao.api.Kakao;
import org.springframework.social.connect.Connection;
import org.springframework.social.connect.support.OAuth2ConnectionFactory;
import org.springframework.social.oauth2.AccessGrant;
public class KakaoConnectionFactory extends OAuth2ConnectionFactory<Kakao> {
public KakaoConnectionFactory(String clientId) {
super("kakao", new KakaoServiceProvider(clientId), new KakaoAdapter());
}
@Override
public Connection<Kakao> createConnection(AccessGrant accessGrant) {
if(accessGrant.getRefreshToken() == null || accessGrant.getExpireTime() == null){
Connection<Kakao> connection = super.createConnection(accessGrant);
AccessGrant ag = new AccessGrant(accessGrant.getAccessToken(), accessGrant.getScope(), accessGrant.getRefreshToken(), connection.getApi().userOperation().accessTokenInfo().getExpiresInMillis());
return super.createConnection(ag);
}
return super.createConnection(accessGrant);
}
}
|
1f9b8cf4-1e08-498f-9635-ddd673d13f53
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-01-09T20:55:51", "repo_name": "dantesta/Which-Character-Are-You", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1211, "line_count": 28, "lang": "en", "doc_type": "text", "blob_id": "bbae9f962cba33433dac7b490240fd35c01ee6a6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/dantesta/Which-Character-Are-You
| 258
|
FILENAME: README.md
| 0.26588
|
# Which Character Are You?
Dan Testa, Mike Troutman, Adrian Sirko
1) Your overall application's concept
We want a make a personality quiz app that matches you up with a character from a movie, tv show, etc. Similar to buzzfeed quizzes, for example, "What Star Wars character are you?". We want to create logic that matches you with a character based on how you answer the questions. We want to add multiply quizzes to give users many options to cater to different interests. We want to add user authenitication so users can track their characters and personality quiz answers.
2) Your motivation for this project (what problem is this solving)
The idea for this project is designed around a fun concept so that users can connect to their favorite characters and have a good time doing it. Our idea in a lot of ways is similar to the friend finder homework, so we will be referencing that code as a boiler plate for our project in terms of the logic for our question algorithm.
3) Any technologies you may want to use (not 100% necessary as they come in as you develop, but knowing ahead of time could help us pinpoint any issues you may run into)
Node
Express
MySQL
Sequelize
Bootstrap Templates
|
fc766d4a-7586-4d59-a483-e92652e5819f
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-03-01 21:45:36", "repo_name": "CSAlexWhite/ocr-workshop", "sub_path": "/src/alexwhitecs/ocr/OCRShop.java", "file_name": "OCRShop.java", "file_ext": "java", "file_size_in_byte": 1037, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "e40bce9bf79a36b44e4e79085643893db99b7c93", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/CSAlexWhite/ocr-workshop
| 222
|
FILENAME: OCRShop.java
| 0.285372
|
package alexwhitecs.ocr;
import alexwhitecs.fx.GUIController;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.HBox;
import javafx.fxml.FXMLLoader;
public class OCRShop extends Application {
static HBox root;
static GUIController controller;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
try {
FXMLLoader fxmlloader = new FXMLLoader();
fxmlloader.setLocation(getClass().getResource("GUI.fxml"));
root = (HBox)FXMLLoader
.load(getClass().getResource("GUI.fxml"));
controller = (GUIController) fxmlloader.getController();
//controller.setStage(primaryStage);
Scene scene = new Scene(root);
scene.getStylesheets()
.add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {e.printStackTrace();}
}
}
|
03a45394-ca20-4b6d-a26d-29d51138f560
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-18 17:40:00", "repo_name": "tarantula251/class-organizer", "sub_path": "/app/src/main/java/model/data/Course.java", "file_name": "Course.java", "file_ext": "java", "file_size_in_byte": 991, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "3f97550ef9d9f8900c98cdea9e04836cfce100d6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/tarantula251/class-organizer
| 207
|
FILENAME: Course.java
| 0.255344
|
package model.data;
import java.io.Serializable;
import java.util.ArrayList;
public class Course implements Data, Serializable
{
private int id;
private String name;
private User supervisor;
private Field field;
private ArrayList<User> students = new ArrayList<User>();
public Course(int id)
{
this.id = id;
}
public Course(int id, String name, User supervisor, Field field)
{
this.id = id;
this.name = name;
this.supervisor = supervisor;
this.field = field;
}
@Override
public int getId()
{
return id;
}
public String getName()
{
return name;
}
public User getSupervisor()
{
return supervisor;
}
public Field getField()
{
return field;
}
public ArrayList<User> getStudents()
{
return students;
}
public boolean addStudent(User student)
{
return students.add(student);
}
}
|
7affae7d-289d-4b0f-9faf-b70e36227d4b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-17 17:39:37", "repo_name": "PauloOTS/Auction", "sub_path": "/AuctionClient/src/com/auction/client/AuctionClient.java", "file_name": "AuctionClient.java", "file_ext": "java", "file_size_in_byte": 974, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "6310d62716e718a4361e9586c83afb0880f84ee1", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/PauloOTS/Auction
| 192
|
FILENAME: AuctionClient.java
| 0.271252
|
/*
* 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 com.auction.client;
import com.auction.interfaces.AuctionServerInterface;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
/**
*
* @author Paulo
*/
public class AuctionClient {
/**
* Main function of the client
* @param args
* @throws java.rmi.RemoteException
*/
public static void main (String[] args) throws RemoteException, NotBoundException{
Registry registryRef = LocateRegistry.getRegistry();
AuctionServerInterface server = (AuctionServerInterface)
registryRef.lookup(AuctionServerInterface.REFERENCE_NAME);
AuctionClientServant c = new AuctionClientServant(server);
}
}
|
4baff9c1-cd27-49db-9b6e-4053d6ca404e
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-23 12:21:19", "repo_name": "unciaal/JM", "sub_path": "/src/main/java/com/uncia/springboot/SpringBootThymeLeaf/service/UserDetailsServiceImpl.java", "file_name": "UserDetailsServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1050, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "bf32dde541a8c23438e2c3624e756c01dd367ef3", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/unciaal/JM
| 162
|
FILENAME: UserDetailsServiceImpl.java
| 0.2227
|
package com.uncia.springboot.SpringBootThymeLeaf.service;
import com.uncia.springboot.SpringBootThymeLeaf.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@Service
public class UserDetailsServiceImpl implements UserDetailsService {
private UserService userService;
@Autowired
public UserDetailsServiceImpl(UserService userService) {
this.userService = userService;
}
@Override
public UserDetails loadUserByUsername(String login) throws UsernameNotFoundException {
User user = userService.getByLoginWihtRoles(login);
if (user != null) {
return user;
} else throw new IllegalArgumentException();
}
}
|
822263f1-4f4e-4d9c-bd02-00cf29179138
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-10-20T10:16:22", "repo_name": "Quantified-Student-Watch/mobile-flutter", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 987, "line_count": 22, "lang": "en", "doc_type": "text", "blob_id": "04a14387bfb923f2bb1fb1f400a3a613c60aa58c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Quantified-Student-Watch/mobile-flutter
| 205
|
FILENAME: README.md
| 0.264358
|
# Quantified Student Watch
In this project we will attempt to predict upcoming stress signals using machine learning and
smartwatches. These predictions can be displayed to user using a mobile application.
This repository contains the source code for the Android application.
## Compatibility
Delta watch requires connection with a specific smartwatch using a pre-defined protocol, this is
defined by the smartwatch itself. We have to implement this protocol for each smartwatch model.
Currently Delta watch supports the following smartwatches:
### E66
The [E66](https://www.smartwatchspecifications.com/devices/bakeey-e66-thermometer-smartband-specs-review/)
is an affordable smartwatch that includes a professional ECG sensor. This makes it perfect for the
delta watch project, as it can provide accurate heart rate data. It also includes a thermometer.
## License
This project is licensed under the terms of the Apache License, version 2.0. See [LICENSE](LICENSE) for details.
|
f2296493-3a0a-49e8-81ba-f3ff89235ba2
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-04 02:44:25", "repo_name": "pysmell/git-practice", "sub_path": "/nettystudy/src/main/java/com/meiya/netty权威指南学习/netty/package15/MarshallingEncoder.java", "file_name": "MarshallingEncoder.java", "file_ext": "java", "file_size_in_byte": 1222, "line_count": 66, "lang": "en", "doc_type": "code", "blob_id": "76bbdd0cf65f65b7089d0b70475a9a047c0fd5de", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/pysmell/git-practice
| 232
|
FILENAME: MarshallingEncoder.java
| 0.271252
|
package com.meiya.netty权威指南学习.netty.package15;
import io.netty.buffer.ByteBuf;
import org.jboss.marshalling.Marshaller;
import java.io.IOException;
/**
* 使用marshall对Object进行编码,并且写入bytebuf
*/
public class MarshallingEncoder {
private static final byte[] LENGTH_PLACEHOLDER = new byte[4];
private Marshaller marshaller;
public MarshallingEncoder() throws IOException {
marshaller = MarshallingCodecFactory.buildMarshalling();
}
public void encode(Object msg, ByteBuf out) throws IOException {
try {
//获取写入位置
int lengthPos = out.writerIndex();
//先写入4个bytes,用于记录Object对象编码后长度
out.writeBytes(LENGTH_PLACEHOLDER);
ChannelBufferByteOutput channelBufferByteOutput = new ChannelBufferByteOutput(out);
marshaller.start(channelBufferByteOutput);
marshaller.writeObject(msg);
//结束编码
marshaller.finish();
//设置对象长度
out.setInt(lengthPos, out.writerIndex() - 4);
} finally {
marshaller.close();
}
}
}
|
bfb4d3a4-e952-446a-a851-4b5260ccd01e
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-07 08:26:31", "repo_name": "QingSworder/ajex", "sub_path": "/ajax/src/main/java/com/kaishengit/util/HttpUtil.java", "file_name": "HttpUtil.java", "file_ext": "java", "file_size_in_byte": 1329, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "818c0859f41812da81864d38437fd4b272548c3b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/QingSworder/ajex
| 274
|
FILENAME: HttpUtil.java
| 0.262842
|
package com.kaishengit.util;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* Created by wtj008 on 2016/12/7.
*/
public class HttpUtil {
public static String sendRequestWithString(String url) throws IOException {
String result = null;
//1.创建一个可以发出Http请求的客户端
CloseableHttpClient httpClient = HttpClients.createDefault();
//2.创建一个get请求
HttpGet httpGet = new HttpGet(url);
//3.客户端执行get请求
HttpResponse httpResponse = httpClient.execute(httpGet);
//4.接收服务端执行结果状态码
int statusCode = httpResponse.getStatusLine().getStatusCode();
if(statusCode==200){
//5.获取响应输入流
InputStream inputStream = httpResponse.getEntity().getContent();
//6.将响应输入流转换为UTF-8格式
result = IOUtils.toString(inputStream,"UTF-8");
} else {
System.out.println("服务器异常"+statusCode);
}
return result;
}
}
|
84f330b8-6b0b-4ee5-a032-e7d3ac26cef0
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-01-20T00:18:32", "repo_name": "ataylor284/loadprop", "sub_path": "/src/main/java/ca/redtoad/loadprop/FieldPropertySetter.java", "file_name": "FieldPropertySetter.java", "file_ext": "java", "file_size_in_byte": 1071, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "e8a98f4b6988ec0a83e2bf30b452c57a919fe4f3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/ataylor284/loadprop
| 212
|
FILENAME: FieldPropertySetter.java
| 0.271252
|
package ca.redtoad.loadprop;
import java.lang.reflect.Field;
import java.util.Optional;
class FieldPropertySetter extends ReflectionPropertySetter implements PropertySetter {
private final Field field;
public FieldPropertySetter(Field field) {
this.field = field;
}
public String getName() {
return field.getName();
}
protected void setPropertyInternal(Object pojo, Object value) {
try {
field.set(pojo, value);
} catch (IllegalAccessException e) {
throw new PropertiesLoaderException("Property " + getName() + " can't be set.", e);
}
}
public Class<?> getTargetClass() {
Class<?> fieldClass = field.getType();
if (isOptional()) {
return getParameterizedType(field.getGenericType());
} else {
return fieldClass;
}
}
public boolean isOptional() {
return field.getType().equals(Optional.class);
}
public String toString() {
return "FieldPropertySetter(" + getName() + ")";
}
}
|
683b6440-e5bd-40bb-9c89-cafe4959d01e
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-10-23 20:37:02", "repo_name": "raiuli/per_fiware_handson", "sub_path": "/FiwareHandsOnUpdateSensorData/src/se/ltu/pmc/fiwareHandson/HandsOnUpdateSensorData.java", "file_name": "HandsOnUpdateSensorData.java", "file_ext": "java", "file_size_in_byte": 1023, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "60f3584350eb6d2bded8c1986f02065a216b5624", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/raiuli/per_fiware_handson
| 254
|
FILENAME: HandsOnUpdateSensorData.java
| 0.29584
|
package se.ltu.pmc.fiwareHandson;
import java.io.IOException;
import se.ltu.pmc.fiware.wrapper.FiwareWrapperUpdate;
import se.ltu.pmc.fiware.wrapper.HttpHandler;
public class HandsOnUpdateSensorData {
public static void main(String[] args) {
// The sensor values that will be updated
String entityName = "TempeSensor_S0";
String attribute = "NH3";
String value = "279.0";
// The url of IoTBroker
String updateUrl="http://ip_address/ngsi10/updateContext";
//Creating Update Request
FiwareWrapperUpdate fwq = new FiwareWrapperUpdate();
String request=fwq.createUpdaterequest(entityName, attribute,value);
System.out.println("------------->Request = "+request);
//Sending Update Request to IoT Broker and getting response back
HttpHandler httpHandler = new HttpHandler();
String response="";
try {
response=httpHandler.sendrequest(updateUrl,request);
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("<-------------Response = "+response);
}
}
|
55fceb03-7f00-495c-9359-f0a83e67c571
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-04 03:00:43", "repo_name": "yibulaxi/What", "sub_path": "/module_live/src/main/java/com/yyxnb/module_live/ui/provide/LiveHomeProvideFragment.java", "file_name": "LiveHomeProvideFragment.java", "file_ext": "java", "file_size_in_byte": 1064, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "362dac63f7d2e2b240251f4ae74d79902e6d1a15", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/yibulaxi/What
| 234
|
FILENAME: LiveHomeProvideFragment.java
| 0.199308
|
package com.yyxnb.module_live.ui.provide;
import android.os.Bundle;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.yyxnb.common_base.core.BaseFragment;
import com.yyxnb.lib_arch.annotations.BindRes;
import com.yyxnb.module_live.R;
import com.yyxnb.module_live.databinding.FragmentLiveHomeProvideBinding;
import static com.yyxnb.common_res.arouter.ARouterConstant.LIVE_HOME_PROVIDE_FRAGMENT;
/**
* ================================================
* 作 者:yyx
* 日 期:2020/11/30
* 描 述:对外提供的直播首页
* ================================================
*/
@BindRes(subPage = true)
@Route(path = LIVE_HOME_PROVIDE_FRAGMENT)
public class LiveHomeProvideFragment extends BaseFragment {
private FragmentLiveHomeProvideBinding binding;
@Override
public int initLayoutResId() {
return R.layout.fragment_live_home_provide;
}
@Override
public void initView(Bundle savedInstanceState) {
binding = getBinding();
binding.iRv.vStatus.showEmptyView();
}
}
|
543a3bdb-e192-4277-8cad-923164403285
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-21 11:11:46", "repo_name": "DamienVermant/nikoniko-spring", "sub_path": "/src/main/java/com/cgi/nikoniko/models/FunctionCGI.java", "file_name": "FunctionCGI.java", "file_ext": "java", "file_size_in_byte": 1205, "line_count": 72, "lang": "en", "doc_type": "code", "blob_id": "5e99882f610bbfc002e78582a1588d7c2b496cb0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/DamienVermant/nikoniko-spring
| 297
|
FILENAME: FunctionCGI.java
| 0.26971
|
package com.cgi.nikoniko.models;
import java.util.ArrayList;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import com.cgi.nikoniko.models.modelbase.DatabaseItem;
@Entity
@Table(name = "function_cgi")
public class FunctionCGI extends DatabaseItem{
@Transient
public static final String TABLE = "function_cgi";
@Transient
public static final String[] FIELDS = { "id", "name" };
@Column(name = "function_name", nullable = false)
private String name;
@Transient
@OneToMany
private ArrayList<RoleCGI> role;
/**
*
* @return name
*/
public String getName() {
return name;
}
/**
*
* @param name
*/
public void setName(String name) {
this.name = name;
}
/**
*
* @return role
*/
public ArrayList<RoleCGI> getRole() {
return role;
}
/**
*
* @param role
*/
public void setRole(ArrayList<RoleCGI> role) {
this.role = role;
}
public FunctionCGI(){
super(FunctionCGI.TABLE, FunctionCGI.FIELDS );
}
public FunctionCGI(String name){
this();
this.name = name;
}
}
|
188a0fd7-d2f4-4d82-9fb2-75cbb654791e
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-09 13:06:27", "repo_name": "Data-Editor/DataEditor-Gateway", "sub_path": "/src/main/java/com/niek125/gateway/config/JWTConsumerConfig.java", "file_name": "JWTConsumerConfig.java", "file_ext": "java", "file_size_in_byte": 1014, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "d652e290b0fb2c0975a8b4afa2668abdf605e2af", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Data-Editor/DataEditor-Gateway
| 209
|
FILENAME: JWTConsumerConfig.java
| 0.235108
|
package com.niek125.gateway.config;
import org.jose4j.jwa.AlgorithmConstraints;
import org.jose4j.jws.AlgorithmIdentifiers;
import org.jose4j.jwt.consumer.JwtConsumer;
import org.jose4j.jwt.consumer.JwtConsumerBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import static com.niek125.gateway.utils.PemUtils.readPublicKeyFromFile;
@Configuration
public class JWTConsumerConfig {
@Value("${dataEditor.publicKey}")
private String publicKey;
@Bean
public JwtConsumer jwtConsumer() {
return new JwtConsumerBuilder()
.setRequireJwtId()
.setExpectedIssuer("data-editor-token-service")
.setVerificationKey(readPublicKeyFromFile(publicKey, "RSA"))
.setJwsAlgorithmConstraints(AlgorithmConstraints.ConstraintType.WHITELIST, AlgorithmIdentifiers.RSA_USING_SHA256)
.build();
}
}
|
1a6a132f-6893-4947-985d-3a7a978b3353
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-02-27 19:35:47", "repo_name": "anthavio/anthavio-kitty", "sub_path": "/kitty-core/src/main/java/net/anthavio/kitty/KittyFactoryBean.java", "file_name": "KittyFactoryBean.java", "file_ext": "java", "file_size_in_byte": 1045, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "cf12f8c9e2e99d3ac809a612fb73e18106281376", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/anthavio/anthavio-kitty
| 223
|
FILENAME: KittyFactoryBean.java
| 0.259826
|
/**
*
*/
package net.anthavio.kitty;
import net.anthavio.kitty.scenario.ScenarioBinder;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
/**
* @author vanek
*
* I don't want public setters on Kitty so this FactoryBean will do the
* job in package visibility...
*/
public class KittyFactoryBean implements FactoryBean<Kitty>, InitializingBean {
private KittyOptions options;
private ScenarioBinder scenarioBinder;
private Kitty kitty;
@Override
public void afterPropertiesSet() throws Exception {
kitty = new Kitty(options, scenarioBinder);
}
@Override
public Kitty getObject() throws Exception {
return kitty;
}
@Override
public Class<?> getObjectType() {
return Kitty.class;
}
@Override
public boolean isSingleton() {
return true;
}
public void setOptions(KittyOptions options) {
this.options = options;
}
public void setScenarioBinder(ScenarioBinder scenarioBinder) {
this.scenarioBinder = scenarioBinder;
}
}
|
f72b3de0-9c4a-4e72-958f-1f5feeb242f8
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-27 16:07:07", "repo_name": "echen44/AnimePal", "sub_path": "/app/src/main/java/com/example/android/animepal/Host.java", "file_name": "Host.java", "file_ext": "java", "file_size_in_byte": 1040, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "9dd2c18fedba2ab9ca71eaa6af657b6d8c9ad459", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/echen44/AnimePal
| 220
|
FILENAME: Host.java
| 0.184768
|
package com.example.android.animepal;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Host {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("embed_prefix")
@Expose
private String embedPrefix;
@SerializedName("embed_suffix")
@Expose
private Object embedSuffix;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmbedPrefix() {
return embedPrefix;
}
public void setEmbedPrefix(String embedPrefix) {
this.embedPrefix = embedPrefix;
}
public Object getEmbedSuffix() {
return embedSuffix;
}
public void setEmbedSuffix(Object embedSuffix) {
this.embedSuffix = embedSuffix;
}
}
|
3d197f4f-a476-468a-ad6a-2903e7db7186
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-23 20:15:08", "repo_name": "Jabzzz/Labzzz", "sub_path": "/Game/core/src/com/jabzzz/labzzz/ai_skills/attack_skills/ShootingSkill.java", "file_name": "ShootingSkill.java", "file_ext": "java", "file_size_in_byte": 1068, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "fad227d93e5dcc8faa03bd6a96f4e15eb727eb66", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Jabzzz/Labzzz
| 230
|
FILENAME: ShootingSkill.java
| 0.284576
|
package com.jabzzz.labzzz.ai_skills.attack_skills;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector2;
import java.util.ArrayList;
/**
* Created by Stefan on 07.05.2017.
*/
public class ShootingSkill extends AAttackSkill {
ArrayList<Bullet> bullets = new ArrayList<Bullet>();
Vector2 characterPosition;
Vector2 velocityBullets;
public ShootingSkill(Vector2 characterPosition, Vector2 velocityBullets)
{
this.characterPosition = characterPosition;
this.velocityBullets = velocityBullets;
}
public void fire()
{
Bullet newBullet = new Bullet();
newBullet.fire(characterPosition, velocityBullets);
bullets.add(newBullet);
}
public void update()
{
for(Bullet bullet : bullets)
bullet.update();
}
public void render(SpriteBatch theBatch, OrthographicCamera theCam)
{
for(Bullet bullet : bullets)
bullet.render(theBatch, theCam);
}
}
|
111037c4-8a56-40eb-bffb-eec17a2a3a6c
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-03 10:57:10", "repo_name": "martin090/gelty", "sub_path": "/src/main/java/com/martinsanguin/gelty/services/UserCredentialsServiceImpl.java", "file_name": "UserCredentialsServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1036, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "6d5d24c9e26f4b222156b5085c0a3ae84fd93ea0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/martin090/gelty
| 170
|
FILENAME: UserCredentialsServiceImpl.java
| 0.225417
|
package com.martinsanguin.gelty.services;
import com.martinsanguin.gelty.domain.UserCredentials;
import com.martinsanguin.gelty.repositories.UserCredentialsRepository;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
public class UserCredentialsServiceImpl implements UserCredentialsService {
private final UserCredentialsRepository userCredentialsRepository;
public UserCredentialsServiceImpl(UserCredentialsRepository userCredentialsRepository) {
this.userCredentialsRepository = userCredentialsRepository;
}
@Override
public UserDetails getUserByUsername(String username) {
Optional<UserCredentials> user = this.userCredentialsRepository.findById(username);
if(user.isPresent())
return user.get();
else
throw new UsernameNotFoundException("Username not found.");
}
}
|
86a0e6c4-711a-4db0-8782-9981bab153a5
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-19 19:37:53", "repo_name": "zpborromeo/senior_design_project_2FA", "sub_path": "/two_fact_printer/src/main/java/main.java", "file_name": "main.java", "file_ext": "java", "file_size_in_byte": 1012, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "ead318dff52907a70c25c89a8de8acaab3342430", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/zpborromeo/senior_design_project_2FA
| 221
|
FILENAME: main.java
| 0.288569
|
import auth.Utils;
import java.util.Scanner;
public class main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
// Static secret key used for testing.
// QDWSM3OYBPGTEVSPB5FKVDM3CSNCWHVK
// Get secretKey from user. Exit if 'stop' is input.
System.out.println("Enter secret key, or 'stop' to quit.");
String secretKey = sc.nextLine();
if (secretKey.equalsIgnoreCase("stop")) {
return;
}
String lastCode = null;
while (true) {
// Generate code based on secret encryption key.
String code = Utils.getTOTPCode(secretKey);
// If code has updated, print new code.
if (!code.equals(lastCode)) {
System.out.println(code);
}
// Update code
lastCode = code;
try {
Thread.sleep(1000);
} catch (InterruptedException e) {break;}
}
}
}
|
a01f5269-01c8-415f-a646-20bc771c5e34
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-11 07:45:39", "repo_name": "xzllxz456/SecondPTJ", "sub_path": "/src/com/bc/controller/EduInfo.java", "file_name": "EduInfo.java", "file_ext": "java", "file_size_in_byte": 1114, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "8ff19e2e21543026f6e0e997f5eb44a4fce05fc0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/xzllxz456/SecondPTJ
| 209
|
FILENAME: EduInfo.java
| 0.280616
|
package com.bc.controller;
import java.io.IOException;
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 com.bc.command.EduCommandServlet;
import com.bc.command.EduCommandServletImpl;
import com.bc.command.ProCommandImpl;
@WebServlet("/education")
public class EduInfo extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String param = request.getParameter("param");
EduCommandServlet Csl = null;
if("edumain".equals(param)) {
Csl = new EduCommandServletImpl();
} else {
Csl = new ProCommandImpl();
}
String path = Csl.execute(request, response);
request.getRequestDispatcher(path).forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
|
e499c222-72c4-42ae-883d-56f74cd2b8c0
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-03-21 03:46:27", "repo_name": "nutzam/nutzmore", "sub_path": "/nutz-plugins-websocket/src/main/java/org/nutz/plugins/mvc/websocket/room/MemoryRoomProvider.java", "file_name": "MemoryRoomProvider.java", "file_ext": "java", "file_size_in_byte": 1217, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "cb943af9cb4f17748d7290f667f00bd07fd69734", "star_events_count": 368, "fork_events_count": 238, "src_encoding": "UTF-8"}
|
https://github.com/nutzam/nutzmore
| 266
|
FILENAME: MemoryRoomProvider.java
| 0.282196
|
package org.nutz.plugins.mvc.websocket.room;
import java.util.ArrayList;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;
import org.nutz.plugins.mvc.websocket.WsRoomProvider;
/**
* 单机版的WsRoom实现
*
* @author wendal
*
*/
public class MemoryRoomProvider implements WsRoomProvider {
protected ConcurrentHashMap<String, ConcurrentSkipListSet<String>> rooms = new ConcurrentHashMap<>();
public Set<String> wsids(String room) {
return getRoom(room);
}
public void join(String room, String wsid) {
getRoom(room).add(wsid);
}
public void left(String room, String wsid) {
getRoom(room).remove(wsid);
}
public Set<String> getRoom(String room) {
ConcurrentSkipListSet<String> _room = rooms.get(room);
if (_room == null) {
_room = new ConcurrentSkipListSet<String>();
ConcurrentSkipListSet<String> prev = rooms.putIfAbsent(room, _room);
if (prev != null)
_room = prev;
}
return _room;
}
public Iterable<String> getRoomNames() {
return new ArrayList<>(rooms.keySet());
}
}
|
2cdd5e20-39ee-41de-8298-1004dd329615
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-18 13:07:21", "repo_name": "HowieHai/Android_accountBook", "sub_path": "/app/src/main/java/com/example/shenhaichen/capstone_project_accountbook/database/DBOpenHelper.java", "file_name": "DBOpenHelper.java", "file_ext": "java", "file_size_in_byte": 998, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "23962170605feb65ec31175444d213bd60e02f99", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/HowieHai/Android_accountBook
| 225
|
FILENAME: DBOpenHelper.java
| 0.27048
|
package com.example.shenhaichen.capstone_project_accountbook.database;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by shenhaichen on 22/12/2017.
*/
public class DBOpenHelper extends SQLiteOpenHelper {
private static int VERSION = 1;
private static String DBNAME = "accountbook.db";
public DBOpenHelper(Context context) {
super(context, DBNAME, null, VERSION);
}
/**
* style中, 0是收入,1是支出
* @param db
*/
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table accountbook (id integer primary key AUTOINCREMENT, amount text,"
+ "category text,payment integer, comment text, year text,"
+ "month text, week text, day text, currency text, style Integer);");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
|
8ed06cae-5e51-44b6-b389-f6ed15d4e491
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-02-19 21:44:58", "repo_name": "Tolaniibikunle/HurtLocker", "sub_path": "/src/main/java/ibikunle/tolani/Main.java", "file_name": "Main.java", "file_ext": "java", "file_size_in_byte": 1055, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "cfd9c2804ce871f891bfa740e308a19e245a7e0e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Tolaniibikunle/HurtLocker
| 225
|
FILENAME: Main.java
| 0.27048
|
package ibikunle.tolani;
import org.apache.commons.io.IOUtils;
import java.util.ArrayList;
import java.util.HashMap;
public class Main {
public static void main(String[] args) throws Exception {
// String output = (new Main()).readRawDataToString();
// System.out.println(output);
JerkSonParser jerkSonParser = new JerkSonParser();
Data data = new Data();
Printer printer = new Printer();
ArrayList<GroceryItem> g = jerkSonParser.makeGroceryList(data.rawData);
//// for (GroceryItem g2 : g) {
//// System.out.println(g2.getName()); // always remember that when you want to iterate through a collection if there are objects stored
//// //always remember to get it via get.name get.id get whatever it is.
////
//// }
//// System.out.println(g.size());
//// System.out.println(JerkSonParser.errorCount); // when its static dont need an instance can call it directly from the class name
System.out.println(printer.printOutput());
}
}
|
8fb6757a-6430-4958-9857-462e37ffd3e6
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-02-06T18:56:47", "repo_name": "lyft/python-confidant-client", "sub_path": "/CHANGELOG.md", "file_name": "CHANGELOG.md", "file_ext": "md", "file_size_in_byte": 1205, "line_count": 52, "lang": "en", "doc_type": "text", "blob_id": "261741ca117bf396ab7d66fce91cf1b39f68cc7f", "star_events_count": 10, "fork_events_count": 17, "src_encoding": "UTF-8"}
|
https://github.com/lyft/python-confidant-client
| 318
|
FILENAME: CHANGELOG.md
| 0.242206
|
## 2.2.0
* remove upper bound for dependency of cryptography
## 2.1.0
* Added a new timeout option, for being able to configure request timeouts.
## 2.0.0
* Added support for certificate endpoints.
* Added support for getting and listing CAs from the CA endpoints.
* Updated the revert support to use the new revert endpoints in the backend. This support no longer requires fetching and passing in the full objects, but instead passes in the object ID, and the revision to revert to, making it possible to limit ACLs to the client to be able to revert without needing to access the decrypted secrets.
## 1.7.0
* Add a configuration option for being able to disable ssl cert validation.
## 1.6.0
* Require newer boto3 and remove pyopenssl workaround
* Only depend on pyopenssl, ndg-httpsclient, pyasn1 in python2.7
## 1.5.5
* add credential pair to credential id mapping
## 1.5.4
* export metadata in 'combined' output format
## 1.5.3
* update metadata response format handling
## 1.5.2
* fixup for release tag
## 1.5.1
* support custom environment variable prefixes
## 1.5.0
* add credential revert functionality
## 1.4.0
* python3 compat
* changed dependency of kmsauth to >=0.3.0
|
981de14c-4d61-4ee8-876f-ff2c736968ab
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-22 04:20:14", "repo_name": "KN193/GroupB_FinalProject", "sub_path": "/src/GroupB_FinalProject/src/main/java/uow/finalproject/webapp/entity/Persons.java", "file_name": "Persons.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 74, "lang": "en", "doc_type": "code", "blob_id": "eda4261b5d7dede87e598312617557177f63dd7c", "star_events_count": 1, "fork_events_count": 2, "src_encoding": "UTF-8"}
|
https://github.com/KN193/GroupB_FinalProject
| 290
|
FILENAME: Persons.java
| 0.261331
|
package uow.finalproject.webapp.entity;
import javax.persistence.Entity;
import javax.persistence.Id;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
@Entity(name="Persons")
@Indexed
public class Persons {
@Id
public int PersonID;
@Field
public String Lastname;
@Field
public String Firstname;
public String Address;
String City;
public Persons () {}
public Persons(int personID, String lastName, String firstName, String address, String city) {
super();
PersonID = personID;
Lastname = lastName;
Firstname = firstName;
Address = address;
City = city;
}
public int getPersonID() {
return PersonID;
}
public void setPersonID(int personID) {
PersonID = personID;
}
public String getLastName() {
return Lastname;
}
public void setLastName(String lastName) {
Lastname = lastName;
}
public String getFirstName() {
return Firstname;
}
public void setFirstName(String firstName) {
Firstname = firstName;
}
public String getAddress() {
return Address;
}
public void setAddress(String address) {
Address = address;
}
public String getCity() {
return City;
}
public void setCity(String city) {
City = city;
}
}
|
290c2e1e-3581-44c9-8d70-298526813557
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-31 12:33:57", "repo_name": "ZhangPeng123456aabb/Itheima_JavaWeb", "sub_path": "/ZhangPeng/src/main/java/com/baizhi/spring/entity/person.java", "file_name": "person.java", "file_ext": "java", "file_size_in_byte": 1004, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "e197bcaa0e8542f08db6ce466580c13a0201e875", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/ZhangPeng123456aabb/Itheima_JavaWeb
| 215
|
FILENAME: person.java
| 0.216012
|
package com.baizhi.spring.entity;
public class person {
private Integer id;
private String name;
private String password;
public person(Integer id, String name, String password) {
this.id = id;
this.name = name;
this.password = password;
}
public person(Integer id, String name) {
this.id = id;
this.name = name;
}
public person(String password) {
this.password = password;
}
public person(Integer id) {
this.id = id;
}
public person() {
}
public void setId(Integer id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "person{" +
"id=" + id +
", name='" + name + '\'' +
", password='" + password + '\'' +
'}';
}
}
|
df5335ae-ad1f-4f8b-ab82-d48aa0e1b260
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-16 09:17:05", "repo_name": "shenfl/web", "sub_path": "/springcloud/src/main/java/com/test/cloud/handler/MyHandlerAdapter.java", "file_name": "MyHandlerAdapter.java", "file_ext": "java", "file_size_in_byte": 1222, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "65ebaa7f2b5e931f9c0a81749f271085bde2c6fb", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/shenfl/web
| 225
|
FILENAME: MyHandlerAdapter.java
| 0.240775
|
package com.test.cloud.handler;
import org.springframework.stereotype.Component;
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
import org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* 默认增加返回值格式
* {
* "success": true/false,
* "code": 200,
* "message": "bingo"
* "data": {
* }
* }
* @author shenfl
*/
@Component
public class MyHandlerAdapter extends RequestMappingHandlerAdapter {
@Override
public void afterPropertiesSet() {
super.afterPropertiesSet();
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<>();
Objects.requireNonNull(getReturnValueHandlers()).forEach(h->{
if (h instanceof RequestResponseBodyMethodProcessor) {
handlers.add(new ResultHandlerMethodReturnValueHandler((RequestResponseBodyMethodProcessor) h));
} else {
handlers.add(h);
}
});
setReturnValueHandlers(handlers);
}
}
|
5ef2eb29-61ee-450b-996d-e24ea37232b5
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-14 16:49:32", "repo_name": "FlowingCode/CustomIDAddon", "sub_path": "/customid-addon/src/main/java/com/flowingcode/vaadin/addons/customid/client/DateFieldConnector.java", "file_name": "DateFieldConnector.java", "file_ext": "java", "file_size_in_byte": 1030, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "223e27c905440ab6e9e035b0d997d730d3b88f88", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/FlowingCode/CustomIDAddon
| 203
|
FILENAME: DateFieldConnector.java
| 0.268941
|
package com.flowingcode.vaadin.addons.customid.client;
import com.flowingcode.vaadin.addons.customid.DatefieldCustomIdExtension;
import com.vaadin.client.ComponentConnector;
import com.vaadin.client.ServerConnector;
import com.vaadin.client.extensions.AbstractExtensionConnector;
import com.vaadin.client.ui.VPopupCalendar;
import com.vaadin.shared.ui.Connect;
@Connect(DatefieldCustomIdExtension.class)
public class DateFieldConnector extends AbstractExtensionConnector {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void extend(ServerConnector target) {
// Get the extended widget
final VPopupCalendar pw =
(VPopupCalendar) ((ComponentConnector) target).getWidget();
DateFieldState state = getState();
if (state.textFieldId!=null)
pw.text.asWidget().getElement().setId(state.textFieldId);
}
@Override
public DateFieldState getState() {
return (DateFieldState) super.getState();
}
}
|
d85eb832-e190-4de0-bfe4-3887ceb7c56d
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-19 03:10:57", "repo_name": "sankes/WebsocketClient", "sub_path": "/src/com/shankes/websocketclient/control/chat/domain/ChatInfo.java", "file_name": "ChatInfo.java", "file_ext": "java", "file_size_in_byte": 1018, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "1acd4fd9ed2cfd72fdf4bcf399a3af6d70e30c1b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/sankes/WebsocketClient
| 227
|
FILENAME: ChatInfo.java
| 0.228156
|
package com.shankes.websocketclient.control.chat.domain;
public class ChatInfo {
private String senderId;// 发送人id
private String content;// 内容
private MessageType messageType;// 消息类型
private String time;// 消息发送时间
public ChatInfo() {
super();
}
public ChatInfo(String senderId, String content, MessageType messageType, String time) {
super();
this.senderId = senderId;
this.content = content;
this.messageType = messageType;
this.time = time;
}
public String getSenderId() {
return senderId;
}
public void setSenderId(String senderId) {
this.senderId = senderId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public MessageType getMessageType() {
return messageType;
}
public void setMessageType(MessageType messageType) {
this.messageType = messageType;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
}
|
6a815808-b9ed-4301-bb2a-bf6e3c806402
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-09-14 14:35:57", "repo_name": "hikoz/spring-comparing-template-engines", "sub_path": "/src/test/java/io/github/hikoz/benchmarks/spring/TemplateBenchmarksTest.java", "file_name": "TemplateBenchmarksTest.java", "file_ext": "java", "file_size_in_byte": 1053, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "68d674e4f8672870b588fc570d13e8927d8dff46", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/hikoz/spring-comparing-template-engines
| 225
|
FILENAME: TemplateBenchmarksTest.java
| 0.258326
|
package io.github.hikoz.benchmarks.spring;
import static org.assertj.core.api.Assertions.*;
import java.lang.reflect.Field;
import org.junit.Test;
import org.openjdk.jmh.annotations.Param;
import org.springframework.mock.web.MockHttpServletResponse;
public class TemplateBenchmarksTest {
@Test
public void allTemplates() throws Exception {
Field field = TemplateBenchmarks.class.getDeclaredField("engine");
TemplateBenchmarks target = new TemplateBenchmarks();
target.setup();
for (String engine : field.getAnnotation(Param.class).value()) {
target.engine = engine;
MockHttpServletResponse res = target.templateBench();
assertThat(res.getStatus()).isEqualTo(200);
assertThat(res.getHeader("Content-Type")).isEqualTo("text/html;charset=UTF-8");
String c = res.getContentAsString();
assertThat(c).contains("<h1>こんにちは");
assertThat(c).contains("<h3 class=\"panel-title\">"
+ "Shootout! Template engines on the JVM - Jeroen Reijn</h3>");
}
target.teardown();
}
}
|
b622d0b6-b93d-454d-9bd6-b29e65fdcb3b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-08-07 22:37:53", "repo_name": "kwanggithub/floodlight-floodlight", "sub_path": "/core/src/main/java/org/projectfloodlight/core/types/NodeInterfaceTuple.java", "file_name": "NodeInterfaceTuple.java", "file_ext": "java", "file_size_in_byte": 995, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "cb594a919d40c99df54b896cec61c617f6e502de", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/kwanggithub/floodlight-floodlight
| 222
|
FILENAME: NodeInterfaceTuple.java
| 0.23793
|
package org.projectfloodlight.core.types;
import org.openflow.util.HexString;
import org.projectfloodlight.db.data.annotation.BigDBProperty;
import org.projectfloodlight.topology.NodePortTuple;
/**
* Represents a Switch DPID along with it's port and interface.
* @author alexreimers
*
*/
public class NodeInterfaceTuple {
protected String nodeId; // switch DPID
protected PortInterfacePair intf;
public NodeInterfaceTuple(long nodeId, PortInterfacePair intf) {
this.nodeId = HexString.toHexString(nodeId);
this.intf = intf;
}
public NodeInterfaceTuple(NodePortTuple npt, String intfName) {
this.nodeId = HexString.toHexString(npt.getNodeId());
intf = new PortInterfacePair(npt.getPortId(), intfName);
}
@BigDBProperty("switch-dpid")
public String getNodeId() {
return nodeId;
}
@BigDBProperty("interface")
public PortInterfacePair getPortInterfacePair() {
return intf;
}
}
|
805cb187-08b5-46ac-b4b6-60460dc31152
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-23 08:27:36", "repo_name": "xuwulin/hnzhyw", "sub_path": "/src/com/swx/ibms/business/etl/utils/SynchroDataListener.java", "file_name": "SynchroDataListener.java", "file_ext": "java", "file_size_in_byte": 1133, "line_count": 41, "lang": "zh", "doc_type": "code", "blob_id": "2f2be74834ec16ac14f604ba322d97404be20359", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/xuwulin/hnzhyw
| 287
|
FILENAME: SynchroDataListener.java
| 0.290981
|
package com.swx.ibms.business.etl.utils;
import com.swx.ibms.business.etl.service.SynchroDataService;
import com.swx.ibms.common.utils.ApplicationContextUtils;
import com.swx.ibms.common.utils.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Calendar;
import java.util.Date;
/**
* 同步任务执行类
* @author 李治鑫
* @since 2017年8月24日 下午2:25:44
*/
public class SynchroDataListener {
private static Logger logger = LoggerFactory.getLogger(SyncPartyPageVisitJob.class);
/**
* 执行
*/
public void doTask(){
try {
logger.debug("{定时同步任务【synchroData】开始执行} =====>"+ DateUtil.dateToString(new Date(),DateUtil.FORMAT_ONE));
SynchroDataService syncService = (SynchroDataService) ApplicationContextUtils.getBean("synchroDataService");
syncService.startSynchro();
logger.debug("{定时同步任务【synchroData】执行完成} =====>"+ DateUtil.dateToString(new Date(),DateUtil.FORMAT_ONE));
} catch (Exception e) {
System.out.println("同步数据任务【synchroData】执行出错!");
e.printStackTrace();
}
}
}
|
20e4712e-60d9-4dc3-b985-6b9334d2a0ea
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-06-09T23:00:07", "repo_name": "mwhwang/alexa-skills-list", "sub_path": "/skills/B01GM48TTG/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1027, "line_count": 24, "lang": "en", "doc_type": "text", "blob_id": "6aa2548b2abf3b617d77e07ec407d10d1b8f9b0c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/mwhwang/alexa-skills-list
| 371
|
FILENAME: README.md
| 0.271252
|
# <img src="skill_icon" alt="PlantFacts icon" width="36"> [PlantFacts](http://alexa.amazon.com/#skills/amzn1.echo-sdk-ams.app.985da967-17e4-4026-b45c-7711e66b67be)
 0
To use the PlantFacts skill, try saying...
* *Alexa, ask plant facts to teach me something about plants.*
* *Alexa, ask plant facts to teach me about plants*
* *Alexa, ask plant facts to give me some info about plants*
This app is aimed at kids. It will repeat a random plant fact when asked.
***
### Skill Details
* **Invocation Name:** plant facts
* **Category:** null
* **ID:** amzn1.echo-sdk-ams.app.985da967-17e4-4026-b45c-7711e66b67be
* **ASIN:** B01GM48TTG
* **Author:** Erik Lane
* **Release Date:** June 9, 2016 @ 04:09:42
* **In-App Purchasing:** No
|
55e72f51-c11a-4d26-8f16-778b9a74f8aa
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-28 08:31:25", "repo_name": "silaguler/javaprojects", "sub_path": "/Project/src/Rocket.java", "file_name": "Rocket.java", "file_ext": "java", "file_size_in_byte": 985, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "0411c2bfb7b94a4cadb7b5e09d3c3319bc18e56f", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/silaguler/javaprojects
| 209
|
FILENAME: Rocket.java
| 0.247987
|
import java.util.Random;
public class Rocket implements SpaceShip {
protected int cost;
protected double weight;
protected double max_item_weight;
protected double item_weight_carried;
protected double chance_crash;
protected double chance_explode;
protected double ranGenerator(double prob_failing){
Random ran = new Random();
double r = ran.nextGaussian();
return r*0.3+prob_failing;
}
@Override
public Boolean launch() {
return true;
}
@Override
public Boolean land() {
return true;
}
@Override
final public Boolean canCarry(Item item) {
Boolean result;
if(item.getWeight() == this.max_item_weight - this.item_weight_carried){
result = true;
} else {
result = false;
}
return result;
}
@Override
final public void carry(Item item) {
this.item_weight_carried += item.getWeight();
}
}
|
0ec59d73-259d-4ab1-af2a-b21a600f2905
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-27 13:37:12", "repo_name": "Chuckame/dofus-protocol", "sub_path": "/src/main/java/org/chuckame/dofus2/protocol/types/secure/TrustCertificate.java", "file_name": "TrustCertificate.java", "file_ext": "java", "file_size_in_byte": 1018, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "6095d16790ed50c21da0536098976f5e9327187f", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Chuckame/dofus-protocol
| 250
|
FILENAME: TrustCertificate.java
| 0.293404
|
package org.chuckame.dofus2.protocol.types.secure;
import org.chuckame.dofus2.common.io.IDataReader;
import org.chuckame.dofus2.common.io.IDataWriter;
import org.chuckame.dofus2.common.io.INetworkType;
import lombok.Data;
import lombok.ToString;
import lombok.EqualsAndHashCode;
@Data
@ToString
@EqualsAndHashCode
public class TrustCertificate implements INetworkType {
public static final short TYPE_ID = 377;
private int id;
private String hash;
public TrustCertificate() {
}
public TrustCertificate(int id, String hash) {
this.id = id;
this.hash = hash;
}
public short getProtocolTypeId() {
return TYPE_ID;
}
public void deserialize(IDataReader reader) {
this.id = reader.readInt();
if (id < 0)
throw new IllegalArgumentException(String.format("Forbidden value on id = %s, it doesn't respect the following condition : id < 0", id));
this.hash = reader.readUTF();
}
public void serialize(IDataWriter writer) {
writer.writeInt(this.id);
writer.writeUTF(this.hash);
}
}
|
cdc5bc7a-c6d4-4877-aafa-aa4259e2c8af
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-09-03 09:04:31", "repo_name": "andreycooper/image-gallery", "sub_path": "/app/src/main/java/com/weezlabs/imagegallery/model/local/FolderViewModel.java", "file_name": "FolderViewModel.java", "file_ext": "java", "file_size_in_byte": 998, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "bdc7e6f861885e6df25305423d5560e823908d19", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/andreycooper/image-gallery
| 204
|
FILENAME: FolderViewModel.java
| 0.275909
|
package com.weezlabs.imagegallery.model.local;
import android.database.Cursor;
import java.util.ArrayList;
import java.util.List;
public class FolderViewModel {
private static final String LOG_TAG = FolderViewModel.class.getSimpleName();
public static final int MAX_COUNT_IMAGES = 4;
private List<LocalImage> mLocalImages;
private int mImageCount;
public FolderViewModel(Cursor cursor) {
mLocalImages = new ArrayList<>();
int i = 0;
if (cursor != null && cursor.moveToFirst()) {
do {
mLocalImages.add(new LocalImage(cursor));
i++;
} while (i < MAX_COUNT_IMAGES && cursor.moveToNext());
mImageCount = cursor.getCount();
}
if (cursor != null && !cursor.isClosed()) {
cursor.close();
}
}
public int getImageCount() {
return mImageCount;
}
public List<LocalImage> getLocalImages() {
return mLocalImages;
}
}
|
27fe1144-d783-4d74-9563-116549815665
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-03 16:19:15", "repo_name": "Eminemhehe/wz_toutiao", "sub_path": "/src/main/java/com/example/doutiao/service/Imp/MessageServiceImp.java", "file_name": "MessageServiceImp.java", "file_ext": "java", "file_size_in_byte": 1136, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "f9115bfc1000e8d7644611cfcdba7f05346538f7", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Eminemhehe/wz_toutiao
| 236
|
FILENAME: MessageServiceImp.java
| 0.280616
|
package com.example.doutiao.service.Imp;
import com.example.doutiao.bean.Message;
import com.example.doutiao.mapper.MessageDAO;
import com.example.doutiao.service.MessageService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by nowcoder on 2016/7/7.
*/
@Service
public class MessageServiceImp implements MessageService {
@Resource
private MessageDAO messageDAO;
public int addMessage(Message message) {
return messageDAO.addMessage(message);
}
public List<Message> getConversationList(int userId, int offset, int limit) {
// conversation的总条数存在id里
return messageDAO.getConversationList(userId, offset, limit);
}
public List<Message> getConversationDetail(String conversationId, int offset, int limit) {
// conversation的总条数存在id里
return messageDAO.getConversationDetail(conversationId, offset, limit);
}
public int getUnreadCount(int userId, String conversationId) {
return messageDAO.getConversationUnReadCount(userId, conversationId);
}
}
|
264ff386-6228-4a1f-8046-b8bf91d75ad2
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-05-01T07:55:15", "repo_name": "eminidi/hive-converter", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1207, "line_count": 42, "lang": "en", "doc_type": "text", "blob_id": "c50f386570be66928f4079e20a2ea8f094132586", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/eminidi/hive-converter
| 297
|
FILENAME: README.md
| 0.205615
|
Hive-converter is a modification of "steem-converter"
# hive-converter
Hive-converter allows you to easily switch from a Hive page to PeakD, Hive to eSteem, eSteem to PeakD... very easily.
------
# [EN]
## Presentation
Are you tired of changing the Hive link manually each time you want to move from one site to another site in the HIVE blockchain?
Then this tool is made for you!
This tool allows you to replace the link automatically and therefore to switch from one site to another. The system is entirely created in javascript, it must be used as a bookmark in your browser. (see use section)
### List of sites you can switch to using this tool:
- Hive to eSteem (or the opposite)
- Hive to PeakD (or the opposite)
- eSteem to PeakD (or the opposite)
### Soon : (tell me different sites of the HIVE blockchain, I would add them as soon as possible! Thanks)
## How to use this tool?
Insert each code in your browser as bookmark. Click on the Switch correspondent to each change.
Presentation article link:
- [EN] : http://hive.blog/@eminidi/
- Other languages: Soon
## Compatibility
- Chrome
- Firefox
- Opéra
- Brave
- CryptoTab
- Others...
### Incompatibilité
- Vivaldi
- Microsof Edge
|
ee84e69f-9aff-474f-88a9-710415fa029c
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-09 07:51:37", "repo_name": "xiaodu1993/zk-curator", "sub_path": "/src/main/java/com/maobing/zk/namingservice/NamingService.java", "file_name": "NamingService.java", "file_ext": "java", "file_size_in_byte": 1063, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "e7cb80b1a8a9103468f01bda8bc2e0dbded64583", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/xiaodu1993/zk-curator
| 228
|
FILENAME: NamingService.java
| 0.236516
|
package com.maobing.zk.namingservice;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
/**
* @author maobing.dmb
* @date 2017/08/02
*/
public class NamingService {
private String namingRoot = "/namingservice";
private CuratorFramework curatorFramework;
public NamingService(String serviceConfig) {
curatorFramework = CuratorFrameworkFactory.newClient(serviceConfig,
new ExponentialBackoffRetry(1000, 3));
curatorFramework.start();
try {
curatorFramework.create().forPath(namingRoot, namingRoot.getBytes());
} catch (Exception e) {}
}
public String naming(String name) throws Exception {
String concatKey = namingRoot.concat("/").concat(name);
try {
curatorFramework.create().forPath(concatKey);
return name;
}catch (Exception e){
throw new Exception("name already is exists");
}
}
}
|
e468d9b2-68dd-45ca-a6aa-279fffc20561
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-31 13:46:22", "repo_name": "zlren/weather", "sub_path": "/micro-weather-api/src/main/java/lab/zlren/weather/api/controller/WeatherController.java", "file_name": "WeatherController.java", "file_ext": "java", "file_size_in_byte": 1276, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "01956b554f4ab452adc46245d99c554f91524681", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/zlren/weather
| 277
|
FILENAME: WeatherController.java
| 0.247987
|
package lab.zlren.weather.api.controller;
import lab.zlren.weather.api.vo.WeatherResponse;
import lab.zlren.weather.api.service.WeatherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* WeatherController
*
* @author zlren
* @date 2018-01-29
*/
@RestController
@RequestMapping("/weather")
public class WeatherController {
@Autowired
private WeatherService weatherService;
/**
* 根据城市id查询天气数据
*
* @param cityId 城市id
* @return 天气数据
*/
@GetMapping("/cityId/{cityId}")
public WeatherResponse getWeatherByCityId(@PathVariable String cityId) {
return weatherService.getDataByCityId(cityId);
}
/**
* 根据城市名称查询天气数据
*
* @param cityName 城市名称
* @return 天气数据
*/
@GetMapping("/cityName/{cityName}")
public WeatherResponse getWeatherByCityName(@PathVariable String cityName) {
return weatherService.getDataByCityName(cityName);
}
}
|
d958ee5b-dbb4-472a-8b73-b00bf0e97c8d
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-08-17 07:58:06", "repo_name": "wso2/wso2-axis2-transports", "sub_path": "/modules/msmq/src/main/java/org/apache/axis2/transport/msmq/ctype/ContentTypeInfo.java", "file_name": "ContentTypeInfo.java", "file_ext": "java", "file_size_in_byte": 987, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "eca74a002d3683ca449eb12e0523cd8f543db932", "star_events_count": 48, "fork_events_count": 190, "src_encoding": "UTF-8"}
|
https://github.com/wso2/wso2-axis2-transports
| 186
|
FILENAME: ContentTypeInfo.java
| 0.216012
|
package org.apache.axis2.transport.msmq.ctype;
/**
* Class encapsulating the content type information for a given message.
*/
public class ContentTypeInfo {
private final String propertyName;
private final String contentType;
public ContentTypeInfo(String propertyName, String contentType) {
this.propertyName = propertyName;
this.contentType = contentType;
}
/**
* Get the name of the message property from which the content type
* has been extracted.
*
* @return the property name or null if the content type was not determined
* by extracting it from a message property
*/
public String getPropertyName() {
return propertyName;
}
/**
* Get the content type of the message.
*
* @return The content type of the message. The return value is never null.
*/
public String getContentType() {
return contentType;
}
}
|
b54a7a80-f972-4ce0-894e-161b46e78f6f
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-31 07:50:46", "repo_name": "Eng-MFQ/innopolis-express", "sub_path": "/MVP Source Code/app/src/main/java/com/mfq/foodle/frgments/HelpFeedback.java", "file_name": "HelpFeedback.java", "file_ext": "java", "file_size_in_byte": 1085, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "6b28a72dcca8cbd04210fdd6b06374c1b5e96629", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Eng-MFQ/innopolis-express
| 201
|
FILENAME: HelpFeedback.java
| 0.187133
|
package com.mfq.foodle.frgments;
import android.app.Fragment;
import android.os.Bundle;
import android.support.design.bottomappbar.BottomAppBar;
import android.support.design.widget.FloatingActionButton;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.mfq.foodle.R;
/**
* A simple {@link Fragment} subclass.
*/
public class HelpFeedback extends BottomBarFragment {
public HelpFeedback() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View root = inflater.inflate(R.layout.fragment_help_feedback, container, false);
root.findViewById(R.id.close).setOnClickListener(v -> getActivity().onBackPressed());
return root;
}
@Override
public void onBottomBarAttached(BottomAppBar bottomAppBar) {
}
@Override
public void onFabAttached(FloatingActionButton fab) {
}
}
|
06862482-c1f9-4029-aa38-0ef155e84a26
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-04 20:46:42", "repo_name": "SaladTomatOignon/Confroid", "sub_path": "/Confroid/confroidlib/src/main/java/fr/uge/confroidlib/Version.java", "file_name": "Version.java", "file_ext": "java", "file_size_in_byte": 1205, "line_count": 53, "lang": "en", "doc_type": "code", "blob_id": "003ee9c172aacc4137cf4dcb6c35f93d41c33e01", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/SaladTomatOignon/Confroid
| 255
|
FILENAME: Version.java
| 0.240775
|
package fr.uge.confroidlib;
import java.util.Date;
import java.util.Objects;
public class Version {
private Date date;
private String tag;
private String name;
public Version(String name, Date date, String tag) {
this.name = Objects.requireNonNull(name);
this.date = Objects.requireNonNull(date);
this.tag = tag;
}
public Date getDate() {
return date;
}
public String getTag() {
return tag;
}
public String getName() {
return name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Version version = (Version) o;
return Objects.equals(date, version.date) &&
Objects.equals(tag, version.tag) &&
Objects.equals(name, version.name);
}
@Override
public int hashCode() {
return Objects.hash(date, tag, name);
}
@Override
public String toString() {
return "Version{" +
"date=" + date +
", tag='" + tag + '\'' +
", name='" + name + '\'' +
'}';
}
}
|
564398e7-dd3e-4be0-bd00-b359f56b16f0
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-11-30 15:36:06", "repo_name": "mihirv0ra/lcd", "sub_path": "/api/src/main/java/com/lightningcd/api/model/ProvisioningConf.java", "file_name": "ProvisioningConf.java", "file_ext": "java", "file_size_in_byte": 988, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "00753e2ed0109c4cb9e60016dc41133575f83773", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/mihirv0ra/lcd
| 191
|
FILENAME: ProvisioningConf.java
| 0.203075
|
package com.lightningcd.api.model;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection = "provisioningconf")
public class ProvisioningConf extends BaseModel {
@Indexed(unique = true)
private String applicationName;
private ProvisionEnv[] restEndPoint;
public ProvisioningConf() {
super();
}
public ProvisioningConf(String applicationName, ProvisionEnv[] restEndPoint) {
this.applicationName = applicationName;
this.restEndPoint = restEndPoint;
}
public String getApplicationName() {
return applicationName;
}
public void setApplicationName(String applicationName) {
this.applicationName = applicationName;
}
public ProvisionEnv[] getRestEndPoint() {
return restEndPoint;
}
public void setRestEndPoint(ProvisionEnv[] restEndPoint) {
this.restEndPoint = restEndPoint;
}
}
|
8f225d77-edca-4eec-9e70-a2b9e2340edf
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-23 06:28:28", "repo_name": "rhkdwo0000/six_test", "sub_path": "/src/product/ProductDTO.java", "file_name": "ProductDTO.java", "file_ext": "java", "file_size_in_byte": 997, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "e47044c4829c18baf6e5118e3dda593171f9c9c4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/rhkdwo0000/six_test
| 227
|
FILENAME: ProductDTO.java
| 0.243642
|
package product;
public class ProductDTO {
private String id;
private String product_name;
private String product_explain;
private int price;
public ProductDTO(String id, String product_name, String product_explain, int price) {
super();
this.id = id;
this.product_name = product_name;
this.product_explain = product_explain;
this.price = price;
}
public ProductDTO() {
super();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getProduct_name() {
return product_name;
}
public void setProduct_name(String product_name) {
this.product_name = product_name;
}
public String getProduct_explain() {
return product_explain;
}
public void setProduct_explain(String product_explain) {
this.product_explain = product_explain;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
}//클래스 끝
|
a580f3f4-b1cf-4f08-aaf8-0bee886bcd3b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-27 13:31:50", "repo_name": "pisaandela/LearnSpringBoot", "sub_path": "/7.Spring Security Oauth2.0认证授权专题/security-spring-boot-first/src/main/java/com/zhangxp/boot/service/SpringUserDetailsService.java", "file_name": "SpringUserDetailsService.java", "file_ext": "java", "file_size_in_byte": 1205, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "4d2339330cd79d651b591362c16dbb27a4bbb554", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/pisaandela/LearnSpringBoot
| 225
|
FILENAME: SpringUserDetailsService.java
| 0.236516
|
package com.zhangxp.boot.service;
import com.zhangxp.boot.entity.MyUser;
import com.zhangxp.boot.mapper.MyUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
/**
* Created by Administrator on 2020/6/25 0025.
*/
@Service
public class SpringUserDetailsService implements UserDetailsService {
@Autowired
private MyUserMapper myUserMapper;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
MyUser myUserDTO = new MyUser();
myUserDTO.setUsername(username);
MyUser myUser = myUserMapper.selectOne(myUserDTO);
if (myUser == null)
{
return null;
}
UserDetails userDetails = User.withUsername(myUser.getUsername()).password(myUser.getPassword()).authorities(myUser.getAuthorites()).build();
return userDetails;
}
}
|
d9a4318a-4c94-44ae-8c62-972bfd1f595b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-24 02:37:29", "repo_name": "surbhirai1998/Quotation_Builder", "sub_path": "/Quotation/src/bb/com/util/DbUtil.java", "file_name": "DbUtil.java", "file_ext": "java", "file_size_in_byte": 1002, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "30cad910e0d6598219a16b3a6ef750b093884c67", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/surbhirai1998/Quotation_Builder
| 217
|
FILENAME: DbUtil.java
| 0.286968
|
package bb.com.util;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import bb.com.model.Config;
public class DbUtil {
static Connection con;
static String classname = "oracle.jdbc.driver.OracleDriver" ;
static String url="jdbc:oracle:thin:@localhost:1521:XE";
static String user="system";
static String password="root";
static String classname2 = "com.mysql.jdbc.Driver" ;//com.mysql.cj.jdbc.Driver
static String url2=Config.getMySqlDns();
static String user2=Config.getMySqlUsername();
static String password2=Config.getMySqlPassword();
static {
try {
Class.forName(classname2);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
public static Connection getConnection() throws SQLException{
con = DriverManager.getConnection(url2,user2,password2);
return con;
}
public static void closeConnection(Connection con) throws SQLException{
if(con!=null)
con.close();
}
}
|
7d672915-4a55-47ed-ba4c-727c75fbf7bf
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-04-03 15:13:05", "repo_name": "Kremlianski/EXXO-Portal", "sub_path": "/Postgre-EXXO - 2.7/src/java/BEANS/FormerBean.java", "file_name": "FormerBean.java", "file_ext": "java", "file_size_in_byte": 1004, "line_count": 27, "lang": "en", "doc_type": "code", "blob_id": "7dcadd647e1f11f814436de67a1bbdc671947a35", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Kremlianski/EXXO-Portal
| 211
|
FILENAME: FormerBean.java
| 0.288569
|
package BEANS;
import java.sql.*;
//import java.util.Properties;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
public class FormerBean {
public String getList(HttpServletRequest r) throws ClassNotFoundException, SQLException {
ServletContext sc = r.getServletContext();
Connection con = BASE.VER.getServletConnection(sc);
Statement stmt = con.createStatement();
String sql = "SELECT employee.id, employee.fio, employee.position, units.unit AS unit FROM employee, units "
+ "WHERE fired='1' AND employee.unit=units.unit_id ORDER BY fio";
ResultSet rs = stmt.executeQuery(sql);
String list = "";
while (rs.next()) {
list += "<tr><td class=\"fio\"><span id=\"" + rs.getString("id") + "\">" + rs.getString("fio") + "</span></td>"
+ "<td>" + rs.getString("unit") + "</td><td>" + rs.getString("position") + "</td></tr>";
}
return list;
}
}
|
1d1eea4b-57d6-4cd1-846e-5147f9bbb991
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-12-22 03:53:38", "repo_name": "JaredRombough/Wrestling", "sub_path": "/src/main/java/openwrestling/entities/StaffMemberEntity.java", "file_name": "StaffMemberEntity.java", "file_ext": "java", "file_size_in_byte": 1060, "line_count": 53, "lang": "en", "doc_type": "code", "blob_id": "84d558b35c5bad13c9db3acc8711b74905bbf207", "star_events_count": 4, "fork_events_count": 4, "src_encoding": "UTF-8"}
|
https://github.com/JaredRombough/Wrestling
| 222
|
FILENAME: StaffMemberEntity.java
| 0.226784
|
package openwrestling.entities;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import openwrestling.model.segment.constants.Gender;
import openwrestling.model.segment.constants.StaffType;
@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@DatabaseTable(tableName = "staff_members")
public class StaffMemberEntity extends Entity {
@DatabaseField(generatedId = true)
private long staffMemberID;
@DatabaseField
private long importKey;
@DatabaseField
private String name;
@DatabaseField
private Gender gender;
@DatabaseField
private int age;
@DatabaseField
private int skill;
@DatabaseField
private int behaviour;
@DatabaseField
private StaffType staffType;
@DatabaseField
private String imageFileName;
@DatabaseField(foreign = true)
private StaffContractEntity staffContract;
}
|
120584e1-2604-4cf6-bae3-38da9c0c1263
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-12-07T03:16:45", "repo_name": "CourtHans/401-cyber-notes", "sub_path": "/class42.md", "file_name": "class42.md", "file_ext": "md", "file_size_in_byte": 996, "line_count": 30, "lang": "en", "doc_type": "text", "blob_id": "b75790c60b32c276b14580efa2ca96b70f48b6a2", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/CourtHans/401-cyber-notes
| 260
|
FILENAME: class42.md
| 0.218669
|
# Day 42 - Scanning and Enumeration with NMAP
12/2/20
* [What is Mimikatz?](https://www.varonis.com/blog/what-is-mimikatz/)
> “Mimikatz has done more to advance security than than any other tool I can think of.” -- Jake Williams, Rendition Infosec
"**Mimikatz is an open-source application that allows users to view and save authentication credentials like Kerberos tickets.**"
Attackers can use Mimikatz to steal credentials and session cookies to mimic legitimate users and escalate privilege.
Examples:
* Pass-the-Hash
* Pass-the-Ticket
* Over-Pass the Hash (Pass the Key)
* Kerberos Golden Ticket
* Kerberos Silver Ticket
* Pass-the-Cache
Mimikatz needs to be “Run as Admin” to function completely, even if you are using an Administrator account.
*Extracting clear text passwords from memory*
```
mimikatz # privilege::debug
mimikatz # log nameoflog.log
mimikatz # sekurlsa::logonpasswords
```
The `coffee` command returns ascii art of coffee. Cause everyone needs coffee.
|
8b7d69ed-d72c-4e2f-b72d-123baac0c4ab
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-16 20:12:24", "repo_name": "EsraaFathy/MoallnemInternship", "sub_path": "/app/src/main/java/com/example/moaleminternsip/Main2Activity.java", "file_name": "Main2Activity.java", "file_ext": "java", "file_size_in_byte": 1114, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "908e1df93e7290624bc02598e200b7c6bff05f0d", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/EsraaFathy/MoallnemInternship
| 203
|
FILENAME: Main2Activity.java
| 0.236516
|
package com.example.moaleminternsip;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
public class Main2Activity extends AppCompatActivity {
VideoView videoView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
videoView=findViewById(R.id.videoView);
Intent intent=getIntent();
int i=intent.getIntExtra("i",0);
String title=intent.getStringExtra("title");
setTitle(title);
if ( videoView!= null){
videoView.setVideoPath("android.resource://" + getPackageName() + "/" + i);
}
MediaController mediaController = new MediaController(this);
videoView.setMediaController(mediaController);
mediaController.setAnchorView(videoView);
videoView.start();
}
@Override
protected void onStop() {
super.onStop();
videoView.stopPlayback();
}
}
|
dc32f46a-ed4c-4f4e-97bd-cb6b9fa83a75
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-04-19T03:52:43", "repo_name": "areps/simple-login-php", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1205, "line_count": 27, "lang": "en", "doc_type": "text", "blob_id": "beea3a81ef3902c05951e8c19a336cf27a6362cf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/areps/simple-login-php
| 242
|
FILENAME: README.md
| 0.203075
|
# simple-login-php
Some lines of the code are written in Malay, sorry!
Please note that this login page is not using hashed passwords method. (Don't use this for real projects!)
## Basic Documentation
### login.sql
SQL file for the login system. Use phpMyAdmin to import. Name your database as "practicelogin";
### connection.php
Containing PHP elements to connect your system with database through mysqli_connect. Make sure to check if your mysql credentials and database name are right.
### index.php
Containing HTML elements of a login page and PHP elements are used to make sure those who logged in will be redirected to dashboard.php and to connect pros-login.php with the index.php file.
### pros-login.php
Containing PHP elements to make login works by communicating your PHP file with database through mysqli_query.
### confirmation.php
Containing PHP elements to make sure no one can access dashboard.php without logging in. Just use "include('confirmation.php');" on pages that you want users to login first before accessing it.
### logout.php
Containing PHP elements to log you out by ending your session.
### dashboard.php
Basically just a landing page to see if you are logged in.
|
e2696a36-c574-4a50-ab0f-e0a4544375f0
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-04-15 06:06:21", "repo_name": "chinazhaoht/study", "sub_path": "/src/main/java/cn/xiaoneng/study/spark/SparkTest.java", "file_name": "SparkTest.java", "file_ext": "java", "file_size_in_byte": 1044, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "d4cb4d2a476be51112ea55b5c34d22ef84a1df99", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/chinazhaoht/study
| 231
|
FILENAME: SparkTest.java
| 0.253861
|
package cn.xiaoneng.study.spark;
import cn.xiaoneng.cluster.IClusterListener;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.FlatMapFunction;
import java.util.Arrays;
/**
* @author zhaoht
* @date 2016/3/25 11:05
*/
public class SparkTest {
public static void main(String[] args) {
String logFile = "YOUR_SPARK_HOME/README.md";
SparkConf sparkConf = new SparkConf().setAppName("test").setMaster("local");
JavaSparkContext sc = new JavaSparkContext(sparkConf);
JavaRDD<String> logData = sc.textFile(logFile).cache();
JavaRDD<String> testLog ;
JavaRDD words = logData.flatMap(
new FlatMapFunction<String,String>() {
@Override
public Iterable<String> call(String s) throws Exception {
return Arrays.asList(s.split(" "));
}
}
);
}
}
|
30e5939c-8a3d-4779-b03f-6d2c7e7d9eef
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-24 12:24:33", "repo_name": "MBY381/DormSystem-SuYiSheng", "sub_path": "/Dormitory/src/main/java/security/register/RegisterAPI.java", "file_name": "RegisterAPI.java", "file_ext": "java", "file_size_in_byte": 1105, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "8bf9ab50ea0d9ad5ece8ec17e4cb65eef6181748", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/MBY381/DormSystem-SuYiSheng
| 188
|
FILENAME: RegisterAPI.java
| 0.214691
|
package com.xjtu.dormitory.security.register;
import com.xjtu.dormitory.common.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
@RequestMapping("/security/register")
public class RegisterAPI {
@Resource
private RegisterService registerService;
@PostMapping("")
public Result register(@RequestBody RegisterDto dto){
boolean insert = false;
boolean exist = registerService.findWorkerId(dto);
if(!exist){
return Result.fail(Result.ERR_CODE_BUSINESS,"职工号不存在,请重新检查");
}else{
insert = registerService.insertUser(dto);
}
if(insert){
return Result.success("注册成功!!!");
}else {
return Result.fail(Result.ERR_CODE_BUSINESS,"职工号重复");
}
}
}
|
8b9047e2-3bc9-46e7-8083-03cb148d35c1
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-30 21:49:05", "repo_name": "joshbarcher/IT333_Spring2019", "sub_path": "/iterators/src/pp/FileIterable.java", "file_name": "FileIterable.java", "file_ext": "java", "file_size_in_byte": 1038, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "1f9927e9e2d0051d8b32542f97e53336a80a542c", "star_events_count": 1, "fork_events_count": 2, "src_encoding": "UTF-8"}
|
https://github.com/joshbarcher/IT333_Spring2019
| 180
|
FILENAME: FileIterable.java
| 0.283781
|
package pp;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Iterator;
import java.util.Scanner;
public class FileIterable implements Iterable<String>
{
private String path;
public FileIterable(String path)
{
this.path = path;
}
@Override
public Iterator<String> iterator()
{
return new FileIterator();
}
private class FileIterator implements Iterator<String>
{
private Scanner reader;
public FileIterator()
{
try
{
reader = new Scanner(new FileInputStream(path));
}
catch (FileNotFoundException e)
{
throw new IllegalStateException("File not found: " + e.getMessage());
}
}
@Override
public boolean hasNext()
{
return reader.hasNextLine();
}
@Override
public String next()
{
return reader.nextLine();
}
}
}
|
81c311e8-a64c-4937-aaaa-ec2acce82ee5
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-03-31 01:01:28", "repo_name": "Yuchengw/Lesbonne", "sub_path": "/core/platformserver/src/main/java/com/lesbonne/search/ElasticSearchUtils.java", "file_name": "ElasticSearchUtils.java", "file_ext": "java", "file_size_in_byte": 1005, "line_count": 25, "lang": "en", "doc_type": "code", "blob_id": "a417e0f1f231898f46f95a2291d0d694caf4edb0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Yuchengw/Lesbonne
| 211
|
FILENAME: ElasticSearchUtils.java
| 0.253861
|
package com.lesbonne.search;
import java.net.InetSocketAddress;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.common.transport.TransportAddress;
import com.google.common.net.HostAndPort;
public class ElasticSearchUtils {
private static final int DEFAULT_PORT = 9300;
/**
* Convert a {@link HostAndPort} instance to {@link TransportAddress}. If the {@link HostAndPort} instance doesn't
* contain a port the resulting {@link TransportAddress} will have {@link #DEFAULT_PORT} as port.
*
* @param hostAndPort a valid {@link HostAndPort} instance
* @return a {@link TransportAddress} equivalent to the provided {@link HostAndPort} instance
*/
public static TransportAddress fromHostAndPort(final HostAndPort hostAndPort) {
InetSocketAddress address = new InetSocketAddress(hostAndPort.getHostText(), hostAndPort.getPortOrDefault(DEFAULT_PORT));
return new InetSocketTransportAddress(address);
}
}
|
064400bf-17fd-4412-a7de-6eb4fc69a3f7
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-17 03:36:46", "repo_name": "xbird001/springboot014", "sub_path": "/src/main/java/springboot010/UserDao.java", "file_name": "UserDao.java", "file_ext": "java", "file_size_in_byte": 1075, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "7f0ca790900d40ec7abc22716b8fd7e460ab4195", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/xbird001/springboot014
| 227
|
FILENAME: UserDao.java
| 0.290981
|
package springboot010;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
public class UserDao {
@Autowired
private JdbcTemplate jdbcTemplate;
public void saveClass(String id, String className, String classAddress) {
String sql = "insert into t_class (id,class_name,class_address) values ('"
+ id + "','" + className + "','" + classAddress + "')";
jdbcTemplate.execute(sql);
}
/*@Transactional*/
public void saveUser() {
String sql = "insert into t_user (id,user_name) values('200','user_周')";
jdbcTemplate.execute(sql);
throw new NullPointerException();
}
/*@Transactional*/
public void savePerson() {
String sql = "insert into t_person (id,person_name) values('200','person_周')";
jdbcTemplate.execute(sql);
}
@Transactional
public void savePersonUser() {
this.savePerson();
this.saveUser();
}
}
|
8fa17b8f-8b53-44f8-87dd-95b6b9acbb1d
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-01 10:04:09", "repo_name": "jarrah42/coney-api", "sub_path": "/src/main/java/com/cefriel/coneyapi/model/db/custom/ConversationTranslation.java", "file_name": "ConversationTranslation.java", "file_ext": "java", "file_size_in_byte": 1077, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "bb1e21d35d70c5b1c75339158d8a54d89e92261b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/jarrah42/coney-api
| 205
|
FILENAME: ConversationTranslation.java
| 0.214691
|
package com.cefriel.coneyapi.model.db.custom;
import com.google.gson.JsonObject;
import org.springframework.data.neo4j.annotation.QueryResult;
@QueryResult
public class ConversationTranslation {
private String language;
private String title;
private String privacyLink;
private String introText;
public ConversationTranslation(String language, String title, String privacyLink, String introText){
this.language = language;
this.title = title;
this.privacyLink = privacyLink;
this.introText = introText;
}
public JsonObject toJson(){
JsonObject translationJson = new JsonObject();
translationJson.addProperty("language", this.language);
translationJson.addProperty("title", title == null ? "" : title);
translationJson.addProperty("privacyLink", privacyLink == null ? "" : privacyLink);
translationJson.addProperty("introText", introText == null ? "" : introText);
return translationJson;
}
public String getLanguage() {
return language;
}
}
|
3eb02c1d-f60e-4b9b-9ab1-f9a870af5fc9
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2015-02-07T13:56:32", "repo_name": "stevegreatrex/whoswhere", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1205, "line_count": 38, "lang": "en", "doc_type": "text", "blob_id": "7db6516e6a284bc28cd735f4f45750c87023a2c4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/stevegreatrex/whoswhere
| 260
|
FILENAME: README.md
| 0.199308
|
# WhosWhere
A test project using a bunch of new technologies that mimics an approach to tracking employee absences within a large company.
## Libraries Used
* Node
* Express
* PostgreSQL
* Angular
* Twitter Bootstrap (+ directives for angular)
* MomentJS
* Chart.js
## Database
I have used postgresql as the database for this application; you will need to update the config.js file in the root to supply a valid connection string.
The database should contain 4 tables based on the CSV files included with the activity description:
1. users
2. absences
3. absence_types
4. work_streams
See create_db.sql for details of structure.
### Populating Data
Run create_db.sql to create and populate the database.
## Unit Tests
Due to my lack of familiarity with Angular unit testing I have not attempted to tackle these within the scope of this project.
## Devices
The site is designed in a responsive way based on bootstrap and should look good on everything from a phone to a desktop.
## Build and Deployment
The site is deployed to openshift at http://whoswhere-stevegreatrex.rhcloud.com/
The deployment process is automated using Jenkins to pull changes from the openshift git repository.
|
c4abd03e-3d9d-42d9-baa2-a931264b400e
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-20 15:01:55", "repo_name": "guptahitesh1304/vodia-dashboard-api", "sub_path": "/dashboard/src/main/java/com/vodia/api/dashboard/DashboardApplication.java", "file_name": "DashboardApplication.java", "file_ext": "java", "file_size_in_byte": 989, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "517c418220e8910bf82099b5d824e342826966d7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/guptahitesh1304/vodia-dashboard-api
| 161
|
FILENAME: DashboardApplication.java
| 0.214691
|
package com.vodia.api.dashboard;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
public class DashboardApplication extends SpringBootServletInitializer{
private static final Logger log = LoggerFactory.getLogger(DashboardApplication.class);
@Bean
public RestTemplate getRestTemplate() {
return new RestTemplate();
}
public static void main(String[] args) {
SpringApplication.run(DashboardApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(DashboardApplication.class);
}
}
|
37af5820-7048-4f52-9aa7-75568fb9e55a
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-13 20:22:58", "repo_name": "andy-ex/apples", "sub_path": "/src/main/java/jaxb/model/DimensionEntry.java", "file_name": "DimensionEntry.java", "file_ext": "java", "file_size_in_byte": 1011, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "e387ac1c4a0619b16adc6f47681f62c2dafa8f38", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/andy-ex/apples
| 189
|
FILENAME: DimensionEntry.java
| 0.233706
|
package jaxb.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import model.dimension.Dimension;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class DimensionEntry {
@XmlAttribute
private String dimensionName;
@XmlElement(name="table")
private Dimension dimension;
public DimensionEntry() {
}
public DimensionEntry(String dimensionName, Dimension dimension) {
super();
this.dimensionName = dimensionName;
this.dimension = dimension;
}
public String getDimensionName() {
return dimensionName;
}
public void setDimensionName(String dimensionName) {
this.dimensionName = dimensionName;
}
public Dimension getDimension() {
return dimension;
}
public void setDimension(Dimension dimension) {
this.dimension = dimension;
}
}
|
4e3c347c-eca8-4ae5-b243-e86154618384
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-07-27 05:44:41", "repo_name": "bei215748382/tonghang", "sub_path": "/tonghang/src/main/java/com/tonghang/server/util/Base64.java", "file_name": "Base64.java", "file_ext": "java", "file_size_in_byte": 1014, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "e7fa04cdb7b92176d3772ce749a5d39cfd138927", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/bei215748382/tonghang
| 220
|
FILENAME: Base64.java
| 0.246533
|
package com.tonghang.server.util;
import java.io.IOException;
import org.apache.commons.lang3.StringUtils;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class Base64 {
/**
* 对byte数组编码
*
* @param srcByte
* @return
*/
public static String encode(byte[] srcByte) {
if (null == srcByte) {
return null;
}
if (srcByte.length == 0) {
return "";
}
BASE64Encoder encoder = new sun.misc.BASE64Encoder();
return encoder.encode(srcByte);
}
/**
* 对String进行解码
*
* @param srcString
* @return
* @throws IOException
*/
public static byte[] decoder(String srcString) throws IOException {
if (StringUtils.isEmpty(srcString)) {
return null;
}
BASE64Decoder decoder = new sun.misc.BASE64Decoder();
return decoder.decodeBuffer(srcString);
}
}
|
40d669cf-e863-4434-b7aa-f8f27026944b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-26 18:05:27", "repo_name": "macoumbathiaw/Advanced-UI", "sub_path": "/AdvanceUserInterface/app/src/main/java/com/example/mthiaw/advanceuserinterface/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1202, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "8780ea3d02f224ded19a421406aa3643dde125b1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/macoumbathiaw/Advanced-UI
| 203
|
FILENAME: MainActivity.java
| 0.279042
|
package com.example.mthiaw.advanceuserinterface;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//find the Editext
final EditText editText = (EditText) findViewById(R.id.editText);
/**
* Find the TextView view
*/
final TextView textView = (TextView) findViewById(R.id.textView);
//Find the Button
Button button = (Button) findViewById(R.id.button);
//Create a onClicklistener to listen to an event
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
/**
* Set the text from the EditText inside the TextView using the Button
*/
textView.setText(editText.getText());
}
});
}
}
|
963921b8-0388-4a49-91f8-9eb8bfba6b10
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-10-24 10:35:41", "repo_name": "cloudtasktracker/tts-track", "sub_path": "/src/main/java/com/tasktracker/service/track/starter/TrackServiceStarter.java", "file_name": "TrackServiceStarter.java", "file_ext": "java", "file_size_in_byte": 983, "line_count": 25, "lang": "en", "doc_type": "code", "blob_id": "3e56f354596d02703ccab15866f3180b0982c64d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/cloudtasktracker/tts-track
| 209
|
FILENAME: TrackServiceStarter.java
| 0.262842
|
package com.tasktracker.service.track.starter;
import com.sun.jersey.api.container.grizzly.GrizzlyWebContainerFactory;
import com.tasktracker.service.track.conf.AppConf;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
public class TrackServiceStarter {
final static Logger logger = Logger.getLogger("Starter");
public static void main(String[] args) throws IOException {
new AppConf();
final String port = System.getenv("TTS_TRACK_CONF").equals("wc")?System.getenv("TTS_TRACK_PORT"):System.getenv("PORT");
final String baseUri = "http://localhost:"+port+"/";
final Map<String, String> initParams = new HashMap<>();
initParams.put("com.sun.jersey.config.property.packages", "com.tasktracker.service.track.server");
logger.info("----------- TTS-TRACK: Grizzly Server starter at: "+baseUri);
GrizzlyWebContainerFactory.create(baseUri, initParams);
}
}
|
773e2a3c-0d67-44c8-b29c-bb2d79ca951d
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-18 08:37:00", "repo_name": "ankumakwana/VideoSearchApp", "sub_path": "/app/src/main/java/videosearchapp/com/videosearchapp/VideoViews.java", "file_name": "VideoViews.java", "file_ext": "java", "file_size_in_byte": 1068, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "11ee5674f19f5493c2f85d78aa2b93853c1b0cc3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/ankumakwana/VideoSearchApp
| 247
|
FILENAME: VideoViews.java
| 0.239349
|
package videosearchapp.com.videosearchapp;
import io.objectbox.annotation.Entity;
import io.objectbox.annotation.Id;
@Entity
public class VideoViews {
@Id
long id;
int increaseview;
int decreaseview;
String url;
public VideoViews(long id, int increaseview, int decreaseview,String url) {
this.id = id;
this.increaseview = increaseview;
this.decreaseview = decreaseview;
this.url = url;
}
public VideoViews() {
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getIncreaseview() {
return increaseview;
}
public void setIncreaseview(int increaseview) {
this.increaseview = increaseview;
}
public int getDecreaseview() {
return decreaseview;
}
public void setDecreaseview(int decreaseview) {
this.decreaseview = decreaseview;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
|
22347e02-6d0c-4636-b786-21b137e1cf5f
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-03-20 16:20:49", "repo_name": "ShpiliakYurii/med", "sub_path": "/backend/src/main/java/com/medical/solution/service/AttributeServiceImpl.java", "file_name": "AttributeServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1205, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "eea26d78130e581682a3409baf789abc91524a7c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/ShpiliakYurii/med
| 208
|
FILENAME: AttributeServiceImpl.java
| 0.264358
|
package com.medical.solution.service;
import com.medical.solution.entity.Attribute;
import com.medical.solution.repository.i.AttributeRepository;
import com.medical.solution.service.i.AttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class AttributeServiceImpl implements AttributeService {
private AttributeRepository attributeRepository;
@Autowired
public AttributeServiceImpl(AttributeRepository attributeRepository) {
this.attributeRepository = attributeRepository;
}
@Override
public Attribute add(Attribute o) {
return attributeRepository.create(o);
}
@Override
public Attribute update(Attribute o) {
return attributeRepository.update(o);
}
@Override
public Attribute getById(long id) throws NoSuchMethodException {
return attributeRepository.findById(id);
}
@Override
public void delete(long id) throws NoSuchMethodException {
attributeRepository.delete(id);
}
@Override
public List<Attribute> getAll() {
return attributeRepository.findAll();
}
}
|
6e375e46-6b0e-4a1a-8462-4b363f4fe3ef
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-20 08:27:25", "repo_name": "afal007/spring-test", "sub_path": "/src/main/java/me/afal/spring/test/Bean.java", "file_name": "Bean.java", "file_ext": "java", "file_size_in_byte": 1003, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "bab1913cf67aa1de88f1613bcf5f3ac8db66e224", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/afal007/spring-test
| 202
|
FILENAME: Bean.java
| 0.252384
|
package me.afal.spring.test;
import javax.annotation.PostConstruct;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;
@Component
public class Bean{
@Greeting( firstName = "Sania", lastName = "Fal" )
private String fullName;
private Bean bean; // Self injecting
public Bean() {
System.out.println( "Constructor " + fullName ); // fullName is null cause BeansPostProcessors haven't done their work yet
}
public String greeting( String name ) {
return "Hello, " + fullName; // fullName was initialized by BeanPostProcessor
}
@PostConstruct
public void init() {
System.out.println( "Init method " + bean.greeting( fullName ) ); // fullName was initialized by BeanPostProcessor
}
public void setBean( Bean bean ) {
this.bean = bean;
}
public Bean getBean() {
return bean;
}
}
|
97ff8246-1a8c-4c6d-85e0-c52da7028cc9
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-08 14:38:13", "repo_name": "ecosme/pocHibernateEntityMgr", "sub_path": "/src/main/java/com/honeywell/corpo/dataaccess/entity/Product.java", "file_name": "Product.java", "file_ext": "java", "file_size_in_byte": 1038, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "30df063be54382beb7d6461f06ec7b53b89f45e0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/ecosme/pocHibernateEntityMgr
| 219
|
FILENAME: Product.java
| 0.259826
|
package com.honeywell.corpo.dataaccess.entity;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
//@Entity
//@Table(name="products", schema="public")
//@TableGenerator(name="prodGen", initialValue=0, allocationSize=10)
public class Product {
@Id
@GeneratedValue(strategy=IDENTITY, generator="prodGen")
@Column(name="idProd", unique=true, nullable = false)
private int idProd;
@Column(nullable = false)
private String description;
public Product(){
super();
}
public Product(String prodName){
super();
this.description = prodName;
}
public int getIdProd() {
return idProd;
}
public void setIdProd(int idProduct) {
this.idProd = idProduct;
}
public String getDescription() {
return description;
}
public void setDescription(String prodName) {
this.description = prodName;
}
}
|
505511b0-8898-4f3c-97c7-64adcf86bd55
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-11 10:16:22", "repo_name": "xutao15186421194/pmc", "sub_path": "/pmc-manage/src/main/java/com/xutao/pmc/service/impl/TbSpeechServiceImpl.java", "file_name": "TbSpeechServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1205, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "76ca20a865305a1a59777bd2cde66129cd82d770", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/xutao15186421194/pmc
| 260
|
FILENAME: TbSpeechServiceImpl.java
| 0.279828
|
package com.xutao.pmc.service.impl;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pmc.bean.TbSpeech;
import com.pmc.service.TbSpeechService;
import com.xutao.pmc.mapper.TbSpeechMapper;
import org.springframework.beans.factory.annotation.Autowired;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
@Service
public class TbSpeechServiceImpl implements TbSpeechService {
@Autowired
TbSpeechMapper tbSpeechMapper;
@Override
public TbSpeech getSpeech() {
Example example = new Example(TbSpeech.class);
example.setOrderByClause("createdate DESC");
List<TbSpeech> tbSpeeches = tbSpeechMapper.selectByExample(example);
return tbSpeeches.get(0);
}
@Override
public PageInfo<TbSpeech> listSpeechAll(Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum,pageSize);
Example example = new Example(TbSpeech.class);
example.setOrderByClause("createdate DESC");
List<TbSpeech> list = tbSpeechMapper.selectAll();
PageInfo<TbSpeech> page = new PageInfo<>(list,3);
return page;
}
}
|
5a8f777b-86c1-4c57-8c5b-c6fc8b2b04c0
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-05-30T18:17:57", "repo_name": "theprakharjain/job_portal_api", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 968, "line_count": 46, "lang": "en", "doc_type": "text", "blob_id": "078376706ca4d50579585342e83744d05351e8c4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/theprakharjain/job_portal_api
| 271
|
FILENAME: README.md
| 0.240775
|
# Job Portal API
Job portal API provides an API interface to the basic functionalities of a Job Portal. The API uses MongoDB database and is built in NodejS. It uses JWT for the verification.
## API End Points
Guide to API endpoints can be accessed via "https://drive.google.com/file/d/1E_kqEFut4pfddGOy4nUIKSO6y3WIaBxc/view?usp=sharing".
API URL: `http://prakharjain.org/jobportalapi/`
Header: `authToken`
## API Test Data Dump
API dump is in the folder "dump.zip". Unzip the folder and use the belown command to restore the data dump in the system.
```bash
mongorestore dump
```
## Test Logins
```python
# For 'Recruiter'
{
"email": "abc@abc.com",
"password": "123456"
}
# For 'Candidate'
{
"email": "tarun@maheshwari.com",
"password": "123456"
}
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
|
f57f9bf9-cf45-4ee2-b503-d0cf80815d13
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-14 17:49:41", "repo_name": "VuaYen/ProjectPM_2021", "sub_path": "/src/main/java/miu/edu/product/domain/Vendor.java", "file_name": "Vendor.java", "file_ext": "java", "file_size_in_byte": 1069, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "d2ecdc136d2ff223625facdc1118ba96f5f170f9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/VuaYen/ProjectPM_2021
| 194
|
FILENAME: Vendor.java
| 0.242206
|
package miu.edu.product.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.List;
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@Table(name = "vendor")
public class Vendor {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(nullable = false)
@NotNull
private String firstName;
@NotNull
private String lastName;
private String gender;
@Email
@NotNull
@Column(nullable = false,unique = true)
private String email;
@NotNull
@Column(unique = true)
private String userName;
private VendorStatus status;
@Embedded
private Address address;
// @JsonIgnore
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "vendor")
// private List<Product> products;
}
|
64c1a8e5-1639-4820-ad4b-9d78cb7b30d4
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-15 07:12:16", "repo_name": "J05H14/Web-Servlets-and-JSP-CS3220", "sub_path": "/src/models/SimpsonsCharacterBean.java", "file_name": "SimpsonsCharacterBean.java", "file_ext": "java", "file_size_in_byte": 1069, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "8b0cc9de5f74efdc44838e640e6536db6a2bb6a6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/J05H14/Web-Servlets-and-JSP-CS3220
| 287
|
FILENAME: SimpsonsCharacterBean.java
| 0.286169
|
package models;
import java.util.ArrayList;
import java.util.Random;
public class SimpsonsCharacterBean {
ArrayList<SimpsonsCharacter> characters;
public SimpsonsCharacterBean() {
characters = new ArrayList<SimpsonsCharacter>();
}
public void setAddCharacter() {
}
public String getLastThumbnail() {
String nameURL = this.characters.get(characters.size() - 1).getName().replaceAll(" ", "_").toLowerCase();
if(characters.get(characters.size() - 1).getImages() == 0) {
return "http://via.placeholder.com/150?text=N/A";
}
else {
return "http://albertcervantes.com/cs3220/cdn/simpsons/" + nameURL + "/pic_0000.jpg";
}
}
public String getRandomImage() {
Random rand = new Random();
String nameURL = this.characters.get(characters.size() - 1).getName().replaceAll(" ", "_").toLowerCase();
int image = rand.nextInt(characters.get(characters.size() - 1).getImages());
String imageURL = String.format("%04d", image);
return "http://albertcervantes.com/cs3220/cdn/simpsons/" + nameURL + "/pic_" + imageURL + ".jpg";
}
}
|
94476a3e-93ee-4be7-acdc-0cf1a1e038c3
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-03 07:34:17", "repo_name": "NuwanNBN/Pizza_Loop", "sub_path": "/app/src/main/java/com/example/pizza_loop/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1021, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "d6d165672feb6872fea65a9d74d16a67ee486340", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/NuwanNBN/Pizza_Loop
| 183
|
FILENAME: MainActivity.java
| 0.20947
|
package com.example.pizza_loop;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
EditText username;
EditText password;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
username = findViewById(R.id.username);
password = findViewById(R.id.password);
}
public void login(View view) {
Intent intent = new Intent(MainActivity.this, PizzaListActivity.class);
startActivity(intent);
/* if (username.getText().toString()=="a" && password.getText().toString()=="1"){
}
else{
Toast toast = (Toast) Toast.makeText(this,"Please enter User name-admin password-1234",Toast.LENGTH_LONG);
toast.show();
}*/
}
}
|
196e6584-623b-48c0-aa5f-52abbdf01c58
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-27 02:28:57", "repo_name": "majunmin/spring-rabbitmq-learning", "sub_path": "/learning-exercise/src/main/java/com/mjm/queue/topics/TopicSend.java", "file_name": "TopicSend.java", "file_ext": "java", "file_size_in_byte": 1205, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "f17c0bc3bfd74303ef0ca335e53ff49786ba9674", "star_events_count": 5, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/majunmin/spring-rabbitmq-learning
| 258
|
FILENAME: TopicSend.java
| 0.247987
|
package com.mjm.queue.topics;
import com.mjm.common.CommonUtils;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import org.apache.commons.io.Charsets;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
/**
* @author majun
* @date 2018/10/24 16:11
*/
public class TopicSend {
private static final String EXCHANGE_NAME = "topic_logs";
public static final String[] routingKeys = new String[]{
"quick.orange.rabbit",
"lazy.orange.elephant",
"quick.orange.fox",
"lazy.brown.fox",
"quick.brown.fox",
"quick.orange.male.rabbit",
"lazy.orange.male.rabbit"
};
public static void main(String[] args) throws IOException, TimeoutException {
Connection connection = CommonUtils.getConnection();
Channel channel = connection.createChannel();
channel.exchangeDeclare(EXCHANGE_NAME, "topic");
for (String routingKey : routingKeys) {
String msg = "send : " + routingKey;
channel.basicPublish(EXCHANGE_NAME, routingKey, null,msg.getBytes(Charsets.UTF_8));
}
connection.close();
}
}
|
b07328e9-7a2b-4c6b-a7ad-784cb0e82918
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-06 10:40:50", "repo_name": "suno09/LearnJava", "sub_path": "/Main/src/main/java/custom_serializable/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 1003, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "4dc2cd190fa7d7ded2adb51a213bbccc51c04c79", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/suno09/LearnJava
| 203
|
FILENAME: User.java
| 0.290981
|
package custom_serializable;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
public class User implements Serializable {
static int field1 = 1;
final int field2 = 2;
private final int field3 = 3;
transient int field4 = 4;
transient final int field5 = 5;
String userName = "admin";
transient String password = "password";
private void writeObject(ObjectOutputStream oos) throws Exception {
oos.defaultWriteObject();
String encryptPassword = encrypt(password);
oos.writeObject(encryptPassword);
}
private void readObject(ObjectInputStream ois) throws Exception {
ois.defaultReadObject();
password = decrypt((String)ois.readObject());
}
private String encrypt(String value) {
return new StringBuilder(value).reverse().toString();
}
private String decrypt(String value) {
return new StringBuilder(value).reverse().toString();
}
}
|
a97855ae-0d19-4ea5-89af-d58dcab6e62a
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-18 14:39:43", "repo_name": "vipsamleti/spring-boot-slack-integration", "sub_path": "/src/main/java/io/vipsamleti/springbootslackintegration/configurations/SlackConfiguration.java", "file_name": "SlackConfiguration.java", "file_ext": "java", "file_size_in_byte": 979, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "f9800d2ebc88a32e24a9a71e535db98b1e1a7f47", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/vipsamleti/spring-boot-slack-integration
| 228
|
FILENAME: SlackConfiguration.java
| 0.240775
|
package io.vipsamleti.springbootslackintegration.configurations;
import com.hubspot.slack.client.SlackClient;
import com.hubspot.slack.client.SlackClientFactory;
import com.hubspot.slack.client.SlackClientRuntimeConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class SlackConfiguration {
//@Value("${slack.api-token}")
//String SLACK_API_TOKEN = "";
String str1 = "xoxb-1064399718182-1083774805649-";
String str2 = "ZqEvdhTIbV5hCosju5HHLojE";
@Bean
public SlackClient getSlackClient(){
SlackClientRuntimeConfig runtimeConfig = SlackClientRuntimeConfig.builder()
.setTokenSupplier(() -> str1+str2)
.build();
return SlackClientFactory.defaultFactory().build(runtimeConfig);
}
}
|
848ff6d2-01b9-407f-824b-20bad544801c
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-03-07 10:03:36", "repo_name": "cuijiabin/java8_function", "sub_path": "/src/com/thread/chapter04/MyService6.java", "file_name": "MyService6.java", "file_ext": "java", "file_size_in_byte": 1255, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "8988d7a476ff4665e3fed63f723aa831db055877", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/cuijiabin/java8_function
| 227
|
FILENAME: MyService6.java
| 0.243642
|
package com.thread.chapter04;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class MyService6 {
private ReentrantLock lock = new ReentrantLock();
private Condition condition = lock.newCondition();
private boolean hasValue = false;
public void set() {
try {
lock.lock();
while (hasValue == true) {
System.out.println("有可能set连续");
condition.await();
}
System.out.println("打印set");
hasValue = true;
condition.signal();
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
lock.unlock();
}
}
public void get() {
try {
lock.lock();
while (hasValue == false) {
System.out.println("有可能get连续");
condition.await();
}
System.out.println("打印get");
hasValue = false;
condition.signal();
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
lock.unlock();
}
}
}
|
c300a8a4-d26a-4f4f-825c-cfb7f08d98be
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2014-08-11T16:27:34", "repo_name": "chriszacny/AppMonPOC", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 967, "line_count": 23, "lang": "en", "doc_type": "text", "blob_id": "8b4abdf0162dfd2ca3131df08b298e4a6b81cde3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/chriszacny/AppMonPOC
| 211
|
FILENAME: README.md
| 0.228156
|
#AppMonPOC
=========
This is a very simple proof of concept I put together for application monitoring on a large screen device such as a TV.
The thought is, it would be composed of large modular "blocks" that can be resized and moved around.
In addition, charts can be included to display messaging rates and such.
I used gridster.js to handle the blocks and resizing. I used highcharts.js for the charting.
The client maintains a WebSocket connection to the server, which in this implementation is a Python Tornado server.
As a final note, this is meant to be conceptual... there is no error handling, things are hard-coded, no thread locking, etc. In practice, these things would all be done in a production application.
#Installation / Usage:
You will need to:
1. Install Python 3
2. Use pip to install tornado (pip install tornado)
3. Start the tornado server in the webserver directory (python demo_server.py)
4. Launch index.html in the client folder
|
99992851-0612-44ec-823d-9e094db3b69a
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-06 09:09:30", "repo_name": "yqbgq/logistics_management", "sub_path": "/src/main/java/com/bishe/logistics_management/database/service/MessageService.java", "file_name": "MessageService.java", "file_ext": "java", "file_size_in_byte": 1074, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "1307e06af7e1725d6f0b3230a1598e08b6956413", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/yqbgq/logistics_management
| 227
|
FILENAME: MessageService.java
| 0.26588
|
package com.bishe.logistics_management.database.service;
import com.bishe.logistics_management.database.dao.MessageDao;
import com.bishe.logistics_management.database.dataObject.MessageObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
/**
* 信息相关的服务层
* @author 黄伟
*/
@Service
public class MessageService {
private static MessageDao messageDao;
/**
* 构造函数,用于注入需要的massageDao
* @param messageDao messageDao
*/
@Autowired
public MessageService(MessageDao messageDao){
MessageService.messageDao = messageDao;
}
/**
* 插入信息表
* @param message 要求的信息类
*/
public static void insertMessage(MessageObject message){messageDao.insertMessage(message);}
/**
* 按照ID获取信息类
* @param id ID
* @return 返回信息列表
*/
public static ArrayList<MessageObject> getMessage(int id){return messageDao.getMessage(id);}
}
|
49bb6007-87ea-4f65-ba0d-25238697d433
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-04-19 03:36:47", "repo_name": "66254264/SoundRecorderUtils", "sub_path": "/app/src/main/java/com/sid/soundrecorderutils/Utils.java", "file_name": "Utils.java", "file_ext": "java", "file_size_in_byte": 1067, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "f59768ee60a0b6bd7dff2be58404c27fd8ba9fc0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/66254264/SoundRecorderUtils
| 239
|
FILENAME: Utils.java
| 0.26588
|
package com.sid.soundrecorderutils;
import android.util.Base64;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
* Created by IT_Hz.
* Date: 2019/1/8
* Time: 8:59
* TEL:18081034195
*/
public class Utils {
public static String FileToStr(String filePath){
byte[] buffer = null;
try {
File file = new File(filePath);
FileInputStream fis = new FileInputStream(file);
ByteArrayOutputStream bos = new ByteArrayOutputStream(1000);
byte[] b = new byte[1000];
int n;
while ((n = fis.read(b)) != -1) {
bos.write(b, 0, n);
}
fis.close();
bos.close();
buffer = bos.toByteArray();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return Base64.encodeToString(buffer,Base64.DEFAULT);
}
}
|
e2994257-07d2-4889-9030-659b5c0cc436
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-17 21:29:43", "repo_name": "pancosances/PTPrinter", "sub_path": "/app/src/main/java/eu/panco/ptprinter/printerservice/PrinterQueue.java", "file_name": "PrinterQueue.java", "file_ext": "java", "file_size_in_byte": 1206, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "2d585dbf545417cedacaeccc3c1de23b9a01020c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/pancosances/PTPrinter
| 227
|
FILENAME: PrinterQueue.java
| 0.26588
|
package eu.panco.ptprinter.printerservice;
import android.printservice.PrintJob;
import java.util.ArrayList;
import eu.panco.ptprinter.BluetoothPrinterService;
import eu.panco.ptprinter.bluetoothservice.BluetoothDeviceState;
public class PrinterQueue {
private BluetoothPrinterService service;
private ArrayList<byte[]> queue;
public PrinterQueue() {
this.queue = new ArrayList<>();
}
public synchronized void add(byte[] bytes) {
queue.add(bytes);
print();
}
public synchronized void add(ArrayList<byte[]> bytes) {
queue.addAll(bytes);
print();
}
public synchronized void print() {
if (service == null) {
service = new BluetoothPrinterService();
}
if (service.getState() != BluetoothDeviceState.CONNECTED) {
/*BluetoothPrinter printer = BluetoothService.getBluetoothPrinter();
service.connect(printer.getDevice());*/
return;
}
while (queue.size() > 0) {
service.write(queue.get(0));
queue.remove(0);
}
}
public void add(PrintJob job) {
}
}
|
9a70b173-23a3-4748-b7ec-c7f7ee49e514
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-09 05:55:48", "repo_name": "kuangxiaoguo0123/FloatingOrderView", "sub_path": "/app/src/main/java/com/sprite/floatingorderview/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 978, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "6c8a80628552b4be32a04f2374dd85e6e3ca3afd", "star_events_count": 23, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/kuangxiaoguo0123/FloatingOrderView
| 179
|
FILENAME: MainActivity.java
| 0.216012
|
package com.sprite.floatingorderview;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.sprite.floatingorderview.view.ATFloatingOrderView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
init();
}
private void init() {
ATFloatingOrderView sellOrderView = (ATFloatingOrderView) findViewById(R.id.sell_order_view);
ATFloatingOrderView riderOrderView = (ATFloatingOrderView) findViewById(R.id.rider_order_view);
sellOrderView.setCenterText(getString(R.string.sell_title),
getString(R.string.sell_description), getString(R.string.sell_detail));
riderOrderView.setCenterText(getString(R.string.rider_title),
getString(R.string.rider_description), getString(R.string.rider_detail));
}
}
|
9dd83bd4-2dc5-4ee7-bab8-0d42f29646ef
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2013-03-08T02:30:14", "repo_name": "braungoodson/MyApp.js", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1068, "line_count": 25, "lang": "en", "doc_type": "text", "blob_id": "572b248036b86b2fe7337bdad80242c9d45f07ae", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/braungoodson/MyApp.js
| 251
|
FILENAME: README.md
| 0.285372
|
MyApp.js
=========
MyApp.js is an example front-end application using an object-oriented MVC architecture with an observable pattern. Both the framework and example application are written in JavaScript adhering to ECMAScript 5. The MVC sub-system utilizes prototype chaining for fast inheritance. The framework is very extensible.
* To give this thing a test run, just open the `MyApp.html` page in a browser.
* To view the docs, just open `jsdoc/index.html` in a browser.
Content
=========
* `DataStructures.js` contains simple data structure faceds that inehrit from the `Array()` object. They are meant for a semantic.
* `MVCSubSystem.js` relies on the data structure semantics, and contains its own set of "abstract classes" that can be inherited to create your own MVC application.
* `MyApp.js` contains an example application of the framework. This is a good place to start..
--
2013-01-10
The sub-system is complete, I think. We'll release in beta.
--
2013-01-07
The architecture is still in design, while the framework reflects only what is designed.
|
17823369-61b0-4c1c-a105-c3d03c373bfd
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-02 13:18:53", "repo_name": "ashishnimrot/EcmployeeManagement", "sub_path": "/src/com/alten/employeemanagement/service/EmployeeServiceImpl.java", "file_name": "EmployeeServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1068, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "6ae018589dc96727e58f31a50b6991761c83d20e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/ashishnimrot/EcmployeeManagement
| 224
|
FILENAME: EmployeeServiceImpl.java
| 0.293404
|
package com.alten.employeemanagement.service;
import java.util.List;
import java.util.Optional;
import com.alten.employeemanagement.dao.EmployeeDAO;
import com.alten.employeemanagement.dao.EmployeeDAOImpl;
import com.alten.employeemanagement.domain.Employee;
public class EmployeeServiceImpl implements EmployeeService{
private static EmployeeServiceImpl instance;
private EmployeeDAO employeeDAO = EmployeeDAOImpl.getInstance();
private EmployeeServiceImpl() {
}
public static EmployeeServiceImpl getInstance() {
if( instance == null) {
instance = new EmployeeServiceImpl();
}
return instance;
}
@Override
public String addEmployee(Employee employee) {
return employeeDAO.addEmployee(employee);
}
@Override
public String removeEmployee(String empId) {
return employeeDAO.removeEmployee(empId);
}
@Override
public Optional<Employee> getEmployeeById(String empId) {
return employeeDAO.getEmployeeById(empId);
}
@Override
public Optional<List<Employee>> getEmployees() {
return employeeDAO.getEmployees();
}
}
|
2a5b8002-646c-4f5b-b790-f6e60f4a863b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-25 08:10:55", "repo_name": "kaspi6000/JavaClass", "sub_path": "/Class/DB/script/JDBCTest/memo/com/test/mvc/member/auth/Auth.java", "file_name": "Auth.java", "file_ext": "java", "file_size_in_byte": 1108, "line_count": 61, "lang": "en", "doc_type": "code", "blob_id": "55758775ec9d019f088e680afe2cc06c8bfcf3f7", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/kaspi6000/JavaClass
| 302
|
FILENAME: Auth.java
| 0.292595
|
package com.test.mvc.member.auth;
import java.util.Scanner;
import com.test.mvc.member.model.MemberDAO;
import com.test.mvc.member.model.MemberDTO;
public class Auth {
private MemberDAO dao;
public static boolean isAuth = false;
public static String mseq;
public Auth() {
dao = new MemberDAO();
}
//MemberClass
public void login() {
Scanner scan = new Scanner(System.in);
System.out.println("[회원 로그인]");
System.out.print("이메일 : ");
String email = scan.nextLine();
System.out.print("비밀번호 : ");
String pw = scan.nextLine();
MemberDTO dto = new MemberDTO();
dto.setEmail(email);
dto.setPw(pw);
if(dao.auth(dto) == 1) {
//성공
Auth.isAuth = true;
Auth.mseq = dao.getMseq(dto);
System.out.println("**로그인 성공.");
} else {
//실패
Auth.isAuth = false;
System.out.println("**로그인 실패.");
}
}
public void logout() {
System.out.println("[회원 로그아웃]");
//로그아웃
Auth.isAuth = false;
Auth.mseq = null;
System.out.println("**로그아웃 성공");
}
}
|
1a6c91bc-a09c-4d4d-b20a-f7f4b9ecaf49
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-28 22:47:01", "repo_name": "m7mdyoussef/Weather_Alert", "sub_path": "/app/src/main/java/com/joecoding/weatheralert/ui/welcom/SplashScreen.java", "file_name": "SplashScreen.java", "file_ext": "java", "file_size_in_byte": 1048, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "e8a26beb9b6dd0535a9d08208236aaa0ae0b6177", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/m7mdyoussef/Weather_Alert
| 193
|
FILENAME: SplashScreen.java
| 0.220007
|
package com.joecoding.weatheralert.ui.welcom;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import com.joecoding.weatheralert.R;
import com.airbnb.lottie.LottieAnimationView;
import com.joecoding.weatheralert.MainActivity;
import com.scwang.wave.MultiWaveHeader;
public class SplashScreen extends AppCompatActivity {
LottieAnimationView splashlottie;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
splashlottie=findViewById(R.id.splashlottie);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent mainIntent = new Intent(SplashScreen.this, MainActivity.class);
SplashScreen.this.startActivity(mainIntent);
SplashScreen.this.finish();
}
}, 4000);
}
}
|
17ca41b4-efd7-485c-be2e-9a9476a49d43
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-07-22T19:11:35", "repo_name": "prashant101386/devops", "sub_path": "/Learning/modules/dataFactory/linkedServices/dataLake/README.MD", "file_name": "README.MD", "file_ext": "md", "file_size_in_byte": 1206, "line_count": 31, "lang": "en", "doc_type": "text", "blob_id": "8e8c6ec79502cf3da52da6706aa3c312077ab042", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/prashant101386/devops
| 246
|
FILENAME: README.MD
| 0.246533
|
# Azure Data Factory - ADLS Gen 2 Linked Service
---
### Description:
- Deploys a Data Factory linked service to an Azure Data Lake Storage account
- This resource is available in Terraform but lacks the required functionality to deploy using a Key vault and secret. This resource is deployed by calling a Terraform local-exec to execute an Azure CLI command. The Azure CLI command uses the deploy.json file to deploy the resource to Azure.
### Dependencies:
- Data Factory
- Azure Data Lake Storage Gen 2
### Included Resources:
- Databricks Linked Service
### Required Variables:
resource_group_name = "string"
data_factory_name = "string"
linked_service_name = "string"
base_url = "string"
secret_name = "string"
key_vault_linked_service_name = "string"
json_path = "string"
trigger = "string"
### Outputs:
### Reference Links:
### Microsoft Documentation:
https://docs.microsoft.com/en-us/azure/data-factory/concepts-linked-services
### Terraform Resource Provider:
https://www.terraform.io/docs/provisioners/local-exec.html
|
b7bd5042-5729-4ac2-bd23-48129d0b7d64
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-22 07:56:31", "repo_name": "pabloriosramirez/springboot-wrapper", "sub_path": "/src/main/java/online/grisk/atenea/domain/entity/TypeVariable.java", "file_name": "TypeVariable.java", "file_ext": "java", "file_size_in_byte": 1207, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "be658d74bc5890ef4f8cc4df5fbb02a54436f790", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/pabloriosramirez/springboot-wrapper
| 267
|
FILENAME: TypeVariable.java
| 0.264358
|
/*
* 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 online.grisk.atenea.domain.entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Collection;
/**
* @author Pablo Ríos Ramírez
* @email pa.riosramirez@gmail.com
* @web www.pabloriosramirez.com
*/
@Getter
@Setter
@NoArgsConstructor
public class TypeVariable implements Serializable {
private static final long serialVersionUID = 1L;
private Long idTypeVariable;
@NotNull
@Size(min = 1, max = 100)
private String name;
@NotNull
@Size(min = 1, max = 50)
private String code;
private Collection<Variable> variableCollection;
public TypeVariable(Long idTypeVariable) {
this.idTypeVariable = idTypeVariable;
}
public TypeVariable(Long idTypeVariable, String name, String code) {
this.idTypeVariable = idTypeVariable;
this.name = name;
this.code = code;
}
}
|
ee20853d-4636-4e6f-941a-a93b492c1657
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-04-03T00:54:02", "repo_name": "flieckster/E-Commerce-Back-End", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1033, "line_count": 26, "lang": "en", "doc_type": "text", "blob_id": "c5e4d1603db892f2d0163870ad6b9f4576c57f78", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/flieckster/E-Commerce-Back-End
| 269
|
FILENAME: README.md
| 0.255344
|
#E-Commerce Back end
## About
This is the back end of an ecommerce database, connecting categories, products, and tags. The application is set up with api's so that as a user you can PUT, DEL, POST, GET various calls using a 3rd party application like insomia to update the MySQL database backend. Note there is not interface beyond that. this is considered a ORM or object relational mapping technique.
## Required
* [Node.js](https://nodejs.org/)
* [MySQL2](https://www.npmjs.com/package/mysql2)
* [express](https://expressjs.com/)
* [dotenv](https://www.npmjs.com/package/dotenv)
* [sequelize](https://sequelize.org/)
## Walkthru
[Walkthru]https://screencast-o-matic.com/watch/crfecGVVPwX
## Deployment
[Insomnia](https://insomnia.rest/) you must start the server using NPM Start, then use insomnia or another API testing application to pass the variables to the URL's end points.
those being
* /api/categories
* /api/products
* /api/tags
## Questions?
email:(brianflieck@gmail.com)
github:(https://github.com/flieckster/)
|
e892ca6b-0708-4d06-a008-1d8fc6b585cb
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-09-02 02:08:58", "repo_name": "xiaofan797/springcloud_sell_module", "sub_path": "/api-gateway/src/main/java/com/xiaofan/sell/gateway/filter/RateLimitFilter.java", "file_name": "RateLimitFilter.java", "file_ext": "java", "file_size_in_byte": 1096, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "d85fbc0bcfc443fbfc3552dea528b74afab5627c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/xiaofan797/springcloud_sell_module
| 244
|
FILENAME: RateLimitFilter.java
| 0.276691
|
package com.xiaofan.sell.gateway.filter;
import com.google.common.util.concurrent.RateLimiter;
import com.netflix.zuul.ZuulFilter;
import com.xiaofan.sell.gateway.exception.RateLimitException;
import org.springframework.stereotype.Component;
import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.PRE_TYPE;
import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.SERVLET_DETECTION_FILTER_ORDER;
/**
* 限流过滤器
*/
@Component
public class RateLimitFilter extends ZuulFilter {
private final static RateLimiter RATE_LIMITER = RateLimiter.create(10); // 限制每秒不超过10个任务被提交
@Override
public String filterType() {
return PRE_TYPE;
}
@Override
public int filterOrder() {
return SERVLET_DETECTION_FILTER_ORDER - 1;
}
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() {
if(!RATE_LIMITER.tryAcquire()){
throw new RateLimitException();
}
return null;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.