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 |
|---|---|---|---|---|---|---|
376f27ab-53a2-4772-ba77-ad32092c07d5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-07 02:14:42", "repo_name": "Dream-without-trace/topshow", "sub_path": "/service/src/main/java/com/luwei/models/checkIn/CheckIn.java", "file_name": "CheckIn.java", "file_ext": "java", "file_size_in_byte": 1123, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "d49bc3092c23b4b69b8f198339c164644cd279bd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Dream-without-trace/topshow | 287 | FILENAME: CheckIn.java | 0.26588 | package com.luwei.models.checkIn;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
/**
* @program: topshow
* @description: 每日签到
* @author: ZhangHongJie
* @create: 2018-12-04 14:18
**/
@Data
@Entity
public class CheckIn{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer checkInId;
@Column(columnDefinition = "int(11) not null default 0 comment '用户id'")
private Integer userId;
@Column(columnDefinition = "int(11) not null default 0 comment '签到赠送积分'")
private Integer giveIntegral;
@Column(columnDefinition = "int(11) not null default 0 comment '连续签到天数'")
private Integer checkInDate;
@Column(columnDefinition = "int(11) not null default 0 comment '签到时间'")
private Integer checkInTime;
public CheckIn() {
}
public CheckIn(Integer userId, Integer giveIntegral, Integer checkInDate, Integer checkInTime) {
this.userId = userId;
this.giveIntegral = giveIntegral;
this.checkInDate = checkInDate;
this.checkInTime = checkInTime;
}
}
|
4db583d9-a804-4dc4-b9b4-4af31f960664 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-26 14:55:14", "repo_name": "saloni-1907/DrivEase", "sub_path": "/src/main/java/com/drivease/controller/FeedbackController.java", "file_name": "FeedbackController.java", "file_ext": "java", "file_size_in_byte": 987, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "f46920184a853162a2ebce4bc3cbcffaf59d6f0b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/saloni-1907/DrivEase | 175 | FILENAME: FeedbackController.java | 0.286169 | package com.drivease.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import com.drivease.model.UserFeedback;
import com.drivease.service.UserFeedbackService;
@Controller
@RequestMapping("/feedback")
public class FeedbackController {
@Autowired
UserFeedbackService userfeedbackservice;
@RequestMapping("/sendfeedback")
public String sendfeedback(Model model)
{
UserFeedback feedback=new UserFeedback();
model.addAttribute("feedback", feedback);
model.addAttribute("edit",false);
return "usercontactus";
}
@RequestMapping("/savefeedback")
public String saveFeedback(@ModelAttribute("feedback") UserFeedback feedback)
{
userfeedbackservice.addFeedback(feedback);
return "redirect:/feedback/sendfeedback";
}
}
|
28bd929d-5e2d-4a4e-9aae-ab4e2039d6b5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-13 06:51:53", "repo_name": "abekoh/gcp-messaging-sand", "sub_path": "/gcp-messaging-sand-log-sink/src/main/java/jp/abekoh/log/sink/converter/mapstruct/MapStructConverterUtil.java", "file_name": "MapStructConverterUtil.java", "file_ext": "java", "file_size_in_byte": 1034, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "dbfa03634ecd36428edf2e5606c2d2adc942cbb5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/abekoh/gcp-messaging-sand | 239 | FILENAME: MapStructConverterUtil.java | 0.291787 | package jp.abekoh.log.sink.converter.mapstruct;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class MapStructConverterUtil {
private static final Pattern urlPattern = Pattern.compile("(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]");
@SourceTextToUrl
public URL sourceTextToUrl(String sourceText) {
Matcher matcher = urlPattern.matcher(sourceText);
if (matcher.find()) {
try {
return new URL(matcher.group(0));
} catch (MalformedURLException e) {
return null;
}
}
return null;
}
@TimestampMsToPostedTime
public ZonedDateTime timestampMsToPostedTime(String timestampMs) {
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(Long.parseLong(timestampMs)), TimeZone.getTimeZone("UTC").toZoneId());
}
}
|
fe6a8df4-698a-4faf-b8c9-cfc73d61c72e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2011-12-26 08:29:12", "repo_name": "RockychengJson/eclipsender", "sub_path": "/com.ibm.gers.regeditor/src/com/ibm/gers/regeditor/editors/XMLTextDocumentProvider.java", "file_name": "XMLTextDocumentProvider.java", "file_ext": "java", "file_size_in_byte": 1024, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "277bb52f022df0e536beb30c845b1192e50c7127", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/RockychengJson/eclipsender | 192 | FILENAME: XMLTextDocumentProvider.java | 0.247987 | package com.ibm.gers.regeditor.editors;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.rules.FastPartitioner;
import org.eclipse.ui.editors.text.TextFileDocumentProvider;
public class XMLTextDocumentProvider extends TextFileDocumentProvider {
protected FileInfo createFileInfo(Object element) throws CoreException {
FileInfo info = super.createFileInfo(element);
if(info==null){
info = createEmptyFileInfo();
}
IDocument document = info.fTextFileBuffer.getDocument();
if (document != null) {
IDocumentPartitioner partitioner =
new FastPartitioner(
new XMLPartitionScanner(),
new String[] {
XMLPartitionScanner.XML_TAG,
XMLPartitionScanner.XML_COMMENT });
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
}
return info;
}
}
|
6ca0af39-10a0-49b3-a960-ca6cf10e3c00 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-17 15:37:41", "repo_name": "xeema-nobody/prices-exercise", "sub_path": "/src/test/java/com/example/pricesexercise/integration/TestApplicationConfig.java", "file_name": "TestApplicationConfig.java", "file_ext": "java", "file_size_in_byte": 1161, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "64c7dc7b235b32f432a7400af053d59df46c712b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xeema-nobody/prices-exercise | 203 | FILENAME: TestApplicationConfig.java | 0.23793 | package com.example.pricesexercise.integration;
import com.example.pricesexercise.core.infrastructure.repository.InH2Prices;
import com.example.pricesexercise.core.infrastructure.repository.PricesRepository;
import com.zaxxer.hikari.HikariDataSource;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.*;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.test.context.ActiveProfiles;
import javax.sql.DataSource;
@Configuration
@ComponentScan({"com.example.pricesexercise.core", "com.example.pricesexercise.delivery.controller"})
@ActiveProfiles("test")
public class TestApplicationConfig {
@Bean
public PricesRepository pricesRepository(){
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("org.h2.Driver");
dataSource.setUrl("jdbc:h2:file:./data/prod");
dataSource.setUsername("user");
dataSource.setPassword("1234");
return new InH2Prices(dataSource);
}
}
|
ad1d25ad-be00-480b-9ae5-6812e8fd8c48 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-26 02:32:24", "repo_name": "songhaoran/netty-study", "sub_path": "/netty-chat/src/main/java/com/song/server/handler/AuthHandler.java", "file_name": "AuthHandler.java", "file_ext": "java", "file_size_in_byte": 981, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "c013521ef80149e6a2f4dde10f760e7c4fc18338", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/songhaoran/netty-study | 191 | FILENAME: AuthHandler.java | 0.214691 | package com.song.server.handler;
import com.song.util.LoginUtil;
import com.song.util.PacketType;
import com.song.vo.LoginResponsePacket;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
/**
* Created by Song on 2019/09/24.
*/
public class AuthHandler extends ChannelInboundHandlerAdapter {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
if (LoginUtil.isLogin(ctx.channel())) {
ctx.pipeline().remove(this);
super.channelRead(ctx, msg);
} else {
LoginResponsePacket loginResponsePacket = new LoginResponsePacket();
loginResponsePacket.setPacketType(PacketType.login_response);
loginResponsePacket.setIsSuccess(false);
loginResponsePacket.setReason("重新的登录");
ctx.channel().writeAndFlush(loginResponsePacket);
ctx.channel().close();
}
}
}
|
71872a05-6ff7-4346-bb62-dd530419fec6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-08-21T14:18:35", "repo_name": "MisterTeeRoland/Help-Me-Decide", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1162, "line_count": 39, "lang": "en", "doc_type": "text", "blob_id": "577dcab0da40587eadb49dfa2f66fc13ef5ef76a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MisterTeeRoland/Help-Me-Decide | 266 | FILENAME: README.md | 0.252384 | # Help Me Decide (powered by Yelp!)
*Help Me Decide is a web application that, using predefined categories and user selections, helps a user decide what to do or what to eat using the Yelp Fusion API*
### Have you ever been hungry and not known what to eat, or been bored and not known what to do?
## Help Me Decide is your solution.

### Step 1: Pick a category.
Choose between Food, Active Life, Night Life, and Entertainment.
### Step 2: Choose options that sound good.
Select one or select all! (Although you should probably select more than one...)
### Step 3: Let the program help you decide!
Click the button. Simple as that.

Once you're happy with the choice, enter a location near you to get the top 5 local businesses for that category.
You can enter an address, neighborhood, city/state, or zip code.

If you would like to learn more about a business, simply click the name and you will be redirected to that business's official Yelp page.
|
b3f9a167-bd22-4e20-b5c8-9bd2bb9b1047 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-13 16:40:39", "repo_name": "downwine/Java-3-sem", "sub_path": "/src/ru/downwine/_27_TwentyseventhLab/Ex3/SnakeController.java", "file_name": "SnakeController.java", "file_ext": "java", "file_size_in_byte": 1067, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "88a6d9b4a814a730b29a685446055dc88b2c3173", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/downwine/Java-3-sem | 225 | FILENAME: SnakeController.java | 0.288569 | package ru.downwine._27_TwentyseventhLab.Ex3;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.Timer;
public class SnakeController implements KeyListener, ActionListener {
private final SnakeView snakeView;
private final Timer timer;
private final Snake snake;
public SnakeController() {
snake = new Snake();
snakeView = new SnakeView(this);
this.snakeView.addKeyListener(this);
this.timer = new Timer(200, this);
startGame();
}
public void stopGame() {
timer.stop();
}
public void startGame() {
timer.start();
}
public void keyPressed(KeyEvent e) {
snake.onMove(e.getKeyCode());
}
public void keyReleased(KeyEvent e) {
}
public void keyTyped(KeyEvent e) {
}
@Override
public void actionPerformed(ActionEvent arg) {
snakeView.moveForward();
}
public Snake getSnake() {
return snake;
}
}
|
c954aac7-5b0c-4183-9d35-52ea302bdb7f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-19 19:39:40", "repo_name": "Dineshkarri/ADS-2_2019501017", "sub_path": "/DAY1/ASSIGN1/WordNet.java", "file_name": "WordNet.java", "file_ext": "java", "file_size_in_byte": 980, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "086e8bf37361e5b9d1cb4933f578ff783fb1ca14", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Dineshkarri/ADS-2_2019501017 | 242 | FILENAME: WordNet.java | 0.262842 | import java.io.*;
public class WordNet {
public WordNet(String synsets, String hypernyms) throws IOException{
parseSynset(synsets);
parseHypernyms(hypernyms);
}
private void parseSynset(String synsets) throws IOException{
FileReader fr1 = new FileReader(synsets + ".txt");
BufferedReader br = new BufferedReader(fr1);
String i;
while ((i=br.readLine()) != null) {
String arr1[] =i.split(",");
System.out.println(arr1[0]);
}
}
private void parseHypernyms(String hypernyms) throws IOException{
FileReader fr2 = new FileReader( hypernyms + ".txt");
BufferedReader br = new BufferedReader(fr2);
String j;
while ((j=br.readLine()) != null) {
String arr2[] =j.split(",");
System.out.println(arr2);
}
}
public static void main(String[] args) throws IOException{
WordNet Obj = new WordNet("synsets", "hypernyms");
}
} |
22314506-2b76-45ff-864c-99b24519d279 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-05-02T17:35:11", "repo_name": "agzalewska/NASA-picture-of-the-day", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1084, "line_count": 33, "lang": "en", "doc_type": "text", "blob_id": "b7b74c9504d95e5d6d901ff7a1e995063e0acf62", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/agzalewska/NASA-picture-of-the-day | 219 | FILENAME: README.md | 0.275909 | This project uses the popular NASA Astronomy Picture of the Day open API to produce wonderful images with details and lengthy descriptions which the users can scroll through and save to the favorites collection.
Built with vanilla JavaScript, HTML and pure CSS.
Functionality:
🚀 the app displays random Astronomy Pictures formated into cards with an image, title, "add to favorites" star button, description, date and copyright information
🚀 the app displays 10 new images after every loading
🚀 images are lazy-loaded to improve performance - the app will load the image only when it comes close to being scrolled to
🚀 clicking on an image opens the full resolution of that image in a separate tab
🚀 the user can add and remove images to and from the "favorites page," which stores images using local storage
🚀 the app is mobile responsive
The app uses responsive design to be both mobile and desktop friendly.
HTTP Request
GET https://api.nasa.gov/planetary/apod
from:
https://api.nasa.gov/
Live demo:
https://nasa-apod-application.netlify.app/
|
4d1ef6dd-3ab3-4d5f-b4dd-9c233efdb123 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-29 08:37:31", "repo_name": "doudizuczk/-", "sub_path": "/src/com/great/bean/Role.java", "file_name": "Role.java", "file_ext": "java", "file_size_in_byte": 1170, "line_count": 60, "lang": "en", "doc_type": "code", "blob_id": "8afb6f33b07ae0dd54151d9f678ca735941e86b4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "GB18030"} | https://github.com/doudizuczk/- | 283 | FILENAME: Role.java | 0.262842 | package com.great.bean;
import java.io.Serializable;
public class Role implements Serializable {
/**修改
* 角色实体对象 @linanp
*/
private static final long serialVersionUID = 1L;
private int roleId;
private String roleName;
private int roleState;
private String roleCdate;
public Role() {
super();
}
public Role(int roleId, String roleName, int roleState, String roleCdate) {
super();
this.roleId = roleId;
this.roleName = roleName;
this.roleState = roleState;
this.roleCdate = roleCdate;
}
public int getRoleId() {
return roleId;
}
public void setRoleId(int roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public int getRoleState() {
return roleState;
}
public void setRoleState(int roleState) {
this.roleState = roleState;
}
public String getRoleCdate() {
return roleCdate;
}
public void setRoleCdate(String roleCdate) {
this.roleCdate = roleCdate;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
}
|
b886712b-6b31-4108-aa47-b303ca2cf2ee | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-12-17T09:02:18", "repo_name": "Kenan7/bakujobs", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 999, "line_count": 53, "lang": "en", "doc_type": "text", "blob_id": "52000ea5f273c9291c2ce1e5c31a8db620f593ab", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/Kenan7/bakujobs | 232 | FILENAME: README.md | 0.267408 | # Setting Up for Development
* install dependencies (Debian/Ubuntu)
$ sudo apt-get update
$ sudo apt-get install -y gcc python3-dev python3-venv
* prepare directory for project code and virtualenv:
$ mkdir -p ~/webapps
$ cd ~/webapps
* download the project code:
$ git clone https://github.com/Kenan7/bakujobs.git
* go in to the project dir:
$ cd bakujobs
* prepare virtual environment
(with virtualenv you get pip, we'll use it soon to install requirements):
$ python3 -m venv env
$ source env/bin/activate
* install requirements (Django, ...) into virtualenv:
$ pip install -r requirements.txt
* Make migrations:
$ (env) python manage.py makemigrations
* Build the database:
$ (env) python manage.py migrate
* Create a superuser:
$ (env) python manage.py createsuperuser
* Run the development server:
$ (env) python manage.py runserver
|
df1a3b21-e30d-47f1-aea5-7fdccb50f29f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-23 06:22:29", "repo_name": "chrkyrong/WeTao", "sub_path": "/src/main/test/com/weitao/dao/ManageMapperTest.java", "file_name": "ManageMapperTest.java", "file_ext": "java", "file_size_in_byte": 1180, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "3cded21e49d170839dbae69c27c31e3d1ba9b51b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/chrkyrong/WeTao | 283 | FILENAME: ManageMapperTest.java | 0.236516 | package com.weitao.dao;
import com.weitao.bean.Manager;
import com.weitao.utils.MD5;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @Author:Cc
* @Date:2018/10/9
* @program: weitao
* @description: ${测试ManageMapper}
* @create: 2018-10-09 15:18
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class ManageMapperTest {
@Autowired
private ManagerMapper managerMapper;
@Test
public void addManagerTest() throws Exception {
Manager manager = new Manager();
manager.setmPassword(MD5.md5("123456"));
manager.setmAuthority((byte) 0);
managerMapper.addManager(manager);
// 返回添加后的主键
System.out.println(manager.getmId());
}
@Test
public void name() throws Exception {
Integer aa = 0;
if(aa == 1){
System.out.println("dui");
}
else System.out.println(".......");
}
}
|
30f0a9e6-081c-4aeb-bbc8-6878de80d55c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-27 07:48:16", "repo_name": "muthukumaran001/selenium_codes", "sub_path": "/FaceBookTest/src/main/java/com/Fb/Pages/LoginPage.java", "file_name": "LoginPage.java", "file_ext": "java", "file_size_in_byte": 1006, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "41fba774a7197ba95015deaf9ea1fdf5c03cf8f1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/muthukumaran001/selenium_codes | 227 | FILENAME: LoginPage.java | 0.268941 | package com.Fb.Pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.Utilie.Browser_Factory;
import net.bytebuddy.asm.Advice.This;
public class LoginPage extends Browser_Factory {
WebDriver driver;
public LoginPage() {
PageFactory.initElements(driver, This.class);
}
@FindBy(id="u_0_m")
static
WebElement First_Name;
@FindBy(className = "inputtext _58mg _5dba _2ph-")
static
WebElement Last_Name;
@FindBy(xpath = "//input[@id='u_0_r']")
static
WebElement mail_ID;
@FindBy(xpath = "//input[@id='u_0_w']")
static
WebElement password;
public static void LOgIN_DEt() {
First_Name.sendKeys(prop.getProperty("First_Name"));
Last_Name.sendKeys(prop.getProperty("Last_name"));
mail_ID.sendKeys(prop.getProperty("Mail"));
password.sendKeys(prop.getProperty("Pwd"));
}
}
|
c2bf32fc-cdee-492c-9db8-6e7f84703d5b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-19 13:49:56", "repo_name": "WangYouzheng1994/hyjf", "sub_path": "/hyjf-admin/src/main/java/com/hyjf/admin/wkcd/wkcdborrow/WkcdBorrowBean.java", "file_name": "WkcdBorrowBean.java", "file_ext": "java", "file_size_in_byte": 1063, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "86eb868e934e2afc43eab73dc568fca3b424d614", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/WangYouzheng1994/hyjf | 270 | FILENAME: WkcdBorrowBean.java | 0.258326 | package com.hyjf.admin.wkcd.wkcdborrow;
import java.io.Serializable;
import java.util.List;
import com.hyjf.common.paginator.Paginator;
import com.hyjf.mybatis.model.auto.WkcdBorrow;
public class WkcdBorrowBean extends WkcdBorrow implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private List<WkcdBorrow> recordList;
/**
* 翻页机能用的隐藏变量
*/
private int paginatorPage = 1;
/**
* 列表画面自定义标签上的用翻页对象:paginator
*/
private Paginator paginator;
public int getPaginatorPage() {
if (paginatorPage == 0) {
paginatorPage = 1;
}
return paginatorPage;
}
public void setPaginatorPage(int paginatorPage) {
this.paginatorPage = paginatorPage;
}
public Paginator getPaginator() {
return paginator;
}
public void setPaginator(Paginator paginator) {
this.paginator = paginator;
}
public List<WkcdBorrow> getRecordList() {
return recordList;
}
public void setRecordList(List<WkcdBorrow> recordList) {
this.recordList = recordList;
}
}
|
d0a3cc27-40c0-48fa-8c83-486e6f989863 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-12 04:28:15", "repo_name": "Pavithra-cpu/shopping-cart", "sub_path": "/Web Application/05.07.2019/webapps/Shopping/WEB-INF/classes/Writeitem.java", "file_name": "Writeitem.java", "file_ext": "java", "file_size_in_byte": 1053, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "015000d1be696944e2348a15a0adfd27eee1aab8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Pavithra-cpu/shopping-cart | 193 | FILENAME: Writeitem.java | 0.275909 | import java.io.*;
import java.util.*;
import queryclass.Query;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Writeitem extends HttpServlet{
protected void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException, IOException
{
int bitid = Integer.parseInt(request.getParameter("it"));
HttpSession session = request.getSession();
int uid = (Integer) session.getAttribute("uid");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println(bitid+""+uid);
try{
Query Q = new Query();
Q.writeitem(uid,bitid);
}
catch(Exception ex){
out.println(ex);
ex.printStackTrace();
}
RequestDispatcher rd = request.getRequestDispatcher("DispitemU");
rd.include(request,response);
out.close();
}
}
|
85e84a63-686c-401e-a1e8-ad5f4f8c7a88 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-18T00:02:21", "repo_name": "kanonier14/questionnaire", "sub_path": "/src/main/java/com/questionnaire/entity/results/Question.java", "file_name": "Question.java", "file_ext": "java", "file_size_in_byte": 1161, "line_count": 62, "lang": "en", "doc_type": "code", "blob_id": "54804a2b10e1c204693c013a94e3fad06ba2bedf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kanonier14/questionnaire | 254 | FILENAME: Question.java | 0.243642 | package com.questionnaire.entity.results;
import com.questionnaire.core.QuestionType;
import java.util.List;
/**
* Created by Igor on 21.11.2016.
*/
public class Question {
private String id;
private String title;
private QuestionType questionType;
private List<Answer> answers;
private List<String> openAnswers;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List<Answer> getAnswers() {
return answers;
}
public void setAnswers(List<Answer> answers) {
this.answers = answers;
}
public QuestionType getQuestionType() {
return questionType;
}
public void setQuestionType(QuestionType questionType) {
this.questionType = questionType;
}
public Question() {
}
public List<String> getOpenAnswers() {
return openAnswers;
}
public void setOpenAnswers(List<String> openAnswers) {
this.openAnswers = openAnswers;
}
}
|
2cca81be-54a0-4e96-8aa9-a1a2564268d5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-11 21:13:56", "repo_name": "Cristian-Sknz/MyAniList-API", "sub_path": "/src/main/java/me/skiincraft/mal/entity/experimental/top/TopType.java", "file_name": "TopType.java", "file_ext": "java", "file_size_in_byte": 964, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "befed9771c950a7d9d5221b06b9579421fd563b8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Cristian-Sknz/MyAniList-API | 249 | FILENAME: TopType.java | 0.242206 | package me.skiincraft.mal.entity.experimental.top;
import me.skiincraft.mal.MyAnimeList;
public enum TopType {
Airing("Top Airing","?type=airing"),
Upcoming("Top Upcoming","?type=upcoming"),
TV_Series("Top TV Series","?type=tv"),
Movies("Top Movies","?type=movie"),
OVAs("Top OVAs","?type=ova"),
ONAs("Top ONAs","?type=ona"),
Special("Top Specials","?type=special"),
Most_Popular("Most Popular","?type=bypopularity"),
Most_Favorited("Most Favorited","?type=favorite");
private static final String TOP_URL = MyAnimeList.SITE_URL + "topanime.php";
private final String name;
private final String endpoint;
TopType(String name, String endpoint) {
this.name = name;
this.endpoint = endpoint;
}
public String getEndpoint() {
return endpoint;
}
public String getURL() {
return TOP_URL + endpoint;
}
public String getName() {
return name;
}
}
|
610fbf6c-81f1-4331-a978-527c5e4979f2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-27 06:21:30", "repo_name": "cow-boy/spring-boot-samples", "sub_path": "/spring-boot-samples-aspect/src/main/java/com/example/demo/TestAspect.java", "file_name": "TestAspect.java", "file_ext": "java", "file_size_in_byte": 1117, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "55f3e0594703443b5d93a32d323ae26ee17ecf57", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/cow-boy/spring-boot-samples | 254 | FILENAME: TestAspect.java | 0.261331 | package com.example.demo;
import io.swagger.annotations.Api;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
* AOP方法级
*
* @author huxu
* @create 2017-08-05 16:14
**/
@Aspect // FOR AOP
@Order(-99) // 控制多个Aspect的执行顺序,越小越先执行
@Component
public class TestAspect {
private Logger LOG = LoggerFactory.getLogger(this.getClass());
@Before("@annotation(test)")// 拦截被TestAnnotation注解的方法;如果你需要拦截指定package指定规则名称的方法,可以使用表达式execution(...)
public void beforeTest(JoinPoint point, TestAnnotation test) throws Throwable {
LOG.info("beforeTest:{}",test.name());
}
@After("@annotation(test)")
public void afterTest(JoinPoint point, TestAnnotation test) {
LOG.info("afterTest:{}",test.name());
}
}
|
09ffac37-e009-486d-ad59-3c25910a5ff9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-02-01T19:08:41", "repo_name": "chenhaihong/smash-cli", "sub_path": "/RepoDocusaurus/docs/examples/usage/using-a-template.md", "file_name": "using-a-template.md", "file_ext": "md", "file_size_in_byte": 982, "line_count": 57, "lang": "en", "doc_type": "text", "blob_id": "a1b4be16d882bb09d28a9434e835663e1f1ca506", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/chenhaihong/smash-cli | 251 | FILENAME: using-a-template.md | 0.275909 | ---
title: Using a template
sidebar_label: Using a template
---
We are going to download `smash-template-react` and run the `dev-server` task on it.
> Make sure you have installed `smash-cli`.
## Download it first
```bash
$ mkdir demo && cd demo
$ smash download smash-template-react
```
Don't forget to install its own dependencies.
```bash
$ npm i
```
## How to use?
### Read the `.smash/task.yml`
Here is what `.smash/task.yml` looks like:
```yaml
# Start webpack-dev-server
dev-server:
- name: smash-middleware-webpack-v4
type: dev-server
```
We can find a task named `dev-server`. And a middleware named `smash-middleware-webpack-v4` was used in it.
### Install middleware
Run the command below to install the middleware.
```bash
$ smash install
```
### Run a task
Now, run the `dev-server` task:
```bash
$ smash run dev-server
```
It starts the webpack-dev-server. A few minutes later, you will see a page opened in your browser.
OK! You finished it.
|
015a7e02-f97b-40b5-aed9-c227b5ba5381 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-06 06:52:21", "repo_name": "raika11/-", "sub_path": "/moka-common/moka-common-template/src/main/java/jmnet/moka/common/template/merge/TreeNode.java", "file_name": "TreeNode.java", "file_ext": "java", "file_size_in_byte": 1201, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "2b4e7800ac74ff46eb8f574b6fca4cf73b3b1578", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/raika11/- | 287 | FILENAME: TreeNode.java | 0.272799 | package jmnet.moka.common.template.merge;
import java.util.ArrayList;
import java.util.List;
import jmnet.moka.common.template.parse.model.TemplateElement;
/**
*
* <pre>
* 템플릿 관계 tree를 생성하기 위한 Tree Node 표현
* 2019. 9. 4. kspark 최초생성
* </pre>
* @since 2019. 9. 4. 오후 6:04:45
* @author kspark
*/
public class TreeNode {
private TemplateElement templateElement;
private TreeNode parentNode;
private List<TreeNode> children;
public TreeNode(TemplateElement templateElement) {
this.templateElement = templateElement;
}
public TreeNode(TreeNode parentNode, TemplateElement templateElement) {
this.parentNode = parentNode;
this.templateElement = templateElement;
}
public void addChild(TreeNode childNode) {
if ( children == null) {
children = new ArrayList<TreeNode>();
}
children.add(childNode);
}
public TemplateElement getTemplateElement() {
return templateElement;
}
public boolean hasParent() {
return parentNode != null;
}
public TreeNode getParent() {
return parentNode;
}
public List<TreeNode> getChildren() {
return children;
}
public boolean hasChild() {
return this.children != null;
}
}
|
dff6e1f5-71d4-43b0-b8c0-f867b7c85473 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-07 18:30:30", "repo_name": "kldfsa/AliMsg", "sub_path": "/src/main/java/cn/cookily/msg/util/SendMsg.java", "file_name": "SendMsg.java", "file_ext": "java", "file_size_in_byte": 1333, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "3aee93de39ac1971d348d44ebb37aed18dcb3672", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kldfsa/AliMsg | 341 | FILENAME: SendMsg.java | 0.258326 | package cn.cookily.msg.util;
import com.taobao.api.ApiException;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.AlibabaAliqinFcSmsNumSendRequest;
import com.taobao.api.response.AlibabaAliqinFcSmsNumSendResponse;
/**
* Created by cookily on 2017/5/8.
*/
public class SendMsg {
public void sendMsg() throws ApiException {
String serverUrl="http://gw.api.taobao.com/router/rest";
String appKey="后台可以查看appKey";
String appSecret="后台可以查看appSecret";
TaobaoClient client=new DefaultTaobaoClient(serverUrl, appKey, appSecret);
AlibabaAliqinFcSmsNumSendRequest req=new AlibabaAliqinFcSmsNumSendRequest();
//req.setExtend("12345回传");//待测 可选
req.setSmsType("normal");//短信类型 必须
req.setSmsFreeSignName("短信签名");// 必须
req.setSmsParamString("{\"userName\":\"通知的消息名\",\"code\":\"验证码\"}");//json格式的短信模板的变量,多个变量括号隔开 可选
req.setRecNum("接收的手机号码");//接收的手机号码 必须
req.setSmsTemplateCode("短信模板id");//短信模板id 必须
AlibabaAliqinFcSmsNumSendResponse rsp= client.execute(req);
System.out.println(rsp.getBody());
}
}
|
baf0253d-42ff-4f8a-98b0-aac854aaaf00 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-07 10:52:24", "repo_name": "NguyenKhacLam/fabulous", "sub_path": "/app/src/main/java/com/project/fabulous/api/ApiBuilder.java", "file_name": "ApiBuilder.java", "file_ext": "java", "file_size_in_byte": 1008, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "38b7879ec68abd2972225b861c0c62ab30acd0fe", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/NguyenKhacLam/fabulous | 181 | FILENAME: ApiBuilder.java | 0.274351 | package com.project.fabulous.api;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ApiBuilder {
private static Api api;
public static Api getInstance(){
Gson gson = new GsonBuilder().setLenient().create();
if (api == null){
// HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
// interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
// OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
api = new Retrofit.Builder()
.baseUrl("https://us-central1-fabulous-journey.cloudfunctions.net/api/")
.addConverterFactory(GsonConverterFactory.create(gson))
.build()
.create(Api.class);
}
return api;
}
}
|
bc49007e-5b11-493e-914d-1d85954837a3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-25 05:52:23", "repo_name": "Devendra015/Release", "sub_path": "/src/MultipleWindows.java", "file_name": "MultipleWindows.java", "file_ext": "java", "file_size_in_byte": 1032, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "f7b903ab043186bed18e8b4af6bdc084d76a01af", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Devendra015/Release | 227 | FILENAME: MultipleWindows.java | 0.295027 | import java.util.Iterator;
import java.util.Set;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class MultipleWindows {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver",
"C:\\Users\\devendra.swarnkar\\Desktop\\Selenium WebDriver with Java\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://the-internet.herokuapp.com/");
driver.findElement(By.xpath("//a[@href='/windows']")).click();
driver.findElement(By.xpath("//a[@href='/windows/new']")).click();
Set<String> ids = driver.getWindowHandles();
Iterator<String> id = ids.iterator();
String partntId = id.next();
String childId = id.next();
driver.switchTo().window(childId);
System.out.println(driver.findElement(By.xpath("//div[@class='example']/h3")).getText());
driver.switchTo().window(partntId);
System.out.println(driver.findElement(By.xpath("//div[@class='example']/h3")).getText());
}
}
|
0428f5ed-593c-402e-b903-d666e866b2df | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-16 09:06:05", "repo_name": "kardidev/poc-service-probes-consumer", "sub_path": "/src/main/java/com/kardidev/poc/cloud/probes/consumer/service/load/LoadService.java", "file_name": "LoadService.java", "file_ext": "java", "file_size_in_byte": 1055, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "03d4192d014e1c014b8eb0c9919584581c8317c2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kardidev/poc-service-probes-consumer | 208 | FILENAME: LoadService.java | 0.264358 | package com.kardidev.poc.cloud.probes.consumer.service.load;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
@Component
public class LoadService {
private final RestTemplate restTemplate;
public LoadService(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
/**
* Call a frontservice REST point to add a task with a given weight
*
* @param podIP target pod IP
* @param weight a weight it's supposed to be load with in milliseconds
*/
public void load(String podIP, int weight) {
String url = String.format("http://%s:8080/frontservice/process?weight=%d", podIP, weight);
ResponseEntity<Object> responseEntity = restTemplate.getForEntity(url, Object.class);
if (responseEntity.getStatusCode() != HttpStatus.ACCEPTED)
throw new RuntimeException("Unexpected response from frontend service");
}
}
|
8b720bfd-58df-47a6-9328-eff29fa44157 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-20T08:22:00", "repo_name": "didinem/dmfqa", "sub_path": "/src/test/java/org/didinem/ZkTest.java", "file_name": "ZkTest.java", "file_ext": "java", "file_size_in_byte": 975, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "1afec7ce37dad2388f3e7aa949ae0e83b44ae604", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/didinem/dmfqa | 214 | FILENAME: ZkTest.java | 0.214691 | package org.didinem;
import org.I0Itec.zkclient.ZkClient;
import org.apache.commons.lang3.StringUtils;
import org.didinem.sprops.DubboProperties;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* Created by zhongzhengmin on 2017/3/10.
*/
public class ZkTest {
@Autowired
private DubboProperties dubboProperties;
@Autowired
private ZkClient zkClient;
public void test1() {
String internalClassName = "com/lvmama/vst/api/biz/service/VstDistrictService";
String interfaceName = internalClassName.replaceAll("/", "\\.");
String providerPath = dubboProperties.getSeperator() + StringUtils.joinWith(dubboProperties.getSeperator(), dubboProperties.getRoot(), interfaceName, dubboProperties.getProvider());
List<String> providerUrlList = zkClient.getChildren(providerPath);
for (String string : providerUrlList) {
System.out.println(string);
}
}
}
|
ce9ebe49-1abe-402f-a5ee-45193c7f66a6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-02-25 04:13:23", "repo_name": "basecampstartup/sharpNodeAndroid", "sub_path": "/app/src/main/java/com/sharpnode/adapter/DeviceDashboardPagerAdaper.java", "file_name": "DeviceDashboardPagerAdaper.java", "file_ext": "java", "file_size_in_byte": 991, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "4ebc24a86fde78235d793ae674eab7ac06be1caa", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/basecampstartup/sharpNodeAndroid | 200 | FILENAME: DeviceDashboardPagerAdaper.java | 0.249447 | package com.sharpnode.adapter;
import android.content.Context;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.sharpnode.DeviceDashboardFragment;
/**
* Created by admin on 12/8/2016.
*/
public class DeviceDashboardPagerAdaper extends FragmentPagerAdapter {
private Context _context;
public static int totalPage = 1;
public DeviceDashboardPagerAdaper(Context context, FragmentManager fm) {
super(fm);
_context = context;
}
@Override
public DeviceDashboardFragment getItem(int position) {
DeviceDashboardFragment f = new DeviceDashboardFragment();
switch (position) {
case 0:
f = new DeviceDashboardFragment();
break;
/*case 1:
f = new DeviceDashboardFragment();
break;*/
}
return f;
}
@Override
public int getCount() {
return totalPage;
}
} |
ce381190-ff62-4766-9a16-0d179c161645 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-21 02:34:30", "repo_name": "fangls/simple-seckill", "sub_path": "/src/test/java/com/fang/seckill/queue/KafkaQueueTests.java", "file_name": "KafkaQueueTests.java", "file_ext": "java", "file_size_in_byte": 1188, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "961771bc363b4c0d872bbbdd8859586014a68c21", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/fangls/simple-seckill | 280 | FILENAME: KafkaQueueTests.java | 0.289372 | package com.fang.seckill.queue;
import com.fang.seckill.BaseTests;
import com.fang.seckill.consumer.KafkaQueueConsumer;
import com.fang.seckill.entity.GoodsDO;
import lombok.extern.slf4j.Slf4j;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.stream.IntStream;
/**
* Description:基于kafka的分布式队列
*
* @author fangliangsheng
* @date 2018/12/19
*/
@Slf4j
public class KafkaQueueTests extends BaseTests {
@Autowired
private KafkaTemplate<String,String> kafkaTemplate;
@Test
public void kafkaQueue() throws Exception{
IntStream.range(0, 1000).parallel().forEach(i->{
kafkaTemplate.send("seckill.queue", super.GOODS_ID.toString());
});
KafkaQueueConsumer.downLatch.await(2000, TimeUnit.MILLISECONDS);
Optional<GoodsDO> goodsDO = goodsRepository.findById(GOODS_ID);
log.info("[kafkaQueue]剩余数量 {}", goodsDO.get().getNumber());
Assert.assertTrue(goodsDO.get().getNumber() == 0);
}
}
|
9c92d2fd-4034-4bca-8031-5eb96ef3508a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-11-12 20:31:17", "repo_name": "TheSchnoo/CourseAuditServer", "sub_path": "/src/web/CourseConverter.java", "file_name": "CourseConverter.java", "file_ext": "java", "file_size_in_byte": 973, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "51a4f716c85460cd9f0fe9d3c73d79e7163fc73b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/TheSchnoo/CourseAuditServer | 178 | FILENAME: CourseConverter.java | 0.258326 | package web;
import org.json.JSONObject;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* Apathetic spawn of Wesb on 11/11/16.
*/
public class CourseConverter {
public List<Course> convertResultSetToCourseList(ResultSet resultSet) {
List<Course> courseList = new ArrayList<>();
try {
while(resultSet.next()){
String code = resultSet.getString("Code");
int number = resultSet.getInt("Number");
String name = resultSet.getString("Name");
String description = resultSet.getString("Description");
int credits = resultSet.getInt("Credits");
Course course = new Course(code, number, name, description, credits);
courseList.add(course);
}
} catch (SQLException e) {
e.printStackTrace();
}
return courseList;
}
}
|
4f2846c3-2fc8-41c7-8d6a-cebad0002118 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-09 05:51:03", "repo_name": "Novthirteen/esupply-yfkey", "sub_path": "/src/main/java/com/yfkey/webapp/filter/ThemeFilter.java", "file_name": "ThemeFilter.java", "file_ext": "java", "file_size_in_byte": 1027, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "dbde3ceb0ec32445cbd41e9a46aad448b9f05a2a", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/Novthirteen/esupply-yfkey | 188 | FILENAME: ThemeFilter.java | 0.23231 | package com.yfkey.webapp.filter;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.hibernate.internal.util.StringHelper;
import org.springframework.web.filter.OncePerRequestFilter;
import com.yfkey.Constants;
/**
* Filter to wrap request with a request including user preferred locale.
*/
public class ThemeFilter extends OncePerRequestFilter {
@SuppressWarnings("unchecked")
public void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws IOException, ServletException {
String theme = request.getParameter(Constants.BOOTSTRAP_THEME);
if (StringHelper.isNotEmpty(theme)) {
HttpSession session = request.getSession(false);
if (session != null) {
session.setAttribute(Constants.BOOTSTRAP_THEME, theme);
}
}
chain.doFilter(request, response);
}
}
|
d1f4331d-cb7d-4b3a-9f8b-efb48f5257d5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-12 07:36:00", "repo_name": "jzykk/erp", "sub_path": "/erp/src/com/company/bean/Decorate.java", "file_name": "Decorate.java", "file_ext": "java", "file_size_in_byte": 1044, "line_count": 71, "lang": "en", "doc_type": "code", "blob_id": "73d35c59d2922d8028e5691d558e8ccbd4fe39d1", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jzykk/erp | 288 | FILENAME: Decorate.java | 0.258326 | package com.company.bean;
/**
* @author Davi
* @category 装潢件信息表
*/
public class Decorate {
/**
* 商品编号
*/
private int spid;
/**
* 装潢名称
*/
private String decoratename;
/**
* 类型Id
*/
private int typeid;
/**
* 装潢 编号
*/
private int id;
public int getSpid() {
return spid;
}
public void setSpid(int spid) {
this.spid = spid;
}
public String getDecoratename() {
return decoratename;
}
public void setDecoratename(String decoratename) {
this.decoratename = decoratename;
}
public int getTypeid() {
return typeid;
}
public void setTypeid(int typeid) {
this.typeid = typeid;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Decorate(int spid, String decoratename, int typeid, int id) {
super();
this.spid = spid;
this.decoratename = decoratename;
this.typeid = typeid;
this.id = id;
}
public Decorate() {
super();
}
}
|
2611d037-8326-4e01-9e52-ada91fcd7a13 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-02-19 06:27:04", "repo_name": "rivkaer/WhisperServer", "sub_path": "/src/main/java/com/bloodsport/whisper/feature/encrypt/EncryptionController.java", "file_name": "EncryptionController.java", "file_ext": "java", "file_size_in_byte": 1180, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "bfff1194ff91a5517a31af32d42658e732569eb6", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rivkaer/WhisperServer | 265 | FILENAME: EncryptionController.java | 0.233706 | package com.bloodsport.whisper.feature.encrypt;
import com.bloodsport.whisper.core.annotation.ResultSkip;
import com.bloodsport.whisper.core.annotation.SecurityParameter;
import com.bloodsport.whisper.model.pojo.PublicKeyDTO;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>@ProjectName: WhisperServer</p>
* <p>@ClassName: EncryptionController</p>
* <p>@PackageName: com.bloodsport.whisper.feature.encrypt</p>
* <b>
* <p>@Description: 加密解密功能控制器</p>
* </b>
* <p>@author: lumo</p>
* <p>@date: 2019/12/16</p>
* <p>@email: cnrivkaer@outlook.com</p>
*/
@RestController
@RequestMapping(value = "/encrypt")
public class EncryptionController {
@Value("${encryption.publicKey}")
String publicKey;
@SecurityParameter
@ResultSkip
@GetMapping(value = "/fetchPublicKey")
public PublicKeyDTO fetchPublicKey(){
return new PublicKeyDTO(publicKey.replaceAll("\\\\", ""));
}
}
|
8210fbbc-e517-496f-b28d-0ebfe1bb5377 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-24 09:20:33", "repo_name": "zchLee/WebProject", "sub_path": "/src/com/lea/servlet/expand/listener/AttributeListenerServlet.java", "file_name": "AttributeListenerServlet.java", "file_ext": "java", "file_size_in_byte": 1083, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "ab40a8ed4a4fc21769e710964971edfc98e5571a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zchLee/WebProject | 209 | FILENAME: AttributeListenerServlet.java | 0.23793 | package com.lea.servlet.expand.listener;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author lzc
* @create 2020/09/23 下午 2:34
*/
@WebServlet("/listener/contextAttribute")
public class AttributeListenerServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
ServletContext context = req.getServletContext();
// 添加数据
context.setAttribute("liam", "get chicken");
// 更新数据
context.setAttribute("liam", "get much beef");
// 添加一条新数据
context.setAttribute("qiqi", "how are you?");
// 删除数据
context.removeAttribute("liam"); // 刚开始时,liam写错了,所有没有删除成功,就没有触发删除监听器方法
}
}
|
12d6f125-079c-4b87-805c-2a2c8765ff9f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-24 13:37:11", "repo_name": "IntelliQ/Android", "sub_path": "/IntelliQ/backend/src/main/java/com/intelliq/appengine/api/PermissionSet.java", "file_name": "PermissionSet.java", "file_ext": "java", "file_size_in_byte": 988, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "a9ef1d1dd7d442911d9e05c062038e38a32bc95f", "star_events_count": 0, "fork_events_count": 3, "src_encoding": "UTF-8"} | https://github.com/IntelliQ/Android | 202 | FILENAME: PermissionSet.java | 0.228156 | package com.intelliq.appengine.api;
import com.intelliq.appengine.datastore.entries.PermissionEntry;
import java.util.ArrayList;
import java.util.List;
public class PermissionSet {
public static final byte REQUIRE_ANY = 0;
public static final byte REQUIRE_ALL = 1;
private List<PermissionEntry> permissions;
private byte mode;
public PermissionSet() {
super();
this.permissions = new ArrayList<PermissionEntry>();
this.mode = REQUIRE_ANY;
}
public PermissionSet(List<PermissionEntry> permissions, byte mode) {
super();
this.permissions = permissions;
this.mode = mode;
}
public List<PermissionEntry> getPermissions() {
return permissions;
}
public void setPermissions(List<PermissionEntry> permissions) {
this.permissions = permissions;
}
public byte getMode() {
return mode;
}
public void setMode(byte mode) {
this.mode = mode;
}
}
|
39208849-c64c-423a-b226-c49c93ac5900 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-19T17:27:22", "repo_name": "mstepovanyy/PQC", "sub_path": "/src/main/java/com/stepomy/core/consumer/Consumer.java", "file_name": "Consumer.java", "file_ext": "java", "file_size_in_byte": 1053, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "f8bc0e17592c174cc66122e7fea89631f6e9d21b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mstepovanyy/PQC | 196 | FILENAME: Consumer.java | 0.286169 | package com.stepomy.core.consumer;
import com.stepomy.core.Configuration;
import com.stepomy.core.QueueItem;
import java.util.Timer;
import java.util.concurrent.*;
import java.util.stream.IntStream;
public class Consumer {
private LinkedBlockingQueue<QueueItem> queue = new LinkedBlockingQueue<>(Configuration.CONSUMER_WORKERS);
private Timer messageScheduler;
private ExecutorService executorService;
public void processMessage() {
System.out.println("Consumer:processMessage");
startMessageScheduler();
startMessageProcess();
}
void startMessageScheduler() {
messageScheduler = new Timer();
messageScheduler.schedule(new MessageFetch(queue), 0, Configuration.CONSUMER_POOLING_TIME);
}
void startMessageProcess() {
executorService = Executors.newFixedThreadPool(Configuration.CONSUMER_WORKERS);
IntStream
.range(0, Configuration.CONSUMER_WORKERS)
.forEach( it -> executorService.submit(new MessageProcess(queue)));
}
}
|
27193e32-c2bd-48bb-ae5c-c652a4007f59 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-28 03:23:55", "repo_name": "xcpxcp198608/BPlay", "sub_path": "/app/src/main/java/com/wiatec/bplay/utils/OkHttp/Request/PostRequest.java", "file_name": "PostRequest.java", "file_ext": "java", "file_size_in_byte": 1075, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "8603051efd6e9e6f9778815c6f624a0860e55a26", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xcpxcp198608/BPlay | 217 | FILENAME: PostRequest.java | 0.288569 | package com.wiatec.bplay.utils.OkHttp.Request;
import java.util.Map;
import okhttp3.FormBody;
import okhttp3.Headers;
import okhttp3.Request;
/**
* Created by patrick on 2016/12/23.
*/
public class PostRequest extends RequestMaster {
private String url;
public PostRequest (String url){
this.url = url;
}
@Override
protected Request createRequest(Header header, Parameters parameters ,Object tag) {
Request.Builder builder = new Request.Builder();
if(header != null){
Headers headers = Headers.of(header.stringMap);
builder.headers(headers);
}
if(parameters != null){
FormBody.Builder builder1 = new FormBody.Builder();
for (Map.Entry<String ,String > entry : parameters.stringMap.entrySet()){
builder1.add(entry.getKey() ,entry.getValue());
}
builder.post(builder1.build());
}
if(tag != null){
builder.tag(tag);
}
builder.url(url);
return builder.build();
}
}
|
62d561c2-61a5-4ad1-ad3e-f072f4a173fc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-12-05 13:53:50", "repo_name": "PhoenixNest/Aurora", "sub_path": "/app/src/main/java/com/dev/aurora/utils/LazyFragment.java", "file_name": "LazyFragment.java", "file_ext": "java", "file_size_in_byte": 1162, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "ec74842bcbaffdddfa5bfb8cd9fefc500847eafd", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/PhoenixNest/Aurora | 201 | FILENAME: LazyFragment.java | 0.256832 | package com.dev.aurora.utils;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
public abstract class LazyFragment extends Fragment {
private Context context;
private boolean isFirstLoad = true;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context = requireActivity();
}
protected abstract int getContentViewId();
protected abstract void initData();
protected abstract void initEvent();
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return LayoutInflater.from(context).inflate(getContentViewId(), null);
}
@Override
public void onResume() {
super.onResume();
if (isFirstLoad) {
initData();
initEvent();
isFirstLoad = false;
}
}
}
|
8f6b64ec-bff2-429c-b7ce-046b34a75a12 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-06 11:31:45", "repo_name": "prifkywahyu/aquafish", "sub_path": "/app/src/main/java/com/mobile/aquafish/SharedPreferences.java", "file_name": "SharedPreferences.java", "file_ext": "java", "file_size_in_byte": 1161, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "66e1249dd62a6ca409811e92b7cdb17da089a337", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/prifkywahyu/aquafish | 229 | FILENAME: SharedPreferences.java | 0.255344 | package com.mobile.aquafish;
import android.content.Context;
import static android.content.Context.MODE_PRIVATE;
public class SharedPreferences {
private static final String AQUAFISH_APP = "aquafishApp";
static final String AQUA_CODE = "aquaCode";
static final String AQUA_NAME = "nameUser";
private android.content.SharedPreferences preferences;
private android.content.SharedPreferences.Editor editor;
public SharedPreferences(Context context) {
preferences = context.getSharedPreferences(AQUAFISH_APP, MODE_PRIVATE);
editor = preferences.edit();
editor.apply();
}
public void deleteValue() {
editor.clear();
editor.commit();
}
public void saveStringCode(String key, String value) {
editor.putString(key, value);
editor.commit();
}
public void saveStringName(String key, String value) {
editor.putString(key, value);
editor.commit();
}
public String getAquaCode() {
return preferences.getString(AQUA_CODE, "");
}
public String getAquaName() {
return preferences.getString(AQUA_NAME, "");
}
}
|
e731f292-7ca4-435d-84da-eefdf295249c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-06-16 08:10:29", "repo_name": "OpenConext/OpenConext-pdp", "sub_path": "/pdp-server/src/test/java/pdp/access/BasicAuthenticationManagerTest.java", "file_name": "BasicAuthenticationManagerTest.java", "file_ext": "java", "file_size_in_byte": 1230, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "968ce2cf14b7daf1703c559b9ca057bd66b77bd9", "star_events_count": 8, "fork_events_count": 13, "src_encoding": "UTF-8"} | https://github.com/OpenConext/OpenConext-pdp | 197 | FILENAME: BasicAuthenticationManagerTest.java | 0.255344 | package pdp.access;
import org.junit.Test;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.TestingAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import static org.junit.Assert.assertEquals;
public class BasicAuthenticationManagerTest {
private BasicAuthenticationProvider manager = new BasicAuthenticationProvider("user", "password");
@Test
public void testAuthenticateHappyFlow() throws Exception {
Authentication authenticate = manager.authenticate(new TestingAuthenticationToken("user", "password"));
assertEquals("[ROLE_USER, ROLE_PEP]", authenticate.getAuthorities().toString());
}
@Test(expected = UsernameNotFoundException.class)
public void testAuthenticateUsername() throws Exception {
manager.authenticate(new TestingAuthenticationToken("unknown", "password"));
}
@Test(expected = BadCredentialsException.class)
public void testAuthenticateBadCredentials() throws Exception {
manager.authenticate(new TestingAuthenticationToken("user", "faulty"));
}
} |
a4be60ed-a18d-4c90-887e-5a78d9178705 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-25 04:48:10", "repo_name": "Tushar-W/CRUD-Operation-In-SpringBoot", "sub_path": "/src/main/java/com/bl/springboot/controller/ProductController.java", "file_name": "ProductController.java", "file_ext": "java", "file_size_in_byte": 1036, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "bab0d69a29bdd82beec326e51a8eed948a6f4047", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Tushar-W/CRUD-Operation-In-SpringBoot | 190 | FILENAME: ProductController.java | 0.26588 | package com.bl.springboot.controller;
import com.bl.springboot.model.Product;
import com.bl.springboot.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
public class ProductController {
@Autowired
private ProductService service;
@GetMapping("/products")
public List<Product> list(){
return service.listAll();
}
@GetMapping("/products/{id}")
public Product get(@PathVariable Integer id){
return service.get(id);
}
@PostMapping("/products")
public void add(@RequestBody Product product){
service.save(product);
}
@PutMapping("/products/{id}")
public void update(@RequestBody Product product, @PathVariable Integer id){
Product existProduct = service.get(id);
service.save(product);
}
@DeleteMapping("/products/{id}")
public void delete(@PathVariable Integer id){
service.delete(id);
}
}
|
0fee8b59-1adb-427d-8432-e84747d66aca | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-20 08:10:19", "repo_name": "gaofeifan/linkemore", "sub_path": "/ops-server/src/main/java/cn/linkmore/ops/biz/controller/ReceiveController.java", "file_name": "ReceiveController.java", "file_ext": "java", "file_size_in_byte": 1177, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "912dd4e544848f9b580d1d84556d695d9c201461", "star_events_count": 1, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/gaofeifan/linkemore | 225 | FILENAME: ReceiveController.java | 0.229535 | package cn.linkmore.ops.biz.controller;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.linkmore.bean.view.ViewPage;
import cn.linkmore.bean.view.ViewPageable;
import cn.linkmore.ops.biz.service.ReceiveService;
/**
* 领券记录
* @author GFF
* @Date 2018年5月30日
* @Version v2.0
*/
@Controller
@RequestMapping("/admin/biz_receive")
public class ReceiveController {
@Resource
private ReceiveService receiveService;
@RequestMapping(value = "/list", method = RequestMethod.POST)
@ResponseBody
public ViewPage list(HttpServletRequest request, ViewPageable pageable) {
return receiveService.findPage(pageable);
}
@RequestMapping(value = "/detailList", method = RequestMethod.POST)
@ResponseBody
public ViewPage detailList(HttpServletRequest request, ViewPageable pageable) {
return receiveService.findDetailPage(pageable);
}
}
|
1a7c5f1d-6578-4842-b823-5d6062692c7e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-07-07 17:38:33", "repo_name": "rajeshk486/Data_Structure_stuffs", "sub_path": "/leetcode/InvertBinaryTree.java", "file_name": "InvertBinaryTree.java", "file_ext": "java", "file_size_in_byte": 986, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "f4d5a411709c10ee02ec31facb6a7d091eeee482", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rajeshk486/Data_Structure_stuffs | 212 | FILENAME: InvertBinaryTree.java | 0.279828 | package com.parkinglot.design.ProblemSolving;
public class InvertBinaryTree {
static boolean isSymmetric(Node root)
{
return true;
}
public static void inorderTraversal(Node root)
{
if(root == null)
return;
inorderTraversal(root.left);
System.out.print(root.key+" ");
inorderTraversal(root.right);
}
public static void main(String args[])
{
BinaryTree tree = new BinaryTree();
tree.root = new Node(1);
tree.root.left = new Node(2);
tree.root.right = new Node(2);
tree.root.left.left = new Node(3);
tree.root.left.right = new Node(4);
tree.root.right.left = new Node(4);
tree.root.right.right = new Node(3);
boolean output = isSymmetric(tree.root);
if (output == true)
System.out.println("Symmetric");
else
System.out.println("Not symmetric");
inorderTraversal(tree.root);
}
}
|
6661bee3-ee09-450e-a967-25314b3d1dce | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-05 09:31:24", "repo_name": "tomingerson/concurrency_demo", "sub_path": "/src/test/java/concurrency/motivation/Example3_AppleShopTest.java", "file_name": "Example3_AppleShopTest.java", "file_ext": "java", "file_size_in_byte": 1080, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "b65bb1ecab219980c86d9e0ce73915d21ca49187", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tomingerson/concurrency_demo | 210 | FILENAME: Example3_AppleShopTest.java | 0.268941 | package concurrency.motivation;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import static org.hamcrest.Matchers.is;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* @author Created by tom on 03.06.2017.
*/
@WebMvcTest(controllers = {Example3_AppleShop.class})
@RunWith(SpringRunner.class)
public class Example3_AppleShopTest {
@Autowired
private MockMvc mvc;
@Test
public void buyingApples() throws Exception {
mvc.perform(post("/appleShop/grannySmith"))
.andExpect(status().isOk())
.andExpect(jsonPath("$", is("gs_1")));
}
} |
717bbeff-8e7d-4d88-821d-6c6e61b621a2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-02 15:00:40", "repo_name": "cheneasternsun/KeyDemo", "sub_path": "/app/src/main/java/com/dongchen/keydemo/BaseActivity.java", "file_name": "BaseActivity.java", "file_ext": "java", "file_size_in_byte": 998, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "aee2af7077a30047043cb8b6081fd96d1e550ca0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/cheneasternsun/KeyDemo | 196 | FILENAME: BaseActivity.java | 0.204342 | package com.dongchen.keydemo;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.MenuItem;
/**
*
*
* @author dongchen
* created at 2018/5/25 17:37
*
* 功能:
* 目的:
*/
public abstract class BaseActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar ab = getSupportActionBar();
if (null != ab) {
ab.setDisplayHomeAsUpEnabled(true);
}
Log.i("class", "activity is " + this.getClass().getName());
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
this.finish();
break;
default:
}
return super.onOptionsItemSelected(item);
}
}
|
9ef4c0a3-5fd3-4a6a-8aba-ab984e9c303a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-26 22:20:46", "repo_name": "mcelrea/DummyServerTest", "sub_path": "/core/src/com/mcelrea/firstservertry/Player.java", "file_name": "Player.java", "file_ext": "java", "file_size_in_byte": 987, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "4b8c5b68bfd8ff667c12e20b5f53417afcdba7f1", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mcelrea/DummyServerTest | 234 | FILENAME: Player.java | 0.264358 | package com.mcelrea.firstservertry;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
public class Player {
private float x;
private float y;
private Color color;
private float prevX;
private float prevY;
public Player(Color color) {
this.color = color;
x = 300;
y = 300;
prevX = x;
prevY = y;
}
public boolean hasMoved() {
if(prevX != x || prevY != y) {
prevX = x;
prevY = y;
return true;
}
return false;
}
public void draw(ShapeRenderer shapeRenderer) {
shapeRenderer.setColor(color);
shapeRenderer.set(ShapeRenderer.ShapeType.Filled);
shapeRenderer.circle(x,y,7);
}
public void setPosition(float x, float y) {
this.x = x;
this.y = y;
}
public float getX() {
return x;
}
public float getY() {
return y;
}
}
|
14e37f9b-8a3a-48b2-94b2-7b79a51c0b5a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-18 21:46:43", "repo_name": "java-prolog-connectivity/jpc", "sub_path": "/src/main/java/org/jpc/util/termprocessor/strategy/PredicateTermProcessorStrategy.java", "file_name": "PredicateTermProcessorStrategy.java", "file_ext": "java", "file_size_in_byte": 1000, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "7d16805f9231d39cdb6e5f2d757594522daa64b6", "star_events_count": 7, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/java-prolog-connectivity/jpc | 199 | FILENAME: PredicateTermProcessorStrategy.java | 0.288569 | package org.jpc.util.termprocessor.strategy;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
import org.jpc.term.Term;
import org.jpc.util.termprocessor.CompositeTermProcessor;
import org.jpc.util.termprocessor.TermProcessor;
public class PredicateTermProcessorStrategy implements TermProcessorStrategy {
public final List<Map.Entry<Predicate<Term>, TermProcessor>> entries;
public PredicateTermProcessorStrategy(List<Map.Entry<Predicate<Term>, TermProcessor>> entries) {
this.entries = entries;
}
@Override
public TermProcessor findTermProcessor(Term term) {
Term compiledTerm = term;
//Term compiledTerm = term.compile(); //currently needed to test for unification
return entries.stream().filter(entry -> entry.getKey().test(compiledTerm)).map(Map.Entry::getValue).findFirst().orElseGet(
() -> {throw new CompositeTermProcessor.NoTermProcessorAvailableException(compiledTerm);});
}
}
|
954ea923-467b-4b15-b7e3-c43b7daf56d7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-08-20T09:47:46", "repo_name": "kshwetabh/GoogleCalendarWallpaper-Golang", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1051, "line_count": 28, "lang": "en", "doc_type": "text", "blob_id": "90eb519b8e16b24144ba301d46b3952e8f41b015", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kshwetabh/GoogleCalendarWallpaper-Golang | 282 | FILENAME: README.md | 0.288569 |
# Sample

# Install Dependencies:
- Get the Google Calendar API Go client library and OAuth2 package using the following commands:
go get -u google.golang.org/api/calendar/v3
go get -u golang.org/x/oauth2/google
- Image manipulation library
go get github.com/fogleman/gg
# Configuration Details
"SourceImageDirectory": "C:\\Dev\\GoProgramming\\src\\github.com\\ksfnu\\calendar_wallpaper\\input",
"OutputImageDirectory": "C:\\Dev\\GoProgramming\\src\\github.com\\ksfnu\\calendar_wallpaper\\output",
"MarginRight": 400,
"MarginTop": 50,
"PrintDate": true,
"TitleFont": "./Fonts/Roboto/Roboto-Bold.ttf",
"TitleFontSize": 18,
"ItemFontSize": 14,
"ItemFont": "./Fonts/Roboto/Roboto-Medium.ttf",
"TitleText": "Today's Calendar",
"ItemPadding": 25,
"GoogleCalendarID": "aaa@group.calendar.google.com"
# All Wallpapers taken from:
[pexels.com](https://www.pexels.com/)
|
949568f0-6923-4f23-a90a-32d7989aec93 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-07-20 15:51:02", "repo_name": "linkedpipes/etl", "sub_path": "/libraries/library-pipeline/src/main/java/com/linkedpipes/etl/library/pipeline/adapter/RawPipelineDataFlow.java", "file_name": "RawPipelineDataFlow.java", "file_ext": "java", "file_size_in_byte": 1162, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "c748b202ef0e98614685aeba43552707b44d1cec", "star_events_count": 139, "fork_events_count": 37, "src_encoding": "UTF-8"} | https://github.com/linkedpipes/etl | 233 | FILENAME: RawPipelineDataFlow.java | 0.27048 | package com.linkedpipes.etl.library.pipeline.adapter;
import org.eclipse.rdf4j.model.Resource;
import org.eclipse.rdf4j.model.Value;
import java.util.ArrayList;
import java.util.List;
public class RawPipelineDataFlow {
/**
* Connection resource.
*/
public Resource resource;
/**
* Connection source component.
*/
public Resource source;
/**
* Source binding.
*/
public Value sourceBinding;
/**
* Connection target component.
*/
public Resource target;
/**
* Target binding.
*/
public Value targetBinding;
/**
* Vertices.
*/
public final List<RawPipelineVertex> vertices = new ArrayList<>();
public RawPipelineDataFlow() {
}
public RawPipelineDataFlow(RawPipelineDataFlow other) {
this.resource = other.resource;
this.source = other.source;
this.sourceBinding = other.sourceBinding;
this.target = other.target;
this.targetBinding = other.targetBinding;
for (RawPipelineVertex vertex : other.vertices) {
this.vertices.add(new RawPipelineVertex(vertex));
}
}
}
|
d1360ffe-c73b-4b7c-ae03-63dd12fff5bb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-27 11:32:07", "repo_name": "BondarenkoJek/todo-list-spring-boot", "sub_path": "/src/main/java/ua/bondarenkojek/controllers/AdminController.java", "file_name": "AdminController.java", "file_ext": "java", "file_size_in_byte": 968, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "372a6e8e97bfdf02f08def661ec62010ba8d2eb6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/BondarenkoJek/todo-list-spring-boot | 183 | FILENAME: AdminController.java | 0.273574 | package ua.bondarenkojek.controllers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import ua.bondarenkojek.models.User;
import ua.bondarenkojek.services.UserService;
@Controller
@RequestMapping("/administrator")
public class AdminController {
@Autowired
private UserService userService;
@GetMapping
public String getAllUsers(ModelMap modelMap) {
modelMap.addAttribute("users", userService.getAllUsers());
return "admin";
}
@PostMapping("/delete")
public String deleteUser(@RequestParam("id") Long id) {
userService.deleteById(id);
return "redirect: /administrator";
}
@PostMapping("/edit")
public String editUser(@ModelAttribute("User")User user) {
userService.save(user);
return "redirect: /administrator";
}
}
|
114ef183-e1b0-415d-bc58-be62f26f7ee5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-11 02:09:29", "repo_name": "gothamp/groupshopping", "sub_path": "/src/main/java/com/glosoft/inventory_service/item/Item.java", "file_name": "Item.java", "file_ext": "java", "file_size_in_byte": 987, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "d44dfbf18d5891d13cfa435418da21774c798342", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/gothamp/groupshopping | 190 | FILENAME: Item.java | 0.224055 | package com.glosoft.inventory_service.item;
import java.util.concurrent.atomic.AtomicLong;
public class Item {
private final long id;
private final long categoryId;
private final String name;
private final String description;
private final String imageURL;
public long getId() {
return id;
}
public long getCategoryId() {
return categoryId;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public String getImageURL() {
return imageURL;
}
private static final AtomicLong nextId = new AtomicLong();
public Item(long categoryId, String name, String description, String imageURL) {
this.id = nextId.incrementAndGet();
this.categoryId = categoryId;
this.name = name;
this.description = description;
this.imageURL = imageURL;
}
// public String getContent() {return content;}
} |
c7e54329-ad76-44f6-a0eb-d848face046a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-09 07:37:43", "repo_name": "Denijar/SOFTENG364_Assignment2", "sub_path": "/src/Client.java", "file_name": "Client.java", "file_ext": "java", "file_size_in_byte": 1157, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "c02dbfa74feeaa51df57a47e2772f1423ece5065", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Denijar/SOFTENG364_Assignment2 | 254 | FILENAME: Client.java | 0.290981 | public class Client {
private String _clientName;
private String _clientType;
private String _hostname;
private int _port;
private int _responseTime;
public Client(String row){
// Parse the data, assigning to fields
String[] data = row.split(",");
_clientName = data[0];
_clientType = data[1];
String[] hostnamePort = data[2].split(":");
_hostname = hostnamePort[0];
_port = Integer.parseInt(hostnamePort[1]);
_responseTime = Integer.parseInt(data[3]);
}
void setResponseTime(int responseTime){
_responseTime = responseTime;
}
String getClientName(){
return _clientName;
}
String getClientType() { return _clientType; }
String getHostname(){
return _hostname;
}
int getPort(){
return _port;
}
int getResponseTime(){
return _responseTime;
}
@Override
public String toString(){
return "" + _clientName + "," + _clientType + "," + _hostname + ":" + _port + "," + _responseTime + System.lineSeparator();
}
}
|
27e4f620-f508-4bee-b7e1-dd544f10c6df | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-18 05:25:02", "repo_name": "Shanisahu10121998/FirebaseTesting", "sub_path": "/app/src/main/java/shani/firebasetesting/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1023, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "d9fa57aedd99aa52840e6f02f97e6a0505637d76", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Shanisahu10121998/FirebaseTesting | 184 | FILENAME: MainActivity.java | 0.212069 | package shani.firebasetesting;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.google.firebase.database.DatabaseReference;
public class MainActivity extends AppCompatActivity {
Button addBtn, updBtn, dltBtn;
public static String test ="Your Task App";
static DatabaseReference databaseReference;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
addBtn=findViewById(R.id.addBtn);
updBtn=findViewById(R.id.updBtn);
dltBtn=findViewById(R.id.deletBtn);
}
public void buttonadd(View view){
Intent intent=new Intent(MainActivity.this,Activity_UI.class);
startActivity(intent);
}
public void buttonUpdate(View view){
Intent intent=new Intent(MainActivity.this, Update_Delete_ViewAll.class);
startActivity(intent);
}
}
|
8834e7e0-01f4-4946-b61e-1503725075c2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-11 11:55:48", "repo_name": "Vasilis-wx/springboot_vue__demo", "sub_path": "/src/main/java/com/wx/control/login/LoginControl.java", "file_name": "LoginControl.java", "file_ext": "java", "file_size_in_byte": 1102, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "9cff98e42c1d8eadc29acf3596eb701511622acc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Vasilis-wx/springboot_vue__demo | 218 | FILENAME: LoginControl.java | 0.204342 | package com.wx.control.login;
import com.wx.VO.ResultVO;
import com.wx.model.user.TUser;
import com.wx.service.user.UserService;
import com.wx.util.ResultVOUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* Created by wx
* 2018/9/19
*/
@RestController
@RequestMapping("/login")
public class LoginControl {
@Autowired
private UserService userService;
@RequestMapping("/login")
public ResultVO<Map<String,String>> login(String username, String password){
System.out.printf(username+"---"+password);
TUser user = userService.findUserByUsernameAndPassword(username,password);
if(user!=null){
return ResultVOUtil.succsee(user);
}else{
return ResultVOUtil.error(1,"用户名密码不正确");
}
}
@RequestMapping("/logout")
public ResultVO<Map<String,String>> logout(){
return ResultVOUtil.succsee("注销成功!");
}
}
|
c2920861-de81-4288-971c-3f89daac3263 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-03-04T19:37:40", "repo_name": "DmitryBelonogov/Replicator", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1024, "line_count": 35, "lang": "en", "doc_type": "text", "blob_id": "3b3a12dc8f88cca07c14aa75736082afe226ba20", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DmitryBelonogov/Replicator | 258 | FILENAME: README.md | 0.210766 | # Replicator
News, full-text, and article metadata extraction in Java with Jsoup
[](https://travis-ci.org/nougust3/Replicator)
## Usage
```
Loader loader = new Loader(url,
new LoaderCallback() {
@Override
public void onLoaded(Article article) {
System.out.println(article.title);
}
@Override
public void onFailure() { }
});
}
```
### Extracted data elements
- `title` - The document title
- `author` - The document author
- `content` - The main content of the document
- `image` - The main image for the document
- `tags`- Any tags or keywords
- `lang` - The language of the document
- `description` - The description of the document
### Supported languages
Russian, Arabic, Danish, German, Greek, English, Spanish, Finnish, French, Hebrew, Hungarian, Indonesian, Italian, Korean, Macedonian, Norwegian, Dutch, Swedish, Turkish, Vietnamese, Chinese.
### Demo
[replicator.nougust3.com]
|
398f92bd-02fa-48c8-a000-93e04511a144 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-22 04:49:20", "repo_name": "friskac/Tubes1", "sub_path": "/app/src/main/java/com/example/makanapa/LobbyFragment.java", "file_name": "LobbyFragment.java", "file_ext": "java", "file_size_in_byte": 1162, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "e957161fe6eb83da0ef55463aaea8683c5120e8b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/friskac/Tubes1 | 205 | FILENAME: LobbyFragment.java | 0.249447 | package com.example.makanapa;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.fragment.app.Fragment;
public class LobbyFragment extends Fragment {
private static LobbyFragment lobbyFragment;
private Presenter presenter;
private Button btnCari;
private LobbyFragment(){
}
public static LobbyFragment newInstance(Presenter presenter){
if (lobbyFragment == null){
lobbyFragment = new LobbyFragment();
}
lobbyFragment.presenter = presenter;
return lobbyFragment;
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
View view = inflater.inflate(R.layout.fragment_lobby,container,false);
this.btnCari = view.findViewById(R.id.btn_cari);
this.btnCari.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
lobbyFragment.presenter.changePage(FoodListener.PAGE2, false);
}
});
return view;
}
}
|
edd36e41-d3b1-4091-af48-177b3e83b62e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-15 02:56:10", "repo_name": "FlyMyFish/ScenicSportWithOut", "sub_path": "/app/src/main/java/com/shichen/scenicsport/data/source/local/ScenicSportDatabase.java", "file_name": "ScenicSportDatabase.java", "file_ext": "java", "file_size_in_byte": 988, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "6cc9599d2e6900e53d7fe968aa2996397cd2377e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/FlyMyFish/ScenicSportWithOut | 181 | FILENAME: ScenicSportDatabase.java | 0.268941 | package com.shichen.scenicsport.data.source.local;
import android.arch.persistence.room.Database;
import android.arch.persistence.room.Room;
import android.arch.persistence.room.RoomDatabase;
import android.content.Context;
import android.support.annotation.NonNull;
import com.shichen.scenicsport.data.Sport;
@Database(entities = {Sport.class}, version = 1, exportSchema = false)
public abstract class ScenicSportDatabase extends RoomDatabase {
private static ScenicSportDatabase INSTANCE;
public abstract SportsDao sportDao();
private static final Object sLock = new Object();
public static ScenicSportDatabase getInstance(@NonNull Context context) {
synchronized (sLock) {
if (INSTANCE == null) {
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
ScenicSportDatabase.class, "ScenicSports.db")
.build();
}
return INSTANCE;
}
}
}
|
b171e5bc-6dc3-498f-8b91-c753d3b1902a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-06 06:20:18", "repo_name": "AworldIcon/MainProject", "sub_path": "/MainProject/app/src/main/java/com/coder/kzxt/course/adapter/CourseClassAdapter.java", "file_name": "CourseClassAdapter.java", "file_ext": "java", "file_size_in_byte": 1176, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "83b798fe017b7203005725d0a56b7132cbffa574", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/AworldIcon/MainProject | 248 | FILENAME: CourseClassAdapter.java | 0.256832 | package com.coder.kzxt.course.adapter;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.coder.kzxt.activity.R;
import java.util.ArrayList;
/**
* 课程班级适配器
* Created by wangtingshun on 2017/3/10.
*/
public class CourseClassAdapter extends FragmentPagerAdapter {
private Context mContext;
private ArrayList<Fragment> fragments;
private String[] titles = new String[1];
public CourseClassAdapter( Context context,FragmentManager fm,ArrayList<Fragment> fragments) {
super(fm);
this.mContext = context;
this.fragments = fragments;
this.titles[0] = context.getResources().getString(R.string.courses);
// this.titles[1] = context.getResources().getString(R.string.classs);
}
@Override
public Fragment getItem(int position) {
return fragments.get(position);
}
@Override
public int getCount() {
return fragments.size();
}
@Override
public CharSequence getPageTitle(int position) {
return titles[position];
}
}
|
e5f28436-4227-4716-9cf3-fe2b2fd2e5aa | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-16 06:39:29", "repo_name": "PaliwalArpit/selenium-chormedevtools-demo", "sub_path": "/src/test/java/me/tests/IgnoreCertTest.java", "file_name": "IgnoreCertTest.java", "file_ext": "java", "file_size_in_byte": 986, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "612f9070c7ac480dd48f71118905e7a34abf2f92", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/PaliwalArpit/selenium-chormedevtools-demo | 211 | FILENAME: IgnoreCertTest.java | 0.259826 | package me.tests;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.security.Security;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class IgnoreCertTest {
private static ChromeDriver chromeDriver;
private static DevTools chromeDevTools;
@BeforeClass
public static void initDriverAndDevTools() {
chromeDriver = new ChromeDriver();
chromeDevTools = chromeDriver.getDevTools();
chromeDevTools.createSession();
}
@Test
public void loadInsecureWebsite() {
// enable Security
chromeDevTools.send(Security.enable());
// set ignore certificate errors
chromeDevTools.send(Security.setIgnoreCertificateErrors(true));
// load insecure website
chromeDriver.get("https://expired.badssl.com/");
// verify that the page was loaded
Assert.assertEquals(true, chromeDriver.getPageSource().contains("expired"));
}
}
|
a22f0984-d748-431b-bfea-dc6715f6a3b3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-09-14 04:49:52", "repo_name": "duggankimani/WIRA", "sub_path": "/src/main/java/com/duggan/workflow/shared/model/dashboard/TaskAging.java", "file_name": "TaskAging.java", "file_ext": "java", "file_size_in_byte": 1009, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "56aaca8c756725101b29d7aa5293fd1bb8d44fc3", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/duggankimani/WIRA | 228 | FILENAME: TaskAging.java | 0.246533 | package com.duggan.workflow.shared.model.dashboard;
import com.wira.commons.shared.models.SerializableObj;
public class TaskAging extends SerializableObj{
/**
*
*/
private static final long serialVersionUID = 1L;
private String period;
private int taskCount;
private int percentage;
private int position;
public TaskAging() {
}
public TaskAging(String period, int taskCount, int position){
this.period = period;
this.taskCount = taskCount;
this.position = position;
}
public String getPeriod() {
return period;
}
public void setPeriod(String period) {
this.period = period;
}
public int getTaskCount() {
return taskCount;
}
public void setTaskCount(int taskCount) {
this.taskCount = taskCount;
}
public int getPercentage() {
return percentage;
}
public void setPercentage(int percentage) {
this.percentage = percentage;
}
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
}
|
c2df2f73-b8fb-4b17-a151-8e621faf0b85 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-05 11:03:40", "repo_name": "BROWN3QQQ/Cstatour", "sub_path": "/src/main/java/com/brown3qqq/cstatour/dao/Impl/UserRepositoryimpl.java", "file_name": "UserRepositoryimpl.java", "file_ext": "java", "file_size_in_byte": 1083, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "b04ec7ac12da04bc8d63e89dd1548f6985cf4e4b", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/BROWN3QQQ/Cstatour | 214 | FILENAME: UserRepositoryimpl.java | 0.255344 | package com.brown3qqq.cstatour.dao.Impl;
import com.brown3qqq.cstatour.dao.UserCustomerRepository;
import com.brown3qqq.cstatour.dao.UserRepository;
import com.brown3qqq.cstatour.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
import java.util.Iterator;
import java.util.List;
@Repository
public class UserRepositoryimpl implements UserCustomerRepository {
@Autowired
protected MongoTemplate mongoTemplate;
@Override
public User getUser(String name) {
try {
Query query = new Query(Criteria.where("realname").is(name));
List<User> userlist = mongoTemplate.find(query,User.class,"user");
Iterator<User> it = userlist.iterator();
User user = it.next();
return user;
}catch (Exception e){
}
return null;
}
}
|
dbb5a1cd-3340-4393-8599-24fc205846e3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-04 12:19:06", "repo_name": "yang-shixiong/concurrent", "sub_path": "/src/main/java/com/yang/lock/CyclicBarrierDemo.java", "file_name": "CyclicBarrierDemo.java", "file_ext": "java", "file_size_in_byte": 1162, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "4d5374698244b77591a3dddd045f16bb119416b5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yang-shixiong/concurrent | 231 | FILENAME: CyclicBarrierDemo.java | 0.272025 | package com.yang.lock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import static com.yang.util.Sleeper.sleep;
/**
* Description:
*
* @author mark
* Date 2020/11/4
*/
public class CyclicBarrierDemo {
private static final Logger logger = LoggerFactory.getLogger(CyclicBarrierDemo.class);
private static final CyclicBarrier barrier = new CyclicBarrier(2);
public static void main(String[] args) {
new Thread(() -> {
logger.debug("start");
try {
barrier.await();
logger.debug("end");
} catch (InterruptedException | BrokenBarrierException e) {
e.printStackTrace();
}
}, "t1").start();
new Thread(() -> {
logger.debug("start");
try {
sleep(3000);
barrier.await();
logger.debug("end");
} catch (InterruptedException | BrokenBarrierException e) {
e.printStackTrace();
}
}, "t2").start();
}
}
|
bf0669e2-cef4-47fe-bf47-25f7d9b22033 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-08-16T02:42:58", "repo_name": "an1meshk/ChutesAndLaddersGame", "sub_path": "/.github/CONTRIBUTING.md", "file_name": "CONTRIBUTING.md", "file_ext": "md", "file_size_in_byte": 1056, "line_count": 28, "lang": "en", "doc_type": "text", "blob_id": "c3019d2d0c1cf8134c605de484d3c6dbb250d8fc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/an1meshk/ChutesAndLaddersGame | 240 | FILENAME: CONTRIBUTING.md | 0.249447 | # Contributing to ChutesAndLaddersGame
Thanks for your interest in ChutesAndLaddersGame.
## Getting Started
ChutesAndLaddersGame's [open issues are here](https://github.com/animesh2712/ChutesAndLaddersGame/issues).
An easy way to get started helping the project is to *file an issue*.
Issues can include bugs to fix, features to add, or documentation that looks outdated.
## Contributions
ChutesAndLaddersGame welcomes contributions from everyone.
Contributions to ChutesAndLaddersGame should be made in the form of GitHub pull requests. Each pull request will
be reviewed by a core contributor.
## Pull Request Checklist
- Seed branch from the master branch and, if needed, rebase to the current master
branch before submitting your pull request. If it doesn't merge cleanly with
master you may be asked to rebase your changes.
- Commits should be as small as possible, while ensuring that each commit is
correct independently (i.e., each commit should compile and pass tests).
- Add tests relevant to the fixed bug or new feature.
|
549f1165-0025-4536-af34-d5cbca6e0ccc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-13 05:00:13", "repo_name": "amritkrishan/ParallelUniverse", "sub_path": "/src/main/java/com/universe/tasks/service/FamilyServiceImpl.java", "file_name": "FamilyServiceImpl.java", "file_ext": "java", "file_size_in_byte": 989, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "e3e0ad7a53c61bcb40c566caa5c7fe5baaade99e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/amritkrishan/ParallelUniverse | 176 | FILENAME: FamilyServiceImpl.java | 0.293404 | package com.universe.tasks.service;
import com.universe.tasks.model.Family;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.universe.tasks.repository.FamilyRepository;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class FamilyServiceImpl implements FamilyService
{
@Autowired
private FamilyRepository familyRepository;
@Transactional
public void saveFamily(Family family)
{
familyRepository.save(family);
}
@Transactional
public List<Family> getAllFamilies()
{
return familyRepository.findAll();
}
public List<String> getFamiliesForUniverse(int id){
return familyRepository.
getFamiliesForUniverse(id).
stream().
map(Family::getFamilyName).
collect(Collectors.toList());
}
} |
b6e43016-3d18-42e3-8f18-4802ee822dfb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-06-07 11:08:39", "repo_name": "jzxyouok/XinShang", "sub_path": "/app/src/main/java/com/qluxstory/qingshe/information/adapter/InformationAdapter.java", "file_name": "InformationAdapter.java", "file_ext": "java", "file_size_in_byte": 1083, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "ccbf2921d9345e40f69c1358980773150c79e345", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jzxyouok/XinShang | 237 | FILENAME: InformationAdapter.java | 0.264358 | package com.qluxstory.qingshe.information.adapter;
import android.widget.ImageView;
import com.qluxstory.ptrrecyclerview.BaseRecyclerViewHolder;
import com.qluxstory.ptrrecyclerview.BaseSimpleRecyclerAdapter;
import com.qluxstory.qingshe.R;
import com.qluxstory.qingshe.common.utils.ImageLoaderUtils;
import com.qluxstory.qingshe.information.entity.InformationEntity;
/**
* Created by lenovo on 2016/5/14.
*/
public class InformationAdapter extends BaseSimpleRecyclerAdapter<InformationEntity> {
@Override
public int getItemViewLayoutId() {
return R.layout.item_information_fragment;
}
@Override
public void bindData(BaseRecyclerViewHolder holder, InformationEntity informationEntity, int position) {
holder.setText(R.id.information_tv1,informationEntity.getNews_big_title());
holder.setText(R.id.information_tv2,informationEntity.getNews_small_title());
ImageView mInformationImg=holder.getView( R.id.information_img);
ImageLoaderUtils.displayImage(informationEntity.getNews_pic_url(), mInformationImg);
}
}
|
dd8f307c-bf9b-4a9e-9734-67389285c453 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-21 23:25:30", "repo_name": "Refactorality/alone", "sub_path": "/src/main/java/com/palehorsestudios/alone/Food.java", "file_name": "Food.java", "file_ext": "java", "file_size_in_byte": 1162, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "a2270854e12b089dc119be3dcb06a3c7e6c14129", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Refactorality/alone | 290 | FILENAME: Food.java | 0.287768 | package com.palehorsestudios.alone;
import java.util.Objects;
public class Food extends Item {
private double caloriesPerGram;
private double grams;
public Food() {
}
public Food(String name, double caloriesPerGram, double grams) {
super(name);
this.caloriesPerGram = caloriesPerGram;
this.grams = grams;
}
public double getCaloriesPerGram() {
return caloriesPerGram;
}
public void setCaloriesPerGram(double caloriesPerGram) {
this.caloriesPerGram = caloriesPerGram;
}
public double getGrams() {
return grams;
}
public void setGrams(double grams) {
this.grams = grams;
}
@Override
public String toString() {
return super.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
Food food = (Food) o;
return Double.compare(food.caloriesPerGram, caloriesPerGram) == 0 &&
Double.compare(food.grams, grams) == 0;
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), caloriesPerGram, grams);
}
}
|
0fc4cd8e-b0d2-4d9f-95f2-be488ddfd38f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-03-15 02:44:44", "repo_name": "bugjc/quick-ea", "sub_path": "/ea-gateway-layer/zuul-api-gateway/src/main/java/com/bugjc/ea/gateway/zuul/core/exception/BizException.java", "file_name": "BizException.java", "file_ext": "java", "file_size_in_byte": 1044, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "7f10275e547e04af594abb0f4e9375075a11af8c", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/bugjc/quick-ea | 219 | FILENAME: BizException.java | 0.228156 | package com.bugjc.ea.gateway.zuul.core.exception;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class BizException extends RuntimeException {
private int code; //异常状态码
private String message; //异常信息
private String method; //发生的方法,位置等
private String desc; //描述
public BizException(String message) {
super(message);
this.message = message;
}
public BizException(int code, String message) {
super(message);
this.code = code;
this.message = message;
}
public BizException(int code, String message, Throwable cause) {
super(message, cause);
this.code = code;
this.message = message;
}
public BizException(int code, String message, String method, String desc, Throwable cause) {
super(message, cause);
this.code = code;
this.message = message;
this.method = method;
this.desc = desc;
}
}
|
cb645c55-546d-41c7-9428-8da099431511 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-05-18T15:42:56", "repo_name": "miseryprevails/TrackFittUpdated", "sub_path": "/Prototype HTML & Pictures/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1163, "line_count": 17, "lang": "en", "doc_type": "text", "blob_id": "fdfbfed34026879b746dd6910ce3294c3977422e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/miseryprevails/TrackFittUpdated | 286 | FILENAME: README.md | 0.261331 |
# Prototype

This the Log In Screen. Here you have a username and password box to enter credentials.
you have the forgot password option to retrieve password, and below you can click new signup to create your new profile below.

Here is the profile screen once you have logged in. you have your feed which shows you food logging activity.
you have the option to add a profile bio, and below that you can set a status (Had a good workout today!)
you can navigate to the tabs to make a post, reply to a connection, or view your total connections.

Here is the page where based on your stats put in, you will get a number back which will determine your total calorie intake needs based on goals selected. you can also sumbit your day activity at the bottom in the day activity bar.
|
559b4bb6-6473-45f8-98f5-cbc2a18444b6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-30 07:26:36", "repo_name": "itolisto/ConversaBusiness-Android", "sub_path": "/app/src/main/java/ee/app/conversamanager/model/nCategory.java", "file_name": "nCategory.java", "file_ext": "java", "file_size_in_byte": 1162, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "d5f174965680959dfc43a19057d99bc020ac7dac", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/itolisto/ConversaBusiness-Android | 240 | FILENAME: nCategory.java | 0.235108 | package ee.app.conversamanager.model;
import android.content.Context;
import android.text.TextUtils;
import ee.app.conversamanager.R;
/**
* Created by edgargomez on 9/15/16.
*/
public class nCategory {
private final String objectId;
private final String name;
private final String avatarUrl;
private boolean removeDividerMargin;
public nCategory(String objectId, String name, String avatarUrl) {
this.objectId = objectId;
this.name = name;
this.avatarUrl = avatarUrl;
this.removeDividerMargin = false;
}
public void setRemoveDividerMargin(boolean removeDividerMargin) {
this.removeDividerMargin = removeDividerMargin;
}
public boolean getRemoveDividerMargin() {
return removeDividerMargin;
}
public String getObjectId() {
return objectId;
}
public String getAvatarUrl() {
return avatarUrl;
}
public String getCategoryName(Context activity) {
if (activity == null) {
return "";
} else {
return (TextUtils.isEmpty(name)) ? activity.getString(R.string.category) : name;
}
}
}
|
65af0666-d637-4e7a-8e48-dee1f9440bda | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-01-12T13:36:59", "repo_name": "ymittal/info-retrieval-final-project", "sub_path": "/retrieval/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 986, "line_count": 30, "lang": "en", "doc_type": "text", "blob_id": "38859cc640a831d458e11dc597cfeb4fb1876451", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ymittal/info-retrieval-final-project | 216 | FILENAME: README.md | 0.282988 | This folder contains:
1. Queries for evaluating our systems
2. Configuration files for searching in Galago
3. Raw results from Solr
4. Results from both systems ready for pooling
Experiment 1 (Galago)
Using `Galago`, we analysed the following:
1. Retrieval performance using different query operators:
- BM25
- Relevance model (RM)
- Sequential Dependece model (SDM)
2. Difference in performance with addition of query description
Hence, a total of six different retrieval configurations were created.
Experiment 2 (Solr)
Using `Solr`, we ran our queries in English, Arabic, and Chinese, using
the same search parameters for all the searches.
We compared using topic titles alone, and title + description.
Again, a total of six different configurations were used.
After all the results were generated, the top 100 results for each system
were pooled and shuffled. The team then made relevance judgements to
identify whether each result was relevant to the query.
|
01628dbb-f571-4728-9dad-e357a4d90935 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-07-18 14:17:24", "repo_name": "PIH/mirebalais-smoke-tests", "sub_path": "/src/test/java/org/openmrs/module/mirebalais/smoke/helper/Exporter.java", "file_name": "Exporter.java", "file_ext": "java", "file_size_in_byte": 1161, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "12e85365a6cff4e16116a3305e2600d4918da24f", "star_events_count": 0, "fork_events_count": 5, "src_encoding": "UTF-8"} | https://github.com/PIH/mirebalais-smoke-tests | 207 | FILENAME: Exporter.java | 0.252384 | package org.openmrs.module.mirebalais.smoke.helper;
import org.dbunit.database.DatabaseConnection;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.database.QueryDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.openmrs.module.mirebalais.smoke.helper.SmokeTestProperties;
import java.io.FileOutputStream;
import java.sql.Connection;
import java.sql.DriverManager;
public class Exporter {
public static void main(String[] args) throws Exception {
SmokeTestProperties properties = new SmokeTestProperties();
// database connection
Class driverClass = Class.forName(properties.getDatabaseDriverClass());
Connection jdbcConnection = DriverManager.getConnection(properties.getDatabaseUrl(), properties.getDatabaseUsername(), properties.getDatabasePassword());
IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);
// partial database export
QueryDataSet partialDataSet = new QueryDataSet(connection);
partialDataSet.addTable("patient_identifier");
FlatXmlDataSet.write(partialDataSet, new FileOutputStream("partial.xml"));
}
} |
72329ed7-a4b6-4f3e-854b-eb0f3d90d354 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-03-08 21:07:21", "repo_name": "ChrisMitov/Repo", "sub_path": "/Test3Practice/src/Client.java", "file_name": "Client.java", "file_ext": "java", "file_size_in_byte": 1053, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "78324ffab5caabecc029914c75afbfff033c94ae", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ChrisMitov/Repo | 289 | FILENAME: Client.java | 0.291787 | import java.util.Arrays;
import java.util.List;
public class Client implements Runnable{
private Shop shop;
@Override
public void run() {
List<Product> moqtSpisyk = Arrays.asList(
new Product("Pork", ProductType.MEATS),
new Product("Cucumber", ProductType.VEGETABLES),
new Product("Banana", ProductType.FRUITS));
while (true) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
return ;
}
System.out.println("Q sega da si ponazaruvam");
try {
Product randomProduct = moqtSpisyk.get((int)(Math.random() * moqtSpisyk.size()));
int randomQuantity = (int)(Math.random() * 3)+1;
shop.sellProduct(randomProduct, randomQuantity);
System.out.println("Kupih "+ randomProduct + " - sega shte go izqm!");
} catch (WarehouseException e) {
e.printStackTrace();
}
}
}
public Shop getShop() {
return shop;
}
public void setShop(Shop shop) {
this.shop = shop;
}
public Client(Shop shop) {
super();
this.shop = shop;
}
}
|
4540b577-308b-4e81-8b4b-6bc5ec198015 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-02-17T16:53:58", "repo_name": "willjohnsonio/eggheadio-web-security-essentails", "sub_path": "/01-web-security-course-overview.md", "file_name": "01-web-security-course-overview.md", "file_ext": "md", "file_size_in_byte": 1162, "line_count": 33, "lang": "en", "doc_type": "text", "blob_id": "f7d4d176da2b1213d8450207ada7af5f02e7ee74", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/willjohnsonio/eggheadio-web-security-essentails | 312 | FILENAME: 01-web-security-course-overview.md | 0.212069 | [Video Link](https://egghead.io/lessons/egghead-web-security-course-overview)
# 01. Web Security Course Overview
**These instructions are for macOS**
* Download Charles Proxy [charlesproxy.com/download](https://www.charlesproxy.com/download)
* Download Git run `git --version` in the command line to check if you have it [git](https://git-scm.com/downloads)
* Download Node.js run `node --version` make sure you have a version higher than 8.9.3 [nodejs](https://nodejs.org/en)
* Download npm ot comes with node, check the version `npm --version`
* Download curl check the version with `curl --version` if you don't have curl go to [curl.haxx.se](https://curl.haxx.se)
Make sure you have `sudo` privileges
Open and change the hosts file
```bash
code /etc/hosts
```
At the `127.0.01 localhost` line add evil.com and save it.
```
127.0.01 localhost evil.com
```
Run `sudo npm install` from the root of the repo
Then `cd exercises/01` then run `sudo npm start`
Visit the http://localhost.charlesproxy.com url there should be a username and password prompt
Run `sudo npm run start:evil.com` then will start a new server at https://evil.com:666/index.html.
|
47f657d2-175c-4d33-8878-26ba75ef2060 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-30 09:18:16", "repo_name": "Pawel-Iskra/LocalWeatherStationAPI", "sub_path": "/src/main/java/com/local_weather_API/external_APIs/darksky/DarkSkyApiFetcher.java", "file_name": "DarkSkyApiFetcher.java", "file_ext": "java", "file_size_in_byte": 1008, "line_count": 27, "lang": "en", "doc_type": "code", "blob_id": "b5f10040a6ab896206bf71c4d7014aa47f50aeee", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Pawel-Iskra/LocalWeatherStationAPI | 227 | FILENAME: DarkSkyApiFetcher.java | 0.282988 | package com.local_weather_API.external_APIs.darksky;
import com.local_weather_API.external_APIs.darksky.model.Currently;
import com.local_weather_API.external_APIs.darksky.model.WeatherFromDarkSkyApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
@Component
public class DarkSkyApiFetcher {
@Value("${app.URL_DARKSKYWEATHER}")
private String url2;
public WeatherFromDarkSkyApi getWeatherFromApi(float latitude, float longitude) {
RestTemplate restTemplate = new RestTemplate();
int latInt = (int) latitude;
int latDec = (int) Math.abs((latitude * 100) - latInt * 100);
int lonInt = (int) longitude;
int lonDec = (int) Math.abs((longitude * 100) - lonInt * 100);
return restTemplate.getForObject(
String.format(url2,latInt, latDec, lonInt, lonDec), WeatherFromDarkSkyApi.class);
}
}
|
48fb2fb1-9907-486a-9ffe-cad723d9ced2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-04-30 06:16:13", "repo_name": "motodale/homework9", "sub_path": "/src/Frame.java", "file_name": "Frame.java", "file_ext": "java", "file_size_in_byte": 1078, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "f828e7f647a4911e5268cc8501cb51a8ea8bf85e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/motodale/homework9 | 197 | FILENAME: Frame.java | 0.206894 | import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by Dale.
*/
public class Frame extends JFrame {
private JPanel menu;
public Frame(){
this.setLayout(new FlowLayout());
this.setSize(400,300);
this.setTitle("DAO");
this.setBackground(Color.gray);
this.createMenuPanel();
this.add(menu);
}
private void createMenuPanel(){
menu = new JPanel();
JMenuBar statsThing = new JMenuBar();
JButton winButton = new JButton("win");
JButton loseButton = new JButton("lose");
winButton.addActionListener(new WinListener());
loseButton.addActionListener(new LoseListener());
menu.add(winButton);
menu.add(loseButton);
}
class WinListener implements ActionListener{
public void actionPerformed(ActionEvent event){
}
}
class LoseListener implements ActionListener{
public void actionPerformed(ActionEvent event){
}
}
}
|
e7249531-f4b0-49d9-a038-0bb320d79024 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-20 09:29:35", "repo_name": "ivanstoykovivanov-telerik/OOP_exam_preparation", "sub_path": "/src/models/base/Task.java", "file_name": "Task.java", "file_ext": "java", "file_size_in_byte": 1053, "line_count": 63, "lang": "en", "doc_type": "code", "blob_id": "3232b87f0698bd46bbec4f21b9c8698e90bc0290", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ivanstoykovivanov-telerik/OOP_exam_preparation | 250 | FILENAME: Task.java | 0.275909 | package models.base;
import java.util.Date;
import models.TicketPriority;
public class Task extends Item {
private TicketPriority priority;
private String assignee ;
private Date plannedTime;
private Date dueDate;
public Task(String title, String description, Date dueDate, TicketPriority priority, Date plannedTime,
String assignee) {
super(title, description);
this.priority = priority;
this.assignee = assignee;
this.plannedTime = plannedTime;
this.dueDate = dueDate;
}
public TicketPriority getPriority() {
return priority;
}
public void setPriority(TicketPriority priority) {
this.priority = priority;
}
public String getAssignee() {
return assignee;
}
public void setAssignee(String assignee) {
this.assignee = assignee;
}
public Date getPlannedTime() {
return plannedTime;
}
public void setPlannedTime(Date plannedTime) {
this.plannedTime = plannedTime;
}
public Date getDueDate() {
return dueDate;
}
public void setDueDate(Date dueDate) {
this.dueDate = dueDate;
}
}
|
5b346cb2-1281-4fef-900a-957bf5bf775f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-17 23:57:17", "repo_name": "Atonement100/Computer-Networking", "sub_path": "/Project-2/src/packet.java", "file_name": "packet.java", "file_ext": "java", "file_size_in_byte": 979, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "6106a85da0ee1dffc8e27c72ae9ac0ca7dbc2950", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Atonement100/Computer-Networking | 203 | FILENAME: packet.java | 0.233706 | import java.io.Serializable;
public class packet implements Serializable{
private byte sequenceNum;
private byte packetId;
private int checksum;
private String content;
public packet(byte seqNum, byte packetId, int checksum, String content){
this.sequenceNum = seqNum;
this.packetId = packetId;
this.checksum = checksum;
this.content = content;
}
public byte getSequenceNum(){
return this.sequenceNum;
}
public byte getPacketId(){
return this.packetId;
}
public int getChecksum(){
return this.checksum;
}
public String getContent(){
return this.content;
}
public void corruptPacket(){
this.checksum++;
}
public void recalculateChecksum(){ //for use by sender only :x
int checksum = 0;
for (char ch : this.getContent().toCharArray()) {
checksum += ch;
}
this.checksum = checksum;
}
}
|
00f3dc39-09cf-4837-aec9-b0c0ecc78de4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2022-12-12T14:47:56", "repo_name": "plone/guillotina", "sub_path": "/docs/source/training/extending/configuration.md", "file_name": "configuration.md", "file_ext": "md", "file_size_in_byte": 1008, "line_count": 30, "lang": "en", "doc_type": "text", "blob_id": "bdd4eb08f48b3f84e17b59a4cc67ed8464e59094", "star_events_count": 185, "fork_events_count": 61, "src_encoding": "UTF-8"} | https://github.com/plone/guillotina | 211 | FILENAME: configuration.md | 0.259826 | # Configuration
All application extension configuration is defined with Guillotina's `configure`
module and the `app_settings` object.
Defining content types, behaviors, services, etc all require the use of the
`configure` module. Guillotina reads all the registered configuration in code
for each install application and loads it.
## app_settings
Guillotina also provides a global `app_settings` object::
```python
from guillotina import app_settings
```
This object contains all the settings from your `config.yaml` file as well as
any additional configuration settings defined in addons.
`app_settings` has an order of precedence it will use pick settings from:
- guillotina's default settings
- each application in order it is defined can override default guillotina settings
- config.yaml takes final precedence over all configuration
`app_settings` has an extra key `__file__` that contains the path of the
configuration file, allowing relative paths to be used in an application
settings.
|
8d755d04-6a14-4e11-b7c2-d2017b1fbe33 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-12 15:56:51", "repo_name": "ammyblabla/spring-security-spike", "sub_path": "/src/main/java/com/example/spikespringsecurity/student/StudentManagementController.java", "file_name": "StudentManagementController.java", "file_ext": "java", "file_size_in_byte": 1162, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "f1566b6bf0ccd84cdc59736e587e802abeb8a5ca", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ammyblabla/spring-security-spike | 228 | FILENAME: StudentManagementController.java | 0.262842 | package com.example.spikespringsecurity.student;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("management/v1/students")
@RequiredArgsConstructor
public class StudentManagementController {
private final StudentRepository studentRepository;
@PreAuthorize("hasAnyRole('ROLE_ADMIN', 'ROLE_ADMINTRAINEE')")
@GetMapping
public List<Student> getAllStudents() {
System.out.println("get all student");
return studentRepository.findAll();
}
@PreAuthorize("hasAuthority('student:write')")
@PostMapping
public void registerNewStudent(@RequestBody Student student) {
studentRepository.save(student);
}
@PreAuthorize("hasAuthority('student:write')")
@DeleteMapping(path = "{studentId}")
public void deleteStudent(@PathVariable Integer studentId) {
studentRepository.deleteById(studentId);
}
@PutMapping(path = "{studentId}")
public void updateStudent(@PathVariable Integer studentId, @RequestBody Student student) {
studentRepository.save(student);
}
}
|
048455c0-2ac8-49b0-91e0-8cb969f06bd0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-08-08 13:33:38", "repo_name": "Alexygui/MicroMessage", "sub_path": "/src/com/aaa/dao/CommandDao.java", "file_name": "CommandDao.java", "file_ext": "java", "file_size_in_byte": 1062, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "0701a8643da526ebcfca77146c2a434309a04494", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Alexygui/MicroMessage | 257 | FILENAME: CommandDao.java | 0.294215 | package com.aaa.dao;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import com.aaa.bean.Command;
import com.aaa.db.DBAccess;
/**
* 和Command表相关的数据库操作
*/
public class CommandDao {
/**
* 根据查询条件查询指令列表
*/
public List<Command> queryCommandList(String name, String description) {
DBAccess aDbAccess = new DBAccess();
SqlSession aSqlSession = null;
List<Command> CommandList = new ArrayList<Command>();
try {
aSqlSession = aDbAccess.getSqlSession();
Command aCommand = new Command();
aCommand.setName(name);;
aCommand.setDescription(description);
// 通过SqlSession执行SQL语句,通过Command.xml配置文件读取相应的sql语句操作数据库
CommandList = aSqlSession.selectList("Command.queryCommandList", aCommand);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (aSqlSession != null) {
aSqlSession.close();
aSqlSession = null;
}
}
return CommandList;
}
}
|
31750068-d5fd-4535-bdd3-f339288d20c9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-09-13 02:25:48", "repo_name": "biantaiwuzui/netx", "sub_path": "/trunk/netx-job/netx-schedule/src/main/java/com/netx/schedule/jobhandler/ucenter/ArticleDeletedJobHandler.java", "file_name": "ArticleDeletedJobHandler.java", "file_ext": "java", "file_size_in_byte": 1016, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "98b8815a1122f7158f6d842af3599add16d47623", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/biantaiwuzui/netx | 201 | FILENAME: ArticleDeletedJobHandler.java | 0.206894 | package com.netx.schedule.jobhandler.ucenter;
import com.netx.core.biz.model.ReturnT;
import com.netx.core.handler.IJobHandler;
import com.netx.core.handler.annotation.JobHandler;
import com.netx.core.log.XxlJobLogger;
import com.netx.ucenter.biz.user.ArticleAction;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
@JobHandler(value="ArticleDeletedJobHandler")
@Component
public class ArticleDeletedJobHandler extends IJobHandler {
@Autowired
private ArticleAction articleAction;
@Override
public ReturnT<String> execute(String articleId) throws Exception {
XxlJobLogger.log(new Date()+":"+"定时删除24小时后未交押金的图文("+articleId+")启动");
if(StringUtils.isNotBlank(articleId)){
if(articleAction.deleteUnpaidArticle(articleId)){
return SUCCESS;
}
}
return FAIL;
}
}
|
58df204c-24c6-45bc-81f2-34d6f848530d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-09-27T15:54:11", "repo_name": "jraleman/afinar.me", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 988, "line_count": 31, "lang": "en", "doc_type": "text", "blob_id": "fd382d19b5dacacc364415977c95ccf1552a1d61", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jraleman/afinar.me | 248 | FILENAME: README.md | 0.243642 | # Afinar.me

## Idea
### G and F Cleff Trainer (Gamify it)
- will show music sheet with some notes
- user has to tap on the correct note
- notes can be tapped by a music notes wheel
- if the note is b or #, then have additional 5 notes to display outside wheel
- notes from music notes wheel will be disabled when b or # are applied to them, only show outside wheel
- and vice-versa, if notes are regular 7 notes, then disabled notes outside the music scroll wheel
### Possible competitors
- Clefs: Music Reading Trainer
- Complete Music Reading Trainer
- MyMusicTheory - music theory exercises
- Music Tutor (Sight Reading)
- Perfect Ear - Music Theory, Ear & Rhythm
- ...etc (keep on searching Playstore / App Store)
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE/)
file for details.
## Acknowledgments
- [Anita Semi-square Font by Gustavo Paz]( http://www.1001fonts.com/anita-semi-square-font.html)
|
b72a14f7-4317-4294-91b1-5807cd9f2578 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-27 11:30:19", "repo_name": "luckyNB/junit-mood-analyser-usecase", "sub_path": "/src/main/java/com/moodanalyser/MoodAnalyser.java", "file_name": "MoodAnalyser.java", "file_ext": "java", "file_size_in_byte": 1083, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "7d39f8ed53140b56118345f8227880cfd572e248", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/luckyNB/junit-mood-analyser-usecase | 222 | FILENAME: MoodAnalyser.java | 0.239349 | package com.moodanalyser;
public class MoodAnalyser {
private String message;
public MoodAnalyser(String message) {
this.message = message;
}
public MoodAnalyser() {
}
public String analyzeMood() throws MoodException {
try {
if (message == null) {
return "HAPPY";
}
} catch (NullPointerException e) {
throw new MoodException("Please Enter Proper Mood");
}
return null;
}
public void analyzeMood(MoodAnalyser moodAnalyser) throws MoodAnalysisException {
if (moodAnalyser == null)
throw new MoodAnalysisException(MoodAnalysisException.ExceptionType.ENTERED_NULL);
}
public void analyzeMood(String mood) throws MoodAnalysisException {
if (mood.isEmpty()) {
throw new MoodAnalysisException(MoodAnalysisException.ExceptionType.ENTERED_EMPTY);
}
}
public boolean equals(Object object) {
if (this == object) {
return true;
} else
return false;
}
} |
54c06f25-1fdd-43af-bbf6-7f0b417bced5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-04-16 02:22:07", "repo_name": "Kaioru/nautilus-legacy", "sub_path": "/nautilus-core/src/main/java/co/kaioru/nautilus/core/packet/IReceiver.java", "file_name": "IReceiver.java", "file_ext": "java", "file_size_in_byte": 1162, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "c71905f5ababc136cad04404a0257cbe6418a9e6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Kaioru/nautilus-legacy | 254 | FILENAME: IReceiver.java | 0.291787 | package co.kaioru.nautilus.core.packet;
import co.kaioru.nautilus.core.user.User;
import co.kaioru.nautilus.core.util.IValue;
import org.slf4j.LoggerFactory;
import java.util.Map;
public interface IReceiver<U extends User, T extends IPacketHandler<U>> {
Map<Integer, T> getPacketHandlers();
default void registerPacketHandler(IValue<Integer> operation, T handler) {
getPacketHandlers().put(operation.getValue(), handler);
}
default void deregisterPacketHandler(T handler) {
getPacketHandlers().remove(handler);
}
default void handlePacket(U user, IPacketReader reader) {
int operation = reader.readShort();
T handler = getPacketHandlers().get(operation);
if (handler != null) {
if (handler.validate(user))
handler.handle(user, reader);
ReceiverLogHolder.log.debug("Handled operation code {} with {}",
Integer.toHexString(operation),
handler.getClass().getSimpleName());
} else {
ReceiverLogHolder.log.warn("No packet handlers found for operation code {}", Integer.toHexString(operation));
}
}
}
final class ReceiverLogHolder {
static final org.slf4j.Logger log = LoggerFactory.getLogger(IReceiver.class);
}
|
63dde2fc-a7d3-470d-a1ad-18715e82420e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-05 20:22:18", "repo_name": "harinder2612/Warehouse", "sub_path": "/app/src/main/java/com/harinder/home_page2/snackbar.java", "file_name": "snackbar.java", "file_ext": "java", "file_size_in_byte": 1162, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "ebc5b608bb4db65471a7689e55a37064b553ccb7", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/harinder2612/Warehouse | 209 | FILENAME: snackbar.java | 0.233706 | package com.harinder.home_page2;
import android.app.Activity;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
public class snackbar extends AppCompatActivity {
Snackbar snackbar;
TextView ts;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.snackbar);
ts = (TextView) findViewById(R.id.text3);
}
public void press(View view) {
ts.setText("Snackbar Build.");
snackbar = Snackbar
.make(view, "Archived", Snackbar.LENGTH_SHORT)
.setAction("UNDO", new View.OnClickListener() {
@Override
public void onClick(View view) {
ts.setText("Undo clicked!");
}
});
snackbar.show();
}
public void back(View view) {
setContentView(R.layout.snackbar);
}
public void next(View view) {
setContentView(R.layout.constraint);
}
}
|
b02a7a54-be58-45f3-b64a-345d62fe5775 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-06 20:24:15", "repo_name": "abhigupta19/Adstory", "sub_path": "/app/src/main/java/com/sars/user/adstory/fullp.java", "file_name": "fullp.java", "file_ext": "java", "file_size_in_byte": 964, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "aea31842fd4dec4559f2caa878488bb7b47d5da6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/abhigupta19/Adstory | 168 | FILENAME: fullp.java | 0.221351 | package com.sars.user.adstory;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.widget.ImageView;
import com.squareup.picasso.Picasso;
public class fullp extends AppCompatActivity {
ImageView imageView3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fullp);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
imageView3=(ImageView)findViewById(R.id.imageView3);
Intent ifull=getIntent();
String url=ifull.getStringExtra("url");
Picasso.with(this).load(url).into(imageView3);
}
public boolean onOptionsItemSelected(MenuItem item){
Intent myIntent = new Intent(getApplicationContext(), bar
.class);
startActivityForResult(myIntent, 0);
return true;
}
}
|
14de4c8a-0461-41f7-94c7-d0ecb556b9d7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-04 14:07:41", "repo_name": "menezessn/AndroidStudio", "sub_path": "/Extras2/app/src/main/java/com/example/extras2/MainActivity2.java", "file_name": "MainActivity2.java", "file_ext": "java", "file_size_in_byte": 1078, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "6a8d37eaf59ac37da185bbce69418637d095ba95", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/menezessn/AndroidStudio | 205 | FILENAME: MainActivity2.java | 0.289372 | package com.example.extras2;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity2 extends AppCompatActivity {
Button btnProximo2;
EditText etNum2;
Intent i;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
btnProximo2 = findViewById(R.id.btn_proximo2);
etNum2 = findViewById(R.id.et_num2);
i = getIntent();
btnProximo2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String num1 = i.getExtras().getString("num1");
i = new Intent(MainActivity2.this , MainActivity3.class);
i.putExtra("num1" , num1);
i.putExtra("num2" , etNum2.getText().toString());
startActivity(i);
}
});
}
} |
cf82394c-2ce1-423d-95a4-f0d7257b2a10 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-07 13:32:19", "repo_name": "jovicigor/SongRecommenderWeb", "sub_path": "/src/main/java/com/songrecommender/dataaccess/repository/SQL/associations/InsertTrackArtistAssociationQuery.java", "file_name": "InsertTrackArtistAssociationQuery.java", "file_ext": "java", "file_size_in_byte": 1162, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "8d7a2c795146fc96546b6269ee62dfd79b74bab6", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jovicigor/SongRecommenderWeb | 213 | FILENAME: InsertTrackArtistAssociationQuery.java | 0.268941 | package com.songrecommender.dataaccess.repository.SQL.associations;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class InsertTrackArtistAssociationQuery {
private int trackId = -1;
private static final String SQL = "INSERT INTO track_artist (track_Id, artist_Id) values (?, ?)";
private PreparedStatement preparedStatement;
public InsertTrackArtistAssociationQuery(Connection connection) throws SQLException {
preparedStatement = connection.prepareStatement(SQL);
}
public InsertTrackArtistAssociationQuery forTrack(int trackId) {
this.trackId = trackId;
return this;
}
public InsertTrackArtistAssociationQuery withArtistId(int artistId) throws SQLException {
preparedStatement.setInt(1, trackId);
preparedStatement.setInt(2, artistId);
preparedStatement.addBatch();
return this;
}
public void execute() throws SQLException {
if (trackId < 0) {
throw new IllegalStateException("The genreId or artistIds is not provided.");
}
preparedStatement.executeBatch();
}
}
|
c6551ce9-857a-4857-95fd-d165963fe2db | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-28 08:36:07", "repo_name": "EmptyPages0430/bxxc", "sub_path": "/app/src/main/java/com/jgkj/bxxc/adapter/SimpleFragmentPagerAdapter.java", "file_name": "SimpleFragmentPagerAdapter.java", "file_ext": "java", "file_size_in_byte": 1017, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "b30a8ad4652cea87023f6df1072bdf084ede7b2f", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/EmptyPages0430/bxxc | 225 | FILENAME: SimpleFragmentPagerAdapter.java | 0.224055 | package com.jgkj.bxxc.adapter;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.jgkj.bxxc.PageFragment;
/**
* Created by fangzhou on 2017/1/4.
* viewPager适配器
*/
public class SimpleFragmentPagerAdapter extends FragmentPagerAdapter {
final int PAGE_COUNT = 4;
private String tabTitles[] = new String[]{" 科目一 "," 科目二 "," 科目三 "," 科目四 "};
private Context context;
public SimpleFragmentPagerAdapter(FragmentManager fragmentManager, Context context) {
super(fragmentManager);
this.context = context;
}
@Override
public Fragment getItem(int position) {
return PageFragment.newInstance(position);
}
@Override
public int getCount() {
return PAGE_COUNT;
}
@Override
public CharSequence getPageTitle(int position) {
return tabTitles[position];
}
}
|
273847ba-34fd-4a41-88a8-54a8cf273ce4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-09 11:30:08", "repo_name": "michealJC/system", "sub_path": "/src/main/java/com/micheajc/system/controller/Food_controller.java", "file_name": "Food_controller.java", "file_ext": "java", "file_size_in_byte": 1027, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "d7b6df5a8ba4aa287ad391accd5780e95cb1ad88", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/michealJC/system | 193 | FILENAME: Food_controller.java | 0.235108 | package com.micheajc.system.controller;
import com.micheajc.system.bean.sys_food;
import com.micheajc.system.service.Food_service;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/food")
public class Food_controller {
@Autowired
Food_service food_service;
@RequestMapping("/getlistfood")
@ResponseBody
public List<sys_food> getfoodclass(){
return food_service.getlist_food();
}
//根据分类名得到食品
@RequestMapping("/wherefoodclassgetlist")
@ResponseBody
public List<sys_food> foodclassgetlist(@RequestBody String json){
return food_service.wherefoodclassgetlist(json);
}
}
|
b46c253e-7434-4909-9cc2-b26cb0b033d8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-19 06:36:57", "repo_name": "zane29/dubbo-demo", "sub_path": "/serverdemo/src/main/java/com/dubbodemo/server/service/UserServiceImpl.java", "file_name": "UserServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1192, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "a5115175c8a4a17bbd8d46ebcea1b4a9624a4d97", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zane29/dubbo-demo | 259 | FILENAME: UserServiceImpl.java | 0.213377 | package com.dubbodemo.server.service;
import com.alibaba.dubbo.rpc.RpcContext;
import com.dubbodemo.common.UserInfo;
import com.dubbodemo.common.UserService;
/**
* Created with IntelliJ IDEA.
* User: lu
* Date: 16-12-20
* Time: 下午3:55
* To change this template use File | Settings | File Templates.
*/
public class UserServiceImpl implements UserService {
@Override
public UserInfo getUserInfo() {
UserInfo userInfo = new UserInfo();
userInfo.setName("周海明");
userInfo.setValue("123456");
// 获取客户端隐式传入的参数,用于框架集成,不建议常规业务使用
String index = RpcContext.getContext().getAttachment("index");
System.out.println(index);
// 本端是否为提供端,这里会返回true
boolean isProviderSide = RpcContext.getContext().isProviderSide();
// 获取调用方IP地址
String clientIP = RpcContext.getContext().getRemoteHost();
// 获取当前服务配置信息,所有配置信息都将转换为URL的参数
String application = RpcContext.getContext().getUrl().getParameter("application");
return userInfo;
}
}
|
44c6d0cc-8f8e-4974-8e64-e5eb901f3ad9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-22 06:57:13", "repo_name": "876860131robert/edot", "sub_path": "/edot-server/src/main/java/com/asiainfo/aigov/web/controller/edot/layout/page/PageMaterial.java", "file_name": "PageMaterial.java", "file_ext": "java", "file_size_in_byte": 985, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "93db6a9dd8dd9bd774a965e9634a99dda149dca7", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/876860131robert/edot | 237 | FILENAME: PageMaterial.java | 0.242206 | package com.asiainfo.aigov.web.controller.edot.layout.page;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 材料提交页
* @author songxiaoliang
*/
public class PageMaterial {
private Map<String,String> datas = new HashMap<String, String>();//业务数据
private List<PieceHeadItems> titleItemsList = new ArrayList<PieceHeadItems>();
public PieceHeadItems findTitleItems(String regionName){
for (PieceHeadItems titleItems : titleItemsList) {
if(regionName.equals(titleItems.getRegionName())){
return titleItems;
}
}
return null;
}
public List<PieceHeadItems> getTitleItemsList() {
return titleItemsList;
}
public void setTitleItemsList(List<PieceHeadItems> titleItemsList) {
this.titleItemsList = titleItemsList;
}
public Map<String, String> getDatas() {
return datas;
}
public void setDatas(Map<String, String> datas) {
this.datas = datas;
}
}
|
72fd67f7-36e5-46fa-b49a-be464e4ae6e8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-26 18:27:41", "repo_name": "jaren/AegisGame", "sub_path": "/app/src/main/java/io/github/automaticspork/aegis/components/EliteEnemy.java", "file_name": "EliteEnemy.java", "file_ext": "java", "file_size_in_byte": 1162, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "7b9d136a926130ffd872945e837ef21c9d4eb5c5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jaren/AegisGame | 294 | FILENAME: EliteEnemy.java | 0.29584 | package io.github.automaticspork.aegis.components;
import android.graphics.Color;
import java.util.List;
import java.util.Random;
import io.github.automaticspork.aegis.GameView;
import io.github.automaticspork.aegis.Sprite;
import io.github.automaticspork.aegis.Vector;
/**
* Created by jaren on 5/25/17.
*/
public class EliteEnemy extends EliteSprite {
public EliteEnemy(Vector pos, float radius, float sMult) {
super(pos, radius, sMult);
score = 5;
paint.setColor(Color.parseColor("#212121"));
}
@Override
public void update(List<Sprite> sprites, GameView view) {
super.update(sprites, view);
}
@Override
public void onTap(GameView view) {
super.onTap(view);
Random random = new Random();
for (int i = 0; i < 5; i++) {
Enemy enemy = new Enemy(new Vector(position.x - 80 + random.nextInt(160), position.y - 80 + random.nextInt(160)), radius / 3, speedMultipler * 2);
view.spritesToAdd.add(enemy);
}
}
@Override
public void onCollide(GameView view) {
super.onCollide(view);
view.core.health -= 50;
}
}
|
8147bfc9-5fa4-4040-a1d9-86c1f25b5c02 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-21 15:47:12", "repo_name": "charlieboggus/simple-game-library", "sub_path": "/src/main/java/com/github/charlieboggus/sgl/graphics/gl/GLVertexArray.java", "file_name": "GLVertexArray.java", "file_ext": "java", "file_size_in_byte": 1231, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "eeee75fc04596aa8b764aa7aaae3c42580553a6a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/charlieboggus/simple-game-library | 258 | FILENAME: GLVertexArray.java | 0.279042 | package com.github.charlieboggus.sgl.graphics.gl;
import static org.lwjgl.opengl.GL20.glDisableVertexAttribArray;
import static org.lwjgl.opengl.GL20.glEnableVertexAttribArray;
import static org.lwjgl.opengl.GL20.glVertexAttribPointer;
import static org.lwjgl.opengl.GL30.glBindVertexArray;
import static org.lwjgl.opengl.GL30.glDeleteVertexArrays;
import static org.lwjgl.opengl.GL30.glGenVertexArrays;
public class GLVertexArray
{
private final int id;
public GLVertexArray()
{
this.id = glGenVertexArrays();
}
public void destroy()
{
glDeleteVertexArrays(this.id);
}
public int getID()
{
return this.id;
}
public void bind()
{
glBindVertexArray(this.id);
}
public void unbind()
{
glBindVertexArray(0);
}
public void enableVertexAttribute(int location)
{
glEnableVertexAttribArray(location);
}
public void disableVertexAttribute(int location)
{
glDisableVertexAttribArray(location);
}
public void setVertexAttributePointer(int location, int size, int type, int stride, int offset)
{
glVertexAttribPointer(location, size, type, false, stride, offset);
}
}
|
7eb87e9a-672e-40cf-a173-86c36ef431e7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-07 18:23:15", "repo_name": "MaheshSaini/AssignmentSpotSoon", "sub_path": "/app/src/main/java/com/assignment/spotsoon/view/IconTextTabLayout.java", "file_name": "IconTextTabLayout.java", "file_ext": "java", "file_size_in_byte": 1160, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "73bc50f079efa9f62f276617bbf54a9ffbe00310", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MaheshSaini/AssignmentSpotSoon | 224 | FILENAME: IconTextTabLayout.java | 0.243642 | package com.assignment.spotsoon.view;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.design.widget.TabLayout;
import android.support.v4.view.PagerAdapter;
import android.util.AttributeSet;
import com.assignment.spotsoon.R;
/**
* Created by MAHESH on 10-Jun-17.
*/
public class IconTextTabLayout extends TabLayout {
public IconTextTabLayout(Context context) {
super(context);
}
public IconTextTabLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public IconTextTabLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void setTabsFromPagerAdapter(@NonNull PagerAdapter adapter) {
this.removeAllTabs();
int i = 0;
for (int count = adapter.getCount(); i < count; ++i) {
this.addTab(this.newTab().setCustomView(R.layout.custom_tab)
/// .setIcon(YourIcons[i])
.setText(adapter.getPageTitle(i)));
}
}}
|
c55a8f7e-7de3-40c5-8111-c42b983105c3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-19 08:53:58", "repo_name": "victorrentea/rx-java", "sub_path": "/src/main/java/victor/training/rx/sample/madalina/ChunkProcessor.java", "file_name": "ChunkProcessor.java", "file_ext": "java", "file_size_in_byte": 1163, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "8c357d1ced305ea87e4cbe2c9092912d5fcea3c1", "star_events_count": 2, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/victorrentea/rx-java | 234 | FILENAME: ChunkProcessor.java | 0.229535 | package victor.training.rx.sample.madalina;
import java.io.InputStream;
import java.util.List;
public class ChunkProcessor {
private int currentChunkId;
private List<InputStream> listOfInputStreams;
private DocumentChunk[] unprocessedChunks;
public ChunkProcessor(int noOfChunks) {
}
public void processInputStream(DocumentChunk chunk) {
try {
final int chunkID = chunk.getChunkPosition() - 1;
if (currentChunkId == chunkID) {
InputStream inputStream = writeToInputStream(chunk);
listOfInputStreams.add(inputStream);
currentChunkId++;
if (currentChunkId < unprocessedChunks.length)
lookAheadInputStream();
} else {
if (chunkID > currentChunkId) {
unprocessedChunks[chunkID] = chunk;
}
}
} catch (Exception ex) {
// logger.error(errorMessage, ex);
}
}
private void lookAheadInputStream() {
}
private InputStream writeToInputStream(DocumentChunk chunk) {
return null;
}
public List<InputStream> getListOfInputStreams() {
return null;
}
}
|
6fc654ae-0ddc-40c4-ac0e-49731230be68 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-06-30 16:10:41", "repo_name": "zhangchenmmtd/mediamonks-wechat-web", "sub_path": "/src/main/java/com/mediamonks/configuration/MvcConfiguration.java", "file_name": "MvcConfiguration.java", "file_ext": "java", "file_size_in_byte": 990, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "1a11e0365e7f7579bf6fc8a3b901d9b0f91db631", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zhangchenmmtd/mediamonks-wechat-web | 183 | FILENAME: MvcConfiguration.java | 0.212069 | package com.mediamonks.configuration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
/**
* Created by zhangchen on 16/6/1.
*/
@Configuration
@EnableWebMvc
public class MvcConfiguration extends WebMvcConfigurerAdapter{
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setPrefix("/WEB-INF/pages/");
viewResolver.setSuffix(".jsp");
registry.viewResolver(viewResolver);
}
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login");
}
}
|
fa74b48d-b9ea-47be-afb3-b8bbb2c5c59b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-06-28 10:43:47", "repo_name": "miujoke/miujoke-springcloud", "sub_path": "/miujoke-common/src/main/java/com/miujoke/common/aspect/IdempotentAspect.java", "file_name": "IdempotentAspect.java", "file_ext": "java", "file_size_in_byte": 1030, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "813dc03c19fcb7648e29fac201aa78e123101458", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/miujoke/miujoke-springcloud | 223 | FILENAME: IdempotentAspect.java | 0.220007 | package com.miujoke.common.aspect;
import com.miujoke.common.annotation.IdempotentAnnotation;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
* @author miujoke
* @date 2023/6/4 0:20
*/
@Aspect
@Order(2)
@Component
public class IdempotentAspect {
@Around("@annotation(idempotentAnnotation)")
public Object doAround(ProceedingJoinPoint joinPoint, IdempotentAnnotation idempotentAnnotation) throws Throwable {
String methodName = joinPoint.getSignature().getName();
System.out.println("开始访问: " + methodName);
try {
System.out.println("结束访问: " + methodName + "得到数据: "+ joinPoint.proceed());
return joinPoint.proceed();
}catch (Exception e){
System.out.println("接口异常");
return joinPoint.proceed();
}
}
}
|
5e4ec809-8185-49e1-8b7c-7df006ad69a3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-10-08 13:34:26", "repo_name": "yingwei0831/cuiweitourism", "sub_path": "/java/com/jhhy/cuiweitourism/http/ResponseResult.java", "file_name": "ResponseResult.java", "file_ext": "java", "file_size_in_byte": 994, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "cad2e4e2168451f107f23058e126a80fb98a9ffe", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yingwei0831/cuiweitourism | 240 | FILENAME: ResponseResult.java | 0.273574 | package com.jhhy.cuiweitourism.http;
import com.jhhy.cuiweitourism.utils.LoadingIndicator;
import com.jhhy.cuiweitourism.net.utils.LogUtil;
import org.xutils.common.Callback;
/**
* Created by jiahe008 on 2016/9/1.
*/
public abstract class ResponseResult implements Callback.CommonCallback<String>, ResponseCallback{
private static final String TAG = ResponseResult.class.getSimpleName();
@Override
public void onSuccess(String result) {
LogUtil.e(TAG, "请求成功,返回数据: " + result);
responseSuccess(result);
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
LogUtil.e(TAG, "onError: " + ex + ", " + isOnCallback);
LoadingIndicator.cancel();
}
@Override
public void onCancelled(CancelledException cex) {
LogUtil.e(TAG, "onCancelled: " + cex);
LoadingIndicator.cancel();
}
@Override
public void onFinished() {
LogUtil.e(TAG, "onFinished");
}
}
|
2b20faa5-ee23-457f-bfa9-78c16bdd705f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-11-02 10:18:06", "repo_name": "aktgb31/PLACEMENT-MANAGEMENT-SYSTEM", "sub_path": "/src/main/java/app/LoginStudentServlet.java", "file_name": "LoginStudentServlet.java", "file_ext": "java", "file_size_in_byte": 1163, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "2254ff0cf4ea3b3bf175d943ae8c5ebb38bcf643", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/aktgb31/PLACEMENT-MANAGEMENT-SYSTEM | 190 | FILENAME: LoginStudentServlet.java | 0.259826 | package app;
import database.*;
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
public class LoginStudentServlet extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String rollNo = request.getParameter("registerNo");
String password = request.getParameter("password");
try {
int user = Operations.studentLogin(rollNo, password);
String destPage = "login.jsp";
if (user != 0) {
HttpSession session = request.getSession();
session.setAttribute("user", user);
destPage = "student_home.jsp";
} else {
String message = "Invalid email/password";
request.setAttribute("message", message);
}
RequestDispatcher dispatcher = request.getRequestDispatcher(destPage);
dispatcher.forward(request, response);
} catch (Exception e) {
System.out.println(e);
}
}
}
|
e3768d82-9984-4510-93a5-115e05450dcf | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-03 10:20:21", "repo_name": "tsbonev/cvetozar_bonev_web_and_servlets", "sub_path": "/src/main/java/com/clouway/bankapp/adapter/web/filter/util/SessionCleanupTask.java", "file_name": "SessionCleanupTask.java", "file_ext": "java", "file_size_in_byte": 1061, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "697c3b0140181b0c9ed26de6a5b64e04060ae11a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tsbonev/cvetozar_bonev_web_and_servlets | 211 | FILENAME: SessionCleanupTask.java | 0.278257 | package com.clouway.bankapp.adapter.web.filter.util;
import com.google.common.util.concurrent.AbstractScheduledService;
import com.clouway.bankapp.core.*;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.concurrent.TimeUnit;
public class SessionCleanupTask extends AbstractScheduledService {
private SessionRepository sessionRepo;
public SessionCleanupTask(SessionRepository sessionRepo){
this.sessionRepo = sessionRepo;
}
@Override
public void startUp() throws SQLException {
}
/**
* Cleans up all sessions whose expiration dates
* have been reached.
*/
@Override
protected void runOneIteration() {
sessionRepo.deleteSessionsExpiringAfter(Timestamp.valueOf(LocalDateTime.now()));
}
/**
* Schedules a clean up task to be run every hour.
*
* @return
*/
@Override
protected Scheduler scheduler() {
return Scheduler
.newFixedRateSchedule(1, 1, TimeUnit.HOURS);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.