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 |
|---|---|---|---|---|---|---|
bbae59ea-139b-456b-8918-57cacafcb27d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-03-20T21:47:23", "repo_name": "silentdefault/Discord-to-GitHub-Status", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1199, "line_count": 27, "lang": "en", "doc_type": "text", "blob_id": "dfb5ee067d56553d90b1a64549858845dc230bf6", "star_events_count": 3, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/silentdefault/Discord-to-GitHub-Status | 335 | FILENAME: README.md | 0.208179 | # Discord-to-GitHub-Status
Send Discord Status to your GitHub Status.
## Installation
Install [BetterDiscord](https://github.com/rauenzi/BetterDiscordApp)\
Download [DiscordGithubStatus.plugin.js](https://raw.githubusercontent.com/silentdefault/Discord-to-GitHub-Status/master/DiscordGithubStatus.plugin.js) into the following directory\
Mac: `~/Library/Preferences/BetterDiscord`\
Windows: `%appdata%\BetterDiscord\plugins`\
Linux: `~/.config/BetterDiscord/plugins`
## Usage
1. Open Discord, go to Settings>Plugins.
1. Enable "Discord-to-GitHub Status" and click Setting.
1. Go to [github](https://github.com/settings/tokens) and "Generate new Token".
1. The note can have "any name", Check user and then "Generate Token".

1. Copy your new Token.

1. Paste on "Discord-to-GitHub Status" and press "Save".

1. Every time your status is changed in discord, it will be reflected in github

## Why?
If possible, why not?
Tip: works fine with [BetterDiscord-Animated-Status](https://github.com/toluschr/BetterDiscord-Animated-Status) |
d071ad54-438d-4ce0-8fae-c461e5e29598 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-27 16:31:49", "repo_name": "martindansc/AIC2019", "sub_path": "/src/LilRookie/Injection.java", "file_name": "Injection.java", "file_ext": "java", "file_size_in_byte": 1105, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "44af05d29f9dbc18ea3a7c917fd21528973d4d65", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/martindansc/AIC2019 | 218 | FILENAME: Injection.java | 0.27513 | package LilRookie;
import aic2019.*;
public class Injection {
public final UnitController unitController;
public final Constants constants = new Constants();
public final StaticVariables staticVariables;
public final MemoryManager memoryManager;
public final Attack attack;
public final Move move;
public final Pathfinder pathfinder;
public final Soldier soldier;
public final Worker worker;
public final Base base;
public final Messages messages;
public final Market market;
public final Map map;
Injection (UnitController uc) {
this.unitController = uc;
this.staticVariables = new StaticVariables(this);
this.memoryManager = new MemoryManager(this);
this.attack = new Attack(this);
this.move = new Move(this);
this.pathfinder = new Pathfinder(this);
this.soldier = new Soldier(this);
this.worker = new Worker(this);
this.base = new Base(this);
this.messages = new Messages(this);
this.market = new Market(this);
this.map = new Map(this);
}
}
|
3cd68c31-e981-4fcc-a476-4c4df4a81fa9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-12 14:41:40", "repo_name": "arnovkh/springbootdemo", "sub_path": "/src/main/java/com/example/demo/security/users/UserService.java", "file_name": "UserService.java", "file_ext": "java", "file_size_in_byte": 1062, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "d9019b60a1d6840103101cd905723eb1637927b7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/arnovkh/springbootdemo | 176 | FILENAME: UserService.java | 0.264358 | package com.example.demo.security.users;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class UserService {
private UserRepository userRepository;
private BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
public UserService(UserRepository userRep) {
this.userRepository = userRep;
}
public Boolean IsUserValid(AppUser appUser) {
try {
List<AppUser> potentialUsers = this.userRepository.getUsers(
new AppUser(
appUser.getUsername(), appUser.getPassword())
);
List<AppUser> result = potentialUsers.stream().
filter(pass-> encoder.matches(appUser.getPassword(), pass.getPassword())).
collect(Collectors.toList());
return result.size() >0;
} catch(Exception e) {
return false;
}
}
}
|
fe28508f-c867-4868-986d-edbb760c130c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-05-23T02:55:41", "repo_name": "dom64/discordcrusher", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1080, "line_count": 42, "lang": "en", "doc_type": "text", "blob_id": "2cce481fdb085248805594cb2629084f0ac497a5", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/dom64/discordcrusher | 260 | FILENAME: README.md | 0.183594 | # What is this
This is a dumb shell script I made to spam messages and change nicknames very quickly in discord.
Messages get send every second and/or nickname gets changed every second depending on what parameters you set.
You can have multiple instances running with multiple accounts.
This was my first real shell script I made so it isn't as clean as I wanted to be.
# Requirements
- [CURL](https://curl.se/)
- POSIX compliant shell
- GNU Coreutils or a similar replacement
# Usage
Message spam:
`discordcrush -m <token> <channel id> <random/file/message>`
Nickname scrambler:
`discordcrush -n <token> <server id> <random/file>`
Both:
`discordcrush -b <token> <server id> <channel id> <random/file/message> <random/file>`
# Notes
Nickname changing can only happen every second so setting it lower will get you rate limited.
Spamming messages can be set to less then 1 second if you manually change the script but might cause some issues (around 0.7 seems fine mostly).
Pinging users: <@userid>
Pinging roles: <@&roleid>
Made for fun and not to break TOS :)
|
0cb93b27-efbc-47e8-bb09-a179a25f6c70 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-04-19 18:51:08", "repo_name": "Abs-Zer0/Integration", "sub_path": "/RestCamel/src/main/java/abs/zer0/restcamel/App.java", "file_name": "App.java", "file_ext": "java", "file_size_in_byte": 1213, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "e2a79aeab7e012b3b65a08031e866442512aa9b3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Abs-Zer0/Integration | 245 | FILENAME: App.java | 0.294215 | /*
* 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 abs.zer0.restcamel;
import abs.zer0.restcamel.routes.RestRoute;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultCamelContext;
/**
*
* @author Абс0лютный Н0ль
*/
public class App {
public static void main(String[] args) {
final CamelContext camel = new DefaultCamelContext();
try {
final RestRoute restRoute = new RestRoute();
camel.addRoutes(restRoute);
camel.start();
System.out.println("Press 'e' to exit the program");
while (true) {
int symbol = System.in.read();
if (symbol == (int) 'e') {
break;
}
}
camel.stop();
} catch (Exception ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
System.out.println(ex.getLocalizedMessage());
camel.stop();
}
}
}
|
3edc1750-8c8b-440e-8b62-369f7f354e46 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-23 00:12:33", "repo_name": "lenik/stack", "sub_path": "/plover/core/plover-arch/src/main/java/com/bee32/plover/arch/exception/AbstractExceptionHandler.java", "file_name": "AbstractExceptionHandler.java", "file_ext": "java", "file_size_in_byte": 1123, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "da3c98a63d9b24134ea55db68c80b3f87d3f1402", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lenik/stack | 224 | FILENAME: AbstractExceptionHandler.java | 0.262842 | package com.bee32.plover.arch.exception;
import com.bee32.plover.inject.ServiceTemplate;
/**
* You must declare {@link ForException} annotation.
*/
@ServiceTemplate
// Must be eager, so as to inject to PloverExceptionHandler.handlerMap as soon as possible.
// @Lazy
public abstract class AbstractExceptionHandler
implements IExceptionHandler {
boolean fullStackSearch;
public AbstractExceptionHandler() {
ForException annotation = getClass().getAnnotation(ForException.class);
if (annotation != null)
fullStackSearch = annotation.fullStackSearch();
}
@Override
public int getPriority() {
return 0;
}
public ExceptionHandleResult skip() {
return ExceptionHandleResult.SKIP;
}
public ExceptionHandleResult handled() {
return ExceptionHandleResult.HANDLED;
}
public ExceptionHandleResult redirect(String resultView) {
return new ExceptionHandleResult(ExceptionHandleResult.TYPE_REDIRECT, resultView);
}
@Override
public boolean isFullStackSearch() {
return fullStackSearch;
}
}
|
9c389bca-ab0b-4e14-8800-6772aa0acbf6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-17 00:12:26", "repo_name": "n0misain/6-1_source_from_JADX", "sub_path": "/sources/com/twitter/sdk/android/tweetui/ResetTweetCallback.java", "file_name": "ResetTweetCallback.java", "file_ext": "java", "file_size_in_byte": 1008, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "b5de07c08e27cd0163da72bd3d6b45c1fae88e27", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/n0misain/6-1_source_from_JADX | 212 | FILENAME: ResetTweetCallback.java | 0.281406 | package com.twitter.sdk.android.tweetui;
import com.twitter.sdk.android.core.Callback;
import com.twitter.sdk.android.core.Result;
import com.twitter.sdk.android.core.TwitterException;
import com.twitter.sdk.android.core.models.Tweet;
class ResetTweetCallback extends Callback<Tweet> {
BaseTweetView baseTweetView;
Callback<Tweet> cb;
TweetRepository tweetRepository;
ResetTweetCallback(BaseTweetView baseTweetView, TweetRepository tweetRepository, Callback<Tweet> cb) {
this.baseTweetView = baseTweetView;
this.tweetRepository = tweetRepository;
this.cb = cb;
}
public void success(Result<Tweet> result) {
this.tweetRepository.updateCache((Tweet) result.data);
this.baseTweetView.setTweet((Tweet) result.data);
if (this.cb != null) {
this.cb.success(result);
}
}
public void failure(TwitterException exception) {
if (this.cb != null) {
this.cb.failure(exception);
}
}
}
|
fd148b8a-e9bd-4259-9808-ee6e1fda00ff | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-23 06:04:43", "repo_name": "synergytrainings18/patterns", "sub_path": "/Ani.Alaverdyan.Proxy/core/StatementProxy.java", "file_name": "StatementProxy.java", "file_ext": "java", "file_size_in_byte": 1095, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "74dbb79bf0ed9d5040960f098cfbacb889d9138d", "star_events_count": 0, "fork_events_count": 3, "src_encoding": "UTF-8"} | https://github.com/synergytrainings18/patterns | 211 | FILENAME: StatementProxy.java | 0.267408 | package Patterns.Proxy.core;
/**
* Created by ani.alaverdyan on 8/24/2018.
*/
public class StatementProxy implements Statement {
Person person;
Statement statementImplementation = new StatementImplementation();
public StatementProxy(Person person) {
this.person = person;
}
@Override
public void insert() {
if (person.isCanInsert()) {
statementImplementation.insert();
} else {
System.out.println(person.getName() + " You don't have permission for insert");
}
}
@Override
public void update() {
if (person.isCanUpdate()) {
statementImplementation.update();
} else {
System.out.println(person.getName() + " You don't have permission for update");
}
}
@Override
public void delete() {
if (person.isCanDelete()) {
statementImplementation.delete();
} else {
System.out.println(person.getName() + " You don't have permission for delete");
}
}
}
|
d30b036e-004d-47d2-a6fd-d0a160318223 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-27 07:21:58", "repo_name": "GimhaniU/GoogleChartsExamples", "sub_path": "/spring-webmvc/src/main/java/com/example/service/MockCustomerService.java", "file_name": "MockCustomerService.java", "file_ext": "java", "file_size_in_byte": 1086, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "b3094bbea4dbeb4ca53d84c0fb68dc87a33ef386", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/GimhaniU/GoogleChartsExamples | 190 | FILENAME: MockCustomerService.java | 0.264358 | package com.example.service;
import com.example.model.Customer;
import com.github.javafaker.Faker;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* Created by roshane on 11/3/16.
*/
@Service
public class MockCustomerService {
private static final Faker faker;
static {
faker = new Faker(Locale.ENGLISH, new Random(System.nanoTime()));
}
public List<Customer> getCustomers(int count) {
return IntStream.range(0, count)
.boxed()
.collect(Collectors.toList())
.stream()
.map((i) -> {
return new Customer(
System.nanoTime(),
faker.name().firstName(),
faker.name().lastName(),
faker.internet().emailAddress()
);
})
.collect(Collectors.toList());
}
}
|
62c9b3b8-a408-4ced-9b4f-92923a47bf27 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-21 08:19:20", "repo_name": "TaoTaoNie/MessThing", "sub_path": "/NIOStudy/src/server/SocketHandler.java", "file_name": "SocketHandler.java", "file_ext": "java", "file_size_in_byte": 1168, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "ce85fe8f3baaa937ad5c6b99ea59c2dca7a8abbb", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/TaoTaoNie/MessThing | 230 | FILENAME: SocketHandler.java | 0.259826 | package server;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
/**
* @author leetHuam
* @version 1.0
*/
public class SocketHandler implements Runnable {
private SocketChannel socketChannel;
public SocketHandler(SocketChannel socketChannel) {
this.socketChannel = socketChannel;
}
@Override
public void run() {
ByteBuffer buffer = ByteBuffer.allocate(1024);
try {
int num;
while ((num = socketChannel.read(buffer)) > 0) {
buffer.flip();
byte[] bytes = new byte[num];
buffer.get(bytes);
String result = new String(bytes, "UTF-8");
System.out.println("收到请求:" + result);
ByteBuffer writeBuffer = ByteBuffer.wrap(("我已经收到你的请求,你的请求内容是:" + result).getBytes());
socketChannel.write(writeBuffer);
buffer.clear();
}
}catch (IOException e) {
// e.printStackTrace();
}
}
}
|
14d3d3ea-9aa4-4b6d-8577-9143a4336672 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-22 07:38:43", "repo_name": "FallInLoveOfOne/project_2019", "sub_path": "/myjava/src/myjava/sms/Test.java", "file_name": "Test.java", "file_ext": "java", "file_size_in_byte": 1382, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "bfb2f195824cc81874d16e4f016aff443055a863", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "GB18030"} | https://github.com/FallInLoveOfOne/project_2019 | 370 | FILENAME: Test.java | 0.267408 | package myjava.sms;
import java.rmi.RemoteException;
import com.chinamobile.openmas.client.Sms;
public class Test {
public static void main(String[] args) throws RemoteException {
/*Sms sms = SmsProvider.getSms();
String[] destinationAddresses = new String[] { "18767090630" };
String message = "测试信息";
String GateWayid = sms.SendMessage(destinationAddresses, message, extendCodeSmsProvider.EXTENDCODE, SmsProvider.APPLICATIONID, SmsProvider.PASSWORD);
System.out.println("sendmessageId**********" + GateWayid);*/
try {
Sms sms = new Sms("http://hz009.openmas.net:9080/OpenMasService");//短信接口地址
String[] destinationAddresses = new String[] { "18767090630" };//发送对象:11数字手机号码
String message = "3435dsfdsfds发放的说法%%%88***";//短信内容
String extendCode = "2"; //自定义扩展码(模块),可以为空,将显示在手机终端来信号码末位,注:来信号码总长度不能超过20位
String ApplicationID = "8027002";//应用账号
String Password = "uepKATiRTLy8";//应用密码
// 发送短信 方法三
String GateWayid = "";
GateWayid = sms.SendMessage(destinationAddresses, message,
extendCode, ApplicationID, Password);
System.out.println(GateWayid);
} catch (Exception e) {
System.err.println(e);
}
}
}
|
bc76c325-60c4-452c-8bc4-3e1dd73bce55 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-08-07T14:30:53", "repo_name": "ory/dockertest", "sub_path": "/examples/CockroachDB.md", "file_name": "CockroachDB.md", "file_ext": "md", "file_size_in_byte": 975, "line_count": 35, "lang": "en", "doc_type": "text", "blob_id": "4e0d1b4a1ee0e62f7fc6d4b51219c1bd57256eb2", "star_events_count": 3414, "fork_events_count": 270, "src_encoding": "UTF-8"} | https://github.com/ory/dockertest | 273 | FILENAME: CockroachDB.md | 0.284576 | ```go
var db *sql.DB
var err error
pool, err := dockertest.NewPool("")
if err != nil {
log.Fatalf("Could not construct pool: %s", err)
}
err = pool.Client.Ping()
if err != nil {
log.Fatalf("Could not connect to Docker: %s", err)
}
resource, err := pool.RunWithOptions(&dockertest.RunOptions{Repository: "cockroachdb/cockroach", Tag: "v19.2.4", Cmd: []string{"start-single-node", "--insecure"}})
if err != nil {
log.Fatalf("Could not start resource: %s", err)
}
if err = pool.Retry(func() error {
var err error
db, err = sql.Open("postgres", fmt.Sprintf("postgresql://root@localhost:%s/defaultdb?sslmode=disable", resource.GetPort("26257/tcp")))
if err != nil {
return err
}
return db.Ping()
}); err != nil {
log.Fatalf("Could not connect to cockroach container: %s", err)
}
// When you're done, kill and remove the container
if err = pool.Purge(resource); err != nil {
log.Fatalf("Could not purge resource: %s", err)
}
```
|
84972311-a113-4857-8276-d283ac7b342e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-04-24T16:58:57", "repo_name": "Jmichael96/RPS-MULTIPLAYER", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1123, "line_count": 26, "lang": "en", "doc_type": "text", "blob_id": "85d9054d89f82f14b691ca2c1b58b51fa3c832d1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Jmichael96/RPS-MULTIPLAYER | 323 | FILENAME: README.md | 0.292595 | # RPS-MULTIPLAYER
## Click the link! Must have two players in order to play.
[Rock-Paper-Scissors](https://jmichael96.github.io/RPS-MULTIPLAYER/)
## HOW IT WORKS
Firebase is used to store all the data being implemented by the user. The name, chat and users selection (RPS)
is stored until the user leaves the page. The wins, losses and ties are also stored in firebase until the user exits the web page.
JQuery is used to render all the information that the user selects or inputs to the html along with initiating functions.

## LANGUAGES/LIBRARIES USED
- Firebase
- JavaScript
- JQuery
- HTML5
- Bootstrap
- CSS
## RULES:
Enter your name to get started! Once your opponent enters their name, one of the game panels will turn green which will prompt the player to choose Rock, Paper, or scissors. When your opponent selects their object you will be notified with a win, loss, or tie!
A chat box is also available to communicate to your competitor.
Good luck and have fun! :)
|
402418ed-409b-4b2e-a5d8-e5343cfdb5a1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-24 09:31:12", "repo_name": "g-smll/gang-mars-java", "sub_path": "/spring-boot-manual-annotation/src/main/java/com/gang/mars/bootstrap/CalculateServiceBootstrap.java", "file_name": "CalculateServiceBootstrap.java", "file_ext": "java", "file_size_in_byte": 971, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "4af6c297e371fa95460e9a08f3b0baa65a8a0538", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/g-smll/gang-mars-java | 181 | FILENAME: CalculateServiceBootstrap.java | 0.261331 | package com.gang.mars.bootstrap;
import com.gang.mars.service.CalculateService;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
/**
* @author gang.chen
* @description
* @time 2020/10/22 12:46
*/
@SpringBootApplication(scanBasePackages = "com.gang.mars.service")
public class CalculateServiceBootstrap {
public static void main(String[] args) {
ConfigurableApplicationContext context = new SpringApplicationBuilder(CalculateServiceBootstrap.class)
.web(WebApplicationType.NONE)
.profiles("Java8")
.run(args);
CalculateService calculateService = context.getBean(CalculateService.class);
System.out.println("calculateService ->" + calculateService);
context.close();
}
}
|
9c7f177b-4eb3-4f31-b223-41b787d516f2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-29 04:54:18", "repo_name": "Theerapat30/LabHostBaseCardEmulation", "sub_path": "/app/src/main/java/com/theerapat/labhostbasecardemulation/AccountStorage.java", "file_name": "AccountStorage.java", "file_ext": "java", "file_size_in_byte": 1031, "line_count": 26, "lang": "en", "doc_type": "code", "blob_id": "5cfef9105b2bf44f59a9e0b6f15a1932d26762b6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Theerapat30/LabHostBaseCardEmulation | 196 | FILENAME: AccountStorage.java | 0.245085 | package com.theerapat.labhostbasecardemulation;
import android.content.Context;
import android.content.SharedPreferences;
/**
* Created by theerapat on 11/26/2016.
*/
public class AccountStorage {
private static final String PREF_ACCOUNT = "com.theerapat.labhostbasecardemulation.pref.account";
private static final String KEY_ACCOUNT = "com.theerapat.labhostbasecardemulation.key.account";
private static final String DEFAULT_ACCOUNT = "000001";
public static String getAccount(Context context){
SharedPreferences preferences = context.getSharedPreferences(PREF_ACCOUNT, Context.MODE_PRIVATE);
String account = preferences.getString(KEY_ACCOUNT, DEFAULT_ACCOUNT);
return account;
}
public static void setAccount(Context context, String accountNum){
SharedPreferences preferences = context.getSharedPreferences(PREF_ACCOUNT, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putString(KEY_ACCOUNT, accountNum);
}
}
|
46751660-6f8d-427f-b5fd-e6f565c57890 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-07 15:49:33", "repo_name": "wezik/league-scout", "sub_path": "/src/main/java/com/lol/scout/config/CoreConfig.java", "file_name": "CoreConfig.java", "file_ext": "java", "file_size_in_byte": 1040, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "c29fba7f4719214ea88ef48c85453e15a31d3ccf", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wezik/league-scout | 193 | FILENAME: CoreConfig.java | 0.208179 | package com.lol.scout.config;
import com.google.gson.GsonBuilder;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
@Configuration
@EnableConfigurationProperties
@Getter
public class CoreConfig {
@Value("${images.directory}")
private String imagesDirectory;
@Value("${update.time.versions}")
private int updateTimeVersions;
@Value("${update.time.locales}")
private int updateTimeLocales;
@Value("${update.time.queues}")
private int updateTimeQueues;
@Value("${update.time.summoner-spells}")
private int updateTimeSummonerSpells;
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
@Bean
public GsonBuilder gsonBuilder() {
return new GsonBuilder();
}
}
|
4d26b6e3-c886-4837-8d51-8c1ce00df476 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-11-07 09:51:17", "repo_name": "WDXSS/wight", "sub_path": "/app/src/main/java/test/wightview/fragment/FragmentMainActivity.java", "file_name": "FragmentMainActivity.java", "file_ext": "java", "file_size_in_byte": 1207, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "29a41bbb1a2f8e4daea6b74c43d197a70f3e9abd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/WDXSS/wight | 243 | FILENAME: FragmentMainActivity.java | 0.240775 | package test.wightview.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import test.wightview.R;
/**
* 装在Fragment的Activity
* Created by zhouchao on 2016/9/22.
*/
public class FragmentMainActivity extends AppCompatActivity {
@BindView(R.id.button2)
Button button2;
@BindView(R.id.button1)
Button button1;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_main);
ButterKnife.bind(this);
}
@OnClick({R.id.button2, R.id.button1})
public void onClick(View view) {
switch (view.getId()) {
case R.id.button2:
Toast.makeText(this, button2.getText() ,Toast.LENGTH_SHORT).show();
break;
case R.id.button1:
Toast.makeText(this, button1.getText() ,Toast.LENGTH_SHORT).show();
break;
}
}
}
|
2ec518b3-0820-4bff-b923-9c4c4d7dcc05 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-09-09 03:18:35", "repo_name": "Unicorn-and-Rainbow/MerlionSystem", "sub_path": "/MerlionSystem/MerlionSystem-ejb/src/java/TMS/EntityTransportationSchedule.java", "file_name": "EntityTransportationSchedule.java", "file_ext": "java", "file_size_in_byte": 1076, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "8c339f63e2845c4f03714297b01ef7ebf64f0084", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Unicorn-and-Rainbow/MerlionSystem | 225 | FILENAME: EntityTransportationSchedule.java | 0.253861 | /*
* 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 TMS;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToOne;
/**
*
* @author phuongtung
*/
@Entity
public class EntityTransportationSchedule implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private Long transportationScheduleID;
@OneToOne
private EntityKPI kpi;
public EntityTransportationSchedule() {
this.setTransportationScheduleID(System.nanoTime());
}
public Long getTransportationScheduleID() {
return transportationScheduleID;
}
public void setTransportationScheduleID(Long transportationScheduleID) {
this.transportationScheduleID = transportationScheduleID;
}
public EntityKPI getKpi() {
return kpi;
}
public void setKpi(EntityKPI kpi) {
this.kpi = kpi;
}
}
|
72287542-e743-4758-b19c-ba0743ab7180 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-03 14:54:47", "repo_name": "Borisca/ProjetSpring-ProjetJava", "sub_path": "/HorlogePatternObserver/src/Temps.java", "file_name": "Temps.java", "file_ext": "java", "file_size_in_byte": 1123, "line_count": 79, "lang": "en", "doc_type": "code", "blob_id": "31fca6375a013b68cdbc8c12d099f3794486e09f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Borisca/ProjetSpring-ProjetJava | 334 | FILENAME: Temps.java | 0.277473 | import java.util.ArrayList;
import java.util.List;
public class Temps implements IObservable {
List<IObserver> observer = new ArrayList<>();
int heure = 0;
int minute = 0;
int seconde = 0;
Temps() {
}
public int getSeconde() {
return this.seconde;
}
public int getMinute() {
return this.minute;
}
public int getHeure() {
return this.heure;
}
public void lancementThread() {
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (this.seconde == 59) {
this.seconde = -1;
if (this.minute == 59) {
this.minute = -1;
this.seconde = -1;
if (this.heure == 59) {
this.heure = -1;
this.minute = -1;
this.seconde = -1;
}
this.heure += 1;
}
this.minute += 1;
}
this.seconde += 1;
notifier();
}
}
@Override
public void notifier() {
for (IObserver iObserver : observer) {
iObserver.update();
}
}
@Override
public void add(IObserver obs) {
observer.add(obs);
}
@Override
public void remove(IObserver obs) {
observer.remove(obs);
}
}
|
62a18a23-24db-46af-9ee0-cf30c707ad8c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-03 09:20:48", "repo_name": "luoleiCool/novel", "sub_path": "/src/main/java/com/luolei/novel/sys/domain/SysLog.java", "file_name": "SysLog.java", "file_ext": "java", "file_size_in_byte": 1246, "line_count": 63, "lang": "en", "doc_type": "code", "blob_id": "21e6f0b117c062124196b346b9905779fd9a7450", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/luoleiCool/novel | 253 | FILENAME: SysLog.java | 0.213377 | package com.luolei.novel.sys.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.io.Serializable;
import java.sql.Timestamp;
@Data
@TableName("sys_log")
@NoArgsConstructor
public class SysLog implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
private Integer id;
/** 操作用户 */
@TableField("user_name")
private String userName;
/** 描述 */
@TableField("description")
private String description;
/** 方法名 */
@TableField("method")
private String method;
/** 参数 */
@TableField("params")
private String params;
/** 请求ip */
@TableField("request_ip")
private String requestIp;
/** 地址 */
@TableField("address")
private String address;
/** 请求耗时 */
@TableField("time")
private String time;
/** 创建日期 */
@TableField("create_time")
private String createTime;
}
|
57dbf097-0432-4d16-8651-95627f7b54ef | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-30 06:53:06", "repo_name": "chaitanyagprasad/transaction-forecast-app", "sub_path": "/src/main/java/io/github/chait/transaction/controller/AccountPreferenceRestController.java", "file_name": "AccountPreferenceRestController.java", "file_ext": "java", "file_size_in_byte": 1012, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "ad1f1c3364e75347dc086c6d6a9752f3b5f5e970", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/chaitanyagprasad/transaction-forecast-app | 170 | FILENAME: AccountPreferenceRestController.java | 0.267408 | package io.github.chait.transaction.controller;
import io.github.chait.transaction.dto.InsightPreferenceDTO;
import io.github.chait.transaction.service.AccountPreferenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
@RestController
@RequestMapping("/preference")
public class AccountPreferenceRestController {
@Autowired
AccountPreferenceService accountPreferenceService;
@PostMapping("/{dateStr}")
public void setPreference(@RequestBody InsightPreferenceDTO dto,@PathVariable("dateStr") String dateStr) {
this.accountPreferenceService.saveAccountPreference(dto, LocalDate.parse(dateStr));
}
@GetMapping("/{accountId}")
public ResponseEntity<InsightPreferenceDTO> getPreference(@PathVariable("accountId") String accountId) {
return ResponseEntity.ok(accountPreferenceService.getPreference(accountId));
}
}
|
37f7bf10-7b05-4d4b-ac49-d3583cfe07ad | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-24 10:27:34", "repo_name": "shivam-tripathi/design-patterns", "sub_path": "/java/headfirst/src/main/java/com/patterns/observer/SwingObservableExample.java", "file_name": "SwingObservableExample.java", "file_ext": "java", "file_size_in_byte": 1023, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "6bf7d2d077ac0d8ceeed31ebdbd33c0d2d6361f0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/shivam-tripathi/design-patterns | 198 | FILENAME: SwingObservableExample.java | 0.255344 | package com.patterns.observer;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class SwingObservableExample {
JFrame frame;
public void go() {
frame = new JFrame();
frame.setTitle("Swing Observable Example");
JButton button = new JButton("Should I do it?");
button.addActionListener(new AngelListener());
button.addActionListener(new DevilListener());
frame.add(button);
frame.setSize(300, 200);
frame.setLocation(200, 200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
class AngelListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
System.out.printf("Don't do it, you might regret it!%n");
}
}
class DevilListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
System.out.printf("Come on, do it!%n");
}
}
}
|
b2edd7fe-5db9-49be-b043-355cae535f10 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-17 08:27:59", "repo_name": "ILoveStudyAndWork/B-basic-quiz", "sub_path": "/src/main/java/com/thoughtworks/gtb/bbasicquiz/controller/EducationController.java", "file_name": "EducationController.java", "file_ext": "java", "file_size_in_byte": 1225, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "cd15b3959aa9d8a2f0165efda371f6a7d41403cb", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ILoveStudyAndWork/B-basic-quiz | 237 | FILENAME: EducationController.java | 0.286968 | package com.thoughtworks.gtb.bbasicquiz.controller;
import com.thoughtworks.gtb.bbasicquiz.domain.Education;
import com.thoughtworks.gtb.bbasicquiz.exception.UserNotExistException;
import com.thoughtworks.gtb.bbasicquiz.service.EducationService;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@CrossOrigin
@RestController
public class EducationController {
private final EducationService educationService;
public EducationController(EducationService educationService) {
this.educationService = educationService;
}
@PostMapping("/users/{userId}/educations")
@ResponseStatus(HttpStatus.CREATED)
public Education addEducationById(@PathVariable long userId, @RequestBody @Valid Education education) throws UserNotExistException {
return educationService.addEducationById(userId,education);
}
@GetMapping("/users/{userId}/educations")
// GTB: - 名字粘贴-复制之后忘改了吧 addEducationById
public List<Education> addEducationById(@PathVariable long userId) throws UserNotExistException {
return educationService.getEducationById(userId);
}
}
|
ae5c2302-8ac5-4077-88a2-4fa3d35cf68b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-05-02 09:57:59", "repo_name": "dnmy/spring-activemq", "sub_path": "/src/main/java/com/sh/lmg/ConsumerListener.java", "file_name": "ConsumerListener.java", "file_ext": "java", "file_size_in_byte": 1091, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "0899ec04985c3f386a73dd84fc6dc4417146a728", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dnmy/spring-activemq | 203 | FILENAME: ConsumerListener.java | 0.225417 | package com.sh.lmg;
import org.springframework.stereotype.Component;
import javax.jms.*;
import java.util.concurrent.TimeUnit;
/**
* Created by liaomengge on 16/5/1.
*/
@Component("consumerListener")
public class ConsumerListener implements MessageListener {
public void onMessage(Message message) {
try {
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (message instanceof TextMessage) {
TextMessage textMessage = (TextMessage) message;
try {
System.out.println("receive message : " + textMessage.getText());
} catch (JMSException e) {
e.printStackTrace();
}
} else if (message instanceof ObjectMessage) {
ObjectMessage objectMessage = (ObjectMessage) message;
try {
System.out.println("receive message : " + objectMessage.getObject().toString());
} catch (JMSException e) {
e.printStackTrace();
}
}
}
}
|
3581755e-024f-4bf6-8e5e-3d61976affa9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-17 07:15:34", "repo_name": "WmCodes/litespring", "sub_path": "/src/main/java/org/litespring/beans/factory/support/DefaultsSingletonBeanRegistry.java", "file_name": "DefaultsSingletonBeanRegistry.java", "file_ext": "java", "file_size_in_byte": 1123, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "660a10ef9e813f36b5edf012e42cf44887bc2222", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/WmCodes/litespring | 236 | FILENAME: DefaultsSingletonBeanRegistry.java | 0.289372 | package org.litespring.beans.factory.support;
import org.litespring.beans.factory.config.SingletonBeanRegistry;
import org.litespring.utill.Assert;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author wangmeng
* @date 2019/5/15
* @desciption
*/
public class DefaultsSingletonBeanRegistry implements SingletonBeanRegistry {
private final Map<String, Object> singletonObjects = new ConcurrentHashMap<String, Object>(64);
@Override
public void regitserSingleton(String beanName, Object singletonObject) {
Assert.notNull(beanName, "'beanName' must not be null ");
Object oldObject = this.singletonObjects.get(beanName);
if (oldObject != null){
throw new IllegalStateException("Could not register object [" + singletonObject +
"] under bean name '" + beanName + "': there is already object [" + oldObject + "] bound");
}
this.singletonObjects.put(beanName,singletonObject);
}
@Override
public Object getSingleton(String beanName) {
return this.singletonObjects.get(beanName);
}
}
|
22cb6c5f-923d-4397-9b29-33426a05be4f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-24 10:02:52", "repo_name": "green-fox-academy/piotriljics", "sub_path": "/week-08/Day-04/src/main/java/com/greenfoxacademy/thereddit/Model/Assignee.java", "file_name": "Assignee.java", "file_ext": "java", "file_size_in_byte": 1117, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "b7dc203be62103bcb9a3d63fbec7aadd6af664a7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/green-fox-academy/piotriljics | 242 | FILENAME: Assignee.java | 0.262842 | package com.greenfoxacademy.thereddit.Model;
import org.hibernate.engine.profile.Fetch;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Entity
public class Assignee {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String username;
@OneToMany (fetch = FetchType.EAGER,cascade = CascadeType.ALL)
List<Posts> postsList = new ArrayList<>();
public Assignee() {
}
public Assignee(String username) {
this.username = username;
}
public Assignee(String username, List<Posts> postsList) {
this.username = username;
this.postsList = postsList;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public List<Posts> getPostsList() {
return postsList;
}
public void setPostsList(List<Posts> postsList) {
this.postsList = postsList;
}
}
|
85eac698-dd9c-4bad-88d8-c6b271b3c8f4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-19 12:45:31", "repo_name": "angeleskilija/Translator", "sub_path": "/app/src/main/java/com/example/ilijaangeleski/translator/manager/TranslateManager.java", "file_name": "TranslateManager.java", "file_ext": "java", "file_size_in_byte": 1202, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "9f78b76279d538592565f64a86b6a812a02fdcfc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/angeleskilija/Translator | 245 | FILENAME: TranslateManager.java | 0.290176 | package com.example.ilijaangeleski.translator.manager;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Ilija Angeleski on 11/18/2017.
*/
public class TranslateManager {
static Map<String,String> translation = new HashMap<String, String>();
private static void fillLanguages() {
translation.put("dog", "kuce");
translation.put("cat", "macka");
translation.put("frog", "zaba");
translation.put("car", "kola");
translation.put("you", "ti");
}
static {
fillLanguages();
}
public String getTranslation(String text){
return translation.get(text.toLowerCase().trim());
}
public String translateSentance(String text){
StringBuilder translatedSentance = new StringBuilder();
String[] words = text.split(" ");
for(String word : words){
String translatedWord = translation.get(word.toLowerCase().trim());
if(translatedWord != null){
translatedSentance.append(translatedWord + " ");
}else {
translatedSentance.append(word + " ");
}
}
return translatedSentance.toString();
}
}
|
49e5a98b-6c11-4b3f-b679-55137b6e33de | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-22 22:51:19", "repo_name": "adrianomr/ControleAcoes", "sub_path": "/src/main/java/br/com/adrianorodrigues/controleacoes/service/CotacaoAtualService.java", "file_name": "CotacaoAtualService.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 28, "lang": "en", "doc_type": "code", "blob_id": "c954e700331d8c4081324e445f5daf67f4465b8c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/adrianomr/ControleAcoes | 261 | FILENAME: CotacaoAtualService.java | 0.275909 | package br.com.adrianorodrigues.controleacoes.service;
import br.com.adrianorodrigues.controleacoes.dto.CotacaoAtualDTO;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@Component
public class CotacaoAtualService {
public CotacaoAtualDTO getCotacaoAtual(String acao) throws IOException {
acao = acao.endsWith("F") ? acao.substring(0, acao.length() - 1) : acao;
Document doc = Jsoup.connect("https://finance.yahoo.com/quote/" + acao + ".SA/?p=" + acao + ".SA").get();
Elements quoteHeader = doc.select("#quote-header-info");
List<String> strings = new ArrayList<>();
quoteHeader.first().getAllElements().forEach(element -> strings.add(element.text()));
Double cotacao = Double.parseDouble(strings.get(28));
CotacaoAtualDTO cotacaoAtualDTO = new CotacaoAtualDTO();
cotacaoAtualDTO.setPapel(acao);
cotacaoAtualDTO.setCotacao(cotacao);
return cotacaoAtualDTO;
}
}
|
99b02f9f-a2fa-44e8-ac2e-8cd53e90a0bf | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-10 09:47:09", "repo_name": "mehidee0041/Automation-Mehidee", "sub_path": "/bongo/src/main/java/TestPack/ClickArbitraryContent.java", "file_name": "ClickArbitraryContent.java", "file_ext": "java", "file_size_in_byte": 983, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "532693f254dad5412ea42966c65f5945feab97f2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mehidee0041/Automation-Mehidee | 208 | FILENAME: ClickArbitraryContent.java | 0.291787 | package TestPack;
import org.openqa.selenium.WebDriver;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.WebElement;
public class ClickArbitraryContent {
// private static LoginBongo login;
WebDriver driver;
public void linksclick() throws Exception{
System.setProperty("webdriver.chrome.driver", "C:\\selenium-java-3.6.0\\chromedriver\\chromedriver.exe");
driver = new ChromeDriver();
String baseUrl = "https://www.bongobd.com/";
driver.get(baseUrl);
List<WebElement> allLinks = driver.findElements(By.tagName("a"));
System.out.println("All Links--> " + allLinks.size());
driver.findElement(By.cssSelector("a[href*='watch']")).click();
driver.close();
}
public static void main(String[] args) throws Exception {
ClickArbitraryContent obj = new ClickArbitraryContent();
obj.linksclick();
}
}
|
01a2ada8-50ca-455d-ad0b-909255430a70 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-13 07:23:03", "repo_name": "ashishranjan27/basicOfAndroid", "sub_path": "/fragment/Mess_from_activitytofragment2/app/src/main/java/com/example/mess_from_activitytofragment2/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "d4eaf6d5a741bf1ea94370acaa679fea7a49854f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ashishranjan27/basicOfAndroid | 178 | FILENAME: MainActivity.java | 0.242206 | package com.example.mess_from_activitytofragment2;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentTransaction;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
private EditText medit;
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
medit = findViewById(R.id.etusername);
button = findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
firstFragment first = new firstFragment();
FragmentTransaction tra = getSupportFragmentManager().beginTransaction();
tra.replace(R.id.frag_container,first);
tra.commit();
String mess = medit.getText().toString();
first.setData(mess);
}
});
}
} |
66e9b3ca-8653-4378-b35e-87de1f336cbb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-24 14:36:46", "repo_name": "mecozma/UserProfile", "sub_path": "/app/src/main/java/com/example/android/userprofile/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1076, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "1b88a8ecec6c4acd6673b163940ff2ddde572513", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mecozma/UserProfile | 195 | FILENAME: MainActivity.java | 0.200558 | package com.example.android.userprofile;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/**
* Profile ImageView
*/
ImageView profileImage = (ImageView) findViewById(R.id.profileImage);
profileImage.setImageResource(R.drawable.img1);
/**
* Textview for name
*/
TextView name = (TextView) findViewById(R.id.name);
name.setText("Eduard");
/**
* Textview for birthday
*/
TextView birthday = (TextView) findViewById(R.id.birthday);
birthday.setText("07/08/1985");
/**
* Textview for country
*/
TextView country = (TextView) findViewById(R.id.country);
country.setText("Romania");
}
}
|
dd622f91-c8d8-4bc1-8868-026ff6213f7d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-23 20:38:49", "repo_name": "luctram/SearchService", "sub_path": "/app/src/main/java/com/lkmt/tramluc/searchservice/Services.java", "file_name": "Services.java", "file_ext": "java", "file_size_in_byte": 1204, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "e08e9cf4f1c30bda19b768b97aa4417ca40796dd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/luctram/SearchService | 260 | FILENAME: Services.java | 0.249447 | package com.lkmt.tramluc.searchservice;
import com.lkmt.tramluc.searchservice.ModelDetailPlace.Reviews;
public class Services {
public String typeServiceId;
public String cityId;
public String serviceId; // auto từ firebase
public String serviceName;
public double lat;
public double lng;
public String phone;
public String address;
public int rate;
public Reviews review;
public String describe;
public int countLike;
public String website;
// public img
public Services() {
}
public Services(String typeServiceId, String cityId, String serviceId, String serviceName, double lat, double lng, String phone, String address, int allRate, Reviews review, String describe, int countLike, String website) {
this.typeServiceId = typeServiceId;
this.cityId = cityId;
this.serviceId = serviceId;
this.serviceName = serviceName;
this.lat = lat;
this.lng = lng;
this.phone = phone;
this.address = address;
this.rate = allRate;
this.review = review;
this.describe = describe;
this.countLike = countLike;
this.website = website;
}
}
|
358b3ebb-f558-4973-9386-05f48c8520d2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-23 00:12:33", "repo_name": "lenik/stack", "sub_path": "/zebra/layer-2/zebra-io/src/main/java/com/bee32/zebra/io/stock/StockEntry.java", "file_name": "StockEntry.java", "file_ext": "java", "file_size_in_byte": 1063, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "3b553bd9c459e7d4a6879397eed731616da8c730", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lenik/stack | 249 | FILENAME: StockEntry.java | 0.282988 | package com.bee32.zebra.io.stock;
import javax.persistence.Table;
import net.bodz.lily.entity.IdType;
import net.bodz.lily.model.base.CoMomentInterval;
import com.bee32.zebra.io.art.Artifact;
/**
* 库存操作项目
*/
@IdType(Long.class)
@Table(name = "stentry")
public class StockEntry
extends CoMomentInterval<Long> {
private static final long serialVersionUID = 1L;
public static final int N_BATCH = 30;
public static final int N_DIVS = 100;
StockEvent event;
Artifact artifact;
Place place;
String batch;
String divs;
double quantity;
double price;
@Override
public void instantiate() {
setAccessMode(M_SHARED);
}
public double getQuantity() {
return quantity;
}
public void setQuantity(double quantity) {
this.quantity = quantity;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getTotal() {
return quantity * price;
}
} |
7f22091c-8940-44f6-962a-4b9e466205ba | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-13 07:17:07", "repo_name": "JosephEJohnston/design-pattern", "sub_path": "/src/main/java/ch13_Visitor/visitor/ListVisitor.java", "file_name": "ListVisitor.java", "file_ext": "java", "file_size_in_byte": 1051, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "7c6a06a38b9e2a712a4d6f84f3abdd123db12fb6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JosephEJohnston/design-pattern | 224 | FILENAME: ListVisitor.java | 0.290176 | package ch13_Visitor.visitor;
import ch13_Visitor.entry.Directory;
import ch13_Visitor.entry.ElementArrayList;
import ch13_Visitor.entry.Entry;
import ch13_Visitor.entry.File;
import java.util.Iterator;
public class ListVisitor extends Visitor {
private String currentDir = "";
@Override
public void visit(File file) {
System.out.println(currentDir + "/" + file);
}
@Override
public void visit(Directory directory) {
System.out.println(currentDir + "/" + directory);
String saveDir = currentDir;
currentDir = currentDir + "/" + directory.getName();
Iterator<Entry> it = directory.iterator();
while (it.hasNext()) {
Entry entry = it.next();
entry.accept(this);
}
currentDir = saveDir;
}
@Override
public void visit(ElementArrayList list) {
Iterator<Entry> iterator = list.iterator();
while (iterator.hasNext()) {
Entry entry = iterator.next();
entry.accept(this);
}
}
}
|
8de24cc9-404b-438c-abb5-83de20f4162e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-06-07 16:38:32", "repo_name": "proyt2016/AppGuarda", "sub_path": "/app/src/main/java/com/fedoraapps/www/appguarda/Api/UsuarioApi.java", "file_name": "UsuarioApi.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "a1b9a79ab4028cf6405b3bd6366721f10d073dcc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/proyt2016/AppGuarda | 237 | FILENAME: UsuarioApi.java | 0.272799 | package com.fedoraapps.www.appguarda.Api;
import com.fedoraapps.www.appguarda.Model.Usuario;
import okhttp3.OkHttpClient;
import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.http.GET;
import retrofit2.http.Path;
/**
* Created by andres on 14/5/16.
*/
public class UsuarioApi {
private static UsuarioApiInterface usuarioService;
private static OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
public static UsuarioApiInterface createService() {
if (usuarioService == null) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("http://574f74b25dd0e51100a9408c.mockapi.io")
.addConverterFactory(GsonConverterFactory.create())
.client(httpClient.build())
.build();
usuarioService = retrofit.create(UsuarioApiInterface.class);
}
return usuarioService;
}
public interface UsuarioApiInterface {
@GET("/usuarios/{id}")
Call<Usuario> getByUsuario(@Path("id") int id);
}
} |
518f2b52-6b41-4de4-a6c9-fe606f95704c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-10-31T15:05:55", "repo_name": "thanhryot/php-design-patterns", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1066, "line_count": 34, "lang": "en", "doc_type": "text", "blob_id": "b1005dacb9b0d16a99fe862fd2fac7a8ae2d947f", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/thanhryot/php-design-patterns | 305 | FILENAME: README.md | 0.290981 | # PHP Design Patterns
List of simple examples of design patterns built in PHP.
### [Creational](src/Creational)
* [AbstractFactory](src/Creational/AbstractFactory)
* [Builder](src/Creational/Builder)
* [FactoryMethod](src/Creational/FactoryMethod)
* [Prototype](src/Creational/Prototype)
* [Singleton](src/Creational/Singleton)
### [Structural](src/Structural)
* [Adapter](src/Structural/Adapter)
* [Bridge](src/Structural/Bridge)
* [Composite](src/Structural/Composite)
* [Decorator](src/Structural/Decorator)
* [Facade](src/Structural/Facade)
* [Flyweight](src/Structural/Flyweight)
* [Proxy](src/Structural/Proxy)
### [Behavioral](src/Behavioral)
* [ChainOfResponsibilities](src/Behavioral/ChainOfResponsibilities)
* [Command](src/Behavioral/Command)
* [Iterator](src/Behavioral/Iterator)
* [Mediator](src/Behavioral/Mediator)
* [Memento](src/Behavioral/Memento)
* [Observer](src/Behavioral/Observer)
* [State](src/Behavioral/State)
* [Strategy](src/Behavioral/Strategy)
* [TemplateMethod](src/Behavioral/TemplateMethod)
* [Visitor](src/Behavioral/Visitor)
|
52657d64-1427-4efd-8f08-e6b1facbc097 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2022-09-23T15:33:32", "repo_name": "Zenika/github-insights", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1202, "line_count": 49, "lang": "en", "doc_type": "text", "blob_id": "2b980101c37394d206f379bfbd1ea07b6b2dfbf4", "star_events_count": 6, "fork_events_count": 10, "src_encoding": "UTF-8"} | https://github.com/Zenika/github-insights | 293 | FILENAME: README.md | 0.271252 | # Why
This repository is a try to get insights on an GitHub organization and its members.
# Getting started
Install dependencies using `yarn`
```
yarn
```
# How to use in command line
Create an `.env` file
```
GITHUB_ID=<github_id>
GITHUB_OAUTH=<oauth to access the API>
GITHUB_ORGA=<name of the organization>
GITHUB_WEBSITE=<repository name of the website>
GITHUB_WEBSITE_ORGA=<name of the website orga>
```
If you do not know how to get the `GITHUB_OAUTH`, please see this [page](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line).
You have to create a token with the `read:org` access.
# Usage
The following command allows you to get information on your organization. The generated files may be found in the `data` folder.
```
yarn start <organization_name>
```
The following command allows you to get insights from your organization's information.
```
yarn stats
```
You may also run the following command to generate a `stats.json` file containing the same insights:
```
yarn stats:file
```
You can add the organisazation name in the .env file. In this case use the key `GITHUB_ORGA`. If both choices are set the env variable will be taken.
|
e8c3007f-c9a6-43ad-abfc-907d7c3a8d34 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-11-08T17:57:51", "repo_name": "axelnetwork/AXEL", "sub_path": "/contrib/axel-blockchain-enhancement/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1016, "line_count": 24, "lang": "en", "doc_type": "text", "blob_id": "74140a8cc6f6ea25c6525ae32f48ab323ffeb56a", "star_events_count": 17, "fork_events_count": 6, "src_encoding": "UTF-8"} | https://github.com/axelnetwork/AXEL | 257 | FILENAME: README.md | 0.26588 | # axel-blockchain-enhancement
A demo for storing/getting data to/from AXEL blockchain with using OP_RETURN, and extra demo of file signing/verifying based on *signmessage* and *verifymessage* AXEL blockchain API calls
## Sending your message to AXEL blockchain
`node ./send.js --rpcuser=<your_rpcuser> --rpcpassword=<your_rpcpassword> --msg=<your_msg>`
## Searching for your message inside AXEL blockchain
`node ./show.js --rpcuser=<your_rpcuser> --rpcpassword=<your_rpcpassword>`
## Demo (screenshot)
[Demo log during executing on testnet](demo-testnet.md).

## File signing based on *signmessage* AXEL blockchain API call
`node ./sign-file.js --rpcuser=<my_rpcuser> --rpcpassword=<my_rpcpassword> --address=<your_address> --file=<your_file>`
## File verifying based on *verifymessage* AXEL blockchain API call
`node ./verify-file.js --rpcuser=<my_rpcuser> --rpcpassword=<my_rpcpassword> --address=<your_address> --sig=<your_sig> --file=<your_file>`
|
6c621958-b921-474d-b63f-489261566314 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-22 00:22:23", "repo_name": "Oguzh4n/Multiplayer-Racing-Game-", "sub_path": "/SimulatorServer/src/Server/ServerImpl.java", "file_name": "ServerImpl.java", "file_ext": "java", "file_size_in_byte": 1121, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "9b5955f4a4f43ecbdcb763a54a746eb8536bde1d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Oguzh4n/Multiplayer-Racing-Game- | 218 | FILENAME: ServerImpl.java | 0.292595 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Server;
import java.rmi.RemoteException;
import java.rmi.server.RemoteServer;
import java.rmi.server.ServerNotActiveException;
import java.util.logging.Level;
import java.util.logging.Logger;
import Data.RaceTrack;
import Interfaces.Server;
import Interfaces.Client;
public class ServerImpl implements Server {
Client client;
public ServerImpl(Client client) {
this.client = client;
}
@Override
public void sendString(String data) throws RemoteException {
try {
String mesg = String.format("String sent by %s, data: %s",
RemoteServer.getClientHost(), data);
System.out.println(mesg);
ServerMethods.sendString(this, data);
} catch (ServerNotActiveException ex) {
Logger.getLogger(ServerImpl.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
|
d2a79993-e461-4634-9eae-7ce2a098f88b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-08-29 10:11:28", "repo_name": "hanqunfeng/springbootchapter", "sub_path": "/chapter53/src/main/java/com/example/controller/DemoController.java", "file_name": "DemoController.java", "file_ext": "java", "file_size_in_byte": 1018, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "c713920de62c6f0c0173110afc45fe6dc8bf6310", "star_events_count": 9, "fork_events_count": 10, "src_encoding": "UTF-8"} | https://github.com/hanqunfeng/springbootchapter | 211 | FILENAME: DemoController.java | 0.226784 | package com.example.controller;
import com.example.support.OssResult;
import com.example.support.OssTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* <h1></h1>
* Created by hanqf on 2021/7/25 23:48.
*/
@RestController
public class DemoController {
@Resource(name = "aliyun")
OssTemplate ossTemplate;
@PostMapping("/file")
public List<OssResult> file(MultipartFile[] multipartFiles){
List<OssResult> list = new ArrayList<>();
if(multipartFiles!=null&&multipartFiles.length>0){
for(MultipartFile multipartFile:multipartFiles){
final OssResult ossResult = ossTemplate.uploadFile(multipartFile, multipartFile.getOriginalFilename());
list.add(ossResult);
}
}
return list;
}
}
|
d2db7800-0a87-4fcc-9740-5a0e625d8973 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-26 16:59:57", "repo_name": "ReneRanzinger/MeetingRegistration", "sub_path": "/src/main/java/org/registration/service/ConferenceManagerImpl.java", "file_name": "ConferenceManagerImpl.java", "file_ext": "java", "file_size_in_byte": 1029, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "b35aaca3c0a34590b6cf62e8cb68e5632bef232b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ReneRanzinger/MeetingRegistration | 178 | FILENAME: ConferenceManagerImpl.java | 0.295027 | package org.registration.service;
import java.util.List;
import org.registration.persistence.ConferenceEntity;
import org.registration.persistence.dao.ConferenceRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional(value="jpaTransactionManager")
public class ConferenceManagerImpl implements ConferenceManager {
@Autowired
ConferenceRepository repository;
@Override
public void createConference(ConferenceEntity newConference) {
repository.save(newConference);
}
@Override
public ConferenceEntity findByConferenceCode(String conferenceCode) {
return repository.findByConferenceCode(conferenceCode);
}
@Override
public List<ConferenceEntity> findAllConferences() {
return repository.findAll();
}
@Override
public ConferenceEntity findByConferenceId(Long conferenceId) {
return repository.findByConferenceId(conferenceId);
}
}
|
5062e231-cad6-452f-8139-5b07eaaa3a0b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-08-14T04:14:12", "repo_name": "totovr/old_site", "sub_path": "/_posts/2018-04-16-Kinect-V2.md", "file_name": "2018-04-16-Kinect-V2.md", "file_ext": "md", "file_size_in_byte": 1109, "line_count": 45, "lang": "en", "doc_type": "text", "blob_id": "7c6d3397671ecdd42e99ffdcb569bc26f05fc6b8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/totovr/old_site | 291 | FILENAME: 2018-04-16-Kinect-V2.md | 0.256832 | SimpleOpenni is now compatible with Kinect V2
##### Manual installation to use Kinect V2 with SimpleOpenni
> Just comptaible with Mac OS
- Install homebrew:
```
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
- Make sure these build tools are available:
1. wget
2. git
3. cmake
4. pkg-config
> Xcode may provide some of them. Install the rest via package managers (homebrew).
- Install dependencies: libusb, GLFW
```
brew update
brew install libusb
brew tap homebrew/versions
brew install glfw3
```
- Install TurboJPEG (optional)
```
brew install jpeg-turbo
```
- Install CUDA (optional): TODO
- Install OpenNI2 (optional)
```
brew tap brewsci/science
brew install openni2
export OPENNI2_REDIST=/usr/local/lib/ni2
export OPENNI2_INCLUDE=/usr/local/include/ni2
```
##### After have done all the steps that are metioned above just clone the repository of [SimpleOpenni](https://github.com/totovr/SimpleOpenni/tree/Processing_3.3.7) in your ***libraries*** folder of ***Processing***
|
ec4679e0-f06e-4dc6-b824-1bd8ec6d3fe0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-15 08:20:04", "repo_name": "43907800/zfile", "sub_path": "/src/main/java/im/zhaojun/zfile/controller/home/ErgodicDirController.java", "file_name": "ErgodicDirController.java", "file_ext": "java", "file_size_in_byte": 1092, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "231387ab6b60b1c6cbfedbde63d5a1122cf23602", "star_events_count": 6, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/43907800/zfile | 250 | FILENAME: ErgodicDirController.java | 0.20947 | package im.zhaojun.zfile.controller.home;
import im.zhaojun.zfile.model.entity.ErgodicDirConfig;
import im.zhaojun.zfile.model.support.ResultBean;
import im.zhaojun.zfile.service.ErgodicDirService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author by LiuSy
* @Date 2021/4/28 11:14
* @Classname ErgodicDirController
* @Description
*/
@RestController
@RequestMapping("/api")
public class ErgodicDirController {
@Resource
ErgodicDirService ergodicDirService;
/**
* 保存
*/
@PostMapping("/ergodic")
public ResultBean save(@RequestBody ErgodicDirConfig ergodicDirConfig){
ergodicDirService.save(ergodicDirConfig);
return ResultBean.success();
}
/**
* 查询所有类型
* @return
*/
@GetMapping("/ergodic/category")
public ResultBean findCategory(){
List<String> category = ergodicDirService.findCategory();
return ResultBean.success(category);
}
}
|
3f894874-7348-4507-aa0e-2485667de6c0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-27 09:57:28", "repo_name": "Ninja-Predator/Api-Atlantis", "sub_path": "/src/main/java/com/shineyue/Main.java", "file_name": "Main.java", "file_ext": "java", "file_size_in_byte": 1139, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "d1f7ceaccfdd0f53483540360399fe480cd88020", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Ninja-Predator/Api-Atlantis | 236 | FILENAME: Main.java | 0.255344 | package com.shineyue;
import com.shineyue.commands.commands.Demo;
import com.shineyue.commands.commands.Demo2;
import com.shineyue.listener.*;
import org.bukkit.command.PluginCommand;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getLogger().info("加载成功");
PluginCommand cmdDemo = getCommand("demo");
cmdDemo.setExecutor(new Demo());
PluginCommand cmdDemo2 = getCommand("demo2");
cmdDemo2.setExecutor(new Demo2());
regListeners(new JoinListener(), new SkeletonShootListener()
, new BoomerHitListener(), new PlayerOnHitListener(), new PlayerSuperHeroListener()
, new EntityDieListener(), new EntityResistanceListener());
}
private void regListeners(Listener... listeners) {
for (Listener listener : listeners) {
getServer().getPluginManager().registerEvents(listener, this);
}
}
@Override
public void onDisable() {
getLogger().info("卸载成功");
}
}
|
4c269b4d-18e5-4249-8697-2caf5e1c5710 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-09-21 06:23:27", "repo_name": "ASO1501023/TwoTouchMail", "sub_path": "/app/src/main/java/jp/ac/asojuku/st/twotouthmail/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1202, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "eb53f16b444b1dd0287630fd4b21356d82f0cc03", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ASO1501023/TwoTouchMail | 205 | FILENAME: MainActivity.java | 0.240775 | package jp.ac.asojuku.st.twotouthmail;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import jp.ac.asojuku.st.twotouchmail.R;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnPicUp = (Button) this.findViewById(R.id.button1);
btnPicUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, PickUpActivity.class);
startActivity(intent);
}
});
Button btnNoDinner =(Button)this.findViewById(R.id.button2);
btnNoDinner.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v){
Intent intent = new Intent(MainActivity.this,NoDinnerActivity.class);
startActivity(intent);
}
});
}
}
|
5d5cb241-99d7-4a41-b901-15b7e6dee51c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-08-17T21:23:26", "repo_name": "maap93/labyrinthGame", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1123, "line_count": 20, "lang": "en", "doc_type": "text", "blob_id": "fdcdb8ecec1125954a8af02bb12db6fe46a59816", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/maap93/labyrinthGame | 409 | FILENAME: README.md | 0.262842 | # labyrinthGame
2D Videogame develop for the Videogame development course at ITESM Campus Queretaro in the 2014 Spring Semester.
Disclaimer Policy: I Do not own the music in this game or the assets(art).
The use of the music and the assets(art) its only for eduacation (School Project) and it is used under the Fair Use law. "Copyright Disclaimer Under Section 107 of the Copyright Act 1976, allowance is made for "fair use" for purposes such as criticism, comment, news reporting, teaching, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favor of fair use."
Screenshots



|
54389eef-c732-403b-8c99-68f15e0d4e09 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-10-11T22:42:40", "repo_name": "volkanb/tweeter", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1202, "line_count": 31, "lang": "en", "doc_type": "text", "blob_id": "85b7486e9cfc258cd3e3945cc97dcec7593e42dd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/volkanb/tweeter | 343 | FILENAME: README.md | 0.235108 | # Tweeter Project
Tweeter is a simple, single-page Twitter clone.
This repository is the starter code for the project: Students will fork and clone this repository, then build upon it to practice their HTML, CSS, JS, jQuery and AJAX front-end skills, and their Node, Express and MongoDB back-end skills.
## Getting Started
1. Fork this repository, then clone your fork of this repository.
2. Install dependencies using the `npm install` command.
3. Start the web server using the `npm run local` command. The app will be served at <http://localhost:8080/>.
4. Go to <http://localhost:8080/> in your browser.
## Dependencies
- body-parser
- chance
- Express
- md5
- Node 5.10.x or above
## Final Product
Screenshot of desktop version of the homepage

Screenshot of tablet version of the homepage

Screenshot of an error message

|
655dca97-c696-44fa-99b2-5e0f52353ea0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-13 06:50:30", "repo_name": "developerandroid9/TestExample", "sub_path": "/app/src/main/java/com/example/suneel/testexample/FragmentMilstone.java", "file_name": "FragmentMilstone.java", "file_ext": "java", "file_size_in_byte": 1012, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "26411acac909d6680aed2668f3914444ffdcde45", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/developerandroid9/TestExample | 165 | FILENAME: FragmentMilstone.java | 0.221351 | package com.example.suneel.testexample;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class FragmentMilstone extends Fragment {
public static FragmentMilstone newInstance() {
return new FragmentMilstone();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_fragment_milstone, container, false);
RecyclerView recyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_view);
AdapterMileStone mAdapter = new AdapterMileStone();
recyclerView.setAdapter(mAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
return rootView;
}
}
|
69f3f223-736a-463a-8591-a3d67f07144d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-16 23:46:36", "repo_name": "ALEXGREENCH/mvp_pattern", "sub_path": "/app/src/main/java/com/github/alexgreench/mvppattern/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1013, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "4ab80bcc4568cb7366b2d0aa3cbc1a5a4f80d4f1", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ALEXGREENCH/mvp_pattern | 174 | FILENAME: MainActivity.java | 0.23793 | package com.github.alexgreench.mvppattern;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity implements MainContract.View{
private MainPresenter presenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
presenter = new MainPresenter(this);
final EditText input_text = findViewById(R.id.input_text);
findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String txt = input_text.getText().toString();
presenter.inputText(txt);
}
});
}
@Override
public void showToast(String msg) {
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
}
}
|
75b37c10-2530-48cd-881d-915d13de4f60 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-10-08 05:56:42", "repo_name": "indraneelr/progbook", "sub_path": "/src/main/java/com/progbook/persistence/dao/impl/LanguageDaoImpl.java", "file_name": "LanguageDaoImpl.java", "file_ext": "java", "file_size_in_byte": 1069, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "3eab20d84885eca121af9f3bfe073220eb208025", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/indraneelr/progbook | 198 | FILENAME: LanguageDaoImpl.java | 0.276691 | package com.progbook.persistence.dao.impl;
import com.progbook.persistence.dao.LanguageDao;
import com.progbook.persistence.model.Answer;
import com.progbook.persistence.model.Language;
import org.springframework.stereotype.Repository;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.List;
@Repository
public class LanguageDaoImpl extends AbstractDaoImpl<Language> implements LanguageDao {
@PersistenceContext
private EntityManager entityManager;
@Override
protected EntityManager getEntityManager() {
return entityManager;
}
@Override
protected Class<Language> getClassType() {
return Language.class;
}
@Override
public void save(Language language) {
entityManager.persist(language);
}
@Override
public List<Language> fetchByNames(List<String> names) {
return entityManager.createQuery("select l from Language l where l.name in :names",Language.class)
.setParameter("names",names).getResultList();
}
}
|
5f027dc4-33c6-4f3b-8965-3ee8e595623e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-09-12 19:14:48", "repo_name": "Speawtr/OpenShop", "sub_path": "/src/main/java/com/kosakorner/openshop/command/CommandHandler.java", "file_name": "CommandHandler.java", "file_ext": "java", "file_size_in_byte": 1202, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "034003cd8c5495115139c6b0662c10b85a67b332", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Speawtr/OpenShop | 265 | FILENAME: CommandHandler.java | 0.291787 | package com.kosakorner.openshop.command;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
import com.kosakorner.openshop.OpenShop;
public class CommandHandler implements CommandExecutor {
private final OpenShop openShop;
public CommandHandler(OpenShop openShop) {
this.openShop = openShop;
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(sender instanceof Player) {
Player player = (Player) sender;
if(cmd.getName().equalsIgnoreCase("openshop")) {
if(args.length > 0 && args[0].equalsIgnoreCase("help")) {
player.sendMessage(ChatColor.RED + "OpenShop Commands:");
player.sendMessage(ChatColor.GREEN + "/os confirm - Confirms sign creation");
return true;
} else if(args.length > 0 && args[0].equalsIgnoreCase("confirm")) {
player.sendMessage(ChatColor.YELLOW + "Punch the sign to confirm.");
player.setMetadata("SignConfirm", new FixedMetadataValue(openShop, true));
}
}
} else {
}
return false;
}
}
|
06b9dfdb-8a37-4974-9c8c-966b376c9497 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-08-16 18:43:24", "repo_name": "springdoc/springdoc-openapi", "sub_path": "/springdoc-openapi-tests/springdoc-openapi-javadoc-tests/src/test/java/test/org/springdoc/api/app107/HelloController.java", "file_name": "HelloController.java", "file_ext": "java", "file_size_in_byte": 1067, "line_count": 60, "lang": "en", "doc_type": "code", "blob_id": "3c9efe86c9546f93bf76b65da56507c6ebbcc030", "star_events_count": 2866, "fork_events_count": 503, "src_encoding": "UTF-8"} | https://github.com/springdoc/springdoc-openapi | 266 | FILENAME: HelloController.java | 0.255344 | package test.org.springdoc.api.app107;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* The type Hello controller.
*/
@RestController
public class HelloController {
/**
* Gets entity b.
*
* @return the entity b
*/
@GetMapping(path = "/entity-b", produces = { "application/json", "application/xml" })
public EntityB getEntityB() {
return new EntityB();
}
/**
* The type Entity b.
*/
public class EntityB {
/**
* The Field b.
*/
@Schema(required = true)
@JsonProperty("fieldB")
private String fieldB;
/**
* The Entity a.
*/
@Schema(required = true)
@JsonProperty("entityA")
private EntityA entityA;
//Getters and setters...
}
/**
* The type Entity a.
*/
public class EntityA {
/**
* The Field a.
*/
@Schema(required = true)
@JsonProperty("fieldA")
private String fieldA;
//Getters and setters...
}
}
|
ffcab2f1-13ab-436e-b4dd-6573841439c0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-23 22:35:37", "repo_name": "drstranges/ActionHandler", "sub_path": "/samples/databinding/src/main/java/com/drextended/databinding/viewmodel/BaseViewModel.java", "file_name": "BaseViewModel.java", "file_ext": "java", "file_size_in_byte": 487, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "9a9057315d047922ce1ed8de11f1bb5731f1f0a8", "star_events_count": 40, "fork_events_count": 7, "src_encoding": "UTF-8"} | https://github.com/drstranges/ActionHandler | 234 | FILENAME: BaseViewModel.java | 0.279042 | /*
* Copyright Roman Donchenko. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.drextended.databinding.viewmodel;
import android.content.Context;
import androidx.annotation.StringRes;
public class BaseViewModel {
private Context mContext;
public BaseViewModel(Context context) {
mContext = context;
}
public Context getContext() {
return mContext;
}
public String getString(@StringRes int resId) {
return mContext.getString(resId);
}
public void onDestroy() {
mContext = null;
}
}
|
40e82eae-be43-4897-9078-4526fded4aa3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-25 08:25:17", "repo_name": "qianyu429/MyTestUI", "sub_path": "/src/main/java/MyTestUI/action/Login.java", "file_name": "Login.java", "file_ext": "java", "file_size_in_byte": 1153, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "10e63d3fc653d1a4a39b81e4aa418081616b0067", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/qianyu429/MyTestUI | 283 | FILENAME: Login.java | 0.272025 | package MyTestUI.action;
import MyTestUI.tools.Log;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import MyTestUI.tools.Constant;
/**
* Created by mac on 2017/9/24.
*/
public class Login {
private WebDriver driver;
public Login(WebDriver driver){this.driver =driver;}
public void login(){
String UserName ="18019281718";
String Password ="1111";
driver.get(Constant.TEST_URL);
Log.info(Constant.TEST_URL);
//进入登录页面
driver.findElement(By.xpath("//*[@id=\"router-monitor\"]/div/div/div[1]/div[1]/div/div[2]/span/span[1]/a/span")).click();
//输入用户名
driver.findElement(By.xpath("//*[@id=\"router-monitor\"]/div/div/div[2]/div/div/div[3]/div[2]/input")).sendKeys(UserName);
//输入密码
driver.findElement(By.xpath("//*[@id=\"router-monitor\"]/div/div/div[2]/div/div/div[3]/div[3]/div/input")).sendKeys(Password);
//点击提交按钮
driver.findElement(By.xpath("//*[@id=\"router-monitor\"]/div/div/div[2]/div/div/div[3]/a")).click();
}
}
|
9edc6413-f717-4300-b069-2eea9d0a510b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-27 08:06:44", "repo_name": "ekuyubaev/Dana", "sub_path": "/src/main/java/kz/foodmaster/filial/data/RoleDB.java", "file_name": "RoleDB.java", "file_ext": "java", "file_size_in_byte": 989, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "e292b53d047d39bfed2ef0dbe9c0480ed309def4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ekuyubaev/Dana | 180 | FILENAME: RoleDB.java | 0.268941 | package kz.foodmaster.filial.data;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class RoleDB {
public static boolean insertRole(String role, String login) {
ConnectionPool pool = ConnectionPool.getInstance();
Connection connection = pool.getConnection();
PreparedStatement ps = null;
ResultSet rs = null;
String query = "Insert Into role (Login, Role) " +
"Values (?, ?)";
try {
ps = connection.prepareStatement(query);
ps.setString(1, login);
ps.setString(2, role);
return ps.executeUpdate() > 0;
} catch (SQLException e) {
System.err.println(e);
return false;
} finally {
DBUtil.closeResultSet(rs);
DBUtil.closePreparedStatement(ps);
pool.freeConnection(connection);
}
}
}
|
7f1df6c9-e032-4dbe-a3dc-cbd3ad246a34 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-19 04:53:56", "repo_name": "wsdesignuiux/Matrial_design", "sub_path": "/app/src/main/java/adapter/Route_Tabs_Adapter.java", "file_name": "Route_Tabs_Adapter.java", "file_ext": "java", "file_size_in_byte": 1087, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "284066050ed133ba59aa33479fe772486b3835d1", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wsdesignuiux/Matrial_design | 237 | FILENAME: Route_Tabs_Adapter.java | 0.292595 | package adapter;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import fragment.Fragment1;
/**
* Created by wolfsoft3 on 12/9/18.
*/
public class Route_Tabs_Adapter extends FragmentStatePagerAdapter {
int mnooftabs;
public Route_Tabs_Adapter(FragmentManager fm, int mnooftabs) {
super(fm);
this.mnooftabs = mnooftabs;
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
Fragment1 tab1 = new Fragment1();
return tab1;
case 1:
Fragment1 tab2 = new Fragment1();
return tab2;
case 2:
Fragment1 tab3 = new Fragment1();
return tab3;
case 3:
Fragment1 tab4 = new Fragment1();
return tab4;
default:
return null;
}
}
@Override
public int getCount() {
return mnooftabs;
}
}
|
d61cee21-c7e8-4cf6-81a2-5d26e54ddf71 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-07-28 08:55:38", "repo_name": "SingleWolf/DripStone", "sub_path": "/optimize/src/main/java/com/walker/crash/CrashReport.java", "file_name": "CrashReport.java", "file_ext": "java", "file_size_in_byte": 1042, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "a15f936fda34f088e0b84c4cf987ea5d226a910b", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/SingleWolf/DripStone | 212 | FILENAME: CrashReport.java | 0.261331 | package com.walker.crash;
import android.content.Context;
import java.io.File;
public class CrashReport {
static {
System.loadLibrary("bugly");
}
public static void init(Context context) {
Context applicationContext = context.getApplicationContext();
File file = new File(applicationContext.getExternalCacheDir(), "native_crash");
if (!file.exists()) {
file.mkdirs();
}
initNativeCrash(file.getAbsolutePath());
}
private static native void initNativeCrash(String path);
public static native void testNativeCrash();
public static void testJavaCrash() {
int i = 1 / 0;
}
public static void testJavaCrash_1() {
String test = null;
int crash = test.hashCode();
}
public static void testJavaCrash_2() {
new Thread(new Runnable() {
@Override
public void run() {
String test = null;
int crash = test.hashCode();
}
});
}
}
|
449c66a1-2202-45b6-a443-5a191fba0546 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-22 16:02:52", "repo_name": "varnittyagi120/javaproject2", "sub_path": "/eclipse-workspaceone/SimpleWebProject/src/main/java/dao/DatabaseQueries.java", "file_name": "DatabaseQueries.java", "file_ext": "java", "file_size_in_byte": 1202, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "c3dde355364377810b6d3f03e69f23a7fea50956", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/varnittyagi120/javaproject2 | 261 | FILENAME: DatabaseQueries.java | 0.290176 | package dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class DatabaseQueries {
Connection connection = null;
public DatabaseQueries() {
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/info", "newuser", "infoobjects");
System.out.println("connection established");
} catch (Exception exception) {
exception.printStackTrace();
}
}
public void readAllEmployees() {
System.out.println("i am here");
PreparedStatement preparedStatement = null;
ResultSet rs = null;
try {
String sql = "Select * from emplyeelist";
preparedStatement = connection.prepareStatement(sql);
rs = preparedStatement.executeQuery();
while (rs.next()) {
System.out.println(rs.getString(1)+" "+rs.getString(2)+" "+rs.getString(3));
}
} catch (Exception exception) {
exception.printStackTrace();
}
}
public void finalize() throws Throwable {
try {
if (connection != null) {
connection.close();
}
} catch (SQLException exception) {
exception.printStackTrace();
}
}
}
|
976aa715-7de9-4db9-808f-a3562615da4c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-04-05 15:28:28", "repo_name": "pog-pp/working", "sub_path": "/HibernateSimpleExample/src/logic/Statistics.java", "file_name": "Statistics.java", "file_ext": "java", "file_size_in_byte": 1017, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "81c51981d4439eba1b16ac329cd10765fa12073d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/pog-pp/working | 242 | FILENAME: Statistics.java | 0.280616 | package logic;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;
/**
* Created by paul on 02.03.16.
*/
@Entity
@Table(name="Statistics")
public class Statistics {
private Long stid;
private Long id;
private Long tid;
public Statistics(){
}
private Set<Test> tests = new HashSet<Test>(0);
@OneToMany
@JoinTable(name = "id")
public Set<Test> getTests() {
return tests;
}
private Set<Student> studs = new HashSet<Student>(0);
@OneToMany
@JoinTable(name = "id")
public Set<Student> getStuds() {
return studs;
}
@Id
@GeneratedValue(generator="increment")
@GenericGenerator(name="increment", strategy = "increment")
@Column(name="stid")
public Long getStid(){
return stid;
}
@Column(name="id")
public Long getId(){
return id;
}
@Column(name="tid")
public Long getTid(){
return tid;
}
}
|
2b5ad339-e74d-4a36-970f-b017d1c4b732 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-21 04:43:55", "repo_name": "loverasd/javademo", "sub_path": "/src/main/java/com/note/design_patterns/creational/factory/factoryMethod/TestHorse.java", "file_name": "TestHorse.java", "file_ext": "java", "file_size_in_byte": 1030, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "feeb655193085ad72441d1aea5446a667bb82028", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/loverasd/javademo | 226 | FILENAME: TestHorse.java | 0.252384 | package com.note.design_patterns.creational.factory.factoryMethod;
import com.note.design_patterns.creational.factory.factoryMethod.concreteFactory.DiluFactory;
import com.note.design_patterns.creational.factory.factoryMethod.horse.DiLuHorse;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
/**
* @program: javademo
* @description:
* @author: chenp
* @create: 2019-01-02 15:02
**/
public class TestHorse {
public static void main(String[] args) {
AbstractFactory factory = new DiluFactory();
Horse horse = factory.create();
horse.desc();
List<? super Horse> list = new ArrayList<>();
list.add(new DiLuHorse());
System.out.println(list.get(0));
Vector vector = new Vector();
System.out.println(vector.size());
String format = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm"));
System.out.println(format);
}
} |
600b177a-f312-44b2-bbe8-4421e4414e39 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-10 23:22:18", "repo_name": "ncoronel-hotmail/wolox", "sub_path": "/EjercicioWolox/EjercicioWolox/EjercicioWolox/src/main/java/com/ejercicio/wolox/EjercicioWolox/response/ResponsePhoto.java", "file_name": "ResponsePhoto.java", "file_ext": "java", "file_size_in_byte": 1123, "line_count": 64, "lang": "en", "doc_type": "code", "blob_id": "e126028c32814236da06c9c2297f96a5702c4c3b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ncoronel-hotmail/wolox | 263 | FILENAME: ResponsePhoto.java | 0.253861 | package com.ejercicio.wolox.EjercicioWolox.response;
import java.io.Serializable;
import org.springframework.stereotype.Component;
import com.ejercicio.wolox.EjercicioWolox.model.PhotoModel;
@Component("responsePhoto")
public class ResponsePhoto implements Serializable {
/**
*
*/
private static final long serialVersionUID = 3453467343L;
private String status = "";
private String error = "";
private PhotoModel photo;
public ResponsePhoto(String status, String error, PhotoModel photos) {
super();
this.status = status;
this.error = error;
this.photo = photos;
}
public ResponsePhoto() {
super();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
public PhotoModel getPhoto() {
return photo;
}
public void setPhoto(PhotoModel photo) {
this.photo = photo;
}
@Override
public String toString() {
return "ResponsePhoto [status=" + status + ", error=" + error + ", photo=" + photo + "]";
}
}
|
4d7990c1-2332-43be-9bcc-bbfa292640d0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-09-05 08:53:06", "repo_name": "hmcts/cmc-claim-store", "sub_path": "/ccd-adapter/src/main/java/uk/gov/hmcts/cmc/ccd/mapper/defendant/statementofmeans/EmployerMapper.java", "file_name": "EmployerMapper.java", "file_ext": "java", "file_size_in_byte": 1200, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "be382090f9e875b03e70f1caf86e836eaf7b0005", "star_events_count": 15, "fork_events_count": 19, "src_encoding": "UTF-8"} | https://github.com/hmcts/cmc-claim-store | 266 | FILENAME: EmployerMapper.java | 0.284576 | package uk.gov.hmcts.cmc.ccd.mapper.defendant.statementofmeans;
import org.springframework.stereotype.Component;
import uk.gov.hmcts.cmc.ccd.domain.CCDCollectionElement;
import uk.gov.hmcts.cmc.ccd.domain.defendant.statementofmeans.CCDEmployer;
import uk.gov.hmcts.cmc.domain.models.statementofmeans.Employer;
@Component
public class EmployerMapper {
public CCDCollectionElement<CCDEmployer> to(Employer employer) {
if (employer == null) {
return null;
}
return CCDCollectionElement.<CCDEmployer>builder()
.value(CCDEmployer.builder()
.employerName(employer.getName())
.jobTitle(employer.getJobTitle())
.build())
.id(employer.getId())
.build();
}
public Employer from(CCDCollectionElement<CCDEmployer> collectionElement) {
CCDEmployer ccdEmployer = collectionElement.getValue();
if (ccdEmployer == null) {
return null;
}
return Employer.builder()
.id(collectionElement.getId())
.jobTitle(ccdEmployer.getJobTitle())
.name(ccdEmployer.getEmployerName())
.build();
}
}
|
15bec491-6475-45e2-a526-2178b662c525 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-17 00:14:48", "repo_name": "DanielSer1996/MWSI-Projekt", "sub_path": "/src/main/java/i5b5/mwsi/services/dto/LicenseCategoryData.java", "file_name": "LicenseCategoryData.java", "file_ext": "java", "file_size_in_byte": 1007, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "7c29d8d7009490e1e5f5c17d920125ac4fbf4772", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DanielSer1996/MWSI-Projekt | 202 | FILENAME: LicenseCategoryData.java | 0.214691 | package i5b5.mwsi.services.dto;
import i5b5.mwsi.entities.DrivingLicense;
import i5b5.mwsi.entities.LicenseCategory;
import java.util.ArrayList;
import java.util.List;
public class LicenseCategoryData
{
private long categoryId;
private String categoryType;
private String description;
public LicenseCategoryData(LicenseCategory lc)
{
categoryId = lc.getCategoryId();
categoryType = lc.getCategoryType();
description = lc.getDescription();
}
public long getCategoryId() {
return categoryId;
}
public void setCategoryId(long categoryId) {
this.categoryId = categoryId;
}
public String getCategoryType() {
return categoryType;
}
public void setCategoryType(String categoryType) {
this.categoryType = categoryType;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
|
67dcaac7-88dc-49d1-a5f4-def25fd337f4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-23 12:03:34", "repo_name": "ilkin/cassandra-native-sample", "sub_path": "/src/main/java/com/example/cassandra/model/CassandraInfo.java", "file_name": "CassandraInfo.java", "file_ext": "java", "file_size_in_byte": 1040, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "ff5c9c7d4db3325135028e35b4d0546a3a27b6fd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ilkin/cassandra-native-sample | 216 | FILENAME: CassandraInfo.java | 0.217338 | package com.example.cassandra.model;
import io.micronaut.core.annotation.Introspected;
import java.util.Objects;
@Introspected
public class CassandraInfo {
private String clusterName;
private String releaseVersion;
public String getClusterName() {
return clusterName;
}
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
public String getReleaseVersion() {
return releaseVersion;
}
public void setReleaseVersion(String releaseVersion) {
this.releaseVersion = releaseVersion;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CassandraInfo that = (CassandraInfo) o;
return Objects.equals(clusterName, that.clusterName) &&
Objects.equals(releaseVersion, that.releaseVersion);
}
@Override
public int hashCode() {
return Objects.hash(clusterName, releaseVersion);
}
}
|
3d4dd162-4f9c-471d-8d50-f4b9c36d229b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-18 09:29:46", "repo_name": "ShemBrooklyne/virtual_pet", "sub_path": "/src/test/java/DatabaseRule.java", "file_name": "DatabaseRule.java", "file_ext": "java", "file_size_in_byte": 972, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "ce5976403f6b105ca4d885ced9e0a6a46a6c0d2c", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ShemBrooklyne/virtual_pet | 212 | FILENAME: DatabaseRule.java | 0.246533 | import org.junit.rules.ExternalResource;
import org.sql2o.*;
public class DatabaseRule extends ExternalResource {
@Override
protected void before() {
DB.sql2o = new Sql2o("jdbc:postgresql://localhost:5432/virtual_pets_test", "access", "Access"); //Those with linux or windows use two strings for username and password
}
// @Override
// protected void after() {
// try(Connection con = DB.sql2o.open()) {
// String deletePersonsQuery = "DELETE FROM persons *;";
// con.createQuery(deletePersonsQuery).executeUpdate();
// }
// }
@Override
protected void after(){
try(Connection con = DB.sql2o.open()) {
String deletePersonsQuery = "DELETE FROM persons *;";
String deleteMonstersQuery = "DElETE FROM monsters *;";
con.createQuery(deletePersonsQuery).executeUpdate();
con.createQuery(deleteMonstersQuery).executeUpdate();
}
}
} |
84dfbdd2-4a03-4989-b46d-ab6d114ed9a5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-16 00:47:35", "repo_name": "nothing-wy/wyl_blog", "sub_path": "/wyl-module/wyl-module-system/src/main/java/com/wyl/system/service/impl/UserServiceImpl.java", "file_name": "UserServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1157, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "bed8a0b85c104e96c461f9df64f80ea92cb63f64", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/nothing-wy/wyl_blog | 247 | FILENAME: UserServiceImpl.java | 0.225417 | package com.wyl.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wyl.system.entity.Role;
import com.wyl.system.entity.User;
import com.wyl.system.mapper.UserMapper;
import com.wyl.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description
* @Author wy
* @Date 2021/8/14
*/
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserMapper userMapper;
/**
* 根据用户名查询用户
*
* @param username 用户名
* @return 用户
*/
@Override
public User selectUserByUsername(String username) {
QueryWrapper<User> wrapper = new QueryWrapper<>();
wrapper.eq("username", username);
return userMapper.selectOne(wrapper);
}
/**
* 根据用户id查询用户拥有的角色列表
*
* @return 用户拥有的角色列表
*/
@Override
public List<Role> selectRoleByUserId(Long userId) {
return userMapper.selectRoleByUserId(userId);
}
}
|
67866807-c53d-4fe9-afba-8d9cac5b14e1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-04-11 03:05:10", "repo_name": "mocn26169/Android-Analyze", "sub_path": "/app/src/main/java/com/mwf/analyze/activity/WelcomeActivity.java", "file_name": "WelcomeActivity.java", "file_ext": "java", "file_size_in_byte": 1202, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "4f4fcda59ac6f711da65eaa4334954cd04bc47ba", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mocn26169/Android-Analyze | 239 | FILENAME: WelcomeActivity.java | 0.256832 | package com.mwf.analyze.activity;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import com.mwf.analyze.R;
public class WelcomeActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
toWritePoetry(null);
}
private void toActivity(Context _context, Class<? extends Activity> _class) {
Intent intent = new Intent(_context, _class);
startActivity(intent);
}
public void toMainActivity(View view) {
Log.i(getClass().getSimpleName(), "toMainActivity");
toActivity(this, MainActivity.class);
}
public void toAnalyzePoem(View view) {
Log.i(getClass().getSimpleName(), "toAnalyzePoem");
toActivity(this, AnalyzePoemActivity.class);
}
public void toWritePoetry(View view) {
Log.i(getClass().getSimpleName(), "toWritePoetry");
toActivity(this, WritePoetryActivity.class);
}
}
|
3cfebc91-94a4-4122-aff9-c03ddccc3342 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-02-23 01:50:23", "repo_name": "happy6eve/b2c-order", "sub_path": "/order-common/src/main/java/com/haohao/order/common/model/operate/ModifyOrderOperationContent.java", "file_name": "ModifyOrderOperationContent.java", "file_ext": "java", "file_size_in_byte": 1020, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "380f05b0925358dcd4db1421952af45aab6c22dd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/happy6eve/b2c-order | 242 | FILENAME: ModifyOrderOperationContent.java | 0.275909 | /**
*
*/
package com.haohao.order.common.model.operate;
import java.util.Map;
/**
* @author mandy.hu
*
*/
public class ModifyOrderOperationContent extends OrderOperationContent {
private static final long serialVersionUID = -523255688911442051L;
/**
*
*/
private Long discount;
/**
*
*/
private Long carriage;
/**
* <pre>
*
* key:
* value:
*
* <pre>
*/
private Map<Long, Long> entryDiscount;
public Long getDiscount() {
return discount;
}
public void setDiscount(Long discount) {
this.discount = discount;
}
public Long getCarriage() {
return carriage;
}
public void setCarriage(Long carriage) {
this.carriage = carriage;
}
public Map<Long, Long> getEntryDiscount() {
return entryDiscount;
}
public void setEntryDiscount(Map<Long, Long> entryDiscount) {
this.entryDiscount = entryDiscount;
}
}
|
0ae1c2ac-6dea-4071-9f7b-980141a75f09 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-27 08:00:32", "repo_name": "XDarker/Seckill", "sub_path": "/src/main/java/com/xdarker/pojo/SeckillGoods.java", "file_name": "SeckillGoods.java", "file_ext": "java", "file_size_in_byte": 1105, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "12d7c12623dbb74103a22472ca001bcd961d9f5c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/XDarker/Seckill | 244 | FILENAME: SeckillGoods.java | 0.245085 | package com.xdarker.pojo;
import lombok.Data;
import java.util.Date;
/**
* 秒杀商品库存表对应的实体类
* Created by XDarker
* 2018/8/22 21:32
*/
@Data
public class SeckillGoods {
private Long seckillId;
private String name;
private Integer number;
private Date createTime;
private Date startTime;
private Date endTime;
public SeckillGoods(){
super();
}
public SeckillGoods(Long seckillId, String name, Integer number, Date createTime, Date startTime, Date endTime) {
this.seckillId = seckillId;
this.name = name;
this.number = number;
this.createTime = createTime;
this.startTime = startTime;
this.endTime = endTime;
}
@Override
public String toString() {
return "SeckillGoods{" +
"seckillId=" + seckillId +
", name='" + name + '\'' +
", number=" + number +
", createTime=" + createTime +
", startTime=" + startTime +
", endTime=" + endTime +
'}';
}
}
|
78010204-680a-41a8-920c-19b1887579c8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-06 04:50:19", "repo_name": "IMASau/android-redmap", "sub_path": "/src/au/com/ionata/redmap/overlay/OverlayManager.java", "file_name": "OverlayManager.java", "file_ext": "java", "file_size_in_byte": 1123, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "7919147fa60f16e04866973e17092f17c4db18a4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/IMASau/android-redmap | 226 | FILENAME: OverlayManager.java | 0.294215 | package au.com.ionata.redmap.overlay;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import au.com.ionata.redmap.R;
public class OverlayManager {
private int rId = R.layout.activity_loading;
private Activity activity;
private View overlayView;
public OverlayManager(Activity activity){
this.activity = activity;
}
public OverlayManager(Activity activity, int rId){
this.rId = rId;
this.activity = activity;
}
public void CreateOverlay(){
CreateOverlay(rId);
}
public void CreateOverlay(int rId){
LayoutInflater inflater = activity.getLayoutInflater();
overlayView = inflater.inflate(rId, null);
overlayView.setVisibility(View.GONE);
activity.getWindow().addContentView(overlayView,
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
}
public void DismissLoadingOverlay(){
overlayView.setVisibility(View.GONE);
}
public void ShowLoadingOverlay(){
overlayView.setVisibility(View.VISIBLE);
}
}
|
14fc0039-78f1-4d45-97a7-3c75a58decf8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-26 19:18:00", "repo_name": "Kiolk/BullsAndCows", "sub_path": "/app/src/main/java/com/example/notepad/bullsandcows/ui/activity/activities/RulesPageActivity.java", "file_name": "RulesPageActivity.java", "file_ext": "java", "file_size_in_byte": 1013, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "80481a7ebd8b472895f95eb293c68b4aaa3fcb45", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/Kiolk/BullsAndCows | 209 | FILENAME: RulesPageActivity.java | 0.26971 | package com.example.notepad.bullsandcows.ui.activity.activities;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
import com.example.notepad.bullsandcows.R;
public class RulesPageActivity extends AppCompatActivity {
private int mCnt;
private String[] mRulesArray;
private TextView mRuleText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.activity_rulespage);
mCnt = 0;
mRulesArray = getResources().getStringArray(R.array.rules_items);
mRuleText = findViewById(R.id.helpFromBull);
}
public void submitBull(View view) {
mRuleText.setText(mRulesArray[mCnt]);
mCnt++;
if (mCnt == mRulesArray.length) {
mCnt = 0;
}
}
}
|
45867777-6da5-4778-ab2a-927bb1d99cd1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-26 09:46:02", "repo_name": "BruceLi119/myBootDemo", "sub_path": "/src/main/java/com/asiaInfo/demo/service/impl/DemoServiceImpl.java", "file_name": "DemoServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1304, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "49837f118177e5f0905ce1ba191b4c2abb3f27f1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/BruceLi119/myBootDemo | 307 | FILENAME: DemoServiceImpl.java | 0.246533 | package com.asiaInfo.demo.service.impl;
import com.asiaInfo.demo.service.DemoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/**
* @author: liShuGuang
* @dateTime: 2021/04/09
*/
@Service("distinctionLogService")
public class DemoServiceImpl implements DemoService {
private Logger log = LoggerFactory.getLogger(DemoServiceImpl.class);
@Value("${areaPreName}")
private String areaPreName;
//@Override
//public String distinctionLogComplete(String data) {
// JSONObject jsonObject = JSONObject.parseObject(data);
// String oper_priacct = (String) jsonObject.get("OPER_PRIACCT");
// String PRACCT_NAME = (String) jsonObject.get("PRACCT_NAME");
//
// //2. 然后判断待区分的字符串中是否包含”_“,如果有,再判断前三个字符有没有在集合 中,如果存在,则需要进行上传SFTP
// String[] areaPreNameArr = areaPreName.split(",");
// Set<String> areaPreNameArrSet = new HashSet<>(Arrays.asList(areaPreNameArr));
// boolean res = areaPreNameArrSet.contains(oper_priacct);
// Set<String> areaNameSet = new HashSet<>();
//
// return null;
//}
}
|
a370d9cf-4aa9-45cc-bc32-84fb5e9b5524 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-04-28 03:50:58", "repo_name": "asnehal/SwipyTabs", "sub_path": "/src/com/example/swipeytabs/SwipeyTabs.java", "file_name": "SwipeyTabs.java", "file_ext": "java", "file_size_in_byte": 1097, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "c25a648132669c9c167f34e2e8ba39cf8fbcc589", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/asnehal/SwipyTabs | 219 | FILENAME: SwipeyTabs.java | 0.258326 | package com.example.swipeytabs;
import android.app.ActionBar;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.Menu;
public class SwipeyTabs extends FragmentActivity {
private ViewPager mViewPager;
private TabsAdapter mTabsAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_swipey_tabs);
mViewPager = (ViewPager)findViewById(R.id.pager);
final ActionBar bar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
mTabsAdapter = new TabsAdapter(this, mViewPager);
mTabsAdapter.addTab(bar.newTab().setText("Tab 1"),
Tab1.class, null);
mTabsAdapter.addTab(bar.newTab().setText("Tab 2"),
Tab2.class, null);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_swipey_tabs, menu);
return true;
}
}
|
f0e37d93-85dc-4a00-b16d-8f4ebc815639 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2012-10-21 21:59:28", "repo_name": "UeliKurmann/igesture", "sub_path": "/igesture-framework/src/main/java/org/ximtec/igesture/core/IconDescriptor.java", "file_name": "IconDescriptor.java", "file_ext": "java", "file_size_in_byte": 1124, "line_count": 66, "lang": "en", "doc_type": "code", "blob_id": "3eab7802ded37aee50f61dcab459e3ea1ab4a63f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/UeliKurmann/igesture | 259 | FILENAME: IconDescriptor.java | 0.289372 | /*
* @(#)$Id$
*
* Author : Ueli Kurmann, igesture@uelikurmann.ch
*
*
* Purpose :
*
* -----------------------------------------------------------------------
*
* Revision Information:
*
* Date Who Reason
*
* 22.10.2008 ukurmann Initial Release
*
* -----------------------------------------------------------------------
*
* Copyright 1999-2009 ETH Zurich. All Rights Reserved.
*
* This software is the proprietary information of ETH Zurich.
* Use is subject to license terms.
*
*/
package org.ximtec.igesture.core;
import java.awt.Image;
/**
* Comment
* @version 1.0 22.10.2008
* @author Ueli Kurmann
*/
public class IconDescriptor extends DefaultDescriptor {
private String path;
public IconDescriptor(){
}
public Image getIcon() {
return null;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
@Override
public String getName() {
return this.getClass().getSimpleName();
}
}
|
0b15d128-02a0-4a3d-8240-abd4924404ca | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-06-06T03:46:52", "repo_name": "joewww/ethereum_node", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1086, "line_count": 51, "lang": "en", "doc_type": "text", "blob_id": "ad2c2f902e3d5d83ff1404f9610db452a0d3d39a", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/joewww/ethereum_node | 381 | FILENAME: README.md | 0.272025 |
# ♢ ethereum_node
## Overview

## Monthly Costs
- t2.medium: ~$33.41
- 120G EBS: ~$12.00
- Total = $45.41
## AMI
- using t2.medium (1x)
- install geth: bin/install.sh
- add bin/startup.sh to /etc/rc.local
- `mkdir /var/ethereum-data/ && chown ubuntu: /var/ethereum-data/`
## mount EBS volume, start client
`$ sh bin/startup.sh`
### start geth manually, enable RPC
`$ geth --syncmode "fast" --datadir "/var/ethereum-data" --cache 1024 --rpc --rpcport "8545" --rpcaddr "0.0.0.0" --rpccorsdomain "*"`
### no RPC
`$ geth --rinkeby --syncmode "fast" --datadir "/var/ethereum-data" --cache 1024`
## migrate database to fresh directory
https://github.com/ethereum/go-ethereum/issues/15797#issuecomment-357030043
`mkdir /var/new-ethereum-data`
`geth --datadir=/var/new-ethereum-data copydb --cache=512 /var/ethereum-data`
`rm -rf /var/ethereum-data`
`mv /var/new-ethereum-data /var/ethereum-data`
## env variables used by runner
- `AWS_ACCESS_KEY_ID`
- `AWS_SECRET_ACCESS_KEY`
- `AWS_DEFAULT_REGION = us-east-1`
|
4426cbf7-d793-4524-9c23-cc4723a472b8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-30 08:06:51", "repo_name": "zapho/chaos-proxy", "sub_path": "/src/main/java/fr/zapho/chaosproxy/Log.java", "file_name": "Log.java", "file_ext": "java", "file_size_in_byte": 1089, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "49b38a1da339b209681ce442fa83297c4b1d54db", "star_events_count": 3, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/zapho/chaos-proxy | 228 | FILENAME: Log.java | 0.252384 | package fr.zapho.chaosproxy;
import javax.json.bind.annotation.JsonbProperty;
import javax.json.bind.annotation.JsonbTransient;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import static java.time.format.DateTimeFormatter.ofPattern;
public class Log {
private LogLevel level;
private String message;
private LocalDateTime date;
public static final DateTimeFormatter FORMATTER = ofPattern("yyyy-MM-dd HH:mm:ss:ms");
public Log(LogLevel level, String message) {
this.level = level;
this.message = message;
this.date = LocalDateTime.now();
}
@JsonbTransient
public LogLevel getLevel() {
return level;
}
@JsonbTransient
public String getMessage() {
return message;
}
@JsonbTransient
public LocalDateTime getDate() {
return date;
}
@JsonbProperty("msg")
public String message() {
return FORMATTER.format(date) + " - " + level + " - " + message;
}
@Override
public String toString() {
return message();
}
}
|
fa1cc5ec-48ce-4628-9699-e5f14d64536d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-20 15:16:58", "repo_name": "KimSuHyeon92/WebPortfolio", "sub_path": "/WebPortfolio/src/main/java/com/pf/test/TitleTest.java", "file_name": "TitleTest.java", "file_ext": "java", "file_size_in_byte": 1081, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "58b5d1d34e8ea4db45666139fed9e8811262d434", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/KimSuHyeon92/WebPortfolio | 241 | FILENAME: TitleTest.java | 0.258326 | package com.pf.test;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.pf.service.TitlesService;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={
"file:src/main/resources-local/database/Spring-Datasource.xml",
"file:src/main/resources-local/beans/Spring-Beans.xml"
})
public class TitleTest {
//private static Log log = LogFactory.getLog(TitlesService.class);
@Resource(name="titleService")
private TitlesService titlesService;
@Test
private void updatetest(){
Map<String, Object> params = new HashMap<String, Object>();
params.put("empNo", "500010");
params.put("oldTitle", "회계부");
params.put("oldFromDate","2017-11-29");
//titlesService.
}
}
|
f6087d7a-116d-4ce6-b7e2-e16f87248054 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-04-22 04:56:07", "repo_name": "GSIPROYECTOSTACHO/AprenderSOAP", "sub_path": "/AprenderSoap/app/src/main/java/utng/edu/mx/aprendersoap/Display.java", "file_name": "Display.java", "file_ext": "java", "file_size_in_byte": 1202, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "bf02596b677a9ac5e4bf9ef2c68b1075c68ec2d9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/GSIPROYECTOSTACHO/AprenderSOAP | 214 | FILENAME: Display.java | 0.258326 | package utng.edu.mx.aprendersoap;
import android.content.Intent;
import android.media.MediaPlayer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class Display extends AppCompatActivity implements View.OnClickListener {
private MediaPlayer sound;
Button btnSiguiente;
DatabaseHelper helper = new DatabaseHelper(this);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display);
String username= getIntent().getStringExtra("Username");
TextView tv = (TextView)findViewById(R.id.txv_display_uname);
tv.setText(username);
btnSiguiente =(Button)findViewById(R.id.btnSiguiente);
btnSiguiente.setOnClickListener(this);
sound = MediaPlayer.create(this,R.raw.button22);
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.btnSiguiente:
sound.start();
startActivity(new Intent(this, PantallaOpciones.class));
}
}
}
|
9c959a93-d431-44c3-a1c7-0abd03c506da | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-01 20:05:23", "repo_name": "lidapeng/matsim", "sub_path": "/playgrounds/sergioo/src/main/java/playground/sergioo/mixedTraffic2017/RunControler.java", "file_name": "RunControler.java", "file_ext": "java", "file_size_in_byte": 1017, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "0f4b7679f98e44ef84bb0f6f9c330e23afb50fc2", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/lidapeng/matsim | 229 | FILENAME: RunControler.java | 0.240775 | package playground.sergioo.mixedTraffic2017;
import com.google.inject.Provider;
import org.matsim.api.core.v01.Scenario;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.controler.AbstractModule;
import org.matsim.core.controler.Controler;
import org.matsim.core.mobsim.framework.Mobsim;
import playground.sergioo.weeklySimulation.scenario.ScenarioUtils;
/**
* Created by sergioo on 24/2/17.
*/
public class RunControler {
public static void main(String[] args) {
final Scenario scenario = ScenarioUtils.loadScenario(ConfigUtils.loadConfig(args[0]));
final Controler controler = new Controler(scenario);
/*controler.addOverridingModule(new AbstractModule() {
@Override
public void install() {
bindMobsim().toProvider(new Provider<Mobsim>() {
@Override
public Mobsim get() {
return new
}
});
}
});*/
controler.run();
}
}
|
d9c72ae4-96ca-4839-8c07-916fea3f691f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-27 15:39:42", "repo_name": "themichaelusa/ScreenGods-CS126", "sub_path": "/app/src/androidTest/java/com/example/michaelusa/screengods/ExampleInstrumentedTest.java", "file_name": "ExampleInstrumentedTest.java", "file_ext": "java", "file_size_in_byte": 1123, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "0ce00d3d080b8d313b281d6d39eb5bc41505967a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/themichaelusa/ScreenGods-CS126 | 259 | FILENAME: ExampleInstrumentedTest.java | 0.290981 | package com.example.michaelusa.screengods;
import android.support.test.runner.AndroidJUnit4;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void tryStockAlert() throws Exception {
String ticker = "GM";
String upperLimit = "45.66";
String lowerLimit = "42.17";
final long uLim = (long) Double.parseDouble(upperLimit);
final long lLim = (long) Double.parseDouble(lowerLimit);
StockAlert newAlert = new StockAlert(ticker.toUpperCase(), uLim, lLim);
String musachenkoUID = "5NPPorodIYUn5WQj9MkCn3MtMmY2";
DatabaseReference mUsersReference = FirebaseDatabase.getInstance().getReference();
mUsersReference.child(musachenkoUID).child("Alerts").child(ticker).setValue(newAlert);
}
}
|
5ae28425-16fb-4037-a506-e36ff38e1d81 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-07-20 15:51:02", "repo_name": "linkedpipes/etl", "sub_path": "/executor/src/main/java/com/linkedpipes/etl/executor/ConfigurationHolder.java", "file_name": "ConfigurationHolder.java", "file_ext": "java", "file_size_in_byte": 1032, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "aa03eb68d44e216442b6b56b50ef41440e3ceda9", "star_events_count": 139, "fork_events_count": 37, "src_encoding": "UTF-8"} | https://github.com/linkedpipes/etl | 190 | FILENAME: ConfigurationHolder.java | 0.2227 | package com.linkedpipes.etl.executor;
import com.linkedpipes.etl.executor.cli.Configuration;
import org.springframework.stereotype.Service;
import java.io.File;
import java.util.List;
/**
* Wrap the configuration, as we do not provide direct access for services.
*/
@Service
public class ConfigurationHolder {
private static Configuration configuration;
public static void setConfiguration(Configuration configuration) {
ConfigurationHolder.configuration = configuration;
}
public Integer getWebServerPort() {
return configuration.httpPort;
}
public File getOsgiStorageDirectory() {
return new File(configuration.osgiWorkingDirectory);
}
public File getOsgiLibDirectory() {
return new File(configuration.osgiLibrariesDirectory);
}
public File getOsgiComponentDirectory() {
return new File(configuration.pluginsDirectory);
}
public List<String> getBannedJarPatterns() {
return configuration.bannedPluginIriPatterns;
}
}
|
4962dfe8-dc06-4234-bb6b-c27019011a1a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-30 16:14:09", "repo_name": "evgeniy-andrienko/long-map", "sub_path": "/src/test/java/de/comparus/opensource/longmap/LongMapTest.java", "file_name": "LongMapTest.java", "file_ext": "java", "file_size_in_byte": 1074, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "0d338c1bf386131974472fad8b2b1a5ad7ca5412", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/evgeniy-andrienko/long-map | 210 | FILENAME: LongMapTest.java | 0.286169 | package de.comparus.opensource.longmap;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
class LongMapTest {
@Test
void initLongMapWithDefaultParams() {
new LongMapImpl<>();
}
@Test
void initLongMapWithCustomInitialCapacity() {
new LongMapImpl<>(100500);
}
@Test
void initLongMapWithIllegalCustomInitialCapacity() {
IllegalArgumentException illegalArgumentException = assertThrows(
IllegalArgumentException.class,
() -> new LongMapImpl<>(-1));
assertTrue(illegalArgumentException.getMessage().startsWith("Illegal initial capacity: "));
}
@Test
void initLongMapWithIllegalLoadFactor() {
IllegalArgumentException illegalArgumentException = assertThrows(
IllegalArgumentException.class,
() -> new LongMapImpl<>(100500, 0.0F));
assertTrue(illegalArgumentException.getMessage().startsWith("Illegal load factor: "));
}
} |
5eb21669-692e-4a0d-b25b-d71e251ffa35 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-08-19T01:36:54", "repo_name": "noma4i/redmine_will_deploy", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1078, "line_count": 41, "lang": "en", "doc_type": "text", "blob_id": "e511ca172f382f38e608b5c5265b423930924367", "star_events_count": 5, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/noma4i/redmine_will_deploy | 273 | FILENAME: README.md | 0.226784 | # Redmine WillDeploy Plugin
Plugin to vote for Deploy or Not.
## Features
Quorum of 2 is minimal PASS to deploy.
## Reason?
Everytime after release we have lots of `hot commits to deploy`. Such things can't just go to production if you
have strict release cycle. At this point better solutions is to VOTE on such ideas. Quorum of 2 people is enough to
make decision about that.
Tickets will gain special filterable field `Deploy?` to group by and have track of tickets to deploy at some point.
## HowTo
- Checkout as `plugins/will_deploy` folder
- `rake redmine:plugins:migrate`
- Enable for Project under `Modules` tab
- Make sure that your CustomField `Deployed?` assigned to Tracker types and projects
- Start voting
## SHOW TIME
### New tracker block at Issue page

### Custom field to rule em all!

## Compatibility
- Tested with Redmine 2.5.x - 3.1.x
## Author
[Alexander Tsirel @noma4i](https://github.com/noma4i)
## Contribution Guide
Open Issue or send PR ;)
|
283f9c25-31a4-4ac5-be2b-32dcff26a253 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-31 08:36:53", "repo_name": "CokeWithoutIce/eureka-server", "sub_path": "/huobi-server/src/main/java/com/kelebujiabing/huobiserver/huobiApi/domain/event/KlineEventResp.java", "file_name": "KlineEventResp.java", "file_ext": "java", "file_size_in_byte": 1083, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "c31ae2aab7c7b9125b8575e4f81ea3485b47e207", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/CokeWithoutIce/eureka-server | 262 | FILENAME: KlineEventResp.java | 0.267408 | package com.kelebujiabing.huobiserver.huobiApi.domain.event;
import com.kelebujiabing.huobiserver.huobiApi.domain.Candle;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.elasticsearch.annotations.Document;
import java.util.List;
/**
* created by jacky. 2018/7/24 8:26 PM
*/
@Getter
@Setter
@Document(indexName = "kline", type = "kline", shards = 1, replicas = 0, refreshInterval = "-1")
public class KlineEventResp {
private String id;
private String status;
private long ts;
private String ch;
private Candle tick;
private String subbed;
//-----req---
private String rep;
private List<Candle> data;
public String toString() {
return "KlineEventResp{" +
"id='" + id + '\'' +
", status='" + status + '\'' +
", ts=" + ts +
", ch='" + ch + '\'' +
", tick=" + tick +
", subbed='" + subbed + '\'' +
", rep='" + rep + '\'' +
", data=" + data +
'}';
}
}
|
51267fd8-44c8-4b58-a7d3-0816d8c1eaf7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-08-19 15:37:04", "repo_name": "jojoldu/blog-code", "sub_path": "/spring-boot-entityql/spring-boot-entityql-sql/src/main/java/com/jojoldu/blogcode/entityql/sql/bulkinsert/academy/onetomany/AcademyMatcherRepository.java", "file_name": "AcademyMatcherRepository.java", "file_ext": "java", "file_size_in_byte": 1244, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "0ccc008b3a6ecdaf6dfcc6b0a608cad3f25c9b18", "star_events_count": 705, "fork_events_count": 451, "src_encoding": "UTF-8"} | https://github.com/jojoldu/blog-code | 245 | FILENAME: AcademyMatcherRepository.java | 0.29584 | package com.jojoldu.blogcode.entityql.sql.bulkinsert.academy.onetomany;
import com.jojoldu.blogcode.entityql.entity.domain.academy.Academy;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.List;
import static com.jojoldu.blogcode.entityql.entity.domain.academy.QAcademy.academy;
import static com.querydsl.core.types.Projections.fields;
@RequiredArgsConstructor
@Transactional(readOnly = true)
@Repository
public class AcademyMatcherRepository {
private final JPAQueryFactory queryFactory;
public List<Academy> findAllByIds(List<Long> ids) {
if(CollectionUtils.isEmpty(ids)) {
throw new IllegalArgumentException("조회할 id가 없습니다.");
}
return queryFactory
.select(fields(Academy.class, // 이렇게 할 경우 Entity가 아닌 Dto로 조회됨
academy.id,
academy.matchKey
))
.from(academy)
.where(academy.id.in(ids))
.fetch();
}
}
|
1ffd3431-df03-4b27-9f0d-34417fae3166 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-01-02 08:01:48", "repo_name": "dstweihao/dst-android-example", "sub_path": "/app/src/main/java/com/jweihao/jdemo/ui/activity/md/ShadowActivity.java", "file_name": "ShadowActivity.java", "file_ext": "java", "file_size_in_byte": 1189, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "f80349a20b6860417d75d12ecd5487cd452b2822", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dstweihao/dst-android-example | 259 | FILENAME: ShadowActivity.java | 0.286169 | package com.jweihao.jdemo.ui.activity.md;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
import com.wh.customcontrol.R;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/*
* 视图与阴影
*
* */
public class ShadowActivity extends AppCompatActivity {
@BindView(R.id.imageview_shadow)
TextView mImageviewShadow;
private boolean flag = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shadow);
ButterKnife.bind(this);
}
@OnClick(R.id.imageview_shadow)
public void onViewClicked() {
if (flag) {
/*
* translationZ(10) 设置阴影区域的大小为10
* translationY(100) 将视图view向下移动100像素
* translationX(100) 将视图view向右移动100像素
* */
mImageviewShadow.animate().translationZ(100);
flag = false;
} else {
mImageviewShadow.animate().translationZ(0);
flag = true;
}
}
}
|
61dc9bc1-d8fa-4fd5-aefc-6fb91959906d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-24 15:57:33", "repo_name": "AliMorales018/IXPERY", "sub_path": "/IXPERY/Presentacion/src/main/java/com/ixpery/controladores/tools/Encrypt.java", "file_name": "Encrypt.java", "file_ext": "java", "file_size_in_byte": 1012, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "27229ba607e0b5b2520126f67e7a4ab6934d8d98", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AliMorales018/IXPERY | 199 | FILENAME: Encrypt.java | 0.27513 | package com.ixpery.controladores.tools;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.apache.commons.codec.binary.Hex;
public class Encrypt {
public static void main(String[] args) {
MessageDigest md = null;
String password = "password D:";
try {
//SHA-512
md= MessageDigest.getInstance("SHA-512");
md.update(password.getBytes());
byte[] mb = md.digest();
System.out.println(Hex.encodeHex(mb));
//SHA-1
md= MessageDigest.getInstance("SHA-1");
md.update(password.getBytes());
mb = md.digest();
System.out.println(Hex.encodeHex(mb));
//MD5
md= MessageDigest.getInstance("MD5");
md.update(password.getBytes());
mb = md.digest();
System.out.println(Hex.encodeHex(mb));
} catch (NoSuchAlgorithmException e) {
//Error
}
}
} |
da124f2a-aff8-44c4-913b-cbaa2141950a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-05-12T15:31:56", "repo_name": "felipejinli/tibi-mobile-2020", "sub_path": "/client/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1087, "line_count": 38, "lang": "en", "doc_type": "text", "blob_id": "17281cb37a93f9dc8f33f31f839e6063b1f39f9d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/felipejinli/tibi-mobile-2020 | 272 | FILENAME: README.md | 0.220007 | # Tibi Global Mobile App
## Set Up (Starting from client)
Install Dependencies
1. `yarn install`
2. `cd ios`
3. `pod install`
Run on Simulator
1. `npx react-native start`
2. `npx react-native run-ios`
Run on iPhone
1. `yarn global add ios-deploy`
2. `npx react-native start`
3. `npx react-native run-ios --device "Device Name"`
## Troubleshooting
### Known Errors
- Font file naming
- iOS and Android read custom font file names differently.
- font styles are imported straight from our Zeplin styleguide and this causes the fontFamily style property to incorrectly call 'TitlingGothicFBNormal' for a font with say filename TitlingGothicFBNormalRegular.otf
- The root error is that iOS uses the full name property of font files, which is like metadata in which case fontFamily: 'TitlingGothicFB Normal' is correct.
---
## Data and Backend Connection
### Data Schemas
- Image component from React Native has source props taking `source={uri: 'https://example.com/image.png}` if we want to pass a live link or it takes a direct `source: require('./path/to/image.png')`
|
fcc3d6bd-69ae-44d9-9dcb-59f0f1ce70a9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-16 11:36:52", "repo_name": "NischithaM/springdemo", "sub_path": "/src/com/cruds/demo/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 1089, "line_count": 68, "lang": "en", "doc_type": "code", "blob_id": "94acbc3f481d575218c44a51ba3fe7e7d8e2d414", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/NischithaM/springdemo | 268 | FILENAME: User.java | 0.261331 | package com.cruds.demo;
public class User {
private String name;
private String country;
private int age;
private Address address;
/*
public User() {
super();
}*/
public User(String name, String country, int age) {
super();
this.name = name;
this.country = country;
this.age = age;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public User(String name, String country, int age, Address address) {
super();
this.name = name;
this.country = country;
this.age = age;
this.address = address;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Override
public String toString() {
return "User [name=" + name + ", country=" + country + ", age=" + age + ", address=" + address + "]";
}
}
|
18c4327c-8a10-4a58-aa26-f2b85bb3aeb4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-07-20 18:48:39", "repo_name": "MaxxtonGroup/microdocs", "sub_path": "/example/product-service/src/main/java/com/example/service/product/domain/Product.java", "file_name": "Product.java", "file_ext": "java", "file_size_in_byte": 1093, "line_count": 59, "lang": "en", "doc_type": "code", "blob_id": "493b987ce8ded37bc2b617eb1e3216b564e8be4a", "star_events_count": 11, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/MaxxtonGroup/microdocs | 229 | FILENAME: Product.java | 0.255344 | package com.example.service.product.domain;
import org.hibernate.validator.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
*
* @author Steven Hermans (s.hermans@maxxton.com)
*/
public class Product implements Serializable{
/** @example 15 */
private Long productId;
/** @example dam */
@NotNull
@NotEmpty
private String name;
/** @dummy 6 */
@NotNull
@NotEmpty
private Double price;
public Product(){}
public Product(Long productId, String name, Double price) {
this.productId = productId;
this.name = name;
this.price = price;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
}
|
4b100a9c-ebc2-45b7-8855-48c2821a9efb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-02-27 10:54:13", "repo_name": "jss-emr/jss-openerp-integration", "sub_path": "/openerp-service/src/test/java/org/jss/openerp/web/service/OpenERPServiceIT.java", "file_name": "OpenERPServiceIT.java", "file_ext": "java", "file_size_in_byte": 1202, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "2da34975007c3e0d008553585cff911323201b31", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jss-emr/jss-openerp-integration | 239 | FILENAME: OpenERPServiceIT.java | 0.295027 | package org.jss.openerp.web.service;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:applicationContext-Test.xml"})
public class OpenERPServiceIT extends TestCase {
@Autowired
OpenERPService openerpService;
public @Value("${host}") String host;
public @Value("${port}") int port;
public @Value("${database}") String database;
public @Value("${user}") String user;
public @Value("${password}") String password;
public void setUp() {
}
public void tearDown() {
}
@Test
public void shouldCreateFindAndDeleteCustomer() throws Exception {
setUp();
String name= "Raman Singh";
String patientId ="12245";
openerpService.createCustomer(name,patientId);
openerpService.deleteCustomerWithPatientReference(patientId);
}
}
|
38afab5c-dcfe-4fff-857a-d3330feac6c2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-15 19:40:09", "repo_name": "Romanow/core", "sub_path": "/rest-client-jmh/src/jmh/java/ru/romanow/core/rest/client/RestClientStressTest.java", "file_name": "RestClientStressTest.java", "file_ext": "java", "file_size_in_byte": 1123, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "90e4201aecdfebe0b59434c15378926f8ff21065", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Romanow/core | 253 | FILENAME: RestClientStressTest.java | 0.292595 | package ru.romanow.core.rest.client;
import org.openjdk.jmh.annotations.*;
import org.springframework.web.client.RestTemplate;
import ru.romanow.core.spring.rest.client.SpringRestClient;
@BenchmarkMode(Mode.All)
@Warmup(iterations = 1, time = 2)
@Measurement(iterations = 10, time = 2)
@Fork(value = 1, warmups = 1)
public class RestClientStressTest {
private static final String TEST_URL = "http://example.com";
@State(Scope.Benchmark)
public static class RestClientState {
final RestClient restClient = new RestClient();
}
@Benchmark
public void testApacheRestClient(RestClientState state) {
state.restClient.get(TEST_URL, Void.class).execute();
}
@State(Scope.Benchmark)
public static class SpringRestClientState {
final SpringRestClient restClient = new SpringRestClient(buildRestTemplate());
private RestTemplate buildRestTemplate() {
return new RestTemplate();
}
}
@Benchmark
public void testSpringRestClient(SpringRestClientState state) {
state.restClient.get(TEST_URL, Void.class).execute();
}
}
|
30595742-1a09-4075-87a7-6db7e6d7b4a6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-14 04:44:03", "repo_name": "kitajima2910/learn-java", "sub_path": "/ADF-2/src/JPL/S/L006/configuration/InitConnection.java", "file_name": "InitConnection.java", "file_ext": "java", "file_size_in_byte": 1202, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "795f330d1f6ccaa9457d6e0c0d809530d38d6c13", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kitajima2910/learn-java | 251 | FILENAME: InitConnection.java | 0.268941 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package JPL.S.L006.configuration;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
*
* @author Lan-T
*/
public class InitConnection {
private static final String JDBC_DRIVER = "com.mysql.cj.jdbc.Driver";
private static final String DB_URL = "jdbc:mysql://localhost:3306/db_t11910m3?useLegacyDatetimeCode=false&serverTimezone=UTC";
private static final String USER = "root";
private static final String PASSWORD = "";
private Connection conn = null;
public Connection getConn() {
return conn;
}
public void setConn(Connection conn) {
this.conn = conn;
}
public void init() {
try {
Class.forName(JDBC_DRIVER);
System.out.println("Connecting to database...");
conn = DriverManager.getConnection(DB_URL, USER, PASSWORD);
} catch (ClassNotFoundException | SQLException e) {
System.out.println(e.getMessage());
}
}
}
|
a34e081b-b546-4a94-9502-8658b9d64dfe | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-01 08:23:55", "repo_name": "porag-ict-mbstu/Blood-Bank-System", "sub_path": "/src/java/main/deletedonor.java", "file_name": "deletedonor.java", "file_ext": "java", "file_size_in_byte": 1100, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "20cfcf50f89dad61b389b77485170bcb513e584f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/porag-ict-mbstu/Blood-Bank-System | 190 | FILENAME: deletedonor.java | 0.258326 | /*
* 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 main;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author Porag
*/
public class deletedonor extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String email=request.getParameter("email");
String pass=request.getParameter("pass");
String nid=request.getParameter("nid");
Task task=new Task();
boolean x=task.checkDonor(nid,email,pass);
if(x)
{
int t=task.deleteDonorfromDonorList(email, pass);
response.sendRedirect("homepage.jsp.jsp");
}
}
}
|
8662540a-a386-4d2c-8f6d-2de359176c30 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-05 09:28:37", "repo_name": "thakurakhilesh1998/myMovie", "sub_path": "/app/src/main/java/com/example/mymovie/Database/AppDatabase.java", "file_name": "AppDatabase.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "eb609687aa2e556ce0778ce12222496f91b08317", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/thakurakhilesh1998/myMovie | 208 | FILENAME: AppDatabase.java | 0.286169 | package com.example.mymovie.Database;
import android.content.Context;
import android.util.Log;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import com.example.mymovie.Modal.MoviesData;
@Database(entities = {MoviesData.class}, version = 1, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {
private static final String TAG = AppDatabase.class.getSimpleName();
private static final Object LOCK = new Object();
private static final String DATABASE_NAME = "MoviesData";
private static AppDatabase sInstance;
public static AppDatabase getInstance(Context context) {
if (sInstance == null) {
synchronized (LOCK) {
Log.d(TAG, "Create new database instance");
sInstance = Room.databaseBuilder(context.getApplicationContext(),
AppDatabase.class, AppDatabase.DATABASE_NAME)
.build();
}
}
Log.d(TAG, "Getting database instance");
return sInstance;
}
public abstract TaskDao taskDao();
} |
10e3e6d5-538f-4d4d-af30-6b10313034df | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-10-06 22:41:27", "repo_name": "qiaohhgz/shop-module", "sub_path": "/shop-core/src/test/java/com/jim/shop/entity/TestUser.java", "file_name": "TestUser.java", "file_ext": "java", "file_size_in_byte": 1021, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "b2bf057b8f3b127a9ed0528bcb63db74780ded60", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/qiaohhgz/shop-module | 226 | FILENAME: TestUser.java | 0.285372 | package com.jim.shop.entity;
import static org.junit.Assert.*;
import java.util.Date;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.jim.shop.util.HiberanteUtil;
public class TestUser {
private int id;
private SessionFactory sessionFactory;
private SessionFactory getSessionFactory() {
if (sessionFactory != null) {
return sessionFactory;
}
return new Configuration().configure().buildSessionFactory();
}
@Test
public void testAdd() {
Session session = HiberanteUtil.getSession();
session.beginTransaction();
User u = new User("jimTest", "123456", new Date());
u.setNickName("jimTest");
session.save(u);
id = u.getId();
assertNotNull("存储用户失败", id);
session.delete(u);
session.getTransaction().commit();
}
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
}
|
0744d365-6374-4bbf-841c-2c73973e05ec | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-28 13:48:13", "repo_name": "nuttapatb/Network", "sub_path": "/Server/src/sample/Server.java", "file_name": "Server.java", "file_ext": "java", "file_size_in_byte": 1203, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "554b3413dfedb5451bd16b93c64e9004c2e9013e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/nuttapatb/Network | 196 | FILENAME: Server.java | 0.27513 | package sample;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
public class Server implements Runnable{
ArrayList<PrintWriter> writers;
Controller controller;
ServerSocket serverSocket;
public Server(ArrayList<PrintWriter> writers,Controller controller){
this.writers = writers;
this.controller = controller;
}
@Override
public void run(){
System.out.println("Connect");
try{
serverSocket = new ServerSocket(11111);
while (true){
Socket clientSocket = serverSocket.accept();
PrintWriter writer = new PrintWriter(clientSocket.getOutputStream());
BufferedReader reader = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
writers.add(writer);
Thread c = new Thread(new clientHandle(reader,controller));
c.start();
}
}
catch (Exception e){
e.printStackTrace();
}
}
}
|
4042c891-dddb-4b3b-8b12-016262d46ec6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-03 09:05:17", "repo_name": "raczandras/webbeadando", "sub_path": "/src/main/java/hu/andras/service/CustomerServiceImpl.java", "file_name": "CustomerServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1052, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "c4d4efbe7066230a14b686a67a4169330ae695a4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/raczandras/webbeadando | 196 | FILENAME: CustomerServiceImpl.java | 0.264358 | package hu.andras.service;
import hu.andras.dao.CustomerDao;
import hu.andras.exceptions.UnknownCustomerException;
import hu.andras.model.Customer;
import hu.andras.model.CustomerOut;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.Collection;
@Slf4j
@Service
@RequiredArgsConstructor
public class CustomerServiceImpl implements CustomerService {
private final CustomerDao customerDao;
@Override
public Collection<CustomerOut> getAllCustomers() {
return customerDao.readAll();
}
@Override
public void recordCustomer(Customer customer) {
customerDao.createCustomer(customer);
}
@Override
public void deleteCustomer(Customer customer) throws UnknownCustomerException {
customerDao.deleteCustomer(customer);
}
@Override
public void updateFirstMatch(Customer original, Customer updated) throws UnknownCustomerException {
customerDao.updateFirstMatch( original, updated);
}
}
|
5bac64ea-57d3-49b7-8d5f-cf8ce2d48c1a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-10 21:57:22", "repo_name": "ericafenyo/build-it-bigger", "sub_path": "/FinalProject/backend/src/main/java/com/udacity/gradle/builditbigger/backend/MyEndpoint.java", "file_name": "MyEndpoint.java", "file_ext": "java", "file_size_in_byte": 1093, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "9fdb37576a56a554fea0032a4776a7e1fbe97a30", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ericafenyo/build-it-bigger | 230 | FILENAME: MyEndpoint.java | 0.267408 | /*
For step-by-step instructions on connecting your Android application to this backend module,
see "App Engine Java Endpoints Module" template documentation at
https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints
*/
package com.udacity.gradle.builditbigger.backend;
import com.example.javalib.JokesProvider;
import com.google.api.server.spi.config.Api;
import com.google.api.server.spi.config.ApiMethod;
import com.google.api.server.spi.config.ApiNamespace;
import javax.inject.Named;
/** An endpoint class we are exposing */
@Api(
name = "jokerApi",
version = "v1",
namespace = @ApiNamespace(
ownerDomain = "backend.builditbigger.gradle.udacity.com",
ownerName = "backend.builditbigger.gradle.udacity.com",
packagePath = ""
)
)
public class MyEndpoint {
@ApiMethod(name = "getJokes")
public JokerBean getJokes() {
JokerBean response = new JokerBean();
response.setData(new JokesProvider().provide());
return response;
}
} |
240d55df-fb92-44ac-94b4-af8769dab2c1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-18 08:56:48", "repo_name": "kexiaomeng/nettyTest", "sub_path": "/springbootnettyacuturo/src/main/java/com/sun/nari/springbootnetty/util/SpringContextUtil.java", "file_name": "SpringContextUtil.java", "file_ext": "java", "file_size_in_byte": 1159, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "49cb14f134a5291596d3d08ce3737446b7a3dbb9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kexiaomeng/nettyTest | 243 | FILENAME: SpringContextUtil.java | 0.288569 | /**
* SpringContext工具类
*/
package com.sun.nari.springbootnetty.util;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* 定义SpringContext工具,用于获取实例
* @author FLOYD
* @time 2016年5月18日下午11:17:53
*/
@Component
public class SpringContextUtil implements ApplicationContextAware {
private static ApplicationContext context = null;
/* (non-Javadoc)
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
SpringContextUtil.context = applicationContext;
}
@SuppressWarnings("unchecked")
private static <T> T getBean(String beanName) {
return (T) context.getBean(beanName);
}
@SuppressWarnings("unchecked")
public static <T> T getBean(String beanName,Object object) {
if (object == null) {
return getBean(beanName);
}
return (T) object;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.