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 |
|---|---|---|---|---|---|---|
789412f8-37ab-4d8b-b2b3-51080d297614 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-26 12:17:59", "repo_name": "Ziem0/Musicator", "sub_path": "/musicLibrary/src/main/java/com/music/library/dao/OwnersDao.java", "file_name": "OwnersDao.java", "file_ext": "java", "file_size_in_byte": 1162, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "d9e69a3a3b2db8764c497083413106cad1ba693a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Ziem0/Musicator | 214 | FILENAME: OwnersDao.java | 0.295027 | package com.music.library.dao;
import com.music.library.model.Album;
import com.music.library.model.User;
import lombok.extern.slf4j.Slf4j;
import java.sql.*;
@Slf4j
public class OwnersDao extends AbstractDao {
private static OwnersDao dao = null;
private Connection connection;
private ResultSet result;
private PreparedStatement preparedStatement;
private Statement statement;
private OwnersDao() {
this.connection = ConnectDB.getConnection();
}
public static OwnersDao getDao() {
if (dao == null) {
synchronized (OwnersDao.class) {
if (dao == null) {
dao = new OwnersDao();
}
}
}
return dao;
}
public void addNewRecord(User user, Album album) throws SQLException { //check if available
String command = "insert into owners values(?,?);";
preparedStatement = connection.prepareStatement(command);
preparedStatement.setInt(1,user.getId());
preparedStatement.setInt(2,album.getId());
preparedStatement.executeUpdate();
preparedStatement.close();
}
}
|
134925af-168d-4577-a211-64887680d1cf | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-09-15T17:38:32", "repo_name": "patyalves17/spotify-challenge-xp", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1025, "line_count": 26, "lang": "en", "doc_type": "text", "blob_id": "75f19128d18f9b7d6ed4549ac7e956792b790dba", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/patyalves17/spotify-challenge-xp | 231 | FILENAME: README.md | 0.190724 |
# SpotifyChallengeXp
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.1.
## Installation
clone the repository and install its dependencies running:
$ npm install
## Using your own credentials
You will need to register your app and get your own credentials from the Spotify for Developers Dashboard.
To do so, go to [your Spotify for Developers Dashboard](https://beta.developer.spotify.com/dashboard) and create your application. For the examples, I registered these Redirect URIs:
* http://localhost:4200 (needed for the implicit grant flow)
Once you have created your app, replace the `clientID`, and `clientSecret` in the environments with the ones you get from My Applications.
## Run the project
Run `ng serve`|`npm start` for a dev server. Navigate to `http://localhost:4200`. The app will automatically reload if you change any of the source files.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
472f8b10-0524-449c-a0f0-4603876e489e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-04 15:07:00", "repo_name": "hklv/netty-practice", "sub_path": "/src/main/java/com/lhk/HelloServer.java", "file_name": "HelloServer.java", "file_ext": "java", "file_size_in_byte": 1036, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "7cb53232449cefdc3111e459ab6c5a21fa3e2d22", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hklv/netty-practice | 232 | FILENAME: HelloServer.java | 0.253861 | package com.lhk;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
/**
* @Author: HuiKang Lv
* @Description:
* @Date: create at 2017/10/31 14:23
*/
public class HelloServer {
private static final int port = 7878;
public static void main(String[] args) throws Exception {
EventLoopGroup bossGroup = new NioEventLoopGroup();
EventLoopGroup workerGroup = new NioEventLoopGroup();
try {
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup);
b.channel(NioServerSocketChannel.class);
b.childHandler(new HelloServerInitializer());
ChannelFuture f = b.bind(port).sync();
f.channel().closeFuture().sync();
} finally {
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
}
}
|
24763140-5ffa-4116-987c-0317547c1371 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-06 11:10:14", "repo_name": "sushma141/seleniumF-W", "sub_path": "/MavenVtigerSeleniumProject/src/main/java/com/vtiger/objectRepository/HomePage.java", "file_name": "HomePage.java", "file_ext": "java", "file_size_in_byte": 1197, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "d7dcaf799056b03b5378605e262baa1c23da751f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sushma141/seleniumF-W | 260 | FILENAME: HomePage.java | 0.29584 | package com.vtiger.objectRepository;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
public class HomePage {
@FindBy(linkText="More")
private WebElement More;
@FindBy(linkText="Campaigns")
private WebElement Campaigns;
@FindBy(xpath="//span[text()='administor']/../following-sibiling::td[1]")
private WebElement signoutdd;
@FindBy(linkText="Sign Out")
private WebElement SignOutLink;
@FindBy(linkText="Organizations")
private WebElement Organisation;
public WebElement getOrganisation() {
return Organisation;
}
public WebElement getMore() {
return More;
}
public WebElement getCampaigns() {
return Campaigns;
}
public WebElement getSignoutdd() {
return signoutdd;
}
public WebElement getSignOutLink() {
return SignOutLink;
}
public void navigateToCampaign()
{
Campaigns.click();
}
public void navigateToOrganisation() {
Organisation.click();
}
public void logoutFromApp()
{
Actions act=new Actions(com.vtiger.genericLib.BaseClass.driver);
act.moveToElement(signoutdd).perform();
SignOutLink.click();
}
}
|
c45049be-a4d0-46d6-905e-64f4750548fb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-06-03 13:50:29", "repo_name": "tylertreat/Whiteboard", "sub_path": "/src/com/whiteboard/model/Whiteboard.java", "file_name": "Whiteboard.java", "file_ext": "java", "file_size_in_byte": 1065, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "c5035df4ef1837dffe077b71352ea9e4eb7eabfd", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tylertreat/Whiteboard | 232 | FILENAME: Whiteboard.java | 0.292595 | package com.whiteboard.model;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import com.whiteboard.ui.view.WhiteboardView;
import com.whiteboard.ui.view.WhiteboardView.DrawingPoint;
public class Whiteboard {
private Canvas mCanvas;
private Bitmap mBitmap;
private WhiteboardView mWhiteboardView;
public Whiteboard(WhiteboardView whiteboardView, int width, int height) {
mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mBitmap);
mWhiteboardView = whiteboardView;
}
public Bitmap getBitmap() {
return mBitmap;
}
public void setBitmap(Bitmap bitmap) {
mBitmap = bitmap;
}
public Canvas getCanvas() {
return mCanvas;
}
public void setCanvas(Canvas canvas) {
mCanvas = canvas;
}
public boolean update(DrawingPoint drawingPoint) {
return mWhiteboardView.update(drawingPoint);
}
public boolean update(Bitmap bitmap) {
return mWhiteboardView.update(bitmap);
}
}
|
ee5db069-f6da-43c0-8a70-a0dde00f0229 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-04-29 14:16:09", "repo_name": "18668031200/LC", "sub_path": "/src/main/java/com/ygdxd/nio/Acceptor.java", "file_name": "Acceptor.java", "file_ext": "java", "file_size_in_byte": 1216, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "ef61efaf86efe3091f64c110d98749b1dd17a6f1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/18668031200/LC | 254 | FILENAME: Acceptor.java | 0.27048 | package com.ygdxd.nio;
import java.io.IOException;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
/**
* @author Created by ygdxd_admin at 2018-07-12 下午11:18
*/
public class Acceptor implements Runnable {
private Reactor reactor;
public Acceptor(Reactor reactor) {
this.reactor = reactor;
}
@Override
public void run() {
// 接受client连接请求
try {
SocketChannel sc = reactor.serverSocketChannel.accept();
System.out.println(sc.socket().getRemoteSocketAddress().toString() + " is connected.");
if (sc != null) {
sc.configureBlocking(false);
// SocketChannel向selector注册一个OP_READ事件,然后返回该通道的key
SelectionKey sk = sc.register(reactor.selector, SelectionKey.OP_READ);
// 使一个阻塞住的selector操作立即返回
reactor.selector.wakeup();
// 通过key为新的通道绑定一个附加的TCPHandler对象
sk.attach(new TCPHandler(sk, sc));
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
f433abf8-7814-4968-ac28-42db10e4bb9b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-21 10:51:11", "repo_name": "ibisTime/xn-gchf", "sub_path": "/src/main/java/com/cdkj/gchf/enums/EUser.java", "file_name": "EUser.java", "file_ext": "java", "file_size_in_byte": 1063, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "968f305244185d643ee4b295acdd3f1ad4a6bb9f", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/ibisTime/xn-gchf | 292 | FILENAME: EUser.java | 0.276691 | /**
* @Title EUser.java
* @Package com.ibis.account.enums
* @Description
* @author miyb
* @date 2015-2-26 下午3:08:34
* @version V1.0
*/
package com.cdkj.gchf.enums;
import java.util.HashMap;
import java.util.Map;
/**
* @author: miyb
* @since: 2015-2-26 下午3:08:34
* @history:
*/
public enum EUser {
// li表示程序
LI("li", "程序"), ADMIN("admin", "系统管理员");
EUser(String code, String value) {
this.code = code;
this.value = value;
}
public static Map<String, EUser> getMap() {
Map<String, EUser> map = new HashMap<String, EUser>();
for (EUser eUser : EUser.values()) {
map.put(eUser.getCode(), eUser);
}
return map;
}
public static String getValue(String code) {
Map<String, EUser> map = getMap();
return map.get(code).getValue();
}
private String code;
private String value;
public String getCode() {
return code;
}
public String getValue() {
return value;
}
}
|
2327f58b-ab08-48c6-9b41-72d2bd9b18f4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-26 18:34:46", "repo_name": "IvanNikolaychuk/java-school", "sub_path": "/src/main/java/com/school/domain/code/program/ExecutionResult.java", "file_name": "ExecutionResult.java", "file_ext": "java", "file_size_in_byte": 1164, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "642f35812852c6ca7fd5ac93ae292739ccf9f238", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/IvanNikolaychuk/java-school | 209 | FILENAME: ExecutionResult.java | 0.289372 | package com.school.domain.code.program;
import static com.school.domain.code.program.Compilation.noCompilationErrors;
public class ExecutionResult {
private String programOutput;
private Compilation compilation;
private Object methodResult;
private ExecutionResult(Compilation compilation, String programOutput, Object methodResult) {
this.compilation = compilation;
this.programOutput = programOutput;
this.methodResult = methodResult;
}
static ExecutionResult withFailedCompilation(Compilation compilation) {
return new ExecutionResult(compilation, "", null);
}
static ExecutionResult withPassedCompilation(String programprogramOutput, Object methodResult) {
return new ExecutionResult(noCompilationErrors(), programprogramOutput, methodResult);
}
public boolean hasCompilationFailed() {
return !compilation.getProblems().isEmpty();
}
public String getProgramOutput() {
return programOutput;
}
public Compilation getCompilation() {
return compilation;
}
public Object getMethodResult() {
return methodResult;
}
}
|
1ac865b6-1014-4f9b-a0b1-826c5be3a616 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-14 20:06:42", "repo_name": "Artem-Maksimov/New", "sub_path": "/Phone_Book/Phone Book/src/Maksimov/Phone_Book/Services/impl/ContactsServiceImpl.java", "file_name": "ContactsServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1189, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "3a7c5c769b7df318e4ff0bea334e0aa1efc4759a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Artem-Maksimov/New | 221 | FILENAME: ContactsServiceImpl.java | 0.226784 | package Maksimov.Phone_Book.Services.impl;
import Maksimov.Phone_Book.Model.Contacts;
import Maksimov.Phone_Book.Services.ContactsService;
import javafx.collections.FXCollections;
import javafx.collections.List;
public abstract class ContactsServiceImpl implements ContactsService {
private final List<Contacts> contactList;
private Contacts newContact;
private int idContact;
public ContactsServiceImpl() {
this.contactList = FXCollections.ArrayList();
}
public void createContact(Contacts contact) {
idContact++;
contactList.put(idContact, new Contacts(idContact, newContact.getName(), newContact.getPhone()));
public void deleteContact(long id) {
contactList.remove(id);
}
public List<Contacts> showContact() {
return contactList;
}
public void editContact(Contacts newContact){
for (Contacts contact : contactList.values()) {
if (contact.getId() == newContact.getId()){
newContact.setName();
contact.setPhone(newContact.getPhone());
return;
}
}
} |
e1c2e874-db7a-4287-8967-2b79566a3b4e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2014-12-12T02:48:40", "repo_name": "dwmhema/Portfolio-final", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1010, "line_count": 33, "lang": "en", "doc_type": "text", "blob_id": "ae2610a796aedd3b11c4c01e92901f83cf29facb", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dwmhema/Portfolio-final | 291 | FILENAME: README.md | 0.242206 | # Final Assignment-Hemachandra Dewamuni
## Installation
- Run `npm install` in the root
- Run `gulp` or `gulp watch` to run build tasks/watch for file changes
- Run `node server.js` to begin running server on **127.0.0.1:3000**
- Run npm install express
- Run npm install sass
Set up the gulpfile.js file in order to work with dependencies,
whenever you edit any file, you have to run gulp or gulp watch then all
file will be updated accordingly.
Work page is the most important page, but particle are not visible there
## Dependancies
- [Backbone.js](http://backbonejs.org/)
- [Handlebars.js](http://handlebarsjs.com/)
- [jQuery](http://jquery.com/)
- [Express](http://expressjs.com/)
## Dev Dependancies
- [Gulp](gulpjs.com)
- [Gulp SASS](https://www.npmjs.org/package/gulp-sass)
- [Gulp Imagemin](https://www.npmjs.org/package/gulp-imagemin)
- [Gulp Rename](https://www.npmjs.org/package/gulp-rename)
- [Gulp Jade](https://www.npmjs.org/package/gulp-jade)
Site Developed by Hemachandra Dewamuni |
93fcf502-f551-46ef-847f-d02d83a6603c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-02 13:37:25", "repo_name": "crimsondevil/darksky", "sub_path": "/app/src/main/java/com/example/weatherapplication/network/Model/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 1043, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "87b3f0cd478ad11257529aa2c2a0efd5f27dacdc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/crimsondevil/darksky | 214 | FILENAME: User.java | 0.198064 | package com.example.weatherapplication.network.Model;
import androidx.annotation.NonNull;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class User {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("username")
@Expose
private String username;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@NonNull
@Override
public String toString() {
String description = "\n Id: " + id.toString()
+"\n Name: " + name
+"\n Username: "+username;
return description;
}
}
|
9120a621-49fc-4590-bee6-1f6c15eaca6b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-04 15:09:52", "repo_name": "skhandge/mssc-beer-inventory-service", "sub_path": "/src/main/java/guru/sfg/beer/inventory/service/services/NewInventoryListener.java", "file_name": "NewInventoryListener.java", "file_ext": "java", "file_size_in_byte": 1163, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "444996f64a0eaafeee98dd5eeb18b23c51b32930", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/skhandge/mssc-beer-inventory-service | 233 | FILENAME: NewInventoryListener.java | 0.278257 | package guru.sfg.beer.inventory.service.services;
import guru.sfg.beer.inventory.service.config.JmsConfig;
import guru.sfg.beer.inventory.service.domain.BeerInventory;
import guru.sfg.beer.inventory.service.repositories.BeerInventoryRepository;
import guru.sfg.brewery.model.events.BeerDto;
import guru.sfg.brewery.model.events.NewInventoryEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;
@Component
@Slf4j
@RequiredArgsConstructor
public class NewInventoryListener {
private final BeerInventoryRepository beerInventoryRepository;
@JmsListener(destination = JmsConfig.NEW_INVENTORY_QUEUE)
public void listen(NewInventoryEvent event){
log.debug("Got Inventory " + event.toString());
BeerInventory beerInventory = new BeerInventory();
beerInventory.setBeerId(event.getBeerDto().getId());
beerInventory.setUpc(event.getBeerDto().getUpc());
beerInventory.setQuantityOnHand(event.getBeerDto().getQuantityOnHand());
beerInventoryRepository.save(beerInventory);
}
}
|
0da0f9e2-806d-4dba-9330-35358b3758ea | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-05-18T13:45:37", "repo_name": "wengair/codewizard", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1230, "line_count": 42, "lang": "en", "doc_type": "text", "blob_id": "8cf5cc1a0826293c1cd2c500be2badb18d42ed3d", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/wengair/codewizard | 326 | FILENAME: README.md | 0.268941 | # Code Wizard
A Rails project turns flash cards into a webpage game to make the learning the basics of Ruby more interesting and engaging.
## Features
- Fully animated with sound effect
- Fully functional combat system
- Fully functional item and inventory system
- Leaderboard and points system
## Using Cos Find
Link: [https://codewizardjt.herokuapp.com/](https://codewizardjt.herokuapp.com/)
You are welcome to create a new account or use following account to look around
Email: `aaa@hotmail.com`
Pass: `testtest`
**Remember to open the sound!**
## Screenshots
Landing page

In the town

Stage list

Battle scene

## Languages
Ruby
HTML/CSS
JavaScript
MySQL
## Gems/Frameworks
Ruby on Rails
PostgreSQL
Webpacker
Pundit
NES.css
Simple Form
Bootstrap
Font-awesome
## Credits
Code Wizard was made in collaboration with [Jordan Luong](https://github.com/jordanwl/) and [Yuji Masuda](https://github.com/yujimsd) over a period of 11 days as part of our final project at [Le Wagon coding bootcamp](https://www.lewagon.com/).
|
28307656-e40a-4059-ad02-a2590d7e25a7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-04 10:31:48", "repo_name": "dasavijit12/jenkinsproject", "sub_path": "/com.ibm.jenkins/src/test/java/com/ibm/jenkins/com/ibm/jenkins/DemoFirefoxTest.java", "file_name": "DemoFirefoxTest.java", "file_ext": "java", "file_size_in_byte": 1191, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "2c7a32ab472e9a64bef3f10838e57ced1ab2785d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dasavijit12/jenkinsproject | 259 | FILENAME: DemoFirefoxTest.java | 0.288569 | package com.ibm.jenkins.com.ibm.jenkins;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.Assert;
import org.testng.annotations.Test;
public class DemoFirefoxTest {
WebDriver driver;
@Test
public void demoFirefoxTest() {
String baseUrl = "http://realestate.hommelle.com";
System.out.println("***************This is firefox testing***************");
System.out.println("***************This is before Launching Browser***************");
System.setProperty
("webdriver.gecko.driver", "C:\\Users\\IBM_ADMIN\\Downloads\\selenium\\geckodriver-v0.20.1-win64\\geckodriver.exe");
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability("marionette", true);
cap.setBrowserName("firefox");
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get(baseUrl);
System.out.println("***************This is after Launching Browser***************");
String expectedTitle = "Real Estate";
String actualTitle = driver.getTitle();
Assert.assertEquals(expectedTitle, actualTitle);
}
}
|
bde1a972-07c9-47a3-ba82-5ac6d97fbc9c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-18T13:52:28", "repo_name": "bchenghi/ip", "sub_path": "/src/main/java/duke/Main.java", "file_name": "Main.java", "file_ext": "java", "file_size_in_byte": 1068, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "6073841d4d4a38aac4925884b537541a652f955b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/bchenghi/ip | 210 | FILENAME: Main.java | 0.26971 | package duke;
import java.io.IOException;
import duke.ui.MainWindow;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
public class Main extends Application {
private Duke duke = new Duke("data/duke.txt");
public Main() {}
@Override
public void start(Stage stage) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("/view/MainWindow.fxml"));
AnchorPane ap = fxmlLoader.load();
Scene scene = new Scene(ap);
stage.setScene(scene);
stage.setTitle("Duke");
stage.getIcons().add(new Image(Main.class.getResource("/images/DukeLogo.png").toExternalForm()));
fxmlLoader.<MainWindow>getController().setDuke(duke);
fxmlLoader.<MainWindow>getController().printOpeningMessage();
stage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
4a4b138b-3bea-4867-b87d-64d6f7cf86f3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-26 08:07:12", "repo_name": "lkb573/Web-learning", "sub_path": "/src/main/java/kr/re/kitri/hello/controller/BslolController.java", "file_name": "BslolController.java", "file_ext": "java", "file_size_in_byte": 1164, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "20490ff0bb4aa0554d9308a8077eb91326d3756a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lkb573/Web-learning | 264 | FILENAME: BslolController.java | 0.246533 | package kr.re.kitri.hello.controller;
import kr.re.kitri.hello.common.MockBslol;
import kr.re.kitri.hello.model.Bslol;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
@Controller
public class BslolController {
@RequestMapping("/bslol")
public ModelAndView bslol(){
MockBslol mock = new MockBslol();
List<Bslol> list = mock.getBslols();
return new ModelAndView("bslol/bs_sample")
.addObject("list", list);
}
@RequestMapping("/bslol/bs-read")
public String bslolread(){
return "bslol/bs_read";
}
@RequestMapping("/bslol/bs-write")
public String bslolwrite(){
return "bslol/bs_write";
}
/*@RequestMapping("/bs-write/{bsnum}")
public ModelAndView bslolwrite(@PathVariable("bsnum") String bsnum){
ModelAndView mav = new ModelAndView();
mav.setViewName("bslol/bs_write");
mav.addObject("bsnum",bsnum);
return mav;
}*/
}
|
caf00ca7-615f-400c-8d14-ed94479ccce8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-19 12:12:13", "repo_name": "pinwei1900/workspace", "sub_path": "/annotation/src/main/java/fdasdfads/AnnotationProcessor.java", "file_name": "AnnotationProcessor.java", "file_ext": "java", "file_size_in_byte": 961, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "e7b236cd61670e5effd2229b7b9dced957e0f0e8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/pinwei1900/workspace | 242 | FILENAME: AnnotationProcessor.java | 0.290981 | /*
* Copyright (c) 2018年06月08日 by XuanWu Wireless Technology Co.Ltd.
* All rights reserved
*/
package fdasdfads;
import java.lang.reflect.Constructor;
/**
* @Description
* @Author <a href="mailto:haosonglin@wxchina.com">songlin.Hao</a>
* @Date 2018/6/8
* @Version 1.0.0
*/
public class AnnotationProcessor {
public static void init(Object object) {
if (!(object instanceof User)) {
throw new IllegalArgumentException();
}
Constructor[] constructors = object.getClass().getDeclaredConstructors();
for (Constructor constructor : constructors) {
if (constructor.isAnnotationPresent(UserMeta.class)) {
UserMeta userFill = (UserMeta) constructor.getAnnotation(UserMeta.class);
int age = userFill.age();
int id = userFill.id();
String name = userFill.name();
((User) object).setAge(age);
((User) object).setId(id);
((User) object).setName(name);
}
}
}
}
|
4ba28700-bf06-465c-b3bb-8aafa9590c6e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-08-26 17:04:37", "repo_name": "kasperpagh/Q2-W1", "sub_path": "/src/blockQueTest/TTaker.java", "file_name": "TTaker.java", "file_ext": "java", "file_size_in_byte": 1110, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "da592b525d179993d6b9c6841aad18a8c8a31b5c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kasperpagh/Q2-W1 | 255 | FILENAME: TTaker.java | 0.267408 | /*
* 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 blockQueTest;
import java.util.List;
import java.util.Stack;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
/**
*
* @author pagh
*/
public class TTaker extends Thread
{
// private Stack stack;
private BlockingQueue abe = new ArrayBlockingQueue(10000);
public TTaker(BlockingQueue abe)
{
this.abe = abe;
}
// public TTaker(Stack stack)
// {
// this.stack = stack;
// }
public void run()
{
while (true)
{
taker(abe);
}
}
public void taker(BlockingQueue abe)
{
abe.poll();
System.out.println(abe.size());
}
// public synchronized void taker(Stack stack)
// {
// while (!stack.empty())
// {
// stack.pop();
// System.out.println("Taker har poppet stacken!!");
// }
// }
}
|
187072a2-7332-4c47-9a4b-2f454029cede | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2013-02-22T20:42:30", "repo_name": "lacides/Publisher", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1229, "line_count": 26, "lang": "en", "doc_type": "text", "blob_id": "01b93ee14b577d03f089a2c27db773085b64cc39", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lacides/Publisher | 296 | FILENAME: README.md | 0.280616 | # Publisher
## What's this?
A example of Sinatra::Streaming
It serves SSEs in a channel/event schema
## What can you do with it?
For starters, fire it up with thin start or foreman start.
Then open your SSE/websocket supporting browser (let's go with the latest version of chrome) and hit localhost:3000/test
You'll be in a page with an open EventSource listening to server sent events trough the channel testchannel and for the event testevent
So you can open your irb and:
require 'net/http'
uri = URI('http://localhost:3000/publish')
Net::HTTP.post_form(uri, 'channel' => 'testchannel', 'event' => 'testevent', 'data' => '<br> Hello there')
And look at that, your data is showing up at real-time on your browser
## What's next?
Well, I'd love to put in some of my projects models something like notify_to_publisher and have my model send to Publisher its json representation on each create, update, or destroy. Hey! Those sound like events, right?
Let's say I have a Post model and by dropping notify_to_publisher on it, on each CRUD operation the model will send its own json to the server using the post channel on the create, update or delete events.
Yeah, I think that's what I'll do next. |
e40ad887-d365-49c9-87b5-2bcc6383a187 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-11 06:43:14", "repo_name": "mahdikhaliki/CS-Classes", "sub_path": "/CS151 Object-Oriented Design Workplace/Assignment3/Customer.java", "file_name": "Customer.java", "file_ext": "java", "file_size_in_byte": 1036, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "f28c6cb3d38569c2ff8933cdd9eae5a1acd62114", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mahdikhaliki/CS-Classes | 192 | FILENAME: Customer.java | 0.240775 | public class Customer extends Person {
private String paymentPreference;
public Customer() {
super();
paymentPreference = "";
}
public Customer(String firstName, String lastName) {
super(firstName, lastName);
paymentPreference = "";
}
public Customer(String firstName, String lastName, Address address) {
super(firstName, lastName, address);
paymentPreference = "";
}
public void makePayment() {
System.out.println("Payment Preference: "+paymentPreference);
}
public String toString() {
return "Customer\n"+super.toString();
}
public void introduce() {
System.out.println(toString());
}
public void introduce(boolean social) {
System.out.println(toString());
if (social) System.out.println("Social: "+getSocial());
}
public void setPaymentPreference(String preference) {paymentPreference = preference;}
public String getPaymentPreference() { return paymentPreference; }
}
|
745ad240-f178-4de8-a927-98be66c06758 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-28 15:07:53", "repo_name": "gunjanaggarwal210/complaint_management", "sub_path": "/customercomplaintmanagement/src/customercomplaintmanagement/dbutil.java", "file_name": "dbutil.java", "file_ext": "java", "file_size_in_byte": 1190, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "8fd1179e43a3db1958a5ea0c09e5f30083c3504c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gunjanaggarwal210/complaint_management | 219 | FILENAME: dbutil.java | 0.285372 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package customercomplaintmanagement;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
/**
*
* @author GUNJAL
*/
public class dbutil {
static Connection con;
public static void getcon() throws FileNotFoundException, IOException, ClassNotFoundException, SQLException{
if(con==null){
FileInputStream fis;
fis=new FileInputStream("config.properties");
Properties prp=new Properties();
prp.load(fis);
fis.close();
Class.forName(prp.getProperty("driver"));
con=DriverManager.getConnection(prp.getProperty("url"),prp.getProperty("uname"),"");
}
}
public static void closecon() throws SQLException{
if(con==null)
return;
else{
con.close();
con=null;
}
}
}
|
2a767eda-4e70-410c-aace-f08ab40656b7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-06 11:49:24", "repo_name": "moumita09/FileEncription", "sub_path": "/springboot-batch/src/main/java/com/javainuse/step/Writer.java", "file_name": "Writer.java", "file_ext": "java", "file_size_in_byte": 1009, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "e1db0ae0145212e59d6b5f0440d2076cbb1d6e7c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/moumita09/FileEncription | 213 | FILENAME: Writer.java | 0.289372 | package com.javainuse.step;
import java.io.File;
import java.io.FileWriter;
import java.util.List;
import org.springframework.batch.item.ItemWriter;
import com.javainuse.controller.JobInvokerController;
public class Writer implements ItemWriter<String> {
@Override
public void write(List<? extends String> messages) throws Exception {
JobInvokerController jc = new JobInvokerController();
String filePath = jc.getJobParameters();
String path=filePath.substring(filePath.lastIndexOf("/")+1);
String newpath=filePath.replace(path, "output_"+path);
File file = new File(newpath);
file.getName();
if (file.createNewFile())
{
System.out.println("File is created!");
} else {
System.out.println("File already exists.");
}
for (String msg : messages) {
FileWriter writer = new FileWriter(file,true);
writer.write(msg+ "\n");
writer.close();
System.out.println("Writing the data " + msg);
}
}
} |
c781dd7c-1202-4546-b3e1-e48b4354df50 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-14 10:14:20", "repo_name": "LuisEngelniederhammer/styx", "sub_path": "/Core/src/main/java/net/petafuel/styx/core/xs2a/entities/InstructedAmount.java", "file_name": "InstructedAmount.java", "file_ext": "java", "file_size_in_byte": 1050, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "c9ee0141bba56d8e90d6302c514c15637317924b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/LuisEngelniederhammer/styx | 222 | FILENAME: InstructedAmount.java | 0.233706 | package net.petafuel.styx.core.xs2a.entities;
import javax.json.bind.annotation.JsonbProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
public class InstructedAmount {
@JsonbProperty("currency")
Currency currency;
@NotNull(message = "InstructedAmount cannot be null")
@NotEmpty(message = "InstructedAmount cannot be empty")
@JsonbProperty("amount")
String amount;
public InstructedAmount() {
//Default constructor for json bind
}
public InstructedAmount(String amount) {
this(amount, Currency.EUR);
}
public InstructedAmount(String amount, Currency currency) {
this.amount = amount;
this.currency = currency;
}
public Currency getCurrency() {
return currency;
}
public void setCurrency(Currency currency) {
this.currency = currency;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
}
|
c0aca2e9-ea3b-4c58-a8b7-e5ce16d2ebe9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-18 01:12:37", "repo_name": "apc4141/aidens-plugin", "sub_path": "/src/aidensplugin/items/model/RecipeItem.java", "file_name": "RecipeItem.java", "file_ext": "java", "file_size_in_byte": 1038, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "2351632423f6dadf613a2d8e198715ffc39df8ca", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/apc4141/aidens-plugin | 216 | FILENAME: RecipeItem.java | 0.285372 | package aidensplugin.items.model;
import org.bukkit.Material;
import org.bukkit.inventory.Recipe;
import java.util.HashMap;
public class RecipeItem {
private static final HashMap<String, Material> RECIPE_ITEMS = new HashMap<>();
public Material material;
public int amount;
public boolean requireTag;
public String tag;
public RecipeItem(Material material, int amount) {
this.material = material;
this.amount = amount;
requireTag = false;
tag = null;
}
public RecipeItem requireTag(String tag) {
if (tag == null) {
requireTag = false;
this.tag = null;
} else {
requireTag = true;
this.tag = tag;
}
return this;
}
public static void addItem(String item, Material material) {
RECIPE_ITEMS.put(item, material);
}
public static RecipeItem createItem(String item, int amount) {
return new RecipeItem(RECIPE_ITEMS.get(item), amount).requireTag(item);
}
}
|
5df0df51-5f37-4ce2-ab8c-33add6f62442 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-07-20T15:16:30", "repo_name": "ajboni/blog", "sub_path": "/static/posts/2020-06-08-configuring-wake-on-lan copy.md", "file_name": "2020-06-08-configuring-wake-on-lan copy.md", "file_ext": "md", "file_size_in_byte": 1189, "line_count": 62, "lang": "en", "doc_type": "text", "blob_id": "bfee4c7a6b09847c537cab8865fe218c2f365821", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ajboni/blog | 371 | FILENAME: 2020-06-08-configuring-wake-on-lan copy.md | 0.243642 | ---
title: Ubuntu - Configure Wake on LAN
slug: 2020-06-08-configuring-wake-on-lan
date_published: 2020-06-08
date_updated: 2020-06-08
tags:
- Ubuntu
- Linux
- WoL
---
I tried to set up WoL on my Linux Mint box. But it wasn't working...
<!-- more -->
First I've checked that Wake on LAN was enabled in the motherboard.
Then I've found out that the driver did not have it enabled by default/
```bash
$ sudo ethtool enp7s0 | grep Wake
Supports Wake-on: pumbg
Wake-on: d
```
That `d` on Wake-on: means disabled. To enable:
```bash
$ sudo ethtool -s enp7s0 wol g
```
And it worked!!! The issue is that this setting is lost after reboot. The (Arch Wiki)[https://wiki.archlinux.org/index.php/Wake-on-LAN#Enable_WoL_on_the_network_adapter] to the rescue!
```bash
$ sudo nano /etc/systemd/system/wol@.service
```
Added this content:
```ini
[Unit]
Description=Wake-on-LAN for %i
Requires=network.target
After=network.target
[Service]
ExecStart=/sbin/ethtool -s %i wol g
Type=oneshot
[Install]
WantedBy=multi-user.target
```
And finally:
```bash
$ sudo systemctl enable wol@enp7s0
```
Now power off and it should work.
NOTE: It won't work after hard poweroff or energy loss.
|
426510aa-9fdb-451c-ab59-3ee69096e066 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-04 00:57:13", "repo_name": "searleser97/HeartPreventSpring", "sub_path": "/HPWS/src/main/java/com/san/guiTextXSection/GuiTextXSectionService.java", "file_name": "GuiTextXSectionService.java", "file_ext": "java", "file_size_in_byte": 1016, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "50480be0d5ce0e78f64b681b7c9d00fe6d8449a0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/searleser97/HeartPreventSpring | 215 | FILENAME: GuiTextXSectionService.java | 0.283781 | package com.san.guiTextXSection;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
@Service
public class GuiTextXSectionService {
@Autowired
private GuiTextXSectionRepository guiTextXSectionRepository;
public List<GuiTextXSection> getAll() {
List<GuiTextXSection> records = new ArrayList<>();
guiTextXSectionRepository.findAll().forEach(records::add);
return records;
}
public GuiTextXSection getOne(Integer id) {
return guiTextXSectionRepository.findOne(id);
}
public void add(GuiTextXSection guiTextXSection) {
guiTextXSectionRepository.save(guiTextXSection);
}
public void update(GuiTextXSection guiTextXSection) {
// if exists updates otherwise inserts
guiTextXSectionRepository.save(guiTextXSection);
}
public void delete(Integer id) {
guiTextXSectionRepository.delete(id);
}
}
|
052abd70-53ea-4777-aba8-fd907e5a66ba | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-23 13:17:44", "repo_name": "PefKiaY/myhome", "sub_path": "/wisdombushome/src/main/java/com/home/cn/config/MyBatisMapperScannerConfig.java", "file_name": "MyBatisMapperScannerConfig.java", "file_ext": "java", "file_size_in_byte": 1159, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "1398ebb18283b8f07435e721275396f631864f7e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/PefKiaY/myhome | 257 | FILENAME: MyBatisMapperScannerConfig.java | 0.216012 | package com.home.cn.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
/**
* Copyright©2015 www.123cx.com All Rights Reserved. 版权所有 湖南智慧畅行交通科技有限公司
* Project: wisdombus-business
* Comments: 备用
* Author: pq
* Create Date:2017年5月6日
* Version:
*/
@ConfigurationProperties(prefix = "mybatis")
@EnableConfigurationProperties
public class MyBatisMapperScannerConfig {
// @Value("${mybatis.basePackage}")
private String basePackage;
// @Value("${mybatis.mapperLocations}")
private String mapperLocations;
public String getBasePackage() {
return basePackage;
}
public String getMapperLocations() {
return mapperLocations;
}
public void setBasePackage(String basePackage) {
this.basePackage = basePackage;
}
public void setMapperLocations(String mapperLocations) {
this.mapperLocations = mapperLocations;
}
@Override
public String toString() {
return "MyBatisMapperScannerConfig [basePackage=" + basePackage + ", mapperLocations=" + mapperLocations + "]";
}
}
|
9a50ff58-1a8f-43a0-b7f6-313df625b565 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-01-05 05:18:25", "repo_name": "darmstrong1/northwind-jpa", "sub_path": "/src/main/java/co/da/nw/dto/reply/StatusReply.java", "file_name": "StatusReply.java", "file_ext": "java", "file_size_in_byte": 1164, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "801e35e3c1a551276b158cfe6aeec0667141bfca", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/darmstrong1/northwind-jpa | 222 | FILENAME: StatusReply.java | 0.236516 | package co.da.nw.dto.reply;
import java.util.List;
import org.codehaus.jackson.annotate.JsonProperty;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
public class StatusReply {
private final Boolean success;
private final List<String> messages;
public StatusReply() {
this(true, ImmutableList.<String> of());
}
public StatusReply(Boolean success) {
this(success, ImmutableList.<String> of());
}
public StatusReply(Boolean success, String message) {
this(success, ImmutableList.of(message));
}
public StatusReply(Boolean success, List<String> messages) {
this.success = success;
this.messages = ImmutableList.copyOf(messages);
}
@JsonProperty("Success")
public Boolean getSuccess() {
return success;
}
@JsonProperty("Messages")
public List<String> getMessages() {
return messages;
}
@Override
public String toString() {
return Objects.toStringHelper(this)
.add("success", success)
.add("messages", messages)
.toString();
}
}
|
65187f10-0b76-4ef1-a616-6450d6e96266 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-31 09:56:19", "repo_name": "YOYOPole/hello", "sub_path": "/jwt/src/main/java/com/example/jwt/utils/JWTUtils.java", "file_name": "JWTUtils.java", "file_ext": "java", "file_size_in_byte": 1069, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "dc85e7d994e3f00a9f107820a338ccecc504e72e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/YOYOPole/hello | 255 | FILENAME: JWTUtils.java | 0.26588 | package com.example.jwt.utils;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTCreator;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.auth0.jwt.interfaces.Verification;
import java.util.Calendar;
import java.util.Map;
public class JWTUtils{
private static final String SIGN = "Token!#3$1!97^";
/**
* 生成token
* @param map 传入令牌信息
* @return
*/
public static String getToken(Map<String,String> map){
JWTCreator.Builder builder = JWT.create();
Calendar instance = Calendar.getInstance();
instance.add(Calendar.SECOND,60);
map.forEach((k,v)->{
builder.withClaim(k, v);
});
String token = builder.withExpiresAt(instance.getTime()).sign(Algorithm.HMAC256(SIGN));
return token;
}
/**
* 验证Token
* @param token 前端携带的token信息
*/
public static DecodedJWT verify(String token){
return JWT.require(Algorithm.HMAC256(SIGN)).build().verify(token);
}
}
|
948fb39e-bb28-4fb4-b6f3-2e54128f2a7d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-17 14:07:51", "repo_name": "soarle/Reader", "sub_path": "/app/src/main/java/com/hycollege/net/reader/book/ContextActivity.java", "file_name": "ContextActivity.java", "file_ext": "java", "file_size_in_byte": 1100, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "a0d31efa0672b8c4246b14beec41b7724cc73fb7", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/soarle/Reader | 186 | FILENAME: ContextActivity.java | 0.201813 | package com.hycollege.net.reader.book;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import com.hycollege.net.reader.R;
public class ContextActivity extends Activity {
Button btnmore;
TextView tvcontext;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_context);
btnmore=(Button)findViewById(R.id.btnmore);
tvcontext=(TextView)findViewById(R.id.tvcontext);
btnmore.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
tvcontext.setMaxLines(15);
}
});
}
}
|
706a7bf7-1003-448e-b1ff-1bd77fcfae8a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-07 03:58:14", "repo_name": "indiepopart/jhipster-kafka", "sub_path": "/store/src/main/java/com/okta/developer/store/web/rest/StoreKafkaResource.java", "file_name": "StoreKafkaResource.java", "file_ext": "java", "file_size_in_byte": 989, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "d28675c877dc837ae2f517d01c8ebd70024b6381", "star_events_count": 2, "fork_events_count": 3, "src_encoding": "UTF-8"} | https://github.com/indiepopart/jhipster-kafka | 184 | FILENAME: StoreKafkaResource.java | 0.226784 | package com.okta.developer.store.web.rest;
import com.okta.developer.store.service.StoreKafkaProducer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/store-kafka")
public class StoreKafkaResource {
private final Logger log = LoggerFactory.getLogger(StoreKafkaResource.class);
private StoreKafkaProducer kafkaProducer;
public StoreKafkaResource(StoreKafkaProducer kafkaProducer) {
this.kafkaProducer = kafkaProducer;
}
@PostMapping("/publish")
public void sendMessageToKafkaTopic(@RequestParam("message") String message) {
log.debug("REST request to send to Kafka topic the message : {}", message);
this.kafkaProducer.send(message);
}
}
|
2e81d846-b043-4481-be48-94c01195e8a5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-29 10:10:40", "repo_name": "sunshinewei/weather", "sub_path": "/weather/libmodel/src/main/java/com/app/weilong/lib/base/utils/StyleUtils.java", "file_name": "StyleUtils.java", "file_ext": "java", "file_size_in_byte": 1218, "line_count": 71, "lang": "en", "doc_type": "code", "blob_id": "f35284f925e8d543e3b13d768990e111f5d80a9b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sunshinewei/weather | 286 | FILENAME: StyleUtils.java | 0.272799 | package com.app.weilong.lib.base.utils;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.view.View;
/**
* create by weilong on 2020/4/10
* email: 1436699184@qq.com
*/
public class StyleUtils {
/**
* 字符串转换为int
* @param color
* @return
*/
public static int parseColor(String color){
return Color.parseColor(color);
}
/**
* 设置背景主题颜色
* @param view
* @param color
*/
public static void setStyleColor(View view, String color){
GradientDrawable drawable= (GradientDrawable) view.getBackground();
drawable.setColor(Color.parseColor(color));
}
public static int getTypeDpi(){
int type=1;//0.hdpi 1,xxhdpi 2.xxhdp
switch (ScreenUtils.getScreenDensityDpi()){
case 320:
type=1;
break;
case 240:
type=0;
break;
case 480:
type=1;
break;
case 640:
type=2;
break;
default:
type=1;
}
return type;
}
}
|
509cafe1-e16d-4e66-aeb7-283a3a793d3d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-23 16:27:12", "repo_name": "blooder35/ChatClient", "sub_path": "/src/main/java/Client.java", "file_name": "Client.java", "file_ext": "java", "file_size_in_byte": 1111, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "c07d30a7348e27998f87282de130acc7583f3170", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/blooder35/ChatClient | 216 | FILENAME: Client.java | 0.255344 |
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public final class Client extends Application {
private static final int CONNECT_TIMEOUT = 5000;
private static final String HOSTNAME = "127.0.0.1";
private static final int PORT = 9123;
public static void main(String[] args) {
launch(args);
}
public void start(Stage primaryStage) throws Exception {
ConnectionManager.getInstance().StartConnection();
LoginScreenController loginScreenController =LoginScreenController.getInstance();
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("loginScreen.fxml"));
fxmlLoader.setController(loginScreenController);
Parent root = fxmlLoader.load();
primaryStage.setTitle("ChatClient");
primaryStage.setScene(new Scene(root, 640, 480));
primaryStage.setOnCloseRequest(event -> {
loginScreenController.closeConnection();
System.exit(0);
});
primaryStage.show();
}
}
|
08a6db22-a29b-49c8-bf70-ae0c2e282cec | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-04-30T09:12:20", "repo_name": "JulianWe/vRealizeAutomation", "sub_path": "/dispatscherWorkflow/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1043, "line_count": 31, "lang": "en", "doc_type": "text", "blob_id": "600b10d489b27b555cac19c9e25c733441eaa04d", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JulianWe/vRealizeAutomation | 235 | FILENAME: README.md | 0.281406 | # PowerShell script to execute Orchestrator workflow via REST API
PowerShell Script to show the input parameter and Execute Orchestrator Workflow via REST API.
Execute-vRoWorkflow.ps1 has the following input parameters:
- Username (Testet with Active Directory User vdi\julian)
- password
- vroServer "Example: vro8.vdi.sclabs.net"
- WorkflowID "Workflow ID from general tab in Orchestrator editor mode"
- apiFormat "json or xml"
- inputParameters "Path to input file (either json or xml)"
JSON File containing the same input parameter like the API-InputWorkflow
InputParameterBody.json File:
- ServerName (string)
- ServerIP (string)
- LocalAdminAccount (string)
- LocalAdminPassword (string)
- ServerOwner (string)
- numberOfNic (number)
- secondDisk (boolean)
com.API-InputWorkflow Workflowpackage contains VMware Orchestrator API-InputWorkflow with input values from above.
# Day Two Operations
+ added some functionality to the PowerShell script regarding day two operations
+ change CPU count
+ change memory size
+ add disk space
|
9a6bf98d-16b6-4745-94bb-b16d8ed918e0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-02-14 21:04:16", "repo_name": "JackyChiu/SYSC4806", "sub_path": "/AddressBook/src/main/java/app/AddressBookController.java", "file_name": "AddressBookController.java", "file_ext": "java", "file_size_in_byte": 1064, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "4cebdb83fc9326a7cb5df560b8e74645cdce3dce", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JackyChiu/SYSC4806 | 199 | FILENAME: AddressBookController.java | 0.273574 | package app;
import app.models.AddressBook;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
@Controller
public class AddressBookController {
private AddressBookRepository addressBookRepository;
public AddressBookController(AddressBookRepository addressBookRepository) {
this.addressBookRepository = addressBookRepository;
}
@GetMapping("/")
public String rootApplication() {
return "application";
}
@ResponseBody
@GetMapping("/addressBook")
public AddressBook getAddressBook(@RequestParam("id") Integer id) {
AddressBook addressBook = this.addressBookRepository.findById(id);
return addressBook;
}
@ResponseBody
@PostMapping(value = "/newAddressBook", produces = "application/json")
public AddressBook newAddressBook(@RequestParam("id") Integer id) {
AddressBook a = new AddressBook();
a.setId(id);
this.addressBookRepository.save(a);
return a;
}
}
|
6fe30ebd-743d-43b4-8549-9cbd9624a306 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-21 07:17:08", "repo_name": "LevNovikov92/area-service", "sub_path": "/src/main/java/com/lev/areaservice/school/SchoolController.java", "file_name": "SchoolController.java", "file_ext": "java", "file_size_in_byte": 1000, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "c4a37fd7eee40d8be199d2af1f1fb531c389076d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/LevNovikov92/area-service | 195 | FILENAME: SchoolController.java | 0.255344 | package com.lev.areaservice.school;
import com.lev.areaservice.helpers.Lang;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@AllArgsConstructor(onConstructor_ = {@Autowired})
public class SchoolController {
final SchoolRepo schoolRepo;
final SchoolTypeRepo schoolTypeRepo;
@GetMapping("/school")
public List<School> getSchools() {
return Lang.toList(schoolRepo.findAll());
}
@GetMapping("/schoolType")
public List<SchoolType> getSchoolTypes() {
return Lang.toList(schoolTypeRepo.findAll());
}
@GetMapping("/school?area={area}")
public List<School> getSchools(@PathVariable("area") int areaId) {
return Lang.toList(schoolRepo.findAllByArea(areaId));
}
}
|
7319ee82-1d3b-42dd-826f-f3387bdf3c12 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-20 11:13:45", "repo_name": "Cathrine-c/Spring-Framework", "sub_path": "/Spring-Blog/src/main/java/org/example/config/ExceptionAdvice.java", "file_name": "ExceptionAdvice.java", "file_ext": "java", "file_size_in_byte": 1085, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "cbb4bcf2763d86a9111598bfae0ed82074b80948", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Cathrine-c/Spring-Framework | 198 | FILENAME: ExceptionAdvice.java | 0.23092 | package org.example.config;
import lombok.extern.slf4j.Slf4j;
import org.example.exception.AppException;
import org.example.model.Response;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ControllerAdvice
@Slf4j
public class ExceptionAdvice {
//自定义异常处理
@ExceptionHandler(AppException.class)
@ResponseBody
public Object handle(AppException e){
log.debug("自定义异常",e);
Response resp = new Response();
resp.setCode(e.getCode());
resp.setMsg(e.getMessage());
return resp;
}
//非自定义异常处理
@ExceptionHandler(Exception.class)
@ResponseBody
public Object handle(Exception e){
log.error("非自定义异常",e);
Response resp = new Response();
resp.setCode("EROOO1");
resp.setMsg("未知错误,请联系管理员!");
return resp;
}
}
|
eb762fbb-5b03-4770-ae55-d02c0d636c46 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-11-16T15:08:38", "repo_name": "krishgb/python-scripts", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1234, "line_count": 52, "lang": "en", "doc_type": "text", "blob_id": "4c9a4875a7a6412fe8f2b0b8b0d7cf153f5e1b41", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/krishgb/python-scripts | 300 | FILENAME: README.md | 0.252384 | 1. page_remover.py
This script is used to remove pages from a pdf file by using PyPDF2 library.
It keeps both the original pdf file and the modified pdf file.
To run this script you have to download PyPDF2 library.
In Terminal run "pip3 install PyPDF2" command.
Run this command in terminal "python page_remover.py".
The script prompts 3 inputs:
1st Prompt: The name of the pdf file from which the pages are going to be removed.
2nd Prompt: Give a name to get the pdf with removed pages.
3rd Prompt: Enter the pages that have to be removed from the given pdf.
Example: 10 20
Give space between the page numbers.
---
2. pdf_merger.py
This script is used to merge pdf files by using PyPDF2 library.
To run this script you have to download PyPDF2 library.
In Terminal run "pip3 install PyPDF2" command.
Run this command in terminal "python pdf_merger.py".
It list the pdf files in numerical order.
Enter the indexes of the pdf files to be merged.
Like: 1 3
Enter a name to a merged file wihtout ".pdf" extension
---
3. png_converter.py
This script is used to convert the jpg or jpeg image formats in a directory to png image formats in another directory. (silly script. just for fun.)
Created using PIL library.
|
9f2cd979-d2d9-476a-84aa-2a596abead54 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-11-11T15:55:32", "repo_name": "erinlmiller/neighborhood-map", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1164, "line_count": 23, "lang": "en", "doc_type": "text", "blob_id": "d8b474d585a54618eb7fd0b425edc4b63946c2c1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/erinlmiller/neighborhood-map | 281 | FILENAME: README.md | 0.249447 | # FEND Project 7: Neighborhood Map
## Richmond, VA Bar Map
This project is a list of bars in Richmond, VA. Locations display on a map with markers. CLicking a marker brings up the name of the bar, a link the bar's website, and a photo from FourSquare if available. Clicking the hamburger menu on the top left brings up a list of locations that can be filtered via the filter box. When a location is clicked, it jumps you back to the map and opens up the appropriate marker. Clicking outside the drawer closes the drawer, and clicking anywhere on the map closes all open info windows.
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app), therefore the default service worker only works in production build.
## How to run
* Clone the repo from https://github.com/erinlmiller/neighborhood-map
* run `npm install`
* run `npm start`
* Find your favorite Richmond, VA bar!
## Acknowledgements
* Doug Browns' project walkthrough (https://youtu.be/NVAVLCJwAAo)
* Andrew Wong's React webinar (https://youtu.be/MUVMTVd9Gzg)
* Ryan Waite's project walkthrough and guide (https://youtu.be/LvQe7xrUh7I)
* Coffee
* Alcohol
|
480800f2-f3af-41ff-8275-5a575e7c2cb3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-11-19 13:55:14", "repo_name": "zkunyeah/customer", "sub_path": "/chapter22/src/main/java/org/atm/chapter22/controller/customer_create.java", "file_name": "customer_create.java", "file_ext": "java", "file_size_in_byte": 1061, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "fa2d2b49f51d6a2216814a2d6430d0f4fb867747", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zkunyeah/customer | 187 | FILENAME: customer_create.java | 0.242206 | package org.atm.chapter22.controller;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by imcas on 2016/11/19.
*/
@WebServlet("/customer")
public class customer_create extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
DateFormat dataFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String currentTime=dataFormat.format(new Date());
req.setAttribute("currentTime",currentTime);
req.getRequestDispatcher("/WEB-INF/jsp/customer.jsp").forward(req,resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doPost(req, resp);
}
}
|
766219c7-4865-4989-994a-761f8fca35b2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-05-12 04:07:56", "repo_name": "Brioal/LineCode", "sub_path": "/app/src/main/java/com/brioal/linecode/database/CodeDataBaseHelper.java", "file_name": "CodeDataBaseHelper.java", "file_ext": "java", "file_size_in_byte": 1084, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "b0a67b4135f32aac71aeb411b4b7c98b095f0700", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Brioal/LineCode | 237 | FILENAME: CodeDataBaseHelper.java | 0.29584 | package com.brioal.linecode.database;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by Brioal on 2016/3/24.
*/
public class CodeDataBaseHelper extends SQLiteOpenHelper {
public static String CREATE_CODE_TABLE = "create table CodeItems(mId integer primary key autoincrement , mTitle , mDesc ,mCode , mAuthor , mTag , mTime , integer mRead)";
public static String CREATE_TAG_TABLE = "create table PagerTags(mId integer primary key autoincrement , mTag)";
public CodeDataBaseHelper(Context context, String name) {
this(context, name, null, 1);
}
public CodeDataBaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_CODE_TABLE);
db.execSQL(CREATE_TAG_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
|
ac6b4e72-9e39-4ed7-8226-d51d11433bd9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-22 15:21:17", "repo_name": "Etherealss/MusicInformationMS", "sub_path": "/src/main/java/pers/wtk/common/strategy/page/mapper/SingerDaoMapper.java", "file_name": "SingerDaoMapper.java", "file_ext": "java", "file_size_in_byte": 1190, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "005b702b8556f56de6c121d974ee6f38d7880470", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Etherealss/MusicInformationMS | 290 | FILENAME: SingerDaoMapper.java | 0.287768 | package pers.wtk.common.strategy.page.mapper;
import pers.wtk.dao.SingerDao;
import pers.wtk.pojo.po.Singer;
import java.util.List;
/**
* @author wtk
* @description
* @date 2021-07-18
*/
public class SingerDaoMapper extends DaoMapper<Singer> {
private SingerDao singerDao;
public SingerDaoMapper(int curPage, int offset, SingerDao singerDao) {
super(curPage, offset);
this.singerDao = singerDao;
}
public SingerDaoMapper(int curPage, int offset, String keyword, SingerDao singerDao) {
super(curPage, offset, keyword);
this.singerDao = singerDao;
}
@Override
public List<Singer> queryAll() {
return singerDao.getRangeSinger(start, offset);
}
@Override
public int queryAllSize() {
return singerDao.getSingerSize();
}
@Override
public Singer queryById() {
return singerDao.getSinger(Long.parseLong(keyword));
}
@Override
public List<Singer> queryByName() {
return singerDao.getRangeSingerBySingerName(start, offset, keyword);
}
@Override
public int queryByNameSize() {
return singerDao.getSingerSizeBySingerName(keyword);
}
}
|
bc816c25-c401-48a7-8a28-35fa9a61d0a0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-06-16 14:48:36", "repo_name": "sumioturk/ishihara", "sub_path": "/src/main/java/com/sumioturk/satomi/domain/channel/Channel.java", "file_name": "Channel.java", "file_ext": "java", "file_size_in_byte": 1004, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "745a1453b4b7e8db719ab0bbd115c17865c7bddd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sumioturk/ishihara | 226 | FILENAME: Channel.java | 0.243642 | package com.sumioturk.satomi.domain.channel;
import com.sumioturk.satomi.domain.user.User;
import java.io.Serializable;
import java.util.List;
/**
* Channel object
*/
public class Channel implements Serializable {
private String id;
private String name;
private List<User> users;
/**
* Instantiate Channel object
* @param id identity
* @param name name of a channel
* @param users list of users of the channel
*/
public Channel(String id, String name, List<User> users) {
this.id = id;
this.name = name;
this.users = users;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public List<User> getUsers() {
return users;
}
public void setId(String id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setUsers(List<User> users) {
this.users = users;
}
}
|
f351f115-4099-48e9-92c7-0a57ddba1bfa | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-05-28T02:45:55", "repo_name": "shenalt/tissera_yasser_DS_project", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1033, "line_count": 19, "lang": "en", "doc_type": "text", "blob_id": "156806b7d5f25a72a4475e0632a10d55f71df114", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/shenalt/tissera_yasser_DS_project | 269 | FILENAME: README.md | 0.279042 | # tissera_yasser_DS_project
Stroke Predictor
Heroku App - https://the-stroke-predictor.herokuapp.com/
- Project Type: Classification
- Classifiying people based on whether they had a stroke or not in a certain dataset. Eventually want to make a web app that can tell a person whether they are at risk for a stroke based on inputs they give us about themselves
Why
Building a predictor like this is quite straightforward but very useful at the same time. I have never seen or had anyone in my life get a stroke but I imagine it is terrible and if our project can help someone to take better care of their health if they seem to be at risk for a stroke, then this project will be a success.
https://raw.githubusercontent.com/shenalt/tissera_yasser_DS_project/main/healthcare-dataset-stroke-data.csv
Resources
https://www.kaggle.com/fedesoriano/stroke-prediction-dataset
https://www.kaggle.com/lirilkumaramal/heart-stroke
Colab
https://colab.research.google.com/drive/1rwbdQA3pO1vR_IQzVMjUUDn-t-902KfV#scrollTo=W2KGmM-grKuh
|
ee09eaa0-eee0-4df3-8aa5-fbacc1cd331e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-24 14:39:42", "repo_name": "omarhatem1995/NearBy", "sub_path": "/app/src/main/java/com/example/nearby/network/RetrofitCallBack.java", "file_name": "RetrofitCallBack.java", "file_ext": "java", "file_size_in_byte": 1051, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "20afd43b21ef1917e057670f9a4c7b20a254d968", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/omarhatem1995/NearBy | 220 | FILENAME: RetrofitCallBack.java | 0.247987 | package com.example.nearby.network;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import com.example.nearby.utils.MainApplication;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public abstract class RetrofitCallBack<T> implements Callback<T> {
@SuppressWarnings("unused")
private static final String TAG = "RetrofitCallback";
private Context mContext;
String mServiceName;
public RetrofitCallBack() {
Log.d("MainPASD", MainApplication.getAppContext() + " ");
mContext = MainApplication.getAppContext();
}
@Override
public void onResponse(Call<T> call, Response<T> response) {
if (response.code()==401){
}else if(response.code()==429){
Toast.makeText(MainApplication.getAppContext(), "Sorry You have exceeded the qouta of Foursquare service" +
"Images", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<T> call, Throwable t) {
}
}
|
fc15ccab-2d24-48bf-8516-c95c9e699a07 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2015-01-26T17:12:18", "repo_name": "pedrobrazao/zf2-sample-report", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1059, "line_count": 47, "lang": "en", "doc_type": "text", "blob_id": "79745b6c99878e4baa71042e228d30bb5c172086", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/pedrobrazao/zf2-sample-report | 234 | FILENAME: README.md | 0.26588 | ZF2 Sample Report Application
=============================
Introduction
------------
This is a sample non-trivial application, built on the top of Zend Framework 2,
Doctrine 2 and PHPUnit 4.4, aimed to showcase some best practices on modern web
programming with PHP.
The application is a simple report that shows transactions for a merchant id
specified as command line argument.
Installation
------------
git clone git://github.com/pedrobrazao/zf2-sample-report.git
cd zf2-sample-report
php composer.phar self-update
php composer.phar install
Usage
-----
There are 2 merchants (IDs 1 and 2) and a few transactions on database.
php public/index.php report <merchant-id>
or...
php public/index.php help
Unit Tests
----------
Test cases are using PHPUnit 4.4.* and can be executed as:
cd test
phpunit
Code coverage reports are available in data/coverage folder.
ToDo
----
1. Complete Unit Tests
2. Implement an application Cache layer to improve database access
3. Add some logging on running the report action. |
9318ed76-4cc5-4cc7-9d0f-8f81097546f1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-22 14:42:23", "repo_name": "dunghy7/VBCWE_Ver_1.0", "sub_path": "/src/main/java/com/dtsvn/vbcwe/controller/HandleErrorController.java", "file_name": "HandleErrorController.java", "file_ext": "java", "file_size_in_byte": 1164, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "e6f0798c4f4e68e94f28be0aa4bf82699000f1f2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dunghy7/VBCWE_Ver_1.0 | 220 | FILENAME: HandleErrorController.java | 0.247987 | package com.dtsvn.vbcwe.controller;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HandleErrorController implements ErrorController {
@RequestMapping("/error")
public String handleError(Model model, HttpServletRequest request) {
Object status = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
Exception exception = (Exception) request.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
if (status != null) {
if (exception != null) {
model.addAttribute("exception", exception.toString());
}
Integer statusCode = Integer.valueOf(status.toString());
if (statusCode == HttpStatus.NOT_FOUND.value()) {
return "404";
} else if (statusCode == HttpStatus.INTERNAL_SERVER_ERROR.value()) {
return "500";
}
}
return "404";
}
@Override
public String getErrorPath() {
return "/error";
}
}
|
22454c28-fe64-4cd7-a8ed-e0f3559e6fa1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-28 14:28:35", "repo_name": "Chen221b/Spring-Boot-Security", "sub_path": "/damon-secuity-demo/src/main/java/com/damon/dao/PersonDAO.java", "file_name": "PersonDAO.java", "file_ext": "java", "file_size_in_byte": 979, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "718ffad580d00d34bc09e9e8160632452d594ece", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Chen221b/Spring-Boot-Security | 193 | FILENAME: PersonDAO.java | 0.23793 | package com.damon.dao;
import com.damon.dto.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import java.sql.ResultSet;
import java.util.List;
@Repository
public class PersonDAO {
@Autowired
private JdbcTemplate template;
public List<Person> listPerson() {
return null;
}
public List<Person> getPersonByName(String name) {
List<Person> result = template.query(String.format("SELECT * FROM person WHERE name='%s'", name), (ResultSet rs, int rowNum) -> {
System.out.println(String.format("NO.%d in person", rowNum));
return new Person(rs.getString("name"), rs.getString("password"));
});
return result;
}
public int insertPerson(Person p) {
return template.update(String.format("INSERT INTO person VALUES ('%s','%s')", p.getName(), p.getPassword()));
}
}
|
318541ed-306d-495c-b1be-3fd3020204e3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-26 17:28:14", "repo_name": "Alan18081/astra-project", "sub_path": "/query-service/src/main/java/com/alex/astraproject/queryservice/domain/position/PositionHandler.java", "file_name": "PositionHandler.java", "file_ext": "java", "file_size_in_byte": 1015, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "83650cbfa740829f25756f902f38bc65b40741b4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Alan18081/astra-project | 171 | FILENAME: PositionHandler.java | 0.242206 | package com.alex.astraproject.queryservice.domain.position;
import com.alex.astraproject.shared.eventTypes.PositionEventType;
import com.alex.astraproject.shared.events.PositionEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.handler.annotation.Payload;
@Configuration
@EnableBinding(PositionProcessor.class)
public class PositionHandler {
@Autowired
private PositionService positionService;
@StreamListener(PositionEventType.CREATED)
public void onPositionCreated(@Payload PositionEvent positionEvent) {
positionService.createOne(positionEvent);
}
@StreamListener(PositionEventType.UPDATED)
public void onPositionUpdated(@Payload PositionEvent positionEvent) {
positionService.updateById(positionEvent);
}
}
|
9120775c-55b7-400c-b2c4-a70d85266f6e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-12-13T13:20:32", "repo_name": "Vaakom/how-to-jasper-fonts-embedded", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1163, "line_count": 23, "lang": "en", "doc_type": "text", "blob_id": "571e47fecdf387f3562face6081debf4e099c5f3", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Vaakom/how-to-jasper-fonts-embedded | 238 | FILENAME: README.md | 0.278257 | # HowToJasperFontsEmbedded
How to include new embedded fonts in Jasper Reports project. Arial font example.
Just create and simple jar file with new fonts and add it in your project path
************ From Jaspersoft WIKI *****************************************************************
This jar has mainly 3 fundamental concepts:
jasperreports_extension.properties - where is declared the factory for loading the fonts and the location of the font mapping xml within the jar.
fonts.xml - the font mapping xml
And lastly, the font files themselfes in one of the accepted formats, being TTF, EOT, SVG or WOFF.
The jar structure should be somewhat like this, considering that the "path" can be any java valid path:
fonts-extension.jar
/jasperreports_extension.properties
/path/fonts.xml
/path/font/*.TTF (or any of the above file types)
Pay attention for the property declared for containing the factory since the Jaspersoft Studio considers "net.sf.jasperreports.extension.registry.factory.fonts" and the JasperReports Server considers the "net.sf.jasperreports.extension.registry.factory.simple.font.families", at least for the 6.2 versions.
|
6a7e889e-537d-406a-98f8-99f1b9b20458 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-22 04:15:18", "repo_name": "chengtaowan/QyNovels", "sub_path": "/app/src/main/java/com/jdhd/qynovels/adapter/ShopAdapter.java", "file_name": "ShopAdapter.java", "file_ext": "java", "file_size_in_byte": 1073, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "5b1c7a1b50013967dbd3c8f2c5e93d6f0772c66c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/chengtaowan/QyNovels | 212 | FILENAME: ShopAdapter.java | 0.23092 | package com.jdhd.qynovels.adapter;
import android.os.Parcelable;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.fragment.app.FragmentStatePagerAdapter;
import com.jdhd.qynovels.ui.fragment.JxFragment;
import com.jdhd.qynovels.ui.fragment.ManFragment;
import com.jdhd.qynovels.ui.fragment.WmanFragment;
import java.util.ArrayList;
import java.util.List;
public class ShopAdapter extends FragmentPagerAdapter {
private List<Fragment> list=new ArrayList<>();
public void refresh(List<Fragment> list){
this.list.clear();
this.list=list;
notifyDataSetChanged();
}
public ShopAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return list.get(position);
}
@Override
public int getCount() {
return list.size();
}
@Override
public Parcelable saveState() {
return null;
}
}
|
4f3d56a4-ecfc-4447-9158-1dfb2cf75e5d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-20 20:47:59", "repo_name": "Raju-Talukder/child-care", "sub_path": "/src/main/java/com/child/service/message/MessageServiceImp.java", "file_name": "MessageServiceImp.java", "file_ext": "java", "file_size_in_byte": 1036, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "0c0a80805080caeef595b409321cf7c1a425f6bb", "star_events_count": 6, "fork_events_count": 3, "src_encoding": "UTF-8"} | https://github.com/Raju-Talukder/child-care | 183 | FILENAME: MessageServiceImp.java | 0.249447 | package com.child.service.message;
import com.child.dto.MessageDto;
import com.child.model.Message;
import com.child.repository.MessageRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
public class MessageServiceImp implements MessageService {
@Autowired
private MessageRepository messageRepository;
@Override
public Message createMessage(MessageDto messageDto) {
String fname = messageDto.getFname();
String lname = messageDto.getLname();
String email = messageDto.getEmail();
String messages = messageDto.getMessage();
Message message = new Message();
message.setFname(fname);
message.setLname(lname);
message.setEmail(email);
message.setMessage(messages );
return messageRepository.save(message);
}
@Override
public Optional<Message> findById(Long id) {
return messageRepository.findById(id);
}
}
|
1baf60e4-f332-4d44-bab0-e7301420ebe1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-15 08:24:04", "repo_name": "RiverSonw/MyMVVMDemo", "sub_path": "/app/src/main/java/com/eddardgao/mymvvmdemo01/bean/UserBean.java", "file_name": "UserBean.java", "file_ext": "java", "file_size_in_byte": 1190, "line_count": 72, "lang": "en", "doc_type": "code", "blob_id": "4cbff9badff10b66bb626ff5b9d5a68cae298e71", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/RiverSonw/MyMVVMDemo | 291 | FILENAME: UserBean.java | 0.23231 | package com.eddardgao.mymvvmdemo01.bean;
import java.io.Serializable;
/**
* @Author EddardGao
* @Email 754231090@qq.com
* @Date 2019/5/21
* @describe ::
* @Version ::
*/
public class UserBean implements Serializable {
private static final long serialVersionUID = -4576840045338985104L;
private String userName;
private String password;
private String sex;
private int age;
public UserBean(){
}
public UserBean(String userName,String password,String sex,int age){
this.userName = userName;
this.password = password;
this.sex = sex;
this.age = age;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
|
0bc30a0c-8db6-4581-a020-a821785b1a18 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-09-26 02:28:21", "repo_name": "jonysaez1/Vuelos", "sub_path": "/src/vuelos/Conexion.java", "file_name": "Conexion.java", "file_ext": "java", "file_size_in_byte": 979, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "bc2a0d18493414e46cc2b5aea1a54be14fa4806e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jonysaez1/Vuelos | 191 | FILENAME: Conexion.java | 0.212069 |
package vuelos;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
*
* @author Jonathan Saez
*/
public class Conexion {
private String url;
private String user="root";
private String password=" ";
private Connection conexion;
public Conexion(String url, String user, String password) throws ClassNotFoundException {
this.url = url;
this.user = user;
this.password = password;
//Cargamos las clases de mariadb que implementan JDBC
Class.forName("org.mariadb.jdbc.Driver");
}
public Connection getConexion() throws SQLException{
if(conexion == null){
// Setup the connection with the DB
conexion = DriverManager
.getConnection(url + "?useLegacyDatetimeCode=false&serverTimezone=UTC"
+ "&user=" + user + "&password=" + password);
}
return conexion;
}
}
|
90dc7fe0-5546-48dd-a0dd-a8073f564778 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-20 17:04:40", "repo_name": "tranducluan1999/Java", "sub_path": "/src/storemanagementsystem/ParttimeEmployee.java", "file_name": "ParttimeEmployee.java", "file_ext": "java", "file_size_in_byte": 1050, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "e6cb86abdc19a375648a85ff3ee4040187bf180b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tranducluan1999/Java | 230 | FILENAME: ParttimeEmployee.java | 0.267408 | package storemanagementsystem;
public class ParttimeEmployee extends Emmployee{
@Override
public long getMealAllowance() {
return 0;
}
@Override
public long getSalaryRate() {
return baseSalary;
}
@Override
public int getWorkingCount() {
return totalWorkingShift;
}
int totalWorkingShift;
long baseSalary;
public ParttimeEmployee() {
}
public ParttimeEmployee(String name, int age, String identificationNunber, int totalWorkingShift, long baseSalary) {
super(name, age, identificationNunber);
this.totalWorkingShift = totalWorkingShift;
this.baseSalary = baseSalary;
}
public int getTotalWorkingShift() {
return totalWorkingShift;
}
public void setTotalWorkingShift(int totalWorkingShift) {
this.totalWorkingShift = totalWorkingShift;
}
public long getBaseSalary() {
return baseSalary;
}
public void setBaseSalary(long baseSalary) {
this.baseSalary = baseSalary;
}
}
|
411e309c-288e-40ab-9cc4-dc4505be8093 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-16 12:32:28", "repo_name": "szebniok/Stocks-app", "sub_path": "/app/src/main/java/com/example/stocks/news/NewsRecyclerViewViewModel.java", "file_name": "NewsRecyclerViewViewModel.java", "file_ext": "java", "file_size_in_byte": 1047, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "162e0008eded78ee577c07903c9878f1242c83b6", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/szebniok/Stocks-app | 187 | FILENAME: NewsRecyclerViewViewModel.java | 0.259826 | package com.example.stocks.news;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.example.stocks.domain.StockMarketService;
import com.rometools.rome.feed.synd.SyndEntry;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EBean;
import java.util.List;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
@EBean
public class NewsRecyclerViewViewModel extends ViewModel {
public MutableLiveData<List<SyndEntry>> news = new MutableLiveData<>();
public MutableLiveData<Boolean> loading = new MutableLiveData<>();
@Bean
StockMarketService service;
public void getNews() {
service.getNews()
.doOnSubscribe(v -> loading.postValue(true))
.doAfterSuccess(v -> loading.postValue(false))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(data -> news.postValue(data));
}
}
|
590f5907-1a4d-4f6c-9af0-893e97419686 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-24 23:55:09", "repo_name": "wooseung-sim/GoCdFetchArtifactsTask", "sub_path": "/src/main/java/net/soti/go/plugin/task/fetch/artifacts/HttpResult.java", "file_name": "HttpResult.java", "file_ext": "java", "file_size_in_byte": 1164, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "898146344daf73a93eb45ca77adc77ec2783fe0d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wooseung-sim/GoCdFetchArtifactsTask | 218 | FILENAME: HttpResult.java | 0.292595 | package net.soti.go.plugin.task.fetch.artifacts;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.util.EntityUtils;
class HttpResult {
private final int statusCode;
private final String data;
private HttpResult(int statusCode, String data) {
this.statusCode = statusCode;
this.data = data;
}
private boolean isSuccessResult() {
return statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_NO_CONTENT || statusCode == HttpStatus.SC_CREATED;
}
String getData() {
return data;
}
static boolean isSuccessResult(HttpResult result) {
return result != null && result.isSuccessResult();
}
static HttpResult fromResponse(HttpResponse response) throws IOException {
return new HttpResult(response.getStatusLine().getStatusCode(), entityToStringOrNull(response.getEntity()));
}
private static String entityToStringOrNull(HttpEntity entity) throws IOException {
return (entity != null) ? EntityUtils.toString(entity, "UTF-8") : null;
}
}
|
ab678fbf-d542-4d1f-89e6-319c451e6e5e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-08 12:15:48", "repo_name": "coder-dyh/minieverygreenframework", "sub_path": "/framework-mvc/src/main/java/org/framework/web/typeconvert/impl/SimpleTypeConvert.java", "file_name": "SimpleTypeConvert.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "52942dd31bc6e93d450501468f8fc74ef014d6b0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/coder-dyh/minieverygreenframework | 209 | FILENAME: SimpleTypeConvert.java | 0.268941 | package org.framework.web.typeconvert.impl;
import org.apache.commons.beanutils.ConvertUtils;
import org.framework.web.ActionContext;
import org.framework.web.TypeExecutor;
import org.framework.web.typeconvert.TypeConvert;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Parameter;
//BeanUtil 转换实体类型 ConvertUtils转换常用数据类型(基本数据类型)
public class SimpleTypeConvert implements TypeConvert {
@Override
public Object convert(Parameter parameter, TypeExecutor executor)
throws IllegalAccessException,InvocationTargetException,InstantiationException{
Object obj=parameter.getType().isArray() ? ActionContext.getActionContext()
.getRequest().getParameterValues(parameter.getName()) : ActionContext.getActionContext()
.getRequest().getParameter(parameter.getName());
if(obj==null){
executor.execute(parameter);
}
Object value=ConvertUtils.convert(obj,parameter.getType());
if(parameter.getType().isPrimitive() && obj==null){
throw new RuntimeException(value+"can't be convert "+parameter.getType().getName());
}
return obj;
}
}
|
74165095-310d-47ed-8199-94916a911a87 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-20 08:17:51", "repo_name": "TU-Berlin-DIMA/babelfish", "sub_path": "/compiler/src/main/java/de/tub/dima/babelfish/storage/text/leaf/CSVSourceRope.java", "file_name": "CSVSourceRope.java", "file_ext": "java", "file_size_in_byte": 989, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "2288406379709de0b6f3f46a16d42716ac32d81d", "star_events_count": 11, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/TU-Berlin-DIMA/babelfish | 228 | FILENAME: CSVSourceRope.java | 0.23793 | package de.tub.dima.babelfish.storage.text.leaf;
import de.tub.dima.babelfish.storage.UnsafeUtils;
import de.tub.dima.babelfish.storage.text.AbstractRope;
import de.tub.dima.babelfish.typesytem.variableLengthType.Text;
public class CSVSourceRope extends AbstractRope {
private final long startPosition;
private final long endPosition;
private final int size;
public CSVSourceRope(long startPosition, long endPosition, int size) {
this.startPosition = startPosition;
this.endPosition = endPosition;
this.size = size;
}
@Override
public int length() {
return size;
// (int) (endPosition-startPosition);
}
@Override
public char get(int index) {
if((startPosition + index) >= endPosition){
return '\0';
}
return (char) UnsafeUtils.getByte(startPosition + index);
}
@Override
public boolean contains(Text otherText) {
return false;
}
}
|
e5b811fc-77ac-463f-82d8-9eb0a67d49c4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-08 02:06:56", "repo_name": "bootcamp-33-java/BPlacement_Spring", "sub_path": "/src/main/java/com/mii/BP/services/InterviewService.java", "file_name": "InterviewService.java", "file_ext": "java", "file_size_in_byte": 997, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "88e0d36467763edc89b81f0fba4cacfee411d97b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/bootcamp-33-java/BPlacement_Spring | 181 | FILENAME: InterviewService.java | 0.27048 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mii.BP.services;
import com.mii.BP.entities.Interview;
import com.mii.BP.repositories.InterviewRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
* @author aqira
*/
@Service
public class InterviewService {
@Autowired
InterviewRepository interviewRepository;
public Iterable<Interview> getAll() {
return interviewRepository.findAll();
}
public Interview save(Interview interview) {
return interviewRepository.save(interview);
}
public Interview getById(Integer id) {
return interviewRepository.findById(id).get();
}
public Integer getByLastIndex(){
return interviewRepository.getLastIndex();
}
}
|
7f378912-cf2b-4dc9-85ab-884a044dd88f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-28 14:29:01", "repo_name": "PIL0TS/spb-1", "sub_path": "/src/main/java/com/tream/config/MyWebAppConfigurer.java", "file_name": "MyWebAppConfigurer.java", "file_ext": "java", "file_size_in_byte": 1050, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "713096f43e585cfdf3fb18bbe01158a181aec415", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/PIL0TS/spb-1 | 192 | FILENAME: MyWebAppConfigurer.java | 0.212069 | package com.tream.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class MyWebAppConfigurer extends WebMvcConfigurerAdapter {
@Override
public void addCorsMappings(CorsRegistry registry) {
String path = "/**";
registry.addMapping(path)
.allowedMethods("GET", "POST", "OPTIONS", "DELETE", "PATCH")
.allowedOrigins("*")
.allowedHeaders("*")
.exposedHeaders("access-control-allow-headers",
"access-control-allow-methods",
"access-control-allow-origin",
"access-control-max-age",
"X-Frame-Options")
.allowCredentials(false)
.maxAge(3600);
System.out.println("******跨域配置******");
System.out.println(path);
}
} |
180a28a5-a17a-4e1b-9403-bd814b67ee8b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-14 03:09:11", "repo_name": "justkeep/gong-customer-situation", "sub_path": "/gong-customer-situation-api/src/main/java/com/gong/aspect/LoginAspect.java", "file_name": "LoginAspect.java", "file_ext": "java", "file_size_in_byte": 1228, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "3a1ce732116b96bc47edb7017f4781c91848d248", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/justkeep/gong-customer-situation | 272 | FILENAME: LoginAspect.java | 0.292595 | package com.gong.aspect;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
/**
* Created by Administrator on 2018/12/2/002.
*/
@Aspect
@Component
public class LoginAspect {
@Around(value = "execution(* com.gong.customer.situation.service.LoginService.login(..))")
public Object loginAspect(ProceedingJoinPoint jp) throws Throwable {
Object[] args = jp.getArgs();
String userId = (String)args[0];
System.out.println(userId+"开始登录");
Object result = jp.proceed();
System.out.println(userId+"登录结束");
return result;
}
@AfterReturning(value = "execution(* com.gong.customer.situation.service.LoginService.isLegal(..))",returning = "result")
public void iLegalUserAspect(JoinPoint joinPoint,Object result){
if (!(boolean)result){
Object[] args = joinPoint.getArgs();
String userId = (String)args[0];
System.out.println("增加非法用户"+userId+"登录的次数");
}
}
}
|
7aff2a44-88bc-4f5a-83a5-0a34fdb7f08e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-15T23:35:35", "repo_name": "sa-2017-2018-team-5/priority-rules-system", "sub_path": "/backend/src/test/java/fr/polytech/al/five/persistence/CarTypeStorageTest.java", "file_name": "CarTypeStorageTest.java", "file_ext": "java", "file_size_in_byte": 1057, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "78b12b7d9ca6fee2e632fcbbd2db835132507486", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sa-2017-2018-team-5/priority-rules-system | 216 | FILENAME: CarTypeStorageTest.java | 0.289372 | package fr.polytech.al.five.persistence;
import arquillian.AbstractPRSTest;
import fr.polytech.al.five.entities.CarStatus;
import fr.polytech.al.five.entities.CarType;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.transaction.api.annotation.TransactionMode;
import org.jboss.arquillian.transaction.api.annotation.Transactional;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import static org.junit.Assert.*;
@RunWith(Arquillian.class)
@Transactional(TransactionMode.COMMIT)
public class CarTypeStorageTest extends AbstractPRSTest {
@PersistenceContext
private EntityManager entityManager;
@Test
public void storingCarType() {
CarType carType = new CarType("FIREFIGHTERS", 100, CarStatus.EMERGENCY);
entityManager.persist(carType);
CarType stored = entityManager.find(CarType.class, "FIREFIGHTERS");
assertEquals(carType, stored);
entityManager.remove(carType);
}
}
|
53fc18ad-1dbd-4558-bb07-6f122ef94d42 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-23 10:02:34", "repo_name": "stylesmangalasseri/spring-hibernate-starting", "sub_path": "/src/main/java/com/example/demo/config/PropertyConfig.java", "file_name": "PropertyConfig.java", "file_ext": "java", "file_size_in_byte": 1021, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "58b0a100c470b5709ac6a17c9cc306e76fd27198", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/stylesmangalasseri/spring-hibernate-starting | 184 | FILENAME: PropertyConfig.java | 0.23793 | package com.example.demo.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import com.example.demo.examplebeans.FakeDataSource;
@Configuration
@PropertySource("classpath:datasource.properties")
public class PropertyConfig{
@Value("${my.app.username}")
String user;
@Value("${my.app.password}")
String password;
@Value("${my.app.url}")
String url;
@Bean
public FakeDataSource customProperties() {
FakeDataSource customProperties = new FakeDataSource();
customProperties.setPassword(password);
customProperties.setUserName(user);
customProperties.setUrl(url);
return customProperties;
}
@Bean
public static PropertySourcesPlaceholderConfigurer properties() {
return new PropertySourcesPlaceholderConfigurer();
}
}
|
a23a2688-4d37-4192-a4d1-cf51fcb54fa7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-17 19:24:41", "repo_name": "DavidCerny2737/PAA-semestralWork", "sub_path": "/app/src/main/java/cz/tul/nutritiontracker/dto/enumerate/Nutrient.java", "file_name": "Nutrient.java", "file_ext": "java", "file_size_in_byte": 1091, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "fc112f0671c6b2c5250b146785623f9560871e1c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DavidCerny2737/PAA-semestralWork | 385 | FILENAME: Nutrient.java | 0.279042 | package cz.tul.nutritiontracker.dto.enumerate;
public enum Nutrient {
CA("Calcium", "mg"), CHOCDF("Carbs", "g"), CHOLE("Cholesterol", "mg"),
FAMS("Monounsaturated", "g"), FAPU("Polyunsaturated", "g"), FASAT("Saturated", "g"),
FAT("Fat", "g"), FATRN("Trans", "g"), FE("Iron", "mg"), FIBTG("Fiber", "g"),
FOLDFE("Folate (Equivalent) ", "aeg"), K("Potassium", "mg"), MG("Magnesium", "mg"),
NA("Sodium", "mg"), ENERC_KCAL("Energy", "kcal"), NIA("Niacin (B3)", "mg"),
P("Phosphorus", "mg"), PROCNT("Protein", "g"), RIBF("Riboflavin (B2)", "mg"),
SUGAR("Sugars", "g"), THIA("Thiamin (B1)", "mg"), TOCPHA("Vitamin E", "mg"),
VITA_RAE("Vitamin A", "aeg"), VITB12 ("Vitamin B12", "aeg"), VITB6A("Vitamin B6", "mg"),
VITC("Vitamin C", "mg"), VITD("Vitamin D", "aeg"), VITK1("Vitamin K", "aeg");
private String name;
private String unit;
Nutrient(String name, String unit){
this.name = name;
this.unit = unit;
}
public String getName() {
return name;
}
public String getUnit() {
return unit;
}
}
|
82192a5f-b204-4a93-b685-7adbcd2f5b01 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-02-01 18:14:34", "repo_name": "RubenVermeulen/HoGentRestoApp", "sub_path": "/android/app/src/main/java/resto/android/hogent/be/hogentresto/models/Product.java", "file_name": "Product.java", "file_ext": "java", "file_size_in_byte": 1046, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "960148d73d79e2353e1895cf3abca3de2a61d235", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/RubenVermeulen/HoGentRestoApp | 218 | FILENAME: Product.java | 0.214691 | package resto.android.hogent.be.hogentresto.models;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by jonas on 28/11/2016.
*/
public class Product implements Serializable
{
@SerializedName("_id")
String id;
String description;
List<String> allergens;
public Product(String description, List<String> allergens) {
this.description= description;
this.allergens=allergens;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<String> getAllergens() {
return allergens;
}
public void setAllergens(ArrayList<String> allergens) {
this.allergens = allergens;
}
}
|
02c0ccf3-f88b-4e5f-bafa-3f2c99f3e88f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-20 21:03:39", "repo_name": "EladJarby/Test", "sub_path": "/app/src/main/java/com/example/elad/test/screens/main/fragments/contactslist/impl/ContactsListPresenter.java", "file_name": "ContactsListPresenter.java", "file_ext": "java", "file_size_in_byte": 1105, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "b87e3afc46dba1af1879986541c9c8aec014f93b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/EladJarby/Test | 227 | FILENAME: ContactsListPresenter.java | 0.278257 | package com.example.elad.test.screens.main.fragments.contactslist.impl;
import android.support.v4.util.Consumer;
import android.util.Log;
import com.example.elad.test.data.DataManager;
import com.example.elad.test.data.dagger.scopes.FragmentScope;
import com.example.elad.test.data.model.ContactsItem;
import com.example.elad.test.screens.main.fragments.contactslist.contracts.ContactsListContract;
import java.util.List;
import javax.inject.Inject;
@FragmentScope
public class ContactsListPresenter implements ContactsListContract.Presenter {
DataManager dataManager;
ContactsListContract.View view;
@Inject
ContactsListPresenter(DataManager dataManager) {
this.dataManager = dataManager;
}
@Override
public void onAttach(ContactsListContract.View view) {
this.view = view;
init();
}
private void init() {
if(view != null) {
view.setData(dataManager.getLocalDataManager().getAppDatabase().contactsItemDao().getAllContacts());
}
}
@Override
public void onDetach() {
view = null;
}
}
|
90e68d2c-2cff-4fd2-ad76-478c7fd14d02 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-03 08:41:55", "repo_name": "denisprog/chat-websockets", "sub_path": "/src/main/java/by/iba/bot/chat/controller/MessagesController.java", "file_name": "MessagesController.java", "file_ext": "java", "file_size_in_byte": 1050, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "f3bf262634256035e40dc77f5a17e095b2f959c9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/denisprog/chat-websockets | 179 | FILENAME: MessagesController.java | 0.286968 | package by.iba.bot.chat.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import by.iba.bot.chat.component.MessageManager;
import by.iba.bot.chat.domain.MessageContent;
@RestController()
public class MessagesController {
@Autowired
private MessageManager messageManager;
@RequestMapping(value= "/admin/getMessages", method=RequestMethod.GET)
public List<MessageContent> getMessages() {
return messageManager.getMessages();
}
@RequestMapping(value= "/admin/updateMessages", method=RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public List<MessageContent> updateMessages(@RequestBody List<MessageContent> messages) {
return messageManager.updateMessages(messages);
}
} |
b07f46f6-e026-4c9f-a8af-8ef51aa14d5e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2014-05-14T02:49:50", "repo_name": "franleplant/SOM-box", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1233, "line_count": 55, "lang": "en", "doc_type": "text", "blob_id": "e9530037cf4750af2a2f086c66d2280d28fbd933", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/franleplant/SOM-box | 304 | FILENAME: README.md | 0.203075 | SOM-box
=======
> PARTIAL INSTRUCTIONS: Opted to all-in-one installer: Enthought.
Checkout [SOM repo](https://github.com/franleplant/SOM.git)
This repository contains a Vagrant machine to work in the SOM project.
## Instructions
### Download and Install:
1. [Virtual Box](https://www.virtualbox.org/wiki/Downloads)
2. [Vagrant](http://www.vagrantup.com/downloads.html)
### Open the terminal and type:
```bash
git clone https://github.com/franleplant/SOM-box.git SOM-box
cd SOM-box
vagrant up && vagrant ssh
```
This will install almost everything you need to work with the project:
Ubuntu Virtual Machine, python, git, etc (inside the VM), and get you
inside the Virtual Machine console.
> This process might take a while since its need to download
a fresh copy of Ubuntu 12.10 Quantal Quetzal.
### Access the Virtual Machine
```bash
vagrant up && vagrant ssh
```
`vagrant up` turns on the virtual machine.
`vagrant ssh` gets you inside the VM console.
### Manual Steps
There are a couple of things that we need to by hand since
they are not easy to automate.
Follow this [instructions](https://github.com/franleplant/debian-based-samba-dance) to install Samba a share files between host and guests machines.
|
5ab60a3c-9b8e-4b85-9de1-9d527f6ea470 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-02 06:50:19", "repo_name": "1872209334/svntest", "sub_path": "/api/src/main/java/com/qf/common/redis/RedisCacheManager.java", "file_name": "RedisCacheManager.java", "file_ext": "java", "file_size_in_byte": 1163, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "56c785b290ccfee172785e520c855f5fd70f1c4c", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/1872209334/svntest | 222 | FILENAME: RedisCacheManager.java | 0.259826 | package com.qf.common.redis;
import org.apache.shiro.cache.Cache;
import org.apache.shiro.cache.CacheException;
import org.apache.shiro.cache.CacheManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@Repository("redisCacheManager")
public class RedisCacheManager implements CacheManager {
@SuppressWarnings("rawtypes")
private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<String, Cache>();
@Resource
private RedisTemplate<String, Object> redisTemplate;
@Autowired
private RedisConfiguration redisConfiguration;
@Override
@SuppressWarnings("rawtypes")
public <K, V> Cache<K, V> getCache(String name) throws CacheException {
Cache c = caches.get(name);
if(c == null){
c = new RedisShiroCache<K, V>(name, redisTemplate, redisConfiguration);
caches.put(name, c);
}
return c;
}
} |
61a6aa44-7fc3-4996-8657-932e154904f8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-17 08:00:31", "repo_name": "xiaowangziw/demo2-Swagger", "sub_path": "/src/test/java/com/example/demo/TestController.java", "file_name": "TestController.java", "file_ext": "java", "file_size_in_byte": 1031, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "8f34b4aa6bc571a5697184b08c18fdf25b235bbd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xiaowangziw/demo2-Swagger | 203 | FILENAME: TestController.java | 0.2227 | package com.example.demo;
import com.example.demo.untils.RedisTool;
import org.junit.runner.RunWith;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import redis.clients.jedis.JedisCluster;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class TestController {
@Autowired
private JedisCluster jedisCluster;
// private RedisTemplate redisTemplate;
@Test
public void test1(){
boolean test1 = RedisTool.tryGetDistributedLock(jedisCluster, "testKey2", "testValue", 6000);
System.out.println(test1);
Boolean test = jedisCluster.exists("test");
System.out.println(test);
Long append = jedisCluster.append("test", "test");
System.out.println(jedisCluster.exists("test"));
}
}
|
dacd80e0-0460-4409-9e2d-ee75c017eac9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-04 14:06:50", "repo_name": "BarBar2070/lab1", "sub_path": "/app/src/main/java/com/example/laborator1/NewActivity.java", "file_name": "NewActivity.java", "file_ext": "java", "file_size_in_byte": 1113, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "1a7cc724cbe443ec70b9f3fab6095ee61b477c98", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/BarBar2070/lab1 | 187 | FILENAME: NewActivity.java | 0.229535 | package com.example.laborator1;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;
public class NewActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new);
ImageView imageView = (ImageView)findViewById(R.id.imageView);
Intent intent = getIntent();
Bitmap photo = (Bitmap) intent.getParcelableExtra("capturedPhoto");
imageView.setImageBitmap(photo);
/* Bundle extras = getIntent().getExtras();
if (extras != null) {
byte[] byteArray = extras.getByteArray("picture");
if (byteArray.length > 0) {
Bitmap bitmap = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
ImageView image = findViewById(R.id.imageView);
image.setImageBitmap(bitmap);
}
}*/
}
}
|
91855300-b193-4b99-b89b-90cf035ebe2f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-23 13:03:15", "repo_name": "miolfo/FstNotes", "sub_path": "/app/src/main/java/com/example/forge/fstnotes/NoteAdapter.java", "file_name": "NoteAdapter.java", "file_ext": "java", "file_size_in_byte": 1040, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "1286bf6df57d69e78aa3b6fe3d28c0a61759af05", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/miolfo/FstNotes | 202 | FILENAME: NoteAdapter.java | 0.268941 | package com.example.forge.fstnotes;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.ArrayList;
/**
* Created by Forge on 9/20/2016.
*/
public class NoteAdapter extends ArrayAdapter {
public NoteAdapter(Context context, ArrayList<Note> notes){
super(context, 0, notes);
}
@Override
public View getView(int position, View convertView, ViewGroup parent){
Note n = (Note)getItem(position);
if(convertView == null){
convertView = LayoutInflater.from(getContext()).inflate(R.layout.single_note, parent, false);
}
TextView noteText = (TextView)convertView.findViewById(R.id.note_text);
TextView reminderText = (TextView)convertView.findViewById(R.id.reminder_text);
noteText.setText(n.GetNoteText());
reminderText.setText(n.GetReminderString());
return convertView;
}
}
|
ff18070f-b234-46ba-9141-7de81e0ad756 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-08-10 04:24:33", "repo_name": "RezaNurRochmat13/Spring-Boot-Security-Example", "sub_path": "/src/main/java/com/rejak/springsecurityexamples/role/usecase/RoleUseCaseImpl.java", "file_name": "RoleUseCaseImpl.java", "file_ext": "java", "file_size_in_byte": 1162, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "76acc17a165af18db3dc14f10ef491359574ca22", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/RezaNurRochmat13/Spring-Boot-Security-Example | 235 | FILENAME: RoleUseCaseImpl.java | 0.293404 | package com.rejak.springsecurityexamples.role.usecase;
import com.rejak.springsecurityexamples.role.dao.RoleDao;
import com.rejak.springsecurityexamples.role.repository.RoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class RoleUseCaseImpl implements RoleUsecase {
@Autowired
RoleRepository roleRepository;
@Override
public List<RoleDao> findAllRole() {
return roleRepository.findAll();
}
@Override
public Long countAllRole() {
return roleRepository.count();
}
@Override
public Optional<RoleDao> findRoleById(Integer id) {
return roleRepository.findById(id);
}
@Override
public RoleDao createNewRole(RoleDao roleDaoPayload) {
return roleRepository.save(roleDaoPayload);
}
@Override
public RoleDao updateRole(RoleDao roleDaoPayload) {
return roleRepository.save(roleDaoPayload);
}
@Override
public void deleteRole(RoleDao roleDaoPayload) {
roleRepository.delete(roleDaoPayload);
}
}
|
d4289444-bb50-4015-8841-7c3137197e42 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-08-28 18:33:44", "repo_name": "Sonat-Consulting/javabin-play-java-demo", "sub_path": "/app/controllers/JavaZoneTweet.java", "file_name": "JavaZoneTweet.java", "file_ext": "java", "file_size_in_byte": 1108, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "e9c21f4291cd2895b5ab93fef57709c177bba0c0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Sonat-Consulting/javabin-play-java-demo | 219 | FILENAME: JavaZoneTweet.java | 0.280616 | package controllers;
import models.Tweet;
import org.codehaus.jackson.JsonNode;
import play.libs.F;
import play.libs.Json;
import play.libs.WS;
import play.mvc.Controller;
import play.mvc.Result;
import views.html.tweets;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
/**
* @author sondre
*/
public class JavaZoneTweet extends Controller {
public static Result findJavaZoneTweets() {
return async(WS.url("http://javabin.zapodot.org/twitter/search/javazone").get().map(new F.Function<WS.Response, Result>() {
@Override
public Result apply(WS.Response response) throws Throwable {
final JsonNode jsonNode = response.asJson();
List<Tweet> tweetsList = new LinkedList<>();
final Iterator<JsonNode> jsonElements = jsonNode.getElements();
while (jsonElements.hasNext()) {
tweetsList.add(Json.fromJson(jsonElements.next(), Tweet.class));
}
return ok(tweets.render("Tweets", tweetsList));
}
}));
}
}
|
20735924-9829-43be-adaa-9b6d6d46cca0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-27 04:29:26", "repo_name": "intuij/Tetris", "sub_path": "/src/control/KeyController.java", "file_name": "KeyController.java", "file_ext": "java", "file_size_in_byte": 980, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "be235f5e74e26b619ac09a457820203359544039", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/intuij/Tetris | 247 | FILENAME: KeyController.java | 0.279042 | package control;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class KeyController extends KeyAdapter {
private GameController gameController;
public KeyController(GameController gameController) {
this.gameController = gameController;
}
@Override
public void keyPressed(KeyEvent e) {
if (gameController.getGameDto().isPause() || !gameController.getGameDto().isStart())
return;
if (e.getKeyCode() == KeyEvent.VK_UP) {
// Rotate
gameController.rotateAct();
} else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
// Move down
gameController.moveDown();
} else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
// Move left
gameController.moveLeft(-1, 0);
} else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
// Move right
gameController.moveRight(1, 0);
} else if (e.getKeyCode() == KeyEvent.VK_Q) {
gameController.lineIncrement();
}
}
public GameController getGameController() {
return gameController;
}
}
|
f7a0fb6e-b991-4deb-8c0a-63cade1311d9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-05-02T14:07:18", "repo_name": "doyler/RWSH", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1190, "line_count": 29, "lang": "en", "doc_type": "text", "blob_id": "6c65096fc13c60c67f14018095bfcae156239198", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/doyler/RWSH | 280 | FILENAME: README.md | 0.190724 | # RWSH - Ray's Web SHell
A PHP web shell and its Python based client
# Features
* Encoded communication
* Pseudo-interactive shell

* Cleaner output formatting than PHP passthru
* Hostname and username (whoami) detection
* (Mostly) Clean exiting
* Ability to still interact with via a browser
* Support for GET and POST methods

# TODO
* Add ability to easily obfuscate shell.php
* Add client specific functionality similar to meterpreter (upload, download, etc.)
* Include randomly generated filenames for server.php (similar to Metasploit payloads)
* Look into better methods of encryption or encoding for the traffic
* Handle all exit cases better
* Perform OS detection and better prompt displays
* Look into the ability to change directories (change the prompt, prepend the current directory to any requests?)
* Pseudo random key for forward-secrecy
* Better encoded version to avoid detection (grep, AI-Bolit)
* Clean up and add more methods
* Add support for more HTTP verbs as well as headers (cookies, arbitrary, etc.)
|
657c08a1-a88e-49b4-9c2d-c85314fe09aa | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-08-19 02:03:28", "repo_name": "edsonw11/AndroidCaelum", "sub_path": "/app/src/main/java/br/com/caelum/cadastro/SMSRecevier.java", "file_name": "SMSRecevier.java", "file_ext": "java", "file_size_in_byte": 1060, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "3391e49d3c1e7bd775b6b09d6ecb4524ca5572a4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/edsonw11/AndroidCaelum | 240 | FILENAME: SMSRecevier.java | 0.271252 | package br.com.caelum.cadastro;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.media.MediaPlayer;
import android.telephony.SmsMessage;
import android.widget.Toast;
import br.com.caelum.cadastro.R;
import br.com.caelum.cadastro.br.com.caelum.dao.AlunoDAO;
/**
* Created by android6384 on 16/08/16.
*/
public class SMSRecevier extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
Object[] pdus = (Object[])intent.getSerializableExtra("pdus");
byte[] pdu = (byte[]) pdus[0];
SmsMessage smsMessage = SmsMessage.createFromPdu(pdu);
String phone = smsMessage.getDisplayOriginatingAddress();
AlunoDAO alunoDAO = new AlunoDAO(context);
if(alunoDAO.isAluno(phone)){
MediaPlayer mp = MediaPlayer.create(context, R.raw.msg);
mp.start();
Toast.makeText(context,"SMS de Aluno " + smsMessage.getMessageBody(), Toast.LENGTH_SHORT).show();
}
}
}
|
11491614-71bb-4858-b374-6292ac3025ef | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-03-17 13:05:04", "repo_name": "eniacce/hql-builder", "sub_path": "/hql-builder/hql-builder-web/hql-builder-webservice/src/main/java/org/tools/hqlbuilder/webservice/jquery/ui/owl_carousel_2/OwlCarousel2.java", "file_name": "OwlCarousel2.java", "file_ext": "java", "file_size_in_byte": 995, "line_count": 26, "lang": "en", "doc_type": "code", "blob_id": "618960a26643ba3c8a377fdbc68ad5a5f2656103", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/eniacce/hql-builder | 209 | FILENAME: OwlCarousel2.java | 0.250913 | package org.tools.hqlbuilder.webservice.jquery.ui.owl_carousel_2;
import org.tools.hqlbuilder.webservice.jquery.ui.jqueryui.JQueryUI;
import org.tools.hqlbuilder.webservice.wicket.CssResourceReference;
import org.tools.hqlbuilder.webservice.wicket.JavaScriptResourceReference;
/**
* @author http://www.owlcarousel.owlgraphic.com/
*/
public class OwlCarousel2 {
public static final JavaScriptResourceReference JS = new JavaScriptResourceReference(OwlCarousel2.class, "owl.carousel.js");
static {
try {
OwlCarousel2.JS.addJavaScriptResourceReferenceDependency(JQueryUI.getJQueryUIReference());
} catch (Exception ex) {
//
}
}
public static final CssResourceReference CSS = new CssResourceReference(OwlCarousel2.class, "owl.carousel.css");
public static final CssResourceReference CSS_THEME = new CssResourceReference(OwlCarousel2.class, "owl.theme.default.css")
.addCssResourceReferenceDependency(OwlCarousel2.CSS);
}
|
89158247-08ee-40ff-872d-475256f03f50 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-26 09:13:06", "repo_name": "rainmaple/rainmaple_simpledfs", "sub_path": "/rainmaple_dfs/distr_fileSystem/distri_fileStorage/src/main/java/cn/edu/ruc/adcourse/fileStorage/communicate_with_server/CommunicateWithServerThreadSupport.java", "file_name": "CommunicateWithServerThreadSupport.java", "file_ext": "java", "file_size_in_byte": 1096, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "b8896513e04dda47b64c256dc5923080760f0980", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/rainmaple/rainmaple_simpledfs | 226 | FILENAME: CommunicateWithServerThreadSupport.java | 0.291787 | package cn.edu.ruc.adcourse.fileStorage.communicate_with_server;
import cn.edu.ruc.adcourse.utils.SimpleThreadPool;
import java.io.IOException;
/**
* 该类提供了节点服务器与FileServer通信的异步支持
* Created by rainmaple on 2019/11/5.
*/
public class CommunicateWithServerThreadSupport implements CommunicateWithServerStrategy{
private CommunicateWithServerStrategy cwss;
private String ip;
private int port;
public CommunicateWithServerThreadSupport(CommunicateWithServerStrategy cwss,
String fileServerIp,
int fileServerPort)
throws IOException {
this.cwss = cwss;
this.ip = fileServerIp;
this.port = fileServerPort;
registerOrUpdate(ip, port);
}
@Override
public void registerOrUpdate(String ip, int port) throws IOException {
//将向服务器发送心跳包的任务交给一个线程异步发送
SimpleThreadPool.getInstance().submit(new CommunicateWithServerRunnable(cwss, ip, port));
}
}
|
9f099d70-63b1-4f8e-a74b-9da7393b0ec7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-09 14:27:42", "repo_name": "zww0019/JdoubanFM", "sub_path": "/src/main/java/team/ngup/douban/common/cookie/CookieUtil.java", "file_name": "CookieUtil.java", "file_ext": "java", "file_size_in_byte": 1015, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "cb0890827e3fada05d1156ad574d873b36a69166", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zww0019/JdoubanFM | 183 | FILENAME: CookieUtil.java | 0.245085 | package team.ngup.douban.common.cookie;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class CookieUtil {
private static Map<String,String> cookies = new ConcurrentHashMap<>();
public static void addCookie(String cookie){
String[] temp = cookie.split(";");
for(String item:temp){
String[] a = item.split("=");
if(a.length>1){
cookies.put(a[0],a[1]);
}else{
cookies.put(a[0],"");
}
}
}
public static String getCookies(){
StringBuilder stringBuilder = new StringBuilder();
for(Map.Entry entry : cookies.entrySet()){
stringBuilder.append(entry.getKey());
stringBuilder.append("=");
stringBuilder.append(entry.getValue());
stringBuilder.append(";");
}
String cookies = stringBuilder.toString();
return cookies.substring(0,cookies.length()-1);
}
}
|
f1999243-c688-487e-801c-eedfe1c1aee5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-08 15:29:12", "repo_name": "lkamdem/tp-spring-epita", "sub_path": "/src/main/java/com/formation/epita/infrastructure/adresse/AdresseEntity.java", "file_name": "AdresseEntity.java", "file_ext": "java", "file_size_in_byte": 1189, "line_count": 62, "lang": "en", "doc_type": "code", "blob_id": "34a6929a89e31954c7eef7ddd24db71d69b77f6c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lkamdem/tp-spring-epita | 295 | FILENAME: AdresseEntity.java | 0.220007 | package com.formation.epita.infrastructure.adresse;
import javax.persistence.Column;
import javax.persistence.Embeddable;
@Embeddable
public class AdresseEntity {
@Column(name = "numero")
private int numeroRue;
@Column(name = "rue")
private String nomRue;
private int codePostal;
private String ville;
public AdresseEntity(int numeroRue, String nomRue, int codePostal, String ville) {
this.numeroRue = numeroRue;
this.nomRue = nomRue;
this.codePostal = codePostal;
this.ville = ville;
}
public AdresseEntity() {
}
public int getNumeroRue() {
return numeroRue;
}
public void setNumeroRue(int numeroRue) {
this.numeroRue = numeroRue;
}
public String getNomRue() {
return nomRue;
}
public void setNomRue(String nomRue) {
this.nomRue = nomRue;
}
public int getCodePostal() {
return codePostal;
}
public void setCodePostal(int codePostal) {
this.codePostal = codePostal;
}
public String getVille() {
return ville;
}
public void setVille(String ville) {
this.ville = ville;
}
}
|
9e8e5276-0cff-4794-bc9f-3f2e820b4508 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-19 13:11:34", "repo_name": "lagg99/Biomecanica", "sub_path": "/Back/data/src/main/java/bmc/care/exception/ServiceException.java", "file_name": "ServiceException.java", "file_ext": "java", "file_size_in_byte": 1050, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "3911f1996e7aed3bc08e883a977f9f60836a4936", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lagg99/Biomecanica | 174 | FILENAME: ServiceException.java | 0.239349 | package bmc.care.exception;
import java.io.PrintWriter;
import java.io.StringWriter;
public class ServiceException extends Exception {
public ServiceException() {
super();
}
public ServiceException(String message) {
super(message);
}
public ServiceException(String message, Throwable cause) {
super(message, cause);
}
public ServiceException(Throwable cause) {
super(cause);
}
protected ServiceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
public static String toStringStackTrace(Exception ex){
StringWriter errors = new StringWriter();
ex.printStackTrace(new PrintWriter(errors));
return errors.toString();
}
public static String toStringStackTrace(Throwable ex){
StringWriter errors = new StringWriter();
ex.printStackTrace(new PrintWriter(errors));
return errors.toString();
}
}
|
b27f24f4-7157-4b59-95e0-39f1c9fc6191 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-17 14:15:41", "repo_name": "luisfilipemotag/DescobreViseu", "sub_path": "/app/src/main/java/com/example/chip/descobreviseu/PrimeiroLogin.java", "file_name": "PrimeiroLogin.java", "file_ext": "java", "file_size_in_byte": 1164, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "fafc02e662ca0e95880a76e788ae04de43368db1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/luisfilipemotag/DescobreViseu | 228 | FILENAME: PrimeiroLogin.java | 0.262842 | package com.example.chip.descobreviseu;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
public class PrimeiroLogin extends AppCompatActivity {
DB_Helper Dbh;
TextView Nome ;
@Override
protected void onCreate(Bundle savedInstanceState) {
int check;
super.onCreate(savedInstanceState);
Dbh= new DB_Helper(getApplicationContext());
check= Dbh.getTurisa();
if ( check ==1 ){
Intent intecao = new Intent(this ,MainActivity.class);
startActivity(intecao);
}
else {
setContentView(R.layout.activity_primeiro_login);
}
}
public void OnStart2(View view) {
Nome= (TextView) findViewById(R.id.NomeT);
Log.e("nome", Nome.getText().toString());
Dbh =new DB_Helper(getApplicationContext());
Dbh.nomeT(Nome.getText().toString());
Intent intecao = new Intent(this ,MainActivity.class);
startActivity(intecao);
PrimeiroLogin.this.finish();
}
}
|
bf0294f8-1d81-43d0-8491-a9c9d855b119 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-26 02:35:43", "repo_name": "kim93j5/soomgosusta", "sub_path": "/Soomgosusta/src/soomgosusta/action_expertAction/RegisterEstimateAction.java", "file_name": "RegisterEstimateAction.java", "file_ext": "java", "file_size_in_byte": 1003, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "822c0ccb0e63b2c59c1c0c5877e2d6f2710258ed", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kim93j5/soomgosusta | 190 | FILENAME: RegisterEstimateAction.java | 0.284576 | package soomgosusta.action_expertAction;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import soomgosusta.action_interface.Action;
import soomgosusta.action_interface.ActionForward;
import soomgosusta.service.ChatService;
import soomgosusta.service.EstimateService;
import soomgosusta.service.MatchService;
public class RegisterEstimateAction implements Action {
public ActionForward excute(HttpServletRequest request, HttpServletResponse response) throws Exception {
MatchService m_service = MatchService.getInstance();
EstimateService e_service = EstimateService.getInstance();
ActionForward forward = new ActionForward();
ChatService chat_service = ChatService.getInstance();
m_service.matchUpdateService(request);
e_service.estimateInsertService(request);
chat_service.chatInsertService(request);
forward.setRedirect(true);
forward.setPath("chatListFormAction.do");
return forward;
}
}
|
cda0bef0-6ab9-4b53-9947-3a43f22e5ac5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-06-24T14:32:09", "repo_name": "rakeshchowdary07/Ofline-gmail-notification-with-python", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1051, "line_count": 28, "lang": "en", "doc_type": "text", "blob_id": "368932b7f9ed4f7644452cbf70e04c54f6921ebb", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rakeshchowdary07/Ofline-gmail-notification-with-python | 230 | FILENAME: README.md | 0.272025 | # Ofline gmail notification using python.
## Aim
- The offline email notification is the program where we can get our email notification without the use of the internet.
- This is helpful in every situation where one cannot use the internet.
- It directly gives the notification to the mobile number which Gmail is synced to the thing is that an automated system of this sort can be customized to suit the needs of the users and provide good service to them.
## Requirements
- python 2.7.
- create a account in twilio and get one free mobile number from twilio to send sms from program to you mobile number.
- make sure you provide correct gmail, password and your mobile number in profun.py file.
## Packages:-
1. twilio(pip install twilio).
2. time(pip install time).
3. Parser(pip install parser).
4. imaplib (pip install imaplib).
## Execution:-
- open terminal or cmd and go to the path where profun.py saved in you device.
- then execute profun.py file (python profun.py).
|
10171012-a05f-4f7d-8edc-cc19d0bcce64 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-04-06 12:57:28", "repo_name": "fengchuidaoguxiang/MyBatis", "sub_path": "/mybatis_one2many/src/com/test/MyTest.java", "file_name": "MyTest.java", "file_ext": "java", "file_size_in_byte": 1141, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "58988ab11c575e5f5e7ebdcd10ad2ffa488397ea", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/fengchuidaoguxiang/MyBatis | 237 | FILENAME: MyTest.java | 0.291787 | package com.test;
import com.domain.Department;
import com.domain.Employee2;
import com.mapper.DepartmentMapper;
import com.mapper.Employee2Mapper;
import com.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
import java.nio.channels.SeekableByteChannel;
import java.util.List;
public class MyTest {
//查询10号部门的信息和包含的员工信息
@Test
public void testGet(){
SqlSession session = MyBatisUtils.getSession();
DepartmentMapper departmentMapper = session.getMapper(DepartmentMapper.class);
Department department = departmentMapper.get(10L);
System.out.println(department);
System.out.println(department.getEmployee2s());
session.close();
}
@Test
public void testEGet(){
SqlSession session = MyBatisUtils.getSession();
Employee2Mapper employee2Mapper = session.getMapper(Employee2Mapper.class);
List<Employee2> employee2s = employee2Mapper.get(10L);
for(Employee2 employee2 : employee2s ){
System.out.println(employee2);
}
session.close();
}
}
|
8eb0e9f5-13a9-4f01-b365-ae3afcb8d821 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-01 12:13:21", "repo_name": "VassilisMp/airport", "sub_path": "/src/com/company/Flight.java", "file_name": "Flight.java", "file_ext": "java", "file_size_in_byte": 1077, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "3ee9613a6df5f04edf2a37553bee5c5815501a1c", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/VassilisMp/airport | 219 | FILENAME: Flight.java | 0.290981 | package com.company;
import java.io.Serializable;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
public class Flight implements Comparable<Flight>, Serializable {
private LocalDateTime dateTime;
private DayOfWeek day;
private int seats;
Flight(LocalDateTime dateTime, DayOfWeek day, int seats) {
this.dateTime = dateTime;
this.day = day;
this.seats = seats;
}
LocalDate getDate() {
return dateTime.toLocalDate();
}
DayOfWeek getDay() {
return day;
}
LocalTime getTime() {
return dateTime.toLocalTime();
}
int getSeats() {
return seats;
}
@Override
public String toString() {
return "Flight{" +
"date=" + getDate() +
", day=" + day +
", time=" + getTime() +
", seats=" + seats +
'}';
}
@Override
public int compareTo(Flight o) {
return dateTime.compareTo(o.dateTime);
}
}
|
f9c4a58e-ff09-40f2-961b-a312f0300dcd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-05-10T00:01:31", "repo_name": "mmubasheriqbal/Final-Project", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1003, "line_count": 18, "lang": "en", "doc_type": "text", "blob_id": "f98a079be765f04233dee6fb742a06ec9c18896b", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mmubasheriqbal/Final-Project | 232 | FILENAME: README.md | 0.200558 | # Final-Project
This is a documentation of the Final Project.
Link to Live Hosted Site: http://sites.bxmc.poly.edu/~mubasheriqbal/Final%20Project/home.html
# Changes from Midterms:
- Home: Added a carrousel. Favorite movie cards, with hover on effects. Bootstrap Navbar.
- Movie Page: Added a trailer for the movie. Rating system. Like button. Other suggestions.
- In general: Made the dropdown menu differently, by listing categories of movies instead of individual movies.
# What Challenges I faced/Problems with the code:
Perhaps the most challenging aspect was getting the javascrip for the star-rating system to work. It still does not register the click of the user. That is, it does not record the stars user has selected.
Navbar Issue: On same pages, the dropdown is not working.
[Update: It was a problem of loading javascript properly. It's fixed now.]
# What I would work on if I had more time:
I would like to make it thematically more beautiful. Improve the star-rating system.
|
8e9a5419-9e47-4754-aa57-2f8bde5182f1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-01 05:20:15", "repo_name": "kaelbastos/Good_Clean_Fun", "sub_path": "/src/main/java/org/kaelbastos/Domain/UseCases/ProductsUseCases/InsertProductKit.java", "file_name": "InsertProductKit.java", "file_ext": "java", "file_size_in_byte": 995, "line_count": 22, "lang": "en", "doc_type": "code", "blob_id": "f216a51d9e1db423a686c704a5ceefec5ac4e06f", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kaelbastos/Good_Clean_Fun | 174 | FILENAME: InsertProductKit.java | 0.290981 | package org.kaelbastos.Domain.UseCases.ProductsUseCases;
import org.kaelbastos.Domain.CustomExceptions.EntityAlreadyExistsException;
import org.kaelbastos.Domain.Entities.Product.Product;
import org.kaelbastos.Domain.Entities.Product.ProductValidator;
import org.kaelbastos.Domain.Entities.utils.Notification;
import org.kaelbastos.Persistance.PersistenceFacade;
public class InsertProductKit {
public boolean insert(Product product) throws Exception{
ProductValidator productValidator = new ProductValidator();
Notification notification = productValidator.validate(product);
PersistenceFacade persistenceFacade = PersistenceFacade.getInstance();
if(notification.hasErrors())
throw new IllegalArgumentException(notification.getMessage());
else if(persistenceFacade.getOneProduct(product.getId()).isPresent())
throw new EntityAlreadyExistsException("Product");
return persistenceFacade.saveProduct(product);
}
} |
f389466e-7862-45be-9588-20f9e60f28a2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-08-17 06:49:19", "repo_name": "donghyuck/legacy-architecture-project", "sub_path": "/architecture-common/src/main/java/architecture/common/event/internal/AnnotationAsynchronousEventResolver.java", "file_name": "AnnotationAsynchronousEventResolver.java", "file_ext": "java", "file_size_in_byte": 1045, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "def6fa45bb06b9c8024e1ff61c223f2b229fe92a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/donghyuck/legacy-architecture-project | 195 | FILENAME: AnnotationAsynchronousEventResolver.java | 0.268941 | package architecture.common.event.internal;
import static com.google.common.base.Preconditions.checkNotNull;
import architecture.common.event.api.AsynchronousPreferred;
/**
* <p>Annotation based {@link AsynchronousEventResolver}. This will check whether the event is annotated with the given
* annotation.</p>
* <p>The default annotation used is {@link architecture.common.event.api.AsynchronousPreferred}</p>
*
* @see architecture.common.event.api.AsynchronousPreferred
* @since 2.0
*/
public final class AnnotationAsynchronousEventResolver implements AsynchronousEventResolver {
private final Class annotationClass;
AnnotationAsynchronousEventResolver() {
this(AsynchronousPreferred.class);
}
AnnotationAsynchronousEventResolver(Class annotationClass) {
this.annotationClass = checkNotNull(annotationClass);
}
@SuppressWarnings("unchecked")
public boolean isAsynchronousEvent(Object event) {
return checkNotNull(event).getClass().getAnnotation(annotationClass) != null;
}
}
|
62806a16-a8db-46d4-932d-ef9e7a9ad262 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-14 19:16:44", "repo_name": "Omkar399/College_Selector", "sub_path": "/app/src/main/java/com/example/basicfragmentbottomnavigation/FragmentWarning.java", "file_name": "FragmentWarning.java", "file_ext": "java", "file_size_in_byte": 1081, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "d829008230a90f463121f9c8b0965a8880291c84", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Omkar399/College_Selector | 178 | FILENAME: FragmentWarning.java | 0.229535 | package com.example.basicfragmentbottomnavigation;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
public class FragmentWarning extends Fragment {
View view;
public Button btn;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.fragment_fragment_warning, container, false);
btn=view.findViewById(R.id.button5);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
start();
}
});
return view;
}
public void start()
{
Intent intent = new Intent(getActivity(), Question.class);
startActivity(intent);
}
}
|
30d1fd36-7e7c-425a-ae72-506b9b68cee3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-13 01:52:26", "repo_name": "hybridappnest/AppNestAndroid", "sub_path": "/tuikit/src/main/java/com/ymy/im/helper/type/WebViewType.java", "file_name": "WebViewType.java", "file_ext": "java", "file_size_in_byte": 1221, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "10b36f8f4991c1c89ac3e08120e17ff4c5446fea", "star_events_count": 10, "fork_events_count": 5, "src_encoding": "UTF-8"} | https://github.com/hybridappnest/AppNestAndroid | 337 | FILENAME: WebViewType.java | 0.233706 | package com.ymy.im.helper.type;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import androidx.annotation.StringDef;
/**
* Created on 2020/8/25 09:40.
*
* @author:hanxueqiang
* @version: 1.0.0
* @desc:
*/
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.PARAMETER})
@StringDef(value = {WebViewType.EVENT_DESC,
WebViewType.ALARM_HISTORY,
WebViewType.EVENT_MOVELINE,
WebViewType.ALARM_TIMELINE,
WebViewType.ALARM_SJPX_TEST,
WebViewType.ALARM_YANLIAN,})
public @interface WebViewType {
/**
* 事件详情
*/
String EVENT_DESC = "event_desc";
/**
* 报警历史
*/
String ALARM_HISTORY = "alarm_history";
/**
* 报警移动轨迹
*/
String EVENT_MOVELINE = "event_moveline";
/**
* 报警时间轴
*/
String ALARM_TIMELINE = "alarm_timeline";
/**
* 演练
*/
String ALARM_YANLIAN = "alarm_yanLian";
/**
* 交接
*/
String ALARM_JIAOJIE = "alarm_jiaoJie";
/**
* 实践能力测试1
*/
String ALARM_SJPX_TEST = "alarm_sjpx_test";
} |
74079f07-5967-4996-926e-0f1d3b25a1d1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-05 23:53:09", "repo_name": "jksantanderg/TareaIntegradora3_3", "sub_path": "/src/model/HeadCoach.java", "file_name": "HeadCoach.java", "file_ext": "java", "file_size_in_byte": 1014, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "81d030566c5b7253099810da1161a6a96dbaf8b5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jksantanderg/TareaIntegradora3_3 | 240 | FILENAME: HeadCoach.java | 0.26588 | package model;
public class HeadCoach extends Coach{
private int equipment;
private int championships;
/**
* @param nameEmployees
* @param id
* @param salary
* @param state
* @param yearsExperience
* @param equipment
* @param championships
*/
public HeadCoach(String nameEmployees, String id, String salary, String state, String yearsExperience,
int equipment, int championships) {
super(nameEmployees, id, salary, state, yearsExperience);
this.equipment = equipment;
this.championships = championships;
}
/**
* @return the equipment
*/
public int getEquipment() {
return equipment;
}
/**
* @param equipment the equipment to set
*/
public void setEquipment(int equipment) {
this.equipment = equipment;
}
/**
* @return the championships
*/
public int getChampionships() {
return championships;
}
/**
* @param championships the championships to set
*/
public void setChampionships(int championships) {
this.championships = championships;
}
}
|
ab30ba13-360e-4ed8-999c-d3bc53ae6171 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-07-09T13:53:08", "repo_name": "thomaszhou63/node-web", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1434, "line_count": 35, "lang": "zh", "doc_type": "text", "blob_id": "d816aa13a16c7b235de9f62a0f3baf9a907a1f1e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/thomaszhou63/node-web | 334 | FILENAME: README.md | 0.282988 | /blob/master/# node学起来
>## ```Vue + Vue-router + axios + nodejs + mongodb + mongoose```
这是在学习完vue之后的一个新的学习模块--node。前端是vue实现的,主要实现了nodejs,通过本项目,我清楚了node和数据库以及前端框架vue,通过axios向后台发送请求,后台是如何进行接受并进行操作的。
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
```
## ```图书展示页面(懒加载) ```

## ```设置筛选条件进行页面的商品显示 ```

## ``` 设置登录拦截(没有登陆情况下不允许加入购物车)```

## ```登录之后可以加入购物车,并进行结账等操作(当然有些小地方还未完成,后续会完善,并且加入更多功能) ```

For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
|
52908c3a-0d07-4e6d-b2f0-771e3fdc1c44 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-09-07T20:57:11", "repo_name": "vlvagerviwager/remote-working-is-the-future", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1190, "line_count": 18, "lang": "en", "doc_type": "text", "blob_id": "bf8b0ff38113e41c3e58f010b2e811dae3e63b68", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/vlvagerviwager/remote-working-is-the-future | 322 | FILENAME: README.md | 0.236516 | # Remote working is the future.
Remote working is the future.
Just a bunch of links for now.
---
- [Remote: Office Not Required, by David Heinemeier Hansson and Jason Fried](https://37signals.com/remote)
- [Stack Overflow - Why We (Still) Believe in Working Remotely](https://stackoverflow.blog/2013/02/01/why-we-still-believe-in-working-remotely/?ref=survey-2016)
- [Trello - 6 Rules To Live By When You Work In An Office But Have Remote Team Members](http://blog.trello.com/6-mistakes-when-you-work-in-office-but-have-remote-team-members%C2%A0)
- [Trello - 5 Fast Team Building Activities For Remote Video Meetings](http://blog.trello.com/team-building-activities-video-meetings)
- [Trello - When To Use What Tools For Remote Work Success [Infographic]](http://blog.trello.com/tools-for-remote-work-success-infographic)
- [GitLab - All Remote](https://about.gitlab.com/culture/remote-only/)
- [Remote work: 9 tips for eliminating distractions and getting things done](https://about.gitlab.com/2018/05/17/eliminating-distractions-and-getting-things-done/)
- [40 Lessons From 4 Years of Remote Work](https://open.buffer.com/remote-work-lessons/)
- [Grow Remote](https://growremote.ie/)
|
0c5d61d5-672b-4622-ac4d-a72ce64941c4 | {"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-starter-webmvc-ui/src/test/java/test/org/springdoc/ui/AbstractCommonTest.java", "file_name": "AbstractCommonTest.java", "file_ext": "java", "file_size_in_byte": 1044, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "36a69138031b789b19ba63d9c911b07a5f1ed45e", "star_events_count": 2866, "fork_events_count": 503, "src_encoding": "UTF-8"} | https://github.com/springdoc/springdoc-openapi | 213 | FILENAME: AbstractCommonTest.java | 0.261331 | package test.org.springdoc.ui;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
@AutoConfigureMockMvc
@ActiveProfiles("test")
public abstract class AbstractCommonTest {
@Autowired
protected MockMvc mockMvc;
protected String getContent(String fileName) {
try {
Path path = Paths.get(AbstractCommonTest.class.getClassLoader().getResource(fileName).toURI());
List<String> lines = Files.readAllLines(path, StandardCharsets.UTF_8);
StringBuilder sb = new StringBuilder();
for (String line : lines) {
sb.append(line).append("\n");
}
return sb.toString();
}
catch (Exception e) {
throw new RuntimeException("Failed to read file: " + fileName, e);
}
}
}
|
9a5483c7-1295-457b-9fa6-8a5c739bd597 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-17 18:52:43", "repo_name": "vtajzich/kafka-vehicle-example", "sub_path": "/kafka-vehicle-domain/src/main/java/com/kafka/vehicle/domain/DefaultVehicle.java", "file_name": "DefaultVehicle.java", "file_ext": "java", "file_size_in_byte": 1045, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "1fe26f1e977fc1e4f5eaf8878a555156a8a1c953", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/vtajzich/kafka-vehicle-example | 218 | FILENAME: DefaultVehicle.java | 0.246533 | package com.kafka.vehicle.domain;
import java.util.StringJoiner;
import java.util.UUID;
class DefaultVehicle implements Vehicle {
private final String id;
private final String name;
private final Metadata metadata;
DefaultVehicle(String name, Metadata metadata) {
this.id =UUID.randomUUID().toString();
this.name = name;
this.metadata = metadata;
}
DefaultVehicle(final String id, final String name, final Metadata metadata) {
this.id = id;
this.name = name;
this.metadata = metadata;
}
@Override
public String getId() {
return id;
}
@Override
public String getName() {
return name;
}
@Override
public Metadata getMetadata() {
return metadata;
}
@Override
public String toString() {
return new StringJoiner(", ", DefaultVehicle.class.getSimpleName() + "[", "]")
.add("id='" + id + "'")
.add("name='" + name + "'")
.toString();
}
}
|
59ef1550-5e64-4815-b88b-600a743b4f8e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-07-15T12:09:24", "repo_name": "sdadsp/LEDMAT3", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1086, "line_count": 37, "lang": "en", "doc_type": "text", "blob_id": "1cdde611134af50d5a250ac9eccec85b32cee980", "star_events_count": 2, "fork_events_count": 4, "src_encoding": "UTF-8"} | https://github.com/sdadsp/LEDMAT3 | 300 | FILENAME: README.md | 0.268941 | # LEDMAT3
## HDMI - LED Display Controller (FPGA)
This is a simple FPGA project (and PCB as well) for driving the common LED RGB-matrixes based on the popular drivers. MBI5124, MBI5153, and ICN2038 chips.
The input data is derived from:
* HDMI Input
* TPG (test pattern generator),
* BMP image, downloaded to FPGA RAM
The USB-VCP port allows to control the basic LED display parameters without recompiling the project.
### Compatible driver ICs:
* MBI5124, TC5020, and similar
* ICN2038
* MBI5153
### The fillowing LED panels are supported:
* up to 3 lanes, each up to 32 rows
* up to 384 columns in the each lane
* Non-cascaded panels (like Longrunled 120x90) are supported using a virtual internal chaining
### Suported functionalities
* On-board EDID
* HDMI clock detection
* Last image hold
* Variable refresh ratio, brightness, multiplex ratio
* Onboard USB VCP for remote control the display parameters
* USB- or External- powering
#### Other basic panels' configurations may be set via the project defines.
#

|
ee988c2e-e7cf-4fad-85dc-124d8e6cd590 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-08 00:18:14", "repo_name": "joamis/repo-details-service", "sub_path": "/repositoryDetails/src/main/java/com/example/repositoryDetails/RepositoryController.java", "file_name": "RepositoryController.java", "file_ext": "java", "file_size_in_byte": 1164, "line_count": 23, "lang": "en", "doc_type": "code", "blob_id": "7e09454249802b0bede8fd352fc1a6870ef08c0a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/joamis/repo-details-service | 189 | FILENAME: RepositoryController.java | 0.229535 | package com.example.repositoryDetails;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
@RestController
public class RepositoryController {
private static final String REPOSITORY_DETAILS_URL = "https://api.github.com/repos/";
@Autowired
private RestTemplate restTemplateWithErrorHandler;
@GetMapping("/repositories/{owner}/{repository-name}")
public RepositoryDetails getRepositoryDetails(@PathVariable("owner") String ownerName, @PathVariable("repository-name") String repositoryName) {
String url = REPOSITORY_DETAILS_URL + ownerName + '/' + repositoryName;
GithubRepository githubRepository = restTemplateWithErrorHandler.getForObject(url, GithubRepository.class);
return new RepositoryDetails(githubRepository.getFullName(), githubRepository.getDescription(), githubRepository.getCloneUrl(), githubRepository.getStars(), githubRepository.getCreatedAt());
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.