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
|
|---|---|---|---|---|---|---|
391ef1fd-4190-4124-8b47-5c2f80ff201b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2012-02-16 01:13:56", "repo_name": "robxu9/RpgEssentials", "sub_path": "/me/duckdoom5/RpgEssentials/NPC/NpcHashmaps.java", "file_name": "NpcHashmaps.java", "file_ext": "java", "file_size_in_byte": 1009, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "b11e5b2d3df721596fd76b5c3f6e78daa4c9be84", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/robxu9/RpgEssentials
| 234
|
FILENAME: NpcHashmaps.java
| 0.279042
|
package me.duckdoom5.RpgEssentials.NPC;
import java.util.HashMap;
import java.util.LinkedHashMap;
import me.duckdoom5.RpgEssentials.RpgEssentials;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import com.topcat.npclib.entity.NPC;
public class NpcHashmaps {
public static HashMap<Player, String> selected = new LinkedHashMap<Player, String>();
static YamlConfiguration npcconfig = new YamlConfiguration();
public static void select(RpgEssentials plugin, Player player, String id){
NPC npc = plugin.m.getNPC(id);
if(npcconfig.getString("Npc." + id + ".owner") == "");
player.sendMessage(ChatColor.GREEN + "You have selected NPC: " + ChatColor.YELLOW + id);
selected.put(player, id);
}
public static String getSelected(Player player){
if(selected.containsKey(player)){
String id = selected.get(player);
return id;
}else{
player.sendMessage(ChatColor.RED + "No npc selected!");
return null;
}
}
}
|
10ee116f-a2fb-4fac-814f-554a769b2d2d
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-27 07:31:39", "repo_name": "vanithavelayutham/servlet", "sub_path": "/webapp/src/main/java/Insert.java", "file_name": "Insert.java", "file_ext": "java", "file_size_in_byte": 1114, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "5c7b07e1796690f6fa058391c8d1032bf6475c27", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/vanithavelayutham/servlet
| 181
|
FILENAME: Insert.java
| 0.261331
|
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/Insert")
public class Insert extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out=response.getWriter();
int id=Integer.parseInt(request.getParameter("id"));
String name=request.getParameter("name");
Student s=new Student();
s.setId(id);
s.setName(name);
int n=StudentDao.insert(s);
if(n>0)
{
out.println("inserted successfully");
}
else
{
out.println("unsuccess");
}
}
}
|
cd084d9a-4063-4377-b9e9-3100fd8e4a5e
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-20 06:59:21", "repo_name": "fanindramate/CykulStationDemoApp", "sub_path": "/src/com/MobiComm/cykulstationdemoApp/SplashScreen.java", "file_name": "SplashScreen.java", "file_ext": "java", "file_size_in_byte": 1081, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "4e3adc690fcff5d4341f061df4338deeb1127325", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/fanindramate/CykulStationDemoApp
| 205
|
FILENAME: SplashScreen.java
| 0.255344
|
package com.MobiComm.cykulstationdemoApp;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.widget.ImageView;
/**
* Created by CYKUL03 on 26-05-2017.
*/
public class SplashScreen extends Activity {
private static int SPLASH_TIME_OUT = 3000;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
final ImageView imageView = (ImageView) findViewById(R.id.imageView);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// This method will be executed once the timer is over
// Start your app main activity
Intent i = new Intent(getBaseContext(),MenuActivity.class);
startActivity(i);
// close this activity
finish();
}
}, SPLASH_TIME_OUT);
}
}
|
f5941cfb-da6d-48c9-a425-361df7665bac
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-17 09:52:13", "repo_name": "Fousq/Java_Core", "sub_path": "/src/main/java/kz/zhanbolat/chief/service/filter/impl/VegetableIngredientFilter.java", "file_name": "VegetableIngredientFilter.java", "file_ext": "java", "file_size_in_byte": 1013, "line_count": 26, "lang": "en", "doc_type": "code", "blob_id": "c9f33f8ed7164104eb71968ff548754e57f6271e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Fousq/Java_Core
| 199
|
FILENAME: VegetableIngredientFilter.java
| 0.275909
|
package kz.zhanbolat.chief.service.filter.impl;
import kz.zhanbolat.chief.entity.ingredient.Ingredient;
import kz.zhanbolat.chief.entity.ingredient.organic.OrganicIngredient;
import kz.zhanbolat.chief.entity.ingredient.organic.OrganicType;
import kz.zhanbolat.chief.service.filter.IngredientFilter;
import java.util.ArrayList;
import java.util.List;
public class VegetableIngredientFilter implements IngredientFilter {
@Override
public List<Ingredient> filterIngredients(List<Ingredient> ingredients) {
List<Ingredient> vegetableIngredients = new ArrayList<>();
for (Ingredient ingredient : ingredients) {
if (ingredient instanceof OrganicIngredient) {
OrganicIngredient organicIngredient = (OrganicIngredient) ingredient;
if (organicIngredient.getOrganicType() == OrganicType.VEGETABLE) {
vegetableIngredients.add(organicIngredient);
}
}
}
return vegetableIngredients;
}
}
|
cd10ad54-6b4f-4d9d-8b22-ab7210e66c06
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-26 03:49:06", "repo_name": "thewangzl/tomcat_learn", "sub_path": "/src/org/apache/catalina/users/MemoryUserDatabaseFactory.java", "file_name": "MemoryUserDatabaseFactory.java", "file_ext": "java", "file_size_in_byte": 1148, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "4cb496eec9251e655b3f42a46f2de211de8fd340", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/thewangzl/tomcat_learn
| 233
|
FILENAME: MemoryUserDatabaseFactory.java
| 0.294215
|
package org.apache.catalina.users;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.RefAddr;
import javax.naming.Reference;
import javax.naming.spi.ObjectFactory;
public class MemoryUserDatabaseFactory implements ObjectFactory {
@Override
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment)
throws Exception {
if(obj == null || !(obj instanceof Reference)){
return null;
}
Reference ref = (Reference) obj;
if (!"org.apache.catalina.UserDatabase".equals(ref.getClassName())) {
return (null);
}
// Create and configure a MemoryUserDatabase instance based on the
// RefAddr values associated with this Reference
MemoryUserDatabase database = new MemoryUserDatabase(name.toString());
RefAddr ra = null;
ra = ref.get("pathname");
if (ra != null) {
database.setPathname(ra.getContent().toString());
}
// Return the configured database instance
database.open();
database.save();
return (database);
}
}
|
9b1274c3-220d-42c9-87b0-faa688cf215b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-06-16 14:56:30", "repo_name": "linxin26/forest", "sub_path": "/forest-container/forest-container-api/src/main/java/co/solinx/forest/container/Main.java", "file_name": "Main.java", "file_ext": "java", "file_size_in_byte": 1057, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "c2138e034b8329b8432cd3bdc50ffe06638232e0", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/linxin26/forest
| 211
|
FILENAME: Main.java
| 0.256832
|
package co.solinx.forest.container;
import co.solinx.forest.common.extension.ExtensionLoader;
import java.util.Iterator;
import java.util.ServiceLoader;
/**
* Created by LX on 2015/2/28.
*/
public class Main {
public static void main(String[] args) throws IllegalAccessException, InstantiationException {
/**
* 加载SPI配置文件
*/
ExtensionLoader<IContainer> loader = new ExtensionLoader();
// loader.loadFile("co.solinx.forest.container.IContainer");
// loader.loadExtension("co.solinx.forest.container.IContainer",IContainer.class);
Iterator<IContainer> container = loader.loadExtensionIterator("co.solinx.forest.container.IContainer", IContainer.class);
// ServiceLoader<IContainer> service = ServiceLoader.load(IContainer.class);
// Iterator<IContainer> container = service.iterator();
/**
* 启动容器
*/
while (container.hasNext()) {
IContainer modl = container.next();
modl.start();
}
}
}
|
37bc072b-e878-4cd1-aba6-37ac18f1acc2
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-22 04:48:16", "repo_name": "MirzayevFarid/Slay-The-Spire", "sub_path": "/src/sample/mainMenu/MainMenu.java", "file_name": "MainMenu.java", "file_ext": "java", "file_size_in_byte": 1072, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "92bb82858d5caff073a1c2dbc2ac9c3dba636b36", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/MirzayevFarid/Slay-The-Spire
| 218
|
FILENAME: MainMenu.java
| 0.267408
|
package sample.mainMenu;
import javafx.fxml.FXML;
import javafx.scene.input.MouseEvent;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import sample.Methods;
import sample.play.Play;
import java.io.IOException;
public class MainMenu {
@FXML
private Text txtPlay;
@FXML
private Text txtCompendium;
@FXML
private Text txtSettings;
@FXML
private Text txtQuit;
public void playClicked(MouseEvent mouseEvent) throws IOException {
Methods.changeScreen("selectCharacter/selectCharacter.fxml", txtPlay, true);
}
public void compendiumClicked(MouseEvent mouseEvent) throws IOException {
Methods.changeScreen("compendium/compendium.fxml", txtCompendium, false);
}
public void settingsClicked(MouseEvent mouseEvent) throws IOException {
Methods.changeScreen("settings/settings.fxml", txtSettings,false);
}
public void quitClicked(MouseEvent mouseEvent) {
Play.player.stop();
Stage stage = (Stage) txtQuit.getScene().getWindow();
stage.close();
}
}
|
ccd61186-c17c-41fc-84af-20eab2b130f5
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-29 08:15:04", "repo_name": "malme32/teamplay", "sub_path": "/src/com/event/dao/AbstractDao.java", "file_name": "AbstractDao.java", "file_ext": "java", "file_size_in_byte": 1064, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "c74f2a27a0101d7b98d7f4fba89692dabb19de35", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/malme32/teamplay
| 183
|
FILENAME: AbstractDao.java
| 0.268941
|
package com.event.dao;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import com.event.model.Event;
import com.sport.model.Champion;
/*@Repository*/
public abstract class AbstractDao {
@Autowired
private SessionFactory sessionFactory;
protected Session getSession() {
return sessionFactory.getCurrentSession();
}
public void persist(Object entity) {
getSession().persist(entity);
}
public void delete(Object entity) {
getSession().delete(entity);
}
public void deleteNewSession(Object entity) {
System.out.println("DELETING NEW SESSION");
Session session = sessionFactory.openSession();
session.delete(entity);
session.close();
}
public void update(Object entity) {
getSession().update(entity);
}
}
|
85aa8690-17ff-41d6-a53d-80371560bd88
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-06 05:15:35", "repo_name": "zhuowr2006/CatCartoon", "sub_path": "/app/src/main/java/com/homa/catcartoon/ui/info/bean/OtherBean.java", "file_name": "OtherBean.java", "file_ext": "java", "file_size_in_byte": 1032, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "5800f64b9b2a38d4f977c80245e55e3918e61223", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/zhuowr2006/CatCartoon
| 244
|
FILENAME: OtherBean.java
| 0.220007
|
package com.homa.catcartoon.ui.info.bean;
/* * Created by Homa on 2017/11/6.
*/
public class OtherBean {
private String title;
private String tip;
private String img;
private String url;
public OtherBean(String title, String tip, String img, String url) {
this.title = title;
this.tip = tip;
this.img = img;
this.url = url;
}
public OtherBean() {
}
public String getTitle() {
return title;
}
public OtherBean setTitle(String title) {
this.title = title;
return this;
}
public String getTip() {
return tip;
}
public OtherBean setTip(String tip) {
this.tip = tip;
return this;
}
public String getImg() {
return img;
}
public OtherBean setImg(String img) {
this.img = img;
return this;
}
public String getUrl() {
return url;
}
public OtherBean setUrl(String url) {
this.url = url;
return this;
}
}
|
cd85ee97-3514-4f2a-833d-e03d82e72fa8
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-26 08:59:07", "repo_name": "ahuh/subzero", "sub_path": "/subzero-core/src/main/java/org/subzero/core/bean/VideoFileToProcess.java", "file_name": "VideoFileToProcess.java", "file_ext": "java", "file_size_in_byte": 1027, "line_count": 53, "lang": "en", "doc_type": "code", "blob_id": "0439bb6d9b08cf6dbccbb657f28a27ebb0b29fcc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/ahuh/subzero
| 230
|
FILENAME: VideoFileToProcess.java
| 0.228156
|
package org.subzero.core.bean;
/**
* Video file to process in SubZero launcher
* @author Julien
*
*/
public class VideoFileToProcess {
private String videoFileName;
private String workingFolderPath;
/**
* Constructor
*
* @param videoFileName
* @param workingFolderPath
*/
public VideoFileToProcess(String videoFileName, String workingFolderPath) {
super();
this.videoFileName = videoFileName;
this.workingFolderPath = workingFolderPath;
}
/**
* @return the videoFileName
*/
public String getVideoFileName() {
return videoFileName;
}
/**
* @param videoFileName the videoFileName to set
*/
public void setVideoFileName(String videoFileName) {
this.videoFileName = videoFileName;
}
/**
* @return the workingFolderPath
*/
public String getWorkingFolderPath() {
return workingFolderPath;
}
/**
* @param workingFolderPath the workingFolderPath to set
*/
public void setWorkingFolderPath(String workingFolderPath) {
this.workingFolderPath = workingFolderPath;
}
}
|
b881bf6d-c6db-4bac-97c5-ae459a3d1945
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-18 08:47:43", "repo_name": "SunMingLianger/sell", "sub_path": "/src/main/java/com/sml/util/CookieUtil.java", "file_name": "CookieUtil.java", "file_ext": "java", "file_size_in_byte": 1174, "line_count": 53, "lang": "en", "doc_type": "code", "blob_id": "77f871f419fb3dfc2af7351734c04a6717d3c8c1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/SunMingLianger/sell
| 257
|
FILENAME: CookieUtil.java
| 0.233706
|
package com.sml.util;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* cookie工具类
* Created by 神迷的亮
* 2018-05-03 09:22
*/
public class CookieUtil
{
/**
* 设置cookie
*
* @param response
* @param name
* @param value
* @param maxage
*/
public static void setCookie(HttpServletResponse response, String name, String value, int maxage)
{
Cookie cookie = new Cookie(name, value);
cookie.setPath("/");
cookie.setMaxAge(maxage);
response.addCookie(cookie);
}
/**
* 获取cookie的值
*
* @param request
* @param cookieName
* @return
*/
public static Cookie getCookie(HttpServletRequest request, String cookieName)
{
Cookie[] cookies = request.getCookies();
if (cookies != null)
{
for (Cookie cookie : cookies)
{
if (cookie.getName().equalsIgnoreCase(cookieName))
{
return cookie;
}
}
}
return null;
}
}
|
1e1599b0-8f41-4bb9-a7bf-e06e9016953e
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-04-17T15:33:09", "repo_name": "timothy-breitenfeldt/mtg-audio", "sub_path": "/readme.md", "file_name": "readme.md", "file_ext": "md", "file_size_in_byte": 1015, "line_count": 30, "lang": "en", "doc_type": "text", "blob_id": "2cf7e83c4af96d53d9594b6e78f7e7114facc0fb", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/timothy-breitenfeldt/mtg-audio
| 193
|
FILENAME: readme.md
| 0.226784
|
### Description
This project is an accessible audio based Magic the Gathering application, providing a comprehensive search engine, and at the moment single player battlefield for playing with other people. This application is driven by screen reader output, and requires that the user is using a screen reader for optimal experience.
This application has only been tested on Windows and Mac. It might work on Linux, but will not support Linux officially unless requests dictate otherwise.
#### Screen Readers
This application uses accessible_output2 for cross platform screen reader output. Tested screen readers are:
Windows:
- JAWS
- NVDA
Mac:
- Voiceover
Other screen readers might work with it since there are others that are supported by accessible_output2, but these are the only screen readers that have been tested.
#### Development Environment
MTG Audio uses python 3 with the following third party libraries that can be installed via pip:
- accessible_output2
- wxpython
- pyinstaller
- wget
|
fa52e27e-bbdd-4ac4-a7bd-ed7a99225ccd
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2015-01-01T21:45:30", "repo_name": "spitimage/jwt-central-client", "sub_path": "/readme.md", "file_name": "readme.md", "file_ext": "md", "file_size_in_byte": 1054, "line_count": 54, "lang": "en", "doc_type": "text", "blob_id": "3891a4bb04f756c5f52c993378f0582c71a504d2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/spitimage/jwt-central-client
| 265
|
FILENAME: readme.md
| 0.264358
|
# jwt-central-client
[](https://travis-ci.org/spitimage/jwt-central-client)
Express middleware for the [jwt-central][jwtc] authentication service.
# Initialization
```js
// Initialize the jwt-central-client with the host params for the jwt-central server
jwtCentralClient.init('localhost', 8000);
```
# Authentication
```js
// Example API endpoint that shows the current decoded jwt
app.get('/api/jwt', jwtCentralClient.auth, function (req, res) {
res.json(req.jwt);
});
```
# Installation
npm install
cd example
npm install
# Running the example application
After modifying the configuration parameters in `app.js`:
cd example
node app.js
# Testing
npm install -g mocha
mocha
# Linting
npm install -g jshint
jshint index.js
jshint example
jshint test
# License
[MIT][license]
[license]: https://github.com/spitimage/jwt-central-client/blob/master/LICENSE
[jwtc]: https://github.com/spitimage/jwt-central
|
177b4bd1-35b5-4f34-8095-0e63a7984eb1
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-04 09:48:06", "repo_name": "DennisPC-bit/ArlaEksamen", "sub_path": "/src/DPMAINTEST.java", "file_name": "DPMAINTEST.java", "file_ext": "java", "file_size_in_byte": 1032, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "767e27eecf9ae3b5506c4a60f98501dbc6d4c059", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/DennisPC-bit/ArlaEksamen
| 218
|
FILENAME: DPMAINTEST.java
| 0.292595
|
import GUI.Controller.StageBuilder;
import javafx.application.Application;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class DPMAINTEST extends Application {
public static void Main(String[]args){ launch(args);}
@Override
public void start(Stage stage) throws Exception {
StageBuilder stageBuilder = new StageBuilder();
Node node = stageBuilder.makeStage("H0.50{|}");
BorderPane bp = new BorderPane(node);
AnchorPane.setTopAnchor(bp,0.0);
AnchorPane.setRightAnchor(bp,0.0);
AnchorPane.setLeftAnchor(bp,0.0);
AnchorPane.setBottomAnchor(bp,0.0);
Button b = new Button("print");
bp.setTop(b);
b.setOnAction((v)-> System.out.println(stageBuilder.getRootController()));
AnchorPane ap = new AnchorPane(bp);
stage.setScene(new Scene(ap));
stage.show();
}
}
|
a5c4c202-2238-495e-8aac-fe9f2a07f62b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-12 15:06:12", "repo_name": "Andrei023/atm-spring", "sub_path": "/service/src/main/java/com/example/data/Entry.java", "file_name": "Entry.java", "file_ext": "java", "file_size_in_byte": 1148, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "b524dd1befe688b5cb301caceb614ff7951953af", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Andrei023/atm-spring
| 243
|
FILENAME: Entry.java
| 0.293404
|
package com.example.data;
import com.example.model.account.EuroAccount;
import com.example.model.entity.client.Client;
import com.example.model.account.Account;
import com.example.model.account.RonAccount;
//Bank Cache
public class Entry {
private Client client;
private EuroAccount contEuro;
private RonAccount contRon;
public Entry(Client client, EuroAccount contEuro, RonAccount contRon) {
this.client = client;
this.contEuro = contEuro;
this.contRon = contRon;
}
public Client getClient() {
return this.client;
}
public Account getContEuro() {
return this.contEuro;
}
public Account getContRon() {
return this.contRon;
}
public String toString() {
return client.toString() + " " + contEuro.toString() + " " + contRon.toString();
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
Entry other = (Entry) obj;
if (other.getClient().equals(this.getClient())) {
return true;
} else {
return false;
}
}
}
|
7240e433-5c23-40d3-9ee2-f657156f30b6
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-10 04:49:34", "repo_name": "mbalakrishnan79/Syntel", "sub_path": "/SparkWithPostgreSQL/src/main/java/com/bala/rdbms/SparkWithPostgreSQL/ReadFromPostgreSQL.java", "file_name": "ReadFromPostgreSQL.java", "file_ext": "java", "file_size_in_byte": 1038, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "649ce5b5efbe5b62749bc97aa667ae7fece8ece5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/mbalakrishnan79/Syntel
| 236
|
FILENAME: ReadFromPostgreSQL.java
| 0.280616
|
package com.bala.rdbms.SparkWithPostgreSQL;
import java.util.Properties;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SQLContext;
import org.apache.spark.sql.SparkSession;
public class ReadFromPostgreSQL {
public static void main(String[] args) {
JavaSparkContext sc = new JavaSparkContext(new SparkConf().setAppName("SparkJdbcDs").setMaster("local[*]"));
SQLContext sqlContext = new SQLContext(sc);
SparkSession spark = SparkSession.builder().appName("SparkPostgreSQLExample").getOrCreate();
Properties connectionProperties = new Properties();
connectionProperties.put("user", "postgres");
connectionProperties.put("password", "Syntel123$");
String query = "sparkour.people";
query = "(select * from employee)";
Dataset<Row> jdbcDF2 = spark.read().jdbc("jdbc:postgresql://localhost:5432/postgres", query,connectionProperties);
jdbcDF2.show();
}
}
|
2d62023d-0eb1-4012-9e1f-b9d2f967c60e
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-19 05:07:56", "repo_name": "LuisMtz-uaemex/Proyectoemail", "sub_path": "/src/edd/PilaDinamica.java", "file_name": "PilaDinamica.java", "file_ext": "java", "file_size_in_byte": 1113, "line_count": 59, "lang": "en", "doc_type": "code", "blob_id": "734de7de38ce71bbcf338703d06556da080e6f5e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/LuisMtz-uaemex/Proyectoemail
| 266
|
FILENAME: PilaDinamica.java
| 0.291787
|
/*
* 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 edd;
/**
*
* @author Mauro
*/
public class PilaDinamica
{
private Nodo tope = null;
/**
* @return the tope
*/
public Nodo getTope()
{
return tope;
}
/**
* @param tope the tope to set
*/
public void setTope(Nodo tope)
{
this.tope = tope;
}
public void inserta(Nodo n)
{
if (n == null)
{
System.out.println("no se puede insertar");//cola llena
} else
{
n.setSig(tope);
tope=n;
}
}
public Nodo elimina()
{
if (tope == null)
{
System.out.println("no hay datos en la pila");
return null;
} else
{
Nodo de = tope;
tope=tope.getSig();
de.setSig(null);
return de;
}
}
}
|
9ead4b64-ed55-4c02-ac25-4bdf5eb054b5
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-12-17T03:05:45", "repo_name": "scottbromander/pluralsight-angular-intro", "sub_path": "/docs/chapter_2.md", "file_name": "chapter_2.md", "file_ext": "md", "file_size_in_byte": 1068, "line_count": 42, "lang": "en", "doc_type": "text", "blob_id": "5d15b6a571750ae74a62fb49d41b16f1dc3395a1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/scottbromander/pluralsight-angular-intro
| 240
|
FILENAME: chapter_2.md
| 0.250913
|
# Chapter 2 Notes
## Introduction Notes
### Angular is:
- A JavaScript Framework for building client side applications using HTML, CSS, and TypeScript
- Expressive HTML
- Power Data-Binding
- Modular by Design - Apps become a set of building blocks
- Built in Back End Integration
### Why a New Angular?
- Built for Speed - Fast change detection, faster initial speeds, improved rendering times
- Modern - Classes Modules and Decorators
- Simplified API - fewer directives, simpler bindings, lower concept count
- Enhances Productivity - Improve our day to day workflow
### Anatomy of an Angular Application
`Application` = `Services(` `Component` + `Component` + (n \* `Component`) `)`
`Component` = `Template` + `Class(Properties + Methods)` + `Metadata`
- Angular Modules have a Root Angular Module that contains Components.
- Angular can have any number of modules, but contains at least one root module.
### Code-A-Long Starting files
[Code a long repo](https://github.com/DeborahK/Angular-GettingStarted)
_(Select the `APM Start` Directory)_
|
89d92d0f-2c64-46ff-9907-3382c73ca8ec
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-14 20:21:26", "repo_name": "amanrathie/mbt", "sub_path": "/src/main/java/br/gov/cgu/mbt/infraestrutura/referenciavel/AutocompleteComTipoOption.java", "file_name": "AutocompleteComTipoOption.java", "file_ext": "java", "file_size_in_byte": 1148, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "2ae04e9795a4d86efbecdc9e467aa7f1e3d2ab66", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/amanrathie/mbt
| 247
|
FILENAME: AutocompleteComTipoOption.java
| 0.236516
|
package br.gov.cgu.mbt.infraestrutura.referenciavel;
import br.gov.cgu.componentes.pojo.AutocompleteOption;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
public class AutocompleteComTipoOption extends AutocompleteOption {
private String tipo;
public AutocompleteComTipoOption(String id, String name, String tipo) {
super(id, name);
this.tipo = tipo;
}
public String getTipo() {
return tipo;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof AutocompleteComTipoOption)) {
return false;
}
AutocompleteComTipoOption that = (AutocompleteComTipoOption) o;
return new EqualsBuilder()
.appendSuper(super.equals(o))
.append(tipo, that.tipo)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.appendSuper(super.hashCode())
.append(tipo)
.toHashCode();
}
}
|
f55104a3-1772-4674-b73f-c7ea3cc199fa
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-14 08:59:36", "repo_name": "hanframework/han", "sub_path": "/han-core/src/main/java/org/hanframework/env/ModuleInfo.java", "file_name": "ModuleInfo.java", "file_ext": "java", "file_size_in_byte": 1049, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "7d21f5b28a0b941d7a3d3ca1acdc3b3c11f75d2e", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/hanframework/han
| 268
|
FILENAME: ModuleInfo.java
| 0.246533
|
package org.hanframework.env;
import java.util.Objects;
/**
* @author liuxin
* @version Id: ModuleInfo.java, v 0.1 2019-05-13 22:15
*/
public class ModuleInfo {
/**
* 模块名
*/
private String moduleName;
/**
* 模块版本
*/
private String version;
public ModuleInfo(String moduleName, String version) {
this.moduleName = moduleName;
this.version = version;
}
public String getModuleName() {
return moduleName;
}
public String getVersion() {
return version;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ModuleInfo that = (ModuleInfo) o;
return moduleName.equals(that.moduleName) &&
version.equals(that.version);
}
@Override
public int hashCode() {
return Objects.hash(moduleName, version);
}
@Override
public String toString() {
return "ModuleInfo{" +
"moduleName='" + moduleName + '\'' +
", version='" + version + '\'' +
'}';
}
}
|
e580bbc1-dbd6-4a51-9ee6-5c14d0b0fa83
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2010-03-03T08:06:25", "repo_name": "ZeroStride/LighthouseIntegrationTest", "sub_path": "/README.markdown", "file_name": "README.markdown", "file_ext": "markdown", "file_size_in_byte": 1005, "line_count": 17, "lang": "en", "doc_type": "text", "blob_id": "c8be5f26eb252e2ffbe4bb210308e2bf21413cb0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/ZeroStride/LighthouseIntegrationTest
| 225
|
FILENAME: README.markdown
| 0.221351
|
# Lighthouse Integration Test Repository
This repository is for testing our bugfix workflow integration with Lighthouse. It contains bugs which will be automatically re-initialized by the commits in the 'repush'.
### Repush
The 'repush' script first resets the local repository to the first commit, then force-pushes the repository to the origin. It then uses the functionality of the git reflog to easily return to the previous state of HEAD in the local repository, and force-pushes the repository to the origin. This allows for simple, consistent testing of the Lighthouse-workflow post-receive server.
### Lighthouse Test Project
This repository is wired in to this (public) [Lighthouse project](http://gameclay.lighthouseapp.com/projects/47141-workflow-test/)
### Bug Fix Syntax
When the post-receive hook sees a message in the format:
`Merged branch 'initials/bug-#'`
It should mark the corresponding bug as 'fixed'.
### To Do's
When Uttu sees a to do message in a diff it should make a ticket.
|
67120411-900d-42ee-b8f3-94c61e862602
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-13 17:53:01", "repo_name": "andreaderi/Shop", "sub_path": "/src/Shop/actionListeners/FirstPageListener.java", "file_name": "FirstPageListener.java", "file_ext": "java", "file_size_in_byte": 1031, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "be14249fb60b6394742c02a52375ba25b7032ca0", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/andreaderi/Shop
| 183
|
FILENAME: FirstPageListener.java
| 0.259826
|
package Shop.actionListeners;
import Shop.view.LoginFrame;
import Shop.view.FirstPageFrame;
import Shop.view.IscrizioneFrame;
import Shop.view.CatalogoFrame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class FirstPageListener implements ActionListener {
private FirstPageFrame first;
public FirstPageListener(FirstPageFrame first) {
this.first = first;
}
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("Evento catturato!");
if ("Login".equals(e.getActionCommand())) {
new LoginFrame();
first.setVisible(false);
}
if ("Registrazione".equals(e.getActionCommand())){
new IscrizioneFrame();
first.setVisible(false);
}
if("Catalogo".equals(e.getActionCommand())){
new CatalogoFrame();
first.setVisible(false);
}
}
}
}
|
7fd365cb-49ed-4a81-afe4-8f18ec95387a
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-10 11:25:01", "repo_name": "Thoronir42/i-spy-with-my-eye--teh-internetzz", "sub_path": "/src/cz/zcu/kiv/nlp/ir/crawling/HtmlDownloaderFactory.java", "file_name": "HtmlDownloaderFactory.java", "file_ext": "java", "file_size_in_byte": 1079, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "6588b8df4764ac2f49c4371da0cb3e37deee1331", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Thoronir42/i-spy-with-my-eye--teh-internetzz
| 193
|
FILENAME: HtmlDownloaderFactory.java
| 0.229535
|
package cz.zcu.kiv.nlp.ir.crawling;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class HtmlDownloaderFactory {
public IHtmlDownloader create(String type) {
switch (type.toLowerCase()) {
default:
System.err.println("Invalid html downloader type provided");
case "direct":
return create(Type.Direct);
case "selenium":
return create(Type.Selenium);
}
}
public IHtmlDownloader create(Type type) {
switch (type) {
case Selenium:
System.setProperty("webdriver.chrome.driver", "./chromedriver.exe");
WebDriver driver = new ChromeDriver();
return new HTMLDownloaderSelenium(driver)
.setDocumentFetchMillis(350); // ensure the page is fully loaded and JS-initialized
default:
case Direct:
return new HTMLDownloader();
}
}
public enum Type {
Direct, Selenium
}
}
|
c92a926a-d199-4d4f-a8d0-f07ec7c22156
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-07 13:49:35", "repo_name": "osmanyaycioglu/t20210705", "sub_path": "/springtraining/src/main/java/com/training/micro/person/PersonFacade.java", "file_name": "PersonFacade.java", "file_ext": "java", "file_size_in_byte": 1111, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "9cceddbbf3a66c75af32b29aad23681eca8c51f1", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/osmanyaycioglu/t20210705
| 214
|
FILENAME: PersonFacade.java
| 0.264358
|
package com.training.micro.person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@Service
public class PersonFacade {
@Autowired
private IPersonDao pDao;
public void add(final Person person) {
}
@Transactional(propagation = Propagation.REQUIRED)
public void save1(final Person personParam) {
this.pDao.save(personParam);
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void save2(final Person personParam) {
this.pDao.save(personParam);
}
@Transactional(propagation = Propagation.REQUIRED)
public void save3(final Person personParam) {
this.pDao.save(personParam);
}
public void deleteById(final Long perIdParam) {
this.pDao.deleteById(perIdParam);
}
public Person findById(final Long perIdParam) {
return this.pDao.findById(perIdParam)
.orElse(null);
}
}
|
db8b457e-5402-4994-bfb5-026fadbf448b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-06-13T05:06:26", "repo_name": "zhanghe06/docker_project", "sub_path": "/elasticsearch/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1109, "line_count": 38, "lang": "en", "doc_type": "text", "blob_id": "018efbb0ba9c0dca10ee1a2c88198fce0f8172c8", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/zhanghe06/docker_project
| 334
|
FILENAME: README.md
| 0.292595
|
## elasticsearch
https://github.com/elastic/elasticsearch
https://github.com/elastic/elasticsearch-docker/tree/5.4
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker
The default password for the elastic user is changeme
username = elastic
password = changeme
```
$ sudo docker pull docker.elastic.co/elasticsearch/elasticsearch:5.5.0
```
## 生产环境注意事项
[生产环境注意事项](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#_notes_for_production_use_and_defaults)
查看集群状态
```
➜ elasticsearch git:(master) ✗ curl -u elastic http://127.0.0.1:9200/_cat/health
Enter host password for user 'elastic':
1499098552 16:15:52 es-cluster yellow 1 1 3 3 0 0 3 0 - 50.0%
```
集群插件
[http://0.0.0.0:9100/?auth_user=elastic&auth_password=changeme](http://0.0.0.0:9100/?auth_user=elastic&auth_password=changeme)
## 参考
[映射类型](https://www.elastic.co/guide/en/elasticsearch/reference/5.5/mapping.html#mapping-type)
[关于数组](https://www.elastic.co/guide/en/elasticsearch/reference/5.5/array.html)
|
9e99d886-13f3-4adf-9de8-e05b8ee91622
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-18 13:03:43", "repo_name": "gigo123/instrument2", "sub_path": "/src/main/java/ua/com/gigasoft/instrument2c/secondModel/ExDocTempStore.java", "file_name": "ExDocTempStore.java", "file_ext": "java", "file_size_in_byte": 1029, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "672471a0d69b463845f11a1f7ca117b473077b6b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/gigo123/instrument2
| 265
|
FILENAME: ExDocTempStore.java
| 0.280616
|
package ua.com.gigasoft.instrument2c.secondModel;
import ua.com.gigasoft.instrument2c.mainModel.DocumentRow;
public class ExDocTempStore {
private String errorString;
private DocumentRow docRow;
private long outStorageId;
public long getOutStorageId() {
return outStorageId;
}
public void setOutStorageId(long outStorageId) {
this.outStorageId = outStorageId;
}
public String getErrorString() {
return errorString;
}
public void setErrorString(String errorString) {
this.errorString = errorString;
}
public DocumentRow getDocRow() {
return docRow;
}
public void setDocRow(DocumentRow doc) {
this.docRow = doc;
}
@Override
public String toString() {
return "ExDocTempStore [errorString=" + errorString + ", doc=" + docRow + ", outStorageId=" + outStorageId + "]";
}
public ExDocTempStore(String errorString, DocumentRow doc, long outStorageId) {
super();
this.errorString = errorString;
this.docRow = doc;
this.outStorageId = outStorageId;
}
public ExDocTempStore() {
}
}
|
c861f2e8-9494-45fa-864f-e7746c13c454
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-13 16:40:29", "repo_name": "kevinhou01/couchbase-onlinebank-demo", "sub_path": "/couchbase-onlinebanking-demo/src/main/java/com/kevintest/sample/service/AccountService.java", "file_name": "AccountService.java", "file_ext": "java", "file_size_in_byte": 1060, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "dd5bce39ad3d5efefedcc8597673a20e9204d05e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/kevinhou01/couchbase-onlinebank-demo
| 209
|
FILENAME: AccountService.java
| 0.286968
|
package com.kevintest.sample.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import com.couchbase.client.protocol.views.Query;
import com.kevintest.sample.domain.Account;
import com.kevintest.sample.repository.AccountRepository;
@Component
@Service
public class AccountService {
@Autowired
private AccountRepository accountRepository;
public void doput(Account acc) {
accountRepository.save(acc);
}
public Account doGetByName(String name) {
//System.out.println(name);
//Query query = new Query();
//query.setKey(name);
return accountRepository.findOne(name);
}
public void doDelete(Account acc) {
accountRepository.delete(acc);
}
List<Account> allAccounts(int limit){
Query query = new Query();
query.setLimit(limit);
return accountRepository.all(query);
}
List<Account> allAccounts(){
return allAccounts(50);
}
}
|
85e2d3b9-0fbf-47ae-af0f-3154cf5e549a
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-03-13 05:06:31", "repo_name": "cs160-berkeley/prog-02-represent-themsanand", "sub_path": "/App/wear/src/main/java/com/example/cs169_au/represent/VoteViewRump.java", "file_name": "VoteViewRump.java", "file_ext": "java", "file_size_in_byte": 1148, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "5c177d0846a912c3fe3c503389303c76ad2987dc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/cs160-berkeley/prog-02-represent-themsanand
| 218
|
FILENAME: VoteViewRump.java
| 0.245085
|
package com.example.cs169_au.represent;
import android.content.Intent;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.widget.TextView;
import com.google.android.gms.wearable.MessageApi;
import com.google.android.gms.wearable.MessageEvent;
public class VoteViewRump extends Activity implements MessageApi.MessageListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vote_view_rump);
Bundle extras = getIntent().getExtras();
String zip = "Alameda";
if (extras != null) {
zip = extras.getString("zipcode");
}
((TextView)findViewById(R.id.county)).setText(zip);
}
@Override
public void onMessageReceived(MessageEvent messageEvent) {
Log.d("Checking VV", "onMessageReceived");
Intent startIntent = new Intent(this, MainActivity.class);
startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startIntent.putExtra("zipcode", messageEvent.getData());
startActivity(startIntent);
}
}
|
00cd8c67-2156-42d7-85d8-344b832c61a4
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-06-27T15:02:35", "repo_name": "mkbaldwin/notes-public", "sub_path": "/conferences/2020-DevNexus/2020-02-20_DevNexus_S01_ReactiveRevolution.md", "file_name": "2020-02-20_DevNexus_S01_ReactiveRevolution.md", "file_ext": "md", "file_size_in_byte": 1149, "line_count": 25, "lang": "en", "doc_type": "text", "blob_id": "d1bcc666faae9635089ffc6fb559fba10685dac3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/mkbaldwin/notes-public
| 271
|
FILENAME: 2020-02-20_DevNexus_S01_ReactiveRevolution.md
| 0.23231
|
# Session 1: Reactive Revolution
Josh Long, Pivotal/VMWare - @starbuxman
* Bootiful Podcast
* Write software that is aware of the fact that things may be asynchronous
* Threads are expensive in Java (rely on real OS threads)
* Reactive programming helps with these things
* Asynchronous IO has been in the JDK for a long time (nio interfaces introduced in 1.4)
* Not widely used
* Painful
* Asyhchronous/Reactive programming is a major paradigm shift in how we think about writing software.
* Spring Framework 5, integrates reactive programming into the framework.
* "I'm going to use the latest and greatest version, because why not. YOLO."
* Flux - from project reactor, produces 0 or more things
* Reactive programming is good for anything that is long lived connections.
* e.g. great for websockets, no longer requires a thread for each socket to always be open/running.
* BlockHound
* Utility to help you locate code/operations that block threads
* Throws exceptions when you do something that would block the thread
* rsocket
* New protocol for reactive connections
* Binary format
|
c04ce599-fb0d-4974-bd5e-6ab35bc74f2b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-18 06:00:14", "repo_name": "ichoukou/thirdapp", "sub_path": "/thirdpp-common/src/main/java/com/zendaimoney/thirdpp/common/enums/ThirdType.java", "file_name": "ThirdType.java", "file_ext": "java", "file_size_in_byte": 1249, "line_count": 65, "lang": "en", "doc_type": "code", "blob_id": "991e45e1a62d91c0779470a48cb2e2b509ab5c45", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/ichoukou/thirdapp
| 386
|
FILENAME: ThirdType.java
| 0.277473
|
package com.zendaimoney.thirdpp.common.enums;
public enum ThirdType {
/** 通联 支付*/
ALLINPAY("0", "通联支付"),
/** 富友支付 */
FUIOUPAY("2", "富友支付"),
/** 上海银联支付 */
SHUNIONPAY("4", "上海银联支付"),
/** 用友支付 */
YONGYOUUNIONPAY("6", "用友支付"),
/** 上海银联支付-实名验证 */
SHUNIONPAY_ACCOUNT_AUTH("8", "上海银联支付-实名认证"),
/** 证大爱特*/
ZENDAIPAY("10","证大爱特支付"),
CMBPAY("12", "招商银行"),
KFTPAY("14","快付通支付"),
IFREPAY("16","数信支付"),
KJTPAY("18","快捷通支付"),
BAOFOOPAY("20","宝付支付"),
UNSPAY("22","银生宝支付"),
ALLINPAY2("100", "通联支付2"),
ROUTEPAY("999","默认路由规则")
;
private final String code;
private final String desc;
private ThirdType(String code, String desc) {
this.code = code;
this.desc = desc;
}
public String getCode() {
return code;
}
public String getDesc() {
return desc;
}
public static ThirdType get(String code) {
for (ThirdType thirdType : ThirdType.values()) {
if (thirdType.getCode().equals(code))
return thirdType;
}
throw new IllegalArgumentException("thirdType is not exist : " + code);
}
}
|
8284346f-df20-4d03-8d35-93bb13ab1f73
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-04-18 18:35:33", "repo_name": "martynasvaicekauskas/webAppExample", "sub_path": "/src/servlets/CreateCatServlet.java", "file_name": "CreateCatServlet.java", "file_ext": "java", "file_size_in_byte": 1056, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "8e0e79e9a3620ea17303900a62109e21c5fb1e4d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/martynasvaicekauskas/webAppExample
| 210
|
FILENAME: CreateCatServlet.java
| 0.287768
|
package servlets;
import Dto.Cat;
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;
/**
* Created by MartynasV on 2017-04-18.
*/
@WebServlet (value = "/createCat")
public class CreateCatServlet extends HttpServlet{
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String catName = req.getParameter("catName");
String catKind = req.getParameter("catKind");
int catAge = Integer.parseInt(req.getParameter("catAge"));
double catWeight = Double.parseDouble(req.getParameter("catWeight"));
boolean likeMilk = Boolean.getBoolean(req.getParameter("likeMilk"));
Cat cat = new Cat(catName, catKind,catAge,catWeight,likeMilk);
req.setAttribute("cat", cat);
req.getRequestDispatcher("catinfo.jsp").forward(req,resp);
}
}
|
5736226d-1df5-41f5-96b1-cf778da38a90
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-01 20:36:49", "repo_name": "MdShobon/FirstProject_QA_Automation", "sub_path": "/src/Firefoxxxx.java", "file_name": "Firefoxxxx.java", "file_ext": "java", "file_size_in_byte": 1153, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "5f8524870df1e3306647d2487ef45c0ed80ffceb", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/MdShobon/FirstProject_QA_Automation
| 263
|
FILENAME: Firefoxxxx.java
| 0.26588
|
import java.sql.Driver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
public class Firefoxxxx {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.gecko.driver", "C:\\Users\\shobon\\Desktop\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
//driver.get // you can use navigate for use more fuction like dynamic way
//Driver.navigate().to(“”)-same as get url
//Driver.navigate().refresh()-reload or refresh the page
//Driver.navigate().back()-back to previous page
//Driver.navigate().forward()-go to the next page
driver.navigate().to("https://www.facebook.com/reg/");
//driver.navigate().refresh();
driver.findElement(By.name("firstname")).sendKeys("Md");
driver.findElement(By.name("lastname")).sendKeys("Shobon");
//Select month = Select
//month.selectByVisibleText("Feb");
//Thread.sleep(3000);
driver.close();
}
}
|
b0e56821-459b-4424-8915-9198c4ae4fd9
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-09-24 23:22:00", "repo_name": "cgoulding/core-amqp-parent", "sub_path": "/core-amqp-context/src/main/java/com/monadiccloud/core/amqp/template/OpinionatedRabbitTemplate.java", "file_name": "OpinionatedRabbitTemplate.java", "file_ext": "java", "file_size_in_byte": 997, "line_count": 26, "lang": "en", "doc_type": "code", "blob_id": "31fc6fef01139f7a9ecdf83300c98c55e2fd953e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/cgoulding/core-amqp-parent
| 183
|
FILENAME: OpinionatedRabbitTemplate.java
| 0.229535
|
package com.monadiccloud.core.amqp.template;
import com.monadiccloud.core.amqp.context.AmqpContext;
import com.monadiccloud.core.amqp.context.MessageDescription;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
public class OpinionatedRabbitTemplate {
private AmqpContext rabbitContext;
private RabbitTemplate rabbitTemplate;
public OpinionatedRabbitTemplate(AmqpContext context) {
this.rabbitContext = context;
this.rabbitTemplate = context.getRabbitTemplate();
}
public void send(Object message) {
MessageDescription description = rabbitContext.getDescription(message.getClass());
rabbitTemplate.convertAndSend(description.getExchange(), description.getRoutingKey(), message);
}
public void send(Object message, String routingKey) {
MessageDescription description = rabbitContext.getDescription(message.getClass());
rabbitTemplate.convertAndSend(description.getExchange(), routingKey, message);
}
}
|
414c52f3-cd44-4096-a5ea-c763580851a8
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-17 13:52:52", "repo_name": "DataPathAnalytics/KR_Developing-a-New-Audit-Methodology-for-Electronic-Public-Tenders-OCDS", "sub_path": "/exporter/src/main/java/com/datapath/ocds/kyrgyzstan/exporter/receivers/LegalFormsReceiver.java", "file_name": "LegalFormsReceiver.java", "file_ext": "java", "file_size_in_byte": 1116, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "000116e7af83067422e2b25ae9998e8636e43cf2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/DataPathAnalytics/KR_Developing-a-New-Audit-Methodology-for-Electronic-Public-Tenders-OCDS
| 250
|
FILENAME: LegalFormsReceiver.java
| 0.284576
|
package com.datapath.ocds.kyrgyzstan.exporter.receivers;
import com.datapath.ocds.kyrgyzstan.exporter.catalogues.LegalForm;
import com.datapath.ocds.kyrgyzstan.exporter.dao.services.CatalogDAOService;
import com.neovisionaries.i18n.CountryCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import static com.datapath.ocds.kyrgyzstan.exporter.Constants.DASH;
@Component
public class LegalFormsReceiver {
@Autowired
private CatalogDAOService dao;
public List<LegalForm> receive() {
ArrayList<LegalForm> legalForms = new ArrayList<>();
dao.getLegalForms().forEach(daoLegalForm -> {
String alpha2 = CountryCode.getByCode(daoLegalForm.getCountryCode()).getAlpha2();
LegalForm legalForm = new LegalForm();
legalForm.setOrganizationId(alpha2 + "-INN" + DASH + daoLegalForm.getInn());
legalForm.setLegalForm(daoLegalForm.getTitleRu());
legalForms.add(legalForm);
});
return legalForms;
}
}
|
9c9a2632-5010-4de1-bb07-dcc94a838c59
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-04-17 21:17:31", "repo_name": "DW2733/TakeHomeAssignment11-DadriaunnaW", "sub_path": "/app/src/main/java/com/example/dadriaunna01/menulesson/SecondActivity.java", "file_name": "SecondActivity.java", "file_ext": "java", "file_size_in_byte": 1050, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "f1491a557d453c27865af5766c803b2b621e63f8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/DW2733/TakeHomeAssignment11-DadriaunnaW
| 181
|
FILENAME: SecondActivity.java
| 0.246533
|
package com.example.dadriaunna01.menulesson;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;
import android.widget.TextView;
public class SecondActivity extends AppCompatActivity {
private ImageView studentPhoto;
private TextView studentName;
private TextView studentGrade;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
studentPhoto = (ImageView) findViewById(R.id.student_photo);
studentName = (TextView) findViewById(R.id.student_name);
studentGrade = (TextView) findViewById(R.id.student_grade);
Intent intent = getIntent();
Student newStudent = (Student) intent.getSerializableExtra(Key.STUDENT);
studentPhoto.setImageResource(newStudent.photoId);
studentName.setText(newStudent.name);
studentGrade.setText(String.valueOf(newStudent.grade));
}
}
|
6f8035e9-fd09-428e-927d-140377ecb825
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-29 18:06:45", "repo_name": "pbattin/SingBetter", "sub_path": "/src/main/java/model/Main.java", "file_name": "Main.java", "file_ext": "java", "file_size_in_byte": 1036, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "19b17495b957a9b0d8ceb52d5f507e6198a39ad3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/pbattin/SingBetter
| 203
|
FILENAME: Main.java
| 0.249447
|
package model;
import javax.sound.sampled.UnsupportedAudioFileException;
import java.io.File;
import java.io.IOException;
/**
* Created by prestonbattin on 2/21/17. 😇😇😇😇😇😇😇😇😇
*/
public class Main {
public static void main(String[] args) throws IOException, UnsupportedAudioFileException {
final SoundInput recorder = new SoundInput();
// creates a new thread that waits for a specified
// of time before stopping
Thread stopper = new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(recorder.RECORD_TIME);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
recorder.finish();
}
});
stopper.start();
// start recording
recorder.start();
new ConvertAudioToNotes().run(new File("/Users/prestonbattin/Desktop/Michael Jackson - Beat It- Isolated Vocal Track.wav"));
}
}
|
863fdda3-1c19-423f-9aaa-561a95a94fe9
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-29 20:39:08", "repo_name": "anttien/design-patterns", "sub_path": "/DP15_adapter/src/adapter/ModernRecorder.java", "file_name": "ModernRecorder.java", "file_ext": "java", "file_size_in_byte": 1031, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "d717ac7c42ce1834b17330a72d94368a111f83a6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/anttien/design-patterns
| 225
|
FILENAME: ModernRecorder.java
| 0.259826
|
package adapter;
/**
* Represents a modern recorder. The guitarist can plug his guitar and
* headphones straight to the device. It doesn't actually save the recording
* anywhere; it can be only listened.
*
* @author Antti Nieminen
*/
public class ModernRecorder implements GuitarRecorder {
private UnbalancedMonoCable guitarIn;
private BalancedStereoCable headphonesOut;
private Headphones headphones;
@Override
public void plugInGuitar(UnbalancedMonoCable guitarIn) {
this.guitarIn = guitarIn;
}
@Override
public void plugInHeadphones(Headphones headphones) {
this.headphones = headphones;
}
@Override
public BalancedStereoCable headphonesOut() {
headphonesOut = new BalancedStereoCable();
headphonesOut.signalIn(guitarIn.signalOut(), guitarIn.signalOut());
return headphonesOut;
}
@Override
public void record(String signalIn) {
guitarIn.signalIn(signalIn);
headphones.signalIn(headphonesOut());
}
}
|
ff526841-8509-483f-95dd-2e2e44bbd4b0
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-26 14:57:22", "repo_name": "babu12f/realtimefileuploaderback", "sub_path": "/src/main/java/com/nrbswift/spring4web/mq/MessageReceiver.java", "file_name": "MessageReceiver.java", "file_ext": "java", "file_size_in_byte": 1148, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "76ef291135de067eca625fc33894ffc1a23511b0", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/babu12f/realtimefileuploaderback
| 216
|
FILENAME: MessageReceiver.java
| 0.249447
|
package com.nrbswift.spring4web.mq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.support.converter.MessageConverter;
import org.springframework.stereotype.Component;
import javax.jms.JMSException;
import javax.jms.Message;
@Component
public class MessageReceiver {
@Autowired
JmsTemplate jmsTemplate;
@Autowired
MessageConverter messageConverter;
public String receiveMessage() {
try {
Message message = jmsTemplate.receive();
String response = (String) messageConverter.fromMessage(message);
return response;
} catch (JMSException e) {
e.printStackTrace();
}
return null;
}
public MqMessageObject receiveObjectMessage() {
try {
Message message = jmsTemplate.receive();
MqMessageObject mqMessageObject = (MqMessageObject) messageConverter.fromMessage(message);
return mqMessageObject;
} catch (JMSException e) {
e.printStackTrace();
}
return null;
}
}
|
7241d53d-64a2-452a-a795-25d99d291e04
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-08-02 12:48:33", "repo_name": "diwt/medical", "sub_path": "/src/main/java/com/kaishengit/dao/BaseDao.java", "file_name": "BaseDao.java", "file_ext": "java", "file_size_in_byte": 1036, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "e5c0913371bdae176d436f3cf26b5cacd4194e33", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/diwt/medical
| 205
|
FILENAME: BaseDao.java
| 0.289372
|
package com.kaishengit.dao;
import com.kaishengit.pojo.Patient;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Projections;
import javax.inject.Inject;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.List;
public class BaseDao<T,PK> {
@Inject
private SessionFactory sessionFactory;
private Class<?> entityClass;
public Session getSession(){
return sessionFactory.getCurrentSession();
}
public BaseDao(){
ParameterizedType parameterizedType = (ParameterizedType) this.getClass().getGenericSuperclass();
Type[] types = parameterizedType.getActualTypeArguments();
entityClass = (Class<?>) types[0];
}
public List<T> findAll() {
Criteria criteria = getSession().createCriteria(entityClass);
return criteria.list();
}
public void saveOrUpdate(Patient patient) {
getSession().saveOrUpdate(patient);
}
}
|
0f4bc9dc-8037-419b-81f9-2d5794f61762
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-26 01:01:59", "repo_name": "nikita160/webchat2019", "sub_path": "/src/main/java/service/VFSImpl.java", "file_name": "VFSImpl.java", "file_ext": "java", "file_size_in_byte": 1064, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "3ed565c5a4627daab16c996d517af8f3b2fb5602", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/nikita160/webchat2019
| 219
|
FILENAME: VFSImpl.java
| 0.264358
|
package service;
import org.apache.commons.io.IOUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
public class VFSImpl implements VFS {
private String root;
public VFSImpl (String root){
this.root = root;
}
@Override
public boolean isExist(String path) {
return new File(path).exists();
}
@Override
public boolean isDirectory(String path) {
return new File(path).isDirectory();
}
@Override
public String getAbsolutePath(String file) {
return new File(file).getAbsolutePath();
}
@Override
public byte[] getBytes(String file) {
try (InputStream io = new FileInputStream(new File(file))){
return IOUtils.toByteArray(io);
}
catch (IOException e){
System.err.println("Failed getByte");
}
return null;
}
@Override
public Iterator<String> getIterator() {
return new FileIterator(root);
}
}
|
d9e5505f-c1e9-48ff-a906-f53e77217056
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-02 06:30:03", "repo_name": "mmichal93/musiclibrary", "sub_path": "/src/main/java/pl/mmichal93/musiclibrary/model/Musician.java", "file_name": "Musician.java", "file_ext": "java", "file_size_in_byte": 1013, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "7e76e1ff558aa4e367aba4e84fdb04cf9da379a5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/mmichal93/musiclibrary
| 204
|
FILENAME: Musician.java
| 0.226784
|
package pl.mmichal93.musiclibrary.model;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import java.time.LocalDate;
@Entity
@DiscriminatorValue(value = "Musician")
public class Musician extends Member {
private String instrument;
@ManyToOne
@JsonBackReference
private Band band;
public Musician(String name, String surname, LocalDate birthDay, String instrument, Band band) {
super(name, surname, birthDay);
this.instrument = instrument;
this.band = band;
}
public Musician() {
}
public String getInstrument() {
return instrument;
}
public void setInstrument(String instrument) {
this.instrument = instrument;
}
public Band getBand() {
return band;
}
public void setBand(Band band) {
this.band = band;
}
}
|
3a847a58-155f-48dc-bad0-0c35382feae1
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-13 05:24:57", "repo_name": "xingcmy/GraduationClient", "sub_path": "/app/src/main/java/com/cn/graduationclient/xingcmyAdapter/friendUItl.java", "file_name": "friendUItl.java", "file_ext": "java", "file_size_in_byte": 1148, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "46f550c2dd7abd73d3233216f9e1b564f4234cc2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/xingcmy/GraduationClient
| 222
|
FILENAME: friendUItl.java
| 0.289372
|
package com.cn.graduationclient.xingcmyAdapter;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.cn.graduationclient.db.FriendDbHelper;
import java.util.ArrayList;
import java.util.List;
public class friendUItl {
public static FriendDbHelper friendDbHelper;
public static SQLiteDatabase sqLiteDatabase;
public static List<friends> getFriend(Context context,String UID){
List<friends> list=new ArrayList<>();
friendDbHelper=new FriendDbHelper(context);
sqLiteDatabase=friendDbHelper.getReadableDatabase();
Cursor cursor=sqLiteDatabase.rawQuery("select * from friend where uid='"+UID+"'",null);
if (cursor!=null){
while (cursor.moveToNext()){
String name=cursor.getString(1);
String msg=cursor.getString(2);
String time=cursor.getString(3);
int type=cursor.getInt(4);
friends friend=new friends(name,msg,time,type);
list.add(friend);
}
return list;
}
return null;
}
}
|
0ded2543-0715-43fb-a8a8-69f2b71d2dc2
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-12-03 16:37:06", "repo_name": "heithem-limame/JEE", "sub_path": "/gestionPharmacie/src/main/java/sessionBeans/UtilisateurFacade.java", "file_name": "UtilisateurFacade.java", "file_ext": "java", "file_size_in_byte": 1110, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "8874a365877b234db1f5e26e1aa1b19431c436c2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/heithem-limame/JEE
| 233
|
FILENAME: UtilisateurFacade.java
| 0.285372
|
/*
* 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 sessionBeans;
import entityBeans.Utilisateur;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
/**
*
* @author tatou
*/
@Stateless
public class UtilisateurFacade extends AbstractFacade<Utilisateur> {
@PersistenceContext(unitName = "tn.haithem_gestionPharmacie_war_1.0PU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public UtilisateurFacade() {
super(Utilisateur.class);
}
public Utilisateur findByCin(Integer cin) {
Query q = getEntityManager().createNamedQuery("Utilisateur.findByCin", Utilisateur.class);
q.setParameter("cin", cin);
if (q.getResultList().isEmpty()) {
return null;
} else {
return (Utilisateur) q.getResultList().get(0);
}
}
}
|
a089824d-e7ba-4c56-8339-3ed7de30af8f
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-19 10:32:03", "repo_name": "homertruong66/research", "sub_path": "/link-stats-processor/src/main/java/com/hoang/lsp/task/LoaderExceptionHandlerTask.java", "file_name": "LoaderExceptionHandlerTask.java", "file_ext": "java", "file_size_in_byte": 1098, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "82f133aef21f82d021281b7ee18621eeaaf6cdc2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/homertruong66/research
| 204
|
FILENAME: LoaderExceptionHandlerTask.java
| 0.279042
|
package com.hoang.lsp.task;
import com.hoang.lsp.core.MyApplicationContext;
import com.hoang.lsp.model.IncrementEvent;
import com.hoang.lsp.service.LoaderExceptionHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
public class LoaderExceptionHandlerTask implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(LoaderExceptionHandlerTask.class);
private LoaderExceptionHandler loaderExceptionHandler;
private List<IncrementEvent> incrementEventList;
public LoaderExceptionHandlerTask (List<IncrementEvent> incrementEventList) {
this.loaderExceptionHandler = MyApplicationContext.getBean("loaderExceptionHandler", LoaderExceptionHandler.class);
this.incrementEventList = incrementEventList;
}
@Override
public void run() {
try {
LOGGER.info("Running Loader Exception Handler Task");
loaderExceptionHandler.writeFailedEventsToFile(incrementEventList);
}
catch (Exception ex) {
LOGGER.error("Failed!", ex);
}
}
}
|
909683f7-e2ab-419c-b03b-ab8ba3002358
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-14 08:02:13", "repo_name": "wowSens/java-china", "sub_path": "/src/main/java/com/javachina/config/TemplateConfig.java", "file_name": "TemplateConfig.java", "file_ext": "java", "file_size_in_byte": 1149, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "f8fb0a61222a16fa8cbc913aa336d49cf41bb19a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/wowSens/java-china
| 241
|
FILENAME: TemplateConfig.java
| 0.280616
|
package com.javachina.config;
import com.blade.annotation.Order;
import com.blade.config.BaseConfig;
import com.blade.config.Configuration;
import com.blade.ioc.annotation.Component;
import com.blade.mvc.view.ViewSettings;
import com.blade.mvc.view.template.JetbrickTemplateEngine;
import com.javachina.Constant;
import com.javachina.ext.Funcs;
import com.javachina.ext.Methods;
import jetbrick.template.JetGlobalContext;
import jetbrick.template.resolver.GlobalResolver;
/**
* Created by biezhi on 2016/12/25.
*/
@Component
@Order(sort = 2)
public class TemplateConfig implements BaseConfig {
@Override
public void config(Configuration configuration) {
JetbrickTemplateEngine templateEngine = new JetbrickTemplateEngine();
JetGlobalContext context = templateEngine.getGlobalContext();
GlobalResolver resolver = templateEngine.getGlobalResolver();
resolver.registerFunctions(Funcs.class);
resolver.registerMethods(Methods.class);
Constant.VIEW_CONTEXT = context;
Constant.VIEW_CONTEXT.set("cdn", Constant.CDN_URL);
ViewSettings.$().templateEngine(templateEngine);
}
}
|
478ed258-1e3e-4ac7-b635-381bed2d25d5
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-08-31 03:20:14", "repo_name": "gatanasi/lacueva-control", "sub_path": "/lacueva-control/src/main/java/com/lacueva/control/security/AuthorityDaoImpl.java", "file_name": "AuthorityDaoImpl.java", "file_ext": "java", "file_size_in_byte": 1150, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "4efccaf032a589d8f1e609bc84508006b4050710", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/gatanasi/lacueva-control
| 215
|
FILENAME: AuthorityDaoImpl.java
| 0.293404
|
package com.lacueva.control.security;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.TypedQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import com.lacueva.control.dao.impl.GenericDaoImpl;
@Repository("authorityDao")
public class AuthorityDaoImpl extends GenericDaoImpl<Authority>implements AuthorityDao {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Override
public List<Authority> findAuthoritiesByUsername(final String username) {
logger.debug("Finding Authorities with Username= " + username);
List<Authority> authorities = new ArrayList<Authority>();
if (username != null) {
TypedQuery<Authority> query = entityManager.createNamedQuery("Authorities.findAuthoritiesByUsername",
Authority.class);
query.setParameter("username", username);
List<Authority> foundList = query.getResultList();
if (!foundList.isEmpty()) {
logger.debug("Found with data= " + foundList);
authorities.addAll(foundList);
}
}
return authorities;
}
}
|
4f9e6476-0830-40c0-8c99-15935cf6197b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-04 20:26:39", "repo_name": "quasquilia/dumporly", "sub_path": "/src/main/java/com/guarascio/dumporly/Authenticator.java", "file_name": "Authenticator.java", "file_ext": "java", "file_size_in_byte": 996, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "e26a86e9df7f99c6736cc17a62d54d21deeafc4f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/quasquilia/dumporly
| 177
|
FILENAME: Authenticator.java
| 0.214691
|
package com.guarascio.dumporly;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.WebDriverWait;
public class Authenticator {
private final WebDriver driver;
public Authenticator(WebDriver driver) {
this.driver = driver;
}
public void authenticate(String userName, String password) {
WebElement element = driver.findElement(By.className("t-sign-in"));
element.click();
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(d -> d.findElement(By.name("email")));
WebElement mail = driver.findElement(By.name(
"email"));
mail.sendKeys(userName);
WebElement pwd = driver.findElement(By.name(
"password"));
pwd.sendKeys(password);
WebElement signIn = driver.findElement(By.xpath(
"//button[text()='Sign In']"));
signIn.click();
}
}
|
cc69ca55-89b6-41b3-8b91-273fffe881bb
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-17 13:44:35", "repo_name": "AKrupaa/home-page-spring-boot", "sub_path": "/src/main/java/krupinski/arkadiusz/home/services/CustomUserRoleServiceImpl.java", "file_name": "CustomUserRoleServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "b92ed32a854d47b1f3b916c7b3474b74c33f722e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/AKrupaa/home-page-spring-boot
| 224
|
FILENAME: CustomUserRoleServiceImpl.java
| 0.26971
|
package krupinski.arkadiusz.home.services;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import krupinski.arkadiusz.home.models.CustomUserRole;
import krupinski.arkadiusz.home.repositories.CustomUserRoleRepository;
import javax.transaction.Transactional;
import java.util.List;
import java.util.Optional;
@Service
@Transactional
public class CustomUserRoleServiceImpl implements CustomUserRoleService {
CustomUserRoleRepository customUserRoleRepository;
@Autowired
public CustomUserRoleServiceImpl(CustomUserRoleRepository customUserRoleRepository) {
this.customUserRoleRepository = customUserRoleRepository;
}
@Override
public List<CustomUserRole> listUserRoles() {
return customUserRoleRepository.findAll();
}
@Override
public void addUserRole(CustomUserRole userRole) {
Optional<CustomUserRole> findByRole = customUserRoleRepository.findByRole(userRole.getRole());
if (!findByRole.isPresent())
customUserRoleRepository.save(userRole);
}
@Override
public Optional<CustomUserRole> getUserRole(long id) {
return customUserRoleRepository.findById(id);
}
}
|
45fa71b7-95ba-456d-a97a-e82eeaa8e1e0
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-28 11:33:00", "repo_name": "lintsGitHub/Spring-LearningPractice", "sub_path": "/Annotation-DI-SupplementaryContent/src/main/java/priv/lint/beans/Student.java", "file_name": "Student.java", "file_ext": "java", "file_size_in_byte": 1097, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "0215677cdae4ae78914c788fb2f6b2bdcd5240e1", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/lintsGitHub/Spring-LearningPractice
| 216
|
FILENAME: Student.java
| 0.262842
|
package priv.lint.beans;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@Component
public class Student {
@Value("零")
String name;
@Autowired
Computer computer;
@Override
public String toString() {
return "Student{" +
"name='" + name + '\'' +
", computer=" + computer +
'}';
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Computer getComputer() {
return computer;
}
public void setComputer(Computer computer) {
this.computer = computer;
}
// 生命开始方法
@PostConstruct
public void init(){
System.out.println("生命开始");
}
// 生命结束方法
@PreDestroy
public void destroy(){
System.out.println("生命结束");
}
}
|
2d4e4b56-b8f4-4c29-aedd-23bf7ca748a1
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-22 13:00:35", "repo_name": "muralianamala/bw6", "sub_path": "/Code/SharedModules/JWTToken/src/JWTTokenGenerate.java", "file_name": "JWTTokenGenerate.java", "file_ext": "java", "file_size_in_byte": 1080, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "5357fd514ac5671a557d49063ab7efb6a4ca8624", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/muralianamala/bw6
| 229
|
FILENAME: JWTTokenGenerate.java
| 0.286968
|
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTCreator;
import com.auth0.jwt.algorithms.Algorithm;
public class JWTTokenGenerate {
public static String generateJwt(final String secretKey, final String keyID,
final int expiryLength) throws FileNotFoundException, IOException {
Date now = new Date();
Date expTime = new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(expiryLength));
// Build the JWT payload
Map<String, Object> headerClaims = new HashMap<String, Object>();
headerClaims.put("kid", keyID);
JWTCreator.Builder token = JWT.create().withHeader(headerClaims).withIssuedAt(now)
// Expires after 'expiraryLength' seconds
.withExpiresAt(expTime).withIssuer(keyID).withSubject("test");
// Sign the JWT
Algorithm algorithm = Algorithm.HMAC256(secretKey);
return token.sign(algorithm);
}
}
|
ffb87e75-ad04-471b-a27a-58f04ffa6095
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-23 18:12:31", "repo_name": "aloxc/jsonice", "sub_path": "/src/main/java/com/github/aloxc/jsonice/annotation/checkparam/support/StringPatternVerify.java", "file_name": "StringPatternVerify.java", "file_ext": "java", "file_size_in_byte": 1069, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "1b25beada25c5428d18b8e1753f016acd9d5d600", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/aloxc/jsonice
| 235
|
FILENAME: StringPatternVerify.java
| 0.285372
|
package com.github.aloxc.jsonice.annotation.checkparam.support;
import com.github.aloxc.jsonice.annotation.checkparam.StringPattern;
import com.github.aloxc.jsonice.io.JsonRequest;
import com.github.aloxc.jsonice.io.VerifyResult;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.lang.reflect.Method;
/**
*
* @author leerohwa@gmail.com
* @date 2016年8月10日
*/
public class StringPatternVerify implements Verify{
private final static Log logger = LogFactory.getLog(StringPatternVerify.class);
@Override
public VerifyResult verify(Method method, JsonRequest request) {
VerifyResult result = null;
StringPattern param = method.getAnnotation(StringPattern.class);
String pattern = param.pattern();
String key = param.key();
String value = request.getParam(key, param.defaultValue());
if(!value.matches(pattern)){
result = new VerifyResult();
result.setName(key);
result.setMessage("["+ pattern +"]无法匹配["+ key +"]的取值["+value+"]");
return result;
}
return null;
}
}
|
cfa84b3d-1a5f-43cf-b4d6-741fd647b939
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-10 12:55:15", "repo_name": "Aaaaashin/ashin-mall", "sub_path": "/ashin-goods-service/src/main/java/com/ashin/controller/BrandController.java", "file_name": "BrandController.java", "file_ext": "java", "file_size_in_byte": 1246, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "0a5045d7b19c1e9e70c467ba384bcbbd71be8f3f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Aaaaashin/ashin-mall
| 241
|
FILENAME: BrandController.java
| 0.26971
|
package com.ashin.controller;
import com.ashin.entity.PageResult;
import com.ashin.entity.QueryPageBean;
import com.ashin.entity.Result;
import com.ashin.pojo.Brand;
import com.ashin.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/brand")
public class BrandController {
@Autowired
private BrandService brandService;
@GetMapping("/findPage")
public PageResult findPage(QueryPageBean queryPageBean){
PageResult pageResult = brandService.findPage(queryPageBean);
return pageResult;
}
@GetMapping("/findAll")
public Result findAll(){
List<Brand> brandList = brandService.findAll();
return new Result(true,"查询成功", brandList);
}
@GetMapping("/find/{id}")
public Result<Brand> findById(@PathVariable Integer id){
Brand brand = brandService.findById(id);
return new Result(true,"查询成功", brand);
}
}
|
106ad95b-7a98-4e77-9e2d-3be19f2c674b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-13 20:29:51", "repo_name": "RomarioGorilyi/CarRegistrationWebService", "sub_path": "/src/main/java/training/registration/service/impl/CarRegistrationServiceImpl.java", "file_name": "CarRegistrationServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1037, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "ac4cc9eef8a013fb6e646a02edf38e5d0f1d1dd1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/RomarioGorilyi/CarRegistrationWebService
| 178
|
FILENAME: CarRegistrationServiceImpl.java
| 0.292595
|
package training.registration.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import training.registration.chain.RegistrationChain;
import training.registration.domain.Car;
import training.registration.exception.CarRegistrationException;
import training.registration.handler.RegistrationChainHandler;
import training.registration.service.CarRegistrationService;
import java.util.List;
/**
* @author Roman Horilyi
*/
@Service
public class CarRegistrationServiceImpl implements CarRegistrationService {
@Autowired
private List<RegistrationChainHandler> handlers;
@Override
public long registerCar(Car car) throws CarRegistrationException {
try {
return new RegistrationChain(handlers).proceed(car);
} catch (CarRegistrationException e) {
throw e;
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
|
50f67b5d-0843-41c7-9e2c-593b3044d916
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-11-07 11:16:02", "repo_name": "jayanthbonagiri/Team-H-Effective_Java_Tranning", "sub_path": "/testapp19.finance11/src/in/conceptarchitect/finance/BankTransaction.java", "file_name": "BankTransaction.java", "file_ext": "java", "file_size_in_byte": 1148, "line_count": 65, "lang": "en", "doc_type": "code", "blob_id": "39496ef5f2e14ac2dd40d8e5abec60b6f66d397c", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/jayanthbonagiri/Team-H-Effective_Java_Tranning
| 254
|
FILENAME: BankTransaction.java
| 0.279828
|
package in.conceptarchitect.finance;
import java.sql.Date;
public class BankTransaction {
String Description;
int accountnumber;
double amount;
Date date;
public BankTransaction() {
super();
}
public BankTransaction(String description, int accountnumber, double amount, Date date) {
super();
this.Description = description;
this.accountnumber = accountnumber;
this.amount = amount;
this.date = date;
}
public String getDescription() {
return Description;
}
public void setDescription(String description) {
this.Description = description;
}
public int getAccountnumber() {
return accountnumber;
}
public void setAccountnumber(int accountnumber) {
this.accountnumber = accountnumber;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
@Override
public String toString() {
return "BankTransaction [Description=" + Description + ", accountnumber=" + accountnumber + ", amount=" + amount
+ ", date=" + date + "]";
}
}
|
fdad9f97-3e50-4dfe-8bff-fa92ad1c7b02
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-21 09:31:18", "repo_name": "arajhub/java8-examples", "sub_path": "/src/SupplierAndConsumer.java", "file_name": "SupplierAndConsumer.java", "file_ext": "java", "file_size_in_byte": 1015, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "e4b465fd21eb26c69acf889017c240b0e3b8cfd9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/arajhub/java8-examples
| 223
|
FILENAME: SupplierAndConsumer.java
| 0.293404
|
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Supplier;
public class SupplierAndConsumer {
public static void main(String[] args) {
List<String> aa = new ArrayList<String>();
aa.add("aaditya");
aa.add("Raj");
Supplier<String> supplier = () -> {
return aa.get(1);
};
System.out.println(supplier.get());
Consumer<String> consumer1 = (x) -> {
System.out.println("Consumer 1 "+x);
};
Consumer<String> consumer2 = (x) -> {
System.out.println("Consumer 2 "+x);
};
consumer1.accept("I am first !!!");
consumer1.andThen(consumer2).andThen(consumer1);
//aa.forEach(() -> aa.get(1));
/* Supplier<Date> dateSupplier= SupplierFunctionExample::getSystemDate;
Date systemDate = dateSupplier.get();
System.out.println("systemDate->" + systemDate);
*/
}
}
|
a035a674-d66c-4653-a0f9-c25419640a41
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-03-13 09:19:57", "repo_name": "alexclin0188/httplite", "sub_path": "/httplite/src/main/java/alexclin/httplite/internal/ResponseBodyImpl.java", "file_name": "ResponseBodyImpl.java", "file_ext": "java", "file_size_in_byte": 1037, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "7a5f36caa34165cf9257ab81038280b20f4ccfad", "star_events_count": 41, "fork_events_count": 6, "src_encoding": "UTF-8"}
|
https://github.com/alexclin0188/httplite
| 210
|
FILENAME: ResponseBodyImpl.java
| 0.229535
|
package alexclin.httplite.internal;
import java.io.IOException;
import java.io.InputStream;
import alexclin.httplite.MediaType;
import alexclin.httplite.ResponseBody;
/**
* ResponseBodyImpl
*
* @author alexclin 16/3/12 14:42
*/
public class ResponseBodyImpl implements ResponseBody {
private InputStream inputStream;
private MediaType mediaType;
private long contentLength;
public ResponseBodyImpl(InputStream inputStream, MediaType mediaType,long contentLength) {
this.inputStream = inputStream;
this.mediaType = mediaType;
this.contentLength = contentLength;
}
@Override
public MediaType contentType() {
return mediaType;
}
@Override
public long contentLength() throws IOException {
return contentLength;
}
@Override
public InputStream stream() throws IOException {
return inputStream;
}
@Override
public void close() throws IOException {
if(inputStream!=null)
inputStream.close();
}
}
|
1dd77dbd-b6a8-44a2-a6ea-3d59e574f619
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-30 08:45:10", "repo_name": "gueryacine/ProjetDAD", "sub_path": "/Serveurs J2EE/Traitements/wordTraitementProject/src/main/java/com/dao/model/EntityManagerController.java", "file_name": "EntityManagerController.java", "file_ext": "java", "file_size_in_byte": 1072, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "5250a7054df3b502238d61a55b3f946ef2648c35", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/gueryacine/ProjetDAD
| 218
|
FILENAME: EntityManagerController.java
| 0.26588
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.dao.model;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.PersistenceContext;
/**
*
* @author gueryacine
*/
public class EntityManagerController {
// @PersistenceContext("com_wordTraitementProject_ejb_1.0-SNAPSHOTPU")
private EntityManagerFactory emf;
private EntityManager em;
public EntityManagerFactory getEmf() {
return emf;
}
public void setEmf(EntityManagerFactory emf) {
this.emf = emf;
}
public EntityManager getEm() {
return em;
}
public void setEm(EntityManager em) {
this.em = em;
}
public EntityManagerController() {
emf = Persistence.createEntityManagerFactory("newPU");
em = emf.createEntityManager();
}
}
|
6a223a47-ecb4-4478-bcb1-7573ee61c2ad
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-12 14:58:59", "repo_name": "GanyaoziTech/danmu-collector", "sub_path": "/src/main/java/tech/ganyaozi/danmu/colloctor/BiliBiliChannelInitializer.java", "file_name": "BiliBiliChannelInitializer.java", "file_ext": "java", "file_size_in_byte": 1032, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "ac7ad192d3239badf3368b1039925d1d78e72c04", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/GanyaoziTech/danmu-collector
| 234
|
FILENAME: BiliBiliChannelInitializer.java
| 0.252384
|
package tech.ganyaozi.danmu.colloctor;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.timeout.IdleStateHandler;
import tech.ganyaozi.danmu.colloctor.handler.*;
import java.util.concurrent.TimeUnit;
/**
* @author Derek
*/
public class BiliBiliChannelInitializer extends ChannelInitializer<SocketChannel> {
private final Integer roomId;
public BiliBiliChannelInitializer(Integer roomId) {
this.roomId = roomId;
}
@Override
protected void initChannel(SocketChannel ch) {
ch.pipeline()
.addLast("decoder", new BiliBiliDecoder())
.addLast("encoder", new BiliBiliEncoder())
.addLast("idleState", new IdleStateHandler(0, 15, 0, TimeUnit.SECONDS))
.addLast("heartbeat", new BiliBiliHeartBeatHandler())
.addLast("joinRoomHandler", new BiliBiliJoinRoomHandler(roomId))
.addLast("messageHandler", new BiliBiliMessageHandler());
}
}
|
4ea09201-2d08-4df1-93b3-b82d6bf7efb9
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-03-09T20:40:22", "repo_name": "NathanielWroblewski/skyhero", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1037, "line_count": 34, "lang": "en", "doc_type": "text", "blob_id": "3f97ce710d2a4ff9591a278bbbbad9cc9bf56ac4", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/NathanielWroblewski/skyhero
| 262
|
FILENAME: README.md
| 0.253861
|
SkyHero
===

Watch a video here:
[](https://youtu.be/HUTJNY7UE8o)
Play [here](https://www.nathaniel.ai/skyhero)
Running locally
---
On a mac, clone the repo, and run a server:
```
$ git clone https://github.com/NathanielWroblewski/skyhero.git
$ cd skyhero
$ open http://localhost:8000 && python3 -m http.server
```
TODO
===
- Make a `target` method for atan2 and reuse it for "rockets"
- General refactor
- move boundaries constants from views into constants file
- Look at collision and bounding code and make sure it's not split between models and game objects, make a separate class if necessary
- Improve title screen
- dive bombers
- change inbounds logic to be direction + offscreen
- helix should come in from side, not behind
- formation flyers should be smoother, borrow angle code
|
786c68ae-2f51-41cd-94c1-6a64215485cd
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-05-09 22:00:27", "repo_name": "LFSDeveloper/VoiceNoteTranslations", "sub_path": "/Sourcer Code/VoiceProcesing/app/src/main/java/com/mac/voiceprocesing/adaptors/LanguageSpinnerAdaptor.java", "file_name": "LanguageSpinnerAdaptor.java", "file_ext": "java", "file_size_in_byte": 1106, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "2eac919a79fd9dc581a8271945c66948124de9c5", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/LFSDeveloper/VoiceNoteTranslations
| 233
|
FILENAME: LanguageSpinnerAdaptor.java
| 0.26588
|
package com.mac.voiceprocesing.adaptors;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.mac.voiceprocesing.R;
import com.mac.voiceprocesing.models.Language;
import java.util.ArrayList;
/**
* Created by florin on 2/6/2015.
*/
public class LanguageSpinnerAdaptor extends BaseAdapter{
private ArrayList<Language> dataSet;
public LanguageSpinnerAdaptor(ArrayList<Language> dataSet) {
this.dataSet = dataSet;
}
@Override
public int getCount() {
return this.dataSet.size();
}
@Override
public Object getItem(int position) {
return this.dataSet.get(position);
}
@Override
public long getItemId(int position) {
return this.dataSet.get(position).getId();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView text = new TextView(parent.getContext());
text.setText(this.dataSet.get(position).getLanguageName());
text.setTextSize(18);
return text;
}
}
|
530ac436-9b0d-4a89-a514-13d9a9b0ee68
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-19 09:53:46", "repo_name": "JonathanOgAnders/ZIZ1_", "sub_path": "/src/com/company/Main.java", "file_name": "Main.java", "file_ext": "java", "file_size_in_byte": 1149, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "e6692c41de88b7347e65a17078d4c9be229250a9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/JonathanOgAnders/ZIZ1_
| 295
|
FILENAME: Main.java
| 0.292595
|
package com.company;
import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
Deck deck = new Deck();
ArrayList<Animals> hand1 = new ArrayList<>();
ArrayList<Animals> hand2 = new ArrayList<>();
for (int i = 0; i < 5; i++)
{
hand1.add(deck.drawFromDeck());
hand2.add(deck.drawFromDeck());
}
int h1 = 0;
int h2 = 0;
System.out.println("Hand 1: " + hand1 + "\nHand 2: " + hand2);
for (Animals a: hand1)
{
for (Animals b: hand2)
{
h1 += b.compareAnimals(a);
}
}
for (Animals a: hand2)
{
for (Animals b: hand1)
{
h2 += b.compareAnimals(a);
}
}
System.out.println("h1: " + h1 + "\nh2: " + h2);
if(h1 == h2)
{
System.out.println("It's a draw!");
}
else if(h1 > h2)
{
System.out.println("hand 1 won");
} else
{
System.out.println("hand 2 won");
}
}
}
|
b6b407ab-f228-4b28-a387-e54045d94089
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-25 19:46:39", "repo_name": "magalierambla/App2Java2", "sub_path": "/src/main/java/com/api/crowdlending/model/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 1016, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "dfeec62e01fbcb1597821741bc4cc1e4205a820c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/magalierambla/App2Java2
| 201
|
FILENAME: User.java
| 0.194368
|
package com.api.crowdlending.model;
import com.api.crowdlending.enumapp.SexeUser;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Entity
@Getter
@Setter
public class User implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false)
private String nom;
@Column(nullable = false)
private String prenom;
private String login;
@CreatedDate
private Date createdDate;
@LastModifiedDate
private Date lastModifiedDate;
private String pseudo;
@Enumerated(EnumType.STRING)
private SexeUser sexe;
private String typeCompte;
private String photo;
private Date dateNaissance;
private String password;
@ManyToOne
@JoinColumn(name = "profile_id")
private Profile profile;
}
|
5adfc4ef-5424-4b46-881f-58408ae6ea15
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-02-24 16:38:27", "repo_name": "sakilaJayasooriya/FixedMe", "sub_path": "/app/src/main/java/com/example/pavithra/fixedme2/AddVehicles.java", "file_name": "AddVehicles.java", "file_ext": "java", "file_size_in_byte": 1149, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "526af818fdeb35e7e72b2db4f9f360526a992e99", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/sakilaJayasooriya/FixedMe
| 206
|
FILENAME: AddVehicles.java
| 0.261331
|
package com.example.pavithra.fixedme2;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class AddVehicles extends AppCompatActivity {
public static String userId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_vehicles);
// Get the Intent that started this activity and extract the string
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
userId=message;
// Capture the layout's TextView and set the string as its text
//TextView textView = findViewById(R.id.txtWelcome);
//textView.setText(message);
}
public void addedV(View view){
Intent intent = new Intent(this, DriverMainAcc.class);
//EditText editText = (EditText) findViewById(R.id.txtUserName);
//String message = vehicleNo;
//intent.putExtra(EXTRA_MESSAGE,message);
startActivity(intent);
}
}
|
3cd145ff-8a63-4fd4-b96b-f4240be61bbd
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-12 05:04:21", "repo_name": "aaronchenac2/MeteorsWithBossCrapSC", "sub_path": "/Dummytar.java", "file_name": "Dummytar.java", "file_ext": "java", "file_size_in_byte": 1008, "line_count": 71, "lang": "en", "doc_type": "code", "blob_id": "5a85168786a1f43d88075b34e4110a7164a5a0e0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/aaronchenac2/MeteorsWithBossCrapSC
| 236
|
FILENAME: Dummytar.java
| 0.282196
|
package pckg;
import java.awt.Image;
import java.net.URL;
import javax.swing.ImageIcon;
public class Dummytar
{
private double x;
private double y;
private int lives = 5;
private Image image;
public Dummytar( URL file, int x, int y )
{
initCraft( file, x, y );
}
private void initCraft( URL file, int x, int y )
{
ImageIcon ii = new ImageIcon( file );
image = ii.getImage();
this.x = x;
this.y = y;
}
public void setLives( int l )
{
lives = l;
}
public int getLives()
{
return lives;
}
public void setX(double x)
{
this.x = x;
}
public void setY(double y)
{
this.y = y;
}
public double getX()
{
return x;
}
public double getY()
{
return y;
}
public Image getImage()
{
return image;
}
}
|
fe60d288-539b-4c0e-a435-0edbe78b52aa
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-08-29T21:32:58", "repo_name": "yimsea/toil-scripts", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1017, "line_count": 22, "lang": "en", "doc_type": "text", "blob_id": "c8514c60c5e8ba435f8ae0520a9a6ad809c1f792", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/yimsea/toil-scripts
| 249
|
FILENAME: README.md
| 0.206894
|
## University of California, Santa Cruz Genomics Institute
### Repository of Toil-based Genomic Pipelines
To install these pipelines, type: `pip install toil-scripts`
Entrypoints are supplied to pipelines that work with the current stable release of Toil:
- Fastq to BAM alignment: `toil-bwa`
- CGL RNA-seq Pipeline (hg38): `toil-rnaseq`
- GATK exome variant pipeline: `toil-exome`
Each pipeline has its own README that provides instructions on how to get up and running.
The general dependencies for these pipelines are:
1. [Toil](https://github.com/BD2KGenomics/toil)
2. [Docker](https://www.docker.com/)
Our group utilizes genomics tools encapsulated within Docker containers for portability. Each of these
pipelines can be run locally on your laptop, on a baremetal cluster, or on a cloud provider.
If there are any questions please contact the Toil team at: Toil@googlegroups.com
If you find any errors or corrections please feel free to make a pull request. Feedback of any kind is appreciated.
|
44b5fde2-e881-45a4-a61e-62fe7066f16f
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-02 16:33:37", "repo_name": "recicleaf/data-service", "sub_path": "/src/main/java/fh/fa/data/repository/converters/StringListToJsonConverter.java", "file_name": "StringListToJsonConverter.java", "file_ext": "java", "file_size_in_byte": 1015, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "d95b7a279f08d4164c43e0cf741d6544b0953a22", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/recicleaf/data-service
| 182
|
FILENAME: StringListToJsonConverter.java
| 0.235108
|
package fh.fa.data.repository.converters;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import javax.persistence.AttributeConverter;
import java.io.IOException;
import java.util.List;
public class StringListToJsonConverter implements AttributeConverter<List<String>, String> {
private ObjectMapper objectMapper = new ObjectMapper();
@Override
public String convertToDatabaseColumn(final List<String> strings) {
try {
return objectMapper.writeValueAsString(strings);
} catch (final JsonProcessingException e) {
}
return "";
}
@Override
public List<String> convertToEntityAttribute(final String s) {
try {
if (s == null || s.equals("null")) {
return List.of();
} else {
return objectMapper.readValue(s, List.class);
}
} catch (final IOException e) {
}
return List.of();
}
}
|
f213a07c-090c-4f63-b4f2-7b5c96816e2b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-06 06:22:18", "repo_name": "SoftpaseFar/Android_SmartButiler", "sub_path": "/app/src/main/java/com/goo1e/smartbutiler/ui/QrCodeActivity.java", "file_name": "QrCodeActivity.java", "file_ext": "java", "file_size_in_byte": 1090, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "3019f31b3fe51ab31d9f5b741aedef92ca6f7663", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/SoftpaseFar/Android_SmartButiler
| 238
|
FILENAME: QrCodeActivity.java
| 0.255344
|
package com.goo1e.smartbutiler.ui;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;
import com.goo1e.smartbutiler.R;
import com.xys.libzxing.zxing.encoding.EncodingUtils;
/**
* 我的二维码
* Created by SoftpaseFar on 2017/4/13.
*/
public class QrCodeActivity extends BaseActivity {
//我的二维码
private ImageView iv_qr_code;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_qr_code);
initView();
}
private void initView() {
iv_qr_code = (ImageView) findViewById(R.id.iv_qr_code);
//屏幕的宽
int width = getResources().getDisplayMetrics().widthPixels;
Bitmap qrCodeBitmap = EncodingUtils.createQRCode("15865369579", width / 2, width / 2,
BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher));
iv_qr_code.setImageBitmap(qrCodeBitmap);
}
}
|
3bd72069-7501-4791-9bb4-ef85c26136ef
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-09-07T10:08:27", "repo_name": "nuxeo-sandbox/nuxeo-pullrequest", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1039, "line_count": 18, "lang": "en", "doc_type": "text", "blob_id": "2afd72b4c3952de07c913cd5d838a3c6107ac427", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"}
|
https://github.com/nuxeo-sandbox/nuxeo-pullrequest
| 250
|
FILENAME: README.md
| 0.217338
|
# nuxeo-pullrequest
Nuxeo Pull Request WIP
This is some text
NXBT-1060: test PR to be merged from GitHub
NXBT-1060: test PR to be merged from NinjaReview
NXBT-1060: test PR created from GitHub API
NXBT-1060: test PR with squashed commits
NXBT-1060: test PR with squashed commits
test rebase and push for Jenkins
add a conflicting change
# About Nuxeo
Nuxeo dramatically improves how content-based applications are built, managed and deployed, making customers more agile, innovative and successful. Nuxeo provides a next generation, enterprise ready platform for building traditional and cutting-edge content oriented applications. Combining a powerful application development environment with SaaS-based tools and a modular architecture, the Nuxeo Platform and Products provide clear business value to some of the most recognizable brands including Verizon, Electronic Arts, Sharp, FICO, the U.S. Navy, and Boeing. Nuxeo is headquartered in New York and Paris. More information is available at [www.nuxeo.com](http://www.nuxeo.com).
|
eb051cf1-9e52-471f-a693-acd00cd2ae96
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-07-24 13:54:40", "repo_name": "gtxcontentconnector/contentconnector", "sub_path": "/contentconnector-core/src/main/java/com/gentics/cr/template/VelocityTemplateWrapper.java", "file_name": "VelocityTemplateWrapper.java", "file_ext": "java", "file_size_in_byte": 1149, "line_count": 64, "lang": "en", "doc_type": "code", "blob_id": "4a0b522efd6d92759bb62f3d509d8a6d8e2b735a", "star_events_count": 0, "fork_events_count": 4, "src_encoding": "UTF-8"}
|
https://github.com/gtxcontentconnector/contentconnector
| 275
|
FILENAME: VelocityTemplateWrapper.java
| 0.289372
|
/*
*
*/
package com.gentics.cr.template;
import java.io.Serializable;
import org.apache.velocity.Template;
/**
* The Class VelocityTemplateWrapper.
*/
public class VelocityTemplateWrapper implements Serializable {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = -6870612259011831815L;
/** The template. */
private Template template;
/** The source of the template. */
private String source;
/**
* Instantiates a new velocity template wrapper.
*
* @param template
* the template
* @param source the source of the template
*/
public VelocityTemplateWrapper(Template template, String source) {
this.template = template;
this.source = source;
}
/**
* Gets the template.
*
* @return the template
*/
public Template getTemplate() {
return template;
}
/**
* Sets the template.
*
* @param template
* the new template
*/
public void setTemplate(Template template) {
this.template = template;
}
/**
* Returns the source of the template
*
* @return the source
*/
public String getSource() {
return source;
}
}
|
641f310f-0698-47d5-a49b-5e0159fd87b4
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-04-24 21:43:10", "repo_name": "KyleMelton32/autonomy", "sub_path": "/Autonomy/app/src/main/java/nasa_rmc/autonomy/data/Itinerary.java", "file_name": "Itinerary.java", "file_ext": "java", "file_size_in_byte": 982, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "e2562678c13bc45a4b8900c74c97917adf63f31b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/KyleMelton32/autonomy
| 218
|
FILENAME: Itinerary.java
| 0.276691
|
package nasa_rmc.autonomy.data;
import java.util.ArrayList;
import nasa_rmc.autonomy.data.Coordinates;
/**
* Created by atomlinson on 3/31/17.
*/
public class Itinerary {
private ArrayList<Coordinates> path;
private ArrayList<Coordinates> getPath() { return path; }
public enum ItineraryPurpose {
DIG,
DUMP;
}
private ItineraryPurpose itineraryPurpose;
public ItineraryPurpose getItineraryPurpose() { return this.itineraryPurpose; }
public Itinerary(ArrayList<Coordinates> path, ItineraryPurpose itineraryPurpose) {
this.path = path;
this.itineraryPurpose = itineraryPurpose;
}
public void setInitialPosition(Coordinates initialPosition) {
path.add(0, initialPosition);
}
public Coordinates getNextCoordinates() { return path.get(0); }
public void arrivedAtCoordinates() {
path.remove(0);
}
public boolean isFinalDestinationReached() { return path.size() == 0; }
}
|
e9fcb02b-fd05-473a-bb27-2cabf30d892b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-01 16:36:52", "repo_name": "SarthakQss/publicapi", "sub_path": "/demo/src/main/java/com/test/demo/controller/MyController.java", "file_name": "MyController.java", "file_ext": "java", "file_size_in_byte": 1111, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "757d46b62ab433071fab4b27da686038c7f27799", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/SarthakQss/publicapi
| 210
|
FILENAME: MyController.java
| 0.23793
|
package com.test.demo.controller;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.test.demo.service.ServiceClass;
@RestController
@RequestMapping("/")
public class MyController {
@Autowired
private ServiceClass service;
@GetMapping("users")
public void getUser() {
service.getUsers();
}
@GetMapping("posts")
public void getPost() {
service.getPosts();
}
@GetMapping("comments")
public void getComment() {
service.getComments();
}
// @GetMapping("users/{id}")
// @ResponseBody
// private void getPostByFilter(@PathVariable int id) {
// service.getUserByFilters(id);
// }
// @GetMapping("post/{userId}")
// @ResponseBody
// private void getPostByFilter(@PathVariable String userId) {
// service.getPostByFilters();
// }
}
|
384d97d0-4444-4bb7-a55d-7b58a9cb3d9d
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-22 09:30:00", "repo_name": "wangtingbang/tongzhuangzhuang", "sub_path": "/src/main/java/me/tongzhuangzhuang/business/service/impl/CustCustomerBaseServiceImpl.java", "file_name": "CustCustomerBaseServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1093, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "d9b7bf342e4a1aedc55f3a177e1d2016fa5b8e8c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/wangtingbang/tongzhuangzhuang
| 258
|
FILENAME: CustCustomerBaseServiceImpl.java
| 0.285372
|
package me.tongzhuangzhuang.business.service.impl;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import me.tongzhuangzhuang.business.biz.CustCustomerBaseBusiness;
import me.tongzhuangzhuang.business.dto.CustCustomerBase;
import me.tongzhuangzhuang.business.entity.TCustCustomerBase;
import me.tongzhuangzhuang.business.service.CustCustomerBaseService;
import me.tongzhuangzhuang.support.mybatis.Example;
/**
*
* @generated by Code Generator v0.1
* @Tue May 31 16:05:12 CST 2016
*/
@Service //("ustCustomerBaseService")
public class CustCustomerBaseServiceImpl implements CustCustomerBaseService {
@Autowired
private CustCustomerBaseBusiness custCustomerBaseBusiness;
private static Logger logger = LoggerFactory.getLogger(CustCustomerBaseServiceImpl.class);
public List<CustCustomerBase> listCustomers(){
Example example = Example.newExample(TCustCustomerBase.class);
return custCustomerBaseBusiness.list(example);
}
}
|
cfc9667a-5420-42b1-aa7f-171b6bb16729
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-11-05T21:19:45", "repo_name": "lorenz/geoip-updater", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 983, "line_count": 27, "lang": "en", "doc_type": "text", "blob_id": "9d6d6f9843e956533c9e9050c5df4236b7def685", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/lorenz/geoip-updater
| 238
|
FILENAME: README.md
| 0.242206
|
# GeoIP Updater
*GeoIP Updater Microservice*
## Building
To build this project, you need my custom Docker build extension dockpipe, which you can get here [here](https://github.com/lorenz/dockpipe).
Then you can just type
```
$ dockpipe geoip-updater:dev .
```
to get an image built.
## Environment variables
| Name | Default | Description |
| ---- | ------- | ----------- |
| `USER_ID`| 99999 | The user id to use to connect to the MaxMind update server, the default one is anonymous for GeoLite databases |
| `EDITION_IDS` | GeoLite2-City | A comma-separated list of edition ids to download and keep up-to-date |
## Volumes
| Path | Description |
| ---- | ----------- |
| `/data` | Shared volume with geoip-server instances for storing GeoIP-Databases. Should be on SSD or high-IOPS volume. |
## Facts
* Only updates databases when they actually change to avoid rate limits and consume excessive bandwidth.
* Checks for updates every hour.
* Does replace databases atomically
|
fbc280a0-b96d-4f1a-9551-a48121be981a
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-16 09:13:34", "repo_name": "luosv/Java-NIO-Netty", "sub_path": "/NIO-Netty/src/nio/UseFileLocks.java", "file_name": "UseFileLocks.java", "file_ext": "java", "file_size_in_byte": 1043, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "b8b2365b7a340c1b718a6b99d0a885acd1e7777b", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/luosv/Java-NIO-Netty
| 243
|
FILENAME: UseFileLocks.java
| 0.295027
|
package nio;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
/**
* 文件锁定
* <p>
* Created by luosv on 2017/9/15 0015.
*/
public class UseFileLocks {
private static final int start = 10;
private static final int end = 20;
public static void main(String[] args) throws Exception {
// Get file channel
RandomAccessFile raf = new RandomAccessFile("usefilelocks.txt", "rw");
FileChannel fc = raf.getChannel();
// Get lock
System.out.println("Trying to get lock");
FileLock lock = fc.lock(start, end, false);
System.out.println("got lock");
// Pause
System.out.println("Pausing");
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Release lock
System.out.println("going ro release lock");
lock.release();
System.out.println("released lock");
raf.close();
}
}
|
8f5a30eb-5bf9-4302-b894-c567958a511b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-15 20:31:12", "repo_name": "jasonkellydk/KEA_3_SEMESTER_EXAM_6_THREADS", "sub_path": "/src/dk/kea/examples/ThreadSynchronizationExample.java", "file_name": "ThreadSynchronizationExample.java", "file_ext": "java", "file_size_in_byte": 1102, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "7f9f6ea7fb5277bec0d17d9de7c289cf2a57c67f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/jasonkellydk/KEA_3_SEMESTER_EXAM_6_THREADS
| 227
|
FILENAME: ThreadSynchronizationExample.java
| 0.27513
|
package dk.kea.examples;
import dk.kea.ExampleInterface;
import dk.kea.examples.Thread.PrintCount;
import dk.kea.examples.Thread.SynchronizeThread;
public class ThreadSynchronizationExample implements ExampleInterface
{
@Override
public String getDescription()
{
return "This example will show how Synchronize in action";
}
@Override
public String getName()
{
return "Thread Synchronization";
}
@Override
public void runExample()
{
PrintCount printCount = new PrintCount();
SynchronizeThread thread = new SynchronizeThread("Thread - 1", printCount);
SynchronizeThread thread2 = new SynchronizeThread("Thread - 2", printCount);
thread.start();
thread2.start();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// wait for threads to end
try {
thread.join();
thread2.join();
} catch ( Exception e) {
System.out.println("Interrupted");
}
}
}
|
7db60507-8671-4d4c-9e1e-ce4f43d16afc
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2015-01-26T07:58:22", "repo_name": "Missybur/missy_t2-css-design.html", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1118, "line_count": 33, "lang": "en", "doc_type": "text", "blob_id": "f293c02826a7b1d48e50e5476e65adaf94783865", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Missybur/missy_t2-css-design.html
| 298
|
FILENAME: README.md
| 0.221351
|
# missy_t2-css-design.html
Class or ID?
<!DOCTYPE html>
<head>
<title>Missy's Blog</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="your-stylesheet-link-here.css">
</head>
<main>
<h1>Class ID say what?</h1>
<h2>When to use Class vs ID</h2>
<h4>1-25-15</h4>
<section>
<p>
Class and ID have very similar results when using CSS. It is important to make note of these differences and to use them when it is appropriate.
</p>
<p>
Traditionally, classes are an element that are used for the purpose of resusing again later within your code. ID's on the other hand are elements that are used to style in a specific area that you don't think that you will need to be applied again, unless of course you are using the ID as an anchor for a single page website which is rare, yet still altogether possible.
</p>
<p>
In order to keep your code clean and clear from clutter, your best bet is to stick with CLASS.
</p>
<!-- copy and paste as many sections as you want to add paragraphs -->
</section>
</main>
|
18934a6a-e848-4907-b326-ff5bb17d470a
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-17 20:56:34", "repo_name": "danieldelira/gjpp", "sub_path": "/src/main/java/com/itseekers/webservices/restcontroller/FranquiciaRestController.java", "file_name": "FranquiciaRestController.java", "file_ext": "java", "file_size_in_byte": 1150, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "ee92498b4187cf770ea96b001612b56482f4a1d7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/danieldelira/gjpp
| 218
|
FILENAME: FranquiciaRestController.java
| 0.23092
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.itseekers.webservices.restcontroller;
import com.itseekers.webservices.service.FranquiciaService;
import com.itseekers.webservices.service.response.FranquiciaResponse;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
*
* @author IT-Seekers
*/
@RestController
@Produces({MediaType.APPLICATION_JSON})
public class FranquiciaRestController {
@Autowired
FranquiciaService franquiciaService;
@RequestMapping(value = "franquicias", method = RequestMethod.GET)
public ResponseEntity<FranquiciaResponse> loginByUser() {
return franquiciaService.getFranquicias();
}
}
|
76e81bc3-39ef-45b1-9b92-a74a9fcfc812
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-02-17 10:29:36", "repo_name": "spatack/zookeeper-distributed-lock", "sub_path": "/src/main/java/com/example/demo/service/AbstractZookeeperLock.java", "file_name": "AbstractZookeeperLock.java", "file_ext": "java", "file_size_in_byte": 1111, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "f350261b9504cff008779f6e0072cbb4f2d8c3af", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/spatack/zookeeper-distributed-lock
| 254
|
FILENAME: AbstractZookeeperLock.java
| 0.23092
|
package com.example.demo.service;
import org.I0Itec.zkclient.ZkClient;
import org.apache.curator.framework.recipes.locks.InterProcessMutex;
/**
* zk分布式锁抽象类
*/
public abstract class AbstractZookeeperLock implements Lock {
private static final String HOST = "localhost:2182";
protected ZkClient client = new ZkClient(HOST);
protected static final String PATH = "/order";
/**
* 获取锁
*/
@Override
public void getLock() {
if (tryLock()) {
System.out.println("####获取到锁######");
} else {
System.out.println("####未获取到锁####");
//等待锁
waitLock();
//重新获取锁
getLock();
}
}
/**
* 释放锁
*/
@Override
public void unLock() {
System.out.println("#####删除节点#####");
client.delete(PATH);
}
/**
* 尝试获取锁
*
* @return 获取结果
*/
protected abstract boolean tryLock();
/**
* 等待锁
*/
protected abstract void waitLock();
}
|
a3cc7e9e-5175-4469-b84d-e6b70e89b0a2
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2013-03-05T22:21:53", "repo_name": "nkeim/PennFluidsCRG", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1061, "line_count": 19, "lang": "en", "doc_type": "text", "blob_id": "bdecb026daec5b2599d975715532ce6dc43d19d8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/nkeim/PennFluidsCRG
| 227
|
FILENAME: README.md
| 0.249447
|
PennFluidsCRG
=============
**Important:** Check out the "Wiki" tab above!
These are some example IPython Notebooks for us to share as we learn. GitHub is like Dropbox, but better
for passing around code and managing shared projects, because we get a high level of control over
whether our edits affect the rest of the group, without having to manually copy files or keep track of old versions.
There's a bit of a learning curve, but once you "get it," you'll be amazed at how it simplifies collaboration.
The free GitHub client for Mac makes this even easier. Check out the "Clone in Mac" button above.
The repository you see is for general-purpose teaching and learning. If you sign up for a free GitHub account
and tell me your username (please do!), I can give you permission to upload your own changes to it and edit the wiki.
Once you've done that, you can also create your own repositories to collaborate on other projects.
Please note that everything on Github is public. It's possible to create private repositories elsewhere; I can show
you how.
|
beed84ed-f842-4955-a652-8de6a26c8f7d
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-04-26 23:48:10", "repo_name": "kevinlin47/Projects", "sub_path": "/AndroidApp/Java/CowActivity.java", "file_name": "CowActivity.java", "file_ext": "java", "file_size_in_byte": 1005, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "ec0294bf4c5cfba2dd218855d76d57cc52e89d5d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/kevinlin47/Projects
| 174
|
FILENAME: CowActivity.java
| 0.253861
|
package nivek.learnnumbersmore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.RelativeLayout;
import android.view.View.OnClickListener;
import android.view.View;
import android.media.MediaPlayer;
public class CowActivity extends AppCompatActivity {
MediaPlayer cowSound;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cow);
}
@Override
public void onResume()
{
super.onResume();
cowSound=MediaPlayer.create(this,R.raw.moo);
cowSound.setVolume(100,100);
cowSound.start();
RelativeLayout rlayout = (RelativeLayout) findViewById(R.id.activity_cow);
rlayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
cowSound.start();
}
});
}
}
|
2a364ddf-a824-4ed7-94d2-660a7b496b9d
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-04 08:14:31", "repo_name": "Catfeeds/myWorkspace", "sub_path": "/hljlivelibrary/src/main/java/com/hunliji/hljlivelibrary/models/LiveIntroItem.java", "file_name": "LiveIntroItem.java", "file_ext": "java", "file_size_in_byte": 1025, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "7e1b3233deb2ac2f7361c0e32281c4c55786fe48", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/Catfeeds/myWorkspace
| 238
|
FILENAME: LiveIntroItem.java
| 0.246533
|
package com.hunliji.hljlivelibrary.models;
import com.hunliji.hljcommonlibrary.models.Work;
import com.hunliji.hljcommonlibrary.models.product.ShopProduct;
/**
* Created by luohanlin on 2017/12/4.
*/
public class LiveIntroItem {
private boolean isIntroducing;
private Work work;
private ShopProduct product;
private int type;
public LiveIntroItem(
boolean isIntroducing, Work work, int type) {
this.isIntroducing = isIntroducing;
this.work = work;
this.product = product;
this.type = type;
}
public LiveIntroItem(
boolean isIntroducing, ShopProduct product, int type) {
this.isIntroducing = isIntroducing;
this.product = product;
this.type = type;
}
public boolean isIntroducing() {
return isIntroducing;
}
public Work getWork() {
return work;
}
public ShopProduct getProduct() {
return product;
}
public int getType() {
return type;
}
}
|
df1fea36-25af-4e36-8a5a-d36e17ef423b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-08 11:39:02", "repo_name": "adrianrogalski/java-advanced-problems", "sub_path": "/src/main/java/homework/classesandinterfaces/p1/UserValidator.java", "file_name": "UserValidator.java", "file_ext": "java", "file_size_in_byte": 1022, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "cb816986949c9e81ec849bccb96df890146893f0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/adrianrogalski/java-advanced-problems
| 184
|
FILENAME: UserValidator.java
| 0.285372
|
package homework.classesandinterfaces.p1;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class UserValidator {
public String validateEmails(String inputEmail){
class Email {
private String address;
private Email(String address) {
this.address = address;
}
private String format() {
if (address.isEmpty() || address.equals(null)) {
return "unknown";
}
String addressLowerCase = address.toLowerCase(Locale.ROOT);
Pattern pattern = Pattern.compile("^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,6}$");
Matcher matcher = pattern.matcher(addressLowerCase);
if (!matcher.matches()) {
return "unknown";
}
return addressLowerCase;
}
}
Email email = new Email(inputEmail);
return email.format();
}
}
|
6a20f66c-73c1-4061-8646-99a553d78bc9
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-02-09 06:47:46", "repo_name": "PandaQAQ/PandaMvp", "sub_path": "/sdk_core/src/main/java/com/pandaq/appcore/utils/system/ContactUtils.java", "file_name": "ContactUtils.java", "file_ext": "java", "file_size_in_byte": 1120, "line_count": 47, "lang": "zh", "doc_type": "code", "blob_id": "b890cac76ea1a94b5507937a0f63a408cbab24db", "star_events_count": 27, "fork_events_count": 2, "src_encoding": "UTF-8"}
|
https://github.com/PandaQAQ/PandaMvp
| 251
|
FILENAME: ContactUtils.java
| 0.218669
|
package com.pandaq.appcore.utils.system;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import androidx.annotation.NonNull;
/**
* Created by huxinyu on 2018/5/30.
* Email : panda.h@foxmail.com
* <p>
* Description :联系人公共方法,如打电话,发短信
*/
public class ContactUtils {
private ContactUtils() {
// private constructor
}
/**
* 拨打电话
*
* @param context 上下文
* @param phoneNumber 电话号码
*/
public static void makeCall(Context context, @NonNull String phoneNumber) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:" + phoneNumber));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
/**
* 发送短消息
*
* @param context 上下文
* @param phoneNumber 电话号码
* @param message 短信内容
*/
public static void sendMessage(Context context, @NonNull String phoneNumber, String message) {
}
}
|
4d136ecb-abff-4462-9548-0c44aba20447
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-04 15:31:13", "repo_name": "alexylon/EduJava", "sub_path": "/exercises/src/me/alexandroff/misc/animals/Animal.java", "file_name": "Animal.java", "file_ext": "java", "file_size_in_byte": 1022, "line_count": 59, "lang": "en", "doc_type": "code", "blob_id": "08d950fb97d367ac222ba69dece0defb2a5c6a35", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/alexylon/EduJava
| 239
|
FILENAME: Animal.java
| 0.289372
|
package me.alexandroff.misc.animals;
public class Animal {
private String name;
private int age;
String str = "Variable from Animal";
Animal(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
void method1() {
System.out.println("Method from Animal");
}
public String toString() {
return "The age of the " + this.getClass().getSimpleName() + " "
+ name + " is " + age;
}
}
class Dog extends Animal {
String str = "Variable from Dog";
Dog(String name, int age) {
super(name, age);
}
void method1() {
System.out.println("Method from Dog");
}
}
class Cat extends Animal {
Cat(String name, int age) {
super(name, age);
}
}
|
7243ab5a-9061-4160-9461-b60335f5da76
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-06 05:53:12", "repo_name": "jakarta1024/keycloak-login-spi", "sub_path": "/src/main/java/cn/porsche/keycloak/spi/authenticator/password/PasswordAuthenticatorFactory.java", "file_name": "PasswordAuthenticatorFactory.java", "file_ext": "java", "file_size_in_byte": 1195, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "a074e72024bf71bc712ec5a13ac778015a8a36b9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/jakarta1024/keycloak-login-spi
| 244
|
FILENAME: PasswordAuthenticatorFactory.java
| 0.23793
|
package cn.porsche.keycloak.spi.authenticator.password;
import cn.porsche.keycloak.spi.authenticator.BaseAuthenticatorFactory;
import cn.porsche.keycloak.spi.util.LoginType;
import com.google.common.collect.Lists;
import java.util.List;
import org.keycloak.provider.ProviderConfigProperty;
public class PasswordAuthenticatorFactory extends BaseAuthenticatorFactory {
@Override
protected LoginType getLoginType() {
return LoginType.PASSWORD;
}
public static final String PROPERTY_FORM_USERNAME = "form.username";
public static final String PROPERTY_FORM_PASSWORD = "form.password";
@Override
public List<ProviderConfigProperty> getConfigProperties() {
List<ProviderConfigProperty> propertyList = Lists.newArrayList();
// 登陆表单
propertyList.add(new ProviderConfigProperty(
PROPERTY_FORM_USERNAME, "login form key - username", "登录表单键名称[用户名]", ProviderConfigProperty.STRING_TYPE, "username"
));
propertyList.add(new ProviderConfigProperty(
PROPERTY_FORM_PASSWORD, "login form key - password", "登陆表单键名称[密码]", ProviderConfigProperty.STRING_TYPE, "password"
));
return propertyList;
}
}
|
c04557ac-cd5e-4596-83f6-3a2b06b4e742
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-10-14T06:56:24", "repo_name": "thomasX/nfc-util", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 999, "line_count": 57, "lang": "en", "doc_type": "text", "blob_id": "12b75ae3aec5967c9c2ca29497416cfa41bf2db8", "star_events_count": 7, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/thomasX/nfc-util
| 229
|
FILENAME: README.md
| 0.27048
|
nfc-util
========
A small and simple java nfc writer/reader for the mifare ultralight C Tags written in Java 1.6
desktop usage:
==============
1.) Reading a Tag:
------------------
NFCReader reader = new NFCReader();
Properties tagContent=reader.read();
String tagID=tagContent.get(NFCReader.PROPERTY_TYPE_TAG_IDENTITY);
String tagValue=tagContent.get(NFCReader.PROPERTY_TYPE_TAG_VALUE);
... tagID contains the unique ID of the MIFARE-Ultralight C chip
... tagValue contains the userData of the MIFARE-Ultralight C chip
2.) Writing on the Tag:
-----------------------
NFCWriter writer = new NFCWriter();
writer.write("Hello World");
3.) Make a Tag Writeprotected (Attention this is a onewayticket !!!)
--------------------------------------------------------------------
NFCWriter writer = new NFCWriter();
writer.lockTag();
web usage:
==========
... (see the example in the folder appletDemo) or have a look in the wiki https://github.com/thomasX/nfc-util/wiki
|
2dabbf4b-7d8d-4ebc-ab55-a3bbea7a008b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-27 19:06:25", "repo_name": "davidhowick/AddressesTracker", "sub_path": "/AddressesTracker/src/main/java/com/accela/java/model/Address.java", "file_name": "Address.java", "file_ext": "java", "file_size_in_byte": 1149, "line_count": 66, "lang": "en", "doc_type": "code", "blob_id": "04d3b3af22ca72b83586773e6cb93ca12e17fec0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/davidhowick/AddressesTracker
| 247
|
FILENAME: Address.java
| 0.239349
|
package com.accela.java.model;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Entity
@Table(name="address")
@IdClass(AddressID.class)
public class Address implements Serializable {
@Id
private Long id;
@NotNull
@Column(name = "street")
private String street;
@NotNull
@Column(name = "city")
private String city;
@NotNull
@Column(name = "state")
private String state;
@NotNull
@Id
@Column(name = "postal_code")
private String postalCode;
public Address(){}
public Long getId(){
return this.id;
}
public String getCity(){
return this.city;
}
public String getStreet(){
return this.street;
}
public String getState(){
return this.state;
}
public String getPostalCode(){
return this.postalCode;
}
public void setCity(String city){
this.city = city;
}
public void setState(String state){
this.state = state;
}
public void setPostalCode(String postalCode){
this.postalCode = postalCode;
}
}
|
a68f8f2d-2ef9-4dbc-9346-537173c8e65f
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-24 14:04:12", "repo_name": "cahitb/airline-project", "sub_path": "/src/main/java/com/finartz/airline/controllers/AirlineCompanyController.java", "file_name": "AirlineCompanyController.java", "file_ext": "java", "file_size_in_byte": 1028, "line_count": 28, "lang": "en", "doc_type": "code", "blob_id": "5a356db9aacb5c1da5a75dacc49d7ec45c9197d4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/cahitb/airline-project
| 188
|
FILENAME: AirlineCompanyController.java
| 0.253861
|
package com.finartz.airline.controllers;
import com.finartz.airline.entities.Company;
import com.finartz.airline.models.CompanyRequest;
import com.finartz.airline.services.AirlineCompanyService;
import lombok.AllArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
@AllArgsConstructor
@RequestMapping("api/v1/airline")
public class AirlineCompanyController {
private final AirlineCompanyService airlineCompanyService;
@GetMapping(value = "/company/get/{id}")
ResponseEntity<Company> getAirlineCompany(@PathVariable int id) throws Exception {
return ResponseEntity.ok(airlineCompanyService.getAirlineCompany(id));
}
@PostMapping(value = "/company/add", consumes = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<Boolean> addAirlineCompany(@RequestBody CompanyRequest request) {
return ResponseEntity.ok(airlineCompanyService.addAirlineCompany(request));
}
}
|
816a69ee-83d9-4fea-b857-1beb7f4bcf2f
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-02 07:55:46", "repo_name": "wenka/JavaHighDevelopment", "sub_path": "/design-patterns/structure/src/main/java/c_filter/People.java", "file_name": "People.java", "file_ext": "java", "file_size_in_byte": 1035, "line_count": 60, "lang": "en", "doc_type": "code", "blob_id": "4bd64901d4a2e0b15c614ee7ff13e65004194f3a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/wenka/JavaHighDevelopment
| 247
|
FILENAME: People.java
| 0.26588
|
package c_filter;
/**
* Created with IDEA
* author:wenka wkwenka@gmail.com
* Date:2019/01/10 下午 03:25
* Description:
*/
public class People {
public enum Gender {
male, female
}
private String name;
private int age;
private Gender gender;
public People(String name, int age, Gender gender) {
this.name = name;
this.age = age;
this.gender = gender;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public Gender getGender() {
return gender;
}
public void setGender(Gender gender) {
this.gender = gender;
}
@Override
public String toString() {
return "\nPeople{" +
"name='" + name + '\'' +
", age=" + age +
", gender=" + gender +
"}\n";
}
}
|
e21dc03c-f87e-4780-b38d-f523946860ff
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-26 19:28:19", "repo_name": "1nilsh/Verteilte-Anwendungssysteme-WS19-20", "sub_path": "/customer/src/main/java/bz/nils/dev/va19/customer/connector/OrderRestConnectorRequester.java", "file_name": "OrderRestConnectorRequester.java", "file_ext": "java", "file_size_in_byte": 1021, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "ef79dcf1439a90ae4ae24b84afd98d54da678bcf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/1nilsh/Verteilte-Anwendungssysteme-WS19-20
| 201
|
FILENAME: OrderRestConnectorRequester.java
| 0.246533
|
package bz.nils.dev.va19.customer.connector;
import bz.nils.dev.va19.customer.component.structure.CartItem;
import feign.Feign;
import feign.gson.GsonDecoder;
import feign.gson.GsonEncoder;
import feign.okhttp.OkHttpClient;
import org.springframework.stereotype.Service;
@Service
public class OrderRestConnectorRequester {
private OrderRestConnectorInterface orderRestConnectorInterface;
public OrderRestConnectorRequester() {
orderRestConnectorInterface = Feign.builder()
.client(new OkHttpClient())
.encoder(new GsonEncoder())
.decoder(new GsonDecoder())
.target(OrderRestConnectorInterface.class, "http://localhost:8090/order-microservice/api/order");
}
public String createOrder(String customerId) {
return this.orderRestConnectorInterface.createOrder(customerId);
}
public void addItemToOrder(CartItem item, String orderId) {
this.orderRestConnectorInterface.addItemToOrder(item, orderId);
}
}
|
cd3cf409-283b-4816-9d1f-f5708afa9873
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-07-31T13:39:09", "repo_name": "esalim/PerBAC", "sub_path": "/hardware/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1056, "line_count": 20, "lang": "en", "doc_type": "text", "blob_id": "9dfd0805d2d8f05767e5a79b7178aa60c9a95496", "star_events_count": 1, "fork_events_count": 2, "src_encoding": "UTF-8"}
|
https://github.com/esalim/PerBAC
| 236
|
FILENAME: README.md
| 0.282196
|
## File Description
We find in this folder the different code programs within the Arduino and Raspberry boards.
### Arduino board:
The source code present in arduino cards allows the ultrasonic sensors to detect by means of audible impulsons the presence of an obstable. This
data is then sent to the Arduinos boards which then use actuators (LEDs) to signal this detection.
This phenomenon is repeated every 30s.
_Link for implementation :_ [**_Arduino Card Code_**](https://github.com/esalim/PerBAC/tree/master/hardware/arduino)
### Raspberry Cards
The source code present in the Raspberry cards allows different Arduino boards after receiving presence data
to send these different data to the Rapberry cards that will process them and send them via
from **_SerialPort_** technology and **_Sockets_** to ThingSpeak with the right rules and actions (which we have previously created) to process the corresponding data.
_Link for implementation :_ [**_Raspberry Pi Card Code_**](https://github.com/esalim/PerBAC/tree/master/hardware/raspberry%20pi)
|
efbc486d-d1d7-4a25-ba8b-201d764843c5
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2014-08-31T14:28:22", "repo_name": "sharikul/BlogPad", "sub_path": "/docs/posting/a_static_post.md", "file_name": "a_static_post.md", "file_ext": "md", "file_size_in_byte": 968, "line_count": 27, "lang": "en", "doc_type": "text", "blob_id": "599bf74a493f8b61c91ddcc40596e33238bd7c6e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/sharikul/BlogPad
| 233
|
FILENAME: a_static_post.md
| 0.252384
|
# Static Posts
A BlogPad static post is a file that stores a post's content. **That's it**. Static posts should have the extension **.bpp** and be stored in the directory specified as the static posts directory.
This is the format of a static post:
```
-- BEGIN METADATA
Title: Post title
Date: Year-Month-Date Hour:Minute:Second
Author: username
Categories: A, comma, separated, list, of, values, if, required
Description: A description
-- END METADATA
The body of a post.
```
When you learn more about structs (_this is a post struct_), you'll find out that everything in BlogPad has a beginning and an ending.
You may have noticed that there is no way of providing a slug to your post. Since a static post is a file, the filename should contain the slug, separated by hyphens if required, like so: `my-post.bpp` or `post.bpp`.
The web editor also provides you with the ability to create and edit static posts and it will handle this templating for you.
|
d483055a-c89d-4211-ab57-7ce5f08594c5
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-03-16 09:08:50", "repo_name": "headstar/iam", "sub_path": "/iam-web/src/main/java/com/headstartech/iam/web/hateoas/assemblers/RoleResourceAssembler.java", "file_name": "RoleResourceAssembler.java", "file_ext": "java", "file_size_in_byte": 1149, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "71e7c2e638ccea76d2bae499ab891360a4bc491a", "star_events_count": 3, "fork_events_count": 3, "src_encoding": "UTF-8"}
|
https://github.com/headstar/iam
| 206
|
FILENAME: RoleResourceAssembler.java
| 0.240775
|
package com.headstartech.iam.web.hateoas.assemblers;
import com.headstartech.iam.common.dto.Role;
import com.headstartech.iam.web.controllers.RoleRestController;
import com.headstartech.iam.common.resources.RoleResource;
import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
import org.springframework.stereotype.Component;
@Component
public class RoleResourceAssembler extends ResourceAssemblerSupport<Role, RoleResource> {
public RoleResourceAssembler() {
super(RoleRestController.class, RoleResource.class);
}
@Override
public RoleResource toResource(Role role) {
final RoleResource roleResource = new RoleResource(role);
/* try {
roleResource.add(
ControllerLinkBuilder.linkTo(
ControllerLinkBuilder.methodOn(UserRestController.class)
.getDomain(role.getId()))
.withSelfRel()
);
} catch (final IAMException ge) {
// Force a server exception
throw new RuntimeException(ge);
}*/
return roleResource;
}
}
|
84c3cbd3-f86e-4575-83cd-1cf79d1c3220
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-02-18T10:55:01", "repo_name": "ojos/stock_crawler", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1059, "line_count": 51, "lang": "en", "doc_type": "text", "blob_id": "1794c5122b50e163e3e020a0f0c526ea18fd83a3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/ojos/stock_crawler
| 266
|
FILENAME: README.md
| 0.274351
|
# Python Qiita Stock Crawler
This is the crawler that you want to synchronize the Qiita stock and
Slack channel running on Python.
This system is suitable for GoogleAppEngine.
If you want to create crawler for your teams Slack,
customize this codes according to the following procedure.
## development setup
clone from git
```
git clone https://github.com/ojos/stock_crawler.git
```
install requirements
```
cd stock_crawler
pip install -r requirements.txt -t lib
```
Run this project locally from the command line:
```
# Require google appengine SDK
# https://developers.google.com/appengine/downloads?hl=ja
dev_appserver.py .
```
Remote login to the local:
```
# Require google appengine SDK
remote_api_shell.py -s localhost:8080
```
## deploy stock crawler
1. edit app.yaml
* modify ```application```
2. edit src/stock/api.py
* modify ```stock_user```
3. edit src/crawlers/ping.py
* add ```_TOKEN```
* modify ```_CHANNEL```
4. deploy to AppEngine
* ```appcfg.py update .```
|
25a7fe30-fec9-4728-9036-5dd29e44b8f8
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-17 15:52:33", "repo_name": "ruxi-savina/Telecommunication-Services", "sub_path": "/web/src/main/java/intrusii/web/converter/SubscriptionConverter.java", "file_name": "SubscriptionConverter.java", "file_ext": "java", "file_size_in_byte": 993, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "cc8dc2c1708ce21b32f7d45e4720a4b7828fbc53", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/ruxi-savina/Telecommunication-Services
| 173
|
FILENAME: SubscriptionConverter.java
| 0.26588
|
package intrusii.web.converter;
import intrusii.core.model.Subscription;
import intrusii.web.dto.SubscriptionDto;
import org.springframework.stereotype.Component;
@Component
public class SubscriptionConverter extends BaseConverter<Subscription, SubscriptionDto> {
@Override
public Subscription convertDtoToModel(SubscriptionDto dto) {
Subscription model =Subscription.builder()
.type(dto.getType())
.duration(dto.getDuration())
.price(dto.getPrice())
.build();
model.setId(dto.getId());
return model;
}
@Override
public SubscriptionDto convertModelToDto(Subscription subscription) {
SubscriptionDto dto = SubscriptionDto.builder()
.type(subscription.getType())
.duration(subscription.getDuration())
.price(subscription.getPrice())
.build();
dto.setId(subscription.getId());
return dto;
}
}
|
6728a56a-b500-4d1e-b436-c7992da5abf6
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-19 12:56:24", "repo_name": "NTRsolutions/FunwithStatus", "sub_path": "/app/src/main/java/com/epsilon/FunwithStatus/jsonpojo/mainhome/HomeData.java", "file_name": "HomeData.java", "file_ext": "java", "file_size_in_byte": 1111, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "f0c6bf7c2ffe7684a977295df6aaa963076aeac8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/NTRsolutions/FunwithStatus
| 254
|
FILENAME: HomeData.java
| 0.253861
|
package com.epsilon.FunwithStatus.jsonpojo.mainhome;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
import java.util.List;
public class HomeData {
@SerializedName("current_page")
@Expose
public int currentPage;
@SerializedName("data")
@Expose
public List<HomeDatum> data = new ArrayList<HomeDatum>();
@SerializedName("first_page_url")
@Expose
public String firstPageUrl;
@SerializedName("from")
@Expose
public int from;
@SerializedName("last_page")
@Expose
public int lastPage;
@SerializedName("last_page_url")
@Expose
public String lastPageUrl;
@SerializedName("next_page_url")
@Expose
public String nextPageUrl;
@SerializedName("path")
@Expose
public String path;
@SerializedName("per_page")
@Expose
public int perPage;
@SerializedName("prev_page_url")
@Expose
public Object prevPageUrl;
@SerializedName("to")
@Expose
public int to;
@SerializedName("total")
@Expose
public int total;
}
|
5030d9b5-0788-4617-82a4-b48861651f7b
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-04 02:38:51", "repo_name": "LJGuardiola-zz/Final-Seminario", "sub_path": "/src/main/java/gui/util/AlertFactory.java", "file_name": "AlertFactory.java", "file_ext": "java", "file_size_in_byte": 1017, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "be0a8cce93dcc62ecc11c48496065116c12bc74d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/LJGuardiola-zz/Final-Seminario
| 204
|
FILENAME: AlertFactory.java
| 0.272025
|
package gui.util;
import com.jfoenix.controls.JFXAlert;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXDialogLayout;
import io.datafx.controller.context.ApplicationContext;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Label;
import javafx.stage.Stage;
public class AlertFactory {
public static JFXAlert<?> alert(String title, String message, EventHandler<ActionEvent> eventHandler) {
Stage stage = (Stage) ApplicationContext.getInstance().getRegisteredObject("stage");
JFXAlert<Void> alert = new JFXAlert<>(stage);
alert.setOverlayClose(false);
JFXDialogLayout layout = new JFXDialogLayout();
layout.setHeading(new Label(title));
layout.setBody(new Label(message));
JFXButton ok = new JFXButton("OK");
ok.setOnAction(eventHandler);
layout.setActions(ok);
alert.setContent(layout);
return alert;
}
}
|
6b8eed56-e3ba-4a1b-9657-398feb8c6aed
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-11 07:43:59", "repo_name": "z-zxq-123456/myproject", "sub_path": "/personalMybatics/database_pool/src/main/java/com/qxz/test/pool/MyConnection.java", "file_name": "MyConnection.java", "file_ext": "java", "file_size_in_byte": 1147, "line_count": 59, "lang": "en", "doc_type": "code", "blob_id": "48ca2baedef0e6e52ec3bee1ad9e119be24944b9", "star_events_count": 4, "fork_events_count": 1, "src_encoding": "UTF-8"}
|
https://github.com/z-zxq-123456/myproject
| 237
|
FILENAME: MyConnection.java
| 0.247987
|
package com.qxz.test.pool;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
/**
* @description
* @author: zhouxqh
* @create: 2020-03-10 22:34
**/
public class MyConnection {
private Connection connection;
private boolean isBusy;
public MyConnection(Connection connection, boolean isBusy) {
this.connection = connection;
this.isBusy = isBusy;
}
public void close(){
this.isBusy = false;
}
public boolean isBusy(){
return isBusy;
}
public void setBusy(boolean busy) {
isBusy = busy;
}
public Connection getConnection() {
return connection;
}
public void setConnection(Connection connection) {
this.connection = connection;
}
public ResultSet query(String sql){
Statement stmt = null;
ResultSet resultSet = null;
try {
stmt = connection.createStatement();
resultSet = stmt.executeQuery(sql);
} catch (SQLException e) {
e.printStackTrace();
}
return resultSet;
}
}
|
4a5b5c94-1f3a-4eca-9fc8-ffc13d4cca4e
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-10-01T08:36:46", "repo_name": "SveinJH/TheWineBase", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1097, "line_count": 29, "lang": "en", "doc_type": "text", "blob_id": "bdda28b4ce49b4f403e55f0d613faf4bd78f00f6", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/SveinJH/TheWineBase
| 279
|
FILENAME: README.md
| 0.206894
|
# The Wine Base
This is a hobby project I am currently working on.
It will use the public API from Norways "Vinmonopolet" to fetch and display useful information about its products and stores.
User authentication and management will be provided by Firebase's Authentication REST API.
## Check it out
Even though the project is far from finished, I have deployed it in order to get feedback and find bugs. You can check it out at [https://www.twb.sjhoie.no](https://www.twb.sjhoie.no)
## Getting Started
Clone and yada yada... (TODO)
## Features and TODOs
- [X] Basic product fetching from API
- [ ] Advanced product fetching (filtering etc.)
- [X] Simple authentication system (email and password)
- [ ] Signup with more info than email and pw
- [X] Add favourites page
- [ ] Add rating to favorites page
- [ ] Add store locator system using geolocation and so on...
- [X] Modern layout :)
- [ ] Finish this readme
- [ ] Responsive
## Authors
* **Svein Jakob Høie** - *Owner* - [SveinJH](https://github.com/SveinJH)
## License
This project is licensed under the MIT License - soon atleast.
|
d1f0c30f-5240-413c-a45b-fa751bc51ec6
|
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-11 09:17:38", "repo_name": "songjianzaina/androidLib", "sub_path": "/base/code/com/insworks/lib_base/utils/ToastUtil.java", "file_name": "ToastUtil.java", "file_ext": "java", "file_size_in_byte": 1081, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "a764a3367053abb57712c9a1addf745a44b9e780", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
|
https://github.com/songjianzaina/androidLib
| 241
|
FILENAME: ToastUtil.java
| 0.277473
|
package com.insworks.lib_base.utils;
import android.content.Context;
import android.widget.Toast;
/**
* Created by songjian on 2017/1/6.
*/
public class ToastUtil {
private static Context mContext;
private static final String TAG = "ToastUtil";
private static Toast toast;
private ToastUtil() {
}
public static void init(Context context) {
mContext = context;
}
/**
* 短吐司
*/
public static void showToast(String msg) {
toast(msg, Toast.LENGTH_SHORT);
}
/**
* 长吐司
*/
public static void showLongToast(String msg) {
toast(msg, Toast.LENGTH_LONG);
}
private static void toast(String msg, int lengthLong) {
if (mContext == null) {
throw new ExceptionInInitializerError("请先在全局Application中调用 ToastUtil.init() 初始化!");
}
if (toast != null) {
toast.cancel();//关闭吐司显示
}
toast = Toast.makeText(mContext, msg, lengthLong);
toast.show();//重新显示吐司
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.