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 |
|---|---|---|---|---|---|---|
760ff856-04d5-4239-8364-7f79c6e7f2e3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-02-27 18:12:36", "repo_name": "RomanDorosinec/TATJAVA01_2017_Task04_Raman_Darasinets", "sub_path": "/src/main/java/com/epam/task3/service/impl/ResourceManagerServiceImpl.java", "file_name": "ResourceManagerServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1101, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "43cd424e360820d224d7ae8cf9fb39e44015eed8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/RomanDorosinec/TATJAVA01_2017_Task04_Raman_Darasinets | 209 | FILENAME: ResourceManagerServiceImpl.java | 0.279828 | package com.epam.task3.service.impl;
import com.epam.task3.dao.DAOResourceManager;
import com.epam.task3.dao.exception.DAOException;
import com.epam.task3.dao.factory.DAOFactory;
import com.epam.task3.service.ResourceManagerService;
import com.epam.task3.service.exception.ServiceException;
/**
*
*/
public class ResourceManagerServiceImpl implements ResourceManagerService {
@Override
public void init() throws ServiceException {
DAOFactory daoFactory = DAOFactory.getInstance();
DAOResourceManager daoResourceManager = daoFactory.getDAOResourceManagerImpl();
try {
daoResourceManager.init();
} catch (DAOException e) {
throw new ServiceException(e);
}
}
@Override
public void destroy() throws ServiceException {
DAOFactory daoFactory = DAOFactory.getInstance();
DAOResourceManager daoResourceManager = daoFactory.getDAOResourceManagerImpl();
try {
daoResourceManager.destroy();
} catch (DAOException e) {
throw new ServiceException(e);
}
}
}
|
0d4fbfb3-3c00-440f-b495-30b55fdbbdc7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-02-23 23:17:19", "repo_name": "julitaSanAndres/TrabajosB_2T_14", "sub_path": "/Fragments_AngelRDuport/Fragments_Angel/src/com/angelrodriguezduport/fragments_angel/MyAdapterCorreo.java", "file_name": "MyAdapterCorreo.java", "file_ext": "java", "file_size_in_byte": 1094, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "9c299da135f91c8895780dc4de7164e0c4fd8ad7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/julitaSanAndres/TrabajosB_2T_14 | 242 | FILENAME: MyAdapterCorreo.java | 0.273574 | package com.angelrodriguezduport.fragments_angel;
import android.app.Activity;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
public class MyAdapterCorreo extends ArrayAdapter<Correo> {
Activity context;
Correo[] correos;
MyAdapterCorreo(Fragment context, Correo[] correos) {
super(context.getActivity(), R.layout.listitem_correo, correos);
this.context = context.getActivity();
this.correos = correos;
}
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View item = inflater.inflate(R.layout.listitem_correo, null);
TextView remitente = (TextView) item
.findViewById(R.id.textViewRemitente);
remitente.setText(correos[position].getRemitente());
TextView lblAsunto = (TextView) item
.findViewById(R.id.textViewAsunto);
lblAsunto.setText(correos[position].getAsunto());
return (item);
}
}
|
7c57d7da-d5ee-4039-9bb5-cb976448fd71 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-04 13:32:59", "repo_name": "Niceug/JavaProject", "sub_path": "/MyBlogJsp/src/com/tencent/wareservlet/WareServlet.java", "file_name": "WareServlet.java", "file_ext": "java", "file_size_in_byte": 1092, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "b996db5bed49c2a3289e32f8a0ca6c92b47eba0b", "star_events_count": 6, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Niceug/JavaProject | 206 | FILENAME: WareServlet.java | 0.245085 | package com.tencent.wareservlet;
import java.io.IOException;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.tencent.waresbean.WaresBean;
/**
* 商品详情页面
*/
public class WareServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
//获取传过来的ID
String wareId = request.getParameter("wareId");
try {
WaresBean w = WareService.getWareById(wareId);
if(w != null) {
request.setAttribute("ware", w);
request.getRequestDispatcher("/jsp/ware.jsp").forward(request, response);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
}
|
c5c724f0-ad38-4303-a564-22b45e9dd7f2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-25 18:35:03", "repo_name": "dwiva12/vision-mobile", "sub_path": "/app/src/main/java/xyz/finity/vision/libs/models/MatchingImage.java", "file_name": "MatchingImage.java", "file_ext": "java", "file_size_in_byte": 1140, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "32abee65ed3b920a00ac487deb244f185ece0a54", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dwiva12/vision-mobile | 242 | FILENAME: MatchingImage.java | 0.245085 | package xyz.finity.vision.libs.models;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
/**
* Created by dwiva on 5/13/19.
* This code is a part of Vision project
*/
public class MatchingImage implements Parcelable {
@SerializedName("url")
private String url;
public MatchingImage(String url) {
this.url = url;
}
protected MatchingImage(Parcel in) {
url = in.readString();
}
public static final Creator<MatchingImage> CREATOR = new Creator<MatchingImage>() {
@Override
public MatchingImage createFromParcel(Parcel in) {
return new MatchingImage(in);
}
@Override
public MatchingImage[] newArray(int size) {
return new MatchingImage[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(url);
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
|
ddda9ca5-6c68-4e07-8fe5-31d93965da66 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-07-04T05:45:58", "repo_name": "apwan/clownServer", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1102, "line_count": 43, "lang": "en", "doc_type": "text", "blob_id": "d3e63759044a3ef38e1f60d4f968eaf79c565287", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/apwan/clownServer | 273 | FILENAME: README.md | 0.218669 | clownServer
===
This repository contains the server side source code for the CLoWN online presentation project,
which aims to promote the interactivity of online presentation.
### Set up
Prerequisite: node, npm, mongodb.
Clone the release branch, run `npm install` to get required node modules.
### Launch database server
After the first launch via `mongod` (with `--auth` flag), configurate the admin account:
- use admin
- db.addUser('admin','your_password')
- db.shutdownServer()
Then launch mongodb via `mongod` with the flag `--auth`, connect by `mongo`, and type:
- use clown
- db.auth('admin','your_password')
- db.addUser('clown','clown')
- exit
You can also use your own configuration and pass them through command line.
See `ctrl/settings.js` to for what parameters to pass.
Example:
- PORT=3000 HOST=localhost DBUSER=clown DBPWD=clown nohup node bin/www > express-debug.log &
### Build & Test
Use grunt.
Run `grunt production` to concat and uglify javascripts in `public/javascripts`
Run `grunt docgen` to generate jsDoc.
Run `grunt test` to lauch QUnit test.
### Licence
MIT |
d9da2d89-81fd-46df-b686-fd052c1bcebd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-05-25 15:22:40", "repo_name": "franbn14/SORPAPETEAM", "sub_path": "/Security/src/security/GenKeys.java", "file_name": "GenKeys.java", "file_ext": "java", "file_size_in_byte": 1067, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "b162bfab3cd00acda25617cb809edeb46fdcfe2f", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/franbn14/SORPAPETEAM | 234 | FILENAME: GenKeys.java | 0.272025 | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package security;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
/**
*
* @author esteve
*/
public class GenKeys {
private PublicKey _public;
private PrivateKey _private;
public GenKeys() throws Exception{
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(1024, new SecureRandom());
KeyPair keyPair = keyPairGenerator.generateKeyPair();
_public = keyPair.getPublic();
_private = keyPair.getPrivate();
}
public PublicKey getPublic() {
return _public;
}
public void setPublic(PublicKey _public) {
this._public = _public;
}
public PrivateKey getPrivate() {
return _private;
}
public void setPrivate(PrivateKey _private) {
this._private = _private;
}
}
|
84ca6026-20df-4c03-956c-eda98d012dcf | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-09 03:02:41", "repo_name": "Chen1997c/pilipili-data", "sub_path": "/pili-provider/pili-provider-mdc/src/main/java/com/pilipili/provider/entity/ChannelSub.java", "file_name": "ChannelSub.java", "file_ext": "java", "file_size_in_byte": 1136, "line_count": 59, "lang": "en", "doc_type": "code", "blob_id": "3683abaa110375e9faee72e4b787ef685dac6adf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Chen1997c/pilipili-data | 267 | FILENAME: ChannelSub.java | 0.224055 | package com.pilipili.provider.entity;
import lombok.Data;
import lombok.ToString;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.Date;
/**
* 描述: 子分区实体
*
* @author ChenJianChuan
* @date 2019/4/13 20:47
*/
@Data
@ToString
@Entity
@Table(name = "channel_sub")
@EntityListeners(AuditingEntityListener.class)
public class ChannelSub {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 上级分区id
*/
@Column(nullable = false)
private Long channelId;
/**
* 子分区名
*/
@Column(nullable = false, length = 20)
private String channelSubName;
/**
* 分区描述
*/
@Column(nullable = false, length = 50)
private String channelDescription;
/**
* 更新时间
*/
@LastModifiedDate
private Date gmtModified;
/**
* 创建时间
*/
@CreatedDate
private Date gmtCreate;
}
|
78c4a080-f129-46fe-a9d0-ea2dc6ac63c5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-28 15:54:09", "repo_name": "quweidong/bookstore-demo-SSM", "sub_path": "/src/test/java/indi/programmer/core/serviceImpl/BookServiceImplTest.java", "file_name": "BookServiceImplTest.java", "file_ext": "java", "file_size_in_byte": 1143, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "521a68d378739d24fede9b8f1dcec3e95a444edc", "star_events_count": 7, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/quweidong/bookstore-demo-SSM | 253 | FILENAME: BookServiceImplTest.java | 0.290981 | package indi.programmer.core.serviceImpl;
import indi.programmer.core.BaseTest;
import indi.programmer.core.pojo.Book;
import indi.programmer.core.service.BookService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
public class BookServiceImplTest extends BaseTest {
@Autowired
private BookService bookService;
@Test
public void topTwentySales() {
List<Book> bookList = bookService.TopTwentySales();
for (Book book : bookList){
System.out.println(book);
}
}
@Test
public void selectOneBook() {
Book book = bookService.selectOneBook(2);
System.out.println(book);
}
@Test
public void searchBooksNumberByBookNameOrAuthor() {
int count = bookService.searchBooksNumberByBookNameOrAuthor("马");
System.out.println(count);
}
@Test
public void searchBooksByBookNameOrAuthor() {
List<Book> bookList = bookService.searchBooksByBookNameOrAuthor("马",null,null,1);
for (Book book:bookList){
System.out.println(book);
}
}
} |
cfea60af-ee16-4458-bca7-539c1bb175a3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-20 21:53:45", "repo_name": "DaWilliam/BusyBank", "sub_path": "/BusyBankSpringBoot/src/main/java/pyramid/BusyBankSpringBoot/CustomerController.java", "file_name": "CustomerController.java", "file_ext": "java", "file_size_in_byte": 994, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "9bced49bbf8b4bd5e745d4930e6cc3ab13d06125", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DaWilliam/BusyBank | 188 | FILENAME: CustomerController.java | 0.256832 | package pyramid.BusyBankSpringBoot;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Optional;
@RestController
public class CustomerController {
@Autowired
private CustomerService cs;
@RequestMapping(value = "/add",method = RequestMethod.POST)
public void saveCustomer(@RequestBody Customer customer){
cs.addCustomer(customer);
}
@RequestMapping(value = "/delete/{id}",method = RequestMethod.DELETE)
public void deleteCustomer(@PathVariable int id){
cs.deleteCustomer(id);
}
@RequestMapping(value = "/{id}",method = RequestMethod.GET)
public Optional<Customer> getCustomer(@PathVariable int id){
return cs.getCustomer(id);
}
@RequestMapping(value = "/{id}/{name}",method = RequestMethod.PUT)
public void updateCustomer(@PathVariable int id, @PathVariable String name){
cs.addCustomer(cs.updateCustomer(id,name));
}
}
|
60edff81-d4ee-4074-869f-bcc73a342b70 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-26 11:06:12", "repo_name": "TGM-HIT/sew8-testbeispiel-sockets20210506", "sub_path": "/test2021/sockets/Client.java", "file_name": "Client.java", "file_ext": "java", "file_size_in_byte": 969, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "906f0dcc69124f79e9917a95ba5f218822412f84", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/TGM-HIT/sew8-testbeispiel-sockets20210506 | 165 | FILENAME: Client.java | 0.258326 | package test2021.sockets;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
public class Client {
public static void main(String[] args) {
try (
Socket socket = new Socket("localhost", 5000);
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWriter writer = new PrintWriter(socket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
) {
String input;
while((input = reader.readLine()) != null) {
if (input.equals("INPUT!!")) {
writer.println(in.readLine());
} else {
System.out.println(input);
}
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
|
7da1cb7a-6023-46a2-becc-e488d977d0f6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-03-03 22:35:55", "repo_name": "rafalkalita/spring-dojo", "sub_path": "/loffice/src/main/java/com/rafalkalita/rmwlex/HomeController.java", "file_name": "HomeController.java", "file_ext": "java", "file_size_in_byte": 1139, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "eb399cdca1ca90e92183166844ef323d25e250af", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rafalkalita/spring-dojo | 214 | FILENAME: HomeController.java | 0.268941 | package com.rafalkalita.rmwlex;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* Handles requests for the application home page.
*/
@Controller
public class HomeController {
private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
/**
* Simply selects the home view to render by returning its name.
*/
@RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! the client locale is "+ locale.toString());
HomeViewModelFactory homeViewModelFactory = new HomeViewModelFactory();
HomeViewModel homeViewModel = homeViewModelFactory.build(locale);
model.addAttribute("title", homeViewModel.getTitle());
model.addAttribute("message", homeViewModel.getMessage());
model.addAttribute("serverTime", homeViewModel.getServerTime());
return "home";
}
}
|
e33effe3-0e32-4616-8555-7c1ab9f2c914 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-04 20:19:24", "repo_name": "MessasKouseila/ceri-m1-test", "sub_path": "/src/main/java/fr/univavignon/pokedex/impl/PokedexFactoryImpl.java", "file_name": "PokedexFactoryImpl.java", "file_ext": "java", "file_size_in_byte": 969, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "d434517647277ff40e59993f27a4692b009947fd", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MessasKouseila/ceri-m1-test | 220 | FILENAME: PokedexFactoryImpl.java | 0.277473 | package fr.univavignon.pokedex.impl;
import fr.univavignon.pokedex.api.IPokedex;
import fr.univavignon.pokedex.api.IPokedexFactory;
import fr.univavignon.pokedex.api.IPokemonFactory;
import fr.univavignon.pokedex.api.IPokemonMetadataProvider;
import java.io.IOException;
/**
* Created by kouceila on 03/05/17.
*/
public class PokedexFactoryImpl implements IPokedexFactory {
// l'instance de la factory pour utilisé le pattern singleton
private static PokedexFactoryImpl instance = null;
private PokedexFactoryImpl() {
}
// fonction qui permet de recupere l'instance
public static PokedexFactoryImpl pokedexFactory() {
if (instance == null) instance = new PokedexFactoryImpl();
return instance;
}
@Override
public IPokedex createPokedex(IPokemonMetadataProvider metadataProvider, IPokemonFactory pokemonFactory) throws IOException {
return new PokedexImpl(metadataProvider, pokemonFactory);
}
}
|
d1125698-01dd-4347-a5c8-faa91eabae79 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-02-17T08:26:56", "repo_name": "Eve-Sama/browser-utils", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1147, "line_count": 31, "lang": "en", "doc_type": "text", "blob_id": "0128822bfa170c9f31fc6ddebfcdeefa2b10b2b0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Eve-Sama/browser-utils | 332 | FILENAME: README.md | 0.246533 | English | [简体中文](README-zh_CN.md)
### Introduction
This project is a extension for browser using JQuery + TypeScript + Gulp. It can close tabs quickly. You have 2 ways to open the entry. First one is click icon.

Second one is press the key `Alt + Q`.

There are no difference between them, which have following functions
- Close all left tabs
- Close all right tabs
- Close all tabs exclude current tab
### How to run
Execute `npm run start` then project will compile files automatic and generate dist directory, just import it to browser.
### Packup
Execute `npm run build` There is a few dirrence with `npm run start`, only some configs is changed such as minify code. It will generate dist directory too, then you can pack it up via chrome.
### Change log
* **0.0.4:** fix: Close error when open multiple windows
* **0.0.3:** fix: UI error in firefox
* **0.0.2:** feat: Set keyboard shortcut Alt+Q
* **0.0.1:** feat: Publish basic function |
1d8b945b-961b-4aeb-934c-1a227364c0a2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-04-05 06:07:47", "repo_name": "smxknife/smxknife", "sub_path": "/smxknife-java/src/main/java/com/smxknife/java2/io/input/FileInputStreamDemo.java", "file_name": "FileInputStreamDemo.java", "file_ext": "java", "file_size_in_byte": 1067, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "0baf6cba2bfcfe7338ff962cb4d5b5f690ccdf78", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/smxknife/smxknife | 246 | FILENAME: FileInputStreamDemo.java | 0.29584 | // 测试文本
package com.smxknife.java2.io.input;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
/**
* @author smxknife
* 2018/11/12
*/
public class FileInputStreamDemo {
public static void main(String[] args) throws IOException {
File rootPath = new File("");
String filePath = rootPath.getAbsolutePath() + "/src/main/java/com/smxknife/java2/io/input/FileInputStreamDemo.java";
File file = new File(filePath);
System.out.println(file.getAbsolutePath());
FileInputStream fileInputStream = new FileInputStream(filePath);
System.out.println(fileInputStream.available());
// int read = fileInputStream.read();
// System.out.print(read + " ");
// System.out.println((char) read);
// System.out.println(fileInputStream.available());
byte[] bytes = new byte[6];
// fileInputStream.read(bytes);
// System.out.println(bytes);
// System.out.println(fileInputStream.available());
int len = 0;
while ((len = fileInputStream.read(bytes)) != -1 ) {
System.out.println(new String(bytes, 0, len));
}
}
}
|
889cba3c-1332-4497-87f9-45ed18de131a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-17 08:04:21", "repo_name": "KqzAnn/bookStore_back", "sub_path": "/src/main/java/bookstore/models/entities/OrderPosition.java", "file_name": "OrderPosition.java", "file_ext": "java", "file_size_in_byte": 1141, "line_count": 67, "lang": "en", "doc_type": "code", "blob_id": "d685f032140563269a92e27d8d40c623d721ec4d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/KqzAnn/bookStore_back | 249 | FILENAME: OrderPosition.java | 0.286968 | package bookstore.models.entities;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
import java.util.*;
@Entity
@Table(name = "order_book")
public class OrderPosition {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Column(nullable = false)
// private Long order_id;
//
// @Column(nullable = false)
// private Long book_id;
@Column(nullable = false)
private Long count;
@ManyToOne
@JoinColumn(name = "order_id")
private Orders order;
@ManyToOne
@JoinColumn(name = "book_id")
private Book book;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public Orders getOrder() {
return order;
}
public void setOrder(Orders order) {
this.order = order;
}
public Book getBook() {
return book;
}
public void setBook(Book book) {
this.book = book;
}
}
|
5cb640d2-391f-48fa-a4e7-002c4fb1269c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-13 07:04:19", "repo_name": "cqyisbug/WxJava", "sub_path": "/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/builder/TemplateCardVoteMessage.java", "file_name": "TemplateCardVoteMessage.java", "file_ext": "java", "file_size_in_byte": 1138, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "f3ef12f1ecf6d73821a873862264c9307b1859b9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/cqyisbug/WxJava | 259 | FILENAME: TemplateCardVoteMessage.java | 0.250913 | package me.chanjar.weixin.cp.bean.message.builder;
import com.google.gson.annotations.SerializedName;
import lombok.Getter;
import lombok.Setter;
/**
* The type Template card vote message.
*/
@Getter
@Setter
public class TemplateCardVoteMessage extends AbstractTemplateCardMessage {
private static final long serialVersionUID = -5479368307619279988L;
@SerializedName("task_id")
private String taskId;
@SerializedName("submit_button")
private SubmitButton submitButton;
@SerializedName("checkbox")
private Checkbox checkbox;
/**
* Instantiates a new Template card vote message.
*
* @param cardType the card type
* @param mainTitle the main title
* @param source the source
* @param taskId the task id
* @param submitButton the submit button
* @param checkbox the checkbox
*/
public TemplateCardVoteMessage(String cardType, MainTitle mainTitle, Source source, String taskId, SubmitButton submitButton, Checkbox checkbox) {
super(cardType, mainTitle, source);
this.taskId = taskId;
this.submitButton = submitButton;
this.checkbox = checkbox;
}
}
|
80392d6e-9909-4fe2-8b1c-6c4683a3645f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-26 17:24:37", "repo_name": "zuiailaoda/YouTubeDownloader", "sub_path": "/DownloadThread.java", "file_name": "DownloadThread.java", "file_ext": "java", "file_size_in_byte": 970, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "1452b63aa49369cbf4450f26ee5108a18e1e079d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zuiailaoda/YouTubeDownloader | 184 | FILENAME: DownloadThread.java | 0.221351 | package com.Lireoy;
import java.io.*;
import java.util.stream.Collectors;
public class DownloadThread extends Thread {
private static String link;
static void setLink(String newLink) {
link = newLink;
}
@Override
public void run() {
try {
Process process = new ProcessBuilder("C:\\yourlocation\\somewhere\\dl.bat", link).start();
String line;
while (true) {
try {
line = new BufferedReader(new InputStreamReader(process.getInputStream())).lines().collect(Collectors.joining("\n"));
Controller.setConsoleTextArea(line);
System.out.println();
} catch (NullPointerException e) {
System.out.println("valami kinullázódott a kurva anyját");
}
}
} catch (IOException e) {
System.out.println("valami elbaszódott");
}
}
}
|
4e3c9a35-4ca7-49e7-8ef7-7a5ae7368815 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-21 13:51:13", "repo_name": "ArynaSun/Project", "sub_path": "/src/com/epam/jwt/task5/filter/ServiceWordsAddingFilter.java", "file_name": "ServiceWordsAddingFilter.java", "file_ext": "java", "file_size_in_byte": 1074, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "a8dc4730c7ed1889848a7fbe6cfd5109b0cef481", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ArynaSun/Project | 189 | FILENAME: ServiceWordsAddingFilter.java | 0.294215 | package com.epam.jwt.task5.filter;
import com.epam.jwt.task5.command.JspAttribute;
import com.epam.jwt.task5.command.RequestParameter;
import com.epam.jwt.task5.controller.ServiceWordsKey;
import com.epam.jwt.task5.util.PropertyHelper;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
public class ServiceWordsAddingFilter extends BaseFilter {
@Override
protected void doFilter(HttpServletRequest request, HttpServletResponse response) {
if (!request.getMethod().toUpperCase().equals("GET")){
return;
}
String message = request.getParameter(RequestParameter.MESSAGE);
if (message != null){
request.setAttribute(JspAttribute.SERVER_MESSAGE, message);
}
ServiceWordsKey[] values = ServiceWordsKey.values();
for (ServiceWordsKey serviceWordsKey : values) {
request.setAttribute(serviceWordsKey.name(), PropertyHelper.receiveServiceWord(serviceWordsKey.name()));
}
}
}
|
25df1d3a-8c38-4950-b499-d24928b80543 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-02 03:20:17", "repo_name": "jedlab/openpm", "sub_path": "/webapp/src/main/java/com/jedlab/pm/security/AuthLogoutSuccessHandler.java", "file_name": "AuthLogoutSuccessHandler.java", "file_ext": "java", "file_size_in_byte": 1140, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "ddacf9cb60e348e8510754db288413439ded6f21", "star_events_count": 7, "fork_events_count": 13, "src_encoding": "UTF-8"} | https://github.com/jedlab/openpm | 175 | FILENAME: AuthLogoutSuccessHandler.java | 0.229535 | package com.jedlab.pm.security;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.AbstractAuthenticationTargetUrlRequestHandler;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
/**
* @author omidp
*
*/
public class AuthLogoutSuccessHandler extends AbstractAuthenticationTargetUrlRequestHandler implements LogoutSuccessHandler
{
@Override
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
throws IOException, ServletException
{
HttpSession session = request.getSession(false);
if(session != null)
{
session.removeAttribute(AuthSuccessHandler.CURRENT_USERNAME);
session.removeAttribute(AuthSuccessHandler.CURRENT_USERID);
}
super.handle(request, response, authentication);
}
}
|
589bd11b-c912-4755-b70a-2fd754c23897 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-23 01:51:06", "repo_name": "Moonphy/oldProject", "sub_path": "/crm/crm-web/crm-web-biz/src/main/java/com/qipeipu/crm/dtos/user/UserWxDTO.java", "file_name": "UserWxDTO.java", "file_ext": "java", "file_size_in_byte": 1195, "line_count": 71, "lang": "en", "doc_type": "code", "blob_id": "7179a0a0d0692a14cac73c5ae843a92b9acd65bc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Moonphy/oldProject | 336 | FILENAME: UserWxDTO.java | 0.246533 | package com.qipeipu.crm.dtos.user;
import java.beans.ConstructorProperties;
import lombok.Data;
import lombok.experimental.Builder;
@Builder
@Data
public class UserWxDTO {
/**
* 用户ID
*/
private Integer userId;
/**
* 用户名
*/
private String userName;
/**
* 是否为管理员
*/
private Boolean isAdmin;
/**
* 性别:0-女,1-男
*/
private Integer Sex;
/**
* 部门id
*/
private Integer deptId;
/**
* 部门名称
*/
private String deptName;
/**
* 邮箱
*/
private String email;
/**
* 手机号
*/
private String mp;
@ConstructorProperties({ "userName", "email", "mp", "deptId" })
public UserWxDTO(String userName, String email, String mp, Integer deptId) {
this.userName = userName;
this.email = email;
this.mp = mp;
this.deptId = deptId;
}
public UserWxDTO() {
}
public UserWxDTO(Integer userId, String userName, Boolean isAdmin,
Integer sex, Integer deptId, String deptName, String email,
String mp) {
super();
this.userId = userId;
this.userName = userName;
this.isAdmin = isAdmin;
this.Sex = sex;
this.deptId = deptId;
this.deptName = deptName;
this.email = email;
this.mp = mp;
}
}
|
8d82e519-14aa-4f75-9b3f-40c50804de14 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-31 11:54:45", "repo_name": "laurenthaillot/DecouverteServlets", "sub_path": "/src/main/java/co/simplon/poleEmploi/decouverteServlets/CreerContact.java", "file_name": "CreerContact.java", "file_ext": "java", "file_size_in_byte": 1105, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "7982fe8079f928f520f17ddebccd4eda8a5a50de", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/laurenthaillot/DecouverteServlets | 220 | FILENAME: CreerContact.java | 0.283781 | package co.simplon.poleEmploi.decouverteServlets;
import java.io.IOException;
import java.util.HashSet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import co.simplon.domaine.Contact;
import co.simplon.domaine.Hobbies;
public class CreerContact extends HttpServlet {
public void init() throws ServletException {
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HashSet<Hobbies> hobbies = new HashSet<Hobbies>();
hobbies.add(new Hobbies("Programmation", 10));
hobbies.add(new Hobbies("Cuisine", 11));
String nom = request.getParameter("nom");
String prenom = request.getParameter("prenom");
String eMail = request.getParameter("eMail");
Contact monContact = new Contact(nom, prenom, eMail, hobbies);
request.setAttribute("monContact", monContact);
request.getRequestDispatcher("AfficherContact.jsp").forward(request,
response);
}
}
|
c730dfe1-143d-46ad-957d-9d561cd0afa1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-03 03:10:55", "repo_name": "TheBlackChamber/springmvcsecurity", "sub_path": "/src/main/java/net/theblackchamber/springmvcsecurity/controller/LoginController.java", "file_name": "LoginController.java", "file_ext": "java", "file_size_in_byte": 1140, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "5dcbe6ea76e7bea0123bfeed5e68671dac42f7ee", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/TheBlackChamber/springmvcsecurity | 233 | FILENAME: LoginController.java | 0.271252 | package net.theblackchamber.springmvcsecurity.controller;
import net.theblackchamber.springmvcsecurity.annotations.Logger;
import org.apache.commons.logging.Log;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class LoginController {
@Logger
private Log log;
//Spring Security see this :
@RequestMapping(value = "/login", method = RequestMethod.GET)
public ModelAndView login(
@RequestParam(value = "error", required = false) String error,
@RequestParam(value = "logout", required = false) String logout) {
log.debug("Getting login Page. ["+error+ " , " + logout + "]");
ModelAndView model = new ModelAndView();
if (error != null) {
model.addObject("error", "Invalid username and password!");
}
if (logout != null) {
model.addObject("msg", "You've been logged out successfully.");
}
model.setViewName("login");
return model;
}
}
|
a8a6d4de-34b8-44c3-8334-d5d1683c8c10 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-07 02:31:46", "repo_name": "kgcnjzym/203007U2", "sub_path": "/day1201/src/com/xt/servlet/ThirdServlet.java", "file_name": "ThirdServlet.java", "file_ext": "java", "file_size_in_byte": 1182, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "b6c59655d9a023057231438798b47c3799e661ca", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/kgcnjzym/203007U2 | 260 | FILENAME: ThirdServlet.java | 0.253861 | package com.xt.servlet;
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.io.PrintWriter;
/**
* @author 杨卫兵
* @version V1.00
* @date 2020/11/30 08:55
* @since V1.00
*/
@WebServlet("/third.do")
public class ThirdServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//以下方式,兼容旧版浏览器,但jquery获取时需指定数据格式为json
// resp.setContentType("text/plain;charset=UTF-8");
//以下方式不兼容旧版浏览器,但jquery获取时无需指定数据格式
resp.setContentType("application/json;charset=UTF-8");
PrintWriter out=resp.getWriter();
String name="ja\"ck";
out.write("[{\"id\":\"s1\",\"name\":\""+name.replace("\"","\\\"")+"\",\"age\":20}," +
"{\"id\":\"s2\"," +
"\"name\":\"marry\",\"age\":22}]");
out.close();
}
}
|
bce13d43-6190-4e93-9c4e-cc8ed021c639 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-04-02 05:58:54", "repo_name": "shilonxi/android_TensorFlow", "sub_path": "/app/src/main/java/com/example/administrator/tensorflow/tft/Recognition.java", "file_name": "Recognition.java", "file_ext": "java", "file_size_in_byte": 1174, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "dc5323827647e7f7cebd76d48b1c7b4502216db6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/shilonxi/android_TensorFlow | 256 | FILENAME: Recognition.java | 0.290176 | package com.example.administrator.tensorflow.tft;
public class Recognition
{
private final String id;
//标签编号
private final String title;
//标签名称
private final Float confidence;
//标签可信度
public Recognition(
final String id, final String title, final Float confidence) {
this.id = id;
this.title = title;
this.confidence = confidence;
}
//识别结果
public String getId() {
return id;
}
public String getTitle() {
return title;
}
public Float getConfidence() {
return confidence == null ? 0f : confidence;
}
@Override
public String toString()
{
String resultString = "";
if (id != null) {
resultString += "[" + id + "] ";
}
if (title != null) {
resultString += title + " ";
}
if (confidence != null) {
resultString += String.format("(%.1f%%) ", confidence * 100.0f);
}
return resultString.trim();
//得到整体结果,并去掉字符串首尾空格(防止不必要的空格导致错误)
}
}
|
5c830536-6517-412d-a6ac-12fddfe391ca | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-07-21T15:03:09", "repo_name": "carlosmmdiaz/cmmd-web", "sub_path": "/packages/image-card/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1069, "line_count": 39, "lang": "en", "doc_type": "text", "blob_id": "1aeb630d6fdc3f86d9e9ac9d5fe8055cbc752490", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/carlosmmdiaz/cmmd-web | 303 | FILENAME: README.md | 0.252384 | # CMMD-Card
Card for CMMD applications.
## How to install
```sh
yarn add @cmmd-web/card
```
```js
import '@cmmd-web/card/cmmd-card.js';
```
## Example
```html
<cmmd-card>
<div>
Lucas ipsum dolor sit amet wedge mustafar kessel luke yoda utapau darth hutt organa mace.
Grievous organa mace hoth amidala antilles. Solo watto watto darth twi'lek darth cade obi-wan.
Darth gonk jar kenobi antilles boba cade. Jango fett twi'lek mandalore moff coruscant. Hutt
vader ventress coruscant padmé mon binks fisto. Hutt luke moff darth lando. Anakin wedge
tatooine skywalker wookiee. Palpatine wookiee wedge solo anakin luke organa antilles. Bothan
fett darth wedge darth mon skywalker qui-gonn.
</div>
</cmmd-card>
```
## Properties
| Name | Description | Type | Optional |
| -------------- | ----------------- | --------- | -------- |
| imageCardTitle | Title of the card | attribute | Yes |
## Slot
All content inside the cmmd-card component will be rendered inside the card.
|
df2da337-3f88-4d06-aee5-b586d5152661 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-14 16:15:32", "repo_name": "Timokhov/chat-service", "sub_path": "/src/main/java/com/timokhov/web/chat_service/config/mvc/CustomHeadersInterceptor.java", "file_name": "CustomHeadersInterceptor.java", "file_ext": "java", "file_size_in_byte": 1140, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "a5e1c99a8cc98da4ba6348d8ff6e56c6913b3be8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Timokhov/chat-service | 204 | FILENAME: CustomHeadersInterceptor.java | 0.262842 | package com.timokhov.web.chat_service.config.mvc;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CustomHeadersInterceptor extends HandlerInterceptorAdapter {
protected Map<String, List<String>> headers = new HashMap<>();
public Map<String, List<String>> getHeaders() {
return headers;
}
public void setHeaders(Map<String, List<String>> headers) {
this.headers = headers;
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
for (Map.Entry<String, List<String>> header : headers.entrySet()) {
List<String> values = header.getValue();
if (values != null) {
for (String value : values) {
response.addHeader(header.getKey(), value);
}
}
}
return super.preHandle(request, response, handler);
}
}
|
c877f22e-5ec6-4676-a3d3-c18e5aaf235a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-06 07:28:26", "repo_name": "zywudev/AndroidLaunchModeTest", "sub_path": "/app/src/main/java/com/wuzy/androidlaunchmodetest/SingleTopActivity.java", "file_name": "SingleTopActivity.java", "file_ext": "java", "file_size_in_byte": 964, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "8efd8bb333c428314187dd741ebcfc8ee7b70419", "star_events_count": 2, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/zywudev/AndroidLaunchModeTest | 183 | FILENAME: SingleTopActivity.java | 0.2227 | package com.wuzy.androidlaunchmodetest;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
public class SingleTopActivity extends AppCompatActivity {
private static final String TAG = "SingleTopActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_top);
Log.e(TAG, "taskId:" + getTaskId());
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Log.e(TAG, "onNewIntent: ");
}
public void startStandardActivity(View view) {
Intent intent = new Intent(this, StandardActivity.class);
startActivity(intent);
}
public void startSingleTopActivity(View view) {
startActivity(new Intent(this, SingleTopActivity.class));
}
}
|
496e4e01-2997-4976-adfb-1e557293c56d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-28 08:06:43", "repo_name": "HSU-009/Android_Studuo_28_notification", "sub_path": "/Android_Studuo_28_notification/app/src/main/java/com/example/android_studuo_28_notification/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1065, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "fd03ffb187de5498b114604d4bfad985000ab8b8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/HSU-009/Android_Studuo_28_notification | 185 | FILENAME: MainActivity.java | 0.2227 | package com.example.android_studuo_28_notification;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Notification;
import android.app.NotificationManager;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
// new 一個 method
public void bt1(View view) {
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification.Builder builder = new Notification.Builder(this);
builder.setSmallIcon(R.mipmap.ic_launcher)
.setTicker("xx特價")
.setContentTitle("標題example")
.setContentText("內容example");
Notification notification = builder.build();
notificationManager.cancel(0); // 移除id值為0的通知
notificationManager.notify(0, notification);
}
} |
c6df8952-8f3a-4345-a3ac-f1cda95690e5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-11 07:00:42", "repo_name": "eversongs/teammate_backend", "sub_path": "/src/main/java/allen/joy/jpademo/controller/admin/TeamController.java", "file_name": "TeamController.java", "file_ext": "java", "file_size_in_byte": 1097, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "696820f02fcaeb5de1cc4e7026ca786a71076ee1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/eversongs/teammate_backend | 227 | FILENAME: TeamController.java | 0.264358 | package allen.joy.jpademo.controller.admin;
import allen.joy.jpademo.model.team.Team;
import allen.joy.jpademo.model.team.TeamJsonView;
import allen.joy.jpademo.service.MainService;
import com.fasterxml.jackson.annotation.JsonView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(value = "/admin/team")
public class TeamController {
@Autowired
private MainService mainService;
@GetMapping(value = "")
@JsonView(TeamControllerJsonView.getTeamList.class)
public List<Team> getTeamList() {
return mainService.getTeamList();
}
@PostMapping(value = "")
public void addTeam(
@RequestParam String name
) {
mainService.addTeam(name);
}
@PatchMapping(value = "/{seq}")
public void updateTeam(
@PathVariable int seq,
@RequestParam String name
){
mainService.updateTeam(seq, name);
}
}
interface TeamControllerJsonView{
public interface getTeamList {
}
} |
f70d5f77-337c-49ef-a112-bcd74da1ffca | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-04-01 05:35:45", "repo_name": "andreivatamanu/Challenges-Module-6", "sub_path": "/app/src/main/java/com/example/homeworkmodule6/Challenge3/BundleFragment.java", "file_name": "BundleFragment.java", "file_ext": "java", "file_size_in_byte": 1140, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "718d1bffcc7a8bf210237dc4e984dcaa8ad00c5e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/andreivatamanu/Challenges-Module-6 | 205 | FILENAME: BundleFragment.java | 0.256832 | package com.example.homeworkmodule6.Challenge3;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.homeworkmodule6.R;
/**
* A simple {@link Fragment} subclass.
*/
public class BundleFragment extends Fragment {
private TextView mTextViewEmail;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_bundle, container, false);
initView(view);
return (view);
}
private void initView(View view) {
mTextViewEmail = view.findViewById(R.id.text_view_bundle_fragment);
Bundle bundle = getArguments();
if (bundle != null) {
String email = bundle.getString(BundleFragmentActivity.EMAIL);
if (email != null && !email.isEmpty()) {
mTextViewEmail.setText(email);
}
}
}
}
|
42731375-09f3-4da9-800d-f995a8e29ffc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-07-23T18:22:04", "repo_name": "airtightdesign/atd-request.js", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1138, "line_count": 47, "lang": "en", "doc_type": "text", "blob_id": "29384ba13002df5393d7087a17d3ea0a59a10b95", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/airtightdesign/atd-request.js | 272 | FILENAME: README.md | 0.240775 | # atd-request.js
## Simple XHR wrapper with Promises
### Makes `GET`, `POST`, `UPDATE` and `DELETE` http requests and returns a `Promise`.
### Installation
`npm install --save atd-request`
### Usage
```
import Request from 'atd-request.js';
Request.get(url, headers).then(response => {
//process response;
});
Request.post(url, data, headers).then(response => {
//process response;
});
Request.update(url, data, headers).then(response => {
//process response;
});
Request.delete(url, data, headers).then(response => {
//process response;
});
```
- `url` is the url for the request.
- `data` is the data sent to the server with the request
- `headers` is an object with a key/value pair for each request header. The keys are the header name and the value is the header content. These headers are sent by default (but can be overridden):
```
{
'Content-type': 'application/json; charset=utf-8',
'Cache-Control': 'no-cache'
}
```
### Deprecated Browsers
This module requires `Promise`, `Object.keys`, `Object.assign`, and `Array.forEach` to function. Older browsers may require these to be polyfilled. |
e991d487-fa6c-4204-83a5-351d7130d09a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-07-28T04:11:31", "repo_name": "lmend8/Database-GUI-in-Python-", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1024, "line_count": 36, "lang": "en", "doc_type": "text", "blob_id": "d79100e2aa5aa8d314f1d8e1516d30315a995ce9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lmend8/Database-GUI-in-Python- | 232 | FILENAME: README.md | 0.247987 | # Database-GUI-in-Python-
A simple database GUI for mysql database
# Dependencies
First make sure that you have python 3.5 or above (if not here is the link https://www.python.org/)
most of the new version of python have pip installer package manager pre-loaded but if you dont have pip here is the command to install:
"python get-pip.py"
for more help link: https://pip.pypa.io/en/stable/installing/
Using pip installer use the following command in the terminal/command prompt to install this dependencies:
"pip install mysql-connector-python"
"pip install tkintertable" // tkinter is standard gui framework in python it should already come pre-loaded but just in cases.
"pip install pandas"
"pip install -U python-dotenv"
for more information visit:
https://dev.mysql.com/doc/connector-python/en/connector-python-installation-binary.html
https://pandas.pydata.org/pandas-docs/stable/getting_started/install.html
https://docs.python.org/3/library/tkinter.html
https://pypi.org/project/python-dotenv/
|
fc0b91b6-36bd-4a6a-a6ab-07eda328a5d2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-29 19:32:28", "repo_name": "A-safarji/java-mini-project", "sub_path": "/Data-Structure/HashTable/Word.java", "file_name": "Word.java", "file_ext": "java", "file_size_in_byte": 1139, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "c379f48406347e81c12a6a005b8462fd22226798", "star_events_count": 4, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/A-safarji/java-mini-project | 247 | FILENAME: Word.java | 0.284576 | package sa.edu.yuc;
import java.util.Scanner;
public class Word implements Comparable<Word>{
private String word;
private String meaning;
public Word(String word, String meaning) {
this.word = word;
this.meaning = meaning;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public String getMeaning() {
return meaning;
}
public void setMeaning(String meaning) {
this.meaning = meaning;
}
@Override
public String toString() {
return "Word [word=" + word + ", meaning=" + meaning + "]";
}
public boolean equals(Word other) {
return this.word.equalsIgnoreCase(other.word);
}
@Override
public int compareTo(Word o) {
return this.word.compareTo(o.word);
}
public static Word getWordMeaning() {
Scanner input = new Scanner(System.in);
System.out.print("Enter a word :: ");
String word = input.nextLine();
System.out.print("Meaning :: ");
String meaning = input.nextLine();
return new Word(word, meaning);
}
} |
1aa0ac85-895b-4e3b-bba2-9f0e5137c45d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-08 19:45:19", "repo_name": "Zan-the-Man01/QuoteBoss", "sub_path": "/app/src/main/java/com/example/quoteboss/SelectionActivity.java", "file_name": "SelectionActivity.java", "file_ext": "java", "file_size_in_byte": 997, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "af439c50ae97c34593b2964737d17af3b8c6d378", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Zan-the-Man01/QuoteBoss | 178 | FILENAME: SelectionActivity.java | 0.240775 | package com.example.quoteboss;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
/**
* Represents the quote type selection menu of the app.
*/
public final class SelectionActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_selection);
Button cat1 = findViewById(R.id.catButton1);
Button cat2 = findViewById(R.id.catButton2);
Button cat3 = findViewById(R.id.catButton3);
cat1.setOnClickListener(unused -> handleClick(1));
cat2.setOnClickListener(unused -> handleClick(2));
cat3.setOnClickListener(unused -> handleClick(3));
}
private void handleClick(int cat) {
Intent intent = new Intent(this, QuoteActivity.class);
intent.putExtra("category", cat);
startActivity(intent);
}
}
|
d18004d0-35e0-4984-909e-aa8dd52726c4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-09-14T21:47:21", "repo_name": "lawgamble/Pomodoro-Timer", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 981, "line_count": 22, "lang": "en", "doc_type": "text", "blob_id": "b4b8388c57bdd5efcc8b9012e636e6c695bd6fcc", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lawgamble/Pomodoro-Timer | 213 | FILENAME: README.md | 0.252384 | # Pomodoro Timer

A Pomodoro timer created in React. Alternates between study and break sessions with adjustable lengths, and keeps the user updated on session changes using time display in the tab title/page and an audio alert whenever the session changes.
[Live Demo](https://pomo-timer-lg.herokuapp.com/)
## Use
The app is intended to allow a user to manage time spent working and time spent taking a break. User is given a default time for both work and break, but these default times are easily adjustable. This method promotes more effecient work during "work time".
## Purpose
The app was created to practice use of complex algorithmic logic and state management in React applications.
## Stack
* React : User interactivity (starting/stopping a session, adjusting session lengths, pausing the timer)
* React Bootstrap
## Future Goals
* Create a more beautiful UI/Design |
10a2db02-92be-46a2-b97e-b416329f5b5f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-12-22T11:21:33", "repo_name": "zackragozzino/OpenGL-RayMarcher", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1103, "line_count": 19, "lang": "en", "doc_type": "text", "blob_id": "2b15da55f84f0619c74613be5095d91ac476ab80", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zackragozzino/OpenGL-RayMarcher | 286 | FILENAME: README.md | 0.291787 | # Echo Chamber /// OpenGL Music Visualizer
<a href="http://www.youtube.com/watch?feature=player_embedded&v=wiJvpwkGFrM
" target="_blank"><img src="http://img.youtube.com/vi/wiJvpwkGFrM/0.jpg"
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a>
## Getting it to Run
- This app only runs on Windows computers
- IMPORTANT: Go to the sound window in the control panel, click on the "Recording" tab, and enable the Stereo Mix (without this, the app can't read computer audio)
## VR
- VR functionality is currently a WIP. If you wish to enable it, uncomment the #define VR_ENABLED
## Audio Sensitivity
- You will need to modify the AUDIO_SENSITIVITY #define based on how loud your music is (currently working on fixing this issue).
- Incorrect audio sensitivity may result in visuals that are too fast or too slow relative to the music
- Generally, if found that a value of 2 is good for playback on headphones, and a value of 0.1 is good for playback on speakers
 |
5168ee5e-3d06-458d-b96c-64227f7dbc6a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-02-28 05:08:03", "repo_name": "xingkaihu/redis-gcache", "sub_path": "/src/main/java/com/keifer/core/cache/guice/provider/cluster/JedisClusterProvider.java", "file_name": "JedisClusterProvider.java", "file_ext": "java", "file_size_in_byte": 1100, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "8a985cb5c2484c946ad2f7167f1e574ecaaee632", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xingkaihu/redis-gcache | 233 | FILENAME: JedisClusterProvider.java | 0.272025 | package com.keifer.core.cache.guice.provider.cluster;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
import com.keifer.core.cache.redis.cluster.JedisClusterFactory;
import com.keifer.core.cache.redis.config.JedisSupportEnum;
import com.keifer.core.cache.utils.ConfigUtils;
import redis.clients.jedis.JedisPoolConfig;
@Singleton
public class JedisClusterProvider implements Provider<JedisClusterFactory> {
private final JedisClusterFactory redisCache = new JedisClusterFactory();
@Inject
public JedisClusterProvider(Provider<JedisPoolConfig> jedisPoolConfigProvider) {
redisCache.setClustNodes(ConfigUtils.getValue(JedisSupportEnum.reids_cluster_nodes.val()));
redisCache.setTimeout(ConfigUtils.getValue(JedisSupportEnum.redis_timeout.val(), Integer.class));
redisCache.setPassword(ConfigUtils.getValue(JedisSupportEnum.redis_password.val()));
redisCache.setGenericObjectPoolConfig(jedisPoolConfigProvider.get());
redisCache.setMaxRedirections(6);
}
@Override
public JedisClusterFactory get() {
return redisCache;
}
}
|
e083775a-6251-4d18-b3b5-00f85733a9d7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-02-21 12:24:36", "repo_name": "Ebrahim-Mostafa/ThreadLocal", "sub_path": "/src/main/java/SearchPage/GooglePage.java", "file_name": "GooglePage.java", "file_ext": "java", "file_size_in_byte": 1140, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "3db8446c59342ad82ff4219f72921fe1ae85d960", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Ebrahim-Mostafa/ThreadLocal | 230 | FILENAME: GooglePage.java | 0.275909 | package SearchPage;
import BasePackage.BaseTest;
import BasePackage.DriverManager;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class GooglePage extends BaseTest {
public GooglePage() {
PageFactory.initElements(driver, this);
}
@FindBy(id = "hplogo")
WebElement google_icon;
@FindBy(name = "btnK")
WebElement Search_btn;
@FindBy(name = "btnI")
WebElement lucky_btn;
@FindBy(name = "q")
WebElement Search_Field;
public boolean iconpresence() {
boolean icon_appear = google_icon.isDisplayed();
return icon_appear;
}
public String searchbtn(){
String search_btn = Search_btn.getText();
return search_btn;
}
public String luckybtn(){
String lucky_btnn = lucky_btn.getText();
return lucky_btnn;
}
public void Search(String search_txt) {
Search_Field.click();
Search_Field.clear();
Search_Field.sendKeys(search_txt);
Search_Field.submit();
}
}
|
75e7c5e4-4ba2-4aca-b9be-3f17b6a853fe | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-10-31 22:18:29", "repo_name": "willypicard/Lecture_JavaProgramming", "sub_path": "/10_JavaNet/src/pl/kti/cp/net/sockets/DictionaryConnectionHandler.java", "file_name": "DictionaryConnectionHandler.java", "file_ext": "java", "file_size_in_byte": 978, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "dc00f3c5e7b9498cf10ae0cf73dbcd13fee3983a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/willypicard/Lecture_JavaProgramming | 232 | FILENAME: DictionaryConnectionHandler.java | 0.280616 | package pl.kti.cp.net.sockets;
import java.io.IOException;
import java.net.Socket;
import java.util.Map;
public class DictionaryConnectionHandler extends AbstractServerRunnable {
private Map<String, String> _dictionary;
public DictionaryConnectionHandler(Socket socket, Map<String, String> dictionary) {
super(socket);
_dictionary = dictionary;
}
public void process() throws IOException {
writeLine("Welcome to the Dictionary On-Line");
String yn;
do {
writeLine("Please enter a world to be translated (eng->pol): ");
String engWord = readLine();
String polWord = translate(engWord);
if (polWord == null) {
writeLine(engWord + " unknown :(");
} else {
writeLine(engWord + ": " + polWord);
}
writeLine("Do you want to continue [y/n]?");
yn = readLine();
} while (yn != null && yn.equals("y"));
}
private String translate(String engWord) {
return (String) _dictionary.get(engWord);
}
} |
560dceab-8ec3-456c-82e5-b27f68d1447b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-21 21:41:00", "repo_name": "TKomericki/AutoServis", "sub_path": "/AutoServisProject/AutoServis/src/main/java/opp/domain/UslugaPrijavaKey.java", "file_name": "UslugaPrijavaKey.java", "file_ext": "java", "file_size_in_byte": 976, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "1de3b881a0fe9cdd61f1499c7c960ae7e5d92f5d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/TKomericki/AutoServis | 270 | FILENAME: UslugaPrijavaKey.java | 0.287768 | package opp.domain;
import java.io.Serializable;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
@Embeddable
@EqualsAndHashCode
@AllArgsConstructor
public class UslugaPrijavaKey implements Serializable{
@Column(name = "id_usluge")
private int idUsluge;
@Column(name = "idKorisnika")
private int idKorisnika;
@Column(name = "vrijemePrijave")
private Timestamp vrijemePrijave;
public UslugaPrijavaKey() {
}
public int getIdUsluge() {
return idUsluge;
}
public void setIdUsluge(int idUsluge) {
this.idUsluge = idUsluge;
}
public Timestamp getVrijemePrijave() {
return vrijemePrijave;
}
public void setIdKorisnika(int idKorisnika) {
this.idKorisnika = idKorisnika;
}
public void setVrijemePrijave(Timestamp vrijemePrijave) {
this.vrijemePrijave = vrijemePrijave;
}
public int getIdKorisnika() {
return idKorisnika;
}
}
|
f8266d1e-1b4c-4ede-986b-fb26355d5f93 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-09 13:17:28", "repo_name": "theCodeHog/BattleShip_Game", "sub_path": "/src/com/company/Ship.java", "file_name": "Ship.java", "file_ext": "java", "file_size_in_byte": 1099, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "76e7b463519033c06b51c89e6fe85c3bb90c1b78", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/theCodeHog/BattleShip_Game | 223 | FILENAME: Ship.java | 0.291787 | package com.company;
public class Ship {
//Fields
private Position[] positions;
private int size;
private int hits = 0;
//Constructor
public Ship(int size, Position startPosition){
this.size = size;
positions = getPositions(size, startPosition);
}
//Methods
public static Position[] getPositions(int size, Position startPosition){
Position[] calculatedPositions = new Position[size];
calculatedPositions[0] = startPosition;
for (int i = 1; i < size ; i++) {
calculatedPositions[i] = new Position(startPosition.x+i, startPosition.y);
}
return calculatedPositions;
}
public boolean isFloating(){
if (hits < size)
return true;
return false;
}
public boolean hasPosition(Position position){
for (Position myPosition : positions) {
if (myPosition.x == position.x && myPosition.y == position.y) {
return true;
}
}
return false;
}
public void addHit(){
hits++;
}
}
|
29ee9e14-7001-48ae-9fd8-aec0df9ae351 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-27 13:37:24", "repo_name": "17602937887/weChatApp", "sub_path": "/src/api/LoginDemo.java", "file_name": "LoginDemo.java", "file_ext": "java", "file_size_in_byte": 1031, "line_count": 26, "lang": "en", "doc_type": "code", "blob_id": "736fb9e333c665f8aaa913e0216387964a466668", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/17602937887/weChatApp | 206 | FILENAME: LoginDemo.java | 0.250913 | package api;
import Utils.WeChatService;
import com.fasterxml.jackson.databind.ObjectMapper;
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.*;
@WebServlet("/loginDemo")
public class LoginDemo extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String wechatCode = request.getParameter("code");
String Appid = "wxbb8dcd951112491a";
String AppidSecret = "3ac5c99decc3c93fc17bfec75f69ba56";
String openId = WeChatService.GetOpenID(Appid, AppidSecret, wechatCode);
response.getWriter().write(new ObjectMapper().writeValueAsString(openId));
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
this.doPost(request, response);
}
}
|
1d9e4a63-4c23-429d-96dc-b66a189d2567 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-31 07:08:30", "repo_name": "belizwp/WallSplash", "sub_path": "/app/src/main/java/kmitl/afinal/nakarin58070064/wallsplash/task/LoadCollectionTask.java", "file_name": "LoadCollectionTask.java", "file_ext": "java", "file_size_in_byte": 976, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "807b9e7ecf6333350ad22a96ce971b3540bf0e32", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/belizwp/WallSplash | 231 | FILENAME: LoadCollectionTask.java | 0.295027 | package kmitl.afinal.nakarin58070064.wallsplash.task;
import android.os.AsyncTask;
import java.util.List;
import kmitl.afinal.nakarin58070064.wallsplash.database.WallSplashDatabase;
import kmitl.afinal.nakarin58070064.wallsplash.model.MyCollection;
public class LoadCollectionTask extends AsyncTask<Void, Void, List<MyCollection>> {
private WallSplashDatabase db;
private OnPostLoadListener listener;
public LoadCollectionTask(WallSplashDatabase db, OnPostLoadListener l) {
this.db = db;
this.listener = l;
}
@Override
protected List<MyCollection> doInBackground(Void... voids) {
return db.myCollectionDao().getAllWithCover();
}
@Override
protected void onPostExecute(List<MyCollection> myCollections) {
super.onPostExecute(myCollections);
listener.onPostLoad(myCollections);
}
public interface OnPostLoadListener {
void onPostLoad(List<MyCollection> myCollections);
}
}
|
e0db2da1-9b42-4d08-8ee6-dd6d61b2ae90 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-11 13:12:16", "repo_name": "pantherproject/designpattern", "sub_path": "/src/main/java/com/panther/proxy/dynamic/DynamicProxy.java", "file_name": "DynamicProxy.java", "file_ext": "java", "file_size_in_byte": 1140, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "402aaa84d427b02c82c9dc781889c3cca84340c1", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/pantherproject/designpattern | 220 | FILENAME: DynamicProxy.java | 0.290176 | package com.panther.proxy.dynamic;
import com.panther.proxy.dynamic.handler.ProxyHandler;
import com.panther.proxy.dynamic.impl.Subject;
import sun.misc.ProxyGenerator;
import java.io.FileOutputStream;
import java.lang.reflect.Proxy;
/**
* Created by panther on 16-9-28.
*/
public class DynamicProxy {
public static void main(String[] args) {
RealSubject real = new RealSubject();
Subject proxySubject = (Subject) Proxy.newProxyInstance(Subject.class.getClassLoader(), new Class[]{Subject.class}, new ProxyHandler(real));
proxySubject.doSomething();
//write proxySubject class binary data to file
createProxyClassFile();
}
public static void createProxyClassFile() {
String name = "ProxySubject";
byte[] data = ProxyGenerator.generateProxyClass(name, new Class[]{Subject.class});
System.out.println(data);
try {
FileOutputStream outputStream = new FileOutputStream(name + ".class");
outputStream.write(data);
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
1c3f9d67-79af-4f46-873d-dccdbba15d3f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-14 08:02:48", "repo_name": "fajingyin/generate-code", "sub_path": "/src/main/java/com/yin/code/generator/GeneratorMain.java", "file_name": "GeneratorMain.java", "file_ext": "java", "file_size_in_byte": 1070, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "c23451f4c7e974613117ce22650e7d8d9f0fedbf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/fajingyin/generate-code | 231 | FILENAME: GeneratorMain.java | 0.235108 | package com.yin.code.generator;
import cn.hutool.core.util.StrUtil;
import cn.org.rapid_framework.generator.GeneratorFacade;
import cn.org.rapid_framework.generator.GeneratorProperties;
import org.h2.util.StringUtils;
import java.io.IOException;
/**
* @author yin
* @since 2021/1/3 22:44
*/
public class GeneratorMain {
public static void main(String[] args) throws Exception {
//设置模板位置
GeneratorFacade gf = new GeneratorFacade();
gf.getGenerator().addTemplateRootDir(GeneratorProperties.getProperty("templateRootDir"));
gf.deleteOutRootDir();
//配置表则,输出配置的表。如果未配置则输出所有表
String tables = GeneratorProperties.getProperty("generatorTables");
if (StrUtil.isNotBlank(tables)) {
gf.generateByTable(tables.split(","));
}else {
gf.generateByAllTable();
}
//打开配置输出文件位置
Runtime.getRuntime().exec("cmd.exe /c start " + GeneratorProperties.getRequiredProperty("outRoot"));
}
}
|
595c6888-c55a-4223-bb3e-226036039f9c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-30 09:08:51", "repo_name": "nbeliaev/2019-12-otus-java-beliaev", "sub_path": "/L30-message-system/src/main/java/ru/otus/socketrpocessor/SocketClient.java", "file_name": "SocketClient.java", "file_ext": "java", "file_size_in_byte": 1139, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "e2b3c0be2c94e80dd48f883cb18ce3261d927541", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/nbeliaev/2019-12-otus-java-beliaev | 223 | FILENAME: SocketClient.java | 0.282988 | package ru.otus.socketrpocessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.otus.messagesystem.Message;
import java.io.BufferedOutputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
public class SocketClient {
private static final Logger logger = LoggerFactory.getLogger(SocketClient.class);
private final String host;
private final int port;
public SocketClient(String host, int port) {
this.host = host;
this.port = port;
}
public void sendMessage(Message message) {
logger.info("Message {} was received from {} to {}", message.getId(), message.getFrom(), message.getTo());
logger.info("connected to the host {} on {} port", host, port);
try (Socket clientSocket = new Socket(host, port);
ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(clientSocket.getOutputStream()))) {
oos.writeObject(message);
logger.info("Message {} was sent to {}", message.getId(), message.getTo());
} catch (Exception e) {
logger.error("error", e);
}
}
}
|
e8c83fff-0a6b-4cc3-b8d1-1b44d2e3d638 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-11 06:31:37", "repo_name": "pengshuhui/Presonal-database", "sub_path": "/src/com/sharpbook/entity/Admin.java", "file_name": "Admin.java", "file_ext": "java", "file_size_in_byte": 994, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "14c30b57fbabc046176a3014297cc1b7b62fcac7", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/pengshuhui/Presonal-database | 318 | FILENAME: Admin.java | 0.275909 | package com.sharpbook.entity;
public class Admin {
private int AID;
private String ALoginID;
private String ALoginPsw;
private String AName;
@Override
public String toString() {
return "Admin [AID=" + AID + ", ALoginID=" + ALoginID + ", ALoginPsw=" + ALoginPsw + ", AName=" + AName + "]";
}
public int getAID() {
return AID;
}
public void setAID(int aID) {
AID = aID;
}
public String getALoginID() {
return ALoginID;
}
public void setALoginID(String aLoginID) {
ALoginID = aLoginID;
}
public String getALoginPsw() {
return ALoginPsw;
}
public void setALoginPsw(String aLoginPsw) {
ALoginPsw = aLoginPsw;
}
public String getAName() {
return AName;
}
public void setAName(String aName) {
AName = aName;
}
public Admin() {
super();
}
public Admin(int aID, String aLoginID, String aLoginPsw, String aName) {
super();
AID = aID;
ALoginID = aLoginID;
ALoginPsw = aLoginPsw;
AName = aName;
}
}
|
f5d420ca-6518-4dbd-8166-7a28ec475bfa | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-08 10:08:17", "repo_name": "cqupt-gsy/distributed-transaction", "sub_path": "/api/src/main/java/apprentice/practice/api/enums/Results.java", "file_name": "Results.java", "file_ext": "java", "file_size_in_byte": 996, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "6bba9684046058cdbac3011a01d7d924a0d6e176", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/cqupt-gsy/distributed-transaction | 194 | FILENAME: Results.java | 0.249447 | package apprentice.practice.api.enums;
public enum Results {
CREATE_TRANSACTION_SUCCESS("Transaction create success and in TRY status."),
TRYING_STATUS("Transaction still in TRY status, retry again."),
CONFIRM_STATUS("Transaction already finished with CONFIRM status, please do not retry."),
CANCEL_STATUS(
"Transaction already finished with CANCEL status, please start a new transaction and do retry."),
DUPLICATE_KEY(
"Transaction with same transaction number start too many times, please wait a minute for retry."),
UNKNOWN_EXCEPTION("Transaction failed with unknown reason, please try later"),
TRY_SUCCESS("Transfer success, can continue CONFIRM stage."),
TRY_FAILED("Transfer failed, can continue CANCEL stage"),
TRANSACTION_SUCCESS("OK! transaction success."),
TRANSACTION_FAILED("Ops, transaction failed.");
private String message;
Results(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
}
|
731fae27-44c3-461c-b688-050533e85de1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-05-09T01:45:26", "repo_name": "AspNetMonsters/website", "sub_path": "/source/_posts/AspNetMonsters-episode-252.md", "file_name": "AspNetMonsters-episode-252.md", "file_ext": "md", "file_size_in_byte": 1053, "line_count": 23, "lang": "en", "doc_type": "text", "blob_id": "7cb698c4859391c0287017b73b3fb7e9d5e3ce42", "star_events_count": 4, "fork_events_count": 4, "src_encoding": "UTF-8"} | https://github.com/AspNetMonsters/website | 277 | FILENAME: AspNetMonsters-episode-252.md | 0.245085 |
---
title: Monsters Weekly 252 - Building a WebComponent
layout: post
tags:
- ASP.NET Core
authorId: monsters
date: 2022-05-30 08:00:00
categories:
- Monsters Weekly
permalink: monsters-weekly\ep252
---
In a previous episode, we looked at how we can use the Template element to reuse a block of HTML. Now, let's take that a step further and use a few other native browser technologies (Shadow DOM, Custom Elements, and Slots) to build a Web Component.
Shadow DOM - https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM
Custom Elements - https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements
Templates and Slots - https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_templates_and_slots
Previous Episode: https://www.youtube.com/watch?v=jeBjW-TCCx4&t=2s
<iframe width="702" height="395" src="https://www.youtube.com/embed/zD5kr0Rggtg" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
a151a564-d5aa-4060-817a-e6023db22eaa | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-18 08:10:47", "repo_name": "RJForgie/java-olympics", "sub_path": "/app/src/main/java/com/example/ryanforgie/olympics/Competitors/Competitor.java", "file_name": "Competitor.java", "file_ext": "java", "file_size_in_byte": 1069, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "bd527b9b818ae3982944a9d755390621e595a711", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/RJForgie/java-olympics | 258 | FILENAME: Competitor.java | 0.286169 | package com.example.ryanforgie.olympics.Competitors;
import com.example.ryanforgie.olympics.Medal;
import com.example.ryanforgie.olympics.Sport;
import java.util.ArrayList;
import java.util.Comparator;
/**
* Created by ryanforgie on 15/09/2017.
*/
public abstract class Competitor {
private Country country;
private Sport sport;
private ArrayList<Medal> haul;
public Competitor(Country country, Sport sport) {
this.country = country;
this.sport = sport;
haul = new ArrayList<>();
}
public Country getCountry() {
return country;
}
public Sport getSport() {
return sport;
}
public ArrayList<Medal> getHaul() {
return haul;
}
public abstract int getSkill();
public static Comparator<Competitor> Compskill = new Comparator<Competitor>() {
public int compare(Competitor comp1, Competitor comp2) {
int skillno1 = comp1.getSkill();
int skillno2 = comp2.getSkill();
return skillno2 - skillno1;
}
};
}
|
7300b8b3-3520-47cf-b144-5ed6d9ada780 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-28 03:20:01", "repo_name": "gfreguglia/beertech.bancobeer", "sub_path": "/src/main/java/br/com/beertechtalents/lupulo/pocmq/events/RequestChangePasswordEvents.java", "file_name": "RequestChangePasswordEvents.java", "file_ext": "java", "file_size_in_byte": 1140, "line_count": 25, "lang": "en", "doc_type": "code", "blob_id": "1fef437f0d2b51ac5b4c374ea3eb8fbf7de1f863", "star_events_count": 6, "fork_events_count": 5, "src_encoding": "UTF-8"} | https://github.com/gfreguglia/beertech.bancobeer | 227 | FILENAME: RequestChangePasswordEvents.java | 0.233706 | package br.com.beertechtalents.lupulo.pocmq.events;
import br.com.beertechtalents.lupulo.pocmq.events.template.NotifyRequestResetPassword;
import br.com.beertechtalents.lupulo.pocmq.model.TokenTrocarSenha;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class RequestChangePasswordEvents {
@Value("${change-password.path:http://localhost:3000/trocar-senha/}")
private String path;
public OutboxEvent createRequestChangePasswordEvents(TokenTrocarSenha token) {
NotifyRequestResetPassword notifyRequestResetPassword = new NotifyRequestResetPassword(token, path);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
JsonNode jsonNode = mapper.convertValue(notifyRequestResetPassword, JsonNode.class);
return new OutboxEvent(token.getId(), NotifyRequestResetPassword.class, jsonNode);
}
}
|
bc2423f8-3709-4777-81b3-e90d8b6feb5f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-08-23 08:52:44", "repo_name": "jabawakhuho/java_workspace", "sub_path": "/GUI0810/src/com/sds/file/ProfileApp.java", "file_name": "ProfileApp.java", "file_ext": "java", "file_size_in_byte": 994, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "d76ba536fd13aa638ffc43a53161f1a0a89a5bfe", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jabawakhuho/java_workspace | 259 | FILENAME: ProfileApp.java | 0.279042 | package com.sds.collection;
import java.awt.Canvas;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class ProfileApp extends JFrame{
JLabel src;
Canvas profile;
JButton bt;
JPanel p;
public ProfileApp() {
src = new JLabel("123");
bt = new JButton();
p = new JPanel();
profile = new Canvas() {
Toolkit kit = Toolkit.getDefaultToolkit();
Image img;
String path= "C:/java_workspace/GUI0810/res/pro.png";
img = kit.getImage(path);
@Override
public void paint(Graphics g) {
g.drawImage(img, 0, 0, this);
}
};
p.add(bt);
p.add(src);
profile.setPreferredSize(new Dimension(300,300));
add(profile);
add(p);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(700, 400);
setVisible(true);
}
public static void main(String[] args){
new ProfileApp();
}
} |
0b405c55-c71f-4921-bb48-06354a38a46f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-02-20T03:49:11", "repo_name": "DestinFloyd/ClickAndLog", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1098, "line_count": 46, "lang": "en", "doc_type": "text", "blob_id": "8393e772ac8ad3e8caae25aa9d96b8f590342699", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DestinFloyd/ClickAndLog | 286 | FILENAME: README.md | 0.239349 | # Project2
Objective: Build a full stack App with Node/Express and Mongo/Mongoose from the ground up yourself.
==========
For My App I made 'Click & Log' a place to Create forms, complete forms, & log forms all in one easy location!
I have build Models, Users, which have Boards, and boards have tasks. Also Logs which have Inputs of when and what was completed.
**Site via Heroku**
https://protected-atoll-41733.herokuapp.com/
**Trello Board**
https://trello.com/b/FITLymU4/project-2-mehn
# Pick From your checklist

# Click off fields and log it

# Check logs as needed

**A list of technologies, libraries, and/or frameworks used:**
- Bulma
- Font Awesome
- Express
- HBS
- Method-Override
- Node
- Nodemon
- Mongoose
- MongoDB
- Trello
- Heroku
**In Version 2 I would love to include:**
- An an easier way to sort through the logs. Maybe a way to file them differently.
- Username / password management.
- Different Styling Options Ex: colors
|
2c7974ec-c85e-4be1-884d-dcd3c2dbc052 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2012-05-18 05:07:52", "repo_name": "marionbok/billeterie", "sub_path": "/cineTicket/src/main/java/com/epita/dao/filmDao.java", "file_name": "filmDao.java", "file_ext": "java", "file_size_in_byte": 999, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "04e8c02142a5a0d2f1fd25106b52870aa4f5130a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/marionbok/billeterie | 207 | FILENAME: filmDao.java | 0.282988 | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.epita.dao;
import com.epita.bean.Film;
import com.epita.bean.User;
import com.epita.utils.HibernateUtil;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
/**
*
* @author TiBs
*/
public class filmDao {
private Session session = HibernateUtil.getSessionFactory().getCurrentSession();
public List<Film> getlistFilm() {
List<Object> list = null;
List<Film> result = null;
Criteria criteria = session.createCriteria(Film.class);
list = criteria.list();
for (Object o : list) {
result.add((Film) o);
}
return result;
}
public String saveFilm(Film film) {
session.save(film);
Criteria criteria = session.createCriteria(Film.class);
return "OK";
}
}
|
0e4c6596-db15-47c0-99d6-2edb223c5f1a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-10-09 04:40:58", "repo_name": "jubelka/Proyecto-1", "sub_path": "/src/java/Modelo/Conexion.java", "file_name": "Conexion.java", "file_ext": "java", "file_size_in_byte": 1078, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "ab938994bedc79ec1f48c2a4d05abcc2333eda65", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jubelka/Proyecto-1 | 223 | FILENAME: Conexion.java | 0.217338 | /*
* 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 Modelo;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Jube
*/
public class Conexion {
Connection cnn;
Statement state;
ResultSet res;
Conexion(){
try {
Class.forName("com.mysql.jdbc.Driver");
cnn = DriverManager.getConnection("jdbc:mysql://localhost:3306/proyecto1?zeroDateTimeBehavior=convertToNull","root","123456");
} catch (ClassNotFoundException ex) {
Logger.getLogger(Conexion.class.getName()).log(Level.SEVERE, null, ex);
} catch (SQLException ex) {
Logger.getLogger(Conexion.class.getName()).log(Level.SEVERE, null, ex);
}
}
// public int insertar(Usuario usuario){
//
// }
}
|
f1cfa9ec-a162-4165-8ecb-b58bb123f110 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-12 20:33:49", "repo_name": "luan-alencar/SGE-gerenciamento-estoque", "sub_path": "/src/main/java/com/luan/ecommerce/ecommerce/dominio/Usuario.java", "file_name": "Usuario.java", "file_ext": "java", "file_size_in_byte": 1096, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "43bd1d5360e98f135a6fd4a632ba2bd840c9846f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/luan-alencar/SGE-gerenciamento-estoque | 239 | FILENAME: Usuario.java | 0.218669 | package com.luan.ecommerce.ecommerce.dominio;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
@Getter
@Setter
@Entity
@Table(name = "usuario")
public class Usuario implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sq_usuario")
@SequenceGenerator(name = "sq_usuario", sequenceName = "sq_usuario", allocationSize = 1)
private Integer id;
@Column(name = "nome")
private String nome;
@Column(name = "cpf")
private String cpf;
@Column(name = "rg")
private String rg;
@Column(name = "email")
private String email;
@Column(name = "data_nascimento")
private LocalDate dataNascimento;
@Column(name = "telefone")
private String telefone;
@Column(name = "chave")
private String chave;
@Column(name = "admin")
private Boolean admin;
} |
2a21221a-be11-4d6a-8fd2-d4f814cd2091 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-12 01:14:53", "repo_name": "Anass001/mdb", "sub_path": "/app/src/main/java/com/zeneo/tmdb/Activities/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 995, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "183096995ee318b85b228d3cfa71e62ed15603a7", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Anass001/mdb | 165 | FILENAME: MainActivity.java | 0.204342 | package com.zeneo.tmdb.Activities;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.google.android.gms.ads.MobileAds;
import com.zeneo.tmdb.R;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MobileAds.initialize(this, getResources().getString(R.string.admob_app_id));
Thread timer = new Thread() {
public void run() {
try {
sleep(1000);
} catch (Exception e) {
e.printStackTrace();
} finally {
Intent intent = new Intent(getApplicationContext(), HomeActivity.class);
startActivity(intent);
finish();
}
}
};
timer.start();
}
}
|
60fba4d0-fbe2-4875-9427-7f0018e536d5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-01 11:17:01", "repo_name": "DennisTitire/AtelierulDigital", "sub_path": "/app/src/main/java/com/example/aninterface/week5/Activity1Challenge3.java", "file_name": "Activity1Challenge3.java", "file_ext": "java", "file_size_in_byte": 1141, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "123d8639dfc88cab9949b8781c4db0e90390ab7c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DennisTitire/AtelierulDigital | 187 | FILENAME: Activity1Challenge3.java | 0.252384 | package com.example.aninterface.week5;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.example.aninterface.R;
public class Activity1Challenge3 extends AppCompatActivity {
public static final String DISPLAY_TEXT ="Display_text";
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity1_challenge3);
Button button = findViewById(R.id.message_send);
final EditText editText = findViewById(R.id.message_et);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String Text = editText.getText().toString();
Intent intent1 = new Intent(v.getContext(), Activity2Challenge3.class);
intent1.putExtra(DISPLAY_TEXT, Text);
startActivity(intent1);
}
});
}
}
|
2ca1ad37-0623-4b73-9f86-4ee0de4e36c8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-05 02:39:15", "repo_name": "AlbertoSierraLopez/Estructuras_de_Datos_Avanzadas", "sub_path": "/exams/enero_2016/usecase/URJCInvest.java", "file_name": "URJCInvest.java", "file_ext": "java", "file_size_in_byte": 1139, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "b206528d33bd8de4515e89e2fbd1b92ab21086c5", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AlbertoSierraLopez/Estructuras_de_Datos_Avanzadas | 240 | FILENAME: URJCInvest.java | 0.287768 | package exams.enero_2016.usecase;
import material.Position;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class URJCInvest {
private Map<String, OrganizationChart> map;
public URJCInvest() {
map = new HashMap<>();
}
public OrganizationChart searchCompany(String name) {
return map.get(name);
}
public Iterable<Employee> getGrantHolders(String name) {
OrganizationChart org = map.get(name);
if (org == null) {
throw new RuntimeException("404");
}
return org.getGrantHolders();
}
public Iterable<Employee> getChiefs(String name, Employee emp) {
OrganizationChart org = map.get(name);
if (org == null) {
throw new RuntimeException("404");
}
return org.getChiefs(emp.getPosition());
}
public Iterable<Employee> getEmployees(String cargo) {
List<Employee> list = new ArrayList<>();
for (OrganizationChart org : map.values()) {
list.addAll(org.getEmployees(cargo));
}
return list;
}
}
|
7c5cd6b0-6114-425a-b6e3-0cfd59bd2ef6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-09-09 01:18:04", "repo_name": "jeffson1985/sxb", "sub_path": "/src/com/demo/validator/LoginValidator.java", "file_name": "LoginValidator.java", "file_ext": "java", "file_size_in_byte": 1068, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "68762c64786d8a1a76cb3d51cc8eca9247f57e37", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jeffson1985/sxb | 274 | FILENAME: LoginValidator.java | 0.278257 | package com.demo.validator;
import org.sxb.core.Controller;
import org.sxb.ext.render.CaptchaRender;
import org.sxb.validate.Validator;
import com.demo.model.Admin;
public class LoginValidator extends Validator {
@Override
protected void validate(Controller c) {
this.validateRequired("admin.username", "usernameMsg", "ユーザーIDを入力してください");
this.validateRequired("admin.password", "passwordMsg", "パスワードを入力してください");
boolean rst = CaptchaRender.validate(c, c.getPara("code"), "mykey");
String remberMe = c.getPara("rember_me");
if("on".equals(remberMe)){
c.setCookie("username", c.getPara("admin.username"), 30*60);
c.setCookie("password", c.getPara("admin.password"), 30 * 60);
}else{
c.removeCookie("username");
c.removeCookie("password");
}
if(!rst){
c.setAttr("code", c.getPara("code"));
addError("imgCodeMsg", "検証コードエラー");
return;
}
}
@Override
protected void handleError(Controller c) {
c.keepModel(Admin.class);
c.render("login.html");
}
}
|
f291a3b1-fd10-4bdc-b015-741810b1ead8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-19 14:44:33", "repo_name": "AlesiaDemidkevich/Java_CleanCode", "sub_path": "/Java/src/main/java/Planes/MilitaryPlane.java", "file_name": "MilitaryPlane.java", "file_ext": "java", "file_size_in_byte": 968, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "0aab6f9adf775b0e14127436296a961892276ab6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AlesiaDemidkevich/Java_CleanCode | 198 | FILENAME: MilitaryPlane.java | 0.273574 | package Planes;
import models.MilitaryType;
import java.util.Objects;
public class MilitaryPlane extends Plane{
private MilitaryType militaryType;
public MilitaryPlane(String model, int maxSpeed, int maxFlightDistance, int maxLoadCapacity, MilitaryType militaryType) {
super(model, maxSpeed, maxFlightDistance, maxLoadCapacity);
this.militaryType = militaryType;
}
public MilitaryType getMilitaryType() {
return militaryType;
}
@Override
public String toString() {
return super.toString().replace("}",
", type=" + militaryType +
'}');
}
@Override
public boolean equals(Object plane) {
return this == plane || (plane instanceof MilitaryPlane) || super.equals(plane) ||
militaryType == ((MilitaryPlane) plane).militaryType;
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), militaryType);
}
}
|
4fed8f88-159a-410f-8f12-7244005649d5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-27 06:54:30", "repo_name": "Inigoperez/chatMultiUsuario", "sub_path": "/src/com/company/Server/ConexionCliente.java", "file_name": "ConexionCliente.java", "file_ext": "java", "file_size_in_byte": 1140, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "ff1bd154b4d2f241ec2ddc3d9e255f5f9dd31916", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Inigoperez/chatMultiUsuario | 198 | FILENAME: ConexionCliente.java | 0.23231 | package com.company.Server;
import java.io.*;
import java.net.Socket;
public class ConexionCliente extends Thread{
Socket socket;
String nombre;
BufferedWriter bw ;
ConexionCliente(Socket socket,String nombre){
this.socket = socket;
this.nombre = nombre;
try{
bw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
} catch (IOException exception) {
exception.printStackTrace();
}
}
public void enviarMensaje(String s){
s = nombre+":"+s;
try{
bw.write(s);
bw.newLine();
bw.flush();
} catch (IOException exception) {
exception.printStackTrace();
}
}
@Override
public void run() {
try{
BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String linea;
while((linea = br.readLine()) != null){
Server.broadcast(linea,socket);
}
} catch (IOException exception) {
exception.printStackTrace();
}
}
}
|
e8fa5b2d-d83b-4da0-b9a1-b0b719f08a9e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-02-27 14:04:14", "repo_name": "kinglongchen/mango", "sub_path": "/mango-core/src/test/java/com/kinglong/mango/core/common/util/ReflectUtilsTest.java", "file_name": "ReflectUtilsTest.java", "file_ext": "java", "file_size_in_byte": 990, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "8c6ba0bd92a90ae1f5a0be4c536db78a56468e36", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/kinglongchen/mango | 215 | FILENAME: ReflectUtilsTest.java | 0.262842 | package com.kinglong.mango.core.common.util;
import com.kinglong.mango.core.config.PropertyHolder;
import lombok.Data;
import org.junit.Test;
import java.lang.reflect.Method;
import java.util.List;
/**
* Created by chenjinlong on 16/1/14.
*/
public class ReflectUtilsTest {
@Test
public void getProperties() {
for (Method method:TestClass.class.getDeclaredMethods()) {
System.out.println(method.getName());
}
for (PropertyHolder prop : ReflectUtils.getProperties(TestClass.class)) {
System.out.println(prop.getName());
}
}
@Test
public void getClassTest() {
List<Class<?>> classList = ReflectUtils.getClasses("com.google.common.base");
for (Class<?> cls : classList) {
System.out.println(cls.getName());
}
}
}
@Data
class TestClass {
private Integer Aaa;
private Integer bBb;
private Integer ccC;
private Integer ddd;
private Integer EEE;
}
|
cc3814a5-d256-4029-8b9e-2630bb7cce92 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-18 01:08:57", "repo_name": "frank-okafor/digicore-challenge-", "sub_path": "/src/main/java/com/digicore/challenge/security/CustomAuthenticationEntryPoint.java", "file_name": "CustomAuthenticationEntryPoint.java", "file_ext": "java", "file_size_in_byte": 1068, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "750bd63aa583d72b08fae63ae47ba36f24093b38", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/frank-okafor/digicore-challenge- | 174 | FILENAME: CustomAuthenticationEntryPoint.java | 0.229535 | package com.digicore.challenge.security;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;
import lombok.extern.slf4j.Slf4j;
@Component
@Slf4j
public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException, ServletException {
log.error("Unauthorized error: {}", authException.getMessage());
String json = String.format("{\"errorcode\": \"%s\", \"message\": \"%s\"}", 401, authException.getMessage());
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json);
}
}
|
65df5154-acad-4be7-91dd-b1752e55e9f2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-12 08:01:00", "repo_name": "longyuan02/XPosedModule", "sub_path": "/app/src/main/java/com/example/xposedmoudle/xprosed/MixHook.java", "file_name": "MixHook.java", "file_ext": "java", "file_size_in_byte": 1184, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "ecd7639a940ceaf6a60a64630121e8b6e8470264", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/longyuan02/XPosedModule | 268 | FILENAME: MixHook.java | 0.293404 | package com.example.xposedmoudle.xprosed;
import android.content.res.XModuleResources;
import com.example.xposedmoudle.R;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.callbacks.XC_InitPackageResources;
public class MixHook implements IXposedHookInitPackageResources, IXposedHookZygoteInit {
private static String MODULE_PATH = null;
@Override
public void handleInitPackageResources(XC_InitPackageResources.InitPackageResourcesParam resparam) throws Throwable {
/**
* 参数createInstance(String path, XResources origRes)
* path 路径:在那个apk中加载
* resparam:设置资源文件
*/
// if(){}判断目标包名
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
resparam.res.addResource(modRes, R.drawable.ic_launcher_foreground);
resparam.res.addResource(modRes, R.drawable.ic_launcher_background);
}
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}
}
|
8e47214a-cefc-4d94-8346-efe417c03435 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-14 11:40:50", "repo_name": "candrawijayanto/TiketOnline", "sub_path": "/src/main/java/com/tugas/manpro/service/BarcodeService.java", "file_name": "BarcodeService.java", "file_ext": "java", "file_size_in_byte": 1024, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "1bc3e6bdd3302d51918b306fdd58c3c4eef3548a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/candrawijayanto/TiketOnline | 212 | FILENAME: BarcodeService.java | 0.258326 | package com.tugas.manpro.service;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import org.springframework.core.io.FileSystemResource;
import org.springframework.stereotype.Component;
@Component
public class BarcodeService {
public FileSystemResource generate(String data) {
String path = "./barcode/" + data + ".jpg";
BitMatrix matrix;
try {
matrix = new MultiFormatWriter().encode(data, BarcodeFormat.QR_CODE, 250, 250);
MatrixToImageWriter.writeToPath(matrix, "jpg", Paths.get(path));
} catch (WriterException | IOException e) {
e.printStackTrace();
}
System.out.println("QR " + data + " berhasil dibuat");
return new FileSystemResource(new File(path));
}
}
|
fb5d38bb-31c3-463b-af6d-ca51f0abb495 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-08-21 08:51:27", "repo_name": "petergeneric/stdlib", "sub_path": "/guice/common/src/main/java/com/peterphi/std/guice/common/auth/annotations/AuthConstraint.java", "file_name": "AuthConstraint.java", "file_ext": "java", "file_size_in_byte": 1099, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "17a9fcc433a0e1172e1a7d7713ba7d9a5fd1fe98", "star_events_count": 7, "fork_events_count": 5, "src_encoding": "UTF-8"} | https://github.com/petergeneric/stdlib | 242 | FILENAME: AuthConstraint.java | 0.243642 | package com.peterphi.std.guice.common.auth.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface AuthConstraint
{
String DEFAULT_ID = "default";
/**
* The id of this authentication constraint; designed to allow configuration to override the constraints in the annotation
*
* @return
*/
String id() default DEFAULT_ID;
/**
* If true, authentication will not be enforced on calls made to the annotation target
*
* @return
*/
boolean skip() default false;
/**
* A list of roles, one of which the user must have. Defaults to "user". If the user does not hold this role then an authentication exception will be raised
*
* @return
*/
String[] role() default "user";
/**
* The description of this constraint (which can be displayed to users to help explain why they have been denied access)
*
* @return
*/
String comment() default "";
}
|
5d86a090-43dd-4e2b-863d-97c0f826b78c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-26 03:04:24", "repo_name": "dawei-ren/study_java", "sub_path": "/myself_study/src/main/java/com/rendawei/myInternet/testUDP/basic/TestSend.java", "file_name": "TestSend.java", "file_ext": "java", "file_size_in_byte": 1225, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "11b2afca6ab8ff4bd01a65353f6c8da88406f02d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dawei-ren/study_java | 295 | FILENAME: TestSend.java | 0.285372 | package com.rendawei.myInternet.testUDP.basic;
import java.io.IOException;
import java.net.*;
import java.util.Scanner;
public class TestSend {
public static void main(String[] args) {
DatagramSocket ds = null;
try {
// 创建套接字, 8888指的是发送方的端口
ds = new DatagramSocket(8888);
while (true){
// 打包数据
Scanner sc = new Scanner(System.in);
System.out.print("学生说:");
String str = sc.next();
byte[] bytes = str.getBytes();
DatagramPacket dp = new DatagramPacket(bytes, bytes.length, InetAddress.getByName("localhost"), 9999);
// 发送数据
ds.send(dp);
if ("bye".equals(str)){
System.out.println("学生下线。。。");
break;
}
// 接收回复
byte[] b = new byte[1024];
DatagramPacket dp2 = new DatagramPacket(b, b.length);
ds.receive(dp2);
String str2 = new String(dp2.getData(), 0, dp2.getLength());
System.out.println("老师:" + str2);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
// 关闭
if (ds != null){
ds.close();
}
}
}
}
|
e182c178-455f-4963-8748-0b67152b7e28 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-28 08:57:40", "repo_name": "tawn0414/Spring", "sub_path": "/springbasic/src/app3/MyBeanTest_ApplicationContext.java", "file_name": "MyBeanTest_ApplicationContext.java", "file_ext": "java", "file_size_in_byte": 1010, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "d5d810d3d84d24f41a492a0e70e3d3211edf2100", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UHC"} | https://github.com/tawn0414/Spring | 224 | FILENAME: MyBeanTest_ApplicationContext.java | 0.261331 | package app3;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
//ApplicationContext가 객체를 관리하는 방법.
public class MyBeanTest_ApplicationContext {
public static void main(String[] args) {
System.out.println("-------------ApplicationContext생성전-------------");
ApplicationContext factory = new GenericXmlApplicationContext("/config/bean.xml");
System.out.println("------------getBean호출전--------------");
MyBeanStyleInherit obj = (MyBeanStyleInherit)factory.getBean("myBean1");
//비즈니스로직 호출
run(obj);
show(obj);
}
public static void run(MyBeanStyleInherit obj) {
System.out.println("*******************");
obj.Hello("현빈");
obj.Hello("현빈");
System.out.println("*******************");
}
public static void show(MyBeanStyleInherit obj) {
System.out.println("====================");
obj.Hello("현빈");
obj.Hello("현빈");
System.out.println("====================");
}
}
|
daab7bbd-1656-4284-a06a-0216dba2fc3c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-16 13:40:55", "repo_name": "Vamdawn/binflare", "sub_path": "/src/main/java/chen/binflare/controller/UsersController.java", "file_name": "UsersController.java", "file_ext": "java", "file_size_in_byte": 1139, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "9d9e471322766c19a3cd663bed35f26be59321b1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Vamdawn/binflare | 203 | FILENAME: UsersController.java | 0.242206 | package chen.binflare.controller;
import chen.binflare.common.dto.ResponseDTO;
import chen.binflare.dto.users.CreateTokenReqDTO;
import chen.binflare.dto.users.CreateTokenRespDTO;
import chen.binflare.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Validated
@RestController
@RequestMapping("/api/users")
public class UsersController {
@Autowired
private UsersService usersService;
@PostMapping("/token")
public ResponseDTO<CreateTokenRespDTO> createAccessToken(@RequestBody @Validated CreateTokenReqDTO createTokenReqDTO) {
return ResponseDTO.success(usersService.createAccessToken(
createTokenReqDTO.getUserType(), createTokenReqDTO.getUserName(),
createTokenReqDTO.getPassType(), createTokenReqDTO.getPassWord()
));
}
}
|
dc060d1c-5087-4917-a7ee-cc0605591972 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-04-24 14:26:54", "repo_name": "dashe02/Algorithm", "sub_path": "/src/com/exercise3/SortArray.java", "file_name": "SortArray.java", "file_ext": "java", "file_size_in_byte": 982, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "c3b08d98be5f4dbd61ed9ab8f68334f7d39da668", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dashe02/Algorithm | 294 | FILENAME: SortArray.java | 0.294215 | package com.exercise3;
import java.util.Arrays;
/**
* Created by wecash on 19/3/27.
*/
public class SortArray {
public static void main(String[] args) {
int[] nums = {1, 7, 3, 5, 4, 2, 10};
SortArray s = new SortArray();
int[] result = s.sortArray(nums);
System.out.print(Arrays.toString(result));
}
//1 3 4 10
//7 5 2
private int[] sortArray(int[] nums) {
int size = 0;
if (nums.length % 2 == 0) {
size = nums[nums.length - 2];
} else if (nums.length % 2 == 1) {
size = nums[nums.length - 1];
}
int[] temp = new int[size + 1];
for (int i = 0; i < nums.length; i++) {
temp[nums[i]] = nums[i];
}
int k = 0;
int[] result = new int[nums.length];
for (int i = 0; i < temp.length; i++) {
if (temp[i] != 0) {
result[k++] = temp[i];
}
}
return result;
}
}
|
8803f3ab-8257-48d8-a7b5-9f329d7d1283 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-18 04:03:15", "repo_name": "miketrueplus/MagestorePOSAndroid", "sub_path": "/LibMagestore/src/main/java/com/magestore/app/lib/connection/ConnectionException.java", "file_name": "ConnectionException.java", "file_ext": "java", "file_size_in_byte": 1103, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "c4de4b31454ba0035edf8b18d23bfef7f5302155", "star_events_count": 1, "fork_events_count": 4, "src_encoding": "UTF-8"} | https://github.com/miketrueplus/MagestorePOSAndroid | 220 | FILENAME: ConnectionException.java | 0.236516 | package com.magestore.app.lib.connection;
import com.magestore.app.lib.exception.MagestoreException;
/**
* Quản lý các exception của Connection
* Created by Mike on 12/12/2016.
* Magestore
* mike@trueplus.vn
*/
public class ConnectionException extends MagestoreException {
public static final String EXCEPTION_INTERNAL_HOST = "com.magestore.app.lib.connection.ConnectionException.InternalHostException";
public static final String EXCEPTION_PAGE_NOT_FOUND = "com.magestore.app.lib.connection.ConnectionException.PageNotFoundException";
public static final String EXCEPTION_TIMEOUT = "com.magestore.app.lib.connection.ConnectionException.TimeoutException";
public ConnectionException(String strCode) {
super(strCode);
}
public ConnectionException(String strCode, String message) {
super(strCode, message);
}
public ConnectionException(String strCode, String message, Throwable cause) {
super(strCode, message, cause);
}
public ConnectionException(String strCode, Throwable cause) {
super(strCode, cause);
}
}
|
3cfef113-a620-4f7e-b7c2-9b7e373c25cd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-14 18:06:49", "repo_name": "lsst-ts/ts_sal_runtime", "sub_path": "/camera/java/src/cameraController.java", "file_name": "cameraController.java", "file_ext": "java", "file_size_in_byte": 1078, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "91536c0cf2bfb80e3bd6cb204577c9743cb6e961", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lsst-ts/ts_sal_runtime | 272 | FILENAME: cameraController.java | 0.259826 |
import camera.*;
import org.lsst.sal.SAL_camera;
public class cameraController {
public static void main(String[] args) {
short aKey = 1;
int status = SAL_camera.SAL__OK;
int cmdId = 0;
int timeout = 0;
boolean finished=false;
// Initialize
SAL_camera cmd = new SAL_camera();
if (args.length > 0) {
timeout=Integer.parseInt(args[0]) * 1000;
}
cmd.salProcessor();
camera.command command = new camera.command();
while (!finished) {
cmdId = cmd.acceptCommand(command);
if (cmdId > 0) {
if (timeout > 0) {
cmd.ackCommand(cmdId, SAL_camera.SAL__CMD_INPROGRESS, timeout, "Ack : OK");
try {Thread.sleep(timeout);} catch (InterruptedException e) { e.printStackTrace(); }
}
cmd.ackCommand(cmdId, SAL_camera.SAL__CMD_COMPLETE, 0, "Done : OK");
}
try {Thread.sleep(1000);} catch (InterruptedException e) { e.printStackTrace(); }
}
/* Remove the DataWriters etc */
cmd.salShutdown();
}
}
|
39077d2a-546e-4401-bd35-f1df4705968a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-10 00:38:07", "repo_name": "19krikma/MusicPlayer", "sub_path": "/Java8/Version1.0.1/Source Code/MusicPlayer.java", "file_name": "MusicPlayer.java", "file_ext": "java", "file_size_in_byte": 1142, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "7a366697ff27ad9e7a100cb9e476d61603e78640", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/19krikma/MusicPlayer | 276 | FILENAME: MusicPlayer.java | 0.286968 |
/*
* Mark Krikunov
* Music Player v1.0.1
* Changes:
* -Removed Stop Button
* -Search for the folder you want to run
* -Spacing between buttons
* -Removed .mp3 from the buttons name
* -Stores name of playing song and stops it immidiatly if needed to
* 3.31.20
*/
import java.io.IOException;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class MusicPlayer extends Application {
private static final int APPWIDTH = 820;
private static final int APPHEIGHT = 480;
public void start(Stage primaryStage) throws IOException {
AppGUI app = new AppGUI();
Scene main = new Scene(app, APPWIDTH, APPHEIGHT);
primaryStage.setScene(main);
primaryStage.setTitle("Music Player");
primaryStage.setResizable(false);
primaryStage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
class AppGUI extends BorderPane {
public AppGUI() throws IOException {
ControlPane control = new ControlPane();
ButtonSong buttons = new ButtonSong(control);
this.setTop(control);
this.setCenter(buttons);
}
}
|
0b6fcd74-ae29-4c94-b658-1fe5e18205d8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-07-10 12:55:21", "repo_name": "roydekleijn/workshop", "sub_path": "/src/test/java/org/workshop/test/ContactTest.java", "file_name": "ContactTest.java", "file_ext": "java", "file_size_in_byte": 1141, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "c20fb9482ea036dd589ee2a9a6429e5699465033", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/roydekleijn/workshop | 230 | FILENAME: ContactTest.java | 0.247987 | package org.workshop.test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.Test;
@Test(groups = { "all", "contact" })
public class ContactTest {
public void completeForm() throws InterruptedException {
// Create a webdriver instance to control the browser
WebDriver driver = new FirefoxDriver();
// Open a website
driver.get("http://selenium.polteq.com/testshop/");
// Navigate to contact page
driver.findElement(By.cssSelector("li#header_link_contact a")).click();
// Complete form
Select subject = new Select(driver.findElement(By.id("id_contact")));
subject.selectByVisibleText("Customer service");
driver.findElement(By.id("email")).sendKeys("tester@test.com");
driver.findElement(By.id("id_order")).sendKeys("12345");
driver.findElement(By.id("message")).sendKeys("Message of what went wrong");
driver.findElement(By.id("submitMessage")).click();
// close browser
driver.quit();
}
}
|
08c904cc-b17d-4a63-b0b6-a481bf6f0c11 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-02 05:45:08", "repo_name": "JavaLovers/wechat-mp-sdk", "sub_path": "/src/main/java/org/usc/wechat/mp/sdk/vo/reply/NewsReply.java", "file_name": "NewsReply.java", "file_ext": "java", "file_size_in_byte": 981, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "58b0477ecc7e1074bcad50942df268ef84714f0c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JavaLovers/wechat-mp-sdk | 199 | FILENAME: NewsReply.java | 0.213377 | package org.usc.wechat.mp.sdk.vo.reply;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author Shunli
*/
@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)
public class NewsReply extends Reply {
@XmlElement(name = "ArticleCount")
private int ArticleCount;
@XmlElementWrapper(name = "Articles")
@XmlElement(name = "item")
private List<ArticleDetail> articles;
public int getArticleCount() {
return ArticleCount;
}
public void setArticleCount(int articleCount) {
ArticleCount = articleCount;
}
public List<ArticleDetail> getArticles() {
return articles;
}
public void setArticles(List<ArticleDetail> articles) {
this.articles = articles;
}
}
|
cceba982-dafc-425e-bcca-220c894a19f7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-01-30 14:45:00", "repo_name": "alexpershin/sms-module", "sub_path": "/src/main/java/org/tcontrol/sms/commands/ThermostatOffCommand.java", "file_name": "ThermostatOffCommand.java", "file_ext": "java", "file_size_in_byte": 1023, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "4859bfbf9724c507073c5f3f05cde19b6d27b9a1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/alexpershin/sms-module | 208 | FILENAME: ThermostatOffCommand.java | 0.253861 | package org.tcontrol.sms.commands;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.tcontrol.sms.IRelayController;
import org.tcontrol.sms.ISMSCommand;
import org.tcontrol.sms.IThermostat;
import org.tcontrol.sms.config.props.ThermostatConfig;
@Component
@Slf4j
@Qualifier("thermostatOffCommand")
@AllArgsConstructor
public class ThermostatOffCommand implements ISMSCommand {
private final IRelayController relayController;
private final IThermostat thermostatElectro;
private final ThermostatConfig thermostatElectroConfig;
@Override
public CommandResult run() {
thermostatElectro.changeOn(false);
thermostatElectroConfig.relayPins().forEach(pin -> {
relayController.turnOffRelay(pin);
});
log.info("Executed");
return new CommandResult(STATUS.OK, "Termostat is off");
}
}
|
98d16800-0375-4881-bb2e-dea5a846a18e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-08T06:28:53", "repo_name": "karlopopovic/Kino-ulaznica", "sub_path": "/Kino_ulaznica/src/Database/Prijava.java", "file_name": "Prijava.java", "file_ext": "java", "file_size_in_byte": 1143, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "5c12fd4ed636123bbdded753f7de3fe15330f900", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/karlopopovic/Kino-ulaznica | 221 | FILENAME: Prijava.java | 0.264358 | /*
* 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 Database;
/**
*
* @author Korisnik
*/
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Prijava {
public static boolean logiraj (String name, String password) throws SQLException
{
Database db = new Database();
PreparedStatement ps = db.CONNECTION.prepareStatement("SELECT * FROM korisnici WHERE id =? AND "
+ "lozinka=?");
try {
ps.setString(1, name);
ps.setString(2, password);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return true;
} else {
return false;
}
} catch (SQLException ex) {
System.out.println("Nastala je greška: "+ex.getMessage());
return false;
}
}
}
|
b8f0ebaa-d17e-4a65-a44e-4e9319dfc370 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-17 15:33:03", "repo_name": "silentcharacter/jooby-app", "sub_path": "/src/main/java/com/mycompany/domain/shop/Customer.java", "file_name": "Customer.java", "file_ext": "java", "file_size_in_byte": 985, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "945a59ff0dd268c50cf95f93c00778b23d8a1c77", "star_events_count": 3, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/silentcharacter/jooby-app | 197 | FILENAME: Customer.java | 0.264358 | package com.mycompany.domain.shop;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.mycompany.annotation.Deployment;
import com.mycompany.domain.Entity;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@JsonIgnoreProperties(ignoreUnknown = true)
@Deployment(table = "customers")
public class Customer extends Entity
{
public String name;
public String comment;
public String phone;
public Integer totalOrdered = 0;
public List<Address> addresses = new ArrayList<>();
@Override
public String getFullText() {
return Optional.ofNullable(name).orElse("").toLowerCase() + " " + Optional.ofNullable(comment).orElse("").toLowerCase()
+ " " + Optional.ofNullable(phone).orElse("").toLowerCase() + " " +
addresses.stream().map(a->String.format("%s %s %s", a.streetName, a.streetNumber, a.flat)).collect(Collectors.joining(" "));
}
}
|
529a5459-a7c4-4289-9f69-0d2f4040eb9d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-11-11 08:36:13", "repo_name": "alexymumo/SqliteDemo", "sub_path": "/app/src/main/java/com/example/classwork/Student.java", "file_name": "Student.java", "file_ext": "java", "file_size_in_byte": 1070, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "39eb8f440ec1b088be041e8ecfb3814330664dfb", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/alexymumo/SqliteDemo | 220 | FILENAME: Student.java | 0.23793 | package com.example.classwork;
public class Student {
int id;
String name;
String department;
String course;
public Student(){}
public Student(String name, String department, String course){
this.name = name;
this.department = department;
this.course = course;
}
public Student(int id, String name, String department, String course){
this.id = id;
this.name = name;
this.department = department;
this.course = course;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public String getCourse() {
return course;
}
public String getDepartment() {
return department;
}
public void setName(String name) {
this.name = name;
}
public void setCourse(String course) {
this.course = course;
}
public void setId(int id) {
this.id = id;
}
public void setDepartment(String department) {
this.department = department;
}
}
|
120cf5c0-bfaa-4a60-9a5f-37e7e8925b0b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-07-24 18:12:06", "repo_name": "nraynaud/trainoo", "sub_path": "/sport-j2ee/src/main/java/com/nraynaud/sport/web/result/RedirectBack.java", "file_name": "RedirectBack.java", "file_ext": "java", "file_size_in_byte": 985, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "10b4c75ce119c0a47e12c87b24518fe661ad1c49", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/nraynaud/trainoo | 203 | FILENAME: RedirectBack.java | 0.242206 | package com.nraynaud.sport.web.result;
import com.nraynaud.sport.web.ActionDetail;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.inject.Inject;
import org.apache.struts2.dispatcher.mapper.ActionMapper;
import java.util.Map;
/**
* Redirect (with 302) to the previous action.
*/
public class RedirectBack extends BackResult {
private ActionMapper actionMapper;
protected Result createRealResult(final ActionInvocation invocation, final ActionDetail detail) {
final Redirect result = new Redirect(detail.namespace, detail.name, "index");
result.setActionMapper(actionMapper);
for (final Map.Entry<String, String[]> entry : detail.parameters.entrySet()) {
result.addParameter(entry.getKey(), entry.getValue()[0]);
}
return result;
}
@Inject
public void setActionMapper(final ActionMapper mapper) {
actionMapper = mapper;
}
}
|
4e644c08-e2c7-42a1-a531-d315dced38e9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-03 20:01:33", "repo_name": "coleman17/spring-appengine-template-project", "sub_path": "/src/main/java/company/infrastructure/datastore/jackson/JacksonConfiguration.java", "file_name": "JacksonConfiguration.java", "file_ext": "java", "file_size_in_byte": 1101, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "d19c457b2d9f740fc004381d22c23224839d3358", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/coleman17/spring-appengine-template-project | 177 | FILENAME: JacksonConfiguration.java | 0.245085 | package company.infrastructure.datastore.jackson;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.joda.JodaModule;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
public class JacksonConfiguration extends AbstractJacksonConfig {
@Override
@Bean
public Jackson2ObjectMapperBuilderCustomizer jacksonBuilderCustomizer(ApplicationContext ctx) {
return baseConfig(objectMapperBuilder ->
objectMapperBuilder.modulesToInstall(
new JodaModule()),
ctx);
}
@Bean
@Primary
public ObjectMapper objectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
return objectMapper;
}
}
|
2f2fc142-5cc5-4845-9572-c21daecfe76e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-03-09 09:22:08", "repo_name": "bluepenfc/HomeAway", "sub_path": "/src/main/java/com/source/ChooseBrowser.java", "file_name": "ChooseBrowser.java", "file_ext": "java", "file_size_in_byte": 1028, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "4a18f0fb33252a6ae5b6b41cbfd967ef401fb3b5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/bluepenfc/HomeAway | 192 | FILENAME: ChooseBrowser.java | 0.249447 | package com.source;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class ChooseBrowser {
public WebDriver loadBrowser(String browser) {
WebDriver driver;
if(browser.equalsIgnoreCase("firefox")){
// use firefox
driver = new FirefoxDriver();
}
else if(browser.equalsIgnoreCase("chrome")){
// use chrome
System.setProperty("webdriver.chrome.driver","C:\\chromeDriver\\chromedriver.exe");
driver = new ChromeDriver();
}
else if(browser.equalsIgnoreCase("ie")){
// use IE
System.setProperty("webdriver.ie.driver","C:\\iedriver\\IEDriverServer.exe");
driver = new InternetExplorerDriver();
}
else{
throw new RuntimeException("Browser is not correct");
}
return driver;
}
}
|
6efa2159-4492-4f48-9af2-d5f3e2325335 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-11-01 18:57:32", "repo_name": "Akhilkathuria2321/PhoneStop", "sub_path": "/app/src/main/java/com/alpgeeks/phonestop/library/SmsReader.java", "file_name": "SmsReader.java", "file_ext": "java", "file_size_in_byte": 985, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "c9ee9667d230f3f935ca6900088f864c42a2aef0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Akhilkathuria2321/PhoneStop | 215 | FILENAME: SmsReader.java | 0.262842 | package com.alpgeeks.phonestop.library;
import android.app.Activity;
import android.database.Cursor;
import android.net.Uri;
/**
* Created by Akki on 10/26/2015.
*/
public class SmsReader {
public static final String INBOX = "content://sms/inbox";
public static boolean smsReceived(Activity activity) {
Cursor cursor = activity.getContentResolver().query(Uri.parse(INBOX), null, null, null, null);
String msgData = "";
if (cursor.moveToFirst()) { // must check the result to prevent exception
do {
// for(int idx=0;idx<cursor.getColumnCount();idx++)
// {
int idx=0;
msgData += " " + cursor.getColumnName(idx) + ":" + cursor.getString(idx);
// }
// use msgData
} while (cursor.moveToNext());
} else {
// empty box, no SMS
}
System.out.println("Yes "+ msgData);
return false;
}
}
|
aef10572-3f0f-4239-b44f-1f2c63311e62 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-04-07 02:54:56", "repo_name": "Bigua/ComicCollector", "sub_path": "/Fragments/WishListFragment.java", "file_name": "WishListFragment.java", "file_ext": "java", "file_size_in_byte": 1141, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "2123dc7b059abf1fcb02ad50057be4393527523d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Bigua/ComicCollector | 211 | FILENAME: WishListFragment.java | 0.221351 | package me.bigua.comiccollector.Fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import me.bigua.comiccollector.MainActivity;
import me.bigua.comiccollector.R;
public class WishListFragment extends Fragment {
private static final String ARG_SECTION_NUMBER = "section_number";
public WishListFragment() {
// Required empty public constructor
}
public static WishListFragment newInstance(int sectionNumber) {
WishListFragment fragment = new WishListFragment();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
fragment.setArguments(args);
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_wish_list, container, false);
((MainActivity) getActivity()).setActionBarTitle(R.string.whish_list);
return view;
}
}
|
cd421a9e-d901-4dcb-9961-bfb16810f838 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-09-07 11:35:58", "repo_name": "warriordog/MapMaster", "sub_path": "/src/net/acomputerdog/map/stage/convert/in/ImportedTile.java", "file_name": "ImportedTile.java", "file_ext": "java", "file_size_in_byte": 1099, "line_count": 53, "lang": "en", "doc_type": "code", "blob_id": "c90964ec6b39d004c99ea9bfdc32fcbcfd4ef109", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/warriordog/MapMaster | 270 | FILENAME: ImportedTile.java | 0.262842 | package net.acomputerdog.map.stage.convert.in;
import net.acomputerdog.map.image.SourcedImage;
import net.acomputerdog.map.tile.Tile;
import net.acomputerdog.map.tile.TileSource;
public class ImportedTile extends Tile {
private final SourcedImage image;
private final int startX, startY, endX, endY;
private final long modified;
public ImportedTile(TileSource source, SourcedImage image, int x, int y) {
super(source);
this.image = image;
this.startX = x;
this.startY = y;
this.endX = x + 512;
this.endY = y + 512;
this.modified = image.getSourceFile().lastModified();
}
@Override
public int getStartX() {
return startX;
}
@Override
public int getStartY() {
return startY;
}
@Override
public int getEndX() {
return endX;
}
@Override
public int getEndY() {
return endY;
}
@Override
public SourcedImage getImage() {
return image;
}
@Override
public long getLastModified() {
return modified;
}
}
|
242383f2-3b5a-4fbf-beaa-3f04a4a17c49 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-30 09:21:53", "repo_name": "phnMegazone/simple-watching-service", "sub_path": "/src/main/java/com/fleta/watchingservice/adapter/grpc/server/WatchingServer.java", "file_name": "WatchingServer.java", "file_ext": "java", "file_size_in_byte": 1100, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "c348ba5c5edf9c2a206c48ff06b54bd650909267", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/phnMegazone/simple-watching-service | 207 | FILENAME: WatchingServer.java | 0.239349 | package com.fleta.watchingservice.adapter.grpc.server;
import com.fleta.watchingservice.domain.service.WatchingServiceGrpcImpl;
import com.fleta.watchingservice.port.WatchingRepository;
import io.grpc.ServerBuilder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class WatchingServer implements ApplicationRunner {
@Value("${grpc.port}")
public int port;
@Value("${grpc.host}")
public String host;
private final WatchingRepository watchingRepository;
public WatchingServer(WatchingRepository watchingRepository) {
this.watchingRepository = watchingRepository;
}
@Override
public void run(ApplicationArguments args) throws Exception {
log.info("host {} {}", host, port);
ServerBuilder.forPort(port)
.addService(new WatchingServiceGrpcImpl(watchingRepository))
.build().start();
}
}
|
d47e2e27-1c5a-4336-b67a-9362f638ab77 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-05-16 18:15:52", "repo_name": "ImadYamane/mad_app", "sub_path": "/security-bundle/src/main/java/managers/RealmManager.java", "file_name": "RealmManager.java", "file_ext": "java", "file_size_in_byte": 976, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "48e0940831e30bb60cf055f8eb1858a2b05061eb", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ImadYamane/mad_app | 232 | FILENAME: RealmManager.java | 0.242206 | package managers;
import org.picketlink.annotations.PicketLink;
import org.picketlink.idm.PartitionManager;
import org.picketlink.idm.model.basic.Realm;
import resources.JPAResources;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import java.io.Serializable;
/**
* author.name: Imad Yamane
* author.email: contact@imadyamane.de
* author.website: //imadyamane.de
* date: 04/05/16
*/
public class RealmManager implements Serializable {
@Inject
private PartitionManager partitionManager;
private Realm realm;
@Produces
@PicketLink
public Realm select() {
return this.realm;
}
public JPAResources.REALM getRealm() {
if (this.realm == null) {
return null;
}
return JPAResources.REALM.valueOf(this.realm.getName());
}
public void setRealm(JPAResources.REALM realm) {
this.realm = this.partitionManager.getPartition(Realm.class, realm.name());
}
}
|
88ffa713-21a5-49d3-a607-9d2eb9c651b0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-08-19 15:37:04", "repo_name": "jojoldu/blog-code", "sub_path": "/springboot-jpa-id/src/test/java/com/jojoldu/blogcode/springbootjpaid/ApplicationTests.java", "file_name": "ApplicationTests.java", "file_ext": "java", "file_size_in_byte": 1147, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "88eae82ff1ee9f685b24356a8ee3e95106a43558", "star_events_count": 705, "fork_events_count": 451, "src_encoding": "UTF-8"} | https://github.com/jojoldu/blog-code | 220 | FILENAME: ApplicationTests.java | 0.262842 | package com.jojoldu.blogcode.springbootjpaid;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApplicationTests {
@Autowired
private BookRepository bookRepository;
@Autowired
private MemberRepository memberRepository;
@After
public void tearDown() throws Exception {
bookRepository.deleteAllInBatch();
memberRepository.deleteAllInBatch();
}
@Test
public void auto_increment_테스트() {
//given
bookRepository.save(new Book("book1"));
memberRepository.save(new Member("member1"));
//when
Book book = bookRepository.findAll().get(0);
Member member = memberRepository.findAll().get(0);
//then
assertThat(book.getId()).isEqualTo(1L);
assertThat(member.getId()).isEqualTo(1L);
}
}
|
86e0b74f-3eb1-45e6-987c-4e15605ff95b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-07 16:22:28", "repo_name": "pedromassango/Programmers", "sub_path": "/app/src/main/java/com/pedromassango/programmers/extras/AnimUtils.java", "file_name": "AnimUtils.java", "file_ext": "java", "file_size_in_byte": 978, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "c152fb223fa78b072604a8e7de0d6a766ccae8bb", "star_events_count": 9, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/pedromassango/Programmers | 185 | FILENAME: AnimUtils.java | 0.245085 | package com.pedromassango.programmers.extras;
import android.content.Context;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
/**
* Created by Pedro Massango on 26/05/2017.
*/
public class AnimUtils {
public static Animation blink() {
Animation animation = new AlphaAnimation(1, 0);
animation.setDuration(550);
animation.setInterpolator(new LinearInterpolator());
animation.setRepeatCount(10);
animation.setRepeatMode(Animation.REVERSE);
return animation;
}
public static Animation transOut(Context context) {
return AnimationUtils.loadAnimation(context, android.R.anim.fade_out);
}
public static Animation transIn(Context context) {
return AnimationUtils.loadAnimation(context, android.R.anim.fade_in);
}
}
|
ffa561e8-5c93-4d77-a648-4711bd346c22 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-02-19 15:20:05", "repo_name": "marcelo-s/geo-students", "sub_path": "/src/main/java/entity/Student.java", "file_name": "Student.java", "file_ext": "java", "file_size_in_byte": 1140, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "199095f5f9fb1cff27551c59fe22fb41b63b0142", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/marcelo-s/geo-students | 233 | FILENAME: Student.java | 0.261331 | package entity;
import java.util.Objects;
/**
* Entity class that models a student with geo location
*/
public class Student implements Comparable<Student> {
private String name;
private GeoCoordinate geoCoordinate;
public Student(String name, GeoCoordinate geoCoordinate) {
this.name = name;
this.geoCoordinate = geoCoordinate;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public GeoCoordinate getGeoCoordinate() {
return geoCoordinate;
}
public void setGeoCoordinate(GeoCoordinate geoCoordinate) {
this.geoCoordinate = geoCoordinate;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Student student = (Student) o;
return name.equals(student.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
@Override
public int compareTo(Student student) {
return this.name.compareTo(student.name);
}
}
|
c65a74d7-0840-4ef8-8a8c-7ecdf3bccc93 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-03-31 15:37:56", "repo_name": "LO-RAN/codeQualityPortal", "sub_path": "/Src/Base/src/main/java/com/compuware/caqs/domain/dataschemas/rights/RoleBean.java", "file_name": "RoleBean.java", "file_ext": "java", "file_size_in_byte": 983, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "8df4841d9b3182cbccd8a68d96ae99a4e0f3c2d7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/LO-RAN/codeQualityPortal | 206 | FILENAME: RoleBean.java | 0.264358 | package com.compuware.caqs.domain.dataschemas.rights;
import com.compuware.caqs.domain.dataschemas.DefinitionBean;
public class RoleBean extends DefinitionBean implements Comparable {
private static final long serialVersionUID = 1L;
@Override
public boolean equals(Object role) {
boolean result = false;
if (role != null && role instanceof RoleBean && this.id != null) {
result = id.equals(((RoleBean) role).getId());
}
return result;
}
@Override
public int hashCode() {
return id.hashCode();
}
public int compareTo(Object role) {
int result = 0;
if (role != null) {
if (this.lib != null) {
result = this.lib.compareTo(((RoleBean) role).getLib());
} else if (this.id != null) {
result = this.id.compareTo(((RoleBean) role).getId());
}
}
return result;
}
}
|
1499c262-2ef6-45e2-99b0-33550e29e325 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2015-01-26T14:31:49", "repo_name": "ThomasLambert/JiveAPI", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1037, "line_count": 29, "lang": "en", "doc_type": "text", "blob_id": "80cea746021820bec71ea3ff082a52cbd9f7ea99", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/ThomasLambert/JiveAPI | 241 | FILENAME: README.md | 0.253861 | Jive API
Is this repository you will find :
- a Jive API wrapper
- a Jive analytics API wrapper
- a Bunchball API wrapper
=== Jive API ===
Basic Auth : all performed actions will be performed by authenticated user
You will have to fill in your password into wrapper.gs.
I've divided functions into places and persons actions and you'll find them respectively into place.gs and persons.gs as the names of the files suggest.
https://developers.jivesoftware.com/api/v3/cloud/rest/index.html
=== Jive Analytics API (Jive Data Export Service) ===
You will have to first configure you analytics. Please see with Jive or on Jive community.
Then you'll have a client ID and Client secret to fill in the file.
=== Bunchball API ===
You'll have to fill in the API key.
The documentation is accessible by following this URL but you'll have to have a account (see with bunchball, they will give you the registration for free, in my understanding)
https://bunchballnet-main.pbworks.com/w/page/53131932/FrontPage
|
e22c0b5e-cb6c-44d9-9952-b7b644f3439e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-08-29 11:01:05", "repo_name": "zk4/code_template", "sub_path": "/spring/web/src/main/java/com/zk/condition/MacCondition.java", "file_name": "MacCondition.java", "file_ext": "java", "file_size_in_byte": 1054, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "04889cde8c1e52a26c15a0221ea8983c90723500", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zk4/code_template | 192 | FILENAME: MacCondition.java | 0.240775 | package com.zk.condition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;
public class MacCondition implements Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
// 得到 ioc 的 bean factory
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
// 获得类加载器
ClassLoader classLoader = context.getClassLoader();
Environment environment = context.getEnvironment();
String osName = environment.getProperty("os.name");
boolean mac_os_x = osName.equals("Mac OS X");
return mac_os_x;
}
public static void main(String[] args) {
String name = System.getProperty("os.name");
System.out.println(name);
}
}
|
a993d8d7-34cc-4216-9e61-833dfa226bd7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-01 02:15:36", "repo_name": "samuraiball/spring-webflux-with-mongo-sample", "sub_path": "/src/test/java/com/demo/reactive/model/repository/EmployeeCrudRepositoryTest.java", "file_name": "EmployeeCrudRepositoryTest.java", "file_ext": "java", "file_size_in_byte": 1154, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "40e26c558b9ece8e6769c05a37caec059a08570d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/samuraiball/spring-webflux-with-mongo-sample | 204 | FILENAME: EmployeeCrudRepositoryTest.java | 0.258326 | package com.demo.reactive.model.repository;
import com.demo.reactive.model.document.Employee;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import reactor.core.publisher.Flux;
import reactor.test.StepVerifier;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest
public class EmployeeCrudRepositoryTest {
@Autowired
EmployeeCrudRepository employeeCrudRepository;
@Test
public void 正常_登録と検索() {
employeeCrudRepository.save(new Employee(null, "heno")).block();
Flux<Employee> employeeFlux = employeeCrudRepository.findAllByName("heno");
StepVerifier
.create(employeeFlux)
.assertNext(employee -> {
assertThat(employee.getId()).isNotNull();
assertThat(employee.getName()).isEqualTo("heno");
})
.expectComplete()
.verify();
}
} |
9af1b6cb-bcec-4725-8cf4-fcb4f84f7d31 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-24 10:17:22", "repo_name": "shmily-xiao/lemon", "sub_path": "/src/main/java/com/lemon/framework/enumwrapper/Option.java", "file_name": "Option.java", "file_ext": "java", "file_size_in_byte": 998, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "2053d9b89fd953d80f8e09ffa71d39b820055112", "star_events_count": 3, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/shmily-xiao/lemon | 210 | FILENAME: Option.java | 0.240775 | package com.lemon.framework.enumwrapper;
/**
* Created by igotti on 14-11-4.
*/
public class Option extends NameValuePair<String> implements Cloneable {
private boolean selected;
public Option() {
}
public Option(String name, String value) {
super(name, value);
}
public Option(String name, String value, boolean selected) {
super(name, value);
this.selected = selected;
}
public boolean isSelected() {
return selected;
}
public void setSelected(boolean selected) {
this.selected = selected;
}
@Override
public String toString() {
return "Option{name='" + super.getName() + "', value='" + super.getValue() + "', selected=" + selected + '}';
}
@Override
public Option clone() {
Option o = null;
try {
o = (Option) super.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return o;
}
}
|
3848661d-382a-4d9c-aa69-1a18bad48966 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-02 00:05:38", "repo_name": "hliu89/ITMD555_HongqiaoLiu", "sub_path": "/app/src/main/java/com/xk/CarRenting/frontend/adapter/LoginPagerAdapter.java", "file_name": "LoginPagerAdapter.java", "file_ext": "java", "file_size_in_byte": 1139, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "b189dddd56a5e478bdbfb0e5d595497618124972", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hliu89/ITMD555_HongqiaoLiu | 224 | FILENAME: LoginPagerAdapter.java | 0.249447 | package com.xk.CarRenting.frontend.adapter;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.xk.CarRenting.app.Constant;
import com.xk.CarRenting.frontend.fragment.LoginFragment;
import java.util.ArrayList;
import java.util.List;
/**
* Adapter
*/
public class LoginPagerAdapter extends FragmentPagerAdapter {
List<Fragment> fragments = new ArrayList<>(2);
public LoginPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
if (fragments.size() > position) {
return fragments.get(position);
} else {
LoginFragment fragment = new LoginFragment();
if (position == 1) {
Bundle arg = new Bundle();
arg.putBoolean(Constant.IS_SIGN_UP, true);
fragment.setArguments(arg);
}
fragments.add(fragment);
return fragment;
}
}
@Override
public int getCount() {
return 2;
}
}
|
d174d662-c348-4b77-976e-f68ba4ba7398 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-29 08:51:52", "repo_name": "wachoo/practice-demo-quartz", "sub_path": "/quartz-common/src/main/java/com/wachoo/demo/quartz/jmx/bo/MetricalInfo.java", "file_name": "MetricalInfo.java", "file_ext": "java", "file_size_in_byte": 1092, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "2ea019e44481f8a964e56a420ca67f426a275a11", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wachoo/practice-demo-quartz | 317 | FILENAME: MetricalInfo.java | 0.277473 | package com.wachoo.demo.quartz.jmx.bo;
import java.beans.ConstructorProperties;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* @desc: 基本监测属性指标
* @author: wangchao3
* @since: JDK1.8
* @date: 2018/9/28 18:26
*/
@Setter
@Getter
@NoArgsConstructor
public class MetricalInfo {
private String apiName;
private Double qps;
private Long qpsNum;
private Long resTotalNum;
private Long resSucNum;
private Long resFailNum;
private Long resNullNum;
private Long resNotNullNum;
@ConstructorProperties({"apiName", "qps", "qpsNum", "resTotalNum",
"resSucNum", "resFailNum", "resNullNum", "resNotNullNum"})
public MetricalInfo(String apiName, Double qps, Long qpsNum, Long resTotalNum,
Long resSucNum, Long resFailNum, Long resNullNum, Long resNotNullNum) {
this.apiName = apiName;
this.qps = qps;
this.qpsNum = qpsNum;
this.resTotalNum = resTotalNum;
this.resSucNum = resSucNum;
this.resFailNum = resFailNum;
this.resNullNum = resNullNum;
this.resNotNullNum = resNotNullNum;
}
}
|
38fe9357-6429-446c-b7aa-8271a8823122 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-20 20:31:40", "repo_name": "dhjacobson/recipebook-commons", "sub_path": "/src/main/java/com/dhjacobson/recipebook_commons/enums/QuantityUnit.java", "file_name": "QuantityUnit.java", "file_ext": "java", "file_size_in_byte": 1050, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "1630047c91935a6d155d3167e9fece6ed7d10734", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dhjacobson/recipebook-commons | 289 | FILENAME: QuantityUnit.java | 0.290981 | package com.dhjacobson.recipebook_commons.enums;
public enum QuantityUnit {
COUNT(null, null, null, null),
TEASPOON("teaspoon", "teaspoons", "tsp", "tsps"),
TABLESPOON("tablespoon", "tablespoons", "Tbsp", "Tbsps"),
CUP("cup", "cups", "cup", "cups"),
OUNCE("ounce", "ounces", "oz", "oz"),
POUND("pound", "pounds", "lb", "ozs");
private String longName;
private String longNamePlural;
private String shortName;
private String shortNamePlural;
QuantityUnit(String longName, String longNamePlural, String shortName, String shortNamePlural) {
this.longName = longName;
this.longNamePlural = longNamePlural;
this.shortName = shortName;
this.shortNamePlural = shortNamePlural;
}
public String getLongName() {
return longName;
}
public String getLongNamePlural() {
return longNamePlural;
}
public String getShortName() {
return shortName;
}
public String getShortNamePlural() {
return shortNamePlural;
}
}
|
249cd586-b5fb-4532-8ee4-80f9322756c7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-29 17:07:00", "repo_name": "nadavbrkt/MMU", "sub_path": "/src/memory/Page.java", "file_name": "Page.java", "file_ext": "java", "file_size_in_byte": 993, "line_count": 60, "lang": "en", "doc_type": "code", "blob_id": "4ebaf80ef44a12a00f58b85aab86192bf216f5b9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/nadavbrkt/MMU | 260 | FILENAME: Page.java | 0.295027 | package memory;
import java.io.Serializable;
// Page class represent page in memory
@SuppressWarnings("serial")
public class Page <T> implements Serializable{
// Data members
private int pageId;
private T content;
// C'tor
public Page(int id, T content){
this.pageId = id;
this.content = content;
}
// Methods
// Get pageId
public int getPageId(){
return this.pageId;
}
// Set pageId
public void setPageId(int pageId){
this.pageId = pageId;
}
// Get content
public T getContent(){
return content;
}
// Set content
public void setContent(T content){
this.content = content;
}
// Hash code override
@Override
public int hashCode(){
return pageId;
}
// Equals override
@Override
public boolean equals(Object obj){
return ((this.hashCode() == obj.hashCode()) ? true : false);
}
// ToString override
@Override
public String toString(){
return ("PageID:" + pageId + "\n" +
"Content: " + content.toString() + "\n" );
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.