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 |
|---|---|---|---|---|---|---|
f2b9b272-b9da-45e8-b883-57e12c89cdce | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-10-29 10:41:58", "repo_name": "noveogroup/clap", "sub_path": "/clap-server/clap-server/clap-server-ui/src/main/java/com/noveogroup/clap/web/exception/ClapUserNotFoundExceptionHandlerDelegate.java", "file_name": "ClapUserNotFoundExceptionHandlerDelegate.java", "file_ext": "java", "file_size_in_byte": 1025, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "9de66511a39a6ebd86cd79e5de9b5ca8bd00089d", "star_events_count": 3, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/noveogroup/clap | 201 | FILENAME: ClapUserNotFoundExceptionHandlerDelegate.java | 0.247987 | package com.noveogroup.clap.web.exception;
import com.noveogroup.clap.exception.ClapUserNotFoundException;
import com.noveogroup.clap.web.util.message.MessageUtils;
import javax.enterprise.context.ApplicationScoped;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import java.io.IOException;
/**
* @author Andrey Sokolov
*/
@ApplicationScoped
public class ClapUserNotFoundExceptionHandlerDelegate implements ExceptionHandlerDelegate<ClapUserNotFoundException> {
@Override
public boolean handle(FacesContext context, ClapUserNotFoundException e) throws IOException {
final FacesMessage message = new FacesMessage();
message.setSeverity(FacesMessage.SEVERITY_ERROR);
message.setSummary(MessageUtils.getMessage(context, "error.userNotFound"));
context.addMessage(null, message);
return true;
}
@Override
public Class<ClapUserNotFoundException> getExceptionClass() {
return ClapUserNotFoundException.class;
}
}
|
c40df022-fb87-427c-a2eb-a2a830db9be6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-16 09:08:39", "repo_name": "GYiyouth/foolkey", "sub_path": "/src/main/java/foolkey/pojo/root/vo/dto/ApplicationStudentRewardDTO.java", "file_name": "ApplicationStudentRewardDTO.java", "file_ext": "java", "file_size_in_byte": 1095, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "4a13d03af6b50dc234af77f351759fbf611a7f46", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/GYiyouth/foolkey | 244 | FILENAME: ApplicationStudentRewardDTO.java | 0.247987 | package foolkey.pojo.root.vo.dto;
import org.springframework.stereotype.Component;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* 申请学生的悬赏
* Created by admin on 2017/4/24.
*/
@Component
@Entity
@Table(name = "t_application_student_reward")
public class ApplicationStudentRewardDTO extends ApplicationAbstract{
//学生(发布悬赏人)的id
@Column(name = "student_id")
private Long studentId;
//悬赏的id
@Column(name = "reward_id")
private Long rewardId;
@Override
public String toString() {
return "ApplicationStudentRewardDTO{" +
"studentId=" + studentId +
", orderId=" + rewardId +
"} " + super.toString();
}
public Long getStudentId() {
return studentId;
}
public void setStudentId(Long studentId) {
this.studentId = studentId;
}
public Long getRewardId() {
return rewardId;
}
public void setRewardId(Long rewardId) {
this.rewardId = rewardId;
}
}
|
eef7b3ec-30c6-40dd-bf72-82b4d1c4c896 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-19 15:06:59", "repo_name": "AmineTraibi/ApiFront-End", "sub_path": "/src/main/java/ma/ensa/entities/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 1121, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "973b9fba9c89e9a73c909bdc2f6f4543d25a2440", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AmineTraibi/ApiFront-End | 277 | FILENAME: User.java | 0.282196 | package ma.ensa.entities;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="user")
public class User {
@Id
private String EmailID;
private String Password;
private String Fname;
private String Lname;
public String getEmailID() {
return EmailID;
}
public void setEmailID(String emailID) {
EmailID = emailID;
}
public String getPassword() {
return Password;
}
public void setPassword(String password) {
Password = password;
}
public String getFname() {
return Fname;
}
public void setFname(String fname) {
Fname = fname;
}
public String getLname() {
return Lname;
}
public void setLname(String lname) {
Lname = lname;
}
public User(String emailID, String password, String fname, String lname) {
EmailID = emailID;
Password = password;
Fname = fname;
Lname = lname;
}
public User() {
}
@Override
public String toString() {
return "User [EmailID=" + EmailID + ", Password=" + Password + ", Fname=" + Fname + ", Lname=" + Lname + "]";
}
}
|
4180de38-2cbe-4595-afa8-59855cabd4e1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-12 09:58:48", "repo_name": "Manojkumarchow/reactappwithspringboot", "sub_path": "/Spring-with-React-JS/src/main/java/com/example/Spring/with/React/JS/SpringWithReactJsApplication.java", "file_name": "SpringWithReactJsApplication.java", "file_ext": "java", "file_size_in_byte": 992, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "a1f1902c468dac184baf414c4d5dcf414f0a18a4", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Manojkumarchow/reactappwithspringboot | 218 | FILENAME: SpringWithReactJsApplication.java | 0.262842 | package com.example.Spring.with.React.JS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.example.Spring.with.React.JS.model.User;
import com.example.Spring.with.React.JS.repository.UserRepository;
@SpringBootApplication
public class SpringWithReactJsApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(SpringWithReactJsApplication.class, args);
}
@Autowired
private UserRepository userRepository;
@Override
public void run(String... args) throws Exception {
this.userRepository.save(new User("Manoj", "React", "manoj@gmail.com", 1234567890));
this.userRepository.save(new User("Chandu", "Python", "chandu@gmail.com", 987654321));
this.userRepository.save(new User("Kiran", "Java", "kiran@gmail.com", 1234567890));
}
}
|
f91ca971-e027-48fa-9699-685633038850 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-04-15 17:18:20", "repo_name": "gennadyyonov/hello-okta", "sub_path": "/hello-okta-services/src/main/java/lv/gennadyyonov/hellookta/config/feign/ClientCredentialsInterceptor.java", "file_name": "ClientCredentialsInterceptor.java", "file_ext": "java", "file_size_in_byte": 1060, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "0878c3d0d3727d1523e3d87a0dcd78dc53c8a440", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gennadyyonov/hello-okta | 211 | FILENAME: ClientCredentialsInterceptor.java | 0.229535 | package lv.gennadyyonov.hellookta.config.feign;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lv.gennadyyonov.hellookta.dto.RunAsDetails;
import lv.gennadyyonov.hellookta.services.TokenService;
import static java.lang.String.format;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;
import static org.springframework.security.oauth2.core.OAuth2AccessToken.TokenType.BEARER;
public class ClientCredentialsInterceptor implements RequestInterceptor {
private final TokenService tokenService;
private final RunAsDetails runAsDetails;
public ClientCredentialsInterceptor(TokenService tokenService,
RunAsDetails runAsDetails) {
this.tokenService = tokenService;
this.runAsDetails = runAsDetails;
}
@Override
public void apply(RequestTemplate template) {
String accessToken = tokenService.getClientCredentialsAccessToken(runAsDetails);
template.header(AUTHORIZATION, format("%s %s", BEARER.getValue(), accessToken));
}
}
|
29da5151-e3e2-49e7-a5a8-83e6489be466 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-26 14:36:59", "repo_name": "dsmita/samples", "sub_path": "/src/main/java/com/debs/sample/DepthFirstSearch.java", "file_name": "DepthFirstSearch.java", "file_ext": "java", "file_size_in_byte": 1015, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "a978bcbd31a8a16bf716898aff2a8a8bfcb67335", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dsmita/samples | 243 | FILENAME: DepthFirstSearch.java | 0.26971 | package com.debs.sample;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Stack;
public class DepthFirstSearch {
public boolean solution(TreeNode node, TreeNode search){
if(node == null)
return false;
Set<Integer> visitedSet = new HashSet<Integer>();
Stack<TreeNode> stack = new Stack<TreeNode>();
if(node.data == search.data){
visitedSet.add(node.data);
return true;
}else{
stack.push(node);
if(stack!= null){
TreeNode nodeToBeRemoved = stack.pop();
if (nodeToBeRemoved != null) {
visitedSet.add(nodeToBeRemoved.data);
if (nodeToBeRemoved.data == search.data)
return true;
List<TreeNode> nodeList = nodeToBeRemoved.nodes;
if (nodeList != null) {
for (TreeNode nodeL : nodeList) {
if (!visitedSet.contains(nodeL.data)) {
stack.push(nodeL);
visitedSet.add(nodeL.data);
}
}
}
}
}
}
return false;
}
}
|
79865349-1aa0-462b-8634-78c2c0551134 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-21 23:34:14", "repo_name": "qiuchili/ggnn_graph_classification", "sub_path": "/program_data/JavaProgramData/24/842.java", "file_name": "842.java", "file_ext": "java", "file_size_in_byte": 1043, "line_count": 72, "lang": "en", "doc_type": "code", "blob_id": "71b4861f5b93a276ebf173b45a56149c3a747e3d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/qiuchili/ggnn_graph_classification | 354 | FILENAME: 842.java | 0.295027 | package <missing>;
public class GlobalMembers
{
public static int Main()
{
int max = 0;
int x = 0;
int min = 20;
int y = 0;
String string = new String(new char[4000]);
char[][] str = new char[40][20];
final String temp = "";
int k = 0;
int j = 0;
int i;
int n;
int m;
String = new Scanner(System.in).nextLine();
n = String.length();
for (i = 0;i < n;i++)
{
if (String[i] != ' ')
{
temp = tangible.StringFunctions.changeCharacter(temp, k, string.charAt(i));
str[j][k] = string.charAt(i);
k++;
}
else
{
str[j] = temp;
k = 0;
j++;
for (m = 0;m < 20;m++)
{
temp = temp.substring(0, m);
}
}
if (i == n - 1)
{
str[j] = temp;
for (m = 0;m < 20;m++)
{
temp = temp.substring(0, m);
}
}
}
for (i = 0;i <= j;i++)
{
if (String.valueOf(str[i]).length() > max)
{
max = String.valueOf(str[i]).length();
x = i;
}
if (String.valueOf(str[i]).length() < min)
{
min = String.valueOf(str[i]).length();
y = i;
}
}
System.out.printf("%s\n",str[x]);
System.out.printf("%s",str[y]);
return 0;
}
}
|
93da946f-8b9e-4ffe-9cca-83478be35c03 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-20 01:24:51", "repo_name": "AsTheStarsFall/MultiThread", "sub_path": "/src/main/java/com/tianhy/multithread/threadpool/FixedThreadPool.java", "file_name": "FixedThreadPool.java", "file_ext": "java", "file_size_in_byte": 1077, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "ed826b2535abc891b3e68f354eb919fe17669c18", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AsTheStarsFall/MultiThread | 223 | FILENAME: FixedThreadPool.java | 0.256832 | package com.tianhy.multithread.threadpool;
import java.util.concurrent.*;
import java.util.concurrent.ThreadPoolExecutor;
/**
* @Desc:
* @Author: thy
* @CreateTime: 2019/4/8
**/
public class FixedThreadPool implements Runnable{
static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(3);
ExecutorService cachedThreadPool = Executors.newCachedThreadPool();
ExecutorService service = Executors.newCachedThreadPool(new MyThreadFactory());
ExecutorService threadPoolExecutor = new ThreadPoolExecutor(0,
Integer.MAX_VALUE,60L,
TimeUnit.SECONDS,new SynchronousQueue<Runnable>());
@Override
public void run() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// System.out.println(Thread.currentThread().getName());
}
public static void main(String[] args) {
for (int i = 0; i < 100; i++) {
fixedThreadPool.execute(new FixedThreadPool());
}
fixedThreadPool.shutdown();
}
}
|
d9b26d20-8090-41eb-99aa-2d5621d8c54d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-23 11:51:37", "repo_name": "lcl100/BookManageSystem_javafx", "sub_path": "/src/BookManageSystem/beans/BookTypeBean.java", "file_name": "BookTypeBean.java", "file_ext": "java", "file_size_in_byte": 986, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "53fe9ffc958799c85d7b596eb7f0c69682b3bb51", "star_events_count": 7, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lcl100/BookManageSystem_javafx | 200 | FILENAME: BookTypeBean.java | 0.221351 | package BookManageSystem.beans;
public class BookTypeBean {
private int bookTypeId;
private String bookTypeName;
private String bookTypeDescription;
public BookTypeBean() {}
public BookTypeBean(int bookTypeId, String bookTypeName, String bookTypeDescription) {
this.bookTypeId = bookTypeId;
this.bookTypeName = bookTypeName;
this.bookTypeDescription = bookTypeDescription;
}
public int getBookTypeId() {
return bookTypeId;
}
public void setBookTypeId(int bookTypeId) {
this.bookTypeId = bookTypeId;
}
public String getBookTypeName() {
return bookTypeName;
}
public void setBookTypeName(String bookTypeName) {
this.bookTypeName = bookTypeName;
}
public String getBookTypeDescription() {
return bookTypeDescription;
}
public void setBookTypeDescription(String bookTypeDescription) {
this.bookTypeDescription = bookTypeDescription;
}
}
|
15568f6e-099d-4d20-b555-c59da9226def | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-08 07:29:42", "repo_name": "yujisuz/MyRepository", "sub_path": "/TestJava/com/cisco/jptac/vsec/http/JptacVsecHttpResponse.java", "file_name": "JptacVsecHttpResponse.java", "file_ext": "java", "file_size_in_byte": 1019, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "7b5fb26b8cdbeed7d0dfc808fd146781a9b7959b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yujisuz/MyRepository | 222 | FILENAME: JptacVsecHttpResponse.java | 0.250913 | package com.cisco.jptac.vsec.http;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class JptacVsecHttpResponse {
private final JptacVsecHttpStatus status;
private Map<String, String> headers = new HashMap<>();
private String body;
public HttpResponse(JptacVsecHttpStatus status) {
Objects.requireNonNull(status);
this.status = status;
}
public void addHeader(String string, Object value) {
this.headers.put(string, value.toString());
}
public void setBody(String body) {
this.body = body;
}
public void writeTo(OutputStream out) throws IOException {
IOUtil.println(out, "HTTP/1.1 " + this.status);
this.headers.forEach((key, value) -> {
IOUtil.println(out, key + ": " + value);
});
if (this.body != null) {
IOUtil.println(out, "");
IOUtil.print(out, this.body);
}
}
}
|
658bad99-d7cf-4fc2-8741-42fd9455703f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-03 14:45:32", "repo_name": "ahlemmhamdi/chahrazed_api", "sub_path": "/src/main/java/tn/alfacomputers/Controllers/ReservationController.java", "file_name": "ReservationController.java", "file_ext": "java", "file_size_in_byte": 1098, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "ce89f88a2ab189c293290bb101c0829b48a6012a", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/ahlemmhamdi/chahrazed_api | 196 | FILENAME: ReservationController.java | 0.268941 | package tn.alfacomputers.Controllers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import tn.alfacomputers.entities.Reservation;
import tn.alfacomputers.repositories.ReservationRepository;
@Controller
@RequestMapping("/api/v1/reservations")
public class ReservationController {
@Autowired
private ReservationRepository reservationRepository;
@PostMapping(path = "/addreservation")
public @ResponseBody
String addNewReservation(
@RequestBody Reservation reservation) {
Reservation r = new Reservation();
r.setArrivalDate(reservation.getArrivalDate());
r.setDepartureDate(reservation.getDepartureDate());
r.setTotal(reservation.getTotal());
reservationRepository.save(r);
return "Reservation Successfully added :)";
}
@GetMapping(path = "/getreservation")
public @ResponseBody
Iterable<Reservation> getAllReservations() {
return reservationRepository.findAll();
}
}
|
fd5c8016-537e-401b-acd4-35eb68bdbdc1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-09 08:10:33", "repo_name": "AgnitumuS/gitv", "sub_path": "/gitv-DeObfuscate/src/main/java/com/gala/video/app/player/pingback/PingbackReceiver.java", "file_name": "PingbackReceiver.java", "file_ext": "java", "file_size_in_byte": 1015, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "e1bc9795fc3700e5d9de64eda3f83b00ff065219", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AgnitumuS/gitv | 246 | FILENAME: PingbackReceiver.java | 0.29584 | package com.gala.video.app.player.pingback;
import com.gala.video.lib.framework.core.utils.LogUtils;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
public class PingbackReceiver {
private static final String TAG = "PingbackReceiver";
public void start() {
if (LogUtils.mIsDebug) {
LogUtils.m1568d(TAG, "start()");
}
EventBus.getDefault().register(this);
}
public void stop() {
if (LogUtils.mIsDebug) {
LogUtils.m1568d(TAG, "stop()");
}
EventBus.getDefault().unregister(this);
}
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onEvent(Pingback pingback) {
if (LogUtils.mIsDebug) {
LogUtils.m1568d(TAG, "onEvent class=" + pingback);
}
if (pingback.check()) {
pingback.send();
} else {
LogUtils.m1571e(TAG, "onEvent(" + pingback + ")");
}
}
}
|
06e6891a-238c-4f31-92df-3f3324c48691 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-05-04 08:29:30", "repo_name": "qiaoxun/spring-boot-study", "sub_path": "/cache-study/src/main/java/com/study/cache/controller/CacheController.java", "file_name": "CacheController.java", "file_ext": "java", "file_size_in_byte": 1120, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "0a88563ea1000bdbc73d19e8db85acdd588dac04", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/qiaoxun/spring-boot-study | 205 | FILENAME: CacheController.java | 0.26588 | package com.study.cache.controller;
import com.study.cache.domain.Booking;
import com.study.cache.service.BookingService;
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 java.util.List;
@RestController
@RequestMapping("/cache")
public class CacheController {
@Autowired
private BookingService bookingService;
@GetMapping("/listBookings/{id}")
public List<Booking> listBookings(@PathVariable Long id) {
return bookingService.listBookings1(id, "test");
}
@GetMapping("/getBookingById/{id}")
public Booking getBookingById(@PathVariable Long id) {
return bookingService.getBookingById(id);
}
@GetMapping("/updateBooking/{id}")
public Booking updateBooking(@PathVariable Long id, Double duration, String remark) {
return bookingService.updateBookingById(id, duration, remark);
}
}
|
8fd3d1f9-1fc6-4222-bcd2-a9f733b7c449 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-04-15 23:27:17", "repo_name": "brunobat/basic-testing-webapp", "sub_path": "/src/main/java/com/brunobat/service/repository/base/JPARepository.java", "file_name": "JPARepository.java", "file_ext": "java", "file_size_in_byte": 1077, "line_count": 53, "lang": "en", "doc_type": "code", "blob_id": "5449e423c615bdd3d523c677c1a89900f0935966", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/brunobat/basic-testing-webapp | 233 | FILENAME: JPARepository.java | 0.282988 | package com.brunobat.service.repository.base;
import com.brunobat.model.base.Identifiable;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.io.Serializable;
/**
* Created by Bruno Baptista on 09/04/15.
*/
public abstract class JPARepository <T extends Identifiable> implements Repository<T>, Serializable {
@PersistenceContext
private EntityManager manager;
private Class<T> type;
public JPARepository(Class<T> type) {
this.type = type;
}
@Override
public Class<T> getType() {
return type;
}
@Override
public T store(T entity) {
T merged = merge(entity);
manager.persist(merged);
return merged;
}
@Override
public T get(String id) {
return manager.find(type, id);
}
@Override
public void remove(T entity) {
manager.remove(merge(entity));
}
private T merge(T entity) {
return manager.merge(entity);
}
protected EntityManager getManager() {
return manager;
}
}
|
adddb1f3-7194-4953-a4f6-a1c176e44e3f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-20 13:40:05", "repo_name": "JonasMelin/twitter", "sub_path": "/src/main/java/com/twitterstuff/model/FollowerListDTO.java", "file_name": "FollowerListDTO.java", "file_ext": "java", "file_size_in_byte": 1118, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "c0b23681835551b492adceba1eb4150a986f5639", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JonasMelin/twitter | 226 | FILENAME: FollowerListDTO.java | 0.252384 | package com.twitterstuff.model;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import twitter4j.PagableResponseList;
import twitter4j.User;
import java.util.LinkedList;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
public class FollowerListDTO extends BaseResponseDTO {
public FollowerListDTO(String message, int httpStatus) {
super(message, httpStatus);
}
public FollowerListDTO(PagableResponseList<User> userList) {
super();
userList.stream().forEach(u -> followers.add(new UserData(u.getName(), u.getScreenName(), u.getId())));
}
@NonNull
private List<UserData> followers = new LinkedList<>();
@Data
@AllArgsConstructor
public static class UserData {
@ApiModelProperty(example = "Financial Times")
private String userName;
@ApiModelProperty(example = "@financialtimes")
private String screenName;
@ApiModelProperty(example = "1252488423")
private Long userId;
}
}
|
28ce98c5-d17d-4640-80c6-c0db195c4efc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-05-28 22:25:25", "repo_name": "kopinski/pobiegne", "sub_path": "/tracker/tracker-components/src/main/java/pl/pobiegne/mobile/widget/GroupItem.java", "file_name": "GroupItem.java", "file_ext": "java", "file_size_in_byte": 1010, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "140b6c8f49a44bf3334dfed22140b3ad112f0709", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kopinski/pobiegne | 184 | FILENAME: GroupItem.java | 0.282988 | package pl.pobiegne.mobile.widget;
import java.text.NumberFormat;
import java.util.Locale;
import pl.pobiegne.mobile.common.api.db.Route;
import android.content.Context;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.googlecode.androidannotations.annotations.EViewGroup;
import com.googlecode.androidannotations.annotations.ViewById;
@EViewGroup(resName = "group_item")
public class GroupItem extends LinearLayout {
@ViewById(resName = "comp_group_name")
protected TextView name;
@ViewById(resName = "comp_group_label")
protected TextView rightLabel;
private NumberFormat numberFormat;
public GroupItem(Context context) {
super(context);
numberFormat = NumberFormat.getIntegerInstance(Locale.getDefault());
}
public void bind(final Route data) {
name.setText(data.getName());
rightLabel.setText(numberFormat.format(data.getCalories()));
}
} |
67399e01-3b17-46af-bc51-720d4fbb6068 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-10-14T10:21:52", "repo_name": "vsidera/PhotoAlbum", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1043, "line_count": 29, "lang": "en", "doc_type": "text", "blob_id": "ac0399f990316eb3b538c3ea3dd23d9c7e56f9d8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/vsidera/PhotoAlbum | 263 | FILENAME: README.md | 0.245085 | # PhotoAlbum
#### A personal gallery application.
#### By **victor siderra**
## Description
This is an application that allows to me to display my photos for others to see.
## Setup/Installation Requirements
* On your terminal, clone this repo using git
* $ git clone https://github.com/vsidera/PhotoAlbum.git
* $ source venv/bin/activate
* (virtual)$ pip install -r requirements.txt
* (virtual)$ python3.8 manage.py runserver
## Technologies used
* Django
* HTML5
* Bootstrap3
## BDD
* As a user, I would like to view different photos that interest me.
* As a user, I would like to click on a single photo to expand it and also view the details of the photo.
* As a user, I would like to search for different categories of photos.
* As a user, I would like to view photos based on the location they were taken.
## Support and contact details
* Email: siderravictor@gmail.com
* Twitter: @vicksiderra
### License
*Distributed under the MIT License. See LICENSE for more information on license and copyright.*
Copyright (c) {2020} **vsidera** |
1418eb7f-f313-4e5f-9b55-3d961199648c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-18 14:13:49", "repo_name": "juanleirojl/backendDevTest", "sub_path": "/src/main/java/com/test/product/config/FeignClientErrorDecoder.java", "file_name": "FeignClientErrorDecoder.java", "file_ext": "java", "file_size_in_byte": 1008, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "5faf9daa910d9a01314474ed1725f28d4ca13e7b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/juanleirojl/backendDevTest | 183 | FILENAME: FeignClientErrorDecoder.java | 0.264358 | package com.test.product.config;
import org.springframework.http.HttpStatus;
import com.test.product.exceptions.ClientErrorException;
import feign.Response;
import feign.RetryableException;
import feign.codec.ErrorDecoder;
public class FeignClientErrorDecoder implements ErrorDecoder {
private final ErrorDecoder defaultErrorDecoder = new Default();
@Override
public Exception decode(String methodKey, Response response) {
Exception exception = defaultErrorDecoder.decode(methodKey, response);
if(exception instanceof RetryableException){
return exception;
}
if (HttpStatus.valueOf(response.status()).is5xxServerError()){
return new RetryableException(response.status(), response.reason(), response.request().httpMethod(), null, response.request());
} else {
return new ClientErrorException("Client Error Status: " + response.status() + " Reason: "+ response.reason()+ " URL:" + response.request().url());
}
}
}
|
9f5530a6-15b5-49b6-a318-0fc2e8561c38 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-07-19 13:12:37", "repo_name": "compomics/compomics-crowd", "sub_path": "/compomics-crowd-pladiquest/src/main/java/com/compomics/compomicscrowd/pladiquest/model/action/ActionTerm.java", "file_name": "ActionTerm.java", "file_ext": "java", "file_size_in_byte": 1021, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "5353fc8528b4bd2b3f8c62af9eea9e7dbd56cb3f", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/compomics/compomics-crowd | 261 | FILENAME: ActionTerm.java | 0.259826 | package com.compomics.compomicscrowd.pladiquest.model.action;
import java.util.ArrayList;
/**
*
* @author Kenneth Verheggen <kenneth.verheggen@gmail.com>
*/
public enum ActionTerm {
ATTACK("attack", "punch", "kick", "stab", "assault", "lunge"),
LOOT("take", "pick up", "loot", "obtain", "retrieve"),
DROP("drop", "let go", "discard", "remove"),
PUT("put", "load", "combine"),
ACTIVATE("use","turn on", "switch on", "activate"),
OPEN("open", "unlock"),
READ("read", "inspect", "look at"),
VICTORY("open exit", "escape", "do a little dance");
private final ArrayList<String> synonyms = new ArrayList<>();
private ActionTerm(String... synonyms) {
for (String aSynonym : synonyms) {
this.synonyms.add(aSynonym);
}
}
public String getPrefix(String term) {
for (String aSynonym : synonyms) {
if (term.toLowerCase().startsWith(aSynonym)) {
return aSynonym;
}
}
return "";
}
}
|
8a0d1caa-29bf-4c26-85be-7e9e1e9fc365 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-29 21:17:23", "repo_name": "farnulfo/unleash-web-client", "sub_path": "/src/main/java/net/arnulfo/InitServletListener.java", "file_name": "InitServletListener.java", "file_ext": "java", "file_size_in_byte": 1045, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "9589c5f75132f60522e37eafa42459b05a8bb265", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/farnulfo/unleash-web-client | 241 | FILENAME: InitServletListener.java | 0.245085 | package net.arnulfo;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import no.finn.unleash.Unleash;
import no.finn.unleash.DefaultUnleash;
import no.finn.unleash.util.UnleashConfig;
/**
* Web application lifecycle listener.
*
* @author Franck
*/
@WebListener
public class InitServletListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent event) {
UnleashConfig config = UnleashConfig.builder()
.appName("java-test")
.instanceId("instance x")
.unleashAPI("https://unleash-cat.herokuapp.com/api/")
.build();
Unleash unleash = new DefaultUnleash(config);
event.getServletContext().setAttribute("unleash", unleash);
}
@Override
public void contextDestroyed(ServletContextEvent event) {
Unleash unleash = (Unleash) event.getServletContext().getAttribute("unleash");
if (unleash != null) {
unleash.shutdown();
}
}
}
|
be2f4ed4-391f-47a7-ab5f-4b59a04f98d7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-07 19:25:57", "repo_name": "AviAvin/ArrayJavaScript", "sub_path": "/Avinash2/src/webdriver/Windowhandle3.java", "file_name": "Windowhandle3.java", "file_ext": "java", "file_size_in_byte": 1096, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "1bcb9d8952a031005b8ee0a07186fb5f46fbee31", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AviAvin/ArrayJavaScript | 224 | FILENAME: Windowhandle3.java | 0.26971 | package webdriver;
import java.util.Set;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Windowhandle3 {
public static void main(String args[])
{
WebDriver driver=new FirefoxDriver();
driver.get("https://online.citibank.com");
String myWindowHandle = driver.getWindowHandle();
driver.findElement(By.xpath(".//*[@id='facebookSprite']")).click();
// sleep for a bit
try {
Thread.sleep(3000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Returns a set of 1 in IE 8 returns a set of 2 in IE 7
Set<String> handles = driver.getWindowHandles() ;
for(String winHandle : driver.getWindowHandles()){
if(myWindowHandle.equalsIgnoreCase(winHandle))
continue;
driver.switchTo().window(winHandle);
String shipperURL = driver.getCurrentUrl();
driver.close();
}
driver.switchTo().window(myWindowHandle);
}
}
|
6f1eb3ee-9b80-4240-9f2d-c415edd41f70 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-20 11:33:45", "repo_name": "JoseManuelBravoDAW/Examen-Mayo-2018", "sub_path": "/productosGUI/Ficheros.java", "file_name": "Ficheros.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 53, "lang": "en", "doc_type": "code", "blob_id": "3bf7e1e58e74f4bd826c04ae064902f17851b64a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JoseManuelBravoDAW/Examen-Mayo-2018 | 227 | FILENAME: Ficheros.java | 0.255344 | package exJoseManuelBravoMartinez.productosGUI;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
public class Ficheros {
static File firma = new File("JoseManuelBravo.txt");
public static void escribir(String s) throws IOException {
try (PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(firma, true)))) {
writer.println(s);
}
}
public static String leer() throws FileNotFoundException, IOException {
try (BufferedReader reader = new BufferedReader(new FileReader(firma))) {
String contenido = "";
String temp;
do {
temp = reader.readLine();
if(temp != null)
contenido += temp + "\n";
} while (temp != null);
return contenido;
}
}
public static void borrar() throws IOException {
try (PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(firma)))) {
writer.print("");
}
}
}
|
47d3e529-6f94-4116-9169-1d2ef3f7528c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2022-04-15T11:07:37", "repo_name": "int3/vim-extradite", "sub_path": "/README.markdown", "file_name": "README.markdown", "file_ext": "markdown", "file_size_in_byte": 1054, "line_count": 31, "lang": "en", "doc_type": "text", "blob_id": "a5571fd337857e0b75ccd05e0a45c4aee51a0d51", "star_events_count": 185, "fork_events_count": 22, "src_encoding": "UTF-8"} | https://github.com/int3/vim-extradite | 268 | FILENAME: README.markdown | 0.224055 | extradite.vim
=============
A git commit browser / git log wrapper that extends fugitive.vim.
`:Extradite` toggles the Extradite buffer, i.e. the commit browser. By
default, it opens in the current window. Adding |!| makes it open in a vertical
split instead.
The width of the split is set with `g:extradite_width`, but can be deactivated
with `g:extradite_resize`
Note: `:Extradite` only runs if the current file is under git version control!
Once we are in the Extradite buffer, the following keymaps are available:
`<CR>` edits the revision on the current line in a fugitive-buffer.
`oh`, `ov`, and `ot` edit the revision under the cursor in a new horizontal
split / vertical split / tab respectively.
`dh`, `dv`, and `dt` diff the current file against the revision under the
cursor in a new horizontal split / vertical split / tab respectively.
`t` toggles the visibility of the file diff buffer.
`q` closes the Extradite buffer.
This plugin can also be obtained from [vim.org][1].
[1]:http://www.vim.org/scripts/script.php?script_id=3509
|
ab86e27e-8ea2-4141-8f26-57089f547520 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-13 06:45:49", "repo_name": "admodule/Admodule", "sub_path": "/admodule/src/main/java/com/admodule/ConnectionDetector.java", "file_name": "ConnectionDetector.java", "file_ext": "java", "file_size_in_byte": 1073, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "8239f3455aa7d15df4a65fdf7a96f3f6b8289341", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/admodule/Admodule | 191 | FILENAME: ConnectionDetector.java | 0.27048 | package com.admodule;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
public class ConnectionDetector {
private Context _context;
ConnectionDetector(Context context) {
this._context = context;
}
/**
* Checking for all possible internet providers
**/
public boolean isConnectingToInternet() {
try {
ConnectivityManager connectivity = (ConnectivityManager) _context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity != null) {
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null)
for (NetworkInfo anInfo : info)
if (anInfo.getState() == NetworkInfo.State.CONNECTED) {
Log.d("Network", "NETWORKnAME: " + anInfo.getTypeName());
return true;
}
}
} catch (Exception e) {
}
return false;
}
} |
2ddbb99f-5104-43cc-bf69-227323740dfe | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-07-09 15:19:05", "repo_name": "jpollo/rcrss", "sub_path": "/team_src/MRL/src/mrl/common/BenchMark/messaging/MessageLogProperty.java", "file_name": "MessageLogProperty.java", "file_ext": "java", "file_size_in_byte": 1120, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "0dbb5b52b6a7fd0a25da89222d3022535b124703", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jpollo/rcrss | 236 | FILENAME: MessageLogProperty.java | 0.255344 | package mrl.common.BenchMark.messaging;
import mrl.mosCommunication.message.property.SendType;
import mrl.mosCommunication.message.type.AbstractMessage;
import rescuecore2.worldmodel.EntityID;
/**
* @author Mahdi
*/
public class MessageLogProperty {
private AbstractMessage message;
private EntityID sender;
private SendType sendType;
private TransmitType transmitType;
private int time;
public MessageLogProperty(AbstractMessage message, int time, SendType sendType, TransmitType transmitType) {
this.time = time;
this.message = message;
this.sender = message.getSender();
this.sendType = sendType;
this.transmitType = transmitType;
}
public AbstractMessage getMessage() {
return message;
}
public EntityID getSender() {
return sender;
}
public SendType getSendType() {
return sendType;
}
public TransmitType getTransmitType() {
return transmitType;
}
public int getTime() {
return time;
}
public void setTime(int time) {
this.time = time;
}
}
|
166ea23b-1f7d-4b27-97fd-384bb7301ad8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-17 04:39:00", "repo_name": "paulhoadley/Adventure", "sub_path": "/src/main/java/com/hahogames/adventure/Place.java", "file_name": "Place.java", "file_ext": "java", "file_size_in_byte": 1032, "line_count": 60, "lang": "en", "doc_type": "code", "blob_id": "505f51467d0e6d8c141acbe4c8c6c7afb3297674", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/paulhoadley/Adventure | 267 | FILENAME: Place.java | 0.276691 | package com.hahogames.adventure;
import java.util.ArrayList;
import java.util.List;
/**
* Represents a location in the game.
*
* @author paulh
*/
public class Place {
/**
* This location's text description
*/
public final String description;
/**
* List of {@link Path}s from this {@code Place}
*/
public List<Path> paths = new ArrayList<>();
/**
* List of {@link Item}s in this {@code Place}
*/
public List<Item> items = new ArrayList<>();
/**
* Constructor
*
* @param description
* text description of this {@code Place}
*/
public Place(String description) {
this.description = description;
return;
}
/**
* Adds an outgoing {@link Path} for this {@code Place}.
*
* @param path
* a {@link Path}
*/
public void addOutgoingPath(Path path) {
paths.add(path);
return;
}
/**
* Adds an {@link Item} to this {@code Place}.
*
* @param item
* an {@link Item}
*/
public void addItem(Item item) {
items.add(item);
return;
}
}
|
1f4be317-e252-49bd-b32d-a5ce9de9048e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-04-22 14:55:51", "repo_name": "mdiazrollup/remindmewhere", "sub_path": "/app/src/main/java/com/example/maria/remindmewhere/adapter/LocationAdapter.java", "file_name": "LocationAdapter.java", "file_ext": "java", "file_size_in_byte": 1121, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "d98ea0ddb1915ce6524f0e36de7607fad857bd34", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mdiazrollup/remindmewhere | 215 | FILENAME: LocationAdapter.java | 0.274351 | package com.example.maria.remindmewhere.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.example.maria.remindmewhere.R;
import com.example.maria.remindmewhere.model.Location;
import java.util.ArrayList;
/**
* Created by maria on 4/2/17.
*/
public class LocationAdapter extends ArrayAdapter<Location> {
public LocationAdapter(Context context, ArrayList<Location> locations) {
super(context, 0, locations);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Location location = getItem(position);
if(convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_view_loc_row, parent, false);
}
TextView locName = (TextView) convertView.findViewById(R.id.ha_locations_list_item);
locName.setText(location.getName());
// Return the completed view to render on screen
return convertView;
}
}
|
56cba76c-b980-465c-94f4-2b26460e16e6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-12 13:56:47", "repo_name": "laratrindade/GenerationClash", "sub_path": "/GenerationClash/app/src/main/java/com/example/myapplication/SelectTheme.java", "file_name": "SelectTheme.java", "file_ext": "java", "file_size_in_byte": 1081, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "62a884d3043e0ed1d501cb0de79fa3261e1e252a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/laratrindade/GenerationClash | 189 | FILENAME: SelectTheme.java | 0.17441 | package com.example.myapplication;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class SelectTheme extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_theme);
getSupportActionBar().hide();
}
public void PalavrasOnClick(View v){
Intent intent = new Intent(this, PerguntaActivity.class);
startActivity(intent);
}
public void ImagesOnClick(View v){
Intent intent = new Intent(this, PerguntaImagemActivity.class);
startActivity(intent);
}
public void DesportoOnClick(View v){
Intent intent = new Intent(this, PerguntaDesportoActivity.class);
startActivity(intent);
}
public void ProverbiosOnClick(View v){
Intent intent = new Intent(this, PerguntaProverbioActivity.class);
startActivity(intent);
}
}
|
52b1de12-d434-466d-81b4-b09a43141f14 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-09-13 15:16:19", "repo_name": "yasseribrahim/magles", "sub_path": "/app/src/main/java/com/azhar/university/magles/MaglesApplication.java", "file_name": "MaglesApplication.java", "file_ext": "java", "file_size_in_byte": 1039, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "dfadda2bdbd160f3844f000ef91528a944743c1a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yasseribrahim/magles | 206 | FILENAME: MaglesApplication.java | 0.271252 | package com.azhar.university.magles;
import android.app.Application;
import com.azhar.university.magles.domain.modules.ApiModule;
import com.azhar.university.magles.domain.modules.ApplicationModule;
import com.azhar.university.magles.domain.modules.PreferencesModule;
import java.io.File;
/**
* Created by Yasser.Ibrahim on 6/12/2018.
*/
public class MaglesApplication extends Application {
private static ApplicationComponent component;
private static Application application;
public static Application getApplication() {
return application;
}
public static ApplicationComponent getComponent() {
return component;
}
@Override
public void onCreate() {
super.onCreate();
application = this;
buildDagger();
}
public void buildDagger() {
component = DaggerApplicationComponent.
builder().
apiModule(new ApiModule(new File(getCacheDir(), "responses"), this, BuildConfig.HOST)).
build();
}
} |
4bc6215e-4416-4f28-a962-1f2965749ed6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-04-12 17:14:11", "repo_name": "baufest-cp-java/play-cm", "sub_path": "/bfcm/app/models/ContributionType.java", "file_name": "ContributionType.java", "file_ext": "java", "file_size_in_byte": 1032, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "98fa2c4a7e595d6df0385f659217cb445682cf3a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/baufest-cp-java/play-cm | 253 | FILENAME: ContributionType.java | 0.286968 | package models;
import javax.persistence.Entity;
import javax.persistence.Id;
import play.data.validation.Constraints.MaxLength;
import play.data.validation.Constraints.Required;
import play.db.ebean.Model;
@Entity
public class ContributionType extends Model {
private static final long serialVersionUID = 7965172086105278922L;
@Id
private Long id;
@Required @MaxLength(10)
private String code;
@Required @MaxLength(100)
private String name;
private Long score;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Long getScore() {
return score;
}
public void setScore(Long score) {
this.score = score;
}
public static Finder<Long, ContributionType> find() {
return new Finder<Long, ContributionType>(Long.class, ContributionType.class);
}
}
|
7985c643-42cc-4a0b-a194-3f6de5673298 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-02-21T22:54:43", "repo_name": "Overland-TSA/SoftwareDev2015", "sub_path": "/OverlandApp/src/org/overland_tsa/overlandapp/WebViewActivity.java", "file_name": "WebViewActivity.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "de9addde23cf626c275f1bbe548d7b67369709d2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Overland-TSA/SoftwareDev2015 | 216 | FILENAME: WebViewActivity.java | 0.26588 | package org.overland_tsa.overlandapp;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
public class WebViewActivity extends Activity {
private String pageLocation;
public static final String WEBPAGE_URL = "org.overland_tsa.overlandapp.webview_url";
// constructor that didn't wanna work
public WebViewActivity() {
super();
this.pageLocation = getIntent().getStringExtra(WebViewActivity.WEBPAGE_URL);
}
public WebViewActivity( String page ) {
super();
this.pageLocation = page;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Display the general WebView layout
setContentView( R.layout.activity_webview );
// choose the page to show
WebView myWebView = (WebView) findViewById(R.id.webview_frame);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
myWebView.loadUrl( this.pageLocation );
}
}
|
f02aa9f5-be91-47f4-9df4-6c437361f830 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-05 03:18:51", "repo_name": "DylanDaiNguyen/InternetBanking_Blockchain_Citynow", "sub_path": "/transaction-wallet-project/transaction-wallet-service-impl/src/main/java/transaction/wallet/service/impl/UserServiceImpl.java", "file_name": "UserServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1053, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "f542e965caf17907c38451b6d7479f9b2e92fb94", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DylanDaiNguyen/InternetBanking_Blockchain_Citynow | 195 | FILENAME: UserServiceImpl.java | 0.272799 | package transaction.wallet.service.impl;
import transaction.wallet.core.dao.UserDao;
import transaction.wallet.core.dao.impl.UserDaoImpl;
import transaction.wallet.dto.UserDTO;
import transaction.wallet.persistence.data.UserEntity;
import transaction.wallet.service.UserService;
import transaction.wallet.utils.UserBeanUtil;
public class UserServiceImpl implements UserService {
public UserDTO isUserExist(UserDTO dto) {
UserDao userDao = new UserDaoImpl();
UserEntity entity = userDao.findUserByUsernameAndPassword(dto.getUsername(), dto.getPassword());
return UserBeanUtil.entity2Dto(entity);
}
public void insertUser(UserDTO dto) {
UserDao userDao = new UserDaoImpl();
userDao.insertUser(dto.getUsername(),dto.getPassword(),dto.getName(),dto.getEmail(),dto.getPhone());
}
public UserDTO findIdByUser(UserDTO dto) {
UserDao userDao = new UserDaoImpl();
UserEntity entity = userDao.findIdByUser(dto.getUsername());
return UserBeanUtil.entity2Dto(entity);
}
}
|
95f9989d-6628-4da0-811b-c5d8d23613d4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-11 09:25:58", "repo_name": "Akram-Mansour/Stortoget", "sub_path": "/src/main/java/com/example/stortorget/service/SalesAdService.java", "file_name": "SalesAdService.java", "file_ext": "java", "file_size_in_byte": 1060, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "f737b687ae60bfe10fa8208174604c7c734eec6c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Akram-Mansour/Stortoget | 206 | FILENAME: SalesAdService.java | 0.289372 | package com.example.stortorget.service;
import com.example.stortorget.entity.SalesAd;
import com.example.stortorget.repository.SalesAdRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class SalesAdService {
@Autowired
private SalesAdRepository salesAdRepository;
public List<SalesAd> getAllAds(){
return salesAdRepository.findAllByOrderByIdDesc();
}
public void saveSalesAd(SalesAd salesAd){
salesAdRepository.save(salesAd);
}
public List<SalesAd> searchAd(String search, String category) {
if(category.equals("all")){
return salesAdRepository.findByItemContainingOrDescriptionContaining(search, search);
}
else{
return salesAdRepository.findByItemContainingAndCategoryOrDescriptionContainingAndCategory(search, category, search, category);
}
}
public void deleteAd(long id){
salesAdRepository.deleteById(id);
}
}
|
fd35eb30-d3eb-4df2-942d-914cab7c5d94 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-31 17:51:27", "repo_name": "MatheussAlves/Projeto-java-FJ26", "sub_path": "/src/br/com/caelum/notasfiscais/util/NomeJaExistenteValidator.java", "file_name": "NomeJaExistenteValidator.java", "file_ext": "java", "file_size_in_byte": 1083, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "dde59b50c62a54afca8005714dba699570c77f57", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "MacCentralEurope"} | https://github.com/MatheussAlves/Projeto-java-FJ26 | 223 | FILENAME: NomeJaExistenteValidator.java | 0.27513 | package br.com.caelum.notasfiscais.util;
import java.io.Serializable;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.FacesValidator;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@FacesValidator("nomeJaExistente")
public class NomeJaExistenteValidator implements Validator, Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
@Inject
private EntityManager manager;
@Override
public void validate(FacesContext context,
UIComponent component, Object value) throws ValidatorException {
Query q = manager.createQuery
("Select Count(u) from Usuario u where u.login like :login");
q.setParameter("login",String.valueOf(value));
Long count = (Long) q.getSingleResult();
if(count !=0 ){
throw new ValidatorException(new FacesMessage("Nome de login jŠ existente"));
}
}
}
|
1e7b37f7-e6b8-4f9b-b208-d2a0997697cf | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-12 23:47:20", "repo_name": "JonathanZ-24/CADaphracti", "sub_path": "/CADaphracti-main/CADaphracti/src/main/java/frc/robot/auton/AutonChassis.java", "file_name": "AutonChassis.java", "file_ext": "java", "file_size_in_byte": 965, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "fecdc7323eadc9717383ebfb068d4e0a16cf6ca3", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JonathanZ-24/CADaphracti | 223 | FILENAME: AutonChassis.java | 0.268941 | package frc.robot.auton;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.RobotContainer;
import frc.robot.subsystems.Chassis;
public class AutonChassis extends CommandBase {
private double driveSpeed;
private double rotationSpeed;
private double time;
private Chassis mChassis;
Timer mTimer;
public AutonChassis(double speed, double rotate, double amtTime, Chassis chassis) {
mChassis = chassis;
addRequirements(mChassis);
mTimer = new Timer();
driveSpeed = speed;
rotationSpeed = rotate;
time = amtTime;
}
@Override
public void initialize() {
mTimer.reset();
mTimer.start();
}
@Override
public void execute() {
RobotContainer.m_Chassis.runJoystick(driveSpeed, rotationSpeed);
}
@Override
public boolean isFinished() {
return (mTimer.get() >= time);
}
} |
2cea7f6f-4505-48fe-ac1c-fcc1b532eeea | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-06 16:53:31", "repo_name": "2829354693/eShop", "sub_path": "/src/main/java/com/yc/eshop/common/util/UUIDUtils.java", "file_name": "UUIDUtils.java", "file_ext": "java", "file_size_in_byte": 1046, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "902a5f46ff0aab2e621d9d8497efb598888717be", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/2829354693/eShop | 262 | FILENAME: UUIDUtils.java | 0.256832 | package com.yc.eshop.common.util;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
/**
* @author 余聪
* @date 2020/12/4
*/
public class UUIDUtils {
/**
* 32位默认长度的uuid
* (获取32位uuid)
*
* @return
*/
public static String getUUID() {
return UUID.randomUUID().toString().replace("-", "");
}
/**
* (获取指定长度uuid)
*
* @return
*/
public static String getUUID(int len) {
if (0 >= len) {
return null;
}
String uuid = getUUID();
System.out.println(uuid);
StringBuilder str = new StringBuilder();
for (int i = 0; i < len; i++) {
str.append(uuid.charAt(i));
}
return str.toString();
}
/**
* 生成订单号id
*/
public static String getOrderId() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
return sdf.format(new Date()) + ((int)(Math.random() * 9000) + 1000);
}
}
|
6b40248d-b4c3-41d9-8891-de88ec9a0720 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-05 18:42:03", "repo_name": "Aman1kr/Road-Safety-", "sub_path": "/main/java/com/example/student/isafe/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "a77aba165fe6e7626f9d2009fe09ce0b40f44c72", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Aman1kr/Road-Safety- | 192 | FILENAME: MainActivity.java | 0.259826 | package com.example.student.isafe;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import java.util.Timer;
import java.util.TimerTask;
import android.annotation.SuppressLint;
import android.graphics.drawable.AnimationDrawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.constraint.ConstraintLayout;
import android.content.Intent;
public class MainActivity extends AppCompatActivity {
Timer timer;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
timer = new Timer();
timer.schedule(new TimerTask(){
@Override
public void run() {
Intent intent=new Intent(MainActivity.this, Activity1.class);
startActivity(intent);
finish();
}
}, 3000);
}
}
/*public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}*/
|
649e88e2-9241-483c-b0a5-e3dcba505427 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-16 06:13:22", "repo_name": "wdply/socket", "sub_path": "/MyServerSocket/src/ChatSocket.java", "file_name": "ChatSocket.java", "file_ext": "java", "file_size_in_byte": 1175, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "541335d13e1c2702bd6c8aecc0f0abfce339b3e6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wdply/socket | 234 | FILENAME: ChatSocket.java | 0.262842 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
/**
* 收到客户端发来的socket,进行处理
* Created by ply on 2017/1/9.
*/
public class ChatSocket extends Thread {
private Socket socket;
public ChatSocket(Socket s) {
this.socket = s;
}
@Override
public void run() {
try {
//读取客户端发来的消息,并群发消息
BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(socket.getInputStream(),"UTF-8"));
String line=null;
while ((line=bufferedReader.readLine())!=null){
System.out.println("服务器收到消息: "+line);
SocketManager.getInstance().publish(this,line);//群发消息
}
bufferedReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 消息发送
* @param out
*/
public void out(String out) {
try {
socket.getOutputStream().write(out.getBytes());
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
775802c1-730a-4ede-a991-7ae0c828b791 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-12-18 08:31:11", "repo_name": "LukaszLyskawa/Android-Twitch-Notifier", "sub_path": "/app/src/main/java/com/example/lukasz/myapplication/TwitchApiJson/FollowsStreams.java", "file_name": "FollowsStreams.java", "file_ext": "java", "file_size_in_byte": 1121, "line_count": 59, "lang": "en", "doc_type": "code", "blob_id": "fcb4a9b77898a566866d296253f6eb3323173757", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/LukaszLyskawa/Android-Twitch-Notifier | 249 | FILENAME: FollowsStreams.java | 0.206894 | package com.example.lukasz.myapplication.TwitchApiJson;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Created by lukasz on 14.12.15.
*/
public class FollowsStreams {
public FollowsChannel getChannel() {
return channel;
}
public void setChannel(FollowsChannel channel) {
this.channel = channel;
}
@SerializedName("channel")
@Expose
private FollowsChannel channel;
public FollowsPreview getPreview() {
return preview;
}
public void setPreview(FollowsPreview preview) {
this.preview = preview;
}
@SerializedName("preview")
@Expose
private FollowsPreview preview;
public int getViewers() {
return viewers;
}
public void setViewers(int viewers) {
this.viewers = viewers;
}
@SerializedName("viewers")
@Expose
private int viewers;
public String getGame() {
return game;
}
public void setGame(String game) {
this.game = game;
}
@SerializedName("game")
@Expose
private String game;
}
|
36889ee5-bad2-4d6f-90a2-53d14cf0952b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-09 07:00:06", "repo_name": "liupanfeng/YangQuanClien", "sub_path": "/app/src/main/java/com/meishe/yangquan/fragment/SlideFragment.java", "file_name": "SlideFragment.java", "file_ext": "java", "file_size_in_byte": 1250, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "3dfe41cf6735d80db91c2d82b5d5d1d6e67efb90", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/liupanfeng/YangQuanClien | 255 | FILENAME: SlideFragment.java | 0.233706 | package com.meishe.yangquan.fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
/**
*
* @Author : LiuPanFeng
* @CreateDate : 2021/4/20 18:37
* @Description : 这个是引导页面专用
*/
public class SlideFragment extends Fragment {
private static final String ARG_LAYOUT_RES_ID = "layoutResId";
public static SlideFragment newInstance(int layoutResId) {
SlideFragment slideFragment = new SlideFragment();
Bundle args = new Bundle();
args.putInt(ARG_LAYOUT_RES_ID, layoutResId);
slideFragment.setArguments(args);
return slideFragment;
}
private int layoutResId;
public SlideFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null && getArguments().containsKey(ARG_LAYOUT_RES_ID))
layoutResId = getArguments().getInt(ARG_LAYOUT_RES_ID);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(layoutResId, container, false);
}
}
|
d332a572-65af-465a-a169-b7a1b1bb42a6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-06-23 18:04:54", "repo_name": "Rulexec/yasly-java", "sub_path": "/src/main/java/by/muna/network/tcp/TCPServer.java", "file_name": "TCPServer.java", "file_ext": "java", "file_size_in_byte": 1120, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "4afdb3570760ddcfbb1a1907d7acb9cdc3ad0dea", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Rulexec/yasly-java | 224 | FILENAME: TCPServer.java | 0.250913 | package by.muna.network.tcp;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.channels.ServerSocketChannel;
public class TCPServer implements ITCPServer {
public ServerSocketChannel serverChannel;
private ITCPServerListener listener;
public TCPServer(SocketAddress local) throws IOException {
this.serverChannel = ServerSocketChannel.open();
this.serverChannel.configureBlocking(false);
this.serverChannel.bind(local);
}
@Override
public void setListener(ITCPServerListener listener) {
this.listener = listener;
}
@Override
public int getPort() {
try {
return ((InetSocketAddress) this.serverChannel.getLocalAddress()).getPort();
} catch (IOException ex) {
return 0;
}
}
@Override
public void stop() {
throw new RuntimeException("Not implemented yet.");
}
void onConnected(TCPSocket socket) {
this.listener.onConnected(socket);
}
void onStop() {
throw new RuntimeException();
}
}
|
2eaeff14-81d3-46e7-81ab-75dbba2ea84d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-17 12:18:28", "repo_name": "rarebreed/reporter", "sub_path": "/src/main/java/com/github/redhatqe/polarizer/reporter/jaxb/JAXBHelper.java", "file_name": "JAXBHelper.java", "file_ext": "java", "file_size_in_byte": 1028, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "98e48f0c766fa1016ff2812e5732ec4e09311b55", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/rarebreed/reporter | 242 | FILENAME: JAXBHelper.java | 0.259826 | package com.github.redhatqe.polarizer.reporter.jaxb;
import com.github.redhatqe.polarizer.reporter.importer.testcase.Testcase;
import com.github.redhatqe.polarizer.reporter.importer.testcase.Testcases;
import com.github.redhatqe.polarizer.reporter.importer.xunit.Testsuites;
import java.net.URL;
public class JAXBHelper implements IJAXBHelper {
public URL getXSDFromResource(Class<?> t) {
URL xsd;
if (t == Testcase.class) {
xsd = JAXBHelper.class.getClassLoader().getResource("testcase_importer/testcase-importer.xsd");
}
else if (t == Testsuites.class) {
xsd = JAXBHelper.class.getClassLoader().getResource("xunit_importers/xunit.xsd");
}
else if (t == Testcases.class) {
xsd = JAXBHelper.class.getClassLoader().getResource("testcase_importer/testcase-importer.xsd");
}
else
throw new XSDValidationError(String.format("Could not find xsd schema for class %s", t.getName()));
return xsd;
}
}
|
298e9263-86d5-4689-bf95-16d21ae950a4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-18 22:31:55", "repo_name": "jaumzera/transapp", "sub_path": "/src/main/java/br/com/joaomassan/transapp/transaction/TransactionCreationRequest.java", "file_name": "TransactionCreationRequest.java", "file_ext": "java", "file_size_in_byte": 1044, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "d10c92adca1afa37a5ad8dbad029399b2e937f6c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jaumzera/transapp | 197 | FILENAME: TransactionCreationRequest.java | 0.27048 | package br.com.joaomassan.transapp.transaction;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;
import java.util.Objects;
import lombok.Value;
@Value
public class TransactionCreationRequest {
Long accountId;
Long operationTypeId;
BigDecimal amount;
@JsonCreator
public TransactionCreationRequest(
@JsonProperty("accountId") Long accountId,
@JsonProperty("operationTypeId") Long operationTypeId,
@JsonProperty("amount") BigDecimal amount) {
this.accountId = Objects.requireNonNull(accountId, "accountId must not be null");
this.operationTypeId =
Objects.requireNonNull(operationTypeId, "operationTypeId must not be null");
this.amount = Objects.requireNonNull(amount, "amount must not be null");
}
public Transaction toEntity() {
return Transaction.builder()
.accountId(this.accountId)
.operationTypeId(this.operationTypeId)
.amount(this.amount)
.build();
}
}
|
e610241c-999f-4ef5-a786-086445cfd802 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-16 02:48:04", "repo_name": "song12138/sysmanager", "sub_path": "/src/main/java/com/company/smartwater/config/CorsConfig.java", "file_name": "CorsConfig.java", "file_ext": "java", "file_size_in_byte": 1087, "line_count": 28, "lang": "en", "doc_type": "code", "blob_id": "a60654ca0fcf298e7936616212981872e6312caa", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/song12138/sysmanager | 196 | FILENAME: CorsConfig.java | 0.210766 | package com.company.smartwater.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
@Configuration
public class CorsConfig {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
// 设置你要允许的网站域名,如果全允许则设为 *
config.addAllowedOrigin("*");
// 如果要限制 HEADER 或 METHOD 请自行更改
config.addAllowedHeader("*");
config.addAllowedMethod("*");
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
} |
2a798f26-d500-4f12-8c07-fb400360d223 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2010-04-22 17:09:56", "repo_name": "jefferyship/searchsystems", "sub_path": "/src/com/baicai/test/MemcacheTest.java", "file_name": "MemcacheTest.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "fdca1fb6fe106ac85cdbe0f914c4d33e3c6396ea", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jefferyship/searchsystems | 353 | FILENAME: MemcacheTest.java | 0.286968 | package com.baicai.test;
import java.util.Date;
import com.danga.MemCached.MemCachedClient;
import com.danga.MemCached.SockIOPool;
public class MemcacheTest {
public static void main(String args[]){
MemCachedClient mcc = new MemCachedClient();
String servers[] = {"192.168.1.111:3335"};
Integer[] weight = {100};
SockIOPool pool = SockIOPool.getInstance();
pool.setServers(servers);
pool.setWeights(weight);
pool.setInitConn( 5 );
pool.setMinConn( 5 );
pool.setMaxConn( 250 );
pool.setMaxIdle( 1000 * 60 * 60 * 6 );
pool.setMaintSleep( 30 );
// pool.setNagle( false );
// pool.setSocketTO( 3000 );
// pool.setSocketConnectTO( 0 );
pool.initialize();
mcc.setPrimitiveAsString( true );
mcc.setCompressEnable(false);
mcc.setCompressThreshold( 64 * 1024 );
pool.setHashingAlg( SockIOPool.NEW_COMPAT_HASH );
mcc.set("www", "www.it.com.cn",new Date(1000));
// mcc.add("www", "www.pconoine.com.cn");
String v = (String)mcc.get("www");
// System.out.println(mcc.keyExists("www"));
System.out.println(v);
}
}
|
6ef2cf9e-69ed-4f11-ba65-b3cc9119cb0e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-06 19:54:57", "repo_name": "ErofeevAS/cloud", "sub_path": "/src/main/java/com/erofeev/cloud/bookshop/contoller/BookController.java", "file_name": "BookController.java", "file_ext": "java", "file_size_in_byte": 1028, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "e4d53e496cda04f8978054d743e20e487704010f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ErofeevAS/cloud | 219 | FILENAME: BookController.java | 0.264358 | package com.erofeev.cloud.bookshop.contoller;
import com.erofeev.cloud.bookshop.service.BookService;
import com.erofeev.cloud.bookshop.service.dto.BookDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@RestController
@RequestMapping("/books")
public class BookController {
@Autowired
private BookService bookService;
@GetMapping
public Flux<BookDto> getBooks() {
return bookService.getBooks();
}
@GetMapping("/{id}")
public Mono<BookDto> getBookButId(@PathVariable String id) {
return bookService.getBookById(id);
}
@PostMapping
public Mono<BookDto> createBook(@RequestBody Mono<BookDto> dto) {
return bookService.createBook(dto);
}
@PatchMapping("/{id}")
public Mono<BookDto> updateBook(@PathVariable String id, @RequestBody Mono<BookDto> dto) {
return bookService.updateBook(id, dto);
}
}
|
1be2bf56-a848-4e07-ba99-e54033be3e85 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-08 12:58:35", "repo_name": "Rabbit95/KaiYan", "sub_path": "/app/src/main/java/com/rabbit/kaiyan/presenter/LikePresenter.java", "file_name": "LikePresenter.java", "file_ext": "java", "file_size_in_byte": 1058, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "6b01437be2ae33a22205d339690229f0414f4cb2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Rabbit95/KaiYan | 224 | FILENAME: LikePresenter.java | 0.286968 | package com.rabbit.kaiyan.presenter;
import com.rabbit.kaiyan.base.contract.LikeContract;
import com.rabbit.kaiyan.model.DataManager;
import com.rabbit.kaiyan.model.beans.DataBean;
import com.rabbit.kaiyan.util.RxUtil;
import com.rabbit.kaiyan.widget.CommonSubscriber;
import javax.inject.Inject;
public class LikePresenter extends RxPresenter<LikeContract.View> implements LikeContract.Presenter {
private static final String TAG = "LikePresenter";
@Inject
public LikePresenter(DataManager manager) {
this.mDataManager = manager;
}
@Override
public void getLikeData() {
mView.setLikeData(mDataManager.getLikeBeans());
}
@Override
public void getLikeDataByID(int id) {
addSubscribe(mDataManager.getDataBean(id)
.compose(RxUtil.<DataBean>rxSchedulerHelper())
.subscribeWith(new CommonSubscriber<DataBean>(mView) {
@Override
public void onNext(DataBean dataBean) {
mView.startDetailActivity(dataBean);
}
}));
}
}
|
2c5ae723-e4c3-43ae-ae2d-0cd9d3bcffd4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-09 15:40:24", "repo_name": "kobenunu/Registration-System", "sub_path": "/src/main/java/bgu/spl/net/api/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 1029, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "65874983d0982725c67e809e32a4d65a7ee67d24", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/kobenunu/Registration-System | 194 | FILENAME: User.java | 0.239349 | package bgu.spl.net.srv;
import src.Course;
import java.util.Vector;
public class User {
private String username;
private String password;
private Vector<Course> registeredCourses;
final boolean isAdmin;
private boolean loggedIn;
public User(String username, String password, boolean isAdmin){
this.username = username;
this.password = password;
this.registeredCourses = new Vector<Course>();
this.isAdmin = isAdmin;
loggedIn = false;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public boolean isAdmin() {
return isAdmin;
}
public Vector<Course> getRegisteredCourses() {
return registeredCourses;
}
public boolean isLoggedIn() {
return loggedIn;
}
public void logIn(){
loggedIn = true;
}
public void registerToCourse(Course course){
registeredCourses.add(course);
}
}
|
d395dca7-f0f3-497c-9d90-c7bc5e146f27 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-26 19:24:15", "repo_name": "Segstas/optimization-hw", "sub_path": "/optomizationJMH/src/main/java/com/sbt/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 1116, "line_count": 60, "lang": "en", "doc_type": "code", "blob_id": "cd45b2050cd444c60902009046a571d669d973e7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Segstas/optimization-hw | 241 | FILENAME: User.java | 0.253861 | package com.sbt;
public class User{
String name;
String email;
Integer age;
boolean isAdmin;
public User(String name, String email, Integer age, boolean isAdmin) {
this.name = name;
this.email = email;
this.age = age;
this.isAdmin = isAdmin;
}
public User() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public boolean isAdmin() {
return isAdmin;
}
public void setAdmin(boolean admin) {
isAdmin = admin;
}
@Override
public String toString() {
return "User{" +
"name='" + name + '\'' +
", email='" + email + '\'' +
", age=" + age +
", isAdmin=" + isAdmin +
'}';
}
} |
f4ee081d-d17c-404c-967c-d43834fcf5a6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-16 15:15:24", "repo_name": "umairmunir-95/CheckMaid-Android", "sub_path": "/app/src/main/java/com/mindclarity/checkmaid/data/remote/ApiClient.java", "file_name": "ApiClient.java", "file_ext": "java", "file_size_in_byte": 1020, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "ead61a9aae26d5f06d180662faf58b7b688b8f6e", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/umairmunir-95/CheckMaid-Android | 176 | FILENAME: ApiClient.java | 0.264358 | package com.mindclarity.checkmaid.data.remote;
import com.mindclarity.checkmaid.App;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ApiClient {
private static Retrofit retrofit = null;
public static Retrofit getClient()
{
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient.Builder oktHttpClient = new OkHttpClient.Builder();
oktHttpClient.addInterceptor(interceptor);
if (retrofit == null)
{
retrofit = new Retrofit.Builder()
.baseUrl(App.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(oktHttpClient.build())
.build();
}
return retrofit;
}
}
|
dea3b8bc-b4d6-483b-b4c3-a9d34cedfa27 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-10 12:45:46", "repo_name": "maurodim/electronica", "sub_path": "/src/objetos/GenerarQr.java", "file_name": "GenerarQr.java", "file_ext": "java", "file_size_in_byte": 1077, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "5a285be976f41084873f3e449c16da3d5e369a93", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/maurodim/electronica | 257 | FILENAME: GenerarQr.java | 0.276691 | /*
* 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 objetos;
import com.barcodelib.barcode.QRCode;
/**
*
* @author mauro
*/
public class GenerarQr {
int udm=0,resol=72,rot=0;
float mi=0.00f,md=0.00f,ms=0.00f,min=0.00f,tam=3;
public GenerarQr(String dato,String nombre) {
try{
QRCode c=new QRCode();
c.setData(dato);
c.setDataMode(QRCode.MODE_BYTE);
c.setUOM(udm);
c.setLeftMargin(mi);
c.setRightMargin(md);
c.setTopMargin(ms);
c.setBottomMargin(min);
c.setResolution(resol);
c.setRotate(rot);
c.setModuleSize(tam);
//String archivo="imagenes/"+nombre+"_qr.gif";
c.renderBarcode(nombre);
}catch(Exception e){
System.out.println(e);
}
}
}
|
a0469db9-aa8c-4276-a500-afa4b18afbf9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-02-10 09:49:10", "repo_name": "kimkimani/GEO-CIRCLE", "sub_path": "/app/src/main/java/family/track/PasswordActivity.java", "file_name": "PasswordActivity.java", "file_ext": "java", "file_size_in_byte": 1117, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "877447a3df0d7bf210a1424edbc6d81c22a07461", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kimkimani/GEO-CIRCLE | 203 | FILENAME: PasswordActivity.java | 0.246533 | package family.track;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
public class PasswordActivity extends AppCompatActivity {
String email;
EditText e3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_password);
e3 =(EditText)findViewById(R.id.editTextp);
Intent intent =getIntent();
if (intent!=null){
email =intent.getStringExtra("email");
}
}
public void gotoNameActivity(View v){
if (e3.getText().toString().length()>6){
Intent intent = new Intent(PasswordActivity.this,NameActivity.class);
intent.putExtra("emmail",email);
intent.putExtra("passwors",e3.getText().toString());
startActivity(intent);
}else {
Toast.makeText(getApplicationContext(),"password must be more that 6",Toast.LENGTH_LONG).show();
}
}
}
|
7e2bed81-bef3-492f-9934-09b9864dcdd1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-31 17:54:41", "repo_name": "JonathanWibowo/FinalThesis", "sub_path": "/app/src/main/java/com/thesis/megahjaya/Session.java", "file_name": "Session.java", "file_ext": "java", "file_size_in_byte": 1121, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "b6748472ab986a37c71aa1cc6866d79d35c5cd5a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JonathanWibowo/FinalThesis | 198 | FILENAME: Session.java | 0.262842 | // reference from: https://www.androidhive.info/2012/08/android-session-management-using-shared-preferences/
package com.thesis.megahjaya;
import android.content.Context;
import android.content.SharedPreferences;
public class Session {
Context context;
SharedPreferences sharedPreferences;
SharedPreferences.Editor editor;
private static final String session = "session";
public Session(SharedPreferences sharedPreferences, SharedPreferences.Editor editor) {
sharedPreferences = context.getSharedPreferences(session, context.MODE_PRIVATE);
editor = sharedPreferences.edit();
}
public void makeSessionLogin(String username, String token){
editor.putBoolean("checkLoginStatus", true);
editor.putString("username", username);
editor.putString("token", token);
editor.commit();
}
public void checkValidation(){
// Go to login page when not
if(isLoggedIn()){
}
else{
}
}
public boolean isLoggedIn(){
return sharedPreferences.getBoolean("checkLoginStatus", false);
}
}
|
5697cd56-8f10-4825-a1cb-9fa0c10ff52a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-14 13:15:37", "repo_name": "xeniaka/spring-core-tutorial", "sub_path": "/spring-core-training-ex-12/src/main/java/common/aspect/Logging.java", "file_name": "Logging.java", "file_ext": "java", "file_size_in_byte": 993, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "37a4ccaf2eaaa26e44f9136f8f1a9b9200ad5af0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xeniaka/spring-core-tutorial | 193 | FILENAME: Logging.java | 0.278257 | package common.aspect;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
@Aspect
public class Logging {
@Pointcut("@annotation(Loggable)")
public void log() {
}
@AfterReturning(pointcut = "log()", returning = "returnValue")
public void writeTo(JoinPoint joinPoint, Object returnValue) {
StringBuilder message = new StringBuilder();
message.append("Method: ").append(joinPoint.getSignature().getName());
message.append(", Args Length: ").append(joinPoint.getArgs() == null ? "0" : joinPoint.getArgs().length);
if (returnValue instanceof Collection) {
message.append(", Return Type is a Collection");
}
System.out.println(message.toString());
}
}
|
f3182bdf-3f98-4f50-9061-ba884a3695cd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-24 05:45:38", "repo_name": "Myung9/spring_1", "sub_path": "/src/main/java/com/myung9/spring/project1/Mycontact/domain/dto/Birthday.java", "file_name": "Birthday.java", "file_ext": "java", "file_size_in_byte": 1081, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "fcbe50d3f749e48dc3bc868855b2cd6f785e9ee3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Myung9/spring_1 | 212 | FILENAME: Birthday.java | 0.275909 | package com.myung9.spring.project1.Mycontact.domain.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Embeddable;
import java.time.LocalDate;
@Embeddable //entity에 속해 있는 dto라는 것을 표시
@NoArgsConstructor
@Data
public class Birthday {
private Integer yearOfBirthday;
private Integer monthOfBirthday;
private Integer dayOfBirthday;
private Birthday(LocalDate birthday){
/*
birthday를 LocalDate 타입으로 한번 mapping해주어서 validation이 자동으로 적용
*/
this.yearOfBirthday = birthday.getYear();
this.monthOfBirthday = birthday.getMonthValue();
this.dayOfBirthday = birthday.getDayOfMonth();
}
public int getAge(){
return LocalDate.now().getYear() - this.yearOfBirthday + 1;
}
public boolean isBirthdayToday(){
return LocalDate.now().equals(LocalDate.of(yearOfBirthday, monthOfBirthday, dayOfBirthday));
}
public static Birthday of(LocalDate birthday){
return new Birthday(birthday);
}
}
|
c6e9af50-8d2f-42d2-a47e-fb35e7bfe549 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-10-24T01:25:14", "repo_name": "domaframework/doma-quarkus", "sub_path": "/.github/ISSUE_TEMPLATE/bug_report.md", "file_name": "bug_report.md", "file_ext": "md", "file_size_in_byte": 1053, "line_count": 48, "lang": "en", "doc_type": "text", "blob_id": "bab6e3ab805dac3b1f141a875a4c34a45ab53224", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/domaframework/doma-quarkus | 252 | FILENAME: bug_report.md | 0.239349 | ---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: nakamura-to
---
**Describe the bug**
(Describe the problem clearly and concisely.)
**Expected behavior**
(Describe the expected behavior clearly and concisely.)
**Actual behavior**
(Describe the actual behavior clearly and concisely.)
**To Reproduce**
Steps to reproduce the behavior:
1.
2.
3.
**Configuration**
```properties
# Add your application.properties here, if applicable.
```
**Screenshots**
(If applicable, add screenshots to help explain your problem.)
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
- Output of `java -version`:
- GraalVM version (if different from Java):
- Doma-Quarkus version or git rev:
- Doma version:
- Quarkus version:
- IDE version (ie. Eclipse or IntelliJ IDEA ):
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
- Database version:
- JDBC Driver version:
**Additional context**
(Add any other context about the problem here.)
|
438b262f-1bd1-471e-ad4c-8e71487ecd91 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-01-11T06:11:01", "repo_name": "mikelnorth/css-clones", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1054, "line_count": 16, "lang": "en", "doc_type": "text", "blob_id": "c0e7d05509a8dfb934a75b9afcbafbc52f378621", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mikelnorth/css-clones | 213 | FILENAME: README.md | 0.226784 | # PIXEL PERFECT CSS CLONES
## About
This website is to showcase CSS / SCSS competency by pixel perfect clones of major websites.
## Table of Contents
### Note that Nike's website is always changing and the version that may be used today may differ from the clone I have created.
Regardless of differences between Nike's updated website and my cloned version, many aspects will still remain the same and your ability to compare should not be impaired. <br/><br/>
Nike Clone: Nike, Inc. is an American multinational corporation that is engaged in the design, development, manufacturing, and worldwide marketing and sales of footwear, apparel, equipment, accessories, and services.
## Create React App
This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).
Below you will find some information on how to perform common tasks.<br>
You can find the most recent version of this guide [here](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md).
|
1b7c6b1f-3c06-4074-8032-d1c0974c0506 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-08 15:26:40", "repo_name": "ioannispriovolos/Android-Developer-Nanodegree", "sub_path": "/BakingApp/app/src/main/java/com/ioannispriovolos/android/bakingapp/DataProvider.java", "file_name": "DataProvider.java", "file_ext": "java", "file_size_in_byte": 1035, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "ae4fdf02fb26f3607a227368a9a7471b383479a4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ioannispriovolos/Android-Developer-Nanodegree | 195 | FILENAME: DataProvider.java | 0.27513 | package com.ioannispriovolos.android.bakingapp;
import android.content.Context;
import android.os.Handler;
import android.support.annotation.Nullable;
public class DataProvider {
private static final int DELAY_MILLIS = 10000;
public interface DataLoadedCallback{
void onDone();
}
public static void downloadBackingData(Context context, final DataLoadedCallback dataLoadedCallback, @Nullable final Idling idlingResource) {
if (idlingResource != null) {
idlingResource.setIdleState(false);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (dataLoadedCallback != null) {
dataLoadedCallback.onDone();
if (idlingResource != null) {
idlingResource.setIdleState(true);
}
}
}
}, DELAY_MILLIS);
}
}
}
|
671dcbf5-a04c-4a4f-9a4b-d4438b75a602 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-30 20:42:36", "repo_name": "rayniery/restaurant", "sub_path": "/src/main/java/rayniery/restaurant/api/model/MenuItem.java", "file_name": "MenuItem.java", "file_ext": "java", "file_size_in_byte": 1121, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "108efac665b2bb95db8d3dad79c58eea863e074f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rayniery/restaurant | 188 | FILENAME: MenuItem.java | 0.255344 | package rayniery.restaurant.api.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Value;
import rayniery.restaurant.persistance.entity.MenuItemEntity;
import java.math.BigDecimal;
@Value
@Builder(toBuilder = true)
@AllArgsConstructor
public class MenuItem {
long id;
String name;
String description;
String image;
BigDecimal price;
String additionalDetails;
public static MenuItem fromEntity(MenuItemEntity entity) {
return MenuItem.builder()
.id(entity.getId())
.name(entity.getName())
.additionalDetails(entity.getAdditionalDetails())
.description(entity.getDescription())
.image(entity.getImage())
.price(entity.getPrice())
.build();
}
public MenuItemEntity toEntity() {
return MenuItemEntity.builder()
.additionalDetails(additionalDetails)
.description(description)
.image(image)
.name(name)
.price(price)
.build();
}
}
|
81e6ce6a-130a-4c11-b38b-ed982cba6584 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-03-30T18:04:45", "repo_name": "EuclideanOS-Legacy/resources", "sub_path": "/README.mkdn", "file_name": "README.mkdn", "file_ext": "mkdn", "file_size_in_byte": 1071, "line_count": 36, "lang": "en", "doc_type": "text", "blob_id": "04473644fa9261ffc59167f4931a6c08576b6eef", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/EuclideanOS-Legacy/resources | 244 | FILENAME: README.mkdn | 0.261331 | Euclidean OS Resources
======================
This section includes all the resources outside the ROM. It contains the resources of EuclideanOS for themeres, xda thread template, build script and some other resources.
Build Script
-------------
release.sh
This script contains a menu based build system that can be edited to point to multiple repos.
It can Auto Upload via sftp to your host of choice right now it is setup for androidfilehost
Theme Resources Script
----------------------
update-themes.sh
This script is to help out the themers with EuclideanOS custom drawables.
You can read more about it here: https://devs-base.com/viewtopic.php?f=198&t=188
Forum Template
--------------
threadtemplate
This contains the thread template ro use in the forums like XDA or devs-base.
Credits/Thanks
--------------
@beanstown106 for the build script (https://github.com/beanstown106/scripts/blob/master/PureMenu.sh)
@DirtyUnicorns team for the theme resources script (https://github.com/DirtyUnicorns/DU-Scripts/blob/n/update-themes.sh)
|
f2477f78-358c-4c40-8ac9-23c0bbdba183 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-17 11:27:22", "repo_name": "terre-virtuelle/navisu", "sub_path": "/navisu-media/src/main/java/bzh/terrevirtuelle/navisu/media/bathysounds/impl/controller/SoundAction.java", "file_name": "SoundAction.java", "file_ext": "java", "file_size_in_byte": 1093, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "41623b51814c048005f486b0aab29580b4f4a259", "star_events_count": 31, "fork_events_count": 16, "src_encoding": "UTF-8"} | https://github.com/terre-virtuelle/navisu | 246 | FILENAME: SoundAction.java | 0.288569 | /*
* 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 bzh.terrevirtuelle.navisu.media.bathysounds.impl.controller;
import bzh.terrevirtuelle.navisu.app.drivers.instrumentdriver.InstrumentDriverManagerServices;
import bzh.terrevirtuelle.navisu.domain.geometry.Point3DGeo;
import java.util.Map;
/**
*
* @author serge
* @date Oct 16, 2017
*/
public class SoundAction
implements LocatableAction {
protected Map<Point3DGeo, String> soundMap;
protected InstrumentDriverManagerServices instrumentDriverManagerServices;
public SoundAction(InstrumentDriverManagerServices instrumentDriverManagerServices,
Map<Point3DGeo, String> soundMap) {
this.soundMap = soundMap;
this.instrumentDriverManagerServices = instrumentDriverManagerServices;
}
public void doIt(Point3DGeo point) {
String sound = soundMap.get(point);
instrumentDriverManagerServices.open(sound, "true", "1");
}
}
|
00cf7677-0755-4d50-a904-bf57cafd2104 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-11 16:26:17", "repo_name": "czarSevilla/evaluaciones", "sub_path": "/src/main/java/czar/evaluaciones/MvcConfig.java", "file_name": "MvcConfig.java", "file_ext": "java", "file_size_in_byte": 1120, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "0c54256e971cd3ac4dd7f871095c01d5cf405f49", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/czarSevilla/evaluaciones | 211 | FILENAME: MvcConfig.java | 0.262842 | package czar.evaluaciones;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class MvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login");
}
@Override
public void addFormatters(FormatterRegistry registry) {
registry.addConverter(new Converter<String, Date>() {
private DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
@Override
public Date convert(String date) {
try {
return df.parse(date);
} catch (ParseException pe) {
return null;
}
}
});
super.addFormatters(registry);
}
}
|
bc22b5d9-cf72-463c-ad6e-82c717a40c3c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-18 04:01:22", "repo_name": "chenshun131/SpringBootDemo", "sub_path": "/eureka/consumer-feign/src/main/java/com/chenshun/test/controller/RefactorConsumerController.java", "file_name": "RefactorConsumerController.java", "file_ext": "java", "file_size_in_byte": 1050, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "ab083a27095ad93cf93b3b5262cec0aa3e35d53d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/chenshun131/SpringBootDemo | 252 | FILENAME: RefactorConsumerController.java | 0.221351 | package com.chenshun.test.controller;
import com.chenshun.test.bean.User;
import com.chenshun.test.service.RefactorRefactService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* User: mew <p />
* Time: 18/5/16 15:25 <p />
* Version: V1.0 <p />
* Description: <p />
*/
@RestController
public class RefactorConsumerController {
@Autowired
private RefactorRefactService refactorHelloService;
@GetMapping(value = "feignConsumer4")
public String helloController1() {
return refactorHelloService.helloService("小肥猪");
}
@GetMapping(value = "feignConsumer5")
public User helloController2() {
return refactorHelloService.helloService("chenshun", 111);
}
@GetMapping(value = "feignConsumer6")
public String helloController3() {
User user = new User("皮皮虾", 222);
return refactorHelloService.helloService(user);
}
}
|
a8ee563c-eda6-4205-bb38-99943a3ed03e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-03 17:13:06", "repo_name": "dsparber/audio-ant", "sub_path": "/AnalysisSoftware/AudioAnalysis/src/com/audioant/io/android/json/actions/DeleteSoundAction.java", "file_name": "DeleteSoundAction.java", "file_ext": "java", "file_size_in_byte": 1058, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "58eed205fad43cd9ba4b0d7a85a397b345e4a58b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dsparber/audio-ant | 213 | FILENAME: DeleteSoundAction.java | 0.293404 | package com.audioant.io.android.json.actions;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.json.simple.JSONObject;
import com.audioant.RaspberryTool;
import com.audioant.audio.learning.LearnedSounds;
import com.audioant.io.android.json.JsonFields;
import com.audioant.io.android.json.JsonFields.DeleteSound.Reply;
import com.audioant.io.android.json.JsonReplyAction;;
public class DeleteSoundAction extends JsonReplyAction {
private int id;
public DeleteSoundAction(JSONObject request) {
super(request);
id = (int) ((long) request.get(JsonFields.DATA_KEY));
}
@SuppressWarnings("unchecked")
@Override
public JSONObject getReply() {
JSONObject jsonObject = new JSONObject();
LearnedSounds.deleteSound(id);
try {
LearnedSounds.saveSounds();
} catch (ParserConfigurationException | TransformerException e) {
e.printStackTrace();
}
RaspberryTool.restartAnalysis();
jsonObject.put(JsonFields.ACTION_KEY, Reply.ACTION_VALUE);
return jsonObject;
}
}
|
3548d0da-4273-47b3-b69b-23d4433a8133 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-03 08:53:25", "repo_name": "sinake123/spark_maven", "sub_path": "/spark_maven/src/main/scala/com/yuan/hadoop/MapperDemo.java", "file_name": "MapperDemo.java", "file_ext": "java", "file_size_in_byte": 1015, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "722b2f4f67081efe3e91f139c02ae66c5f0266e9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sinake123/spark_maven | 207 | FILENAME: MapperDemo.java | 0.283781 | package com.yuan.hadoop;
import java.io.IOException;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
public class MapperDemo extends Mapper<LongWritable,Text,Text,LongWritable> {
private Text key;
private LongWritable value;
/**
*
*/
@Override
protected void setup(Context context)
throws IOException, InterruptedException {
key = new Text();
value = new LongWritable();
}
@Override
protected void map(LongWritable key, Text value,Context context)
throws IOException, InterruptedException {
String content = value.toString();
if(content!=null&&content.contains("female")){
String[] infos = content.split(",");
this.key.set(infos[0]);
this.value.set(Long.valueOf(infos[2]));
context.write(this.key, this.value);
}
}
@Override
protected void cleanup(Context context)
throws IOException, InterruptedException {
super.cleanup(context);
}
}
|
97242351-325e-42b3-ab63-fc737bacea22 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-13 04:14:23", "repo_name": "matieuthe/TP_RMI", "sub_path": "/ChatClient.java", "file_name": "ChatClient.java", "file_ext": "java", "file_size_in_byte": 1079, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "97e57c1a2738a4c6c36f8ec5d3657b25a9393fe7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/matieuthe/TP_RMI | 218 | FILENAME: ChatClient.java | 0.291787 |
import java.net.MalformedURLException;
import java.rmi.*;
import java.util.*;
public class ChatClient {
public static void main(String[] argv) throws Exception {
try {
Scanner s = new Scanner(System.in);
System.out.print("Enter your name: ");
String name = s.nextLine().trim();
ChatInterface client = new ChatImplement(name);
ChatInterface stub = (ChatInterface) Naming.lookup("rmi://192.168.11.1:5000/SimpleChatServer");
String msg = "[" + client.getName() + "] got connected.";
stub.send(msg);
System.out.println("[System] Chat Remote Object is ready!");
stub.setClient(client);
while (true) {
msg = s.nextLine().trim();
msg = "[" + client.getName() + "] " + msg;
stub.send(msg);
}
} catch (RemoteException | NotBoundException | MalformedURLException e) {
System.out.println("[System] Server failed: " + e);
}
}
}
|
4024acd7-df54-46f9-82fb-df87f8a23f7c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-04-22 14:11:36", "repo_name": "biodiv-archived/biodiv-mobile-android", "sub_path": "/IBP/src/com/mobisys/android/ibp/widget/CheckableLayout.java", "file_name": "CheckableLayout.java", "file_ext": "java", "file_size_in_byte": 1121, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "47703b11fcd11409063ee3d2423ca0caa54532df", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/biodiv-archived/biodiv-mobile-android | 207 | FILENAME: CheckableLayout.java | 0.256832 | package com.mobisys.android.ibp.widget;
import com.mobisys.android.ibp.R;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.Checkable;
import android.widget.RelativeLayout;
public class CheckableLayout extends RelativeLayout implements Checkable {
private boolean mChecked;
private Context mContext;
public CheckableLayout(Context context) {
super(context);
mContext=context;
}
public CheckableLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mContext=context;
}
public void setChecked(boolean checked) {
mChecked = checked;
setBackgroundColor(mChecked?mContext.getResources().getColor(R.color.light_gray):mContext.getResources().getColor(android.R.color.transparent));
// setBackgroundDrawable(mChecked?mContext.getResources().getDrawable(R.drawable.list_item_bg):new ColorDrawable(0));
}
public boolean isChecked() {
return mChecked;
}
public void toggle() {
setChecked(!mChecked);
}
}
|
3b230dda-948a-40cd-a176-1e9e0c6e9a82 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-10-21 20:25:55", "repo_name": "iamfiras/OpenRSSParser", "sub_path": "/src/main/java/openrssparser/models/atom/AtomFeed.java", "file_name": "AtomFeed.java", "file_ext": "java", "file_size_in_byte": 979, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "16b4094fcfa03a8549b19d64196e017be2eeb653", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/iamfiras/OpenRSSParser | 268 | FILENAME: AtomFeed.java | 0.275909 | package openrssparser.models.atom;
import java.util.ArrayList;
import java.util.List;
/*
* url: http://www.ietf.org/rfc/rfc4287.txt
* section: 4.1.1. The "atom:feed" Element
* model:
*
* atomFeed =
* element atom:feed {
* atomCommonAttributes,
* (atomAuthor*
* & atomCategory*
* & atomContributor*
* & atomGenerator?
* & atomIcon?
* & atomId
* & atomLink*
* & atomLogo?
* & atomRights?
* & atomSubtitle?
* & atomTitle
* & atomUpdated
* & extensionElement*),
* atomEntry*
* }
*/
public class AtomFeed extends AtomElement {
private AtomSource header = new AtomSource();
private List<AtomEntry> entries = new ArrayList<AtomEntry>();
public AtomSource getHeader() {
return header;
}
public void setHeader(AtomSource header) {
this.header = header;
}
public List<AtomEntry> getEntries() {
return entries;
}
public void setEntries(List<AtomEntry> entries) {
this.entries = entries;
}
} |
08389502-3dd5-4646-8897-6f375dcece3c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-08 15:32:45", "repo_name": "Garomir/MusicListClient", "sub_path": "/app/src/main/java/ru/ramich/musiclist/AlbumsAdapter.java", "file_name": "AlbumsAdapter.java", "file_ext": "java", "file_size_in_byte": 1011, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "c442847eadeaf35d34b08cbbd3fdde0171624c6f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Garomir/MusicListClient | 222 | FILENAME: AlbumsAdapter.java | 0.273574 | package ru.ramich.musiclist;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.List;
public class AlbumsAdapter extends BaseAdapter {
private List<Album> myAlbums;
public AlbumsAdapter(List<Album> myAlbums) {
super();
this.myAlbums = myAlbums;
}
@Override
public int getCount() {
return myAlbums.size();
}
@Override
public Object getItem(int position) {
return myAlbums.get(position);
}
@Override
public long getItemId(int position) {
return myAlbums.get(position).getId();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) v = View.inflate(parent.getContext(), R.layout.list_item, null);
TextView txt1 = v.findViewById(R.id.tvListItem);
txt1.setText(myAlbums.get(position).getName());
return v;
}
}
|
0edaee02-4aa1-4b27-8370-f0d711175a11 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-20 11:39:21", "repo_name": "Combodgony/NEUS", "sub_path": "/terminalLogistic/src/main/java/com/segvek/terminal/model/Estakada.java", "file_name": "Estakada.java", "file_ext": "java", "file_size_in_byte": 1070, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "73645ec4b67a792820654a815d1100f46c85b562", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Combodgony/NEUS | 249 | FILENAME: Estakada.java | 0.267408 | package com.segvek.terminal.model;
import java.util.List;
public class Estakada extends MainModel{
private TypeEstakada typeEstakada;
private String name;
private List<DrainLocation> drainLocations;
public Estakada(Long id, TypeEstakada typeEstakada, String name, List<DrainLocation> drainLocations) {
super(id);
this.typeEstakada = typeEstakada;
this.name = name;
this.drainLocations = drainLocations;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public TypeEstakada getTypeEstakada() {
return typeEstakada;
}
public void setTypeEstakada(TypeEstakada typeEstakada) {
this.typeEstakada = typeEstakada;
}
public List<DrainLocation> getDrainLocations() {
return drainLocations;
}
public void setDrainLocations(List<DrainLocation> drainLocations) {
this.drainLocations = drainLocations;
}
}
|
fe87c23a-b8f4-475f-8281-9ae75fde5eee | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-02 02:58:08", "repo_name": "Bruce-morty/springboot_mall_project", "sub_path": "/src/main/java/top/philxin/controller/wx/WxHomeController.java", "file_name": "WxHomeController.java", "file_ext": "java", "file_size_in_byte": 1085, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "66c2021178ba82b52198e9981bcb3c1f7e3be3ef", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Bruce-morty/springboot_mall_project | 225 | FILENAME: WxHomeController.java | 0.228156 | package top.philxin.controller.wx;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.philxin.model.responseModel.CommonsModel.BaseRespVo;
import top.philxin.service.wx.WxHomeService;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("wx")
public class WxHomeController {
@Autowired
WxHomeService homeService;
/**
* 此方法用于小程序首页的显示
* @return
*/
@RequestMapping("home/index")
public BaseRespVo getHomeIndex(){
Map map = homeService.homeIndex();
return BaseRespVo.success(map);
}
/**
* 此方法用于小程序首页的显示,统计共有多少件商品
* @return
*/
@RequestMapping("goods/count")
public BaseRespVo countGoods(){
Integer count = homeService.countGoods();
Map map = new HashMap();
map.put("goodsCount",count);
return BaseRespVo.success(map);
}
}
|
c9948340-b9d8-4c8a-97c6-d143c7b6e364 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-08 08:49:58", "repo_name": "leroniris/Spring5", "sub_path": "/Spring/Spring5_proxy_static/src/com/lg/proxy/EmployeeServiceProxy.java", "file_name": "EmployeeServiceProxy.java", "file_ext": "java", "file_size_in_byte": 1083, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "dab58a0156fb8f141abd6d27ebbdd20d037ebc44", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/leroniris/Spring5 | 209 | FILENAME: EmployeeServiceProxy.java | 0.26971 | package com.lg.proxy;
import com.lg.domain.Employee;
import com.lg.service.IEmployeeService;
import com.lg.tx.TransactionManager;
public class EmployeeServiceProxy implements IEmployeeService {
private IEmployeeService target;//真实对象/委托对象
private TransactionManager txManager;//事务管理对象
public void setTarget(IEmployeeService target) {
this.target = target;
}
public void setTxManager(TransactionManager txManager) {
this.txManager = txManager;
}
@Override
public void save(Employee employee) {
txManager.begin();
try{
target.save(employee);
txManager.commit();
} catch (Exception e) {
e.printStackTrace();
txManager.rollback();
}
}
@Override
public void update(Employee employee) {
txManager.begin();
try{
target.update(employee);
txManager.commit();
} catch (Exception e) {
e.printStackTrace();
txManager.rollback();
}
}
}
|
eec873c6-0b5a-4b8f-b7cd-ea9f3007d124 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-07-29 08:46:06", "repo_name": "OpenNTF/xLog", "sub_path": "/domino-logger/src/main/java/org/openntf/utils/UniqueThreadIdGenerator.java", "file_name": "UniqueThreadIdGenerator.java", "file_ext": "java", "file_size_in_byte": 1015, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "757bf2ddd3c4d18c772388fabd289bcfae57c786", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "IBM852"} | https://github.com/OpenNTF/xLog | 204 | FILENAME: UniqueThreadIdGenerator.java | 0.284576 | package org.openntf.utils;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.logging.Log;
/**
* Generator class used to get a transaction ID.
*
* @author Olle ThalÚn
*
*/
public class UniqueThreadIdGenerator {
/**
* This method returns a hash of the users distinguished name and the sessionId (if present)
*
* @return hashcode which can be used as identifier
*/
public static int getCurrentThreadId() {
HashCodeBuilder builder = new HashCodeBuilder();
builder.append(JSFUtils.getUsername());
String sessionId = JSFUtils.getSessionID();
if (sessionId != null) {
builder.append(sessionId);
}
Log logger = DiagnosticLogging.getLogger();
if (logger.isDebugEnabled()) {
logger.debug("values used when creating hash: username - " + JSFUtils.getUsername() + ", sessionID - " + sessionId);
}
return builder.hashCode();
}
}
|
16dbd4f2-3abe-4d8b-9498-5f6c35851ed3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-02 11:16:20", "repo_name": "2871706122/javaJinJie", "sub_path": "/src/cn/zys/day520/doDolder/Druid_demo_test_uitles.java", "file_name": "Druid_demo_test_uitles.java", "file_ext": "java", "file_size_in_byte": 1150, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "ba7ff4a798241599bcd9d6c329c8606d02125318", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/2871706122/javaJinJie | 235 | FILENAME: Druid_demo_test_uitles.java | 0.253861 | package cn.zys.day520.doDolder;
import cn.zys.day520.uitles.Jdbc_druid_uitles;
import java.sql.*;
/**
* 测试写的druid工具类
*/
@SuppressWarnings("ALL")
public class Druid_demo_test_uitles {
public static void main(String[] args) {
Connection connectionObj = null;
PreparedStatement preparedStatementObj = null;
try {
//获取连接
connectionObj = Jdbc_druid_uitles.getConnection();
//定义sql
String sql = "insert into user_msg values(null,?,?,?)";
//创建数据库连接对象
preparedStatementObj = connectionObj.prepareStatement(sql);
//给?赋值
preparedStatementObj.setString(1,"name");
preparedStatementObj.setInt(2,20);
preparedStatementObj.setString(3,"男");
//执行sql
int ResultNum = preparedStatementObj.executeUpdate();
System.out.println(ResultNum);
} catch (SQLException e) {
e.printStackTrace();
}finally {
Jdbc_druid_uitles.doUpdateClose(preparedStatementObj,connectionObj);
}
}
}
|
7eff621b-b9cc-4d5e-84b0-7a2fb7bd3a66 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-02-27 10:00:45", "repo_name": "zstar2013/MyToolSet", "sub_path": "/src/com/mytools/android/file/FileLoader.java", "file_name": "FileLoader.java", "file_ext": "java", "file_size_in_byte": 1025, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "13d64756a5c73e2c3481ac5f89685154b68ceb0c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "GB18030"} | https://github.com/zstar2013/MyToolSet | 203 | FILENAME: FileLoader.java | 0.262842 | package com.mytools.android.file;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.http.util.EncodingUtils;
import android.content.Context;
public class FileLoader {
public static void getFileText(Context context) {
try {
InputStream in = context.getResources().getAssets().open("data1.xml");// 文件名字为rose.txt
int length = in.available();
byte[] buffer = new byte[length];
in.read(buffer);
String res = EncodingUtils.getString(buffer, "UTF-8");
System.out.println(res);
} catch (IOException e) {
e.printStackTrace();
}
}
public static InputStream getFileStream(Context context) {
try {
return context.getResources().getAssets().open("data1.xml");// 文件名字为rose.txt
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
|
6720d192-6d4a-4241-8ce4-29d0bb65cc9e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-05-05 18:42:23", "repo_name": "ulyanovvladimir/androidweather", "sub_path": "/app/src/main/java/domain/androidweather/weather/services/ServiceHelperBase.java", "file_name": "ServiceHelperBase.java", "file_ext": "java", "file_size_in_byte": 1072, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "8b374c6e3a744ac43d005e7dc374159947f65175", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/ulyanovvladimir/androidweather | 209 | FILENAME: ServiceHelperBase.java | 0.288569 | package domain.androidweather.weather.services;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
public abstract class ServiceHelperBase {
private final Context context;
private final int providerId;
private final String resultAction;
public ServiceHelperBase(Context context, int providerId, String resultAction) {
this.context = context;
this.providerId = providerId;
this.resultAction = resultAction;
}
protected void runMethod(int methodId) {
runMethod(methodId, null);
}
protected void runMethod(int methodId, Bundle bundle) {
Log.v("HELPER!", "runMethod");
Intent service = new Intent(context, ProcessorService.class);
service.putExtra(Extras.PROVIDER, providerId);
service.putExtra(Extras.METHOD, methodId);
service.putExtra(Extras.RESULT_ACTION, resultAction);
if(bundle != null) {
service.putExtras(bundle);
}
context.startService(service);
}
}
|
099b99c5-03a6-4146-af82-e16179d82e4e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-08 12:04:17", "repo_name": "AhmedSM1/Movies-Application", "sub_path": "/app/src/main/java/com/example/movies/popularmovies/Utils/MyJobDispatcher.java", "file_name": "MyJobDispatcher.java", "file_ext": "java", "file_size_in_byte": 1121, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "ca2f6608bb6df0eca9e8772553947edd37618553", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/AhmedSM1/Movies-Application | 201 | FILENAME: MyJobDispatcher.java | 0.259826 | package com.example.movies.popularmovies.Utils;
import android.util.Log;
import androidx.annotation.NonNull;
import com.example.movies.popularmovies.Database.AppExecutors;
import com.example.movies.popularmovies.R;
import com.firebase.jobdispatcher.JobParameters;
import com.firebase.jobdispatcher.JobService;
public class MyJobDispatcher extends JobService {
public static final String TAG = MyJobDispatcher.class.getName();
@Override
public boolean onStartJob(@NonNull JobParameters job) {
AppExecutors.getInstance().diskIO().execute(new Runnable() {
@Override
public void run() {
//notifications
Log.d(TAG, "startJob");
NotificationSender.myNotification(getApplicationContext(),getString(R.string.notification_title),getString(R.string.notification_body));
}
});
return true;
}
@Override
public boolean onStopJob(@NonNull JobParameters job) {
Log.d(TAG, "onStopJob: ");
NotificationSender.clearNotifications(getApplicationContext());
return false;
}
}
|
4a8af541-5859-4449-8ae9-8c9d85d4942c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-03-16 22:55:29", "repo_name": "kreezxil/Ex-Nihilo-3", "sub_path": "/src/main/java/exnihilo2/registries/EN2Registries.java", "file_name": "EN2Registries.java", "file_ext": "java", "file_size_in_byte": 1006, "line_count": 26, "lang": "en", "doc_type": "code", "blob_id": "76dfe7b4bf16acc7ffd5cc377875dcf91370d7cf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kreezxil/Ex-Nihilo-3 | 226 | FILENAME: EN2Registries.java | 0.293404 | package exnihilo2.registries;
import exnihilo2.registries.composting.CompostRegistry;
import exnihilo2.registries.hammering.HammerRegistry;
import exnihilo2.registries.sifting.SieveRegistry;
import net.minecraftforge.common.config.Configuration;
public class EN2Registries {
public static final String CATEGORY_DEFAULT_RECIPES = "default recipes";
public static boolean loadCompostDefaults = true;
public static boolean loadHammerDefaults = true;
public static boolean loadSieveDefaults = true;
public static void configure(Configuration config)
{
loadCompostDefaults = config.get(CATEGORY_DEFAULT_RECIPES, "load default compost recipes", true).getBoolean(true);
loadHammerDefaults = config.get(CATEGORY_DEFAULT_RECIPES, "load default hammer recipes", true).getBoolean(true);
loadSieveDefaults = config.get(CATEGORY_DEFAULT_RECIPES, "load default sieve recipes", true).getBoolean(true);
CompostRegistry.initialize();
HammerRegistry.initialize();
SieveRegistry.initialize();
}
}
|
9eca0108-581f-4cbe-b78e-34f8d2998664 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-18 20:15:11", "repo_name": "yuwangdev/piana", "sub_path": "/src/main/java/com/piana/restModel/response/TimeStampListModel.java", "file_name": "TimeStampListModel.java", "file_ext": "java", "file_size_in_byte": 1048, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "e388687317563220145312e8bee93a0c11cf3d3f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yuwangdev/piana | 219 | FILENAME: TimeStampListModel.java | 0.246533 | package com.piana.restModel.response;
import com.google.common.collect.Sets;
import java.util.Set;
/**
* Created by yuwang on 11/20/16.
*/
public class TimeStampListModel {
private int totalCount;
private Set<String> timeStampList = Sets.newConcurrentHashSet();
public TimeStampListModel(Set<String> timeStampList) {
this.timeStampList = timeStampList;
this.totalCount = this.timeStampList.size();
}
public TimeStampListModel() {
}
public Set<String> getTimeStampList() {
return timeStampList;
}
public void setTimeStampList(Set<String> timeStampList) {
this.timeStampList = timeStampList;
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
@Override
public String toString() {
return "TimeStampListModel{" +
"totalCount=" + totalCount +
", timeStampList=" + timeStampList +
'}';
}
}
|
ce698f47-8940-4994-80b8-eb39069887a7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-27 15:18:43", "repo_name": "xyw55/xorm", "sub_path": "/src/main/java/com/xyw55/xorm/bean/JavaFieldGetSet.java", "file_name": "JavaFieldGetSet.java", "file_ext": "java", "file_size_in_byte": 1178, "line_count": 62, "lang": "en", "doc_type": "code", "blob_id": "1bcb03d2ffcd8d0c7c5cce90b3b00921c75ba757", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xyw55/xorm | 287 | FILENAME: JavaFieldGetSet.java | 0.258326 | package com.xyw55.xorm.bean;
/**
* 封装java属性和get set方法的源代码
* Created by xiayiwei on 7/16/17.
*/
public class JavaFieldGetSet {
/**
* 属性源码信息,如: private int userId;
*/
private String fieldInfo;
/**
* get方法源码信息
*/
private String getInfo;
/**
* set方法源码信息
*/
private String setInfo;
public JavaFieldGetSet() {
}
public JavaFieldGetSet(String fieldInfo, String getInfo, String setInfo) {
this.fieldInfo = fieldInfo;
this.getInfo = getInfo;
this.setInfo = setInfo;
}
public String getFieldInfo() {
return fieldInfo;
}
public void setFieldInfo(String fieldInfo) {
this.fieldInfo = fieldInfo;
}
public String getGetInfo() {
return getInfo;
}
public void setGetInfo(String getInfo) {
this.getInfo = getInfo;
}
public String getSetInfo() {
return setInfo;
}
public void setSetInfo(String setInfo) {
this.setInfo = setInfo;
}
@Override
public String toString() {
return fieldInfo + getInfo + setInfo;
}
}
|
267cd3b4-bb90-49e0-b603-031d86ed88d3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-16 02:23:19", "repo_name": "WengShengyuan/rabbit-mq-client", "sub_path": "/src/main/java/org/wsy/mqendpoint/endpoint/serialization/SimpleSerialization.java", "file_name": "SimpleSerialization.java", "file_ext": "java", "file_size_in_byte": 1022, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "30a4239bf9dfb67f3be3fb7ebf80bffcbffdd2c7", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/WengShengyuan/rabbit-mq-client | 223 | FILENAME: SimpleSerialization.java | 0.249447 | package org.wsy.mqendpoint.endpoint.serialization;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import com.caucho.hessian.io.Hessian2StreamingInput;
import com.caucho.hessian.io.Hessian2StreamingOutput;
public class SimpleSerialization {
public static byte[] toByte(Object object) throws Exception {
Hessian2StreamingOutput oos = null;
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
oos = new Hessian2StreamingOutput(bos);
oos.writeObject(object);
byte[] b = bos.toByteArray();
return b;
} finally {
if (oos != null) {
oos.close();
}
}
}
public static Object toObject(byte[] objectBytes) throws Exception {
Hessian2StreamingInput ois = null;
try {
ByteArrayInputStream bis = new ByteArrayInputStream(objectBytes);
ois = new Hessian2StreamingInput(bis);
return ois.readObject();
} finally {
if (ois != null) {
ois.close();
}
}
}
}
|
dc0381cb-2a6c-4d05-962d-518f24f9da27 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-01 13:15:46", "repo_name": "dskim9752/3Dshare", "sub_path": "/src/dto/UserBean.java", "file_name": "UserBean.java", "file_ext": "java", "file_size_in_byte": 1057, "line_count": 70, "lang": "en", "doc_type": "code", "blob_id": "c773786a1c62d219ee219520db7e0781066f4516", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dskim9752/3Dshare | 251 | FILENAME: UserBean.java | 0.250913 | package dto;
public class UserBean implements java.io.Serializable {
private String id;
private String password;
private String email;
private String name;
// default constructor
public UserBean() {
this(null,null,null,null);
}
// constructor
public UserBean(String id, String password, String email, String name) {
super();
this.id = id;
this.password = password;
this.email = email;
this.name = name;
}
// getter & setter
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "UserBean [id=" + id + ", password=" + password + ", email=" + email + ", name=" + name + "]";
}
}
|
9c4b049f-5cbd-4422-a1ec-ebc4a6dcb1a5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-06 18:04:29", "repo_name": "saidreamx/Alumni-Network", "sub_path": "/app/src/main/java/com/example/sanjeev/alumninetwork/signUp/welcome.java", "file_name": "welcome.java", "file_ext": "java", "file_size_in_byte": 1058, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "741e50347436c4261734ba0e342e2451a7cb38f8", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/saidreamx/Alumni-Network | 184 | FILENAME: welcome.java | 0.204342 | package com.example.sanjeev.alumninetwork.signUp;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.example.sanjeev.alumninetwork.R;
public class welcome extends Fragment
{
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.welcome, container, false);
Button welcome = (Button) view.findViewById(R.id.welcome);
welcome.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent = new Intent(getActivity(), logIn.class);
startActivity(intent);
getActivity().getSupportFragmentManager().popBackStack();
}
});
return view;
}
}
|
0e333bc4-602e-46dc-94ee-f6ede511c00e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-28 09:07:11", "repo_name": "Blackun/mordern.java.in.action", "sub_path": "/chapter2/src/main/java/com/blackun/chapter17/TempSubscription.java", "file_name": "TempSubscription.java", "file_ext": "java", "file_size_in_byte": 1111, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "83c6cc17d0657e51ff25c4785ce98ca624653b97", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Blackun/mordern.java.in.action | 256 | FILENAME: TempSubscription.java | 0.279042 | package com.blackun.chapter17;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Flow.*;
public class TempSubscription implements Subscription {
private static final ExecutorService executor = Executors.newSingleThreadExecutor();
private final Subscriber<? super TempInfo> subscriber;
private final String town;
public TempSubscription(Subscriber<? super TempInfo> subscriber, String town){
this.subscriber = subscriber;
this.town = town;
}
@Override public void request(long n) {
executor.submit(()-> {
// Subscriber가 만든 요청을 한개씩 반복
for (long i = 0l; i < n; i++) {
try {
// 현재 온도를 Subscriber로 전달
subscriber.onNext(TempInfo.fetch(town));
} catch (Exception ex) {
// 온도 가져오기를 실패하면 Subscriber로 에러를 전달
subscriber.onError(ex);
break;
}
}
});
}
@Override public void cancel() {
// 구독이 취소되면 완료(onComplete) 신호를 Subscriber로 전달
subscriber.onComplete();
}
}
|
19fbb782-c58e-4fb8-bef9-c4100852badf | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-01-05T06:28:36", "repo_name": "ganesh2shiv/vedicnerd-blog-theme", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1120, "line_count": 33, "lang": "en", "doc_type": "text", "blob_id": "f0c2ff6df67fba78d34b2c74a1f85cd8bb9ff358", "star_events_count": 6, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/ganesh2shiv/vedicnerd-blog-theme | 252 | FILENAME: README.md | 0.224055 | Vedic Nerd 1.1
==============
A modified version of [Manifest](https://theme.wordpress.com/themes/manifest/) (a minimalistic Wordpress theme)
Screenshot
----------

**Note: It's not responsive. So it probably won't look good on mobile devices.**
(I know it sucks. But you can check out [this link](https://github.com/PotHix/manifest-wordpress-theme-responsive) if it helps. And [here's the github link](https://github.com/jbarraud/Manifest) of the original Manifest theme)
License
-------
Copyright 2013 Ganesh Mohan
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. |
c2eebd08-ad02-4cc6-997d-3d646c90472d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-22 11:13:23", "repo_name": "yollpoll/CardShop", "sub_path": "/app/src/main/java/com/cardshop/cardshop/View/Activity/SettingActivity.java", "file_name": "SettingActivity.java", "file_ext": "java", "file_size_in_byte": 1077, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "2864dba3335390b7a988555188f676e230a20dad", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yollpoll/CardShop | 193 | FILENAME: SettingActivity.java | 0.243642 | package com.cardshop.cardshop.View.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import com.cardshop.cardshop.Base.BaseActivity;
import com.cardshop.cardshop.Contract.SettingContract;
import com.cardshop.cardshop.PresenterImpl.SettingPresenterImpl;
import com.cardshop.cardshop.R;
import com.cardshop.cardshop.View.Fragment.SettingFragment;
public class SettingActivity extends BaseActivity {
public static void gotoSettingActivity(Context context) {
Intent intent = new Intent(context, SettingActivity.class);
context.startActivity(intent);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
initView();
initData();
}
@Override
protected void initData() {
super.initData();
new SettingPresenterImpl((SettingContract.IView) loadBaseFragment(SettingFragment.newInstance()));
}
}
|
de6bc459-f003-434d-9532-00a8f08010dc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-29 04:20:29", "repo_name": "hgongguo/SpringBootSample", "sub_path": "/src/main/java/com/redis/RedisTest.java", "file_name": "RedisTest.java", "file_ext": "java", "file_size_in_byte": 1011, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "51719fcddee3d479a24c5349fd3c096efc52a045", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hgongguo/SpringBootSample | 301 | FILENAME: RedisTest.java | 0.249447 | package com.redis;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
/**
* Created by hgg on 2019/10/29.
*/
public class RedisTest {
public static void main(String[] args) {
Jedis jedis = new Jedis("127.0.0.1",6379);
jedis.set("test","Hello");
System.out.println(jedis.get("test"));
jedis.close();
/*JedisPool jedisPool = new JedisPool("127.0.0.1",6379);
Jedis jedis1 = jedisPool.getResource();
System.out.println("pool————:"+jedis1.get("hgg"));
jedis1.close();*/
Jedis jedistest = new Jedis("192.168.133.130",6379);
jedistest.set("test","Hello");
System.out.println(jedistest.get("test"));
jedistest.close();
JedisPool jedisPool = new JedisPool("192.168.133.130",6379);
Jedis jedis1 = jedisPool.getResource();
jedis1.set("hgg","linux-hgg");
System.out.println("pool————:"+jedis1.get("hgg"));
jedis1.close();
}
}
|
2655ba20-c3b0-49ab-9d23-2bd8c9c3ecfd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-20 12:49:55", "repo_name": "sanchezalejandro86/rrhh", "sub_path": "/src/main/java/ar/com/vault/dto/DepartmentClientDto.java", "file_name": "DepartmentClientDto.java", "file_ext": "java", "file_size_in_byte": 1085, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "976ad5aae72e031b32fc7fc9798f64a981d9253d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sanchezalejandro86/rrhh | 242 | FILENAME: DepartmentClientDto.java | 0.210766 | package ar.com.vault.dto;
import io.swagger.annotations.ApiModelProperty;
/**
* Created by alejandro on 17/11/18.
*/
public class DepartmentClientDto {
@ApiModelProperty(notes = "El nombre del departamento")
private String name;
@ApiModelProperty(notes = "El ID del manager")
private Long managerId;
@ApiModelProperty(notes = "El ID de la ubicación")
private Long locationId;
public DepartmentClientDto(String name, Long managerId, Long locationId) {
this.name = name;
this.managerId = managerId;
this.locationId = locationId;
}
public DepartmentClientDto() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getManagerId() {
return managerId;
}
public void setManagerId(Long managerId) {
this.managerId = managerId;
}
public Long getLocationId() {
return locationId;
}
public void setLocationId(Long locationId) {
this.locationId = locationId;
}
}
|
186d6203-ab1c-4da1-a45b-13b1f2d783ea | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-02 06:56:07", "repo_name": "sarailaraselenium02/scenic", "sub_path": "/src/test/java/com/scenic/config/BaseConfig.java", "file_name": "BaseConfig.java", "file_ext": "java", "file_size_in_byte": 1089, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "764e91cf6eb6b35b903469b336aff160a9f2a277", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sarailaraselenium02/scenic | 235 | FILENAME: BaseConfig.java | 0.26588 | package com.scenic.config;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class BaseConfig {
private WebDriver driver;
public BaseConfig(WebDriver driver) {
this.driver = driver;
}
public WebDriver chromeDriverConection() {
System.setProperty("webdriver.chrome.driver", "chromedriver\\chromedrivers.exe");
driver = new ChromeDriver();
return driver;
}
public void setText(By locator, String text) {
driver.findElement(locator).sendKeys(text);
}
public void click(By locator) {
driver.findElement(locator).click();
}
public boolean isDisplayed(By locator) {
try {
return driver.findElement(locator).isDisplayed();
} catch (org.openqa.selenium.NoSuchElementException e) {
return false;
}
}
public void setURL(String url) {
driver.get(url);
}
public void setTime(int time) {
driver.manage().timeouts().implicitlyWait(time, TimeUnit.SECONDS);
}
public void setWindowMaximize() {
driver.manage().window().maximize();
}
}
|
d836185f-7845-4129-9e9e-e4221424e909 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-08-09 17:22:49", "repo_name": "mpgarate/DropSearch", "sub_path": "/src/main/java/edu/nyu/mpgarate/dropsearch/util/IOUtil.java", "file_name": "IOUtil.java", "file_ext": "java", "file_size_in_byte": 1120, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "5a505e98f76cbc230642d7087c4776b248917b23", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mpgarate/DropSearch | 214 | FILENAME: IOUtil.java | 0.242206 | package edu.nyu.mpgarate.dropsearch.util;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
/**
* Created by mike on 4/14/15.
*/
public final class IOUtil {
/**
* http://stackoverflow.com/questions/4328711/read-url-to-string-in-few-lines-of-java-code
* @param url
*/
public static String getURLAsString(URL url) throws IOException {
URLConnection connection = url.openConnection();
String contentType = connection.getHeaderField("Content-Type");
if (!contentType.contains("text/html")){
return null;
}
BufferedReader reader = new BufferedReader(
new InputStreamReader(connection.getInputStream(),
StandardCharsets.UTF_8)
);
StringBuilder sb = new StringBuilder();
String line;
while ((line = reader.readLine()) != null){
sb.append(line);
}
reader.close();
return sb.toString();
}
}
|
0695bf82-9314-40d3-b523-bef2687719ee | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-12-22T09:13:57", "repo_name": "ianwinter/ian.io", "sub_path": "/_posts/2007-02-12-xpath-is-my-new-friend.md", "file_name": "2007-02-12-xpath-is-my-new-friend.md", "file_ext": "md", "file_size_in_byte": 1030, "line_count": 17, "lang": "en", "doc_type": "text", "blob_id": "aac301332d6c9dd43e38a943816aa2e4ff1cf04c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ianwinter/ian.io | 296 | FILENAME: 2007-02-12-xpath-is-my-new-friend.md | 0.274351 | ---
layout: post
status: publish
title: XPath is my new friend
date: '2007-02-12 22:29:00 +0000'
date_gmt: '2007-02-12 22:29:00 +0000'
tags:
- coldfusion
- xml
- xpath
- code
---
Doing something at work which involves me grabbing an XML feed from a third party provider on a daily basis then sticking it in a database so it can be reused as the feed only updates at midnight GMT.
Quite an easy task, cfhttp the file, loop over it, insert to the database. Well, this was made even easier by me discovering the entirely not new <a href="http://en.wikipedia.org/wiki/XPath">XPath</a> (or <a href="http://www.w3.org/TR/xpath">here</a>). Another quick google found a <a href="http://www.w3schools.com/xpath/default.asp">tutorial</a> and after a quick play using xmlParse() and xmlSearch() in Coldfusion 7 my feed was filtered and inserted for reuse. It's been around for a while, but, if you're using CF7 and working with XML and haven't seen XPath I suggest you take a look.
Quite nice as well as I actually learned something today!
|
ec1d5fdc-eccd-4d6d-b441-d813a1e9d441 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-19 03:48:38", "repo_name": "gordonwu66/pokemon-collector", "sub_path": "/src/Pokemon.java", "file_name": "Pokemon.java", "file_ext": "java", "file_size_in_byte": 1076, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "e559d685201fec8d42ef1515ffbc71fcf7b4e8a3", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gordonwu66/pokemon-collector | 262 | FILENAME: Pokemon.java | 0.264358 | /*
* Main Pokemon entities to encapsulate different stats and be encountered/collected
*/
public class Pokemon {
// From 1 to 100 and used to calculate other stats
private int lvl;
// From 1 to 100 and used for encounter appearances and catch difficulty
private int rarity;
private int dexId;
private String nickname;
// Combat stats
private int hp;
private int att;
//private int def;
//private int spe;
public Pokemon(int dexIdIn, String nicknameIn) {
dexId = dexIdIn;
nickname = nicknameIn;
lvl = 1;
rarity = 1;
// Calculate combat stats based on level
hp = 10;
att = 1;
}
public int getHp() {
return hp;
}
public int getAtt() {
return att;
}
/*
* Display info and stats of individual pokemon using player's pokedex
*/
public String identify(Pokedex dex) {
return dex.getDex().get(dexId).getName();
}
public String toString() {
return "Pokemon: " +dexId +", " +nickname;
}
}
|
748bd117-fe8a-4f11-890a-16f49be3f75a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-24 15:51:16", "repo_name": "71mY4ng/learnJava", "sub_path": "/src/main/java/com/company/net/SourceViewer2.java", "file_name": "SourceViewer2.java", "file_ext": "java", "file_size_in_byte": 1101, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "fd0039a651ea47a022df5918a71e742ccf00f49d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/71mY4ng/learnJava | 200 | FILENAME: SourceViewer2.java | 0.261331 | package com.company.net;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
/**
* Download web page by URLConnection
*/
public class SourceViewer2 {
public static void main(String[] args) {
if (args.length > 0) {
try {
URL u = new URL(args[0]);
URLConnection conn = u.openConnection();
try (InputStream raw = conn.getInputStream()) {
InputStream buffer = new BufferedInputStream(raw);
// inputstream 串链到reader
Reader reader = new InputStreamReader(buffer);
int c;
while ((c = reader.read()) != -1) {
System.out.println((char) c);
}
}
} catch (MalformedURLException e) {
e.printStackTrace();
System.err.println(args[0] + "is not a parseable url!");
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
|
e4650c4b-d4fb-427b-a112-188b4480fd73 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-29 15:02:01", "repo_name": "HubertYoung/AcFun", "sub_path": "/acfun5_7/src/main/java/com/igexin/push/extension/distribution/basic/l/n.java", "file_name": "n.java", "file_ext": "java", "file_size_in_byte": 1121, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "28f45c6c4706a532c014525d19f35679f91d0b79", "star_events_count": 6, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/HubertYoung/AcFun | 213 | FILENAME: n.java | 0.291787 | package com.igexin.push.extension.distribution.basic.l;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import com.igexin.push.core.g;
public class n {
public static Bitmap a(Drawable drawable) {
return drawable != null ? ((BitmapDrawable) drawable).getBitmap() : null;
}
public static Drawable a(String str) {
PackageManager packageManager = g.f.getPackageManager();
try {
return packageManager.getApplicationInfo(str, 0).loadIcon(packageManager);
} catch (NameNotFoundException unused) {
return null;
}
}
public static Bitmap b(String str) {
if (str != null) {
Bitmap decodeFile;
try {
decodeFile = BitmapFactory.decodeFile(str);
} catch (Exception unused) {
}
return decodeFile != null ? decodeFile : null;
}
}
}
|
0363c217-10a6-4c50-94e8-4d968a0accb6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-06-28 04:49:21", "repo_name": "yangdongpo418/pwc", "sub_path": "/app/src/main/java/com/pwc/sdc/recruit/data/remote/RetrofitHelper.java", "file_name": "RetrofitHelper.java", "file_ext": "java", "file_size_in_byte": 1034, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "93abf25e94db7e5d5b39fed0aa7c33b4da908da0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yangdongpo418/pwc | 212 | FILENAME: RetrofitHelper.java | 0.243642 | package com.pwc.sdc.recruit.data.remote;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* @author:dongpo 创建时间: 6/20/2016
* 描述:
* 修改:
*/
public class RetrofitHelper {
private final Retrofit mRetrofit;
private final BackPointService mBackPointService;
private static RetrofitHelper client = new RetrofitHelper();
private static final String BASE_URL = "http://apicloud.mob.com/v1/weather/query/";
private RetrofitHelper(){
mRetrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create()).build();
mBackPointService = mRetrofit.create(BackPointService.class);
}
public static RetrofitHelper getInstance(){
return client;
}
public BackPointService getService(){
return mBackPointService;
}
}
|
f535f4ae-9afe-46da-9e1b-5b06a0c72d2f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-01-10T03:50:23", "repo_name": "smallpaes/google-map-api-practice-map", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1066, "line_count": 57, "lang": "en", "doc_type": "text", "blob_id": "0a8ecebe179ed98deb58630c4ed2404f066ed9de", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/smallpaes/google-map-api-practice-map | 289 | FILENAME: README.md | 0.286169 | # # Google Api Practice: Map
This project is built with Vue.js and Google Map API, and is used to practice creating map, marker, and info window on a single page application.
## Project First Look

<p> </p>
## Project setup
### Clone
Clone this repository to your local machine
```
$ git clone https://github.com/smallpaes/google-map-api-practice-map.git
```
### Setup App
**1. Enter the project folder**
```
$ cd google-map-api-practice-map
```
**2. Install packages via npm**
```
$ npm install
```
**3. Place Google Map Project API Key**
> /public/index.html
```
<script src="https://maps.googleapis.com/maps/api/js?key=<YOUR_API_KEY>"></script>
```
**4. Compiles and hot-reloads for development**
```
$ npm run serve
```
**5. Visit the page**
```
http://localhost:8080/#/restaurants
```
___
## Related Blog Post
- [Medium: [筆記] 從零接觸 Google Map API:在 Vue.js 中實作地圖、地標、訊息視窗](http://tiny.cc/aibdez)
## Authors
- [Mike Huang](https://github.com/smallpaes) |
9a6996b6-2a67-4074-a250-34ce6d9f9e10 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-07 12:17:27", "repo_name": "RottingAlien/theisledmgcalc", "sub_path": "/src/main/java/rottingalien/theisledmgcalc/dinos/herbivores/puertasaurus/Puertasaurus.java", "file_name": "Puertasaurus.java", "file_ext": "java", "file_size_in_byte": 1029, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "682cd32540334dff987235e74cf98456445f6e17", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/RottingAlien/theisledmgcalc | 256 | FILENAME: Puertasaurus.java | 0.273574 | package rottingalien.theisledmgcalc.dinos.herbivores.puertasaurus;
import rottingalien.theisledmgcalc.Dino;
import rottingalien.theisledmgcalc.GrowthState;
public class Puertasaurus extends Dino {
public Puertasaurus() {
wire();
}
public void wire() {
setName("Puertasaurus");
setCarnivore(false);
setTier(6);
setGrowthDurationJuvi(0);
setGrowthDurationSub(0);
setGrowthDurationAdult(0);
setGrowthDurationTotal(getGrowthDurationJuvi() + getGrowthDurationSub() + getGrowthDurationAdult());
//----- ADULT
GrowthState fullAdult = new GrowthState(
"Full Adult",
12.3,
0,
0,
0,
0,
0,
49895,
49895,
5000,
0,
0,
0,
0,
"puerta");
getGrowthStates().put("Full Adult", fullAdult);
}
}
|
be33b07e-d444-4bcd-a7ff-3fbb1b402527 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-29 12:16:39", "repo_name": "Thornchoc/mag", "sub_path": "/src/test/java/com/thorntons/pages/AccountPage.java", "file_name": "AccountPage.java", "file_ext": "java", "file_size_in_byte": 1067, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "1bb7ae6ff492748bc8c707e467d2b4c2334cb18f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Thornchoc/mag | 209 | FILENAME: AccountPage.java | 0.235108 | package com.thorntons.pages;
import io.magentys.cinnamon.webdriver.collections.PageElementCollection;
import io.magentys.cinnamon.webdriver.elements.PageElement;
import io.magentys.cinnamon.webdriver.support.FindByKey;
import org.openqa.selenium.support.FindBy;
import static io.magentys.cinnamon.webdriver.conditions.ElementConditions.*;
public class AccountPage {
@FindBy(css = "#primary > .h1 ")
private PageElement myAccountTitle;
@FindBy(css = ".account-options>li>a>h2")
private PageElementCollection accountOptions;
public boolean isUserNameDisplayed(String name) {
return myAccountTitle.waitUntil((textContainsIgnoreCase(name))).isDisplayed();
}
public void clickPersonalDataOption() {
clickAccountOption("Personal Data");
}
public void clickAccountOption(String option) {
accountOptions.first(textContainsIgnoreCase(option).and(displayed).and(enabled)).click();
}
public void clickAddressesOption() {
clickAccountOption("Addresses");
}
}
|
d9070d2a-6afe-4c32-b9be-d3ee0bbfbd3f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-06 16:40:38", "repo_name": "singinglia/Ancestory-Mapping-Server", "sub_path": "/SharedFamilyFiles/src/results/EventResult.java", "file_name": "EventResult.java", "file_ext": "java", "file_size_in_byte": 1033, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "4f67655420992b50e98234ae05b5e9b1968e9966", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/singinglia/Ancestory-Mapping-Server | 194 | FILENAME: EventResult.java | 0.274351 | package results;
public class EventResult extends BasicResult{
private String eventID;
private String associatedUsername;
private String personID;
private Float latitude;
private Float longitude;
private String country;
private String city;
private String eventType;
private Integer year;
public EventResult(String eventID, String username, String personID, float latitude, float longitude,
String country, String city, String eventType, int year) {
this.eventID = eventID;
this.associatedUsername = username;
this.personID = personID;
this.latitude = latitude;
this.longitude = longitude;
this.country = country;
this.city = city;
this.eventType = eventType;
this.year = year;
}
public EventResult(boolean isSuccessful, String errorMessage) {
super(isSuccessful, errorMessage);
}
public String getEventID() {
return eventID;
}
}
|
e5d968b9-8a50-4aeb-848e-f18a3f830383 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-28 03:50:57", "repo_name": "KaiserDeng/ks-sdk-boot", "sub_path": "/src/main/java/com/haihun/pay/PayCallBackUrlConst.java", "file_name": "PayCallBackUrlConst.java", "file_ext": "java", "file_size_in_byte": 1183, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "d439283b623e12f41b9366ba3818feb05419c6f6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/KaiserDeng/ks-sdk-boot | 339 | FILENAME: PayCallBackUrlConst.java | 0.235108 | package com.haihun.pay;
/**
* 支付回调常量类
*
* @author kaiser·von·d
* @version 2018/5/2
*/
public class PayCallBackUrlConst {
private static boolean isDev = true;
/**
* 支付宝回调接口
*/
public static final String ALIPAY_CALL_BACK_URL ;
/**
* 微信支付回调接口
*/
public static final String WECHAT_PAY_CALL_BACK_URL;
// public static final String WECHAT_PAY_CALL_BACK_URL = "http://17586q9d82.iask.in/pay/weChatPayCallBack";
/**
* 银联支付回调接口
*/
public static final String UNION_PAY_CALL_BACK_URL ;
static{
if (isDev) {
ALIPAY_CALL_BACK_URL = "http://17586q9d82.iask.in/pay/alipayCallBack";
WECHAT_PAY_CALL_BACK_URL = "http://17586q9d82.iask.in/pay/weChatPayCallBack";
UNION_PAY_CALL_BACK_URL = "http://17586q9d82.iask.in/pay/testpay";
} else {
ALIPAY_CALL_BACK_URL = "http://pay.haihungame.com/pay/alipayCallBack";
WECHAT_PAY_CALL_BACK_URL = "http://pay.haihungame.com/pay/weChatPayCallBack";
UNION_PAY_CALL_BACK_URL = "http://pay.haihungame.com/pay/testpay";
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.