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 |
|---|---|---|---|---|---|---|
822ccbfc-9e80-4332-b815-5457dfb3d97a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-23 22:06:05", "repo_name": "tchintalapudi/tej-soundcloud-challenge", "sub_path": "/src/main/java/com/followermaze/utils/PropertyUtils.java", "file_name": "PropertyUtils.java", "file_ext": "java", "file_size_in_byte": 1043, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "2751aa20151473a6ae0f8999288c9c7473b9a3a6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tchintalapudi/tej-soundcloud-challenge | 186 | FILENAME: PropertyUtils.java | 0.256832 | package com.followermaze.utils;
import com.followermaze.Application;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* Property file reader.
*/
public class PropertyUtils {
private static final String CONFIG_FILENAME = "config.properties";
private static final Logger logger = Logger.getLogger(PropertyUtils.class);
public static Properties getProperties() {
try (InputStream input = Application.class.getClassLoader().getResourceAsStream(CONFIG_FILENAME)) {
logger.info("Reading properties file");
Properties prop = new Properties();
if (input == null) {
logger.error("Unable to find file: "+CONFIG_FILENAME);
}
//load a properties file from class path, inside static method
prop.load(input);
return prop;
} catch (IOException ex) {
logger.error("Error reading configuration file");
}
return null;
}
}
|
2cafb986-f098-4f34-b740-5d8db5dd2642 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-01 00:55:18", "repo_name": "maytic/pokemon-db", "sub_path": "/src/main/java/com/maytic/pokemondb/Exceptions/ExceptionResponse.java", "file_name": "ExceptionResponse.java", "file_ext": "java", "file_size_in_byte": 1012, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "a7959c0be16496a6bf49fb095a228fba9d9990c2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/maytic/pokemon-db | 196 | FILENAME: ExceptionResponse.java | 0.225417 | package com.maytic.pokemondb.Exceptions;
import java.util.Date;
/**
* basic Exception response containing a time stamp for the time of exception
* a message from the exception and the details of the exception
*/
public class ExceptionResponse {
private Date timeStamp;
private String message;
private String details;
// removes default constructor
private ExceptionResponse(){
}
/**
* constructs ExceptionsResponse with variables
* @param timeStamp - time stamp of exception
* @param message - message sent from web service
* @param details - details from exception
*/
public ExceptionResponse(Date timeStamp, String message, String details) {
this.timeStamp = timeStamp;
this.message = message;
this.details = details;
}
public Date getTimeStamp() {
return timeStamp;
}
public String getMessage() {
return message;
}
public String getDetails() {
return details;
}
}
|
5b675d40-9f16-4a14-8ff1-88205464aa12 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-28 01:54:32", "repo_name": "xuminghao-upup/learn", "sub_path": "/core/src/main/java/com/pty/grape2/core/enums/ServiceEnum.java", "file_name": "ServiceEnum.java", "file_ext": "java", "file_size_in_byte": 1235, "line_count": 79, "lang": "en", "doc_type": "code", "blob_id": "375ece66df41fd2d0bb6c3f040546a1ad21b92f7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xuminghao-upup/learn | 298 | FILENAME: ServiceEnum.java | 0.290176 | package com.pty.grape2.core.enums;
import java.util.ArrayList;
import java.util.List;
public enum ServiceEnum {
/**
* 不可用
*/
DISABLE(0),
/**
* 可用
*/
AVAILABLE(1),
/**
* 未安装
*/
NOT_INSTALLED(10),
/**
* 已安装
*/
INSTALLED(11),
/**
* 已停止
*/
STOP(12),
/**
* 启动中
*/
STARTING(13),
/**
* 运行中
*/
RUNNING(14);
private int code;
ServiceEnum(int code) {
this.code = code;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public static List<Integer> toList(){
List<Integer> list = new ArrayList<>();
ServiceEnum[] serviceEnums = ServiceEnum.values();
for(ServiceEnum e : serviceEnums) {
list.add(e.getCode());
}
return list;
}
public static ServiceEnum getById(Integer code) {
for (ServiceEnum serviceEnum : values()) {
if (serviceEnum.getCode() == code) {
//获取指定的枚举
return serviceEnum;
}
}
return null;
}
}
|
4ffab91b-402c-49f6-bad1-52d3c334b828 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-13 08:05:17", "repo_name": "Aiome/step-spring", "sub_path": "/step-spring-smart-framework-example/src/main/java/top/aiome/aspect/ControllerAspect.java", "file_name": "ControllerAspect.java", "file_ext": "java", "file_size_in_byte": 1199, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "2979749e3bf0a38256e877d0de99ca370bc87df1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Aiome/step-spring | 253 | FILENAME: ControllerAspect.java | 0.277473 | package top.aiome.aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Method;
import top.aiome.step.spring.smart.framework.annotation.Aspect;
import top.aiome.step.spring.smart.framework.annotation.Controller;
import top.aiome.step.spring.smart.framework.proxy.AspectProxy;
/**
* Description: 拦截 Controller 所有方法<br>
*
* @author mahongyan 2019-08-11 13:41
*/
@Aspect(Controller.class)
public class ControllerAspect extends AspectProxy {
private static final Logger logger = LoggerFactory.getLogger(ControllerAspect.class);
private long begin;
@Override
public void before(Class<?> cls, Method method, Object[] params) throws Throwable {
logger.info("---------- begin ----------");
logger.info(String.format("class:%s", cls.getName()));
logger.info(String.format("method:%s", method.getName()));
begin = System.currentTimeMillis();
}
@Override
public void after(Class<?> cls, Method method, Object[] params, Object result) throws Throwable {
logger.info("time: " + (System.currentTimeMillis() - begin) + "ms");
logger.info("----------- end -----------");
}
}
|
cd14095c-d251-4082-b58a-762def921bea | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-08-04T09:28:39", "repo_name": "lrrp/stormpath-spring-boot-war-example", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1082, "line_count": 67, "lang": "en", "doc_type": "text", "blob_id": "d3bb55e845986d4c70fc5c1153d9c39afe0617a6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lrrp/stormpath-spring-boot-war-example | 301 | FILENAME: README.md | 0.259826 | # WAR files with Spring Boot
This is the code developed in the tutorial on deploying Spring Boot apps as a WAR.
It modifies an existing simple REST app https://github.com/stormpath/stormpath-spring-boot-jpa-example
### Requirements
- Maven
- JDK 7
- Tomcat 7
### Running
To build and start the server simply type
```sh
$ mvn spring-boot:run
```
from the root directory.
### Deploying on Tomcat
First build the WAR with
```sh
$ mvn clean package
```
Then copy the output WAR to Tomcat's webapps directory.
On Ubuntu the command is
```sh
$ sudo cp target/demo-0.0.1-SNAPSHOT.war /var/lib/tomcat7/webapps/demo.war
```
### Using
You can see what urls are available using curl:
```sh
$ curl localhost:8080/demo
```
You can view existing people objects using a similar request:
```sh
$ curl localhost:8080/demo/persons
```
and can create new ones using a POST:
```sh
$ curl -X POST -H "Content-Type:application/json" -d '{ "firstName" : "Karl", "lastName" : "Penzhorn" }' localhost:8080/demo/persons
```
### Todo
- Different build profiles
### License
----
MIT
|
746bdd7c-a46c-41f5-8148-29c411e62200 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-07 05:20:28", "repo_name": "fandeus/CommonLibrary", "sub_path": "/app/src/main/java/com/common/libraries/ActivityCommonTest.java", "file_name": "ActivityCommonTest.java", "file_ext": "java", "file_size_in_byte": 1223, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "2b45ed5ea2fbdbf20f217aa50b8544beacfff08d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/fandeus/CommonLibrary | 214 | FILENAME: ActivityCommonTest.java | 0.262842 | package com.common.libraries;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class ActivityCommonTest extends ActivityBase {
private RelativeLayout mSearchHint;
private LinearLayout mSearchBox;
private TextView mCancelText;
@Override
int getContentView() {
return R.layout.activity_common_test;
}
@Override
public void initViews() {
mSearchHint = findViewById(R.id.relative_layout_search_hint_box);
mSearchBox = findViewById(R.id.linear_layout_search_box);
mCancelText = findViewById(R.id.text_view_search_cancel);
mSearchHint.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mSearchHint.setVisibility(View.GONE);
mSearchBox.setVisibility(View.VISIBLE);
}
});
mCancelText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mSearchHint.setVisibility(View.VISIBLE);
mSearchBox.setVisibility(View.GONE);
}
});
}
}
|
6a316cf4-e697-4cff-bf13-c7e7b6f57527 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-16 13:05:24", "repo_name": "danisandika/FutsalMateII", "sub_path": "/src/java/controller/TbRatingFacade.java", "file_name": "TbRatingFacade.java", "file_ext": "java", "file_size_in_byte": 968, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "c554e22b02c653d2ad7efcf7960559c0b13a4d0c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/danisandika/FutsalMateII | 211 | FILENAME: TbRatingFacade.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 controller;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import model.TbMatchteam;
import model.TbRating;
/**
*
* @author Danis
*/
@Stateless
public class TbRatingFacade extends AbstractFacade<TbRating> {
@PersistenceContext(unitName = "FutsalMateIIPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public TbRatingFacade() {
super(TbRating.class);
}
public List<TbRating> getRatingBy(Integer id){
return em.createQuery("SELECT t FROM TbRating t WHERE t.idFutsal.idFutsal = :id")
.setParameter("id", id)
.getResultList();
}
}
|
bb3a040b-47f2-416e-a8f1-1b54b5abcf4e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-18 06:18:41", "repo_name": "minhdat1602/2021_mobile_group17_backend", "sub_path": "/src/main/java/com/nlu/entity/CartItemEntity.java", "file_name": "CartItemEntity.java", "file_ext": "java", "file_size_in_byte": 1088, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "8431c708fca4374e8b8a97c94c72e2e88919ebfe", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/minhdat1602/2021_mobile_group17_backend | 221 | FILENAME: CartItemEntity.java | 0.252384 | package com.nlu.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;
@Entity
@Table(name = "cart_item")
public class CartItemEntity extends BaseEntity{
@JsonBackReference
@ManyToOne
@JoinColumn(name = "cart_id")
private CartEntity cart;
@JsonManagedReference
@ManyToOne
@JoinColumn(name = "inventory_id", referencedColumnName = "id")
private InventoryEntity inventory;
@Column(name = "quantity")
private Integer quantity;
public CartEntity getCart() {
return cart;
}
public void setCart(CartEntity cart) {
this.cart = cart;
}
public InventoryEntity getInventory() {
return inventory;
}
public void setInventory(InventoryEntity inventory) {
this.inventory = inventory;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
}
|
65202bb8-5917-44e6-a15f-19f868a84300 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-22 02:38:42", "repo_name": "webtutsplus/social-network-backend", "sub_path": "/src/main/java/com/simplecoding/social/service/UserService.java", "file_name": "UserService.java", "file_ext": "java", "file_size_in_byte": 1156, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "343b3fbe866fb92e66c1025e661f3818236a36e3", "star_events_count": 5, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/webtutsplus/social-network-backend | 209 | FILENAME: UserService.java | 0.264358 | package com.simplecoding.social.service;
import com.simplecoding.social.auth.models.UserDto;
import com.simplecoding.social.model.User;
import com.simplecoding.social.repo.UserRepository;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class UserService {
@Autowired
UserRepository userRepository;
@Autowired
ModelMapper modelMapper;
public void saveUser(UserDto userDto) {
Optional<User> optionalUser = userRepository.findByEmail(userDto.getEmail());
if (!optionalUser.isPresent()) {
// insert new user
User user = modelMapper.map(userDto, User.class);
userRepository.save(user);
}
}
public User getUser(String email) {
Optional<User> optionalUser = userRepository.findByEmail(email);
if (optionalUser.isPresent()) {
return optionalUser.get();
}
return null;
}
public List<User> getAllUsers() {
return userRepository.findAll();
}
}
|
4f24583d-7985-488f-b225-6b88f7cede89 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-05-23 00:30:21", "repo_name": "ChanaLieba/mco152-spring-2014", "sub_path": "/src/stein/weathermap/WeatherFrameThread.java", "file_name": "WeatherFrameThread.java", "file_ext": "java", "file_size_in_byte": 992, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "2bebe7dcdf89f6f69aeae3111630c33b8eb954d0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ChanaLieba/mco152-spring-2014 | 219 | FILENAME: WeatherFrameThread.java | 0.282196 | package stein.weathermap;
import java.io.IOException;
import javax.swing.JPanel;
import javax.swing.JTextArea;
public class WeatherFrameThread extends Thread {
private String city;
private WeatherMain wm;
private JTextArea conditionsLabel;
private TheChart chart;
public void run() {
try {
wm = new WeatherMain(city);
conditionsLabel.setText(wm.getWeather());
chart.setWm(wm);
chart.setWc(wm.getWeatherCondition());
chart.setValues(wm.getWeatherCondition().getTemp());
chart.setNames(wm.getWeatherCondition().getTime());
chart.repaint();
} catch (IOException | NullPointerException e) {
conditionsLabel
.setText("There is a problem with the information you have provided, please try again");
}
}
public WeatherFrameThread(String city, JTextArea conditionsLabel,
TheChart chart) {
this.city = city;
this.conditionsLabel = conditionsLabel;
this.chart = chart;
// this.container = container;
}
}
|
895a64d8-bccb-422c-9d73-9f96372f601e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-24 08:18:43", "repo_name": "Jigzy08/luma-acceptance-test", "sub_path": "/src/test/java/com/lamtech/luma/pageObject/HomePagePO.java", "file_name": "HomePagePO.java", "file_ext": "java", "file_size_in_byte": 1068, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "17b587611767d97aa6fcfc9af0f6dafbc18488a8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Jigzy08/luma-acceptance-test | 217 | FILENAME: HomePagePO.java | 0.287768 | package com.lamtech.luma.pageObject;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class HomePagePO {
//Element Locator
@FindBy(linkText = "Create an Account")
//Declare WebElement Create Account
public static WebElement CreateAccountLink;
@FindBy(linkText = "Sign In")
public static WebElement SignInLink;
@FindBy(css = "body > div.page-wrapper > header > div.header.content > div.minicart-wrapper > a")
private static WebElement MiniCartButton;
//Initialize Elements using Selenium Webdriver
public HomePagePO(WebDriver driver) {
PageFactory.initElements(driver, this); //initialise all element on page to use Webdriver
}
//Page Specific Method
public void clickCreateAccount(){
CreateAccountLink.click();
}
public void clickSignIn(){
SignInLink.click();
}
public void clickMiniCart(){
MiniCartButton.click();
}
}
|
1ad3b012-29c7-4c84-9aa1-8d27b5a2bf5a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-05-05T08:18:06", "repo_name": "perfectwebtech/blog", "sub_path": "/content/posts/2018/11/properties-defined-outside-nodejs-modules-shared-between-requires.md", "file_name": "properties-defined-outside-nodejs-modules-shared-between-requires.md", "file_ext": "md", "file_size_in_byte": 1087, "line_count": 17, "lang": "en", "doc_type": "text", "blob_id": "a66e24cf5f696b11e1cb8b724db8a6497144dade", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/perfectwebtech/blog | 321 | FILENAME: properties-defined-outside-nodejs-modules-shared-between-requires.md | 0.255344 | ---
title: Properties Defined Outside NodeJS Modules Shared Between Requires
published: 2018-11-10T20:43:00+12:00
tags: [ "dev",]
---
If you use Node.js modules in any capacity, you may or may not benefit from the knowledge that properties defined outside the module are shared between every `require()` you call.
This is just a quick post, because I couldn't find anything right-away on the internet - so I ended up checking it out for myself.
I wanted to be able to call a module through require, so I could do some cleanup when my service received a `SIGHUP` or `SIGTERM` - and I didn't have to make my code any longer by defining it in a variable. I know, it's lazy and maybe a bad design pattern 😬


|
eaec5445-ef82-4777-a0e0-9f5876b65da6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-24 15:57:45", "repo_name": "AlexSuvorov2k/Paiste", "sub_path": "/app/src/main/java/ru/alexsuvorov/paistewiki/model/SupportAnatomy.java", "file_name": "SupportAnatomy.java", "file_ext": "java", "file_size_in_byte": 1156, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "fa9d7cfd7a62aed945cf4406cb092951e6d939b2", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/AlexSuvorov2k/Paiste | 248 | FILENAME: SupportAnatomy.java | 0.252384 | package ru.alexsuvorov.paistewiki.model;
import android.arch.persistence.room.ColumnInfo;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.Ignore;
import android.arch.persistence.room.PrimaryKey;
import android.support.annotation.NonNull;
import lombok.Getter;
import lombok.Setter;
@Entity(tableName = "support_anatomy")
public class SupportAnatomy {
@PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "anatomy_id")
@Getter @Setter @NonNull
public long anatomyId = 1;
@ColumnInfo(name = "anatomy_title")
@Getter @Setter
public String anatomyTitle;
@ColumnInfo(name = "anatomy_subtitle")
@Getter @Setter
public String anatomySubtitle;
@ColumnInfo(name = "anatomy_text")
@Getter @Setter
public String anatomyText;
public SupportAnatomy() {
}
@Ignore
public SupportAnatomy(@NonNull long anatomy_id, String anatomy_title, String anatomy_subtitle, String anatomy_text) {
this.anatomyId = anatomy_id;
this.anatomyTitle = anatomy_title;
this.anatomySubtitle = anatomy_subtitle;
this.anatomyText = anatomy_text;
}
}
|
63b7d417-1672-4e1e-a727-521079787fec | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-28 13:52:37", "repo_name": "wasim5390/KidsLauncher", "sub_path": "/app/src/main/java/com/uiu/kids/event/notification/LinkNotificationEvent.java", "file_name": "LinkNotificationEvent.java", "file_ext": "java", "file_size_in_byte": 1221, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "6568bdd5b2bbbe976c51f6919d8c17acd33bd2fc", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wasim5390/KidsLauncher | 242 | FILENAME: LinkNotificationEvent.java | 0.261331 | package com.uiu.kids.event.notification;
import com.uiu.kids.model.LinksEntity;
import com.uiu.kids.model.LocalNotificationModel;
import com.uiu.kids.model.NotificationSender;
import com.uiu.kids.ui.home.apps.AppsEntity;
public class LinkNotificationEvent {
LinksEntity linksEntity;
LocalNotificationModel localNotificationModel;
String message;
int status;
String image;
public LinkNotificationEvent(LinksEntity linksEntity, LocalNotificationModel notificationModel) {
this.linksEntity = linksEntity;
this.localNotificationModel = notificationModel;
this.message = notificationModel.getMessage();
this.status =notificationModel.getStatus();
this.image = notificationModel.getImage();
}
public LinksEntity getLinkEntity() {
return linksEntity;
}
public NotificationSender getSender() {
return localNotificationModel.getSender();
}
public String getMessage() {
return message;
}
public int getStatus() {
return status;
}
public String getImage() {
return image==null?"www.g":image;
}
public void setImage(String image) {
this.image = image;
}
}
|
af1c7d0d-a06b-494f-a333-bf309a100dba | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-28 02:17:02", "repo_name": "LeMikaelF/spring-mvc-fruitshop", "sub_path": "/src/main/java/com/mikaelfrancoeur/controllers/CategoryController.java", "file_name": "CategoryController.java", "file_ext": "java", "file_size_in_byte": 1085, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "272d3b3b2b059f356967bcd1e76cc532aa3d6762", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/LeMikaelF/spring-mvc-fruitshop | 197 | FILENAME: CategoryController.java | 0.220007 | package com.mikaelfrancoeur.controllers;
import com.mikaelfrancoeur.api.v1.dto.CategoryDTO;
import com.mikaelfrancoeur.api.v1.dto.CategoryListDTO;
import com.mikaelfrancoeur.services.CategoryService;
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;
@RestController
@RequestMapping(CategoryController.BASE_URL)
public class CategoryController {
public final static String BASE_URL = "/api/v1/categories/";
private final CategoryService categoryService;
public CategoryController(CategoryService categoryService) {
this.categoryService = categoryService;
}
@GetMapping
public CategoryListDTO listAllCategories() {
return new CategoryListDTO(categoryService.getAllCategories());
}
@GetMapping("{name}")
public CategoryDTO getCategoryByName(@PathVariable String name) {
return categoryService.getCategoryByName(name);
}
}
|
27b6cd17-6aaa-4e45-bde3-ac51d4dc8071 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-22 05:50:49", "repo_name": "xuxin511/BoduoAndroid", "sub_path": "/app/src/main/java/com/liansu/boduowms/ui/widget/TextUtils.java", "file_name": "TextUtils.java", "file_ext": "java", "file_size_in_byte": 1201, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "35d5f22883234982209a4a6cb1fa08daa83ce00a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xuxin511/BoduoAndroid | 290 | FILENAME: TextUtils.java | 0.290981 | package com.liansu.boduowms.ui.widget;
import android.graphics.Color;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
/**
* @ Des:
* @ Created by yangyiqing on 2020/7/19.
*/
public class TextUtils {
/**
* @desc: 一行数据变成两种颜色
* @param:
* @return:
* @author: Nietzsche
* @time 2020/7/19 14:02
*/
public static SpannableStringBuilder getColorTextString(String value1, String color1, String value2, String color2) {
SpannableStringBuilder span1 = new SpannableStringBuilder();
SpannableString spannableString = new SpannableString(value1);
spannableString.setSpan(new ForegroundColorSpan(Color.parseColor(color1)), 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
span1.append(spannableString);
SpannableString spannableString2 = new SpannableString(value2);
spannableString2.setSpan(new ForegroundColorSpan(Color.parseColor(color2)), 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
span1.append(spannableString2);
return span1;
}
}
|
c20cb19b-0b7f-4262-81a9-b4e3f5a917c5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-03-25 03:38:32", "repo_name": "jackcptdev/ProtobufDSL", "sub_path": "/src/main/java/protobufdsl/parse/ProtobufDslParseUtils.java", "file_name": "ProtobufDslParseUtils.java", "file_ext": "java", "file_size_in_byte": 1187, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "844faa231efc8dc85e0cf2df188335dd6f9d6584", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jackcptdev/ProtobufDSL | 249 | FILENAME: ProtobufDslParseUtils.java | 0.295027 | package protobufdsl.parse;
import org.antlr.runtime.ANTLRStringStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.tree.BufferedTreeNodeStream;
import org.antlr.runtime.tree.CommonTree;
import org.antlr.runtime.tree.TreeNodeStream;
import protobufdsl.parse.FormatterParserBuilder.start_return;
import protobufdsl.parse.tree.Start;
/**
* @author jackcptdev<jackcptdev@gmail.com>
* @version Mar 10, 2014 3:02:16 PM
*
*/
public class ProtobufDslParseUtils {
public static Start parse(String input) throws RecognitionException {
FormatterParserLexer lexer = new FormatterParserLexer(new ANTLRStringStream(input));
CommonTokenStream tokenStream = new CommonTokenStream(lexer);
FormatterParserParser parser = new FormatterParserParser(tokenStream);
CommonTree tree = (CommonTree) parser.start().getTree();
TreeNodeStream treeStream = new BufferedTreeNodeStream(tree);
FormatterParserBuilder treeBuilder = new FormatterParserBuilder(treeStream);
start_return ret = treeBuilder.start();
Start value = ret.value;
return value;
}
}
|
4b79de56-a52a-4345-b2f8-862d29615a48 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-09-17 03:48:27", "repo_name": "yangtech555/javaLearn", "sub_path": "/src/main/java/com/yhb/designPattern/bridge/BridgeMain.java", "file_name": "BridgeMain.java", "file_ext": "java", "file_size_in_byte": 1014, "line_count": 28, "lang": "en", "doc_type": "code", "blob_id": "d7ce95ac17c62e39a031ef3a02de9f906285967d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yangtech555/javaLearn | 216 | FILENAME: BridgeMain.java | 0.279042 | package com.yhb.designPattern.bridge;
/**
* Created by yanghongbo on 2018/8/20.
*/
public class BridgeMain {
public static void main(String[] args) {
//参数
Object param = new Object();
Receiver wxTemplateMessageForActivity = new WeixinTemplateMessage(new ActivityMessage(), null);
Receiver wxTemplageMessageForNormal = new WeixinTemplateMessage(new NormalMessage(), new TimeLimit());
wxTemplateMessageForActivity.send(param);
wxTemplageMessageForNormal.send(param);
Receiver smsForActivity = new SMS(new ActivityMessage(), new TimeLimit());
Receiver smsForNormal = new SMS(new NormalMessage(), new CountLimit());
smsForActivity.send(param);
smsForNormal.send(param);
Receiver appPushForActivity = new APPPush(new ActivityMessage(), new TimeLimit());
Receiver appPushForNormal = new APPPush(new NormalMessage(), null);
appPushForActivity.send(param);
appPushForNormal.send(param);
}
}
|
8610c2e7-0368-4cfe-88be-c4d14ae5c57e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-02 03:54:46", "repo_name": "zw23534572/dz-common-project", "sub_path": "/dz-common-mq/src/main/java/com/dazong/common/mq/job/ReTryNotifyJob.java", "file_name": "ReTryNotifyJob.java", "file_ext": "java", "file_size_in_byte": 1116, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "035ff66b7a25e615ce07a58ed890915d2c16b3c1", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/zw23534572/dz-common-project | 256 | FILENAME: ReTryNotifyJob.java | 0.23793 | package com.dazong.common.mq.job;
import com.dazong.common.mq.dao.mapper.MQMessageMapper;
import com.dazong.common.mq.domian.DZConsumerMessage;
import com.dazong.common.mq.domian.DZMessage;
import com.dazong.common.mq.manager.MQNotifyManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author huqichao
* @date 2017-10-31 18:23
**/
@Component
public class ReTryNotifyJob implements Job {
private Logger logger = LoggerFactory.getLogger(ReTryNotifyJob.class);
@Autowired
private MQMessageMapper messageMapper;
@Autowired
private MQNotifyManager notifyManager;
@Override
public void execute() {
List<DZConsumerMessage> messageList = messageMapper.queryConsumerMessageByStatus(DZMessage.STATUS_DOING);
logger.debug("定时重复通知未处理成功的消息:{}", messageList.size());
for (DZConsumerMessage message : messageList){
notifyManager.notifyMessage(message);
}
}
}
|
06538a97-365b-4514-8bdd-8c0e196760ab | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-20 04:07:15", "repo_name": "netollie/JwtSecurity", "sub_path": "/src/main/java/com/netollie/demo/util/JwtUtil.java", "file_name": "JwtUtil.java", "file_ext": "java", "file_size_in_byte": 1223, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "a9aac7bb1f226f95c222a8a58cee6a3c794440c6", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/netollie/JwtSecurity | 255 | FILENAME: JwtUtil.java | 0.290981 | package com.netollie.demo.util;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.netollie.demo.config.properties.JwtProperties;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.function.Function;
@Component
public class JwtUtil {
@Resource
private JwtProperties jwtProperties;
public String encode(String username) {
LocalDateTime now = LocalDateTime.now();
Function<LocalDateTime, Date> toDate = time -> Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
return JWT.create().withAudience(username)
.withIssuedAt(toDate.apply(now))
.withExpiresAt(toDate.apply(now.plusSeconds(jwtProperties.getLifespan())))
.sign(Algorithm.HMAC256(username + jwtProperties.getSecret()));
}
public DecodedJWT decode(String jwt, String username) {
JWTVerifier jwtVerifier = JWT.require(Algorithm.HMAC256(username + jwtProperties.getSecret())).build();
return jwtVerifier.verify(jwt);
}
}
|
caaab376-eb9d-4e9c-81ba-00fe20b70132 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-22 10:29:01", "repo_name": "git-sir/girl", "sub_path": "/src/main/java/com/imooc/listener/MyListener.java", "file_name": "MyListener.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "74428524f20595e5cd20443793441b5390e1353d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/git-sir/girl | 241 | FILENAME: MyListener.java | 0.264358 | package com.imooc.listener;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
/**
* Created by ucs_xiaokailin on 2017/5/16.
*/
@WebListener
public class MyListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
System.out.println(getClass().getSimpleName()+"执行contextInitialized方法");
String sourceName = servletContextEvent.getSource().getClass().getSimpleName();
System.out.println("触发此监听器的事件源 : "+sourceName);
//获取web.xml中在context-param标签配置的信息
// ServletContext servletContext = servletContextEvent.getServletContext();
// String paramName = "contextConfigLocation";
// String paramValue = servletContext.getInitParameter(paramName);
// System.out.println("读取web.xml中在context-param标签配置的值 : "+paramValue);
}
@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
System.out.println(getClass().getSimpleName()+"执行contextDestroyed方法");
}
}
|
86469e40-1cfc-4d9d-b509-a14085ffefbc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-18 12:25:54", "repo_name": "yokiyang/Bookstore_ssh", "sub_path": "/src/main/java/com/tz/bms/book/service/impl/BookServiceImpl.java", "file_name": "BookServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1201, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "ae2b9b3a2e32847d79881b73831dd51afb632530", "star_events_count": 4, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/yokiyang/Bookstore_ssh | 278 | FILENAME: BookServiceImpl.java | 0.26971 | package com.tz.bms.book.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.tz.bms.book.dao.IBookDao;
import com.tz.bms.book.service.IBookService;
import com.tz.bms.entity.Book;
import com.tz.bms.entity.Category;
import com.tz.bms.entity.Pageing;
/**
* 本来用来演示
*@author 杨倩Yoki
*@2016-12-28 @下午1:47:15
*/
@Service
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
public class BookServiceImpl implements IBookService {
@Resource
private IBookDao bookDao;
@Override
public Pageing queryBookByCondition(int now, int size, String cate) {
return bookDao.selectBookByCondition(now, size, cate);
}
@Override
public Book queryBookById(long id) {
return bookDao.selectBookById(id);
}
@Override
public Category querytById(long id) {
return bookDao.selectById(id);
}
@Override
public List<Category> selectAllCategory() {
return bookDao.selectAll();
}
}
|
03ffe16d-63c3-4ad3-a2f5-6078bf6cc4c3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-09-30 13:20:28", "repo_name": "Mash-Up-MapC/MapC-android", "sub_path": "/app/src/main/java/kr/mashup/mapc/ui/main/booking/BookingAdapter.java", "file_name": "BookingAdapter.java", "file_ext": "java", "file_size_in_byte": 1099, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "13e6cf934a00a17318df35a59a2e1d74fd2db28b", "star_events_count": 6, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Mash-Up-MapC/MapC-android | 205 | FILENAME: BookingAdapter.java | 0.276691 | package kr.mashup.mapc.ui.main.booking;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import java.util.ArrayList;
import kr.mashup.mapc.R;
import kr.mashup.mapc.data.Booking;
public class BookingAdapter extends RecyclerView.Adapter<BookingViewHolder> {
private ArrayList<Booking> dataList = new ArrayList<>();
@NonNull
@Override
public BookingViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new BookingViewHolder(
LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_booking, parent, false)
);
}
@Override
public void onBindViewHolder(@NonNull BookingViewHolder holder, int position) {
holder.setData(dataList.get(position));
}
@Override
public int getItemCount() {
return dataList.size();
}
public void addData(Booking booking) {
dataList.add(booking);
notifyItemInserted(dataList.size());
}
}
|
0065a31a-3175-42c6-b367-f3099ddd0ed9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-08-20T18:04:58", "repo_name": "maingockien01/learning-database", "sub_path": "/PostgreSQL/app.md", "file_name": "app.md", "file_ext": "md", "file_size_in_byte": 992, "line_count": 27, "lang": "en", "doc_type": "text", "blob_id": "0ec66d66152868478fc6d7502dd1c576a9c865c0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/maingockien01/learning-database | 288 | FILENAME: app.md | 0.261331 | # Overview
This is my small assignment of how to use PostgreSQL and Go Lang
The app will be simple and console-interaction.
The app will have the function of getting movies based on genre and actor. It will show all result for strict matching and top 5 (genres or actors) for fuzzy searching.
# Functions
- Receive command from the console. COMMAND will have a format of "[COMMAND] [DETAIL]". Each command will have their own detail.
- Print out the result (in other thread) - multithread processing
# Commands
READ_GENRES //print generes and position
READ_MOVIE title //strictly matching title
READ_ACTOR name //strictly matching if found, otherwise fuzzy searching
SIMILAR_MOVIES_GENRE 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 //genre type
SIMILAR_MOVIES title
INSERT_ACTOR name
INSERT_MOVIE title 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 // values of 18 genres
# Credit
The assignment is inspired by the book "7 Database in 7 weeks" - Chapter 2.
The data and the data model is from the book.
|
dc4fd1c6-7e2c-4463-80e8-23f0f1fa3aa1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-10-04T06:45:27", "repo_name": "dirigiblelabs/curriculum-2017", "sub_path": "/KalinaGeorgieva/ScriptingServices.md", "file_name": "ScriptingServices.md", "file_ext": "md", "file_size_in_byte": 1046, "line_count": 25, "lang": "en", "doc_type": "text", "blob_id": "369491c96c7607f34bc6c24027a897bf15063ee7", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dirigiblelabs/curriculum-2017 | 239 | FILENAME: ScriptingServices.md | 0.240775 | # **Create a Scripting Services.**
Follow these steps in order to create a scripting service for your Eclipse Dirigible application.
**Requirements**
* [Have at least one Project and Data Structure created.](https://github.com/dirigiblelabs/curriculum/tree/master/KalinaGeorgieva/DataStructures.md)
### Procedure
1. Right-click on the project and choose **New -> Scripting Service**.
2. Select the **JavaScript Entity Service on Table** and choose **Next**.
3. Select your table and add it into the project by choosing **Add**.
4. Select the **Target** and enter name im **File Name** field. Press **Finish**.
### Results:
**You have created**
1. Metadata descriptor for the Entity Services.
2. Service endpoint implementation script.
3. Swagger-compliant service definition.
4. Scripting Service implementation reusable module.
>In the Preview you can test the invocationa of the Scripting Service.
**Next step**
1. [**Create User Interfaces**](https://github.com/dirigiblelabs/curriculum/tree/master/KalinaGeorgieva/UserInterfaces.md).
|
21d8af14-84b6-4864-9a10-20c09a91c9b1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-02-07 07:00:26", "repo_name": "xub1997/springboot", "sub_path": "/autowired/customized_starter/src/main/java/com/xub/springboot/study/customized_stater/import_selecter/CustomizedImportSelector.java", "file_name": "CustomizedImportSelector.java", "file_ext": "java", "file_size_in_byte": 1321, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "a5bf2a8366c89e968ba5ff5e3bf002b0cadb56fa", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/xub1997/springboot | 251 | FILENAME: CustomizedImportSelector.java | 0.252384 | package com.xub.springboot.study.customized_stater.import_selecter;
import com.xub.springboot.study.customized_stater.EnabledCustomerStarter;
import com.xub.springboot.study.customized_stater.service.CustomizedServiceByImportSelector;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.core.type.AnnotationMetadata;
/**
* @author liqingxu
* @Description
* @create 2022-03-15
*/
@Slf4j
public class CustomizedImportSelector implements ImportSelector {
@Override
public String[] selectImports(AnnotationMetadata importingClassMetadata) {
AnnotationAttributes annotationAttributes = AnnotationAttributes.fromMap(
importingClassMetadata.getAnnotationAttributes(
EnabledCustomerStarter.class.getName()));
if(annotationAttributes == null){
log.info("@EnableLogger is not used on the main program");
return new String[0];
}
//在这里可以拿到所有注解的信息,可以根据不同注解的和注解的属性来返回不同的class,
// 从而达到开启不同功能的目的
return new String[]{CustomizedServiceByImportSelector.class.getName()};
}
}
|
e713478a-ee73-47cb-b950-119d9e1eb274 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-08 00:43:29", "repo_name": "MYoung86/AutomationProject", "sub_path": "/src/July3/ByClassName.java", "file_name": "ByClassName.java", "file_ext": "java", "file_size_in_byte": 993, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "2a8d3b900b6f2f9f04db42cab73324dd24729a75", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MYoung86/AutomationProject | 201 | FILENAME: ByClassName.java | 0.204342 | package July3;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
public class ByClassName {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Matt\\Documents\\Drivers\\chromedriver.exe");
WebDriver driver = new ChromeDriver(); // launches a new browser session
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.get("https://www.duotech.io/"); // navigates to a URL
driver.manage().window().maximize(); // maximizes the window
driver.findElement(By.className("scroll-down-link")).click(); // className can only accept on class attribute value.
//it will not work for multiple classes
driver.findElement(By.xpath("//a[@href='/about-us]")).click();
driver.findElement(By.xpath("//input[@value='Submit Messag'")).click();
}
}
|
d5eed5e0-d2e3-4d78-8efe-97f3efc76de0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-24 10:15:48", "repo_name": "zhunhuang/java-demos", "sub_path": "/springbootsecurityjwt1/src/main/java/com/nolan/learn/springsecurityjwt1/api/WxCode2SessionAPI.java", "file_name": "WxCode2SessionAPI.java", "file_ext": "java", "file_size_in_byte": 1068, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "14831725dd2bacd186bcc93bcf480364d613a4ab", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/zhunhuang/java-demos | 258 | FILENAME: WxCode2SessionAPI.java | 0.240775 | package com.nolan.learn.springsecurityjwt1.api;
import com.nolan.learn.springsecurityjwt1.util.HttpUtil;
import com.nolan.learn.springsecurityjwt1.util.JacksonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* description:
*
* @author zhun.huang 2019-03-31
*/
public class WxCode2SessionAPI {
private static final Logger LOGGER = LoggerFactory.getLogger(WxCode2SessionAPI.class);
private String wxSessionApiEndPoint = "https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&grant_type=authorization_code&js_code=";
public WxCode2SessionAPI(String appId, String appSecret) {
wxSessionApiEndPoint = String.format(wxSessionApiEndPoint,appId,appSecret);
}
public WxSessionModel getSession(String code) {
String url = wxSessionApiEndPoint.concat(code);
String s = HttpUtil.get(url, null, null);
WxSessionModel wxSessionModel = JacksonUtil.deSerialize(s, WxSessionModel.class);
LOGGER.info("getAccessToken from wx, response :{}", s);
return wxSessionModel;
}
}
|
3f88eeb2-0af3-4cb2-a7c7-d5d81f73b449 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-03 11:20:42", "repo_name": "bookgvi/LearningJava", "sub_path": "/src/StreamIO.java", "file_name": "StreamIO.java", "file_ext": "java", "file_size_in_byte": 1153, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "d13bc02752b2ade1cdd169c724d2d76bb8f0873b", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/bookgvi/LearningJava | 288 | FILENAME: StreamIO.java | 0.287768 | import StreamIO.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class StreamIO {
public static void main(String[] args) throws IOException {
// File file = new File();
// file.writeToFile("/Users/bookgvi/IdeaProjects/LearningJava/files/file12.txt", (InputStream) null);
// file.getFromFile("/Users/bookgvi/IdeaProjects/LearningJava/files/file12.txt");
// final int THREADS_COUNT = 10;
//
// ExecutorService executorService = Executors.newFixedThreadPool(THREADS_COUNT);
//
// for (int i = 0; i < THREADS_COUNT; i++) {
// executorService.submit(new SocketThread());
// }
// SocketThread socketThread = new SocketThread();
//
// String strForSend = "qweqweqew \n" +
// "Hey \n" +
// "there!!! \n" +
// "QWEE\n";
// SocketCLient socketCLient = new SocketCLient();
// socketCLient.request(strForSend);
//
// executorService.shutdown();
ReadFile rf = new ReadFile("/Users/bookgvi/IdeaProjects/LearningJava/src/StreamIO.java");
rf.readFileToConsole();
}
}
|
629af297-3d4f-42a5-adb5-4b511f5c3bec | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2015-07-14T00:04:51", "repo_name": "roman-kulish/ingress-farmbot", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1075, "line_count": 26, "lang": "en", "doc_type": "text", "blob_id": "fa6eb5b33da55835eab4de09b90642379aa0bc9b", "star_events_count": 8, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/roman-kulish/ingress-farmbot | 215 | FILENAME: README.md | 0.243642 | Ingress Farm Bot
================
Current status: Abandoned
-------------------------
Agreement
---------
This projects is for educational purpose only.
You agree that you are solely responsible for any breach of your obligations under the Ingress Terms of Service (http://www.ingress.com/terms) or any applicable law or regulation, and for the consequences (including any loss or damage) of any such breach.
YOUR USE OF THIS CODE IS AT YOUR OWN DISCRETION AND RISK AND YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOU ARE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING THE LOSS OF INGRESS ACCOUNT.
Intro
-----
This bot supports the very early V2 game protocol existed before the check for devices was introduced.
Passing device parameters on a handshake request is not implemented.
The Bot depends on a "Runner" Java library that performs Spherical Geometry calculations.
To configure the Bot you need to create a new user account JSON file inside "account" directory. See example file.
|
c2856074-42b6-4edf-a023-eae7954534b9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2012-11-26 07:48:52", "repo_name": "darkluster/kraken", "sub_path": "/siem/kraken-logdb/src/main/java/org/krakenapps/logdb/impl/LogScriptRegistryImpl.java", "file_name": "LogScriptRegistryImpl.java", "file_ext": "java", "file_size_in_byte": 1182, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "1cafa52a2329d02a3f52cc9d5da6ce5cd3e9846e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/darkluster/kraken | 249 | FILENAME: LogScriptRegistryImpl.java | 0.281406 | package org.krakenapps.logdb.impl;
import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Provides;
import org.apache.felix.ipojo.annotations.Validate;
import org.krakenapps.logdb.LogScript;
import org.krakenapps.logdb.LogScriptRegistry;
@Component(name = "log-script-registry")
@Provides
public class LogScriptRegistryImpl implements LogScriptRegistry {
private ConcurrentMap<String, LogScript> scripts;
@Validate
public void start() {
scripts = new ConcurrentHashMap<String, LogScript>();
}
@Override
public Collection<LogScript> getScripts() {
return scripts.values();
}
@Override
public LogScript getScript(String name) {
return scripts.get(name);
}
@Override
public void addScript(String name, LogScript script) {
LogScript old = scripts.putIfAbsent(name, script);
if (old != null)
throw new IllegalStateException("log script already exists: " + name);
}
@Override
public void removeScript(String name) {
scripts.remove(name);
}
}
|
c64dc4dc-c215-42d2-bcc9-accf39846b40 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-15 15:19:39", "repo_name": "monkeyDugi/monkey-music", "sub_path": "/src/main/java/com/dugi/monkey/domain/music/dailychart/DailyChart.java", "file_name": "DailyChart.java", "file_ext": "java", "file_size_in_byte": 1201, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "ccfdcc7afa5a923d77b1c7bcfdba060b8121004b", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/monkeyDugi/monkey-music | 266 | FILENAME: DailyChart.java | 0.229535 | package com.dugi.monkey.domain.music.dailychart;
import com.dugi.monkey.domain.music.BaseTimeEntity;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
* @author : 이병덕
* @description : 일간차트
* @date : 2020.07.19 22:10:07
*/
@Getter
@NoArgsConstructor
@Entity
public class DailyChart extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true)
private String rank;
@Column(nullable = false, unique = true)
private String videoId;
@Column(nullable = false)
private String title;
@Column(nullable = false)
private String singer;
@Column(nullable = false)
private String image;
@Builder
public DailyChart(String rank, String videoId, String title, String singer, String image) {
this.rank = rank;
this.videoId = videoId;
this.title = title;
this.singer = singer;
this.image = image;
}
}
|
b208b9f0-1256-4b57-a628-1657c1e237fa | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-04-29 11:10:53", "repo_name": "anthonyporciuncula/ThomaShare", "sub_path": "/app/src/main/java/com/android/hood/thomashare/Navigation.java", "file_name": "Navigation.java", "file_ext": "java", "file_size_in_byte": 1223, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "4165fd2be8b2adc0592e4fb722b4acc4770eb3b1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/anthonyporciuncula/ThomaShare | 223 | FILENAME: Navigation.java | 0.203075 | package com.android.hood.thomashare;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class Navigation extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_navigation);
}
public void loginPage (View view){
Intent intent = new Intent(this, LoginActivity.class);
startActivity(intent);
}
public void SignUpPage (View view){
Intent intent = new Intent(this, SignUp.class);
startActivity(intent);
}
public void addInterest (View view){
Intent intent = new Intent(this, AddInterest.class);
startActivity(intent);
}
public void uploadFile (View view){
Intent intent = new Intent(this, Upload.class);
startActivity(intent);
}
public void explorePage (View view){
Intent intent = new Intent(this, Explore.class);
startActivity(intent);
}
public void discoverPage (View view){
Intent intent = new Intent(this, Discover.class);
startActivity(intent);
}
}
|
ea1bf058-bfa1-4c25-a063-9c87b5f56713 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-19 17:02:07", "repo_name": "Gustavo-Akira/ms-authentication", "sub_path": "/src/main/java/br/com/gustavoakira/ms/authentication/adapters/inbound/consumer/AuthenticationConsumer.java", "file_name": "AuthenticationConsumer.java", "file_ext": "java", "file_size_in_byte": 1015, "line_count": 26, "lang": "en", "doc_type": "code", "blob_id": "c479736a51beeb2cd5b47975ead29574563bdb16", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Gustavo-Akira/ms-authentication | 177 | FILENAME: AuthenticationConsumer.java | 0.213377 | package br.com.gustavoakira.ms.authentication.adapters.inbound.consumer;
import br.com.gustavoakira.ms.authentication.application.domain.Credentials;
import br.com.gustavoakira.ms.authentication.application.port.CredentialsServicePort;
import br.com.gustavoakira.ms.core.events.AuthenticationRegistrationMessage;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class AuthenticationConsumer {
@Autowired
private CredentialsServicePort port;
@RabbitListener(queues = "ms-authentication")
public void consume(AuthenticationRegistrationMessage message){
port.insert(Credentials.builder()
.userId(message.getUserId())
.username(message.getUsername())
.password(message.getPassword())
.level(1)
.build());
System.out.println("Consumido " + message);
}
}
|
3abb8de3-2e5c-4157-a429-3f90f864c73a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-03-28 12:20:58", "repo_name": "921668753/wztx-shipper-android", "sub_path": "/ZWBH-Android/app/src/main/java/com/ruitukeji/zwbh/main/cargoinformation/selectvehicle/SelectVehiclePresenter.java", "file_name": "SelectVehiclePresenter.java", "file_ext": "java", "file_size_in_byte": 1079, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "5ee10a5b80018ef449f34e4e677ce5e2a800d8cf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/921668753/wztx-shipper-android | 231 | FILENAME: SelectVehiclePresenter.java | 0.27048 | package com.ruitukeji.zwbh.main.cargoinformation.selectvehicle;
import com.kymjs.rxvolley.client.HttpParams;
import com.ruitukeji.zwbh.retrofit.RequestClient;
import com.ruitukeji.zwbh.utils.httputil.HttpUtilParams;
import com.ruitukeji.zwbh.utils.httputil.ResponseListener;
/**
* Created by Administrator on 2017/2/21.
*/
public class SelectVehiclePresenter implements SelectVehicleContract.Presenter {
private SelectVehicleContract.View mView;
public SelectVehiclePresenter(SelectVehicleContract.View view) {
mView = view;
mView.setPresenter(this);
}
@Override
public void getConductorModels() {
HttpParams httpParams = HttpUtilParams.getInstance().getHttpParams();
RequestClient.getConductorModels(httpParams, new ResponseListener<String>() {
@Override
public void onSuccess(String response) {
mView.getSuccess(response);
}
@Override
public void onFailure(String msg) {
mView.error(msg);
}
});
}
}
|
466c4d42-26e4-45ee-a880-8fcad9d795ee | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-28 03:03:53", "repo_name": "BnSalahFahmi/ng-library-store", "sub_path": "/ng-library-store-server/src/main/java/com/cqrs/event_sourcing/controllers/queries/BookQueryController.java", "file_name": "BookQueryController.java", "file_ext": "java", "file_size_in_byte": 1156, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "45b6ee7140084b4b19ab10f8edc96ab44271e2d8", "star_events_count": 4, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/BnSalahFahmi/ng-library-store | 237 | FILENAME: BookQueryController.java | 0.273574 | package com.cqrs.event_sourcing.controllers.queries;
import com.cqrs.event_sourcing.dto.BookDTO;
import com.cqrs.event_sourcing.entities.Book;
import com.cqrs.event_sourcing.entities.Library;
import com.cqrs.event_sourcing.services.queries.BookQueryService;
import com.cqrs.event_sourcing.services.queries.LibraryQueryService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@RestController
@RequestMapping(value = "/books")
@CrossOrigin(origins = "*")
@Api(value = "Book Queries", description = "Book Query Events Endpoint", tags = "Book Queries")
public class BookQueryController {
private final BookQueryService bookQueryService;
public BookQueryController(BookQueryService bookQueryService) {
this.bookQueryService = bookQueryService;
}
@GetMapping("")
public CompletableFuture<List<BookDTO>> fetchBooks() {
return this.bookQueryService.getAllBooks();
}
@GetMapping("/{id}")
public CompletableFuture<BookDTO> getBook(@PathVariable String id) { return this.bookQueryService.getBook(id); }
}
|
692da43b-c89b-4b30-8ddd-0c719d316960 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-24 14:48:25", "repo_name": "AlinaPopescu1/BasicNavigationTests", "sub_path": "/src/test/java/com/cbt/utilities/BrowserFactory.java", "file_name": "BrowserFactory.java", "file_ext": "java", "file_size_in_byte": 1188, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "dcc54f30f8af457557243036459c645d5fd59349", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AlinaPopescu1/BasicNavigationTests | 231 | FILENAME: BrowserFactory.java | 0.26588 | package com.cbt.utilities;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.safari.SafariDriver;
public class BrowserFactory {
public static WebDriver getDriver(String browser) {
String opSysName = System.getProperty("os.name");
WebDriver webDriver = null;
if (browser.contains("Chrome")) {
WebDriverManager.chromedriver().setup();
webDriver = new ChromeDriver();
} else if (browser.contains("Firefox")) {
WebDriverManager.firefoxdriver().setup();
webDriver = new FirefoxDriver();
} else if (browser.contains(("Safari"))) {
System.setProperty("webdriver.safari.driver", "C:/safaridriver.exe");
webDriver = new SafariDriver();
} else if (browser.contains("Edge")
&& opSysName.contains("Mac")
||
browser.contains("Explorer")
&& opSysName.contains("Mac")) {
return null;
}
return webDriver;
}
}
|
1d812a7c-1407-40a9-b402-08a42091c3e0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-25 20:31:26", "repo_name": "njegovan/copy-and-sync", "sub_path": "/src/main/java/dev/njegovan/copyandsync/consumer/Consumer.java", "file_name": "Consumer.java", "file_ext": "java", "file_size_in_byte": 1112, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "e8b300b1528074a571e5df3dd43ac1a78d755ab4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/njegovan/copy-and-sync | 203 | FILENAME: Consumer.java | 0.253861 | package dev.njegovan.copyandsync.consumer;
import dev.njegovan.copyandsync.wrapper.ByteArrayWrapper;
import dev.njegovan.copyandsync.utils.LoggingUtils;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.util.concurrent.BlockingQueue;
public class Consumer {
private final BlockingQueue<ByteArrayWrapper> blockingQueue;
private final ByteArrayWrapper endByteArrayWrapper;
public Consumer(BlockingQueue<ByteArrayWrapper> blockingQueue, ByteArrayWrapper endByteArrayWrapper) {
this.blockingQueue = blockingQueue;
this.endByteArrayWrapper = endByteArrayWrapper;
}
public boolean consumeWithContinue(BufferedOutputStream bufferedOutputStream, final long[] startTime) throws IOException, InterruptedException {
ByteArrayWrapper byteArrayWrapper = blockingQueue.take();
if (endByteArrayWrapper == byteArrayWrapper) {
LoggingUtils.printEnd(startTime);
return false;
}
bufferedOutputStream.write(byteArrayWrapper.getData(), 0, byteArrayWrapper.getBytesReadCount());
return true;
}
}
|
c58e8c7a-f420-429f-9ff4-a97f0dc0e27e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-17 10:30:26", "repo_name": "Ridhsk13/My_Projects", "sub_path": "/Elen Jwells/Jwellery/app/src/main/java/com/ridhs/jwellery/Register.java", "file_name": "Register.java", "file_ext": "java", "file_size_in_byte": 1187, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "b3dcf352399cdec17c1bb202a7850e6486a9a924", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Ridhsk13/My_Projects | 254 | FILENAME: Register.java | 0.23231 | package com.ridhs.jwellery;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class Register extends AppCompatActivity {
final String SiteKey = "6LfE1jQUAAAAAKRc7XpzbtNyw6usSFw22T6SHOKt";
final String SecretKey = "6LfE1jQUAAAAAOP_VvqwJRsb4J_h4HEEcGtAMlCJ";
//private GoogleApiClient mGoogleApiClient;
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
Drawable background = this.getResources().getDrawable(R.drawable.actionbar_gredient);
w.setStatusBarColor(this.getResources().getColor(R.color.transparent));
w.setBackgroundDrawable(background);
}
setContentView(R.layout.activity_register);
}
}
|
db89bd32-84df-4710-937b-a5d6e35ad0ad | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-11-02 02:37:50", "repo_name": "rodrigaun/JSONJava", "sub_path": "/src/center/rodrigo/connection/Connect.java", "file_name": "Connect.java", "file_ext": "java", "file_size_in_byte": 994, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "2fcf8b25c20bb3f6ebaffebd8867aed0fef2212c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rodrigaun/JSONJava | 201 | FILENAME: Connect.java | 0.242206 | package center.rodrigo.connection;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Connect {
private URL url;
private HttpURLConnection conn;
private BufferedReader rd;
private String line;
private String result = "";
private String urlViaCEP = "http://viacep.com.br/ws/_SEU_CEP_/json/";
public String consomeEndPoint(String cep) {
try {
urlViaCEP = urlViaCEP.replace("_SEU_CEP_", cep);
url = new URL(urlViaCEP);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
rd = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
while ((line = rd.readLine()) != null) {
result += line;
}
rd.close();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}
|
7ee47b19-6ee3-4307-bacb-f4e9cbf4dfe5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-09-12 02:34:33", "repo_name": "DoYouLoveThisJob/CustomerSys", "sub_path": "/src/main/java/com/lesso/util/quartz/QuartzInterruptableJob.java", "file_name": "QuartzInterruptableJob.java", "file_ext": "java", "file_size_in_byte": 1181, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "ecedce3ad2c47f4781928f061bb8c43bc6974e58", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DoYouLoveThisJob/CustomerSys | 245 | FILENAME: QuartzInterruptableJob.java | 0.280616 | package com.lesso.util.quartz;
import com.lesso.entity.ScheduleJob;
import org.apache.log4j.Logger;
import org.quartz.InterruptableJob;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.UnableToInterruptJobException;
/**
* Created by Administrator on 2016/5/24.
*/
public class QuartzInterruptableJob implements InterruptableJob {
private static Logger LOG = Logger.getLogger(QuartzInterruptableJob.class);
private volatile boolean isJobInterrupted = true;
public QuartzInterruptableJob() {
}
public void interrupt() throws UnableToInterruptJobException {
System.out.println("Job-- INTERRUPTING --");
isJobInterrupted = false;
}
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
ScheduleJob scheduleJob = (ScheduleJob) jobExecutionContext.getMergedJobDataMap().get("scheduleJob");
if(isJobInterrupted){
try {
TaskUtils.invokMethod(scheduleJob);
} catch (Exception e) {
throw new JobExecutionException("this program have exception!");
}
}
}
}
|
afce9218-114d-4fc9-a119-5aa1f8dca10d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-08-25T15:56:29", "repo_name": "mateo951/portfolio", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1090, "line_count": 35, "lang": "en", "doc_type": "text", "blob_id": "80938f3bc550838fc70bfcbf25d3d1d8ef659d2c", "star_events_count": 4, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mateo951/portfolio | 288 | FILENAME: README.md | 0.216012 | Portfolio
The project's goal is to clone a design from a portfolio with html and css. Applying new tools such us Flexbox, Figma, and as well as using best practices for html and css. This project is the start of a micronaut future portfolio!

Built With
- HTML, CSS, JS
- Linters, Node.js, Git, Flexbox
[Portolio Live Demo](https://mateo951.github.io/portfolio/)
To get a local copy up and running follow these simple example steps.
- On your terminal and run the following command to clone the repository
`git clone git@github.com:mateo951/portfolio.git`
Authors
👤 Mateo Villagómez
GitHub: [@mateo951](https://github.com/mateo951)
Twitter: [@MVGameDev](https://twitter.com/MVGameDev)
LinkedIn: [@Mateo Villagómez](https://www.linkedin.com/in/mateo-villagómez/)
🤝 Contributing
Contributions, issues, and feature requests are welcome!
Feel free to check the [issues](https://github.com/mateo951/portfolio/issues) page.
Show your support
Give a ⭐️ if you like this project!
📝 License
This project is MIT licensed.
|
d936b09f-e602-4cc6-846d-b292d6de3024 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-12-20T14:28:08", "repo_name": "dotmat/nodeJSPollyTwiML", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1228, "line_count": 45, "lang": "en", "doc_type": "text", "blob_id": "13522b0bf164b19922bbdb982025b58c42d6ce8a", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dotmat/nodeJSPollyTwiML | 384 | FILENAME: README.md | 0.253861 | # Node AWS Polly Text to Speech API and Generator
## Blog post
http://www.mathewjenkinson.com/generating-speech-using-aws-polly/
## Brief
Node AWS Polly text to speech is an API engine where you can send the desired voice and text in and get a MP3 file out.
AWS Polly voices are:
| Language | Female | Male |
| --- | --- | --- |
|Australian English | Nicole | Russell |
|Brazilian Portuguese | Vitória | Ricardo |
|Canadian French | Chantal |
|Danish | Naja | Mads |
|Dutch | Lotte | Ruben |
|French |Céline |Mathieu |
|German |Marlene | Hans |
|Icelandic |Dóra | Karl |
|Indian | English | Raveena |
|Italian | Carla |Giorgio |
|Japanese | Mizuki |
|Norwegian | Liv |
|Polish | Ewa Jacek |
|Polish | Maja Jan |
|Portuguese - Iberic | Inês | Cristiano |
|Romanian | Carmen |
|Russian | Tatyana Maxim |
|Spanish - Castilian | Conchita | Enrique |
|Swedish | Astrid |
|Turkish | Filiz |
|UK English | Amy | Brian |
|UK English | Emma |
|US English | Joanna | Joey |
|US English | Salli Justin |
|US English | Kendra |
|US English | Kimberly |
|US English | Ivy |
|US Spanish | Penélope | Miguel |
|Welsh | Gwyneth |
|Welsh English | Geraint |
## API Details
api.domain.com/AmazonVoice/Text%20To%20Convert%20To%20Speech
|
c5b9cc98-6e73-410f-9a68-1a4d1ca7a16c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-17 23:57:53", "repo_name": "PeterHausenAoi/CardsGame", "sub_path": "/src/main/java/com/github/PeterHausenAoi/CardsGame/models/entities/CardValue.java", "file_name": "CardValue.java", "file_ext": "java", "file_size_in_byte": 1156, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "6fc57831793f8f17c7628acb53963edc647a8dc2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/PeterHausenAoi/CardsGame | 256 | FILENAME: CardValue.java | 0.264358 | package com.github.PeterHausenAoi.CardsGame.models.entities;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "card_values")
public class CardValue extends BaseEntity {
@Column(name = "name")
private String name;
@Column(name = "value")
private Integer value;
public CardValue() {
}
public CardValue(Long id) {
super(id);
}
public CardValue(String name, Integer value) {
this.name = name;
this.value = value;
}
public CardValue(Long id, String name, Integer value) {
super(id);
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
return !super.equals(o);
}
}
|
992f4fa5-69fb-4451-bcb4-77d9c5ffb9f6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-02 09:18:09", "repo_name": "YoungForWP/ObserverPattern", "sub_path": "/src/com/wp/product/Product.java", "file_name": "Product.java", "file_ext": "java", "file_size_in_byte": 1180, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "648814d546c70d32881401f240e4ecfdba3bda7b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/YoungForWP/ObserverPattern | 232 | FILENAME: Product.java | 0.293404 | package com.wp.product;
import com.wp.customer.Customer;
import java.util.ArrayList;
public class Product implements Commodity {
private String color;
private Integer amount;
private ArrayList<Customer> customers;
public Product() {
customers = new ArrayList<>();
}
@Override
public void registerObserver(Customer customer) {
customers.add(customer);
}
@Override
public void notifyCustomer() {
for (Customer customer : customers) {
customer.receiveMessage();
}
}
@Override
public void removeCustomer(Customer customer) {
int index = customers.indexOf(customer);
if (index > -1) {
customers.remove(index);
}
}
public void setAmount(Integer amount) {
if (checkNotify(amount)) {
notifyCustomer();
}
this.amount = amount;
}
private boolean checkNotify(Integer amount) {
return (this.amount == null || this.amount == 0) && amount > 0;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
}
|
99fbe4e1-953e-47b9-8bc8-a3576eb51085 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-15 08:51:44", "repo_name": "lassemaatta/temporaljooq", "sub_path": "/src/main/java/fi/lassemaatta/temporaljooq/config/properties/DataSourceProperties.java", "file_name": "DataSourceProperties.java", "file_ext": "java", "file_size_in_byte": 1187, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "1d21e56b667c24fa04e5a669b5a9a48d6e87313e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lassemaatta/temporaljooq | 219 | FILENAME: DataSourceProperties.java | 0.236516 | package fi.lassemaatta.temporaljooq.config.properties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
@Component
@PropertySource("classpath:configuration/db.properties")
public class DataSourceProperties {
@Value("#{environment['db.driver']}")
private String driverClassName;
@Value("#{environment['db.url']}")
private String jdbcUrl;
@Value("#{environment['db.min.connections']}")
private int minimumIdle;
@Value("#{environment['db.max.connections']}")
private int maximumPoolSize;
@Value("#{environment['db.username']}")
private String username;
@Value("#{environment['db.password']}")
private String password;
public DataSourceConfigDto config() {
return ImmutableDataSourceConfigDto
.builder()
.driverClassName(driverClassName)
.jdbcUrl(jdbcUrl)
.minimumIdle(minimumIdle)
.maximumPoolSize(maximumPoolSize)
.username(username)
.password(password)
.build();
}
}
|
de5de070-75ca-4f0d-ab95-0d96e7c67fd7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-05-28T09:39:23", "repo_name": "gisunglee/recipe_app_flutter_ui_go", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1291, "line_count": 28, "lang": "en", "doc_type": "text", "blob_id": "7881a03f278d9386fcb83333e0cd9efccb79539a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gisunglee/recipe_app_flutter_ui_go | 440 | FILENAME: README.md | 0.23793 | # recipe_app_flutter_ui_go
A new Flutter project.
## Getting Started
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.


defaultSize 를 이용하여 핸드폰을 옆으로 돌렸을때 사이즈에 맞게 화면이 변경되도록 코딩하는 예제임
참고로 나는 안됐음 ㅡㅡ; 뭐지!

SizeConfig 라는 클래스를 만들어서 defaultSize를 구함 defaultSize는 landscape 따라서 다름

|
468f3d3b-10c3-4c82-a099-355e1c3ad69d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-17 10:32:07", "repo_name": "xeon2007/accompany-server", "sub_path": "/src/main/java/me/quhu/haohushi/accompany/domain/coupon/SysCpuponCity.java", "file_name": "SysCpuponCity.java", "file_ext": "java", "file_size_in_byte": 1134, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "e36e7e98ae042ae55dcb04f165ba32f8611ec8be", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xeon2007/accompany-server | 251 | FILENAME: SysCpuponCity.java | 0.262842 | package me.quhu.haohushi.accompany.domain.coupon;
import me.quhu.haohushi.accompany.util.CommUtil;
import me.quhu.haohushi.accompany.util.enums.OrderType;
/**
* Created by wei on 2016/9/29.
*/
public class SysCpuponCity extends SysCoupon {
private String areaName;//限制城市
public String getAreaName(){
StringBuilder sb = new StringBuilder();
boolean isFirst = true;
if(areaName != null){
sb.append("限").append(areaName).append("使用");
isFirst = false;
}
// null 不限制套餐类型
if(getOrderType()!=null){
if(!isFirst){
sb.append(";");
}
else {
isFirst = false;
}
sb.append("限").append(OrderType.getOrderName(Integer.parseInt(getOrderType()))).append("陪诊使用");
}
if(getMaxValue()!=null){
if(!isFirst){
sb.append(";");
}
sb.append("最高抵扣").append(CommUtil.trimZeroOfNumber(getMaxValue())).append("元");
}
return sb.toString();
}
}
|
f76f0af4-4fdb-4d36-9fd1-111f368a465e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-04-02 16:32:52", "repo_name": "MurilloTavares/ProjetoPadroes", "sub_path": "/src/main/java/br/edu/ifpb/projetopadroes/entity/CPF.java", "file_name": "CPF.java", "file_ext": "java", "file_size_in_byte": 1025, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "5c5e3b3a87c4341e69e6a0eb2d21d69ae19d74ac", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MurilloTavares/ProjetoPadroes | 231 | FILENAME: CPF.java | 0.286968 | package br.edu.ifpb.projetopadroes.entity;
import java.io.Serializable;
import java.text.ParseException;
import javax.persistence.Embeddable;
import javax.swing.text.MaskFormatter;
@Embeddable
public class CPF implements Serializable{
private String numericCpf;
public CPF() {
}
public CPF(String cpf) {
setCpf(cpf);
}
public void setCpf(String cpf) {
if(cpf == null) cpf = "";
this.numericCpf = cpf.replaceAll("\\D+",""); // extraindo apenas numeros
}
public String getNumericCpf() {
return numericCpf;
}
public String getFormatedCpf(){
if(!isValid()) return "";
try {
MaskFormatter mf = new MaskFormatter("###.###.###-##");
mf.setValueContainsLiteralCharacters(false);
return mf.valueToString(numericCpf);
} catch (ParseException ex) {
return "";
}
}
public boolean isValid(){
return numericCpf.length() == 11;
}
} |
5c2fe876-0495-4740-add4-32b7bcfebb99 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-18 12:12:54", "repo_name": "manikanthkumar/CRS-Auth-Service", "sub_path": "/src/main/java/com/pramati/crs/authservice/resource/UserProfileResource.java", "file_name": "UserProfileResource.java", "file_ext": "java", "file_size_in_byte": 1090, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "ec6660f483826766e21dac3b4ead272e34b50868", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/manikanthkumar/CRS-Auth-Service | 183 | FILENAME: UserProfileResource.java | 0.23092 | package com.pramati.crs.authservice.resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.pramati.crs.authservice.config.entity.UserProfile;
import com.pramati.crs.authservice.service.UserProfilesService;
@RestController
@RequestMapping("/users")
public class UserProfileResource {
@Autowired
private UserProfilesService userProfileService;
@RequestMapping(method = RequestMethod.POST, value = "/")
public String createUserProfiles(@RequestBody UserProfile userProfile) {
userProfileService.createUserProfile(userProfile);
return "UserProfie added Successfully";
}
@RequestMapping(method = RequestMethod.PUT, value = "/")
public String updateUserProfiles(@RequestBody UserProfile userProfile) {
userProfileService.updateUserProfile(userProfile);
return "UserProfie added Successfully";
}
}
|
c054cbf9-3744-4cef-8cee-cb598a75f831 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-19 20:35:54", "repo_name": "only-us-app/UDONG_SERVER", "sub_path": "/src/main/java/solux/woodong/web/dto/receipt/ReceiptSaveRequestDto.java", "file_name": "ReceiptSaveRequestDto.java", "file_ext": "java", "file_size_in_byte": 1182, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "dc58e3a58afba1a36dcf8acb49afddeb478acd21", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/only-us-app/UDONG_SERVER | 245 | FILENAME: ReceiptSaveRequestDto.java | 0.26588 | package solux.woodong.web.dto.receipt;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import solux.woodong.web.domain.club.Club;
import solux.woodong.web.domain.receipt.Receipt;
import solux.woodong.web.domain.user.User;
@Getter
@NoArgsConstructor
public class ReceiptSaveRequestDto {
private String cost;
private String title;
private String content;
private String picture;
private String useDate;
private Club club;
private User user;
@Builder
public ReceiptSaveRequestDto(String cost, String title, String content
, String picture, String useDate, Club club, User user) {
this.cost = cost;
this.title = title;
this.content = content;
this.picture = picture;
this.useDate = useDate;
this.club = club;
this.user = user;
}
public Receipt toEntity() {
return Receipt.builder()
.cost(cost)
.title(title)
.content(content)
.picture(picture)
.useDate(useDate)
.club(club)
.user(user)
.build();
}
}
|
4aa5f48f-1613-41f3-9145-4f1e8509282a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-05-03T08:22:51", "repo_name": "codeinchq/compatibility-middleware", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1014, "line_count": 25, "lang": "en", "doc_type": "text", "blob_id": "04318b919e38eb849c9aeece7e2a16da736c9f69", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/codeinchq/compatibility-middleware | 256 | FILENAME: README.md | 0.249447 | # Compatibility PSR-15 middleware
This library provides a collection of [PSR-15](https://www.php-fig.org/psr/psr-15/) middleware to provide compatibility with older PHP scripts.
## The collection includes
* [`PhpGpcVarsMiddleware`](src/PhpGpcVarsMiddleware.php) Extract PSR-7 request data to PHP GPC variables `$_GET`, `$_POST`, `$_COOKIE` and `$_SERVER`
* [`PhpSessionMiddleware`](src/PhpSessionMiddleware.php) Read sesion cookie from PSR-7 requests and add session cookie to PSR-7 responses
## Installation
This library is available through [Packagist](https://packagist.org/packages/codeinc/compatibility-middleware) and can be installed using [Composer](https://getcomposer.org/):
```bash
composer require codeinc/compatibility-middleware
```
:speech_balloon: This library is extracted from the now deprecated [codeinc/psr15-middlewares](https://packagist.org/packages/codeinc/psr15-middlewares) package.
## License
The library is published under the MIT license (see [`LICENSE`](LICENSE) file). |
bb10cc8c-fdb8-4e87-8b43-0a86a6cab775 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-01 00:51:54", "repo_name": "andrew-waite/Acercraft-Plugins", "sub_path": "/acerstaffchat/src/com/acercraft/AcerStaffChat/StaffChatListener.java", "file_name": "StaffChatListener.java", "file_ext": "java", "file_size_in_byte": 1061, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "e61eb5c929cfc4351e256d26409b5246f5fe4223", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/andrew-waite/Acercraft-Plugins | 240 | FILENAME: StaffChatListener.java | 0.287768 | package com.acercraft.AcerStaffChat;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerQuitEvent;
public class StaffChatListener implements Listener
{
public AcerStaffChat plugin;
public StaffChatListener(AcerStaffChat instance)
{
this.plugin = instance;
}
@EventHandler
public void onPlayerChatEvent(AsyncPlayerChatEvent event)
{
if(plugin.getAdminList().contains(event.getPlayer().getName()))
{
String message = event.getMessage();
event.setCancelled(true);
for(Player player : Bukkit.getServer().getOnlinePlayers())
{
if(plugin.hasPermission(player, "acercraft.adminchat.admin"))
{
player.sendMessage(message);
}
}
}
}
@EventHandler
public void playerQuit(PlayerQuitEvent event)
{
if(plugin.getAdminList().contains(event.getPlayer().getName()))
{
plugin.removeAdminList(event.getPlayer().getName());
}
}
}
|
de8b0e01-a4f8-4c46-869b-58199add3312 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-04-25 08:08:16", "repo_name": "serhatertuerk/RequestHelper", "sub_path": "/src/main/java/io/serhatertuerk/RequestHelper/ParameterStringBuilder.java", "file_name": "ParameterStringBuilder.java", "file_ext": "java", "file_size_in_byte": 1022, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "b45dd7e152fd23f313230e3e11b5121fdbc74da8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/serhatertuerk/RequestHelper | 225 | FILENAME: ParameterStringBuilder.java | 0.275909 | package io.serhatertuerk.RequestHelper;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Map;
public class ParameterStringBuilder {
/**
* @see <a href="https://www.baeldung.com/java-http-request">java-http-request</a>
* @param parameters The parameters to send the request with
* @return formatted map
*/
protected static String getParamsString(Map<String, String> parameters) {
StringBuilder result = new StringBuilder();
try {
for (Map.Entry<String, String> entry : parameters.entrySet()) {
result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
result.append("=");
result.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
result.append("&");
}
String resultString = result.toString();
return resultString.length() > 0
? resultString.substring(0, resultString.length() - 1)
: resultString;
} catch (UnsupportedEncodingException ee) {
ee.printStackTrace();
}
return result.toString();
}
}
|
4c844254-68de-49d1-9d0b-a552c1d639bb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-19 08:51:02", "repo_name": "bruceLio/RootAppTool", "sub_path": "/app/src/main/java/com/xiaolong/rootapptool/utils/Shell.java", "file_name": "Shell.java", "file_ext": "java", "file_size_in_byte": 989, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "062dcdd20c5bbe448f0945acb44d560fec7eb83c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/bruceLio/RootAppTool | 183 | FILENAME: Shell.java | 0.23092 | package com.xiaolong.rootapptool.utils;
import java.io.DataOutputStream;
import java.io.OutputStream;
public class Shell {
private static Shell shell;
private Process process;
public static Shell getInstance() {
if (shell == null) shell = new Shell();
return shell;
}
private Shell() {
su();
}
public void su() {
try {
process = Runtime.getRuntime().exec("su");
} catch (Exception e) {
L.e(e.getMessage());
}
}
public void execShellCmd(String cmd) {
try {
OutputStream outputStream = process.getOutputStream();
DataOutputStream dataOutputStream = new DataOutputStream(
outputStream);
dataOutputStream.writeBytes(cmd);
dataOutputStream.flush();
dataOutputStream.close();
outputStream.close();
} catch (Throwable t) {
L.e(t.getMessage());
}
}
}
|
15e30f0d-9591-455b-86bd-d49f5d54f09b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-30 02:16:41", "repo_name": "AustinLee2/ReminderApp", "sub_path": "/app/src/main/java/com/austinhlee/android/app1/SecondActivity.java", "file_name": "SecondActivity.java", "file_ext": "java", "file_size_in_byte": 1016, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "696a9e00d494623820881f861a382f01f9c4e1e8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AustinLee2/ReminderApp | 172 | FILENAME: SecondActivity.java | 0.235108 | package com.austinhlee.android.app1;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class SecondActivity extends AppCompatActivity {
private Button mButton;
private EditText mEditText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
mEditText = (EditText) findViewById(R.id.taskNameEditText);
mButton = (Button) findViewById(R.id.createButton);
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Task newTask = new Task(mEditText.getText().toString());
Database.get(getApplicationContext()).addTask(newTask);
finish();
}
});
}
}
|
e54f0556-8e75-4881-a609-f60605db7d72 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-26 14:15:34", "repo_name": "Android-Runners/Screen_Sharing", "sub_path": "/app/src/main/java/com/savelyevlad/screensharing/help/HelpFragment.java", "file_name": "HelpFragment.java", "file_ext": "java", "file_size_in_byte": 1223, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "f4c773948cc185f5d1671bc924ad74f319b6d4a6", "star_events_count": 4, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Android-Runners/Screen_Sharing | 236 | FILENAME: HelpFragment.java | 0.286169 | package com.savelyevlad.screensharing.help;
import android.annotation.SuppressLint;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.savelyevlad.screensharing.MainActivity;
import com.savelyevlad.screensharing.R;
public final class HelpFragment extends Fragment {
final static String KEY_MSG_4 = "FRAGMENT4_MSG";
public MainActivity getMainActivity() {
return mainActivity;
}
public void setMainActivity(MainActivity mainActivity) {
this.mainActivity = mainActivity;
}
private MainActivity mainActivity;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
@SuppressLint("InflateParams") View view = inflater.inflate(R.layout.fragment_help, null);
Bundle bundle = getArguments();
if(bundle != null) {
String msg = bundle.getString(KEY_MSG_4);
if(msg != null) {
Log.e("lol", "in help");
}
}
return view;
}
}
|
62699c5f-9590-45f2-b396-ad8417af8a11 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-06-07 08:32:26", "repo_name": "rantibi/trygit", "sub_path": "/CompletableExam.java", "file_name": "CompletableExam.java", "file_ext": "java", "file_size_in_byte": 1156, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "872dc061773ba561c69031cf803d8643b6c23d85", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rantibi/trygit | 232 | FILENAME: CompletableExam.java | 0.289372 | import java.util.Timer;
import java.util.concurrent.*;
import java.util.function.Function;
/**
* Created by ran on 02/06/2015.
*/
public class CompletableExam {
public static void main(String[] args) {
ExecutorService executor1 = Executors.newFixedThreadPool(2);
ExecutorService executor2 = Executors.newFixedThreadPool(2);
final CompletableFuture<String> future1 = CompletableFuture.supplyAsync(() -> {
long start = System.currentTimeMillis();
while (System.currentTimeMillis() - start < 1000)
System.out.println("aaa");
return "8";
}, executor1);
final CompletableFuture<String> future2 = CompletableFuture.supplyAsync(() -> {
long start = System.currentTimeMillis();
while (System.currentTimeMillis() - start < 1000)
System.out.println("bbb");
return "65";
}, executor2);
ddasa
future2.join();
future1.join();
future1.thenAccept(System.out::println);
future2.thenAccept(System.out::println);
executor1.shutdown();
executor2.shutdown();
}
}
|
4e6275c9-9c36-4f35-a858-2c5d6cb18447 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-04 05:04:07", "repo_name": "YufanMoNEU/cs5200f18_ZilanZ", "sub_path": "/Assignment-3/cs5200_fall2018_zhang_zilan_jdbc/src/main/java/edu/northeastern/cs5200/models/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 1181, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "b8a921c8f05c3254798993fa32a76a7f49d6e700", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/YufanMoNEU/cs5200f18_ZilanZ | 256 | FILENAME: User.java | 0.23092 | package edu.northeastern.cs5200.models;
import java.util.Date;
public class User extends Person {
private Boolean approvedUser;
private Boolean userAgreement;
public User(int id, String firstName, String lastName) {
super(id, firstName, lastName);
this.userAgreement = false;
}
public User(int id, String firstName, String lastName, String username, String password, String email, Date dob) {
super(id, firstName, lastName, username, password, email, dob);
this.userAgreement = false;
}
public User(int id, String firstName, String lastName, String username, String password, String email, Date dob, Boolean userAgreement) {
super(id, firstName, lastName, username, password, email, dob);
this.userAgreement = userAgreement;
}
public Boolean getApprovedUser() {
return approvedUser;
}
public void setApprovedUser(Boolean approvedUser) {
this.approvedUser = approvedUser;
}
public Boolean getUserAgreement() {
return userAgreement;
}
public void setUserAgreement(Boolean userAgreement) {
this.userAgreement = userAgreement;
}
}
|
9fa100e2-3459-4092-8bd5-63f0e35d6913 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-19 12:41:01", "repo_name": "tomasperezmolina/lfg", "sub_path": "/src/main/java/persistence/entity/GamePlatformForPostEntityPK.java", "file_name": "GamePlatformForPostEntityPK.java", "file_ext": "java", "file_size_in_byte": 1187, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "e544224baa1d8fe0966430d0ef04455d29e8ed61", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tomasperezmolina/lfg | 268 | FILENAME: GamePlatformForPostEntityPK.java | 0.294215 | package persistence.entity;
import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;
import java.util.Objects;
/**
* @author Tomas Perez Molina
*/
public class GamePlatformForPostEntityPK implements Serializable {
private int postId;
private int gamePlatformId;
@Column(name = "POST_ID", nullable = false)
@Id
public int getPostId() {
return postId;
}
public void setPostId(int postId) {
this.postId = postId;
}
@Column(name = "GAME_PLATFORM_ID", nullable = false)
@Id
public int getGamePlatformId() {
return gamePlatformId;
}
public void setGamePlatformId(int gamePlatformId) {
this.gamePlatformId = gamePlatformId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GamePlatformForPostEntityPK that = (GamePlatformForPostEntityPK) o;
return postId == that.postId &&
gamePlatformId == that.gamePlatformId;
}
@Override
public int hashCode() {
return Objects.hash(postId, gamePlatformId);
}
}
|
b8d52f9b-5825-451f-aeb9-ef283f322c14 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-03-20 02:08:47", "repo_name": "emailtohl/web-building", "sub_path": "/src/main/java/com/github/emailtohl/building/message/observer/ChatEventInterestedParty.java", "file_name": "ChatEventInterestedParty.java", "file_ext": "java", "file_size_in_byte": 1030, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "bd1013e6fd96f7268810a6a63fb53e4f099860ea", "star_events_count": 40, "fork_events_count": 8, "src_encoding": "UTF-8"} | https://github.com/emailtohl/web-building | 206 | FILENAME: ChatEventInterestedParty.java | 0.245085 | package com.github.emailtohl.building.message.observer;
import static com.github.emailtohl.building.config.RootContextConfiguration.PROFILE_PRODUCTION;
import static com.github.emailtohl.building.config.RootContextConfiguration.PROFILE_QA;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
import com.github.emailtohl.building.message.event.ChatEvent;
/**
* 对聊天事件感兴趣的监听器
* @author HeLei
* @date 2017.02.04
*/
@Profile({ PROFILE_PRODUCTION, PROFILE_QA })
@Service
public class ChatEventInterestedParty implements ApplicationListener<ChatEvent> {
private static final Logger log = LogManager.getLogger();
@Override
public void onApplicationEvent(ChatEvent event) {
log.info("Chat event for source {} received in chat {}.", event.getSource(),
event.getMessage());
}
}
|
6fd938d0-29ee-4139-b93e-7fcfef2ca81e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-30 14:37:22", "repo_name": "Augustus175/SSH_Demo", "sub_path": "/src/cn/itcast/test/TestApp.java", "file_name": "TestApp.java", "file_ext": "java", "file_size_in_byte": 1224, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "01a9155fac0f7416f4c6ca9537721fa3ebf6ad18", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Augustus175/SSH_Demo | 247 | FILENAME: TestApp.java | 0.259826 | package cn.itcast.test;
import cn.itcast.dao.impl.UserDaoImpl;
import cn.itcast.domain.User;
import cn.itcast.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Gavin.Stevenson on 2016/12/27.
*/
public class TestApp {
public static void main(String[] args) {
User user = new User();
user.setUsername("jack");
user.setPassword("1234");
User user2 = new User();
user2.setUsername("jack");
user2.setPassword("1234");
String xmlPatth = "applicationContext.xml";
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(xmlPatth);
UserService userService = applicationContext.getBean("userService", UserService.class);
userService.saveUser(user);
userService.saveUser(user2);
UserDaoImpl usi = new UserDaoImpl();
List<User> userlist = new ArrayList<>();
userlist = usi.findAll();
for(User u:userlist)
{
System.out.println(u.getId()+" "+u.getUsername()+" "+u.getPassword());
}
}
}
|
64f01c2a-9784-48d2-8128-beb61b1d9411 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-10 12:57:07", "repo_name": "tspetrov/blog_page_backend", "sub_path": "/src/main/java/com/example/blog_page_backend/controllers/HelloWorldController.java", "file_name": "HelloWorldController.java", "file_ext": "java", "file_size_in_byte": 993, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "8774a6f9fac51f460534ac6d28232a7a2da27f89", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tspetrov/blog_page_backend | 177 | FILENAME: HelloWorldController.java | 0.246533 | package com.example.blog_page_backend.controllers;
import com.example.blog_page_backend.DTOs.HelloWorldDTO;
import com.example.blog_page_backend.model.CheckValidCredentials;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorldController {
@Autowired
CheckValidCredentials validateUser;
@GetMapping("/hello")
public HelloWorldDTO getHelloWorld () {
return new HelloWorldDTO(1, "Hello Worlds");
}
//
@GetMapping("/validUser")
public Boolean isUserValid(@RequestParam String username, @RequestParam String password) {
System.out.println("username = " + username + ", password = " + password);
System.out.println(validateUser.checkIfCredentialsAreOk(username, password));
return true;
}
}
|
6636372b-45d1-4905-8b89-52f99c904982 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-09 10:31:04", "repo_name": "hartl3y94/heartcheck", "sub_path": "/src/main/java/org/yun/heartcheck/model/Task.java", "file_name": "Task.java", "file_ext": "java", "file_size_in_byte": 1028, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "e2ac7009625a55cd96309cd4d49cf87216467801", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hartl3y94/heartcheck | 234 | FILENAME: Task.java | 0.252384 | package org.yun.heartcheck.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
@Entity
@DynamicUpdate
@Data
@ApiModel("task model")
public class Task {
@Id
@GenericGenerator(name = "task-uuid", strategy = "uuid")
@GeneratedValue(generator = "task-uuid")
@ApiModelProperty(name = "id", value = "主键")
private String id;
@ApiModelProperty(name = "task_name", value = "任务名称")
private String task_name;
@ApiModelProperty(name = "cron", value = "cron表达式", example = "0/30 * * * * ?")
private String cron;
@ApiModelProperty(name = "status", value = "状态标识", allowableValues = "run,stop", example = "run")
private String status;
@ManyToOne(cascade = {CascadeType.MERGE, CascadeType.REFRESH}, optional = false)
@JoinColumn(name = "url_id")
private Url url;
}
|
7eaac7fc-1bf3-47fb-8f98-98ca04c9ccfd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-01-15 12:05:10", "repo_name": "Achal-Aggarwal/twu-biblioteca-achal", "sub_path": "/src/com/twu/biblioteca/CheckoutBookController.java", "file_name": "CheckoutBookController.java", "file_ext": "java", "file_size_in_byte": 1026, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "82dbc424459fc8dcbd74dcde6f09bac7d417b284", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Achal-Aggarwal/twu-biblioteca-achal | 201 | FILENAME: CheckoutBookController.java | 0.27513 | package com.twu.biblioteca;
public class CheckoutBookController extends Controller {
private CheckoutBookView view;
LoginController loginController;
public CheckoutBookController(LibraryManager libraryManager, InputOutputManger inputOutputManger) {
super(libraryManager);
view = new CheckoutBookView(inputOutputManger);
loginController = new LoginController(libraryManager, inputOutputManger);
}
@Override
public boolean execute() {
boolean login_successful = loginController.execute();
if(!login_successful){
view.setStatus(CheckoutBookView.Status.LOGIN_REQUIRED);
} else if(libraryManager.checkoutBook(view.getBookName())){
view.setStatus(CheckoutBookView.Status.CHECKOUT_SUCCESSFUL);
} else {
view.setStatus(CheckoutBookView.Status.CHECKOUT_UNSUCCESSFUL);
}
view.render();
return true;
}
@Override
public String getTitle() {
return "Checkout book.";
}
}
|
f4a49c0c-4521-4417-a49a-b967212e00a3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-09-16 17:14:04", "repo_name": "FHannes/Multi-Agent-Systems", "sub_path": "/src/main/java/be/kuleuven/cs/mas/message/AgentMessage.java", "file_name": "AgentMessage.java", "file_ext": "java", "file_size_in_byte": 1034, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "ab660bdd7f8e8e0a30c768cc22e7f9e64f44b4e3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/FHannes/Multi-Agent-Systems | 241 | FILENAME: AgentMessage.java | 0.284576 | package be.kuleuven.cs.mas.message;
import com.github.rinde.rinsim.core.model.comm.MessageContents;
import java.util.LinkedList;
import java.util.List;
public class AgentMessage implements MessageContents {
public static final String FIELD_SEP = ";";
public static final String NAME_VALUE_SEP = "=";
AgentMessage(String message) throws IllegalArgumentException {
if (message == null) {
throw new IllegalArgumentException("message cannot be null");
}
this.message = message;
}
private String message;
private String getMessage() {
return this.message;
}
public List<Field> getContents() {
List<Field> toReturn = new LinkedList<>();
String[] fields = this.getMessage().split(FIELD_SEP);
for (String field : fields) {
String[] nameVal = field.split(NAME_VALUE_SEP);
if (nameVal.length == 1) {
toReturn.add(new Field(nameVal[0]));
} else {
toReturn.add(new Field(nameVal[0], nameVal[1]));
}
}
return toReturn;
}
public String toString() {
return this.message;
}
}
|
cddba64f-7b9f-48ee-8844-f61fb7157ef8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-26 13:59:25", "repo_name": "sajithgowda/Flight-Advisor", "sub_path": "/src/main/java/org/siriusxi/htec/fa/domain/model/RolePK.java", "file_name": "RolePK.java", "file_ext": "java", "file_size_in_byte": 1070, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "183218e120760d68dea57d2ad5b1c21498c90f22", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sajithgowda/Flight-Advisor | 228 | FILENAME: RolePK.java | 0.286968 | package org.siriusxi.htec.fa.domain.model;
import lombok.*;
import org.hibernate.Hibernate;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import java.io.Serializable;
import java.util.Objects;
@Embeddable
@Getter
@Setter
@ToString
@NoArgsConstructor
@RequiredArgsConstructor
public class RolePK implements Serializable {
@NonNull
@Basic(optional = false)
@Column(name = "USER_ID", nullable = false)
private Integer userId;
@NonNull
@Basic(optional = false)
@Column(nullable = false)
private String authority;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o))
return false;
RolePK rolePK = (RolePK) o;
return Objects.equals(userId, rolePK.userId)
&& Objects.equals(authority, rolePK.authority);
}
@Override
public int hashCode() {
return Objects.hash(userId, authority);
}
}
|
4f4f2172-13dd-4bb0-a650-e42673b8802c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-03-20 13:55:35", "repo_name": "kvigor83/OnlineTraining", "sub_path": "/src/main/java/by/ihi/onlinetraining/web/listener/ApplicationExitListener.java", "file_name": "ApplicationExitListener.java", "file_ext": "java", "file_size_in_byte": 1181, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "289f84f87d8bd176c1a10630d06fa4070fd36f4d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kvigor83/OnlineTraining | 225 | FILENAME: ApplicationExitListener.java | 0.295027 | package by.ihi.onlinetraining.web.listener;
import by.ihi.onlinetraining.db.ConnectionPool;
import by.ihi.onlinetraining.db.DbConnectionException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
@WebListener
public class ApplicationExitListener implements ServletContextListener {
private static final Logger LOGGER = LogManager.getRootLogger();
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
}
@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
try {
if (ConnectionPool.getInstanceCreated().get()) {
ConnectionPool.getInstance().destroyConnections();
// LOGGER.info("Listener: pool was created");
} else {LOGGER.info("Listener: poll was not created");}
} catch (DbConnectionException e) {
LOGGER.error("Failed to destroy Connection pool with exit application ", e);
}
// LOGGER.info("Listener: pool free ");
}
}
|
7a208088-224f-4e9e-8412-6845f75af107 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-04T07:59:00", "repo_name": "runfengxin/springboot-activemq", "sub_path": "/src/main/java/com/example/demo/producer/Producer.java", "file_name": "Producer.java", "file_ext": "java", "file_size_in_byte": 1026, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "098b328a0199f3ced2f7dea2f52eb8564d4f0cfe", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/runfengxin/springboot-activemq | 180 | FILENAME: Producer.java | 0.235108 | package com.example.demo.producer;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.jms.Destination;
@Component
public class Producer {
@Resource
private JmsMessagingTemplate jmsMessagingTemplate;
public void sendMsgToQueue(String destinationName,String message){
System.out.println("发送Queue--->"+message);
Destination destination=new ActiveMQQueue(destinationName);
jmsMessagingTemplate.convertAndSend(destination,message);
}
public void sendMsgToTopic(String destinationName,String message){
System.out.println("发送Topic--->"+message);
Destination destination=new ActiveMQTopic(destinationName);
jmsMessagingTemplate.convertAndSend(destination,message);
}
}
|
d65e17a5-b4d1-42dd-946f-ab9b23bd7ae8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-03 14:23:44", "repo_name": "jeepchenup/awesome-cws", "sub_path": "/awsome-cws-web/src/test/java/info/chen/awsome/cws/web/configuration/HibernateConfigurationTest.java", "file_name": "HibernateConfigurationTest.java", "file_ext": "java", "file_size_in_byte": 1224, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "096b7339e5bf4290f66e821020a7c55bb6e04d7a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jeepchenup/awesome-cws | 208 | FILENAME: HibernateConfigurationTest.java | 0.282196 | package info.chen.awsome.cws.web.configuration;
import static org.junit.Assert.assertNotNull;
import javax.sql.DataSource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate4.HibernateTransactionManager;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import info.chen.awsome.cws.web.configuration.HibernateConfiguration;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = HibernateConfiguration.class)
@WebAppConfiguration
public class HibernateConfigurationTest {
@Autowired
private HibernateConfiguration hibernateConfig;
@Autowired
HibernateTransactionManager hibernateTransactionManager;
@Autowired
DataSource dataSource;
@Test
public void testHibernateConfigurationNotNull() {
assertNotNull(hibernateConfig);
assertNotNull(hibernateTransactionManager);
assertNotNull(dataSource);
}
/*@Test
public void testHibernateConfig() {
assertEquals("", hibernateConfig);
}*/
}
|
e27d40f2-0aa4-4da3-b856-5d3d0415fc23 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2011-12-09 09:05:13", "repo_name": "sundewei/sadoop", "sub_path": "/src_backup/com/sap/hadoop/index/PathNameInputSplit.java", "file_name": "PathNameInputSplit.java", "file_ext": "java", "file_size_in_byte": 1082, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "f25868528dbfb58edf684e6c8fe09bc0ce56aa84", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "WINDOWS-1252"} | https://github.com/sundewei/sadoop | 251 | FILENAME: PathNameInputSplit.java | 0.246533 | package com.sap.hadoop.index;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapreduce.InputSplit;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
/**
* Created by IntelliJ IDEA.
* User: Frank
* Date: 2011/1/16
* Time: ¤W¤È 10:52:42
* To change this template use File | Settings | File Templates.
*/
public class PathNameInputSplit extends InputSplit implements Writable {
String pathString;
public PathNameInputSplit() {
}
public PathNameInputSplit(String pathString) {
this.pathString = pathString;
}
public long getLength() {
return pathString == null ? 0 : pathString.length();
}
@Override
public void write(DataOutput out) throws IOException {
Text.writeString(out, pathString);
}
@Override
public void readFields(DataInput in) throws IOException {
pathString = Text.readString(in);
}
@Override
public String[] getLocations() throws IOException {
return new String[]{};
}
}
|
84d51fd9-bc27-4430-9f3d-50767b8d291c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-07-04T18:50:19", "repo_name": "0x203/BreezeTestGen", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1066, "line_count": 32, "lang": "en", "doc_type": "text", "blob_id": "fe4decb954283f2ca72e4abe40125c1d378639d4", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/0x203/BreezeTestGen | 258 | FILENAME: README.md | 0.279828 | # BreezeTestGen
[](https://travis-ci.org/0x203/BreezeTestGen)
Generator of Verification Tests for Breeze Netlists.
This project is written in [Scala](http://www.scala-lang.org/) Version 2.11.8.
Usage
----
### First Installation
You'll need Java 8 and [SBT](http://www.scala-sbt.org/).
1. Clone this repository and `cd` into it.
2. Run `sbt "run --help"` for installation and usage information.
### Example
Here is a example for generating tests for a circuit in the `.breeze` format. Generated tests will be stored into the specified file `generated_tests.json`:
sbt "run ./path/to/circuit.breeze generated_test.json"
### Configuration
See `src/main/resources/reference.conf` as reference for configurable values.
Create an `application.conf` in the same location with the same format for your own configuration or use Java system properties.
For further information about the format consult the documentation of [typesafe/config](https://github.com/typesafehub/config).
|
6dcc0074-09b1-4d0a-9c9e-910fa55d08b2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-02 09:42:07", "repo_name": "jurson86/springcloud-tcc", "sub_path": "/tcc-manage/src/main/java/com/tuandai/architecture/component/RestTemplateHelper.java", "file_name": "RestTemplateHelper.java", "file_ext": "java", "file_size_in_byte": 1157, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "00fdf79e26d96e51be283935188de3b1323df461", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/jurson86/springcloud-tcc | 224 | FILENAME: RestTemplateHelper.java | 0.285372 | package com.tuandai.architecture.component;
import org.apache.http.impl.client.HttpClientBuilder;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import com.tuandai.architecture.constant.Constants;
@Component
public class RestTemplateHelper {
final HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(HttpClientBuilder.create()
.setMaxConnTotal(200)
.setMaxConnPerRoute(100)
.build());
@LoadBalanced
@Bean
protected RestTemplate restTemplate() {
httpRequestFactory.setConnectionRequestTimeout(Constants.TCC_RESTFUL_MAX_TIMEOUT_SECONDS * 1000);
httpRequestFactory.setConnectTimeout(Constants.TCC_RESTFUL_MAX_TIMEOUT_SECONDS * 1000);
httpRequestFactory.setReadTimeout(Constants.TCC_RESTFUL_MAX_TIMEOUT_SECONDS * 1000);
return new RestTemplate(httpRequestFactory);
}
}
|
ce5fd186-c14e-418e-89b4-046c07a67eb9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-06-13 06:49:51", "repo_name": "joshterrell805-historic/EClass", "sub_path": "/prototype/EClassPrototype/src/application/AudioVideoController.java", "file_name": "AudioVideoController.java", "file_ext": "java", "file_size_in_byte": 1187, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "56ee0006b6fbdeef76acedabdee5315488e584d6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/joshterrell805-historic/EClass | 225 | FILENAME: AudioVideoController.java | 0.288569 | package application;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
public class AudioVideoController implements Initializable {
@FXML // fx:id="avOnButton"
private Button avOnButton;
@FXML // fx:id="avOffButton"
private Button avOffButton;
@Override
public void initialize(URL fxmlFileLocation, final ResourceBundle resources) {
avOnButton.setOnAction(new EventHandler<ActionEvent>() {
@SuppressWarnings("unchecked")
public void handle(ActionEvent event) {
Parent root = null;
try {
root = FXMLLoader.load(getClass().getResource("AudioVideoStream.fxml"));
} catch (IOException e) {
e.printStackTrace();
}
Stage stage = new Stage();
stage.setScene(new Scene(root));
stage.show();
}
});
}
} |
d170d826-7525-4918-b74f-13a9a0fc83f2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-28 01:54:28", "repo_name": "lumiayx/activeMQ", "sub_path": "/src/main/java/com/yx/activeMQ/queues/MQProvider.java", "file_name": "MQProvider.java", "file_ext": "java", "file_size_in_byte": 999, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "8fea305ee0b5145b56f6303ba92a564397f528a5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lumiayx/activeMQ | 213 | FILENAME: MQProvider.java | 0.252384 | package com.yx.activeMQ.queues;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.apache.activemq.ActiveMQConnectionFactory;
public class MQProvider {
private static final String URL = "tcp://localhost:61616";
private static final String name = "queues-test";
public static void main(String[] args) throws JMSException {
ConnectionFactory factory = new ActiveMQConnectionFactory(URL);
Connection connection = factory.createConnection();
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination dest = session.createQueue(name);
MessageProducer producer = session.createProducer(dest);
for (int i = 0; i < 200; i++) {
TextMessage message = session.createTextMessage("消息:" + i);
producer.send(message);
}
connection.close();
}
}
|
d1c7fce5-6771-442a-84d2-1cf8b106118f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-04 07:03:06", "repo_name": "SongLinYang12138/YangBase", "sub_path": "/app/src/main/java/com/bondex/ysl/bondex/base/login/LoginViewModel.java", "file_name": "LoginViewModel.java", "file_ext": "java", "file_size_in_byte": 994, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "4acf4cc81b0430cfdc464714847df93e53dbb0c2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/SongLinYang12138/YangBase | 199 | FILENAME: LoginViewModel.java | 0.206894 | package com.bondex.ysl.bondex.base.login;
import android.app.Application;
import android.content.Context;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.View;
import com.bondex.ysl.bondex.base.main.MainActivity;
import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
/**
* date: 2018/12/13
* Author: ysl
* description:
*/
public class LoginViewModel extends BaseViewModel {
private Context context;
private static final String TAG = LoginViewModel.class.getSimpleName();
public LoginViewModel(@NonNull Application application) {
super(application);
context = application.getApplicationContext();
}
public BindingCommand loginCommand = new BindingCommand(new BindingAction() {
@Override
public void call() {
startActivity(MainActivity.class);
}
});
}
|
434ff203-daa7-421b-a03c-a78485ad941b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-10-10 08:28:41", "repo_name": "KennyZhu/wx", "sub_path": "/src/main/java/com/kennyzhu/wx/core/enums/WeiXinPublicMsgTypeEnum.java", "file_name": "WeiXinPublicMsgTypeEnum.java", "file_ext": "java", "file_size_in_byte": 1068, "line_count": 54, "lang": "zh", "doc_type": "code", "blob_id": "815ced65423cc9a5aad13e2fa8991a5dfa1efe4b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/KennyZhu/wx | 268 | FILENAME: WeiXinPublicMsgTypeEnum.java | 0.250913 | package com.kennyzhu.wx.core.enums;
import org.apache.commons.lang3.StringUtils;
/**
* Desc:微信公众平台消息类型
* <p/>Date: 2014/11/26
* <br/>Time: 16:33
* <br/>User: ylzhu
*/
public enum WeiXinPublicMsgTypeEnum {
/**
* 文本消息
*/
TEXT("text"),
/**
* 图片消息
*/
IMAGE("image"),
/**
* 音频消息
*/
AUDIO("audio"),
/**
* 地理位置消息
*/
LOCATION("location"),
/**
* 事件消息
*/
EVENT("event");
private String value;
private WeiXinPublicMsgTypeEnum(String value) {
this.value = value;
}
public String getValue() {
return this.value;
}
public static WeiXinPublicMsgTypeEnum getByMsgType(String msgType) {
if (StringUtils.isNotBlank(msgType)) {
for (WeiXinPublicMsgTypeEnum enums : WeiXinPublicMsgTypeEnum.values()) {
if (enums.getValue().equals(msgType)) {
return enums;
}
}
}
return null;
}
}
|
f8a8b7bf-597b-4513-a563-1b0a33669acb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-09 14:18:53", "repo_name": "sheetalp15/actitime", "sub_path": "/Selenium_training/src/sikuli/LoginTest.java", "file_name": "LoginTest.java", "file_ext": "java", "file_size_in_byte": 1010, "line_count": 26, "lang": "en", "doc_type": "code", "blob_id": "f757eeebd40c8f084d32fca83274f1ab21099b08", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sheetalp15/actitime | 236 | FILENAME: LoginTest.java | 0.252384 | package sikuli;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;
import org.sikuli.script.SikuliException;
public class LoginTest {
public static void main(String[] args) throws SikuliException
{
System.out.println("welcome");
System.setProperty("webdriver.chrome.driver", "drivers\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://localhost/login.do");
Screen s1 = new Screen();
Pattern unm = new Pattern("C:\\selenium\\Eclipse_WS\\Selenium_training\\Sikuli_Images\\unm.JPG");
Pattern pwd = new Pattern("C:\\selenium\\Eclipse_WS\\Selenium_training\\Sikuli_Images\\pwd.JPG");
Pattern login = new Pattern("C:\\selenium\\Eclipse_WS\\Selenium_training\\Sikuli_Images\\login.JPG");
s1.type(unm, "admin");
s1.type(pwd, "manager");
s1.click(login);}
}
|
364d0f02-4645-4de8-93f5-325ded6b19fa | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-09-18 10:06:34", "repo_name": "NightFarmer/CommonUtil", "sub_path": "/sample/src/main/java/com/nightfarmer/commonutil/sample/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1050, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "ac47f6a313c9e69c0ebf43d21fdabb89b639afae", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/NightFarmer/CommonUtil | 225 | FILENAME: MainActivity.java | 0.249447 | package com.nightfarmer.commonutil.sample;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.nightfarmer.commonutil.ClipboardUtil;
public class MainActivity extends AppCompatActivity {
TextView console;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
console = (TextView) findViewById(R.id.console);
}
int count = 0;
public void a1(View v) {
// ClipboardUtil.INSTANCE.copyToClipboard(this, "a");
ClipboardUtil.INSTANCE.append(this, "a" + (++count));
}
public void a2(View v) {
Log.i("1", "" + ClipboardUtil.INSTANCE.getItemCount(this));
}
public void a3(View v) {
Log.i("1", "" + ClipboardUtil.INSTANCE.getText(this, 0));
}
public void a4(View v) {
Log.i("1", "" + ClipboardUtil.INSTANCE.getLatestText(this));
}
}
|
c8a12150-eeef-4bb8-a90d-ff66bf7c3385 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-10 17:34:13", "repo_name": "gaeun917-zz/BabySitterApp", "sub_path": "/app/src/main/java/com/example/gaeunlee/babysitter/add_child_categories/AddMealTimeActivity.java", "file_name": "AddMealTimeActivity.java", "file_ext": "java", "file_size_in_byte": 1109, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "4721086592a89289d6cbd4e14919538048ca6d6b", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/gaeun917-zz/BabySitterApp | 221 | FILENAME: AddMealTimeActivity.java | 0.226784 | package com.example.gaeunlee.babysitter.add_child_categories;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.example.gaeunlee.babysitter.R;
public class AddMealTimeActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_meal_time);
}
// 버튼 온클릭으로 xml에서 주어진 값 :
public void showTimePickerDialog1(View v) {
DialogFragment newFragment = new TimePickerMeal();
newFragment.show(getSupportFragmentManager(), "timePicker1");
}
public void showTimePickerDialog2(View v) {
DialogFragment newFragment = new TimePickerMeal();
newFragment.show(getSupportFragmentManager(), "timePicker2");
}
public void showTimePickerDialog3(View v) {
DialogFragment newFragment = new TimePickerMeal();
newFragment.show(getSupportFragmentManager(), "timePicker3");
}
}
|
f7f77183-2e12-40f9-9536-398ceb0ae1ba | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-27 19:15:56", "repo_name": "javastartpl/android-podstawy-lekcje", "sub_path": "/app/src/main/java/pl/javastart/ap/webclient/NewCategoryFragment.java", "file_name": "NewCategoryFragment.java", "file_ext": "java", "file_size_in_byte": 1181, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "49fed7dd033dfecd1585ddd562e743f9e25877c7", "star_events_count": 0, "fork_events_count": 4, "src_encoding": "UTF-8"} | https://github.com/javastartpl/android-podstawy-lekcje | 199 | FILENAME: NewCategoryFragment.java | 0.236516 | package pl.javastart.ap.webclient;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.widget.EditText;
public class NewCategoryFragment extends DialogFragment {
private NewCategoryCallback callback;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Nowa kategoria");
final EditText input = new EditText(getActivity());
builder.setView(input);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
callback.newCategoryAddButtonPressed(input.getText().toString());
}
});
builder.setNegativeButton("Anuluj", null);
return builder.create();
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
callback = (NewCategoryCallback) getActivity();
}
}
|
a7454b83-e176-42a1-ac1d-4c6ae674ef0e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-05-24 10:35:16", "repo_name": "TomaszKwolek/HibernateJPAGroup2", "sub_path": "/spring-data-model/src/main/java/pl/spring/demo/to/LibraryTo.java", "file_name": "LibraryTo.java", "file_ext": "java", "file_size_in_byte": 1028, "line_count": 71, "lang": "en", "doc_type": "code", "blob_id": "c3d94e542a7b17b97c708080f4c176aaa8d620b9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/TomaszKwolek/HibernateJPAGroup2 | 265 | FILENAME: LibraryTo.java | 0.276691 | package pl.spring.demo.to;
import java.util.List;
public class LibraryTo {
private Long id;
private String name;
private List<BookTo> books;
private Long version;
public LibraryTo() {
}
public LibraryTo(Long id, String name, List<BookTo> books, Long version) {
super();
this.id=id;
this.name = name;
this.books = books;
this.version=version;
}
public LibraryTo(Long id, String name, List<BookTo> books) {
super();
this.id=id;
this.name = name;
this.books = books;
}
public LibraryTo(String name) {
super();
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<BookTo> getBooks() {
return books;
}
public void setBooks(List<BookTo> books) {
this.books = books;
}
public Long getVersion() {
return version;
}
public void setVersion(Long version) {
this.version = version;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
|
652de0e3-88cc-4ef3-b3e6-90836f599068 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-20 02:08:05", "repo_name": "dmstocking/put-it-on-the-list", "sub_path": "/app/src/main/java/com/github/dmstocking/putitonthelist/grocery_list/items/add/CategoryDocument.java", "file_name": "CategoryDocument.java", "file_ext": "java", "file_size_in_byte": 1223, "line_count": 60, "lang": "en", "doc_type": "code", "blob_id": "c1711feba50cd92ce03f64ce96e7acc083b376aa", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dmstocking/put-it-on-the-list | 241 | FILENAME: CategoryDocument.java | 0.236516 | package com.github.dmstocking.putitonthelist.grocery_list.items.add;
import com.github.dmstocking.putitonthelist.Color;
import com.github.dmstocking.putitonthelist.Icon;
import com.google.firebase.firestore.Exclude;
public class CategoryDocument {
@Exclude
private String id;
private String category;
private Color color;
private Icon icon;
private int order;
public CategoryDocument() {
}
public CategoryDocument(String category) {
this.category = category;
}
public CategoryDocument(String id,
String category,
Color color,
Icon icon,
int order) {
this.id = id;
this.category = category;
this.color = color;
this.icon = icon;
this.order = order;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCategory() {
return category;
}
public Color getColor() {
return color;
}
public Icon getIcon() {
return icon;
}
public int getOrder() {
return order;
}
}
|
032feac3-cfbb-4584-a5d5-e9f5b03a3426 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-08-01 21:16:29", "repo_name": "splitio/java-client", "sub_path": "/client/src/main/java/io/split/engine/sse/dtos/OccupancyNotification.java", "file_name": "OccupancyNotification.java", "file_ext": "java", "file_size_in_byte": 1156, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "b8f5b52dd671a4fe61a85fc5c1deaf5c7d64bbf5", "star_events_count": 27, "fork_events_count": 18, "src_encoding": "UTF-8"} | https://github.com/splitio/java-client | 220 | FILENAME: OccupancyNotification.java | 0.264358 | package io.split.engine.sse.dtos;
import io.split.engine.sse.PushStatusTracker;
import io.split.engine.sse.NotificationProcessor;
public class OccupancyNotification extends IncomingNotification implements StatusNotification {
private final OccupancyMetrics metrics;
public OccupancyNotification(GenericNotificationData genericNotificationData) {
super(Type.OCCUPANCY, genericNotificationData.getChannel());
this.metrics = genericNotificationData.getMetrics();
}
public OccupancyMetrics getMetrics() {
return metrics;
}
@Override
public void handler(NotificationProcessor notificationProcessor) {
notificationProcessor.processStatus(this);
}
@Override
public void handlerStatus(PushStatusTracker notificationManagerKeeper) {
notificationManagerKeeper.handleIncomingOccupancyEvent(this);
}
@Override
public String toString() {
try {
return String.format("Type: %s; Channel: %s; Publishers: %s", getType(), getChannel(), getMetrics().getPublishers());
} catch (Exception ex) {
return super.toString();
}
}
}
|
6e24a35d-719d-49cd-ab4c-dd985e43820d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-09-24 08:41:51", "repo_name": "x3408/libsystem", "sub_path": "/src/main/java/com/xc/libsystem/Interceptor/LoginInterceptor.java", "file_name": "LoginInterceptor.java", "file_ext": "java", "file_size_in_byte": 1188, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "41c93d960515baea8a6d536ce58edb6204ca9917", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/x3408/libsystem | 199 | FILENAME: LoginInterceptor.java | 0.235108 | package com.xc.libsystem.Interceptor;
import com.xc.libsystem.Util.LoginResult;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
public class LoginInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
if ("autoLogin".equals(cookie.getName())) {
String account = (cookie.getValue().split("#login#"))[0];
String password = (cookie.getValue().split("#login#"))[1];
request.getRequestDispatcher("/user?account="+ account+"&password="+password).forward(request, response);
return false;
}
}
}
request.getRequestDispatcher("/noAuthorization").forward(request, response);
return false;
}
}
|
0fd111e5-8423-43f5-bc40-2c1ec8b2efea | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-30 13:07:13", "repo_name": "santanukumardas/IPL-2019", "sub_path": "/app/src/main/java/com/santanu/customarrayadapter/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1222, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "46eff390bcf47b80ccab0cff6bbca150617ac7c5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/santanukumardas/IPL-2019 | 199 | FILENAME: MainActivity.java | 0.196826 | package com.santanu.customarrayadapter;
import android.content.Intent;
import android.media.Image;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import org.w3c.dom.Text;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView click = findViewById(R.id.click_text_view);
click.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intentStart = new Intent(MainActivity.this, InfoActivity.class);
startActivity(intentStart);
}
});
TextView info = findViewById(R.id.info_text_View);
info.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intentAboutApp = new Intent(MainActivity.this,AboutAppActivity.class);
startActivity(intentAboutApp);
}
});
}
}
|
a729b2f6-e839-4f8d-92d5-c2952842d552 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-07-06 20:45:05", "repo_name": "johnarleyburns/ranchan", "sub_path": "/app/src/main/java/com/chanapps/ranchan/app/views/SquareNetworkImageView.java", "file_name": "SquareNetworkImageView.java", "file_ext": "java", "file_size_in_byte": 1155, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "409d03540ec772ccc81d4fa83c1f6b93f4645a3e", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/johnarleyburns/ranchan | 223 | FILENAME: SquareNetworkImageView.java | 0.256832 | package com.chanapps.ranchan.app.views;
import android.content.Context;
import android.util.AttributeSet;
import com.android.volley.toolbox.NetworkImageView;
/**
* Created by johnarleyburns on 27/06/14.
*/
public class SquareNetworkImageView extends NetworkImageView {
public SquareNetworkImageView(final Context context)
{
super(context);
}
public SquareNetworkImageView(final Context context, final AttributeSet attrs)
{
super(context, attrs);
}
public SquareNetworkImageView(final Context context, final AttributeSet attrs, final int defStyle)
{
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec)
{
final int width = getDefaultSize(getSuggestedMinimumWidth(),widthMeasureSpec);
setMeasuredDimension(width, width);
}
@Override
protected void onSizeChanged(final int w, final int h, final int oldw, final int oldh)
{
super.onSizeChanged(w, w, oldw, oldh);
}
}
|
c516e496-7afe-4698-984f-499af0af9ef9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-08-27T09:07:45", "repo_name": "4bhishekKasam/My-Google-Map-", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 994, "line_count": 25, "lang": "en", "doc_type": "text", "blob_id": "87023666ea6d6d10278eb6151793eccd3627be3d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/4bhishekKasam/My-Google-Map- | 257 | FILENAME: README.md | 0.242206 | <p align="center">
<img src="https://github.com/4bhishekKasam/My-Google-Map-/blob/master/map.PNG" width="850"/>
</p>
<br/>
<p align="center">
Step 1: Get an API Key from the Google Cloud Platform Console
Step 2: Add the API key to your application
https://www.google.com/maps/embed/v1/MODE?key=YOUR_API_KEY¶meters
Follow these steps to get an API key:
<p> Go to the Google Cloud Platform Console.</p>
<p> Go to the Google Cloud Platform Console.</p>
<p> Create or select a project. </p>
<p>Click Continue to enable the API. </p>
<p>On the Credentials page, get an API key. </p>
Note: If you have an existing unrestricted API key, or a key with browser restrictions, you may use that key.
From the dialog displaying the API key, select Restrict key to set a browser restriction on the API key.
In the Key restriction section, select HTTP referrers (web sites), then follow the on-screen instructions to set referrers, then click Save. Read more about restricting API keys.
</p>
|
1dec980b-9e3d-4571-b901-f193ff2a2ef1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-10 03:36:09", "repo_name": "mdrahil/medicBuddy", "sub_path": "/app/src/main/java/com/cricbuzz/medicbuddy/base/BaseFragment.java", "file_name": "BaseFragment.java", "file_ext": "java", "file_size_in_byte": 1187, "line_count": 53, "lang": "en", "doc_type": "code", "blob_id": "412a05ae9be2957a368b8eec7efe0398da6938c0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mdrahil/medicBuddy | 217 | FILENAME: BaseFragment.java | 0.249447 | package com.cricbuzz.medicbuddy.base;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.widget.TextView;
import com.cricbuzz.medicbuddy.utils.Utils;
import java.lang.reflect.Field;
/**
* A simple {@link Fragment} subclass.
*/
public abstract class BaseFragment extends Fragment {
protected String TAG = "";
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TAG = getClass().getSimpleName();
}
public String getName() {
return getClass().getSimpleName();
}
public String getTrimmedText(TextView textView) {
return textView.getText().toString().trim();
}
@Override
public void onDetach() {
Utils.hideKeyboard(getContext());
super.onDetach();
try {
Field childFragmentManager = Fragment.class.getDeclaredField("mChildFragmentManager");
childFragmentManager.setAccessible(true);
childFragmentManager.set(this, null);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
|
99dd6faf-01b4-41ba-84a0-2360b829b02a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-29 18:44:57", "repo_name": "kuldeepshandilya/algo-ds", "sub_path": "/src/main/java/com/practice/algods/tree/TreeNode.java", "file_name": "TreeNode.java", "file_ext": "java", "file_size_in_byte": 1035, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "557c7d8f79973031151123220dbcf340a6b7e862", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kuldeepshandilya/algo-ds | 248 | FILENAME: TreeNode.java | 0.259826 | package com.practice.algods.tree;
public class TreeNode<Comparable> {
private Comparable data;
private TreeNode leftChild, rightChild;
public TreeNode(Comparable data){
this.data = data;
}
public TreeNode(Comparable data, TreeNode leftChild, TreeNode rightChild) {
this.data = data;
this.leftChild = leftChild;
this.rightChild = rightChild;
}
public Comparable getData() {
return data;
}
public com.practice.algods.tree.TreeNode getLeftChild() {
return leftChild;
}
public com.practice.algods.tree.TreeNode getRightChild() {
return rightChild;
}
public void setData(Comparable data) {
this.data = data;
}
public void setLeftChild(TreeNode leftChild) {
this.leftChild = leftChild;
}
public void setRightChild(TreeNode rightChild) {
this.rightChild = rightChild;
}
@Override
public String toString() {
return "TreeNode{" +
"data=" + data +
", leftChild=" + leftChild +
", rightChild=" + rightChild +
'}';
}
}
|
add48e61-8934-4bf5-b6d9-1d16650cca78 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-10T13:58:40", "repo_name": "houwenhua/authoritycontrolshiro", "sub_path": "/src/main/java/com/hwh/vo/MenusVo.java", "file_name": "MenusVo.java", "file_ext": "java", "file_size_in_byte": 1191, "line_count": 74, "lang": "en", "doc_type": "code", "blob_id": "3dbd3f4d7b2d189de96210e6f4f1b1a2c1cb9dc0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/houwenhua/authoritycontrolshiro | 304 | FILENAME: MenusVo.java | 0.214691 | package com.hwh.vo;
import java.util.List;
/**
* 功能描述:
*
* @Author houwenhua
* @Date 2018/10/3 13:05
*/
public class MenusVo {
private Integer id;
private String text;
private String url;
private String icon;
private List<MenusVo> menus;
public MenusVo() {
}
public MenusVo(Integer id, String text, String url, String icon, List<MenusVo> menus) {
this.id = id;
this.text = text;
this.url = url;
this.icon = icon;
this.menus = menus;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public List<MenusVo> getMenus() {
return menus;
}
public void setMenus(List<MenusVo> menus) {
this.menus = menus;
}
}
|
8ede50f2-f51e-486c-9431-3f7fb786e9c7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-11 04:43:05", "repo_name": "Indian-Dev/Material-Smart-Rating", "sub_path": "/app/src/main/java/com/vimalcvs/myrateapp/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1026, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "91876328e73cf0854f3a0254a554a064631d3acf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Indian-Dev/Material-Smart-Rating | 185 | FILENAME: MainActivity.java | 0.214691 | package com.vimalcvs.myrateapp;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.vimalcvs.materialrating.util.RateDialogManager;
/**
* Created by VimalCvs on 02/11/2020.
*/
public class MainActivity extends AppCompatActivity {
Bundle rating;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setTitle(getString(R.string.app_name));
Button button = findViewById(R.id.rate_ok);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Rating Dialog
RateDialogManager.showRateDialog(MainActivity.this, rating);
}
});
}
}
|
564fe34b-0a90-4f29-aa8a-875895ced4d1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-28 18:16:34", "repo_name": "gitskarios/Gitskarios", "sub_path": "/app/src/main/java/com/alorma/github/ui/activity/repo/RepoReadmeActivity.java", "file_name": "RepoReadmeActivity.java", "file_ext": "java", "file_size_in_byte": 1223, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "273ecb2637c4e385dda5634a2534e917320c55f4", "star_events_count": 678, "fork_events_count": 172, "src_encoding": "UTF-8"} | https://github.com/gitskarios/Gitskarios | 245 | FILENAME: RepoReadmeActivity.java | 0.274351 | package com.alorma.github.ui.activity.repo;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import com.alorma.github.R;
import com.alorma.github.sdk.bean.info.RepoInfo;
import com.alorma.github.ui.activity.base.RepositoryThemeActivity;
public class RepoReadmeActivity extends RepositoryThemeActivity {
private static final String REPO_INFO = "REPO_INFO";
public static Intent createIntent(Context context, RepoInfo repoInfo) {
Intent intent = new Intent(context, RepoReadmeActivity.class);
intent.putExtra(REPO_INFO, repoInfo);
return intent;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.generic_toolbar_responsive);
RepoInfo repoInfo = getIntent().getExtras().getParcelable(REPO_INFO);
if (repoInfo != null) {
setTitle(repoInfo.toString());
RepoReadmeFragment fragment = RepoReadmeFragment.newInstance(repoInfo);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.content, fragment);
ft.commit();
} else {
finish();
}
}
}
|
78a85473-9dee-4a87-9db2-2c1d0a8c6b7a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-26 16:24:01", "repo_name": "ssverud/UdpReciever", "sub_path": "/src/sample/UdpSender.java", "file_name": "UdpSender.java", "file_ext": "java", "file_size_in_byte": 1155, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "e9693203abdf6dc03bad80c37ea7854709e445b4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ssverud/UdpReciever | 225 | FILENAME: UdpSender.java | 0.26588 | package sample;
import java.io.*;
import java.net.*;
import java.net.InetAddress;
public class UdpSender {
private DatagramSocket socket;
private Drone drone;
// constructor
public UdpSender(Drone drone) {
this.drone = drone;
}
// method to send an UDP
public void sendUdp(Message message) {
try {
//prepares socket
try {
socket = new DatagramSocket();
} catch (SocketException e) {
e.printStackTrace();
}
// picks up the drone IP
InetAddress ip = InetAddress.getByName(drone.getIP());
// prepares array for data
byte data[];
// change the string into bytes
data = message.getMessage().getBytes();
// Creating the datagramPacket
DatagramPacket datagramPacket =
new DatagramPacket(data, data.length, ip, 7007);
// sends
socket.send(datagramPacket);
System.out.println("PACKET SENT");
} catch (IOException e) {
e.printStackTrace();
}
}
} |
4ab09ff7-d950-4bee-99ae-e56883ea171a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2006-07-05 02:23:17", "repo_name": "syrus-ru/amficom", "sub_path": "/hw/r6/src/com/syrus/AMFICOM/kis/Transceiver.java", "file_name": "Transceiver.java", "file_ext": "java", "file_size_in_byte": 1180, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "aafef0afb5d9f6cd4dd7a975d120e0962dfc357e", "star_events_count": 5, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/syrus-ru/amficom | 230 | FILENAME: Transceiver.java | 0.249447 | package com.syrus.AMFICOM.kis;
public class Transceiver {
private static String measurement_id;
private static String measurement_type_id;
private static String local_address;
private static String[] par_names;
private static byte[][] par_values;
static {
System.loadLibrary("r6transceiver");
}
public static native int create(String fileName);
public static native boolean open(int fileHandle);
public static native boolean close(int fileHandle);
public static native boolean read1(int fileHandle, String fileName);
public static native boolean push1(int fileHandle, String fileName,
String measurement_id,
String[] par_names,
byte[][] par_values);
public static String getMeasurementId() {
return measurement_id;
}
public static String getMeasurementTypeId() {
return measurement_type_id;
}
public static String getLocalAddress() {
return local_address;
}
public static String[] getParameterNames() {
return par_names;
}
public static byte[][] getParameterValues() {
return par_values;
}
} |
f1f2a963-d9a5-447e-9d46-be6f9fd70fbd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-03 08:38:33", "repo_name": "moushumiseal/SmartWall-API", "sub_path": "/SmartWall/src/java/edu/sg/nus/iss/smartwall/util/SmartWallFilter.java", "file_name": "SmartWallFilter.java", "file_ext": "java", "file_size_in_byte": 1188, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "e4d9ba4d2dad6bbbc6bc2b5fcf03eff96ac0fee3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/moushumiseal/SmartWall-API | 228 | FILENAME: SmartWallFilter.java | 0.240775 | package edu.sg.nus.iss.smartwall.util;
import java.io.IOException;
import javax.ws.rs.NotAuthorizedException;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.container.PreMatching;
import javax.ws.rs.ext.Provider;
/**
*
* @author Moushumi Seal
*/
@Provider
@PreMatching
public class SmartWallFilter implements ContainerRequestFilter {
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
System.out.println("*******Request:="+requestContext.getUriInfo().getRequestUri());
System.out.println("*******Request:="+requestContext.getUriInfo().getPathParameters());
System.out.println("*******Request:="+requestContext.getUriInfo().getQueryParameters());
System.out.println("*******Request:="+requestContext.getEntityStream().toString());
System.out.println(requestContext.getPropertyNames());
String authHeader = requestContext.getHeaderString("smartwallheader");
if (authHeader == null || !authHeader.equals("smartwall")) {
throw new NotAuthorizedException("Illegal Access");
}
}
}
|
c3de013d-1188-4d7e-a3f7-544f048e33b2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-24 10:15:48", "repo_name": "zhunhuang/java-demos", "sub_path": "/H2DatabaseInSpring/src/main/java/Main.java", "file_name": "Main.java", "file_ext": "java", "file_size_in_byte": 1052, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "560ece5870808626f554148e5cf4beff2a769c3a", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/zhunhuang/java-demos | 192 | FILENAME: Main.java | 0.210766 | import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.datasource.SimpleDriverDataSource;
import java.sql.*;
/**
* @author: zhun.huang
* @create: 2018-03-30 下午4:36
* @email: nolan.zhun@gmail.com
* @description:
*/
public class Main {
public static void main(String[] args) {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring.xml");
SimpleDriverDataSource dataSource = (SimpleDriverDataSource)context.getBean("dataSource");
try {
Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * from ADMIN_USER");
while (resultSet.next()) {
System.out.println(resultSet.getString("name"));
System.out.println(resultSet.getString("password"));
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
|
f9be8489-36a9-46d3-bfa2-70ebd3a4db6c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-06-20 20:22:23", "repo_name": "AZHARDEEN/cloudsystems", "sub_path": "/cloudsystems/ViewPrj/src/main/java/br/com/mcampos/controller/anoto/util/AnotoBook.java", "file_name": "AnotoBook.java", "file_ext": "java", "file_size_in_byte": 1078, "line_count": 62, "lang": "en", "doc_type": "code", "blob_id": "27c20a5d6d3a30726034bdc5412c6e9bff409220", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AZHARDEEN/cloudsystems | 229 | FILENAME: AnotoBook.java | 0.286968 | package br.com.mcampos.controller.anoto.util;
import com.anoto.api.Page;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class AnotoBook implements Serializable
{
Iterator book;
List<Page> pages;
public AnotoBook()
{
super();
}
public AnotoBook ( Iterator book )
{
super ();
setBook( book );
}
protected void setBook( Iterator book )
{
this.book = book;
while ( book != null && book.hasNext() )
{
Object obj = book.next();
addPage( (Page) obj );
}
}
public Iterator getBook()
{
return book;
}
public List<Page> getPages()
{
if ( pages == null )
pages = new ArrayList<Page> ();
return pages;
}
public void addPage ( Page page )
{
getPages().add( page );
}
public int getPageCount()
{
return getPages().size();
}
}
|
edbaeeb5-3602-453e-9ce0-eb471f8f7cb8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-04-21T11:44:53", "repo_name": "hnakamur/my-mock-configs-for-building-rpm-on-ubuntu", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1223, "line_count": 54, "lang": "en", "doc_type": "text", "blob_id": "28f4802e5af24a5f78e9a3def5c6418a30b9a58c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hnakamur/my-mock-configs-for-building-rpm-on-ubuntu | 376 | FILENAME: README.md | 0.250913 | my-mock-configs-for-building-rpm-on-ubuntu
==========================================
## How to setup mock
Install mock and place my config files for chroot environments.
```
sudo apt install mock
```
Copy `*.cfg` files in this repository to /etc/mock/.
```
sudo *.cfg /etc/mock/
```
Install CentOS7 and epel gpg key files.
* CentOS 7 Signing Key at [CentOS GPG Keys](https://www.centos.org/keys/)
* EPEL 7 at [Package Signing Keys](https://getfedora.org/en/keys/)
```
sudo mkdir -p /usr/share/distribution-gpg-keys/{centos,epel}
sudo curl -L -o /usr/share/distribution-gpg-keys/centos/RPM-GPG-KEY-CentOS-7 \
https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7
sudo curl -L -o /usr/share/distribution-gpg-keys/epel/RPM-GPG-KEY-EPEL-7 \
https://getfedora.org/static/352C64E5.txt
```
Create `mock` group and add my user to `mock`group .
```
sudo groupadd -r mock
sudo usermod -a -G mock $USER
```
## How to setup copr-cli
Install copr-cli from my PPA
```
sudo add-apt-repository ppa:hnakamur/copr-cli
sudo apt update
sudo apt install python3-copr-cli
```
Go to [API for Copr](https://copr.fedorainfracloud.org/api/)
and login with fedora copr account.
Copy the API token information to `~/.config/copr`.
|
50be646a-0e6e-4b33-b0b2-a1680b40ce9f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-08-13T15:23:47", "repo_name": "ampize/docs", "sub_path": "/content/docs/tutorials/plug/query.md", "file_name": "query.md", "file_ext": "md", "file_size_in_byte": 1093, "line_count": 26, "lang": "en", "doc_type": "text", "blob_id": "9d13e2b7296846df6d16a58f0f5972f5fb696dee", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ampize/docs | 287 | FILENAME: query.md | 0.246533 | ---
$title@: Query params
$order: 2
---
Now, you can set your parameters specific to your API. (For this example, we will use params specific to The Guardian API):
a. Basic Authorization
- This is an optional addition
b. Query Params - Here, you can set the parameters specific to your API. (For this example, we will use params specific to The Guardian API:
- Select ‘Add Query Param’
- Fill in the key and the value specific to your API. (For The Guardian API we will use the following 2:)
- the query param "show-fields" is used to get the detailed article fields
- the query-param "show-tags" to get the article tags.
<amp-img src="/static/img/plug_query.png" width="897"height="583" layout="responsive" class="screenshot">
c. HTTP Headers
- Select ‘add HTTP header’ to input your unique API key. (For The Guardian API example, we will use api-key 'test')
<amp-img src="/static/img/plug_header.png" width="899"height="491" layout="responsive" class="screenshot">
<p class="white"><a class="btn right" href="/docs/tutorials/plug/model">Continue to Step 3</a></p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.