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 |
|---|---|---|---|---|---|---|
1b996367-c9e7-4bfe-82dc-c3e731c81004 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-20 13:41:00", "repo_name": "tomaszsojka/restaurant-backend-springBoot", "sub_path": "/src/main/java/com/dev/restaurant/model/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 1170, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "ecb32cb61509c321d1c8e63706536a1e661ed133", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tomaszsojka/restaurant-backend-springBoot | 225 | FILENAME: User.java | 0.217338 | package com.dev.restaurant.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import javax.persistence.*;
@Data
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String phoneNumber;
private String email;
private String password;
private String role;
public User() {
}
public User(/*@JsonProperty("id") UUID id,*/
@JsonProperty("phoneNumber") String phoneNumber,
@JsonProperty("email") String email,
@JsonProperty("password") String password,
@JsonProperty("role") String role) {
//this.id = id;
this.phoneNumber = phoneNumber;
this.email = email;
this.password = password;
this.role = role;
}
public long getId() {
return id;
}
public String getPhoneNumber() {
return phoneNumber;
}
public String getEmail() {
return email;
}
public String getPassword() {
return password;
}
public String getRole() {
return role;
}
}
|
0e896672-f08b-4e3e-8a45-da96f369428f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-08-24T10:02:11", "repo_name": "CommonGateway/ZGWBundle", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1047, "line_count": 19, "lang": "en", "doc_type": "text", "blob_id": "c11e3107aae53b5e2c33d282d27842f66d3a48a0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/CommonGateway/ZGWBundle | 242 | FILENAME: README.md | 0.236516 | # ZGWBundle
Common Gateway Symfony bundle for ZGW functionality including the Zaken, Catalogi, Documenten and Besluiten APIs.
#### Using your code
To use the code in your library we first have to install it with composer.
Note: for docker add `docker-compose exec php` before all comands
1. Navigate with a command line to where your composer.json lives in the project you want to use this bundle.
- Execute `composer require {full package name}:dev-main`
- Docker users: restart your containers so symfony can recognize the new Bundle's namespace
2. Open a php file where you want to use a class.
- Add the correct use statement (example `use CommonGateway\ZGWBundle\Service\ZGWService;`)
- U can now use your class!
In the common gateway, if you want to use your code when triggered by an event with a action, make sure the class of the action object is set as the handler name including the namespace. For example if I want to use the ZGWService I can set the ZGWHandler as `CommonGateway\ZGWBundle\ActionHandler\ZGWHandler`.
|
ec2df0ed-ca4d-455a-b819-3b06e3b3d4b4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-16 16:25:50", "repo_name": "mrblacklee/shop", "sub_path": "/src/main/java/com/example/demo/service/TGoodsDaoService.java", "file_name": "TGoodsDaoService.java", "file_ext": "java", "file_size_in_byte": 1065, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "777ffabb18e1d4a5eba3834d10afba220d958d61", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mrblacklee/shop | 208 | FILENAME: TGoodsDaoService.java | 0.262842 | package com.example.demo.service;
import com.example.demo.dao.TGoodsDao;
import com.example.demo.domain.TGoods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class TGoodsDaoService {
@Autowired
private TGoodsDao tGoodsDao;
//查询所有商品信息
public List selectGoods(){
return tGoodsDao.selectAll();
}
//查询所有商品分类
public List selectByType(){
List<TGoods> list= tGoodsDao.selectGoodsByType();
List<String> type=new ArrayList<String>();
for(TGoods goods:list){
type.add( goods.getItemType());
}
return type;
}
//按商品id查询单个商品的信息
public TGoods selectById(String id){
if (tGoodsDao.selectByPrimaryKey(id)==null){
throw new RuntimeException("该商品不存在");
}
return tGoodsDao.selectByPrimaryKey(id);
}
}
|
4222f271-a9a6-4e6d-a3bc-c09cb9b7299d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2022-10-23T14:05:51", "repo_name": "lanlan2017/blog", "sub_path": "/source/_posts/编程/Git/命令/Git 取消commit.md", "file_name": "Git 取消commit.md", "file_ext": "md", "file_size_in_byte": 1451, "line_count": 55, "lang": "zh", "doc_type": "text", "blob_id": "c33906e13ab20a697b763d0e35ce11ca5a730657", "star_events_count": 4, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/lanlan2017/blog | 420 | FILENAME: Git 取消commit.md | 0.272799 | ---
title: Git 取消commit
categories:
- Git
- 命令
abbrlink: ae0d2128
date: 2019-11-28 16:08:50
updated: 2022-04-04 00:51:45
---
# 问题描述
你可能在执行git add .和git commit -m 'xxx'之后后悔了,如何回退到上一个版本呢。
|版本代号|描述|
|:---|:---|
|`HEAD`|表示当前版本|
|`HEAD^`|表示上一个版本|
|`HEAD^^`|上上一个版本就是|
|`HEAD~100`|当前版本之前的第100个版本|
# 回退到上个版本
```shell
git reset --hard HEAD^
```
# 回退到执行版本
```shell
git reset --hard commit_id
```
如:
```shell
git reset --hard 1094a
```
# 自动生成
请在下面输入框中,**输入**`commit_id`,然后点击**生成**即可生成代码到剪贴板中.
<input type="text" id="commitId" placeholder="请输入commit_d"><button onclick="switchCommit(document.getElementById('commitId').value)">生成代码</button>
<script>
function switchCommit(text) {
var input = document.getElementById('commitId');
var code = "git reset --head " + text;
input.value = '';
copy(code);
}
function copy(text) {
var temp = document.createElement("textarea");
temp.value = text;
document.body.appendChild(temp);
temp.select();
// alert('打断,看效果');
document.execCommand('copy');
document.body.removeChild(temp);
alert('已经复制如下代码到剪贴板:\n'+text);
}
</script>
|
65560f15-df06-41d2-95bc-3d9d8f03c3b9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-05-31 12:24:07", "repo_name": "sergmain/webmill", "sub_path": "/riverock-gwt/src/org/riverock/gwt/client/commons/TableToolbarItem.java", "file_name": "TableToolbarItem.java", "file_ext": "java", "file_size_in_byte": 978, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "a2db3941f2cd18f3d0e8741ee6acde24fd60642d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sergmain/webmill | 223 | FILENAME: TableToolbarItem.java | 0.221351 | package org.riverock.gwt.client.commons;
import com.google.gwt.user.client.ui.Widget;
/**
* User: SergeMaslyukov
* Date: 21.06.2009
* Time: 12:00:31
*/
public class TableToolbarItem {
private DialogBoxWithUpdater widget;
private String buttonText;
private Widget simpleWidget;
private Widget button;
public TableToolbarItem(DialogBoxWithUpdater widget, String buttonText) {
this.widget = widget;
this.buttonText = buttonText;
}
public TableToolbarItem(Widget simpleWidget) {
this.simpleWidget = simpleWidget;
}
public TableToolbarItem() {
}
public Widget getButton() {
return button;
}
public void setButton(Widget button) {
this.button = button;
}
public Widget getSimpleWidget() {
return simpleWidget;
}
public DialogBoxWithUpdater getWidget() {
return widget;
}
public String getButtonText() {
return buttonText;
}
}
|
ba405560-c72c-4799-9345-8d29f860ffed | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-03-17 21:02:31", "repo_name": "pppepito86/arena", "sub_path": "/src/main/java/com/olimpiici/arena/grader/WorkerPool.java", "file_name": "WorkerPool.java", "file_ext": "java", "file_size_in_byte": 1100, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "a6279dd4ccdb6508c9bab2ff14c4d5572ebcd769", "star_events_count": 2, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/pppepito86/arena | 242 | FILENAME: WorkerPool.java | 0.29584 | package com.olimpiici.arena.grader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.olimpiici.arena.config.ApplicationProperties;
@Component
public class WorkerPool {
private final Logger log = LoggerFactory.getLogger(WorkerPool.class);
private List<Worker> workers;
public WorkerPool(ApplicationProperties applicationProperties) {
workers = new ArrayList<>();
if (applicationProperties.getWorkerUrl().isEmpty()) {
log.error("Worker URL is not configured.");
return;
}
workers.add(new Worker(applicationProperties.getWorkerUrl(), applicationProperties.getWorkDir()));
}
public void deleteProblem(long problemId) {
workers.forEach(worker -> {
try {
worker.deleteProblem(problemId);
} catch (IOException e) {
e.printStackTrace();
}
});
}
public Worker getOne() {
return workers.get(0);
}
public boolean isAlive() {
if (workers.isEmpty()) {
return false;
}
return getOne().isAlive();
}
}
|
61228c84-2bfd-443a-ac40-90ba63189cc1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-17 03:10:37", "repo_name": "10yangbin/JinMaoChinaApp", "sub_path": "/app/src/main/java/com/guomao/propertyservice/widget/MyProgress.java", "file_name": "MyProgress.java", "file_ext": "java", "file_size_in_byte": 1069, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "cad96d4fff4314832f9f64010117344facb759dd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/10yangbin/JinMaoChinaApp | 246 | FILENAME: MyProgress.java | 0.291787 | package com.guomao.propertyservice.widget;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface.OnCancelListener;
public class MyProgress {
static Dialog show;
public static void show(String text, Context context) {
dismiss();
show = MyProgressDialog.show(context, text, true, null);
}
public static void show(int resID, Context context) {
dismiss();
show = MyProgressDialog.show(context,
context.getResources().getString(resID), true, null);
}
public static void show(String text, Context context, boolean cancelAble) {
dismiss();
show = MyProgressDialog.show(context, text, cancelAble, null);
}
public static void show(String text, Context context, boolean cancelAble,
OnCancelListener onCancelListener) {
dismiss();
show = MyProgressDialog.show(context, text, cancelAble,
onCancelListener);
}
public static void dismiss() {
try {
if (show != null && show.isShowing()) {
show.dismiss();
show = null;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
31609742-d877-4c85-afe7-5539c626d268 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-22 08:38:22", "repo_name": "HH99clone17/VelogCloneBE", "sub_path": "/src/main/java/com/example/velogclonebe/s3/S3Config.java", "file_name": "S3Config.java", "file_ext": "java", "file_size_in_byte": 1149, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "137280224e9f51a27fb2699ba494a62f8d6978f0", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/HH99clone17/VelogCloneBE | 235 | FILENAME: S3Config.java | 0.228156 | package com.example.velogclonebe.s3;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class S3Config {
// aws.yml 파일에 작성한 값들을 읽어와 AmazonS3Client 객체를 만들어 Bean으로 주입
@Value("${cloud.aws.credentials.access-key}")
private String accessKey;
@Value("${cloud.aws.credentials.secret-key}")
private String secretKey;
@Value("${cloud.aws.region.static}")
private String region;
@Bean
public AmazonS3Client amazonS3Client() {
BasicAWSCredentials awsCreds = new BasicAWSCredentials(accessKey, secretKey);
return (AmazonS3Client) AmazonS3ClientBuilder.standard()
.withRegion(region)
.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
.build();
}
} |
dc2ddf04-53ca-45c9-89a6-1f878b7af3df | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-17 07:15:34", "repo_name": "WmCodes/litespring", "sub_path": "/src/test/java/org/listspring/test/v2/TypeConverterTest.java", "file_name": "TypeConverterTest.java", "file_ext": "java", "file_size_in_byte": 1171, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "d7548a0a088b194ebae56cff11ce4885957ffa0d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/WmCodes/litespring | 251 | FILENAME: TypeConverterTest.java | 0.285372 | package org.listspring.test.v2;
import org.junit.Assert;
import org.junit.Test;
import org.litespring.beans.SimpleTypeConverter;
import org.litespring.beans.TypeConverter;
import org.litespring.beans.TypeMismatchException;
/**
* @author wangmeng
* @date 2019/5/17
* @desciption
*/
public class TypeConverterTest {
@Test
public void testConvertStringToIne(){
TypeConverter converter = new SimpleTypeConverter();
try {
Integer i = converter.convertIfNecessary("3",Integer.class);
Assert.assertEquals(3,i.intValue());
converter.convertIfNecessary("3.1",Integer.class);
}catch (TypeMismatchException e){
return;
}
Assert.fail();
}
@Test
public void testConvetStringToBoolean(){
TypeConverter converter = new SimpleTypeConverter();
try {
Boolean b = converter.convertIfNecessary("true",Boolean.class);
Assert.assertEquals(true,b.booleanValue());
converter.convertIfNecessary("aaaa.1",Boolean.class);
}catch (TypeMismatchException e){
return;
}
Assert.fail();
}
}
|
06671a49-0e32-425e-ab19-47ab553464f8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-21 08:55:37", "repo_name": "maxqiang1992/MVP", "sub_path": "/app/src/main/java/com/mvp/module/activity/WeatherActivity.java", "file_name": "WeatherActivity.java", "file_ext": "java", "file_size_in_byte": 1178, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "728619df0d4540ff52f2ec77f951bfe5be44b684", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/maxqiang1992/MVP | 269 | FILENAME: WeatherActivity.java | 0.26588 | package com.mvp.module.activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;
import com.mvp.R;
import com.mvp.module.interfaces.IUIWeather;
import com.mvp.module.presenter.PersenterWeather;
import com.mvp.module.response.WeatherData;
/**
* @author xiongxiang
* @time 2018/11/21.
* @e-mail 276186694@qq.com
*/
public class WeatherActivity extends BaseActivity<PersenterWeather> implements IUIWeather, View.OnClickListener {
private TextView mTv1;
private TextView mTv2;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_weather);
mTv1 = findViewById(R.id.TV1);
mTv2 = findViewById(R.id.TV2);
findViewById(R.id.BT1).setOnClickListener(this);
}
@Override
public void updateWeather(WeatherData weather) {
mTv1.setText("城市:" + weather.getData().getCity());
mTv2.setText("温度:" + weather.getData().getWendu());
}
@Override
public void onClick(View v) {
mPresenter.getWeather();
}
}
|
2d285187-8a6b-41a0-a378-8edb4613204d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2013-09-03T11:30:46", "repo_name": "isorna/THE.TOOLBOX", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1027, "line_count": 15, "lang": "en", "doc_type": "text", "blob_id": "de5c50bb9c858f9d9fcd2a90d8b484ccdabe748c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/isorna/THE.TOOLBOX | 343 | FILENAME: README.md | 0.255344 | THE.TOOLBOX
======
Mobile Android: Netrunner LCG Toolbox
**This is an experiment**, I enjoy web apps technologies and I wanted to do something that I know I'll use, so here it's: a mobile (online & offline) **Android: Netrunner LCG Toolbox**.
It's still under development, but my objetive is to create:
* A tournament organizer web app usable online and offline
* A portable Card DB reader with incorporated lightweight deckbuilder
You can see some screenshots here:
 /  /  / 
|
59f2beab-e6ce-4036-95e7-d314e8b04811 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-01 21:30:03", "repo_name": "abarker-byui/ProveWeather", "sub_path": "/app/src/main/java/byui/cs246/barker/wk06Prove/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1171, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "913c28acbb11c7b324e383c9f3d6a21663e4a6c1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/abarker-byui/ProveWeather | 236 | FILENAME: MainActivity.java | 0.26971 | package byui.cs246.barker.wk06Prove;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import java.lang.ref.WeakReference;
import byui.cs246.barker.wk06Prove.objects.GetWeatherType;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onGetTemperatureClick(View view) {
Runnable tempRunnable = new GetWeather(getCity(), new WeakReference<Activity>(this), GetWeatherType.Current);
Thread thread = new Thread(tempRunnable);
thread.start();
}
public void onGetForecastClick(View view) {
Runnable tempRunnable = new GetWeather(getCity(), new WeakReference<Activity>(this), GetWeatherType.Forecast);
Thread thread = new Thread(tempRunnable);
thread.start();
}
private String getCity() {
EditText txtCity = (EditText)findViewById(R.id.editCity);
return txtCity.getText().toString();
}
}
|
222f5f61-4d32-4ba6-956f-1a34eee60277 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-10-13T16:35:08", "repo_name": "rennyrocha/flutter_bloc_login_firebase", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1039, "line_count": 23, "lang": "en", "doc_type": "text", "blob_id": "8f5f7119215e3612d0a6a8ef8667699feeb35d48", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rennyrocha/flutter_bloc_login_firebase | 307 | FILENAME: README.md | 0.217338 | # Flutter login and signup system
Full working login and signup using Bloc pattern and Firebase.
## Don't forget
You must create a Firebase authentication configuration.
Add your ``google-services.json`` file to your ``./android/app/`` folder, and the ``GoogleService-Info.plist`` to your IOS Runner folder using Xcode.
## Current Flutter configuration

## Screenshot
<img width="421" alt="Screenshot 2020-10-12 at 19 35 49" src="https://user-images.githubusercontent.com/1804152/95781330-825aa000-0cc5-11eb-9109-23d511e1bf21.png">
## 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
Cookbook: Useful Flutter samples
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
|
f230d6d7-0598-4ca6-9377-3b8014232ed1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-23 08:53:47", "repo_name": "STyulenev/CarService", "sub_path": "/src/main/java/com/carservice/application/data/entity/Detail.java", "file_name": "Detail.java", "file_ext": "java", "file_size_in_byte": 1169, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "3819c553196750c6d1f02377d6369de574630584", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/STyulenev/CarService | 252 | FILENAME: Detail.java | 0.267408 | package com.carservice.application.data.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
import java.util.List;
@Entity
@Table(name = "Detail", schema = "public")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler", "warehouses"})
public class Detail {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "name", length = 30)
private String name;
@Column(name = "price")
private Integer price;
@ManyToMany(mappedBy = "details")
private List<Warehouse> warehouses;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public List<Warehouse> getWarehouses() {
return warehouses;
}
public void setWarehouses(List<Warehouse> warehouses) {
this.warehouses = warehouses;
}
}
|
527fa2e2-8bb3-4cec-9a5f-74bc1676cb6d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-28 15:45:35", "repo_name": "musanabiyev/NBCOAPP", "sub_path": "/src/main/java/com/company/entity/CustomerData.java", "file_name": "CustomerData.java", "file_ext": "java", "file_size_in_byte": 995, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "5ca0dfbe11e2c04f41dfb442a0e80285e600dcc1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/musanabiyev/NBCOAPP | 207 | FILENAME: CustomerData.java | 0.264358 | package com.company.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "customer_data")
public class CustomerData {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@Column(name = "name")
private String name;
@Column(name = "surname")
private String surname;
@Column(name = "phone_number")
private String phoneNumber;
@Column(name = "address")
private String address;
@Column(name = "date_of_birth")
@Temporal(TemporalType.DATE)
private Date dateOfBirth;
@JoinColumn(name = "user_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private User userId;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "customerDataId")
private List<IssuedLoan> issuedLoans;
} |
5d5b7614-6ab7-4231-bc89-a105c2adae82 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-25 05:10:01", "repo_name": "NikolenkoMaksim/phoneBookJSP", "sub_path": "/phoneBookJSP/src/main/java/ru/academits/nikolenko/servlet/StartServlet.java", "file_name": "StartServlet.java", "file_ext": "java", "file_size_in_byte": 1106, "line_count": 28, "lang": "en", "doc_type": "code", "blob_id": "803a52c56cddf704d945079cd90fe670baee7014", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/NikolenkoMaksim/phoneBookJSP | 207 | FILENAME: StartServlet.java | 0.278257 | package ru.academits.nikolenko.servlet;
import ru.academits.nikolenko.PhoneBook;
import ru.academits.nikolenko.service.ContactService;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class StartServlet extends HttpServlet {
private static final long serialVersionUID = 5909297255492112405L;
private ContactService contactService = PhoneBook.contactService;
protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
try {
req.setAttribute("contactList", contactService.getAllContacts());
req.setAttribute("contactValidation", contactService.getLastContactValidation());
req.setAttribute("currentContact", contactService.getLastContact());
req.setAttribute("deleteResult", contactService.getLastDeleteResults());
req.getRequestDispatcher("phonebook.jsp").forward(req, resp);
} catch (Exception e) {
System.out.println("error in StartServlet: ");
e.printStackTrace();
}
}
}
|
5224081b-22eb-4021-965b-eca8d3506eae | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-09-14 04:49:52", "repo_name": "duggankimani/WIRA", "sub_path": "/src/main/java/com/duggan/workflow/client/ui/admin/component/TestDnD.java", "file_name": "TestDnD.java", "file_ext": "java", "file_size_in_byte": 1171, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "a0494c416aa1dcb3ca013067258eefcef09e65ef", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/duggankimani/WIRA | 273 | FILENAME: TestDnD.java | 0.277473 | package com.duggan.workflow.client.ui.admin.component;
import com.allen_sauer.gwt.dnd.client.PickupDragController;
import com.allen_sauer.gwt.dnd.client.drop.SimpleDropController;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
public class TestDnD extends Composite {
private static TestDnDUiBinder uiBinder = GWT.create(TestDnDUiBinder.class);
interface TestDnDUiBinder extends UiBinder<Widget, TestDnD> {
}
@UiField AbsolutePanel testabsolutepanel;
@UiField HTMLPanel dropTarget;
@UiField HTMLPanel sampleSubject;
public TestDnD() {
initWidget(uiBinder.createAndBindUi(this));
PickupDragController dragController =new PickupDragController(testabsolutepanel, true);
SimpleDropController dropController = new SimpleDropController(dropTarget);
dragController.registerDropController(dropController);
dragController.makeDraggable(sampleSubject);
}
}
|
bd651759-cdb2-40d8-a42b-afc2147edb07 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2011-12-08T17:34:26", "repo_name": "yorickvP/node-scgi-client", "sub_path": "/README.markdown", "file_name": "README.markdown", "file_ext": "markdown", "file_size_in_byte": 1230, "line_count": 36, "lang": "en", "doc_type": "text", "blob_id": "592b346ca0551a5ee41c3a5c4d0ddedb0cf41d5d", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yorickvP/node-scgi-client | 301 | FILENAME: README.markdown | 0.210766 | SCGI-Client
===========
[Simple Common Gateway Interface](http://en.wikipedia.org/wiki/Simple_Common_Gateway_Interface) client for [node.js](http://nodejs.org/).
This is basically a rewritten and updated version of [claudioc's node-scgi](https://github.com/claudioc/node-scgi), which I created so I could run firefox-sync behind a node proxy.
Example
=======
var SCGIClient = require('scgi-client');
var http = require('http');
http.createServer(SCGIClient(8085)).listen(80)
Usage
=======
SCGIClient(port, [host], [opts])(request, response)
SCGIClient(path, [opts])(request, response)
opts = {
mountPoint: '', // when you have http://abc.def.com/blahscript/ and want blahscript to be your scgi path
serverName: 'unknown', // ip/hostname of your server, passed to the scgi server
serverPort: 80, // port of your server, passed to the scgi server
documentRoot: '' } // directory your webserver is serving documents from, passed to scgi server
Installation
============
npm install scgi-client
Missing things
==============
AUTH_TYPE and REMOTE_USER headers are not sent, because they seem to break firefox-sync. I've also not implemented them with digest auth. |
cc065736-9d03-4a2a-a222-6f8d5431ec22 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-05-09T19:06:49", "repo_name": "crewsertay/web-dev-hw.", "sub_path": "/assignment-7/readme.md", "file_name": "readme.md", "file_ext": "md", "file_size_in_byte": 1060, "line_count": 14, "lang": "en", "doc_type": "text", "blob_id": "748ae92e7de4a9636b92a375ee8018517c23edfc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/crewsertay/web-dev-hw. | 245 | FILENAME: readme.md | 0.261331 | # Assignment-7 Readme
- For this assignment I decided to go with a red color scheme, to represent the Sorcerer's Stone. I used a handwritten font (EastSeaDokdo) to reflect the setting of Hogwarts and Harry Potter. And a simple sans serif font for the paragraphs (Roboto).
- A system font is a font that automatically comes with a certain software type. A web font is a font that is hosted on a server and has to be placed into an element to appear on a page. A web-safe font is a font that will be available to the system and viewable on webpages.
## Work Cycle
For this work cycle I was really excited to develop a palette and font family for The Sorcerer's Stone because I am a big Harry Potter fan.
I found this assignemnt enjoyably challenging to work on. At one point I was having a lot of trouble getting my fonts to register on my index.html and doublechecked every aspect of my code until I realized that I had typed "font" instead of "fonts" when trying to link to my .ttf file - it's the little things!

|
d40a111e-d628-4be4-910d-53bd51fa491a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-18 15:35:58", "repo_name": "auk/CrackShot", "sub_path": "/apps/rest/src/main/java/stx/shooterstatistic/exceptions/ResponseExceptionComposer.java", "file_name": "ResponseExceptionComposer.java", "file_ext": "java", "file_size_in_byte": 1073, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "c3795dcc65086f7b2bd08f9523a127bcffc99cfb", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/auk/CrackShot | 187 | FILENAME: ResponseExceptionComposer.java | 0.282988 | package stx.shooterstatistic.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.context.request.ServletWebRequest;
import org.springframework.web.context.request.WebRequest;
import stx.shooterstatistic.exceptions.ResponseException;
import stx.shooterstatistic.exceptions.ResponseExceptionBuilder;
import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotNull;
import java.io.PrintWriter;
import java.io.StringWriter;
public final class ResponseExceptionComposer {
private ResponseExceptionComposer() {}
public static ResponseException compose(@NotNull HttpStatus status, @NotNull Exception ex, @NotNull WebRequest webRequest) {
HttpServletRequest servletRequest = ((ServletWebRequest)webRequest).getRequest();
StringWriter sw = new StringWriter();
ex.printStackTrace(new PrintWriter(sw));
return ResponseExceptionBuilder
.create(status)
.withPath(servletRequest.getRequestURI())
.withMessage(ex.getMessage())
.withDetails(sw.toString())
.build();
}
}
|
40b8b80e-7168-4263-84ab-be598c363251 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-08-12 03:27:09", "repo_name": "StageGageHub/Artist-Service", "sub_path": "/src/main/java/com/stagegage/services/dto/response/ArtistResponse.java", "file_name": "ArtistResponse.java", "file_ext": "java", "file_size_in_byte": 1110, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "7013d7740f1cc39b1219a5cc42f21c262bc55f1d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/StageGageHub/Artist-Service | 236 | FILENAME: ArtistResponse.java | 0.27048 | package com.stagegage.services.dto.response;
import com.stagegage.services.dto.ArtistDto;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* Created by Scott on 7/12/14.
*
* @author Scott Hendrickson
*/
public class ArtistResponse {
private final String name;
private final Set<String> genres;
public static List<ArtistResponse> getResponses(List<ArtistDto> artistDtos) {
if (artistDtos == null) return null;
List<ArtistResponse> responses = new ArrayList<ArtistResponse>();
for (ArtistDto dto : artistDtos) {
responses.add(ArtistResponse.getResponse(dto));
}
return responses;
}
public static ArtistResponse getResponse(ArtistDto dto) {
return new ArtistResponse(dto.getName(),
dto.getGenres());
}
public ArtistResponse(String name, Set<String> genres) {
this.name = name;
this.genres = genres;
}
public String getName() {
return name;
}
public Set<String> getGenres() {
return genres;
}
}
|
228f27bc-9c00-496d-b6ed-ddbc546f41fd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-26 01:15:52", "repo_name": "Marcio-40-mrn/Orangeinicio", "sub_path": "/src/test/java/pages/com/br/LoginPage.java", "file_name": "LoginPage.java", "file_ext": "java", "file_size_in_byte": 1098, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "a3c223d4bfa03ee8778f0327003ae35cf7a08a13", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Marcio-40-mrn/Orangeinicio | 239 | FILENAME: LoginPage.java | 0.291787 | package pages.com.br;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import hooks.com.br.Hooks;
public class LoginPage {
protected WebDriver driver;
public LoginPage() {
driver = Hooks.getDriver();
PageFactory.initElements(driver, this);
}
@FindBy(id="txtUsername")
public WebElement txtUsername;
@FindBy(name="txtPassword")
public WebElement txtPassword;
@FindBy(id="btnLogin")
public WebElement btnlogin;
@FindBy(id="welcome")
public WebElement validaacesso;
@FindBy(id="spanMessage")
public WebElement msgerro;
public void EfetuarLogin(String Usuario, String Senha) {
txtUsername.sendKeys(Usuario);
txtPassword.sendKeys(Senha);
btnlogin.click();
}
public void ValidarAcesso() {
boolean wc = validaacesso.isDisplayed();
Assert.assertTrue(wc);
}
public void MsgErro() {
String msg = msgerro.getText();
Assert.assertEquals("Invalid credentials", msg);
}
}
|
f19332b5-a8ed-436d-9ebf-6ae583ef6ce7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-10 23:20:49", "repo_name": "mswiczar/deAutosAndroid", "sub_path": "/src/com/mswiczar/deautos/gracias.java", "file_name": "gracias.java", "file_ext": "java", "file_size_in_byte": 1171, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "08641c507108e719d87e6412e1aa254e5066affc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mswiczar/deAutosAndroid | 210 | FILENAME: gracias.java | 0.229535 | package com.mswiczar.deautos;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class gracias extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
deautosApp app = (deautosApp) getApplication();
app.tracker.trackPageView("/androidMensajeEnviado");
super.onCreate(savedInstanceState);
setContentView(R.layout.gracias);
final TextView textInicio = (TextView) findViewById(R.id.textInicio);
textInicio.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
gracias.this.finish();
}
});
final TextView textvolver = (TextView) findViewById(R.id.textvolver);
textvolver.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//this.
// viewauto.this.finish();
gracias.this.finish();
}
});
}
}
|
6cc4c272-72e8-46e3-9ab7-3dd802c9a7e5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-16 22:54:49", "repo_name": "Lehodev/Programming_Technologies_Assignment", "sub_path": "/Code/src/main/java/org/example/TabletWarehouse.java", "file_name": "TabletWarehouse.java", "file_ext": "java", "file_size_in_byte": 1096, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "9e698ff0e79e15248dede497aead72bf945d7151", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Lehodev/Programming_Technologies_Assignment | 228 | FILENAME: TabletWarehouse.java | 0.288569 | package org.example;
import java.util.ArrayList;
public class TabletWarehouse implements IObserver, IDeviceOperations {
private final ArrayList<Device> boardGameList = new ArrayList<>();
private MainWarehouse mainWarehouse;
public TabletWarehouse(MainWarehouse mainWarehouse) {
this.mainWarehouse = mainWarehouse;
mainWarehouse.ObserverAdd(this);}
@Override
public void update(Device device, int quantity) {
if (device.getType() == DeviceTypeEnum.Tablet)
for (int i=0;i<quantity;i++){boardGameList.add(device);}
}
@Override
public void addProduct(Device device) {
this.boardGameList.add(device);
}
@Override
public void removeProduct(String name) {
ArrayList<Device> list = mainWarehouse.getTabletStorage().boardGameList;
for (int i=0;i<list.size();i++){
if (list.get(i).getName().equals(name)){
list.remove(i);
return;
}
}
}
@Override
public int getListSize() {
return boardGameList.size();
}
}
|
c34016cc-08c7-4cd7-99f5-b11ef6c267ee | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-09 13:25:09", "repo_name": "zezulka/GpioDebuggerClient", "sub_path": "/src/main/java/gui/tab/loader/TabAddressPair.java", "file_name": "TabAddressPair.java", "file_ext": "java", "file_size_in_byte": 1170, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "cbda8b2903a6cd9c474e7ffd4a4bea16a6625987", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zezulka/GpioDebuggerClient | 248 | FILENAME: TabAddressPair.java | 0.29584 | package gui.tab.loader;
import java.net.InetAddress;
import java.util.Objects;
import javafx.scene.control.Tab;
public final class TabAddressPair {
private final Tab tab;
private final InetAddress address;
public TabAddressPair(Tab tab, InetAddress address) {
Objects.requireNonNull(tab, "tab");
Objects.requireNonNull(address, "address");
this.tab = tab;
this.address = address;
}
public Tab getTab() {
return tab;
}
public InetAddress getAddress() {
return address;
}
@Override
public int hashCode() {
int hash = 3;
hash = 37 * hash + Objects.hashCode(this.tab);
hash = 37 * hash + Objects.hashCode(this.address);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TabAddressPair other = (TabAddressPair) obj;
return this.tab.equals(other.tab) && this.address.equals(other.address);
}
}
|
2849de55-ca01-4a86-ad4b-705fc9f8e5a6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-23 07:42:12", "repo_name": "Armymans/hysw-cost", "sub_path": "/src/main/java/net/zlw/cloud/VisaApplyChangeInformation/model/VisaChangeInformation.java", "file_name": "VisaChangeInformation.java", "file_ext": "java", "file_size_in_byte": 1114, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "cb40e29a39112f51981aeed38031b3ce5bb2ff39", "star_events_count": 0, "fork_events_count": 5, "src_encoding": "UTF-8"} | https://github.com/Armymans/hysw-cost | 267 | FILENAME: VisaChangeInformation.java | 0.214691 | package net.zlw.cloud.VisaApplyChangeInformation.model;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
/**
*
* 上下家签证/变更信息表
* Created by xulei on 2020/9/22.
*/
@Table(name = "visa_apply_change_information")
@Data
public class VisaChangeInformation {
@Id
@Column(name = "id")
private String id;
@Column(name = "applicant_name")
private String applicantName;
@Column(name = "remark")
private String remark;
@Column(name = "submit_money")
private String submitMoney;
@Column(name = "up_and_down_mark")
private String upAndDownMark;
@Column(name = "create_time")
private String createTime;
@Column(name = "update_time")
private String updateTime;
@Column(name = "fouder_id")
private String fouderId;
@Column(name = "fouder_company")
private String fouderCompany;
@Column(name = "state")
private String state;
@Column(name = "base_project_id")
private String baseProjectId;
@Column(name = "status")
private String status;
}
|
9bd3f99c-5473-4f9a-96b5-0f9266de1394 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-30 10:26:48", "repo_name": "green-fox-academy/zuzanastasova", "sub_path": "/week-10/chat/src/main/java/com/greenfoxacademy/chatproject/models/PostMessageResponseDTO.java", "file_name": "PostMessageResponseDTO.java", "file_ext": "java", "file_size_in_byte": 1011, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "35af7a1c5d6989c45763c47d1233dfcf55c8c46b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/green-fox-academy/zuzanastasova | 201 | FILENAME: PostMessageResponseDTO.java | 0.206894 | package com.greenfoxacademy.chatproject.models;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;
public class PostMessageResponseDTO {
private String content;
@Temporal(TemporalType.TIMESTAMP)
private Date created;
private UserUpdateResponseDTO author;
public PostMessageResponseDTO() {
}
public PostMessageResponseDTO(String content, UserUpdateResponseDTO author) {
this.content = content;
this.created = null;
this.author = author;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public UserUpdateResponseDTO getAuthor() {
return author;
}
public void setAuthor(UserUpdateResponseDTO author) {
this.author = author;
}
}
|
75c0946c-19db-46fb-bcaa-744e7350ec02 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-20 02:54:46", "repo_name": "zsj6102/zsjda", "sub_path": "/app/src/main/java/com/colpencil/propertycloud/View/Adapter/NationAdapter.java", "file_name": "NationAdapter.java", "file_ext": "java", "file_size_in_byte": 1019, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "e7ec574cfd168aca9d27f3105a89900d49fdc364", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zsj6102/zsjda | 203 | FILENAME: NationAdapter.java | 0.245085 | package com.colpencil.propertycloud.View.Adapter;
import android.content.Context;
import com.colpencil.propertycloud.R;
import org.byteam.superadapter.SuperAdapter;
import org.byteam.superadapter.internal.SuperViewHolder;
import java.util.List;
public class NationAdapter extends SuperAdapter<String> {
private String content;
private Context context;
public NationAdapter(Context context, List<String> items, int layoutResId,String content) {
super(context, items, layoutResId);
this.content = content;
this.context = context;
}
@Override
public void onBind(SuperViewHolder holder, int viewType, int layoutPosition, String item) {
holder.setText(R.id.tv_nation,item);
if (content.equals(item)){
holder.setImageDrawable(R.id.iv_nation,context.getResources().getDrawable(R.mipmap.fit_check));
}else {
holder.setImageDrawable(R.id.iv_nation,context.getResources().getDrawable(R.mipmap.fit_uncheck));
}
}
} |
1035cc4b-78fe-4ea6-a203-bc69bef09f9f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-02-07 20:57:40", "repo_name": "kavigupta/41-Plus-Plus", "sub_path": "/41++ General/src/fortytwo/language/classification/SentenceType.java", "file_name": "SentenceType.java", "file_ext": "java", "file_size_in_byte": 1096, "line_count": 28, "lang": "en", "doc_type": "code", "blob_id": "158b73138e4255bd5a0d7c4fe053f65e317dad8b", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kavigupta/41-Plus-Plus | 220 | FILENAME: SentenceType.java | 0.295027 | package fortytwo.language.classification;
import static fortytwo.language.classification.SentenceKind.DECLARATION;
import static fortytwo.language.classification.SentenceKind.STATEMENT;
public enum SentenceType {
DEFINITION("variable definition", STATEMENT),
ASSIGNMENT("variable assignment", STATEMENT),
DECLARATION_STRUCT("type definition", DECLARATION),
DECLARATION_FUNCT("function definition", DECLARATION),
FUNCTION_CALL("function call", STATEMENT),
FUNCTION_OUTPUT("function output statement", DECLARATION),
COMPOUND("compound statement", STATEMENT),
PURE_EXPRESSION("pure expression", STATEMENT),
CONTROL_FLOW("control flow statement", DECLARATION),
IMPURE_EXPRESSION("impure expression", STATEMENT),
FUNCTION("entire function", DECLARATION),
DEFINITION_ENVIRONMENT("environment definition", STATEMENT);
public final String description;
public final SentenceKind kind;
private SentenceType(String description, SentenceKind kind) {
this.description = description;
this.kind = kind;
}
public String description() {
return description;
}
} |
8f69dd81-c1fa-44ed-b218-e0d5db637f56 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-16 09:13:32", "repo_name": "447857062/homegenius", "sub_path": "/SmartWirelessRelay/app/src/main/java/com/deplink/boruSmart/activity/device/doorbell/add/PairGuideTwoActivity.java", "file_name": "PairGuideTwoActivity.java", "file_ext": "java", "file_size_in_byte": 1191, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "34152850c694a4d86df1030ca4b75b7a922b63f2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/447857062/homegenius | 234 | FILENAME: PairGuideTwoActivity.java | 0.226784 | package com.deplink.boruSmart.activity.device.doorbell.add;
import android.app.Activity;
import android.os.Bundle;
import com.deplink.boruSmart.view.combinationwidget.TitleLayout;
import deplink.com.smartwirelessrelay.homegenius.EllESDK.R;
public class PairGuideTwoActivity extends Activity {
private TitleLayout layout_title;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pair_guide_two);
initViews();
initEvents();
initDatas();
}
private void initDatas() {
}
@Override
public void finish() {
super.finish();
//注释掉activity本身的过渡动画
overridePendingTransition(R.anim.in_left, R.anim.out_right);
}
private void initEvents() {
layout_title.setReturnClickListener(new TitleLayout.ReturnImageClickListener() {
@Override
public void onBackPressed() {
PairGuideTwoActivity.this.onBackPressed();
}
});
}
private void initViews() {
layout_title = (TitleLayout) findViewById(R.id.layout_title);
}
}
|
39343183-44d1-4afc-b6e9-aab1629a60bc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-31 10:07:26", "repo_name": "shahedbhuiyan/selise-assessment", "sub_path": "/service/src/main/java/ch/selise/assessment/service/fundTransfer/FundTransferServiceImpl.java", "file_name": "FundTransferServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1012, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "d967a69c5657ff3dd6ac815e5515be3ead166041", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/shahedbhuiyan/selise-assessment | 197 | FILENAME: FundTransferServiceImpl.java | 0.279042 | package ch.selise.assessment.service.fundTransfer;
import ch.selise.assessment.entity.AccountEntity;
import ch.selise.assessment.service.AccountEntityService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
* @author dipanjal
* @since 0.0.1
*/
@Service
@RequiredArgsConstructor
public class FundTransferServiceImpl implements FundTransferService{
private final AccountEntityService entityService;
@Override
public void transferFund(AccountEntity source, AccountEntity destination, double amount) {
this.withdraw(source, amount);
this.deposit(destination, amount);
}
@Override
public void withdraw(AccountEntity account, double amount) {
account.setBalance(account.getBalance() - amount);
entityService.save(account);
}
@Override
public void deposit(AccountEntity account, double amount) {
account.setBalance(account.getBalance() + amount);
entityService.save(account);
}
}
|
d164f924-2f9a-4406-afed-a4b5ffab45d0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-11-21 12:57:25", "repo_name": "eugenestepanenkov/better", "sub_path": "/web/src/main/java/com/stepsoft/better/web/MainApplicationInitializer.java", "file_name": "MainApplicationInitializer.java", "file_ext": "java", "file_size_in_byte": 1068, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "6e2f76203dc5e5ee38a1157a068e8414a83b6144", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/eugenestepanenkov/better | 176 | FILENAME: MainApplicationInitializer.java | 0.253861 | package com.stepsoft.better.web;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import com.stepsoft.better.web.context.WebContext;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
/**
* @author Eugene Stepanenkov
*/
public class MainApplicationInitializer implements WebApplicationInitializer {
private static final String SERVLET_NAME = "dispatcher";
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext webContext = new AnnotationConfigWebApplicationContext();
webContext.register(WebContext.class);
ServletRegistration.Dynamic registration =
servletContext.addServlet(SERVLET_NAME, new DispatcherServlet(webContext));
registration.setLoadOnStartup(1);
registration.addMapping("/");
}
}
|
8fa59bf8-fbbe-4601-bf9c-39faf6b3d030 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-04-08 22:11:24", "repo_name": "Shachty/dst", "sub_path": "/ass1-jpa/src/main/java/dst/ass1/jpa/model/impl/Metadata.java", "file_name": "Metadata.java", "file_ext": "java", "file_size_in_byte": 1093, "line_count": 61, "lang": "en", "doc_type": "code", "blob_id": "b0fb0582673dcc8fb390e000e4b35d62ebfa4e3f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Shachty/dst | 237 | FILENAME: Metadata.java | 0.285372 | package dst.ass1.jpa.model.impl;
import dst.ass1.jpa.model.IMetadata;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Entity
public class Metadata implements IMetadata {
@Id
@GeneratedValue
private Long id;
private String course;
@OrderColumn(name = "settings_order")
@ElementCollection
private List<String> settings;
@Override
public Long getId() {
return id;
}
@Override
public void setId(Long id) {
this.id = id;
}
@Override
public String getCourse() {
return course;
}
@Override
public void setCourse(String course) {
this.course = course;
}
@Override
public List<String> getSettings() {
return settings;
}
@Override
public void setSettings(List<String> settings) {
this.settings = settings;
}
@Override
public void addSetting(String setting) {
if(this.settings == null){
this.settings = new ArrayList<String>();
}
this.settings.add(setting);
}
}
|
313576de-9108-46a5-8908-30cecda80dca | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-15 22:21:10", "repo_name": "RAVITEJAKOMMALAPATI20/MovicentralBackend", "sub_path": "/MovieCentralBackend/src/main/java/com/moviecentral/pojos/MoviesPlayedEmbedded.java", "file_name": "MoviesPlayedEmbedded.java", "file_ext": "java", "file_size_in_byte": 1087, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "1ea72e2e71732a35ea2362754ff252755f995e9f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/RAVITEJAKOMMALAPATI20/MovicentralBackend | 248 | FILENAME: MoviesPlayedEmbedded.java | 0.27513 | package com.moviecentral.pojos;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Embeddable
@Getter @Setter @NoArgsConstructor
public class MoviesPlayedEmbedded implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="username")
private User user;
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="movieid")
private Movie movie;
@Column(name = "watched_time")
@JsonFormat (pattern = "yyyy-MM-dd HH:mm:ss")
private Date watchedTime;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Movie getMovie() {
return movie;
}
public void setMovie(Movie movie) {
this.movie = movie;
}
public Date getWatchedTime() {
return watchedTime;
}
public void setWatchedTime(Date watchedTime) {
this.watchedTime = watchedTime;
}
}
|
259299e5-229d-4da9-aaac-dc3ae3a132d4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-18 07:52:56", "repo_name": "laurensdegilde/financial-data-streaming", "sub_path": "/financial-pubsub/src/main/java/com/distributed/actors/Supervision.java", "file_name": "Supervision.java", "file_ext": "java", "file_size_in_byte": 1171, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "f26340dfb50ccfceb33d764dd955b8e4507a9cf3", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/laurensdegilde/financial-data-streaming | 205 | FILENAME: Supervision.java | 0.267408 | package com.distributed.actors;
import akka.actor.*;
import akka.japi.pf.DeciderBuilder;
import java.time.Duration;
public class Supervision extends AbstractActor {
public static Props props() {
return Props.create(Supervision.class);
}
private static SupervisorStrategy strategy =
new OneForOneStrategy(10, Duration.ofMinutes(1),
DeciderBuilder
.match(ArithmeticException.class, e -> SupervisorStrategy.resume())
.match(NullPointerException.class, e -> SupervisorStrategy.restart())
.match(IllegalArgumentException.class, e -> SupervisorStrategy.stop())
.matchAny(o -> SupervisorStrategy.escalate())
.build());
@Override
public SupervisorStrategy supervisorStrategy() {
return strategy;
}
@Override
public Receive createReceive() {
return receiveBuilder()
.match(Props.class, props -> {
getSender().tell(getContext().actorOf(props), getSelf());
})
.build();
}
}
|
ea0b77bb-5907-4ade-b8a3-fdc1ea8c0729 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-08-24T13:55:19", "repo_name": "jacobsky/godot-specs-integration", "sub_path": "/readme.md", "file_name": "readme.md", "file_ext": "md", "file_size_in_byte": 1060, "line_count": 19, "lang": "en", "doc_type": "text", "blob_id": "b1188d6550ccda93cfd573037f8a28f3ef6a64b4", "star_events_count": 3, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/jacobsky/godot-specs-integration | 215 | FILENAME: readme.md | 0.216012 | # Godot Specs Integration
For the guide section, refer to the [Introduction](docs/introduction.md) for more information.
## Important Note
As per the official [Godot-Rust readme](https://github.com/godot-rust/godot-rust#further-examples)
Before launching the examples in the godot editor, you must first run cargo build and wait for the build operations to finish successfully.
At startup, the Godot editor tries to load all resources used by the project, including the native binary. If it isn't present, the editor skips properties or signals associated with the missing NativeScripts in the scene. This will cause the scene tree to be non-functional for any sample that relies on properties or signals configured in the editor.
## Contributing
Contributions are welcome with corrections. Please just create a PR and I would be happy to include your contributions. Please note that any contributions are also licensed under the MIT License
## License
This repository is for educational purposes and freely available under the MIT License. |
ab4adaa7-9301-4e85-9839-5250db3295f5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-10-06 00:00:20", "repo_name": "istolga/simulation-api", "sub_path": "/src/main/java/com/simapi/Main.java", "file_name": "Main.java", "file_ext": "java", "file_size_in_byte": 1167, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "03df268b105d12117dafad9e99079b3e3bb31fdb", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/istolga/simulation-api | 213 | FILENAME: Main.java | 0.278257 | package com.simapi;
import com.simapi.config.AppConfig;
import com.simapi.server.NettyServer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.context.ConfigurableWebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
/**
* main class to run netty server. This will block current thread until server
* socket is closed
*/
public class Main {
private static final Log LOGGER = LogFactory.getLog(Main.class);
public static void main(String[] args) throws Exception {
ConfigurableWebApplicationContext ctx = createWebContext();
NettyServer nettyServer = (NettyServer) ctx.getBean("nettyServer");
nettyServer.runServer();
}
private static ConfigurableWebApplicationContext createWebContext() {
LOGGER.info("Starting application context");
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(AppConfig.class);
ctx.refresh();
ctx.registerShutdownHook();
return ctx;
}
}
|
12097339-cb76-4f90-9865-938ad08a2cd6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-09-14 04:49:52", "repo_name": "duggankimani/WIRA", "sub_path": "/src/main/java/com/duggan/workflow/shared/requests/GetOutputDocumentsRequest.java", "file_name": "GetOutputDocumentsRequest.java", "file_ext": "java", "file_size_in_byte": 1096, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "8f16d7a2ec29ca01154966031b4029813fcacb4d", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/duggankimani/WIRA | 235 | FILENAME: GetOutputDocumentsRequest.java | 0.247987 | package com.duggan.workflow.shared.requests;
import com.duggan.workflow.shared.responses.GetOutputDocumentsResponse;
import com.wira.commons.shared.request.BaseRequest;
import com.wira.commons.shared.response.BaseResponse;
public class GetOutputDocumentsRequest extends BaseRequest<GetOutputDocumentsResponse> {
private Long documentId;
private String processRefId;
private String searchTerm;
public GetOutputDocumentsRequest() {
}
public GetOutputDocumentsRequest(Long documentId) {
this.documentId = documentId;
}
public GetOutputDocumentsRequest(String processRefId) {
this.processRefId = processRefId;
}
public Long getDocumentId() {
return documentId;
}
@Override
public BaseResponse createDefaultActionResponse() {
return new GetOutputDocumentsResponse();
}
public String getProcessRefId() {
return processRefId;
}
public void setProcessRefId(String processRefId) {
this.processRefId = processRefId;
}
public String getSearchTerm() {
return searchTerm;
}
public void setSearchTerm(String searchTerm) {
this.searchTerm = searchTerm;
}
}
|
0ac52c9b-2530-468c-806f-5eee4b130efb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-12-16 18:48:27", "repo_name": "RodryVazquez/CustomTextView", "sub_path": "/app/src/main/java/and_401/customtextview/MyTextViewListActivity.java", "file_name": "MyTextViewListActivity.java", "file_ext": "java", "file_size_in_byte": 1028, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "00e4d209d437ba69eccf3ade2325614997e49550", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/RodryVazquez/CustomTextView | 185 | FILENAME: MyTextViewListActivity.java | 0.252384 | package and_401.customtextview;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
public class MyTextViewListActivity extends AppCompatActivity {
private ListView lstTextViewList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_text_view_list);
lstTextViewList = (ListView)findViewById(R.id.lstCustomTextViews);
final ArrayList<String>stringArrayList = new ArrayList<>();
stringArrayList.add("Alfredo");
stringArrayList.add("Manuel");
stringArrayList.add("Rodrigo");
stringArrayList.add("Jaime");
stringArrayList.add("Adrian");
stringArrayList.add("Charlie");
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,R.layout.my_text_view,stringArrayList);
lstTextViewList.setAdapter(adapter);
}
}
|
b922b914-6ff2-46c3-92ee-373939a3a92e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-09 13:54:33", "repo_name": "Ajay19291/js-ws", "sub_path": "/src/main/java/com/jandarbar/ws/resources/StateResource.java", "file_name": "StateResource.java", "file_ext": "java", "file_size_in_byte": 1102, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "bc9673ca731e7facc2eeb3faa2fc3deae3aec521", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Ajay19291/js-ws | 211 | FILENAME: StateResource.java | 0.280616 | package com.jandarbar.ws.resources;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jandarbar.ws.entities.StateMaster;
import com.jandarbar.ws.services.StateService;
@CrossOrigin(origins = "*", maxAge = 3600)
@RestController
@RequestMapping(path="/state")
public class StateResource
{
@Autowired
private StateService stateService;
@RequestMapping(path="/getAll")
public List<StateMaster> getAllStateMasters()
{
return stateService.getAll();
}
@RequestMapping(path="/create")
public StateMaster createStateMaster(HttpServletRequest request)
{
return stateService.create(request);
}
@RequestMapping(path="/get/{id}")
public StateMaster getStateMasterByid(@PathVariable(value="id")Long id)
{
return stateService.getById(id);
}
}
|
6a33eec0-1112-42bc-a012-db125800b5bc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-21 23:34:14", "repo_name": "qiuchili/ggnn_graph_classification", "sub_path": "/program_data/JavaProgramData/58/262.java", "file_name": "262.java", "file_ext": "java", "file_size_in_byte": 1172, "line_count": 53, "lang": "en", "doc_type": "code", "blob_id": "bd891302c77a7c8eb013d2f338643eeabfa89ab6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/qiuchili/ggnn_graph_classification | 310 | FILENAME: 262.java | 0.27513 | package <missing>;
public class GlobalMembers
{
public static int Main()
{
int n;
String tempVar = ConsoleInput.scanfRead();
if (tempVar != null)
{
n = Integer.parseInt(tempVar);
}
System.in.read();
int i;
int j;
String x = new String(new char[100]);
for (j = 0;j < n;j++)
{
x = new Scanner(System.in).nextLine();
if (x.charAt(0) == '_' || (x.charAt(0) >= 'A' && x.charAt(0) <= 'z'))
{
if (x.charAt(1) == '\0')
{
System.out.print("1\n");
continue;
}
}
else
{
System.out.print("0\n");
continue;
}
for (i = 1;x.charAt(i) != '\0';i++)
{
if (x.charAt(i) == '_' || (x.charAt(i) >= 'A' && x.charAt(i) <= 'z') || (x.charAt(i) >= '0' && x.charAt(i) <= '9'))
{
continue;
}
else
{
System.out.print("0\n");
break;
}
}
if (x.charAt(i) == '\0')
{
System.out.print("1\n");
}
}
}
}
|
3238f6df-f0c3-491e-acf4-4e7c6741a3a9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-01 15:09:12", "repo_name": "Zhang-Each/IoT-Device-Management-System", "sub_path": "/server/src/main/java/com/example/server/utils/RedisUtils.java", "file_name": "RedisUtils.java", "file_ext": "java", "file_size_in_byte": 1020, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "435a72ecf55ae8f31a884e166dc0c1a6a40da3cf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Zhang-Each/IoT-Device-Management-System | 183 | FILENAME: RedisUtils.java | 0.2227 | package com.example.server.utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RestController;
@CrossOrigin
@RestController
public class RedisUtils {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Autowired
private RedisTemplate redisTemplate;
public void redisSetValue(String key, String value) {
System.out.println(key);
System.out.println(value);
stringRedisTemplate.opsForValue().set(key, value);
}
public String redisGetValue(String key) {
return stringRedisTemplate.opsForValue().get(key);
}
public boolean redisUserValidation(String key, String token) {
return redisGetValue(key).equals(token)
&& TokenCenter.getTokenUserName(token).equals(key);
}
}
|
d20f031b-52e2-4408-a0cd-2a62a9342a59 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2022-05-30T19:29:12", "repo_name": "deepstreamIO/deepstream.io-website", "sub_path": "/content/docs/50-client-java-v2/DeepstreamRuntimeErrorHandler/index.md", "file_name": "index.md", "file_ext": "md", "file_size_in_byte": 1029, "line_count": 36, "lang": "en", "doc_type": "text", "blob_id": "be3fd85bd075b7ec4e53b005766eaf45426b5cea", "star_events_count": 11, "fork_events_count": 19, "src_encoding": "UTF-8"} | https://github.com/deepstreamIO/deepstream.io-website | 238 | FILENAME: index.md | 0.240775 | ---
title: Class DeepstreamRuntimeErrorHandler
description: Allows for all runtime errors to be caught in a single place
category: interface
navLabel: DeepstreamRuntimeErrorHandler
body_class: dark
---
This interface allows to handle common errors centrally rather than in numerous try/catch clauses.
Please note: Errors that are specific to a request, e.g. a RPC timing out or a record not being permissioned are either passed directly to the method that requested them or will be caught by a more specific listener.
## Methods
### void onException(Topic topic, Event event, String errorMessage)
```
{{#table mode="java-api"}}
-
arg: topic
typ: Topic
des: The Topic the error occured on
-
arg: event
typ: Event
des: The Error Event
-
arg: errorMessage
typ: String
des: The error message
{{/table}}
```
Triggered whenever a runtime error occurs ( mostly async such as TimeOuts or MergeConflicts ). Recieves a topic to indicate if it was e.g. RPC, event and a english error message to simplify debugging.
|
715ba37e-d88e-434b-9994-1b8b09117626 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-16 10:34:30", "repo_name": "yekainew/DC-world-android", "sub_path": "/app/src/main/java/com/jkkg/hhtx/activity/GuiZeActivity.java", "file_name": "GuiZeActivity.java", "file_ext": "java", "file_size_in_byte": 1178, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "260db094320e4f52e4b7b5e16348a609b8c19640", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yekainew/DC-world-android | 232 | FILENAME: GuiZeActivity.java | 0.181263 | package com.jkkg.hhtx.activity;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.jkkg.hhtx.R;
import com.jkkg.hhtx.base.BaseActivity;
import butterknife.BindView;
public class GuiZeActivity extends BaseActivity {
@BindView(R.id.toolbar_image_left)
ImageView toolbarImageLeft;
@BindView(R.id.toolbar_tv_left)
TextView toolbarTvLeft;
@BindView(R.id.toolbar_title)
TextView toolbarTitle;
@BindView(R.id.toolbar_image_right)
ImageView toolbarImageRight;
@BindView(R.id.toolbar_tv_right)
TextView toolbarTvRight;
@BindView(R.id.toolbar)
Toolbar toolbar;
@Override
protected int initView(@Nullable Bundle savedInstanceState) {
return R.layout.activity_gui_ze;
}
@Override
protected void initData(@Nullable Bundle savedInstanceState) {
toolbarTitle.setVisibility(View.VISIBLE);
toolbarImageLeft.setVisibility(View.VISIBLE);
toolbarTitle.setText("存币规则");
}
}
|
1aacf1b5-0e4d-43ee-9f4b-ba1acde034f6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-11 08:49:52", "repo_name": "huimumua/android_app_demo", "sub_path": "/FrameLayoutTest/app/src/main/java/linhui/com/framelayouttest/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1094, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "44149dfee4fae53abc16d5640abe367d2c6dd49e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/huimumua/android_app_demo | 202 | FILENAME: MainActivity.java | 0.256832 | package linhui.com.framelayouttest;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
public class MainActivity extends AppCompatActivity {
FrameLayout frameLayout;
Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/* btn = (Button) findViewById(R.id.btn);
frameLayout = (FrameLayout) findViewById(R.id.frameLayout);
frameLayout.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
int width = btn.getWidth();
int height = btn.getHeight();
btn.layout(x, y, x + width, y + height);
return false;
}
});*/
}
}
|
b6db7745-5800-466e-98c2-3996cd79626f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-04 07:56:36", "repo_name": "zhangkangmu/huihu", "sub_path": "/HuiHu_Android/module_circle/src/main/java/com/huihu/module_circle/circle/entity/CircleInfo.java", "file_name": "CircleInfo.java", "file_ext": "java", "file_size_in_byte": 1108, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "7cec019b6fa84976c221f517f03d9cc13bcd21f6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zhangkangmu/huihu | 235 | FILENAME: CircleInfo.java | 0.259826 | package com.huihu.module_circle.circle.entity;
import java.util.List;
public class CircleInfo {
private List<ActiveCircleBean> activeCircle;
private List<PopularCircleBean> popularCircle;
private List<RecentCircleBean> recentCircle;
public List<ActiveCircleBean> getActiveCircle() {
return activeCircle;
}
public void setActiveCircle(List<ActiveCircleBean> activeCircle) {
this.activeCircle = activeCircle;
}
public List<PopularCircleBean> getPopularCircle() {
return popularCircle;
}
public void setPopularCircle(List<PopularCircleBean> popularCircle) {
this.popularCircle = popularCircle;
}
public List<RecentCircleBean> getRecentCircle() {
return recentCircle;
}
public void setRecentCircle(List<RecentCircleBean> recentCircle) {
this.recentCircle = recentCircle;
}
public static class ActiveCircleBean extends CircleBaseBean{
}
public static class PopularCircleBean extends CircleBaseBean{
}
public static class RecentCircleBean extends CircleBaseBean{
}
}
|
008ff4c8-19fe-4040-ab2a-d37f256db8d1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-14 06:12:20", "repo_name": "18600165064/operation", "sub_path": "/src/main/java/com/data/display/controller/ExceptionController.java", "file_name": "ExceptionController.java", "file_ext": "java", "file_size_in_byte": 1229, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "c19819ee394324802fdb4b198ab148553741ea49", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/18600165064/operation | 236 | FILENAME: ExceptionController.java | 0.20947 | package com.data.display.controller;
import com.data.display.model.dto.DataTableResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/**
* @Author: CYN
* @Date: 2019/2/19 15:53
* @Description: 全局异常处理
*/
@RestControllerAdvice
public class ExceptionController {
private static final Logger logger = LoggerFactory.getLogger(ExceptionController.class);
/**
* 异常结果返回
*/
@ExceptionHandler(Exception.class)
public DataTableResult errorHandler(Exception e) {
DataTableResult result = new DataTableResult();
logger.error("system"+e.getMessage());
e.printStackTrace();
result.setError("系统错误");
return result;
}
/**
* 自定义异常结果返回
*/
@ExceptionHandler(RuntimeException.class)
public DataTableResult customErrorHandler(RuntimeException e) {
DataTableResult result = new DataTableResult();
logger.error("custom"+e.getMessage());
e.printStackTrace();
result.setError("系统错误");
return result;
}
}
|
fce5b99c-6080-4ccf-99a9-81e6ba870a3a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-19 06:30:45", "repo_name": "ZhuoSir/Ellen", "sub_path": "/Ellen/EllenServer/src/main/java/com/chen/ellen/service/impl/AccountServiceImpl.java", "file_name": "AccountServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1094, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "049b9765e869f2e0452ffc71bf65756807a2f8fa", "star_events_count": 4, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ZhuoSir/Ellen | 208 | FILENAME: AccountServiceImpl.java | 0.239349 | package com.chen.ellen.service.impl;
import com.chen.ellen.po.ImAccount;
import com.chen.ellen.im.core.message.IMessageWrapper;
import com.chen.ellen.im.core.session.ImSession;
import com.chen.ellen.service.AccountService;
import com.chen.ellen.session.SessionManagerImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AccountServiceImpl implements AccountService {
@Autowired
private SessionManagerImpl sessionManager;
@Override
public ImAccount initAccountAfterConnect(ImSession imSession,
IMessageWrapper wrapper) {
ImAccount imAccount = wrapper.getAccount();
imSession.setAccountId(imAccount.getAccountId());
sessionManager.updateSession(imSession);
return imAccount;
}
@Override
public ImAccount accountInfo(String accountId) {
ImAccount imAccount = new ImAccount();
imAccount.setAccountId(accountId);
imAccount.setNickName("tester");
return imAccount;
}
}
|
60d710a8-83c1-4b6c-8188-4d84ce4335e0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-10-08T23:36:43", "repo_name": "btorres136/VoceroReactApp", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1081, "line_count": 40, "lang": "en", "doc_type": "text", "blob_id": "e1ffdb595efa423655098f1dfbdceb52fd70a848", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/btorres136/VoceroReactApp | 237 | FILENAME: README.md | 0.171061 | # VoceroReactApp
To start the project, first install expo.
Open a new terminal or cmd anywhere and run:
## `npm install expo-cli -g`
navigate to the project folder and run:
## `npm install`
When the download finishes run the following command in the same folder:
## `npm start`
Your web browser will start with a QR code on the left side.
Download the Expo App on your mobile device (Android, IOS).
## IOS
Open your phone camera and scan the QR code.
This will open the Expo app and the Vocero app will start
for development purposes.
## Android
Open the expo app and hit the Scan QR code button and Scan the QR code.
This will open the Expo app and the Vocero app will start
for development purposes.
## Notes
All the changes made in the code will be automatically reflected on the device.
## Having Problems?
If you have made some changes and the change is not reflected on the phone, it is probably because
your phone has been disconnected from the server.
Simply, shake the phone up and down and a menu will appear. Just press the reload button and you're done. |
724ebd5f-7633-4fbf-bf85-3a405eef0125 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-05-11 03:05:39", "repo_name": "lawrenciumchang/basil", "sub_path": "/backend/src/main/java/com/lawrencium/basil/James/backend/RegistrationRecord.java", "file_name": "RegistrationRecord.java", "file_ext": "java", "file_size_in_byte": 1091, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "2f536a80d5930e781a0279aa83156a376f6f25b5", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lawrenciumchang/basil | 217 | FILENAME: RegistrationRecord.java | 0.216012 | package com.lawrencium.basil.James.backend;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;
/**
* The Objectify object model for device registrations we are persisting
*/
@Entity
public class RegistrationRecord {
@Id
private String emailAddress;
@Index
private String regId;
@Index
private String userName;
public RegistrationRecord() {
}
public RegistrationRecord(RegistrationRecord record){
if(record != null)
this.userName = record.getUserName();
}
public String getRegId() {
return regId;
}
public void setRegId(String regId) {
this.regId = regId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getEmailAddress() {
return emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
} |
216f0e0e-f3fd-47bc-b1e8-3a54f12b1811 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-05-03 01:26:57", "repo_name": "WYJoJo/stepCountermaster", "sub_path": "/src/main/java/com/cn/stepcounter/SplashActivity.java", "file_name": "SplashActivity.java", "file_ext": "java", "file_size_in_byte": 1116, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "e97f4d1d9de37d52b78a87266324c08c60853a16", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/WYJoJo/stepCountermaster | 196 | FILENAME: SplashActivity.java | 0.246533 | package com.cn.stepcounter;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.KeyEvent;
public class SplashActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
handler.sendEmptyMessageDelayed(1,2000);
}
private Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == 1){
startActivity(new Intent(getApplicationContext(),MainActivity.class));
SplashActivity.this.finish();
}
}
};
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK
&& event.getRepeatCount() == 0) {
return true;
}
return super.onKeyDown(keyCode, event);
}
}
|
de45a842-e7b8-437f-b607-58e62d7e52bb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-31 14:35:36", "repo_name": "mmmobley/SpringTestProject", "sub_path": "/src/test/java/com/tts/PracticeApp/PracticeApplicationTests.java", "file_name": "PracticeApplicationTests.java", "file_ext": "java", "file_size_in_byte": 1023, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "259275f00e0b46d458a20387bea147842027ad92", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mmmobley/SpringTestProject | 193 | FILENAME: PracticeApplicationTests.java | 0.262842 | package com.tts.PracticeApp;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
class PracticeApplicationTests {
@LocalServerPort
private int port;
@Autowired
private TestRestTemplate restTemplate;
// private SubscriberController controller;
// @Test
// void contextLoads() {
// //assertNotNullcontroller);
// assertThat(controller).isNotNull();
// }
@Test
void shouldReturnInfo() throws Exception {
assertThat(this.restTemplate.getForObject("http//localhost:" + port, String.class))
.contains("Welcome to my site dedicated to the best restaurants in San Antonio");
}
}
|
bda85f86-243e-4356-8fc4-7e5fdd784ad7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-18 15:50:53", "repo_name": "Fabio24Silva/QRCode-Attendance-Validator", "sub_path": "/SI/SimulacaoSI/src/main/java/simulacao/si/classes/UnidadeCurricular.java", "file_name": "UnidadeCurricular.java", "file_ext": "java", "file_size_in_byte": 1102, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "6a7c3495ed470a5655b7198b696d24f64dcc7f64", "star_events_count": 2, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/Fabio24Silva/QRCode-Attendance-Validator | 257 | FILENAME: UnidadeCurricular.java | 0.249447 | package simulacao.si.classes;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;
/**
*
* Title: QRCode Attendance API
*
* @author João Caçote
* @version 1.0
*/
@EqualsAndHashCode(callSuper = false)
@Entity
@Data
@NoArgsConstructor
public class UnidadeCurricular extends BaseModel {
private String nome;
private String code;
@EqualsAndHashCode.Exclude
@ToString.Include
@JsonInclude
@OneToMany(cascade = CascadeType.ALL, mappedBy = "unidadeCurricular", orphanRemoval = true)
private Set<Turma> turmas = new HashSet<>();
@EqualsAndHashCode.Exclude
@ToString.Include
@JsonInclude
@ManyToMany(mappedBy = "unidadescurriculares")
private Set<Curso> cursos = new HashSet<>();
public UnidadeCurricular(String nome, String code) {
this.nome = nome;
this.code = code;
}
public void addCurso(Curso curso) {
this.cursos.add(curso);
}
public void addTurma(Turma turma) {
this.turmas.add(turma);
}
} |
6e68e0a7-bd01-4079-adbb-dee744b7281b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-25 08:40:41", "repo_name": "destiny891116/vmdsunglasses", "sub_path": "/VMDSunglassStoreManager2/src/model/JoinVO.java", "file_name": "JoinVO.java", "file_ext": "java", "file_size_in_byte": 1172, "line_count": 71, "lang": "en", "doc_type": "code", "blob_id": "b2885b9ba953f265848ffe31691a395a7801932e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/destiny891116/vmdsunglasses | 248 | FILENAME: JoinVO.java | 0.236516 | package model;
public class JoinVO {
String id;
String password;
String name;
String position;
String PhoneNumber;
public JoinVO() {
super();
}
public JoinVO(String id, String password) {
super();
this.id = id;
this.password = password;
}
public JoinVO(String id, String password, String name, String position, String phoneNumber) {
super();
this.id = id;
this.password = password;
this.name = name;
this.position = position;
this.PhoneNumber = phoneNumber;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
public String getPhoneNumber() {
return PhoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
PhoneNumber = phoneNumber;
}
}
|
9963985f-1bec-453e-8698-5992f4d7d40a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-19 21:53:47", "repo_name": "StephenOTT/STIX-Java", "sub_path": "/src/main/java/io/digitalstate/stix/validation/SdoDefaultValidator.java", "file_name": "SdoDefaultValidator.java", "file_ext": "java", "file_size_in_byte": 1120, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "750ba57e67b28d12fa18d89e114a4d9cefc78795", "star_events_count": 26, "fork_events_count": 15, "src_encoding": "UTF-8"} | https://github.com/StephenOTT/STIX-Java | 195 | FILENAME: SdoDefaultValidator.java | 0.285372 | package io.digitalstate.stix.validation;
import io.digitalstate.stix.validation.sequences.SequenceDefault;
import io.digitalstate.stix.validation.sequences.SequenceValidationIdOnly;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Validation;
import javax.validation.Validator;
import java.util.Set;
public interface SdoDefaultValidator {
Validator VALIDATOR = Validation.buildDefaultValidatorFactory().getValidator();
default void validate() throws ConstraintViolationException{
Set<ConstraintViolation<SdoDefaultValidator>> violations = VALIDATOR.validate(this, SequenceDefault.class);
if (!violations.isEmpty()) {
throw new ConstraintViolationException(violations);
}
}
default void validateOnlyId() throws ConstraintViolationException{
Set<ConstraintViolation<SdoDefaultValidator>> violations = VALIDATOR.validate(this, SequenceValidationIdOnly.class);
if (!violations.isEmpty()) {
throw new ConstraintViolationException(violations);
}
}
}
|
9852ee84-2961-4638-bdba-b6ec2f566180 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-13 15:21:54", "repo_name": "YeganehNobakht/Home_Service_Spring_Boot", "sub_path": "/src/main/java/ir/maktab/homeService/web/LogoutController.java", "file_name": "LogoutController.java", "file_ext": "java", "file_size_in_byte": 1062, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "3911038c2a786857f599ee321dba40d5a0918232", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/YeganehNobakht/Home_Service_Spring_Boot | 192 | FILENAME: LogoutController.java | 0.246533 | package ir.maktab.homeService.web;
import ir.maktab.homeService.service.maktabMassageSource.MaktabMessageSource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@Controller
@RequestMapping("/logout")
public class LogoutController {
private final Logger logger = LogManager.getLogger(LogoutController.class);
private final MaktabMessageSource maktabMessageSource;
public LogoutController(MaktabMessageSource maktabMessageSource) {
this.maktabMessageSource = maktabMessageSource;
}
@GetMapping
public String logout(HttpServletRequest request){
logger.info(maktabMessageSource.getEnglish("success.logout"));
HttpSession session = request.getSession(false);
session.invalidate();
return "index";
}
}
|
b2e45a74-040d-428d-b5dc-2b74b0d99ffe | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-05 16:39:06", "repo_name": "ICC-4102-APLICACIONESMOVILES/laboratorio-recuperativo-BenjaPerezG", "sub_path": "/app/src/main/java/com/example/rabinovich/lab/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1096, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "c067e6b4ed50f5886e4f2420f99d07566f0148c7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ICC-4102-APLICACIONESMOVILES/laboratorio-recuperativo-BenjaPerezG | 178 | FILENAME: MainActivity.java | 0.20947 | package com.example.rabinovich.lab;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
SharedPreferences preferences;
private String rut;
private String password;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
preferences = getSharedPreferences(getString(R.string.shared_preferences_file), MODE_PRIVATE);
}
@Override
protected void onStart(){
super.onStart();
rut = preferences.getString("rut", "");
password = preferences.getString("password", "");
if(rut.equals("") || password.equals("")){
Intent login_intent = new Intent(this, LoginActivity.class);
startActivity(login_intent);
}else{
Intent change_intent = new Intent(this, ChangeActivity.class);
startActivity(change_intent);
}
}
}
|
df251916-983e-43ac-b5f7-443557e7027a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-02-17 03:35:30", "repo_name": "deshpandeanoop/explore-zookeeper", "sub_path": "/src/main/java/com/explore/zookeeper/watchers/MasterNodeWatcher.java", "file_name": "MasterNodeWatcher.java", "file_ext": "java", "file_size_in_byte": 1094, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "e51eaf10108782030378d52ef83a25b390b45692", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/deshpandeanoop/explore-zookeeper | 221 | FILENAME: MasterNodeWatcher.java | 0.242206 | package com.explore.zookeeper.watchers;
import com.explore.zookeeper.model.ClusterInfo;
import com.explore.zookeeper.service.interfaces.IZookeeperService;
import org.I0Itec.zkclient.IZkChildListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.List;
@Component("masterNodeWatcher")
public class MasterNodeWatcher implements IZkChildListener {
private static final Logger LOGGER = LoggerFactory.getLogger(MasterNodeWatcher.class);
private final IZookeeperService zookeeperService;
public MasterNodeWatcher(IZookeeperService zookeeperService) {
this.zookeeperService = zookeeperService;
}
@Override
public void handleChildChange(String path, List<String> list) throws Exception {
LOGGER.info("Master has been crashed, trying to be master");
zookeeperService.electMaster(ClusterInfo.getServerHostAndPort());
ClusterInfo.getInstance().setMaster(zookeeperService.getMaster());
LOGGER.info("Master has been elected and updated cluster info");
}
} |
6a31ae63-88fe-4bc7-bd18-c625627aa35c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-25 16:10:12", "repo_name": "youdean/technical-assessment", "sub_path": "/src/main/java/id/hasanuddin/technicalassessment/controller/AuthController.java", "file_name": "AuthController.java", "file_ext": "java", "file_size_in_byte": 1170, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "21914a86143e7390be2ae30d3d2e682e9056a34a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/youdean/technical-assessment | 195 | FILENAME: AuthController.java | 0.210766 | package id.hasanuddin.technicalassessment.controller;
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE;
import javax.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import id.hasanuddin.technicalassessment.request.AuthenticationRequest;
import id.hasanuddin.technicalassessment.response.TokenResponse;
import id.hasanuddin.technicalassessment.service.UserService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
@RestController
@Api(tags = "Auth")
@RequestMapping(value = "/auth")
@RequiredArgsConstructor
public class AuthController {
private final UserService userService;
@PostMapping(value = "/token", consumes = APPLICATION_JSON_UTF8_VALUE, produces = APPLICATION_JSON_UTF8_VALUE)
public TokenResponse signIn(@RequestBody @Valid AuthenticationRequest credentials) {
String token = userService.createToken(credentials);
return new TokenResponse(token);
}
} |
4b61ff89-6a17-48cf-9103-d05f78787761 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-04-08T15:41:12", "repo_name": "jnardon/ExercicioSelecaoMobile", "sub_path": "/app/src/main/java/com/fourall/exercicioselecaomobile/views/SpinnerDialog.java", "file_name": "SpinnerDialog.java", "file_ext": "java", "file_size_in_byte": 1170, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "6f1edc34c256ec9ebd62bf9f4c39d4f39a0a32d6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jnardon/ExercicioSelecaoMobile | 225 | FILENAME: SpinnerDialog.java | 0.235108 | package com.fourall.exercicioselecaomobile.views;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.Window;
import com.fourall.exercicioselecaomobile.R;
/**
* Created by julianonardon on 31/12/14.
*/
public class SpinnerDialog {
private Dialog dialog;
private Context context;
public SpinnerDialog(Context context){
dialog = new Dialog(context);
this.context = context;
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(
new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog.setContentView(R.layout.dialog_spinner);
dialog.setCanceledOnTouchOutside(false);
}
public void show(){
((Activity) context).runOnUiThread(new Runnable() {
public void run() {
dialog.show();
}
});
}
public void dismiss(){
((Activity) context).runOnUiThread(new Runnable() {
public void run() {
dialog.dismiss();
}
});
}
}
|
3d453fa7-d8eb-43e3-b6a2-4407486b3770 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2015-12-13T18:04:25", "repo_name": "DarkNormal/Sunshine-Version-2", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1105, "line_count": 21, "lang": "en", "doc_type": "text", "blob_id": "d848ab367f55f933052ffbc16a8a12e6254ecb18", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DarkNormal/Sunshine-Version-2 | 302 | FILENAME: README.md | 0.23793 | This is my work following along with the Udacity course. The course itself is aimed at people with a year or 2 experience in OOP, and I felt it would be good for me and my skills to get some guidance on my mobile development techniques. I'm rusting with AsyncTasks and other quite important stuff, and I'll be using these a lot during my 4th year project so some practice is always good.
Sunshine
========
Sunshine is the companion Android app for the Udacity course [Developing Android Apps: Android Fundamentals](https://www.udacity.com/course/ud853).
Take the course to find out how to build this app a step at a time, and eventually create your own Android App!
This is the second version of the Sunshine code. The repository has been updated on:
* **February 13th, 2015** - Major update
* February 25, 2015 - Minor bug fixes
* March 4th, 2015 - Minor bug fixes
For the original version, please go [here](https://github.com/udacity/Sunshine).
A changelog for the course can be found [here](https://docs.google.com/a/knowlabs.com/document/d/193xJb_OpcNCqgquMhxPrMh05IEYFXQqt0S6-6YK8gBw/pub).
|
fa3f1313-03e0-4d11-8d9e-bb0aec6a4af2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-02 09:35:07", "repo_name": "zhanght86/erim", "sub_path": "/P15009907/src/main/java/com/erim/sz/web/service/PubCitytownService.java", "file_name": "PubCitytownService.java", "file_ext": "java", "file_size_in_byte": 1087, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "2728095122556bad67dceff1c9d72c1725132804", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zhanght86/erim | 285 | FILENAME: PubCitytownService.java | 0.262842 | package com.erim.sz.web.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import com.erim.sz.common.bean.PubCityshopBean;
import com.erim.sz.web.dao.PubCitytownDao;
/**
* @ClassName: PubCitytownService
* @Description: 社会商圈
* @author maoxian
* @date 2015年10月3日 下午10:13:00
*/
@Service("pubCitytownService")
@Scope(BeanDefinition.SCOPE_SINGLETON)
public class PubCitytownService {
@Autowired
private PubCitytownDao pubCitytownDao;
/**
* @Title: update
* @Description: 数据清洗
* @param 设定文件
* @return void 返回类型
* @throws
*/
public void update(){
List<PubCityshopBean> list = this.pubCitytownDao.selectAllCode();
for(PubCityshopBean bean :list){
String lb = bean.getLb();
String aa = "";
if(lb.contains("医院:")){
aa += lb +",";
}
System.out.println(aa);
}
}
}
|
edb63896-6ddd-4728-b454-17eccfc7fed9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-13 15:34:57", "repo_name": "lingxuxiong/NanoHttpdemo", "sub_path": "/app/src/main/java/com/neil/nanohttpdemo/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1109, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "b6ad7e8400fa987832d4ee119439e65409c6ba79", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lingxuxiong/NanoHttpdemo | 216 | FILENAME: MainActivity.java | 0.253861 | package com.neil.nanohttpdemo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import com.neil.nanohttpdemo.server.MyServer;
import com.neil.nanohttpdemo.utils.NetworkUtils;
import java.io.IOException;
public class MainActivity extends AppCompatActivity {
private static final String LOG_TAG = "MainActivity";
private MyServer mMyServer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
protected void onResume() {
super.onResume();
Log.d(LOG_TAG, "onResume");
try {
String host = NetworkUtils.getWifiIpAddress(getApplicationContext());
mMyServer = new MyServer(host, MyServer.PORT);
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void onPause() {
super.onPause();
Log.d(LOG_TAG, "onPause");
if(mMyServer != null) {
mMyServer.stop();
}
}
}
|
b1c5b22f-646d-4485-99e3-86813a146424 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-19 01:37:04", "repo_name": "1198109623/GraduationDesign", "sub_path": "/MovieOrder/src/main/java/com/hand/movie/bean/Seat.java", "file_name": "Seat.java", "file_ext": "java", "file_size_in_byte": 1170, "line_count": 63, "lang": "en", "doc_type": "code", "blob_id": "2dd4628418ed168af149e96a2a556b9ff48270cd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/1198109623/GraduationDesign | 262 | FILENAME: Seat.java | 0.243642 | package com.hand.movie.bean;
public class Seat {
private Integer seatId;
private Integer row;
private Integer seat;
private Integer status;
public Seat() {
}
public Seat(Integer seatId, Integer row, Integer seat, Integer status) {
this.seatId = seatId;
this.row = row;
this.seat = seat;
this.status = status;
}
public Integer getSeatId() {
return seatId;
}
public void setSeatId(Integer seatId) {
this.seatId = seatId;
}
public Integer getRow() {
return row;
}
public void setRow(Integer row) {
this.row = row;
}
public Integer getSeat() {
return seat;
}
public void setSeat(Integer seat) {
this.seat = seat;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
@Override
public String toString() {
return "Seat{" +
"seatId=" + seatId +
", row=" + row +
", seat=" + seat +
", status=" + status +
'}';
}
} |
359bf65d-595a-4099-bd09-45b577d7db55 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-03-18T18:08:37", "repo_name": "SYSUMSC/hackreg-t1", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1128, "line_count": 35, "lang": "en", "doc_type": "text", "blob_id": "58aacbcbd130caf4bd44e27e630cda360c6ab2a9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/SYSUMSC/hackreg-t1 | 300 | FILENAME: README.md | 0.208179 | # hackreg-t1
🤟🤩The frontend program for Hackathon 2020 registration website.
## 🖼 Screenshots




## ⚙️ Technology Stack
- Redux
- Bootstrap
- React
- TypeScript
## 📋 Guides
#### 🛠 Setting up local development environment
1. Install React DevTools and Redux DevTools for your web browser.
2. Run these commands to fetch the copy of the project and install the dependent packages using npm.
```
git clone https://github.com/SYSUMSC/hackreg-t1.git
cd hackreg-t1
npm install
```
3. Run `npm start` to fire up the development build!
#### 🛠 Making a production build and run it
1. Run `npm run build`.
2. Check out `/dist`.
## 🔏 License
This project is licensed under the [MIT license](https://opensource.org/licenses/mit-license.php), see the LICENSE file for details
|
79ac8ffe-cfe2-4926-bd2b-f4aae7324a7a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-02-01 05:18:12", "repo_name": "Kenadia/Visualizing-Diff-Eqs", "sub_path": "/src/Function.java", "file_name": "Function.java", "file_ext": "java", "file_size_in_byte": 995, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "858e47f697c974a537e5c8f568427bf7904d3fef", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Kenadia/Visualizing-Diff-Eqs | 211 | FILENAME: Function.java | 0.267408 | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package differential;
/**
*
* @author kenschiller
*/
public class Function extends Graphable {
public Function(String string) {
super(string); //theory
}
public double operate(double x) {
int y = (int) x;
return y;
}
/*public double operate(double input) {
String string = getString();
if(string.substring(0, 2).equals("y=")) {
return evaluate(string.substring(2), input, '\0');
}
return Double.NaN;
}
public double evaluate(String formula, double input, char endChar) {
int length = formula.length();
for(int i = 0; i < length; i++) {
char c = formula.charAt(i);
switch(c) {
case '(':
break;
default:
return Double.NaN;
}
}
return Double.NaN;
}*/
}
|
f38d6911-b0d2-44fa-80dd-238c3741705d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-02 11:09:33", "repo_name": "BitWeb/genetic-algorithm-lib", "sub_path": "/src/ee/bitweb/geneticalgorithm/GeneticAlgorithm.java", "file_name": "GeneticAlgorithm.java", "file_ext": "java", "file_size_in_byte": 1169, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "5764b9c6caca7f1a9055a9553a9b21cde75a5ff5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/BitWeb/genetic-algorithm-lib | 224 | FILENAME: GeneticAlgorithm.java | 0.286968 | package ee.bitweb.geneticalgorithm;
import ee.bitweb.geneticalgorithm.fitness.FitnessFunction;
import ee.bitweb.geneticalgorithm.selection.SelectionFunction;
/**
* Created by tobre on 18/07/2017.
*/
public class GeneticAlgorithm {
private Population population;
public GeneticAlgorithm(Integer populationSize, FitnessFunction fitnessFunction, SelectionFunction selectionFunction) {
population = new Population(populationSize, fitnessFunction, selectionFunction);
selectionFunction.setPopulation(population);
}
public Integer run() {
int generationCount = 1;
while (population.getFittest().getFitness() < population.getFitnessFunction().getMaxFitness()) {
population = population.evolve();
generationCount++;
}
return generationCount;
}
public Population getPopulation() {
return population;
}
public Population evolve() {
population = population.evolve();
return population;
}
public Boolean solutionFound() {
return population.getFittest().getFitness() < population.getFitnessFunction().getMaxFitness();
}
}
|
8c1bc051-a1c6-42a2-bb7f-d9eeb6db4e0d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-18 09:40:35", "repo_name": "selinTom/HistoryApp", "sub_path": "/app/src/main/java/com/example/devov/historyapp/fragment/audioRecord/AnswerInfo.java", "file_name": "AnswerInfo.java", "file_ext": "java", "file_size_in_byte": 1171, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "dc231687ec8e5539045d53e97399a56a6ef09fd9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/selinTom/HistoryApp | 238 | FILENAME: AnswerInfo.java | 0.27513 | package com.example.devov.historyapp.fragment.audioRecord;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by devov on 2016/12/15.
*/
public class AnswerInfo implements Parcelable {
public String reason;
public Result result;
public String error_code;
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.reason);
dest.writeParcelable(this.result, flags);
dest.writeString(this.error_code);
}
public AnswerInfo() {
}
protected AnswerInfo(Parcel in) {
this.reason = in.readString();
this.result = in.readParcelable(Result.class.getClassLoader());
this.error_code = in.readString();
}
public static final Parcelable.Creator<AnswerInfo> CREATOR = new Parcelable.Creator<AnswerInfo>() {
@Override
public AnswerInfo createFromParcel(Parcel source) {
return new AnswerInfo(source);
}
@Override
public AnswerInfo[] newArray(int size) {
return new AnswerInfo[size];
}
};
}
|
60df13ce-59cb-4b62-a8be-75bbed3cfd5c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-18 09:06:39", "repo_name": "Stellucidam/DigiBack_java_backend", "sub_path": "/src/main/java/ch/heigvd/digiback/business/activity/credential/StepCredentialDeserializer.java", "file_name": "StepCredentialDeserializer.java", "file_ext": "java", "file_size_in_byte": 1231, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "a41341f1062c91206ae092143a90843320e8ef64", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Stellucidam/DigiBack_java_backend | 229 | FILENAME: StepCredentialDeserializer.java | 0.289372 | package ch.heigvd.digiback.business.activity.credential;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.jackson.JsonComponent;
import java.io.IOException;
import java.sql.Date;
@JsonComponent
public class StepCredentialDeserializer extends JsonDeserializer<StepCredential> {
private static final Logger logger = LoggerFactory.getLogger(StepCredentialDeserializer.class);
@Override
public StepCredential deserialize(
JsonParser jsonParser,
DeserializationContext deserializationContext
) throws IOException {
JsonNode node = jsonParser.getCodec().readTree(jsonParser);
Long idUser = node.get("idUser").longValue();
String date = node.get("date").asText();
Long nbrSteps = node.get("nbrSteps").longValue();
logger.info("Deserialized step");
return StepCredential.builder()
.date(Date.valueOf(date))
.nbrSteps(nbrSteps)
.build();
}
}
|
08de5f7f-e91f-47b6-8576-3a70db9e0f24 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-04-14T08:15:23", "repo_name": "PiTiLeZarD/pyoneer", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1171, "line_count": 18, "lang": "en", "doc_type": "text", "blob_id": "583cee60b5b81bc3706a7035267a175105a60588", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/PiTiLeZarD/pyoneer | 332 | FILENAME: README.md | 0.26971 | # pyoneer
Python learning game
Aim of the game is something akin to [zork](https://en.wikipedia.org/wiki/Zork).
Steps are connected to branches. To see the working code at step X:
```
$ git checkout step_X
```
- [Step 1](https://github.com/PiTiLeZarD/pyoneer/tree/step_1): Have a little guy walking on a 3x4 map, nothing fancy ([Example](https://raw.githubusercontent.com/PiTiLeZarD/pyoneer/step_1/example.png))
- [Step 2](https://github.com/PiTiLeZarD/pyoneer/tree/step_2): Here the cells in the map have walls, objects and you can win the game ([Example](https://raw.githubusercontent.com/PiTiLeZarD/pyoneer/step_2/example.png))
- Step 3: Here we'll add some unit-tests, documentation, pep8, all the project goodies
- Step 4: Here we'll have the concept of actions (go, pick, drop, attack, etc...), player's life, player's bag, useful objects (weapons, food, armour), monsters...
- Step 5: Here we'll add customisable auto generated maps, yup that's it, it'll be heaps!
- Step 6: Here we'll add the concept of difficulty, levels, stregth of monsters, lasting effects (heal/poison)
- Step 7: Let's make it look nice and web based, using docker/docker-compose
|
9f5546b1-a432-4252-a082-a005b6609186 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-30 15:45:37", "repo_name": "spydx/dat251gr9", "sub_path": "/lop-backend/src/main/java/no/hvl/dat251/gr9/lopbackend/entities/OrganizerProfile.java", "file_name": "OrganizerProfile.java", "file_ext": "java", "file_size_in_byte": 1039, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "9dfcea9b30d056e21696565a99bc13c5c72e6522", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/spydx/dat251gr9 | 208 | FILENAME: OrganizerProfile.java | 0.23231 | package no.hvl.dat251.gr9.lopbackend.entities;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
@Entity
@Data
public class OrganizerProfile implements Serializable{
@Id
@GeneratedValue(generator="system-uuid")
@GenericGenerator(name="system-uuid", strategy = "uuid2")
@JsonIgnore
private String id;
private String organizerName;
private String Address;
@JsonIgnore
@OneToMany(cascade = CascadeType.PERSIST)
private List<Contacts> contacts;
@JsonIgnore
@OneToOne(fetch = FetchType.EAGER)
private OrganizerAccount account;
@Override
public String toString() {
return "OrganizerProfile{" +
"id='" + id + '\'' +
", organizerName='" + organizerName + '\'' +
", Address='" + Address + '\'' +
", contacts=" + contacts +
'}';
}
}
|
bb2efac5-be4c-4254-9357-367a2c0f79a6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-06-16 16:50:41", "repo_name": "dclement/ProjectLemmings", "sub_path": "/src/environment/AIBody.java", "file_name": "AIBody.java", "file_ext": "java", "file_size_in_byte": 1000, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "1a6c47a0ad79cfef512db481f456828026941d6d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dclement/ProjectLemmings | 223 | FILENAME: AIBody.java | 0.272025 |
package environment;
import java.util.List;
import org.janusproject.kernel.address.AgentAddress;
public abstract class AIBody extends Body {
/** Is the perception distance.
*/
private final int distance;
/**
* @param env is the environment in which the body is located.
* @param distance is the maximal distance of perception of the artificial intelligence.
* @param direction is the initial direction of the body.
*/
public AIBody(AgentAddress address, Environment env, int distance, Direction direction, boolean fall) {
super(address, env, direction, fall);
this.distance = distance;
}
/** Replies the maximal distance of perception.
*
* @return the maximal distance of perception.
*/
public int getPerceptionDistance() {
return this.distance;
}
/** Replies the objects around the body.
*
* @return the list of the perceived objects.
*/
public List<Perception> perceive() {
Environment e = getEnvironment();
return e.perceive(this);
}
}
|
e6555f53-5878-48f2-b5e2-554600b495bb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-02 10:24:52", "repo_name": "dicrescenzoa/project-management", "sub_path": "/src/main/java/com/hydra/pma/services/AuthorService.java", "file_name": "AuthorService.java", "file_ext": "java", "file_size_in_byte": 1170, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "3a18bf4b4d718c7d2115439363598d972a1b7a2a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dicrescenzoa/project-management | 232 | FILENAME: AuthorService.java | 0.285372 | package com.hydra.pma.services;
import com.hydra.pma.dao.AuthorRepository;
import com.hydra.pma.dto.AuthorDto;
import com.hydra.pma.entities.Author;
import com.hydra.pma.mapper.AuthorMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@Service
public class AuthorService {
@Autowired
AuthorRepository authorRepository;
public Optional<AuthorDto> getAuthorById(Long id) {
Optional<Author> authorOpt = authorRepository.findById(id);
if(authorOpt.isEmpty()) {
return Optional.empty();
}
Author author = authorOpt.get();
AuthorDto authorDto = AuthorMapper.INSTANCE.authorToAuthorDto(author);
return Optional.ofNullable(authorDto);
}
public AuthorDto getAuthorDto(Author author) {
return AuthorMapper.INSTANCE.authorToAuthorDto(author);
}
public List<AuthorDto> getAuthorDtoList(List<Author> authorList) {
return AuthorMapper.INSTANCE.getAuthorDtoList(authorList);
}
}
|
9eb32b3c-7708-4eae-a60e-80c64b7b2d1f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-10-21 10:20:52", "repo_name": "rishabh05/ED", "sub_path": "/platform/src/main/java/com/eworkplaceapps/platform/cyclicnotification/CyclicNotificationLinkingDataService.java", "file_name": "CyclicNotificationLinkingDataService.java", "file_ext": "java", "file_size_in_byte": 985, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "ee652718d9ea7d9cfd9521032577f5fce91c0d08", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rishabh05/ED | 183 | FILENAME: CyclicNotificationLinkingDataService.java | 0.291787 | //===============================================================================
// © 2015 eWorkplace Apps. ALL rights reserved.
// Main Author: Parikshit Patel
// Original DATE: 4/29/2015
//===============================================================================
package com.eworkplaceapps.platform.cyclicnotification;
import com.eworkplaceapps.platform.entity.BaseDataService;
public class CyclicNotificationLinkingDataService extends BaseDataService<CyclicNotificationLinking> {
CyclicNotificationLinkingData dataDelegate = new CyclicNotificationLinkingData();
/**
* Initializes a new instance of the CyclicNotificationLinkingDataService class.
*/
public CyclicNotificationLinkingDataService() {
super("CYCLIC_NOTIFICATION_LINKING");
}
@Override
public CyclicNotificationLinkingData getDataClass() {
return dataDelegate;
}
/**
* ----------------------- Begin Class Methods ---------------
*/
}
|
e201bc3c-05d4-4255-8bd0-b3e6b63eca58 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-18 20:41:50", "repo_name": "thiagoTBA/GERAL", "sub_path": "/JESUS/PROVA2/Comunidade/app/src/main/java/model/connection/ConnectionFactory.java", "file_name": "ConnectionFactory.java", "file_ext": "java", "file_size_in_byte": 1080, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "926a7cbb2ef40d684e2086b34ee84b69b0a9a5ba", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/thiagoTBA/GERAL | 216 | FILENAME: ConnectionFactory.java | 0.277473 | package model.connection;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class ConnectionFactory extends SQLiteOpenHelper {
private static final String DATABASE = "banco";
private static final int VERSION = 1;
public ConnectionFactory(Context context) {
super(context, DATABASE, null, VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
StringBuilder sql = new StringBuilder();
sql.append("create table funcionario(")
.append("pcodigo integer not null primary key,")
.append("pnome text not null,")
.append("pcpf int not null,")
.append("pfone int not null,")
.append("psalari int not null,")
.append("pbonus text not null,")
.append("psalariofinal text not null)");
db.execSQL(sql.toString());
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
|
93791faa-ae83-4196-8204-3a22683ee860 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-15 02:19:43", "repo_name": "zcmlijie/gmall", "sub_path": "/gmall-service-util/src/main/java/message/Util.java", "file_name": "Util.java", "file_ext": "java", "file_size_in_byte": 1227, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "0f9c095e060ef9e855266cd1296a8f7e5177846b", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zcmlijie/gmall | 243 | FILENAME: Util.java | 0.256832 | package message;
import org.apache.http.HttpEntity;
import org.apache.http.entity.InputStreamEntity;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Util {
/**
* 获取请求Content-Type: application/json 类型的二进制数据,转换为JSON数据格式
*
* @param request 客户端请求
* @return JSON字符串
* @author Mbox
*/
public static String toJSON(HttpServletRequest request) {
InputStreamReader input = null;
BufferedReader reader = null;
try {
HttpEntity data = new InputStreamEntity(request.getInputStream(), request.getContentLength());
input = new InputStreamReader(data.getContent(), "utf-8");
reader = new BufferedReader(input);
String line = null;
StringBuilder sb = new StringBuilder();
while ((line = reader.readLine()) != null) {
sb.append(line);
}
return sb.toString();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
input.close();
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
}
|
cc523433-e845-4cd9-9db2-f33dcfec69b5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-26 07:12:46", "repo_name": "PiotrGrzaslewicz/foodproject", "sub_path": "/src/main/java/pl/coderslab/dao/DayNameDao.java", "file_name": "DayNameDao.java", "file_ext": "java", "file_size_in_byte": 966, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "96dcfb215a2fa756b3fb75cc804b4b8b89ed5acf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/PiotrGrzaslewicz/foodproject | 191 | FILENAME: DayNameDao.java | 0.292595 | package pl.coderslab.dao;
import pl.coderslab.model.DayName;
import pl.coderslab.utils.DbUtil;
import pl.coderslab.utils.EntityFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
public class DayNameDao {
private static final String FIND_ALL_BOOKS_QUERY = "SELECT * FROM day_name ORDER BY display_order ASC;";
private EntityFactory<DayName> factory = new EntityFactory<>(DayName.class);
public List<DayName> findAll() {
List<DayName> dayNames = new ArrayList<>();
try (Connection connection = DbUtil.getConnection();
PreparedStatement statement = connection.prepareStatement(FIND_ALL_BOOKS_QUERY)) {
ResultSet resultSet = statement.executeQuery();
dayNames = factory.getAsList(resultSet);
} catch (Exception e) {
e.printStackTrace();
}
return dayNames;
}
}
|
31ff6b2f-753a-4876-b9e8-baa2b3d2e11f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-09-22 13:13:18", "repo_name": "audit4j/audit4j-core", "sub_path": "/src/main/java/org/audit4j/core/util/ClassLoaderUtils.java", "file_name": "ClassLoaderUtils.java", "file_ext": "java", "file_size_in_byte": 1171, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "459bcc650a1c0c05183cde8f9da154c69ac3e138", "star_events_count": 124, "fork_events_count": 98, "src_encoding": "UTF-8"} | https://github.com/audit4j/audit4j-core | 253 | FILENAME: ClassLoaderUtils.java | 0.286169 | package org.audit4j.core.util;
/**
* The Class ClassLoaderUtils.
*
* @author <a href="mailto:janith3000@gmail.com">Janith Bandara</a>
*
* @since 2.4.0
*/
public final class ClassLoaderUtils {
/**
* Instantiates a new class loader utils.
*/
private ClassLoaderUtils() {
super();
}
/**
* Gets the class loader.
*
* @param clazz the clazz
* @return the class loader
*/
public static ClassLoader getClassLoader(final Class<?> clazz) {
// Context class loader can be null
final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
if (contextClassLoader != null) {
return contextClassLoader;
}
if (clazz != null) {
// The class loader for a specific class can also be null
final ClassLoader clazzClassLoader = clazz.getClassLoader();
if (clazzClassLoader != null) {
return clazzClassLoader;
}
}
// The only class loader we can rely on for not being null is the system
// one
return ClassLoader.getSystemClassLoader();
}
}
|
1f4e1ce3-ac23-4c77-9709-c016302dda71 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-03 13:48:05", "repo_name": "cuileikun/AndroidBase", "sub_path": "/app/src/main/java/com/cuileikun/androidbase/activity/seventh/SpecalBroadcasterActivity.java", "file_name": "SpecalBroadcasterActivity.java", "file_ext": "java", "file_size_in_byte": 1189, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "923318ffeb9ad2b007be974235f3708689c67b03", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/cuileikun/AndroidBase | 237 | FILENAME: SpecalBroadcasterActivity.java | 0.26588 | package com.cuileikun.androidbase.activity.seventh;
import android.app.Activity;
import android.content.IntentFilter;
import android.os.Bundle;
import com.cuileikun.androidbase.R;
import com.cuileikun.androidbase.receiver.ScreenReceiver;
/**
* Created by Admin on 2017/4/29.
*/
public class SpecalBroadcasterActivity extends Activity {
private ScreenReceiver screenReceiver;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_specal_broadcast);
//[1]获取receiver的实例
screenReceiver = new ScreenReceiver();
//[2]准备intent-filter
IntentFilter filter = new IntentFilter();
filter.addAction("android.intent.action.SCREEN_OFF");
filter.addAction("android.intent.action.SCREEN_ON");
//通过代码动态的去注册
this.registerReceiver(screenReceiver, filter);
}
//当Activity销毁的时候 需要取消注册广播接收者
@Override
protected void onDestroy() {
//取消注册广播接收者
unregisterReceiver(screenReceiver);
super.onDestroy();
}
}
|
9a42d395-2a8c-462f-ab2f-83d52bfcec8b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-02 12:24:17", "repo_name": "topsecretabc/TextApp", "sub_path": "/app/src/main/java/com/licong/textapp/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1104, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "37958dded731c2a1b34d619649cbc362dd70c8ab", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/topsecretabc/TextApp | 205 | FILENAME: MainActivity.java | 0.26588 | package com.licong.textapp;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
Uri uri=Uri.parse("content://com.licong.graduationproject.provider/Textapp");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
readContacts();
}
public void readContacts(){
Cursor cursor =null;
TextView textView = (TextView) findViewById(R.id.textapp_textview);
cursor = getContentResolver().query(uri,null, null, null, null);
if (cursor != null) {
while (cursor.moveToNext()) {
String text = cursor.getString(cursor.getColumnIndex("textapptext"));
textView.setText(text);
}
}
if (cursor != null) {
cursor.close();
}
}
}
|
af0b5388-d743-4f73-8033-0174d7bfac06 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-11 22:49:11", "repo_name": "RuedaFacundo/FinalProyect", "sub_path": "/src/com/company/graficos/AdminMenu.java", "file_name": "AdminMenu.java", "file_ext": "java", "file_size_in_byte": 1168, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "95c7ce692c802b04852fd45d857d5df811f23634", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/RuedaFacundo/FinalProyect | 269 | FILENAME: AdminMenu.java | 0.271252 | package com.company.graficos;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
public class AdminMenu extends JPanel {
private final JPanel sheet;
public AdminMenu (){
sheet = new JPanel();
sheet.setLayout(new GridLayout(16,1, 2, 5));
addButtom("Cargar Administrador");
addButtom("Cargar Recepcionista");
addButtom("Cargar Cliente");
addButtom("Cargar Reserva");
addButtom("Check In");
addButtom("Check Out");
addButtom("Listar Administradores");
addButtom("Buscar un Administrador");
addButtom("Listar Recepcionistas");
addButtom("Buscar un Recepcionista");
addButtom("Listar Reservas");
addButtom("Mostrar Reservas del dia");
addButtom("Listar Habitaciones");
addButtom("Mostrar Habitaciones Disponibles");
addButtom("Remover una Habitacion");
addButtom("Back up");
sheet.setBackground(Color.CYAN);
add(sheet);
}
private void addButtom (String name){
JButton boton = new JButton(name);
sheet.add(boton, BorderLayout.CENTER);
}
}
|
975e92db-aba5-41d1-bef2-25a910bdf012 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-07 13:23:09", "repo_name": "dashboardijo/bat", "sub_path": "/src/CyclicBarrierDemo.java", "file_name": "CyclicBarrierDemo.java", "file_ext": "java", "file_size_in_byte": 1069, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "fcaaafdd02759ba04efe4a68865ce6211a31eb15", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dashboardijo/bat | 225 | FILENAME: CyclicBarrierDemo.java | 0.289372 | import java.util.HashSet;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.atomic.AtomicLong;
/**
* @author lvyue
* @since 2020/7/21
*/
public class CyclicBarrierDemo {
public static void main(String[] args) {
AtomicLong atomicLong = new AtomicLong(0);
atomicLong.getAndIncrement();
CyclicBarrier cyclicBarrier = new CyclicBarrier(7, () -> {
System.out.println("*** 召唤神龙!");
});
for (int i = 1; i <= 7; i++) {
final int tempInt = i;
new Thread(() -> {
System.out.println(Thread.currentThread().getName() + "\t 收集到第:" + tempInt + "龙珠");
try {
cyclicBarrier.await();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
}, String.valueOf(i)).start();
}
}
}
|
af2cdafa-ea51-4ab3-9de3-e935266d78fa | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-02-22T21:28:15", "repo_name": "vdt/fastec2", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 999, "line_count": 43, "lang": "en", "doc_type": "text", "blob_id": "0d2131abc8f1bd8b5520dbb16dbe437fa4fbdf52", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/vdt/fastec2 | 266 | FILENAME: README.md | 0.258326 | ## fastec2
AWS EC2 computer management for regular folks...
## Installation
```bash
$ pip install git+https://github.com/fastai/fastec2.git
```
To add tab completion for your shell (replace *bash* with the name of your preferred shell, and *.bashrc* with your shell's config script):
```bash
$ fe2 -- --completion bash > ~/.fe2-completion
$ echo 'source ~/.fe2-completion' >> ~/.bashrc
$ source ~/.bashrc
```
## Usage
For a list of commands, type:
```bash
$ fe2
Usage: fe2 -
fe2 - change-type
fe2 - connect
fe2 - get-ami
fe2 - get-price-hist
...
```
Each command can provide help, as follows:
```bash
$ fe2 change-type -- --help
Usage: fe2 change-type NAME INSTTYPE
fe2 change-type --name NAME --insttype INSTTYPE
```
An [introduction and guide](https://www.fast.ai/2019/02/15/fastec2/) is available for the command line API and REPL. See the `examples` directory for examples of the Python API.
|
6de134e7-f60c-4e66-ae7c-f1d76fe62918 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-07-28 12:40:09", "repo_name": "manish-in-java/jpa-hibernate-jdbc", "sub_path": "/src/main/java/org/example/benchmark/hibernate/PersonCriteriaBenchmark.java", "file_name": "PersonCriteriaBenchmark.java", "file_ext": "java", "file_size_in_byte": 1071, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "afe58ec7b4937793d2ca8033e8231985cb66c87e", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/manish-in-java/jpa-hibernate-jdbc | 223 | FILENAME: PersonCriteriaBenchmark.java | 0.289372 | package org.example.benchmark.hibernate;
import org.example.benchmark.SpringAwareBenchmark;
import org.example.domain.Contract;
import org.example.domain.Person;
import org.hibernate.Session;
import org.openjdk.jmh.annotations.*;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.List;
import java.util.concurrent.TimeUnit;
abstract class PersonCriteriaBenchmark<P extends Person<C, P>, C extends Contract<P, C>>
extends SpringAwareBenchmark
{
@PersistenceContext
private EntityManager entityManager;
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@Fork(0)
@Measurement(iterations = 5, timeUnit = TimeUnit.MICROSECONDS)
@Warmup(iterations = 5)
public void benchmark()
{
List<P> persons = entityManager.getEntityManagerFactory()
.createEntityManager()
.unwrap(Session.class)
.createCriteria(getType()).list();
persons.stream()
.flatMap(p -> p.getContracts().stream())
.map(c -> c.getNumber())
.count();
}
abstract Class<P> getType();
}
|
f302bf00-27d3-43e8-9fa7-cd1ed140f224 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-26 13:11:42", "repo_name": "Pratibha24/HealthCheckApplication", "sub_path": "/src/main/java/service/ScheduledBackgroundExecutor.java", "file_name": "ScheduledBackgroundExecutor.java", "file_ext": "java", "file_size_in_byte": 1039, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "78787b1274da3570e5e160b0cebbf839fff0fc09", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Pratibha24/HealthCheckApplication | 197 | FILENAME: ScheduledBackgroundExecutor.java | 0.29584 | package service;
import java.util.concurrent.ScheduledExecutorService;
import static java.lang.Runtime.getRuntime;
import static java.util.concurrent.Executors.newScheduledThreadPool;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
public class ScheduledBackgroundExecutor implements BackgroundExecutor {
private final long interval;
private static final int WAIT_TIME = 100;
private static final int SERVER_PROCESSING_TIME = 5;
private static final int OPTIMAL_NUMBER_OF_THREADS = getRuntime()
.availableProcessors() * (1 + WAIT_TIME / SERVER_PROCESSING_TIME);
ScheduledExecutorService executorService = newScheduledThreadPool(OPTIMAL_NUMBER_OF_THREADS);
public ScheduledBackgroundExecutor(final long interval) {
this.interval = interval;
}
@Override
public void run(Runnable runnable) {
executorService.scheduleAtFixedRate(runnable, 0, interval, MILLISECONDS);
}
@Override
public void shutdown() {
executorService.shutdown();
}
}
|
40671395-df52-4817-9b89-9a9b044a8338 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-10 13:55:53", "repo_name": "luckybooy/JavaStudy", "sub_path": "/src/main/java/iostudy/review/CopySomething.java", "file_name": "CopySomething.java", "file_ext": "java", "file_size_in_byte": 1207, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "41840d26b4875dbb4f951c45d93d47967dac77a8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/luckybooy/JavaStudy | 271 | FILENAME: CopySomething.java | 0.285372 | package iostudy.review;
import java.io.*;
/**
* @author xiaoran
* @program JavaStudy
* @package iostudy.review
* @description 复制字节文件
* @date 2020-05-06 22:52:18
*/
public class CopySomething {
public static void main(String[] args) {
InputStream in = null;
OutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream("D:\\tools\\ScreenPrinter\\GIF录制工具好用.exe"));
out = new BufferedOutputStream(new FileOutputStream("E:\\exercise\\JavaStudy\\src\\main\\java\\iostudy\\review\\GIF录制工具好用.exe"));
byte[] bytes = new byte[1024];
int critical = 0;
while ((critical = in.read(bytes)) != -1){
out.write(bytes,0,critical);
out.flush();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
|
f9b533bd-31f4-4153-b928-1ce03256b29f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-08-15T17:23:56", "repo_name": "colbylane/AreYouHumanPublic", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1063, "line_count": 18, "lang": "en", "doc_type": "text", "blob_id": "4b47c6e1cb237038e1d9d0eeb2b75c7aad59170d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/colbylane/AreYouHumanPublic | 244 | FILENAME: README.md | 0.264358 | # AreYouHumanPublic
Welcome to the Are You Human public repository! Use the package contents to review the sample component that implements the AreYouHuman component and event into a simple contact form. [Remember to check out our sample site for a live example of the component.](https://ayhpublictest-developer-edition.na53.force.com/Sample/s/ "Are You Human Sample Site")
## TL;DR - I've downloaded it, now what?
To begin using the component, you only need to complete 3 steps:
1. Add the AreYouHuman component into one of your own components.
2. Register the HumanCheck event into one of your own components (either the same or another component).
3. Add an event handler for the HumanCheck event.
That's it! In the source code example, the AreYouHuman component controls enabling the submit button and the event handler is as simple as this:
```javascript
var ayhResult = event.getParam("result");
component.set("v.verified", ayhResult);
```
You can of course add your own logic as you see fit, but you can always copy/paste the example to get going.
|
a03e85af-a445-437c-9de3-0c40911f2cfb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-03-03 10:21:30", "repo_name": "Ondrej-vojtisek/bbmri", "sub_path": "/src/main/java/cz/bbmri/entities/enumeration/RequestState.java", "file_name": "RequestState.java", "file_ext": "java", "file_size_in_byte": 1170, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "7bbe63ab2acbe4fe6d6c068a6cd7ab5b260cb111", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Ondrej-vojtisek/bbmri | 278 | FILENAME: RequestState.java | 0.282988 | package cz.bbmri.entities.enumeration;
/**
* RequestState describes present state of sample request or sample reservation.
*
* NEW - SampleRequest or SampleReservation was created
* APPROVED - biobank administrator approved request/reservation - it means that bioban can fullfill the request
* DENIED - biobank can't fullfill request
* CLOSED - set of samples was attached to request/reservation and this set was finished
* AGREED - check of project worker whether the set of samples fullfill his requirements - set agreed
* - if not agreed then change the state info CLOSED again
* DELIVERED - sample set was delivered to reseacher
* EXPIRED - when reservation is older than expiration date
*
*
* @author Ondrej Vojtisek (ondra.vojtisek@gmail.com)
* @version 1.0
*/
public enum RequestState {
NEW("new"),
APPROVED("approved"),
DENIED("denied"),
CLOSED("closed"),
AGREED("agreed"),
DELIVERED("delivered"),
EXPIRED("expired");
private final String state;
private RequestState(String state) {
this.state = state;
}
@Override
public String toString() {
return this.state;
}
}
|
ae0e9215-4acb-43db-9f12-8f6da3744863 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-13 13:53:42", "repo_name": "IReallyNeedANick/spring-boot-app", "sub_path": "/src/main/java/com/sbapp/dto/hibernate/ReportEntity.java", "file_name": "ReportEntity.java", "file_ext": "java", "file_size_in_byte": 1071, "line_count": 59, "lang": "en", "doc_type": "code", "blob_id": "86047791eab262e6ba490f80f64a4b236511d1c8", "star_events_count": 3, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/IReallyNeedANick/spring-boot-app | 248 | FILENAME: ReportEntity.java | 0.258326 | package com.sbapp.dto.hibernate;
import com.sbapp.dto.enumeration.SourceEnum;
import javax.persistence.*;
import java.util.Date;
@Entity
public class ReportEntity {
@Id
@Column(name = "name", unique = true, nullable = false)
private String name;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "process_time", nullable = false, length = 26)
private Date processTime;
@Enumerated(EnumType.STRING)
@Column(name = "source", nullable = false, length = 10)
private SourceEnum source;
@Column(name = "success", nullable = false)
private boolean success;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getProcessTime() {
return processTime;
}
public void setProcessTime(Date processTime) {
this.processTime = processTime;
}
public SourceEnum getSource() {
return source;
}
public void setSource(SourceEnum source) {
this.source = source;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
}
|
b581c589-dfd9-47ba-a8d5-faa7eec6e2a2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-15 07:15:58", "repo_name": "caozhentian/doc", "sub_path": "/code/firstProject/MyApplication/app/src/main/java/com/example/administrator/firstapplication/tabs/SectionsPagerAdapter.java", "file_name": "SectionsPagerAdapter.java", "file_ext": "java", "file_size_in_byte": 1101, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "9476538e6e527da7ba2c0205bfe67b5b1ae67488", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/caozhentian/doc | 215 | FILENAME: SectionsPagerAdapter.java | 0.289372 | package com.example.administrator.firstapplication.tabs;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import java.util.Collections;
import java.util.List;
/**
* Created by Administrator on 2017/5/9.
*/
public class SectionsPagerAdapter extends FragmentPagerAdapter {
private List<String> mTitles = Collections.emptyList();
public SectionsPagerAdapter(FragmentManager fm , List<String> titles) {
super(fm);
mTitles = titles ;
}
@Override
public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page.
// Return a PlaceholderFragment (defined as a static inner class below).
return PlaceholderFragment.newInstance(position + 1);
}
@Override
public int getCount() {
return mTitles.size();
}
@Override
public CharSequence getPageTitle(int position) {
if(mTitles != null){
return mTitles.get(position) ;
}
return null;
}
}
|
0560c61e-cc35-403f-bdd5-59b6b3b1f081 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-08 14:13:39", "repo_name": "AskipMC/customshovel", "sub_path": "/src/fr/matt/customshovel/Commands.java", "file_name": "Commands.java", "file_ext": "java", "file_size_in_byte": 1112, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "97c2ff29f48197bcd89592f3d0305939cd732140", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AskipMC/customshovel | 250 | FILENAME: Commands.java | 0.286169 | package fr.matt.customshovel;
import java.util.Arrays;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import net.md_5.bungee.api.ChatColor;
public class Commands implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args) {
// Commande : customshovel Pseudo (--> Give 1 custom shovel)
if(args.length!=1) return false;
Player player = Bukkit.getPlayer(args[0]);
if(player==null) return false;
ItemStack shovel = new ItemStack(Material.DIAMOND_SPADE, 1);
ItemMeta shovelM = shovel.getItemMeta();
shovelM.setDisplayName(ChatColor.GREEN + "Custom Shovel");
shovelM.setLore(Arrays.asList(" ",ChatColor.BLUE + "Stock : 0"," "));
shovel.setItemMeta(shovelM);
player.getInventory().addItem(shovel);
return false;
}
}
|
464671e0-a3a2-4325-8ba9-1711a79953e2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-07 09:33:13", "repo_name": "newslytherin/SysProject", "sub_path": "/SysProjectBackend/src/main/java/facade/UserDataFacade.java", "file_name": "UserDataFacade.java", "file_ext": "java", "file_size_in_byte": 1085, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "4b80be8d8eb245c82dcd1a2af72c3a7f8d519158", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/newslytherin/SysProject | 202 | FILENAME: UserDataFacade.java | 0.276691 | package facade;
import entity.UserData;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class UserDataFacade {
private static EntityManagerFactory emf = Persistence.createEntityManagerFactory("pu");
public UserDataFacade() {
}
public void setEntityManagerFactory(EntityManagerFactory emf) {
this.emf = emf;
}
public List<UserData> getAllUserData() {
EntityManager em = emf.createEntityManager();
String jpql = "SELECT ud FROM UserData ud";
try {
return em.createQuery(jpql, UserData.class).getResultList();
} finally {
em.close();
}
}
public UserData saveUserData(UserData ud) {
EntityManager em = emf.createEntityManager();
UserData tmp = ud;
try {
em.getTransaction().begin();
em.persist(ud);
em.getTransaction().commit();
} finally {
em.close();
}
return tmp;
}
}
|
4a23d96c-19b7-49b0-aa97-11ed51a65dc3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-30 09:06:23", "repo_name": "syarahmnayef95/Multiple-Image-Picker", "sub_path": "/multipleImagePickerLib/src/main/java/com/rahul/media/utils/MediaSingleTon.java", "file_name": "MediaSingleTon.java", "file_ext": "java", "file_size_in_byte": 1022, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "52d07dbc83137b092d14fbbf46a19e393e346cc8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/syarahmnayef95/Multiple-Image-Picker | 219 | FILENAME: MediaSingleTon.java | 0.26588 | package com.rahul.media.utils;
import android.graphics.Bitmap;
import java.util.HashMap;
/**
* Created by rahul on 20/8/15.
*/
public class MediaSingleTon {
private static MediaSingleTon mediaSingleTon;
HashMap<String, Bitmap> bitmapHashMap = new HashMap<>();
private MediaSingleTon() {
}
public static MediaSingleTon getInstance() {
if (mediaSingleTon == null)
return mediaSingleTon = new MediaSingleTon();
return mediaSingleTon;
}
public HashMap<String, Bitmap> getBitmapHashMap() {
return bitmapHashMap;
}
public void setBitmapHashMap(HashMap<String, Bitmap> bitmapHashMap) {
this.bitmapHashMap = bitmapHashMap;
}
public void putImage(String key, Bitmap value) {
bitmapHashMap.put(key, value);
}
public Bitmap getImage(String key) {
Bitmap bitmap = bitmapHashMap.get(key);
if (bitmap != null && bitmap.isRecycled()) {
return null;
}
return bitmap;
}
}
|
1ad69176-5208-42bf-ba45-0263e4a3fce5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-04-12T10:08:01", "repo_name": "gajduk/last-act-of-defiance", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1035, "line_count": 32, "lang": "en", "doc_type": "text", "blob_id": "905283db2fd3974c7cb210f233cd2eee41c89b5c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gajduk/last-act-of-defiance | 238 | FILENAME: README.md | 0.256832 | Last Act of Defiance
========================
An MFC based side-scrolling shooter with custom code-generated graphics and animations.
Made almost entirely from scratch without using any external libraries.
---------------------
Features 2 different basic weapons, a super weapon and 3 types of special power ups: a deflector shield, a time warp and a repair kit.
The game has 4 difficulty settings, an auto-fire option and an endless swarm of enemies for you to destroy.
-----
Made for fun during a summer break when I was in my 2nd year of Computer Science studies at the Faculty in Skopje.
Are you ready for your Last Act of DefianceEEEE?
------
Screenshots




|
e4e51c84-3707-44bb-9d94-9f6ec4117cc8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-05 10:35:24", "repo_name": "oskpom002/UtpMStorage", "sub_path": "/UtpMStorage/UtpMStorage-ejb/src/java/service/SprzedazFacade.java", "file_name": "SprzedazFacade.java", "file_ext": "java", "file_size_in_byte": 1024, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "7da2c76fb37e86b01085e0a50dfe5c4622eef4de", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/oskpom002/UtpMStorage | 215 | FILENAME: SprzedazFacade.java | 0.292595 | /*
* 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 service;
import entity.Sprzedaz;
import java.util.Date;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author Olek
*/
@Stateless
public class SprzedazFacade extends AbstractFacade<Sprzedaz> {
@PersistenceContext(unitName = "UtpMStorage-ejbPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public SprzedazFacade() {
super(Sprzedaz.class);
}
public List<Sprzedaz> findSprzedazByData(Date data) {
return em.createQuery("SELECT s FROM Sprzedaz s WHERE s.dataSprzedazy = :data AND s.serwis=null")
.setParameter("data", data)
.getResultList();
}
}
|
bcb5b459-12cd-4c94-abe5-158bfeb3d6c5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2013-01-27T07:42:03", "repo_name": "macton/arm_nacl_toolchain_pepper_25", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1171, "line_count": 38, "lang": "en", "doc_type": "text", "blob_id": "bb7c843578b0fc3433b0d8d917f27e2e654d1610", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/macton/arm_nacl_toolchain_pepper_25 | 285 | FILENAME: README.md | 0.262842 | arm_nacl_toolchain_pepper_25
============================
Pre-built Native Client (NaCl) linux_arm_newlib and linux_x86_newlib gcc toolchains and libs for ARM host.
STEPS TO INSTALL
----------------
NACL_SDK is wherever you installed nacl_sdk. See: https://developers.google.com/native-client/sdk/download
ARM_TOOLCHAIN is the directory this file is in.
Go to the toolchain location
$ cd $(NACL_SDK)/pepper_25/
The pre-installed toolchain is for x86 hosts only
$ mv toolchain toolchain.x64
Decompress the arm toolchains
$ tar xzvf $(ARM_TOOLCHAIN)/toolchain.tgz
Done. You can now build NaCl projects normally on your arm host.
NOTES ON BUILDING TOOLCHAIN
---------------------------
For notes on building toolchain from source on an ARM host, see thread: https://groups.google.com/d/topic/native-client-discuss/oTSZsUv8woM/discussion
NOTES ON DEVELOPMENT ENVIRONMENT
--------------------------------
I am running ChromeOS on a Samsung ARM Chromebook in developer mode with an ArchLinux userspace (chroot) installed on an external sdcard.
For notes on that process see: https://gist.github.com/4632677
@mike_acton
|
fbe559bd-0f92-4df4-84ba-1abf4fef79f3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-24 09:19:08", "repo_name": "monirIDB/Hotel-Management-System", "sub_path": "/MrsHotelLtd/src/java/util/HibernateUtil.java", "file_name": "HibernateUtil.java", "file_ext": "java", "file_size_in_byte": 1036, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "fff123720a100782ffdee6658ce84279f92f6bcd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/monirIDB/Hotel-Management-System | 191 | FILENAME: HibernateUtil.java | 0.272799 | /*
* 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 util;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.SessionFactory;
/**
* Hibernate Utility class with a convenient method to get Session Factory
* object.
*
* @author MIZAN
*/
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
// Create the SessionFactory from standard (hibernate.cfg.xml)
// config file.
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Log the exception.
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
}
|
4a68e62a-e215-4409-b5e8-86cda5d6453b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-10 02:02:10", "repo_name": "github19950430/wuxiao", "sub_path": "/wuxiao/modules/modelstudio/src/main/java/com/pldk/modules/modelstudio/service/impl/MasterMemberServiceImpl.java", "file_name": "MasterMemberServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1045, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "8410682b789d407d8a91119a85e39da66adb4aea", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/github19950430/wuxiao | 217 | FILENAME: MasterMemberServiceImpl.java | 0.293404 | package com.pldk.modules.modelstudio.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pldk.modules.modelstudio.domain.MasterMember;
import com.pldk.modules.modelstudio.repository.MasterMemberRepository;
import com.pldk.modules.modelstudio.service.MasterMemberService;
/**
* @author suhp
* @date 2019/07/16
*/
@Service
public class MasterMemberServiceImpl implements MasterMemberService{
@Autowired
private MasterMemberRepository masterMemberRepository;
@Override
public MasterMember getById(Long id) {
return masterMemberRepository.findById(id).orElse(null);
}
@Override
public MasterMember save(MasterMember masterMember) {
return masterMemberRepository.save(masterMember);
}
@Override
public List<MasterMember> getMasterMemberByStudio(Long id) {
return masterMemberRepository.findAllByMasterMemberId(id);
}
@Override
public void delMember(Long id) {
masterMemberRepository.deleteById(id);
}
}
|
933cec12-f8d8-494b-bb0d-61f5be6fdc25 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-10-24 12:17:20", "repo_name": "pram/CalypsoDevelopment", "sub_path": "/SuperEngine/src/main/java/calypsox/xstream/convertor/events/GenericEventProcessor.java", "file_name": "GenericEventProcessor.java", "file_ext": "java", "file_size_in_byte": 1100, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "0ae21685f4bf00bdcc38a846b175a06f5fd9955f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/pram/CalypsoDevelopment | 257 | FILENAME: GenericEventProcessor.java | 0.271252 | package calypsox.xstream.convertor.events;
import com.calypso.tk.event.PSEvent;
import com.calypso.tk.event.PSEventDomainChange;
import com.calypso.tk.service.LocalCache;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
/**
* Created with IntelliJ IDEA.
* User: xe32104
* Date: 9/05/13
* Time: 17:10
*/
public class GenericEventProcessor implements CalypsoEventProcessor {
@Override
public void createWriter(PSEvent ps, HierarchicalStreamWriter writer) {
outputDefault(ps,writer);
}
protected void outputDefault(PSEvent ps, HierarchicalStreamWriter writer) {
safeWrite("className", ps.getClassName(), writer);
safeWrite("eventType", ps.getEventType(), writer);
safeWrite("dataserverName", ps.getDataServerName(), writer);
safeWrite("engineName", ps.getEngineName(), writer);
}
protected void safeWrite(String node, Object o, HierarchicalStreamWriter writer) {
writer.startNode(node);
String output = o != null ? o.toString() : "";
writer.setValue(output);
writer.endNode();
}
}
|
cc0c0f69-3080-4d86-9f0c-9a44f0b94166 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-02-26 03:50:51", "repo_name": "synchrolog/synchrolog-java-servlet", "sub_path": "/src/main/java/com/synchrolog/client/SynchrologHttpClientSingleton.java", "file_name": "SynchrologHttpClientSingleton.java", "file_ext": "java", "file_size_in_byte": 1076, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "12478cf72f5fdfa2c7d2d53e60b39b1db8a92df5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/synchrolog/synchrolog-java-servlet | 234 | FILENAME: SynchrologHttpClientSingleton.java | 0.271252 | package com.synchrolog.client;
public class SynchrologHttpClientSingleton {
private static final String DEFAULT_PROD_HOST = "https://input.synchrolog.com";
private static final Object lock = new Object();
private static SynchrologHttpClient instance;
public static SynchrologHttpClient getInstance() {
if (instance != null) {
return instance;
}
synchronized (lock) {
instance = createSynchrologHttpClient();
}
return instance;
}
private static SynchrologHttpClient createSynchrologHttpClient() {
String apiKey = System.getProperty("synchrolog.apiKey");
if(apiKey == null || apiKey.trim().length() == 0) {
throw new RuntimeException("Missing Synchrolog API key. Please add system property 'synchrolog.apiKey'.");
}
String host = System.getProperty("synchrolog.host");
if(host == null || host.trim().length() == 0) {
host = DEFAULT_PROD_HOST;
}
return new SynchrologHttpClient(apiKey, host);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.