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 |
|---|---|---|---|---|---|---|
dadeb10e-0e7e-4ef9-bce3-3d5c79363e83 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-23 18:30:09", "repo_name": "executed/t-watch", "sub_path": "/src/main/java/com/devserbyn/twatch/controller/impl/DispatcherImpl.java", "file_name": "DispatcherImpl.java", "file_ext": "java", "file_size_in_byte": 1150, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "038817a5321325053bd52dbd46fca9fa0cd0b8a2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/executed/t-watch | 212 | FILENAME: DispatcherImpl.java | 0.288569 | package com.devserbyn.twatch.controller.impl;
import com.devserbyn.twatch.controller.Dispatcher;
import com.devserbyn.twatch.controller.RequestResolver;
import com.devserbyn.twatch.model.bot.BaseBot;
import com.devserbyn.twatch.service.DispatcherService;
import com.devserbyn.twatch.service.ExceptionHandler;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Update;
import java.util.Optional;
@Component
@RequiredArgsConstructor
public class DispatcherImpl implements Dispatcher {
private final DispatcherService dispatcherService;
private final ExceptionHandler exceptionHandler;
@Override
public Optional<BotApiMethod> handleUpdate(Update update, Class<? extends BaseBot> botClass) {
RequestResolver requestResolver = dispatcherService.getBotRequestResolver(botClass);
try {
return requestResolver.resolveUpdate(update);
} catch (Exception e) {
return exceptionHandler.handleException(e, update, botClass);
}
}
}
|
136bbb6e-043e-41ce-8857-8c72687fa2d8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-15 20:53:47", "repo_name": "mulwa/SuperMum", "sub_path": "/app/src/main/java/com/example/gen/supermum/Pojo/Reminder.java", "file_name": "Reminder.java", "file_ext": "java", "file_size_in_byte": 1084, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "e84e5cd4190d90173535c8948bc0b170209e1ce1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mulwa/SuperMum | 212 | FILENAME: Reminder.java | 0.199308 | package com.example.gen.supermum.Pojo;
public class Reminder {
private String reminderTitle;
private String description;
private String date;
private String time;
public Reminder() {
}
public Reminder(String reminderTitle, String description,
String date, String time) {
this.reminderTitle = reminderTitle;
this.description = description;
this.date = date;
this.time = time;
}
public String getReminderTitle() {
return reminderTitle;
}
public void setReminderTitle(String reminderTitle) {
this.reminderTitle = reminderTitle;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
}
|
41f893a4-98a8-4537-ad29-9ec19176e804 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-24 08:44:24", "repo_name": "yanghp1984/CompInfo", "sub_path": "/src/main/java/common/exception/ExceptionResolver.java", "file_name": "ExceptionResolver.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "1cb076f14026dc92c66a70f0ea5ab4dc5f8cfec1", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yanghp1984/CompInfo | 247 | FILENAME: ExceptionResolver.java | 0.275909 | package common.exception;
import java.io.PrintWriter;
import java.io.StringWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
import common.constant.GlobalConstant;
/**
* SpringMVC 统一异常处理接口
*
* @author bianj
* @version 1.0.0 2017-07-10
*/
public class ExceptionResolver implements HandlerExceptionResolver {
private static final Logger logger = LogManager.getLogger(ExceptionResolver.class);
@Override
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object object,
Exception ex) {
logger.error(ex.getMessage(), ex);
String exceptionMsg = null;
if (ex != null) {
StringWriter sw = new StringWriter();
ex.printStackTrace(new PrintWriter(sw));
exceptionMsg = sw.toString();
}
ModelAndView model = new ModelAndView(GlobalConstant.ERROR_PAGE);
model.addObject(GlobalConstant.ERROR_MSG_KEY, "系统错误!");
model.addObject("exceptionMsg", exceptionMsg);
return model;
}
}
|
f78a34f8-033d-45e4-8568-397181508220 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-20 13:42:37", "repo_name": "Gavinwgq/design-pattern", "sub_path": "/src/main/java/behavior/Interpreter/demo1/ExpressionNode.java", "file_name": "ExpressionNode.java", "file_ext": "java", "file_size_in_byte": 1130, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "40eb6aba2a55bf165d1ba4ed6db9867f42c259eb", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Gavinwgq/design-pattern | 235 | FILENAME: ExpressionNode.java | 0.289372 | package behavior.Interpreter.demo1;
import com.google.common.collect.Lists;
import java.util.List;
/**
* @author wangguoqiang
* @date 2020/3/1 16:40
*/
public class ExpressionNode extends AbstractPracticeNode {
private AbstractPracticeNode practiceNode;
private static final String COPY = "COPY";
private static final String MOVE = "MOVE";
private List<AbstractPracticeNode> list = Lists.newArrayList();
@Override
public void interpret(PracticeContext context) {
while (context.currectToken() != null) {
if (COPY.equalsIgnoreCase(context.currectToken())) {
practiceNode = new CopyNode();
} else if (MOVE.equalsIgnoreCase(context.currectToken())) {
practiceNode = new MoveNode();
} else {
System.out.println(String.format("指令无法解析:%s", context));
}
list.add(practiceNode);
practiceNode.interpret(context);
}
}
@Override
public void execute() {
for (AbstractPracticeNode node : list) {
node.execute();
}
}
}
|
1bf61fbc-16fa-454f-929e-9dd3594608e1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-08-04T03:39:36", "repo_name": "santrasanchita13/PortfolioApp", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1128, "line_count": 24, "lang": "en", "doc_type": "text", "blob_id": "b0192d8761fead2d5d23cd91d30c3243a9ad0480", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/santrasanchita13/PortfolioApp | 323 | FILENAME: README.md | 0.285372 | # PortfolioApp
My portfolio
This app is a showcase of my Android development skills and a means to contact me for new apps. Instead of relying on a resume, I've built this app to make it easier to measure my app performance.
The app has material design, animations, custom components and Google API integration to show a small sample of my skills.
If you have interesting and challenging work for Android development, please use this app to assess my skills and contact me.
https://play.google.com/store/apps/details?id=com.santra.sanchita.portfolioapp
Email - pakhi.this@gmail.com





|
6a1d68ec-7501-4259-a8e8-8a37307c5b1f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-10-28 13:26:34", "repo_name": "diegowvalerio/dw-bi", "sub_path": "/dwbidiretor/dwbidiretor/src/main/java/br/com/dwbidiretor/converter/SigeModuloConverter.java", "file_name": "SigeModuloConverter.java", "file_ext": "java", "file_size_in_byte": 1148, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "b44b1c4322ba323ee62e7c6a02b2fbfff619cfd3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/diegowvalerio/dw-bi | 253 | FILENAME: SigeModuloConverter.java | 0.279042 | package br.com.dwbidiretor.converter;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
import br.com.dwbidiretor.classe.SigeModulo;
@FacesConverter(forClass = SigeModulo.class,value="conversorSigeModulo")
public class SigeModuloConverter implements Converter {
@Override
public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String value) {
if (value != null && !value.isEmpty()) {
return (SigeModulo) uiComponent.getAttributes().get(value);
}
return null;
}
@Override
public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object value) {
if (value instanceof SigeModulo) {
SigeModulo entity= (SigeModulo) value;
if (entity != null && entity instanceof SigeModulo && entity.getIdmodulo() != null) {
uiComponent.getAttributes().put( entity.getIdmodulo().toString(), entity);
return entity.getIdmodulo().toString();
}
}
return "";
}
} |
15b7cbaa-1712-469f-9237-2821a2df85f2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-18 15:19:58", "repo_name": "omarsahl/HashLearning", "sub_path": "/src/main/java/com/hashlearning/utils/validators/PasswordConfirmationMismatchValidator.java", "file_name": "PasswordConfirmationMismatchValidator.java", "file_ext": "java", "file_size_in_byte": 1094, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "f89da052e675984e87372d99dec3f9f8f522b823", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/omarsahl/HashLearning | 205 | FILENAME: PasswordConfirmationMismatchValidator.java | 0.274351 | package com.hashlearning.utils.validators;
import com.jfoenix.controls.JFXPasswordField;
import com.jfoenix.controls.JFXTextField;
import com.jfoenix.validation.base.ValidatorBase;
import javafx.scene.control.TextInputControl;
/**
* Created by Omar on 09-Dec-16
*/
public class PasswordConfirmationMismatchValidator extends ValidatorBase {
private JFXPasswordField passwordField;
public PasswordConfirmationMismatchValidator(JFXPasswordField passwordField) {
this.passwordField = passwordField;
}
@Override
protected void eval() {
if (srcControl.get() instanceof TextInputControl)
evalTextInputField();
}
private void evalTextInputField() {
TextInputControl passwordConfirmationTextField = (TextInputControl) srcControl.get();
if (passwordConfirmationTextField.getText() == null || passwordConfirmationTextField.getText().equals("")
|| !passwordConfirmationTextField.getText().equals(passwordField.getText())) {
hasErrors.set(true);
}
else hasErrors.set(false);
}
} |
34471755-743c-4616-bbee-76b45d301a89 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-29 06:32:21", "repo_name": "YHH-HJ/springboot02", "sub_path": "/src/main/java/com/atguigu/controller/UserController.java", "file_name": "UserController.java", "file_ext": "java", "file_size_in_byte": 1080, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "b71ea65d57db43f529af41e99bb45d466e7fc0b9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/YHH-HJ/springboot02 | 240 | FILENAME: UserController.java | 0.27513 | package com.atguigu.controller;
import com.atguigu.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("/user")
public class UserController {
@RequestMapping("/findAll")
public List<User> getAll(){
List<User> users = new ArrayList<User>();
User user1 = new User();
user1.setUsername("杨过");
user1.setPassword("123456");
user1.setAge(18);
user1.setSex("男");
User user2 = new User();
user2.setUsername("杨过");
user2.setPassword("123456");
user2.setAge(18);
user2.setSex("男");
User user3 = new User();
user3.setUsername("杨过");
user3.setPassword("123456");
user3.setAge(18);
user3.setSex("男");
users.add(user1);
users.add(user2);
users.add(user3);
return users ;
}
}
|
34561357-fff5-4e92-84c2-ea43c203233b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-04-07T18:31:51", "repo_name": "OxfordCity/oxfordcity.github.io", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1127, "line_count": 14, "lang": "en", "doc_type": "text", "blob_id": "72ef8a85f740f6316776bb1d96697f4c5fadc3bc", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/OxfordCity/oxfordcity.github.io | 251 | FILENAME: README.md | 0.233706 | # oxfordcity.github.io
This is the GitHub Pages site used to supply the front-end for the Oxfordshire Data Portal at www.oxopendata.uk
The main portal uses the Socrata platform, but as this does not enable 'pages' to be created, this site sits in the front to enable additional information to be provided and more easily updated independently of Socrata. Clicking on the 'data' tab takes the visitor to the Socrata portal at www2.oxopendata.uk.
The site uses Jekyll to provide a main layout (_layouts/default.html) that can be called by all content pages rather than replicate all the layout code
The styling of this site mirrors that of the Socrata portal so that there is a near-seamless transition for visitors. The main portal css files (base.css, current_site.css) are referenced along with a custom.css file for adding any site-specific styling for non-Socrata content.
# More information
* information on GitHub Pages is available at https://pages.github.com/
* Information on using Markdown is available at https://daringfireball.net/projects/markdown/
* Information on Jekyll is available at http://jekyllrb.com
|
85432d17-d1d8-4857-ae21-83a790b79dee | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-21 10:12:32", "repo_name": "pordaniel01/Car-rental-website", "sub_path": "/back-end/cars/src/main/java/pd/cars/cars/model/Rent.java", "file_name": "Rent.java", "file_ext": "java", "file_size_in_byte": 1210, "line_count": 63, "lang": "en", "doc_type": "code", "blob_id": "ed46f8ccdafd6a472df93edb0a9b1665176709c4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/pordaniel01/Car-rental-website | 275 | FILENAME: Rent.java | 0.290176 | package pd.cars.cars.model;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import javax.persistence.*;
import java.time.LocalDateTime;
@Entity
@Table(name = "rent")
public class Rent {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "rent_id")
private long id;
@OneToOne
@JoinColumn(name = "fk_car", nullable=false)
@OnDelete(action = OnDeleteAction.CASCADE)
private Car car;
@ManyToOne
@JoinColumn(name="fk_user", nullable=false)
@OnDelete(action = OnDeleteAction.CASCADE)
private User user;
@Column(name = "rent_ts")
private LocalDateTime rentTime;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public Car getCar() {
return car;
}
public void setCar(Car car) {
this.car = car;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public LocalDateTime getRentTime() {
return rentTime;
}
public void setRentTime(LocalDateTime rentTime) {
this.rentTime = rentTime;
}
}
|
2e0ffd3b-47e3-4023-a002-88941352eaf8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-04 08:28:55", "repo_name": "JNU-econovation/contents-proxy-blog-team1", "sub_path": "/src/main/java/com/econo/hackday/contentsproxyblog/model/Post.java", "file_name": "Post.java", "file_ext": "java", "file_size_in_byte": 1077, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "c06511a1f5a0a5b0922d7d718248733b6c4348f7", "star_events_count": 4, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/JNU-econovation/contents-proxy-blog-team1 | 239 | FILENAME: Post.java | 0.287768 | package com.econo.hackday.contentsproxyblog.model;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.util.List;
@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Post {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false)
private String title;
@Column(nullable = false)
private String url;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "post")
public List<HashtagVariable> hashtagVariables;
@ManyToOne
private Account writer;
private Long viewCount;
@Builder
public Post(String title, String url, Account writer) {
this.title = title;
this.url = url;
this.writer = writer;
this.viewCount = 0l;
}
public void increaseViewCount() {
this.viewCount++;
}
public boolean hasTag(String tagName) {
for (HashtagVariable hashtagVariable : hashtagVariables) {
if (hashtagVariable.getHashtag().getName().equals(tagName)) {
return true;
}
}
return false;
}
}
|
0ee5164a-45b7-4492-b11e-b8654ad1ad45 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-06 23:56:06", "repo_name": "stormpath/stormpath-spring-service-to-service-example", "sub_path": "/src/main/java/com/stormpath/examples/service/CommunicationService.java", "file_name": "CommunicationService.java", "file_ext": "java", "file_size_in_byte": 1150, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "382f731e19aa91bec70926bbb9e31a5990de3b86", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/stormpath/stormpath-spring-service-to-service-example | 194 | FILENAME: CommunicationService.java | 0.259826 | package com.stormpath.examples.service;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.stormpath.examples.model.AccountsResponse;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.springframework.stereotype.Service;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@Service
public class CommunicationService {
public AccountsResponse doRemoteRequest(String url, String token) throws Exception {
// make request of other micro-service
GetMethod method = new GetMethod(url + "?token=" + token);
HttpClient httpClient = new HttpClient();
int returnCode = httpClient.executeMethod(method);
BufferedReader br = new BufferedReader(
new InputStreamReader(method.getResponseBodyAsStream())
);
StringBuffer buffer = new StringBuffer();
String line;
while(((line = br.readLine()) != null)) {
buffer.append(line);
}
ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(buffer.toString(), AccountsResponse.class);
}
}
|
eacf767b-ff55-4543-93dc-e1756f7466ca | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-21 05:14:33", "repo_name": "AochongZhang/openapi-auth-spring-boot-starter", "sub_path": "/src/main/java/com/zhangaochong/spring/starter/openapi/handler/DefaultAuthHandler.java", "file_name": "DefaultAuthHandler.java", "file_ext": "java", "file_size_in_byte": 1241, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "d086e861490148afbf0323064160256c5b0284ac", "star_events_count": 26, "fork_events_count": 3, "src_encoding": "UTF-8"} | https://github.com/AochongZhang/openapi-auth-spring-boot-starter | 266 | FILENAME: DefaultAuthHandler.java | 0.239349 | package com.zhangaochong.spring.starter.openapi.handler;
import com.zhangaochong.spring.starter.openapi.properties.UserProperties;
import javax.annotation.Resource;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 默认权限处理器实现
*
* @author AochongZhang
*/
public class DefaultAuthHandler extends AbstractAuthHandler {
/** 存储调用方随机数,生产中可放入Redis,并设置过期时间 */
private static final Map<String, String> NONCEMAP = new ConcurrentHashMap<>();
/** 用户唯一key及密钥,生产中可放入数据库和Redis */
@Resource
private UserProperties userConfig;
@Override
public String getUserSecretKey(String accessKey) {
Map<String, String> secretKeyMap = userConfig.getSecretKeyMap();
if (secretKeyMap == null) {
throw new IllegalArgumentException("未配置用户密钥");
}
return secretKeyMap.get(accessKey);
}
@Override
public boolean saveUserNonce(String accessKey, String nonce) {
NONCEMAP.put(accessKey, nonce);
return true;
}
@Override
public String getUserLastNonce(String accessKey) {
return NONCEMAP.get(accessKey);
}
}
|
25d98249-ae9b-4f68-b7e8-c431c11f7b9d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-02-22 10:03:52", "repo_name": "ZhicongLin/cgcg-base-starter", "sub_path": "/cgcg-base-spring-boot-starter/src/main/java/com/cgcg/base/language/Translator.java", "file_name": "Translator.java", "file_ext": "java", "file_size_in_byte": 1149, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "09a7a421af214874c7b069eb8658449c5c8f0fad", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/ZhicongLin/cgcg-base-starter | 215 | FILENAME: Translator.java | 0.259826 | package com.cgcg.base.language;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;
import java.util.Locale;
@Slf4j
@Component
public class Translator {
private static MessageSource messageSource;
public Translator(@Autowired MessageSource messageSource) {
Translator.messageSource = messageSource;
}
public static String toLocale(String msg) {
if (StringUtils.isBlank(msg)) {
return null;
}
final Locale locale = LocaleContextHolder.getLocale();
try {
return messageSource.getMessage(msg, null, locale);
} catch (Exception e) {
return null;
}
}
public static String toLocale(String code, String defaultMsg) {
final String result = Translator.toLocale(code);
return result != null && (defaultMsg == null || !result.equals(code)) ? result : defaultMsg;
}
} |
d4fcee0c-81f8-465e-8de2-c6bdf476edb0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-05-29 22:00:34", "repo_name": "elizaII/idgi", "sub_path": "/app/src/main/java/com/idgi/android/activity/SchoolListActivity.java", "file_name": "SchoolListActivity.java", "file_ext": "java", "file_size_in_byte": 1001, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "d4ae2c7bf25fe1c03d02893ac6778b21f2a45e57", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/elizaII/idgi | 220 | FILENAME: SchoolListActivity.java | 0.279828 | package com.idgi.android.activity;
import android.content.Intent;
import com.google.common.eventbus.Subscribe;
import com.idgi.R;
import com.idgi.android.ActivityType;
import com.idgi.core.Nameable;
import com.idgi.core.School;
import com.idgi.event.BusEvent;
import com.idgi.event.Event;
import com.idgi.service.FireDatabase;
import com.idgi.session.SessionData;
import java.util.List;
/*
Lists all the database's schools
*/
public class SchoolListActivity extends NameableListActivity{
@Override
protected String getTitleName() {
return getResources().getString(R.string.list_school_title);
}
@Override
protected List<? extends Nameable> getNameables() {
return FireDatabase.getInstance().getSchools();
}
@Subscribe
public void onSchoolSelected(BusEvent busEvent) {
if(busEvent.getEvent() == Event.SCHOOL_SELECTED){
School school = (School) busEvent.getData();
SessionData.setCurrentSchool(school);
startActivity(new Intent(this, SubjectListActivity.class));
}
}
}
|
0662976a-e627-499e-a636-bf291333d9a4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-23 10:56:31", "repo_name": "milesburton/nzbair", "sub_path": "/providers/src/main/java/com/mb/nzbair/providers/converters/UsenetPostResultConverter.java", "file_name": "UsenetPostResultConverter.java", "file_ext": "java", "file_size_in_byte": 1051, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "e4688aa2c6fcb5c94fef9dc3eaa4228c0f1db964", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/milesburton/nzbair | 217 | FILENAME: UsenetPostResultConverter.java | 0.292595 |
package com.mb.nzbair.providers.converters;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.Reader;
import org.codehaus.jackson.JsonFactory;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.map.ObjectMapper;
import com.mb.nzbair.providers.domain.UsenetPostResult;
import com.mb.nzbair.remote.response.RestResponse;
public class UsenetPostResultConverter extends BaseConverter<UsenetPostResult> {
private ObjectMapper objectMapper = null;
private JsonFactory jsonFactory = null;
private JsonParser jp = null;
public UsenetPostResultConverter() {
objectMapper = new ObjectMapper();
jsonFactory = new JsonFactory();
}
@Override
public UsenetPostResult convert(RestResponse rr) throws Exception {
this.throwErrorIf(rr);
final Reader r = new InputStreamReader(rr.getStream());
final BufferedReader reader = new BufferedReader(r);
jp = jsonFactory.createJsonParser(reader);
final UsenetPostResult upr = objectMapper.readValue(jp, UsenetPostResult.class);
return upr;
}
}
|
3321f4d6-7420-4215-8280-e9dda3e8eb40 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-25 14:11:19", "repo_name": "noobliuxg/JAVA-2", "sub_path": "/src/main/java/cn/com/java/thread/synch/DeadLock.java", "file_name": "DeadLock.java", "file_ext": "java", "file_size_in_byte": 1111, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "beaa667f99a05253389d39beee42c2976abfbb07", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/noobliuxg/JAVA-2 | 215 | FILENAME: DeadLock.java | 0.274351 | package cn.com.java.thread.synch;
public class DeadLock {
private static final Object lockA = new Object();
private static final Object lockB = new Object();
public static void main(String[] args) {
new Thread(()->{a();},"main-1").start();
try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
new Thread(()->{b();},"main-2").start();
}
private static void a(){
synchronized (lockA){
System.out.println(Thread.currentThread().getName()+"运行a()");
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName()+"等待运行b()");
b();
}
}
private static void b(){
synchronized (lockB){
System.out.println(Thread.currentThread().getName()+"运行b()");
System.out.println(Thread.currentThread().getName()+"等待运行a()");
a();
}
}
}
|
b9bb5955-d247-4cba-94ab-835fbb3eccef | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-10 21:03:55", "repo_name": "Raluxa/AutomationProject", "sub_path": "/src/main/java/steps/LoginLogoutPageSteps.java", "file_name": "LoginLogoutPageSteps.java", "file_ext": "java", "file_size_in_byte": 1067, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "3778354b0c9f0f24a3499ec413eda5184f120eb7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Raluxa/AutomationProject | 237 | FILENAME: LoginLogoutPageSteps.java | 0.281406 | package steps;
import common.UserInfo;
import net.thucydides.core.annotations.Step;
import net.thucydides.core.steps.ScenarioSteps;
import pages.LoginLogoutPage;
public class LoginLogoutPageSteps extends ScenarioSteps {
LoginLogoutPage sp;
@Step("Test 1: Login button functionality ")
public void loginOptionFunctionality() {
sp.loginOption();
}
@Step("Test 2 : Test the presence of elements")
public void loginElements() {
sp.loginElements();
}
@Step("Test 3 : Test the close button with blank fields")
public void closeButtonFunctionality() {
sp.closeButtonFunctionality();
}
@Step("Test 4 : Test the successful login")
public void successfulLogin(String user, String pass) {
sp.successfulLogin(user,pass);
}
@Step("Test 5 : Test the functionality of logout button")
public void logoutUser() {
sp.logoutUser();
}
@Step("Test 6 : Log in with invalid credentials")
public void invalidCredentials () {
sp.invalidCredentials();
}
}
|
0f7860e9-962f-40f8-8c17-0a0556f64cc5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-10 23:52:50", "repo_name": "filiperecharte/SpaceInvaders", "sub_path": "/src/main/java/com/spaceinvaders/controller/states/playstate/playstatecontrollers/EnemiesShotsGenerator.java", "file_name": "EnemiesShotsGenerator.java", "file_ext": "java", "file_size_in_byte": 1068, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "e12e0d53f41bac202c55e4fe5312e73376eb8037", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/filiperecharte/SpaceInvaders | 244 | FILENAME: EnemiesShotsGenerator.java | 0.294215 | package com.spaceinvaders.controller.states.playstate.playstatecontrollers;
import com.spaceinvaders.model.arena.Arena;
import com.spaceinvaders.model.enemy.Enemy;
import com.spaceinvaders.model.pools.ShotPool;
import com.spaceinvaders.model.shots.Shot;
public class EnemiesShotsGenerator {
private Arena arena;
private ShotPool shotPool;
private int whenToShoot;
private Enemy enemyToShoot;
public EnemiesShotsGenerator(Arena arena, ShotPool shotPool) {
this.arena = arena;
this.shotPool = shotPool;
}
public void generate() {
Shot shot = shotPool.extract();
enemyToShoot.recycleShot(shot);
arena.addElement(shot);
}
public boolean enemyReadyToShoot() {
return !arena.getEnemies().isEmpty() && enemyToShoot.getAttackBehavior().readyToShoot(whenToShoot);
}
public void setWhenToShoot(int whenToShoot) {
this.whenToShoot = whenToShoot;
}
public void setEnemyIndex(int enemyIndex) {
this.enemyToShoot = arena.getEnemies().get(enemyIndex);
}
}
|
83466cd3-6aac-4601-ac1c-049a91b2b2b9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-09-29T03:53:55", "repo_name": "Nodirbek94/TeamProfileGenerator", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1235, "line_count": 40, "lang": "en", "doc_type": "text", "blob_id": "5bb120789b9828fd1b8efe51631b0bbcff45d9d0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Nodirbek94/TeamProfileGenerator | 322 | FILENAME: README.md | 0.289372 | # Team Profile Generator
## Description
This project demonstrates the node.js inquirer method and testing. It asks the user to enter information about individual team member such as engineer or intern and it renders the information and displays it the information to cards.
## Table of Contents
* [Installation](#installation)
* [Usage](#usage)
* [License](#license)
* [Contributions](#contributions)
* [Tests](#tests)
* [Questions](#questions)
## Installation
User must have node.js installed and npm installed to run this application
## Usage
This application can be used to created individual member information and it will run using the Terminal
Video Demonstration: https://drive.google.com/file/d/1IjRhqszIVI5Xz1a_WNTdYyTz7Majiwy8/view
<img src="./Assets/Screen%20Shot%202020-09-28%20at%2011.43.14%20PM.png">
## License
MIT
## Contributions
Anyone can contribute to the application by just forking this repository
## Tests
Application was tested using NPM and was run in the Terminal
## Questions
Questions about this repository? Please contact me at [nodirbekmaksudov@gmail.com](mailto:nodirbekmaksudov@gmail.com). View more of my work in GitHub at [https://github.com/Nodirbek94](https://github.com/Nodirbek94)
|
d15b8c82-18be-4330-95cc-20622d82e51a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-25 19:39:15", "repo_name": "kolatkat/java_dla_testera_selenium", "sub_path": "/test/java/tests/BaseTest.java", "file_name": "BaseTest.java", "file_ext": "java", "file_size_in_byte": 980, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "a5d2e1552604c7a595b503b5be9d9b60b829e465", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kolatkat/java_dla_testera_selenium | 200 | FILENAME: BaseTest.java | 0.249447 | package tests;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import utils.PageTitleUtils;
import static org.assertj.core.api.Assertions.*;
public class BaseTest {
protected static final String BASE_URL = "http://automationpractice.com/index.php";
protected WebDriver driver;
@BeforeAll
public static void setupClass() {
WebDriverManager.chromedriver().setup();
}
// @BeforeEach
// public void setupTest() {
// driver = new ChromeDriver();
// driver.get(BASE_URL);
// assertThat(driver.getTitle()).isEqualTo(PageTitleUtils.HOME_PAGE_TITLE);
// }
@AfterEach
public void tearDown() {
if (driver != null) {
driver.quit();
}
}
}
|
c31d70b7-0c64-497c-892f-225b36a2028e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-17 05:10:03", "repo_name": "Vigor377/springboot2.x_Java", "sub_path": "/Service_Tier/Blog_Service/src/main/java/com/chen/pei/service/Impl/LoginServiceImpl.java", "file_name": "LoginServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1096, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "47605dc88f9137adf3e2fb18ff10a22b0dd1c8af", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Vigor377/springboot2.x_Java | 218 | FILENAME: LoginServiceImpl.java | 0.250913 | package com.chen.pei.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chen.pei.entity.Blogger;
import com.chen.pei.mapper.BloggerMapper;
import com.chen.pei.mapper.LoginMapper;
import com.chen.pei.service.LoginService;
import org.springframework.stereotype.Service;
@Service
public class LoginServiceImpl extends ServiceImpl<LoginMapper, Blogger> implements LoginService {
@Override
public Blogger findLogin(String nickName, String password) {
QueryWrapper<Blogger> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("nick_name",nickName);
queryWrapper.eq("password",password);
Blogger blogger = baseMapper.selectOne(queryWrapper);
return blogger;
}
@Override
public Blogger findLoginByName(String username) {
QueryWrapper<Blogger> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("nick_name",username);
Blogger blogger = baseMapper.selectOne(queryWrapper);
return blogger;
}
}
|
0ed52519-4e12-4ecc-908d-7cbcd69188cc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-03 13:25:50", "repo_name": "SeekingHearts/ECSurvivalSystem", "sub_path": "/[EC] SurvivalSystem/src/me/aaron/survivalsystem/listeners/trade/listenerGameModeChange.java", "file_name": "listenerGameModeChange.java", "file_ext": "java", "file_size_in_byte": 1209, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "a29ef06c9442a09042c2e723f420c36a5b9e7d21", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/SeekingHearts/ECSurvivalSystem | 283 | FILENAME: listenerGameModeChange.java | 0.289372 | package me.aaron.survivalsystem.listeners.trade;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerGameModeChangeEvent;
import me.aaron.survivalsystem.main.Main;
import me.aaron.survivalsystem.trade.Trade;
import me.aaron.survivalsystem.trade.TradeMain;
import me.aaron.survivalsystem.trade.TradeUtils;
public class listenerGameModeChange implements Listener {
@EventHandler
public void onPlayerGameModeChange(final PlayerGameModeChangeEvent e) {
final Player p = e.getPlayer();
if (e.getNewGameMode() == GameMode.CREATIVE && !Main.getInstance().getConfig().getBoolean("TradeInCreative")) {
Trade tr = null;
if (TradeUtils.getTradeFromAccepter(p) != null)
tr = TradeUtils.getTradeFromAccepter(p);
if (TradeUtils.getTradeFromRequester(p) != null)
tr = TradeUtils.getTradeFromRequester(p);
if (tr != null) {
tr.cancelTrade(true);
tr.getAccepter().sendMessage(TradeMain.getMessage("trade-cancelled-creative-reason"));
tr.getRequester().sendMessage(TradeMain.getMessage("trade-cancelled-creative-reason"));
}
}
}
} |
d26d02a7-fa24-480c-81c9-d6ed050de533 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-19 05:55:06", "repo_name": "s838378358/nb-iot-gh-group", "sub_path": "/src/main/java/com/weeg/callbackHandler/CallbackHandlerImpl/Upload200ACallBackHandler.java", "file_name": "Upload200ACallBackHandler.java", "file_ext": "java", "file_size_in_byte": 996, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "bfb720bc1e6088597737baebec55e1444934bccd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/s838378358/nb-iot-gh-group | 238 | FILENAME: Upload200ACallBackHandler.java | 0.290176 | package com.weeg.callbackHandler.CallbackHandlerImpl;
import com.weeg.callbackHandler.CallbackFactory;
import com.weeg.callbackHandler.CallBackHandler;
import com.weeg.util.DataFomat;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Component;
/**
* Created by SJ on 2020/8/13
*/
@Component
public class Upload200ACallBackHandler extends CallBackHandler {
@Override
public JSONObject upload200aHandler(JSONObject object, String mid, String[] binaryData) {
DataFomat dataFomat = new DataFomat();
if (mid.equals("200a") || mid.equals("200A")) {
String SIM = "";
for (int i = 0; i < 20; i++) {
SIM += binaryData[i];
}
String SIMascii = dataFomat.convertHexToString(SIM);
object.put("SIM卡信息", SIMascii);
}
return object;
}
@Override
public void afterPropertiesSet() throws Exception {
CallbackFactory.register("200a",this);
}
}
|
f69aa904-0f30-4d3e-bfa1-4d5201332dd1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-20 11:12:04", "repo_name": "yelang10000/power", "sub_path": "/src/main/java/com/sun/power/modules/system/user/dto/QueryUserVo.java", "file_name": "QueryUserVo.java", "file_ext": "java", "file_size_in_byte": 1154, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "4aca1bbdff250c279fa268c4474f4fd0ebe30ec2", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yelang10000/power | 260 | FILENAME: QueryUserVo.java | 0.184768 | package com.sun.power.modules.system.user.dto;
import com.sun.power.core.aop.mysql.MysqlQueryFieldHandle;
import com.sun.power.core.common.entity.BaseRequestVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author : caoxin
* @Date: 2019/4/18
* @Description: 查询所有、模糊查询请求
*/
@Data
public class QueryUserVo extends BaseRequestVo {
@MysqlQueryFieldHandle
@ApiModelProperty(value = "登陆姓名", required = false)
private String userName;
@ApiModelProperty(value = "单位id", required = false)
private String organizationId;
@ApiModelProperty(value = "专/兼职", required = false)
private String fullPart;
@MysqlQueryFieldHandle
@ApiModelProperty(value="所属部门")
private String department;
@MysqlQueryFieldHandle
@ApiModelProperty(value = "工作人员姓名", required = false)
private String realName;
@ApiModelProperty(value = "当前页", required = false, example = "1")
private Integer currentPage;
@ApiModelProperty(value = "页面大小", required = false, example = "20")
private Integer pageSize;
}
|
70b9042d-44c9-4490-8376-db160cc536ef | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-26 00:49:46", "repo_name": "cbustamantem/testApp", "sub_path": "/src/main/java/cast/testapp/invoice/boundary/impl/InvoiceFileReaderImpl.java", "file_name": "InvoiceFileReaderImpl.java", "file_ext": "java", "file_size_in_byte": 1150, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "e7dbf868a44d99859362d5f195fa286ddbda4088", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/cbustamantem/testApp | 221 | FILENAME: InvoiceFileReaderImpl.java | 0.250913 | /*
* 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 cast.testapp.invoice.boundary.impl;
import cast.testapp.invoice.boundary.InvoiceFileReader;
import java.io.File;
/**
*
* @author cbustamante
*/
public class InvoiceFileReaderImpl implements InvoiceFileReader {
@Override
public File readFile(String filePath) {
try{
File file = new File(filePath);
if (!file.exists()){
throw new IllegalArgumentException("Ruta invalidad el archivo");
}
return file;
}
catch(Exception ex){
System.out.println("Ocurrio un error al leer el archivo");
}
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Boolean validateLine(String line) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
|
23ebd960-ea1d-49ce-8aac-3956b11567c7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-30 11:21:13", "repo_name": "waninoko68/ListViewHomework", "sub_path": "/app/src/main/java/wm/list/AnimalDetailsActivity.java", "file_name": "AnimalDetailsActivity.java", "file_ext": "java", "file_size_in_byte": 1019, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "c0d37bc2b5829c581ef4a641d191fc80e5178d4b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/waninoko68/ListViewHomework | 185 | FILENAME: AnimalDetailsActivity.java | 0.212069 | package wm.list;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import wm.list.model.Animal;
import static android.R.attr.name;
public class AnimalDetailsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_animal_details);
ImageView animalImg = (ImageView) findViewById(R.id.animalImage);
TextView nameTxt = (TextView) findViewById(R.id.animalTxt);
Intent in = getIntent();
int position = in.getIntExtra("position",0);
AnimalData animalData = AnimalData.getInstance();
Animal animal = animalData.animalList.get(position);
nameTxt.setText(animal.detail);
animalImg.setImageResource(animal.pic);
getSupportActionBar().setTitle(animal.thaiName+" ("+animal.name+")");
}
}
|
63f98fad-7fcd-4fc7-8e5c-a746790769a3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-26 13:42:57", "repo_name": "15719298615/flink", "sub_path": "/src/main/java/com/atguigu/reflection/reflection_test1.java", "file_name": "reflection_test1.java", "file_ext": "java", "file_size_in_byte": 997, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "fb302164c56bbd305bcc58cff6dcb8a1101182ba", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/15719298615/flink | 244 | FILENAME: reflection_test1.java | 0.246533 | package com.atguigu.reflection;
import cn.hutool.core.util.ClassUtil;
import cn.hutool.crypto.SecureUtil;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* @author:yaoshuai.1024
* @date: 2021/1/25 4:58 下午
*/
public class reflection_test1 {
private static Map<String, Class<?>> rpcMethodMap = new HashMap<>();
public static void main(String[] args) throws Exception {
Set<Class<?>> classes = ClassUtil.scanPackageBySuper("com.atguigu.reflection", Base.class);
for (Class<?> aclass:classes) {
Method[] publicMethods = ClassUtil.getPublicMethods(aclass);
Arrays.stream(publicMethods).forEach(e->rpcMethodMap.put(e.getName(),aclass));
}
System.out.println(rpcMethodMap);
ClassUtil.invoke(rpcMethodMap.get("emmitt2").getName(),"emmitt2",true);
String eeee = SecureUtil.md5("eeee");
System.out.println(eeee);
}
}
|
d2ea5da4-f618-4f57-8fa7-eadf7b5836d3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-08-31 01:03:25", "repo_name": "PluCial/plucial-blog", "sub_path": "/src/com/appspot/plucial/controller/account/ActivityDeleteController.java", "file_name": "ActivityDeleteController.java", "file_ext": "java", "file_size_in_byte": 1127, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "a8f90f7b6e7e2f7d1a94c449d95e4e41121beac8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/PluCial/plucial-blog | 210 | FILENAME: ActivityDeleteController.java | 0.239349 | package com.appspot.plucial.controller.account;
import java.util.ArrayList;
import org.slim3.controller.Navigation;
import com.appspot.plucial.model.ActivityModel;
import com.appspot.plucial.model.UserModel;
import com.appspot.plucial.service.ActivityService;
public class ActivityDeleteController extends BaseController {
@Override
protected Navigation execute(UserModel loginUserModel) throws Exception {
String activityId = asString("activity");
ActivityModel activityModel = ActivityService.getActivity(activityId);
ArrayList<ActivityModel> activityList = new ArrayList<ActivityModel>();
if(activityModel != null) {
activityList.add(activityModel);
}
requestScope("activityModel", activityModel);
requestScope("activityList", activityList);
return forward("/responsive/account/activity_delete.jsp");
}
@Override
protected String setPageTitle() {
return "アクティビティの削除";
}
@Override
protected String setPageDescription() {
return "アクティビティの削除";
}
}
|
3b00153e-67fe-45de-8ed3-ebe0ac91938b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-11-04T04:27:10", "repo_name": "RyanScottLewis/static_template-metalsmith-bootstrap-knockout", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1127, "line_count": 44, "lang": "en", "doc_type": "text", "blob_id": "436aa8ef8a4a065cdf623df8bad35cd40d71d60b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/RyanScottLewis/static_template-metalsmith-bootstrap-knockout | 298 | FILENAME: README.md | 0.2227 | ## Static Website Template
A template for creating static sites.
**Languages/Libraries:**
* [NodeJS][nodejs]
* [Metalsmith][metalsmith]
* [Bootstrap][bootstrap]
* [Knockout][knockout]
* [Coffeescript][coffeescript]
* [HAML][haml]
* [SASS][sass]
## Usage
## Setup
`cake setup`
## Build
Single: `cake build`
Watching: `bundle exec guard`
> Run `gem install bundler && bundle install` to setup Bundler/Guard
[nodejs]: https://nodejs.org
[metalsmith]: http://www.metalsmith.io/
[bootstrap]: http://getbootstrap.com/
[knockout]: http://knockoutjs.com/
[coffeescript]: http://coffeescript.org/
[haml]: http://haml.info/
[sass]: http://sass-lang.com/
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/RyanScottLewis/static_template-metalsmith-bootstrap-knockout.
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
7dedbdfd-d5a7-4b28-8537-06901a8d214c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-09-03 14:41:23", "repo_name": "VersusProject/versus-service", "sub_path": "/src/main/java/edu/illinois/ncsa/versus/service/FreeMarkerServletConfig.java", "file_name": "FreeMarkerServletConfig.java", "file_ext": "java", "file_size_in_byte": 990, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "a56053c60a1ac40a7e14b1bf7c63a6b1120f1d38", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/VersusProject/versus-service | 187 | FILENAME: FreeMarkerServletConfig.java | 0.236516 | /**
*
*/
package edu.illinois.ncsa.versus.service;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;
/**
* Setup FreeMarker for templating.
*
* @author Luigi Marini
*
*/
public class FreeMarkerServletConfig implements ServletContextListener {
@Override
public void contextDestroyed(ServletContextEvent event) {
ServletContext context = event.getServletContext();
context.removeAttribute(Configuration.class.getName());
}
@Override
public void contextInitialized(ServletContextEvent event) {
Configuration cfg = new Configuration();
cfg.setServletContextForTemplateLoading(event.getServletContext(),
"WEB-INF/templates");
cfg.setObjectWrapper(new DefaultObjectWrapper());
ServletContext context = event.getServletContext();
context.setAttribute(Configuration.class.getName(), cfg);
}
}
|
c8540bda-a33a-4f41-ab8d-acebb0a72dbd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-04-19 15:19:57", "repo_name": "oflynned/JS-Assignments", "sub_path": "/3D5 Software Design/2-ToDo List/app/src/main/java/com/example/android/todolistgh/Connectivity.java", "file_name": "Connectivity.java", "file_ext": "java", "file_size_in_byte": 1025, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "e36bd99abf98f88437d2f48aba337fc03b1459ff", "star_events_count": 2, "fork_events_count": 3, "src_encoding": "UTF-8"} | https://github.com/oflynned/JS-Assignments | 200 | FILENAME: Connectivity.java | 0.246533 | package com.example.android.todolistgh;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.widget.Toast;
/**
* Created by ed on 27/11/15.
*/
public class Connectivity {
Context context;
public Connectivity(Context context){
this.context = context;
}
public void sendToEmail(String memo) {
if (memo.isEmpty()) {
Toast.makeText(context, "Empty Memo", Toast.LENGTH_SHORT).show();
return;
}
else {
Intent sendEmailSummary = new Intent(Intent.ACTION_SENDTO);
sendEmailSummary.setData(Uri.parse("mailto:")); // only email apps should handle this
sendEmailSummary.putExtra(Intent.EXTRA_SUBJECT, ("MEMO- To-Do List App"));
sendEmailSummary.putExtra(Intent.EXTRA_TEXT, memo);
if (sendEmailSummary.resolveActivity(context.getPackageManager()) != null) {
context.startActivity(sendEmailSummary);
}
}
}
}
|
a1b5b5ea-ee58-4f68-9041-108a19ee0b1d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-01 09:55:11", "repo_name": "Relynn/DontOpenTheDoor", "sub_path": "/app/src/main/java/edu/calbaptist/android/dontopenthedoorgame/database/DoorGameBaseHelper.java", "file_name": "DoorGameBaseHelper.java", "file_ext": "java", "file_size_in_byte": 1029, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "9b133b15cc1c54dc64ecbc1ceff263f1c7ff1b40", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Relynn/DontOpenTheDoor | 231 | FILENAME: DoorGameBaseHelper.java | 0.262842 | package edu.calbaptist.android.dontopenthedoorgame.database;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import edu.calbaptist.android.dontopenthedoorgame.database.DoorGameDbSchema.PlayerTable;
/**
* Created by lynnreilly on 11/8/17.
*/
public class DoorGameBaseHelper extends SQLiteOpenHelper {
private static final int VERSION = 1;
private static final String DATABASE_NAME = "dotd.db";
public DoorGameBaseHelper(Context context) {
super(context,DATABASE_NAME, null, VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table " + PlayerTable.NAME + "( " + " _id integer primary key autoincrement, " +
PlayerTable.Cols.UUID + ", " +
PlayerTable.Cols.PLAYER + ", " +
PlayerTable.Cols.SCORE + ")"
);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
|
5dffbdb9-7c9a-4c51-9ef0-8eeb321497a5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-09-07 16:54:44", "repo_name": "KarlJiaweiZ/UG2_JAVA", "sub_path": "/Sample/09Week/src/sample/DelegationTest.java", "file_name": "DelegationTest.java", "file_ext": "java", "file_size_in_byte": 1030, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "bc46496390ec620d84497697c585e02b96babea4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "SHIFT_JIS"} | https://github.com/KarlJiaweiZ/UG2_JAVA | 258 | FILENAME: DelegationTest.java | 0.273574 | package sample;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class DelegationTest extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
JButton bt1;
JButton bt2;
JLabel label;
public DelegationTest() {
setBounds(200, 200, 200, 100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
label = new JLabel("クリックしてください",JLabel.CENTER);
add("North",label);
bt1 = new JButton("ボタン1");
bt2 = new JButton("ボタン2");
bt1.addActionListener(this);
bt2.addActionListener(this);
JPanel p = new JPanel();
p.add(bt1);
p.add(bt2);
add("Center",p);
setVisible(true);
}
public static void main(String[] args) {
new DelegationTest();
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == bt1)
label.setText("ボタン1");
else if(e.getSource() == bt2)
label.setText("ボタン2");
}
} |
e7f8b9cb-91cb-4788-87f5-eddcd4d13a96 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-05 03:23:10", "repo_name": "fan764093434/ChatUI", "sub_path": "/app/src/main/java/com/fsw/chat_ui/widget/chatrow/ChatRowFile.java", "file_name": "ChatRowFile.java", "file_ext": "java", "file_size_in_byte": 1062, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "87b8992743aa90bf729f902a4a68ac88f4bce3f1", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/fan764093434/ChatUI | 236 | FILENAME: ChatRowFile.java | 0.290176 | package com.fsw.chat_ui.widget.chatrow;
import android.content.Context;
import com.fsw.chat_ui.ChatMessage;
import com.fsw.chat_ui.R;
import com.fsw.chat_ui.adapter.viewholder.ChatFileViewHolder;
import com.fsw.chat_ui.entity.Message;
/**
* Created by Admin on 2017/4/8.
*/
public class ChatRowFile extends ChatRow {
private ChatFileViewHolder viewHolder;
public ChatRowFile(Context context, Message message) {
super(context, message);
}
@Override
protected void onInflateView() {
inflater.inflate(message.getDirect() == ChatMessage.Direct.RECEIVE ? R.layout.chat_row_file_receive : R.layout.chat_row_file_send, this);
}
@Override
protected void onViewFindById() {
if (viewHolder == null) {
viewHolder = new ChatFileViewHolder();
this.setTag(viewHolder);
} else {
viewHolder = (ChatFileViewHolder) this.getTag();
}
}
@Override
protected void onSetUpView() {
}
@Override
protected void onSetClickListener() {
}
}
|
d4bea0cb-00f6-4c6b-a721-681bf4a6d4d1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-02-21 12:52:47", "repo_name": "joe-bq/algorithms", "sub_path": "/PojAlgorithms/src/dynamic/ScribersSolution.java", "file_name": "ScribersSolution.java", "file_ext": "java", "file_size_in_byte": 1079, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "efaf82e49577222d6c1eb65c4f1e290a33a67ef5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/joe-bq/algorithms | 344 | FILENAME: ScribersSolution.java | 0.29584 | package dynamic;
import java.util.Scanner;
/* the link to the problem is :http://poj.org/problem?id=1505
*
problem 1505...
the problem is not yet done.
*/
public class ScribersSolution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int inputCount = 0;
inputCount = scanner.nextInt();
for (int i = 0; i < inputCount; i++) {
int m = 0, k = 0; // m denote the numbers of books, while the k means how many scribers
m = scanner.nextInt();
k = scanner.nextInt();
int[] books = new int[m];
int[] acc_pages = new int[m];
for (int j = 0; j < m; j++) {
books[j] = scanner.nextInt();
acc_pages[j] = j > 0 ? acc_pages[j - 1] : 0 + books[j];
}
int[] scribers = new int[k];
int[] scriber_books = new int[k];
for (int j = 0; j < k; j++) {
scriber_books[j] = j+1; // that means scriber 0 scribes book [0..1), scriber 1 scribes books [1,2)....
scribers[j] = books[i];
}
for (int j = 0; j < m; j++) {
}
}
}
}
|
7d7681be-b695-407b-88ad-532ba03330a4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-18 12:18:34", "repo_name": "StephanK90/FootballSimulator", "sub_path": "/src/FootballSimulator/Round.java", "file_name": "Round.java", "file_ext": "java", "file_size_in_byte": 1047, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "512f44a02cf55a633da2d6303c19634fa59dfa69", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/StephanK90/FootballSimulator | 223 | FILENAME: Round.java | 0.278257 | /*
* 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 FootballSimulator;
import java.util.ArrayList;
/**
*
* @author Stephan
*/
public class Round {
private final ArrayList<Match> matches; // list of matches in this round
private Boolean played; // true if round is finished
public Round() {
this.matches = new ArrayList();
this.played = false; // set default false
}
// add new match to a round
public void addMatch(Match m) {
this.matches.add(m);
}
// returns list of matches in this round
public ArrayList<Match> getMatches() {
return this.matches;
}
// sets round as played
public void isPlayed() {
this.played = true;
}
// returns status of the round (true if finished, false if not)
public Boolean getPlayed() {
return this.played;
}
}
|
32648397-2fdb-4cc6-aff5-9662c1d507b2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-10-09 07:35:31", "repo_name": "SamWain/BasiqPVE", "sub_path": "/src/com/basiqnation/basiqpve/PlayerListener.java", "file_name": "PlayerListener.java", "file_ext": "java", "file_size_in_byte": 1112, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "70bb967c02c3288eb344545426ee0b1f81c3a906", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/SamWain/BasiqPVE | 267 | FILENAME: PlayerListener.java | 0.27513 | package com.basiqnation.basiqpve;
import java.sql.SQLException;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
public class PlayerListener implements Listener {
public static BasiqPVE plugin;
public PlayerListener(BasiqPVE instance) {
plugin = instance;
}
@EventHandler(priority = EventPriority.NORMAL)
public void onEntityDamaged(final EntityDamageByEntityEvent event)
throws SQLException {
if ((event.getDamager() instanceof Player)
&& (event.getEntity() instanceof Player)) {
Player damager = (Player) event.getDamager();
Player damagee = (Player) event.getEntity();
if (damager.hasPermission("basiqpve.pve")
|| damagee.hasPermission("basiqpve.pve")) {
event.setCancelled(true);
}
if(damager.hasPermission("basiqpve.pve")){
damager.sendMessage("You cannot damage other players");
}
if(damagee.hasPermission("basiqpve.pve")){
damager.sendMessage("You cannot damage PVE players");
}
}
}
}
|
0a56190a-0761-4e29-96d3-6014c2a27eac | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-21 02:09:59", "repo_name": "kukaro/Tiramisu", "sub_path": "/TiramisuProject/Tiramisu/src/work/model/dto/Image.java", "file_name": "Image.java", "file_ext": "java", "file_size_in_byte": 1280, "line_count": 83, "lang": "en", "doc_type": "code", "blob_id": "a49005572187c0655808458b713c726c7a550265", "star_events_count": 1, "fork_events_count": 4, "src_encoding": "UHC"} | https://github.com/kukaro/Tiramisu | 321 | FILENAME: Image.java | 0.249447 | package work.model.dto;
/**
* 사진
* ID : 시퀀스 + 프라이머리
* 파일명 : 200자
* @author cse
*
*/
public class Image {
private int imageId;
private String fileName;
/**
* Image 기본 생성자
*/
public Image() {
super();
}
/**
* Image 필수 / 모든 데이터 생성자
* @param imageId
* @param fileName
*/
public Image(int imageId, String fileName) {
super();
this.imageId = imageId;
this.fileName = fileName;
}
/**
* 시퀀스 생성자
* @param fileName
*/
public Image(String fileName) {
super();
this.fileName = fileName;
}
/**
* @return the imageId
*/
public int getImageId() {
return imageId;
}
/**
* @param imageId the imageId to set
*/
public void setImageId(int imageId) {
this.imageId = imageId;
}
/**
* @return the fileName
*/
public String getFileName() {
return fileName;
}
/**
* @param fileName the fileName to set
*/
public void setFileName(String fileName) {
this.fileName = fileName;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append(imageId);
builder.append(", ");
builder.append(fileName);
return builder.toString();
}
}
|
d94349d1-e879-4895-a69f-f55df8f03964 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-08 22:30:26", "repo_name": "HassenBenSlima/Mini-Project-Java", "sub_path": "/workspace/base/src/main/java/com/csys/parametrageachat/domain/Specialite.java", "file_name": "Specialite.java", "file_ext": "java", "file_size_in_byte": 1150, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "3e607833de693aed66896e960bb0262096290b76", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/HassenBenSlima/Mini-Project-Java | 223 | FILENAME: Specialite.java | 0.235108 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.csys.parametrageachat.domain;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import com.csys.parametrageachat.domain.ArticlePH;
/**
*
* @author Farouk
*/
@Entity
@Table(name = "specialite")
@NamedQueries({
@NamedQuery(name = "Specialite.findAll", query = "SELECT s FROM Specialite s")})
public class Specialite extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ManyToMany(mappedBy = "specialiteCollection")
private Collection<ArticlePH> articleCollection;
public Collection<ArticlePH> getArticleCollection() {
return articleCollection;
}
public void setArticleCollection(Collection<ArticlePH> articleCollection) {
this.articleCollection = articleCollection;
}
}
|
1f74ae14-7078-449b-ad5f-1cf724b2d444 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-16 19:24:21", "repo_name": "soderdahl/FileHandle", "sub_path": "/src/test/java/se/kth/payment/PaymentParserServiceTest.java", "file_name": "PaymentParserServiceTest.java", "file_ext": "java", "file_size_in_byte": 969, "line_count": 28, "lang": "en", "doc_type": "code", "blob_id": "a65e3951b07bcb2d49c805d501ed1843329dcdbc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/soderdahl/FileHandle | 212 | FILENAME: PaymentParserServiceTest.java | 0.283781 | package se.kth.payment;
import org.junit.jupiter.api.Test;
import java.io.File;
import static org.junit.jupiter.api.Assertions.*;
class PaymentParserServiceTest {
PaymentParserService paymentParserService = new PaymentParserService();
@Test
void readPaymentFileBetalningsservice() {
String filePathBetalningsservice = this.getClass().getClassLoader().getResource("Exempelfil_betalningsservice.txt").getFile();
File paymentFile = new File(filePathBetalningsservice);
boolean b = paymentParserService.readPaymentFile(paymentFile);
assertTrue(b);
}
@Test
void readPaymentFileInbetalningstjansten() {
String filePathInbetalningstjansten = this.getClass().getClassLoader().getResource("Exempelfil_inbetalningstjansten.txt").getFile();
File paymentFile = new File(filePathInbetalningstjansten);
boolean b = paymentParserService.readPaymentFile(paymentFile);
assertTrue(b);
}
} |
ad1fe4a6-99d9-4cac-9172-3a1debf33454 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-11 14:14:28", "repo_name": "pr7vinas/atlas-api", "sub_path": "/src/main/java/com/atlas/api/App.java", "file_name": "App.java", "file_ext": "java", "file_size_in_byte": 306, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "8d3a38b3ade0375e9c85d381d3fbfda7f7c77a13", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/pr7vinas/atlas-api | 265 | FILENAME: App.java | 0.27048 | /*
* Copyright 2016 Atlas, Inc.
*
* 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.
*
* Module: atlas
* File: App.java
* Class: App
* Qualified: com.atlas.api.App
*
* Author: vinas
* Date: 10/16/16 1:36 PM
* Modified: 10/16/16 1:35 PM
*/
package com.atlas.api;
import com.atlas.servers.GrizzlyServer;
import org.irenical.lifecycle.builder.CompositeLifeCycle;
public class App {
public static void main(String[] args) {
CompositeLifeCycle cycle = new CompositeLifeCycle();
cycle.append(new GrizzlyServer());
cycle.start();
}
}
|
2de525f0-74ae-4d86-b57b-123f685827f8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-27 14:16:43", "repo_name": "arraycto/Market-Data-Analysis", "sub_path": "/demo/src/main/java/com/example/demo/controller/LoginController.java", "file_name": "LoginController.java", "file_ext": "java", "file_size_in_byte": 1276, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "3237dffd054ef29853857c10d59dc17e5d7d7ca3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/arraycto/Market-Data-Analysis | 224 | FILENAME: LoginController.java | 0.253861 | package com.example.demo.controller;
import com.example.demo.mapper.AdministratorMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpSession;
import java.util.Map;
@Controller
public class LoginController {
@Autowired
AdministratorMapper administratorMapper;
// @DeleteMapping
// @PutMapping
// @GetMapping
//@RequestMapping(value = "/admin/login",method = RequestMethod.POST)
@PostMapping("/admin/login")
public String login(@RequestParam("username") String username,
@RequestParam("password") String password,
Map<String, Object> map, HttpSession session){
if(administratorMapper.getUserByUserName(username).getPassWord().equals(password)){
//登陆成功,防止表单重复提交,可以重定向到主页
session.setAttribute("loginUser", username);
return "redirect:/main.html";
}else{
//登陆失败
map.put("msg","用户名密码错误");
return "login";
}
}
}
|
320c5d32-eb4e-42ba-b8f8-18bb6eedcb87 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-12 02:56:35", "repo_name": "hana153/Lab-7", "sub_path": "/src/QueueHospital.java", "file_name": "QueueHospital.java", "file_ext": "java", "file_size_in_byte": 990, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "5b22d7327b1266f6e2fb1ed507562b02ce606938", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hana153/Lab-7 | 219 | FILENAME: QueueHospital.java | 0.268941 | import java.util.LinkedList;
public class QueueHospital<PatientType> extends Hospital<PatientType>
{
private LinkedList<PatientType> waitList;
// constructor to initialize waitList
public QueueHospital()
{
waitList = new LinkedList<PatientType>();
}
@Override
public void addPatient(PatientType patient)
{
waitList.add(patient);
}
@Override
public PatientType nextPatient()
{
return waitList.peek();
}
@Override
public PatientType treatNextPatient()
{
return waitList.poll();
}
@Override
public int numPatients()
{
return waitList.size();
}
@Override
public String hospitalType()
{
return "QueueHospital";
}
@Override
public String allPatientInfo()
{
String result = "";
for (int i = 0; i < waitList.size(); ++i)
{
result += waitList.get(i);
}
return result;
}
}
|
3861542e-328c-4805-8d07-00f1031d7637 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-25 15:22:34", "repo_name": "yangmingyu06/javaWork", "sub_path": "/javaWork05/work08/mystarter/src/main/java/mingyu/data/MailService.java", "file_name": "MailService.java", "file_ext": "java", "file_size_in_byte": 877, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "8ed2bd4382d3729b0cb9bad2f8a828f2e168e5b9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yangmingyu06/javaWork | 250 | FILENAME: MailService.java | 0.276691 | /**
* @(#)MailService.java, 9月 06, 2021.
* <p>
* Copyright 2021 fenbi.com. All rights reserved.
* FENBI.COM PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package mingyu.data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
/**
* @author yangmingyu
*/
@Component
public class MailService {
@Autowired
private User user;
private ZoneId zoneId = ZoneId.systemDefault();
public void setZoneId(ZoneId zoneId) {
this.zoneId = zoneId;
}
public String getTime() {
return ZonedDateTime.now(this.zoneId).format(DateTimeFormatter.ISO_ZONED_DATE_TIME);
}
public void sendLoginMail() {
System.err.println(String.format("Hi, %s! You are logged in at %s", user.getName(), getTime()));
}
public void sendRegistrationMail() {
System.err.println(String.format("Welcome, %s!", user.getName()));
}
} |
7c4ac018-6be7-4030-b6c4-62005ef99179 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-20 14:27:24", "repo_name": "eXcellenceSPb/CRUD", "sub_path": "/src/main/java/controller/servlet/Filter/RoleServlet.java", "file_name": "RoleServlet.java", "file_ext": "java", "file_size_in_byte": 1127, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "2bd1c03b9eb9d7d673c6aa52301c349ad59d2918", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/eXcellenceSPb/CRUD | 196 | FILENAME: RoleServlet.java | 0.240775 | package controller.servlet.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;
@WebFilter(urlPatterns = {"/listUser.jsp", "/Read", "/Update.jsp", "/Update"})
public class RoleServlet implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
HttpSession session = request.getSession();
if (session.getAttribute("role") == "admin") {
filterChain.doFilter(request, response);
}
else {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
}
}
@Override
public void destroy() {
}
}
|
c22af98e-4cc6-4dc2-878f-c20f23badb34 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-20 16:25:14", "repo_name": "MinestomRewind/MinestomRewind", "sub_path": "/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentColor.java", "file_name": "ArgumentColor.java", "file_ext": "java", "file_size_in_byte": 966, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "f491756b6834cee72fd562d802898569e53dd185", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/MinestomRewind/MinestomRewind | 196 | FILENAME: ArgumentColor.java | 0.247987 | package net.minestom.server.command.builder.arguments.minecraft;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor;
import net.minestom.server.command.builder.arguments.Argument;
import net.minestom.server.command.builder.exception.ArgumentSyntaxException;
import org.jetbrains.annotations.NotNull;
/**
* Represents an argument which will give you a {@link TextColor}.
* <p>
* Example: red, white, reset
*/
public class ArgumentColor extends Argument<TextColor> {
public static final int UNDEFINED_COLOR = -2;
public ArgumentColor(String id) {
super(id);
}
@NotNull
@Override
public TextColor parse(@NotNull String input) throws ArgumentSyntaxException {
final TextColor color = NamedTextColor.NAMES.value(input);
if (color == null)
throw new ArgumentSyntaxException("Undefined color", input, UNDEFINED_COLOR);
return color;
}
}
|
24b90699-0e8e-43d0-ae45-6a6b65b7d344 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-02-17 04:01:37", "repo_name": "vipulbhale/splitter", "sub_path": "/src/main/java/aug/manas/splitter/web/HomeController.java", "file_name": "HomeController.java", "file_ext": "java", "file_size_in_byte": 992, "line_count": 26, "lang": "en", "doc_type": "code", "blob_id": "f607e1e9cdfa32dbda994b572cb1d986aebad883", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/vipulbhale/splitter | 168 | FILENAME: HomeController.java | 0.252384 | package aug.manas.splitter.web;
import static org.springframework.web.bind.annotation.RequestMethod.*;
import org.apache.log4j.Logger;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class HomeController {
private static final Logger logger = Logger.getLogger(HomeController.class);
@RequestMapping(value = "/", method = GET)
public ModelAndView goToDashboard() {
logger.debug("Entered in the goToDashboard method");
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
String name = auth.getName(); // get logged in username
logger.debug("Logged in user is :: "+ auth.getName());
ModelAndView modelAndView = new ModelAndView("home","loggedInUser",name);
return modelAndView;
}
} |
dda42f51-534a-427f-bd14-224f019c12d1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-06-19 07:28:47", "repo_name": "claboran/priceimporter", "sub_path": "/src/test/java/de/laboranowitsch/priceimporter/testutil/FactDataRecordHelper.java", "file_name": "FactDataRecordHelper.java", "file_ext": "java", "file_size_in_byte": 1078, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "3c7eebbf3cbdbd1ed18cc641ce81119c9f029019", "star_events_count": 4, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/claboran/priceimporter | 244 | FILENAME: FactDataRecordHelper.java | 0.285372 | package de.laboranowitsch.priceimporter.testutil;
import de.laboranowitsch.priceimporter.domain.FactData;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import javax.sql.DataSource;
import java.util.List;
/**
* Reads {@link de.laboranowitsch.priceimporter.domain.FactData} for test purpose.
*
* @author christian@laboranowitsch.de
*/
public class FactDataRecordHelper {
/**
* Reads all entries of {@link FactData}
*
* @param dataSource
* @return List of FactData
*/
public static List<FactData> getFactData(DataSource dataSource) {
NamedParameterJdbcTemplate jdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
return jdbcTemplate.query("select * from int_test_f_energy_price_demand", ((rs, rowNum) -> FactData.builder().id(rs.getLong(1))
.totalDemand(rs.getDouble(2))
.rpr(rs.getDouble(3))
.regionId(rs.getLong(4))
.periodId(rs.getLong(5))
.dateTimeId(rs.getLong(6))
.build()));
}
}
|
c679f70d-03c1-4c82-accf-1c06fefe1822 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-16 11:50:35", "repo_name": "ainilili/no-framework", "sub_path": "/nico-nocat/src/main/java/org/nico/cat/server/processer/response/chains/segment/ProcessSession.java", "file_name": "ProcessSession.java", "file_ext": "java", "file_size_in_byte": 1123, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "e29d59e8238239f1c284c749dfea5d5869844da5", "star_events_count": 5, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ainilili/no-framework | 252 | FILENAME: ProcessSession.java | 0.282988 | package org.nico.cat.server.processer.response.chains.segment;
import java.util.Base64;
import java.util.Date;
import org.nico.cat.config.ConfigKey;
import org.nico.cat.server.container.Container;
import org.nico.cat.server.processer.response.chains.AbstractResponseProcess;
import org.nico.cat.server.request.Request;
import org.nico.cat.server.response.Response;
/**
* Process uri filter
* @author nico
* @date 2018年1月11日
*/
public class ProcessSession extends AbstractResponseProcess{
@Override
public Response process(Request request, Response response) throws Exception {
if(container != null){
if(request.getSession() != null){
if(! request.getSession().isEmpty()){
if(! request.getCookieMap().containsKey(ConfigKey.SESSIONID)){
String sessionToken = new String(Base64.getEncoder().encode(String.valueOf(new Date().getTime()).getBytes()));
container.putSession(sessionToken, request.getSession());
response.getHeaders().add("Set-Cookie", ConfigKey.SESSIONID + "=" + sessionToken + ";path=/");
}
}
}else{
}
}
return next(request, response);
}
}
|
5643f4ad-b355-4505-b331-5f3820e44ff5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-16 13:21:40", "repo_name": "mohamedkhairy953/WeatherStatusSharing", "sub_path": "/core/src/main/java/com/khairy/core/data/db/entities/WeatherPhotoEntity.java", "file_name": "WeatherPhotoEntity.java", "file_ext": "java", "file_size_in_byte": 1127, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "13ded7cf9e25cc4b4fc6f13121c600d0a98ad828", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mohamedkhairy953/WeatherStatusSharing | 226 | FILENAME: WeatherPhotoEntity.java | 0.23793 | package com.khairy.core.data.db.entities;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.databinding.BindingAdapter;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import com.bumptech.glide.Glide;
import com.khairy.core.R;
import java.io.File;
@Entity(tableName = "weatherPhoto")
public class WeatherPhotoEntity {
String name;
@PrimaryKey
@NonNull
String photoPath;
public WeatherPhotoEntity(String name, @NonNull String photoPath) {
this.name = name;
this.photoPath = photoPath;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhotoPath() {
return photoPath;
}
public void setPhotoPath(String photoPath) {
this.photoPath = photoPath;
}
@BindingAdapter("displayPhoto")
public static void loadImage(ImageView view, String imageUrl) {
Glide.with(view).
load(new File(imageUrl)).
error(R.drawable.placeholder).
into(view);
}
}
|
2a1a2cb8-06bd-4484-bf76-5fa242884936 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-09-25 09:53:44", "repo_name": "DeTreMusketere/Database-Business-Slagelse-Server", "sub_path": "/dbs/src/model/data/Picture.java", "file_name": "Picture.java", "file_ext": "java", "file_size_in_byte": 1210, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "74bcbd322ae2d2770f89ad857e7a69b8513afb36", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DeTreMusketere/Database-Business-Slagelse-Server | 265 | FILENAME: Picture.java | 0.26588 | package model.data;
import abstracts.Data;
import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
import java.io.Serializable;
import org.json.JSONObject;
/**
*
* @author Patrick
*/
public class Picture extends Data implements Serializable {
private String name;
private byte[] byteArray;
public Picture(int id, String name, byte[] byteArray, int updateNumber) {
super(id, updateNumber);
this.name = name;
this.byteArray = byteArray;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public byte[] getByteArray() {
return byteArray;
}
public void setByteArray(byte[] byteArray) {
this.byteArray = byteArray;
}
@Override
public String toString() {
return "name: " + name;
}
@Override
public JSONObject toJSONObject() {
JSONObject obj = new JSONObject();
obj.put("id", getId());
obj.put("name", name);
String base64String = Base64.encode(byteArray);
obj.put("picturestring", base64String);
obj.put("updatenumber", getUpdateNumber());
return obj;
}
}
|
7b80119e-b81a-4150-962a-4f48e3eea7f6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-03-26 19:00:04", "repo_name": "SusannaAmatuni/OnlineArtGallery", "sub_path": "/src/java/shopper/data/ArtTypeDB.java", "file_name": "ArtTypeDB.java", "file_ext": "java", "file_size_in_byte": 970, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "a3557aad58fd6dc33884e80e74a82d7c3f054b91", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/SusannaAmatuni/OnlineArtGallery | 226 | FILENAME: ArtTypeDB.java | 0.284576 | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package shopper.data;
import java.sql.*;
/**
*
* @author HP_Owner
*/
public class ArtTypeDB {
public static int selectArtType(String arttype) {
ConnectionPool pool = ConnectionPool.getInstance();
Connection connection = pool.getConnection();
PreparedStatement ps = null;
ResultSet rs = null;
int arttype_ID=0;
String sql = "SELECT ArtType_ID FROM ArtType WHERE ArtTypeName= ?";
try {
ps= connection.prepareStatement(sql);
ps.setString(1,arttype);
rs= ps.executeQuery();
if(rs.next()) {
arttype_ID= rs.getInt("ArtType_ID");
return arttype_ID;
}
else {
return 0;
}
}
catch(SQLException e) {
e.printStackTrace();
return 0;
}
finally {
pool.freeConnection(connection);
DBUtil.closePreparedStatement(ps);
DBUtil.closeResultSet(rs);}
}
}
|
d21328b6-9f6b-4dd2-91ce-08fe82af51a9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-06-25 05:37:05", "repo_name": "fanpengfei1993/cbk", "sub_path": "/ChaBaiKe/app/src/main/java/com/example/administrator/day0620_chabaike/LoadingActivity.java", "file_name": "LoadingActivity.java", "file_ext": "java", "file_size_in_byte": 1150, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "f470da1292b055a86682f4be5d28273a69dc6d1c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/fanpengfei1993/cbk | 215 | FILENAME: LoadingActivity.java | 0.220007 | package com.example.administrator.day0620_chabaike;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import com.example.administrator.day0620_chabaike.Constant.ConstantKey;
import com.example.administrator.day0620_chabaike.Utils.Pref_Utils;
public class LoadingActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loading);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent();
intent.setClass(LoadingActivity.this,WelcomeActivity.class);
if(!getFirstOpenFlag()){
intent.setClass(LoadingActivity.this,HomeActivity.class);
}
startActivity(intent);
finish();
}
},3000);
}
private boolean getFirstOpenFlag() {
return Pref_Utils.getBoolean(this, ConstantKey.PRE_KEY_FIRST_OPEN,true);
}
}
|
dd5a10e3-a310-4d26-9a8f-738d1bc227da | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-08 06:28:19", "repo_name": "PopaRares/Proiect-IS", "sub_path": "/src/main/java/com/IS/SINU/controllers/GroupController.java", "file_name": "GroupController.java", "file_ext": "java", "file_size_in_byte": 1026, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "100d426dd704c0190ead3f151ed8a0d08960a747", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/PopaRares/Proiect-IS | 184 | FILENAME: GroupController.java | 0.250913 | package com.IS.SINU.controllers;
import com.IS.SINU.entities.dao.Group;
import com.IS.SINU.entities.dao.User;
import com.IS.SINU.entities.dto.Request;
import com.IS.SINU.services.GroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/group")
public class GroupController {
@Autowired
private GroupService service;
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Group> getGroup() {
Group group = service.getGroup();
return ResponseEntity.ok(group);
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Group> getGroup(@PathVariable Long id) {
Group group = service.getGroupById(id);
return ResponseEntity.ok(group);
}
}
|
0f215381-f839-492b-8be0-1767c23a79a8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-05-18 20:28:33", "repo_name": "life0fun/MovementSensor", "sub_path": "/src/com/colorcloud/movementsensor/MovementSensorApiHandler.java", "file_name": "MovementSensorApiHandler.java", "file_ext": "java", "file_size_in_byte": 1101, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "8baa01f00697e72b76156b376c89a2a9f6cdb644", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/life0fun/MovementSensor | 230 | FILENAME: MovementSensorApiHandler.java | 0.288569 | package com.colorcloud.movementsensor;
import android.os.Handler;
import android.os.RemoteException;
import com.colorcloud.movementsensor.IMovementSensor;
/**
*<code><pre>
* CLASS:
* implements service API handler Interface. For now, service stub is empty.
* This is reserved here for future usage. The Intent filter to bind to this service will be defined later.
*
* RESPONSIBILITIES:
* Expose Location manager service binder APIs so other components can bind to us.
*
* COLABORATORS:
*
* USAGE:
* See each method.
*
*</pre></code>
*/
public class MovementSensorApiHandler extends IMovementSensor.Stub {
@SuppressWarnings("unused")
private MovementSensorManager mManager;
public MovementSensorApiHandler(MovementSensorManager manager) {
mManager = manager; // dependency injection, reserved for future extension.
}
public int registerListener(int movement_interval, String intentActionString)
throws RemoteException {
return 0;
}
public int unregisterListener(int hdl) throws RemoteException {
return 0;
}
}
|
97cd543e-7a91-41b9-819a-cc7d439b4fec | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-02 16:56:48", "repo_name": "NemanjaVlaisavljevic/microservices-beer-project", "sub_path": "/inventory-failover/src/main/java/com/sfg/inventoryfailover/controller/InventoryFailoverController.java", "file_name": "InventoryFailoverController.java", "file_ext": "java", "file_size_in_byte": 1117, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "a60a89391566038f358cabfcb6616a049713f01f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/NemanjaVlaisavljevic/microservices-beer-project | 256 | FILENAME: InventoryFailoverController.java | 0.26588 | package com.sfg.inventoryfailover.controller;
import com.sfg.inventoryfailover.model.BeerInventoryDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@RestController
@Slf4j
public class InventoryFailoverController {
@GetMapping("/inventory-failover")
public List<BeerInventoryDto> getInventoryDtoList(){
BeerInventoryDto beerInventoryDto = BeerInventoryDto.builder()
.id(UUID.randomUUID())
.beerId(UUID.fromString("00000000-0000-0000-0000-000000000000"))
.quantityOnHand(999)
.createdDate(OffsetDateTime.now())
.lastModifiedDate(OffsetDateTime.now())
.upc("72527273070")
.build();
List<BeerInventoryDto> beerInventoryDtoList = new ArrayList<BeerInventoryDto>();
beerInventoryDtoList.add(beerInventoryDto);
return beerInventoryDtoList;
}
}
|
d286585d-d438-4126-93b4-c1bb341046bf | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-20 10:41:49", "repo_name": "CQJTU-ZCT/SmartHospital", "sub_path": "/common/src/main/java/com/cqjtu/tools/MybatisGenerator.java", "file_name": "MybatisGenerator.java", "file_ext": "java", "file_size_in_byte": 1157, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "94ddb02f409bf206cf323821c37924ca2096614b", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/CQJTU-ZCT/SmartHospital | 258 | FILENAME: MybatisGenerator.java | 0.250913 | package com.cqjtu.tools;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.internal.DefaultShellCallback;
/**
*
* <p>ClassName:MybatisGenerator</p>
* <p>Description:逆向工程</p>
* @author ZJH
* @date 2017年5月31日下午7:13:52
*/
public class MybatisGenerator {
public static void main(String[] args) throws Exception {
List<String> warnings = new ArrayList<String>();
boolean overwrite = true;
File configFile = new File(MybatisGenerator.class.getResource("/").getPath() + "mybatisGenerator.xml");
System.out.println(configFile.toString());
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(configFile);
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
myBatisGenerator.generate(null);
System.out.println("mybatis逆向工程完成");
}
}
|
40b24668-7094-4f6d-9b2d-8f912235f9d9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-26 14:23:37", "repo_name": "NeptuneN/MoviesAndGrades", "sub_path": "/src/main/java/ee/kool/kool/actorsAndMovies/actors/movies/service/MovieService.java", "file_name": "MovieService.java", "file_ext": "java", "file_size_in_byte": 1149, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "d2aa0696fc1233b908de549d69b0f34bf2c708c0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/NeptuneN/MoviesAndGrades | 271 | FILENAME: MovieService.java | 0.290981 | package ee.kool.kool.actorsAndMovies.actors.movies.service;
import ee.kool.kool.actorsAndMovies.actors.dto.Actor;
import ee.kool.kool.actorsAndMovies.actors.movies.dto.Film;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class MovieService {
public List<Film> mockMovies() {
List<Film> films = new ArrayList<>();
Film film1 = new Film();
film1.setId(1);
film1.setName("Star Wars");
Actor actor1 = new Actor();
actor1.setForeName("Matthew");
actor1.setLastName("Mercer");
actor1.setId(1);
List<Actor> actors = new ArrayList<>();
actors.add(actor1);
film1.setActors(actors);
films.add(film1);
return films;
}
public Film mockOneMovie(Integer id) {
Film film2 = new Film();
film2.setId(id);
film2.setName("Overwatch");
return film2;
}
public Film mockTwoMovie(Integer id) {
Film film3 = new Film();
film3.setId(id);
film3.setName("Bingo");
film3.setRating(7);
return film3;
}
}
|
d43692c8-5ce7-4672-804e-974bcbc1f649 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-21 02:38:43", "repo_name": "tree1123/Kafka-demo-version", "sub_path": "/src/main/java/com/tree/newversion/ProducerDemo.java", "file_name": "ProducerDemo.java", "file_ext": "java", "file_size_in_byte": 1062, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "7b470c1910eed3ec97ab5627f00093c2b5b5dd30", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/tree1123/Kafka-demo-version | 260 | FILENAME: ProducerDemo.java | 0.253861 | package com.tree.newversion;
/**
* ues it after version 0.9
*
* http://kafka.apache.org/23/javadoc/index.html?org/apache/kafka/clients/producer/KafkaProducer.html
*/
import java.util.Properties;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
public class ProducerDemo {
public static void main(String[] args) {
Properties properties = new Properties();
properties.put("bootstrap.servers", "kafka01:9092,kafka02:9092");
properties.put("acks", "all");
properties.put("retries", 0);
properties.put("batch.size", 16384);
properties.put("linger.ms", 1);
properties.put("buffer.memory", 33554432);
properties.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
properties.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
KafkaProducer<String, String> kafkaProducer = new KafkaProducer<String, String>(properties);
kafkaProducer.send(new ProducerRecord<>("topic", "value"));
kafkaProducer.close();
}
}
|
29602767-2aa9-4a15-be07-339ed85aaa26 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-14 09:31:59", "repo_name": "swatipriyadarsani/LogParser", "sub_path": "/LogParser/src/test/java/madbuildparser/LogParser/MadBuildLogParserTest.java", "file_name": "MadBuildLogParserTest.java", "file_ext": "java", "file_size_in_byte": 1093, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "a93dac2d2c722fb0906deb8bef7fce1f31e8f843", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/swatipriyadarsani/LogParser | 225 | FILENAME: MadBuildLogParserTest.java | 0.272799 | package madbuildparser.LogParser;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import static org.junit.Assert.fail;
import java.io.IOException;
public class MadBuildLogParserTest {
@Test
public void readSampleLogFile() throws IOException {
String inputDir=System.getProperty("user.dir")+"\\src\\test\\resources\\input";
String outputDir=System.getProperty("user.dir")+"\\src\\test\\resources\\output";
MadBuildLogParser madBuildLogParser=new MadBuildLogParser();
madBuildLogParser.process(inputDir,outputDir);
madBuildLogParser.showProcessedFiles();
madBuildLogParser.showGeneratedFiles();
}
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@Test
public void checkIfOutputFolderExist() throws IOException {
temporaryFolder.newFolder("output");
fail("Output folder alredy exist");
}
@Test
public void checkIfInputFolderExist() throws IOException {
temporaryFolder.newFolder("input");
fail("Input folder alredy exist");
}
} |
af00d875-364d-455a-b1e2-f3d4229cd887 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-29 13:46:18", "repo_name": "changhe626/mmall", "sub_path": "/src/main/java/com/mmall/common/ExceptionResolver.java", "file_name": "ExceptionResolver.java", "file_ext": "java", "file_size_in_byte": 1089, "line_count": 27, "lang": "en", "doc_type": "code", "blob_id": "d7debc19d63441cc7df4f18b09f27ba2dc511ef7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/changhe626/mmall | 193 | FILENAME: ExceptionResolver.java | 0.213377 | package com.mmall.common;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.json.MappingJacksonJsonView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Slf4j
@Component
public class ExceptionResolver implements HandlerExceptionResolver {
@Override
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception e) {
log.error("{} exception",request.getRequestURI(),e);
MappingJacksonJsonView jsonView = new MappingJacksonJsonView();
ModelAndView view = new ModelAndView(jsonView);
//当时用jackson2.x 的时候,使用MappingJacksonJson2View
view.addObject("status",ResponseCode.ERROR.getCode());
view.addObject("msg","接口异常,请联系管理员");
view.addObject("data",e.toString());
return view;
}
}
|
492a75c0-5bfd-49bf-a7d3-aa41a5703759 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-21 12:02:45", "repo_name": "Sondola/lab7", "sub_path": "/common/src/main/java/objects/Request.java", "file_name": "Request.java", "file_ext": "java", "file_size_in_byte": 1088, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "bcb963bf910eda72e4c8a0883d034472505f58d3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Sondola/lab7 | 234 | FILENAME: Request.java | 0.278257 | package objects;
import data.User;
import java.io.Serializable;
public class Request implements Serializable {
private String command;
private String commandArg;
private Object obj;
private User user;
public Request(String command, String commandArg, Object obj, User user) {
this.command = command;
this.commandArg = commandArg;
this.obj = obj;
this.user = user;
}
public Request(String command, String commandArr, User user) {
this(command, commandArr, null, user);
}
public Request(String command, User user) {
this(command, "", null, user);
}
public String getCommandString() {
return command;
}
public String getCommandArg() {return commandArg;}
public Object getObject() {return obj;}
public User getUser() {
return user;
}
public boolean isEmpty() {
return command.isEmpty();
}
@Override
public String toString() {
return "Request[" + command + "]\n" + "Argument: " + commandArg + "\nObject: " + obj;
}
}
|
cafdbbe0-6cc5-482e-8297-b733d3fcd673 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-09-05T16:21:59", "repo_name": "operationBrass/Homework-assignment-15", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1210, "line_count": 41, "lang": "en", "doc_type": "text", "blob_id": "ad3bf85117fcb5b19398bb3ee990176059d4a5ba", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/operationBrass/Homework-assignment-15 | 302 | FILENAME: README.md | 0.2227 | # Workout Tracker
[](http://www.wtfpl.net/about/)

### Description
Manage your workouts with this workout tracker.
### Table of Contents
- [Usage Guide](#Usage-Guide)
- [Install Instructions](#Installation)
- [Technologies Used](#Technologies-Used)
- [Contributions](#Contributions)
- [Tests](#Tests)
- [Questions](#Questions)
## Usage Guide
Deployed on [Heroku](https://intense-springs-06464.herokuapp.com/) This application allows you track your workouts, add to existing, create new ones and trend on the last 7 days of workouts.
Get started with the fitness tracker [here](https://intense-springs-06464.herokuapp.com/)
## Technologies Used
MongoDB, Node, mongoose, expresss
## Contributions
This is currently my own work. Please feel free to submit your contributions on GITHUB with credits given
## Tests
Future testing planned using Jest testing framework
## Questions
If you have any questions or want to keep up with my latest projects, please follow me on [Github](http://www.github.com/operationBrass) or contact me via [Email](mr.brn.lewis@outlook.com).
|
1ecdc965-d658-41d9-af4a-cd21d2bcb887 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-16 13:02:29", "repo_name": "Switch-vov/JAVA-01", "sub_path": "/Week_13/exercise/kafka-demo/src/main/java/com/switchvov/kafka/demo/producer/KafkaProducerDemo.java", "file_name": "KafkaProducerDemo.java", "file_ext": "java", "file_size_in_byte": 1150, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "aa8cbb97349f235fa8e1785dddebe3c0a5fb55c2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Switch-vov/JAVA-01 | 238 | FILENAME: KafkaProducerDemo.java | 0.261331 | package com.switchvov.kafka.demo.producer;
import com.alibaba.fastjson.JSON;
import com.switchvov.kafka.demo.domain.Order;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
import java.math.BigDecimal;
import java.util.Properties;
/**
* @author switch
* @since 2021/4/23
*/
public class KafkaProducerDemo {
public static void main(String[] args) {
Properties props = new Properties();
props.setProperty("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.setProperty("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.setProperty("bootstrap.servers", "localhost:9092");
KafkaProducer<String, String> producer = new KafkaProducer<String, String>(props);
for (int i = 0; i < 10; i++) {
Order order = new Order().setId(i).setAmount(BigDecimal.ONE).setType(1);
ProducerRecord<String, String> record = new ProducerRecord<>("demo-source", JSON.toJSONString(order));
producer.send(record);
}
producer.close();
}
}
|
5d47d94b-1eb1-4240-b94f-94cfe36efe63 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2011-10-25T13:32:25", "repo_name": "holyshared/Locater", "sub_path": "/Demos/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 966, "line_count": 28, "lang": "en", "doc_type": "text", "blob_id": "43c6199fa42ec3aa3be820fcfef8c6aa91f4a8c6", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/holyshared/Locater | 198 | FILENAME: README.md | 0.26588 | YourPosition
==================================
This application is an application to display your present position in the map by using location information API.
This application is made for the demonstration of [Locater](https://github.com/holyshared/Locater "Locater").
Author
----------------------------------
Noritaka Horio<holy.shared.design@gmail.com>
Licence
----------------------------------
[The MIT Licence ](http://www.opensource.org/licenses/mit-license.php "The MIT Licence ")
Build of source
----------------------------------
Please do the build by using [packager](https://github.com/kamicane/packager "packager").
### Mootools
packager build Core/Object Core/Browser Core/Class Core/Class.Extras
### Locater(All components)
packager build Locater/Locater.Application Locater/Locater.Handler.DebugHandler Locater/Locater.Handler.CurrentPositionHandler +use-only Locater
### Application
packager build YourPosition/* +use-only YourPosition
|
55b4ee7e-84a7-4f85-8df7-e085c8da9ed4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-02 00:02:14", "repo_name": "brianNoreiko/udee", "sub_path": "/src/main/java/com/utn/UDEE/models/Address.java", "file_name": "Address.java", "file_ext": "java", "file_size_in_byte": 1040, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "c2526adc65cf4858e0d85afbee7716a7525d8433", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/brianNoreiko/udee | 220 | FILENAME: Address.java | 0.243642 |
package com.utn.UDEE.models;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
@Entity (name = "addresses")
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Address {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
@Column(name = "address_id",unique = true,nullable = false)
private Integer id;
@NotNull(message = "The street shouldn't be null")
@Column(name = "street")
private String street;
@NotNull(message = "The street number shouldn't be null")
@Column(name = "number")
private Integer number;
@Column(name = "apartment")
private String apartment;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "userId")
private User user;
@OneToOne
@JoinColumn(name = "meterId")
private Meter meter;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_rate")
private Rate rate;
} |
997406b5-bdaa-4e6e-8938-e8f61710bce5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-06 04:03:41", "repo_name": "GauravNadar/COVID-19", "sub_path": "/app/src/main/java/com/gauravnadar/covid19stats/BroadcastReceiver/CustomBroadcastReceiver.java", "file_name": "CustomBroadcastReceiver.java", "file_ext": "java", "file_size_in_byte": 1208, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "376e711dd37dd190e1049ec94977c183728a14bb", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/GauravNadar/COVID-19 | 231 | FILENAME: CustomBroadcastReceiver.java | 0.245085 | package com.gauravnadar.covid19stats.BroadcastReceiver;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;
import android.widget.Toast;
import com.gauravnadar.covid19stats.MainActivity;
import com.gauravnadar.covid19stats.Scheduler;
import com.gauravnadar.covid19stats.Util.Job;
import static android.content.Context.JOB_SCHEDULER_SERVICE;
import static android.content.Context.MODE_PRIVATE;
public class CustomBroadcastReceiver extends BroadcastReceiver {
SharedPreferences prefs;
SharedPreferences.Editor editor;
@Override
public void onReceive(Context context, Intent intent) {
String intentAction = intent.getAction();
Log.e("log", intent.getAction());
if(intentAction != null)
{
Log.e("check", "inside");
if(Intent.ACTION_MY_PACKAGE_REPLACED.equals(intentAction))
{
Job.scheduleJob(context);
Log.e("Broadcast", "Working");
}
}
}
}
|
20f5b70d-6953-49cc-a518-a4ddef1d98f9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-18 06:38:31", "repo_name": "hjhcode/JAVA", "sub_path": "/练习/wenjian/FileTest.java", "file_name": "FileTest.java", "file_ext": "java", "file_size_in_byte": 1066, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "749fb943f6193b47cb7f012c80ea2633c8979f9b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hjhcode/JAVA | 218 | FILENAME: FileTest.java | 0.252384 | package wenjian;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import java.io.File;
import java.io.IOException;
import java.net.SocketPermission;
/**
* Created by hjh on 16-7-23.
*/
public class FileTest {
public static void main(String[] args)throws IOException{
File file = new File(".");
System.out.println(file.getName());
System.out.println(file.getParent());
System.out.println(file.getAbsoluteFile());
System.out.println(file.getAbsoluteFile().getParent());
File tmpfile = File.createTempFile("aaa",".txt",file);
tmpfile.deleteOnExit();
File newfile = new File(System.currentTimeMillis()+"");
System.out.println(newfile.exists());
newfile.createNewFile();
newfile.mkdir();
String[] filelist = file.list();
for(String filename : filelist){
System.out.println(filename);
}
File[] roots = File.listRoots();
for(File root:roots){
System.out.println(root);
}
}
}
|
7fdbff49-d52d-4e2a-87b2-cb809af54345 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-03-05T21:37:44", "repo_name": "ElanaLaskin/multi-user-blog", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1117, "line_count": 17, "lang": "en", "doc_type": "text", "blob_id": "70cefc33114f5d76fd8560d9d9a3fddea5ca943e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ElanaLaskin/multi-user-blog | 273 | FILENAME: README.md | 0.233706 | ##Multi-User Blog
A simple blog with user signup
Here's the [link](https://monsey-therapists.appspot.com) to the website.
Instructions for running application:
1. Install [Cloud SDK](https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python)
(runs on Linux, Mac OS X and Windows, and requires Python 2.7.x)
2. Extract the file to any location on your file system.
3. Initialize gcloud on the command line from within the sdk directory:
```./google-cloud-sdk/bin/gcloud init```
4. Run the application with the "dev_appserver.py" command, specifying the paths of dev_appserver.py and the application:
For example,
```~/Documents/programming_software/google-cloud-sdk/bin/dev_appserver.py ./Documents/projects/google_applications/user-signup-154601```
5. When the command executes, it will give you the port where the application is running. View the application in the browser by visiting "http://localhost:8080", "8080" is just an example or a port number.
6. To stop the local server: with Mac OS X or Unix, press Control-C or with Windows, press Control-Break in your command prompt window.
|
541ebdcd-7a58-43bd-8537-812c95e1ab7a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-15 12:02:55", "repo_name": "aliciaak/INFS3634_Task3_final", "sub_path": "/app/src/main/java/com/example/infs3634_task3/utils/GetAPIRequest.java", "file_name": "GetAPIRequest.java", "file_ext": "java", "file_size_in_byte": 1126, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "7c85349c881f49144b8c1d7961b7e83af5f9c9bf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/aliciaak/INFS3634_Task3_final | 207 | FILENAME: GetAPIRequest.java | 0.290981 | package com.example.infs3634_task3.utils;
import android.content.Context;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONException;
public class GetAPIRequest {
private JsonArrayRequest request;
private RequestQueue requestQueue;
public void request(final Context context, final FetchDataListener listener, final String ApiURL) throws JSONException {
if (listener != null) {
listener.onFetchStart();
}
request = new JsonArrayRequest(ApiURL, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
listener.onFetchComplete(response);
}
} , new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) { }
});
requestQueue = Volley.newRequestQueue(context);
requestQueue.add(request);
}
} |
407644d7-5d87-4d89-984c-03f3718785c2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-11 01:16:40", "repo_name": "nife86/Lab_JsonPlaceholder_Demo", "sub_path": "/app/src/main/java/com/example/lab_JsonPlaceholder_Demo/ProgressDialogUtil.java", "file_name": "ProgressDialogUtil.java", "file_ext": "java", "file_size_in_byte": 1025, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "5eacb0faba74d0df40d4bc99b65a18aaf64f17e1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/nife86/Lab_JsonPlaceholder_Demo | 183 | FILENAME: ProgressDialogUtil.java | 0.23793 | package com.example.lab_JsonPlaceholder_Demo;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
public class ProgressDialogUtil {
private static AlertDialog mAlertDialog;
public static void showProgressDialog(Context context, String s) {
if (mAlertDialog == null) {
mAlertDialog = new AlertDialog.Builder(context, R.style.CustomProgressDialog).create();
}
View loadView = LayoutInflater.from(context).inflate(R.layout.process_dialog, null);
mAlertDialog.setView(loadView);
mAlertDialog.setCanceledOnTouchOutside(false);
TextView tv_jsonDownload = loadView.findViewById(R.id.tv_jsonDownload);
tv_jsonDownload.setText(s);
mAlertDialog.show();
}
public static void dismissProgressDialog() {
if (mAlertDialog != null && mAlertDialog.isShowing()) {
mAlertDialog.dismiss();
}
}
}
|
2f0fd4ff-384f-49b6-bf63-9f527f55ba39 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-04-23T02:06:17", "repo_name": "NikoBotDev/onee-sama", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1084, "line_count": 45, "lang": "en", "doc_type": "text", "blob_id": "3ba4b8ab4c180766aca13b8694ee5e3168a0c8de", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/NikoBotDev/onee-sama | 271 | FILENAME: README.md | 0.259826 | # Oneesama
Promise wrapper for [oppai-ng](https://github.com/Francesco149/oppai-ng).
## Getting started
To install the package, just install it from this repository:
`npm i NikoBotDev/onee-sama`
## Testing
Just clone this repository using:
`git clone https://github.com/NikoBotDev/onee-sama.git`
Then go to the folder using cmd and run the following:
`npm run test`
## Usage
### Get oppai data
```javascript
const Oneesama = require('onee-sama');
const parser = new Oneesama();
parser.get('beatmapId').then(data => {
console.log(data);
}).catch(console.err);
```
## Contributing
1. Fork & clone the repository
2. Code your heart out!
3. Make a test just for sure.
4. [Submit a pull request](https://github.com/NikoBotDev/onee-sama/compare)
## License
This package is licensed under the MIT license (see the LICENSE file for more information). I have neither created or contributed to the development of oppai-ng, and this package is not affiliated with its developers in any way.
> GitHub [@EmptyException](https://github.com/NikoBotDev) |
82dda47d-fd8b-4703-9198-15cc80f8b073 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-12-20T09:25:03", "repo_name": "SlashArash/maah", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1130, "line_count": 40, "lang": "en", "doc_type": "text", "blob_id": "a95752101896275e1530196f8b1a1e31bdbb1478", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/SlashArash/maah | 322 | FILENAME: README.md | 0.261331 | # Maah for ZSH
A theme for [Oh My ZSH](https://github.com/robbyrussell/oh-my-zsh) with collapsed working directory and moon(Persian: ماه, Māh) icon!

## Install
### CURL
- Enter below command:
```
curl -o ~/.oh-my-zsh/custom/themes/maah.zsh-theme https://raw.githubusercontent.com/SlashArash/maah/master/maah.zsh-theme --create-dirs
```
### Git
- Clone the repo:
```
git clone https://github.com/SlashArash/maah.git
```
- Create a symbolic link to oh-my-zsh's custom theme folder:
> Remember that you should replace PATH_TO_CLONED_REPO with the actual directories for this command to work.
```
ln -s PATH_TO_CLONED_REPO/maah/maah.zsh-theme ~/.oh-my-zsh/custom/themes/maah.zsh-theme
```
### Manually
1) Download using the GitHub .zip download option and unzip them.
2) Move maah.zsh-theme file to oh-my-zsh's custom theme folder: ~/.oh-my-zsh/custom/themes/maah.zsh-theme.
## Active theme
Go to your ~/.zshrc file and set ZSH_THEME="maah".
## License
[MIT License](./LICENSE)
|
e3eeea77-e540-4a9d-b0dc-d70b2d0f206a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-24 03:31:20", "repo_name": "Rscotl/Ht2", "sub_path": "/HomeTrainer2/app/src/main/java/com/bignerdranch/android/hometrainer2/ProfileActivity.java", "file_name": "ProfileActivity.java", "file_ext": "java", "file_size_in_byte": 1046, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "b327b264f64ec96c802d7125c467c3efa342c848", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Rscotl/Ht2 | 199 | FILENAME: ProfileActivity.java | 0.190724 | package com.bignerdranch.android.hometrainer2;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class ProfileActivity extends AppCompatActivity {
private TextView mName;
private TextView mPassword;
private TextView mEmail;
private TextView mPhoneNumber;
private TextView mAddress;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registry);
mName = (TextView) findViewById(R.id.personName);
mName.setText(0);
mAddress = (TextView) findViewById(R.id.address);
mAddress.setText(0);
mPassword = (TextView) findViewById(R.id.userPassword);
mPassword.setText(0);
mEmail = (TextView) findViewById(R.id.email);
mEmail.setText(0);
mPhoneNumber = (TextView) findViewById(R.id.phone);
mPhoneNumber.setText(0);
}
}
|
2b30f647-8738-4ef4-8ec4-427db6986198 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-05-23 04:17:49", "repo_name": "jakartaredhat/cdi", "sub_path": "/api/src/main/java/jakarta/enterprise/inject/literal/SingletonLiteral.java", "file_name": "SingletonLiteral.java", "file_ext": "java", "file_size_in_byte": 477, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "f2371432008d6c695e70f77f7f52e2111b9d5180", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jakartaredhat/cdi | 249 | FILENAME: SingletonLiteral.java | 0.279042 | /*
* Copyright 2008, Red Hat, Inc., and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* 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 jakarta.enterprise.inject.literal;
import jakarta.enterprise.util.AnnotationLiteral;
import jakarta.inject.Singleton;
/**
* Supports inline instantiation of the {@link Singleton} annotation.
*
* @author Martin Kouba
* @since 2.0
*/
public final class SingletonLiteral extends AnnotationLiteral<Singleton> implements Singleton {
public static final SingletonLiteral INSTANCE = new SingletonLiteral();
private static final long serialVersionUID = 1L;
}
|
901a748e-9c61-4e7d-b70b-f879a1283902 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-12 20:03:42", "repo_name": "sridevi20/WhiskyTracker", "sub_path": "/src/main/java/com/codeclan/example/WhiskyTracker/controllers/WhiskyController.java", "file_name": "WhiskyController.java", "file_ext": "java", "file_size_in_byte": 1043, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "2ee572f3fc53ed6960e952fb52f6b87cb42e94da", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sridevi20/WhiskyTracker | 183 | FILENAME: WhiskyController.java | 0.243642 | package com.codeclan.example.WhiskyTracker.controllers;
import com.codeclan.example.WhiskyTracker.models.Whisky;
import com.codeclan.example.WhiskyTracker.repositories.WhiskyRepository.WhiskyRepository;
import org.hibernate.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.transaction.Transactional;
import java.util.List;
@RestController
@RequestMapping(value = "/whiskies")
public class WhiskyController {
@Autowired
WhiskyRepository whiskeyRepository;
EntityManager entityManager;
@GetMapping(value = "/whiskies/{year}")
public List<Whisky> GetAllTheWhiskiesWithYear(@PathVariable int year) {
return whiskeyRepository.findWhiskyByYear(year);
}
}
|
d17a6fb6-521c-4c12-82d5-bbd83524b081 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-03 09:46:06", "repo_name": "erickogi/zaidi_android", "sub_path": "/app/src/main/java/com/dev/lishabora/Views/Admin/CreateTraderConstants.java", "file_name": "CreateTraderConstants.java", "file_ext": "java", "file_size_in_byte": 1046, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "32e5ebc5f37438bf25e4cc8a008886c8e70af0d4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/erickogi/zaidi_android | 212 | FILENAME: CreateTraderConstants.java | 0.273574 | package com.dev.lishabora.Views.Admin;
import com.dev.lishabora.Models.ProductsModel;
import com.dev.lishabora.Models.Trader.TraderModel;
import java.util.List;
public class CreateTraderConstants {
private static TraderModel traderModel;
private static List<ProductsModel> productModels;
public static TraderModel getTraderModel() {
return traderModel;
}
public static void setTraderModel(TraderModel traderModel) {
CreateTraderConstants.traderModel = traderModel;
}
public static List<ProductsModel> getProductModels() {
return productModels;
}
public static void setProductModels(List<ProductsModel> productModels) {
CreateTraderConstants.productModels = productModels;
}
public static void addTraderProducts(List<ProductsModel> selectedProducts) {
if (productModels != null) {
productModels.addAll(selectedProducts);
} else {
productModels = selectedProducts;
}
}
public class TraderPayload {
}
}
|
8372f778-ba04-4933-878b-27d11be792c9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-26 20:16:54", "repo_name": "tokanada/cs222-two-weeks-project", "sub_path": "/src/main/java/edu/bsu/cs222/RedirectParser.java", "file_name": "RedirectParser.java", "file_ext": "java", "file_size_in_byte": 1150, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "be4f826549c325532da79351f62aa84d441cfcca", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tokanada/cs222-two-weeks-project | 210 | FILENAME: RedirectParser.java | 0.261331 | package edu.bsu.cs222;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
public class RedirectParser {
public Redirect parse(InputStream inputStream) {
try {
JsonParser parser = new JsonParser();
Reader reader = new InputStreamReader(inputStream);
JsonElement rootElement = parser.parse(reader);
JsonObject rootObject = rootElement.getAsJsonObject();
JsonObject query = rootObject.getAsJsonObject("query").getAsJsonObject();
JsonElement redirectElement = query.getAsJsonArray("redirects").get(0);
if (redirectElement == null) {
return null;
}
String originalSearchTerm = redirectElement.getAsJsonObject().get("from").getAsString();
String newSearchTerm = redirectElement.getAsJsonObject().get("to").getAsString();
return new Redirect(originalSearchTerm, newSearchTerm);
} catch (Exception e) {
return null;
}
}
}
|
306f8c8a-4139-4e09-bbaf-d6a3b5933f49 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-21 16:14:12", "repo_name": "nickolayrusev/trackteam", "sub_path": "/domain/src/main/java/com/nrusev/domain/AbstractAuditableEntity.java", "file_name": "AbstractAuditableEntity.java", "file_ext": "java", "file_size_in_byte": 1042, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "fcce0366f1637b6c6439d60d7206008270811948", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/nickolayrusev/trackteam | 215 | FILENAME: AbstractAuditableEntity.java | 0.253861 | package com.nrusev.domain;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.Date;
/**
* Created by nikolayrusev on 3/10/16.
*/
@MappedSuperclass
@EntityListeners({AuditingEntityListener.class})
public class AbstractAuditableEntity {
private Date createdDate;
private Date lastModifiedDate;
@CreatedDate
@Column(name = "created_at")
@Temporal(TemporalType.TIMESTAMP)
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
@LastModifiedDate
@Column(name = "updated_at")
@Temporal(TemporalType.TIMESTAMP)
public Date getLastModifiedDate() {
return lastModifiedDate;
}
public void setLastModifiedDate(Date lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
}
|
1e2f9ded-1f96-404f-8ba1-c32f23384544 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-12 12:08:29", "repo_name": "abu131415/seata0.9.0-demo", "sub_path": "/seata-project/order-model/src/main/java/com/abu/order/controller/OrderTblController.java", "file_name": "OrderTblController.java", "file_ext": "java", "file_size_in_byte": 1097, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "fd6a615ce6bb0fd4a9c597553371497cb5f2bee0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/abu131415/seata0.9.0-demo | 231 | FILENAME: OrderTblController.java | 0.250913 | package com.abu.order.controller;
import com.abu.order.client.StorageClient;
import com.abu.order.pojo.Order;
import com.abu.order.service.OrderTblService;
import com.abu.storage.pojo.Storage;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author 阿布
* @since 2020-04-12
*/
@RestController
@RequestMapping("/order")
public class OrderTblController {
@Autowired
private OrderTblService orderservice;
@Autowired
private StorageClient storageClient;
@PostMapping("insert")
@GlobalTransactional
public void createOrder(Order order) {
this.orderservice.save(order);
Storage storage = new Storage();
storage.setCommodityCode("fsf");
storage.setCount(1);
// int a = 1 / 0;
this.storageClient.save(storage);
}
}
|
45a0dcf3-1e3d-44ed-be15-2b52c3d8537a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-07 12:55:46", "repo_name": "geekbrains-sms/backend", "sub_path": "/warehouse/src/main/java/com/geekbrains/internship/warehouse/controllers/rest/ImagesController.java", "file_name": "ImagesController.java", "file_ext": "java", "file_size_in_byte": 1210, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "6869a1d64aeaf285121c70d13d6e84f17c1959ba", "star_events_count": 0, "fork_events_count": 4, "src_encoding": "UTF-8"} | https://github.com/geekbrains-sms/backend | 218 | FILENAME: ImagesController.java | 0.27513 | package com.geekbrains.internship.warehouse.controllers.rest;
import com.geekbrains.internship.warehouse.entities.Image;
import com.geekbrains.internship.warehouse.services.ImageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/api/v1/images")
@Api("Set of endpoints for CRUD operations for Image")
public class ImagesController {
private ImageService imageService;
@Autowired
private ImagesController(ImageService imageService){
this.imageService = imageService;
}
@GetMapping
@ApiOperation("Returns list of all images")
public List<Image> getAllImages() {
return imageService.findAll();
}
@PostMapping
@ApiOperation("Creates a new image")
public Image createNewImage(Image image) {
return imageService.saveOrUpdate(image);
}
}
|
126f9b4e-4250-4be1-a7c4-4b72a869bbcb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-10-27 15:06:35", "repo_name": "DwarfPlanetGames/Tegris", "sub_path": "/core/src/ml/dpgames/tegris/GameObject.java", "file_name": "GameObject.java", "file_ext": "java", "file_size_in_byte": 977, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "68e1bd8cad71461471639d2e2ff47fa6e84a6b4f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DwarfPlanetGames/Tegris | 256 | FILENAME: GameObject.java | 0.264358 | package ml.dpgames.tegris;
import java.util.Random;
import ml.dpgames.tegris.TextureRender.Draw;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Rectangle;
public class GameObject {
public float x, y, width, height;
public static Texture terrain;
public TextureRegion terrainReg = new TextureRegion(terrain,0,0,16,16);
public static final Random rand = new Random();
public GameObject(float x, float y, float width, float height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
terrainReg.setRegion(0, rand.nextInt(2) * 16, 16, 16);
}
public Rectangle getBounds() {
return null;
}
public void update(float delta) {
}
public void render(SpriteBatch batch) {
TextureRender.addTex(new Draw(){
public void render(SpriteBatch batch) {
batch.draw(terrainReg, x, y);
}
}, (int) y+50);
}
}
|
42550fad-7dc8-4677-be3a-d158a0a7c5dd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-22 04:31:55", "repo_name": "koen08/eduTest", "sub_path": "/src/main/java/com/siberteam/koen/dictionary/FileStreamWorker.java", "file_name": "FileStreamWorker.java", "file_ext": "java", "file_size_in_byte": 1128, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "7f45c010367d4a2f95f14e293b50ee3b089198c3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/koen08/eduTest | 223 | FILENAME: FileStreamWorker.java | 0.291787 | package com.siberteam.koen.dictionary;
import java.io.*;
import java.util.Deque;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedDeque;
public class FileStreamWorker {
private final String fileReaderName;
public final String fileWriterName;
public FileStreamWorker(String fileRead, String fileWrite) {
this.fileReaderName = fileRead;
this.fileWriterName = fileWrite;
}
public Deque<String> getStackUrl() throws IOException {
Deque<String> urls = new ConcurrentLinkedDeque<>();
try (BufferedReader readerFile = new BufferedReader(new FileReader(fileReaderName))) {
String line;
while ((line = readerFile.readLine()) != null) {
urls.push(line);
}
}
return urls;
}
public void writeResultsToFile(Set<String> setWords) throws IOException {
try (BufferedWriter fileWriter = new BufferedWriter(new FileWriter(fileWriterName))) {
for (String setWord : setWords) {
fileWriter.write(setWord + System.lineSeparator());
}
}
}
}
|
868422a3-4f5f-4ca0-bd27-c652853620a2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-06 10:08:04", "repo_name": "zzyzy/otphelper", "sub_path": "/app/src/main/java/com/paperfly/otphelper/OtpListener.java", "file_name": "OtpListener.java", "file_ext": "java", "file_size_in_byte": 1055, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "67d8e5bb7c74a76d1f52649a9b6cba2f41802439", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zzyzy/otphelper | 212 | FILENAME: OtpListener.java | 0.275909 | package com.paperfly.otphelper;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.SimpleTimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class OtpListener {
private String mSender;
private String mMessageFormat;
public OtpListener(String sender, String messageFormat) {
mSender = sender;
mMessageFormat = messageFormat;
}
public boolean isRightSender(String sender) {
return mSender.equals(sender);
}
public Otp getOtpFromMessage(String message) {
Pattern pattern = Pattern.compile(mMessageFormat);
Matcher matcher = pattern.matcher(message);
Otp otp = new Otp();
if (matcher.find()) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmm", Locale.US);
sdf.setTimeZone(new SimpleTimeZone(SimpleTimeZone.UTC_TIME, "UTC"));
otp.setText(matcher.group(1));
otp.setDate(sdf.format(new Date()));
}
return otp;
}
}
|
0a31ace5-dad0-4282-8128-3eff5cce96fa | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-14 16:20:14", "repo_name": "GuilleSO86/LiferayCRUD", "sub_path": "/LiferayProjectTest/modules/AdminData/src/main/java/com/ricoh/test/liferay/portlet/AdminDataAltaCocheRenderCommand.java", "file_name": "AdminDataAltaCocheRenderCommand.java", "file_ext": "java", "file_size_in_byte": 1086, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "238e8c8dc08d0dbe726e2c2162b04e1eb4cf710b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/GuilleSO86/LiferayCRUD | 248 | FILENAME: AdminDataAltaCocheRenderCommand.java | 0.247987 | package com.ricoh.test.liferay.portlet;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.osgi.service.component.annotations.Component;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCRenderCommand;
import com.ricoh.test.liferay.constants.AdminDataPortletKeys;
import com.ricoh.test.liferay.constants.Constants;
@Component(
immediate = true,
property = {
"javax.portlet.name=" + AdminDataPortletKeys.ADMINDATA,
"mvc.command.name=" + Constants.RENDER_ALTA_COCHE
},
service = MVCRenderCommand.class
)
public class AdminDataAltaCocheRenderCommand implements MVCRenderCommand {
@Override
public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException {
_log.info("Redirect to '" + Constants.ALTA_COCHE + "'");
return Constants.ALTA_COCHE;
}
private static final Log _log = LogFactoryUtil.getLog(AdminDataAltaCocheRenderCommand.class);
}
|
11963b19-070c-4b59-81f8-ecdac9e3c989 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-11-15 22:16:42", "repo_name": "mhgrove/cp-openrdf-utils", "sub_path": "/core/main/src/com/complexible/common/openrdf/vocabulary/DBPedia.java", "file_name": "DBPedia.java", "file_ext": "java", "file_size_in_byte": 1127, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "c14ecbf75c9f0d8b569e401f00eec055f696363b", "star_events_count": 3, "fork_events_count": 9, "src_encoding": "UTF-8"} | https://github.com/mhgrove/cp-openrdf-utils | 271 | FILENAME: DBPedia.java | 0.275909 | package com.complexible.common.openrdf.vocabulary;
import org.openrdf.model.IRI;
/**
* <p>Vocabulary for the DBPedia schemas</p>
*
* @author Michael Grove
* @since 0.3.1
* @version 4.0
*/
public class DBPedia {
private static final Ontology ONT = new Ontology();
private static final Property PROP = new Property();
private static final Resource RES = new Resource();
public static Property property() {
return PROP;
}
public static Resource resource() {
return RES;
}
public static Ontology ontology() {
return ONT;
}
public static class Property extends Vocabulary {
private Property() {
super("http://dbpedia.org/property/");
}
public final IRI countryCode = term("countryCode");
}
public static class Resource extends Vocabulary {
private Resource() {
super("http://dbpedia.org/resource/");
}
}
public static class Ontology extends Vocabulary {
private Ontology() {
super("http://dbpedia.org/ontology/");
}
public final IRI Place = term("Place");
public final IRI PopulatedPlace = term("PopulatedPlace");
public final IRI Country = term("Country");
}
}
|
3164474d-f833-4664-85e0-fe704d3245c0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-01-22 17:37:19", "repo_name": "cescoffier/vertx-cache", "sub_path": "/src/main/java/examples/Examples.java", "file_name": "Examples.java", "file_ext": "java", "file_size_in_byte": 1211, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "96d4eabd4b27617a71f636e5f378e98d12a1d860", "star_events_count": 9, "fork_events_count": 7, "src_encoding": "UTF-8"} | https://github.com/cescoffier/vertx-cache | 300 | FILENAME: Examples.java | 0.293404 | package examples;
import io.vertx.core.Vertx;
import io.vertx.ext.cache.Cache;
import io.vertx.ext.cache.CacheOptions;
import io.vertx.ext.cache.ExpirationPolicy;
/**
* @author <a href="http://escoffier.me">Clement Escoffier</a>
*/
public class Examples {
public void create(Vertx vertx) {
Cache.create(vertx, "my-cache", new CacheOptions().setExpirationPolicy(ExpirationPolicy.TOUCH)
.setExpirationTimeInSecond(3600), cache -> {
// cache is the instance you can use
});
}
public void put(Cache<String, String> cache) {
cache.put("key", "my value", v -> {
if (v.failed()) {
// cannot insert the value
} else {
// value inserted
}
});
}
public void get(Cache<String, String> cache) {
cache.get("key", retrieved -> {
if (retrieved.failed()) {
// cannot get the value
} else {
String cachedValue = retrieved.result();
// cachedValue may be null if the cache don't have a mapping for "key".
}
});
}
public void close(Cache<String, String> cache) {
cache.close(done -> {
// you can destroy it to unregister it from the cache manager
cache.destroy();
});
}
}
|
4c3d55fd-de28-4050-bb1d-a2df6e1f6521 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-06 07:42:53", "repo_name": "caoweizhao/PersonHealthRecord", "sub_path": "/app/src/main/java/com/example/administrator/personhealthrecord/util/SoftInputFixUtil.java", "file_name": "SoftInputFixUtil.java", "file_ext": "java", "file_size_in_byte": 1041, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "c0facb246f8bb0b29751414752ecd301e3b7daa8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/caoweizhao/PersonHealthRecord | 199 | FILENAME: SoftInputFixUtil.java | 0.273574 | package com.example.administrator.personhealthrecord.util;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewTreeObserver;
/**
* Created by andy on 2017/8/1.
*/
public class SoftInputFixUtil {
public static void fix(final View root, final View lastView){
root.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
@Override
public void onGlobalLayout(){
Rect rect=new Rect();
root.getWindowVisibleDisplayFrame(rect);
int mainInvisibleHeight=root.getRootView().getHeight()-rect.bottom;
if(mainInvisibleHeight>200){
int[]location=new int[2];
lastView.getLocationInWindow(location);
int deltaY=location[1]+lastView.getHeight()-rect.bottom;
root.scrollBy(0,deltaY);
}else{
root.scrollTo(0,0);
}
}
});
}
}
|
86b02260-1112-4d30-9808-44fabb7bdf60 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-24 08:01:15", "repo_name": "andrejzlatevski/MusicManagement", "sub_path": "/app/src/main/java/andrej/com/musicmanagement/base/BaseScreenPresenter.java", "file_name": "BaseScreenPresenter.java", "file_ext": "java", "file_size_in_byte": 1149, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "fb6cde31c3862a4b513d49207fc2467563c9bf03", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/andrejzlatevski/MusicManagement | 216 | FILENAME: BaseScreenPresenter.java | 0.282196 | package andrej.com.musicmanagement.base;
import andrej.com.musicmanagement.ScreenPresenter;
import andrej.com.musicmanagement.ScreenView;
import io.reactivex.disposables.CompositeDisposable;
public abstract class BaseScreenPresenter<T extends ScreenView> implements ScreenPresenter<T> {
private T mView;
protected final CompositeDisposable viewSubscriptions = new CompositeDisposable();
protected final CompositeDisposable screenSubscriptions = new CompositeDisposable();
@Override
public final void takeView(T view) {
mView = view;
onViewAttached();
}
@Override
public final void dropView() {
mView = null;
viewSubscriptions.clear();
onViewDetached();
}
@Override
public void destroyScreen() {
screenSubscriptions.clear();
onScreenDestroyed();
}
protected final T getView() {
return mView;
}
protected final boolean isViewAttached() {
return mView != null;
}
protected abstract void onViewDetached();
protected abstract void onViewAttached();
protected abstract void onScreenDestroyed();
} |
175b48ab-c08b-4ed3-b440-c8f9bf1e42ee | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-01 18:57:08", "repo_name": "h5dde45/JEE_31_10_17", "sub_path": "/src/main/java/gl_22_01/p6/SinglElemBuffLock.java", "file_name": "SinglElemBuffLock.java", "file_ext": "java", "file_size_in_byte": 1032, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "af5c41e1fb93118b1b85528952ea80a0593ce8ab", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/h5dde45/JEE_31_10_17 | 202 | FILENAME: SinglElemBuffLock.java | 0.290981 | package gl_22_01.p6;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class SinglElemBuffLock {
private final Lock lock = new ReentrantLock(true);
private final Condition notEmpty = lock.newCondition();
private final Condition notFull = lock.newCondition();
private Integer elem = null;
public void put(int newElem) throws InterruptedException {
lock.lock();
try {
while (elem != null) {
notFull.await();
}
this.elem = newElem;
notEmpty.signal();
} finally {
lock.unlock();
}
}
public void get() throws InterruptedException {
lock.lock();
try {
while (elem == null) {
notEmpty.await();
}
Integer result = elem;
elem = null;
notFull.signal();
} finally {
lock.unlock();
}
}
}
|
b3e0056c-bd66-4b1d-a4a5-145b91f02e8c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-22 17:24:35", "repo_name": "annot8/annot8-common-deprecated", "sub_path": "/annot8-common-jackson-serialisation/src/test/java/io/annot8/common/serialisation/jackson/NoBoundsSerializerTest.java", "file_name": "NoBoundsSerializerTest.java", "file_ext": "java", "file_size_in_byte": 975, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "fbf39aef50f070104dc1929e310023cd01010538", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/annot8/annot8-common-deprecated | 186 | FILENAME: NoBoundsSerializerTest.java | 0.268941 | /* Annot8 (annot8.io) - Licensed under Apache-2.0. */
package io.annot8.common.serialisation.jackson;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import io.annot8.common.data.bounds.NoBounds;
public class NoBoundsSerializerTest {
@Test
public void testSerialize() {
ObjectMapper mapper = new ObjectMapper();
SimpleModule module = new SimpleModule();
module.addSerializer(new NoBoundsSerializer());
mapper.registerModule(module);
String json = null;
try {
json = mapper.writeValueAsString(NoBounds.getInstance());
} catch (JsonProcessingException e) {
e.printStackTrace();
}
assertNotNull(json);
assertEquals("{}", json);
}
}
|
cd3182e1-d8db-480d-8c1e-72c300d69f17 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-27 06:42:12", "repo_name": "kunalbarchha/generic-wrapper-for-bitcoinforks", "sub_path": "/src/main/java/com/coin/controller/CoinController.java", "file_name": "CoinController.java", "file_ext": "java", "file_size_in_byte": 1128, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "397b3da559b3f03170f41ff65f96dc7bfedefa6e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kunalbarchha/generic-wrapper-for-bitcoinforks | 200 | FILENAME: CoinController.java | 0.245085 | package com.coin.controller;
import com.coin.models.AppResponse;
import com.coin.services.CoinBalanceUpdateService;
import com.coin.services.WalletAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class CoinController {
@Autowired
WalletAddressService walletAddressService;
@Autowired
CoinBalanceUpdateService coinBalanceUpdateService;
@RequestMapping(value = "/getWalletAddress", method = RequestMethod.POST)
public AppResponse<String> getWalletAddress(String userId) {
String address = walletAddressService.getAddress(userId);
return new AppResponse<>(address);
}
@RequestMapping(value = "/balanceUpdate/{txid}", method = RequestMethod.GET)
public void updateBalanceByTxId(@PathVariable("txid") String txId) {
coinBalanceUpdateService.update(txId);
}
}
|
ff26f910-a1a5-4a32-ac04-90cc63ce28c2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-18 12:36:57", "repo_name": "kbyyd24/cins-openday", "sub_path": "/src/main/java/cn/edu/swpu/cins/openday/model/service/AuthUser.java", "file_name": "AuthUser.java", "file_ext": "java", "file_size_in_byte": 1149, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "8393b15f08b75c981c354f4611a6fad3cbd33f01", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kbyyd24/cins-openday | 306 | FILENAME: AuthUser.java | 0.279042 | package cn.edu.swpu.cins.openday.model.service;
public class AuthUser {
private String mail;
private String token;
public AuthUser() {}
public AuthUser(String mail, String token) {
this.mail = mail;
this.token = token;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AuthUser that = (AuthUser) o;
if (getMail() != null ? !getMail().equals(that.getMail()) : that.getMail() != null) return false;
return getToken() != null ? getToken().equals(that.getToken()) : that.getToken() == null;
}
@Override
public int hashCode() {
int result = getMail() != null ? getMail().hashCode() : 0;
result = 31 * result + (getToken() != null ? getToken().hashCode() : 0);
return result;
}
@Override
public String toString() {
return "AuthUser{" +
"mail='" + mail + '\'' +
", token='" + token + '\'' +
'}';
}
}
|
5c6e222a-47f6-4bf4-9dcb-c5f0c6bd0dfa | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-16 21:16:18", "repo_name": "etamorib/JavaGame2D", "sub_path": "/CinemaGame/src/dev/mate/cinemagame/states/MenuState.java", "file_name": "MenuState.java", "file_ext": "java", "file_size_in_byte": 1038, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "7aa5e59c9f8f11d9f5f0c229ed61f9d79862697b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/etamorib/JavaGame2D | 257 | FILENAME: MenuState.java | 0.290176 | package dev.mate.cinemagame.states;
import java.awt.Graphics;
import dev.mate.cinemagame.Handler;
import dev.mate.cinemagame.gfx.Assets;
import dev.mate.cinemagame.ui.ClickListener;
import dev.mate.cinemagame.ui.UIImageButton;
import dev.mate.cinemagame.ui.UIManager;
public class MenuState extends State {
private UIManager uiManager;
public MenuState(Handler handler) {
super(handler);
uiManager = new UIManager(handler);
handler.getMouse().setUIManager(uiManager);
uiManager.addObject(new UIImageButton(handler.getGame().getWidth()/2-Assets.MENU_BUTTON_WIDTH/2, handler.getGame().getHeight()/2-Assets.MENU_BUTTON_HEIGHT/2,
Assets.MENU_BUTTON_WIDTH, Assets.MENU_BUTTON_HEIGHT, Assets.startButton, new ClickListener() {
@Override
public void onClick() {
handler.getMouse().setUIManager(null);
State.setState(handler.getGame().gameState);
}}));
}
@Override
public void tick() {
uiManager.tick();
}
@Override
public void render(Graphics g) {
uiManager.render(g);
}
}
|
f106f02e-3a5c-43c8-9d5d-8efb9ae53f9e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-01-29 06:55:20", "repo_name": "MahendraReddyP/TestRepository", "sub_path": "/DemoMavenSampleProject/src/test/java/Txl/DemoMavenSampleProject/ExampleTest.java", "file_name": "ExampleTest.java", "file_ext": "java", "file_size_in_byte": 1068, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "742ce2ad0677712000011e26f777ff22666ac349", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MahendraReddyP/TestRepository | 245 | FILENAME: ExampleTest.java | 0.274351 | package Txl.DemoMavenSampleProject;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class ExampleTest {
public static WebDriver driver;
@BeforeTest
public static void startUp()
{
//driver = new ChromeDriver();
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testDownload() throws Exception
{
driver.get("https://www.zoho.com/mail/");
driver.findElement(By.xpath("//div[@class='header']//div[@class='signing']//a[text()='Sign In']")).click();
String header = driver.findElement(By.xpath("//div[@class='main']/h1")).getText();
System.out.println("Page Title : "+ header);
System.out.println("Done");
}
@AfterTest
public static void tearDown()
{
driver.close();
driver.quit();
}
}
|
04c96526-18e3-4ec0-8c3e-aa2b9eac844e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-03 03:28:56", "repo_name": "natanaelfonseca/msc-authserver", "sub_path": "/src/main/java/br/com/treinamento/auth/filter/InspectHeaderFilter.java", "file_name": "InspectHeaderFilter.java", "file_ext": "java", "file_size_in_byte": 1116, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "feb86bf4259c2265a329c4a94c43d56fdf0c431b", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/natanaelfonseca/msc-authserver | 199 | FILENAME: InspectHeaderFilter.java | 0.205615 | package br.com.treinamento.auth.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class InspectHeaderFilter implements Filter {
Logger logger = LoggerFactory.getLogger(InspectHeaderFilter.class);
@Override
public void doFilter(ServletRequest servletRequest,
ServletResponse servletResponse,
FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
logger.debug("Passando pelo AuthServer: " + httpServletRequest.getHeader("Authorization"));
filterChain.doFilter(httpServletRequest, servletResponse);
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void destroy() {
}
} |
2f995761-e66c-4081-8f36-b0f737c9bbb9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-14 05:46:03", "repo_name": "choitree/issue-tracker", "sub_path": "/BE/server/src/main/java/com/team11/issue/dto/comment/CommentResponseDTO.java", "file_name": "CommentResponseDTO.java", "file_ext": "java", "file_size_in_byte": 975, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "a5aa794788e938175ddb03019afd73408d1ddabc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/choitree/issue-tracker | 174 | FILENAME: CommentResponseDTO.java | 0.246533 | package com.team11.issue.dto.comment;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.team11.issue.domain.Comment;
import com.team11.issue.dto.user.UserResponseDTO;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.time.LocalDateTime;
@JsonPropertyOrder({"commentId", "author", "contents", "createDateTime"})
@RequiredArgsConstructor
@Builder
@Getter
public class CommentResponseDTO {
private final Long commentId;
private final UserResponseDTO author;
private final String contents;
private final LocalDateTime createDateTime;
public static CommentResponseDTO from(Comment comment) {
return CommentResponseDTO.builder()
.commentId(comment.getId())
.author(UserResponseDTO.from(comment.getUser()))
.contents(comment.getContents())
.createDateTime(comment.getCreateDateTime())
.build();
}
}
|
e818f3b2-8c5c-4851-aeda-63fbab0e7d2a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-06-03 08:07:34", "repo_name": "forbe/Carbon", "sub_path": "/carbon/src/main/java/carbon/drawable/ControlCheckedColorStateList.java", "file_name": "ControlCheckedColorStateList.java", "file_ext": "java", "file_size_in_byte": 1008, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "f95dd1b849efc24eb6f7329d45f43a3b26cc2e19", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/forbe/Carbon | 206 | FILENAME: ControlCheckedColorStateList.java | 0.284576 | package carbon.drawable;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.util.TypedValue;
import carbon.R;
/**
* Created by Marcin on 2015-03-16.
*/
public class ControlCheckedColorStateList extends ColorStateList {
public ControlCheckedColorStateList(Context context) {
super(new int[][]{
new int[]{android.R.attr.state_checked},
new int[]{}
}, new int[]{
getThemeColor(context, R.attr.colorAccent),
getThemeColor(context, R.attr.colorControlNormal)
});
}
public static int getThemeColor(Context context, int attr) {
Resources.Theme theme = context.getTheme();
TypedValue typedvalueattr = new TypedValue();
theme.resolveAttribute(attr, typedvalueattr, true);
return typedvalueattr.resourceId != 0 ? context.getResources().getColor(typedvalueattr.resourceId) : typedvalueattr.data;
}
}
|
6a8e15a5-c2e7-48ff-97d8-1bde44efa871 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-05 11:20:25", "repo_name": "ytempest/WanAndroid", "sub_path": "/app/src/main/java/com/ytempest/wanandroid/listener/PasswordStatusChangeListener.java", "file_name": "PasswordStatusChangeListener.java", "file_ext": "java", "file_size_in_byte": 1124, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "a5faebc81eec462f19193f714afc78d38765fc77", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ytempest/WanAndroid | 216 | FILENAME: PasswordStatusChangeListener.java | 0.229535 | package com.ytempest.wanandroid.listener;
import android.text.Editable;
import android.text.Selection;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.widget.EditText;
/**
* @author heqidu
* @since 2020/8/12
*/
public class PasswordStatusChangeListener implements View.OnClickListener {
private final EditText mPwdEditText;
public PasswordStatusChangeListener(EditText pwdEditText) {
this.mPwdEditText = pwdEditText;
}
@Override
public void onClick(View view) {
view.setSelected(!view.isSelected());
if (view.isSelected()) {
// 显示密码
mPwdEditText.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
} else {
// 隐藏密码
mPwdEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
// 最后把光标移动到末尾
Editable editable = mPwdEditText.getText();
Selection.setSelection(editable, editable.length());
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.