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 |
|---|---|---|---|---|---|---|
82de7e5b-bb58-4eee-848c-7dd951e838ed | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-03 13:28:32", "repo_name": "fakerbrother/citic_demo", "sub_path": "/src/main/java/com/citic/demo/service/impl/UserProductServiceImpl.java", "file_name": "UserProductServiceImpl.java", "file_ext": "java", "file_size_in_byte": 990, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "b380370afa7e08ee6c58b13f9a2145fff535494c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/fakerbrother/citic_demo | 187 | FILENAME: UserProductServiceImpl.java | 0.264358 | package com.citic.demo.service.impl;
import com.citic.demo.dao.UserProductRepository;
import com.citic.demo.entity.UserProductPO;
import com.citic.demo.service.UserProductService;
import com.citic.demo.vo.UserProductVO;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserProductServiceImpl implements UserProductService {
private final UserProductRepository userProductRepository;
public UserProductServiceImpl(UserProductRepository userProductRepository) {
this.userProductRepository = userProductRepository;
}
@Override
public void purchaseProduct(UserProductVO requestVo) {
UserProductPO po = new UserProductPO();
po.setName(requestVo.getProductName());
po.setUserId(requestVo.getUserId());
userProductRepository.save(po);
}
@Override
public List<UserProductPO> getUserProducts(Integer userId) {
return userProductRepository.findByUserId(userId);
}
}
|
c8131ce2-a9df-4d71-882b-f4be7e4f3714 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-10-23 16:33:15", "repo_name": "huangshiqiang/demo", "sub_path": "/code/cn.elwy.editor/src/main/java/cn/elwy/editor/action/ActionDynamicMenu.java", "file_name": "ActionDynamicMenu.java", "file_ext": "java", "file_size_in_byte": 1082, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "a4c40a5f01b97c48826b538c80116eb1cfded140", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/huangshiqiang/demo | 240 | FILENAME: ActionDynamicMenu.java | 0.26588 | package cn.elwy.editor.action;
import java.util.Date;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
/**
* 动态菜单
* @author huangsq
* @version 1.0, 2013-12-27
* @since 1.0, 2013-12-27
*/
public class ActionDynamicMenu extends ContributionItem {
public ActionDynamicMenu(String name) {
}
@Override
public void fill(Menu menu, int index) {
MenuItem menuItem = new MenuItem(menu, SWT.CHECK, index);
menuItem.setText("My menu item (" + new Date() + ")");
menuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
System.err.println("Dynamic menu selected");
}
});
System.err.println("Fill Dynamic Menu");
}
@Override
public boolean isDynamic() {
return true;
}
} |
4dab020f-151e-42f0-834a-311d93b3a70c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-11-11 04:07:17", "repo_name": "toff63/esper", "sub_path": "/temperature-controller/src/main/java/net/francesbagual/github/esper/EsperEngine.java", "file_name": "EsperEngine.java", "file_ext": "java", "file_size_in_byte": 1052, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "3b4e96375f749eee64d6dea4652206373e25e886", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/toff63/esper | 208 | FILENAME: EsperEngine.java | 0.250913 | package net.francesbagual.github.esper;
import com.espertech.esper.client.Configuration;
import com.espertech.esper.client.EPServiceProvider;
import com.espertech.esper.client.EPServiceProviderManager;
import com.espertech.esper.client.EPStatement;
import com.espertech.esper.client.UpdateListener;
public class EsperEngine {
private EPServiceProvider epService;
public void start(){
Configuration config = new Configuration();
config.addEventTypeAutoName("net.francesbagual.github.esper");
epService = EPServiceProviderManager.getDefaultProvider(config);
registerListeners();
}
private void registerListeners() {
registerListener(new MonitorEventListener());
registerListener(new WarningEventListener());
registerListener(new ErrorEventListener());
}
private void registerListener(UpdateListenerWithExpression listener){
EPStatement statement = epService.getEPAdministrator().createEPL(listener.getExpression());
statement.addListener(listener);
}
public EPServiceProvider getEpService() {
return epService;
}
}
|
a774710c-7969-4bf9-8850-59ee17f9dfc0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-11 18:58:17", "repo_name": "lucasstarsz/jfxtras-styles", "sub_path": "/jmetro--samples/src/main/java/jfxtras/styles/jmetro/OverridingStylesheetSample.java", "file_name": "OverridingStylesheetSample.java", "file_ext": "java", "file_size_in_byte": 1000, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "dbdb85595c73d271144d5bc1e70511c7b10e4e47", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lucasstarsz/jfxtras-styles | 196 | FILENAME: OverridingStylesheetSample.java | 0.271252 | package jfxtras.styles.jmetro;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class OverridingStylesheetSample extends Application {
private static final String SLIDER_RESOURCE = "JMetro Slider.fxml";
static final private Style STYLE = Style.LIGHT;
@Override
public void start(Stage primaryStage) throws Exception{
System.setProperty("prism.lcdtext", "false");
Parent root = FXMLLoader.load(getClass().getResource(SLIDER_RESOURCE));
primaryStage.setTitle("JMetro");
JMetro jMetro = new JMetro(root, STYLE);
jMetro.getOverridingStylesheets().add(OverridingStylesheetSample.class.getResource("overriding-sample.css").toExternalForm());
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
|
48a6e3d0-3296-4660-a546-84598a9a7eb1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-20 07:45:39", "repo_name": "September31st/CleanDemo", "sub_path": "/app/src/main/java/com/example/mylo/cleandemo/domain/usecase/ZhihuUseCase.java", "file_name": "ZhihuUseCase.java", "file_ext": "java", "file_size_in_byte": 1037, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "2b86664289223e1a001da399cd49688915ff43ea", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/September31st/CleanDemo | 258 | FILENAME: ZhihuUseCase.java | 0.264358 | package com.example.mylo.cleandemo.domain.usecase;
import android.util.Log;
import com.example.mylo.cleandemo.domain.entity.ZhihuNewsEntity;
import com.example.mylo.cleandemo.domain.exception.ApiException;
import com.example.mylo.cleandemo.domain.repository.ZhihuRepository;
import org.reactivestreams.Publisher;
import io.reactivex.Flowable;
public class ZhihuUseCase extends UseCase<ZhihuNewsEntity, Void> {
private final ZhihuRepository mZhihuRepository;
public ZhihuUseCase(ZhihuRepository zhihuRepository) {
mZhihuRepository = zhihuRepository;
}
public Flowable<ZhihuNewsEntity> buildUseCaseObservable(Void aVoid) {
return mZhihuRepository.getMainList()
.flatMap(this::handleException);
}
private Publisher<ZhihuNewsEntity> handleException(ZhihuNewsEntity zhihuNewsList) {
if (zhihuNewsList == null) {
return Flowable.error(new ApiException(0, "数据为空,请求个毛线!"));
}
return Flowable.just(zhihuNewsList);
}
}
|
5efd3d50-a9ff-4538-a8ac-b29c865f8d70 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-01-27T11:28:24", "repo_name": "vanadium23/cf-metrics", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1017, "line_count": 35, "lang": "en", "doc_type": "text", "blob_id": "e1f07fba4773b0dfb67b2f6a6273846d6bf33c21", "star_events_count": 11, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/vanadium23/cf-metrics | 255 | FILENAME: README.md | 0.225417 | # Cloudflare metrics worker
Send your page views from [Cloudflare worker](https://developers.cloudflare.com/workers/) to InfluxDB.

## Requirements
1. Your site need to be setup behind Cloudflare CDN.
2. You need to setup InfluxDB with external access (make sure you have set [authentication](https://docs.influxdata.com/influxdb/v1.7/administration/authentication_and_authorization/#set-up-authentication))
1. Make sure InfluxDB is hosted under [supported port](https://blog.cloudflare.com/cloudflare-now-supporting-more-ports/) for Workers. Best option is 80 or 443.
## How to use
1. Install wrangler package
```
npm i @cloudflare/wrangler -g
```
2. Copy example files
```
cp .env.example .env
cp wrangler.toml.example wrangler.toml
```
3. Deploy your worker to a site with wrangler
```
wrangler publish --env production
```
4. (Optional) If you're using Grafana with InfluxDB, then you can import [example Dashboard](static/dashboard.json) from first screen.
|
1b059a80-57b5-4468-84b6-f5fc6fe55cfa | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-07-21T04:43:19", "repo_name": "jgm/skylighting", "sub_path": "/skylighting-core/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1025, "line_count": 22, "lang": "en", "doc_type": "text", "blob_id": "c0b2167eb115649f670d46c6e1e275e89fc65457", "star_events_count": 172, "fork_events_count": 77, "src_encoding": "UTF-8"} | https://github.com/jgm/skylighting | 239 | FILENAME: README.md | 0.200558 | skylighting-core
================
[](https://opensource.org/licenses/BSD-3-Clause)
[](https://travis-ci.org/jgm/skylighting-core)
This package provides the core functionality of the Skylighting project,
a Haskell syntax highlighting library with support for KDE XML syntax
highlighting descriptions.
Formatters are no longer included in this package: see
`skylighting-format-ansi`, `skylighting-format-blaze-html`,
`skylighting-format-context`, and `skylighting-format-latex`.
For details on how to use this package, see the Haddock documentation and
the [Skylighting README](https://github.com/jgm/skylighting/blob/master/skylighting/README.md).
The Haskell code and related files in this package are licensed under
the BSD3 license. This package also includes KDE XML syntax definitions
which are provided under various licenses; see the XML files for
details.
|
578108e0-3bd0-43a6-9f4e-9c0643214b0c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-14 14:03:58", "repo_name": "Nebulous03/LoreEngine2D-V7", "sub_path": "/LoreEngine-Core/src/main/java/loreEngine/core/graphics/vertex/VertexBuffer.java", "file_name": "VertexBuffer.java", "file_ext": "java", "file_size_in_byte": 1031, "line_count": 60, "lang": "en", "doc_type": "code", "blob_id": "046575d60927a4c19bf2ac6e136c5571a0ef0300", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Nebulous03/LoreEngine2D-V7 | 254 | FILENAME: VertexBuffer.java | 0.29584 | package loreEngine.core.graphics.vertex;
import static org.lwjgl.opengl.GL15.*;
import java.nio.FloatBuffer;
import org.lwjgl.system.MemoryUtil;
public class VertexBuffer {
private FloatBuffer data;
private int bufferID;
private int vecSize;
private int size;
public VertexBuffer(float[] data, int vecSize) {
this.size = data.length;
this.vecSize = vecSize;
this.data = MemoryUtil.memAllocFloat(data.length);
this.data.put(data).flip();
bufferID = glGenBuffers();
glBindBuffer(GL_ARRAY_BUFFER, bufferID);
glBufferData(GL_ARRAY_BUFFER, this.data, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
public void delete() {
glDeleteBuffers(bufferID);
}
public void bind() {
glBindBuffer(GL_ARRAY_BUFFER, bufferID);
}
public void unbind() {
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
public FloatBuffer getData() {
return data;
}
public int getBufferID() {
return bufferID;
}
public int getVecSize() {
return vecSize;
}
public int getSize() {
return size;
}
}
|
08fa5a34-5b1c-4360-8b8d-1728e5390f15 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-08-11 15:11:41", "repo_name": "fengg5241/aircon", "sub_path": "/bizproject/src/main/java/com/panasonic/b2bacns/bizportal/persistence/Groupcategory.java", "file_name": "Groupcategory.java", "file_ext": "java", "file_size_in_byte": 1053, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "cc8124fcc042275f3b0593c4f5a7b4386e06bdf1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/fengg5241/aircon | 211 | FILENAME: Groupcategory.java | 0.243642 | package com.panasonic.b2bacns.bizportal.persistence;
import java.io.Serializable;
import javax.persistence.*;
/**
* The persistent class for the groupcategory database table.
*
*/
@Entity
@Table(name="groupcategory")
@NamedQuery(name="Groupcategory.findAll", query="SELECT g FROM Groupcategory g")
public class Groupcategory implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(unique=true, nullable=false)
private Integer groupcategoryid;
@Column(nullable=false, length=128)
private String groupcategoryname;
public Groupcategory() {
}
public Integer getGroupcategoryid() {
return this.groupcategoryid;
}
public void setGroupcategoryid(Integer groupcategoryid) {
this.groupcategoryid = groupcategoryid;
}
public String getGroupcategoryname() {
return this.groupcategoryname;
}
public void setGroupcategoryname(String groupcategoryname) {
this.groupcategoryname = groupcategoryname;
}
} |
f71ae962-39b7-43bc-ab3e-3de06f81e056 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-13 13:32:39", "repo_name": "liuxianshengCn/vcircle", "sub_path": "/vcircle/src/main/java/com/v/circle/cloud/base/ErrorController.java", "file_name": "ErrorController.java", "file_ext": "java", "file_size_in_byte": 1155, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "36a891350354338e0468d6a9e00fbe97178a7cca", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/liuxianshengCn/vcircle | 240 | FILENAME: ErrorController.java | 0.218669 | package com.v.circle.cloud.base;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @Author Dell
* @Date 2018/1/24 10:56
* @Description 公共异常统一处理类
*/
@Slf4j
@ControllerAdvice
public class ErrorController {
@ExceptionHandler(value = RestException.class)
@ResponseBody
public ResultDto errorHandler(RestException e){
ResultDto resultDto = new ResultDto();
resultDto.setResultCode(e.getErrorCode());
resultDto.setResultMessage(e.getErrorMessage());
resultDto.setResultModel(e);
log.error("主动异常",e);
return resultDto;
}
@ExceptionHandler(value = Exception.class)
@ResponseBody
public ResultDto errorHandler(Exception e){
ResultDto resultDto = new ResultDto();
resultDto.setResultCode("2001");
resultDto.setResultMessage(e.getMessage());
resultDto.setResultModel(e);
log.error("系统异常",e);
return resultDto;
}
}
|
3d04a6c9-ca55-4226-906d-3fa9c39f0915 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-10 07:48:02", "repo_name": "MatiasEJ/java-hotel-apirest", "sub_path": "/src/main/java/com/hotel/model/entity/Habitacion.java", "file_name": "Habitacion.java", "file_ext": "java", "file_size_in_byte": 1120, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "f80664206e606eb4999af8a4ea48c70d5994fff6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MatiasEJ/java-hotel-apirest | 238 | FILENAME: Habitacion.java | 0.271252 | package com.hotel.model.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.*;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "habitaciones")
public class Habitacion extends BaseEntity{
@Column(nullable = false)
private String num_id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "tipo_hab_id")
@JsonIgnoreProperties({"hibernateLazyInitializer","handler"})
private TipoHabitacion tipo_hab;
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "tematica_id")
@JsonIgnoreProperties({"hibernateLazyInitializer","handler"})
private Tematica tematica;
@Column(nullable = false)
private double precio_noche;
public Habitacion(double precio_noche, String num_id) {
this.precio_noche = precio_noche;
this.num_id = num_id;
}
@Builder
public Habitacion(Long id,double precio_noche) {
super(id);
this.precio_noche = precio_noche;
}
}
|
264276f4-b4e0-49c0-bb00-5b8fbdc3ea35 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-10-15 04:44:24", "repo_name": "lowpitched/m-picker", "sub_path": "/m-picker/src/com/mlh/util/JDBCUtil.java", "file_name": "JDBCUtil.java", "file_ext": "java", "file_size_in_byte": 1057, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "02158631e6a495f61db7ec8d08b374df47d7d251", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lowpitched/m-picker | 226 | FILENAME: JDBCUtil.java | 0.274351 | package com.mlh.util;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
import com.mbag.log.LogTools;
public class JDBCUtil {
public static Properties property;
static{
try {
property = new Properties();
property.load(JDBCUtil.class.getResourceAsStream("db.properties"));
} catch (IOException e) {
e.printStackTrace();
LogTools.e(JDBCUtil.class, e.getMessage(),e);
}
}
public static Connection getConnection(){
try {
Class.forName(property.getProperty("driverClass"));
String url = property.getProperty("jdbcUrl");
String userName = property.getProperty("user");
String password = property.getProperty("password");
return DriverManager.getConnection(url,userName,password);
} catch (ClassNotFoundException e) {
e.printStackTrace();
LogTools.e(JDBCUtil.class, e.getMessage(),e);
} catch (SQLException e) {
e.printStackTrace();
LogTools.e(JDBCUtil.class, e.getMessage(),e);
}
return null;
}
}
|
d8a46c5c-a886-433f-a1b5-7fa6b28864de | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-16 23:59:43", "repo_name": "ETdvlpr/Traffic-system", "sub_path": "/ITS/netbeans project/src/com/GUI/theme.java", "file_name": "theme.java", "file_ext": "java", "file_size_in_byte": 1007, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "a1fa0f9dd3a3e60848d89f5a53f3c81568bfe31f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ETdvlpr/Traffic-system | 219 | FILENAME: theme.java | 0.280616 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.GUI;
import com.Pages.MainWindow;
import java.awt.Font;
/**
*
* @author dave
*/
public class theme {
public static Font font;
public static String wd;
public static String OS;
static {
reset();
}
public static void reset() {
OS = System.getProperty("os.name");
if ("Linux".equals(OS) || "Mac OS X".equals(OS)) {
wd = MainWindow.data.get("working directory", "/usr/local/traffic/");
} else if (OS.startsWith("Windows")) {
wd = MainWindow.data.get("working directory", "C:\\traffic\\");
} else {
throw new RuntimeException("Unsupported Operating System");
}
font = new Font(MainWindow.data.get("LF_style", "Bookman Old Style"), Font.PLAIN, MainWindow.data.getInt("LF_size", 16));
}
}
|
7bc94b0f-91e1-4c62-b170-a655b5b3c69d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-11-07 08:18:32", "repo_name": "honj51/tn_abt", "sub_path": "/abt-service/src/main/java/com/tuniu/abt/service/issue/IssueResultReporter.java", "file_name": "IssueResultReporter.java", "file_ext": "java", "file_size_in_byte": 1037, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "1d1cafdd21e696d834af4c6a3234eaa849fefc92", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/honj51/tn_abt | 210 | FILENAME: IssueResultReporter.java | 0.217338 | package com.tuniu.abt.service.issue;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.tuniu.abt.intf.dto.issue.response.IssueResponse;
import com.tuniu.abt.utils.RestClientComponent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* Created by huangsizhou on 2016/03/14.
*/
@Component
public class IssueResultReporter {
private static final Logger LOGGER = LoggerFactory.getLogger(IssueResultReporter.class);
@Resource
private RestClientComponent restClientComponent;
public void processCallback(String url, IssueResponse issueResponse) {
if(LOGGER.isInfoEnabled()){
LOGGER.info("出票反馈{}", JSON.toJSONString(issueResponse));
}
restClientComponent.query(url, HttpMethod.POST, JSON.toJSONString(issueResponse, SerializerFeature.DisableCircularReferenceDetect), 3000);
}
}
|
87f5aebb-df0b-446b-b0cd-bc9bee85e96a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-02-27 12:28:04", "repo_name": "Kostersson/Kostajabot", "sub_path": "/src/kostajabot/core/Channel.java", "file_name": "Channel.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "8ec5e7723fcf34740282ad8ed6c137bd5783a876", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Kostersson/Kostajabot | 226 | FILENAME: Channel.java | 0.236516 |
package kostajabot.core;
import java.util.ArrayList;
import kostajabot.core.exceptions.*;
/**
*
* @author Kostersson
*/
public class Channel {
private final String channelName;
private final String network;
private ArrayList<String> users;
public Channel(String channelName, String network) {
this.channelName = channelName;
this.network = network;
this.users = new ArrayList<>();
}
public String getChannelName() throws NoChannelNameException{
if(channelName.isEmpty()){
throw new NoChannelNameException();
}
return channelName;
}
public String getNetwork() throws NoNetworkException{
if(network.isEmpty()){
throw new NoNetworkException();
}
return network;
}
public void addUser(String user){
users.add(user);
}
public ArrayList<String> getUsers() {
return users;
}
@Override
public String toString() {
return channelName + " @ " + network + "\n===============\n" + users + "\n===============\n";
}
}
|
c4283c92-79f4-4ebd-b81a-ebde56ca0fd0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-27 21:34:05", "repo_name": "datacite/mds", "sub_path": "/src/main/java/org/datacite/mds/web/api/controller/StatusController.java", "file_name": "StatusController.java", "file_ext": "java", "file_size_in_byte": 1089, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "d7280be2ff90a662503ee24aa018a977dae7bf89", "star_events_count": 14, "fork_events_count": 12, "src_encoding": "UTF-8"} | https://github.com/datacite/mds | 187 | FILENAME: StatusController.java | 0.239349 | package org.datacite.mds.web.api.controller;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.datacite.mds.service.HandleException;
import org.datacite.mds.service.HandleService;
import org.datacite.mds.web.api.ApiController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class StatusController implements ApiController {
@PersistenceContext
EntityManager em;
@Autowired
HandleService handleService;
@RequestMapping(value = "/status")
public ResponseEntity<String> status() throws HandleException {
checkDatabaseConnection();
handleService.ping();
return new ResponseEntity<String>("OK", null, HttpStatus.OK);
}
private void checkDatabaseConnection() {
em.createNativeQuery("SELECT 1").getSingleResult();
}
}
|
81ceaf35-f836-46fc-b5e8-709726be19ec | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-11 10:28:09", "repo_name": "Yurwar/registration-form", "sub_path": "/src/main/java/com/yurwar/model/dao/impl/JDBCDaoFactory.java", "file_name": "JDBCDaoFactory.java", "file_ext": "java", "file_size_in_byte": 1079, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "b624e0bb907d602bbb03eac97e7100ba0ccbce74", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Yurwar/registration-form | 189 | FILENAME: JDBCDaoFactory.java | 0.253861 | package com.yurwar.model.dao.impl;
import com.yurwar.model.dao.DaoFactory;
import com.yurwar.model.dao.RecordDao;
import java.io.FileReader;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
public class JDBCDaoFactory extends DaoFactory {
@Override
public RecordDao createRecordDao() {
return new JDBCRecordDao(getConnection());
}
private Connection getConnection() {
Properties properties = new Properties();
try {
properties.load(new FileReader("src/main/resources/db.properties"));
} catch (IOException e) {
e.printStackTrace();
}
try {
return DriverManager.getConnection(
properties.getProperty("datasource.url"),
properties.getProperty("datasource.user"),
properties.getProperty("datasource.password")
);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
|
b82710d6-ce5f-439b-878b-21f5d64369c9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-28 10:02:08", "repo_name": "amelielaurent/appnews", "sub_path": "/app/src/main/java/com/newsgobelins/user/appnews/database/DatabaseHelper.java", "file_name": "DatabaseHelper.java", "file_ext": "java", "file_size_in_byte": 1023, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "14de48b4bffdc9b2aad37a9a4225cc3a9b4da982", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/amelielaurent/appnews | 186 | FILENAME: DatabaseHelper.java | 0.247987 | package com.newsgobelins.user.appnews.database;
import android.content.Context;
import java.util.concurrent.Callable;
import androidx.room.Room;
import bolts.Continuation;
import bolts.Task;
public class DatabaseHelper {
private static NewsDatabase database;
public static void init(final Context context) {
Task.callInBackground(new Callable<Void>()
{
@Override
public Void call() throws Exception {
database = Room.databaseBuilder(context, NewsDatabase.class, "news-db")
.fallbackToDestructiveMigration()
.build();
return null;
}
}).continueWith(new Continuation<Void, Void>() {
@Override
public Void then(Task<Void> task) throws Exception {
return null;
}
}, Task.UI_THREAD_EXECUTOR); //retourne sur le thread principal
}
public static NewsDatabase getDatabase() {
return database;
}
} |
1857fee7-540c-4bb7-a447-f4c634ae200f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-04 14:21:56", "repo_name": "YuriiAndreitsev/java-concurrency-training", "sub_path": "/src/main/com/exchanger/goldmine/OrcWarehouseWorker.java", "file_name": "OrcWarehouseWorker.java", "file_ext": "java", "file_size_in_byte": 1046, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "6f51a46726caf1b3a6776beaddc556b28c9b938e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/YuriiAndreitsev/java-concurrency-training | 211 | FILENAME: OrcWarehouseWorker.java | 0.268941 | package main.com.exchanger.goldmine;
import java.util.concurrent.Exchanger;
import java.util.concurrent.TimeUnit;
public class OrcWarehouseWorker implements Runnable {
private String name;
private final Exchanger<Integer> ex;
private Warehouse warehouse;
private int cart = 0;
private int receivedGold = 0;
private final GoldMine mine;
public OrcWarehouseWorker(String name, Exchanger<Integer> ex, Warehouse warehouse, GoldMine mine) {
this.name = name;
this.ex = ex;
this.warehouse = warehouse;
this.mine = mine;
}
@Override
public void run() {
while (mine.getGold() >= 0) {
try {
receivedGold = ex.exchange(cart);
TimeUnit.MILLISECONDS.sleep(100);
warehouse.setGold(warehouse.getGold()+receivedGold);
System.out.println(name + " : Warehouse has : " + warehouse + "]");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
} |
84012c18-e920-4233-9f13-acb773481757 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-01 10:44:06", "repo_name": "hubangmao/knowledge", "sub_path": "/Android知识点/框架/课堂封装框架/启动相册照相裁剪图片框架/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1052, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "4401311e1c877591a8106e9de1e7bfe02cb114e8", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hubangmao/knowledge | 204 | FILENAME: MainActivity.java | 0.220007 | package cn.ucai.test2;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
/**
* 模拟QQ下载安装
*/
public class MainActivity extends AppCompatActivity {
private ImageView mImageView;
OnSetAvatarListener mOnSetAvatarListener;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mImageView = (ImageView) findViewById(R.id.iv_test);
}
//调用系统下载
public void onClick(View v) {
mOnSetAvatarListener = new OnSetAvatarListener(this, R.id.relative, "fileName");
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode != RESULT_OK) {
return;
}
mOnSetAvatarListener.setAvatar(requestCode, data, mImageView);
}
}
|
1c364412-cca9-4fa2-8a3f-52d75d90a85a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-01 04:12:13", "repo_name": "robin1995dhillon/HockeySimulation", "sub_path": "/src/main/java/dhl/leagueModel/FreeAgents.java", "file_name": "FreeAgents.java", "file_ext": "java", "file_size_in_byte": 1052, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "37eb1479d671c4989ce37f43c95916c02f2e4e85", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/robin1995dhillon/HockeySimulation | 225 | FILENAME: FreeAgents.java | 0.259826 | package dhl.leagueModel;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.List;
@JsonDeserialize(as = FreeAgents.class)
public class FreeAgents extends AllPlayers implements IFreeAgents {
public FreeAgents() {
super();
}
@Override
public IFreeAgents getFreeAgentFromList(List<IFreeAgents> freeAgentList, String freeAgentName) {
for (IFreeAgents freeAgent : freeAgentList) {
if (freeAgent.getPlayerName().equals(freeAgentName)) {
return freeAgent;
}
}
return null;
}
@Override
public List<IFreeAgents> removeFreeAgents(List<IFreeAgents> freeAgentsList) {
ArrayList<IFreeAgents> newFreeAgentList = new ArrayList<>();
for(IFreeAgents freeAgents: freeAgentsList) {
if(this.equals(freeAgents)) {
continue;
} else {
newFreeAgentList.add(freeAgents);
}
}
return newFreeAgentList;
}
}
|
b975f8be-e2a5-45c9-988d-8d067e0e7fdd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-09-18T19:57:10", "repo_name": "chedaroo/Leytech_PrototypeUpdate", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1019, "line_count": 36, "lang": "en", "doc_type": "text", "blob_id": "d17e7e7b667e5f25b2b0eea9ea535682cb31b05c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/chedaroo/Leytech_PrototypeUpdate | 235 | FILENAME: README.md | 0.195594 | ## Update Prototype JavaScript library for Magento 1
A Magento 1 extension to cleanly update the Prototype Javascript library to 1.7.2 (or other versions).
### Features
- Provides an admin option to cleanly update the Prototype library to version 1.7.1, 1.7.2 or 1.7.3
- Does not affect the load order of Javascript resources so Prototype still loads first
- Does not require any layout XML updates
- Does not rewrite any core blocks or models
- Cleanly coded to avoid conflicts with other extensions
### Compatibility
Tested on Magento CE 1.9.3.x. Should work on lower versions ( >= 1.7) and equivalent EE.
### How to use?
1. Enable the extension under System -> Configuration -> Leytech Extensions.
2. Select the desired Prototype version.
3. Refresh caches and test.
### Screenshots
Maybe coming soon...
### To do
1. Nothing really. Feature requests welcome.
### Support
This extension is provided free of charge as-is. We don't provide free support.
### Contribute
Pull requests and feedback welcome. |
6f2d1159-1563-4098-ae20-fa87eae86bb6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-28 07:21:16", "repo_name": "liiibpm/easyexcel-demo", "sub_path": "/src/main/java/top/lrshuai/excel/exceltool/dropdown/service/OccupationDropDownService.java", "file_name": "OccupationDropDownService.java", "file_ext": "java", "file_size_in_byte": 1155, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "2d41d0398ed133eaa0360dbdfaf78d248ed2a18f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/liiibpm/easyexcel-demo | 245 | FILENAME: OccupationDropDownService.java | 0.281406 | package top.lrshuai.excel.exceltool.dropdown.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.util.ObjectUtils;
import top.lrshuai.excel.exceltool.dict.entity.DictValue;
import top.lrshuai.excel.exceltool.dict.service.IDictValueService;
import top.lrshuai.excel.exceltool.utils.ApplicationContextUtils;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 职业的下拉 实现类
*/
public class OccupationDropDownService implements IDropDownService{
@Override
public String[] getSource(String typeValue) {
// 没法用 @Autowired 注入,所以用ApplicationContext
IDictValueService dictValueService = ApplicationContextUtils.getBean(IDictValueService.class);
List<DictValue> list = dictValueService.list(new LambdaQueryWrapper<DictValue>().eq(DictValue::getType, typeValue));
if(ObjectUtils.isEmpty(list)){
return null;
}
Set<String> collect = list.stream().map(DictValue::getValue).collect(Collectors.toSet());
return collect.toArray(new String[collect.size()]);
}
}
|
9f8d4686-40f1-40c5-8598-0e39bb2cdbdb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-03 08:52:45", "repo_name": "victsomie/spring-boot-soap-example", "sub_path": "/src/main/java/victor/users/UserEndpoint.java", "file_name": "UserEndpoint.java", "file_ext": "java", "file_size_in_byte": 1060, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "12ed480b58f4ae3684832b6d23951eba6dabfcd5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/victsomie/spring-boot-soap-example | 187 | FILENAME: UserEndpoint.java | 0.235108 | package victor.users;
import com.techprimers.spring_boot_soap_example.GetUserRequest;
import com.techprimers.spring_boot_soap_example.GetUserResponse;
import com.techprimers.spring_boot_soap_example.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
@Endpoint
public class UserEndpoint {
@Autowired
private UserService userService;
@PayloadRoot(namespace = "http://techprimers.com/spring-boot-soap-example", localPart = "getUserRequest")
@ResponsePayload
public GetUserResponse getUserRequest(@RequestPayload GetUserRequest userRequest){
GetUserResponse response = new GetUserResponse();
User user = userService.getUsers(userRequest.getName());
response.setUser(user);
return response;
}
}
|
b7bd7632-257a-487e-a553-c8e856399edd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-12 01:09:08", "repo_name": "Aran1018/SandW", "sub_path": "/android/app/src/main/java/com/triplebro/aran/sandw/managers/FirstPageManager.java", "file_name": "FirstPageManager.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "0e3f8ce4ab834ef3818f2deecfb506f252888b9c", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/Aran1018/SandW | 242 | FILENAME: FirstPageManager.java | 0.291787 | package com.triplebro.aran.sandw.managers;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import com.triplebro.aran.sandw.handlers.FirstPageHandler;
import com.triplebro.aran.sandw.services.NetworkCommunicationService;
public class FirstPageManager implements ServiceConnection {
private Context context;
private FirstPageHandler firstPageHandler;
public FirstPageManager(Context context, FirstPageHandler firstPageHandler) {
this.context = context;
this.firstPageHandler = firstPageHandler;
firstPageHandler.setFirstPageManager(this);
}
public void getGoodsInfo(){
Intent intent = new Intent(context, NetworkCommunicationService.class);
context.bindService(intent,this,Context.BIND_AUTO_CREATE);
}
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
NetworkCommunicationService.MyBinder myBinder = (NetworkCommunicationService.MyBinder) service;
myBinder.getGoodsInfo(context,firstPageHandler);
}
@Override
public void onServiceDisconnected(ComponentName name) {
}
}
|
a0cd190e-6bfd-400e-8476-7d6f81f3a228 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-09-03 14:09:34", "repo_name": "GrishaAngelov/gwt-bank", "sub_path": "/GWT-Bank/src/main/java/com/clouway/gwtbank/client/editor/UserEditor.java", "file_name": "UserEditor.java", "file_ext": "java", "file_size_in_byte": 1013, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "c14501063cb755f5cb72c6a2206ac5274ee20b5c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/GrishaAngelov/gwt-bank | 231 | FILENAME: UserEditor.java | 0.2227 | package com.clouway.gwtbank.client.editor;
import com.clouway.gwtbank.shared.UserProxy;
import com.clouway.gwtbank.shared.UserRequestFactory;
import com.google.gwt.core.client.GWT;
import com.google.gwt.editor.client.Editor;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.*;
import com.google.web.bindery.requestfactory.gwt.client.RequestFactoryEditorDriver;
/**
* @author Grisha Angelov <grisha.angelov@clouway.com>
*/
public class UserEditor extends Composite implements Editor<UserProxy> {
interface UserEditorUiBinder extends UiBinder<Widget, UserEditor> {
}
private static UserEditorUiBinder uiBinder = GWT.create(UserEditorUiBinder.class);
public UserEditor() {
initWidget(uiBinder.createAndBindUi(this));
}
@UiField
@Ignore
Label nameLabel;
@UiField
TextBox username;
@UiField
@Ignore
Label passwordLabel;
@UiField
PasswordTextBox password;
}
|
b1dcd34f-85eb-4355-9e3d-8a4961791000 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-29 10:03:56", "repo_name": "13616632061/TakeOut", "sub_path": "/app/src/main/java/com/example/administrator/takeout/bean/MultiItemView.java", "file_name": "MultiItemView.java", "file_ext": "java", "file_size_in_byte": 969, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "02c8f55628dc2a9c58516bc5021e97b346bbaaf1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/13616632061/TakeOut | 216 | FILENAME: MultiItemView.java | 0.228156 | package com.example.administrator.takeout.bean;
import com.chad.library.adapter.base.entity.MultiItemEntity;
/**
* Created by Administrator on 2018/8/28.
*/
public class MultiItemView<T> implements MultiItemEntity {
public static final int TITLE = 1;
public static final int BODY = 2;
public static final int FOOTER = 3;
private int itemType;
private T data;
private String goodsTypeName;
public String getGoodsTypeName() {
return goodsTypeName;
}
public void setGoodsTypeName(String goodsTypeName) {
this.goodsTypeName = goodsTypeName;
}
public MultiItemView(int itemType) {
this.itemType = itemType;
}
public void setItemType(int itemType) {
this.itemType = itemType;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
@Override
public int getItemType() {
return itemType;
}
}
|
79a2d5ba-7383-4c61-87c5-29237fbd1df4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-08-25 14:48:42", "repo_name": "MeetMeCJ/gcm", "sub_path": "/app/src/main/java/gcm/play/android/samples/com/gcmquickstart/fragment/FragmentPagerMain.java", "file_name": "FragmentPagerMain.java", "file_ext": "java", "file_size_in_byte": 1027, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "ea2aaa670308b2110b3bf6750b7fd831a5b5a95e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MeetMeCJ/gcm | 204 | FILENAME: FragmentPagerMain.java | 0.242206 | package gcm.play.android.samples.com.gcmquickstart.fragment;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
public class FragmentPagerMain extends FragmentPagerAdapter {
final int PAGE_COUNT = 2;
private String tabTitles[] = new String[]{"Chat", "Contacts"};
public FragmentPagerMain(FragmentManager fm) {
super(fm);
}
@Override
public int getCount() {
return PAGE_COUNT;
}
@Override
public Fragment getItem(int position) {
Fragment f = null;
switch (position) {
case 0:
f = FragmentMain.newInstance(FragmentMain.CHAT);
break;
case 1:
f = FragmentMain.newInstance(FragmentMain.CONTACT);
break;
}
return f;
}
@Override
public CharSequence getPageTitle(int position) {
return tabTitles[position];
}
} |
c7427807-db47-45ec-a08c-a3a2cfa5eed4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-16 06:03:28", "repo_name": "CorvetteCole/NOHS-Edge-Client", "sub_path": "/NOHSEdge/app/src/main/java/corve/nohsedge/SettingsFragment.java", "file_name": "SettingsFragment.java", "file_ext": "java", "file_size_in_byte": 1053, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "485384488ceb458501bc49cf0eaa1187caaa6a19", "star_events_count": 3, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/CorvetteCole/NOHS-Edge-Client | 188 | FILENAME: SettingsFragment.java | 0.249447 | package corve.nohsedge;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import static corve.nohsedge.MainActivity.minValue;
/**
* Created by Cole on 9/27/2017.
*/
public class SettingsFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
final Preference NumberPickerPref = this.findPreference("Notify_min");
NumberPickerPref.setSummary("Notifications will be sent " + minValue + " minutes before class starts");
NumberPickerPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
NumberPickerPref.setSummary("Notifications will be sent " + newValue + " minutes before class starts");
return true;
}
});
}
} |
a1ec58ec-d298-4e05-a6a1-fc60b0b110d9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-30 08:52:42", "repo_name": "KleinDevDE/TwitchBot", "sub_path": "/client/src/main/java/de/kleindev/twitchbot/utils/ArgonManager.java", "file_name": "ArgonManager.java", "file_ext": "java", "file_size_in_byte": 1021, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "7c9d89d8d8ba7d67da5546ac4ab30e22cf045cbe", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/KleinDevDE/TwitchBot | 248 | FILENAME: ArgonManager.java | 0.279042 | package de.kleindev.twitchbot.utils;
import de.kleindev.twitchbot.websocket.packets.auth.ArgonIterationPacket;
import de.mkammerer.argon2.Argon2;
import de.mkammerer.argon2.Argon2Helper;
public class ArgonManager {
private static Argon2 argon2;
public static int iterations;
public ArgonManager(Argon2 argon2){
ArgonManager.argon2 = argon2;
System.out.println("Check the best iterations for argon2...");
iterations = Argon2Helper.findIterations(argon2, 1000, 65536, 1);
System.out.println("Result: " + iterations + " iterations");
ArgonIterationPacket argonIterationPacket = new ArgonIterationPacket();
argonIterationPacket.setIterations(iterations);
argonIterationPacket.send("auth");
}
public static String hash(String string){
return argon2.hash(iterations, 65536, 1, string.toCharArray());
}
public static boolean verify(String hashed, String string){
return argon2.verify(hashed, string.toCharArray());
}
}
|
4a33ca1b-9e48-4702-bb0a-06a7fbb3bde5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-30 02:58:24", "repo_name": "newSue/aster", "sub_path": "/aster/src/main/java/com/bluestone/aster/job/NewBondsJob.java", "file_name": "NewBondsJob.java", "file_ext": "java", "file_size_in_byte": 1151, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "e540d18b30e63c0d682747f1e65ea416dd3b760b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/newSue/aster | 244 | FILENAME: NewBondsJob.java | 0.256832 | package com.bluestone.aster.job;
import com.bluestone.aster.biz.mapper.NewBondsDao;
import com.bluestone.aster.utils.time.SystemTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 一级债定时任务
* Created by lichong on 2016/10/9.
*/
@Service
@EnableScheduling
@Profile({"job","testjob","prodjob"})
public class NewBondsJob {
private static final Logger logger = LoggerFactory.getLogger(NewBondsJob.class);
@Autowired
private NewBondsDao newBondsDao;
//每天晚上更新状态
@Scheduled(cron="${NewBond.Cron.Expression}")
@Transactional
public void updateState(){
logger.info("New bond job fired");
newBondsDao.updateStateAlready(SystemTime.asDate());
newBondsDao.updateStateIs(SystemTime.asDate());
}
}
|
e1a88eab-7e25-4861-b9d1-b29f4e50ea2f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-22 06:14:10", "repo_name": "JackpotHan/Logistics-management-platform", "sub_path": "/lmp-base/src/main/java/com/jackpot/base/encrypt/MD5.java", "file_name": "MD5.java", "file_ext": "java", "file_size_in_byte": 1111, "line_count": 41, "lang": "zh", "doc_type": "code", "blob_id": "a44fed75e71ba3cdb0f8382483160896e39bfcb1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JackpotHan/Logistics-management-platform | 265 | FILENAME: MD5.java | 0.282196 | package com.jackpot.base.encrypt;
import com.jackpot.base.base.BaseUtil;
import com.jackpot.base.utils.StrConvertUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.security.MessageDigest;
/**
* @Author: Hanjt
* @Date: 2018/8/2 12:49
* @Description: MD5加密
*/
public final class MD5 {
private static final Logger LOGGER = LoggerFactory.getLogger(MD5.class);
public static String encode(String content) {
return encode(content, BaseUtil.UTF8);
}
/**
* Md5加密 返回值全部大写
* @param messge
* @param encoding
* @return md5 result
*/
public static String encode(String messge, String encoding) {
try {
MessageDigest mdInst = MessageDigest.getInstance("MD5");
mdInst.update(messge.getBytes(encoding));// 使用指定的字节更新摘要
byte[] md = mdInst.digest();// 获得密文
return StrConvertUtil.byteArrToHexStr(md).toUpperCase();
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
return null;
}
}
}
|
9317adb4-fc83-4f5a-849a-03e291459c36 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-07 20:42:22", "repo_name": "almiso/GiffyApp", "sub_path": "/app/src/main/java/org/almiso/giffy/network/implementation/util/RetrofitUrlBuilder.java", "file_name": "RetrofitUrlBuilder.java", "file_ext": "java", "file_size_in_byte": 1074, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "54ddaf7007b1db075dd19ebd9f4dc518a71df932", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/almiso/GiffyApp | 206 | FILENAME: RetrofitUrlBuilder.java | 0.290176 | package org.almiso.giffy.network.implementation.util;
import android.net.Uri;
import android.support.annotation.NonNull;
import org.almiso.giffy.network.core.request.NetworkRequest;
import org.almiso.giffy.network.core.request.NetworkRequestPath;
import org.almiso.giffy.network.core.util.UrlBuilder;
import java.net.MalformedURLException;
import java.net.URL;
public class RetrofitUrlBuilder implements UrlBuilder {
/* Data */
private NetworkRequest networkRequest;
/* Constructor */
public RetrofitUrlBuilder(@NonNull NetworkRequest networkRequest) {
this.networkRequest = networkRequest;
}
@Override
public URL createUrl() throws MalformedURLException {
return createPostUrl();
}
private URL createPostUrl() throws MalformedURLException {
NetworkRequestPath path = networkRequest.getRequestPath();
Uri uri = new Uri.Builder()
.scheme(path.getScheme())
.authority(path.getAuthority())
.build();
return new URL(uri.toString());
}
}
|
7cc06794-cdda-4c54-9301-3a8b68ef937b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-12 08:32:51", "repo_name": "Cynthia0329/Android", "sub_path": "/addressBook/01-本次项目的安卓工程/Contact/app/src/main/java/com/cqnu/chenyudan/activity/Alarm/AlarmActivity.java", "file_name": "AlarmActivity.java", "file_ext": "java", "file_size_in_byte": 1223, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "b8609db50029964388c97ce4de5447e0a6203e79", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Cynthia0329/Android | 231 | FILENAME: AlarmActivity.java | 0.258326 | package com.cqnu.chenyudan.activity.Alarm;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TimePicker;
import com.cqnu.chenyudan.R;
/**
* 事务提醒,设置提醒时间
*/
public class AlarmActivity extends AppCompatActivity {
private TimePicker alarmTimePicker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alarm);
/*寻找时间控件*/
alarmTimePicker = (TimePicker) findViewById(R.id.alarm_time_tp);
}
/*点击进入编辑事务提醒内容*/
public void edit(View view) {
//获取要设置的提醒时间
String hour = alarmTimePicker.getCurrentHour().toString();
String minute = alarmTimePicker.getCurrentMinute().toString();
Intent intent = new Intent(AlarmActivity.this, AlarmEditActivity.class);
//向下一个页面传入提醒时间
intent.putExtra("hour",hour);
intent.putExtra("minute",minute);
AlarmActivity.this.startActivity(intent);
}
}
|
0f0a63d5-5d7c-4984-978f-3689f5aeb109 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-04-04T18:43:18", "repo_name": "wilsonj24/Message-Coder-Decoder", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1042, "line_count": 22, "lang": "en", "doc_type": "text", "blob_id": "4fea211ec85ceb32ba679286ac5260709fcbf02b", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wilsonj24/Message-Coder-Decoder | 218 | FILENAME: README.md | 0.284576 |
### Project: Message Coder/Decoder
### By: Jordan Wilson
# About:
This project was designed to show how one can encrypt and decrypt passwords with an associated key.
Users are given the opportunity to create a private message and send it to other users
but they can only view the message with the key associated with the message. This
project emphasizes security along with sending other users private messages that they
would not want anyone else to see. Feel free to check out the repo. Thanks!
## How to run:
Simply clone the repo to your local machine and make sure you have python installed. After
you have those installed you can navigate to the folder with the file and run it. From
here you can run the encoder program. Once you do so, you can simply type in a message and
have the program encrypt it for you. Once you have your encrypted message you can run
the decoder program and type in your encrypted message. After that it will ask you for your
unlock key. Once you insert your key, you should see your message decrypted.
|
fa507a05-5cfe-4ce5-ad9e-a3b652125c84 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-17 05:02:01", "repo_name": "sandeepk1210/recipe", "sub_path": "/src/main/java/com/sandeep/recipe/service/ConfigServicesImpl.java", "file_name": "ConfigServicesImpl.java", "file_ext": "java", "file_size_in_byte": 982, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "cec9ffea142821a21e93cb32e38bf37a8d629133", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sandeepk1210/recipe | 215 | FILENAME: ConfigServicesImpl.java | 0.272799 | package com.sandeep.recipe.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sandeep.recipe.dao.ConfigDao;
import com.sandeep.recipe.tables.Cuisine;
import com.sandeep.recipe.tables.Ingredient;
import com.sandeep.recipe.tables.Person;
@Service
public class ConfigServicesImpl implements ConfigServices {
@Autowired
private ConfigDao configDao;
public List<Cuisine> getCuisine() {
return configDao.getCuisine();
}
public void addCuisine(Cuisine cuisine) {
configDao.addCuisine(cuisine);
}
public void deleteCuisine(int id) {
configDao.deleteCuisine(id);
}
public List<Person> getPerson() {
return configDao.getPerson();
}
public void addPerson(Person person) {
configDao.addPerson(person);
}
public void deletePerson(int id) {
configDao.deletePerson(id);
}
public List<Ingredient> getIngredient() {
return configDao.getIngredient();
}
}
|
14b82d1a-4d37-49f0-9e6c-e9cc83e1c551 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-03-16 17:04:30", "repo_name": "sahil085/IskconGhaziabad", "sub_path": "/src/main/java/iskcongzb/dao/DaoClasses/UserLoginDaoImp.java", "file_name": "UserLoginDaoImp.java", "file_ext": "java", "file_size_in_byte": 992, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "e560b171aef07776e741ff9722b9c0fc4f3ca688", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/sahil085/IskconGhaziabad | 182 | FILENAME: UserLoginDaoImp.java | 0.259826 | package iskcongzb.dao.DaoClasses;
import iskcongzb.dao.DaoInterfaces.UserLoginDao;
import iskcongzb.domain.User;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserLoginDaoImp implements UserLoginDao {
@Autowired
SessionFactory sessionFactory;
public User getAuthenticate(User user) {
Session session=sessionFactory.openSession();
try
{
Query query=session.createQuery("from User where email=:email and password=:password");
query.setParameter("email",user.getEmail());
query.setParameter("password",user.getPassword());
return (User)query.uniqueResult();
}catch (Exception e)
{
System.out.println(e);
return null;
}finally {
session.close();
}
}
}
|
2e10871f-69ce-45d8-ada1-922fc8c17d25 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-27 11:38:47", "repo_name": "Hopeful-Developers/topggwebhooks4j", "sub_path": "/src/main/java/me/hopedev/topggwebhooks/PathCollection.java", "file_name": "PathCollection.java", "file_ext": "java", "file_size_in_byte": 1061, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "30d70dee00d27b6f31f1674d5d556a55b03e0f2a", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Hopeful-Developers/topggwebhooks4j | 209 | FILENAME: PathCollection.java | 0.23793 | package me.hopedev.topggwebhooks;
import me.hopedev.topggwebhooks.bots.BotWebhookListener;
import me.hopedev.topggwebhooks.enums.ListenerType;
import me.hopedev.topggwebhooks.servers.GuildWebhookListener;
public class PathCollection {
private final String context;
private final ListenerCollection listenerCollection;
public PathCollection(String context, ListenerCollection listenerCollection) {
this.context = context;
this.listenerCollection = listenerCollection;
}
public String getContext() {
return this.context;
}
public ListenerCollection getListenerCollection() {
return this.listenerCollection;
}
public ListenerType getListenerType() {
if (this.getListenerCollection().getListener() instanceof BotWebhookListener) {
return ListenerType.BOT;
} else if (this.getListenerCollection().getListener() instanceof GuildWebhookListener) {
return ListenerType.GUILD;
} else {
return ListenerType.UNKNOWN;
}
}
}
|
193d145e-65ae-4f65-9662-2bdfb1b6c072 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-22 09:51:39", "repo_name": "Yhongwu/springboot-demo", "sub_path": "/springboot_cache/src/main/java/com/howard/springboot03/web/TransactionController.java", "file_name": "TransactionController.java", "file_ext": "java", "file_size_in_byte": 996, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "b14c5b61a1d310bb9a18bd2ffe8629bc5458f1a6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Yhongwu/springboot-demo | 189 | FILENAME: TransactionController.java | 0.242206 | package com.howard.springboot03.web;
import com.howard.springboot03.domain.Person;
import com.howard.springboot03.service.TransactionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TransactionController {
@Autowired
private TransactionService transactionService;
@RequestMapping("/rollback")
public Person rollback() {
Person p = new Person();
p.setAddress("xxxx");
p.setAge(11);
p.setName("hh");
return transactionService.savePersonWithRollBack(p);
}
@RequestMapping("/norollback")
public Person noRollback() {
Person p = new Person();
p.setAddress("xxxx");
p.setAge(11);
p.setName("hh");
return transactionService.savePersonWithoutRollBack(p);
}
}
|
a869f65c-67e6-4bde-a107-2db04525b0a8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-11 02:19:35", "repo_name": "zoripong/GeulGil", "sub_path": "/app/src/main/java/com/five/high/emirim/geulgil/Adapter/SearchRecyclerSetter.java", "file_name": "SearchRecyclerSetter.java", "file_ext": "java", "file_size_in_byte": 1094, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "a91aeb07b121378b0f7fcee5ac753b69cb0d6e29", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zoripong/GeulGil | 208 | FILENAME: SearchRecyclerSetter.java | 0.281406 | package com.five.high.emirim.geulgil.Adapter;
import android.app.Activity;
import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import com.five.high.emirim.geulgil.Model.SearchRecordItem;
import java.util.ArrayList;
/**
* Created by 유리 on 2017-09-14.
*/
public class SearchRecyclerSetter {
ArrayList<SearchRecordItem> items;
SearchRecyclerAdapter adapter;
Context context;
Activity nowActivity;
public SearchRecyclerSetter(Context context, Activity nowActivity) {
this.context = context;
this.nowActivity = nowActivity;
}
public boolean setRecyclerCardView(RecyclerView recyclerView){
items = new ArrayList<SearchRecordItem>();
LinearLayoutManager layoutManager = new LinearLayoutManager(context);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(layoutManager);
adapter = new SearchRecyclerAdapter(context, nowActivity);
recyclerView.setAdapter(adapter);
return true;
}
}
|
199be7b8-0101-43d3-b656-cd55edc8a57e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-11-22T00:21:18", "repo_name": "SeanMelody/PWDGenerator", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1013, "line_count": 45, "lang": "en", "doc_type": "text", "blob_id": "84238c8493b94b312dc747a3bf9b924e814ea4df", "star_events_count": 0, "fork_events_count": 4, "src_encoding": "UTF-8"} | https://github.com/SeanMelody/PWDGenerator | 287 | FILENAME: README.md | 0.250913 | <img src="https://img.shields.io/badge/LICENSE-mit-green"/>
https://seanmelody.github.io/PWDGenerator/

### Personal Dashboard APP
```
Coding bootcamp project completed with fellow zoom classmates.
Archana and Delgadillo worked on the design.
Sean figured out the APIs.
Francisco helped on putting it all together.
```
### About
```
Not your typical password generator that just spits out random letters and number.
Configurable results to your liking.
Phrase like password creation that will be easier to memorise for your own usage.
You can even generate fun phrases using this password generator.
```
### Tech
```
* HTML
* CSS
* JS
* Bulma
```
### Demo
```
```
### Contact Us:
Archana Gottipaty (https://github.com/archanagottipaty)
Daisy Delgadillo (https://github.com/DaisyDelgadillo)
Francisco Rones (https://github.com/francisN21)
Sean Melody (https://github.com/SeanMelody)
|
882ff9f5-c770-476b-a90f-5baa51a9a82b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-04-14 10:22:14", "repo_name": "ConAlgorithm/study_android", "sub_path": "/android_book_shizhan/04_01_Tencent/src/com/sid/tencent/progress/asynctask/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1020, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "d7b452f1ac0829ab76468b6a7b181099a5face9d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ConAlgorithm/study_android | 193 | FILENAME: MainActivity.java | 0.290176 | package com.sid.tencent.progress.asynctask;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
public class MainActivity extends Activity {
private Button button = null;
private ProgressBar progressBar = null;
private TextView textView = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.main);
//
// button = (Button)findViewById(R.id.buttonId);
// progressBar = (ProgressBar)findViewById(R.id.progerssBarId);
// textView = (TextView)findViewById(R.id.textViewId);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ProgressBarAsyncTask asyncTask = new ProgressBarAsyncTask(textView,progressBar);
asyncTask.execute(1000);
}
});
}
} |
78708036-5fae-458e-ba00-d954ce438e07 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-08 03:27:17", "repo_name": "Tokymin/test5_11", "sub_path": "/hibernate/src/toky/geek/database/Test.java", "file_name": "Test.java", "file_ext": "java", "file_size_in_byte": 1333, "line_count": 49, "lang": "zh", "doc_type": "code", "blob_id": "d3f05305c9f2d3bfa488dc3bac3d7441493a4013", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Tokymin/test5_11 | 268 | FILENAME: Test.java | 0.280616 | package toky.geek.database;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
public class Test {
public static void main(String[] args) {
//1.读取配置文件信息,并创建管理配置文件信息的对象 cfg。
Configuration cfg = new Configuration();
cfg.configure();//默认加载src目录下的主配置文件hibernate.cfg.xml。
//2.利用管理配置文件信息的对象 cfg来创建SessionFactory对象即会话工厂对象。
SessionFactory sf = cfg.buildSessionFactory();
//3.根据会话工厂对象来创建会话对象session
Session session = sf.openSession();
//5. 对数据的crud操作
StudentEntity user = new StudentEntity();
user.setName("Toky223");
user.setNp("123");
user.setSex("女");
//6.提交事物
//4.开启事物,并得到事物管理对象tx
Transaction tx = session.beginTransaction();
//7.关闭资源
try {
session.save(user);
tx.commit();
} catch (Exception e) {
// tx.rollback();
e.printStackTrace();
} finally {
session.close();
sf.close();
}
}
}
|
e63fd4e8-feb5-4a98-bd81-9a75d719b1d6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-17 14:02:50", "repo_name": "mehdi-nezafat-bakhsh/android-studio-1", "sub_path": "/app/src/main/java/com/example/myapplication1/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1058, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "ba10d2a99f165e02b9598703a96aafb7fe664e23", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mehdi-nezafat-bakhsh/android-studio-1 | 191 | FILENAME: MainActivity.java | 0.218669 | package com.example.myapplication1;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class MainActivity extends AppCompatActivity {
@BindView(R.id.button)
Button buttonOne;
@BindView(R.id.img)
ImageView image1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
}
@OnClick(R.id.button)
public void buttonOneClicked() {
Toast toast = Toast.makeText(getApplicationContext(), "Hello world. again", Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0b0, 0);
toast.show();
image1.setImageResource(R.drawable.kk);
}
}
|
75761d44-dfc6-43c2-a6c7-2c014dd12422 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-27 09:12:27", "repo_name": "bo729892905/bc-dreamport-manage", "sub_path": "/src/main/java/com/dreamport/controller/service/UserService.java", "file_name": "UserService.java", "file_ext": "java", "file_size_in_byte": 1062, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "49ab4e08e4da2cf3ab375ab45146ce1bb5194afd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/bo729892905/bc-dreamport-manage | 234 | FILENAME: UserService.java | 0.259826 | package com.dreamport.controller.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.dreamport.bo.UserBO;
import com.dreamport.controller.client.UserFeignClient;
import com.dreamport.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by ren.xiaobo on 2017/7/31.
*/
@Service
public class UserService {
private final UserFeignClient userFeignClient;
@Autowired
public UserService(UserFeignClient userFeignClient) {
this.userFeignClient = userFeignClient;
}
public Page<User> selectUserPage(Integer pageNo, Integer pageSize, UserBO param) {
return userFeignClient.selectUserPage(pageNo, pageSize, param);
}
public int insert(User entity) {
return userFeignClient.insert(entity);
}
public int update(Long id, User entity) {
return userFeignClient.update(id, entity);
}
public int deleteById(Long id) {
return userFeignClient.deleteById(id);
}
}
|
00044bb9-3a1a-43ae-b44f-cff4406f3fbf | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-23 15:41:21", "repo_name": "EngAAlex/Giraph-for-GiViP", "sub_path": "/giraph-core/src/main/java/org/apache/giraph/givip/profiler/Copier.java", "file_name": "Copier.java", "file_ext": "java", "file_size_in_byte": 1088, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "e7f3b60dd7842aadb3bc3c07195c3a337b4bf48f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/EngAAlex/Giraph-for-GiViP | 246 | FILENAME: Copier.java | 0.27513 | package org.apache.giraph.givip.profiler;
/**
*
*/
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
/**
* @author maria
*
* Copia dei file in locale sui worker
*/
public class Copier {
// Configuration conf;
public static void copyFromLocalToHDFS(Configuration conf, String localSrc, String folder, String jobId) throws IllegalArgumentException, IOException{
FileSystem fs = null;
String dst = "";
try {
fs = FileSystem.get(conf);
dst = fs.getHomeDirectory()+ Path.SEPARATOR
+"profiler" + Path.SEPARATOR
+ jobId + Path.SEPARATOR
+ folder;
FileSystem.mkdirs(fs, new Path(dst), FsPermission.getDefault());
} catch (IOException e) {
e.printStackTrace();
}
try {
if(fs != null){
fs.copyFromLocalFile(true, new Path(localSrc), new Path(dst));
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
240fcd94-0386-477d-a9d8-7ad6f0a056af | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-11 09:54:24", "repo_name": "fengyajie/ShiroTest", "sub_path": "/src/main/java/com/fyj/filter/MyFormAuthenticationFilter.java", "file_name": "MyFormAuthenticationFilter.java", "file_ext": "java", "file_size_in_byte": 1058, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "3afbb9bd8d8de884ce27c558cbf40d0b5e638e66", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/fengyajie/ShiroTest | 191 | FILENAME: MyFormAuthenticationFilter.java | 0.256832 | package com.fyj.filter;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.apache.shiro.web.util.WebUtils;
import org.springframework.util.StringUtils;
public class MyFormAuthenticationFilter extends FormAuthenticationFilter{
@Override
protected void issueSuccessRedirect(ServletRequest request, ServletResponse response) throws Exception {
String fallbackUrl = (String)getSubject(request,response).getSession().getAttribute("authc.fallbackUrl");
if(StringUtils.isEmpty(fallbackUrl)){
fallbackUrl = getSuccessUrl();
}
WebUtils.redirectToSavedRequest(request, response, fallbackUrl);
}
@Override
protected void setFailureAttribute(ServletRequest request, AuthenticationException ae) {
request.setAttribute(getFailureKeyAttribute(), ae);
}
}
|
1a9d89be-a737-4316-89cb-9face0a4b325 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-20 08:31:41", "repo_name": "1343829382/blogs", "sub_path": "/src/main/java/Service/impl/CategoryServiceimpl.java", "file_name": "CategoryServiceimpl.java", "file_ext": "java", "file_size_in_byte": 1077, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "6c62209b48a9118294986113fa62d24af6dc7507", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/1343829382/blogs | 210 | FILENAME: CategoryServiceimpl.java | 0.292595 | package Service.impl;
import Dao.CategoryDao;
import Service.CategoryService;
import entity.Category;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CategoryServiceimpl implements CategoryService {
@Autowired
private CategoryDao categoryDao;
@Override
public List<Category> getAll() {
return categoryDao.getAll();
}
@Override
public Category finCaid(Integer id) {
return categoryDao.finCaid(id);
}
@Override
public Integer add(Category category) {
return categoryDao.add(category);
}
@Override
public Integer update(Category category) {
return categoryDao.update(category);
}
@Override
public Integer delete(Integer id) {
return categoryDao.delete(id);
}
@Override
public int count() {
return categoryDao.count();
}
@Override
public List<Category> like(String typename) {
return categoryDao.like(typename);
}
}
|
53dcf165-b612-4f1d-9a5d-cbe256e932c2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-31 00:22:01", "repo_name": "4RN0LD/cb4sistencia", "sub_path": "/cbAsistencia/src/com/arnoldnorabuena/dao/Conexion.java", "file_name": "Conexion.java", "file_ext": "java", "file_size_in_byte": 1075, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "ad1edc1e65fd27fcf29a3770f4592c7f8b5124bf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/4RN0LD/cb4sistencia | 212 | FILENAME: Conexion.java | 0.220007 | package com.arnoldnorabuena.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
*
* @author Arnold Alfredo Norabuena Aranda
* @version 1.0
*/
public class Conexion {
protected final String dataBase = "web";
protected final String port = "3306";
protected final String host = "localhost";
protected final String usuario = "root";
protected final String password = "mysql";
public static Connection connection;
protected final String cadenaConexion;
private static Conexion conexion;
private Conexion() throws ClassNotFoundException, SQLException {
this.cadenaConexion = "jdbc:mysql://" + host + ":" + port + "/" + dataBase;
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(cadenaConexion, usuario, password);
}
public static Connection getInstanceConnection() throws ClassNotFoundException, SQLException{
if (conexion == null) {
conexion = new Conexion();
}
return connection;
}
}
|
8f918fa7-a391-4184-92d9-4f665a14d8b7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-03-30 17:29:36", "repo_name": "bonito-amat0w0tama/tcp-ip", "sub_path": "/java/etc/ver1/ExternalCodeAdapterReceiverSample.java", "file_name": "ExternalCodeAdapterReceiverSample.java", "file_ext": "java", "file_size_in_byte": 1059, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "0ec0ebda5eb77ebbe8912dee765026ab1afd69a3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/bonito-amat0w0tama/tcp-ip | 227 | FILENAME: ExternalCodeAdapterReceiverSample.java | 0.287768 | import java.io.*;
import java.nio.*;
import java.net.*;
public class ExternalCodeAdapterReceiverSample {
static int readInt(InputStream instream) throws IOException {
byte[] buff = new byte[4];
instream.read(buff);
ByteBuffer bb = ByteBuffer.wrap(buff);
bb.order(ByteOrder.LITTLE_ENDIAN);
return bb.getInt();
}
public ExternalCodeAdapterReceiverSample(int port) throws IOException {
ServerSocket ss = new ServerSocket(port);
Socket socket = ss.accept();
BufferedInputStream instream = new BufferedInputStream(socket.getInputStream());
byte[] head = new byte[4];
instream.read(head);
System.out.println(new String(head));
int size = readInt(instream);
System.out.println(size);
byte[] data = new byte[size];
instream.read(data);
System.out.println(new String(data));
}
public static void main(String []args) {
try {
new ExternalCodeAdapterReceiverSample(Integer.parseInt(args[0]));
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
}
|
4057f0a1-9b87-46c4-b4da-240338b149ae | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-31 03:14:33", "repo_name": "itsscdachao/Alanber4Code", "sub_path": "/alanber/src/main/java/com/itssc/alanber4code/base/activity/BaseCommonActivity.java", "file_name": "BaseCommonActivity.java", "file_ext": "java", "file_size_in_byte": 1038, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "6064d536dbc64c0ce46c9a8145023446285adb22", "star_events_count": 5, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/itsscdachao/Alanber4Code | 210 | FILENAME: BaseCommonActivity.java | 0.242206 | package com.itssc.alanber4code.base.activity;
import android.app.Activity;
import android.os.Bundle;
import com.itssc.alanber4code.base.presenter.BaseCommonPresenter;
import com.itssc.alanber4code.base.view.IBaseView;
/**
* 普通样式Activity
*
* @param <T>
*/
public abstract class BaseCommonActivity<T extends BaseCommonPresenter> extends Activity implements IBaseActivity, IBaseView {
public T mPresenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getLayoutResId());
mPresenter = createPresenter();
if (mPresenter != null) {
mPresenter.attachView(this);
}
initSomething();
}
protected abstract int getLayoutResId();
protected abstract T createPresenter();
protected abstract void initSomething();
@Override
protected void onDestroy() {
super.onDestroy();
if (mPresenter != null) {
mPresenter.detachView();
}
}
}
|
f3fa7d33-b8fa-4ad2-85c5-fef3f4e2ee10 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-17 11:49:09", "repo_name": "krystal-simmonds/Trainers-Fundamental-Project", "sub_path": "/src/main/java/com/qa/trainers/domain/Brand.java", "file_name": "Brand.java", "file_ext": "java", "file_size_in_byte": 1121, "line_count": 53, "lang": "en", "doc_type": "code", "blob_id": "22da969dba5e7a068341c8f0bf4ef79f18af03d6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/krystal-simmonds/Trainers-Fundamental-Project | 261 | FILENAME: Brand.java | 0.26971 | package com.qa.trainers.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Entity
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler", "shoes"})
public class Brand {
@Id
@GeneratedValue
private Long brandId;
@Column(unique = true, nullable = false)
private String brandName;
@OneToMany(mappedBy = "brand", fetch = FetchType.EAGER)
private List<Shoe> shoes = new ArrayList<>();
public Brand() {
}
public Brand(Long brandId, String brandName) {
this.brandId = brandId;
this.brandName = brandName;
}
public Long getBrandId() {
return brandId;
}
public void setBrandId(Long brandId) {
this.brandId = brandId;
}
public String getBrandName() {
return brandName;
}
public void setBrandName(String brandName) {
this.brandName = brandName;
}
public List<Shoe> getShoes() {
return shoes;
}
public void setShoes(List<Shoe> shoes) {
this.shoes = shoes;
}
}
|
0e086650-99c2-4c08-ade4-15abcb418b42 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-04 17:12:34", "repo_name": "AdamLuptak/user-crd", "sub_path": "/src/main/java/com/adamluptakosice/usercrdmin/service/UserService.java", "file_name": "UserService.java", "file_ext": "java", "file_size_in_byte": 997, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "c2ddf1f4b3c715e66a869fe67b1b3d9dc0c4dee7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AdamLuptak/user-crd | 200 | FILENAME: UserService.java | 0.26588 | package com.adamluptakosice.usercrdmin.service;
import com.adamluptakosice.usercrdmin.dao.UserDao;
import com.adamluptakosice.usercrdmin.domain.User;
import javax.validation.ConstraintViolationException;
import javax.validation.Validator;
import java.util.List;
public class UserService {
private final UserDao userDao;
private final Validator validator;
public UserService(UserDao userDao, Validator validator) {
this.userDao = userDao;
this.validator = validator;
}
public User add(User user) {
validate(user);
return userDao.save(user);
}
private void validate(User user) {
var violationList = validator.validate(user);
if (!violationList.isEmpty()) {
throw new ConstraintViolationException("Invalid object User", violationList);
}
}
public Integer deleteAll() {
return userDao.deleteAll();
}
public List<User> findAll() {
return userDao.findAll();
}
}
|
62495d11-02f7-4ae8-ad7a-7f297cdb8704 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-04-15T12:05:25", "repo_name": "mmounirf/web-components-demo", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1047, "line_count": 44, "lang": "en", "doc_type": "text", "blob_id": "d6489fdb8a24a89d2f3bb059247a5e42fdab9460", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mmounirf/web-components-demo | 249 | FILENAME: README.md | 0.285372 | # \<mm-action-button\>
POC
<!--
The next comment block is used by webcomponents.org to enable inline demo.
Visit https://www.webcomponents.org/publish for more details.
-->
<!--
```
<custom-element-demo>
<template>
<script src="../webcomponentsjs/webcomponents-loader.js"></script>
<link rel="import" href="mm-action-button.html">
<next-code-block></next-code-block>
</template>
</custom-element-demo>
```
-->
```html
<mm-action-button></mm-action-button>
```
## Install the Polymer-CLI
First, make sure you have the [Polymer CLI](https://www.npmjs.com/package/polymer-cli) installed. Then run `polymer serve` to serve your element locally.
## Viewing Your Element
```
$ polymer serve
```
## Running Tests
```
$ polymer test
```
Your application is already set up to be tested via [web-component-tester](https://github.com/Polymer/web-component-tester). Run `polymer test` to run your application's test suite locally.
## License
[MIT](https://opensource.org/licenses/MIT) |
ab0553a8-7628-4bf3-a978-d9c3b79ffc26 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-02 00:59:30", "repo_name": "qpdyg/jih", "sub_path": "/jih/jih_manage/src/main/java/com/xiaolc/service/impl/ContentServiceImpl.java", "file_name": "ContentServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1121, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "89f98de2403937b830440e13e64dde61dfd1eced", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/qpdyg/jih | 254 | FILENAME: ContentServiceImpl.java | 0.240775 | package com.xiaolc.service.impl;
import com.xiaolc.mapper.ContentMapper;
import com.xiaolc.model.Content;
import com.xiaolc.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.UUID;
/**
* @author lc
* @Date: 2018/11/28 10:21
*/
@Service
public class ContentServiceImpl implements ContentService {
@Autowired
private ContentMapper mapper;
@Override
public List<Content> fandAll() {
return mapper.fandAll();
}
@Override
public Content findById(String cid) {
return mapper.findById(cid);
}
@Override
public List<Content> fandName(String cname) {
return mapper.fandName(cname);
}
@Override
public int save(Content content) {
content.setCid(UUID.randomUUID().toString());
return mapper.save(content);
}
@Override
public int update(Content content) {
return mapper.update(content);
}
@Override
public int delete(String mid) {
return mapper.delete(mid);
}
}
|
b146b393-e828-43ae-a6e0-5d4551f48315 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-11 09:18:50", "repo_name": "Andreibich/javaLearning", "sub_path": "/project_stock_without_comments/common/src/main/java/com/htp/stock/filter/CharsetFilter.java", "file_name": "CharsetFilter.java", "file_ext": "java", "file_size_in_byte": 1026, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "54c276efb0b9ada8715f3f44ad1cba642360e89f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Andreibich/javaLearning | 168 | FILENAME: CharsetFilter.java | 0.23793 | package com.htp.stock.filter;
import javax.servlet.Filter;
import javax.servlet.ServletContext;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;
public class CharsetFilter implements Filter {
private String encoding;
private ServletContext context;
@Override
public void destroy() {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding(encoding);
response.setCharacterEncoding(encoding);
chain.doFilter(request, response);
}
@Override
public void init(FilterConfig config) throws ServletException {
encoding = config.getInitParameter("characterEncoding");
context = config.getServletContext();
}
}
|
577ccca4-47de-430f-abaf-9d31d0119012 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-10-27 15:33:53", "repo_name": "Esherns/Prueba2", "sub_path": "/src/java/dto/CancionExtendida.java", "file_name": "CancionExtendida.java", "file_ext": "java", "file_size_in_byte": 1029, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "331ece371c852fa6e1276b58e4aa6564e091ec7e", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/Esherns/Prueba2 | 227 | FILENAME: CancionExtendida.java | 0.250913 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package dto;
import ctrl.Helpers;
import java.io.Serializable;
/**
*
* @author hmoraga
*/
public class CancionExtendida implements Serializable{
private Cancion cancion;
private Album album;
public CancionExtendida(Cancion cancion, Album album) {
this.cancion = cancion;
this.album = album;
}
public Album getAlbum() {
return album;
}
public void setAlbum(Album album) {
this.album = album;
}
public Cancion getCancion() {
return cancion;
}
public void setCancion(Cancion cancion) {
this.cancion = cancion;
}
// Helper para entregar la duracion de la cancion en format Hora
public String getDuracion(){
return Helpers.getSecondsToHourFormat(cancion.getDuracion());
}
}
|
b90c862a-8a31-46dc-9e53-e5e198af77eb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-17 08:19:58", "repo_name": "GrigoreCatalin/LinkedList", "sub_path": "/src/Ex1/TownList.java", "file_name": "TownList.java", "file_ext": "java", "file_size_in_byte": 1025, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "9ed986dc17746003885bcf8b4f26ca01235c3715", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/GrigoreCatalin/LinkedList | 182 | FILENAME: TownList.java | 0.27513 | package Ex1;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
public class TownList<T extends Comparable<T>> {
private List<T> elements = new LinkedList<>();
public boolean addInOrderedList(T newElement) {
ListIterator<T> li = elements.listIterator();
while (li.hasNext()) {
T currentTown = li.next();
int comparison = currentTown.compareTo(newElement);
if (currentTown.equals(newElement)){
return false;
} else if (comparison >= 0) {
li.previous();
li.add(newElement);
return true;
}
}
li.add(newElement);
return true;
}
@Override
public String toString() {
String ret = "";
for(T el : elements) {
ret += el.toString();
}
return ret;
}
}
|
380dc6c2-1d47-456a-a854-f199f909a178 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-20 06:10:49", "repo_name": "avijitsaha7778/FreshNGreenVer2", "sub_path": "/app/src/main/java/com/gios/freshngreen/responseModel/order/UpdateAddressModel.java", "file_name": "UpdateAddressModel.java", "file_ext": "java", "file_size_in_byte": 1044, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "3cd1a4a7b60239d69b2f100c0015682d992ba7e3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/avijitsaha7778/FreshNGreenVer2 | 206 | FILENAME: UpdateAddressModel.java | 0.226784 | package com.gios.freshngreen.responseModel.order;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.List;
public class UpdateAddressModel implements Serializable {
@SerializedName("status")
@Expose
private Boolean status;
@SerializedName("error")
@Expose
private String error;
@SerializedName("user_address_details")
@Expose
private List<UserAddressDetail> userAddressDetails = null;
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
public List<UserAddressDetail> getUserAddressDetails() {
return userAddressDetails;
}
public void setUserAddressDetails(List<UserAddressDetail> userAddressDetails) {
this.userAddressDetails = userAddressDetails;
}
}
|
1f6b3738-09f2-4db4-9fd5-e5f176816d7b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-15 04:15:42", "repo_name": "basquiat78/bnb-wallet-springboot", "sub_path": "/src/main/java/io/basquiat/websocket/handler/ClientHandler.java", "file_name": "ClientHandler.java", "file_ext": "java", "file_size_in_byte": 1054, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "425e9c2dd41dc3983490ccdc9dce89a92b542e4d", "star_events_count": 2, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/basquiat78/bnb-wallet-springboot | 214 | FILENAME: ClientHandler.java | 0.259826 | package io.basquiat.websocket.handler;
import org.springframework.web.reactive.socket.WebSocketHandler;
import org.springframework.web.reactive.socket.WebSocketSession;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.publisher.ReplayProcessor;
/**
*
* client Handler
*
* created by basquiat
*
*/
public class ClientHandler implements WebSocketHandler {
private final SessionHandler sessionHandler;
private final ReplayProcessor<SessionHandler> connectedProcessor;
/**
* Constructor
*/
public ClientHandler() {
sessionHandler = new SessionHandler();
connectedProcessor = ReplayProcessor.create();
}
@Override
public Mono<Void> handle(WebSocketSession session) {
sessionHandler.connected()
.doOnNext(value -> connectedProcessor.onNext(sessionHandler))
.subscribe();
return sessionHandler.handle(session);
}
/**
* connectedProcessor 반환
* @return Flux<SessionHandler>
*/
public Flux<SessionHandler> connected() {
return connectedProcessor;
}
} |
77d358c2-baae-4847-999b-eef0d3664503 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-11-09 09:53:16", "repo_name": "alu4216/ElJuegoDeLaVida", "sub_path": "/src/packageprincipal/Frame.java", "file_name": "Frame.java", "file_ext": "java", "file_size_in_byte": 1075, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "306dafd088e4e1eca27f6db94e78d883a4698026", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "ISO-8859-1"} | https://github.com/alu4216/ElJuegoDeLaVida | 232 | FILENAME: Frame.java | 0.285372 | package packageprincipal;
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
public class Frame extends JFrame {
/**
* Contenedor principal de la interfaz gráfica
*/
private static final long serialVersionUID = 1L;
private JScrollPane scroll;
private Panel panel;
private PanelSouth panelS;
private PanelEast panelE;
public Frame() {
//Instancias de objetos a utilizar
panel = new Panel();
scroll= new JScrollPane();
panelS = new PanelSouth(panel);
panelE = new PanelEast(panel,panelS);
setExtendedState(JFrame.MAXIMIZED_BOTH);
setLayout(new BorderLayout());
scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scroll.setViewportView(panel); //Añadimos scroll al panel
scroll.getViewport().setView(panel);
add(scroll, BorderLayout.CENTER);
add(panelS,BorderLayout.SOUTH);
add(panelE,BorderLayout.EAST);
setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
|
ceacb429-c440-4006-922a-c52874e16071 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-09 06:55:17", "repo_name": "iceflag/THWB-SOP", "sub_path": "/sop-common/sop-service-common/src/main/java/com/zyd/sop/servercommon/bean/ServiceApiInfo.java", "file_name": "ServiceApiInfo.java", "file_ext": "java", "file_size_in_byte": 1078, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "18bc4ff1ff696e8ea9575e607c27341e5d9b8c02", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/iceflag/THWB-SOP | 221 | FILENAME: ServiceApiInfo.java | 0.205615 | package com.zyd.sop.servercommon.bean;
import com.zyd.sop.servercommon.route.GatewayRouteDefinition;
import lombok.Data;
import java.util.List;
/**
* @author tanghc
*/
@Data
public class ServiceApiInfo {
private String serviceId;
private List<ApiMeta> apis;
private List<GatewayRouteDefinition> routeDefinitionList;
@Data
public static class ApiMeta {
/** 接口名 */
private String name;
/** 请求path */
private String path;
/** 版本号 */
private String version;
/** 是否忽略验证 */
private int ignoreValidate;
/** 是否合并结果 */
private int mergeResult;
/** 是否需要授权才能访问 */
private int permission;
public ApiMeta() {
}
public ApiMeta(String name, String path, String version) {
this.name = name;
this.path = path;
this.version = version;
}
public String fetchNameVersion() {
return this.name + this.version;
}
}
}
|
09ad6213-2491-4e2b-a90e-c3f4854bae14 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-18 13:49:37", "repo_name": "Sumayla/AmazonApplication", "sub_path": "/AmazonApplicationTestAutomation/src/main/java/com/amazom/qa/testcases/TC008.java", "file_name": "TC008.java", "file_ext": "java", "file_size_in_byte": 1073, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "f93dd38a96317e3b30006f994185a022f58d2a20", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Sumayla/AmazonApplication | 241 | FILENAME: TC008.java | 0.261331 | package com.amazom.qa.testcases;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class TC008 {
public static void main(String[] args) throws AWTException {
System.setProperty("webdriver.gecko.driver", "C:\\selenium-java-3.13.0\\geckodriver.exe");
WebDriver driver= new FirefoxDriver();
driver.manage().deleteAllCookies();
driver.manage().window().maximize();
driver.manage().timeouts().pageLoadTimeout(5, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://www.pdfonline.com/pdf-to-word-converter/");
driver.findElement(By.xpath("//div[@id='nav-xshop-container']")).click();
Robot robot = new Robot();
// robot.keyPress(KeyEvent.VK_TAB);
robot.mousePress(InputEvent.BUTTON3_DOWN_MASK);
}
}
|
a69a5116-b903-4228-856f-9b772ceeb436 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-26 01:08:50", "repo_name": "vinohsueh/i9-defence-parent", "sub_path": "/i9-defence-parent/i9-defence-api/src/main/java/i9/defence/platform/api/listener/MySessionListener.java", "file_name": "MySessionListener.java", "file_ext": "java", "file_size_in_byte": 1178, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "46d4c7cb1b009b558ea92fccdcabf270dd1a12c0", "star_events_count": 1, "fork_events_count": 3, "src_encoding": "UTF-8"} | https://github.com/vinohsueh/i9-defence-parent | 253 | FILENAME: MySessionListener.java | 0.284576 | package i9.defence.platform.api.listener;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.SessionListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* 创建时间:2018年4月10日 上午11:31:49
* @author lby
* @version
*
*/
@Component
public class MySessionListener implements SessionListener {
private static final Logger S_LOGGER = LoggerFactory.getLogger(MySessionListener.class);
private final AtomicInteger sessionCount = new AtomicInteger(0);
public int getSessionCount() {
return sessionCount.get();
}
@Override
public void onStart(Session session) {
sessionCount.incrementAndGet();
S_LOGGER.info("登录+1=="+sessionCount.get());
}
@Override
public void onStop(Session session) {
sessionCount.decrementAndGet();
S_LOGGER.info("登录退出-1=="+sessionCount.get());
}
@Override
public void onExpiration(Session session) {
sessionCount.decrementAndGet();
S_LOGGER.info("登录过期-1=="+sessionCount.get());
}
}
|
fdd6411e-02c9-46db-b471-ad6aa7b5a964 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-01-21T16:49:01", "repo_name": "haim-rubin/lucy-in-the-sky", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1196, "line_count": 34, "lang": "en", "doc_type": "text", "blob_id": "637cfd4dd215d4ede60b7f2e65e0c613bfdfe0de", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/haim-rubin/lucy-in-the-sky | 273 | FILENAME: README.md | 0.267408 |
Gudlines/Description
1. Backend
- Run backend: from in 'backend' folder run npm start
- APIs
* Because we needed to retrieve data from 3rd party so I splitted the API into 2 different APIs
* 3rdParty - Proxy to the images data
* local - deal with local data like user's favorites
- dal
* Function 'find' to get favorite for specific user
* Function 'upsert' to update/add favorite for user
- database
- A json file that hold the user's favorites data
- Rest APIs
- /Images GET - retrieve images
- /images/:imageId/favorites PUT - set favorite for user
- /images/favorites GET - get all favorites for user
2. Frontend
- Run frontend: from in 'frontend' folder run npm start
- ImageDetails - for displaying image info like favorite/description/image
- LineImages - for displaying images (3/other) in line
- Results - for displaying images in cunck of lines
- Callbacks for getImages/setFavorite
- APIs service to fetch http requests
- Tests - Did tests for App and ImageDetails components
|
b481d6fe-3eaf-4b00-b404-5664c4328717 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-15 09:24:24", "repo_name": "sys-cms/x-sso-server-web", "sub_path": "/src/main/java/com/x/uac/web/model/email/SendEmailRequest.java", "file_name": "SendEmailRequest.java", "file_ext": "java", "file_size_in_byte": 1048, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "e22cee68d6f0cf218c808424fc61643ef1cda3d6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sys-cms/x-sso-server-web | 298 | FILENAME: SendEmailRequest.java | 0.228156 | package com.x.uac.web.model.email;
/**
* 发送邮件入参对象
* tomails,data,templateRUL 必填
* @author wangyongxin
*/
public class SendEmailRequest {
/** 收件箱(必填)*/
private String[] tomails;
/** 抄送邮箱*/
private String[] ccmails;
/** 主题*/
private String subject;
/** 邮件内容参数(必填)*/
private String[] data;
/** 模板路径(必填)*/
private String templateRUL;
public String[] getTomails() {
return tomails;
}
public void setTomails(String[] tomails) {
this.tomails = tomails;
}
public String[] getCcmails() {
return ccmails;
}
public void setCcmails(String[] ccmails) {
this.ccmails = ccmails;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String[] getData() {
return data;
}
public void setData(String[] data) {
this.data = data;
}
public String getTemplateRUL() {
return templateRUL;
}
public void setTemplateRUL(String templateRUL) {
this.templateRUL = templateRUL;
}
}
|
61d8855f-01cc-404f-9530-49b75907ed42 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-03-05 09:45:42", "repo_name": "mcfernandes/Suportebasicodevida1", "sub_path": "/app/src/main/java/com/example/vigion/suportebasicodevida1/MainActivityCompressoes2.java", "file_name": "MainActivityCompressoes2.java", "file_ext": "java", "file_size_in_byte": 1084, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "bffb8857873f20c1f587a33885792eb46b987504", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mcfernandes/Suportebasicodevida1 | 200 | FILENAME: MainActivityCompressoes2.java | 0.214691 | package com.example.vigion.suportebasicodevida1;
import android.content.Intent;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
public class MainActivityCompressoes2 extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_activity_compressoes2);
if (getSupportActionBar() != null) {
getSupportActionBar().hide();
}
}
public void btnInicioOnClick(View i)
{
Intent intent = new Intent(i.getContext(), MainActivity.class);
startActivityForResult(intent, 0);
}
public void btnPasso5OnClick(View i)
{
Intent intent = new Intent(i.getContext(), MainActivityCompressoes3.class);
startActivityForResult(intent, 0);
}
}
|
f9bdd9a0-5d2e-45ea-8bf5-0ab4721da7b2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-22 07:32:11", "repo_name": "sunhpjc/elasticsearch", "sub_path": "/src/main/java/com/sunhp/elasticsearch/guava/controller/CourseController.java", "file_name": "CourseController.java", "file_ext": "java", "file_size_in_byte": 1202, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "ba14abb91126ced581d7d9dc59cfedd1ce9fd1f1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sunhpjc/elasticsearch | 232 | FILENAME: CourseController.java | 0.213377 | package com.sunhp.elasticsearch.guava.controller;
import com.sunhp.elasticsearch.guava.entity.Course;
import com.sunhp.elasticsearch.guava.service.CourseService;
import com.sunhp.elasticsearch.guava.utils.GuavaCacheUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping(value = "/course")
public class CourseController {
private static final Logger logger = LoggerFactory.getLogger(CourseController.class);
@Resource
private CourseService courseService;
@GetMapping(value = "/selectCourse")
public List<Course> selectCourse(){
return courseService.selectCourse();
}
@GetMapping(value = "/guava/selectCourse")
public String selectGuava(){
String key = "1";
String value = GuavaCacheUtil.getGuavaValue(key);
return value;
}
@GetMapping(value = "/test")
public String test(){
logger.info("测试");
return "测试";
}
}
|
a8f48355-9f9a-4ece-bdf5-1a42f0f002d7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-29 08:25:59", "repo_name": "dyj3344/mybatis_dyj", "sub_path": "/src/main/java/com/dyj/mybatis/test/OrderTest.java", "file_name": "OrderTest.java", "file_ext": "java", "file_size_in_byte": 990, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "844f60bc9a9953c7639970f4184f7579b0984d23", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dyj3344/mybatis_dyj | 185 | FILENAME: OrderTest.java | 0.239349 | package com.dyj.mybatis.test;
import com.dyj.mybatis.domain.Orders;
import com.dyj.mybatis.mapper.OrderMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
public class OrderTest {
@Test
public void test1() throws IOException {
InputStream resourceAsStream = Resources.getResourceAsStream("sqlMapConfig.xml");
SqlSessionFactory build = new SqlSessionFactoryBuilder().build(resourceAsStream);
SqlSession sqlSession = build.openSession();
OrderMapper mapper = sqlSession.getMapper(OrderMapper.class);
List<Orders> allWithUser = mapper.findAllWithUser();
for (Orders orders : allWithUser) {
System.out.println(orders);
}
sqlSession.close();
}
}
|
81749f40-cc5a-44b0-b54c-8e419d7679d6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-01 22:53:00", "repo_name": "vsanca/foodbook", "sub_path": "/src/main/java/e2/isa/grupa5/model/restaurant/Menu.java", "file_name": "Menu.java", "file_ext": "java", "file_size_in_byte": 1005, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "5b4327473c035563b244be3863b51e331a65532a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/vsanca/foodbook | 242 | FILENAME: Menu.java | 0.267408 | package e2.isa.grupa5.model.restaurant;
import java.io.Serializable;
import javax.persistence.*;
/**
*
* {@link Restaurant} menu.
*
* Funkcionalnost 2.3:
* - jelovnik, karta pića (u ovom slučaju meni obuhvata sve, razlikuju se tipovi stavki ({@link MenuItem})).
*
* @author Viktor
*
*/
@Entity
@Table(name = "menu")
public class Menu implements Serializable {
@Id
@GeneratedValue
@Column(name = "id")
private long id;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "restaurant_id", nullable = false)
private Restaurant restaurant;
public Menu() {
}
public Menu(Restaurant restaurant) {
this.restaurant = restaurant;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Restaurant getRestaurant() {
return restaurant;
}
public void setRestaurant(Restaurant restaurant) {
this.restaurant = restaurant;
}
}
|
4eb9d5f5-59a1-48fa-a133-85752c1bd15c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-20 13:29:58", "repo_name": "clblue/HibrnateDemo", "sub_path": "/src/user/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 1065, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "83ca83f43c3f726c67ee1f3a0f36d8271bb639fd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/clblue/HibrnateDemo | 210 | FILENAME: User.java | 0.229535 | package user;
public class User {
private String username;
private String password;
private Product product;
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public User() {
}
public User(String username, String password, Product product) {
this.username = username;
this.password = password;
this.product = product;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String print()
{
/* int[] a = new int[3];
a[3] = 5;*/
return "User{" +
"username='" + username + '\'' +
", password='" + password + '\'' +
", product=" + product +
'}';
}
}
|
fc555f1a-7cda-4220-befc-24195285ba48 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-01 14:16:11", "repo_name": "Hkohli30/ShoppingApplication", "sub_path": "/app/src/main/java/com/example/hkohli/shoppingapplication/ImageConverter.java", "file_name": "ImageConverter.java", "file_ext": "java", "file_size_in_byte": 1090, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "172baa351d202c6a2173492247a9b2bc046ff23c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Hkohli30/ShoppingApplication | 225 | FILENAME: ImageConverter.java | 0.250913 | package com.example.hkohli.shoppingapplication;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.Image;
import android.util.Base64;
import java.io.ByteArrayOutputStream;
/**
* Created by Hkohli on 9/22/2016.
*/
public class ImageConverter {
public String bitmapToBase64(Image image,Context context)
{
String stringImage = null;
Bitmap bitmap;
bitmap = BitmapFactory.decodeResource(context.getResources(),R.drawable.l);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream .toByteArray();
stringImage = Base64.encodeToString(byteArray, Base64.DEFAULT);
return stringImage;
}
public Bitmap base64ToBitmap(String b64)
{
byte imageAsByte[] = Base64.decode(b64.getBytes(),Base64.DEFAULT);
return BitmapFactory.decodeByteArray(imageAsByte,0,imageAsByte.length);
}
}
|
f28d124a-cb0d-44bd-b8de-3f1a4481321f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-12 01:40:24", "repo_name": "hellcy/GramDispatch", "sub_path": "/app/src/main/java/au/com/gramline/gramdispatch/pojo/JobOrderListTest.java", "file_name": "JobOrderListTest.java", "file_ext": "java", "file_size_in_byte": 1136, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "2ed43136a851808c0e5d91d06524bec8affd1f49", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hellcy/GramDispatch | 234 | FILENAME: JobOrderListTest.java | 0.259826 | package au.com.gramline.gramdispatch.pojo;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
import java.util.List;
public class JobOrderListTest {
@SerializedName("results")
public List<JobOrder> data = new ArrayList<>();
public class JobOrder {
@SerializedName("SEQNO")
public Integer SEQNO;
@SerializedName("HDR_SEQNO")
public Integer HDR_SEQNO;
@SerializedName("STOCKCODE")
public String STOCKCODE;
@SerializedName("DESCRIPTION")
public String DESCRIPTION;
@SerializedName("QTYREQD")
public Double QTYREQD;
@SerializedName("QTYUSED")
public Double QTYUSED;
@SerializedName("BATCHCODE")
public String BATCHCODE;
@SerializedName("X_LENGTH")
public Integer X_LENGTH;
@SerializedName("X_COLOR")
public String X_COLOR;
@SerializedName("X_SOLINE")
public Integer X_SOLINE;
@SerializedName("X_NARRATIVE")
public Integer X_NARRATIVE;
@SerializedName("X_LINESTATUS")
public Integer X_LINESTATUS;
}
} |
281e15f7-ba59-4bf6-a131-183c3d07ef51 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-06 20:45:46", "repo_name": "mabdolla/Twitter-Project", "sub_path": "/login-microservice/src/main/java/no/oslomet/loginmicroservice/model/TwitterUser.java", "file_name": "TwitterUser.java", "file_ext": "java", "file_size_in_byte": 1196, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "1e3bafe07c76224426e854b4db5c19f7a3db92cc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mabdolla/Twitter-Project | 237 | FILENAME: TwitterUser.java | 0.180107 | package no.oslomet.loginmicroservice.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import no.oslomet.common.api.User;
@JsonIgnoreProperties(ignoreUnknown = true)
public class TwitterUser implements User {
@JsonProperty
private String firstName;
@JsonProperty
private String lastName;
@JsonProperty
private String email;
public TwitterUser() {
}
public TwitterUser(String firstName, String lastName, String email) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public String getFirstName() {
return null;
}
@Override
public String getLastName() {
return null;
}
@Override
public String getEmail() {
return null;
}
@Override
public Long getTwitterId() {
return null;
}
}
|
cb1d409d-2707-4666-b2a5-97b294fae4d6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-16 01:51:35", "repo_name": "MrLexJR/AppWeb-JavaSB-ReactJs-Kruger", "sub_path": "/jr_proyect_k/src/main/java/com/jr/kruger/jr_proyect_k/services/PersonaService.java", "file_name": "PersonaService.java", "file_ext": "java", "file_size_in_byte": 1136, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "985c5a2b592f215f8ddf21aa8fe7c0e31d45fbe5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MrLexJR/AppWeb-JavaSB-ReactJs-Kruger | 220 | FILENAME: PersonaService.java | 0.250913 | package com.jr.kruger.jr_proyect_k.services;
import java.util.ArrayList;
import java.util.Optional;
import com.jr.kruger.jr_proyect_k.modules.PersonaModel;
import com.jr.kruger.jr_proyect_k.repositories.PersonaRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class PersonaService {
@Autowired
PersonaRepository personaRepository;
public ArrayList<PersonaModel> obtenerPersonas(){
return (ArrayList<PersonaModel>) personaRepository.findAll();
}
public PersonaModel guardarPersona(PersonaModel persona){
return personaRepository.save(persona);
}
public Optional<PersonaModel> obtenerPorId(Long id){
return personaRepository.findById(id);
}
public ArrayList<PersonaModel> obtenerPorCedula(String cedula){
return personaRepository.findByCedula(cedula);
}
public boolean eliminarUsuario(Long id){
try {
personaRepository.deleteById(id);
return true;
} catch (Exception e) {
return false;
}
}
}
|
0794b158-a5bd-4a9c-bf55-1e32b120f0dc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-03-18 02:21:59", "repo_name": "ZhouChen-TW/Mybatis_Learn", "sub_path": "/src/main/java/com/mybatis/lean/core/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 1114, "line_count": 63, "lang": "en", "doc_type": "code", "blob_id": "51017b3f3a568fec2710167b10a14bdec84115e4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ZhouChen-TW/Mybatis_Learn | 264 | FILENAME: User.java | 0.235108 | package com.mybatis.lean.core;
import java.util.List;
/**
* Created by zoe on 3/15/16.
*/
public class User {
private Integer id;
private String name;
private Icard icard;
private List<Contact> contacts;
private List<Group> groups;
public User(){}
public User(Integer id,String name,Icard icard){
this.id=id;
this.name =name;
this.icard=icard;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Icard getIcard() {
return icard;
}
public void setIcard(Icard icard) {
this.icard = icard;
}
public List<Contact> getContacts() {
return contacts;
}
public void setContacts(List<Contact> contacts) {
this.contacts = contacts;
}
public List<Group> getGroups() {
return groups;
}
public void setGroups(List<Group> groups) {
this.groups = groups;
}
}
|
2a7b9f38-b421-4927-8910-162b01093f60 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-06 18:16:51", "repo_name": "CaballepMobile/AndroidTraining", "sub_path": "/Daily/Week2/MultiThreading/app/src/main/java/com/example/angel/multi_threading/workers/MyThread.java", "file_name": "MyThread.java", "file_ext": "java", "file_size_in_byte": 1052, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "be55c8e783321a0e40217679ff5367315a5e45ae", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/CaballepMobile/AndroidTraining | 204 | FILENAME: MyThread.java | 0.286968 | package com.example.angel.multi_threading.workers;
import android.os.Handler;
import android.os.Looper;
import android.widget.TextView;
import com.example.angel.multi_threading.utils.TaskCreator;
public class MyThread extends Thread {
TextView tvMain;
Handler handler;
public MyThread(TextView tvMain) {
this.tvMain = tvMain;
this.handler = new Handler(Looper.getMainLooper());
}
@Override
public void run() {
super.run();
//Before task is started
handler.post(new Runnable() {
@Override
public void run() {
tvMain.setText("Task starting");
}
});
//Task is executed
try {
TaskCreator.createSimpleTask(this);
}catch(InterruptedException e){
e.printStackTrace();
}
//Task completed
handler.post(new Runnable() {
@Override
public void run() {
tvMain.setText("Task finished");
}
});
}
} |
f5942b6f-6ede-48c2-80f1-e317c9d08a16 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-03-28 15:43:35", "repo_name": "ruivale/Java", "sub_path": "/JavaBeanValidatorWithMaven/src/main/java/com/mycompany/javabeanvalidatorwithmaven/Car.java", "file_name": "Car.java", "file_ext": "java", "file_size_in_byte": 974, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "11b37f9ee59e17b4a20a70c8c6a2d4ee59894572", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ruivale/Java | 206 | FILENAME: Car.java | 0.292595 | package com.mycompany.javabeanvalidatorwithmaven;
import jakarta.validation.constraints.*;
public class Car
{
// ---------------| Member fields |----------------------------
@NotNull
private String manufacturer;
@NotNull
@Size ( min = 2, max = 14 )
private String licensePlate;
@Min ( 2 )
private int seatCount;
// ---------------| Constructors |----------------------------
public Car ( String manufacturer , String licensePlate , int seatCount )
{
this.manufacturer = manufacturer;
this.licensePlate = licensePlate;
this.seatCount = seatCount;
}
// ---------------| Object overrides |----------------------------
@Override
public String toString ( )
{
return "Car{ " +
"manufacturer='" + manufacturer + '\'' +
" | licensePlate='" + licensePlate + '\'' +
" | seatCount=" + seatCount +
" }";
}
} |
1d3d649b-c347-4017-ad6b-e5722e774e3b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-04-10 10:32:08", "repo_name": "tito5460/practice", "sub_path": "/springboot-gradle-rabbitmq/produce/src/main/java/com/example/rabbit/produce/sender/TopicSender.java", "file_name": "TopicSender.java", "file_ext": "java", "file_size_in_byte": 989, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "6f6ca5bee468138fb24f35f9af832be9053f7c8a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tito5460/practice | 226 | FILENAME: TopicSender.java | 0.252384 | package com.example.rabbit.produce.sender;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class TopicSender {
@Autowired
private AmqpTemplate rabbitTemplate;
public void send1() {
String str = "Topic Sender: topic.message";
System.out.println(str);
this.rabbitTemplate.convertAndSend("topicExchange", "topic.message", str);
}
public void send2() {
String str = "Topic Sender: topic.messages++";
System.out.println(str);
this.rabbitTemplate.convertAndSend("topicExchange", "topic.messages", str);
}
public void send3() {
String str = "Topic Sender: topic.1";
System.out.println(str);
this.rabbitTemplate.convertAndSend("topicExchange", "topic.1", str);
}
public void send4() {
String str = "Topic Sender: topic.2";
System.out.println(str);
this.rabbitTemplate.convertAndSend("topicExchange", "topic.2", str);
}
} |
1796f04c-57ff-435d-a5f4-0aaa131c938b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-26 10:44:17", "repo_name": "DianaBobkova/Polib", "sub_path": "/src/polibii/Encryption.java", "file_name": "Encryption.java", "file_ext": "java", "file_size_in_byte": 1137, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "3c1ea8bb326d89fdbcac2f489a199e100ffc7081", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DianaBobkova/Polib | 284 | FILENAME: Encryption.java | 0.290176 | package polibii;
public class Encryption {
private String text = "";
private String encText = "";
public Encryption(String text) {
this.text = text;
findInArr(this.text);
}
public String getEncText() {
return this.encText;
}
public void findInArr(String text) {
for (int i = 0; i < text.length(); ++i) {
this.encText += charIn(text.charAt(i));
}
}
public void finalEncrypt(String text) {
String spaceDel = text.replaceAll(" ", "");
System.out.println(spaceDel);
String rez = "";
rez += spaceDel.charAt(spaceDel.length());
for (int i = 0; i < (spaceDel.length() - 1); ++i) {
rez += spaceDel.charAt(i + 1);
}
this.encText = rez;
}
public String charIn(char c) {
String rez = "";
for (int i = 0; i < Main.key.length; ++i) {
for (int j = 0; j < Main.key[i].length; ++j) {
if (Main.key[i][j] == c) {
rez = rez + (i + "" + j + " ");
}
}
}
return rez;
}
}
|
300f89c2-fe71-45ff-950e-6a328f8eb89d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2014-11-23T11:46:31", "repo_name": "Gigacore/iOrange-2", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1197, "line_count": 34, "lang": "en", "doc_type": "text", "blob_id": "1681e9ec795cfa42b305e5ed8dd89a61f9af0035", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/Gigacore/iOrange-2 | 338 | FILENAME: README.md | 0.290981 | iOrange 2.0
=========
iOrange 2.0 is a free, simple and light-weight web template for your website and is valid HTML5 & CSS3 (W3C Compliant) document. This template is built on HTML5 Boiler Plate framework and is fully responsive with mobile-first attitude and weighs just under 60KB.
##Don't like Orange?
I have 3 other flavors for you. Not everyone likes Orange. Since iOrange 1.0 was released in 2008, I've no idea why I chose Orange as primary color. Just make the following changes and you will love the color psychology. You will need to edit `main.css` and make changes to header, nav and footer elements.

### Turquoise:
.header-container {background: #7DA7D9;}
#nav {background: #6697D2;}
.footer-container {border-bottom : 2px solid #6697D2;}
### Emerald:
.header-container {background: #50C878;}
#nav {background: #37AE5E;}
.footer-container {border-bottom : 2px solid #37AE5E;}
### Ruby:
.header-container {background: #E0115F;}
#nav { background: #B40E4D; }
.footer-container {border-bottom : 2px solid #B40E4D;}
## License
iOrange 2 is licensed under MIT.
|
29774c3d-f5b1-40ad-812d-2d783a7cb765 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-21 14:05:03", "repo_name": "sid046/QMB", "sub_path": "/app/src/main/java/com/animation/qmb/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1195, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "db020f5b3852dc34e61aec58093892464d5c565a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sid046/QMB | 184 | FILENAME: MainActivity.java | 0.233706 | package com.animation.qmb;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SharedPreferences sharedPreferences = getSharedPreferences("UserLogin",MODE_PRIVATE);
final String Status =sharedPreferences.getString("Status","");
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (Status != ""){
Intent i = new Intent(MainActivity.this, course.class);
startActivity(i);
finish();
}
else {
Intent i = new Intent(MainActivity.this, Register.class);
startActivity(i);
finish();
}
//This method will be executed once the timer is over
}
}, 2000);
}
}
|
5bd94735-0d66-4991-9b58-c15cc77008f0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-21 17:17:01", "repo_name": "pyotrbodlev/softunirepo", "sub_path": "/JavaDBAdvanced/mostwanted/src/main/java/mostwanted/domain/entities/Race.java", "file_name": "Race.java", "file_ext": "java", "file_size_in_byte": 1020, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "e2c5d15bac9a54560def9363155e2d71ad568982", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/pyotrbodlev/softunirepo | 220 | FILENAME: Race.java | 0.259826 | package mostwanted.domain.entities;
import mostwanted.domain.entities.base.BaseEntity;
import javax.persistence.*;
import java.util.List;
@Entity
@Table(name = "races")
public class Race extends BaseEntity {
private int laps;
private District district;
private List<RaceEntry> entries;
@Column(name = "laps", nullable = false)
public int getLaps() {
return laps;
}
public void setLaps(int laps) {
this.laps = laps;
}
@ManyToOne(targetEntity = District.class, cascade = CascadeType.ALL)
@JoinColumn(name = "district_id", referencedColumnName = "id", nullable = false)
public District getDistrict() {
return district;
}
public void setDistrict(District district) {
this.district = district;
}
@OneToMany(mappedBy = "race", targetEntity = RaceEntry.class)
public List<RaceEntry> getEntries() {
return entries;
}
public void setEntries(List<RaceEntry> entries) {
this.entries = entries;
}
}
|
ed9ae497-6e1d-4c93-bd9f-8212eb1612ff | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-03 13:22:10", "repo_name": "abohomol/gifky", "sub_path": "/app/src/main/java/com/abohomol/gifky/skeleton/BasePresenter.java", "file_name": "BasePresenter.java", "file_ext": "java", "file_size_in_byte": 1093, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "af141d884e01ab5651ec35c8937d560481a808b8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/abohomol/gifky | 229 | FILENAME: BasePresenter.java | 0.282988 | package com.abohomol.gifky.skeleton;
/**
* Base class that implements the {@link Presenter} interface and provides a base implementation
* for {@link #attachView(View)} and {@link #detachView()}.
* It also handles keeping a reference to the view that can be accessed from the
* children classes by calling {@link #getView()}.
*/
public abstract class BasePresenter<T extends View> implements Presenter<T> {
private T view;
@Override
public void attachView(T view) {
this.view = view;
}
@Override
public void detachView() {
view = null;
}
public boolean isViewAttached() {
return view != null;
}
public T getView() {
return view;
}
public void checkViewAttached() {
if (!isViewAttached()) throw new ViewNotAttachedException();
}
private static class ViewNotAttachedException extends RuntimeException {
ViewNotAttachedException() {
super("Please call Presenter.attachView(View) before" +
" requesting data from the Presenter");
}
}
}
|
0ca003ab-899d-43f1-805d-7979e92b1843 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-22 19:36:44", "repo_name": "13399182359/LeXiang", "sub_path": "/LeXiang-manager-web/src/main/java/com/LeXiang/manager/controller/MessageController.java", "file_name": "MessageController.java", "file_ext": "java", "file_size_in_byte": 1059, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "b32e49f5633b2c344663ed29a5245ddf76566f9a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/13399182359/LeXiang | 192 | FILENAME: MessageController.java | 0.246533 | package com.LeXiang.manager.controller;
import com.LeXiang.Entity.PageResult;
import com.LeXiang.Entity.Result;
import com.LeXiang.manager.service.MessageService;
import com.LeXiang.pojo.Message;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("message")
public class MessageController {
@Reference
private MessageService messageService;
@RequestMapping("insertMessage")
public Result insertMessage(Message message,String username){
return messageService.insertMessage(message,username);
}
@RequestMapping("queryMessage")
public PageResult queryMessage(Message message,Integer page,Integer rows){
return messageService.queryMessage(message,page,rows);
} @RequestMapping("queryMessage2")
public PageResult queryMessage2(Message message,Integer page,Integer rows){
return messageService.queryMessage2(message,page,rows);
}
}
|
08fb9f49-9076-494d-b1d8-04b4ffead7dc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-05 09:11:18", "repo_name": "UnowHouse/aibrainer", "sub_path": "/ab-common/src/main/java/com/ab/commons/enums/ExceptionEnum.java", "file_name": "ExceptionEnum.java", "file_ext": "java", "file_size_in_byte": 1336, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "5f13a25d53ed788b0c1fcc3a938f6bd74436bfee", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/UnowHouse/aibrainer | 359 | FILENAME: ExceptionEnum.java | 0.256832 | package com.ab.commons.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
/*
* @项目名: ai-brainer
* @包名: com.ab.commons.enums
* @文件名: ExceptionEnum
* @创建者: Unow
* @创建时间: 2019/1/1 14:27
* @描述: 异常种类枚举
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum ExceptionEnum {
REMOVE_WOKER_FAILURE(500,"移除工作者失败"),
USER_CHECK_FAILURE(401,"校验失败"),
INVALID_PARAM(400, "参数错误"),
USERNAME_OR_PASSWORD_ERROR(400, "账号或密码错误"),
VERIFY_CODE_NOT_MATCHING(400, "验证码错误"),
PASSWORD_NOT_MATCHING(400, "密码错误"),
USER_NOT_EXIST(404, "用户不存在"),
CREATE_TOKEN_ERROR(500, "生成校验码失败"),
INVAILD_AUTHORITY_VISIT(403, "无访问权限"),
ERROR_ADD_TASK(500, "新增任务失败"),
INVALID_FILE_TYPE(400,"文件类型不匹配"),
UPLOAD_FILE_ERROR(500,"文件上传失败"),
FILE_EXCEEDING_MAXIMUM(500,"文件超过最大容量限制"),
ERROR_INSERT_WORK_DATA(400,"标注数据插入失败"),
INVAILD_JOIN(400,"不被允许的加入任务请求"),
TASK_NOT_FOUND(404,"任务不存在"),
;
private int status;
private String message;
}
|
c0aa97f9-a9af-4ed1-9c7e-1dbfb0c44eb8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-04-19 07:10:29", "repo_name": "lukaselmer/ethz-db-project", "sub_path": "/src/main/java/ch/ethz/inf/dbproject/model/StretchGoal.java", "file_name": "StretchGoal.java", "file_ext": "java", "file_size_in_byte": 996, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "ae69b131d192e5ba18bf76767d19ae4bdf354a3c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lukaselmer/ethz-db-project | 233 | FILENAME: StretchGoal.java | 0.282988 | package ch.ethz.inf.dbproject.model;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Object that represents a stretch goal
*/
public class StretchGoal implements ComboInterface {
private final int id;
private final int project_id;
private final double amount;
private final String bonus;
public StretchGoal(final int id, final int project_id, final double amount, final String bonus) {
this.id = id;
this.project_id = project_id;
this.amount = amount;
this.bonus = bonus;
}
public StretchGoal (final ResultSet rs) throws SQLException {
this.id = rs.getInt("id");
this.project_id = rs.getInt("project_id");
this.amount = rs.getDouble("amount");
this.bonus = rs.getString("bonus");
}
public double getAmount() {
return amount;
}
public String getBonus() {
return bonus;
}
public int getId() {
return id;
}
public int getProjectId() {
return project_id;
}
public String toString() {;
return "[" + amount + "]: " + bonus;
}
}
|
47a850da-60c9-47c4-a460-afdc6246c981 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-17 01:18:55", "repo_name": "jtschiss/PizzaGenerator", "sub_path": "/src/main/java/edu/matc/controller/ForwardUsers.java", "file_name": "ForwardUsers.java", "file_ext": "java", "file_size_in_byte": 1085, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "deb0beae4e4c9b611121bca39f7ae0ae5b2bbcb7", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jtschiss/PizzaGenerator | 189 | FILENAME: ForwardUsers.java | 0.273574 | package edu.matc.controller;
import edu.matc.entity.User;
import edu.matc.persistence.UserDao;
import javax.servlet.RequestDispatcher;
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;
import java.util.ArrayList;
import java.util.List;
/**
* forwards list of all users back to pizza builder page after sign in
*/
@WebServlet(
name="ForwardUsers",
urlPatterns = {"/user/forwardUsers"}
)
public class ForwardUsers extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
UserDao userDao = new UserDao();
List<User> users = new ArrayList<>();
users = userDao.getAll();
req.setAttribute("usersList", users);
RequestDispatcher dispatcher = req.getRequestDispatcher("/user/pizzaBuilder.jsp");
dispatcher.forward(req, resp);
}
} |
ee14fdad-80c3-4112-b5af-c3fabbc00132 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-06-27 15:01:41", "repo_name": "onozaty/mybatis-postgresql-typehandlers", "sub_path": "/src/test/java/com/github/onozaty/mybatis/pg/type/TestUtils.java", "file_name": "TestUtils.java", "file_ext": "java", "file_size_in_byte": 995, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "6695677dd06f55bb0a8ec7123337f7e8c13cd5a5", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/onozaty/mybatis-postgresql-typehandlers | 170 | FILENAME: TestUtils.java | 0.225417 | package com.github.onozaty.mybatis.pg.type;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
/**
* @author onozaty
*/
public class TestUtils {
public static SqlSession createSession(Class<?> clazz, String name) throws IOException {
try (InputStream inputStream = clazz.getResourceAsStream(name)) {
String dbhost = System.getProperty("dbhost");
if (dbhost == null || dbhost == "") {
dbhost = "localhost";
}
Properties properties = new Properties();
properties.setProperty("dbhost", dbhost);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream, properties);
return sqlSessionFactory.openSession();
}
}
}
|
9dcf9990-ad03-40d1-a412-89b3bb2d7ecd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-14 15:30:00", "repo_name": "Taequn/cs102", "sub_path": "/L11_starter/Human.java", "file_name": "Human.java", "file_ext": "java", "file_size_in_byte": 1136, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "c26359aa3ee24403dc575021bc4ae790205b44fc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Taequn/cs102 | 255 | FILENAME: Human.java | 0.285372 | import java.util.ArrayList;
public class Human implements Player{
private ArrayList<Integer> history;
public void initPlayer(int startingSticks){
history = new ArrayList<Integer>();
}
public int takeTurn(int remainingSticks){
int maxChoiceThisTurn = Math.min(remainingSticks, Matchsticks.MAX_STICKS_CHOICE);
String prompt = "How many sticks will you take (1 - " + maxChoiceThisTurn + ")?: ";
int choice = Matchsticks.getValidInput(prompt, 1, maxChoiceThisTurn);
history.add(choice);
return choice;
}
public String getDebugInfo(){
String debug = "Previous Moves: ";
if (history.size() == 0)
return debug + "no turns taken yet!";
for(int i = 0; i < history.size(); i++){
debug += "Turn " + (i+1) + ": " + history.get(i);
if (i != history.size()-1)
debug += ", ";
}
return debug;
}
public void gameOver(boolean didPlayerWin){
history = new ArrayList<Integer>();
}
public String getPlayerType(){
return "Human";
}
} |
883d13a1-ea34-40ec-957d-9da2fdfb18a7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-01-01 19:37:05", "repo_name": "mback2k/ts3admin", "sub_path": "/src/de/uxnr/ts3/admin/ui/action/DisconnectAction.java", "file_name": "DisconnectAction.java", "file_ext": "java", "file_size_in_byte": 1196, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "2782a5716b3a649d80072658a7da69594e4ebd22", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mback2k/ts3admin | 240 | FILENAME: DisconnectAction.java | 0.252384 | package de.uxnr.ts3.admin.ui.action;
import org.eclipse.jface.action.Action;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.TabItem;
import de.uxnr.ts3.admin.ui.composite.ConnectionComposite;
import de.uxnr.ts3.admin.ui.resource.IconDescriptor;
public class DisconnectAction extends Action implements SelectionListener {
private static DisconnectAction uniqueInstance = null;
private DisconnectAction() {
super("&Disconnect", new IconDescriptor("disconnect"));
this.setEnabled(false);
}
public static DisconnectAction getInstance() {
if (DisconnectAction.uniqueInstance == null) {
DisconnectAction.uniqueInstance = new DisconnectAction();
}
return DisconnectAction.uniqueInstance;
}
@Override
public void run() {
ConnectionComposite.getSelected().disconnect();
}
@Override
public void widgetSelected(SelectionEvent e) {
ConnectionComposite connection = (ConnectionComposite) ((TabItem) e.item).getControl();
this.setEnabled(connection != null);
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
this.widgetSelected(e);
}
}
|
0341172f-4102-4ed1-b38e-4722b6a73b92 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-16 07:44:40", "repo_name": "dzfg/mybatis", "sub_path": "/src/main/java/a/entity/Emp.java", "file_name": "Emp.java", "file_ext": "java", "file_size_in_byte": 1243, "line_count": 74, "lang": "en", "doc_type": "code", "blob_id": "2cb6db0e5b2fcd7b1a7b738bb41060a1a5481fb6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dzfg/mybatis | 294 | FILENAME: Emp.java | 0.283781 | package a.entity;
import java.io.Serializable;
@SuppressWarnings("serial")
public class Emp implements Serializable {
private String id;
private String name;
private String gender;
private Double salary;
// 所属部门
private Dept dept;
public Emp() {
}
public Emp(String id, String name, String gender, Double salary, Dept dept) {
super();
this.id = id;
this.name = name;
this.gender = gender;
this.salary = salary;
this.dept = dept;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public Double getSalary() {
return salary;
}
public void setSalary(Double salary) {
this.salary = salary;
}
public Dept getDept() {
return dept;
}
public void setDept(Dept dept) {
this.dept = dept;
}
@Override
public String toString() {
return "Emp [id=" + id + ", name=" + name + ", gender=" + gender + ", salary=" + salary + ", dept=" + dept
+ "]";
}
}
|
6ac1bda6-eee3-4f47-8252-20f58efdfdbb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-29 09:24:06", "repo_name": "Amangoel998/Feedback-Management-System", "sub_path": "/Feedback Management System Console/src/com/cg/feedback/dto/ProgramDTO.java", "file_name": "ProgramDTO.java", "file_ext": "java", "file_size_in_byte": 1082, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "a195b53789dd6ac8ac39b7c91c1b546544ed0c99", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Amangoel998/Feedback-Management-System | 254 | FILENAME: ProgramDTO.java | 0.279042 | package com.cg.feedback.dto;
public class ProgramDTO {
private String programId;
private String programName;
private boolean isActive;
// Constructor
public ProgramDTO(String programId, String programName) {
super();
this.programName = programName;
this.programId = programId;
isActive=true;
}
@Override
public String toString() {
return "ProgramDTO [programId=" + programId + ", programName=" + programName + ", isActive=" + isActive + "]";
}
// Getters and Setters
public boolean isActive() {
return isActive;
}
public void setActive(boolean isActive) {
this.isActive = isActive;
}
public String getProgramName() {
return programName;
}
public void setProgramName(String programName) {
this.programName = programName;
}
public String getProgramId() {
return programId;
}
public void setProgramId(String programId) {
this.programId = programId;
}
@Override
public boolean equals(Object obj) {
ProgramDTO temp = (ProgramDTO) obj;
if (temp.getProgramName().equals(this.programName))
return true;
return false;
}
}
|
4c213a34-3ceb-4656-869b-52dab0249bfc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-22 17:40:43", "repo_name": "HubSpot/twitter4j", "sub_path": "/twitter4j-examples/src/main/java/twitter4j/examples/tweets/LookupStatus.java", "file_name": "LookupStatus.java", "file_ext": "java", "file_size_in_byte": 1053, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "60ef49ec7bae9b95b08a9988cee9fb218c657c96", "star_events_count": 0, "fork_events_count": 4, "src_encoding": "UTF-8"} | https://github.com/HubSpot/twitter4j | 243 | FILENAME: LookupStatus.java | 0.288569 | package twitter4j.examples.tweets;
import twitter4j.ResponseList;
import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
/**
* Testing the batch lookup status call with a single ID as input.
*/
public class LookupStatus {
/**
* Usage: java twitter4j.examples.tweets.LookupStatus [status id]
*/
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage: java twitter4j.examples.tweets.LookupStatus [status id]");
System.exit(-1);
}
try {
Twitter twitter = new TwitterFactory().getInstance();
ResponseList<Status> responseList = twitter.lookup(Long.parseLong(args[0]));
for (Status status : responseList) {
System.out.println("@" + status.getUser().getScreenName() + " - " + status.getText());
}
System.exit(0);
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to show status: " + te.getMessage());
System.exit(-1);
}
}
}
|
24e87fdc-8e4e-411d-8ab6-1588d6dbd8ed | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-26 14:01:23", "repo_name": "oyadier/BroadCasting", "sub_path": "/app/src/main/java/com/oyatech/broadcasting/LoggingActivity.java", "file_name": "LoggingActivity.java", "file_ext": "java", "file_size_in_byte": 1115, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "933f0c600218ac041bd628f9f3fd94f3c080f040", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/oyadier/BroadCasting | 223 | FILENAME: LoggingActivity.java | 0.246533 | package com.oyatech.broadcasting;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.Nullable;
public class LoggingActivity extends Activity {
final String TAG = getClass().getSimpleName();
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(savedInstanceState != null)
{
Log.d(TAG, "onCreate: object already created");
}
else Log.d(TAG, "onCreate: activity is about to be created");
}
@Override
protected void onStart() {
super.onStart();
Log.d(TAG, "onStart: the activity is becoming to the foreground");
}
@Override
protected void onResume() {
super.onResume();
Log.d(TAG, "onResume: the activity is fully seen and interactive with the user");
}
@Override
protected void onPause() {
super.onPause();
Log.d(TAG, "onPause: the activity is now invisible");
}
@Override
protected void onDestroy() {
super.onDestroy();
}
}
|
b08125b7-dc1f-4cf4-8250-2f15b963cbbc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-06 21:53:28", "repo_name": "JarneVanAerde/TrafficAnalyser", "sub_path": "/simulator/src/main/java/be/kdg/simulator/services/impl/messengers/CommandLineMessenger.java", "file_name": "CommandLineMessenger.java", "file_ext": "java", "file_size_in_byte": 1137, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "642522466f53fd530b5ac9431d693693d1a8597c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JarneVanAerde/TrafficAnalyser | 210 | FILENAME: CommandLineMessenger.java | 0.239349 | package be.kdg.simulator.services.impl.messengers;
import be.kdg.simulator.models.CameraMessage;
import be.kdg.simulator.services.api.Messenger;
import be.kdg.simulator.services.exceptions.ServiceException;
import be.kdg.simulator.services.impl.utils.MessageWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
/**
* Messenger used to send messages to the command line.
*/
@Component
@ConditionalOnProperty(name = "messaging.type", havingValue = "cmd")
public class CommandLineMessenger implements Messenger {
private final MessageWriter messageWriter;
@Autowired
public CommandLineMessenger(MessageWriter messageWriter) {
this.messageWriter = messageWriter;
}
/**
* Generates a message from the file -or random generator
* and prints it to the commandline.
*/
@Override
public void sendMessage(CameraMessage message) throws ServiceException {
messageWriter.writeMessage(message);
System.out.println(message);
}
}
|
5b0a8da0-976a-48e0-bb8e-df9ac6da7e68 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-31 22:15:37", "repo_name": "sidorchukandrew/upcafe-api", "sub_path": "/src/main/java/upcafe/error/CustomErrorResponse.java", "file_name": "CustomErrorResponse.java", "file_ext": "java", "file_size_in_byte": 1196, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "fc694942c46e7d4728103e53a5a50b8b3f5469a2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sidorchukandrew/upcafe-api | 236 | FILENAME: CustomErrorResponse.java | 0.242206 | package upcafe.error;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
public class CustomErrorResponse {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM-dd-yyyy hh:mm:ss")
private LocalDateTime timestamp;
private int status;
private String error;
public CustomErrorResponse(LocalDateTime timestamp, int status, String error) {
super();
this.timestamp = timestamp;
this.status = status;
this.error = error;
}
public CustomErrorResponse() {
super();
}
public LocalDateTime getTimestamp() {
return timestamp;
}
public void setTimestamp(LocalDateTime localDateTime) {
this.timestamp = localDateTime;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
@Override
public String toString() {
return "CustomErrorResponse [timestamp=" + timestamp + ", status=" + status + ", error=" + error + "]";
}
}
|
59145795-8a66-41c5-9e4f-c528573fc940 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-22 06:30:03", "repo_name": "ducanhkl/hecsdldpt", "sub_path": "/src/main/java/com/btl/hecsdlpt/imageSearch/storage/StorageEngine.java", "file_name": "StorageEngine.java", "file_ext": "java", "file_size_in_byte": 984, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "37b4f9e5924779733f42b9aa203666799736b7bf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ducanhkl/hecsdldpt | 187 | FILENAME: StorageEngine.java | 0.243642 | package com.btl.hecsdlpt.imageSearch.storage;
import javassist.bytecode.stackmap.BasicBlock;
import org.openimaj.io.Cache;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
public class StorageEngine {
public static String path = "src/main/data";
static public void write(Chunk[] chunks) {
try {
FileOutputStream fos = new FileOutputStream(path);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(chunks);
} catch (Exception ex) {
ex.printStackTrace();
}
}
static public Chunk[] read() {
try {
FileInputStream fis = new FileInputStream(path);
ObjectInputStream ois = new ObjectInputStream(fis);
return (Chunk[]) ois.readObject();
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
}
|
f0e1b921-6a07-4351-b74b-9f7f1ba519a2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-18 08:27:29", "repo_name": "Joycn2018/seckill", "sub_path": "/src/main/java/com/chi/seckill/entity/Store.java", "file_name": "Store.java", "file_ext": "java", "file_size_in_byte": 1179, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "2e66aaf37c376231c292e0ed3220acfd6bbc11b7", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Joycn2018/seckill | 251 | FILENAME: Store.java | 0.212069 | package com.chi.seckill.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 商家表
* </p>
*
* @author ChiYuhang
* @since 2021-08-13
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="Store对象", description="商家表")
public class Store implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
@ApiModelProperty(value = "创建时间")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
@ApiModelProperty(value = "修改时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
@ApiModelProperty(value = "商家昵称")
private String name;
}
|
f4c6cdeb-329b-42ca-9845-27a8cd4ef808 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-01 21:30:01", "repo_name": "yichunzhao/Cases-for-Oracle-OCPJP-Certificate", "sub_path": "/src/FileIO/ObjectIO.java", "file_name": "ObjectIO.java", "file_ext": "java", "file_size_in_byte": 1057, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "28c38ee2e90844a4d0c5d8926f782654e84fd786", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/yichunzhao/Cases-for-Oracle-OCPJP-Certificate | 201 | FILENAME: ObjectIO.java | 0.268941 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package FileIO;
import CollectionFun.Person;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author YNZ
*/
public class ObjectIO {
public static void main(String[] args) {
Person bd = new Person("Yichun Zhao", 100);
try (ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream("myobject.obj"))) {
os.writeObject(bd);
os.flush();
} catch (FileNotFoundException ex) {
Logger.getLogger(ObjectIO.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(ObjectIO.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.