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 |
|---|---|---|---|---|---|---|
7407d332-9fa6-4b11-8a8a-bb87dffb710f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-26 13:59:09", "repo_name": "ViRb3/game2d-dungeon", "sub_path": "/src/main/java/Block.java", "file_name": "Block.java", "file_ext": "java", "file_size_in_byte": 998, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "a6e1954ac3b15a14969cf5c892b8c1e22d127180", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ViRb3/game2d-dungeon | 215 | FILENAME: Block.java | 0.242206 | import game2D.Animation;
import java.awt.event.KeyEvent;
import java.util.List;
class Block extends GameObject {
public Block(GameState gameState, AnimationState animationState) {
super(gameState, animationState);
this.trigger = false;
}
public static Block create(GameState gameState) {
Animation animation = new Animation();
animation.loadAnimationFromSheet("images/block.png", 1, 1, 60);
Block npc = new Block(gameState, new AnimationState(animation));
npc.setScale(4);
return npc;
}
@Override
public void preReboundTick(long elapsed, List<TileCollision> collidingTiles, List<GameObjectCollision> collidingGameObjects) {
}
@Override
public void postReboundTick(long elapsed, List<TileCollision> collidingTiles, List<GameObjectCollision> collidingGameObjects) {
}
@Override
public void keyPressed(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
}
}
|
54dcb117-1ee2-4677-870c-808686d95bc4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2022-05-14T19:33:16", "repo_name": "jonluca/Never-Ending-Netflix", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1060, "line_count": 32, "lang": "en", "doc_type": "text", "blob_id": "eade9fa495963daaf812d2bef3e56ddf40b25508", "star_events_count": 55, "fork_events_count": 14, "src_encoding": "UTF-8"} | https://github.com/jonluca/Never-Ending-Netflix | 276 | FILENAME: README.md | 0.201813 | # Never Ending Netflix
[NEN](https://chrome.google.com/webstore/detail/hdadmgabliibighlbejhlglfjgplfmhb) is a chrome extension that improves the Netflix experience for power users. It's features include:
* Automatically skip intros
* Automatically play the next episode
* Skip the popups that ask if you're "Still here?" after 8 hours
* Search *all* of Netflix's genre's
## Options
NEN allows you to customize it's functionality with an options menu, which can be accessed by clicking the logo in the top bar.

## Live link
[Link to Chrome Webstore](https://chrome.google.com/webstore/detail/hdadmgabliibighlbejhlglfjgplfmhb)
## Language
Note: I used Google Translate for all the translations. If there is anything wrong with them, please file an issue here and I'll fix it ASAP!
## Libraries & Credits
* [Fuse.js](http://fusejs.io/) - Genre search
* [gumby](https://gumbyframework.com/docs/javascript/) - Options page
* [modernizr](https://modernizr.com/) - Options page
* [jQuery](https://jquery.com/)
|
7e144c68-3b34-4b24-aaa7-3934ddaf7eed | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-05-28T22:08:20", "repo_name": "AdamColton/buttress", "sub_path": "/config/readme.md", "file_name": "readme.md", "file_ext": "md", "file_size_in_byte": 1135, "line_count": 35, "lang": "en", "doc_type": "text", "blob_id": "d055fded868c6332102a569d425a39b71b916e4c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AdamColton/buttress | 338 | FILENAME: readme.md | 0.258326 | ## Gothic Config
A different approach to configs. One of the goals of gothic is to compile
everything into a single binary. That would include all configs so that a single
binary can run as any environment. Rather than keeping the configs in files,
the thinking is that the configs can be set in code.
### Recipes
#### Command line or os.Getenv
```Go
config.Environments("dev", "test", "prod")
if key := os.Getenv("key"){
config.SetBytes("key").AsBase64(key)
} else {
config.SetBytes("key").
AsBase64("FEz_Oh8lFXY1u0ymBxipESwxlxprKUSFTHyPG5fGFt4=", "dev").
AsBase64("JvQwfAAVxyn1WOt8NvQD4OJU--29mBKz8KoYGy1ghvs=", "test").
}
```
Where "key" is either an environment variable set for the user or is set from the
command line
```bash
key=ZoF4Z14lso3o4hlejIH_Q3TwayUxS5rmboiPLDH2Rs0= serviceName
```
This achieves two things. For security, the production key is not stored in the
code and must be set on the production machine. Second, we have default dev and
test keys, but we can also override them using an environment variable during
testing.
The same thing can be done with arguments passed in through the command line. |
21a826fd-1a67-4541-be7f-cb382b8b4a06 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-23 07:15:43", "repo_name": "xioak/full-demo", "sub_path": "/news-manager-mvc/dao/src/main/java/com/xioa/service/impl/PrilServiceImpl.java", "file_name": "PrilServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1196, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "6cdfe3ba86921b1fcb19a0ea684f393a0fc21f2b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xioak/full-demo | 268 | FILENAME: PrilServiceImpl.java | 0.286968 | package com.xioa.service.impl;
import com.xioa.dao.PrilMapper;
import com.xioa.model.Pril;
import com.xioa.service.IPrilService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class PrilServiceImpl implements IPrilService{
@Autowired
PrilMapper prilMapper;
@Override
public int addPril(Pril recode, int i) {
try {
int r= prilMapper.insert(recode);
if(r==1 && i==1){
// throw new RuntimeException("erro : user define erro");
throw new Exception("new Exception");
}else{
return r;
}
} catch (RuntimeException e) {
throw new RuntimeException("user define erro" +e.getMessage());
}catch (Exception e){
System.out.println(e.getMessage());
throw new RuntimeException("user define erro 222" +e.getMessage());
}
}
@Override
public int updatePril(Pril recode) {
return 0;
}
@Override
public Pril findPril(Integer id) {
return null;
}
@Override
public void getByProc(int id) {
}
} |
d8ff8a67-e6b3-4f1e-a509-30f2937c505b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-11-06 14:58:49", "repo_name": "yikezhan/ywqDemo", "sub_path": "/demo/src/test/java/com/yuwuquan/demo/common/leetcode/LIS.java", "file_name": "LIS.java", "file_ext": "java", "file_size_in_byte": 1003, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "32d98d2b4ec41fb1b3d35ae1b28d4e2a0e6867fa", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yikezhan/ywqDemo | 229 | FILENAME: LIS.java | 0.294215 | package com.yuwuquan.demo.common.leetcode;
import java.util.Stack;
//最长递增子序列
public class LIS {
public static void main(String[] args) {
int[] a = {10,9,2,5,3,4};
System.out.println(new LIS().lengthOfLIS(a));
}
public int lengthOfLIS(int[] nums) {
Stack<Integer> stack = new Stack<>();
for(int i =0; i<nums.length; i++){
Stack<Integer> stack2 = new Stack<>();
if(stack.size()==0){
stack.push(nums[i]);
continue;
}
for(int val = stack.peek();val>=nums[i] && stack.size() != 0;){
stack2.push(stack.pop());
if(stack.size()==0) break;
else val = stack.peek();
}
stack.push(nums[i]);
if(stack2.size()!=0){
for(stack2.pop();stack2.size()!=0;){
stack.push(stack2.pop());
}
}
}
return stack.size();
}
}
|
14ba5afb-024a-465c-9ead-cab2f5238d2d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-30 19:24:58", "repo_name": "ssatish880/RanazunjarDholTasha", "sub_path": "/app/src/main/java/com/developers/shreeganesha/ranazunjardholtasha/Home_Ranazunjar.java", "file_name": "Home_Ranazunjar.java", "file_ext": "java", "file_size_in_byte": 1031, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "bf7568d768a178f530305bfeb5c9d8a40994b303", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ssatish880/RanazunjarDholTasha | 204 | FILENAME: Home_Ranazunjar.java | 0.218669 | package com.developers.shreeganesha.ranazunjardholtasha;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
/**
* A simple {@link Fragment} subclass.
*/
public class Home_Ranazunjar extends Fragment {
TextView practice_Place;
public Home_Ranazunjar() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View root = inflater.inflate(R.layout.fragment_home__ranazunjar, container, false);
practice_Place = (TextView) root.findViewById(R.id.place);
Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(),"fonts/Shivaji05.ttf");
practice_Place.setTypeface(typeface);
return root;
}
}
|
9f34d3e7-f89e-4f6b-a736-489872e0f068 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-21 19:23:33", "repo_name": "Sagar5885/SeleniumJava", "sub_path": "/src/demos/DataReader.java", "file_name": "DataReader.java", "file_ext": "java", "file_size_in_byte": 989, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "0e51bf72bc79963a44592fd854164e31778dcb3a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Sagar5885/SeleniumJava | 199 | FILENAME: DataReader.java | 0.271252 | package demos;
import java.util.List;
import static utilities.CSVReader.get;
import static utilities.ExcelReader.get1;
public class DataReader {
public static void main(String args[]){
//readCsv();
readExcel();
}
public static void readCsv(){
String filename = "/Users/sdodia/Desktop/SeleniumProjectJava/UserAccounts.csv";
List<String[]> records = get(filename);
//Iterating through the list
for (String[] record: records) {
for (String field : record) {
System.out.println(field);
}
}
}
public static void readExcel(){
String filename = "/Users/sdodia/Desktop/SeleniumProjectJava/UserLogin.xls";
String[][] data = get1(filename);
for (String[] record : data) {
System.out.println();
System.out.println(record[0]);
System.out.println(record[1]);
System.out.println(record[2]);
}
}
}
|
1f09ab10-2e3e-463e-a18d-e4c85b55d188 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-28 13:11:29", "repo_name": "developma/mybatis-spring-paging", "sub_path": "/src/main/java/com/example/paging/config/MyBatisConfig.java", "file_name": "MyBatisConfig.java", "file_ext": "java", "file_size_in_byte": 1021, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "dd9ed0a4829de9f8c19588603a8a4e9905049dfc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/developma/mybatis-spring-paging | 167 | FILENAME: MyBatisConfig.java | 0.228156 | package com.example.paging.config;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import javax.sql.DataSource;
@Configuration
@MapperScan({"com.example.paging"})
public class MyBatisConfig {
public DataSource dataSource() {
EmbeddedDatabaseBuilder embeddedDatabaseBuilder = new EmbeddedDatabaseBuilder();
embeddedDatabaseBuilder.setType(EmbeddedDatabaseType.H2);
return embeddedDatabaseBuilder.build();
}
@Bean
public SqlSessionFactoryBean sqlSessionFactoryBean() {
final SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
sqlSessionFactoryBean.setDataSource(dataSource());
return sqlSessionFactoryBean;
}
}
|
585b82a3-4c63-4cc8-bf4b-6b90971370ce | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-07 22:10:31", "repo_name": "onlyonce/openbanking-tpp-server", "sub_path": "/src/main/java/uk/org/openbanking/v3_1_2/parser/DateUtils.java", "file_name": "DateUtils.java", "file_ext": "java", "file_size_in_byte": 1002, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "d322b0a8b534f202c8167eece7914c8c445e5745", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/onlyonce/openbanking-tpp-server | 224 | FILENAME: DateUtils.java | 0.281406 | /*
* This Source Code Form is subject to the terms of the Mozilla
* Public License, v. 2.0. If a copy of the MPL was not distributed
* with this file, You can obtain one at
*
* https://mozilla.org/MPL/2.0/.
*/
package uk.org.openbanking.v3_1_2.parser;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.Date;
public final class DateUtils {
private static final SimpleDateFormat LOCAL_DATE_TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
private DateUtils() {
// Utility class
}
public static LocalDateTime parseLocalFormatDateTime(final String date) {
return null == date ? null : LocalDateTime.ofInstant(OffsetDateTime.parse(date).toInstant(), ZoneOffset.UTC);
}
public static String formatLocalFormatDateTime(final LocalDateTime date) {
return null == date ? null : LOCAL_DATE_TIME_FORMAT.format(Date.from(date.toInstant(ZoneOffset.UTC)));
}
}
|
0d0564e8-594a-40d3-a148-0bef514ff913 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-09 18:23:30", "repo_name": "KimoneSE/Movies", "sub_path": "/src/com/movie/dao/impl/UserDaoImpl.java", "file_name": "UserDaoImpl.java", "file_ext": "java", "file_size_in_byte": 1081, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "145d53b1633edb1975fc4ed29cbeaaaf266a243b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/KimoneSE/Movies | 200 | FILENAME: UserDaoImpl.java | 0.279828 | package com.movie.dao.impl;
import javax.transaction.Transactional;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.movie.dao.UserDao;
import com.movie.model.User;
@Repository
public class UserDaoImpl implements UserDao{
@Autowired
private SessionFactory sessionFactory;
@Override
@Transactional
public User createUser(String username, String password) {
Session session = sessionFactory.getCurrentSession();
User user = new User();
user.setUsername(username);
user.setPassword(password);
session.save(user);
return user;
}
@Override
public User findByUsername(String username) {
Session session = sessionFactory.getCurrentSession();
Query query = session.createQuery("from User where username='"+username+"'");
if(query.list()==null||query.list().size() == 0){
return null;
}else{
return (User)query.list().get(0);
}
}
}
|
e0fd584e-7b62-45d9-bc79-b38bf24b6b72 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-28 20:35:46", "repo_name": "niemczyk13/ChatClientV3.3", "sub_path": "/src/main/java/com/niemiec/games/battleship/controllers/ConfirmationOfLeaveGameWindowController.java", "file_name": "ConfirmationOfLeaveGameWindowController.java", "file_ext": "java", "file_size_in_byte": 1114, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "b2aebaf8b00e570d1a8a88f12d41026f837b3cdd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/niemczyk13/ChatClientV3.3 | 253 | FILENAME: ConfirmationOfLeaveGameWindowController.java | 0.282988 | package com.niemiec.games.battleship.controllers;
import com.niemiec.chat.dispatchers.general.DispatcherOfOutgoingRequest;
import com.niemiec.games.battleship.command.order.game.GiveUp;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
public class ConfirmationOfLeaveGameWindowController {
private int typeOfGame;
private String opponentPlayerNick;
private DispatcherOfOutgoingRequest dispatcherOfOutgoingRequest;
@FXML
public
void cancel() {
dispatcherOfOutgoingRequest.setTheCommand(new GiveUp(typeOfGame, opponentPlayerNick, GiveUp.CANCEL));
}
@FXML
void exit(ActionEvent event) {
dispatcherOfOutgoingRequest.setTheCommand(new GiveUp(typeOfGame, opponentPlayerNick, GiveUp.GIVE_UP));
}
public void setOpponentPlayerNick(String opponentPlayerNick) {
this.opponentPlayerNick = opponentPlayerNick;
}
public void setDispatcherOfOutgoingRequest(DispatcherOfOutgoingRequest dispatcherOfOutgoingRequest) {
this.dispatcherOfOutgoingRequest = dispatcherOfOutgoingRequest;
}
public void setTypeOfGame(int typeOfGame) {
this.typeOfGame = typeOfGame;
}
}
|
4dcd1595-2e6e-4da8-b75f-1361a49b95aa | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-07-17 14:01:24", "repo_name": "raisercostin/raisercostin-commons", "sub_path": "/src/main/java/org/raisercostin/utils/ResourceUtils.java", "file_name": "ResourceUtils.java", "file_ext": "java", "file_size_in_byte": 1054, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "d8c41e6db45dd938099bd549ac18a66a2f1423e8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/raisercostin/raisercostin-commons | 197 | FILENAME: ResourceUtils.java | 0.235108 | package org.raisercostin.utils;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import org.springframework.core.io.Resource;
public class ResourceUtils {
public static String readAsString(Resource resource, String encoding, boolean replaceWithStandardEndOfLine) {
InputStream in = null;
try {
in = resource.getInputStream();
String string = IOUtils.toString(in, encoding);
if (replaceWithStandardEndOfLine) {
string = toStandardEndOfLine(string);
}
return string;
} catch (IOException e) {
throw new RuntimeException("When trying to read resource [" + resource + "] using encoding=[" + encoding
+ "] an exception occureed.", e);
} finally {
IOUtils.closeQuietly(in);
}
}
public static String toStandardEndOfLine(String string) {
return string.replace(IOUtils.LINE_SEPARATOR, "\n");
}
}
|
c3ce45e5-416b-426d-8725-3ed234b7cbd3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-05 15:14:47", "repo_name": "thomas6666/springmvcfirst", "sub_path": "/src/main/java/com/wangwang/springmvcfirst/demo/DBTestConnection.java", "file_name": "DBTestConnection.java", "file_ext": "java", "file_size_in_byte": 1275, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "3ea1a8dc134c00d2d1e448111e2b58612745aa4d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/thomas6666/springmvcfirst | 327 | FILENAME: DBTestConnection.java | 0.289372 | package com.wangwang.springmvcfirst.demo;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class DBTestConnection {
public static void main(String[] args) throws Exception {
String url = "jdbc:oracle:thin:@127.0.0.1:1521:ORCL";
String user = "SCOTT";
String password = "Orcl1234";
// 1、加载驱动 这种方式不好,会导致驱动加载两次,并且耦合度太高
// DriverManager.registerDriver(new OracleDriver());
// 通过类加载驱动
Class.forName("oracle.jdbc.driver.OracleDriver");
// 2、获取与数据库的连接
Connection con = DriverManager.getConnection(url, user, password);
// 3、获取用于发送sql数据库statement对象
Statement st = con.createStatement();
String sql = "select * from dept";
// 4、向数据库发送sql
ResultSet rs = st.executeQuery(sql);
int count = 1;
while (rs.next()) {
System.out.println("第" + count + "条数据");
System.out.println("DEPTNO:" + rs.getString("DEPTNO"));
System.out.println("DNAME:" + rs.getString("DNAME"));
System.out.println("LOC:" + rs.getString("LOC"));
System.out.println("======================");
count++;
}
st.close();
rs.close();
con.close();
}
}
|
2e7afd5e-29e3-497b-8117-01a558045681 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-28 02:22:18", "repo_name": "chrisparrella23/Login-with-SQLite", "sub_path": "/Login-with-SQLite/src/authentication/LoginController.java", "file_name": "LoginController.java", "file_ext": "java", "file_size_in_byte": 1044, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "898a03313f8463a38190fb85c8fde29818231312", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/chrisparrella23/Login-with-SQLite | 233 | FILENAME: LoginController.java | 0.292595 | package authentication;
import java.io.IOException;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
public class LoginController {
public LoginController() {
}
static String[] userInfo = new String[6];
@FXML
private Button button;
@FXML
private TextField username;
@FXML
private PasswordField password;
@FXML
private String[] userLogin(ActionEvent event) throws IOException {
App a = new App();
String userName = username.getText();
String passWord = password.getText();
String[] loginInfo = {userName, passWord};
userInfo = UserUtils.login("UserDB.sqlite", loginInfo);
if (userInfo[0] == null) {
a.changeScene("FailureView.fxml");
} else {
a.changeScene("UserInfoView.fxml");
return userInfo;
}
return null;
}
@FXML
private void goToUserCreation(ActionEvent event) throws IOException {
App a = new App();
a.changeScene("UserCreationView.fxml");
}
}
|
296575ff-43e5-454a-bc1c-694258d755d9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-23 09:23:38", "repo_name": "neoteric-eu/neo-starters", "sub_path": "/neo-starter/src/main/java/eu/neoteric/starter/jackson/JsonParser.java", "file_name": "JsonParser.java", "file_ext": "java", "file_size_in_byte": 1196, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "e866fc071a28da07b69895caf56f90c178de1dc9", "star_events_count": 11, "fork_events_count": 11, "src_encoding": "UTF-8"} | https://github.com/neoteric-eu/neo-starters | 223 | FILENAME: JsonParser.java | 0.250913 | package eu.neoteric.starter.jackson;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
public class JsonParser {
private static final Logger LOG = LoggerFactory.getLogger(JsonParser.class);
private final ObjectMapper mapper;
public JsonParser(ObjectMapper mapper) {
this.mapper = mapper;
}
public String toJson(Object object) {
try {
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(object);
} catch (JsonProcessingException e) {
LOG.error("Unable to serialize to JSON", e);
throw new IllegalStateException("Unable to serialize to JSON", e);
}
}
public <T> T fromJson(Class<T> resultClass, String json) {
try {
return mapper.readValue(json, resultClass);
} catch (IOException e) {
LOG.error("Unable to deserialize JSON to {}", resultClass.getSimpleName(), e);
throw new IllegalArgumentException("Unable to deserialize JSON to " + resultClass.getSimpleName());
}
}
} |
afb40b48-e7bc-4a48-8400-263f4fae5eb3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-26T08:39:13", "repo_name": "toannguyen17/Blog-HTTQ-backend", "sub_path": "/src/main/java/com/httq/dto/BaseResponse.java", "file_name": "BaseResponse.java", "file_ext": "java", "file_size_in_byte": 973, "line_count": 64, "lang": "en", "doc_type": "code", "blob_id": "14892a9c5a057cef452974a159669ab78a285225", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/toannguyen17/Blog-HTTQ-backend | 239 | FILENAME: BaseResponse.java | 0.275909 | package com.httq.dto;
import java.util.Date;
public class BaseResponse<T> {
private Integer status;
private String msg;
private T data;
private Long timestamp;
public BaseResponse() {
defaultData();
}
public BaseResponse(T data) {
this.data = data;
defaultData();
}
public BaseResponse(T data, String msg, Integer status) {
this.status = status;
this.msg = msg;
this.data = data;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public Long getTimestamp() {
return timestamp;
}
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
public void defaultData() {
timestamp = new Date().getTime();
status = 0;
msg = "";
}
}
|
0fc8b25b-c20e-41b3-8a89-8774ad3b830b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-10-31T11:23:10", "repo_name": "pk4tech/Java-UI-with-advance-Coding", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1010, "line_count": 30, "lang": "en", "doc_type": "text", "blob_id": "7ae13a7b0cf5d223f6685547de653f5e5b9fdbf0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/pk4tech/Java-UI-with-advance-Coding | 276 | FILENAME: README.md | 0.27513 | # Java-UI-with-advance-Coding for Windows
This is the advance java application for windows
In this section we are using
Jpanels
Jtext
JField
IOExceptions and much more coding with NetBeans
By Me Pradip
Comment Here to get this video in real type
==================================================
Official http://bit.ly/2YlCFvm
Hacking http://bit.ly/2vTHUpC
Educational http://bit.ly/2E1g934
Sponsered http://bit.ly/2Hcjihg
==================================================
**************************************
Follow me:
Facebook Page: http://bit.ly/2V9O4wc
Facebook: http://bit.ly/2Jw0rRe
Pintress: http://bit.ly/2LyQRzy
LinkedIn: http://bit.ly/2DnoAFr
Instagram: http://bit.ly/2VSsJMh
GitHub: http://bit.ly/2Yl6ax8
**************************************
Contact for any Business Design
Call : +977 9813173454 /IMO, WhatsApp,
Email - iampk4tech@gmail.com
Website: https://bit.ly/Pk4Tech ( Processing)
|
0ad20458-ad45-4dff-ac12-800fb25c4af0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-09T20:21:10", "repo_name": "davidtkeshela/TaskForCandidate", "sub_path": "/src/main/java/PageObjects/CheckOutPages/ShippingTermsPage.java", "file_name": "ShippingTermsPage.java", "file_ext": "java", "file_size_in_byte": 1088, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "5aa257fe029b733a6f4cd651f77fb8662542fc75", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/davidtkeshela/TaskForCandidate | 216 | FILENAME: ShippingTermsPage.java | 0.264358 | package PageObjects.CheckOutPages;
import Common.Helper;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.PageFactory;
public class ShippingTermsPage {
WebDriver driver;
public ShippingTermsPage(WebDriver driver) {
this.driver = driver;
PageFactory.initElements(driver, this);
}
public WebElement getProccedToChekoutButton() {
return Helper.waitForElementPresence(driver, By.xpath("//button[@type=\"submit\"]/span[contains(text(), \"Proceed to checkout\")]"));
}
public WebElement getDialogBox() {
return Helper.waitForElementPresence(driver, By.xpath("//p[contains(text(), \"You must agree to the terms of service before continuing.\")]"));
}
public WebElement getDialogBoxClose() {
return Helper.waitForElementPresence(driver, By.xpath("//a[@class=\"fancybox-item fancybox-close\"]"));
}
public WebElement getAcceptTermsCheck(){
return Helper.waitForElementPresence(driver, By.id("cgv"));
}
}
|
818408b1-8ea0-47a0-96e6-b3d1fedd3ccf | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-04-15T03:36:15", "repo_name": "jethrochan/reactdjango", "sub_path": "/reactDRFGithub/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1054, "line_count": 28, "lang": "en", "doc_type": "text", "blob_id": "65259c68f26a29e6df2a6c37f284d4f2e096d4d8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jethrochan/reactdjango | 282 | FILENAME: README.md | 0.268941 | #Django Rest Framework Browsable API<br />
#This is a project that integrates React on top of the Django Rest Framework.<br />
#It provides full CRUD operations.<br />
#React Code is under the /assets directory<br />
#Usage and Setup<br />
#OS: Unix<br />
#DJANGO SPECIFIC<br />
#install python3 in your environment<br />
#virtualenv fistbumpenv<br />
#move this project directory (ReactDRF) into the virtualenv directory (ie fistbumpenv) <br />
#pip3 install -r requirements.txt<br />
#use a secret key generator and place it in the line where there is a "TODO" in fistbump/settings.py<br />
#python3 manage.py createsuperuser (Do this to create a user to login to the REST API and React project) <br />
#python3 manage.py makemigrations<br />
#python3 manage.py migrate<br />
#REACT SPECIFIC<br />
#npm install<br />
#npm run build<br />
#Run the project:<br />
#python3 manage.py runserver 0.0.0.0:8000<br />
#go to localhost:8000 to view the Django Rest API endpoint<br />
#go to localhost:8000/fistbump/ to go to react project root page.<br />
|
793b2710-8cd5-417d-a1a6-a7f76548e0f6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-24 14:17:44", "repo_name": "m4292007/openssp", "sub_path": "/data-sim-client/src/main/java/com/atg/openssp/dspSimUi/view/videoAd/VideoAdMaintenanceView.java", "file_name": "VideoAdMaintenanceView.java", "file_ext": "java", "file_size_in_byte": 1038, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "12a08d5b09afee98337fc2d175f97089f1177762", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/m4292007/openssp | 232 | FILENAME: VideoAdMaintenanceView.java | 0.279042 | package com.atg.openssp.dspSimUi.view.videoAd;
import com.atg.openssp.dspSimUi.videoAd.VideoAdServerHandler;
import com.atg.openssp.dspSimUi.model.ad.video.VideoAdModel;
import javax.swing.*;
import java.awt.*;
/**
* @author Brian Sorensen
*/
public class VideoAdMaintenanceView {
private final VideoAdModel model;
private final JFrame frame;
public VideoAdMaintenanceView(VideoAdModel videoAdModel) {
this.model = videoAdModel;
frame = new JFrame("VideoAd Maintenance - "+model.lookupProperty(VideoAdServerHandler.SITE_HOST)+":"+model.lookupProperty(VideoAdServerHandler.SITE_PORT));
JTabbedPane tabs = new JTabbedPane();
frame.setContentPane(tabs);
tabs.addTab("VideoAd Maintenance", new VideoAdMaintenancePanel(videoAdModel));
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setSize(d.width, d.height-40);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
public void start() {
frame.setVisible(true);
}
}
|
8dbdaf66-ab15-4582-826e-0bb9cc289c6a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-16 01:44:10", "repo_name": "PawelPrusalowicz/KlubTenisowy", "sub_path": "/src/app/CustomIntegerStringConverter.java", "file_name": "CustomIntegerStringConverter.java", "file_ext": "java", "file_size_in_byte": 1055, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "ab784f62c0d8a39684a2daed66607d9dae8c0435", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/PawelPrusalowicz/KlubTenisowy | 191 | FILENAME: CustomIntegerStringConverter.java | 0.274351 | package app;
import javafx.scene.control.Alert;
import javafx.util.converter.IntegerStringConverter;
public class CustomIntegerStringConverter extends IntegerStringConverter {
private final IntegerStringConverter converter = new IntegerStringConverter();
@Override
public String toString(Integer object) {
try {
if (object == 0){
return "";
} else {
return converter.toString(object);
}
} catch (NumberFormatException e) {
}
return null;
}
@Override
public Integer fromString(String string) {
try {
if (string == ""){
return 0;
} else {
return converter.fromString(string);
}
} catch (NumberFormatException e) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Błąd");
alert.setContentText("Proszę wprowadzić liczbę!");
alert.show();
}
return -1;
}
} |
416b3718-d0e2-413a-ac76-62f46b3bc211 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-08-03T12:38:37", "repo_name": "PublicInMotionGmbH/ui-kit", "sub_path": "/packages/countdown/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1137, "line_count": 32, "lang": "en", "doc_type": "text", "blob_id": "ee127ea7a80ac4a74aa2e23ddf4137fcbc4edc96", "star_events_count": 10, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/PublicInMotionGmbH/ui-kit | 263 | FILENAME: README.md | 0.29584 | # Talixo Countdown
UI Component which represents Countdown
## How to install
Package is available as `@talixo/countdown` in NPM registry, so you can use it in your project
using `npm install @talixo/countdown --save` or `yarn add @talixo/countdown`.
## Requirements
Your package should additionally have some extra dependencies:
- `@talixo/shared: ^1.0.0-alpha.35`
- `prop-types: ^15.6.1`
- `react: ^16.2.0`
These packages are required by `@talixo/countdown`, but you have to install them manually,
to avoid having different versions of these in your application.
## Supported props
Property name | Type | Required | Default | Description
--------------|----------|-----------|:------------------------:|--------------------------------
className | string | no | n/a | Additional class name passed to wrapper
render | function | no | `BasicCountdownRenderer` | Custom function to render countdown by time left
targetDate | string | yes | n/a | The date to which it will count down
## Changelog
- **0.1.0** - initial version
|
531b94ba-579b-4446-ab64-ba62a8cf7f21 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-03-09T00:54:06", "repo_name": "code-rush/MovieTrailerWebsite", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 980, "line_count": 21, "lang": "en", "doc_type": "text", "blob_id": "fe7fa3a36f4ed682391bdb0739f0a741337a4ec9", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/code-rush/MovieTrailerWebsite | 202 | FILENAME: README.md | 0.217338 | # MovieTrailerWebsite
MovieTrailerWebsite is a simple webpage to store user's favorite movies, details about the movies and its trailer.
## Two ways to run the website
1) First, Clone this repository to your computer. Open my_movies.html file which will take you to my website. The page contains my favorite movie cards. You can flip cards by hovering over them. The front side contains the movie images and the back side contains its description and trailer button.
2) Go to http://code-rush.github.io/MovieTrailerWebsite
**The users can also build their webpage themselves with python entertainment-center.py if they have python installed.**
Steps to watch movie trailers
-----------------------------
1. Hover over a movie image which will flip the card and on the back side you can see movie details like Storyline, Release Date, Stars, Directors and Watch Trailer button.
2. Click on the Watch Trailer button below the movie details to watch the trailer.
3. Enjoy!
|
dedab967-0e8c-42ff-83b8-51a457c782c7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-12 12:49:36", "repo_name": "fangwenfei/fwfTestCloud", "sub_path": "/cfmoto/cfmoto-modules/cfmoto-upms-service/src/main/java/com/github/pig/admin/model/entity/FwfTest.java", "file_name": "FwfTest.java", "file_ext": "java", "file_size_in_byte": 982, "line_count": 53, "lang": "en", "doc_type": "code", "blob_id": "5568ec6fe87a47d1b40f531539d73d206d8d8fbc", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/fangwenfei/fwfTestCloud | 258 | FILENAME: FwfTest.java | 0.221351 | package com.github.pig.admin.model.entity;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author FangWenFei
* @since 2018-12-18
*/
@TableName("fwf_test")
public class FwfTest extends Model<FwfTest> {
private static final long serialVersionUID = 1L;
private Integer fwftest;
private String fwfname;
public Integer getFwftest() {
return fwftest;
}
public void setFwftest(Integer fwftest) {
this.fwftest = fwftest;
}
public String getFwfname() {
return fwfname;
}
public void setFwfname(String fwfname) {
this.fwfname = fwfname;
}
@Override
protected Serializable pkVal() {
return this.fwftest;
}
@Override
public String toString() {
return "FwfTest{" +
", fwftest=" + fwftest +
", fwfname=" + fwfname +
"}";
}
}
|
ef969fe3-bd5b-4bc1-a1e9-db16fb5f7069 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-07 15:08:35", "repo_name": "kara4k/MediaGrub", "sub_path": "/app/src/main/java/com/kara4k/mediagrub/view/adapters/recycler/BaseAdapter.java", "file_name": "BaseAdapter.java", "file_ext": "java", "file_size_in_byte": 1197, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "65f83562768104c37a0918c9a11c226a457d89ec", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kara4k/MediaGrub | 258 | FILENAME: BaseAdapter.java | 0.288569 | package com.kara4k.mediagrub.view.adapters.recycler;
import android.support.v7.widget.RecyclerView;
import java.util.List;
public abstract class BaseAdapter<T extends SelectableItem, H extends BaseHolder<T>> extends RecyclerView.Adapter<H> {
private List<T> mList;
@Override
public void onBindViewHolder(H holder, int position) {
holder.onBind(mList.get(position), ++position);
}
public void finishActionMode() {
for (int i = 0; i < mList.size(); i++) {
mList.get(i).setSelected(false);
}
notifyDataSetChanged();
}
@Override
public int getItemCount() {
return mList == null ? 0 : mList.size();
}
public void setList(List<T> list) {
mList = list;
notifyDataSetChanged();
}
public void setItemSelected(int position, boolean isSelected) {
mList.get(position).setSelected(isSelected);
notifyItemChanged(position);
}
public void setSelectedAll() {
for (int i = 0; i < mList.size(); i++) {
mList.get(i).setSelected(true);
}
notifyDataSetChanged();
}
public List<T> getList() {
return mList;
}
}
|
6c1ed281-38ce-44ac-914e-91f24c52b843 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-02 13:36:05", "repo_name": "nclar015/azzida-native-android", "sub_path": "/app/src/main/java/com/azzida/model/ImageList.java", "file_name": "ImageList.java", "file_ext": "java", "file_size_in_byte": 988, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "258b7e23fce583a3abc5cf61f15c41ee1cabe330", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/nclar015/azzida-native-android | 211 | FILENAME: ImageList.java | 0.194368 | package com.azzida.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class ImageList {
@SerializedName("Id")
@Expose
private Integer id;
@SerializedName("JobId")
@Expose
private Integer jobId;
@SerializedName("UserId")
@Expose
private Integer userId;
@SerializedName("ImageName")
@Expose
private String imageName;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getJobId() {
return jobId;
}
public void setJobId(Integer jobId) {
this.jobId = jobId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getImageName() {
return imageName;
}
public void setImageName(String imageName) {
this.imageName = imageName;
}
}
|
5a1fbf75-f242-4c0e-9933-632b3edd8499 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-14 13:21:47", "repo_name": "TareqK/software-construction-project-report", "sub_path": "/example/src/main/java/me/kisoft/chat/entity/ChatMessage.java", "file_name": "ChatMessage.java", "file_ext": "java", "file_size_in_byte": 1050, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "e8ae67bbb6142d4e2ab1e31f05ba9d04e982e43b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/TareqK/software-construction-project-report | 230 | FILENAME: ChatMessage.java | 0.210766 | /*
* 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 me.kisoft.chat.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.Date;
/**
*
* @author tareq
*/
public class ChatMessage implements Serializable {
private String message;
private Date sentOn = new Date();
private String screenName;
@JsonProperty
public String getMessage() {
return message;
}
@JsonProperty
public void setMessage(String message) {
this.message = message;
}
@JsonProperty
public Date getSentOn() {
return sentOn;
}
@JsonIgnore
public void setSentOn(Date sentOn) {
this.sentOn = sentOn;
}
@JsonProperty
public String getScreenName() {
return screenName;
}
@JsonProperty
public void setScreenName(String screenName) {
this.screenName = screenName;
}
}
|
7a5dfcc5-bd85-480d-82ae-3832a593baef | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-05-04 09:35:48", "repo_name": "DommyShen/paipai", "sub_path": "/src/main/java/com/sbkj/paipai/api/response/deal/GetDealRefundDetailInfoResponse.java", "file_name": "GetDealRefundDetailInfoResponse.java", "file_ext": "java", "file_size_in_byte": 1154, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "c3c032be2df8007072d7a7c4188d4d9a1a3c39a8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DommyShen/paipai | 302 | FILENAME: GetDealRefundDetailInfoResponse.java | 0.281406 | package com.sbkj.paipai.api.response.deal;
import java.util.List;
import com.sbkj.paipai.api.PaipaiResponse;
import com.sbkj.paipai.api.domain.deal.RefundDetailDealItem;
/**
* 本接口主要用于买卖家根据拍拍网销售订单号查询订单的退款详细信息
* @author DOmmy
* create:2014-08-08
*/
public class GetDealRefundDetailInfoResponse extends PaipaiResponse{
private static final long serialVersionUID = -1597884139209108155L;
private String dealCode;// string 订单编码
private String dealDetailLink;// string 订单的详情连接
private List<RefundDetailDealItem> itemList;// list 订单的商品列表
public String getDealCode() {
return dealCode;
}
public void setDealCode(String dealCode) {
this.dealCode = dealCode;
}
public String getDealDetailLink() {
return dealDetailLink;
}
public void setDealDetailLink(String dealDetailLink) {
this.dealDetailLink = dealDetailLink;
}
public List<RefundDetailDealItem> getItemList() {
return itemList;
}
public void setItemList(List<RefundDetailDealItem> itemList) {
this.itemList = itemList;
}
}
|
9dc8b8b7-f1bb-4fca-a8a1-1cdc2042c91a | {"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-common/src/test/java/org/tools/hqlbuilder/common/test/ManyToOne.java", "file_name": "ManyToOne.java", "file_ext": "java", "file_size_in_byte": 1005, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "ab2f2a6d5dd1aac26d723b55c839d11e14efc3b5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/eniacce/hql-builder | 243 | FILENAME: ManyToOne.java | 0.281406 | package org.tools.hqlbuilder.common.test;
import java.util.Set;
import javax.persistence.Entity;
import org.tools.hqlbuilder.common.EntityERHAdapter;
@Entity
public class ManyToOne extends EntityERHAdapter {
private static final long serialVersionUID = -3720856012355844474L;
public static final String ONE_TO_MANY = "oneToMany";
@javax.persistence.OneToMany(mappedBy = OneToMany.MANY_TO_ONE)
private Set<OneToMany> oneToMany;
public Set<OneToMany> getOneToMany() {
return erh.omGet(ONE_TO_MANY, this.oneToMany);
}
public void setOneToMany(Set<OneToMany> oneToMany) {
erh.omSet(ONE_TO_MANY, oneToMany);
}
public void addOneToMany(@SuppressWarnings("hiding") OneToMany oneToMany) {
erh.omAdd(ONE_TO_MANY, oneToMany);
}
public void removeOneToMany(@SuppressWarnings("hiding") OneToMany oneToMany) {
erh.omRemove(ONE_TO_MANY, oneToMany);
}
public void clearOneToMany() {
erh.omClear(ONE_TO_MANY);
}
}
|
7a5981f6-7212-4ad4-b7be-c421c6d64a56 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-06-23T14:42:49", "repo_name": "wvanderp/youtube-rss", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1046, "line_count": 41, "lang": "en", "doc_type": "text", "blob_id": "eba6a3ca270015bcd8cbe5dd1b77f6c1ff873978", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wvanderp/youtube-rss | 274 | FILENAME: README.md | 0.194368 | # YouTube-rss
YouTube-rss is a php script based on [YouTube-dl](https://rg3.github.io/youtube-dl/) that generates an rss feed based on YouTube channels or users.
It uses the much loved [YouTube-dl](https://rg3.github.io/youtube-dl/) for downloading and feed generation.
The songs are downloaded on the fly and converted to mp3. And then stored on the server for later use.
# Features
* downloads youtube channels and playlists
* converts videos to mp3
* on the fly downloading
* Thumbnails
# Requirements
* a web server
* [php](http://php.net)
* [YouTube-dl](https://rg3.github.io/youtube-dl/)
* [ffmpeg](https://www.ffmpeg.org/) or [libav](https://libav.org/)
# how to install
* setup a web server
* install php
* install youtube-dl
* install ffmpeg
* git clone the repo
* change the contents of settings.exp.php and rename it to settings.php
* go to `http://yourDomain/youtube-rss/test_env.php` in your browser
# Wanted features
* video podcasts
* Rss cashing
* Clearing cash
* making some stats
* dashboard
* Other YouTube-dl site
|
ffad7fd2-1a37-4ab6-b999-69f6b018829a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-06-28 15:01:48", "repo_name": "FRizkiaA/Cari-Darah", "sub_path": "/app/src/main/java/com/indonative/cari_darah/Result.java", "file_name": "Result.java", "file_ext": "java", "file_size_in_byte": 1137, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "738c47e39c04d610de12c9ab2781b3a151fc2852", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/FRizkiaA/Cari-Darah | 271 | FILENAME: Result.java | 0.280616 | package com.indonative.cari_darah;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
/**
* Created by Rizkia on 17/10/2015.
*/
public class Result extends AppCompatActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.result);
String golongan_darah = getIntent().getExtras().getString("golongan_darah");
TextView text_golongan_darah = (TextView) findViewById(R.id.golongan_darah);
text_golongan_darah.setText("Golongan Darah : " + golongan_darah);
Integer jumlah_labu = getIntent().getExtras().getInt("jumlah_labu",1);
TextView text_jumlah_labu = (TextView) findViewById(R.id.jumlah_labu);
text_jumlah_labu.setText("Jumlah Labu : " + jumlah_labu);
String jenis_rhesus = getIntent().getExtras().getString("jenis_rhesus");
TextView text_jenis_rhesus = (TextView) findViewById(R.id.jenis_rhesus);
text_jenis_rhesus.setText("Jenis Rhesus : " + jenis_rhesus);
}
}
|
97d8e2d3-ffad-4148-ac23-7f239b0f4e15 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-08-22 09:53:19", "repo_name": "neteinstein/MemoPhone", "sub_path": "/MemoPhone/src/org/neteinstein/memophone/interceptors/CallInterceptor.java", "file_name": "CallInterceptor.java", "file_ext": "java", "file_size_in_byte": 1196, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "4cecdcb01fdd6a15f5fbc36f5e094697ab2413a8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/neteinstein/MemoPhone | 246 | FILENAME: CallInterceptor.java | 0.26588 | package org.neteinstein.memophone.interceptors;
import org.neteinstein.memophone.MemoPhone;
import org.neteinstein.util.SharedPreferencesManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.PhoneNumberUtils;
public class CallInterceptor extends BroadcastReceiver {
public String TAG = "CallInterceptor";
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
boolean interceptionEnabled = SharedPreferencesManager
.getPreferenceBoolean(context,
MemoPhone.INTERCEPTION_ENABLED, true);
boolean isEmergencyNumber = PhoneNumberUtils.isEmergencyNumber(number);
if (interceptionEnabled && !isEmergencyNumber && !MemoPhone.FROM_MEMOPHONE) {
intent = new Intent(context, CallIntercepted.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("number", number);
context.startActivity(intent);
setResultData(null);
} else if (MemoPhone.FROM_MEMOPHONE) {
MemoPhone.FROM_MEMOPHONE = false;
}
}
}
}
|
8b812e74-36da-4798-9168-39f8d1f3beda | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-17 00:47:41", "repo_name": "martynamaron/Practice_projects", "sub_path": "/src/main/java/utils/UserInput.java", "file_name": "UserInput.java", "file_ext": "java", "file_size_in_byte": 1005, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "9fd8f40bf634e2f2316c81396ce2416f9b00be19", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/martynamaron/Practice_projects | 172 | FILENAME: UserInput.java | 0.276691 | package utils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class UserInput {
public static int readInteger(String instruction) {
int input = 0;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print(instruction);
try {
input = Integer.parseInt(br.readLine());
} catch (NumberFormatException | IOException exception) {
System.err.println("Invalid Format: " + exception.getMessage());
}
return input;
}
public static String readString(String instruction) {
String word = "example";
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println(instruction);
try {
word = br.readLine();
} catch (IOException exception) {
System.err.println("Invalid string: " + exception.getMessage());
}
return word;
}
}
|
3132d9a3-9bd2-43b3-bf6d-d836316c6268 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-06 14:52:46", "repo_name": "Yeyangshu/Flink", "sub_path": "/src/main/java/com/yeyangshu/streaming/transformation/MapTest.java", "file_name": "MapTest.java", "file_ext": "java", "file_size_in_byte": 1187, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "b0c96ba194cf8ef01952df070189251c2a6666e0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Yeyangshu/Flink | 253 | FILENAME: MapTest.java | 0.29584 | package com.yeyangshu.streaming.transformation;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
/**
* Map练习
*
* @author zhumingxing
* @date 2021/3/11 16:09
**/
public class MapTest {
public static void main(String[] args) throws Exception {
StreamExecutionEnvironment environment = StreamExecutionEnvironment.getExecutionEnvironment();
// 生成1~100之间的数字
DataStreamSource<Long> source = environment.generateSequence(1, 100).setParallelism(1);
// <Long, String>,左边输入类型,右边输出类型
source.map(new MapFunction<Long, String>() {
@Override
public String map(Long num) throws Exception {
return num.toString();
}
}).map(new MyMapFunction()).print();
environment.execute();
}
}
/**
* 自定义map
*/
class MyMapFunction implements MapFunction<String, Float> {
@Override
public Float map(String input) throws Exception {
return Float.valueOf(input);
}
} |
0cfee178-c739-4a6c-a6e5-f360764b3c06 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-12-15 21:28:58", "repo_name": "rogerchap/Login-Semarnat-Ej", "sub_path": "/app/src/main/java/com/monsh/pasoparametros/SegundaActivity.java", "file_name": "SegundaActivity.java", "file_ext": "java", "file_size_in_byte": 1037, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "a8bbfe91cec7031b0c27c6be4d31dc547d33070e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rogerchap/Login-Semarnat-Ej | 203 | FILENAME: SegundaActivity.java | 0.210766 | package com.monsh.pasoparametros;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class SegundaActivity extends AppCompatActivity {
TextView tv_name;
TextView tv_mail;
TextView tv_passw;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_segunda);
tv_name = (TextView)findViewById(R.id.tv_name);
tv_mail = (TextView)findViewById(R.id.tv_mail);
tv_passw = (TextView)findViewById(R.id.tv_passw);
Intent i = getIntent();
Bundle bundle = i.getExtras();
if (bundle != null){
String name = (String)bundle.get("Nombre");
tv_name.setText(name);
String mail = (String)bundle.get("Correo");
tv_mail.setText(mail);
String passw = (String)bundle.get("Password");
tv_passw.setText(passw);
}
}
}
|
352c31c3-3075-4bab-aba8-3f7fd70b65d3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-28 15:18:08", "repo_name": "guangrunshe/CodingHelper", "sub_path": "/src/main/java/cn/xunyard/idea/coding/doc/process/describer/impl/AbstractBasicClass.java", "file_name": "AbstractBasicClass.java", "file_ext": "java", "file_size_in_byte": 1066, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "bc84e196d8d6e45168c0cb608b50cb3f0f727f62", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/guangrunshe/CodingHelper | 232 | FILENAME: AbstractBasicClass.java | 0.236516 | package cn.xunyard.idea.coding.doc.process.describer.impl;
import com.thoughtworks.qdox.model.JavaType;
/**
* @author <a herf="mailto:wuqi@terminus.io">xunyard</a>
* @date 2019-12-28
*/
public abstract class AbstractBasicClass {
private final String packageName;
private final String className;
private final boolean hasPackage;
public AbstractBasicClass(JavaType javaType) {
String fullClassName = javaType.toString();
hasPackage = fullClassName.contains(".");
this.className = javaType.getValue();
this.packageName = hasPackage ? fullClassName.substring(0, fullClassName.lastIndexOf("."))
: null;
}
public boolean hasPackage() {
return hasPackage;
}
public String getPackage() {
return packageName;
}
public String getSimpleName() {
return className;
}
public String getFullName() {
return hasPackage ? packageName + "." + className : className;
}
public String toSimpleString() {
return className;
}
}
|
f0064bc4-a977-4a84-a115-4cb7200c348d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-30 21:54:51", "repo_name": "halimahitsna/KTPSapi", "sub_path": "/app/src/main/java/id/sapi/ktp/aplikasiktpsapi/api/UtilsApi.java", "file_name": "UtilsApi.java", "file_ext": "java", "file_size_in_byte": 1137, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "4c1b59e9ae579610e54d64c2299ada21aa530721", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/halimahitsna/KTPSapi | 209 | FILENAME: UtilsApi.java | 0.26588 | package id.sapi.ktp.aplikasiktpsapi.api;
import android.content.Context;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class UtilsApi {
public static final String BASE_URL = "http://ktpsapi.com/android/ktpsapi/";
private static Retrofit retrofit = null;
// variable to hold context
private static Context context;
public static ApiService getAPIService(){
return RetrofitClient.getClient(BASE_URL).create(ApiService.class);
}
public static Retrofit getClient() {
// OkHttpClient client = new OkHttpClient.Builder()
// .addInterceptor(new Connectivity(context))
// .build();
if (retrofit == null) {
Gson gson = new GsonBuilder()
.setLenient()
.create();
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
}
return retrofit;
}
}
|
540e4753-37a8-4865-88c1-8c4bc90eef5c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-05-06 08:55:54", "repo_name": "huntdog1541/AssembleSimulate", "sub_path": "/src/VM.java", "file_name": "VM.java", "file_ext": "java", "file_size_in_byte": 1088, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "023afd9cef140125d447dc0735606d8a3a1f6bd7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/huntdog1541/AssembleSimulate | 247 | FILENAME: VM.java | 0.264358 | import java.util.ArrayList;
/**
* Created by David on 3/19/2015.
*/
public class VM {
private Register eax = new Register("EAX", 44);
private Register ebx = new Register("EBX");
private Register ecx = new Register("ECX");
private Register edx = new Register("EDX");
private ArrayList<Register> allregisters;
private OpCode op = new OpCode();
private Code code = new Code();
private CodeContent cc;
public VM() {
allregisters = new ArrayList<Register>();
allregisters.add(eax);
allregisters.add(ebx);
allregisters.add(ecx);
allregisters.add(edx);
}
public void getCode()
{
cc = new CodeContent(code);
code.printStrings();
}
public void runCode(String opc, String[] restOfString) {
op.executeCode(opc, restOfString, this);
}
public Register getRegister(String temp)
{
Register ans = null;
for(Register tp : allregisters)
{
if(tp.compareString(temp))
ans = tp;
}
return ans;
}
}
|
d3ba5fed-0fee-4c92-8614-c808422b450f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-06-18 22:43:52", "repo_name": "emil10001/AndroidCallSmsInfo", "sub_path": "/testSmsApp/src/main/java/com/feigdev/testsms/app/CallScraper.java", "file_name": "CallScraper.java", "file_ext": "java", "file_size_in_byte": 1197, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "cb0bad04b9680c4ca6f47a6f2020db14f7c286d6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/emil10001/AndroidCallSmsInfo | 256 | FILENAME: CallScraper.java | 0.295027 | package com.feigdev.testsms.app;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
/**
* Created by ejf3 on 6/18/15.
*/
public class CallScraper extends AsyncTask<Context, Void, Void> {
public static void readCalls(Context context) {
Cursor cursor = context.getContentResolver().query(Uri.parse("content://call_log/calls"), null, null, null, null);
Log.d(CallScraper.class.toString(), "======= CALL LOG =======");
if (cursor.moveToFirst()) { // must check the result to prevent exception
do {
String msgData = "";
for (int idx = 0; idx < cursor.getColumnCount(); idx++) {
msgData += " " + cursor.getColumnName(idx) + ":" + cursor.getString(idx);
}
Log.d(CallScraper.class.toString(), "call: " + msgData);
// use msgData
} while (cursor.moveToNext());
} else {
// empty box, no SMS
}
}
@Override
protected Void doInBackground(Context... params) {
readCalls(params[0]);
return null;
}
}
|
bd9aa242-3869-4341-a59e-010fa994000c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-03-17T06:30:37", "repo_name": "AndresLong01/Burger", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 992, "line_count": 35, "lang": "en", "doc_type": "text", "blob_id": "4415db3626017aa5cfe9fa996f264641662b5fd4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AndresLong01/Burger | 251 | FILENAME: README.md | 0.278257 | # Eat the Burger!
[](https://github.com/AndresLong01)
# Description
It's a website using an SQL database and an express server to post a list of burgers to be devoured and devour them by clicking on them.
Table of Contents |
----------------- |
Installation Information |
Usage Information |
License |
Contributors |
Questions |
# Installation
No need, just visit the website at https://aqueous-bastion-83312.herokuapp.com/
# Usage
burgers.
# License
[](https://opensource.org/licenses/MIT)
# Contributors
Non
# Questions
If you have any questions please contact me at at: Email protected by github API
My user is also linked at the top under the Generic Badge

|
09c8422a-ee1c-4175-9580-45c4644ac720 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-21 09:32:49", "repo_name": "dnilay/socjen-phase-2-may-2021", "sub_path": "/my-product-service/src/main/java/org/example/demo/model/Customer.java", "file_name": "Customer.java", "file_ext": "java", "file_size_in_byte": 1070, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "63aef7720b6bdc74df5f322f8ea8e1606480d71b", "star_events_count": 5, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/dnilay/socjen-phase-2-may-2021 | 215 | FILENAME: Customer.java | 0.235108 | package org.example.demo.model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class Customer {
private String customerId;
private String customerName;
@Autowired
private Address address;
public Customer(String customerId, String customerName, Address address) {
super();
this.customerId = customerId;
this.customerName = customerName;
this.address = address;
}
public Customer() {
super();
}
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
@Override
public String toString() {
return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", address=" + address + "]";
}
}
|
d982c936-7652-47bd-a158-24d13a5ea5d2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-07 16:50:00", "repo_name": "shuaisong/GoodCountry", "sub_path": "/app/src/main/java/com/reeching/goodcountry/util/Imgloader.java", "file_name": "Imgloader.java", "file_ext": "java", "file_size_in_byte": 1140, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "412f1a3f1f7d404a0ccbf131335b86fad0b02d11", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/shuaisong/GoodCountry | 250 | FILENAME: Imgloader.java | 0.247987 | package com.reeching.goodcountry.util;
import android.content.Context;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.reeching.goodcountry.Constant;
import com.reeching.goodcountry.R;
import com.youth.banner.loader.ImageLoader;
/**
* Created by lenovo on 2019/1/23.
* auther:lenovo
* Date:2019/1/23
*/
public class Imgloader extends ImageLoader {
@Override
public void displayImage(Context context, Object path, ImageView imageView) {
RequestOptions options = new RequestOptions().fitCenter();
if (path instanceof Integer)
Glide.with(context).load((Integer) path).centerCrop().error(R.mipmap.error).placeholder(R.mipmap.img_shoppingmall_default_jd).apply(options).into(imageView);
if (path instanceof String) {
if (!((String) path).startsWith("http")) {
path = Constant.IMG_URL + path;
}
Glide.with(context).load(path).apply(options).centerCrop().error(R.mipmap.error).placeholder(R.mipmap.img_shoppingmall_default_jd).into(imageView);
}
}
}
|
e147597e-7821-4a00-8e62-5440137be1be | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-04-13 04:27:50", "repo_name": "Mihail74/SpringLearning", "sub_path": "/JpaIntro/jpa-intro/src/main/java/demo4/demo.java", "file_name": "demo.java", "file_ext": "java", "file_size_in_byte": 973, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "7f887365df530afee510f86089b124592b2629b5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Mihail74/SpringLearning | 199 | FILENAME: demo.java | 0.273574 | package demo4;
import org.h2.tools.Server;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class demo {
public static void main(String[] args) throws Exception {
Server.createWebServer().start();
EntityManagerFactory emf = Persistence.createEntityManagerFactory("demo4");
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Project p1 = new Project("project 1");
Project p2 = new Project("project 2");
Employee e1 = new Employee("John", "Doe");
p1.assignEmployee(e1);
p2.assignEmployee(e1);
em.persist(p1);
em.persist(p2);
em.getTransaction().commit();
Employee e = em.find(Employee.class, 2);
System.out.println(e.getFirstName() + " " + e.getLastName());
e.getProjects().forEach( p -> System.out.println(p.getName()) );
}
}
|
4154955d-6dd9-4a3f-a945-d2f5b1165c33 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-01-21T16:12:41", "repo_name": "InsaniTea/Virtual-House-Tour", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1150, "line_count": 38, "lang": "en", "doc_type": "text", "blob_id": "558e753a795a5c2aec03b3b8de7d5cede01cdbf8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/InsaniTea/Virtual-House-Tour | 315 | FILENAME: README.md | 0.286968 | # Virtual-House-Tour
OpenGL project where, using C++, we created a virtual house
Two stories house with lighting, textures, .mdl's, stairs, collisions and a particle fountain.
Academic Project made for one of our classes.
Total of 3 elements:
• Pedro Coelho - ME - Made the xml/xsd structure and imported it to the project to create the house dynamically.
- Created the estructure of the house, made the blueprints and handled XML import and Zip extraction.
• Pedro Magalhães - Handled the import of .mdl, collisions and the stairs.
• João Cabral - Handled textures, positioning the .mdl and the fountain.
<--INSTALATION-->
Whe use OpenGL, Glut, GLaux and OpenAL.
To garanty that we could all run the program we installed the above applications and used specific folders for them:
• GLUT -> C:\GLUT\GLAux
C:\GLUT\glut32
C:\GLUT\GL\GLAux
C:\GLUT\GL\glut
• OpenAL -> C:\Program Files\OpenAL 1.1 SDK\...
• FreeAlut -> C:\Program Files\freealut-1.1.0
<--HELP-->
In case you need help, you can contact me at 1130353@isep.ipp.pt, I'll try to answer briefly.
Enjoy |
47672d5e-5bac-41fe-8396-7ec52399f6bc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2013-07-04T14:20:45", "repo_name": "thijsterlouw/erlang-openshift-libs", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1115, "line_count": 27, "lang": "en", "doc_type": "text", "blob_id": "169c116f0ac548d0fb9de51d77a6672babd63c22", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/thijsterlouw/erlang-openshift-libs | 261 | FILENAME: README.md | 0.243642 | erlang-openshift-libs
=====================
Erlang Openshift libraries. WORK IN PROGRESS!!
Features
========
* Custom distribution protocol which ensures that our public listen port (for Erlang distribution) is registered in EPMD
instead of the private listen port. This is required because each gear has a private IP-range. This is not available
from other gears, and thus needs to be proxied. Erlang nodes first ask EPMD for the port and then connect directly
to it. Thus we should tell EPMD to register the public port (on the proxy) instead of the private listen port.
Usage
=====
* ``erl -pa ebin -name test -proto_dist inet_openshift -kernel inet_dist_listen_external 3000``
Explanation:
``-name test`` is required to make the node distributed (and thus register with EPMD + setup a listen port)
``-proto_dist`` allows us to customize the distribution protocol. Our custom protocol registers the correct port.
``-kernel inet_dist_listen_external 30000`` instructs our custom inet_openshift_dist protocol to register port
30000 with EPMD instead of the default listen port.
|
fcf9e388-7db5-4d93-811a-149e4895dc09 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-08-20T08:44:15", "repo_name": "jpreecedev/basket-graphql-scratch", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1197, "line_count": 18, "lang": "en", "doc_type": "text", "blob_id": "e2a7a34ddb192c6d83d3f4d30899751c8e76e32b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jpreecedev/basket-graphql-scratch | 277 | FILENAME: README.md | 0.190724 | # GraphQL with .NET back end PoC
A test project for understanding how to use GraphQL with a .NET back end. This repo is purely for learning purposes and should not be used as the foundation for any applications going forward.
For simplicity, the front end and back end are split into two separate projects that run on separate ports. Due to this, I have enabled CORS (any origin).
## Front end
Based on my [Webpack 4 scratch repo](https://github.com/jpreecedev/webpack-4-scratch), with a few additional packages to support using GraphQL with the Apollo client.
To run, change directory to `/frontend` and run `yarn start`. This will start a server listening on `https://localhost:8080`.
When the back end is running, click **Request some data** to trigger a `POST` request to the GraphQL endpoint. The result of the request will be displayed underneath the button.
## Back end
To run the back end, go to the `/backend` folder and open `BasketGraphQLAPI.sln` with Visual Studio 2015 or higher. When open, press `F5` to start the application running. The backend is based on an [example GraphQL/DotNet repo](https://github.com/graphql-dotnet/graphql-dotnet), with most of the fluff removed.
|
58b72a6b-02de-45c3-b0ce-b709fd9ac4d8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-16 02:17:32", "repo_name": "alexz0000/Utils", "sub_path": "/src/classloader/CustomClassLoader.java", "file_name": "CustomClassLoader.java", "file_ext": "java", "file_size_in_byte": 1065, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "0a04b08397826098eb488fde5c504fff4b47a295", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/alexz0000/Utils | 188 | FILENAME: CustomClassLoader.java | 0.255344 | package classloader;
public class CustomClassLoader extends ClassLoader {
public CustomClassLoader(ClassLoader parent) {
super(parent);
}
public static void main(String[] args) {
PrintClassLoader printer = new PrintClassLoader();
ClassLoader c = printer.getClass().getClassLoader();
System.out.println(c);
// CustomClassLoader loader = new CustomClassLoader((new Object()).getClass().getClassLoader().getParent());
CustomClassLoader loader = new CustomClassLoader(c.getParent());
System.out.println(loader.getParent());
// Runtime.getRuntime().load();
// try {
// loader.loadClass("annotation.SubClass");
// } catch (ClassNotFoundException e) {
// e.printStackTrace();
// }
while (true) {
new Object();
try {
System.out.println("Sleeping");
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
|
270a6db8-583b-41bd-9b3e-c59d94e9302b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-16 09:15:51", "repo_name": "HLong0902/vtman-be", "sub_path": "/src/main/java/com/viettel/vtman/cms/service/impl/UserAuthorizationServiceImpl.java", "file_name": "UserAuthorizationServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1001, "line_count": 27, "lang": "en", "doc_type": "code", "blob_id": "7405cf33045113278a282e798192933941661e21", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/HLong0902/vtman-be | 197 | FILENAME: UserAuthorizationServiceImpl.java | 0.240775 | package com.viettel.vtman.cms.service.impl;
import com.viettel.vtman.cms.dao.UserAuthorizationDAO;
import com.viettel.vtman.cms.dto.ObjectResultPage;
import com.viettel.vtman.cms.dto.UserAuthorizationDTO;
import com.viettel.vtman.cms.service.UserAuthorizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserAuthorizationServiceImpl implements UserAuthorizationService {
@Autowired
private UserAuthorizationDAO userAuthorizationDAO;
@Override
public List<UserAuthorizationDTO> searchUserAuthorization(String employee, Long roleId, Long departmentId, ObjectResultPage objectResultPage) {
return userAuthorizationDAO.getUserAuthorization(employee, roleId, departmentId, objectResultPage);
}
@Override
public List<UserAuthorizationDTO> getByEmployeeId(Long employeeId) {
return userAuthorizationDAO.getByEmployeeId(employeeId);
}
}
|
1d8e4356-3ac0-4f0d-a0ab-03187d60142a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-06-07T10:53:16", "repo_name": "mayowaadediran/react-weather-app", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1138, "line_count": 49, "lang": "en", "doc_type": "text", "blob_id": "2338815c3c6ee156b50fbcca8e4feae102ea8046", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mayowaadediran/react-weather-app | 262 | FILENAME: README.md | 0.206894 | # Weather App
A weather conditions and forecast application built with react.
## About/Motivation
Trying to grasp react involves building actual project, hence this project was built to learn basic and advanced react concepts. These include the use of external data APIs, react lifecycles, react UI libraries, location data. As I advance in my learning, I'll continue to add more features and technologies.
## Get Started
To clone this project, you'll need node installed on your machine. From your command line,
```# Clone repository
$ git clone https://github.com/mayowaadediran/react-weather-app.git
# Go into the repository
$ cd react-weather-app
# Install dependencies
$ npm install
# Run the app
$ npm start
```
## Tech/Framework Used
- Frontend - React.js
- Api - [OpenWeatherMap](https://openweathermap.org/api)
- UI - [MaterialUI](https://material-ui.com/)
## Features
- User can search for locations
- Displays weather conditions and forecast for searched location
### To Dos
- [ ] Detect user location when app is opened
- [ ] Add 5-day weather forecast
- [ ] Add moment.js
- [ ] Fix UI
- [ ] Add animation
|
51b4a73f-32a4-40c5-949b-87dcd355bc15 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-01-05 12:18:29", "repo_name": "ailbertriksen/pdf-library", "sub_path": "/src/main/java/nl/mad/toucanpdf/api/BaseTable.java", "file_name": "BaseTable.java", "file_ext": "java", "file_size_in_byte": 1195, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "e6f8b0fa66f723dd06662d63333ba8a8d8a01a0f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ailbertriksen/pdf-library | 269 | FILENAME: BaseTable.java | 0.294215 | package nl.mad.toucanpdf.api;
import java.util.LinkedList;
import java.util.List;
import nl.mad.toucanpdf.model.Cell;
import nl.mad.toucanpdf.model.PlaceableDocumentPart;
import nl.mad.toucanpdf.model.Table;
public class BaseTable extends AbstractTable implements Table {
private List<Cell> content = new LinkedList<Cell>();
public BaseTable(int pageWidth) {
super(pageWidth);
}
public BaseTable(Table table) {
super(table);
this.content = table.getContent();
}
@Override
public Cell addCell(PlaceableDocumentPart part) {
Cell c = new BaseCell(part);
this.content.add(c);
return c;
}
@Override
public Cell addCell(String s) {
return this.addCell(new BaseText(s));
}
@Override
public BaseTable addCell(Cell c) {
this.content.add(c);
return this;
}
@Override
public List<Cell> getContent() {
return this.content;
}
@Override
public PlaceableDocumentPart copy() {
return new BaseTable(this);
}
@Override
public Table removeContent() {
this.content = new LinkedList<Cell>();
return this;
}
}
|
281169a1-4bbf-4dd5-8a9b-d180da0eef78 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-23 10:47:56", "repo_name": "wolvesleader/interview", "sub_path": "/base_java/src/main/java/com/quincy/java/base/hashmap/HashMapDriver.java", "file_name": "HashMapDriver.java", "file_ext": "java", "file_size_in_byte": 1128, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "ff605d2880e366481c26c896e3de06fa24be22a1", "star_events_count": 34, "fork_events_count": 8, "src_encoding": "UTF-8"} | https://github.com/wolvesleader/interview | 242 | FILENAME: HashMapDriver.java | 0.286968 | package com.quincy.java.base.hashmap;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
/**
* Created by quincy on 18/5/27.
* 读写锁操作,线程不安全的操作演示
*/
public class HashMapDriver {
public static void main(String[] args) {
HashMap<String ,Object> map = new HashMap<String ,Object>();
int threadCount = 1000;
// 用来让主线程等待threadCount个子线程执行完毕
CountDownLatch countDownLatch = new CountDownLatch(threadCount);
// 启动threadCount个子线程
for (int i = 1; i <= threadCount; i++) {
System.out.println(i + "------");
Thread thread = new Thread(new HashMapResource(map, countDownLatch));
thread.start();
}
System.out.println(map.size());
try {
// 主线程等待所有子线程执行完成,再向下执行
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(map.size());
}
}
|
1f51b567-8f75-437d-9acf-64ad04cf1876 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-11 05:30:33", "repo_name": "rizqyfitrianto1/InfoWisataJogja", "sub_path": "/app/src/main/java/com/example/infowisatajogja/LoginActivity.java", "file_name": "LoginActivity.java", "file_ext": "java", "file_size_in_byte": 1093, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "d8d1447ec9739cc202e3a1fbfbab696981bd2ede", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rizqyfitrianto1/InfoWisataJogja | 182 | FILENAME: LoginActivity.java | 0.187133 | package com.example.infowisatajogja;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class LoginActivity extends AppCompatActivity {
TextView to_signup;
Button btn_login;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
to_signup = findViewById(R.id.to_signup);
btn_login = findViewById(R.id.btn_login);
btn_login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(LoginActivity.this, Main2Activity.class));
}
});
to_signup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(LoginActivity.this, RegisterActivity.class));
}
});
}
}
|
ec52043a-e75e-4afd-99f3-6e8f49388f2e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-09 13:00:51", "repo_name": "MasayaOkuda/Facebook_login", "sub_path": "/src/dao/CreateUserDAO.java", "file_name": "CreateUserDAO.java", "file_ext": "java", "file_size_in_byte": 1113, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "4443179ca0555039f5bbaf380c5989e8c64c6da8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MasayaOkuda/Facebook_login | 216 | FILENAME: CreateUserDAO.java | 0.282196 | package dao;
import java.sql.*;
public class CreateUserDAO {
Connection con;
public void createUser(String login_id, String inPassword) throws SQLException {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/facebook3";
String user = "root";
String pass = "himitu";
con = DriverManager.getConnection(url,user,pass);
} catch (Exception e) {
e.printStackTrace();
}
PreparedStatement st=null;
ResultSet rs=null;
try {
String sql = "INSERT INTO users (login_id, password) value (?,?)";
st = con.prepareStatement(sql);
st.setString(1, login_id);
st.setString(2, inPassword);
st.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}finally {
try{
if(rs!=null)rs.close();
if(st!=null)st.close();
}catch(Exception e){
e.printStackTrace();
}
}
}
}
|
f723a377-3d78-41b5-9ac5-b93bbfc3dc63 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-16 09:53:58", "repo_name": "artcodelcy/webSocketDemo", "sub_path": "/src/main/java/com/websocket/push/push.java", "file_name": "push.java", "file_ext": "java", "file_size_in_byte": 1027, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "667513864484277bccad073df111be0e3af6fa80", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/artcodelcy/webSocketDemo | 231 | FILENAME: push.java | 0.23092 | package com.websocket.push;
import com.alibaba.fastjson.JSON;
import com.websocket.model.Message;
import com.websocket.webSocket.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
/**
* 后端定时任务推送消息
* @author LiChangyuan
* @Date 2019-07-12 16:37
*/
@Slf4j
@Service
public class push {
@Scheduled(cron = "0/3 * * * * ?")
public void buildMessage() {
Long staffId = 20L;
Message message = new Message("来自后端推送的消息");
String jsonData = JSON.toJSONString(message);
log.info("推送数据开始...");
try {
WebSocketServer.sendInfo(jsonData, String.valueOf(staffId));
} catch (Exception e) {
e.printStackTrace();
}
log.info("推送数据完成...");
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} |
e5621a91-9391-45ad-9ce2-3b02ed7b2fd9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-06 11:17:42", "repo_name": "AndreyGermanov/myplaces_android_client", "sub_path": "/app/src/main/java/ru/itport/andrey/myplaces/models/Place.java", "file_name": "Place.java", "file_ext": "java", "file_size_in_byte": 1073, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "0001d6c87d87b006eaae370d1a4f7959b6cabee7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AndreyGermanov/myplaces_android_client | 219 | FILENAME: Place.java | 0.239349 | package ru.itport.andrey.myplaces.models;
import android.database.Cursor;
import android.util.Log;
/**
* Created by andrey on 2/5/18.
*/
public class Place extends DBModel {
String name;
String id;
double lat;
double lng;
String description;
String tableName;
public void parseRow(Cursor cursor) {
this.name = cursor.getString(cursor.getColumnIndex("name"));
this.id = cursor.getString(cursor.getColumnIndex("id"));
this.lat = cursor.getDouble(cursor.getColumnIndex("lat"));
this.lng = cursor.getDouble(cursor.getColumnIndex("lng"));
this.description = cursor.getString(cursor.getColumnIndex("description"));
}
public Place() {
this.tableName = "places";
}
public String getTableName() {
return this.tableName;
}
public String getName() {
return this.name;
}
public String getId() {
return this.id;
}
public double getLat() {
return this.lat;
}
public double getLng() {
return this.lng;
}
}
|
ff5ab7e6-5d2c-41d5-b95a-1760cdd5be13 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-31 07:24:06", "repo_name": "YangQingQ666/sannuo", "sub_path": "/src/main/java/com/xr/util/HibernateUtil.java", "file_name": "HibernateUtil.java", "file_ext": "java", "file_size_in_byte": 1063, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "97310581ca145e50327c7fd42f74b9f10ac06bb4", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/YangQingQ666/sannuo | 213 | FILENAME: HibernateUtil.java | 0.253861 | package com.xr.util;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class HibernateUtil {
@Autowired
private static SessionFactory sessionFactory;
private static ThreadLocal<Session> local = new ThreadLocal<Session>();
/**
* 获取Session
* @return
*/
public static Session getSession() {
Session session = local.get();
if(session==null||session.isOpen()){
if(sessionFactory==null){
ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
sessionFactory=(SessionFactory)context.getBean("sessionFactory");
}
session = sessionFactory.openSession();
local.set(session);
}
return session;
}
/**
* 关闭session
*
*/
public static void close() {
Session session=local.get();
if(session==null||session.isOpen()){
session.close();
}
local.set(null);
}
} |
b62cf56d-30cc-4427-9ecc-3ef274664a9a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-19 10:16:06", "repo_name": "a7956232/Survey", "sub_path": "/src/main/java/com/yxj/interceptor/RightFilterInterceptor.java", "file_name": "RightFilterInterceptor.java", "file_ext": "java", "file_size_in_byte": 1077, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "ad6c2fa5ea97a30b4dac0eee1c50095733d9ff01", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/a7956232/Survey | 247 | FILENAME: RightFilterInterceptor.java | 0.249447 | package com.yxj.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.interceptor.Interceptor;
import com.yxj.action.BaseAction;
import com.yxj.aware.UserAware;
import com.yxj.entity.User;
import com.yxj.entity.security.Right;
import com.yxj.util.ValidateUtil;
import org.apache.struts2.ServletActionContext;
import java.util.Map;
/**
* Created by 95 on 2016/11/22.
*/
public class RightFilterInterceptor implements Interceptor {
@Override
public void destroy() {
}
@Override
public void init() {
}
@Override
public String intercept(ActionInvocation ai) throws Exception {
BaseAction action = (BaseAction) ai.getAction();
ActionProxy proxy = ai.getProxy();
String ns = proxy.getNamespace();
String actionName = proxy.getActionName();
if(ValidateUtil.hasRight(ns,actionName, ServletActionContext.getRequest(),action)){
return ai.invoke();
}else {
return "login";
}
}
}
|
f27fd7e7-8ccf-439a-9b60-a279cda825a9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2011-09-06 03:06:08", "repo_name": "LoyolaChicagoCode/restlet-book-examples", "sub_path": "/src/main/java/org/restlet/example/book/restlet/ch4/HelloWorldResource.java", "file_name": "HelloWorldResource.java", "file_ext": "java", "file_size_in_byte": 1198, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "899d214d79030437a2994ed16d4a524077f87f64", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/LoyolaChicagoCode/restlet-book-examples | 207 | FILENAME: HelloWorldResource.java | 0.27048 | package org.restlet.example.book.restlet.ch4;
import org.restlet.Context;
import org.restlet.data.MediaType;
import org.restlet.data.Request;
import org.restlet.data.Response;
import org.restlet.resource.Representation;
import org.restlet.resource.Resource;
import org.restlet.resource.ResourceException;
import org.restlet.resource.StringRepresentation;
import org.restlet.resource.Variant;
public class HelloWorldResource extends Resource {
public HelloWorldResource(Context context, Request request,
Response response) {
super(context, request, response);
// Declare all kind of representations supported by the resource
getVariants().add(new Variant(MediaType.TEXT_PLAIN));
}
@Override
public Representation represent(Variant variant) throws ResourceException {
Representation representation = null;
// Generate the right representation according to the variant.
if (MediaType.TEXT_PLAIN.equals(variant.getMediaType())) {
representation = new StringRepresentation("hello, world",
MediaType.TEXT_PLAIN);
}
return representation;
}
}
|
f4d37db0-da9c-4a49-9358-50724c7d049c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-04 15:08:45", "repo_name": "nagendra1010/Cucumber", "sub_path": "/src/test/java/ReusableFunctions/ConfigFileReader.java", "file_name": "ConfigFileReader.java", "file_ext": "java", "file_size_in_byte": 987, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "9e7d0a0efac55c14350033c33bfdcb1289f8b5c9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/nagendra1010/Cucumber | 191 | FILENAME: ConfigFileReader.java | 0.289372 | package ReusableFunctions;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
public class ConfigFileReader {
Properties properties;
final String testProperties_filePath = "configuration//global.properties";
public ConfigFileReader() {
BufferedReader reader;
try {
reader = new BufferedReader(new FileReader(testProperties_filePath));
properties = new Properties();
try {
properties.load(reader);
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
throw new RuntimeException("Configuration.properties not found at " + testProperties_filePath);
}
}
public String getPropertyFromPropertiesFile(String propertyName) {
String propertyValue = properties.getProperty(propertyName);
if (propertyValue != null)
return propertyValue;
else
return null;
}
}
|
a8e74289-d83d-4278-aa26-e9ef7172dfdb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-31 07:48:41", "repo_name": "MCC2689920998/designMode", "sub_path": "/src/main/java/structural/proxy/jdk/MyInvocationHandler.java", "file_name": "MyInvocationHandler.java", "file_ext": "java", "file_size_in_byte": 1209, "line_count": 37, "lang": "zh", "doc_type": "code", "blob_id": "b340cbaf027bc1f99aa461cf33262e6918db4696", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MCC2689920998/designMode | 258 | FILENAME: MyInvocationHandler.java | 0.27048 | package structural.proxy.jdk;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
/**
* @Author MCC
* @Create 2019/7/28 10:59
* JDK 自带的动态代理
* java.lang.reflect.Proxy:生成动态代理类和对象;
* java.lang.reflect.InvocationHandler(处理器接口):可以通过invoke方法实现
* 对真实角色的代理访问。
* 每次通过 Proxy 生成的代理类对象都要指定对应的处理器对象。
*/
public class MyInvocationHandler implements InvocationHandler {
Subject realSubject;
public MyInvocationHandler(Subject realSubject) {
this.realSubject = realSubject;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
System.out.println("调用代理类");
if (method.getName().equals("sellBooks")) {
int invoke = (int) method.invoke(realSubject, args);
System.out.println("调用的是卖书的方法");
return invoke;
} else {
String string = (String) method.invoke(realSubject, args);
System.out.println("调用的是说话的方法");
return string;
}
}
}
|
e6ebef5b-7fb6-4263-865b-57ab849accfd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-25 14:46:25", "repo_name": "EfanRu/Spring-Boot-JUnit", "sub_path": "/src/main/java/com/example/spring_junit/model/Role.java", "file_name": "Role.java", "file_ext": "java", "file_size_in_byte": 1138, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "ffcc029d73e4a9ecb2a3a07309509af7c3479b67", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/EfanRu/Spring-Boot-JUnit | 241 | FILENAME: Role.java | 0.256832 | package com.example.spring_junit.model;
import org.springframework.security.core.GrantedAuthority;
import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;
@Entity
@Table(name = "roles")
public class Role implements GrantedAuthority {
@Id
@Column(name = "role_id", unique = true)
private String name;
@ManyToMany(fetch = FetchType.EAGER, mappedBy = "role")
private Collection<User> users;
public Role() {}
public Role(String name) {
this.name = name.toUpperCase();
}
@Override
public String getAuthority() {
return "ROLE_" + name.toUpperCase();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name.toUpperCase();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Role role = (Role) o;
return Objects.equals(name.toUpperCase(), role.name.toUpperCase());
}
@Override
public int hashCode() {
return Objects.hash(name);
}
}
|
63b56734-e1d3-4f92-87fe-8c39e58859b8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-30 21:09:57", "repo_name": "broadmindco/timely", "sub_path": "/src/main/java/io/nomondays/timely/auth/config/CustomUserDetailsService.java", "file_name": "CustomUserDetailsService.java", "file_ext": "java", "file_size_in_byte": 971, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "db96e572035fe897714fbe1b4524e758dc3c93b8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/broadmindco/timely | 162 | FILENAME: CustomUserDetailsService.java | 0.217338 | package io.nomondays.timely.auth.config;
import io.nomondays.timely.auth.domain.CustomUserDetails;
import io.nomondays.timely.auth.exception.LoginFailedException;
import io.nomondays.timely.user.service.UserService;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
class CustomUserDetailsService implements UserDetailsService {
private final UserService userService;
public CustomUserDetailsService(UserService userService){
this.userService = userService;
}
@Override
public UserDetails loadUserByUsername(String email) {
final var user = userService
.findByEmail(email.toLowerCase())
.orElseThrow(LoginFailedException::new);
return new CustomUserDetails(user);
}
}
|
a1ccd021-9094-40b6-a282-4cfa922fa1dd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-05-13 02:31:06", "repo_name": "savannaholson/EntJavaIndividualProject", "sub_path": "/BookTracker/src/entity/UserRole.java", "file_name": "UserRole.java", "file_ext": "java", "file_size_in_byte": 1196, "line_count": 67, "lang": "en", "doc_type": "code", "blob_id": "f6c05150ac47b9eb65568b7d145c93064524dcf7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/savannaholson/EntJavaIndividualProject | 260 | FILENAME: UserRole.java | 0.225417 | package entity;
/**
* Created by savannaholson on 3/10/16.
*/
public class UserRole {
private String username;
private String roleName;
/**
* constructor to set all values
*
* @param username the username
* @param roleName the rolename
*/
public UserRole(String username, String roleName) {
this.username = username;
this.roleName = roleName;
}
/**
* default empty constructor
*/
public UserRole() {
username = "";
roleName = "";
}
/**
* Gets roleName.
*
* @return Value of roleName.
*/
public String getRoleName() {
return roleName;
}
/**
* Sets new username.
*
* @param username New value of username.
*/
public void setUsername(String username) {
this.username = username;
}
/**
* Sets new roleName.
*
* @param roleName New value of roleName.
*/
public void setRoleName(String roleName) {
this.roleName = roleName;
}
/**
* Gets username.
*
* @return Value of username.
*/
public String getUsername() {
return username;
}
}
|
0f5e063f-11d6-492a-9a41-dbcc24022857 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-06-30 12:36:31", "repo_name": "ctpconsulting/cdise", "sub_path": "/archiver/archiver-main/src/main/java/com/ctp/javaone/archiver/command/ChangeDirectory.java", "file_name": "ChangeDirectory.java", "file_ext": "java", "file_size_in_byte": 1006, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "f493c37b394e514653bd6ffb73d32f653084392b", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ctpconsulting/cdise | 210 | FILENAME: ChangeDirectory.java | 0.267408 | package com.ctp.javaone.archiver.command;
import java.io.File;
import javax.enterprise.event.Event;
import javax.inject.Inject;
import org.apache.commons.io.FileUtils;
@ShellCommand("cd")
public class ChangeDirectory implements Command {
@Inject
private File currentDirectory;
@Inject
private Event<File> directoryChanged;
@Override
public Result execute(String... params) {
if (params == null || params.length == 0) {
directoryChanged.fire(FileUtils.getUserDirectory());
}
String path = currentDirectory.getAbsolutePath() + File.separator + params[0];
File next = new File(path);
if (!next.exists()) {
return new Result("File " + params[0] + " does not exist", Status.FAILURE);
}
if (!next.isDirectory()) {
return new Result("File " + params[0] + " is not a directory", Status.FAILURE);
}
directoryChanged.fire(next);
return Result.SUCCESS;
}
}
|
65940a18-60eb-4c39-a924-74154f88932f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2013-12-01T13:14:10", "repo_name": "ff6347/duration-and-processing", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1092, "line_count": 31, "lang": "en", "doc_type": "text", "blob_id": "a8bd1afd75e5170d63c29e3bfa75f9245a09cdf4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ff6347/duration-and-processing | 291 | FILENAME: README.md | 0.286169 | duration-and-processing
=======================

I had to fiddle with duration after seeing somebody fork it on ny github feed. See a quick [screenrecord on vimeo](http://vimeo.com/80712056)
1. get the [Duration.app](http://duration.cc) - [Code](https://github.com/YCAMInterlab/Duration)
2. get the [procesing osc library](http://www.sojamo.de/libraries/oscP5/)
3. get nuts
##License
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 Fabian Morón Zirfas aka fabiantheblind
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
##Music in Screenrecord:
B001 by [Monroeville Music Center](http://monroevillemusiccenter.blogspot.com)
under CC Licnese http://creativecommons.org/licenses/by/3.0/
|
ed490145-9e79-40d1-9e49-0e0eedaa66b4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-04-07 15:40:10", "repo_name": "gcivanov/Projects", "sub_path": "/android/eclipse/Cinema/src/com/example/cinema/model/Movies.java", "file_name": "Movies.java", "file_ext": "java", "file_size_in_byte": 1115, "line_count": 74, "lang": "en", "doc_type": "code", "blob_id": "ac3b8425d19cd5e105c51fc14313577ee540e596", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gcivanov/Projects | 300 | FILENAME: Movies.java | 0.286968 | package com.example.cinema.model;
import java.io.Serializable;
public class Movies implements Serializable {
private static final long serialVersionUID = 8797872986654688666L;
private long id;
private String name;
private int year;
private AllProjections allProjections; /////
public Movies(){
}
public Movies(String name , int year ){
if(name != null && year > 0 && year / 10000 == 0) {
this.name = name;
this.year = year;
}
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public AllProjections getAllProjections() {
return allProjections;
}
public void setAllProjections(AllProjections allProjections) {
this.allProjections = allProjections;
}
@Override
public String toString() {
return "Movies [id=" + id + ", name=" + name + ", year=" + year
+ ", allProjections=" + allProjections + "]";
}
}
|
53ce23f9-abe8-4550-8eba-ecfb7f00f55c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-21 00:46:56", "repo_name": "RJDove/designPattren", "sub_path": "/src/com/rj/design/study/interpreter/eg2/Context.java", "file_name": "Context.java", "file_ext": "java", "file_size_in_byte": 1229, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "8ae1f2013d1dcd294416f40b8c509fa0e655c92d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/RJDove/designPattren | 293 | FILENAME: Context.java | 0.258326 | package com.rj.design.study.interpreter.eg2;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
/**
* 上下文
* @author renjin
* @date 2020/1/10
*/
public class Context {
/**
* 上次被处理的元素
*/
private Element preEle;
/**
* Dom解析xml的Document对象
*/
private Document document;
public Context(String filePathName) throws Exception {
this.document = XmlUtil.getRoot(filePathName);
}
public void reInit() {
preEle = null;
}
public Element getNowEle(Element pEle, String eleName) {
NodeList tempNodeList = pEle.getChildNodes();
for (int i=0; i<tempNodeList.getLength(); i++) {
if (tempNodeList.item(i) instanceof Element) {
Element nowEle = (Element) tempNodeList.item(i);
if (nowEle.getTagName().equals(eleName)) {
return nowEle;
}
}
}
return null;
}
public Element getPreEle() {
return preEle;
}
public void setPreEle(Element preEle) {
this.preEle = preEle;
}
public Document getDocument() {
return document;
}
}
|
a5b34fce-bf21-4bc3-91f4-b005921f8d7e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-04-07 23:34:27", "repo_name": "wiredcats/EventBasedWiredCats", "sub_path": "/src/Util2415/BlockingQueue.java", "file_name": "BlockingQueue.java", "file_ext": "java", "file_size_in_byte": 991, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "cf852854b6381fbaa128f5529dcea0d29b199bf2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wiredcats/EventBasedWiredCats | 183 | FILENAME: BlockingQueue.java | 0.246533 | package Util2415;
import java.util.Vector;
/**
* Queue used to organize events in systems
*
* @author Robotics
*/
public class BlockingQueue {
private Vector queue; //events are held here
public BlockingQueue(int limit) {
queue = new Vector(limit);
}
public synchronized void put(Object o) throws InterruptedException {
queue.addElement(o);
}
/**
* Takes the next in line of the Queue.
*/
public synchronized Object take() throws InterruptedException {
Object temp;
while (queue.isEmpty()) {
try {
wait();
} catch (InterruptedException e) {
}
}
temp = queue.firstElement();
queue.removeElementAt(0);
return temp;
}
public int getSize() {
return queue.size();
}
public boolean isEmpty() {
return queue.isEmpty();
}
}
|
bda748de-1693-4305-84b4-c883c5170e35 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-27 19:23:18", "repo_name": "AlexisRossat/Polytech-2017-5A-alternance-ROSSAT", "sub_path": "/app/src/main/java/com/example/epulapp/projetandroid/MyBroadcastReceiver.java", "file_name": "MyBroadcastReceiver.java", "file_ext": "java", "file_size_in_byte": 1099, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "f8ee1212d28695db5eef7e90cd524061ff07ba57", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AlexisRossat/Polytech-2017-5A-alternance-ROSSAT | 207 | FILENAME: MyBroadcastReceiver.java | 0.240775 | package com.example.epulapp.projetandroid;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.TaskStackBuilder;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import static android.provider.Settings.Global.getString;
/**
* Created by Epulapp on 29/11/2017.
*/
public class MyBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("DEBUG_PROJET", "Broadcast recu");
NotificationManager mNotification = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_rowing_black_24dp)
.setContentTitle("My notification")
.setContentText("Hello World!");
mNotification.notify(111, mBuilder.build());
}
}
|
2d396c55-6cea-4009-8edb-74f2391c3f61 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-02 14:12:07", "repo_name": "ISOTOPE-Studio/Evolution", "sub_path": "/src/cc/isotopestudio/evolution/sql/SqlManager.java", "file_name": "SqlManager.java", "file_ext": "java", "file_size_in_byte": 1105, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "ec3372df958bf9a46358a46485caf747de9a2020", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ISOTOPE-Studio/Evolution | 222 | FILENAME: SqlManager.java | 0.283781 | package cc.isotopestudio.evolution.sql;
/*
* Created by Mars Tan on 3/2/2017.
* Copyright ISOTOPE Studio
*/
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import static cc.isotopestudio.evolution.Evolution.plugin;
public abstract class SqlManager {
public static Connection c;
public static Statement statement;
public static void init() {
SQLite db = new SQLite(plugin.getDataFolder().getPath(), "players.db");
try {
c = db.openConnection();
statement = c.createStatement();
String sql = "CREATE TABLE IF NOT EXISTS players " +
"(NAME CHAR(20) PRIMARY KEY NOT NULL," +
" STR INT NOT NULL," +
" SPD INT NOT NULL," +
" CON INT NOT NULL," +
" WIT INT NOT NULL," +
" MEN INT NOT NULL)";
statement.executeUpdate(sql);
} catch (SQLException | ClassNotFoundException e) {
e.printStackTrace();
}
}
}
|
b77b945a-24b2-46a3-af1c-48e651732d36 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-17T15:31:54", "repo_name": "antoninastefanowska/SocialSynchro", "sub_path": "/app/src/main/java/com/antonina/socialsynchro/services/twitter/rest/requests/TwitterRequest.java", "file_name": "TwitterRequest.java", "file_ext": "java", "file_size_in_byte": 1138, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "707baa69d5823a586b6724ef32a83273e3b23e33", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/antoninastefanowska/SocialSynchro | 201 | FILENAME: TwitterRequest.java | 0.242206 | package com.antonina.socialsynchro.services.twitter.rest.requests;
import com.antonina.socialsynchro.common.rest.BaseRequest;
import com.antonina.socialsynchro.services.twitter.rest.authorization.TwitterAuthorizationStrategy;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
@SuppressWarnings({"WeakerAccess", "StringBufferReplaceableByString"})
public abstract class TwitterRequest extends BaseRequest {
protected TwitterRequest(String authorizationString) {
super(authorizationString);
}
public static String percentEncode(String input) {
String output = "";
try {
output = URLEncoder.encode(input, "UTF-8");
output = output.replace("+", "%20");
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return output;
}
public static abstract class Builder extends BaseRequest.Builder {
protected TwitterAuthorizationStrategy authorization;
@Override
public abstract TwitterRequest build();
protected abstract void configureAuthorization();
}
}
|
2e89206a-e416-46b3-b394-f572cc6c2687 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-08-16T22:44:05", "repo_name": "cloudflare/cloudflare-docs", "sub_path": "/content/support/Third-Party Software/Content Management System (CMS)/Can I use WordPress caching plugins like Super Cache or W3 Total Cache (W3TC) with Cloudflare.md", "file_name": "Can I use WordPress caching plugins like Super Cache or W3 Total Cache (W3TC) with Cloudflare.md", "file_ext": "md", "file_size_in_byte": 1141, "line_count": 14, "lang": "en", "doc_type": "text", "blob_id": "b732ec2a4e2dcb5775e18b8384fa1b8a357f73e3", "star_events_count": 2276, "fork_events_count": 2810, "src_encoding": "UTF-8"} | https://github.com/cloudflare/cloudflare-docs | 272 | FILENAME: Can I use WordPress caching plugins like Super Cache or W3 Total Cache (W3TC) with Cloudflare.md | 0.210766 | ---
pcx_content_type: troubleshooting
source: https://support.cloudflare.com/hc/en-us/articles/200169756-Can-I-use-WordPress-caching-plugins-like-Super-Cache-or-W3-Total-Cache-W3TC-with-Cloudflare-
title: Can I use WordPress caching plugins like Super Cache or W3 Total Cache (W3TC) with Cloudflare
---
# Can I use WordPress caching plugins like Super Cache or W3 Total Cache (W3TC) with Cloudflare?
## Overview
It is possible to cache the HTML of a WordPress site at Cloudflare's Edge using a feature known as "Bypass Cache on Cookie". This can dramatically improve the speed of your website and reduce server load; in cases where the HTML is cached, Cloudflare will not need to make a roundtrip to your web server. In order to utilize this feature, refer to the article: [Caching Static HTML with WordPress/WooCommerce](https://support.cloudflare.com/hc/en-us/articles/236166048-Caching-Static-HTML-with-WordPress-WooCommerce).
Cloudflare is able to proxy HTTP traffic of any website, including WordPress sites with third-party performance plugins installed, however, please note that these plugins are installed at your own risk.
|
40788cd8-6225-4091-8d76-f6e833a16231 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-03-16 01:56:51", "repo_name": "yosmellopez/planificacion", "sub_path": "/src/com/planning/util/RestModelAndView.java", "file_name": "RestModelAndView.java", "file_ext": "java", "file_size_in_byte": 1070, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "fa48f4e84bc5a6a8efb69598220f0b6efe9422c0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yosmellopez/planificacion | 205 | FILENAME: RestModelAndView.java | 0.286169 | /*
* 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.planning.util;
import java.util.Map;
import org.springframework.http.HttpStatus;
import org.springframework.ui.ModelMap;
import org.springframework.web.servlet.ModelAndView;
public class RestModelAndView extends ModelAndView {
public RestModelAndView(Map<String, ?> model) {
super(new RestMappingJacksonJsonView(), model);
}
public RestModelAndView(Map<String, ?> model, HttpStatus httpStatus) {
super(new RestMappingJacksonJsonView(), model);
super.setStatus(httpStatus);
}
public static ModelAndView ok() {
RestModelAndView view = new RestModelAndView(new ModelMap());
view.setStatus(HttpStatus.OK);
return view;
}
public static ModelAndView ok(ModelMap map) {
RestModelAndView view = new RestModelAndView(map);
view.setStatus(HttpStatus.OK);
return view;
}
}
|
cae849f7-7cc8-4f61-a244-4d6905cb0e01 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-18 05:49:47", "repo_name": "ravaneswaran/techsocialist", "sub_path": "/source-code/java/os-stripper/os-stripper-api/src/main/java/com/techsocialist/os/stripper/service/api/IOperatingSystemStripperService.java", "file_name": "IOperatingSystemStripperService.java", "file_ext": "java", "file_size_in_byte": 1197, "line_count": 27, "lang": "en", "doc_type": "code", "blob_id": "1d04cd0344b235143986e2b3aa87451cf273805b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ravaneswaran/techsocialist | 234 | FILENAME: IOperatingSystemStripperService.java | 0.261331 | package com.techsocialist.os.stripper.service.api;
import com.techsocialist.os.stripper.model.api.IEnvironmentVariable;
import com.techsocialist.os.stripper.model.api.IProcess;
import com.techsocialist.os.stripper.model.api.ISystemProperty;
import java.io.IOException;
import java.util.List;
public interface IOperatingSystemStripperService {
public static final String OPERATING_SYSTEM_STRIPPER_SERVICE_IMPLEMENTATION = "techsocialist.os.stripper.service";
public static final String UNIX_STRIPPER_SERVICE_IMPLEMENTATION = "techsocialist.unix.stripper.service";
public static final String LINUX_STRIPPER_SERVICE_IMPLEMENTATION = "techsocialist.linux.stripper.service";
public static final String WINDOWS_STRIPPER_SERVICE_IMPLEMENTATION = "techsocialist.windows.stripper.service";
public static final String SOLARIS_STRIPPER_SERVICE_IMPLEMENTATION = "techsocialist.solaris.stripper.service";
public List<IProcess> getProcesses() throws IOException;
public List<IEnvironmentVariable> getEnvironmentVariables() throws IOException;
public List<ISystemProperty> getSystemProperties();
public String getInternetProtocolConfiguration() throws IOException;
}
|
fbb7dcad-7613-44e4-949b-035ddee8187d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-06 09:32:54", "repo_name": "dhirajn72/datastructureAndAlgorithms", "sub_path": "/core/src/main/java/interview/SetWithDups.java", "file_name": "SetWithDups.java", "file_ext": "java", "file_size_in_byte": 1064, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "0091fe672518387f5b8a2325ce96bbfe67069c9d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dhirajn72/datastructureAndAlgorithms | 259 | FILENAME: SetWithDups.java | 0.290981 | package interview;
import java.util.HashSet;
import java.util.Set;
/**
* @author Dhiraj
* @date 14/01/19
*/
public class SetWithDups {
public static void main(String[] args) {
Set<Emp> emps= new HashSet<>();
emps.add(new Emp(1,"dk"));
emps.add(new Emp(1,"dk"));
System.out.println(emps);
}
}
class Emp{
private int id;
private String name;
public Emp(int id, String name) {
this.id = id;
this.name = name;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof Emp){
System.out.println("equals called");
return this.id==((Emp)obj).id && this.name==((Emp)obj).name;
//return false;
}
return false;
}
@Override
public int hashCode() {
System.out.println("hascode called");
return id%7+name.hashCode();
}
@Override
public String toString() {
return "Emp{" +
"id=" + id +
", name='" + name + '\'' +
'}';
}
} |
4335da82-87b5-404c-9985-0ac4dfc8a681 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-30T16:30:54", "repo_name": "duongnn/voldemort-monitor", "sub_path": "/predicatedetectionlib/src/main/java/predicatedetectionlib/common/clientgraph/ClientGraphNode.java", "file_name": "ClientGraphNode.java", "file_ext": "java", "file_size_in_byte": 1138, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "f54d88fcc8ca3fda1e436e61eb81213d939a930d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/duongnn/voldemort-monitor | 251 | FILENAME: ClientGraphNode.java | 0.275909 | package predicatedetectionlib.common.clientgraph;
import java.util.HashMap;
/**
* Created by duongnn on 11/21/17.
* The class describing a node in the line graph
* This class will be used by clientGraph program
*/
public class ClientGraphNode {
String name;
ClientGraphNodeType type;
// A mapping of a neighbor (name) and the lock associated with the link
// between this node and that neighbor
private HashMap<String, ClientGraphPetersonLock> lockHashMap;
public ClientGraphNode(String name, ClientGraphNodeType type){
this.name = name;
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ClientGraphNodeType getType() {
return type;
}
public void setType(ClientGraphNodeType type) {
this.type = type;
}
public HashMap<String, ClientGraphPetersonLock> getLockHashMap() {
return lockHashMap;
}
public void setLockHashMap(HashMap<String, ClientGraphPetersonLock> lockHashMap) {
this.lockHashMap = lockHashMap;
}
}
|
87428180-8025-411a-bfe8-a4ac3a1e6a25 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-26 06:20:23", "repo_name": "dzbUser/home-word1", "sub_path": "/src/main/java/com/aiwan/server/base/executor/scene/SceneExecutorService.java", "file_name": "SceneExecutorService.java", "file_ext": "java", "file_size_in_byte": 1199, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "72b91ceeb5791e5ad8914a65d3cceedbbd4ddee0", "star_events_count": 2, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/dzbUser/home-word1 | 225 | FILENAME: SceneExecutorService.java | 0.274351 | package com.aiwan.server.base.executor.scene;
import com.aiwan.server.base.executor.ICommand;
import com.aiwan.server.base.executor.scene.impl.AbstractSceneDelayCommand;
import com.aiwan.server.base.executor.scene.impl.AbstractSceneRateCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 场景执行任务
*
* @author dengzebiao
*/
@Component
public class SceneExecutorService implements ISceneExecutorService {
@Autowired
private SceneExecutor sceneExecutor;
@Override
public void submit(ICommand command) {
if (command instanceof AbstractSceneRateCommand) {
AbstractSceneRateCommand sceneRateCommand = (AbstractSceneRateCommand) command;
sceneExecutor.schedule(sceneRateCommand, sceneRateCommand.getDelay(), sceneRateCommand.getPeriod());
} else if (command instanceof AbstractSceneDelayCommand) {
AbstractSceneDelayCommand sceneDelayCommand = (AbstractSceneDelayCommand) command;
sceneExecutor.schedule(sceneDelayCommand, sceneDelayCommand.getDelay());
} else {
sceneExecutor.addTask(command);
}
}
}
|
25a647a9-b1f3-44b5-82f8-bcae73688f2d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-12 11:39:15", "repo_name": "MarcoM5/mongo-crud", "sub_path": "/src/main/java/com/bm/mongocrud/dataaccessobject/MovieDao.java", "file_name": "MovieDao.java", "file_ext": "java", "file_size_in_byte": 1191, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "a91b03d454b92791d46ad8c95b82ad151cd83ef7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/MarcoM5/mongo-crud | 241 | FILENAME: MovieDao.java | 0.279828 | package com.bm.mongocrud.dataaccessobject;
import com.bm.mongocrud.model.Movie;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Optional;
@Slf4j
@Component
@RequiredArgsConstructor
public class MovieDao {
private final MovieRepository movieRepository;
public List<Movie> getMovies() {
return movieRepository.findAll();
}
public Optional<Movie> getMovieById(String id) {
return movieRepository.findById(id);
}
public Movie insertMovie(Movie movie) {
return movieRepository.insert(movie);
}
// public Movie updateMovie(Movie movie) {
// final Optional<Movie> oldMovie = movieRepository.findById(movie.getId());
// oldMovie.ifPresent() {
// oldMovie.
// } else {
// movieRepository.insert(movie);
// }
//
// }
public void deleteMovie(String id) {
try {
movieRepository.deleteById(id);
} catch (NoSuchElementException e) {
log.warn("Movie not Found: {}", id);
}
}
}
|
a18a1bd1-8dd3-45fc-a068-b47383708a41 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-14 02:37:49", "repo_name": "liepeiming/xposed_chatbot", "sub_path": "/alimama/src/main/java/com/taobao/pexode/entity/IncrementalStaging.java", "file_name": "IncrementalStaging.java", "file_ext": "java", "file_size_in_byte": 1099, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "3cc48d5f06ef2c60eb61cae2385452d9f643d909", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/liepeiming/xposed_chatbot | 228 | FILENAME: IncrementalStaging.java | 0.282196 | package com.taobao.pexode.entity;
import android.graphics.Bitmap;
public class IncrementalStaging {
private final Bitmap mInterBitmap;
private long mNativeConfigOut;
private final NativeDestructor mNativeDestructor;
public interface NativeDestructor {
void destruct(long j);
}
public IncrementalStaging(Bitmap bitmap, long j, NativeDestructor nativeDestructor) {
this.mInterBitmap = bitmap;
this.mNativeConfigOut = j;
this.mNativeDestructor = nativeDestructor;
}
public Bitmap getInterBitmap() {
return this.mInterBitmap;
}
public long getNativeConfigOut() {
return this.mNativeConfigOut;
}
public synchronized void release() {
if (this.mNativeConfigOut != 0) {
this.mNativeDestructor.destruct(this.mNativeConfigOut);
this.mNativeConfigOut = 0;
}
}
/* access modifiers changed from: protected */
public void finalize() {
try {
release();
super.finalize();
} catch (Throwable unused) {
}
}
}
|
f21ffa90-53ae-4cea-a8a7-864cac1bb0c0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-09-24T07:55:08", "repo_name": "Misterinecompany/DryIoc.Transactions", "sub_path": "/readme.md", "file_name": "readme.md", "file_ext": "md", "file_size_in_byte": 1198, "line_count": 36, "lang": "en", "doc_type": "text", "blob_id": "2ab6cf01da231e8fc2e26ca883b5569a94dffc54", "star_events_count": 1, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/Misterinecompany/DryIoc.Transactions | 231 | FILENAME: readme.md | 0.213377 | # DryIoc Transactions (port from Castle.Transactions https://github.com/castleproject/Castle.Transactions)
A project for transaction management on .NET Standard.
## Quick Start
NuGet package is currently not exist.
### Castle Transactions
The original project that manages transactions.
#### Main Features
* Regular Transactions (+`System.Transactions` interop) - allows you to create transactions with a nice API
* Dependent Transactions - allows you to fork dependent transactions automatically by declarative programming: `[Transaction(Fork=true)]`
* Transaction Logging - A trace listener in namespace `Castle.Transactions.Logging`, named `TraceListener`.
* Retry policies for transactions
#### Main Interfaces
- `ITransactionManager`:
- *default implementation is `TransactionManager`*
- keeps tabs on what transaction is currently active
- coordinates parallel dependent transactions
- keep the light weight transaction manager (LTM) happy on the CLR
### Castle Transactions IO
A project for adding a transactional file system to the mix!
#### Main Features
* Provides an `Castle.IO.IFileSystem` implementation that adds transactionality to common operations.
|
85ec7cbe-1e4c-415d-972f-789ca44e2a63 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-28 12:32:56", "repo_name": "289991233/BaseNetWork", "sub_path": "/network/src/main/java/basenetword/jack/com/network/http/models/TBaseModel.java", "file_name": "TBaseModel.java", "file_ext": "java", "file_size_in_byte": 1116, "line_count": 41, "lang": "zh", "doc_type": "code", "blob_id": "68b9d96d6259942134851f12f8458538d9989fa5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/289991233/BaseNetWork | 245 | FILENAME: TBaseModel.java | 0.264358 | package basenetword.jack.com.network.http.models;
import basenetword.jack.com.network.utils.Loger;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
/**
* 描 述:
* 创 建 人:SDX
* 创建日期:2017/6/19 16:10
* 修订历史:
* 修 改 人:
*/
public abstract class TBaseModel implements BaseModel {
//保存观察者和订阅者的订阅关系对象
public CompositeDisposable compositeDisposable;
/**
* 使用Disposable 必须进行订阅管理
*
* @param disposable
*/
protected void addDisposable(Disposable disposable) {
if (compositeDisposable == null) {
compositeDisposable = new CompositeDisposable();
}
compositeDisposable.add(disposable);
}
@Override
public void dispose() {
Loger.e("XBaseModel销毁了");
//解除compositeDisposable中所有保存的Disposable对象中的订阅关系
if (compositeDisposable != null) {
compositeDisposable.dispose();
compositeDisposable = null;
}
}
}
|
425646c8-50dd-4b2e-84ab-c598bef80602 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-16 15:09:07", "repo_name": "yuanchangyue/j2ee-final-work", "sub_path": "/src/main/java/com/changyue/j2eefinal/validator/ValidatorResult.java", "file_name": "ValidatorResult.java", "file_ext": "java", "file_size_in_byte": 1133, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "8e53670d6a10bc2cd2e037a1cde58837dcd2e2c2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yuanchangyue/j2ee-final-work | 280 | FILENAME: ValidatorResult.java | 0.252384 | package com.changyue.j2eefinal.validator;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* @program: j2eework-9
* @description:
* @author: 袁阊越
* @create: 2019-12-12 21:53
*/
public class ValidatorResult {
/**
* 是否有错
*/
private boolean hasError = false;
/**
* 存放错误的信息
* 如 propertyName :message
*/
private Map<String, String> errorMsgMap = new HashMap<>();
public boolean isHasError() {
return hasError;
}
public void setHasError(boolean hasError) {
this.hasError = hasError;
}
public Map<String, String> getErrorMsgMap() {
return errorMsgMap;
}
public void setErrorMsgMap(Map<String, String> errorMsgMap) {
this.errorMsgMap = errorMsgMap;
}
/**
* 实现通用的格式化字符串信息获取的错误信息结果的msg方法
*
* @return 错误信息
*/
public String getErrMsg() {
return StringUtils.join(Arrays.toString(errorMsgMap.values().toArray()) + ",");
}
}
|
dabcf4d3-e8ab-4b1c-ac10-c2282ed3a056 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-27 06:07:59", "repo_name": "solomonshihundu/SimpleRestBackend", "sub_path": "/src/main/java/com/ss/rest/api/simplebackend/SimpleBackendApplication.java", "file_name": "SimpleBackendApplication.java", "file_ext": "java", "file_size_in_byte": 1092, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "47db374f2806d613905e8f4ddaeea2343e66291a", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/solomonshihundu/SimpleRestBackend | 200 | FILENAME: SimpleBackendApplication.java | 0.255344 | package com.ss.rest.api.simplebackend;
import com.ss.rest.api.simplebackend.model.ERole;
import com.ss.rest.api.simplebackend.model.Role;
import com.ss.rest.api.simplebackend.repository.RoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SimpleBackendApplication implements ApplicationRunner
{
private RoleRepository roleRepository;
@Autowired
public SimpleBackendApplication(RoleRepository roleRepository) {
this.roleRepository = roleRepository;
}
public static void main(String[] args) {
SpringApplication.run(SimpleBackendApplication.class, args);
}
@Override
public void run(ApplicationArguments args) throws Exception {
roleRepository.save(new Role(ERole.ROLE_USER));
roleRepository.save(new Role(ERole.ROLE_ADMIN));
roleRepository.save(new Role(ERole.ROLE_MODERATOR));
}
}
|
c1cd5581-e758-4845-b318-77ad297a55ae | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-02-04 17:09:48", "repo_name": "rylo/BubbleSort-Strategy-Pattern", "sub_path": "/src/BubbleSort.java", "file_name": "BubbleSort.java", "file_ext": "java", "file_size_in_byte": 1023, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "1bffd3464ad35fdef32d5d6c5a5d63561a8c7968", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/rylo/BubbleSort-Strategy-Pattern | 217 | FILENAME: BubbleSort.java | 0.275909 | import java.util.ArrayList;
public class BubbleSort {
private SortStrategy strategy;
void setSortStrategy(SortStrategy strategy) {
this.strategy = strategy;
}
public void sort(ArrayList collectionToSort){
Object first, second;
boolean swapHappened = true;
while(swapHappened){
swapHappened = false;
for(int x = 0; x < (collectionToSort.size() - 1); x++) {
first = collectionToSort.get(x);
second = collectionToSort.get(x+1);
if (this.strategy.compare(first, second)) {
this.strategy.swap(x, collectionToSort, first, second);
swapHappened = true;
}
}
}
printArray(collectionToSort);
}
public final void printArray(ArrayList arrayToPrint){
System.out.println("Outcome:");
for(int x = 0; x < arrayToPrint.size(); x++) {
System.out.println(arrayToPrint.get(x));
}
}
}
|
278739cd-30d7-46a4-b3a1-13ccb6dae009 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-13 15:14:34", "repo_name": "accasio/partA", "sub_path": "/src/main/java/Course.java", "file_name": "Course.java", "file_ext": "java", "file_size_in_byte": 1139, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "fcc5e410386f744aea9e1856e9f539d71a8ffdbb", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/accasio/partA | 226 | FILENAME: Course.java | 0.273574 | /**
* Created by accas on 03/10/2017.
*/
import org.joda.time.*;
public class Course {
private String courseName;
private Module[] modules;
private DateTime startDate;
private DateTime endDate;
public Course(String courseName, Module[] modules, DateTime startDate, DateTime endDate) {
this.courseName = courseName;
this.modules = modules;
this.startDate = startDate;
this.endDate = endDate;
}
public String getCourseName() {
return courseName;
}
public void setCourseName(String courseName) {
this.courseName = courseName;
}
public Module[] getModules() {
return modules;
}
public void setModules(Module[] modules) {
this.modules = modules;
}
public DateTime getStartDate() {
return startDate;
}
public void setStartDate(DateTime startDate) {
this.startDate = startDate;
}
public DateTime getEndDate() {
return endDate;
}
public void setEndDate(DateTime endDate) {
this.endDate = endDate;
}
}
|
73e9acda-40e2-4a91-a676-ae1a8154b141 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-21 23:21:20", "repo_name": "Robots-R-Us/CL2020", "sub_path": "/src/main/java/frc/robot/commands/Drive.java", "file_name": "Drive.java", "file_ext": "java", "file_size_in_byte": 976, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "35607f464e5270b2a56850fa8f1ce5917e586936", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Robots-R-Us/CL2020 | 212 | FILENAME: Drive.java | 0.246533 | package frc.robot.commands;
import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.Constants;
import frc.robot.RobotContainer;
import frc.robot.subsystems.Drivebase;
import util.GameData;
public class Drive extends CommandBase {
private Drivebase driveBase;
private boolean isFinished = false;
public Drive(Drivebase _driveBase) {
this.driveBase = _driveBase;
addRequirements(_driveBase);
}
@Override
public void initialize() {
}
@Override
public void execute() {
driveBase.drive(RobotContainer.getInstance().getDriverAxis(Constants.Controller.LEFT_Y), RobotContainer.getInstance().getDriverAxis(Constants.Controller.LEFT_X));
}
@Override
public void end(boolean interrupted) {
driveBase.stop();
}
@Override
public boolean isFinished() {
if(GameData.getMatchTime() <= 0) {
isFinished = true;
}
return isFinished;
}
}
|
0e7c026b-05a9-46da-9b12-65f90fbf0c41 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-02 15:23:12", "repo_name": "therealshabi/Eventos", "sub_path": "/app/src/main/java/app/com/thetechnocafe/eventos/HomeStreamActivity.java", "file_name": "HomeStreamActivity.java", "file_ext": "java", "file_size_in_byte": 1196, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "83b1961e4ab51150971c51b9c2e066091a502b14", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/therealshabi/Eventos | 203 | FILENAME: HomeStreamActivity.java | 0.216012 | package app.com.thetechnocafe.eventos;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import app.com.thetechnocafe.eventos.Utils.SharedPreferencesUtils;
public class HomeStreamActivity extends AppCompatActivity {
boolean LikeBtnStatus;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_stream);
if(!SharedPreferencesUtils.getLoginState(getBaseContext())){
finish();
}
// getIntent().getBooleanExtra("likeBtnStatus", LikeBtnStatus);
FragmentManager fragmentManager = getSupportFragmentManager();
Fragment fragment = fragmentManager.findFragmentById(R.id.home_stream_fragment_container);
if (fragment == null) {
fragment = HomeStreamFragment.getInstance();
fragmentManager.beginTransaction().add(R.id.home_stream_fragment_container, fragment).commit();
}
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
}
|
1371df7b-68bc-4c7d-b970-5fd3ed179150 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-04-30T19:10:18", "repo_name": "SarahJoline/google-books", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1234, "line_count": 53, "lang": "en", "doc_type": "text", "blob_id": "36c7a2de110f2b14a6c422e9d366cca949108e69", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/SarahJoline/google-books | 277 | FILENAME: README.md | 0.239349 | # google-books

### What the app does:
This app used the Google Books API so users can look for books. They can then save the book to MongoDB to create a reading list. They can later check the books off their list with the delete button. Clicking on the book will bring you directly to the Google Books page for the book where you can find more information. This app uses react-router-dom to switch between components.
Happy Reading!
### To get the app running:
After cloning the repo run:
> npm install
To run the app on your computer run:
> npm run dev
### Database:
The Schema includes:
- id - ID of the book from the Google Books API
- title - Title of the book from the Google Books API
- authors - The book's author(s) from the Google Books API
- description - The book's description from the Google Books API
- image - The thumbnail image from the Google Books API
- link - The book information link from the Google Books API
However, for styling purposes, only the image appears on the pages.
### Technoligies used:
- MongoDB
- Express
- React
- Node.js
Styled with love and CSS.
### Live site:
Deployed on Heroku
https://app-google-books.herokuapp.com/
|
0cbe278a-6898-4372-b061-2038b16b1444 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-12-13 10:16:51", "repo_name": "wood23636/mp3gain-analyst", "sub_path": "/src/main/java/be/sonck/mp3gain/impl/process/analysis/ErrorStreamListener.java", "file_name": "ErrorStreamListener.java", "file_ext": "java", "file_size_in_byte": 1086, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "f48ae0731bba5a17ffff5e5dbb3d4be44ed40a70", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wood23636/mp3gain-analyst | 233 | FILENAME: ErrorStreamListener.java | 0.282988 | package be.sonck.mp3gain.impl.process.analysis;
import java.io.File;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import be.sonck.mp3gain.api.model.ProgressIndicator;
import be.sonck.mp3gain.api.service.Mp3GainAnalysisListener;
import be.sonck.mp3gain.impl.factory.ProgressIndicatorFactory;
import be.sonck.mp3gain.impl.process.StreamReaderListener;
class ErrorStreamListener implements StreamReaderListener {
private final Mp3GainAnalysisListener listener;
private final List<File> files;
public ErrorStreamListener(List<File> files, Mp3GainAnalysisListener listener) {
this.files = files;
this.listener = listener;
}
@Override
public void lineRead(String line) {
if (StringUtils.isBlank(line)) { return; }
ProgressIndicator indicator = ProgressIndicatorFactory.create(files, line);
listener.notifyProgress(indicator.getFile(), indicator.getTrackNumber(), indicator.getNumberOfTracks(),
indicator.getProgress());
}
@Override
public void error(Exception e) {
listener.notifyError(e);
}
@Override
public void done() {
}
}
|
6f98592d-f992-4db6-819a-58f333a812e7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-04 03:36:18", "repo_name": "iBlueBRs/InLogin", "sub_path": "/src/com/br/login/login.java", "file_name": "login.java", "file_ext": "java", "file_size_in_byte": 1089, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "243e724ab89032cef175b177f7435b32adfbcc9f", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/iBlueBRs/InLogin | 202 | FILENAME: login.java | 0.195594 | package com.br.login;
import com.br.Main;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class login implements CommandExecutor {
@Override
public boolean onCommand(CommandSender Sender, Command cmd, String label, String[] args) {
if (Sender instanceof Player) {
Player p = (Player) Sender;
if (args.length == 0){
return true;
}else {
if (!loginAPI.estaLogado(p)) {
String senha = args[0];
if (senha.equals(loginAPI.getSenha(p))) {
loginAPI.Logar(p);
p.sendMessage(Main.plugin.getConfig().getString("entrou"));
}else {
p.kickPlayer(Main.plugin.getConfig().getString("erroSenha"));
}
}else {
p.sendMessage(Main.plugin.getConfig().getString("estaLogado"));
}
}
}
return true;
}
}
|
091138ec-2833-4364-9e74-7ceec8e8afc3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-12-30T11:38:28", "repo_name": "denis1stomin/multithreaded-file-archiver", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1136, "line_count": 35, "lang": "en", "doc_type": "text", "blob_id": "12680cff6ddf10ac3be0740e6ab4905805e4c4f0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/denis1stomin/multithreaded-file-archiver | 303 | FILENAME: README.md | 0.284576 | # Multithreaded file archiver
Simple multithreaded file archiver implemented using dotnet core framework.
Most commands below are for Linux system but it is just because I have Ubuntu on my home machine. The commands can be easily tuned for Windows or even used as-is on Windows.
## Requirements
- Input files can be bigger than RAM size
- Don't use async/await
- Don't use ThreadPool, BackgroundWorker, TPL
## Main things to understand and reproduce this code
To run the app
`cd GzipArchiver`
`dotnet run`
To publish single executable file on Linux
`dotnet publish -c release --self-contained --runtime linux-x64`
or on Windows
`dotnet publish -c release --self-contained --runtime win-x64`
To run unit tests
`cd GzipArchiver.Test`
`dotnet test`
To run E2E tests
`sh e2e-test-suite.sh`
To create project structure run
`dotnet new console --name GzipArchiver`
`dotnet new mstest --name GzipArchiver.Test`
`cd GzipArchiver.Test`
`dotnet add reference ./../GzipArchiver/GzipArchiver.csproj`
## Some links
https://docs.microsoft.com/ru-ru/dotnet/api/system.io.compression.gzipstream?view=net-5.0
|
7f4019f2-9cae-4a95-bb33-65d5bd9c0692 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-07-21 03:29:36", "repo_name": "hcsp/thread-local-bug", "sub_path": "/src/main/java/com/github/hcsp/service/UserContextInterceptor.java", "file_name": "UserContextInterceptor.java", "file_ext": "java", "file_size_in_byte": 1197, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "24d7e9f1ca70ace68a23f7fd36c604b1b7211b10", "star_events_count": 4, "fork_events_count": 40, "src_encoding": "UTF-8"} | https://github.com/hcsp/thread-local-bug | 183 | FILENAME: UserContextInterceptor.java | 0.276691 | package com.github.hcsp.service;
import com.github.hcsp.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
public class UserContextInterceptor implements HandlerInterceptor {
private final UserService userService;
@Autowired
public UserContextInterceptor(UserService userService) {
this.userService = userService;
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null) {
User user = userService.getUserByUsername(authentication.getName());
if (user != null) {
UserContext.setCurrentUser(user);
}
}
return true;
}
}
|
770fdfcc-bf98-43c0-ae4d-232851417063 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-05-20 01:44:03", "repo_name": "fangzi123/weixin", "sub_path": "/src/main/java/com/micro/rent/common/support/ShiroHelper.java", "file_name": "ShiroHelper.java", "file_ext": "java", "file_size_in_byte": 1103, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "1e8ae6afccf87c5185ac7b68a35b5ecfa8d00c93", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/fangzi123/weixin | 307 | FILENAME: ShiroHelper.java | 0.277473 | package com.micro.rent.common.support;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import com.micro.rent.biz.shiro.ShiroDbRealm.ShiroUser;
/**
* @Description shiro框架帮助类
* @author
* @date 2013-3-21
* @version 1.0
*/
public class ShiroHelper {
/**
* @Description 获取当前登录用户名称
* @return
* @author
*/
public static String getUsername(){
ShiroUser su = getShiroUser();
return su == null ? null : su.getUserName();
}
public static String getUserOrgCode() {
ShiroUser su = getShiroUser();
return su == null ? null : su.getOrgCode();
}
public static ShiroUser getShiroUser() {
return ShiroUser.class.cast(SecurityUtils.getSubject().getPrincipal());
}
public static Boolean hasSupplierRole() {
Subject sub = SecurityUtils.getSubject();
//供货商角色
if (sub.hasRole("100046")) {
return true;
}
return false;
}
public static Boolean hasAdmin() {
Subject sub = SecurityUtils.getSubject();
//创建角色
if (sub.hasRole("994")) {
return true;
}
return false;
}
}
|
8909220e-83f3-405d-b10a-3b0da93de3ed | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-26 12:45:45", "repo_name": "Team1425/zbdx", "sub_path": "/src/com/zb/servlet/WjDownexcelServlet.java", "file_name": "WjDownexcelServlet.java", "file_ext": "java", "file_size_in_byte": 1096, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "dae504db2fc4534ef3a5cf56c653dafbbed978bf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Team1425/zbdx | 217 | FILENAME: WjDownexcelServlet.java | 0.235108 | package com.zb.servlet;
import com.zb.utils.WjExcelPOI;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/wjdownexcel")
public class WjDownexcelServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//1.创建一个流,将生成的excel对象返回给浏览器让浏览器下载
ServletOutputStream out = response.getOutputStream();
//2.设置头文件
response.setHeader("Content-Disposition","attachment;fileName=booklist.xls");
//3.设置表头
String [] titles = {"编号","书名","作者","ISBN","出版社","价格","出版日期"};
//调用EXCELPOI里面的方法
WjExcelPOI wjExcelPOI = new WjExcelPOI();
wjExcelPOI.export(titles,out);
}
}
|
200a427c-6ccc-4e15-b492-35d33e4a9eee | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-03-21 16:52:13", "repo_name": "saksam/Campus_Recruitment", "sub_path": "/app/src/main/java/com/wix/traitsoft/tpo_mnnit/Graph_Draw.java", "file_name": "Graph_Draw.java", "file_ext": "java", "file_size_in_byte": 1087, "line_count": 74, "lang": "en", "doc_type": "code", "blob_id": "6cb2e557f1e95094318428480d1b4aa2f5ea1883", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/saksam/Campus_Recruitment | 269 | FILENAME: Graph_Draw.java | 0.295027 | package com.wix.traitsoft.tpo_mnnit;
/**
* Created by saksham_ on 12-Oct-17.
*/
public class Graph_Draw {
private int cse;
private int ece;
private int mech;
private int civil;
private int ee;
private int bio;
private int it;
private int chem;
Graph_Draw(int cse,int ece,int mech,int civil,int ee,int bio,int it,int chem)
{
this.cse = cse;
this.ece = ece;
this.mech = mech;
this.civil = civil;
this.ee = ee;
this.bio = bio;
this.it = it;
this.chem = chem;
}
public int getEe() {
return ee;
}
public int getCse() {
return cse;
}
public int getEce() {
return ece;
}
public int getChem() {
return chem;
}
public int getIt() {
return it;
}
public int getBio() {
return bio;
}
public int getCivil() {
return civil;
}
public int getMech() {
return mech;
}
}
|
6195a984-68f2-4805-b488-28d6288a59b6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-14 09:55:44", "repo_name": "ProFewGames/CustomStaff", "sub_path": "/src/main/java/xyz/ufactions/customstaff/file/LanguageFile.java", "file_name": "LanguageFile.java", "file_ext": "java", "file_size_in_byte": 1137, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "7abcfc0164db8790b35091151ce6081012f75173", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ProFewGames/CustomStaff | 232 | FILENAME: LanguageFile.java | 0.233706 | package xyz.ufactions.customstaff.file;
import org.bukkit.plugin.java.JavaPlugin;
public class LanguageFile extends FileHandler {
public enum Language {
ENGLISH("language_en.yml"),
SPANISH("language_es.yml");
private final String resourcePath;
Language(String resourcePath) {
this.resourcePath = resourcePath;
}
}
public enum LanguagePath {
NOPERM("no-permission"),
NOPLAYER("no-player"),
NOSTAFF("no-staff"),
STAFFLIST_HIDDEN("stafflist-hidden"),
STAFFLIST_VISIBLE("stafflist-visible"),
STAFFLIST_HEADER("stafflist-header"),
STAFFLIST_REPEATABLE("stafflist-repeatable"),
STAFFCHAT_ENABLED("staffchat-enabled"),
STAFFCHAT_DISABLED("staffchat-disabled");
private final String path;
LanguagePath(String path) {
this.path = path;
}
}
public LanguageFile(JavaPlugin plugin, Language language) {
super(plugin, language.resourcePath, "language.yml");
}
public String get(LanguagePath path) {
return getString(path.path);
}
} |
10049b68-0497-4690-8a8d-9fb3c92ff481 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-16 00:27:19", "repo_name": "tryup2021/yypp1", "sub_path": "/src/main/java/com/phome/yypp/service/impl/NumsServiceImpl.java", "file_name": "NumsServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1024, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "d81c9715b405f800bb0fc1c614749064865ad2cc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tryup2021/yypp1 | 231 | FILENAME: NumsServiceImpl.java | 0.278257 | package com.phome.yypp.service.impl;
import com.phome.yypp.dao.NumsMapper;
import com.phome.yypp.pojo.Nums;
import com.phome.yypp.service.NumsService;
import org.apache.logging.log4j.message.ReusableMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class NumsServiceImpl implements NumsService {
@Autowired
NumsMapper numsMapper;
@Override
public int saveNum(Nums nums) {
//先查
if (numsMapper.selectNum(nums).isEmpty()) {
return numsMapper.saveNum(nums);
}
return 0;
}
@Override
public int selectNum(Nums nums) {
List<Nums> nums1 = numsMapper.selectNum(nums);
if (nums1.isEmpty()){
return 0;
}else {
return 1;
}
}
@Override
public List<Nums> queryNum() {
return numsMapper.queryNum();
}
}
|
1c0d6a20-021d-46aa-aa95-c809b7a8ce3c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-05 20:32:02", "repo_name": "basme/staged_jpa_demo", "sub_path": "/src/test/java/com/netcracker/training/hibernate/demo/scenario/Stage3Stomach.java", "file_name": "Stage3Stomach.java", "file_ext": "java", "file_size_in_byte": 1087, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "d454663f786c123bf6ee8a14be0872a36c58a9f3", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/basme/staged_jpa_demo | 219 | FILENAME: Stage3Stomach.java | 0.286968 | package com.netcracker.training.hibernate.demo.scenario;
import com.netcracker.training.hibernate.demo.config.HibernateConfig;
import com.netcracker.training.hibernate.demo.model.Stomach;
import com.netcracker.training.hibernate.demo.service.repo.StomachRepo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
import javax.annotation.Resource;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = { HibernateConfig.class },
loader = AnnotationConfigContextLoader.class)
public class Stage3Stomach {
@Resource
private StomachRepo stomachRepo;
@Test
public void boomHappens() {
Stomach stomach = new Stomach();
stomach.setId(1);
stomach.setCapacity(10);
stomach.setActualUtilization(5);
stomachRepo.save(stomach);
stomach = stomachRepo.findById(1).get();
}
}
|
ef023d65-e18f-4547-a919-bd230225301c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-09 19:05:06", "repo_name": "SyedAzharAsghar/Jaxbook", "sub_path": "/app/src/main/java/com/jaxbook/Timeline/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1137, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "8e023895d7a37dd984fe21541bbd0a4857d49694", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/SyedAzharAsghar/Jaxbook | 211 | FILENAME: MainActivity.java | 0.256832 | package com.jaxbook.Timeline;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
private WebView webView;
private WebSettings webSettings;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView = findViewById(R.id.webview);
webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setDefaultFontSize(19);
webView.setWebViewClient(new Callback()); //HERE IS THE MAIN CHANGE
webView.loadUrl("https://jaxbook.com/");
}
private class Callback extends WebViewClient { //HERE IS THE MAIN CHANGE.
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return (false);
}
}
}
|
d7f1a23c-d9c2-41b9-8ea1-25caea9dd9d2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-27 12:45:29", "repo_name": "tsasfalvi/module7", "sub_path": "/src/main/java/st/service/SubscriptionFacade.java", "file_name": "SubscriptionFacade.java", "file_ext": "java", "file_size_in_byte": 965, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "6f4bd844d7c81d5a23619076704c220aa912f31a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tsasfalvi/module7 | 162 | FILENAME: SubscriptionFacade.java | 0.278257 | package st.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import st.dto.User;
import st.entity.BookEntity;
import st.entity.UserEntity;
import st.exception.SuspendedException;
import st.repository.BookRepository;
@Service
public class SubscriptionFacade {
@Autowired
private UserService userService;
@Autowired
private BookRepository bookRepository;
@Transactional
public User subscribe(long bookId) throws SuspendedException {
UserEntity currentUser = userService.getCurrentUser();
if (currentUser.isSuspended()) {
throw new SuspendedException("your account is suspended currently");
}
BookEntity bookEntity = bookRepository.findOne(bookId);
currentUser.getSubscriptions().add(bookEntity);
return userService.update(currentUser);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.