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 |
|---|---|---|---|---|---|---|
371d153c-582f-4b04-af64-131af01f5e14 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-08 15:40:25", "repo_name": "macielbombonato/apolo", "sub_path": "/apolo-core/src/main/java/apolo/common/util/ThreadLocalContextUtil.java", "file_name": "ThreadLocalContextUtil.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "1479d5c867b2732a07863eae51be62f1a84a9917", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/macielbombonato/apolo | 248 | FILENAME: ThreadLocalContextUtil.java | 0.268941 | package apolo.common.util;
import apolo.common.config.enums.Language;
import org.springframework.util.Assert;
public class ThreadLocalContextUtil {
private static final ThreadLocal<String> tenantContextHolder = new ThreadLocal<String>();
private static final ThreadLocal<String> languageContextHolder = new ThreadLocal<String>();
public static final void setLanguage(Language language) {
Language lang = Language.BR;
if (language != null) {
lang = language;
}
languageContextHolder.set(lang.getCode());
}
public static final Language getLanguage() {
Language result = null;
String langCode = languageContextHolder.get();
if (langCode != null) {
result = Language.fromCode(langCode);
} else {
result = Language.BR;
}
return result;
}
public static final void setTenantId(String tenantId) {
Assert.notNull(tenantId, "customerType cannot be null");
tenantContextHolder.set(tenantId);
}
public static final String getTenantId() {
return (String) tenantContextHolder.get();
}
public static final void clearTenant() {
tenantContextHolder.remove();
}
}
|
7b536c82-bad0-4a72-b23a-ad4044f592af | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-04-06 21:02:07", "repo_name": "Micromegas/ProyectoUni", "sub_path": "/src/proyectouni/Conexion.java", "file_name": "Conexion.java", "file_ext": "java", "file_size_in_byte": 1069, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "1c215ceba44fab7bce1c4ff7814e920ff402c0ab", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Micromegas/ProyectoUni | 215 | FILENAME: Conexion.java | 0.23793 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package proyectouni;
import java.sql.*;
/**
*
* @author Administrador
*/
public class Conexion {
/* datos para la conexion */
private String bd = "db_programacion";
private String login = "dbprogramacion";
private String password = "dbprogramacion";
private String url = "jdbc:mysql//localhost/"+bd;
private Connection conn = null;
public Conexion(){
try{
//obtenemos el driver de para mysql
Class.forName("com.mysql.jdbc.Driver");
//obtenemos la conexión
conn = DriverManager.getConnection(url,login,password);
if (conn!=null){
System.out.println("OK base de datos "+bd+" listo");
}
}catch(SQLException e){
System.out.println(e);
}catch(ClassNotFoundException e){
System.out.println(e);
}
}
}
|
293c5140-5812-4269-a6d0-9d2b76fed21e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-09-13 07:32:56", "repo_name": "569934390/darenbao", "sub_path": "/jinbang/src/main/java/com/compses/dao/impl/system/AgreementInfoDao.java", "file_name": "AgreementInfoDao.java", "file_ext": "java", "file_size_in_byte": 1008, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "c0e0f536572dc3cc9919cf45e09d54c508dfd084", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/569934390/darenbao | 209 | FILENAME: AgreementInfoDao.java | 0.253861 | package com.compses.dao.impl.system;
import com.compses.dao.system.IAgreementInfoDao;
import com.compses.model.AgreementInfo;
import com.compses.util.DBUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.Map;
/**
* Created by nini on 2016/3/19.
*/
@Repository
public class AgreementInfoDao implements IAgreementInfoDao {
@Autowired
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
public AgreementInfo selectOneByVersion(String versionId,String type){
String sql= DBUtils.getSql("AgreementInfo", "selectOneByVersion");
Map<String,Object> paramMap=new HashMap<String, Object>();
paramMap.put("versionId", versionId);
paramMap.put("type", type);
return DBUtils.queryForObject(sql, paramMap, namedParameterJdbcTemplate, AgreementInfo.class);
}
}
|
74228a09-7ec2-44e9-9e42-1a3d59872006 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-02-11 11:23:59", "repo_name": "adurenator/InteractionProgrammingLab", "sub_path": "/DinnerApp/src/se/kth/csc/iprog/dinnerplanner/DescriptionPopup.java", "file_name": "DescriptionPopup.java", "file_ext": "java", "file_size_in_byte": 1033, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "84ec279d35533af9865906da8f4fece273b4c5b6", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/adurenator/InteractionProgrammingLab | 201 | FILENAME: DescriptionPopup.java | 0.278257 | package se.kth.csc.iprog.dinnerplanner;
import controllers.DescriptionPopupController;
import controllers.HeaderController;
import se.kth.csc.iprog.dinnerplanner.model.DinnerModel;
import views.DescriptionPopupView;
import views.HeaderView;
import android.app.Activity;
import android.os.Bundle;
public class DescriptionPopup extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.description_popup);
int type = Integer.parseInt(getIntent().getStringExtra("type"));
String name = getIntent().getStringExtra("name");
String image = getIntent().getStringExtra("image");
DinnerModel model = ((DinnerPlannerApplication) this.getApplication()).getModel();
new HeaderController(new HeaderView(this, model), this);
new DescriptionPopupController(new DescriptionPopupView(this, model, type, name, image));
new HeaderController(new HeaderView(this, model), this);
}
}
|
51fa0df0-4367-425f-92f0-a88eb3651fea | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-01-13 06:08:31", "repo_name": "lavin-q/qhm-elasticsearch", "sub_path": "/src/main/java/com/qhm/elasticsearch/controller/ContainerController.java", "file_name": "ContainerController.java", "file_ext": "java", "file_size_in_byte": 1100, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "9e9e034f2f0895a90e3f21910b4bba6960bf1c12", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lavin-q/qhm-elasticsearch | 204 | FILENAME: ContainerController.java | 0.213377 | package com.qhm.elasticsearch.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
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 java.util.HashMap;
/**
* @ Description:
* @ Author: qhm
* @ Date: 2020/3/24 10:15
* @ Version: 1.0
*/
@Controller
@RequestMapping
public class ContainerController {
@Autowired
private ApplicationContext webApplicationContext;
@RequestMapping(path = "/Ioc",method = RequestMethod.GET)
@ResponseBody
public HashMap<String,String[]> allInIoc(){
String[] beanDefinitionNames = webApplicationContext.getBeanDefinitionNames();
return new HashMap<String, String[]>(){{
put("子容器",webApplicationContext.getBeanDefinitionNames());
//put("父容器", webApplicationContext.getParent().getBeanDefinitionNames());
}};
}
}
|
97fede6e-1ff0-456e-aee8-045fdd324185 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-27 21:48:21", "repo_name": "tamoop5858/cdh5", "sub_path": "/futuredata/FileManager.java", "file_name": "FileManager.java", "file_ext": "java", "file_size_in_byte": 1047, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "31a49401e2f79663f0bcde123a85ceca50e625fa", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tamoop5858/cdh5 | 184 | FILENAME: FileManager.java | 0.228156 | package futuredata;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class FileManager {
public String getOutputPath() {
String filePath = "";
File directory = new File("");
try {
filePath = directory.getCanonicalPath();
} catch (IOException e) {
e.printStackTrace();
}
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
df.format(new Date());
File folder = new File(filePath + "\\output\\" + df.format(new Date()));
folder.mkdirs();
return folder.getPath();
}
public String getInputPath() {
String filePath = "";
File directory = new File("");
try {
filePath = directory.getCanonicalPath();
} catch (IOException e) {
e.printStackTrace();
}
filePath = filePath + "\\input\\config.xml";
return filePath;
}
}
|
051b246a-66f1-4161-b797-25bfb57df453 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-06-06 03:29:03", "repo_name": "DanielliUrbieta/souzaUrbieta", "sub_path": "/org.eclipse.jgit/src/command/Command.java", "file_name": "Command.java", "file_ext": "java", "file_size_in_byte": 1200, "line_count": 79, "lang": "en", "doc_type": "code", "blob_id": "267c81cdb332ec663e748c4e79d754c8f7fadcf9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DanielliUrbieta/souzaUrbieta | 315 | FILENAME: Command.java | 0.279828 | package command;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Repository;
/**
* @author Urbieta Souza Superclasse dos comandos basicos do Git
*
*/
abstract class Command {
/***/
protected static Git git;
/**
* Caminho do repositorio local
*/
protected static String localPath;
/**
* Repositorio
*/
protected static Repository repository;
/**
* Endereco do repositorio remoto
*/
protected static String remotePath;
/**
* Nome do arquivo que pode ser adicionado ou removido
*/
protected String file;
/**
* @return localPath
*/
public String getLocalPath() {
return localPath;
}
/**
* @param localPath
* @param remotePath
*/
public Command(String localPath,
String remotePath) {
super();
// Command.git = git;
Command.localPath = localPath;
Command.remotePath = remotePath;
// Command.repository = repository;
}
/**
* @param git
*/
public Command(Git git) {
Command.git = git;
}
/**
* @param localPath2
*/
public Command(String localPath2) {
// Command.git = git2;
Command.localPath = localPath2;
// Command.repository = repository2;
}
/**
* Construto vazio
*/
public Command() {
}
} |
2e26667e-dcf5-47ef-8e49-a193de82f2e7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-11 09:27:19", "repo_name": "Albert-Hugo/RobinDB", "sub_path": "/client/src/main/java/com/ido/robin/client/RobinClient.java", "file_name": "RobinClient.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "8f7da05c64079dbf554229d2383843c61fe437e1", "star_events_count": 27, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Albert-Hugo/RobinDB | 264 | FILENAME: RobinClient.java | 0.23231 | package com.ido.robin.client;
import com.ido.robin.client.netty.Connector;
import com.ido.robin.rpc.proto.RemoteCmd;
import lombok.extern.slf4j.Slf4j;
/**
* @author Ido
* @date 2019/1/24 10:18
*/
@Slf4j
public class RobinClient {
private Connector connector;
public RobinClient(String host, int port) throws Exception {
this.connector = new Connector(host, port);
try {
this.connector.connect();
} catch (Exception ex) {
throw ex;
}
}
public void copyData(String fileName, byte[] data) {
this.connector.copy(fileName, data);
}
public void sendRemoteCopyRequest(String host, int port, int start, int end, RemoteCmd.RemoteCopyRequest.CopyType type) {
this.connector.sendRemoteCopyRequest(host, port, start, end, type);
}
public void put(String k, String v) {
connector.put(k, v);
}
public void delete(String k) {
connector.delete(k);
}
public String get(String k) {
return connector.get(k);
}
public void shutdown() {
connector.close();
}
}
|
56c2a79e-8019-4640-aa40-c51ccd1bcab7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-09 12:51:04", "repo_name": "NewChenJie/JUC-demo", "sub_path": "/src/main/java/com/juc/demo/Lock/LockTest2.java", "file_name": "LockTest2.java", "file_ext": "java", "file_size_in_byte": 1224, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "318d104433dbd75b7222d680567e9c5e542c70e2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/NewChenJie/JUC-demo | 267 | FILENAME: LockTest2.java | 0.283781 | package com.juc.demo.Lock;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* @author : chenjie
* @date : 2019-12-07 15:33
* @describe : lockInterruptibly 可以被打断 并且自己释放锁
*/
public class LockTest2 {
public static void main(String[] args) throws InterruptedException {
Lock lock = new ReentrantLock();
Thread t = new Thread(()->{
try {
lock.lockInterruptibly();
Thread.sleep(4000);
} catch (InterruptedException e) {
} finally {
lock.unlock();
System.out.println(Thread.currentThread().getName() + " finished");
}
});
t.start();
t.interrupt();
Thread.sleep(5000);
}
}
class RunIt2 implements Runnable{
private Lock lock = new ReentrantLock();
@Override
public void run() {
try {
lock.lock();
Thread.sleep(4000);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
lock.unlock();
System.out.println(Thread.currentThread().getName() + " finished");
}
}
}
|
879fe662-e468-4208-acca-3487c7513948 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-01-01T22:43:07", "repo_name": "Rutwik99/Simple-C-Shell", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1071, "line_count": 59, "lang": "en", "doc_type": "text", "blob_id": "13909282a12ddc843ff59733284b210bd76ee5f4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Rutwik99/Simple-C-Shell | 289 | FILENAME: README.md | 0.278257 | **Shell Implementation in C**
**By Rutwik Reddy**
*Introduction*
This is a basic shell implemented using syscalls and C language.
*How to Run*
- Install make (if not installed) by running the command
sudo apt-get install make
- Type the command
make run
- Run the shell
./run
*Features of this Shell*
1. cd command
- cd <dir>
- cd ~
- cd .
- cd ..
- cd
2. pwd command
- pwd
3. echo command
- echo "<text>" (Bonus Marks)
- echo '<text>' (Bonus Marks)
- echo <text>
4. ls command
- ls
- ls -l
- ls -a
- ls -al and its variations
5. System commands
- All commands work for foreground and background processes
- PID is returned when we kill the background process
6. pinfo command(Prints information related to the process)
- pinfo
- pinfo <PID>
Bonus:-
7. remindme command(Prints a message in the shell after a specifed duration)
- remindme <duration> "<message>"
8. clock command(Prints the time of the machine every <duration> seconds)
- clock -t <duration> |
4d39b125-21b4-4ac5-a88a-61f51da9f0d3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-17 09:35:50", "repo_name": "webshine6/SpringProjects", "sub_path": "/Spring-Data-JPA-Security/src/main/java/com/springdev/springbootcrud/services/NotificationService.java", "file_name": "NotificationService.java", "file_ext": "java", "file_size_in_byte": 1014, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "527a7739606ddaa15ea0456fe75af11af2cabfd7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/webshine6/SpringProjects | 206 | FILENAME: NotificationService.java | 0.276691 | package com.springdev.springbootcrud.services;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.springdev.springbootcrud.domains.User;
@Service
public class NotificationService {
private JavaMailSender mailSender;
@Autowired
public NotificationService(JavaMailSender mailSender) {
this.mailSender = mailSender;
}
@Async
public void sendNotification(User user) throws InterruptedException {
System.out.println("Sleeping now...");
Thread.sleep(10000);
System.out.println("Sending email...");
SimpleMailMessage mail = new SimpleMailMessage();
mail.setFrom("rtestdev");
mail.setTo(user.getEmail());
mail.setSubject("Registration");
mail.setText("Registration successfuly");
mailSender.send(mail);
System.out.println("Email sent!");
}
}
|
160c8155-5a7b-4d0f-8a57-2f044f72da80 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-02 04:55:39", "repo_name": "guojunliangJava/concurrent-coding", "sub_path": "/concurrent-coding-service/src/main/java/com/spring/transaction/propagation/TransactionPropagationService.java", "file_name": "TransactionPropagationService.java", "file_ext": "java", "file_size_in_byte": 1030, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "22d18a611a60e25b8edd01ba0745051aa3b63799", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/guojunliangJava/concurrent-coding | 220 | FILENAME: TransactionPropagationService.java | 0.235108 | package com.spring.transaction.propagation;/**
* @author
* @since 2020-11-04 14:45
*/
import com.spring.transaction.OperationService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;
/**
* @author guojl
* @version 1.0.0
* @ClassName UseJdbcWithoutTransactionService.java
* @Description
* @createTime 2020年11月04日 14:45:00
*/
@Service
public class TransactionPropagationService {
public static void main(String[] args) throws InterruptedException {
ApplicationContext context = new ClassPathXmlApplicationContext("classpath*:META-INF/spring/spring-mysql.xml");
OperationPropatationService operationService =
(OperationPropatationService) context.getBean("operationPropatationService");
// operationService.queryScore();
//事务测试
// operationService.mulitOperation();
operationService.requestNew();
}
}
|
e358450f-3d8d-473c-b038-46e4da230c3a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-22 13:26:26", "repo_name": "HasonHuang/java-design-patterns", "sub_path": "/prototype-pattern/src/main/java/com/hason/patterns/prototype/AnimalMapResource.java", "file_name": "AnimalMapResource.java", "file_ext": "java", "file_size_in_byte": 1082, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "36f83f57b8b62f1b015186729358b42e5f2c28c6", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/HasonHuang/java-design-patterns | 248 | FILENAME: AnimalMapResource.java | 0.262842 | package com.hason.patterns.prototype;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.atomic.AtomicLong;
/**
* 动物资源(具体原型类)
*
* @author Huanghs
* @since 2.0
* @date 2019/1/19
*/
@Data
@Slf4j
public class AnimalMapResource implements MapResource<AnimalMapResource>, Cloneable {
private static final AtomicLong COUNTER = new AtomicLong(1);
/** 唯一标识 */
private Long id;
/** 名字 */
private String name;
public AnimalMapResource(Long id, String name) {
this.id = COUNTER.getAndIncrement();
this.name = name;
}
@Override
public AnimalMapResource clone() {
try {
// 实际场景中需要注意浅克隆or深克隆
AnimalMapResource resource = (AnimalMapResource) super.clone();
resource.setId(COUNTER.getAndIncrement());
return resource;
} catch (CloneNotSupportedException e) {
log.error(e.getMessage(), e);
}
return null;
}
}
|
1e80deaa-c8fb-47a3-8e47-ef8f92ba26c6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-03 14:52:17", "repo_name": "dip77/Bus-Reservation-and-Pass-Creation-System", "sub_path": "/src/com/digimation/gujjubus/controller/UserDeleteServlet.java", "file_name": "UserDeleteServlet.java", "file_ext": "java", "file_size_in_byte": 1121, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "970df338d0fd2addec95f3db0176f51c0aaa47ae", "star_events_count": 8, "fork_events_count": 10, "src_encoding": "UTF-8"} | https://github.com/dip77/Bus-Reservation-and-Pass-Creation-System | 202 | FILENAME: UserDeleteServlet.java | 0.293404 | package com.digimation.gujjubus.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.digimation.gujjubus.dao.UserDAO;
public class UserDeleteServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String userid=request.getParameter("id");
if(new UserDAO().checkReference(Integer.parseInt(userid)))
request.setAttribute("msguser", " can't be delete[child record found]");
else if(new UserDAO().removeUser(Integer.parseInt(userid)))
request.setAttribute("msguser", " successfully delete");
else
request.setAttribute("msguser", " failed to delete");
request.getRequestDispatcher("UserListServlet").forward(request, response);
}
}
|
0415c86d-a07c-4662-bf5f-bfb48893b0a2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-05 17:39:01", "repo_name": "Knicksaas/minecraft-server-plugins", "sub_path": "/MLGrush/src/ch/nte/mc/bungee/mlgrush/commands/CMD_logout.java", "file_name": "CMD_logout.java", "file_ext": "java", "file_size_in_byte": 984, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "9924a85928633a33172572ce49e163909c91000d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Knicksaas/minecraft-server-plugins | 233 | FILENAME: CMD_logout.java | 0.245085 | package ch.nte.mc.bungee.mlgrush.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import ch.nte.mc.bungee.mlgrush.events.PlayerJoinEvent;
import ch.nte.mc.bungee.mlgrush.main.Messages;
import ch.nte.mc.bungee.mlgrush.main.Variables;
public class CMD_logout {
public CMD_logout(CommandSender sender, Command cmd, String label, String[] args) {
if(sender instanceof Player) {
Player p = (Player) sender;
if(p.hasPermission("mlgrush.logout")) {
if(Variables.adminList.contains(p.getName())) {
p.sendMessage(ChatColor.GREEN + Messages.logoutMsg);
Variables.adminList.remove(p.getName());
PlayerJoinEvent.addPlayer(p);
} else {
p.sendMessage(ChatColor.RED + Messages.alreadyLoggedOutMsg);
}
} else {
p.sendMessage(ChatColor.RED + Messages.noPermissionsMsg);
}
} else {
System.out.println(Messages.playerOnlyCommandMsg);
}
}
}
|
768e49f3-eb26-4873-b86d-224a183022bf | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-02-10T07:39:17", "repo_name": "gitter-badger/cr-examples", "sub_path": "/vehicle-simulator/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1201, "line_count": 41, "lang": "en", "doc_type": "text", "blob_id": "4a2d31a2d17c8d2742a70048d95773675636e2a8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gitter-badger/cr-examples | 276 | FILENAME: README.md | 0.261331 | # Bosch IoT Central Registry - Example Vehicle Simulator
This example shows how to integrate devices information using Java with the CR.
**Notice:** Currently this demo uses the REST API for the updating the properties of Features of Things.
As soon as the CR supports updating feature properties using the CR-Integration Client for Java this can be changed.
# Build
Use the following maven command to build the server:
```
mvn clean install
```
# Configure your Client Id and other settings
Create or adjust file "config.properties"
```
centralRegistryEndpointUrl=https://cr.apps.bosch-iot-cloud.com
centralRegistryMessagingUrl=wss\://events.apps.bosch-iot-cloud.com
clientId=###your solution id ###\:gateway
apiToken=###your api token ###
keyAlias=CR
keyStorePassword=### your key password ###
keyAliasPassword=### your key alias password ###
#http.proxyHost=### your http proxy host, if you need one ###
#http.proxyPort=### your http proxy host, if you need one ###
```
# Run it
Use the following command to run the example.
```
mvn exec:java -Dexec.mainClass="com.bosch.cr.examples.carintegrator.VehicleSimulator"
```
# Usage
Look in the Inventory Browser and see your vehicle(s) move.
|
c96d641b-5c1f-4b8a-8917-4be43057f56a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-04-11 14:05:51", "repo_name": "dcvh/Android-AugmentedReality", "sub_path": "/app/src/main/java/com/example/op/arview/arview/DetailLocation.java", "file_name": "DetailLocation.java", "file_ext": "java", "file_size_in_byte": 1024, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "b1b3b8fe4ff85fb7db7030d4afd54f5efade3e91", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dcvh/Android-AugmentedReality | 201 | FILENAME: DetailLocation.java | 0.224055 | package com.example.op.arview.arview;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import com.example.op.arview.R;
public class DetailLocation extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail_location);
double lat = 0.0d;
double lon = 0.0d;
String name ="";
String img = "";
lat = getIntent().getExtras().getDouble("lat");
lon = getIntent().getExtras().getDouble("lon");
name = getIntent().getExtras().getString("name");
img = getIntent().getExtras().getString("img");
((TextView)findViewById(R.id.tvName)).setText(name);
((TextView)findViewById(R.id.tvLat)).setText(String.valueOf(lat));
((TextView)findViewById(R.id.tvLon)).setText(String.valueOf(lon));
((TextView)findViewById(R.id.tvImage)).setText(img);
}
}
|
b8ba2fa0-93b2-46cb-bb7e-8c114d54c2d6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-12 00:43:00", "repo_name": "lavsvemulapalli/selenium-using-java", "sub_path": "/SeleniumDemo.java", "file_name": "SeleniumDemo.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "03cb146ddfe062c4488f6a73a5e900dfd7a06289", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lavsvemulapalli/selenium-using-java | 257 | FILENAME: SeleniumDemo.java | 0.294215 | package klm;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class SeleniumDemo {
WebDriver d;
@Before
public void setUp()
{
System.setProperty("webdriver.gecko.driver", "F:\\Driver Server\\geckodriver.exe");
d=new FirefoxDriver();
d.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
@After
public void tearDown()
{
d.quit();
}
@Test
public void testsynch() throws Exception
{
d.get("https://www.google.co.nz/");
d.findElement(By.id("lst-ib")).sendKeys("selenium");
d.findElement(By.xpath("//input[@value='Google Search']")).click();
d.findElement(By.linkText("Selenium - Web Browser Automation")).click();
WebDriverWait b= new WebDriverWait(d,120);
b.until(ExpectedConditions.elementToBeClickable( d.findElement(By.linkText("Projects"))));
d.findElement(By.linkText("Projects")).click();
Thread.sleep(3000);
}
}
|
9e93e5bd-385e-44a6-876c-a55b0756f552 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-05-02 02:02:03", "repo_name": "yupengyan/gzucm_web", "sub_path": "/src/main/java/cn/edu/gzucm/web/framework/config/PropertyStrategy.java", "file_name": "PropertyStrategy.java", "file_ext": "java", "file_size_in_byte": 1197, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "780866ef1255e4ed9557fff4b678a5bc5d6bc00c", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yupengyan/gzucm_web | 199 | FILENAME: PropertyStrategy.java | 0.258326 | package cn.edu.gzucm.web.framework.config;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.springframework.core.io.AbstractResource;
import cn.edu.gzucm.web.utils.MyProperties;
public class PropertyStrategy extends AbstractResource {
private String propertyName;
public PropertyStrategy(String propertyName) {
this.propertyName = propertyName;
}
public PropertyStrategy() {
//org.springframework.beans.factory.config.PropertyPlaceholderConfigurer a = new org.springframework.beans.factory.config.PropertyPlaceholderConfigurer();
//a.setLocation(location)
}
@Override
public String getDescription() {
return null;
}
@Override
public InputStream getInputStream() throws IOException {
File propertyFile = new File(MyProperties.getConfigPath() + "/conf/" + propertyName);
if (propertyFile.exists()) {
return new FileInputStream(propertyFile);
} else {
return this.getClass().getClassLoader().getResourceAsStream(propertyName);
}
}
}
|
411371a8-d3fa-462c-8060-fc18a4f2439f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-07-09 11:55:37", "repo_name": "MartinDai/weChatRobot", "sub_path": "/robot-web/src/main/java/com/doodl6/wechatrobot/response/TextMessage.java", "file_name": "TextMessage.java", "file_ext": "java", "file_size_in_byte": 1031, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "0d85c52b71e9e67c8b51e2acb8d70fc712f47d87", "star_events_count": 203, "fork_events_count": 101, "src_encoding": "UTF-8"} | https://github.com/MartinDai/weChatRobot | 211 | FILENAME: TextMessage.java | 0.200558 | package com.doodl6.wechatrobot.response;
import com.doodl6.wechatrobot.enums.MessageType;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlCData;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import lombok.Getter;
import lombok.Setter;
/**
* 响应消息-> 文本消息
*/
@Getter
@Setter
public class TextMessage extends BaseMessage {
/**
* 内容
**/
@JacksonXmlCData
@JsonProperty("Content")
@JacksonXmlProperty(localName = "Content")
private String content;
public TextMessage() {
super();
setMsgType(MessageType.TEXT.getValue());
}
public TextMessage(String content) {
this();
this.content = content;
}
public TextMessage(String fromUserName, String toUserName, String content) {
this(content);
setFromUserName(fromUserName);
setToUserName(toUserName);
setCreateTime(System.currentTimeMillis());
}
}
|
1c97ddfc-a224-456b-a5ad-68629dab4b79 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-11 04:22:05", "repo_name": "cah-richard-duckworth/fantasy-api", "sub_path": "/src/main/java/com/therick/fantasy/api/data/model/NflTeam.java", "file_name": "NflTeam.java", "file_ext": "java", "file_size_in_byte": 1082, "line_count": 67, "lang": "en", "doc_type": "code", "blob_id": "33a5d85b359a44c1662720a8d9eb283666d07461", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/cah-richard-duckworth/fantasy-api | 287 | FILENAME: NflTeam.java | 0.252384 | package com.therick.fantasy.api.data.model;
import javax.persistence.*;
import java.util.Objects;
import java.util.Set;
/**
* @author Richard W. Duckworth
* @created 11/21/2019
*/
@Entity
public class NflTeam {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String name;
@OneToMany(mappedBy = "nflTeam")
private Set<Player> players;
public NflTeam() {}
public NflTeam(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Set<Player> getPlayers() {
return players;
}
public void setPlayers(Set<Player> players) {
this.players = players;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
NflTeam nflTeam = (NflTeam) o;
return name.equals(nflTeam.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
}
|
e5c57eae-743c-4c9b-8b21-09ca26211721 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-25 12:27:00", "repo_name": "Sonat-Consulting/cicd-demo-app", "sub_path": "/src/main/java/no/sonat/fagdag/cicd/demo/person/resource/PersonController.java", "file_name": "PersonController.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "c1220936ce51223003bccd538286a462969c2485", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/Sonat-Consulting/cicd-demo-app | 223 | FILENAME: PersonController.java | 0.235108 | package no.sonat.fagdag.cicd.demo.person.resource;
import lombok.extern.slf4j.Slf4j;
import no.sonat.fagdag.cicd.demo.person.Person;
import no.sonat.fagdag.cicd.demo.person.PersonRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("persons")
public class PersonController {
private PersonRepository personRepository;
@Autowired
public PersonController(PersonRepository personRepository) {
this.personRepository = personRepository;
}
@PostMapping
public Person create(@RequestBody Person person) {
log.info("Creating person -> {}", person.toString());
return personRepository.save(person);
}
@GetMapping("{personId}")
public Person get(@PathVariable long personId) {
log.info("Fetching person by id {}", personId);
return personRepository.getOne(personId);
}
@GetMapping
public List<Person> get() {
log.info("Fetching all persons");
return personRepository.findAll();
}
}
|
6c0e37d2-d521-4121-9849-13e4df4d14a4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-02-22T20:54:38", "repo_name": "mdhedman/Aceable-Robotic-Pilot", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1047, "line_count": 34, "lang": "en", "doc_type": "text", "blob_id": "79f0dffa8619487cd740ca2d49da957bac547a20", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mdhedman/Aceable-Robotic-Pilot | 254 | FILENAME: README.md | 0.247987 | # Aceable-Robotic-Pilot
> Aceable Robot Pilot Licensing System
####
## Author: Michael Hedman
## Date: 2/22/2019
## Description: This project is to build out the Aceable robot pilot licensing system.
## The project initially calls a public API to retrieve a list of products, including their title, description, and price.
##
## On first load: npm install
## To Run: npm run dev
## Modifications:
## Additional properties were added to the vue-loader.config.js to allow for relative urls in bootstrap.
## See https://bootstrap-vue.js.org/docs/reference/images/ for details.
####
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
```
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
|
11fbae64-79ef-41d9-9b9a-142eeb858726 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-27 02:07:20", "repo_name": "csc668-868-hakunamatata/android-finance-app", "sub_path": "/app/src/main/java/com/example/financeapp/activities/HelpActivity.java", "file_name": "HelpActivity.java", "file_ext": "java", "file_size_in_byte": 1200, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "a038141e6dbd294ba42f7d5a11460e1dec4f8d94", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/csc668-868-hakunamatata/android-finance-app | 191 | FILENAME: HelpActivity.java | 0.210766 | package com.example.financeapp.activities;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.drawerlayout.widget.DrawerLayout;
import android.os.Bundle;
import com.example.financeapp.R;
import com.google.android.material.navigation.NavigationView;
public class HelpActivity extends HomePageActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_nav_help);
//navigation
DrawerLayout drawerLayout;
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
drawerLayout = findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar,
R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawerLayout.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
} |
07c3a89b-b690-4d86-a455-2c364129f310 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-08T01:23:33", "repo_name": "ANGELOS-TSILAFAKIS/NavigationDrawerPublic", "sub_path": "/app/src/main/java/info/android_angel/navigationdrawer/model_tv_id_get_images/TVGetImages.java", "file_name": "TVGetImages.java", "file_ext": "java", "file_size_in_byte": 1021, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "149128e04f00a128ef288611608c7a3887954eea", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ANGELOS-TSILAFAKIS/NavigationDrawerPublic | 246 | FILENAME: TVGetImages.java | 0.255344 | package info.android_angel.navigationdrawer.model_tv_id_get_images;
/**
* Created by ANGELOS on 2017.
*/
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class TVGetImages {
@SerializedName("backdrops")
@Expose
private List<TVGetImages_backdrop> backdrops = null;
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("posters")
@Expose
private List<TVGetImages_poster> posters = null;
public List<TVGetImages_backdrop> getBackdrops() {
return backdrops;
}
public void setBackdrops(List<TVGetImages_backdrop> backdrops) {
this.backdrops = backdrops;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public List<TVGetImages_poster> getPosters() {
return posters;
}
public void setPosters(List<TVGetImages_poster> posters) {
this.posters = posters;
}
}
|
92866090-89c9-48c9-a935-b4189f2b9553 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-04-13T09:56:30", "repo_name": "luckyshot/frontend-framework", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1023, "line_count": 45, "lang": "en", "doc_type": "text", "blob_id": "d696d01c6f82573dce07c2785a8b67bb33c01b81", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/luckyshot/frontend-framework | 227 | FILENAME: README.md | 0.220007 | # LuckyShot Front End Framework
This is a collection of HTML, CSS and JS files that include all the boilerplate code to start a powerful front-end website development project.
It is constantly updated to adapt to the latest changes and best practices in their languages and adapts to modern desktop and mobile browsers as well as gracefully degrading on old browsers.
## How to use
Copy the files, remove what you don't need (faster than adding) and start coding your own stuff.
## What's included
### CSS / SCSS (SASS)
- Grid: micro, responsive and flexible with several breakpoints
- (optional) Readability theme
- Config files
### JavaScript
- Solid and modular code structure with public/private methods/variables
- Vanilla JavaScript DOM selector helpers
- Cookies and Local Storage helpers
### HTML
- Web App info and icons
- Social sharing
- Miscelaneous metas
- Stylesheet and Script loading
## To Do
- Make Grid work mobile-first
## Contact
<a href="http://xaviesteve.com/">xaviesteve.com</a>
|
7764475a-ba5c-49ec-b5fc-834633bda92e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-28 12:59:42", "repo_name": "amid123/motoapp", "sub_path": "/src/main/java/pl/arek/motoappserver/configuration/security/LogedInChecker.java", "file_name": "LogedInChecker.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "aedc061484c7b680a60c452b0bf1eb6f68872abf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/amid123/motoapp | 205 | FILENAME: LogedInChecker.java | 0.255344 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pl.arek.motoappserver.configuration.security;
import pl.arek.motoappserver.domain.entities.User;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
/**
*
* @author Arkadiusz Gibes <arkadiusz.gibes@yahoo.com>
*/
public class LogedInChecker {
public User getLoggedUser() {
User user = null;
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null) {
Object principal = authentication.getPrincipal();
// sprawdzamy czy user nie jest anonimowy
if (principal instanceof UserDetails) {
AppUserDetails userDetails = (AppUserDetails) principal;
user = userDetails.getUser();
}
}
return user;
}
}
|
80a2d2c6-f8e4-4c34-98e1-3c78ab73a764 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-18 07:44:04", "repo_name": "enmaoFu/infrastructure", "sub_path": "/infrastructure-common/src/main/java/com/infrastructure/utils/NumberGeneratorUtils.java", "file_name": "NumberGeneratorUtils.java", "file_ext": "java", "file_size_in_byte": 1359, "line_count": 52, "lang": "zh", "doc_type": "code", "blob_id": "170e7ca9204605744a575d20945ac2fd6a067ced", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/enmaoFu/infrastructure | 365 | FILENAME: NumberGeneratorUtils.java | 0.295027 | package com.infrastructure.utils;
import java.text.DecimalFormat;
public class NumberGeneratorUtils {
private static DecimalFormat df = new DecimalFormat("0000");
/**
* @return String
* @throws :
* @Description(功能描述) : 获取商品单号
* @author(作者) : suyuanliu
* @date (开发日期) : 2017年1月9日 下午17:33:52
*/
public synchronized static String getGoodsNo() {
return getNo("11");
}
/**
* @return String
* @throws :
* @Description(功能描述) : 获取订单单号
* @author(作者) : suyuanliu
* @date (开发日期) : 2017年1月9日 下午17:33:52
*/
public synchronized static String getOrderNo() {
return getNo("10");
}
public static void main(String[] args) {
System.out.println(getOrderNo());
}
/**
* 获取充值单号
* 规则:年2位,月2位,日2位,时2位,分2位,秒2位,随机数6位的字符串
*
* @return
*/
public static synchronized String getNo(String prefix) {
String number = DateUtils.date2String(DateUtils.currentDateTime(), "yyMMddHHmmss");
String str2 = df.format(Long.valueOf(DateUtils.date2String(DateUtils.currentDateTime(), "mmss")));
return prefix + number + str2;
}
}
|
29292672-7edb-44b8-a882-faf7c00efb55 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-06-16 09:39:32", "repo_name": "khemzacz/SImpleUnitConverter", "sub_path": "/app/src/main/java/Listeners/MySettingsListListener.java", "file_name": "MySettingsListListener.java", "file_ext": "java", "file_size_in_byte": 1107, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "ff8673a74fd77bf8ee2f9d59f8b8fb125005dd70", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/khemzacz/SImpleUnitConverter | 213 | FILENAME: MySettingsListListener.java | 0.287768 | package Listeners;
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Toast;
import com.example.konrad.simpleunitconverter.SettingsActivity;
import java.io.Console;
/**
* Created by Konrad on 3/10/2016.
*/
public class MySettingsListListener implements AdapterView.OnItemClickListener {
private SettingsActivity st;
private String selectedItem;
public MySettingsListListener(SettingsActivity st){
super();
this.st=st;
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
selectedItem=st.getMainListAdapter().getItem(position).toString();
if (selectedItem.equals("Result precision")){
st.showPrecisionDialog(st.getMainListView());
}
else if (selectedItem.equals("Keyboard")){
st.showKeyboardDialog(st.getMainListView());
}
else if (selectedItem.equals("Currency details")){
st.showCurrencyDetailsDialog(st.getMainListView());
}
}
}
|
e152dd1c-b163-4b31-8ff0-1e6e853c59ce | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-24 11:23:12", "repo_name": "namhellfire/demoPlayer", "sub_path": "/app/src/main/java/com/app/letsbigo/Handler/EndlessRecyclerOnScrollListener.java", "file_name": "EndlessRecyclerOnScrollListener.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "fcc239f88ba536a2b4c630ce00aa5bc37f22f847", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/namhellfire/demoPlayer | 228 | FILENAME: EndlessRecyclerOnScrollListener.java | 0.26971 | package com.app.letsbigo.Handler;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
/**
* Created by nguyennam on 3/11/17.
*/
public class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public final static String TAG = "EndlessRecyclerOnScrollListener";
private GridLayoutManager gridLayoutManager;
int mLastFirstVisibleItem = 0;
public EndlessRecyclerOnScrollListener(GridLayoutManager gridLayoutManager) {
this.gridLayoutManager = gridLayoutManager;
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
final int currentFirstVisibleItem = gridLayoutManager.findFirstVisibleItemPosition();
final int currentLastVisibleItem = gridLayoutManager.findLastVisibleItemPosition();
final int totalItem = gridLayoutManager.getItemCount();
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
}
}
|
65107f24-0f3b-40e2-8e5a-39dc4bdbd78b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-04 08:12:16", "repo_name": "huangzhibing/softwareComponents", "sub_path": "/src/main/java/com/hqu/modules/purchasemanage/transtype/entity/TranStype.java", "file_name": "TranStype.java", "file_ext": "java", "file_size_in_byte": 1168, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "2a18a41e0d29544929f2e3f4b7d628ff4747c60a", "star_events_count": 1, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/huangzhibing/softwareComponents | 375 | FILENAME: TranStype.java | 0.278257 | /**
* Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.hqu.modules.purchasemanage.transtype.entity;
import com.jeeplus.core.persistence.DataEntity;
import com.jeeplus.common.utils.excel.annotation.ExcelField;
/**
* 运输方式定义Entity
* @author 石豪迈
* @version 2018-04-14
*/
public class TranStype extends DataEntity<TranStype> {
private static final long serialVersionUID = 1L;
private String transtypeid; // 运输方式编码
private String transtypename; // 运输方式名称
private String notes; // 备注
public TranStype() {
super();
}
public TranStype(String id){
super(id);
}
@ExcelField(title="运输方式编码", align=2, sort=7)
public String getTranstypeid() {
return transtypeid;
}
public void setTranstypeid(String transtypeid) {
this.transtypeid = transtypeid;
}
@ExcelField(title="运输方式名称", align=2, sort=8)
public String getTranstypename() {
return transtypename;
}
public void setTranstypename(String transtypename) {
this.transtypename = transtypename;
}
@ExcelField(title="备注", align=2, sort=9)
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
} |
19b80cf2-5278-4f30-bccc-aef797c62adf | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-26 09:35:59", "repo_name": "jango89/transaction-api", "sub_path": "/src/main/java/com/n26/usecase/AddTransaction.java", "file_name": "AddTransaction.java", "file_ext": "java", "file_size_in_byte": 1083, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "23a2d9b56950a7eac2f3f72cf9d73f39386aa74d", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jango89/transaction-api | 195 | FILENAME: AddTransaction.java | 0.294215 | package com.n26.usecase;
import com.n26.domain.Transaction;
import com.n26.exception.FutureTransactionException;
import com.n26.exception.OldTransactionException;
import com.n26.json.TransactionDto;
import com.n26.repository.TransactionRepository;
import org.springframework.stereotype.Service;
@Service
public class AddTransaction {
private final TransactionRepository transactionRepository;
public AddTransaction(TransactionRepository transactionRepository) {
this.transactionRepository = transactionRepository;
}
public void execute(TransactionDto transactionDto) {
final Transaction transaction = new Transaction(transactionDto);
validateTransactionDates(transaction);
transactionRepository.add(transaction);
}
private void validateTransactionDates(Transaction transaction) {
if (transaction.isOldTransaction()) {
throw new OldTransactionException("Transaction time is older than 60 seconds");
} else if (transaction.isFutureTransaction()) {
throw new FutureTransactionException("Transaction time is in future");
}
}
}
|
6b34806a-fa25-49fd-aa94-82755b99671c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-15 20:55:13", "repo_name": "HospitalAssistant/HospitalAssistantServer", "sub_path": "/hospital-assistant-controller/src/main/java/com/hospital/assistant/service/UserServiceImpl.java", "file_name": "UserServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1033, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "d4d903e4500314cb15e2cf506d0a7e0cf54e8fd5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/HospitalAssistant/HospitalAssistantServer | 186 | FILENAME: UserServiceImpl.java | 0.245085 | package com.hospital.assistant.service;
import com.hospital.assistant.domain.UserEntity;
import com.hospital.assistant.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service("userService")
public class UserServiceImpl implements UserService {
@Autowired
UserRepository userRepository;
@Override
public Optional<UserEntity> findByEmail(String email) {
return userRepository.findByEmail(email);
}
@Override
public Boolean existsByEmail(String email) {
return userRepository.existsByEmail(email);
}
@Override
public UserEntity save(UserEntity userEntity) {
return userRepository.save(userEntity);
}
@Override
public Optional<UserEntity> findById(Long id) {
return userRepository.findById(id);
}
@Override
public List<UserEntity> findAll() {
return userRepository.findAll();
}
}
|
d601576d-e19b-4d29-aa13-aeb6fb36ca24 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-11 08:20:58", "repo_name": "ShaoZeng/Android-OpenCV-Demo", "sub_path": "/app/src/main/java/com/example/opencvdemo/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1042, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "f85be0a4a46bdcccf0228237ad37b3a1307767b6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ShaoZeng/Android-OpenCV-Demo | 186 | FILENAME: MainActivity.java | 0.212069 | package com.example.opencvdemo;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private ImageView imageView;
// Used to load the 'native-lib' library on application startup.
static {
System.loadLibrary("native-lib");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView = (ImageView) findViewById(R.id.iv_image);
}
public void clickNDK(View v){
imageView.setImageBitmap(CppImageProcess.getBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.test)));
}
/**
* A native method that is implemented by the 'native-lib' native library,
* which is packaged with this application.
*/
public native String stringFromJNI();
}
|
ea200850-2023-4112-9207-84dadb6d145e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-30 15:49:10", "repo_name": "SmokedKoala/tamagotchi", "sub_path": "/app/src/main/java/ru/practice/tamagotchi/minigame/GameActivity.java", "file_name": "GameActivity.java", "file_ext": "java", "file_size_in_byte": 1056, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "329e97c4bf42d315e91bb1c4b0ef6171f8eb9e09", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/SmokedKoala/tamagotchi | 196 | FILENAME: GameActivity.java | 0.286968 | package ru.practice.tamagotchi.minigame;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Point;
import android.os.Bundle;
import android.view.Display;
import ru.practice.tamagotchi.minigame.GameView;
public class GameActivity extends AppCompatActivity {
private GameView gameView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//создание переменной Point для получения размеров экрана
Display display = getWindowManager().getDefaultDisplay();
Point point = new Point();
display.getSize(point);
System.out.println(point.x);
System.out.println(point.y);
gameView = new GameView(this, point.x,point.y);
setContentView(gameView);
}
@Override
protected void onPause() {
super.onPause();
gameView.pause();
}
@Override
protected void onResume() {
super.onResume();
gameView.resume();
}
} |
f0299d52-22ef-48e5-b45e-010f98591be4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-17 21:18:50", "repo_name": "acasadoquijada/popularmovies-stage2", "sub_path": "/app/src/main/java/com/example/popularmoviesstage2/database/MovieDataBase.java", "file_name": "MovieDataBase.java", "file_ext": "java", "file_size_in_byte": 1089, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "3242f7a905d4b1e944377e9c9223d35a91eafc99", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/acasadoquijada/popularmovies-stage2 | 189 | FILENAME: MovieDataBase.java | 0.26588 | package com.example.popularmoviesstage2.database;
import android.content.Context;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import androidx.room.TypeConverters;
import com.example.popularmoviesstage2.movie.Movie;
@Database(entities = {Movie.class}, version = 1, exportSchema = false)
@TypeConverters({MovieConverter.class, ListConverter.class})
public abstract class MovieDataBase extends RoomDatabase {
private static final Object LOCK = new Object();
private static final String DATABASE_NAME = "moviesdatabase";
private static MovieDataBase sInstance;
public static MovieDataBase getInstance(Context context){
if(sInstance == null){
synchronized (LOCK){
sInstance = Room.databaseBuilder(
context.getApplicationContext(),
MovieDataBase.class,
MovieDataBase.DATABASE_NAME)
.build();
}
}
return sInstance;
}
public abstract MovieDAO movieDAO();
}
|
5287fd98-2b8b-4248-b911-81499d2452f2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-07-27 20:28:38", "repo_name": "Robertelving/CardSmith", "sub_path": "/CardSmith/src/cardSmith/Elements.java", "file_name": "Elements.java", "file_ext": "java", "file_size_in_byte": 1201, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "3bc27bfccf2df718c9c12e39c9c7d5f5a8b66380", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Robertelving/CardSmith | 250 | FILENAME: Elements.java | 0.29584 | package cardSmith;
import java.util.ArrayList;
/**
*
* @author Robert
*/
public class Elements {
//holds all possible elements
private static ArrayList<String> elements = null;
//loads all possible elements from elements.txt
public Elements() {
Elements.elements = FileHandling.readFromfile("elements");
}
/**
*prints out all possible elements. For debugging purposes only
* @return
*/
@Override
public String toString() {
String tmp = "";
for (int i = 0; i < Elements.elements.size(); i++) {
if (i != Elements.elements.size() - 1) {
tmp += Elements.elements.get(i) + "\n";
} else {
tmp += Elements.elements.get(i);
}
}
return tmp;
}
//checks if element exist in collection
public static boolean elementExists(String element){
return Elements.elements.contains(element);
}
//main test class
// public static void main(String[] args) {
// Elements e = new Elements();
// System.out.println(e.toString());
// System.out.println(e.elementExists("Water"));
// }
}
|
a8d66168-c2ea-4bc3-9355-b188a1d4f55d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-10 19:01:22", "repo_name": "adelinastancioi/proiect", "sub_path": "/Project/app/src/main/java/com/example/cristina/project/adapter/QuestionsAdapter.java", "file_name": "QuestionsAdapter.java", "file_ext": "java", "file_size_in_byte": 1108, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "d6debd30af6359f94ba3e878d8ed9b573bf8d1b1", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/adelinastancioi/proiect | 209 | FILENAME: QuestionsAdapter.java | 0.255344 | package com.example.cristina.project.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import com.example.cristina.project.R;
import com.example.cristina.project.model.Question;
import java.util.List;
public class QuestionsAdapter extends BaseAdapter {
private List<Question> lista;
LayoutInflater layoutInflater;
@Override
public Object getItem(int position) {
return lista.get(position);
}
QuestionsAdapter(Context context, List<Question> lista ){
layoutInflater=LayoutInflater.from(context);
this.lista=lista;
}
@Override
public int getCount(){
return lista.size();
}
@Override
public long getItemId(int position){
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView==null){
convertView=layoutInflater.inflate(R.layout.questions_item);
}
}}
|
4f755925-c4a7-47f8-8444-b490c3c02b17 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-01 13:59:22", "repo_name": "MykolaBova/Pavel-Yanushka-interview", "sub_path": "/src/main/java/org/pavel/yanushka/common/models/City.java", "file_name": "City.java", "file_ext": "java", "file_size_in_byte": 1087, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "c192fdfd6e3cbb460d203b5cf0442879deba7bbc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MykolaBova/Pavel-Yanushka-interview | 217 | FILENAME: City.java | 0.278257 | package org.pavel.yanushka.common.models;
import java.io.Serializable;
public class City implements Serializable {
private String placeId;
private String name;
public String getPlaceId() {
return placeId;
}
public void setPlaceId(String placeId) {
this.placeId = placeId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static final class Builder {
private String placeId;
private String name;
private Builder() {
}
public static Builder aSuggest() {
return new Builder();
}
public Builder placeId(String placeId) {
this.placeId = placeId;
return this;
}
public Builder name(String name) {
this.name = name;
return this;
}
public City build() {
City city = new City();
city.setPlaceId(placeId);
city.setName(name);
return city;
}
}
}
|
d8558a6d-98ca-46de-8787-a3c64b325c83 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-03 08:35:40", "repo_name": "woshiwjma956/netty-learn", "sub_path": "/src/main/java/com/ycorn/nettypractices/simple/SimpleNettyClientHandler.java", "file_name": "SimpleNettyClientHandler.java", "file_ext": "java", "file_size_in_byte": 1192, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "bc6bf19f9c69cb38fce1a799864fcfae96553a32", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/woshiwjma956/netty-learn | 265 | FILENAME: SimpleNettyClientHandler.java | 0.259826 | package com.ycorn.nettypractices.simple;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import java.nio.charset.Charset;
/**
* @author : Jim Wu
* @version 1.0
* @function :
* @since : 2020/6/24 17:55
*/
public class SimpleNettyClientHandler extends ChannelInboundHandlerAdapter {
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
// 使用上下文对象创建一个ByteBuf内存管理器
ByteBuf buffer = ctx.alloc().buffer();
// 调用ByteBuf中的writeBytes方法将byte数据写入buf
buffer.writeBytes("helloServer!".getBytes());
ctx.writeAndFlush(buffer);
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
ByteBuf buf = (ByteBuf) msg;
System.out.println("收到服务端的回信: " + buf.toString(Charset.defaultCharset()));
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
ctx.close();
cause.printStackTrace();
}
}
|
80bca789-f4d8-4e6b-b275-2b7cfe25068f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-19 08:11:30", "repo_name": "Otaka/KOSBuild", "sub_path": "/VisualEagle/src/main/java/org/visualeagle/gui/small/directorychooser/ProjectDirectoryChooser.java", "file_name": "ProjectDirectoryChooser.java", "file_ext": "java", "file_size_in_byte": 1089, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "2a611ab49ca0789498996328445a03968403e7a9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Otaka/KOSBuild | 204 | FILENAME: ProjectDirectoryChooser.java | 0.278257 | package org.visualeagle.gui.small.directorychooser;
import java.io.File;
import org.visualeagle.utils.ImageManager;
/**
* @author Dmitry
*/
public class ProjectDirectoryChooser extends DirectoryChooser {
public ProjectDirectoryChooser() {
setOnFileFoundEvent(createOnFileFoundEvent());
setCheckAllowToSelectCallback((TreeElement treeElement) -> {
File folder=treeElement.getFile();
return new File(folder,"kosbuild.json").exists();
});
}
private OnFileFound createOnFileFoundEvent() {
return new OnFileFound() {
@Override
public TreeElement onFileFound(File file) {
if (file.isDirectory()) {
if (new File(file, "kosbuild.json").exists()) {
return new TreeElement(ImageManager.get().getIcon("eagle_small"), file.getName(), file, false);
}
}
return new TreeElement(null, file.getName(), file, file.isDirectory());
}
};
}
}
|
7ac2bfc5-8a9a-4b7b-b037-688e12d7cf0f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-17 13:58:16", "repo_name": "findlunch/WebApp", "sub_path": "/src/main/java/edu/hm/cs/projektstudium/findlunch/webapp/model/validation/passwordReset/PasswordResetPasswordEqualValidator.java", "file_name": "PasswordResetPasswordEqualValidator.java", "file_ext": "java", "file_size_in_byte": 1088, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "36db12235f5e6db6a652bdfc7d0e1b3694ec7a59", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/findlunch/WebApp | 206 | FILENAME: PasswordResetPasswordEqualValidator.java | 0.282988 | package edu.hm.cs.projektstudium.findlunch.webapp.model.validation.passwordReset;
import edu.hm.cs.projektstudium.findlunch.webapp.components.PasswordResetForm;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
/**
* Validates that the password reset passwords are equal.
*/
@Component
public class PasswordResetPasswordEqualValidator implements Validator {
public boolean supports(Class<?> clazz) {
return PasswordResetForm.class.isAssignableFrom(clazz);
}
/**
* Validates that the new and repeated password in the reset form are equal.
* @param target the target
* @param errors the errors
*/
@Override
public void validate(Object target, Errors errors) {
PasswordResetForm passwordResetForm = (PasswordResetForm) target;
if(!passwordResetForm.getNewPassword().equals(passwordResetForm.getNewPasswordRepeat())) {
errors.rejectValue("newPassword", "universal.validation.passwordNotEqual");
}
}
}
|
1c8d0d62-6171-402f-85ec-ac890470f799 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-01-25T19:24:35", "repo_name": "gwyndol1n/hades-asl-extension", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1122, "line_count": 29, "lang": "en", "doc_type": "text", "blob_id": "5813a2fe729d4844eba3ed84fb33ccfeedc52d8b", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gwyndol1n/hades-asl-extension | 248 | FILENAME: README.md | 0.205615 | # hades-asl-extension
Extensions added to Hades Autosplitter script, includes additional information about current run.
# HOW TO USE
1. Download the script and place somewhere accessible by Livesplit.
2. **IMPORTANT!** Make sure to disable Autosplitter if it's being used.
3. Right-click Livesplit > Edit Layout... > Add > Scriptable Auto Splitter
4. Click on the Layout Settings button in the Layout Editor panel.
5. Go to the tab for the Scriptable Auto Splitter we just created and set the Script Path to the downloaded script.
6. (Optional) Configure settings.
- If you wish to customize the layout of the components, either add them pre-emptively, setting the left text to one of the corresponding labels:
- 'Chamber:'
- 'Chaos Gates:'
- 'Story Chambers:'
- 'Map:'
- 'Slow Bosses:'
- 'Fountains:'
- If TextComponents are already placed, the script will use them instead of creating its own.
- If 'Create missing text components underneath timer' is checked, all created components will be inserted directly under the timer component.
7. Enjoy!
|
ac0c4a16-e90a-4be4-b007-7479153349fe | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-22 01:56:01", "repo_name": "kanyanan/canal-elasticsearch", "sub_path": "/src/test/java/test/syn/Lock.java", "file_name": "Lock.java", "file_ext": "java", "file_size_in_byte": 1209, "line_count": 68, "lang": "en", "doc_type": "code", "blob_id": "0e3e4605648709fabc78de4f34c685272bc5ceac", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kanyanan/canal-elasticsearch | 283 | FILENAME: Lock.java | 0.249447 | package test.syn;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.LockSupport;
/**
* 说明 . <br>
* <p>
* <p>
* Copyright: Copyright (c) 2017/12/04 下午2:19
* <p>
* Company: xxx
* <p>
*
* @author zhongcheng_m@yeah.net
* @version 1.0.0
*/
public class Lock {
public static void get() {
LockSupport.park();
}
public static void main(String[] args) {
Student student = new Student("ZHONGC",12);
List<Student> students = new ArrayList<>();
students.add(student);
student = new Student("asd",18);
students.add(student);
}
public static class Student {
public Student(String name, int age) {
this.name = name;
this.age = age;
}
private String name;
private int age;
public String getName() {
return name;
}
public Student setName(String name) {
this.name = name;
return this;
}
public int getAge() {
return age;
}
public Student setAge(int age) {
this.age = age;
return this;
}
}
}
|
26226c24-6d37-42a7-891f-80e99d6d4776 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-03-25T07:26:03", "repo_name": "MCastleSolutions/Scaffold-Framework", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 972, "line_count": 23, "lang": "en", "doc_type": "text", "blob_id": "26f6923f0fade8d630194c0ff7132f1fd1edf9de", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MCastleSolutions/Scaffold-Framework | 204 | FILENAME: README.md | 0.213377 | # Scaffold
Scaffold is an experimental YAML based Android framework written in Kotlin. It aims to provide a mean of dynamic UI. There is a list of features:
- An approach of UI definition that gives a sense of direct representation for visual elements.
- A restricted remote definition of UI elements that allows design changes at server side while ensuring security.
## LICENSE
Copyright 2016 [MCastle Solutions Ltd.](https://www.mapp.hk/)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
<http://www.apache.org/licenses/LICENSE-2.0>
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
67580a10-a98e-440a-9fd3-38c793ce7e0a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-04-20T13:29:39", "repo_name": "uk-gov-mirror/ministryofjustice.hmpps-delius-core-terraform", "sub_path": "/application/ndelius/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1122, "line_count": 17, "lang": "en", "doc_type": "text", "blob_id": "e6382a54284eaa282b6b2995cb1a156413f7fec4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/uk-gov-mirror/ministryofjustice.hmpps-delius-core-terraform | 289 | FILENAME: README.md | 0.245085 | # National Delius - WebLogic NDelius domain
Supports the front-end application for National Delius.
This terraform module defines a load-balanced WebLogic auto-scaling group with the NDelius application deployed.
## Resources
* `weblogic-ndelius.tf` - Module defining WebLogic ASG with an internal application load-balancer
* `nlb.tf` - External network load-balancer to forward traffic on to the internal ALB via a HAProxy ASG.
This is to support static elastic IP addresses that can be whitelisted in external firewalls, whilst maintaining the
ability for us to also whitelist inbound CIDR ranges.
## Outputs
* `private_fqdn_spg_wls_internal_alb` - Private DNS name for the internal ALB eg. ndelius-app-internal.delius-core-dev.internal
* `public_fqdn_spg_wls_internal_alb` - Public DNS name for the internal ALB eg. ndelius-app-internal.dev.delius-core.probation.hmpps.dsd.io
* `private_fqdn_ndelius_external_nlb` - Private DNS name for the external NLB eg. ndelius.delius-core-dev.internal
* `public_fqdn_ndelius_external_nlb` - Public DNS name for the external NLB eg. ndelius.delius-core.probation.hmpps.dsd.io
|
0742caf7-6034-4a28-b55c-35741c9807d5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-06 11:40:49", "repo_name": "kundan-gif/Amazon-Clone", "sub_path": "/app/src/main/java/com/example/amazonclone/Activities/ui/Settings/SettingsFragment.java", "file_name": "SettingsFragment.java", "file_ext": "java", "file_size_in_byte": 1081, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "6cd8b6c9f97e7717affcbe1c87d6dad5faed17f9", "star_events_count": 1, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/kundan-gif/Amazon-Clone | 169 | FILENAME: SettingsFragment.java | 0.243642 | package com.example.amazonclone.Activities.ui.Settings;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import com.example.amazonclone.Activities.LoginActivityP;
import com.example.amazonclone.PreferenceClass.PreferenceHelper;
import com.example.amazonclone.R;
public class SettingsFragment extends PreferenceFragmentCompat {
private Preference preference;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.root_preferences, rootKey);
preference=findPreference("Sign Out");
preference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent=new Intent(getActivity(), LoginActivityP.class);
startActivity(intent);
return false;
}
});
}
} |
ec1b1258-84fc-4d0f-bb82-678c29f15afd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-05-08T20:58:22", "repo_name": "samicoman/nethuns_sameday_m2", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1066, "line_count": 35, "lang": "en", "doc_type": "text", "blob_id": "cff6bc47aef14dd0e14ade9edae577dc765d3a4f", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/samicoman/nethuns_sameday_m2 | 277 | FILENAME: README.md | 0.229535 | # Sameday Courier Romania - Magento 2.3 Module
## Current Features - v. 1.0.0
- get price quote from the API (checkout)
- choose between Sameday and Nextday delivery - if applicable (checkout)
- change the shipping origin (admin)
- change the package type (admin)
- add service taxes by default (admin)
- create shipping label using the Sameday API
## Future Features
### v. 1.1.0
- ro_RO translations
- automatically generate AWB on order placed (admin setting)
- cancel AWB for order in admin (/api/awb/ ..)
- add sandbox configuration
- change insured value (admin)
### v. 1.2.0
- status AWB in admin
- optional service taxes on checkout (deschidere colet, reambalare, colet la schimb, retur documente)
- handle multiple parcels
### v. 1.3.0
- delivery hour interval on checkout
- third party pickup config & api
- estimate delivery timeframe on checkout
- lockers (pickup points?)
### Development TODO list
- write tests for API & Carrier
- mock curl OR replace with HTTPClient
- add uninstall script (to remove configs from db)
- add default config values |
7dfcadb7-3279-4d47-84ad-c2ad376de25e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-08 13:21:49", "repo_name": "avtuhovich/politech", "sub_path": "/src/test/java/HashTableTest.java", "file_name": "HashTableTest.java", "file_ext": "java", "file_size_in_byte": 1011, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "253dcfc8de3e2f17cb68dd30c4be2b18be4ad1e0", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/avtuhovich/politech | 244 | FILENAME: HashTableTest.java | 0.293404 |
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
import main.java.HashTable;
public class HashTableTest {
private HashTable hs;
@Test
public void add() {
hs = new HashTable(4, 5);
hs.add(5);
assertTrue(hs.contains(5));
assertFalse(hs.contains(4));
}
@Test
public void remove() {
hs = new HashTable(4, 5);
hs.add(5);
assertTrue(hs.contains(5));
hs.remove(5);
assertFalse(hs.contains(0));
}
@Test
public void contains() {
hs = new HashTable(4, 5);
hs.add(5);
assertTrue(hs.contains(5));
assertFalse(hs.contains(4));
}
@Test
public void equals() {
hs = new HashTable(4, 7);
this.hs = new HashTable(2, 5);
assertTrue(true);
assertFalse(false);
}
}
|
379d5e4c-4a78-469a-8ae6-e678abc519c8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-28 13:09:43", "repo_name": "lesoudera/bibliotheque", "sub_path": "/SIObibliothequeScratch-master/src/entites/CTest.java", "file_name": "CTest.java", "file_ext": "java", "file_size_in_byte": 1090, "line_count": 64, "lang": "en", "doc_type": "code", "blob_id": "85fd0bf36506e85a25cd9a58565b664958df07c9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lesoudera/bibliotheque | 269 | FILENAME: CTest.java | 0.259826 | package entites;
public class CTest {
protected int id;
protected String nom;
protected int age;
public CTest(int id, String nom, int age) {
this.id = id;
this.nom = nom;
this.age = age;
}
@Override
public String toString() {
String str = "init";
str = this.id + "\n nom : " + this.nom + "\n age : " + this.age;
return str;
}
/**
* @return the id
*/
public int getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(int id) {
this.id = id;
}
/**
* @return the nom
*/
public String getNom() {
return nom;
}
/**
* @param nom the nom to set
*/
public void setNom(String nom) {
this.nom = nom;
}
/**
* @return the age
*/
public int getAge() {
return age;
}
/**
* @param age the age to set
*/
public void setAge(int age) {
this.age = age;
}
}
|
7afa5dac-085d-41cf-97b9-3a394838907c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-11-26T20:36:14", "repo_name": "Meganimation/ingamecc", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1201, "line_count": 42, "lang": "en", "doc_type": "text", "blob_id": "43572308e00e2375e8c73ff6e3c25fe23e6d912b", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Meganimation/ingamecc | 377 | FILENAME: README.md | 0.261331 | </u> <h1> inGame CC</h1> </u>
</br>
</br>
<b> A novelty web application that converts in-game currency into USD </b>
</br>
Deployed at:
<a href='https://morning-crag-16734.herokuapp.com/'> heroku </a>
</br>
</br>
Back-end can be found<a href='https://github.com/Meganimation/inGameCurrencyConverterBACKEND/'> here. </a>
</br>
</br>
<h2> How to Install and View... </h2>
<ul> - Fork the above repo. </ul>
<ul> - Fork <a href='https://github.com/Meganimation/inGameCurrencyConverterBACKEND/'>this</a> repo. </ul>
<ul> - Open both repos in seperate terminals </ul>
<ul> - For the front-end, enter in the terminal 'npm i && npm start' </ul>
<ul> - For the back-end, enter in the terminal 'bundle i && rails s' </ul>
</br>
</br>
<h2> Languages / Frameworks Used... </h2>
</br>
<h3> Frontend </h3>
</br>
HTML, CSS, Javascript, React, JQuery, JSON
<h3> Backend </h3>
</br>
Ruby, Rails, Python, PostGres
</br>
<h2> Credits & Contributions </h2>
A huge thank you to everyone at Flatiron School, and a special shoutout to Eric, Jack, Nicky and Graham for helping me unlock my potential.
</br>
</br>
<i> For any issues, queries, or feedback, please email MeganOliviaWendyAdams@gmail.com </i>
|
f578fc4b-3792-4a67-bea8-ce404e696642 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-25 09:59:07", "repo_name": "Faon2018/springcloud", "sub_path": "/provider-user/src/main/java/com/faon/springcloud/controller/UserController.java", "file_name": "UserController.java", "file_ext": "java", "file_size_in_byte": 1136, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "6d4143e8bb3ed490595badd28f03fb70a5827d1a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Faon2018/springcloud | 219 | FILENAME: UserController.java | 0.216012 | package com.faon.springcloud.controller;
import com.faon.springcloud.entities.User;
import com.faon.springcloud.service.impl.UserServiceImpl;
import com.faon.springcloud.util.ResponsResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/provider/user")
@RefreshScope
public class UserController {
@Autowired
private UserServiceImpl userServiceImpl;
@Value("${server.port}")
private int port;
@RequestMapping(value = "/add",method = RequestMethod.POST)
public ResponsResult addUser(User user){
int i = userServiceImpl.addUser(user);
return new ResponsResult(200,"添加成功",userServiceImpl.selectUserById(i));
}
@GetMapping("/select/{id}")
public User userTest(@PathVariable("id") int id){
return userServiceImpl.selectUserById(id);
}
@GetMapping("/test")
public String test(){
return "端口:"+port;
}
}
|
1680a7dc-e098-47c3-9592-0de419c75d81 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-26 17:00:03", "repo_name": "stwerner97/BKG", "sub_path": "/knowledge_graph/src/main/java/com/group/proseminar/knowledge_graph/nlp/SAXHandler.java", "file_name": "SAXHandler.java", "file_ext": "java", "file_size_in_byte": 1200, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "10ff2e92fc619a2c73b45e574fdfb5fdb6433875", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/stwerner97/BKG | 273 | FILENAME: SAXHandler.java | 0.253861 | package com.group.proseminar.knowledge_graph.nlp;
import java.util.Stack;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/**
* SAX parser handling responses by the DBpedia lookup API.
*
* @author Stefan Werner
*
*/
public class SAXHandler extends DefaultHandler {
private String response;
private Stack<String> elements;
public SAXHandler() {
this.elements = new Stack<>();
this.response = null;
}
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
this.elements.push(qName);
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
this.elements.pop();
}
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
String value = new String(ch, start, length).trim();
if (value.length() == 0) {
return;
}
if ("URI".equals(currentElement())) {
this.response = value;
throw new SAXException("Extracted URI");
}
}
private String currentElement() {
return this.elements.peek();
}
public String getResponse() {
return response;
}
}
|
c739aae3-a0d2-47b6-99bf-cf7983e6e38f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-02 20:54:00", "repo_name": "PPPPPPika/rpo", "sub_path": "/src/main/java/com/example/rpo/Services/Operations/DeleteOperation.java", "file_name": "DeleteOperation.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "50e6c692a30fcf0ef3cfe2ad1184201d7f803685", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/PPPPPPika/rpo | 202 | FILENAME: DeleteOperation.java | 0.295027 | package com.example.rpo.Services.Operations;
import com.example.rpo.Models.Comment;
import com.example.rpo.Repositorys.CommentRepository;
import com.example.rpo.Repositorys.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component("deleteOperation")
public class DeleteOperation implements OperationsInterface {
private final CommentRepository commentRepository;
private final UserRepository userRepository;
@Autowired
public DeleteOperation(CommentRepository commentRepository, UserRepository userRepository) {
this.commentRepository = commentRepository;
this.userRepository = userRepository;
}
private Comment searchComment(Long id){
return commentRepository.findById(id).get();
}
@Override
public void deleteComment(Long id, String currentUser) {
try {
Comment comment = searchComment(id);
if (comment.getAuthor().getName().equals(currentUser)){
comment.setAuthor(null);
commentRepository.delete(comment);
}
} catch (Exception exception) {
exception.printStackTrace();
}
}
}
|
9cbb6703-282f-4d5d-9958-60e86006a620 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-04-18T20:01:46", "repo_name": "fsmoke/ESP8266-Wizard-Package", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1039, "line_count": 24, "lang": "en", "doc_type": "text", "blob_id": "e66dd6ba78973da8c21f35a63e07593d7b5e7ab7", "star_events_count": 3, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/fsmoke/ESP8266-Wizard-Package | 276 | FILENAME: README.md | 0.203075 | # ESP8266-Wizard-Package
Esp8266 visual studio add-in
Originally forked this add in https://bbs.espressif.com/viewtopic.php?t=3577
All copyrights saved.
# Fixes and changes
* Removed VsixInstaller and dependencies from setup script, instead used regkey to determine vs2017 path to run native VsixInstaller
* Fixed irom flash address for NON-OS SDK 2.X.X(and above) versions (was 40000, must be 10000)
* Removed old version of Visual studio(2013, 2015)
* Replaced some graphical files
* Reorganization of project directories(to avoid building to source directory)
* Removed source code from distrib, instead source code can be retrieved from here(source link added to distrib)
* Added new versions NON-OS SDK
* Some terms translated(was in French) to international(English) language
* Fixed ESP init data for NON-OS SDK 2.2.x and above
* Fixed rm utility for python scripts
* Support vs2019
# TODO for future versions
* Add new versions of RTOS SDK
* Rewrite some code templates to support new memory map declaration (NON-OS SDK 3.X.X)
|
5a1dcc05-971b-4781-a481-225c29329a47 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-09 20:12:39", "repo_name": "iammaxence/MochiCine", "sub_path": "/src/servlet/AddFavoris.java", "file_name": "AddFavoris.java", "file_ext": "java", "file_size_in_byte": 1108, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "6fe2dd1f47aa707d34e5e70240c5441491012dd4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/iammaxence/MochiCine | 226 | FILENAME: AddFavoris.java | 0.290981 | package servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
/**
* servlet gerant l'ajout de favoris
* @author
*
*/
public class AddFavoris extends HttpServlet{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* appelle le Service Favoris pour l'ajout d'un favoris a partir
* des information de la requete http
*/
protected void doGet(HttpServletRequest request, HttpServletResponse reponse) throws ServletException,IOException {
String login = request.getParameter("login");
String id_favoris = request.getParameter("id");
String isSerie = request.getParameter("isSerie");
JSONObject res = services.Favoris.addFavoris(login, Integer.parseInt(id_favoris) ,Boolean.parseBoolean(isSerie));
reponse.setContentType("text/json");
PrintWriter out = reponse.getWriter();
out.println(res);
}
}
|
9b474448-aa5d-489e-b97f-9d608febcc27 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-23 07:56:32", "repo_name": "crazyfly1115/jeesite", "sub_path": "/src/main/java/com/thinkgem/jeesite/common/utils/AssertUtil.java", "file_name": "AssertUtil.java", "file_ext": "java", "file_size_in_byte": 1071, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "4e18b2baa8f025cf29bf8c2fbdbfa4d111ed137a", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/crazyfly1115/jeesite | 272 | FILENAME: AssertUtil.java | 0.26588 | package com.thinkgem.jeesite.common.utils;
import org.springframework.util.Assert;
import java.util.List;
/**
* @Author zhangsy
* @Description AssertUtil 继承Assert
* @Date 23:11 2019/1/4
* @Param
* @return
* @Company 重庆尚渝网络科技
* @version v1000
**/
public class AssertUtil extends Assert {
/**
* @Author zhangsy
* @Description AssertUtil 判断为空,直接断言
* @Date 23:16 2019/1/4
* @Param [o, errmsg]
* @return void
* @Company 重庆尚渝网络科技
* @version v1000
**/
public static void notEmpty(Object o,String errmsg){
notNull(o);
if(o instanceof String){
if(StringUtils.isBlank(o.toString()))
throw new IllegalArgumentException(errmsg);
}
if(o instanceof List){
if(((List) o).size()==0){
throw new IllegalArgumentException(errmsg);
}
}
}
public static void notEmpty(Object o){
String errmsg="该参数不能为空";
notNull(o,errmsg);
}
}
|
b4a6db15-19f5-4844-ac3d-f26ad4585231 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-19 22:29:12", "repo_name": "ensiasit/project-tracker-demo", "sub_path": "/src/main/java/ma/ensiasit/ensias/project_tracking/services/TaskServiceImpl.java", "file_name": "TaskServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1030, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "5a06d30c3dd863c826c191563be5a86b375f8d60", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ensiasit/project-tracker-demo | 215 | FILENAME: TaskServiceImpl.java | 0.278257 | package ma.ensiasit.ensias.project_tracking.services;
import lombok.AllArgsConstructor;
import ma.ensiasit.ensias.project_tracking.exceptions.DocumentNotFoundException;
import ma.ensiasit.ensias.project_tracking.models.Task;
import ma.ensiasit.ensias.project_tracking.repositories.TaskRepository;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@AllArgsConstructor
public class TaskServiceImpl implements TaskService {
private final TaskRepository taskRepository;
@Override public List<Task> getAll() {
return taskRepository.findAll();
}
@Override
public Task addTask(Task payload) {
return taskRepository.save(payload);
}
@Override
public Task getTask(String id) {
return taskRepository
.findById(id)
.orElseThrow(() -> new DocumentNotFoundException(String.format("Document with id='%s' not found.", id)));
}
@Override
public Task deleteTask(String id) {
var task = getTask(id);
taskRepository.deleteById(id);
return task;
}
}
|
f2df9c1a-6f3a-440e-b028-6d523a497c95 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-16 15:02:46", "repo_name": "GlobalLogicLatam/android-barcamp", "sub_path": "/app/src/main/java/com/globallogic/barcamp/home/MainPresenter.java", "file_name": "MainPresenter.java", "file_ext": "java", "file_size_in_byte": 1112, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "50d9f20d7d40d943cb00911d18b6a05050686a3c", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/GlobalLogicLatam/android-barcamp | 211 | FILENAME: MainPresenter.java | 0.261331 | package com.globallogic.barcamp.home;
import android.content.DialogInterface;
import com.globallogic.barcamp.BasePresenter;
import com.globallogic.barcamp.data.firebase.FirebaseWorker;
/**
* Created by Gonzalo.Martin on 9/27/2016
*/
public class MainPresenter extends BasePresenter<MainView> {
private FirebaseWorker firebaseWorker = new FirebaseWorker();
public MainPresenter(MainView view) {
super(view);
}
@Override
public void onCreate() {
super.onCreate();
// set home tabs fragment
view.setHomeTabsFragment();
}
public void logoutItemPressed() {
view.displayLogoutConfirmation(new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
// execute logout
firebaseWorker.logout();
dialogInterface.dismiss();
view.notifyLogout();
view.restartApp();
}
});
}
@Override
public boolean canBack() {
return view.fragmentCanBack();
}
}
|
498cd374-85ee-4d97-a9f8-134f9ec87582 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-04 11:59:27", "repo_name": "zmf2006/shop_cloud", "sub_path": "/fenbushi_Log/src/main/java/com/fh/tuils/RedisUtils.java", "file_name": "RedisUtils.java", "file_ext": "java", "file_size_in_byte": 1275, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "9e8d594f5ddd52d2a960f8e7e8e7ea5aaa7095fd", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zmf2006/shop_cloud | 292 | FILENAME: RedisUtils.java | 0.26971 | package com.fh.tuils;
import com.alibaba.fastjson.JSONObject;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import java.util.concurrent.TimeUnit;
//redis的工具类
public class RedisUtils {
//某某池对象
private static JedisPool jedisPool;
//执行一次
static {
// 某某池 最大 最小 初始化大小 空闲时间
JedisPoolConfig poolConfig=new JedisPoolConfig();
poolConfig.setMinIdle(2);
poolConfig.setMaxIdle(5);
//初始化连接池对象
jedisPool=new JedisPool(poolConfig,"192.168.233.129",6379,0);
}
public static String get(String key){
Jedis resource = jedisPool.getResource();
String value = resource.get(key);
jedisPool.returnResource(resource);
return value;
}
public static String set(String key,Object data){
String s = JSONObject.toJSONString(data);
Jedis resource = jedisPool.getResource();
String set = resource.set(key, s);
return set;
}
public static String set(String key,String data){
Jedis resource = jedisPool.getResource();
String set = resource.set(key,data);
return set;
}
}
|
e8e6a203-49b5-48e2-bf82-6b2768cf621a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-07 13:50:46", "repo_name": "Cod4Man/Thread", "sub_path": "/src/com/codeman/thread/activeObject/ActiveObjectProxy.java", "file_name": "ActiveObjectProxy.java", "file_ext": "java", "file_size_in_byte": 1014, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "81ef703b391b087ecb213065d0880df99a0ddd6f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Cod4Man/Thread | 203 | FILENAME: ActiveObjectProxy.java | 0.293404 | package com.codeman.thread.activeObject;
class ActiveObjectProxy implements ActiveObject {
private final Servant servant;
private final SchedularThread schedularThread;
public ActiveObjectProxy(Servant servant, SchedularThread schedularThread) {
this.servant = servant;
this.schedularThread = schedularThread;
}
@Override
public String makeString(int length, char ch) {
FutureResult<String> futureResult = new FutureResult<>();
MethodRequest<String> methodRequest = new MakeStringRequest(servant, futureResult, length, ch);
schedularThread.invoke(methodRequest);
return futureResult.getResultValue();
}
@Override
public String displayString(String text) {
FutureResult<String> futureResult = new FutureResult<>();
MethodRequest<String> methodRequest = new DisplayStringRequest(servant, futureResult, text);
schedularThread.invoke(methodRequest);
return futureResult.getResultValue();
}
}
|
3130fa07-36bf-4ff9-8e67-698ef9cbb53b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-26 22:35:03", "repo_name": "el-keith/Assignment4", "sub_path": "/PokemonTrainer.java", "file_name": "PokemonTrainer.java", "file_ext": "java", "file_size_in_byte": 1053, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "17caf2edd46c021d26a9c767e3551c7fd436e176", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/el-keith/Assignment4 | 227 | FILENAME: PokemonTrainer.java | 0.262842 | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
public class PokemonTrainer {
private String name = "";
private int win = 0;
private ArrayList<Pokemon> team = new ArrayList<Pokemon>();
public PokemonTrainer(String name, ArrayList<Pokemon> team) {
this.name = name;
this.team = team;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getWin() {
return win;
}
public void setWin(int win) {
this.win = win;
}
public ArrayList<Pokemon> getTeam() {
return team;
}
public void setTeam(ArrayList<Pokemon> team) {
this.team = team;
}
// Helper methods goes here
//
//
public String toString() {
return "\n\nTrainer: "+ name + ", Wins: " + win + ", team:" + team;
}
}
|
e467eb40-e081-4e8e-89be-77e4330c3d96 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-04-30T06:34:34", "repo_name": "sgnyjohn/scripts", "sub_path": "/README.mkdn", "file_name": "README.mkdn", "file_ext": "mkdn", "file_size_in_byte": 1123, "line_count": 23, "lang": "en", "doc_type": "text", "blob_id": "b869775fa0de23a474617e6b8271cdf21b81ae47", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sgnyjohn/scripts | 316 | FILENAME: README.mkdn | 0.225417 | Scripts
=========
Bunch of homemade bash scripts which I often use to make my life easier :)
Feel free to fork it for your own use, and I'm open to PRs if you'd like to improve something or fix issues!
* `build-rom.sh`: Builds any android ROM for any device, and uploads it to transfer.sh
* `clone-hals.sh`: Clones QCOM msm8916 HALs which I use to compile Android Pie ROMs for lettuce & A6020
* `clone-bacon-repos.sh`: Clones my Android Pie device sources for bacon
* `clone-A6020-repos.sh`: Clones my Android Pie device sources for A6020
* `ubuntu-setup.sh`: Sets up an Ubuntu 18.04+ server or PC for android builds
* `merge-aosp-tag.sh`: Merges the specified AOSP tag in a ROM source in all repos that are not tracked directly from AOSP
* `merge-caf-tag.sh`: Merges the specified CAF tag in a ROM source in all repos that are not tracked directly from CAF
* `jenkins-setup-gce.sh`: Set up jenkins at port 80 (HTTP port) in a GCE instance running Ubuntu
* `merge-aosp-tag-legacy.sh`: Merge specified AOSP tag in [AOSP-LEGACY](https://github.com/AOSP-LEGACY) ROM source; enhanced version of `merge-aosp-tag.sh`
|
217ca324-654c-4bbc-87c3-c54b8162191b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-11-15 17:20:27", "repo_name": "klyvechen/exchangeme", "sub_path": "/src/main/java/com/sporty/digitalcurrency/tx/GenericTx.java", "file_name": "GenericTx.java", "file_ext": "java", "file_size_in_byte": 1001, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "a38844b331106013937a6a5c89ed61a52eedcaa2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/klyvechen/exchangeme | 200 | FILENAME: GenericTx.java | 0.214691 | package com.sporty.digitalcurrency.tx;
import java.util.ArrayList;
import java.util.List;
public class GenericTx {
private List<Long> inputs;
private List<Long> outputs;
private List<String> signatures;
private List<Long> requireAddresses;
public void addInput(Long input) {
if (inputs == null) {
inputs = new ArrayList<>();
}
inputs.add(input);
}
public void addOutput(Long output) {
if (outputs == null) {
outputs = new ArrayList<>();
}
outputs.add(output);
}
public void addSignature(String sig) {
if (signatures == null) {
signatures = new ArrayList<>();
}
signatures.add(sig);
}
public void addRequireAddr(Long publicKey) {
if (requireAddresses == null) {
requireAddresses = new ArrayList<>();
}
requireAddresses.add(publicKey);
}
public boolean isValid() {
return false;
}
}
|
8cca54a9-f710-497b-aa2d-83c9f0c9925a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-27 06:52:23", "repo_name": "xiaoy00/sharding-jdbc-springcloud-plugin", "sub_path": "/sharding-jdbc-base-service/src/main/java/com/xin/sharding/controller/DataBaseController.java", "file_name": "DataBaseController.java", "file_ext": "java", "file_size_in_byte": 1199, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "46a54fb4100f0ba684fa0fa033069d73decd040c", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xiaoy00/sharding-jdbc-springcloud-plugin | 254 | FILENAME: DataBaseController.java | 0.226784 | package com.xin.sharding.controller;
import com.car.resume.common.SysResult;
import com.xin.sharding.model.vo.ShardingDataBaseVO;
import com.xin.sharding.service.ShardingDataBaseService;
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.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author: songxiaoyue
* @Date: 2018/10/16 18:05
*/
@RestController
@RequestMapping("dataBase")
public class DataBaseController {
@Autowired
ShardingDataBaseService shardingDataBaseService;
@RequestMapping("list")
public Map getAllDateBase(){
List<ShardingDataBaseVO> all = shardingDataBaseService.getAll();
Map<String,Object> map = new HashMap<>();
map.put("data",all);
map.put("code",1);
map.put("count",all.size());
map.put("msg","");
return map;
}
@RequestMapping("add")
public SysResult add(@RequestBody ShardingDataBaseVO vo){
return shardingDataBaseService.insert(vo);
}
}
|
91c86725-ea63-49ae-a856-f08339bb4dd5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-19 01:20:57", "repo_name": "wgcjy/java8", "sub_path": "/src/reflect/ReflectTest01.java", "file_name": "ReflectTest01.java", "file_ext": "java", "file_size_in_byte": 990, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "be490ff359cc70579a5cc26333cdaac11b4b030e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wgcjy/java8 | 255 | FILENAME: ReflectTest01.java | 0.264358 | package reflect;/**
* @Author:zhouxuan
* @Description:
* @Date:2018/1/10 0010 23:24
*/
import java.lang.reflect.Field;
/**
* @Author:zhouxuan
* @create:2018-01-10-23:24
**/
public class ReflectTest01 {
public static void main(String[] args) throws Exception {
//Person p = new Person();
//p.setName("zhangsan");
//p.setPassWord("zhangsan123");
//p.setAge(18);
Class<Person> clazz = Person.class;
Person person = clazz.newInstance();
Field name = clazz.getDeclaredField("name");
name.setAccessible(true);
name.set(person,"zhangsan");
System.out.println(person.getName());
//Field[] fields = clazz.getFields();
//Field[] fields = clazz.getDeclaredFields();//申明的变量
//for (Field field : fields) {
// //field.setAccessible(true);
// //System.out.println("=======");
// System.out.println(field.getName());
//}
}
}
|
a67fe182-fd4b-4365-9e97-078a51ecb106 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-08 04:28:36", "repo_name": "be10ff/AndroidApplication", "sub_path": "/androidApplication/src/main/java/ru/tcgeo/application/wkt/GIDBaseField.java", "file_name": "GIDBaseField.java", "file_ext": "java", "file_size_in_byte": 1003, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "3e00221c827f4be5a0f82f00a1e95d73871e57a0", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/be10ff/AndroidApplication | 299 | FILENAME: GIDBaseField.java | 0.268941 | package ru.tcgeo.application.wkt;
public class GIDBaseField
{
public int m_id;
public String m_name;
public String m_description;
public int m_type;
public int m_sub_type;
public int m_order;
public String m_default_value;
public Object m_value;
public GIDBaseField()
{
m_id = 0;
m_name = "";
m_description = "";
m_type = 0;
m_sub_type = 0;
m_order = 0;
m_default_value = "";
m_value = null;
}
public GIDBaseField(int id, String name, String description, int type, int sub_type, int order, String default_value, Object value)
{
m_id = 0;
m_name = "";
m_description = "";
m_type = 0;
m_sub_type = 0;
m_order = 0;
m_default_value = "";
m_value = value;
}
public GIDBaseField(GIDBaseField temp)
{
m_id = 0;
m_name = new String(temp.m_name);
m_description = new String(temp.m_description);
m_type = 0;
m_sub_type = 0;
m_order = 0;
m_default_value = new String(temp.m_default_value);
m_value = new String(temp.m_default_value);
}
}
|
e35a602c-43c3-4fb1-96b7-d71930655668 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-15 19:20:05", "repo_name": "lsim6580/Cs349-Java-Servlets", "sub_path": "/src/main/java/src/MVC/Models/QuestionViewModel.java", "file_name": "QuestionViewModel.java", "file_ext": "java", "file_size_in_byte": 1014, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "b2a79c77363c06a2b6d5b139f93870f57dfe9bc1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lsim6580/Cs349-Java-Servlets | 203 | FILENAME: QuestionViewModel.java | 0.255344 | package main.java.src.MVC.Models;
import java.util.ArrayList;
import java.util.List;
/**
* Created by luke on 11/12/2016.
*/
public class QuestionViewModel {
//private List<QuestionViewModel> questions;
private String question;
private int id;
public QuestionViewModel(Question question){
this.question = question.getQuestion();
this.id = question.getId();
}
public QuestionViewModel(){};
public List<QuestionViewModel> getQuestions(){
List<QuestionViewModel> questionViewModels = new ArrayList<>();
Question question = new Question();
for(Question q: question.getSQLQuestions()){
questionViewModels.add(makeQuestionView(q));
}
return questionViewModels;
}
public String getQuestion(){
return this.question;
}
public int getID(){
return this.id;
}
public QuestionViewModel makeQuestionView(Question question){
return new QuestionViewModel(question);
}
}
|
8e15721d-cd6a-4144-8b7f-8339a1b95c1a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-05-30 03:12:03", "repo_name": "King-Pan/java-architect", "sub_path": "/code/thread/src/main/java/club/javalearn/thread/lock/ThisLock2.java", "file_name": "ThisLock2.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "9015a15c7b39ab0bc948d22f84f86904baf6fa63", "star_events_count": 7, "fork_events_count": 8, "src_encoding": "UTF-8"} | https://github.com/King-Pan/java-architect | 222 | FILENAME: ThisLock2.java | 0.239349 | package club.javalearn.thread.lock;
import java.util.concurrent.TimeUnit;
/**
* @author king-pan
* @date 2019/3/11
* @Description ${DESCRIPTION}
*/
public class ThisLock2 {
private final Object LOCK = new Object();
public static void main(String[] args) {
ThisLock2 thisLock = new ThisLock2();
new Thread(()->{
try {
thisLock.m1();
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
new Thread(()->{
try {
thisLock.m2();
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
}
public void m1() throws InterruptedException {
synchronized (LOCK){
System.out.println(Thread.currentThread().getName());
TimeUnit.SECONDS.sleep(10);
}
}
public void m2() throws InterruptedException {
synchronized(LOCK){
System.out.println(Thread.currentThread().getName());
TimeUnit.SECONDS.sleep(10);
}
}
}
|
dfb25f7f-0b09-4827-8679-930dc25d8468 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-04-23 15:56:54", "repo_name": "gengzi/Idea-plugins", "sub_path": "/SoulSoother996-GSJ/src/com/scoket/demo/basedemo/demo04/SocketServerDemo.java", "file_name": "SocketServerDemo.java", "file_ext": "java", "file_size_in_byte": 1314, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "a52a3b03e28337dd02c19664728248e7e2f24b27", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gengzi/Idea-plugins | 278 | FILENAME: SocketServerDemo.java | 0.282988 | package com.scoket.demo.basedemo.demo04;
import com.scoket.demo.basedemo.demo05.ThreadServer;
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashSet;
import java.util.Set;
/**
* serverscoket 服务端
* <p>
* 接收用户发来的请求
* 并将消息分发给所有链接的客户端
*/
public class SocketServerDemo {
private Set<Socket> clients;
int prot = 55533;
public SocketServerDemo() {
clients = new HashSet<>(16);
try {
// 创建ServerSocket
ServerSocket serverSocket = new ServerSocket(prot);
System.out.println("聊天室开启");
while (true) {
// 接收客户端的请求,阻塞方法
Socket socket = serverSocket.accept();
System.out.println("新用户");
ThreadServer2 threadServer = new ThreadServer2(socket);
Thread thread = new Thread(threadServer);
thread.start();
}
} catch (IOException e) {
e.printStackTrace();
System.out.println("聊天室异常关闭");
}
}
public static void main(String[] args) throws IOException {
SocketServerDemo socketServerDemo = new SocketServerDemo();
}
}
|
ef9139d4-fb4c-43d7-8280-bc4a54d2b017 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-01-10T07:55:42", "repo_name": "codebot/ros2_patterns", "sub_path": "/nested_services/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1004, "line_count": 37, "lang": "en", "doc_type": "text", "blob_id": "01955dbeadf164e9f8fc7f1d78009bd5ff600462", "star_events_count": 10, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/codebot/ros2_patterns | 228 | FILENAME: README.md | 0.205615 | # ros2_patterns
Greetings. This isn't a real package, just a few little test programs.
## Add security sauce
#### securing my_service
```
ros2 security create_keystore keys
ros2 security create_key keys test_service
ros2 security create_key keys test_client
```
Terminal 1 for the service:
```
export ROS_SECURITY_ROOT_DIRECTORY=`pwd`/keys
export ROS_SECURITY_ENABLE=true
export ROS_SECURITY_STRATEGY=Enforce
./test_service.py
```
Terminal 2 for the client:
```
export ROS_SECURITY_ROOT_DIRECTORY=`pwd`/keys
export ROS_SECURITY_ENABLE=true
export ROS_SECURITY_STRATEGY=Enforce
./test_client.py
```
Performance will be slower during connect because the `ros2` daemon can't
help (by design), so discovery will actually be encrypted peer-to-peer. Note
that much of the latency of setting up encrypted connections is during the
discovery phase, so this example is basically the most inefficient case
possible: it's a new client that starts, does a single trivial request/reply,
and immediately exits.
|
2d080d1f-9f7e-4fae-a2c4-474cb80b8d8b | {"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-common/src/main/java/com/netx/common/vo/common/FrozenOperationRequestDto.java", "file_name": "FrozenOperationRequestDto.java", "file_ext": "java", "file_size_in_byte": 1179, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "b1ad6e17ad63860591f643f435779e703e3ab537", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/biantaiwuzui/netx | 253 | FILENAME: FrozenOperationRequestDto.java | 0.224055 | package com.netx.common.vo.common;
import com.netx.common.common.enums.FrozenTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* Create by wongloong on 17-10-10
*/
@ApiModel
public class FrozenOperationRequestDto {
@ApiModelProperty(value = "参与事件id,类似活动id或购买商品的订单id,与冻结时id一样", required = true)
@NotBlank
private String typeId;
@ApiModelProperty(value = "用户id", required = true)
@NotBlank
private String userId;
@ApiModelProperty(value = "事件类型", required = true)
@NotNull
private FrozenTypeEnum type;
public String getTypeId() {
return typeId;
}
public void setTypeId(String typeId) {
this.typeId = typeId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public FrozenTypeEnum getType() {
return type;
}
public void setType(FrozenTypeEnum type) {
this.type = type;
}
}
|
0a1e19f6-f865-457e-948f-5e77721ad403 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-11-06 19:00:07", "repo_name": "PetroAndrushchakHome/RockRoyal", "sub_path": "/src/main/java/com/nulp/rock/ui/components/Button.java", "file_name": "Button.java", "file_ext": "java", "file_size_in_byte": 1021, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "6988c1f89e54f3b7c7faa6f8c8261f26c17fef6e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/PetroAndrushchakHome/RockRoyal | 201 | FILENAME: Button.java | 0.240775 | package com.nulp.rock.ui.components;
import com.nulp.rock.common.Driver;
import com.nulp.rock.common.Logger;
import com.nulp.rock.localization.Localization;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
public class Button extends NavigationLink {
public Button() {
}
public Button(WebElement wrappedElement, String name, String page) {
super(wrappedElement, name, page);
}
public void submit() {
if (wrappedElement != null) {
highlightElement();
wrappedElement.submit();
Logger.logInfo(Localization.getMessage(Localization.BUTTON_SUBMIT, name, page));
} else
Logger.logError(Localization.getMessage(Localization.NO_BUTTON, name));
}
public boolean checkboxIsChecked() {
highlightElement();
JavascriptExecutor exec = Driver.getCurrentDriver();
return (Boolean) exec.executeScript("return $(arguments[0]).is(\":checked\");", wrappedElement);
}
}
|
d56b0898-cf8c-46b7-8b89-e041776135d1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-15 06:38:12", "repo_name": "feifa168/snort_parser", "sub_path": "/src/main/java/com/ids/jdbc/AbstractDaoBase.java", "file_name": "AbstractDaoBase.java", "file_ext": "java", "file_size_in_byte": 1202, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "08de823e5bb2245353798da7fb1c15577fc0b726", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/feifa168/snort_parser | 221 | FILENAME: AbstractDaoBase.java | 0.262842 | package com.ids.jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public abstract class AbstractDaoBase implements DaoBase {
private String dbdriver;
private String dburl;
private String user;
private String passwd;
private Connection conn = null;
private boolean isvalid = false;
private PreparedStatement pstmt = null;
public AbstractDaoBase(String dbdriver, String dburl, String user, String passwd) throws ClassNotFoundException, SQLException {
this.dbdriver = dbdriver;
this.dburl = dburl;
this.user = user;
this.passwd = passwd;
init();
connection();
}
private void init() throws ClassNotFoundException{
Class.forName(dbdriver);
}
private void connection() throws SQLException {
conn = DriverManager.getConnection(dburl, user, passwd);
isvalid = true;
}
public void close() throws SQLException {
if (conn != null) {
conn.close();
}
}
public Connection getConnection() {
return conn;
}
}
|
13ac12e1-92c7-4fa0-8b58-13c715750591 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-26 03:29:57", "repo_name": "amiirds/Java---programing", "sub_path": "/Homework/s10/ex2/server/src/Repository.java", "file_name": "Repository.java", "file_ext": "java", "file_size_in_byte": 976, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "42c387b5664bb990420d070d01a662e9b4addf92", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/amiirds/Java---programing | 178 | FILENAME: Repository.java | 0.243642 | import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class Repository implements AutoCloseable {
private Connection connection;
private PreparedStatement preparedStatement;
Repository()throws Exception
{
Class.forName("oracle.jdbc.driver.OracleDriver");
connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/xepdb1","amirds","ds123");
}
public void insert(Entity entity)throws Exception
{
preparedStatement=connection.prepareStatement("insert into resturant (address,food,cost) values (?,?,?)");
preparedStatement.setString(1, entity.getAddress());
preparedStatement.setString(2, entity.getFood());
preparedStatement.setString(3, entity.getCost());
preparedStatement.executeUpdate();
}
@Override
public void close() throws Exception {
connection.close();
preparedStatement.close();
}
}
|
cba0f1c8-c448-4fad-9ddc-536bd3480152 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-24 01:19:19", "repo_name": "Namchee/tubes_3", "sub_path": "/app/src/main/java/com/example/tubes_3/presenters/MangaPresenter.java", "file_name": "MangaPresenter.java", "file_ext": "java", "file_size_in_byte": 1051, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "38a1997881f97b27e1bc4f6df0b29f63c276521c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Namchee/tubes_3 | 245 | FILENAME: MangaPresenter.java | 0.290176 | package com.example.tubes_3.presenters;
import androidx.recyclerview.widget.SortedList;
import com.example.tubes_3.model.MangaRaw;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class MangaPresenter {
private List<MangaRaw> mangaRawList;
public MangaPresenter() {
this.mangaRawList = new ArrayList<>();
}
public MangaPresenter(List<MangaRaw> mangaRawList) {
this.mangaRawList = mangaRawList;
}
public void addManga(MangaRaw mangaRaw) {
this.mangaRawList.add(mangaRaw);
}
public List<MangaRaw> getMangaRawList() {
return this.mangaRawList;
}
public MangaRaw getManga(int idx) {
return this.mangaRawList.get(idx);
}
public int getSize() {
return this.mangaRawList.size();
}
public void clearPresenter() {
this.mangaRawList.clear();
}
public void sort(Comparator<MangaRaw> comparator) {
Collections.sort(this.mangaRawList, comparator);
}
}
|
0728ad51-3af2-4190-a9b6-d73664fc69f1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-06 17:46:12", "repo_name": "ragupathiraja184/bigdataniit", "sub_path": "/ex4.java", "file_name": "ex4.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 65, "lang": "en", "doc_type": "code", "blob_id": "c3a1a7c05352f209218a7b248bcec4930b462a15", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ragupathiraja184/bigdataniit | 323 | FILENAME: ex4.java | 0.281406 | import java.util.*;
import java.io.*;
public class ex4
{
public static void main(String []args)
{
try
{
FileOutputStream f=new FileOutputStream("C:\\Users\\Ragupathiraja\\java\\raja.txt");
FileOutputStream f1=new FileOutputStream("C:\\Users\\Ragupathiraja\\java\\raja1.txt");
String s[]=new String[5];
System.out.println("the string are");
Scanner sc=new Scanner(System.in);
for(int i=0;i<5;i++)
{
s[i]=sc.next();
char []x=s[i].toCharArray();
System.out.print(s[i]);
if(x[0]=='a')
{
System.out.print(s[i]);
byte[] b=s[i].getBytes();
f.write(b);
}
else if(x[0]=='e')
{
System.out.print(s);
byte[] b=s[i].getBytes();
f.write(b);
}
else if(x[0]=='i')
{
System.out.print(s[i]);
byte[] b=s[i].getBytes();
f.write(b);
}
else if(x[0]=='u')
{
System.out.print(s[i]);
byte[] b=s[i].getBytes();
f.write(b);
}
else if(x[0]=='o')
{
System.out.print(s[i]);
byte[] b=s[i].getBytes();
f.write(b);
}
//f.write(s);
else
{
System.out.print("consonants" +s[i]);
byte[] b=s[i].getBytes();
f1.write(b);
}
}
f.close();
f1.close();
}
catch(Exception e)
{
System.out.print(e);
}
}
} |
b07fa0e4-accb-4299-bf54-994625a1d560 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-07 08:03:40", "repo_name": "wqjuser/TestMyApi", "sub_path": "/app/src/main/java/com/example/wqj/testmyapi/Bean/EntityMeetingRoomQueryWeekNew.java", "file_name": "EntityMeetingRoomQueryWeekNew.java", "file_ext": "java", "file_size_in_byte": 1229, "line_count": 59, "lang": "en", "doc_type": "code", "blob_id": "662ca09965c39bb6210f3eb18bb23cf3507984e2", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wqjuser/TestMyApi | 289 | FILENAME: EntityMeetingRoomQueryWeekNew.java | 0.268941 | package com.example.wqj.testmyapi.Bean;
/**
* Created by wqj on 2017/9/4.
*/
import org.json.JSONArray;
import java.io.Serializable;
/**
* class_name: EntityMeetingRoomQueryWeekNew
* package: com.snsoft.partner.MeetingManagement.entity
* describe: 重写会场查询本周实体类
* creat_user: 温清洁
* creat_date: 2017/8/23
* creat_time: 14:21
**/
public class EntityMeetingRoomQueryWeekNew implements Serializable {
private String time;
private String week;
private JSONArray mJSONArray;
public EntityMeetingRoomQueryWeekNew(String time, String week, JSONArray JSONArray) {
this.time = time;
this.week = week;
mJSONArray = JSONArray;
}
// private List<EntityMeetingQueryTodayList> mEntityMeetingQueryTodayLists = new ArrayList<>();
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getWeek() {
return week;
}
public void setWeek(String week) {
this.week = week;
}
public JSONArray getJSONArray() {
return mJSONArray;
}
public void setJSONArray(JSONArray JSONArray) {
mJSONArray = JSONArray;
}
}
|
328d9850-aa5e-4430-9f7d-fbc4785b781d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-09-15T21:58:29", "repo_name": "dmitri-liventsev/symfony-ddd-shop-sample", "sub_path": "/COMMENTS.md", "file_name": "COMMENTS.md", "file_ext": "md", "file_size_in_byte": 1081, "line_count": 23, "lang": "en", "doc_type": "text", "blob_id": "3f9f453814d3dbaa56c799b8051602e87e352f38", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dmitri-liventsev/symfony-ddd-shop-sample | 240 | FILENAME: COMMENTS.md | 0.262842 | ### Not implemented ObjectValues:
- Product.price - should extend some Money class, there are few in open source.
### ORM assumptions
Product type should be entity, not a string
Foreign keys between Order_item - Product, Order_Customer - User was excluded, to avoid any cascade deletion. Orders should stay on the system
### Not implemented features:
Order should contain collection of OrderItems.
Order should contain worked statuses, and handle in async mode.
Order could be canceled, it means at we should return OrderItem products to the Store
Entity timestamps (updated_at, created_at)
### Migrations.
On the live project should be realized migrations instead of using doctrine:schema:create command, but for dev its ok.
### Not realized requirements:
- Logs
- Symfony already has PSR 3 log system, just added event logging there!
- Tests
- Was added only functional tests, its enough to be sure at all endpoints works, but need full code coverage by unit tests
My daughter, asked to help me, so here is her comment: ";it5l3jjjjjttt7r;2fm" |
d55df306-af42-4eb1-b97e-f9dd9dc6538b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-05T02:46:22", "repo_name": "b4456609/movie-theater", "sub_path": "/src/main/java/ntou/soselab/movie/controller/ServiceTestController.java", "file_name": "ServiceTestController.java", "file_ext": "java", "file_size_in_byte": 1028, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "a5ad5c735be60cf29526b1cd8eab9a8157a2b2ca", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/b4456609/movie-theater | 248 | FILENAME: ServiceTestController.java | 0.283781 | package ntou.soselab.movie.controller;
import ntou.soselab.movie.controller.dto.ServiceTestDTO;
import ntou.soselab.movie.model.Show;
import ntou.soselab.movie.repository.ShowRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ServiceTestController {
@Autowired
private ShowRepository showRepository;
@PostMapping("/serviceTest")
public void serviceTest(@RequestBody ServiceTestDTO serviceTestDTO) {
if (serviceTestDTO.getState().equals("The show id'5ef2bf0d-6dbf-4de8-a095-93690854da5b' is exist and has 2 more seats")) {
this.setShow();
}
}
private void setShow() {
showRepository.save(Show.builder()
.id("5ef2bf0d-6dbf-4de8-a095-93690854da5b")
.emptySeat(10)
.build());
}
}
|
90d0190d-993b-4556-9385-66e0b8c2ea47 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-07 22:12:44", "repo_name": "saarw/protostats", "sub_path": "/protostats-android/app/src/main/java/se/saar/protostats/RunnableScenario.java", "file_name": "RunnableScenario.java", "file_ext": "java", "file_size_in_byte": 1121, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "03ac72256eb6b679666ebcbfa92cfc7495092d25", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/saarw/protostats | 223 | FILENAME: RunnableScenario.java | 0.258326 | package se.saar.protostats;
import android.os.RecoverySystem;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Created by william on 2014-12-31.
*/
public class RunnableScenario {
private final ScenarioID id;
private final ScenarioLogic scenarioLogic;
private final AtomicInteger runProgress = new AtomicInteger();
public RunnableScenario(ScenarioID id, ScenarioLogic logic) {
this.id = id;
this.scenarioLogic = logic;
}
public void run(String token, ScenarioRunner context) throws Exception {
scenarioLogic.run(token, context, new RecoverySystem.ProgressListener() {
@Override
public void onProgress(int progress) {
runProgress.set(1);
runProgress.set(progress);
}
});
}
public int getProgress() {
return runProgress.get();
}
public ScenarioID getScenarioId() {
return id;
}
interface ScenarioLogic {
public void run(String token, ScenarioRunner context, RecoverySystem.ProgressListener progressListener) throws Exception;
}
}
|
06fdfd78-2740-4500-955f-ccc158887346 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-17 10:30:16", "repo_name": "TanyaOdyniuk/NetcrackerTestTask", "sub_path": "/src/main/java/com/netcracker/entity/Author.java", "file_name": "Author.java", "file_ext": "java", "file_size_in_byte": 1012, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "612b87680c3681da2786c38d70ac49927a2fdf0a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/TanyaOdyniuk/NetcrackerTestTask | 216 | FILENAME: Author.java | 0.258326 | package com.netcracker.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
@Entity
public class Author implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "author_id")
private Long id;
private String authorInfo;
@OneToMany(mappedBy = "author",fetch = FetchType.LAZY)
@JsonIgnore
private List<Book> books;
public Author() {
}
public Author(String authorInfo) {
this.authorInfo = authorInfo;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAuthorInfo() {
return authorInfo;
}
public void setAuthorInfo(String authorInfo) {
this.authorInfo = authorInfo;
}
public List<Book> getBooks() {
return books;
}
public void setBooks(List<Book> books) {
this.books = books;
}
} |
c2583e5f-7a92-4067-a66d-6d18248eafc9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-12 22:33:46", "repo_name": "matadini/net-integrator", "sub_path": "/net-integrator-db-util/src/main/java/pl/inzynier/netintegrator/db/util/JpaRepositoryUtil.java", "file_name": "JpaRepositoryUtil.java", "file_ext": "java", "file_size_in_byte": 1107, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "79326b138437a2a6a317812eee422001e60734c6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/matadini/net-integrator | 186 | FILENAME: JpaRepositoryUtil.java | 0.253861 | package pl.inzynier.netintegrator.db.util;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import com.google.common.collect.Maps;
import java.util.Map;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class JpaRepositoryUtil {
public static <T, PK> T read(Class<T> entityClass, PK id, EntityManager entityManager) {
return entityManager.find(entityClass, id);
}
public static <T> T merge(T entity, EntityManager entityManager) {
EntityTransaction transaction = entityManager.getTransaction();
transaction.begin();
entity = entityManager.merge(entity);
transaction.commit();
return entity;
}
public static <T> void delete(T entity, EntityManager entityManager) {
EntityTransaction transaction = entityManager.getTransaction();
transaction.begin();
entityManager.remove(entity);
transaction.commit();
}
}
|
4ad83e62-d081-4b44-810d-0546440b53af | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-02 16:37:05", "repo_name": "AnnamaryC/Flicks", "sub_path": "/app/src/main/java/com/example/anitac/flicks/models/MovieData.java", "file_name": "MovieData.java", "file_ext": "java", "file_size_in_byte": 1201, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "15aeb2a90bb01dc9778b01d38d83424944be0d2f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AnnamaryC/Flicks | 244 | FILENAME: MovieData.java | 0.23793 | package com.example.anitac.flicks.models;
import org.json.JSONException;
import org.json.JSONObject;
import org.parceler.Parcel;
/**
* Created by anitac on 6/27/18.
*/
@Parcel // makes class parcelable
public class MovieData {
private String title;
private String overview;
private String posterPath; //not full url, just path
private String backdropPath;
private Double voteAverage;
public MovieData(){}
public MovieData(JSONObject object){
try {
title = object.getString("title");
overview = object.getString("overview");
posterPath = object.getString("poster_path");
backdropPath = object.getString("backdrop_path");
voteAverage = object.getDouble("vote_average");
} catch (JSONException e) {
e.printStackTrace();
}
}
public Double getVoteAverage() {
return voteAverage;
}
public String getTitle() {
return title;
}
public String getBackdropPath() {
return backdropPath;
}
public String getOverview() {
return overview;
}
public String getPosterPath() {
return posterPath;
}
}
|
37afe9d1-9ae1-46ff-8280-f1c778fe2f8c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-09 23:10:06", "repo_name": "hcheng628/Spring4", "sub_path": "/spring-jdbc-transaction/src/test/java/us/supercheng/spring4/jdbc/transaction/annoation/db/test/DB_Connection_Test.java", "file_name": "DB_Connection_Test.java", "file_ext": "java", "file_size_in_byte": 1107, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "f64a59455fb2917e63a804884f5e51bb0734e20a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hcheng628/Spring4 | 219 | FILENAME: DB_Connection_Test.java | 0.255344 | package us.supercheng.spring4.jdbc.transaction.annoation.db.test;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import javax.sql.DataSource;
public class DB_Connection_Test {
private final String springIoCConfigFile = "Spring-IoC-Config.xml";
ApplicationContext appContext;
@Before
public void warmUp() {
this.appContext = new ClassPathXmlApplicationContext(springIoCConfigFile);
}
@Test
public void c3p0_Test() {
DataSource dataSource = (DataSource) this.appContext.getBean("dbSourcePool");
System.out.println("DataSource: " + dataSource);
}
@Test
public void namedParamJdbcTemplate() {
NamedParameterJdbcTemplate namedParameterJdbcTemplate = (NamedParameterJdbcTemplate) appContext.getBean("namedParameterJdbcTemplate");
System.out.println("NamedParameterJdbcTemplate: " + namedParameterJdbcTemplate);
}
} |
e61b9c47-b86e-42bc-8041-fad92692b6e7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-27 17:55:23", "repo_name": "eastbanctechru/Reamp", "sub_path": "/sample/src/test/java/example/reamp/TestView.java", "file_name": "TestView.java", "file_ext": "java", "file_size_in_byte": 1066, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "c313712fee96770054e16842e9c6a3777f63ae69", "star_events_count": 56, "fork_events_count": 11, "src_encoding": "UTF-8"} | https://github.com/eastbanctechru/Reamp | 246 | FILENAME: TestView.java | 0.26588 | package example.reamp;
import android.content.Context;
import etr.android.reamp.mvp.MvpDelegate;
import etr.android.reamp.mvp.ReampPresenter;
import etr.android.reamp.mvp.ReampStateModel;
import etr.android.reamp.mvp.ReampView;
public class TestView<SM extends ReampStateModel> implements ReampView<SM> {
private MvpDelegate delegate = new MvpDelegate(this);
public TestView() {
delegate.onCreate(null);
delegate.connect();
}
@Override
public Context getContext() {
return null;
}
@Override
public void onStateChanged(SM stateModel) {
}
@Override
public void onError(Throwable throwable) {
}
@Override
public String getMvpId() {
return delegate.getId();
}
@Override
public SM onCreateStateModel() {
return null;
}
@Override
public ReampPresenter<SM> onCreatePresenter() {
return null;
}
@Override
public ReampPresenter<SM> getPresenter() {
return delegate.<ReampPresenter<SM>, SM>getPresenter();
}
}
|
246a046e-fbfb-472f-8af8-92dd6b50b853 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-21 15:24:24", "repo_name": "Jola-Witaszak/kodilla-library", "sub_path": "/src/main/java/com/crud/library/controller/UserController.java", "file_name": "UserController.java", "file_ext": "java", "file_size_in_byte": 1123, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "e1dcbcdfd5df468b324f52b9f2211a111d032c9b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Jola-Witaszak/kodilla-library | 206 | FILENAME: UserController.java | 0.26971 | package com.crud.library.controller;
import com.crud.library.dbService.UserService;
import com.crud.library.domain.UserDto;
import com.crud.library.exception.UserAlreadyExistsException;
import com.crud.library.exception.UserNotExistsException;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/library/user")
@CrossOrigin(origins = "*")
@RequiredArgsConstructor
public class UserController {
private final UserService userService;
@PostMapping
public UserDto create(@RequestBody UserDto userDto) throws UserAlreadyExistsException {
return userService.createUser(userDto);
}
@GetMapping("/{userId}")
public UserDto get(@PathVariable long userId) throws UserNotExistsException {
return userService.getUser(userId);
}
@GetMapping
public List<UserDto> getUsers() {
return userService.getUsers();
}
@DeleteMapping("/{userId}")
public void delete(@PathVariable long userId) throws UserNotExistsException {
userService.deleteUser(userId);
}
}
|
86e601e7-ae2b-4981-bbc1-173fb0ffdb73 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-15 06:52:21", "repo_name": "WorksApplications/swagger-code-builder", "sub_path": "/src/main/java/com/worksap/webapi/codingstarter/model/PathOperation.java", "file_name": "PathOperation.java", "file_ext": "java", "file_size_in_byte": 359, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "cfd4629047ecbc81f0f571dbb8c1a67598e803d1", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/WorksApplications/swagger-code-builder | 214 | FILENAME: PathOperation.java | 0.253861 | /*
* Copyright 2016 Works Applications Co.,Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.worksap.webapi.codingstarter.model;
import io.swagger.models.Operation;
import lombok.Value;
/**
* Normalized PathItem and Operation object.
*
* It can process operation regardless of the methods.
*/
@Value
public class PathOperation {
private final String path;
private final Operation operation;
private final String method;
}
|
c945a917-2170-496f-8170-b8a04236817f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-08 10:24:58", "repo_name": "pieceofnerd/nix-4", "sub_path": "/module_2/json-parser/src/main/java/ua/com/alevel/ParserJson.java", "file_name": "ParserJson.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "375367f1914e875b563af04f490a2ffa2fc341fd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/pieceofnerd/nix-4 | 204 | FILENAME: ParserJson.java | 0.276691 | package ua.com.alevel;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Scanner;
import java.util.StringJoiner;
public class ParserJson {
public static <T> List<String> readJson(String file) {
ObjectMapper objectMapper = new ObjectMapper();
try {
List<String> dates = objectMapper.readValue(readFile(file), new TypeReference<>() {
});
return dates;
} catch (JsonProcessingException e) {
throw new RuntimeException("Problems with ObjectMapper");
}
}
public static String readFile(String file) {
Path fileName = Path.of(file);
try {
return Files.readString(fileName);
} catch (IOException e) {
throw new RuntimeException();
}
}
}
|
75db2466-f498-430a-a888-9ddfe8d66dbd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-30 11:29:12", "repo_name": "snejka844/JavaProjects", "sub_path": "/Solution/company/src/com/Manager.java", "file_name": "Manager.java", "file_ext": "java", "file_size_in_byte": 1201, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "77896407dce578ce151706b849928d639a83be33", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/snejka844/JavaProjects | 257 | FILENAME: Manager.java | 0.282196 | package com;
import java.security.InvalidParameterException;
public class Manager extends Employee {
private String manageDeptName;
private StaffAppointHandler staffAppoint;
public Manager(String name, double salary, String manageDeptName) {
super(name, salary);
setManageDeptName(manageDeptName);
}
public final String getManageDeptName() {
return manageDeptName;
}
public final void setManageDeptName(String manageDeptName) {
if(manageDeptName == null) {
throw new InvalidParameterException("manageDeptName was null");
}
this.manageDeptName = manageDeptName;
}
public void addStaffAppointHandler(StaffAppointHandler staffAppoint) {
if(staffAppoint == null) {
throw new InvalidParameterException("staffAppoint was null");
}
this.staffAppoint = staffAppoint;
}
public void onStaffAppoint(Staff member, double newStaffMemberSalary) {
staffAppoint.addStaff(new StaffAppointEventArgs(member, newStaffMemberSalary));
}
@Override
public String toString() {
return String.format("%s %s", super.toString(), manageDeptName);
}
}
|
df8d4ee4-912a-4fe8-842a-bc441ca591b3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-08-29T11:31:24", "repo_name": "shashwatkathuria/FlappyBird-GameDevelopment", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1011, "line_count": 34, "lang": "en", "doc_type": "text", "blob_id": "baba3861aed4a414dd8523151b6c6dce81bc2790", "star_events_count": 3, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/shashwatkathuria/FlappyBird-GameDevelopment | 235 | FILENAME: README.md | 0.259826 | # FlappyBird-GameDevelopment   
----------------------------
ABOUT THE PROJECT
----------------------------
This is the 2D game Flappy Bird.
----------------------------
TECHNOLOGIES USED
----------------------------
- Lua 5.2.4
- LÖVE2D 11.2
----------------------------
INSTRUCTIONS TO RUN THE PROJECT
----------------------------
Type the following commands in sequential order to run the game:
sudo apt install lua (To install lua)
sudo snap install love (To intall love2d framework)
[ignore above two commands if already installed]
love .
----------------------------
CONTROLS
----------------------------
## Left Player
- space to flap, cross in between the pipes as far as possible
---------------------------
|
3d8c86f0-df74-4ae3-bf38-6f3641425c0f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-18 01:11:16", "repo_name": "UPMitd/MadridColab", "sub_path": "/madridColab/microservices/services/members-service/src/main/java/org/xcolab/service/members/web/CommunityRegistryController.java", "file_name": "CommunityRegistryController.java", "file_ext": "java", "file_size_in_byte": 1110, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "b8d6e7b9f393cff4ea2e4b66c650a4640e9875d2", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/UPMitd/MadridColab | 177 | FILENAME: CommunityRegistryController.java | 0.242206 | package org.xcolab.service.members.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.xcolab.model.tables.pojos.CommunityRegistry;
import org.xcolab.service.members.service.member.UserService;
@RestController
@RequestMapping("/communityRegistry")
public class CommunityRegistryController {
private final UserService memberService;
@Autowired
public CommunityRegistryController(UserService memberService) {
Assert.notNull(memberService, "UserService bean is required");
this.memberService = memberService;
}
@PostMapping
public CommunityRegistry createCommunityRegistry(@RequestBody CommunityRegistry communityRegistry) {
return memberService.createCommunityRegistry(communityRegistry.getIdUser(), communityRegistry.getIdCommunity());
}
}
|
6ef4048f-6336-46c8-abc1-72b9c509ad0e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-07-04 07:52:46", "repo_name": "xBlackCat/ice-framework-idea-plugin", "sub_path": "/frozen-base/src/main/java/org/xblackcat/frozenidea/IceFileType.java", "file_name": "IceFileType.java", "file_ext": "java", "file_size_in_byte": 1123, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "c94fa6cd587ae189936b555724d558227d20e7a8", "star_events_count": 7, "fork_events_count": 3, "src_encoding": "UTF-8"} | https://github.com/xBlackCat/ice-framework-idea-plugin | 235 | FILENAME: IceFileType.java | 0.236516 | package org.xblackcat.frozenidea;
import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.xblackcat.frozenidea.util.SliceIcons;
import javax.swing.*;
/**
* @author xBlackCat
*/
public class IceFileType extends LanguageFileType {
public static final IceFileType INSTANCE = new IceFileType();
private static final String DEFAULT_EXTENSION = "ice";
protected IceFileType() {
super(SliceLanguage.INSTANCE);
}
@NotNull
@Override
public String getName() {
return "SLICE";
}
@NotNull
@Override
public String getDescription() {
return "ZeroC ICE definition file";
}
@NotNull
@Override
public String getDefaultExtension() {
return DEFAULT_EXTENSION;
}
@Override
public Icon getIcon() {
return SliceIcons.FILE_ICON;
}
@Override
public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) {
return CharsetToolkit.UTF8;
}
}
|
58244872-616e-4617-8851-f0a0ffe52f0c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-11-01 10:09:40", "repo_name": "Vicky18-2/Cinema-", "sub_path": "/src/main/java/server/filter/SecurityFilter.java", "file_name": "SecurityFilter.java", "file_ext": "java", "file_size_in_byte": 1010, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "218cc64e83279c87a308dc304e2aaf02e9b89d6f", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/Vicky18-2/Cinema- | 179 | FILENAME: SecurityFilter.java | 0.239349 | package server.filter;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
/**
* Filter to not allow users to get into admin pages
*/
@WebFilter(filterName = "server.filter.SecurityFilter")
public class SecurityFilter implements Filter {
public void destroy() {
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
HttpServletRequest req = (HttpServletRequest) request;
HttpSession session = req.getSession();
String role = (String) session.getAttribute("ses_role");
if (role != "ADMIN") {
((HttpServletResponse) response).sendRedirect("/");
} else {
chain.doFilter(req, response);
}
}
public void init(FilterConfig config) throws ServletException {
}
}
|
a5dac914-8d7b-45d4-887e-71ec79f946a9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-23 04:51:50", "repo_name": "darsh9292/JSF-Practice", "sub_path": "/src/java/com/darshan/proxy/ShipmentProxy.java", "file_name": "ShipmentProxy.java", "file_ext": "java", "file_size_in_byte": 1011, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "fc2edb3eedc396681a1b3f1e9590b6db203148df", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/darsh9292/JSF-Practice | 234 | FILENAME: ShipmentProxy.java | 0.233706 | package com.darshan.proxy;
import java.util.ArrayList;
import java.util.List;
/**
* @author Darshan Patel
*/
public class ShipmentProxy {
private Long id;
private boolean status;
private String name;
private List<ShipmentRow> shipmentRowList = new ArrayList<ShipmentRow>();
public ShipmentProxy(Long id, String name) {
this.id = id;
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public boolean isStatus() {
return status;
}
public void setStatus(boolean status) {
this.status = status;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<ShipmentRow> getShipmentRowList() {
return shipmentRowList;
}
public void setShipmentRowList(List<ShipmentRow> shipmentRowList) {
this.shipmentRowList = shipmentRowList;
}
}
|
4aa9cdd2-c0e3-4c84-a827-05a419f83829 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-07-27 07:18:13", "repo_name": "sn790519/Jkindey", "sub_path": "/app/src/main/java/com/liji/jkidney/adapter/LifeHealthyInfoAda.java", "file_name": "LifeHealthyInfoAda.java", "file_ext": "java", "file_size_in_byte": 1024, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "6798c3f208e0eaabf526faa40dc2de10097cdae8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sn790519/Jkindey | 250 | FILENAME: LifeHealthyInfoAda.java | 0.225417 | package com.liji.jkidney.adapter;
import android.widget.ImageView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.liji.jkidney.R;
import com.liji.jkidney.model.info.M_Life_Healthy;
import com.nostra13.universalimageloader.core.ImageLoader;
import java.util.List;
/**
* 作者:liji on 2016/6/29 13:49
* 邮箱:lijiwork@sina.com
*/
public class LifeHealthyInfoAda extends BaseQuickAdapter<M_Life_Healthy> {
ImageLoader imageLoader = ImageLoader.getInstance();
public LifeHealthyInfoAda(List<M_Life_Healthy> data) {
super(R.layout.item_info_life, data);
}
@Override
protected void convert(BaseViewHolder holder, M_Life_Healthy info) {
imageLoader.displayImage(info.getPicUrl(), (ImageView) holder.getView(R.id.item_img));
holder.setText(R.id.item_title,info.getTitle());
holder.setText(R.id.item_time,info.getCtime());
holder.setText(R.id.item_from,info.getDescription());
}
}
|
74270c88-3afb-48ac-8bbe-2aa7d6c032ee | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-16 17:41:55", "repo_name": "n0noob/rest-best-practices", "sub_path": "/src/test/java/com/learn/restbestpractices/repositories/AuthorRepositoryTest.java", "file_name": "AuthorRepositoryTest.java", "file_ext": "java", "file_size_in_byte": 1045, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "36a192900c0b34da6c033bf84d0d43322af0fe51", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/n0noob/rest-best-practices | 203 | FILENAME: AuthorRepositoryTest.java | 0.280616 | package com.learn.restbestpractices.repositories;
import com.learn.restbestpractices.entities.Author;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import static org.junit.jupiter.api.Assertions.assertSame;
import java.time.LocalDateTime;
import java.util.Date;
@DataJpaTest
public class AuthorRepositoryTest {
@Autowired
private AuthorRepository authorRepository;
@Test
public void givenAuthor_whenAuthorNotPresentInDB_thenAuthorGetsSaved() {
//when
String authorName = "Mahatma Gandhi";
Author author = Author.builder()
.fullName(authorName)
.dob(LocalDateTime.now())
.bioLink("https://en.wikipedia.org/wiki/Mahatma_Gandhi")
.build();
Long id = authorRepository.save(author).getId();
//then
assertSame(authorRepository.findById(id).orElseThrow().getFullName(), authorName);
}
}
|
d8aaa042-beb4-4281-a3b4-e04d61b0ae88 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-16 10:36:39", "repo_name": "karoltylenda/copiers-services-corp-web-app", "sub_path": "/src/main/java/com/tytanisukcesu/copiers/dto/CopiersSettlementDto.java", "file_name": "CopiersSettlementDto.java", "file_ext": "java", "file_size_in_byte": 1202, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "ebea915f270133b403aa4471bfc86505d3e4365d", "star_events_count": 1, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/karoltylenda/copiers-services-corp-web-app | 214 | FILENAME: CopiersSettlementDto.java | 0.258326 | package com.tytanisukcesu.copiers.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.time.LocalDate;
@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ToString
@EqualsAndHashCode
public class CopiersSettlementDto {
private Long id;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate dateOfSettlement;
private Integer startingMonoCounter;
private Integer closingMonoCounter;
private Integer startingColourCounter;
private Integer closingColourCounter;
private BigDecimal monoAmount;
private BigDecimal colourAmount;
private BigDecimal totalAmount;
@EqualsAndHashCode.Exclude
@JsonIgnoreProperties({
"contractNumber",
"device",
"startDate",
"endDate",
"monoPagePrice",
"colorPagePrice",
"leasePrice",
"initialMonoCounter",
"initialColourCounter",
"copierSettlementSet"
})
private ContractDto contract;
}
|
a179e67d-697f-4f50-809e-60df27bbf07e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-05 03:12:09", "repo_name": "MJ666666/myo2oproject2", "sub_path": "/o2o_common/src/main/java/com/lmj/o2o/enums/OperationEnum.java", "file_name": "OperationEnum.java", "file_ext": "java", "file_size_in_byte": 1239, "line_count": 53, "lang": "en", "doc_type": "code", "blob_id": "dff57e7df7c066433a45426a84e85196ef0d3592", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MJ666666/myo2oproject2 | 331 | FILENAME: OperationEnum.java | 0.282196 | package com.lmj.o2o.enums;
/**
* ClassName: OperationEnum
* Description:
* date: 2020/3/7 16:39
*
* @author MJ
*/
public enum OperationEnum {
SUCCESS(1, "操作成功"),
INNER_ERROR(-1001, "操作失败"),
NULL_RESULT(-1002, "查询结果为空"),
NULL_PARAM(-1003, "传入了空的信息"),
TOO_MUCH_FILES(-1004,"传入文件数超过限制"),
WRONG_PASSWORD(-1005,"密码错误"),
USER_NOT_EXISTS(-2001,"用户不存在"),
ACCOUNT_ALREADY_BIND(1001,"该微信已绑定"),
USERNAME_EXISTS(1002,"用户已存在"),
QRCODE_EXPIRE(-1010,"二维码已过期"),
UNGRANTED_OPERATION(-1011,"没权限的操作"),
USER_EXISTS(1000,"用户已存在");
private int state;
private String stateInfo;
private OperationEnum(int state, String stateInfo) {
this.state = state;
this.stateInfo = stateInfo;
}
public int getState() {
return state;
}
public String getStateInfo() {
return stateInfo;
}
public static OperationEnum stateOf(int index) {
for (OperationEnum state : values()) {
if (state.getState() == index) {
return state;
}
}
return null;
}
}
|
e6a95068-0140-4f54-b2a3-0b85d1ee509e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-08 09:50:40", "repo_name": "romagolchin/ontology-visualization", "sub_path": "/src/main/java/org/golchin/ontology_visualization/TableFormatter.java", "file_name": "TableFormatter.java", "file_ext": "java", "file_size_in_byte": 1123, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "87d498e82dce8e244e00f5cc8dcd3546f1a81d06", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/romagolchin/ontology-visualization | 211 | FILENAME: TableFormatter.java | 0.274351 | package org.golchin.ontology_visualization;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
public abstract class TableFormatter {
protected final Table table;
private final BufferedWriter writer;
protected TableFormatter(Table table, Path file) throws IOException {
this.table = table;
writer = Files.newBufferedWriter(file);
}
protected void writeLine(String line) throws IOException {
writer.write(line);
writer.newLine();
}
protected void writePreamble() throws IOException {
}
protected void writeFooter() throws IOException {
}
protected abstract void writeRow(List<String> row) throws IOException;
protected abstract void writeHeader(List<String> header) throws IOException;
public void writeToFile() throws IOException {
writePreamble();
writeHeader(table.getHeader());
for (List<String> row : table.getValues()) {
writeRow(row);
}
writeFooter();
writer.close();
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.