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 |
|---|---|---|---|---|---|---|
eca4ea86-8426-4d43-903b-e3906f15e173 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-12-04T21:11:41", "repo_name": "sandervandevelde/Wise.4012E.Modbus", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1222, "line_count": 28, "lang": "en", "doc_type": "text", "blob_id": "72c917d10ae59ffa2a97404df32562902c530ca3", "star_events_count": 2, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/sandervandevelde/Wise.4012E.Modbus | 411 | FILENAME: README.md | 0.250913 | # Introduction
This is a C# library for accessing the [Advantech Wise 4012E](http://www.advantech.com/products/4260f153-57cd-4102-81ea-7a0f36d9b216/wise-4012e/mod_4e936d58-a559-4c1a-9022-e96698c2930b?_ga=1.82474646.1033186900.1491183171)
This library gives access to eg. the two Knobs (read), the two Switches (read) and the two Relays (write).
I reference the Modbus Nuget package called [NModbus](https://github.com/NModbus/NModbus).
# Getting Started
1. Fork or download this project and recompile the solution
2. Just reference the Wise.4012E.Modbus project in your own solution
3. See the Demo app for examples on how to read Knobs and Switches
4. See the Demo app for examples on how to change the Relays
# Build and Test
Compile the solution, Run the test app
# Modbus
More documentation about Modbus on the Wise 4012E can be found [here](http://support.advantech.com/Support/DownloadSRDetail_New.aspx?SR_ID=1-W5ALRV&Doc_Source=Download). Just download the PDF from primary or secondary site.
Current features which are supported:
1. two Knobs (read)
2. average of two knobs (if activated on Wise)
3. two Switches (read)
4. two Relays (write)
# Contribute
Want to contribute? Throw me a pull request....
|
30e73120-65a8-4834-a216-13db75c1d9db | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-21 03:52:58", "repo_name": "wlBoy/center", "sub_path": "/scjs170602/src/com/seecen/exam/day0808/Pet.java", "file_name": "Pet.java", "file_ext": "java", "file_size_in_byte": 1090, "line_count": 66, "lang": "en", "doc_type": "code", "blob_id": "c3a5d78ae89d83b1e92431eda4519a1e2d14d914", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "GB18030"} | https://github.com/wlBoy/center | 346 | FILENAME: Pet.java | 0.282196 | package com.seecen.exam.day0808;
/**
* 宠物实体类
*
* @scjs170602
* @author 【万磊】
* @2017年8月8日
*/
public abstract class Pet {
private String name;// 名字
private int healthy = 60;// 健康值
private int lover = 20;// 亲密值
public Pet() {
super();
}
public Pet(String name, int healthy, int lover) {
super();
this.name = name;
this.healthy = healthy;
this.lover = lover;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getHealthy() {
return healthy;
}
public void setHealthy(int healthy) {
if (healthy >= 0 && healthy <= 100) {
this.healthy = healthy;
} else {
System.out.println("健康值应该在0-100之间,默认值是60");
}
}
public int getLover() {
return lover;
}
public void setLover(int lover) {
this.lover = lover;
}
/**
* 自白的抽象方法,让子类去具体实现
*/
public abstract void show();
/**
* 去医院的抽象方法,让子类去具体实现
*/
public abstract void toHospital();
/**
* 吃饭的抽象方法,让子类去具体实现
*/
public abstract void eat();
}
|
5d51185c-9e1b-4ca6-b94a-8753ddaf9771 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-04-10 12:55:34", "repo_name": "lockc/java-osgi", "sub_path": "/ddf-osgi-exploration/ddf/ddf-eventing/src/main/java/lockc/osgi/ddf/eventing/impl/SampleDeliveryMethod.java", "file_name": "SampleDeliveryMethod.java", "file_ext": "java", "file_size_in_byte": 1042, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "527ffa5f40ce9742e90fa68e32303e5ac3f742da", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lockc/java-osgi | 264 | FILENAME: SampleDeliveryMethod.java | 0.279042 | package lockc.osgi.ddf.eventing.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ddf.catalog.data.Metacard;
import ddf.catalog.event.DeliveryMethod;
public class SampleDeliveryMethod implements DeliveryMethod {
private static final Logger LOG = LoggerFactory.getLogger(SampleDeliveryMethod.class);
@Override
public void created(Metacard newMetacard) {
LOG.info(">>>>> created metacard with title of : " + newMetacard.getTitle());
}
@Override
public void deleted(Metacard oldMetacard) {
LOG.info(">>>>> deleted metacard with title of : " + oldMetacard.getTitle());
}
@Override
public void updatedHit(Metacard newMetacard, Metacard oldMetacard) {
LOG.info(">>>>> updatedHit. metacard title : " + oldMetacard.getTitle());
}
@Override
public void updatedMiss(Metacard newMetacard, Metacard oldMetacard) {
LOG.info(">>>>> updatedMiss. metacard title : " + oldMetacard.getTitle());
}
}
|
0ebaf769-f47d-46a2-ac95-0541523a2d08 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-12-13T05:47:46", "repo_name": "Jamesits/myip", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1112, "line_count": 61, "lang": "en", "doc_type": "text", "blob_id": "e3d01f5b88402aa7e456a398e56fa22bf8d21191", "star_events_count": 13, "fork_events_count": 5, "src_encoding": "UTF-8"} | https://github.com/Jamesits/myip | 356 | FILENAME: README.md | 0.26588 | # myip
Get your external IP address from command line.
[](https://dev.azure.com/nekomimiswitch/General/_build/latest?definitionId=72&branchName=master)
## Usage
### Basic Usage
```shell
$ myip
2001:db8::2
$ myip -4
192.0.2.2
$ myip -6
2001:db8::2
```
### STUN
* This is the default method
* `stun.l.google.com:19302` is the default server
* Connection over UDP only
```shell
myip --method STUN --server stun.l.google.com:19302
```
### ip.sb HTTPS API
```shell
myip --method ip.sb
```
### OpenDNS DNS Query
```shell
myip --method OpenDNS
```
### OpenDNS HTTPS API
* `-4`/`-6` doesn't work
```shell
myip --method OpenDNS-API
```
## Building
Use go 1.11 or higher. Run `build.sh` to build and collect your artifact in `build` directory.
## Donation
If this project is helpful to you, please consider buying me a coffee.
[](https://www.buymeacoffee.com/Jamesits) or [PayPal](https://paypal.me/Jamesits)
|
2756b593-fc92-43bf-91b5-6a133d63c1fd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-20 08:10:19", "repo_name": "gaofeifan/linkemore", "sub_path": "/order-service/order-server/src/main/java/cn/linkmore/order/controller/app/request/ReqSwitch.java", "file_name": "ReqSwitch.java", "file_ext": "java", "file_size_in_byte": 1256, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "25af6aaff84ebf58aa731c41aadc447a887393a4", "star_events_count": 1, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/gaofeifan/linkemore | 287 | FILENAME: ReqSwitch.java | 0.259826 | package cn.linkmore.order.controller.app.request;
import javax.validation.constraints.Min;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotBlank;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 车位切换封装
* @author liwenlong
* @version 2.0
*
*/
@ApiModel("车位切换请求")
public class ReqSwitch {
@ApiModelProperty(value = "订单ID", required = true)
@Min(value=0,message="订单ID为大于0的长整数")
@NotBlank(message="订单ID不能为空")
private Long orderId;
@ApiModelProperty(value = "原因ID", required = true)
@Min(value=0,message="原因ID为大于0的长整数")
@NotBlank(message="原因ID不能为空")
private Long causeId;
@ApiModelProperty(value = "其它原因", required = true)
private String remark;
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public Long getCauseId() {
return causeId;
}
public void setCauseId(Long causeId) {
this.causeId = causeId;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
|
b3e6dad3-6db4-4421-aa8d-08084b9da036 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-19 03:49:13", "repo_name": "lewiszlw/sso", "sub_path": "/sso-server/src/main/java/lewiszlw/sso/server/service/OAuthAppService.java", "file_name": "OAuthAppService.java", "file_ext": "java", "file_size_in_byte": 1187, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "4977ee5e11bdb3229f11ec7aa0d54d7dc63f1350", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lewiszlw/sso | 273 | FILENAME: OAuthAppService.java | 0.26971 | package lewiszlw.sso.server.service;
import lewiszlw.sso.server.convertor.OAuthAppConverter;
import lewiszlw.sso.server.entity.OAuthAppEntity;
import lewiszlw.sso.server.mapper.OAuthAppMapper;
import lewiszlw.sso.server.model.req.RegisterAppReq;
import lewiszlw.sso.server.model.resp.RegisterAppResp;
import lewiszlw.sso.server.util.TokenUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Desc:
*
* @author zhanglinwei02
* @date 2019-05-31
*/
@Service
public class OAuthAppService {
@Autowired
private OAuthAppMapper oauthAppMapper;
public RegisterAppResp registerApp(RegisterAppReq req) {
String clientId = TokenUtils.createClientId();
String clientSecret = TokenUtils.createClientSecret();
OAuthAppEntity oauthAppEntity = OAuthAppConverter.convertToOauthAppEntity(req, clientId, clientSecret);
oauthAppMapper.insertOne(oauthAppEntity);
return new RegisterAppResp().setClientId(clientId).setClientSecret(clientSecret);
}
public OAuthAppEntity queryByClientId(String clientId) {
return oauthAppMapper.selectByClientId(clientId);
}
}
|
c83ded6b-466d-414c-85b5-77a1c7b49007 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-25 00:55:59", "repo_name": "marktani/HelloKitty", "sub_path": "/app/src/main/java/com/example/hellokitty/model/CatApi.java", "file_name": "CatApi.java", "file_ext": "java", "file_size_in_byte": 986, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "927171d734b689e20c61cce8398330fac291c7e3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/marktani/HelloKitty | 184 | FILENAME: CatApi.java | 0.228156 | package com.example.hellokitty.model;
import com.example.hellokitty.CatApiService;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.simplexml.SimpleXmlConverterFactory;
public class CatApi {
private CatApiService apiService;
public CatApi() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("http://thecatapi.com/api/images/")
.addConverterFactory(SimpleXmlConverterFactory.create())
.client(client)
.build();
apiService = retrofit.create(CatApiService.class);
}
public Call<Image> getRandomImage() {
return apiService.getRandomImage();
}
}
|
1907c60c-b24c-4130-a6c4-8871dff63d87 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-27 01:28:31", "repo_name": "apsiqueira/MediaEscola", "sub_path": "/ToggleButon/app/src/main/java/primeiroapp/power/com/togglebuton/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1044, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "fb1614b85a1271d888e54fff67ef81de32a4d66a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/apsiqueira/MediaEscola | 174 | FILENAME: MainActivity.java | 0.214691 | package primeiroapp.power.com.togglebuton;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.CompoundButton;
import android.widget.TextView;
import android.widget.ToggleButton;
public class MainActivity extends AppCompatActivity {
private ToggleButton btn;
private TextView saida;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn = (ToggleButton) findViewById(R.id.toggleButtonid);
saida=(TextView)findViewById(R.id.textsaida);
btn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
saida.setText("Ligado");
}
else{
saida.setText("desligado");
}
}
});
}
}
|
1b09118e-6209-4cf4-9a00-e22a1da075da | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-08 08:15:34", "repo_name": "yxzyh/spring-cloud-fis", "sub_path": "/fis-gateway/src/main/java/com/fis/cloud/gateway/utils/HttpServletRequestUtils.java", "file_name": "HttpServletRequestUtils.java", "file_ext": "java", "file_size_in_byte": 1230, "line_count": 63, "lang": "en", "doc_type": "code", "blob_id": "b21f47d8d2260737128c02d55901946402758c25", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yxzyh/spring-cloud-fis | 278 | FILENAME: HttpServletRequestUtils.java | 0.267408 | package com.fis.cloud.gateway.utils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.io.IOUtils;
import org.springframework.stereotype.Component;
/**
* httpServletRequest 解析工具
*
* @author zhen.Gao
* @version [产品/模块]
* @see [相关类/方法]
* @since [JDK 1.8]
*
* [Jul 11, 2019]
*/
@Component
public class HttpServletRequestUtils {
/**
* 获取请求路径url
* @param request
* @return
*/
public String getRequestUri(HttpServletRequest request){
String url = request.getRequestURI();
return url;
}
/**
* 获取request方式 post get
* @param request
* @return
*/
public String getRequestMethod(HttpServletRequest request){
return request.getMethod();
}
/**
* 获取requestBody
* @param request
* @return
*/
public String getRequestBody(HttpServletRequest request){
BufferedReader bufferedReader;
String body=null;
try {
bufferedReader = new BufferedReader(new InputStreamReader(request.getInputStream()));
body = IOUtils.toString(bufferedReader);
} catch (IOException e) {
e.printStackTrace();
}
return body;
}
}
|
556933fb-ae4a-47c0-84fe-7e8c9dfc6178 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-15 03:42:58", "repo_name": "szjdbf/mybatis-plus-demo", "sub_path": "/src/main/java/com/zlf/mybatisplusdemo/controller/StudentController.java", "file_name": "StudentController.java", "file_ext": "java", "file_size_in_byte": 1050, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "8782cccd58568a7c6f383f14034de15a054ecd85", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/szjdbf/mybatis-plus-demo | 199 | FILENAME: StudentController.java | 0.208179 | package com.zlf.mybatisplusdemo.controller;
import com.zlf.mybatisplusdemo.StudentService;
import com.zlf.mybatisplusdemo.domain.Student;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/student")
@Api(tags = "学生API")
public class StudentController {
@Autowired
private StudentService studentService;
@GetMapping("/findList")
@ApiOperation(value = "查询学生列表")
public List<Student> findList(int pageNum, int pageSize) {
return studentService.findList(pageNum, pageSize);
}
@GetMapping("/detail")
@ApiOperation(value = "查询学生详情")
public Student detail(long id) {
return studentService.detail(id);
}
@PostMapping("/add")
@ApiOperation(value = "新增学生")
public void add(@RequestBody Student student) {
studentService.add(student);
}
}
|
dd6b7c40-0fb7-412a-8f88-1d1104f47b1b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-25 09:57:38", "repo_name": "roy-as/big-data-workspace", "sub_path": "/flink/src/main/java/com/as/source/OrderSourceDemo.java", "file_name": "OrderSourceDemo.java", "file_ext": "java", "file_size_in_byte": 1180, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "83bb0c49f17822b7c262af04ed303c273afbc5d2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/roy-as/big-data-workspace | 220 | FILENAME: OrderSourceDemo.java | 0.290176 | package com.as.source;
import org.apache.flink.api.common.RuntimeExecutionMode;
import org.apache.flink.api.common.functions.RichMapFunction;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
public class OrderSourceDemo {
public static void main(String[] args) throws Exception {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setRuntimeMode(RuntimeExecutionMode.STREAMING);
DataStream<Order> ds = env.addSource(new OrderGenerator());
SingleOutputStreamOperator<Tuple2<Integer, Order>> result = ds.map(new RichMapFunction<Order, Tuple2<Integer, Order>>() {
@Override
public Tuple2<Integer, Order> map(Order order) throws Exception {
int index = getRuntimeContext().getIndexOfThisSubtask();
return Tuple2.of(index, order);
}
}).setParallelism(2);
result.print();
env.execute();
}
}
|
f7ab44d8-b02a-47c5-9b0f-d7552e2d3e39 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-24 12:37:38", "repo_name": "stankevichevg/package-challenge", "sub_path": "/src/main/java/com/mobiquityinc/packer/io/PackageWriter.java", "file_name": "PackageWriter.java", "file_ext": "java", "file_size_in_byte": 1187, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "cf1c24c7d11fcaf78af2b5f9c7355fd37a469cde", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/stankevichevg/package-challenge | 250 | FILENAME: PackageWriter.java | 0.287768 | package com.mobiquityinc.packer.io;
import com.mobiquityinc.packer.domain.Package;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.function.Function;
/**
* Writes built package to the given output stream using the provided {@link #formatter}.
*/
public class PackageWriter implements AutoCloseable {
private PrintWriter writer;
private Function<Package, String> formatter;
public PackageWriter(OutputStream out, Function<Package, String> formatter) {
this.writer = new PrintWriter(out);
}
public PackageWriter(OutputStream out) {
this(out, PackageWriter::defaultFormatter);
}
/**
* Writes pack to the underlying output.
*
* @param pack pack to write
*/
public void write(Package pack) {
writer.println(defaultFormatter(pack));
}
@Override
public void close() throws Exception {
writer.close();
}
private static String defaultFormatter(Package pack) {
return pack == null || pack.getThings().size() == 0 ? "-" :
pack.getThings().stream().map(t -> String.valueOf(t.getIndex())).reduce((p, c) -> p + "," + c).orElse("");
}
}
|
604c724d-d08e-42a3-9943-c3e1b17d4ec2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-10 19:13:31", "repo_name": "DevTeamAcademy/bookbook-api", "sub_path": "/src/main/java/com/bookbook/user/api/validation/CreateUserValidator.java", "file_name": "CreateUserValidator.java", "file_ext": "java", "file_size_in_byte": 1155, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "d48f8d10b710a7df0eedf74c3989fe6e9444bf58", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DevTeamAcademy/bookbook-api | 227 | FILENAME: CreateUserValidator.java | 0.293404 | package com.bookbook.user.api.validation;
import com.bookbook.user.domain.NewUser;
import com.bookbook.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
@Component
public class CreateUserValidator implements Validator {
@Autowired
private UserService userService;
@Override
public boolean supports(Class<?> aClass) {
return NewUser.class.equals(aClass);
}
@Override
public void validate(Object object, Errors errors) {
NewUser newUser = (NewUser) object;
if (userService.existsByEmail(newUser.getMail())) {
errors.rejectValue("email", "validation.newUser.email.nonUnique", new String[]{newUser.getMail()},
"User with email " + newUser.getMail() + " already exists.");
}
if (userService.existsByLogin(newUser.getLogin())) {
errors.rejectValue("login", "validation.newUser.loginId.nonUnique", new String[]{newUser.getLogin()},
"User with login " + newUser.getLogin() + " already exists.");
}
}
}
|
03235283-4356-44f9-bfd7-59ae2d7a5c2b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-10 11:45:16", "repo_name": "zhouhc-github/community", "sub_path": "/src/main/java/zhc/life/com/community/controller/HelloWorldController.java", "file_name": "HelloWorldController.java", "file_ext": "java", "file_size_in_byte": 1028, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "6c86f087af4a3fd547676e6b759921be3344e190", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zhouhc-github/community | 193 | FILENAME: HelloWorldController.java | 0.221351 | package zhc.life.com.community.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import zhc.life.com.community.service.StudentSerivce;
import zhc.life.com.community.vo.Student;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import static com.sun.xml.internal.ws.spi.db.BindingContextFactory.LOGGER;
@RestController
public class HelloWorldController {
@Autowired
private StudentSerivce studentSerivce;
@GetMapping("/hello")
//@RequestMapping("/hello")
public String HelloWorld(){
Map<String,String> map = new HashMap<>();
LOGGER.info("测试");
Student student = new Student();
studentSerivce.insert(student);
List<Student> result = studentSerivce.selectAll();
LOGGER.info("返回结果" + result);
return "Hello World!";
}
}
|
41eb45ff-531a-468f-9d81-529312bf8480 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-17 10:32:07", "repo_name": "xeon2007/accompany-server", "sub_path": "/src/main/java/me/quhu/haohushi/accompany/service/common/impl/SysStatisticsServiceImpl.java", "file_name": "SysStatisticsServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1178, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "47f3b837a65f4490226b81cf4a0e5ce03dbc46cd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xeon2007/accompany-server | 276 | FILENAME: SysStatisticsServiceImpl.java | 0.279828 | package me.quhu.haohushi.accompany.service.common.impl;
import me.quhu.haohushi.accompany.dao.mapper.common.SysStatisticsMapper;
import me.quhu.haohushi.accompany.service.common.SysStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by Ralph.Woo on 2016/02/29
*/
@Service
public class SysStatisticsServiceImpl implements SysStatisticsService {
@Autowired
private SysStatisticsMapper sysStatisticsMapper;
/**
* 增加浏览次数
* @param channelId 渠道标志
* @return
*/
@Override
public int addViewCount(String channelId) {
return sysStatisticsMapper.addViewCount(channelId);
}
/**
* 增加下载次数
* @param channelId 渠道标志
* @return
*/
@Override
public int addDlCount(String channelId) {
return sysStatisticsMapper.addDlCount(channelId);
}
/**
* 增加浏览和下载次数
* @param channelId 渠道标志
* @return
*/
public int addViewAndDlCount(String channelId){
return sysStatisticsMapper.addViewAndDlCount(channelId);
}
}
|
73634de7-06fe-4f6f-b107-08607fbb07c8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-07-15 19:43:53", "repo_name": "Arrrmy21/psanalyzer", "sub_path": "/src/main/java/com/onyshchenko/psanalyzer/security/JwtUserDetailService.java", "file_name": "JwtUserDetailService.java", "file_ext": "java", "file_size_in_byte": 1222, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "2c00143b1d2a9970cc1117aa9ba6383ef8c3e4df", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Arrrmy21/psanalyzer | 218 | FILENAME: JwtUserDetailService.java | 0.261331 | package com.onyshchenko.psanalyzer.security;
import com.onyshchenko.psanalyzer.security.jwt.JwtUserFactory;
import com.onyshchenko.psanalyzer.services.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
@Service
public class JwtUserDetailService implements UserDetailsService {
private static final Logger LOGGER = LoggerFactory.getLogger(JwtUserDetailService.class);
@Autowired
private UserService userService;
@Override
public UserDetails loadUserByUsername(String username) {
var user = userService.findByUsername(username);
if (user == null) {
throw new UsernameNotFoundException("User with username [" + username + "] not found.");
}
var jwtUser = JwtUserFactory.create(user);
LOGGER.info("User with username [{}] successfully loaded", user.getUsername());
return jwtUser;
}
}
|
47660338-c7d3-400e-aa27-519f2a580a74 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-15 10:49:20", "repo_name": "QuocTuan1998/MSC", "sub_path": "/app/src/main/java/com/example/quoctuan/msc/Adapter/Play/PlayViewpagerAdapter.java", "file_name": "PlayViewpagerAdapter.java", "file_ext": "java", "file_size_in_byte": 996, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "4ea3e0192bdc262ddc5eaaa5be4f4907e616abf4", "star_events_count": 1, "fork_events_count": 7, "src_encoding": "UTF-8"} | https://github.com/QuocTuan1998/MSC | 199 | FILENAME: PlayViewpagerAdapter.java | 0.226784 | package com.example.quoctuan.msc.Adapter.Play;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.example.quoctuan.msc.view.PlayMusic.fragment.ListMusicFragment;
import com.example.quoctuan.msc.view.PlayMusic.fragment.LyricFragment;
import com.example.quoctuan.msc.view.PlayMusic.fragment.PlayFragment;
import java.util.ArrayList;
import java.util.List;
public class PlayViewpagerAdapter extends FragmentPagerAdapter {
List<Fragment> listFragment = new ArrayList<>();
public PlayViewpagerAdapter(FragmentManager fm) {
super(fm);
listFragment.add(new ListMusicFragment());
listFragment.add(new PlayFragment());
listFragment.add(new LyricFragment());
}
@Override
public Fragment getItem(int position) {
return listFragment.get(position);
}
@Override
public int getCount() {
return listFragment.size();
}
}
|
8ac71b7f-9ecf-4b04-b6d3-70f64229d477 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-08-28T15:19:35", "repo_name": "Ipolito42/BorrelBot", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1073, "line_count": 27, "lang": "en", "doc_type": "text", "blob_id": "9d63c59f5e34a82780d7967c93ae9b7d06472f4f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Ipolito42/BorrelBot | 256 | FILENAME: README.md | 0.287768 | # BorrelBot
BorrelBot is a mobile robotic arm to fetch beers. This project is part of the Robotics course in LIACS, Leiden University.
## Requirements
1) The Maestro library for servo control via python scripts.
https://github.com/FRC4564/Maestro
2) The OpenCV library for image recognition.
https://opencv.org/
3) The pybullet library for the Inverse Kinematics calculations.
https://pybullet.org/
plus the standard python package libraries.
## File Index
* **maestro.py** : The necessary functions to work with servos
* **camera_code.py** : Script for image recognition i.e. to identiy bottle caps
* **set_destination.py** : Script to calculate servo steps based on inverse kinematics
* **inverse_kinematics.py** : Script to build a pybullet simulation and perform inverse kinematics for the BorrelBot
* **tryout.py** : Script for testing
* **servo_positions.txt** : Contains info for the servo characteristics
* **visuals folder** : Contains the required .stl and .dae files for the ppybullet simulation
* **demo folder** : Contains a first demo of the BorrelBot
|
f0916487-60a4-4051-a449-e04ea2396634 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-06-23 01:40:39", "repo_name": "aloisiop1/futebol", "sub_path": "/src/br/com/etecmam/cartolafc/apresentacao/PrincipalUI.java", "file_name": "PrincipalUI.java", "file_ext": "java", "file_size_in_byte": 1084, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "4807c1a45f67f20e50271055b7ea3c81165bd8d8", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/aloisiop1/futebol | 261 | FILENAME: PrincipalUI.java | 0.23793 | package br.com.etecmam.cartolafc.apresentacao;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Toolkit;
public class PrincipalUI extends JFrame {
private JPanel contentPane;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
PrincipalUI frame = new PrincipalUI();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public PrincipalUI() {
setTitle("CARTOLA ETEC FC");
setIconImage(Toolkit.getDefaultToolkit().getImage(PrincipalUI.class.getResource("/br/com/etecmam/cartolafc/images/World Cup-48.png")));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
}
}
|
3995dfb0-e17b-4a2d-84a4-454a65a836de | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-06-03T22:37:02", "repo_name": "ausesims/PSO2Wiki", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1222, "line_count": 18, "lang": "en", "doc_type": "text", "blob_id": "c3ab94c242dadd4b77e19fea3e525a8aca7819f7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ausesims/PSO2Wiki | 249 | FILENAME: README.md | 0.205615 | # PSO2Wiki
PSO2 Wiki for the US is a project for the production of a wiki site for the Phantasy Star Online 2 game
More information will be released as the project unfolds. Please be advised of the following....
# Website
The website will be constructed using ASP.NET, or Wikipedia Wiki software. This is currently being evualated and depends on the information received back from SEGA.
# Sega Information - Pending
Information is pending from Sega. A formal request has been sent to see if information, and materials are avaiable to publish the site with.
# Publishing & Production
I expect the site to go live sometime within two or three weeks after hearing Sega's response to our inquiry. Due to the nature of this project repository access will be limited, until a peer review process has been establish to make sure accurate information is published on the stie. The site will be designed for users to still have logon, and can make comments or suggestions, but unlike other wiki's the information on this one will be locked and only autorized project members will have access.
# See the Project Wiki on this repository for any additional information.
# See this readme.md for any update information avaiable.
|
4a06eebb-5718-4c69-9e6c-44d8115712c2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-27 07:11:23", "repo_name": "kfloresJava/Assignments", "sub_path": "/01-java-fundamentals/04-string-manipulation/AlfredResponse.java", "file_name": "AlfredResponse.java", "file_ext": "java", "file_size_in_byte": 1082, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "be1f46e1980f099b662b9d99295ed43daa0389d2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kfloresJava/Assignments | 229 | FILENAME: AlfredResponse.java | 0.26588 | import java.util.Date;
public class AlfredResponse {
public String basicGreeting()
{
return "Good day to whomever it may concern";
}
public String greetPerson(String personName, String dayString)
{
return String.format("Good day %s isn't it a nice day this %s", personName,dayString);
}
public String announceDate()
{
Date currdate= new Date();
return String.format("What a wonderful day today, today is %s", currdate);
}
public String Conversation(String text)
{
String wordValue="";
if(text.contains("Alexis"))
{
wordValue="Right away, sir. She certainly isn't sophisticated enough for that.";
}
else if(text.contains("Alfred"))
{
wordValue="At your service. As you wish, naturally.";
}
else if(text.contains("Alexis")==false && text.contains("Alexis")==false)
{
wordValue="Right. And with that I shall retire.";
}
return wordValue;
}
}
|
24e4e764-44bc-4666-b1b1-c2b541462b33 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-02-20 11:48:12", "repo_name": "suixinlu2017/cnblogs-example", "sub_path": "/7-spring中使用aop配置事务/src/main/java/org/xs/demo1/HelloController.java", "file_name": "HelloController.java", "file_ext": "java", "file_size_in_byte": 1100, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "4f142bc122341a0bac7db0e20df93708cce0e0f5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/suixinlu2017/cnblogs-example | 227 | FILENAME: HelloController.java | 0.26588 | package org.xs.demo1;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("hello")
public class HelloController {
@Autowired
private testDao testDao;
@RequestMapping("world")
public String helloworld(HttpServletRequest request) {
request.setAttribute("say", "Hello World!");
return "index2";
}
@RequestMapping("mysql")
public String mysql(HttpServletRequest request) {
List<testInfo> list = testDao.getList();
request.setAttribute("testList", list);
request.setAttribute("say", "Hello Mysql!");
return "index3";
}
/**
* 保存实体
* @param request
* @return
*/
@RequestMapping("save")
public String save(HttpServletRequest request) {
testInfo info = new testInfo();
info.setId(request.getParameter("id"));
info.setName(request.getParameter("name"));
testDao.save(info);
return "redirect:/hello/mysql";
}
}
|
107a88ed-c99d-4532-b20d-fc866a4d6214 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-09-24T13:32:49", "repo_name": "AndreL2507/ISTA420", "sub_path": "/homework/T-SQL Ch.8a Homework.md", "file_name": "T-SQL Ch.8a Homework.md", "file_ext": "md", "file_size_in_byte": 1001, "line_count": 25, "lang": "en", "doc_type": "text", "blob_id": "3a8fcaa7c601cbbd2d1c047a59eafa147530ba6f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AndreL2507/ISTA420 | 223 | FILENAME: T-SQL Ch.8a Homework.md | 0.273574 | # Andre Lacquement
### T-SQL Ch.8a Homework
---
1. The list of columns is optional, but by doing so you control the value-column associations. If you don't specify a value, SQL will use a default value if one was defined.
1. Yes, you use a subquery in INSERT SELECT statements.
1. Create Proc EXEC
1. You insert the INTO statement right before the FROM clause of the query
1. The parameters for the BULK insert statement are the target table, source file, and options.(You can specify many options)
1. No, however you can provide your own explicit values after setting the IDENTITY_INSERT option to ON.
1. use the CREATE SEQUENCE command.
1. You use SEQUENCE objects to support other tables.
1. You can alter a sequence with ALTER SEQUENCE.
1. Truncate is minimally logged and has no filter, however truncate is not allowed when the target table is referenced by a foreign key constraint.
1. Drop will remove the entire table whereas delete can be filtered. |
5661bef6-10ec-4c59-b1d8-75acd09f048d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-14 13:08:04", "repo_name": "Jcduhdt/Concurrency", "sub_path": "/src/main/java/com/zx/thread/SemaphoreTest.java", "file_name": "SemaphoreTest.java", "file_ext": "java", "file_size_in_byte": 1178, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "d68d197c0257bca7dece619487ef5b5982d9485d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Jcduhdt/Concurrency | 236 | FILENAME: SemaphoreTest.java | 0.286968 | package com.zx.thread;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
/**
* @author ZhangXiong
* @version v12.0.1
* @date 2020-06-14
* Semaphore 允许多少个线程同时做什么事
* 其实这个例子看不出来吧
*/
public class SemaphoreTest {
private static final int THREAD_COUNT = 30;
private static ExecutorService threadPool = Executors.newFixedThreadPool(THREAD_COUNT);
private static Semaphore s = new Semaphore(10);
public static void main(String[] args) {
for (int i = 0; i < THREAD_COUNT; i++) {
threadPool.execute(new Runnable() {
@Override
public void run() {
try {
// 获取许可
s.acquire();
System.out.println("save data");
// 释放许可
s.release();
} catch (InterruptedException e) {
// e.printStackTrace();
}
}
});
}
threadPool.shutdown();
}
}
|
237f45ee-ff3b-48df-9d0d-92bf817e8086 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-07 14:14:16", "repo_name": "Georgich88/grasp-and-gof-design-patterns", "sub_path": "/src/main/java/com/foxminded/isaev/prototype/cars/Vehicle.java", "file_name": "Vehicle.java", "file_ext": "java", "file_size_in_byte": 1181, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "e54ec7fdd7ed5bf715c059771b191dc1a8fe69d1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Georgich88/grasp-and-gof-design-patterns | 246 | FILENAME: Vehicle.java | 0.259826 | package com.foxminded.isaev.prototype.cars;
public class Vehicle implements VehiclePrototype {
private VehicleType type;
private String color;
private String number;
protected Vehicle(VehicleType type, String color, String number) {
this.type = type;
this.color = color;
this.number = number;
}
@Override
public VehicleType getType() {
return type;
}
@Override
public String getColor() {
return color;
}
@Override
public void setColor(String color) {
this.color = color;
}
@Override
public String getNumber() {
return number;
}
@Override
public void setNumber(String number) {
this.number = number;
}
@Override
public VehiclePrototype clone() throws CloneNotSupportedException {
Vehicle clonnedVehicle = (Vehicle) super.clone();
return (VehiclePrototype) super.clone();
}
@Override
public String toString() {
return "Vehicle{" +
"type=" + type +
", color='" + color + '\'' +
", number='" + number + '\'' +
'}';
}
}
|
ed197fbf-ee3c-4dee-bbaf-a6935d461476 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-11-14T06:23:00", "repo_name": "StuffbyYuki/Tableau-Python-API-Export-View", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1048, "line_count": 40, "lang": "en", "doc_type": "text", "blob_id": "0c4680351e0be0624ddb6e187435f010ff057aec", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/StuffbyYuki/Tableau-Python-API-Export-View | 259 | FILENAME: README.md | 0.246533 | # Tableau Python API
This is a python script based off of an example in [Tableau Server Client (Python)](https://github.com/tableau/server-client-python)
The script in the link above is not working as is (as of 11/13/2020), so this script is to help export csv/png/pdf of a view in your Tableau server.
## Prerequisites
You need to have installed Python 3.5 or later.
You also need to install tableau server client python package.
To install the package, type the following:
```
pip install tableauserverclient
```
or
```
pip install -r requirements.txt
```
## Installing
When you run the script, you can use the command like the following:
```
python export_view.py -s SITENAME -u USERNAME -p PASSWORD -v YOURVIEWNAME --csv -f YOURFILENAME.csv
```
And you can also add other arguments as neccesary. Look into the code for details.
One thing to note is that you cannot export a csv and a png/pdf or vice verse in one run.
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
fd836134-16f1-48ca-a92a-642572cdae3f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-05-19T17:31:58", "repo_name": "laere/scape", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1107, "line_count": 20, "lang": "en", "doc_type": "text", "blob_id": "931e92d61d9534fedc5b745e2d96a56b41a83fef", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/laere/scape | 278 | FILENAME: README.md | 0.189521 | Runescape has been a big part of my life as a kid growing up.
I started Runescape in 2001 during classic under the name Strikerx15. I was ranked 4 on top attack exp,
and in the top 20 for overall skills for almost half a year. I played it as much as I could until I left the game in 2007.
However, I couldn't stay away, and came back for a short time in 2009-2010 to do summoning, then again quit.
Now it's 2016, and I have started playing again. Although I don't play OSRS, I have been enjoying RS3. Runescape is one game I hate starting over in.
But, maybe I will start a new OSRS character sometime in the future.
This project is being able to combine my love for creating web applications with my love for the game I grew up with. This application
will be along the lines of a pokedex/wikipedia combination. Players can look up others high scores, monster information, and whats hot on the grand exchange within the game.
I really want to make this project into something big, so here is for those that enjoy the game as much as I do!
Cheers.
**Project abandoned due to the lack of a real API**
|
2fe4b61c-1146-4656-8a15-997e59542a80 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-05-28 03:26:27", "repo_name": "wocommunity/wonder", "sub_path": "/Examples/Ajax/AjaxExample/Sources/ModalDialogContents.java", "file_name": "ModalDialogContents.java", "file_ext": "java", "file_size_in_byte": 1155, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "a8b598afad4e040db16ad5795df1ab5f9ff6b830", "star_events_count": 89, "fork_events_count": 85, "src_encoding": "UTF-8"} | https://github.com/wocommunity/wonder | 253 | FILENAME: ModalDialogContents.java | 0.295027 | import com.webobjects.appserver.WOActionResults;
import com.webobjects.appserver.WOComponent;
import com.webobjects.appserver.WOContext;
import com.webobjects.foundation.NSLog;
import er.ajax.AjaxModalDialog;
public class ModalDialogContents extends WOComponent {
boolean isSecondConfirmation = false;
public ModalDialogContents(WOContext context) {
super(context);
}
/**
* Ajax method that is called when deletion is confirmed in the Ajax Dialog
*
* @return null
*/
public WOActionResults deleteIt() {
NSLog.out.appendln(isSecondConfirmation ? "ModalDialogContents deleteIt called will delete" : "ModalDialogContents deleteIt called will reconfirm");
isSecondConfirmation = ! isSecondConfirmation;
if (isSecondConfirmation) {
AjaxModalDialog.update(context(), confirmationMessage());
}
else {
AjaxModalDialog.close(context());
}
return null;
}
public String confirmationMessage() {
return isSecondConfirmation ? "Are you really, really, really sure you want to delete this?" : "Are you sure you want to delete this?";
}
}
|
5ea9fee4-40ec-4bda-8cc6-8efb132a25be | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-29 09:08:29", "repo_name": "molayodecker/Ajax-spring-boot-form", "sub_path": "/src/main/java/gh/gov/moh/admissionsportal/service/LoggerServiceImpl.java", "file_name": "LoggerServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1187, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "44688cf9a25d62425cf940ca0c620cc456c81bed", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/molayodecker/Ajax-spring-boot-form | 264 | FILENAME: LoggerServiceImpl.java | 0.277473 | package gh.gov.moh.admissionsportal.service;
import gh.gov.moh.admissionsportal.dao.LoggerDao;
import gh.gov.moh.admissionsportal.model.UrlLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by molayodecker on 10/03/2017.
*/
@Service
public class LoggerServiceImpl implements LoggerService {
@Autowired
LoggerDao loggerDao;
@Override
public List<UrlLogger> findAll() {
return loggerDao.findAll() ;
}
@Override
public void save(UrlLogger logger) {
loggerDao.save(logger);
}
@Override
public void logger(String logger) {
loggerDao.log(logger);
}
@Override
public void loggerURL(String logger, Long id) { loggerDao.logURI(logger, id);
}
@Override
public long findOne() {
UrlLogger logger = loggerDao.ListAll();
return logger.getId();
}
@Override
public String findRequest() {
UrlLogger logger = loggerDao.ListAll();
return logger.getRedirect();
}
@Override
public UrlLogger ListAll() {
return loggerDao.ListAll();
}
}
|
b2dd8ad1-2e5a-43e8-a48c-86ac26fb5dd1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-31 08:32:53", "repo_name": "lamdoan7747/rmit-android-ass2", "sub_path": "/app/src/main/java/com/example/rmit_android_ass2/model/CleaningResult.java", "file_name": "CleaningResult.java", "file_ext": "java", "file_size_in_byte": 1087, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "a260216e3a72ec9329d393e4d36d7bc976845150", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lamdoan7747/rmit-android-ass2 | 211 | FILENAME: CleaningResult.java | 0.226784 | package com.example.rmit_android_ass2.model;
import com.google.firebase.Timestamp;
import com.google.firebase.firestore.DocumentId;
import com.google.firebase.firestore.FieldValue;
import com.google.firebase.firestore.ServerTimestamp;
import java.io.Serializable;
import java.sql.Time;
import java.text.SimpleDateFormat;
import java.util.Date;
public class CleaningResult implements Serializable {
@DocumentId
private String id;
@ServerTimestamp
private Timestamp dateCleaning;
private double amount;
public CleaningResult() {
}
public CleaningResult(double amount) {
this.amount = amount;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Timestamp getDateCleaning() {
return dateCleaning;
}
public void setDateCleaning(Timestamp dateCleaning) {
this.dateCleaning = dateCleaning;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
}
|
9551ba4a-2edf-4ca5-a9f9-943bd23d885d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-29 19:30:55", "repo_name": "mikepitman/FinalProject", "sub_path": "/androidJokeLib/src/main/java/pitman/co/za/androidjokelib/JokeActivity.java", "file_name": "JokeActivity.java", "file_ext": "java", "file_size_in_byte": 1179, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "f59395c43d7e7e6748371797b72513240712664c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mikepitman/FinalProject | 219 | FILENAME: JokeActivity.java | 0.23092 | package pitman.co.za.androidjokelib;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.TextView;
public class JokeActivity extends AppCompatActivity {
private static String LOG_TAG = JokeActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_joke);
TextView jokeTextView = (TextView) findViewById(R.id.lame_joke_text);
Intent intent = getIntent();
if ((intent != null)) {
String joke = intent.getStringExtra(getString(R.string.joke_intent_ref));
if (!joke.isEmpty()) {
jokeTextView.setText(joke);
Log.d(LOG_TAG, "Intent non-null, setting joke value");
} else {
Log.d(LOG_TAG, "StringExtra on intent is empty");
jokeTextView.setText(R.string.joke_failure);
}
} else {
Log.d(LOG_TAG, "Intent is NULL");
jokeTextView.setText(R.string.joke_failure);
}
}
}
|
f590a7c9-e746-4dcf-9a45-0ab8ff17bb01 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-21 14:11:15", "repo_name": "baatheo/TournamentManager", "sub_path": "/src/main/java/tm/domain/entity/Tournament.java", "file_name": "Tournament.java", "file_ext": "java", "file_size_in_byte": 1223, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "2a10a3ba7e554c4daf1a687c78d0acfbae5ae451", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/baatheo/TournamentManager | 253 | FILENAME: Tournament.java | 0.279042 | package tm.domain.entity;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
@Entity
@Table(name="tournament")
public class Tournament {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "tournament_id")
private long tournamentId;
@Column(name="name")
private String name;
public long getId() {
return tournamentId;
}
public void setId(long id) {
this.tournamentId = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "Tournament{" +
"id=" + tournamentId +
", name='" + name + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tournament that = (Tournament) o;
return tournamentId == that.tournamentId;
}
@Override
public int hashCode() {
return Objects.hash(tournamentId);
}
}
|
8c486f45-8027-486e-bd1f-1b802486916e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-10-01T22:49:18", "repo_name": "rubenerd/rubenerd.com", "sub_path": "/content/post/2018/freebsd-zfs-catching-mismatched-disks.md", "file_name": "freebsd-zfs-catching-mismatched-disks.md", "file_ext": "md", "file_size_in_byte": 1045, "line_count": 37, "lang": "en", "doc_type": "text", "blob_id": "3f9ee658ffd0b42fcac7f0d1baee39a74dfbb4be", "star_events_count": 7, "fork_events_count": 3, "src_encoding": "UTF-8"} | https://github.com/rubenerd/rubenerd.com | 309 | FILENAME: freebsd-zfs-catching-mismatched-disks.md | 0.191933 | ---
title: "FreeBSD ZFS catching mismatched disks"
date: "2018-08-13T17:22:38+10:00"
abstract: "invalid vdev specification"
year: "2018"
category: Software
tag:
- bsd
- file-systems
- freebsd
- orionvm
- zfs
location: sydney
---
I was creating a ZFS mirrored pool on a FreeBSD cloud instance with two identical data disks, like a gentleman:
$ ovm create disk test1 in SY3 with 100g on tier SSD
$ ovm create disk test2 in SY3 with 10gb on tier SSD
$ ovm attach disk test1 to VM test
$ ovm attach disk test2 to VM test
And then on the VM:
# glabel test1 /dev/ada1
# glabel test2 /dev/ada2
# zpool create [options] mirror tank \
/dev/label/test1 /dev/label/test2
Output:
==> invalid vdev specification
==> use '-f' to override the following errors:
==> mirror contains devices of different sizes
Whoops! Turns out they were less identical than I realised. You've have thought the monospace font not lining up during provisioning would have been a clue. Either way, good to know. Also, derp.
|
75895fb6-eb54-4a69-a00f-c23223b94a01 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-08-28T07:29:59", "repo_name": "ArduCAM/MIPI_Camera", "sub_path": "/Jetson/Multi-Camera Adapter/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1090, "line_count": 27, "lang": "en", "doc_type": "text", "blob_id": "01f1eefb74e634ff8ac492bf4c7cb06a95fb6a85", "star_events_count": 212, "fork_events_count": 118, "src_encoding": "UTF-8"} | https://github.com/ArduCAM/MIPI_Camera | 289 | FILENAME: README.md | 0.262842 | ## Jetson Naono Multi Camera Adapter
### Install GPIO lib
sudo pip install Jetson.GPIO
### Setting User Permissions
In order to use the Jetson GPIO Library, the correct user permissions/groups must be set first.
Create a new gpio user group. Then add your user to the newly created group.
`sudo groupadd -f -r gpio`
`sudo usermod -a -G gpio $USER`
Install custom udev rules by copying the 99-gpio.rules file into the rules.d directory:
`sudo cp /opt/nvidia/jetson-gpio/etc/99-gpio.rules /etc/udev/rules.d/`
Please note that for the new rule to take place, you may either need to reboot or reload the udev rules by issuing this command:
`sudo udevadm control --reload-rules && sudo udevadm trigger`
`sudo reboot`
Visiting here to get more detail information[Jetson.GPIO - Linux for Tegra](https://pypi.org/project/Jetson.GPIO/#description)
### Run demo
`sudo python Multi-Camera-Adapter-Demo.py -i 1`
`-i` use to set i2c bus, for Jetson Nano it is 1, for Jetson Xavier NX it is 8.
This demo will preview each camera and get one snapshot. Then stored it to local path. |
92af96d0-3793-47b9-821e-0174bea2b7f4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-29 21:17:29", "repo_name": "vakondios/mailer-service", "sub_path": "/src/test/java/com/avakio/mailer/SwaggerUnitTest.java", "file_name": "SwaggerUnitTest.java", "file_ext": "java", "file_size_in_byte": 1064, "line_count": 28, "lang": "en", "doc_type": "code", "blob_id": "aca48b883dbb9f5742ab6668dca2b97fbabfc7ed", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/vakondios/mailer-service | 182 | FILENAME: SwaggerUnitTest.java | 0.23231 | package com.avakio.mailer;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@AutoConfigureMockMvc
@SpringBootTest
public class SwaggerUnitTest {
@Autowired
protected MockMvc mockMvc;
@Test
public void shouldDisplaySwaggerUiPage() throws Exception {
MvcResult mvcResult = mockMvc.perform(get("/swagger-ui/index.html")).andExpect(status().isOk()).andReturn();
String contentAsString = mvcResult.getResponse().getContentAsString();
Assertions.assertTrue(contentAsString.contains("Swagger UI"));
}
} |
b9e6a464-221d-4126-9097-9c9a39e527e1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-26 14:41:56", "repo_name": "rafaelbraga25/Uminho", "sub_path": "/DSS/SistemaGestaoTurnos/src/Business/Utilizador.java", "file_name": "Utilizador.java", "file_ext": "java", "file_size_in_byte": 1115, "line_count": 60, "lang": "en", "doc_type": "code", "blob_id": "ad9a7953e72ed5e5fbe536b493e8c5d6a1d759f7", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rafaelbraga25/Uminho | 212 | FILENAME: Utilizador.java | 0.249447 | package Business;
import java.util.Arrays;
/*
* 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.
*/
/**
*
* @author rafae
*/
public abstract class Utilizador {
private final String username;
private String password;
public Utilizador(String nomeUtilizador, String password) {
this.username = nomeUtilizador;
this.password = password;
}
public Utilizador(Utilizador u) {
username = u.getUsername();
password = u.getPassword();
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public int hashCode() {
return Arrays.hashCode(new Object[] {
username,
password
});
}
@Override
public abstract Utilizador clone();
}
|
0dd0abdd-335c-4f23-a99d-0e68596ed1e6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-14 21:47:50", "repo_name": "Mannendri/skhool", "sub_path": "/project/app/src/main/java/com/example/skhool/ResourceAdapter.java", "file_name": "ResourceAdapter.java", "file_ext": "java", "file_size_in_byte": 1181, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "a5f2c0b06176b2763d6374938bd3885df9f3da3e", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/Mannendri/skhool | 203 | FILENAME: ResourceAdapter.java | 0.276691 | package com.example.skhool;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import org.w3c.dom.Text;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class ResourceAdapter extends ArrayAdapter<ResourceItem> {
public ResourceAdapter(Context context, ArrayList list){
super(context,0,list);
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.resource_item, parent, false);
ResourceItem currentResourceItem = getItem(position);
TextView resourceItemTextViewTitle = convertView.findViewById(R.id.resource_item_title);
TextView resourceItemTextViewURL = convertView.findViewById(R.id.resource_item_url);
resourceItemTextViewTitle.setText(currentResourceItem.getTitle() );
resourceItemTextViewURL.setText(currentResourceItem.getUrl() );
return convertView;
}
}
|
13ff82c8-e231-44a0-baa1-e6b83b221bd2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-14 19:57:36", "repo_name": "Clydeside/ALipatov", "sub_path": "/chapter_004/src/main/java/ru/job4j/orderBook/Item.java", "file_name": "Item.java", "file_ext": "java", "file_size_in_byte": 994, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "b715d1fe5342a04f013421603865029e61100c25", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Clydeside/ALipatov | 214 | FILENAME: Item.java | 0.276691 | package ru.job4j.orderBook;
import java.util.UUID;
public class Item {
private String id;
private String book;
private String type;
private String action;
private int price;
private int amount;
public Item(String book, String type, String action, int price, int amount) {
this.id = generateId();
this.book = book;
this.type = type;
this.action = action;
this.price = price;
this.amount = amount;
}
private String generateId() {
return UUID.randomUUID().toString();
}
public String getId() {
return id;
}
public String getBook() {
return book;
}
public String getType() {
return type;
}
public String getAction() {
return action;
}
public int getPrice() {
return price;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
}
|
a9e28f9f-5395-4b6e-aae3-823dfda4d628 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-06 02:37:07", "repo_name": "Centennial-FTC-Robotics/Exponential2020-2021", "sub_path": "/TeamCode/src/main/java/org/exponential/unittests/CameraTensorFlowTester.java", "file_name": "CameraTensorFlowTester.java", "file_ext": "java", "file_size_in_byte": 1079, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "7230de11d9bbc5a72b8ca60b858e4746788cbc4b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Centennial-FTC-Robotics/Exponential2020-2021 | 216 | FILENAME: CameraTensorFlowTester.java | 0.271252 | package org.exponential.unittests;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import org.exponential.mechanisms.CameraTensorFlow;
import org.exponential.superclasses.UnitTester;
@Disabled
@Autonomous(name="CameraTensorFlowTester", group="Autonomous")
public class CameraTensorFlowTester extends UnitTester {
CameraTensorFlow camera;
@Override
public void runOpMode() throws InterruptedException {
waitForStart();
camera = new CameraTensorFlow();
camera.initialize(this);
camera.activate();
trackIndex(0, 1);
}
@Override
public void runTest(int index) {
switch (index) {
case 0:
activateCamera();
break;
case 1:
deactivateCamera();
break;
default:
break;
}
}
public void activateCamera() {
camera.activate();
}
public void deactivateCamera() {
camera.deactivate();
}
}
|
ae9c39bb-68d9-406a-8c0e-4b0fc4194a4a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-11 08:22:20", "repo_name": "ifmylove2011/SlimCalendar", "sub_path": "/app/src/main/java/com/xter/slimcalendar/data/source/cloud/request/ShowBingWallpaperRequest.java", "file_name": "ShowBingWallpaperRequest.java", "file_ext": "java", "file_size_in_byte": 1001, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "6fa7a66e79ad43afe3841f1f669b61b175ade3c3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ifmylove2011/SlimCalendar | 254 | FILENAME: ShowBingWallpaperRequest.java | 0.289372 | package com.xter.slimcalendar.data.source.cloud.request;
import com.xter.slimcalendar.data.constant.NC;
import com.xter.slimcalendar.data.source.cloud.base.IShowRequest;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* Created by XTER on 2018/4/9.
* ShowAPI请求头
*/
public class ShowBingWallpaperRequest implements IShowRequest {
/**
* 得到当前时间
*
* @return time
*/
protected String getTime() {
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA);
return sdf.format(d);
}
@Override
public Map<String, Object> getParams() {
Map<String, Object> params = new HashMap<>();
params.put("showapi_appid", NC.APP_ID_SHOWAPI);
params.put("showapi_sign", NC.APP_KEY_SHOWAPI);
// params.put("showapi_timestamp", getTime());
// params.put("showapi_sign_method", "md5");
// params.put("showapi_res_gzip", "1");
return params;
}
}
|
b496a9a9-11ca-403a-b863-4c22531d6525 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-12 08:53:44", "repo_name": "wanghe2/jwt", "sub_path": "/jwt-server/src/main/java/org/jwt/filter/MyTokenFilter.java", "file_name": "MyTokenFilter.java", "file_ext": "java", "file_size_in_byte": 1155, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "6d195a6bddeb1f8117dbfefb62bae9d8dcf01f2b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wanghe2/jwt | 231 | FILENAME: MyTokenFilter.java | 0.256832 | package org.jwt.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.wang.util.TockenUtil;
public class MyTokenFilter implements Filter{
@Override
public void init(FilterConfig filterConfig) throws ServletException {}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
String realPath=((HttpServletRequest )request).getRequestURI();
if(realPath.contains("checklogin")||realPath.contains("loginpage")) {
chain.doFilter(request, response);
}else {
String jwt_token=((HttpServletRequest )request).getParameter("jwt_token");
if(TockenUtil.validateJWT(jwt_token).getSuccess()) {
chain.doFilter(request, response);
}else
((HttpServletResponse)response).sendRedirect("/loginpage");
}
}
@Override
public void destroy() {
}
}
|
cda90599-f71d-460a-ae75-c6f93c7bc7d6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-09 16:19:23", "repo_name": "Aseray/AI_TP1_GestorTareas", "sub_path": "/AplicacionesInteractivas/src/business_layer/business_objects/Location.java", "file_name": "Location.java", "file_ext": "java", "file_size_in_byte": 1188, "line_count": 60, "lang": "en", "doc_type": "code", "blob_id": "2ccba731d672c8c9601ef1a6108d70144e90d537", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Aseray/AI_TP1_GestorTareas | 255 | FILENAME: Location.java | 0.282196 | package business_layer.business_objects;
import data_access_layer.data_access_objects.DAOLocationImpl;
import data_access_layer.interfaces.DAOLocation;
public class Location {
private String longitude;
private String latitude;
private Integer idTask = autoIncrementID();
public Location(String longitude, String latitude) {
super();
this.longitude = longitude;
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public Integer getIdTask() {
return idTask;
}
public void setIdTask(Integer idTask) {
this.idTask = idTask;
}
private Integer autoIncrementID() {
DAOLocation data = new DAOLocationImpl();
Integer num = data.toList().get(data.toList().size()).getIdTask();
return num + 1;
}
@Override
public String toString() {
return "Location [longitude=" + longitude + ", latitude=" + latitude + ", idTask=" + idTask + "]";
}
}
|
2c6787de-520b-4da0-9230-a036c65b9e09 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-01-13T17:36:28", "repo_name": "iccowan/EmailOpt", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1222, "line_count": 23, "lang": "en", "doc_type": "text", "blob_id": "a55c93f2ce7b67a1e09cdd683b0f2f156f31cff4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/iccowan/EmailOpt | 327 | FILENAME: README.md | 0.188324 | # OUTDATED - Please see below for the new VATUSA Base ARTCC Website designed for integration with the VATUSA API. That is written in Laravel 5. This code is no longer being updated.
VATUSA Base ARTCC Website, which is a newer version of the legacy Bozwood-Davies legacy website can be found at:
[https://github.com/iccowan/VATUSA_Base_ARTCC_Site](https://github.com/iccowan/VATUSA_Base_ARTCC_Site)
# EmailOpt for Laravel 4.2
Created by Ian Cowan for the vZTL ARTCC website in order to comply with the new GDPR requirements.
# To Install:
1. Move all migrations into the migrations folder.
2. Move the controller into the controllers folder.
3. Move the view into the views folder.
4. Move the models to the models folder.
5. Run "php artisan migrate" in order to add the appropiate tables/columns.
6. In the User model, add "opt" to the fillable.
# Setup/Configuration:
- The link "/emails/opt" will now return the page to opt in and accept the privacy policy OR to opt out (if one has already opted in).
- There will be a new column within the roster table (User model) to see who has opted in. 1 = Opted in, 0 = Not Opted in.
If you have any questions or issues, contact me at wm@ztlartcc.org.
|
f70417c7-a479-4c9e-9ea9-aad820f424dc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-28 07:21:49", "repo_name": "imacback/bs", "sub_path": "/bs-cache/src/test/java/cn/aiyuedu/bs/cache/service/CategoryCacheServiceTest.java", "file_name": "CategoryCacheServiceTest.java", "file_ext": "java", "file_size_in_byte": 1020, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "d970938e56cee7849cd9fb45ddfa821780df4d44", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/imacback/bs | 203 | FILENAME: CategoryCacheServiceTest.java | 0.240775 | package cn.aiyuedu.bs.cache.service;
import cn.aiyuedu.bs.common.model.CategoryBase;
import org.apache.commons.collections4.CollectionUtils;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* Created by webwyz on 14/10/22.
*/
@Ignore
public class CategoryCacheServiceTest extends BaseTest {
@Autowired
private CategoryCacheService categoryCacheService;
@Test
public void test() {
List<CategoryBase> list = categoryCacheService.getAll();
if (CollectionUtils.isNotEmpty(list)) {
for (CategoryBase c : list) {
System.out.println(c.getName()+", orderId:"+c.getOrderId());
if (CollectionUtils.isNotEmpty(c.getChildren())) {
for (CategoryBase cc : c.getChildren()) {
System.out.println("-----"+cc.getName()+", orderId:"+cc.getOrderId());
}
}
}
}
}
}
|
c191b900-2ff5-4428-ac7e-18d50813926c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2022-04-08T09:44:59", "repo_name": "elmot/qemu-lm3s", "sub_path": "/Readme.md", "file_name": "Readme.md", "file_ext": "md", "file_size_in_byte": 1155, "line_count": 36, "lang": "en", "doc_type": "text", "blob_id": "1cba54473d92a936834e98bb8be8a9ff058854ea", "star_events_count": 8, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/elmot/qemu-lm3s | 312 | FILENAME: Readme.md | 0.23092 | A small project to run QEMU in ARM Cortex-M3 mode with remote gdb endpoint.
=====
Primarily for testing CLion embedded support.
[CLion](https://jetbrains.com/clion/) 2019.2+ is required with embedded support plugin enabled.
Features
---
Uses QEMU emulation of TI lm3s811evb. QEMU is run with some garbage (README file) instead of kernel image. The binary is uploaded via gdb anyway but qemu
requires some kernel to start.
QEMU cmd arguments:
* `-cpu cortex-m3` - cpu type
* `-M lm3s811evb` - guest machine type
* `-nographic` - do not open window
* `-s` - cli shortcut to start gdbserver at port 1234
* `-S` - freeze execution, wait until gdb is connected
* `-kernel README` - load binary garbage as kernel
Standard CMSIS 5 for Cortex-M3 + libnano are used. CMSIS is modified according to lm3s memory map.
`stdout` is redirected to lm3s UART0.
There is a [fake peripheral device definition](fake_peripheral.svd) which may be used for debugging and testing
purposes. The "device" is located in RAM, at address `0x20001800`. In the program code it is filled up with values.
Clion Run configuration
---

|
4a16947a-c670-4917-83af-622698988d26 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-05 02:16:52", "repo_name": "2368990203/WorkManagementSystem", "sub_path": "/源代码/work-system/work-system/work-api-admin/src/main/java/team/work/doc/SysSubMenuAuthAdd.java", "file_name": "SysSubMenuAuthAdd.java", "file_ext": "java", "file_size_in_byte": 1243, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "9365ab60cad9a6c80e2917df52cc80269b212c42", "star_events_count": 2, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/2368990203/WorkManagementSystem | 257 | FILENAME: SysSubMenuAuthAdd.java | 0.181263 | package team.work.doc;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"handler", "hibernateLazyInitializer"})
@ApiModel(value = "权限菜单功能权限模块")
public class SysSubMenuAuthAdd {
@ApiModelProperty(value = "功能权限名称")
private String name;
@ApiModelProperty(value = "对应菜单id")
private String menuId;
@ApiModelProperty(value = "前端方法")
private String fun;
@ApiModelProperty(value = "接口函数")
private String code;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMenuId() {
return menuId;
}
public void setMenuId(String menuId) {
this.menuId = menuId;
}
public String getFun() {
return fun;
}
public void setFun(String fun) {
this.fun = fun;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
|
86c8a989-959e-40ce-af5f-63ac2f2c9b7f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-14 08:36:29", "repo_name": "StepanMelnik/MultiThreading_Examples", "sub_path": "/src/main/java/com/sme/multithreading/model/DelayedMessage.java", "file_name": "DelayedMessage.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "fee1bad49cff1a01d74731925a28e04dbf273ce4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/StepanMelnik/MultiThreading_Examples | 251 | FILENAME: DelayedMessage.java | 0.280616 | package com.sme.multithreading.model;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* Provides POJO message with delay option.
*/
public final class DelayedMessage extends Message
{
private final int id;
private final int delay;
public DelayedMessage(int id, int delay, String message)
{
super(message);
this.id = id;
this.delay = delay;
}
public int getId()
{
return id;
}
public int getDelay()
{
return delay;
}
@Override
public void setMessage(String message)
{
throw new UnsupportedOperationException("Immutable object does not allow to change a state");
}
@Override
public int hashCode()
{
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object obj)
{
return EqualsBuilder.reflectionEquals(this, obj);
}
@Override
public String toString()
{
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
}
|
6bcc8a88-35e8-4df6-8a93-3d97d9a8fd7a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-29 04:53:17", "repo_name": "chenshuidejidan/Java_learn", "sub_path": "/basic/src/cn/hit14/producerAndConsumer/Consumer.java", "file_name": "Consumer.java", "file_ext": "java", "file_size_in_byte": 1235, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "d819bf1aa6aefc7e62c758f2e285ea6b536e91c2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/chenshuidejidan/Java_learn | 210 | FILENAME: Consumer.java | 0.255344 | package cn.hit14.producerAndConsumer;
public class Consumer implements Runnable {
private Product product;
@Override
public void run() {
while (true) {
synchronized (product) {
while (product.isEmpty()) {
try {
product.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (!product.isEmpty()) {
consume();
}
product.notify();
}
}
}
Consumer(Product product) {
this.product = product;
}
void consume() {
if (product.isEmpty()) {
System.out.println("警告:空了,不能再消费了");
throw new IndexOutOfBoundsException();
} else {
product.subtract();
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName() + "花费1秒消耗了一个产品,现在共有" + product.getCount() + "个");
}
}
}
|
de2a0f3b-1cc5-4938-b370-bdc615457309 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-06 09:33:28", "repo_name": "flycatrat/dataosclient", "sub_path": "/src/main/java/com/dataos/client/collection/RuleResultCollection.java", "file_name": "RuleResultCollection.java", "file_ext": "java", "file_size_in_byte": 994, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "d9ee9d1e13340807a460f8a34a973a80f5414d0d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/flycatrat/dataosclient | 208 | FILENAME: RuleResultCollection.java | 0.221351 | package com.dataos.client.collection;
import com.dataos.client.biz.RuleResultBiz;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* RuleResultCollection
*
* @author libing
* @date 2020/3/29
**/
@Slf4j
@RestController
public class RuleResultCollection {
@Autowired
RuleResultBiz ruleResultBiz;
@GetMapping("/ruleResult/excute")
public int ruleResultExcute(@RequestParam String file,@RequestParam String checkDate) {
log.debug("file={} checkDate={}",file, checkDate);
try{
return ruleResultBiz.ruleResultExcute(file, checkDate);
}catch (Exception e) {
e.printStackTrace();
log.error("ruleResultExcute ----->>>>> {}",e.getMessage());
return -1;
}
}
}
|
5957c11e-e176-49c8-b0c0-fdd527ca273c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-05-05T06:55:41", "repo_name": "rahafoundation/dev-blog", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1007, "line_count": 27, "lang": "en", "doc_type": "text", "blob_id": "7ffdbbdd2775d034a4d80a7457a7477c955659f1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rahafoundation/dev-blog | 258 | FILENAME: README.md | 0.213377 | # dev-blog
# This codebase is no longer maintained.
Blog of the Raha software development team. Rendered using Github Pages' Jekyll
integration.
## Adding articles
1. Create a file in `_posts/` with the following title format:
`yyyy-mm-dd-title.md`
1. Add the [Jekyll front matter](https://jekyllrb.com/docs/frontmatter/) to the
beginning of the file, following the pattern of other posts. If you'd like
to add a new author, add the metadata to `_config.yml`.
1. Write your article in Markdown. Author info will be added automatically to
the article, so don't worry about that.
1. Publish it by opening an PR and having it merged into `master`.
## Serving it locally
If you'd like to see what it'll look like when it's published, do the following:
1. Install [Ruby Version Manager](https://rvm.io/).
1. Install a Ruby version: `rvm install 2.4`
1. Install package dependencies: `bundle install`
1. Run the server, defaults to http://localhost:4000. `bundle exec jekyll serve`
|
a7c120e9-7afa-4157-aaf3-14c6abe5f36b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-05-18 05:09:00", "repo_name": "zuokai666/Util", "sub_path": "/Spring/src/com/zk/demo1025/ABeanPostProcessor.java", "file_name": "ABeanPostProcessor.java", "file_ext": "java", "file_size_in_byte": 1106, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "8ada382ad34ffc7d7fe52bd214f927bb46767079", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zuokai666/Util | 203 | FILENAME: ABeanPostProcessor.java | 0.295027 | package com.zk.demo1025;
import java.lang.annotation.Annotation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;
public class ABeanPostProcessor implements BeanPostProcessor{
private static final Log log = LogFactory.getLog(ABeanPostProcessor.class);
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
log.info("----------------Before Initialization postProcess:"+beanName);
Class<?> clasz=bean.getClass();
Annotation annotation=clasz.getAnnotation(Component.class);
if(annotation != null){
log.info("----------------Before Initialization postProcess:"+annotation);
}
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
log.info("----------------After Initialization postProcess:"+beanName);
return bean;
}
} |
e5786b75-1d76-43be-9a49-d7fe0c6997c4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-22 11:09:46", "repo_name": "daniel1n/json-fastJson-demo", "sub_path": "/src/test/java/cn/qqlin/JsonToFileTest.java", "file_name": "JsonToFileTest.java", "file_ext": "java", "file_size_in_byte": 1155, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "c08b69df4216e82383cd1dc5b6ec566b77d207c2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/daniel1n/json-fastJson-demo | 257 | FILENAME: JsonToFileTest.java | 0.256832 | package cn.qqlin;
import cn.qqlin.model.test.TestModel;
import com.alibaba.fastjson.JSON;
import org.apache.commons.io.IOUtils;
import org.junit.jupiter.api.Test;
import java.io.*;
import java.util.List;
/**
* @author lin.qingquan
* @date 2020-10-24 14:47
* @Description:
*/
public class JsonToFileTest {
@Test
public void JsonFileToSqlFile() throws IOException {
InputStream inputStream = new FileInputStream("src/main/resources/test.json");
String text = IOUtils.toString(inputStream, "utf8");
List<TestModel> s = JSON.parseArray(text, TestModel.class);
String path = "src/main/resources/sql.txt";
BufferedWriter out = new BufferedWriter(
new OutputStreamWriter(new FileOutputStream(path, true))
);
for (TestModel d : s) {
String SQL = "insert into test(ID,NAME, PASSWORD)"
+ "VALUES('" + d.getId() + "','" + d.getName() + "','"
+ d.getPassWord() + "')";
System.out.println(SQL);
out.write(SQL);
out.write("\n");
out.flush();
}
out.close();
}
}
|
bf9068cf-34f3-4ec7-a538-f39b177a5dd7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-02-26 12:54:00", "repo_name": "lumaryn/3434_343434", "sub_path": "/src/main/java/siriusadmin/siriusadmin.java", "file_name": "siriusadmin.java", "file_ext": "java", "file_size_in_byte": 1179, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "bbb84ba94a4fea0765fc5960250803e562e5ab5b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lumaryn/3434_343434 | 254 | FILENAME: siriusadmin.java | 0.245085 | package siriusadmin;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
import static com.codeborne.selenide.Selenide.*;
import static com.codeborne.selenide.Condition.*;
public class siriusadmin {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.ie.driver", "C:\\IEDriverServer_Win32_3.8.0\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
{
driver.get("http://sbpgs2-qa.bpm.lanit:9080/prweb/PRServlet/3EmOSbam7UQMneCCqrdaiQ%5B%5B*/!STANDARD");
WebElement element = driver.findElement(By.className("inputBox"));
element.click();
element.sendKeys("siriusadmin");
element = driver.findElement(By.id("txtPassword"));
element.click();
element.sendKeys("rules");
element = driver.findElement(By.id("sub"));
element.click();
Thread.sleep(1000);
// element.findElement(By.id("TABANCHOR"));
// element.click();
}}} |
a802893c-2ed8-428b-81d2-b23ba2db2e6a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-10 16:58:04", "repo_name": "Venn8888/wallet", "sub_path": "/wallet-provider/wallet-message-rpc/src/main/java/com/venn/message/service/impl/MobileMessageServiceImpl.java", "file_name": "MobileMessageServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1187, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "c50b71fc0d8127eb4360b3c84e0252f12f26f2cd", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Venn8888/wallet | 272 | FILENAME: MobileMessageServiceImpl.java | 0.23092 | package com.venn.message.service.impl;
import com.venn.domain.dto.MobileMessageDTO;
import com.venn.message.service.MobileMessageService;
import org.apache.dubbo.config.annotation.Service;
import java.util.Date;
/**
* @author venn
* @version 1.0.0
* @date 2020/6/5
*/
@Service
public class MobileMessageServiceImpl implements MobileMessageService {
@Override
public MobileMessageDTO getMobileMessageDTO(Long id) {
MobileMessageDTO mobileMessageDTO = new MobileMessageDTO();
mobileMessageDTO.setId(0L);
mobileMessageDTO.setEventName("12");
mobileMessageDTO.setMessageText("12");
mobileMessageDTO.setRecipient("21");
mobileMessageDTO.setCountRecipient(0L);
mobileMessageDTO.setFailRecipient("1");
mobileMessageDTO.setCountFail(0L);
mobileMessageDTO.setStoreCode("12");
mobileMessageDTO.setStatus((byte)0);
mobileMessageDTO.setAuthor("1");
mobileMessageDTO.setReviewer("12");
mobileMessageDTO.setReasonRejection("21");
mobileMessageDTO.setPushMessageTime(new Date());
mobileMessageDTO.setReviewTime(new Date());
return mobileMessageDTO;
}
}
|
568f9be4-affc-4524-ad95-aaa20c3c8085 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2014-12-16T11:15:44", "repo_name": "DerekDuchesne/CabectAutotester", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 994, "line_count": 23, "lang": "en", "doc_type": "text", "blob_id": "435b081ab83c9c1159764499789c3f45adb12045", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/DerekDuchesne/CabectAutotester | 227 | FILENAME: README.md | 0.210766 | CabectAutotester
================
Penetration testing tool that combines web app and server-side vulnerability checking.
Requirements:
1) The program must be run on Linux.
2) Python must be installed.
*Important Note*
This program uses the Zed Attack Proxy API which requires that the ZAP GUI be open as the program is running.
CabectAutotester will automatically open this window, but if you are connecting to another machine that's running the program
remotely, you need to enable X11 forwarding to be able to display the ZAP window.
On Mac and Linux, this can be done by setting the -X flag when using ssh.
Ex. ssh -X myHost
On Windows, installing and running Xming will help you enable X11 forwarding.
Instructions:
1) Run the setup.py file by typing 'python setup.py'. This will install all necessary dependencies.
2) Run the actual tool (cabect_autotest.py) by typing 'python cabect_autotest.py'.
3) Enter in the URL of a website to begin testing the web application and web server.
|
528a1ba7-401a-4137-b6a0-342dda7cab6a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-04 20:59:21", "repo_name": "mahbubmunna/diu_transport", "sub_path": "/app/src/main/java/com/moonssoft/diubus/BusData.java", "file_name": "BusData.java", "file_ext": "java", "file_size_in_byte": 1007, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "5a53a29e32c3a045ffa553bddec459dc23997e13", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mahbubmunna/diu_transport | 253 | FILENAME: BusData.java | 0.242206 | package com.moonssoft.diubus;
/**
* Created by MoonS on 25-01-17.
*/
public class BusData {
private String BusName;
private String BusTime;
private int mImageResource;
public BusData(String mBusName, String mBusTime, int mImageResource) {
this.BusName = BusName;
this.BusTime = BusTime;
this.mImageResource = mImageResource;
}
public BusData() {
}
public BusData(String busName, String busTime) {
BusName = busName;
BusTime = busTime;
}
public String getBusName() {
return BusName;
}
public void setBusName(String mBusName) {
this.BusName = mBusName;
}
public String getBusTime() {
return BusTime;
}
public void setBusTime(String mBusTime) {
this.BusTime = mBusTime;
}
public int getImageResource() {
return mImageResource;
}
public void setmImageResource(int mImageResource) {
this.mImageResource = mImageResource;
}
}
|
aaf0d08f-0177-4a6e-a0a0-5f8637cbfbad | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-11 20:38:01", "repo_name": "gongyuchenshidage/3DPrinting10", "sub_path": "/app/src/main/java/com/mukesh/drawingview/example/MoXingKu.java", "file_name": "MoXingKu.java", "file_ext": "java", "file_size_in_byte": 1335, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "09a0054ab8e9ca4b9ed5a1f39258c3db2720eb67", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gongyuchenshidage/3DPrinting10 | 247 | FILENAME: MoXingKu.java | 0.245085 | package com.mukesh.drawingview.example;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
//显示在本地sd卡上储存在某个目录下的图片,每个图片有自己的复选框,选中之后点打印按钮 打印按钮含读取与图片对应的gcode文件功能
public class MoXingKu extends AppCompatActivity implements View.OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_moxingku);
initUI();
}
private void initUI() {
findViewById(R.id.imageView2).setOnClickListener(this);
findViewById(R.id.up_button).setOnClickListener(this);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.imageView2:
Intent intent7 = new Intent();
intent7.setClass(getApplicationContext(), DaYinJieMian.class);
startActivity(intent7);
break;
case R.id.up_button:
Intent intent8 = new Intent();
intent8.setClass(getApplicationContext(), UPicture.class);
startActivity(intent8);
break;
}
}
} |
76c0d13d-efca-4ad6-b6e4-1b47f8a5862e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-18 13:56:55", "repo_name": "NaserSalameh/IP-Imposterless-App", "sub_path": "/app/src/main/java/com/nasersalameh/imposterphenomenoninterventionapp/helpers/DateConverter.java", "file_name": "DateConverter.java", "file_ext": "java", "file_size_in_byte": 1010, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "08e9047b1c061db49618963bae3c9768e674ceac", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/NaserSalameh/IP-Imposterless-App | 213 | FILENAME: DateConverter.java | 0.278257 | package com.nasersalameh.imposterphenomenoninterventionapp.helpers;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateConverter {
private static DateFormat dateFormat = new SimpleDateFormat("dd/M/yyyy");;
public static Long getUnixTimeFromData(String Date){
try {
Date date = dateFormat.parse(Date);
long unixTime = (long) date.getTime()/1000;
return unixTime;
}
catch (ParseException e) {
e.printStackTrace();
}
return 0l;
}
public static String getDateFromUnixTime(Long unix) {
Date date = new Date((long) unix * 1000);
return dateFormat.format(date);
}
public static String getDateAndTimeFromUnixTime(Long unix){
DateFormat dateFormat = new SimpleDateFormat("dd/M/yyyy HH:mm:ss");;
Date date = new Date((long)unix*1000);
return dateFormat.format(date);
}
}
|
fabed207-8b7e-42e1-b61e-6d96b663f4c2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-27 07:37:43", "repo_name": "Shellyfc/JAVA-deep-learning-code", "sub_path": "/src/downloadPage.java", "file_name": "downloadPage.java", "file_ext": "java", "file_size_in_byte": 1060, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "884200aab3ebfcf11a0309e9dd3d984926b13f2a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Shellyfc/JAVA-deep-learning-code | 189 | FILENAME: downloadPage.java | 0.249447 | import java.io.*;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
@WebServlet("/downloadPage")
public class downloadPage extends HttpServlet {
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
String path = this.getServletContext().getRealPath("/downloadSuccessfully.png");
//read
FileInputStream fileInputStream = new FileInputStream(path);
String fileName = path.substring(path.lastIndexOf("\\")+1); //很奇怪,改成_还是不太对
System.out.println(fileName);
response.setHeader("Content-Disposition","attachment;filename="+fileName);
int len = 0;
byte[] bytes = new byte[1024];
ServletOutputStream servletOutputStream = response.getOutputStream();
while((len = fileInputStream.read(bytes))>0) {
servletOutputStream.write(bytes, 0, len);
}
servletOutputStream.close();
fileInputStream.close();
}
}
|
b9eea875-0b3f-4a2d-bffb-9e909d518366 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-18 20:32:11", "repo_name": "vigneshvr88/campaign-builder", "sub_path": "/src/main/java/se/invidi/campaignbuilder/controller/CampaignBuilderController.java", "file_name": "CampaignBuilderController.java", "file_ext": "java", "file_size_in_byte": 1045, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "431586471ba1ac076076b72f45c724b817fa3224", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/vigneshvr88/campaign-builder | 195 | FILENAME: CampaignBuilderController.java | 0.273574 | package se.invidi.campaignbuilder.controller;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import se.invidi.campaignbuilder.model.CampaignBuilderRequest;
import se.invidi.campaignbuilder.model.CampaignBuilderResponse;
import se.invidi.campaignbuilder.service.CampaignBuilderService;
@RestController
@RequestMapping("/invidi")
public class CampaignBuilderController {
@Autowired
private CampaignBuilderService campaignBuilderService;
@PostMapping("/campaign")
@ApiOperation(
value = "Build best possible combination of sold campaigns to maximise the revenue",
response = CampaignBuilderResponse.class)
public CampaignBuilderResponse buildCampaign(
@RequestBody CampaignBuilderRequest request, @RequestParam int monthlyInventory) {
if (monthlyInventory <= 0) {
// Throw bad request
}
return campaignBuilderService.buildOptimizedCampaign(monthlyInventory, request);
}
}
|
b1fc70ad-b4c0-4c12-8d2d-c3358bd06228 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-01-29T20:29:03", "repo_name": "trickstival/css-keylogger", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1086, "line_count": 32, "lang": "en", "doc_type": "text", "blob_id": "24e8807faa8507efa97fe8538dfd86e891db24b7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/trickstival/css-keylogger | 270 | FILENAME: README.md | 0.250913 | # CSS Keylogger
Check the [demo](https://codesandbox.io/s/lucid-germain-uxymn?file=/src/index.js)
This is a simple implementation of a keylogger using CSS.
It requires the `value` attribute to be in sync with the input value,
that is why there is a listener `oninput` in the `input` tag.
## How it works
It works by using an [attribute ends with selector](https://www.w3schools.com/cssref/sel_attr_end.asp)
and CSS background images. For instance:
```html
<style>
input[value$=a] {
background-image: url(/char/a);
}
input[value$=b] {
background-image: url(/char/b);
}
</style>
<!-- It has first made the request for a, and then the request for b as the user typed -->
<input type="text" value="ab">
```
### Limitations
- This implementations only listens for a-z characters. To trigger the request for more characters, just add them to the alphabet array
- If the user types fast enough, or types the same character twice, the server is not going to be notified
- When typing the same letter twice, the image was already loaded, so no request is made (probably can be fixed)
|
16dee7f5-0bbe-4bbb-9f61-5a1368ea0f40 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-06-09T19:36:18", "repo_name": "tttsonev/ep-test-parent", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1097, "line_count": 27, "lang": "en", "doc_type": "text", "blob_id": "d7c5ef8848ed5c85f80dc3388ca87cb6cea85c0b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tttsonev/ep-test-parent | 269 | FILENAME: README.md | 0.235108 |
Clone the project to your machine : git clone
<br/>
The project is maven based, so you need to install java 8 and maven on your machine. This is the [How To document for Ubuntu](https://linuxize.com/post/how-to-install-apache-maven-on-ubuntu-18-04/)
<br/>
All runnable test classes are following the convention *Tests.java
<br/>
Tests are stored in folder [healthchecktest](https://github.com/tttsonev/ep-test-parent/tree/master/api-test/src/test/java/healthchecktest)
<br/>
# api-test
Start the test in console in project folder after checkout via command line :mvn clean test -Dtest=*Tests -Dspring.profiles.active=local -pl api-test
<br/>
Properties files (Spring boot configurations) are stored in resources/config [application-local.properties](https://github.com/tttsonev/ep-test-parent/blob/master/api-test/src/main/resources/config/application-local.properties)
<br/>
All tests classes extend [BaseTest](https://github.com/tttsonev/ep-test-parent/blob/master/api-test/src/main/java/com/ep/api/tests/BaseTest.java)
<br/>
Tests are using Spring RestTemaplate.
<br/>
|
31f161dd-e997-4a21-9721-3645da750717 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-02-10 18:20:03", "repo_name": "vadim6810/Heder-Kosher", "sub_path": "/code/AndroidApp/app/src/main/java/com/tr2016/hederkosher/utils/RestClient.java", "file_name": "RestClient.java", "file_ext": "java", "file_size_in_byte": 1117, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "666aabe70573f66e48f615e931d8c00cd9c1867c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/vadim6810/Heder-Kosher | 219 | FILENAME: RestClient.java | 0.261331 | package com.tr2016.hederkosher.utils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import rx.schedulers.Schedulers;
public class RestClient {
private static final String BASE_URL = "https://api.hk.inetextest.com/HederKosherApp";
private static Retrofit retrofitInstance;
static {
setupRestClient();
}
private RestClient() {
}
public static Retrofit get() {
return retrofitInstance;
}
private static void setupRestClient() {
Gson gson = new GsonBuilder()
.setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
.create();
RxJavaCallAdapterFactory rxAdapter = RxJavaCallAdapterFactory.createWithScheduler(Schedulers.io());
retrofitInstance = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.addCallAdapterFactory(rxAdapter)
.build();
}
}
|
dee01f66-1c7e-4c02-8412-fec939359468 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-21 12:54:44", "repo_name": "devosonder/event-sourcing-example", "sub_path": "/userservice/src/main/java/com/example/userservice/service/UserService.java", "file_name": "UserService.java", "file_ext": "java", "file_size_in_byte": 1181, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "4d3ad3aae424a13f5c576a799b43bf0623980512", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/devosonder/event-sourcing-example | 214 | FILENAME: UserService.java | 0.247987 | package com.example.userservice.service;
import com.example.userservice.event.UpdatedRoleEvent;
import com.example.userservice.model.UserServiceUser;
import com.example.userservice.repository.UserRepository;
import org.axonframework.eventhandling.EventHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
@Service
public class UserService {
private UserRepository userRepository;
@PostConstruct
public void init() {
UserServiceUser user = userRepository.save(new UserServiceUser("username1", "firstName", "LastName"));
System.out.println("user.getId() = " + user.getId());
}
@Autowired
public UserService(UserRepository userRepository) {
this.userRepository = userRepository;
}
public UserServiceUser create(UserServiceUser user) {
return userRepository.save(user);
}
public UserServiceUser get(String id) {
return userRepository.getOne(id);
}
@EventHandler
public void on(UpdatedRoleEvent event) {
System.out.println("event.roleName = " + event.roleName);
}
}
|
e1a1529e-6044-4029-9934-51797f33fc0e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-30 08:59:55", "repo_name": "lucifax301/chelizi", "sub_path": "/chelizi/school/src/main/java/com/lili/school/manager/impl/EnrollMaterialAddressManagerImpl.java", "file_name": "EnrollMaterialAddressManagerImpl.java", "file_ext": "java", "file_size_in_byte": 1222, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "22086a9e7f5defb838d4c3dce15e438ece53e153", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lucifax301/chelizi | 251 | FILENAME: EnrollMaterialAddressManagerImpl.java | 0.291787 | package com.lili.school.manager.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.lili.common.util.redis.RedisUtil;
import com.lili.common.util.redis.RedisKeys.REDISKEY;
import com.lili.school.dto.EnrollMaterialAddress;
import com.lili.school.dto.EnrollMaterialAddressExample;
import com.lili.school.manager.EnrollMaterialAddressManager;
import com.lili.school.mapper.EnrollMaterialAddressMapper;
public class EnrollMaterialAddressManagerImpl implements
EnrollMaterialAddressManager {
@Autowired
private EnrollMaterialAddressMapper enrollMaterialAddressMapper;
@Autowired
private RedisUtil redisUtil;
@Override
public int addEnrollMaterialAddress(EnrollMaterialAddress record) {
return enrollMaterialAddressMapper.insertSelective(record);
}
@Override
public int updateEnrollMaterialAddress(EnrollMaterialAddress record) {
redisUtil.delete(REDISKEY.ENROLL_MAIL_ONE + record.getTtid());
return enrollMaterialAddressMapper.updateByPrimaryKeySelective(record);
}
@Override
public List<EnrollMaterialAddress> getEnrollMaterialAddress(
EnrollMaterialAddressExample example) {
return enrollMaterialAddressMapper.selectByExample(example);
}
}
|
46b7df2c-b60e-4776-8de3-eea4cd98a1c6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-12-04T03:10:59", "repo_name": "p0sty/holiday-festive", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1080, "line_count": 33, "lang": "en", "doc_type": "text", "blob_id": "5250d55dadc848ea1336b638c82ad5786a92c931", "star_events_count": 4, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/p0sty/holiday-festive | 269 | FILENAME: README.md | 0.214691 | holiday-festive
===============
A simple festive animation for the Moorescloud Holiday light.
If you were lucky enough to own one, now archived here - https://web.archive.org/web/20140531015443/http://moorescloud.com:80/
I couldn't find one in the defaults, so I added one :D
Merry Christmas everyone :)
I've done it in bash because it runs locally on the light (when ssh'd through developer mode) and has few dependencies.
usage is ./festive.sh holidayipaddress.
NEW in 2021:
added start-christmascountdown.sh - 30 days from christmas the animation will get faster closer to christmas, then wind down to new years
can run directly on the holiday or on another bash supported device - if no host is specified it assumes it's running locally
usage ./start-christmascountdown.sh holidayIPaddress
NEW in 2017:
Added the ability to close your ssh window.
you can now start the animation with
./start-festive.sh
and stop with
./stop-festive.sh
this basically takes over the lights function completely, so if you want to use any of the other apps, you'll need to do this.
|
ecc52f6a-2bdb-4436-8b87-229d9f245be9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-06 17:11:07", "repo_name": "maurofama99/Progetto-Ingegneria-del-Software-2021", "sub_path": "/src/main/java/it/polimi/ingsw/observerPattern/Observable.java", "file_name": "Observable.java", "file_ext": "java", "file_size_in_byte": 985, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "c7650e085a3d02d4e6da402f4834b8bcbc0f6ee2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/maurofama99/Progetto-Ingegneria-del-Software-2021 | 191 | FILENAME: Observable.java | 0.277473 | package it.polimi.ingsw.observerPattern;
import it.polimi.ingsw.network.Message;
import java.io.IOException;
import java.util.ArrayList;
/**
* This observable class is used by the model to notify controller and virtual view
*/
public abstract class Observable {
/**
* List of observers
*/
private ArrayList<Observer> observers = new ArrayList<>();
/**
* Adds a new observer to the list of observers
* @param observer is the new observer
*/
public void addObserver(Observer observer){
observers.add(observer);
}
/**
* Send a notify to all the observers about a change
* @param message is the message that has to be notified to the observers
*/
public void notifyObserver(Message message){
observers.forEach(observer -> {
try {
observer.update(message);
} catch (IOException e) {
e.printStackTrace();
}
});
}
}
|
e8db063b-c57f-4025-b935-670af8fe204a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-03-16T18:07:16", "repo_name": "Jblanch94/restaurant-reviewy", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1039, "line_count": 13, "lang": "en", "doc_type": "text", "blob_id": "d424c27941f4d5c93029c20b9188f9736f165683", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Jblanch94/restaurant-reviewy | 207 | FILENAME: README.md | 0.249447 | # Restaurant Reviewy
What is Restaurant Reviewy?
Restaurant Reviewy at it's core is a reviewing application for restaurants. It provides user authentication so you know your data will be secure. Users can view reviews for different restaurants without having an account, but to leave a review must have an account and be logged in.
# Usage
Once the user opens the application they are brought to the dashboard where they can view all of the restaurants and click to see reviews for that restaurant. If they would like to sign up or login they can navigate to the Sign In page by clicking on Sign In in the navigation bar. If they choose to login or register they can now leave reviews for restaurants if they would like or they can update their profile by clicking on the avatar.
# Planned Features
Some features that are planned to be added in include: having an average rating for each restaurant, a search bar to filter restaurants by the user's input, and a way to filter by category.
# Live Version
https://restaurant-reviewy.com
|
f9f52f8b-f227-48b3-a1a7-8ee90a37451d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-28 06:34:53", "repo_name": "hoiwanjohnlouis/nyu-scps-android-F2014", "sub_path": "/hfad/ch02/BeerAdvisor/app/src/main/java/com/hfad/beeradvisor/FindBeerActivity.java", "file_name": "FindBeerActivity.java", "file_ext": "java", "file_size_in_byte": 1081, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "23069364b9c02cf665f14a8cb3f01e0d1e315061", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hoiwanjohnlouis/nyu-scps-android-F2014 | 202 | FILENAME: FindBeerActivity.java | 0.252384 | package com.hfad.beeradvisor;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Spinner;
import android.widget.TextView;
import java.util.List;
public class FindBeerActivity extends AppCompatActivity {
private BeerExpert beerExpert = new BeerExpert();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_find_beer);
}
public void onClickFindBeer(View view) {
TextView brands = (TextView) findViewById(R.id.brands);
Spinner beerColor = (Spinner) findViewById(R.id.beer_color);
String selectedBeerType = String.valueOf(beerColor.getSelectedItem());
//
List<String> brandsList = beerExpert.getBeerBrandsByColor(selectedBeerType);
StringBuilder brandsFormatted = new StringBuilder();
for (String brand : brandsList) {
brandsFormatted.append(brand).append('\n');
}
brands.setText(brandsFormatted);
}
}
|
03cf9ad0-d84f-4147-b9ae-bcb2fa7b099e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-19 13:49:56", "repo_name": "WangYouzheng1994/hyjf", "sub_path": "/hyjf-api/src/main/java/com/hyjf/activity/actdoubleeleven/bargain/PrizeBargainListResultBean.java", "file_name": "PrizeBargainListResultBean.java", "file_ext": "java", "file_size_in_byte": 1040, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "7472b12ae9850ece4d8d6f88953121968908eaef", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/WangYouzheng1994/hyjf | 255 | FILENAME: PrizeBargainListResultBean.java | 0.27513 | package com.hyjf.activity.actdoubleeleven.bargain;
import java.util.List;
import com.hyjf.base.bean.BaseResultBean;
import com.hyjf.common.paginator.Paginator;
import com.hyjf.mybatis.model.customize.act.ActNovBargainCustomize;
public class PrizeBargainListResultBean extends BaseResultBean {
/**
* 此处为属性说明
*/
private static final long serialVersionUID = -9174539916567994537L;
private List<ActNovBargainCustomize> dataList;
//分页信息
Paginator paginator;
public Paginator getPaginator() {
return paginator;
}
public void setPaginator(Paginator paginator) {
this.paginator = paginator;
}
public List<ActNovBargainCustomize> getDataList() {
return dataList;
}
public void setDataList(List<ActNovBargainCustomize> dataList) {
this.dataList = dataList;
}
@Override
public String toString() {
return super.toString() + "PrizeBargainListResultBean [dataList=" + dataList + ", paginator=" + paginator + "]";
}
}
|
3ebab83a-ccd5-4f59-bdce-f99ef23a739d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-10 03:47:48", "repo_name": "DawitSheno/Framework", "sub_path": "/AutomationTesting5/src/test/java/CandyTest.java", "file_name": "CandyTest.java", "file_ext": "java", "file_size_in_byte": 1156, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "290bae6c92347bb137071d354f30b98e890033ea", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DawitSheno/Framework | 261 | FILENAME: CandyTest.java | 0.264358 | import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class CandyTest {
public static void main(String[] args) throws InterruptedException {
WebDriver Driver = new ChromeDriver();
Driver.manage().window().maximize();
Driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
Driver.get("https://www.bbc.com/");
Thread.sleep(4000);
Driver.findElement(By.linkText("More")).click();
//Driver.findElement(By.linkText("Capital")).click();
Thread.sleep(3000);
Driver.findElement(By.id("orb-search-q")).sendKeys("Ethipian Prime Minister");
Driver.findElement(By.id("orb-search-button")).click();
String url = Driver.getTitle();
//String pageTitle = Driver.getCurrentUrl();
System.out.println(url);
if (url.equals("BBC - Search results for Ethipian Prime Minister")) {
System.out.println("we are on the right page");
}else
{
System.out.println("we are not the same page");
}
Driver.close();
}
}
|
dc0fd7db-e428-47cd-b2fa-f9e2641879e2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-23 10:00:04", "repo_name": "ShawnLeeLXY/spring-test", "sub_path": "/src/main/java/com/lxy/util/DynamicProxyUtil.java", "file_name": "DynamicProxyUtil.java", "file_ext": "java", "file_size_in_byte": 1239, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "d06fc8866663a083721b6cb48ad5f91a42fabb39", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ShawnLeeLXY/spring-test | 225 | FILENAME: DynamicProxyUtil.java | 0.261331 | package com.lxy.util;
import com.lxy.controller.TransactionHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
/**
* AOP测试:JDK动态代理
* 获取代理对象的工具类
* 增强功能:事务管理
*/
@Component
public class DynamicProxyUtil {
@Autowired
private TransactionHandler th;
public <T> T getProxyObject(Class<T> cls) {
Object proxyObj = Proxy.newProxyInstance(cls.getClassLoader(), cls.getInterfaces(), new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) {
Object res = null;
try {
th.begin();
res = method.invoke(cls.newInstance(), args);
th.commit();
} catch (Exception e) {
e.printStackTrace();
th.rollback();
} finally {
th.closeSession();
}
return res;
}
});
return (T) proxyObj;
}
}
|
70eeebad-84f9-4404-ab79-37b70dd8a6bf | {"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": "/mugui-block/src/main/java/com/mugui/block/TRC20/TronKit.java", "file_name": "TronKit.java", "file_ext": "java", "file_size_in_byte": 1221, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "933070518b2c48d903b811de18c944683d4bf2bd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yekainew/DC-world-android | 248 | FILENAME: TronKit.java | 0.274351 | package com.mugui.block.TRC20;
public class TronKit {
protected TronApi api;
protected Credential credential;
protected String defaultAddress;
public TronKit(TronApi api, Credential credential) {
this.api = api;
this.credential = credential;
this.defaultAddress = credential.getAddress().base58;
}
public String getDefaultAddress() {
return this.defaultAddress;
}
public TransactionResult sendTrx(String to, long amount) throws Exception {
TransferTransaction tx = api.createTransaction(to, amount, defaultAddress);
String signature = credential.sign(tx.txId);
tx.signature = new String[]{signature};
ApiResult state = api.broadcastTransaction(tx);
return new TransactionResult(state.txid, state.result, state.message);
}
public long getTrxBalance(String address) throws Exception {
Account account = api.getAccount(address);
return account.balance;
}
public Account getAccount(String address) throws Exception {
return api.getAccount(address);
}
public Trc20 trc20(String contractAddress) {
return new Trc20(api, credential, contractAddress);
}
} |
cdb62d95-6003-4ac0-83bf-929f54b19188 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-15 13:03:14", "repo_name": "LakshmiParamasivan/empdet2", "sub_path": "/empdet2/src/main/java/com/example/empdet2/Entity/DepartmentEntity.java", "file_name": "DepartmentEntity.java", "file_ext": "java", "file_size_in_byte": 1037, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "264c2a35d0f4055ae75896a390293dfbdebaa6dc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/LakshmiParamasivan/empdet2 | 234 | FILENAME: DepartmentEntity.java | 0.267408 | package com.example.empdet2.Entity;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.mapping.Set;
import javax.persistence.*;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
@Entity
@Getter
@Setter
@Table(name = "Department")
public class DepartmentEntity implements Serializable {
@Serial
private static final long serialVersionUID = 3308728889610662771L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "dep_id")
private Long depId;
@Column(name = "dep_name")
String depName;
@Column(name = "dep_projects")
String projects;
// @OneToMany(mappedBy = "department", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
// private Set<EmployeeEntity> employeeEntityList;
//public <EmployeeEntity> getEmployeeEntityList() {
// return employeeEntityList;
// }
//public void setEmployeeEntityList(Set<EmployeeEntity> employeeEntityList) {
// this.employeeEntityList = employeeEntityList;
// }
}
|
b718fab5-512d-49c1-9334-d31d960b03fd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-16 08:25:50", "repo_name": "zzxtz007/MyBatisTestByMaven", "sub_path": "/src/main/java/top/haha233/smbms/servlet/QueryUsersServlets.java", "file_name": "QueryUsersServlets.java", "file_ext": "java", "file_size_in_byte": 1154, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "b5deef9d3773f4d99c04ad868b91ff4ecf40b608", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zzxtz007/MyBatisTestByMaven | 226 | FILENAME: QueryUsersServlets.java | 0.245085 | package top.haha233.smbms.servlet;
import com.google.gson.Gson;
import top.haha233.smbms.service.impl.UserServiceImpl;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author Ice_Dog
*/
@WebServlet(name = "QueryUsersServlets", urlPatterns = {"/api/user/fuck"})
public class QueryUsersServlets extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("application/json;charset=utf-8");
String userName = request.getParameter("userName");
String userRole = request.getParameter("userRole");
String pageNum = request.getParameter("pageNum");
String pageSize = request.getParameter("pageSize");
Gson g = new Gson();
response.getWriter().print(g.toJson(
new UserServiceImpl().query(userName, userRole, pageSize, pageNum)));
}
}
|
6decff33-d179-4175-b4a2-c731f2a06042 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-22 02:18:27", "repo_name": "759126711/jetty9test", "sub_path": "/src/main/java/com/test/jetty/common/server/OneWebApp.java", "file_name": "OneWebApp.java", "file_ext": "java", "file_size_in_byte": 1312, "line_count": 36, "lang": "zh", "doc_type": "code", "blob_id": "ea81785f43b6b3c46e890a9238bb92329564045b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/759126711/jetty9test | 298 | FILENAME: OneWebApp.java | 0.26971 | package com.test.jetty.common.server;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AllowSymLinkAliasChecker;
import org.eclipse.jetty.webapp.WebAppContext;
import java.io.File;
import java.lang.management.ManagementFactory;
/**
* 以嵌入式方式发布一个war网站文件
*/
public class OneWebApp {
public static void main(String[] args) throws Exception {
Server server = new Server(8081);
// 设置 JMX
MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
server.addBean(mbContainer);
// 下面这个web应用是一个完整的web应用,在这个例子里设置/为根路径,web应用所有的配置都是有效的,
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
// File warFile = new File("D:\\softdev\\jetty9\\demo-base\\webapps\\test.war");
File warFile = new File("D:\\soft_dev\\jetty_9412\\demo-base\\webapps\\test.war");
webapp.setWar(warFile.getAbsolutePath());
webapp.addAliasCheck(new AllowSymLinkAliasChecker());
//将web应用设置到server里
server.setHandler(webapp);
server.start();
server.join();
}
} |
847f6d7b-eb94-48f9-b20b-56dc6dcebec2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-05-22 14:49:34", "repo_name": "iromos/LabelPet", "sub_path": "/LABEL_PROJECT/LabelCore/src/main/java/data/Bands.java", "file_name": "Bands.java", "file_ext": "java", "file_size_in_byte": 1023, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "8371d1683f16ade7a5ad04f29401faa4b9a536c1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/iromos/LabelPet | 233 | FILENAME: Bands.java | 0.242206 | package data;
import exception.LabelException;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
/**
* Created by Jackson on 08.05.2015.
*/
@XmlRootElement(name = "doc")
public class Bands {
private List<BandPOJO> bands;
private List<LabelException> exceptions;
@XmlElement(name = "band")
@XmlElementWrapper(name = "bands")
public List<BandPOJO> getBands() {
return bands;
}
public void setBands(List<BandPOJO> bands) {
this.bands = bands;
}
@XmlElement(name = "LabelError")
@XmlElementWrapper(name = "Errors")
public List<LabelException> getExceptions() {
return exceptions;
}
public void setExceptions(List<LabelException> exceptions) {
this.exceptions = exceptions;
}
@Override
public String toString() {
return "Bands=" + bands;
}
}
|
5ad01314-00aa-4ceb-92a6-716bb1d33a99 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-18 01:23:18", "repo_name": "jameszkw/demo", "sub_path": "/src/main/java/com/zkw/concurrent/java_Multithread_programmingbook/c4_1/c4_1_4/MyService.java", "file_name": "MyService.java", "file_ext": "java", "file_size_in_byte": 997, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "2f227e34fcfe36c76d02ddba85c70a5e0ceac102", "star_events_count": 4, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jameszkw/demo | 198 | FILENAME: MyService.java | 0.239349 | package com.zkw.concurrent.java_Multithread_programmingbook.c4_1.c4_1_4;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* ${DESCRIPTION}
*
* @author James
* @create 2017-09-14 下午 9:32
**/
public class MyService {
private Lock lock=new ReentrantLock();
public Condition condition=lock.newCondition();
public void await(){
lock.lock();
System.out.println(" await时间为 "+System.currentTimeMillis());
try {
condition.await();
} catch (InterruptedException e) {
e.printStackTrace();
}finally {
lock.unlock();
}
}
public void signal(){
try {
lock.lock();
System.out.println("signal时间为"+System.currentTimeMillis());
condition.signal();
}finally {
lock.unlock();
}
}
}
|
5fb84c5f-b337-43de-bc7f-b6dee9033772 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-08-17 07:23:24", "repo_name": "ITtrap/MySlidingMenu", "sub_path": "/app/src/main/java/com/xuchen/myslidingmenu/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1128, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "f2bd797cf7d40c40d8ccb38366c71f46593d7ce9", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ITtrap/MySlidingMenu | 225 | FILENAME: MainActivity.java | 0.252384 | package com.xuchen.myslidingmenu;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
/**
* z整体的侧滑菜单的实现是王一个帧布局中放置两个子布局。分别是bottom和top,我们只需要控制top的位移来显示bottom的
* 内容就呈现了侧滑的效果。
*/
public class MainActivity extends AppCompatActivity {
private MySlidingMenu slidingMenu;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//初始化
slidingMenu = (MySlidingMenu) findViewById(R.id.mysliding);
//映射view
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View top = inflater.inflate(R.layout.top, null);
View bottom = View.inflate(this, R.layout.bottom, null);
//给SlidingMenu添加两个View
slidingMenu.addBottom(bottom);
slidingMenu.addTop(top);
}
}
|
cc3bbf96-5e03-483f-8e7a-19203b3f217a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-03T20:52:17", "repo_name": "NicoN00b/chooseYourOwnAdventure", "sub_path": "/src/main/java/App.java", "file_name": "App.java", "file_ext": "java", "file_size_in_byte": 1081, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "1868590ca3ca68db548441ca2a06feb35505e875", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/NicoN00b/chooseYourOwnAdventure | 211 | FILENAME: App.java | 0.213377 | import Models.Game;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
/**
* Created by Guest on 8/3/17.
*/
public class App {
public static void main(String[] args) {
boolean GameStory = true;
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
try {
while (GameStory){
System.out.println("Welcome to your Morning ennui. Your alarm rudely woke you up and the Sun is blasting through your curtain, beckoning you to rouse. What do you do?");
Game newGame = new Game();
System.out.println(" ");
System.out.println("Should you 'get up' and face the day, or will you put your pillow over your head and go back to 'sleep' because there's nothing out there for you anyway.");
String playerResult = bufferedReader.readLine();
newGame.choiceEvaluator(playerOptions);
}
} catch (IOException e) {
e.printStackTrace();
}
}
} |
6144c947-76a0-42ac-a1c2-47fa7db2e7ae | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-09 14:35:51", "repo_name": "Minestom/ui", "sub_path": "/src/main/java/net/minestom/ui/Main.java", "file_name": "Main.java", "file_ext": "java", "file_size_in_byte": 1016, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "113591ee94719af24da94622d04a946454e3e2da", "star_events_count": 5, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/Minestom/ui | 216 | FILENAME: Main.java | 0.242206 | package net.minestom.ui;
import net.minestom.ui.panel.InstanceHierarchyPanel;
import net.minestom.ui.panel.PanelRegistry;
import net.minestom.ui.panel.TestPanel;
import net.minestom.ui.panel.entity.EntityEditor;
import net.minestom.ui.panel.nbt.NBTEditorPanel;
import net.minestom.ui.window.MainWindow;
import java.nio.file.Paths;
// Would be nice to add a demo window to showcase all of the MS- components.
// (opened with some combination of development menu, keybind, vm arg)
// Should add some debug menu to figure out the Minestom version (if possible) and vm info for debugging
public class Main {
public static void main(String[] args) {
Settings.init(Paths.get("."));
PanelRegistry.registerPanel(TestPanel.class);
PanelRegistry.registerPanel(InstanceHierarchyPanel.class);
PanelRegistry.registerPanel(NBTEditorPanel.class);
PanelRegistry.registerPanel(EntityEditor.class);
MainWindow window = new MainWindow();
window.display();
}
}
|
068815b8-da92-406d-9c7e-a70b060fddec | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2014-11-25T08:51:08", "repo_name": "enlacee/mySkype", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1043, "line_count": 53, "lang": "en", "doc_type": "text", "blob_id": "f0d7ef422d737410e2f468c4b539e5789c4e1cbf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/enlacee/mySkype | 284 | FILENAME: README.md | 0.275909 | # Send Message by Sell with python
## skype4py : [https://github.com/awahlig/skype4py](https://github.com/awahlig/skype4py)
Send many messages atomatic, with Skype.
Hi, start It. We install this app, would read this step
### Requirements
Your SO LINUX, (test in Ubuntu 13.10)
Is very likely that you already have installed
You nedd install **python 2.x**
###Step 1
Change name by terminal of **config.dist.py to config.py**
to variables of configuration:
mv config.dist.py config.py
###Step 2
Change these parameter:
user = '****' # userName Skype
timeSend = 5
messages = [
"message only read",
"hello what your time?",
"these is great",
"moon in the skype",
"live to back in story",
"You defends with Jack Newton",
"It is the fisrt class",
"Where are you estudent",
"do you is a mexican",
"I fine and you",
]
###Step 3
The file must have execution permission
sudo chmod 777 loopSkype.py
You should run the file in terminal
python loopSkype.py
|
fc33741a-070d-415b-96f3-9d520ebdb348 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-24 08:39:14", "repo_name": "LebronZhangJiaWen/silinmuye", "sub_path": "/silinmuye-web/src/main/java/com/muyenet/muye/interceptor/AdminLoginInterceptor.java", "file_name": "AdminLoginInterceptor.java", "file_ext": "java", "file_size_in_byte": 1082, "line_count": 28, "lang": "en", "doc_type": "code", "blob_id": "40c4ae4d81feb1880a64bbb88ff6b9f985bd195a", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/LebronZhangJiaWen/silinmuye | 217 | FILENAME: AdminLoginInterceptor.java | 0.240775 | package com.muyenet.muye.interceptor;
import com.muyenet.muye.common.utils.MemberUtil;
import com.muyenet.muye.core.utils.MuyeConfig;
import com.muyenet.muye.core.utils.SpringContextHolder;
import com.muyenet.muye.model.member.Member;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Created by zchuanzhao on 16/11/25.
*/
public class AdminLoginInterceptor implements MuyeInterceptor {
@Override
public boolean interceptor(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object handler) throws Exception {
Member loginAdmin = MemberUtil.getLoginMember(httpServletRequest);
if (loginAdmin == null || loginAdmin.getIsAdmin() == 0) {
MuyeConfig muyeConfig = SpringContextHolder.getBean("muyeConfig");
httpServletResponse.sendRedirect(httpServletRequest.getContextPath() + "/" + muyeConfig.getManagePath() + "/login");
return false;
}
httpServletRequest.setAttribute("loginUser", loginAdmin);
return true;
}
}
|
2fc43575-9015-4048-a1e9-5684fa12e700 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-09 18:50:47", "repo_name": "joaoreis/baking-app", "sub_path": "/app/src/main/java/br/com/joaoreis/bakingapp/service/models/Ingredients.java", "file_name": "Ingredients.java", "file_ext": "java", "file_size_in_byte": 1155, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "db5854874e132b0dde9acadc24f961a3597508b3", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/joaoreis/baking-app | 224 | FILENAME: Ingredients.java | 0.247987 | package br.com.joaoreis.bakingapp.service.models;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.List;
public class Ingredients implements Parcelable {
public static final Creator<Ingredients> CREATOR = new Creator<Ingredients>() {
@Override
public Ingredients createFromParcel(Parcel in) {
return new Ingredients(in);
}
@Override
public Ingredients[] newArray(int size) {
return new Ingredients[size];
}
};
List<Ingredient> ingredients;
public Ingredients(List<Ingredient> ingredients) {
this.ingredients = ingredients;
}
protected Ingredients(Parcel in) {
ingredients = in.createTypedArrayList(Ingredient.CREATOR);
}
public List<Ingredient> getIngredients() {
return ingredients;
}
public void setIngredients(List<Ingredient> ingredients) {
this.ingredients = ingredients;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeTypedList(ingredients);
}
}
|
a30d3f93-67fd-4c70-bcc7-1a34c26c0d0b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-19 09:04:49", "repo_name": "sholybell/hello_mq", "sub_path": "/src/main/java/com/syb/hello_mq/rabbitmq/consumer/DistributionReceiver11.java", "file_name": "DistributionReceiver11.java", "file_ext": "java", "file_size_in_byte": 1222, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "4f1d1cb9fa65b8c077d7b602c4e12884e5fec9da", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sholybell/hello_mq | 252 | FILENAME: DistributionReceiver11.java | 0.261331 | package com.syb.hello_mq.rabbitmq.consumer;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
@Component
public class DistributionReceiver11 {
/**
* 消费者A,根据生产者生产的.符号,决定休眠多少秒
*/
@SuppressWarnings("deprecation")
@RabbitListener(queues = "distribu")
public void processA(Message message) {
String msg = new String(message.getBody());
System.out.println(" DistributionReceiverA : " + msg);
SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSSS");
System.out.println(" ProccessingA... at " + time.format(new Date()));
try {
for (char ch : msg.toCharArray()) {
if (ch == '.') {
doWork(1000);
}
}
} catch (InterruptedException e) {
} finally {
System.out.println(" A Done! at " + time.format(new Date()));
}
}
private void doWork(long time) throws InterruptedException {
Thread.sleep(time);
}
} |
64aa2c53-912c-44c8-9c58-ed5278aaf956 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-20 09:37:11", "repo_name": "luismu78/EarthquakeObserver2", "sub_path": "/app/src/main/java/es/cervecitas/earthquakeobserver/presentation/ui/earthquakelist/EarthquakeListActivity.java", "file_name": "EarthquakeListActivity.java", "file_ext": "java", "file_size_in_byte": 1187, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "f65771a99de4613ec8e3085e43b87f670d9df891", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/luismu78/EarthquakeObserver2 | 215 | FILENAME: EarthquakeListActivity.java | 0.224055 | package es.cervecitas.earthquakeobserver.presentation.ui.earthquakelist;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import java.util.Objects;
import es.cervecitas.earthquakeobserver.R;
import es.cervecitas.earthquakeobserver.presentation.ui.common.BaseActivity;
import es.cervecitas.earthquakeobserver.presentation.ui.earthquakelist.view.EarthquakeListFragment;
public class EarthquakeListActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_earthquake_list);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Objects.requireNonNull(getSupportActionBar()).setTitle(R.string.app_name);
getSupportActionBar().setLogo(R.drawable.nav_logo);
if (getSupportFragmentManager().findFragmentByTag(EarthquakeListFragment.TAG) == null) {
getSupportFragmentManager()
.beginTransaction()
.add(R.id.content, new EarthquakeListFragment(), EarthquakeListFragment.TAG)
.commit();
}
}
}
|
3ad7ebcc-a8f2-4fde-a128-506c976c14f6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-24 19:06:57", "repo_name": "210119-java-enterprise/demos", "sub_path": "/java/restaurantWebapp/src/main/java/com/revature/util/JwtParser.java", "file_name": "JwtParser.java", "file_ext": "java", "file_size_in_byte": 1223, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "c2343b8005afbbc84fe8b60f4e31687f0805181f", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/210119-java-enterprise/demos | 211 | FILENAME: JwtParser.java | 0.271252 | package com.revature.util;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import com.revature.pojo.Principal;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
public class JwtParser {
public static void checkToken(HttpServletRequest req) {
// get HTTP cookie named authorization
String token = "";
Cookie[] cookies = req.getCookies();
for (Cookie cookie : cookies) {
if (cookie.getName().equals("token")) {
token = cookie.getValue();
}
}
try {
// automatically decrypts
Claims claims = Jwts.parser()
.setSigningKey("super-secret-key")
.parseClaimsJws(token)
.getBody();
Principal principal = new Principal();
principal.setId(Integer.parseInt(claims.getId()));
principal.setUsername(claims.getSubject());
principal.setFirstName(claims.get("firstName", String.class));
req.setAttribute("principal", principal);
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
fc33e6ac-02ee-46ec-8e9d-8720d6d0c8c2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-28 07:57:09", "repo_name": "wangmengzhong/supacer", "sub_path": "/punch_auth/src/main/java/com/wmz/auth/test.java", "file_name": "test.java", "file_ext": "java", "file_size_in_byte": 1017, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "4ddff2ec2a79442426b09db8995df7f04efa2d9a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wangmengzhong/supacer | 296 | FILENAME: test.java | 0.291787 | package com.wmz.auth;
import java.util.List;
import org.springframework.boot.devtools.autoconfigure.RemoteDevToolsProperties.Debug;
public class test {
public static void main(String[] args) {
List s=null;
System.out.println(s.isEmpty());
/*int s=1;
int a=Integer.valueOf(s);
Double d=2.1;
//System.out.println(String.valueOf(d));
Object [] obj=new Object[]{1,"ss"};
for(int i=0;i<obj.length;i++){
System.out.println(obj[i].toString());
}*/
}
public static boolean sql_check(Object [] obj) {
for(int i=0;i<obj.length;i++){
return sql_inj(obj[i].toString());
}
return false;
}
public static boolean sql_inj(String str) {
String inj_str = "’|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare|;|or|-|+|,|--";
String inj_stra[] = inj_str.split("|");
for (int i=0 ; i < inj_stra.length ; i++ )
{
if (str.indexOf(inj_stra[i])>=0)
{
return true;
}
}
return false;
}
}
|
c69fa437-e6fa-4431-a673-0fa7aebc6877 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-02-23T03:15:00", "repo_name": "sinkers/golapse", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1044, "line_count": 20, "lang": "en", "doc_type": "text", "blob_id": "37b15329eb1d95feb0d795aa7352fcad5c2b2538", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sinkers/golapse | 238 | FILENAME: README.md | 0.236516 | # golapse
Simple timelapse recorder for a gopro camera designed to run on a small Raspberry Pi or equivalent machine with 2 NICs so that it can connect to the GoPro which has closed wifi and also to an external network.
The whole setup has been built to run off a solar powered rig so can be placed remotely and is weather proof.
Features include
* Take a photo every x seconds
* Retrieves the photo from the gopro
* Store the photos to a local file server order by year/month/day/hour/seconds
* Detects a level of black in the photo so doesn't store night time photos
* Upload the latest photo to S3 so it can be served out to the web
Upcoming features
* Convert previous period photos to a video timelapse
* Upload timelapse videos
* Archive old footage as a more efficient h265 or VP9 given change between images is mostly low
* Make the network connection particularly to the GoPro more robust and able to auto start
* Add logging
* Make it so that after so many black images it powers off for some time but powers on before first light
|
37876c3a-9214-44d5-a041-2bbb4b352685 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-23 07:08:31", "repo_name": "yigangGitHubNew/distributeProject", "sub_path": "/springCloudConfig/springboot-mybatis/src/main/java/org/spring/springboot/basejava/treads/synchronize/SynchrDubbo.java", "file_name": "SynchrDubbo.java", "file_ext": "java", "file_size_in_byte": 1169, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "7e95c6753cae4706e12ee2a7798bb5b943750237", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yigangGitHubNew/distributeProject | 209 | FILENAME: SynchrDubbo.java | 0.259826 | package org.spring.springboot.basejava.treads.synchronize;
/**
* 可重入锁的继承
*/
public class SynchrDubbo {
static class Main{
int count = 5;
public synchronized void operationSub(){
count--;
System.out.println("Main class print count is "+ count);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
static class Sub extends Main{
public synchronized void operationSub(){
while (count > 0){
count--;
System.out.println("Sub print count is "+count);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
new Thread(new Runnable() {
@Override
public void run() {
Sub sub = new Sub();
sub.operationSub();
}
}).start();
}
}
}
|
49a05ad5-7647-49fd-ac91-b5b2200fc743 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-12-09 00:57:40", "repo_name": "landaire/media-player", "sub_path": "/src/main/java/org/madhatters/mediaplayer/database/MediaDBTest.java", "file_name": "MediaDBTest.java", "file_ext": "java", "file_size_in_byte": 1179, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "ba80504c385620c0c5d22ac74cd134f937e1d961", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/landaire/media-player | 249 | FILENAME: MediaDBTest.java | 0.274351 | package org.madhatters.mediaplayer.database;
import org.madhatters.mediaplayer.media.AudioFile;
import org.madhatters.mediaplayer.media.FileFinder;
import java.util.Collection;
import java.util.Iterator;
public class MediaDBTest {
public static void main(String[] args) {
MediaDB mediaPlayer;
mediaPlayer = new MediaDB();
FileFinder allFiles;
allFiles = new FileFinder();
System.out.println("START");
Collection<AudioFile> songs;
songs = allFiles.findIn("C:/Users/Joey/Music");
System.out.println("DONE");
mediaPlayer.addAudioFiles(songs);
Collection<AudioFile> allSongs = mediaPlayer.getAudioFiles();
Iterator<AudioFile> itr = allSongs.iterator();
while (itr.hasNext()) {
AudioFile curSong = itr.next();
System.out.println("Song: " + curSong.getSongTitle());
System.out.println("Artist: " + curSong.getArtistName());
System.out.println("Album: " + curSong.getAlbum());
System.out.println("Filepath: " + curSong.getFilePath());
System.out.println();
}
mediaPlayer.closeDB();
}
}
|
6228ea70-f3f2-4770-8e45-515b465252a1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-01-26 06:26:49", "repo_name": "johnjiang611/MyApplication", "sub_path": "/commonlibrary/src/main/java/com/tpad/common/utils/GsonUtils.java", "file_name": "GsonUtils.java", "file_ext": "java", "file_size_in_byte": 1187, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "86610181cbcff16ea46a7803fab620538bd55bfd", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/johnjiang611/MyApplication | 266 | FILENAME: GsonUtils.java | 0.295027 | package com.tpad.common.utils;
import com.google.gson.Gson;
import com.google.gson.JsonParseException;
import com.google.gson.JsonParser;
import java.lang.reflect.Type;
/**
* @author jone.sun on 2015/3/24.
*/
public class GsonUtils {
private static Gson gson = new Gson();
public static Gson getGson() {
return gson;
}
public static String toJson(Object obj) {
return gson.toJson(obj);
}
public static <T> T loadAs(String json, Class<T> clazz) throws Exception {
return gson.fromJson(json, clazz);
}
public static <T> T loadAs(String json, Type type) throws Exception {
return gson.fromJson(json, type);
}
// public static <T> List<T> loadAsList(String json, Class<T> clazz)
// throws Exception {
// return gson.fromJson(json, new TypeToken<List<T>>() {
// }.getType());
// }
public static boolean isGoodJson(String json) {
if (json == null || json.isEmpty()) {
return false;
}
try {
new JsonParser().parse(json);
return true;
} catch (JsonParseException e) {
return false;
}
}
}
|
8e2284f6-2de2-4b4f-8793-b766598ebb55 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-04 06:54:41", "repo_name": "cx422803902/ng2-blog-server", "sub_path": "/src/main/java/org/goiot/controller/model/Tag.java", "file_name": "Tag.java", "file_ext": "java", "file_size_in_byte": 986, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "46a12d879354e8a98140adda5900d410bdeacce1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/cx422803902/ng2-blog-server | 218 | FILENAME: Tag.java | 0.258326 | package org.goiot.controller.model;
import org.goiot.core.base.Builder;
import org.goiot.entity.BlogTagEntity;
/**
* Created by chenxing on 2017/7/30.
*/
public class Tag {
private Long id;
private String name;
private Integer count;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static class TagBuilder extends Builder<Tag> {
public TagBuilder appendTagEntity(BlogTagEntity tagEntity) {
Tag tag = super.getInstance();
tag.setId(tagEntity.getId());
tag.setName(tagEntity.getName());
tag.setCount(tagEntity.getBlogCount());
return this;
}
}
}
|
ebdabe00-c5fc-4e01-9a21-e073be5f5b91 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-26 21:14:35", "repo_name": "jduranmaster/HTTP-Web-Server-Proof-Of-Concept", "sub_path": "/src/main/java/com/jdm/http/webserver/interceptor/UserAuthenticator.java", "file_name": "UserAuthenticator.java", "file_ext": "java", "file_size_in_byte": 994, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "66205c8db5c75857499d8669f29af81bf6f13500", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/jduranmaster/HTTP-Web-Server-Proof-Of-Concept | 189 | FILENAME: UserAuthenticator.java | 0.252384 | package com.jdm.http.webserver.interceptor;
import java.security.NoSuchAlgorithmException;
import com.jdm.http.webserver.model.MD5;
import com.jdm.http.webserver.model.Password;
import com.jdm.http.webserver.model.User;
import com.jdm.http.webserver.repository.IUserRepository;
public class UserAuthenticator {
private final IUserRepository userRepository;
private final MD5 passwordEncrypter;
public UserAuthenticator(IUserRepository userRepository) throws NoSuchAlgorithmException {
this.userRepository = userRepository;
this.passwordEncrypter = new MD5();
}
public User authenticateUser(String username, Password password){
User user = this.userRepository.findUserByUsername(username);
if (user != null) {
Password cypheredpassword = passwordEncrypter.cypher(password);
if (cypheredpassword.equals(user.getPassword())) {
return user;
}
}
return null;
}
}
|
a521630c-081c-4dfa-8040-123e9fd5710e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-26 09:00:44", "repo_name": "zanxu2016/demo", "sub_path": "/core/src/main/java/com/example/demo/core/rabbitmq/delay/RabbitConfig.java", "file_name": "RabbitConfig.java", "file_ext": "java", "file_size_in_byte": 1167, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "c2a50cd5f80c9b53d65ab99ce21a883c52b2c5b7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zanxu2016/demo | 250 | FILENAME: RabbitConfig.java | 0.220007 | package com.example.demo.core.rabbitmq.delay;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
public class RabbitConfig {
//rabbitmq 连接工厂
private final ConnectionFactory RAB_FACTORY = new ConnectionFactory();
private Connection connection;
public void init() throws Exception {
//rabbitmq 服务器地址
String SERVER_HOST = "127.0.0.1";
RAB_FACTORY.setHost(SERVER_HOST);
//端口号
int PORT = 5672;
RAB_FACTORY.setPort(PORT);
//用户名
String USER_NAME = "guest";
RAB_FACTORY.setUsername(USER_NAME);
//密码
String PASSWORD = "guest";
RAB_FACTORY.setPassword(PASSWORD);
this.connection = RAB_FACTORY.newConnection();
}
public Connection getConnection() {
return connection;
}
public void setConnection(Connection connection) {
this.connection = connection;
}
public boolean isQUEUE_SAVE() {
//队列是否持久化
return true;
}
public String getMESSAGE_SAVE() {
//消息持久化 1,0
return "1";
}
}
|
9f31d764-db2f-4469-afc6-c4809ac47981 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-06-05 02:59:40", "repo_name": "kyoodong/SMSAdvertisement", "sub_path": "/SMSMaster/app/src/main/java/com/ironfactory/smsmasterapplication/entities/ChargeCoinEntity.java", "file_name": "ChargeCoinEntity.java", "file_ext": "java", "file_size_in_byte": 1155, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "eb69533238670fe6da00de175d77cb3494cd14d5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kyoodong/SMSAdvertisement | 257 | FILENAME: ChargeCoinEntity.java | 0.252384 | package com.ironfactory.smsmasterapplication.entities;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by IronFactory on 2016. 5. 14..
*/
public class ChargeCoinEntity {
private String PROPERTY_CHARGE_COIN_ID = "charge_coin_id";
private String PROPERTY_CHARGE_COIN_PRICE = "charge_coin_price";
private String id;
private int price;
public ChargeCoinEntity(JSONObject object) {
try {
if (!object.get(PROPERTY_CHARGE_COIN_ID).equals(null))
id = object.getString(PROPERTY_CHARGE_COIN_ID);
if (!object.get(PROPERTY_CHARGE_COIN_PRICE).equals(null))
price = object.getInt(PROPERTY_CHARGE_COIN_PRICE);
} catch (JSONException e) {
e.printStackTrace();
}
}
public ChargeCoinEntity(String id, int price) {
this.id = id;
this.price = price;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
}
|
af513792-a148-4550-8217-ff611096ca4b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-17 01:57:26", "repo_name": "keni0k/tanks", "sub_path": "/src/main/java/ru/keni0k/game/tanks/controllers/WorldController.java", "file_name": "WorldController.java", "file_ext": "java", "file_size_in_byte": 1181, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "df638d5ca51bf82057f57f1f1a9f5a0c8e6e47be", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/keni0k/tanks | 251 | FILENAME: WorldController.java | 0.283781 | package ru.keni0k.game.tanks.controllers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import ru.keni0k.game.tanks.services.WorldService;
import ru.keni0k.game.tanks.utils.MapAndIds;
import ru.keni0k.game.tanks.utils.MapItem;
import ru.keni0k.game.tanks.utils.PATH;
@Controller
@RequestMapping(PATH.WORLD)
public class WorldController {
private WorldService service;
@Autowired
public WorldController(WorldService tankService) {
service = tankService;
}
@MessageMapping("/world/init")
@SendTo("/topic/init")
public MapAndIds getInitialWorld(Long worldId) {
if (worldId == -1) {
return service.initWorld();
} else {
return service.addNewTank(worldId);
}
}
@MessageMapping("/world/map")
@SendTo("/topic/map")
public MapItem[][] getWorldMap(Long worldId) {
return service.getWorldMap(worldId);
}
}
|
b258b30c-e582-49dd-9900-9c96196a0ff3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-29 09:02:01", "repo_name": "darkprize/nvChart", "sub_path": "/app/src/main/java/andcom/nvchart/util/NvChartDB.java", "file_name": "NvChartDB.java", "file_ext": "java", "file_size_in_byte": 1235, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "f516440465b1ce7ea6c1471900d1ae291580fe61", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/darkprize/nvChart | 261 | FILENAME: NvChartDB.java | 0.26588 | package andcom.nvchart.util;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast;
public class NvChartDB extends SQLiteOpenHelper {
private Context context;
public NvChartDB(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
this.context = context;
}
@Override
public void onCreate(SQLiteDatabase db) {
// String 보다 StringBuffer가 Query 만들기 편하다.
StringBuffer sb = new StringBuffer();
sb.append(" CREATE TABLE NVCHART ( ");
sb.append(" DB_NO INTEGER NOT NULL, ");
sb.append(" NODEKEY TEXT NOT NULL, ");
sb.append(" NVDATA BLOB ,");
sb.append(" PRIMARY KEY(DB_NO,NODEKEY)) ");
// SQLite Database로 쿼리 실행
db.execSQL(sb.toString());
}
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//Toast.makeText(context, "DB의 버전이 올라갔습니다.", Toast.LENGTH_SHORT).show();
}
public void testDB() {
SQLiteDatabase db = getReadableDatabase();
}
}
|
e26374b1-c1ae-4a4e-b957-bd90483feadd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-29 08:48:44", "repo_name": "maulanakurnia/movie-room", "sub_path": "/app/src/main/java/com/maulanakurnia/movieroom/ui/viewmodel/UserViewModel.java", "file_name": "UserViewModel.java", "file_ext": "java", "file_size_in_byte": 1223, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "c934b21b557701fab7516348d168a09d37cde54e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/maulanakurnia/movie-room | 242 | FILENAME: UserViewModel.java | 0.277473 | package com.maulanakurnia.movieroom.ui.viewmodel;
import android.app.Application;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import com.maulanakurnia.movieroom.data.AppRepository;
import com.maulanakurnia.movieroom.data.model.User;
/**
* Created by Maulana Kurnia on 6/4/2021
* Keep Coding & Stay Awesome!
**/
public class UserViewModel extends AndroidViewModel {
public AppRepository repository;
public UserViewModel(@NonNull Application application) {
super(application);
repository = new AppRepository(application);
}
public LiveData<User> login(String username, String password) {
return repository.login(username,password);
}
public LiveData<User> checkUsername(String username) {
return repository.checkUsername(username);
}
public void insert(User user) {
repository.register(user);
}
public void update(User user) {
repository.updateUser(user);
}
public void updatePassword(User user) {
repository.updatePassword(user);
}
public LiveData<User> getUser(Integer id) {
return repository.getUser(id);
}
}
|
8aef4626-7497-4899-b061-b8a9f780de38 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-12 01:42:07", "repo_name": "JccY-stu/-", "sub_path": "/src/main/java/com/southwind/mmall002/controller/Verifi/RegVerification.java", "file_name": "RegVerification.java", "file_ext": "java", "file_size_in_byte": 1337, "line_count": 42, "lang": "zh", "doc_type": "code", "blob_id": "1fce217e8dea7f5d124ce3034cf94d3e98694515", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/JccY-stu/- | 300 | FILENAME: RegVerification.java | 0.267408 | package com.southwind.mmall002.controller.Verifi;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 接收前端传来的验证码
* 与Redis里保存的value进行对比
* 相同则写入数据库
* 否则提示出错
* @param Key 用户验证码在Redis里保存的键名
* @param scan_code 是用户输入的验证码
* @param redisTemplate 处理Redis
* @param user 需要写入数据库的对象
*/
@Controller
public class RegVerification {
/**
* 验证 验证码
* @param loginNameOne
* @param scan_code
* @param redisTemplate
* @return
*/
@ResponseBody
public Boolean Verfication(String loginNameOne, String scan_code, RedisTemplate redisTemplate){
String o = (String) redisTemplate.opsForValue().get(loginNameOne);
System.out.println("Redis中存储的正确的验证码为:" + o);
System.out.println("用户输入的验证码为:" + scan_code);
if(o.equals(scan_code)) {
System.out.println("验证码正确");
//调用Mapper写入数据库
return true;
}
else System.out.println("很抱歉,您的验证码有误,请重试");
return false;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.