Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
36
36
meta
stringlengths
429
697
code_content
large_stringlengths
612
1.26k
52c3ead6-3710-4653-8586-87aa7ecef9bb
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-15 05:04:05", "repo_name": "Meiguangya/think", "sub_path": "/src/file/FindDffFile.java", "file_name": "FindDffFile.java", "file_ext": "java", "file_size_in_byte": 1242, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "507449a1dd727d066d58122a96d4d2371bbc3fad", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package file; import java.io.File; import java.util.HashSet; import java.util.Set; public class FindDffFile { public static void main(String[] args) { File file1 = new File("/Users/meiguangya/Downloads/对比/1/web/WEB-INF/lib"); File file2 = new File("/Users/meiguangya/Downloads/对比/2/web/WEB-INF/lib"); if(file1.isDirectory()){ File[] files = file1.listFiles(); File[] files2 = file2.listFiles(); Set<String> file1Names = new HashSet<>(); for (File file : files) { file1Names.add(file.getName()); } System.out.println(file1Names.size()); for (File file : files2) { if(file1Names.contains(file.getName())){ if(file.getName().contains("shiro-lang")){ System.out.println(file.getName()); } file1Names.remove(file.getName()); } } System.out.println(file1Names.size()); file1Names.forEach(e-> System.out.println(e)); } } //commons-logging-1.1.1.jar //commons-lang-2.5.jar //commons-logging-1.0.4.jar //commons-lang-2.3.jar }
402635ac-0479-4f03-91e1-7965025f53a0
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-01 03:24:35", "repo_name": "Helen403/HelenTime", "sub_path": "/app/src/main/java/HConstants/HConstants.java", "file_name": "HConstants.java", "file_ext": "java", "file_size_in_byte": 1252, "line_count": 60, "lang": "en", "doc_type": "code", "blob_id": "4583c944abf67d8c1f4ab0c15127dc67478b61cb", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package HConstants; /** * Created by SNOY on 2017/5/13. */ public interface HConstants { String url = "http://192.168.1.131:8080/timeLang/"; String url_man = "http://192.168.1.188:8080/timeLang/"; /** * Eventbus 常量 */ interface EVENT { int HOMEREFRESH = 0; int LOGINACTIVITY_CLOSE = 1; } interface URL { //验证码 String VER = url + "existsUser"; //注册 String Register = url + "saveUser"; //登录 String LOGIN = url + "userLogin"; String Weather = url + "weather"; String historyToday = url + "historyToday"; String saveRemind = url_man + "saveRemind"; String findFriendList = url + "findFriendList"; String updateRegId = url + "updateRegId"; String uploadFile = url + "uploadFile"; String uploadPhoto = url + "uploadPicFile"; String saveUser = url + "saveUser"; } interface KEY { String UserId = "userId"; String RegId = "regId"; String QQnickName = "QQnickName"; String QQfigureurl = "QQfigureurl"; String QQgender = "QQgender"; String QQcity = "QQcity"; String QQopenid = "QQopenid"; } }
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"}
# google-books ![App Screenshot](/client/public/screenshot.png) ### 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/
99ec1343-6d08-4d8a-a5f5-b2e4de3c51b1
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-07 07:12:09", "repo_name": "geek0108/LauncherModules", "sub_path": "/FileAuthSystem_module/src/main/java/pro/gravit/launchermodules/fileauthsystem/providers/FileSystemUserDAO.java", "file_name": "FileSystemUserDAO.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "53ff9a4eb0138744f9947d50939816a5ec1a5032", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package pro.gravit.launchermodules.fileauthsystem.providers; import pro.gravit.launchermodules.fileauthsystem.FileAuthSystemModule; import pro.gravit.launchserver.dao.User; import pro.gravit.launchserver.dao.UserDAO; import java.util.ArrayList; import java.util.List; import java.util.UUID; public class FileSystemUserDAO implements UserDAO { private final FileAuthSystemModule module; public FileSystemUserDAO(FileAuthSystemModule module) { this.module = module; } @Override public User findById(int id) { throw new UnsupportedOperationException(); } @Override public User findByUsername(String username) { return module.getUser(username); } @Override public User findByUUID(UUID uuid) { return module.getUser(uuid); } @Override public void save(User user) { module.addUser((FileAuthSystemModule.UserEntity) user); } @Override public void update(User user) { // None } @Override public void delete(User user) { module.deleteUser((FileAuthSystemModule.UserEntity) user); } @Override public List<User> findAll() { return new ArrayList<>(module.getAllUsers()); } }
0341172f-4102-4ed1-b38e-4722b6a73b92
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-11-16 07:44:40", "repo_name": "dzfg/mybatis", "sub_path": "/src/main/java/a/entity/Emp.java", "file_name": "Emp.java", "file_ext": "java", "file_size_in_byte": 1243, "line_count": 74, "lang": "en", "doc_type": "code", "blob_id": "2cb6db0e5b2fcd7b1a7b738bb41060a1a5481fb6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package a.entity; import java.io.Serializable; @SuppressWarnings("serial") public class Emp implements Serializable { private String id; private String name; private String gender; private Double salary; // 所属部门 private Dept dept; public Emp() { } public Emp(String id, String name, String gender, Double salary, Dept dept) { super(); this.id = id; this.name = name; this.gender = gender; this.salary = salary; this.dept = dept; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public Double getSalary() { return salary; } public void setSalary(Double salary) { this.salary = salary; } public Dept getDept() { return dept; } public void setDept(Dept dept) { this.dept = dept; } @Override public String toString() { return "Emp [id=" + id + ", name=" + name + ", gender=" + gender + ", salary=" + salary + ", dept=" + dept + "]"; } }
d8705f76-aabb-4e5a-b62e-f33a92156cfb
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-10 16:39:26", "repo_name": "shash222/IntroToCS_Assignments", "sub_path": "/Compress.java", "file_name": "Compress.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "0570d2512d882139a8d73ce43ab45a714a7dec6f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
import java.io.*; public class Compress{ public static String compress(String original){ int length=original.length(); String compressed=""; int count=1; char letter=original.charAt(0); int letternumber=1; do{ while(original.charAt(letternumber)==original.charAt(letternumber-1)){ count++; if (letternumber<(length-1)){ letternumber++; } else if (letternumber==(length-1)){ break; } } if (count==1){ compressed=compressed+letter; } else{ compressed=compressed+count+letter; } letter=original.charAt(letternumber); count=1; letternumber++; }while(letternumber<length); if (count==1&&original.charAt(length-1)!=original.charAt(length-2)){ compressed=compressed+letter; } return compressed; } public static void main(String[] args){ String original=IO.readString(); String compressed=compress(original); System.out.println(compressed); } }
cf2f76cb-9234-4aa7-949d-36e1ba708cd9
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-10 01:18:25", "repo_name": "kxgao9/DiscordBot", "sub_path": "/src/main/java/li/jeffrey/events/VerifyEvent.java", "file_name": "VerifyEvent.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "ddebfaabb73c0ae4a8152e40696bf7ff52623aec", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package li.jeffrey.events; import java.util.List; import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.events.message.react.GenericMessageReactionEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; public class VerifyEvent extends ListenerAdapter { private JDA jda; private String prefix; public VerifyEvent(JDA jda, String prefix) { this.jda = jda; this.prefix = prefix; } public void onGenericMessageReaction(GenericMessageReactionEvent event) { try { if (!event.getChannel().getName().equals("verify") || event.getUser().isBot()) return; List<Role> memberRoleNames = event.getGuild().getRolesByName("Member", true); Role member = null; for (Role i : memberRoleNames) { if (i.getName().toLowerCase().equals("member")) { member = i; break; } } event.getGuild().addRoleToMember(event.getMember().getId(), member).complete(); event.getReaction().removeReaction(event.getUser()).complete(); } catch (Exception e) { return; } } }
7cd2b68b-b825-48ab-a875-fdceb0bbc2c7
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-01-30T02:21:36", "repo_name": "badlychadly/daily-trending-apps-cli-gem", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1234, "line_count": 40, "lang": "en", "doc_type": "text", "blob_id": "8e37093fc171eb9c63f7cca75d1cd26fcff76bda", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
# Daily::Trending::Apps This is a ruby CLI Gem that displays a list of new and updated apps froms the Google Play Store, follow CLI instructions to learn more about the apps that interest you. ## Installation Add this line to your application's Gemfile: ```ruby gem 'daily-trending-apps' ``` And then execute: $ bundle Or install it yourself as: $ gem install daily-trending-apps ## Usage Type the following command to start this gem $ daily-trending-apps ## Development After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/'badlychadly'/daily-trending-apps. ## License The gem is available as open source under the terms of the [Mit License](http://opensource.org/licenses/MIT).
568012be-ed38-4e1e-a32f-29aff08e6c43
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-10 03:54:25", "repo_name": "yrd47/java_learn", "sub_path": "/Work_training/TestNGListener/src/main/java/testnglistener/model/StackTrace.java", "file_name": "StackTrace.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "037550e102320577571c8042be3c01a00f1d3fbd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package testnglistener.model; /** * Created by yrd on 2017/5/24. */ public class StackTrace { private String declaringClass; private String methodName; private String fileName; private String lineNumber; public StackTrace() { super(); } public StackTrace(String declaringClass, String methodName, String fileName, String lineNumber) { super(); this.declaringClass = declaringClass; this.methodName = methodName; this.fileName = fileName; this.lineNumber = lineNumber; } public String getDeclaringClass() { return declaringClass; } public void setDeclaringClass(String declaringClass) { this.declaringClass = declaringClass; } public String getMethodName() { return methodName; } public void setMethodName(String methodName) { this.methodName = methodName; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public String getLineNumber() { return lineNumber; } public void setLineNumber(String lineNumber) { this.lineNumber = lineNumber; } }
6c605287-4cec-4ebd-b190-8f79898d66df
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2012-02-18 07:50:23", "repo_name": "hehahovip/mygapps", "sub_path": "/Demo/src/com/hehaho/googleapp/demo/jdo/Person.java", "file_name": "Person.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 79, "lang": "en", "doc_type": "code", "blob_id": "924c693e430cfc6c9d539723b7bdc2ab496a4c5e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
/** * */ package com.hehaho.googleapp.demo.jdo; import java.util.Date; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.IdentityType; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; /** * @author Kevin.Wang * */ @PersistenceCapable(identityType=IdentityType.APPLICATION) public class Person { @PrimaryKey @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY) private String id; @Persistent private String name; @Persistent private int age; @Persistent private Date createDate; @Persistent private Date modifyDate; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public Date getCreateDate() { return createDate; } public void setCreateDate(Date createDate) { this.createDate = createDate; } public Date getModifyDate() { return modifyDate; } public void setModifyDate(Date modifyDate) { this.modifyDate = modifyDate; } }
5101fb37-0fc1-481e-8abb-8fee9cdb7023
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-14 06:12:20", "repo_name": "18600165064/operation", "sub_path": "/src/main/java/com/data/display/model/dto/DataTableDTO.java", "file_name": "DataTableDTO.java", "file_ext": "java", "file_size_in_byte": 1282, "line_count": 73, "lang": "en", "doc_type": "code", "blob_id": "0b3e21459f6c9ada82b8053e5fcde786ad5e1ac8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.data.display.model.dto; import java.util.List; import java.util.Map; /** * @Author: CYN * @Date: 2019/1/23 11:16 * @Description: dataTable 分页封装 */ public class DataTableDTO { /** * 排序 */ private List<Map<String,String>> order; /** * 前端传入直接返回 */ private Integer draw; /** * 数量 */ private Integer start; /** * 每页显示数量 */ private Integer length; /** * 页数 */ private Integer pageNum; public Integer getPageNum() { if(start==0){ return 1; } return start/length+1; } public List<Map<String, String>> getOrder() { return order; } public void setOrder(List<Map<String, String>> order) { this.order = order; } public DataTableDTO() { } public Integer getDraw() { return draw; } public void setDraw(Integer draw) { this.draw = draw; } public Integer getStart() { return start; } public void setStart(Integer start) { this.start = start; } public Integer getLength() { return length; } public void setLength(Integer length) { this.length = length; } }
cc69ca55-89b6-41b3-8b91-273fffe881bb
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-17 13:44:35", "repo_name": "AKrupaa/home-page-spring-boot", "sub_path": "/src/main/java/krupinski/arkadiusz/home/services/CustomUserRoleServiceImpl.java", "file_name": "CustomUserRoleServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "b92ed32a854d47b1f3b916c7b3474b74c33f722e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package krupinski.arkadiusz.home.services; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import krupinski.arkadiusz.home.models.CustomUserRole; import krupinski.arkadiusz.home.repositories.CustomUserRoleRepository; import javax.transaction.Transactional; import java.util.List; import java.util.Optional; @Service @Transactional public class CustomUserRoleServiceImpl implements CustomUserRoleService { CustomUserRoleRepository customUserRoleRepository; @Autowired public CustomUserRoleServiceImpl(CustomUserRoleRepository customUserRoleRepository) { this.customUserRoleRepository = customUserRoleRepository; } @Override public List<CustomUserRole> listUserRoles() { return customUserRoleRepository.findAll(); } @Override public void addUserRole(CustomUserRole userRole) { Optional<CustomUserRole> findByRole = customUserRoleRepository.findByRole(userRole.getRole()); if (!findByRole.isPresent()) customUserRoleRepository.save(userRole); } @Override public Optional<CustomUserRole> getUserRole(long id) { return customUserRoleRepository.findById(id); } }
8dea7686-5427-497e-8b0a-1439b6569577
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-19 09:52:53", "repo_name": "Tobin2020/TobinStudy", "sub_path": "/basicLib/src/main/java/top/tobin/basic/base/BaseNoModelActivity.java", "file_name": "BaseNoModelActivity.java", "file_ext": "java", "file_size_in_byte": 1330, "line_count": 62, "lang": "zh", "doc_type": "code", "blob_id": "b1eb614d2ee9c6126af463b52a4eb4372e66fe45", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"}
package top.tobin.basic.base; import android.content.Context; import androidx.appcompat.app.AppCompatActivity; import com.gyf.immersionbar.ImmersionBar; import top.tobin.basic.common.ActivityCollector; /** * 不需要ViewModel的页面基类 */ public abstract class BaseNoModelActivity extends AppCompatActivity { protected Context context; @Override protected void onCreate(@androidx.annotation.Nullable android.os.Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = this; ActivityCollector.getInstance().addActivity(this); setContentView(onCreate()); initView(); initData(); initImmersionBar(); } /** * 初始化沉浸式 * Init immersion bar. */ protected void initImmersionBar() { ImmersionBar.with(this).init(); } /** * 初始化要加载的布局资源ID * 此函数优先执行于onCreate()可以做window操作 */ protected abstract int onCreate(); /** * 初始化视图 */ protected abstract void initView(); /** * 初始化数据 */ protected abstract void initData(); @Override protected void onDestroy() { ActivityCollector.getInstance().removeActivity(this); super.onDestroy(); } }
bbe1c9e0-83cd-4aee-b6fa-e097dd04346d
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-12 05:17:35", "repo_name": "leozhangsr/kafka-toolkit", "sub_path": "/offset-kit/src/main/java/com/bigdatalighter/kafka/offset/monitor/LoggingOffsetStateObserver.java", "file_name": "LoggingOffsetStateObserver.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 27, "lang": "en", "doc_type": "code", "blob_id": "abac861eb6753e348b376e8e6944b69bce754f59", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.bigdatalighter.kafka.offset.monitor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author: Leo Zhang([email protected]) **/ public class LoggingOffsetStateObserver extends AbsConsumerOffsetStateObserver { private Logger logger = LoggerFactory.getLogger(LoggingOffsetStateObserver.class); @Override protected void doCaughtUp(ConsumerOffsetState offsetState, ConsumerOffsetState.StateInfo stateInfo) { logger.info("Consumer[{}:{}] has caught up to target offset;", offsetState.getGroup(), offsetState.getTopic()); } @Override protected void doDelay(ConsumerOffsetState offsetState, ConsumerOffsetState.StateInfo stateInfo) { logger.warn("Consumer[{}:{}] has fallen behind target offset.Difference:{}.", offsetState.getGroup(), offsetState.getTopic(), stateInfo.getTotalDifference()); logger.warn("Partition\tCurrent offset\tConsumer offset\tDifference"); for (ConsumerOffsetState.PartitionOffsetDifference difference : stateInfo.getDifferences()) { logger.warn("{} \t {} \t {} \t {}", difference.getPartitionId(), difference.getCurrentOffset(), difference.getTargetOffset(), difference.getDifference()); } } }
14012f7e-a213-4b0e-89c5-249cce1aa064
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-17 15:12:55", "repo_name": "abdasik25/OneMusic", "sub_path": "/src/by/epam/onemusic/entity/Author.java", "file_name": "Author.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 62, "lang": "en", "doc_type": "code", "blob_id": "4148e6ec05b8e551fe17eba5fdb4a544b874e721", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
/** * Created by Alexander Lomat on 13.05.19 * version 0.0.1 */ package by.epam.onemusic.entity; import java.util.Objects; public class Author extends Entity { private String name; private String country; public Author(){ } public Author(long id, String name, String country) { super(id); this.name = name; this.country = country; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Author)) return false; Author author = (Author) o; return name.equals(author.name) && Objects.equals(country, author.country); } @Override public int hashCode() { return Objects.hash(name, country); } @Override public String toString() { return "Author{" + "name='" + name + '\'' + ", country='" + country + '\'' + '}'; } }
c5d38aef-2085-4895-9c72-1fbcdc7b6c2e
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-10-20T11:15:38", "repo_name": "RoelN/Color-Variable-Emoji", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1237, "line_count": 16, "lang": "en", "doc_type": "text", "blob_id": "08d866238a40605cd44e226e68c56ebed8903b8b", "star_events_count": 18, "fork_events_count": 0, "src_encoding": "UTF-8"}
# Color Variable Emoji This is an experimental, one-character variable color font. It contains only one character, the poo emoji 💩. It has one axis, "crap", which goes from 100 to 900. You can see [Mr. Poo in action here](https://pixelambacht.nl/demo/mrpoo/)! If he's all black and/or doesn't animate, your browser doesn't fully support variable color fonts yet. ## Where does it work? Your browser needs to support variable fonts _and_ color fonts of the COLR/CPAL format. Currently this is only Safari 11 and Chrome 62 on OS X High Sierra. ## Building the font It's a bit messy, but: build the ufo files in the source directory, then inject COLR/CPAL tables by running `scripts/pathcolorcpal.sh` (source found in `scripts/colr-cpal-tables.ttx`). Then, uhm, dump the font with ttx/FontTools and hack away until it's working. These are lousy instructions, I know, but the truth is I've been hacking at this on-and-off for the past months and I forgot the exact path to the current VariablePooDemo.ttf file. But I'm more than willing to work out problems or answer your questions (even dumb ones (_especially_ dumb ones)), so ping me at [my site](https://pixelambacht.nl) or over at [Twitter](https://twitter.com/pixelambacht).
0bd02794-88ea-4c92-8eb0-c334e3559911
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-04-09 11:21:03", "repo_name": "grarenla/ass_javaservlet", "sub_path": "/src/filter/ManageFilter.java", "file_name": "ManageFilter.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "cc474d8ff0012d6760cc926a3f468b17d2198f2e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package filter; import entity.User; import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; public class ManageFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; HttpSession httpSession = httpServletRequest.getSession(); User user = (User) httpSession.getAttribute("user"); if (user == null) user = new User(); String role = user.getRole(); if (role == null) role = ""; if (!role.equals("admin")) { HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse; httpServletResponse.sendRedirect("/Assignment_war_exploded/unauthorized"); } else { filterChain.doFilter(servletRequest, servletResponse); } } @Override public void destroy() { } }
7d4dd9b1-d980-4b6f-a8c4-740cba6d4a05
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-10 11:15:29", "repo_name": "Zxobi/andersenlab", "sub_path": "/bookstorageweb/src/test/java/com/andersenlab/bookstorageweb/PublishingHouseRepositoryIntegrationTest.java", "file_name": "PublishingHouseRepositoryIntegrationTest.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "2a94881683f9fc158b48bd4249963ec48123972f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.andersenlab.bookstorageweb; import com.andersenlab.bookstorageweb.entity.PublishingHouse; import com.andersenlab.bookstorageweb.repository.PublishingHouseRepository; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.assertj.core.api.Assertions.assertThat; @ExtendWith(SpringExtension.class) @DataJpaTest public class PublishingHouseRepositoryIntegrationTest { @Autowired private TestEntityManager entityManager; @Autowired private PublishingHouseRepository publishingHouseRepository; @Test public void testFindById() { PublishingHouse publishingHouse = new PublishingHouse("publishing house name"); entityManager.persist(publishingHouse); entityManager.flush(); assertThat( publishingHouseRepository.findById(publishingHouse.getId()).get().getName() ).isEqualTo("publishing house name"); } }
8db3406f-83a3-4bcf-8c2c-f8f18ffff678
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-25 06:12:58", "repo_name": "Minenash/Rear-View-Window", "sub_path": "/src/main/java/net/fabricmc/example/ExampleMod.java", "file_name": "ExampleMod.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "6d9600bbb8e801f06ec8967d8cfa50ae50c702c3", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"}
package net.fabricmc.example; import com.raphydaphy.breakoutapi.BreakoutAPIClient; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; import net.minecraft.client.option.KeyBinding; import net.minecraft.client.util.InputUtil; import net.minecraft.util.Identifier; import org.lwjgl.glfw.GLFW; public class ExampleMod implements ModInitializer { public static final Identifier REAR_VIEW_BREAKOUT = new Identifier("rearview", "breakout"); public static boolean isRearViewOpen = false; public static final KeyBinding TOGGLE_BREAKOUT = KeyBindingHelper.registerKeyBinding(new KeyBinding( "Toggle RearView", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_G, "key.categories.misc")); @Override public void onInitialize() { ClientTickEvents.END_CLIENT_TICK.register(client -> { while (TOGGLE_BREAKOUT.wasPressed()) { boolean isOpen = BreakoutAPIClient.getBreakouts().containsKey(REAR_VIEW_BREAKOUT); if (isOpen) BreakoutAPIClient.closeBreakout(REAR_VIEW_BREAKOUT); else BreakoutAPIClient.openBreakout(new RearViewBreakout()); isRearViewOpen = !isOpen; } }); } }
eb762fbb-5b03-4770-ae55-d02c0d636c46
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-11-16T15:08:38", "repo_name": "krishgb/python-scripts", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1234, "line_count": 52, "lang": "en", "doc_type": "text", "blob_id": "4c9a4875a7a6412fe8f2b0b8b0d7cf153f5e1b41", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
1. page_remover.py This script is used to remove pages from a pdf file by using PyPDF2 library. It keeps both the original pdf file and the modified pdf file. To run this script you have to download PyPDF2 library. In Terminal run "pip3 install PyPDF2" command. Run this command in terminal "python page_remover.py". The script prompts 3 inputs: 1st Prompt: The name of the pdf file from which the pages are going to be removed. 2nd Prompt: Give a name to get the pdf with removed pages. 3rd Prompt: Enter the pages that have to be removed from the given pdf. Example: 10 20 Give space between the page numbers. --- 2. pdf_merger.py This script is used to merge pdf files by using PyPDF2 library. To run this script you have to download PyPDF2 library. In Terminal run "pip3 install PyPDF2" command. Run this command in terminal "python pdf_merger.py". It list the pdf files in numerical order. Enter the indexes of the pdf files to be merged. Like: 1 3 Enter a name to a merged file wihtout ".pdf" extension --- 3. png_converter.py This script is used to convert the jpg or jpeg image formats in a directory to png image formats in another directory. (silly script. just for fun.) Created using PIL library.
f02c37eb-e83a-4d04-898a-63582c394d30
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-22 14:15:08", "repo_name": "1455364690/AlgorithmReview", "sub_path": "/src/字符串/字符串最大不重复子串.java", "file_name": "字符串最大不重复子串.java", "file_ext": "java", "file_size_in_byte": 1260, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "fa6ae94eef1b1b65f6a3d4239c882cdee66f2185", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package 字符串; import java.util.HashMap; /** * @author sunjh * @date 2020/3/16 10:42 */ public class 字符串最大不重复子串 { public static void main(String[] args) { System.out.println(longSubStr("ab")); } public static String longSubStr(String s) { int i = 0; int j = 0; String max = ""; int maxLen = 0; HashMap<Character, Integer> map = new HashMap<>(); while (i < s.length() && j < s.length()) { if (i == j) { if (maxLen == 0) { map.put(s.charAt(i), 1); maxLen = 1; max = s.substring(i, j + 1); } j++; } else if (!map.containsKey(s.charAt(j))) { map.put(s.charAt(j), 1); if (j - i + 1 > maxLen) { maxLen = j - i + 1; max = s.substring(i, j + 1); } j++; } else { map.remove(s.charAt(i)); i++; if (i<s.length()){ map.put(s.charAt(i), 1); } } } System.out.println(maxLen); return max; } }
11bff548-6dad-4332-a191-88e9e98082c3
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2015-04-03T16:29:35", "repo_name": "Ekultek/ruby_practice_theOdinProject", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1253, "line_count": 32, "lang": "en", "doc_type": "text", "blob_id": "2953c6a5b893af1c568638d9f0afa570b73f3932", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"}
theOdinProject ============== http://www.theodinproject.com/ assignments <ul> <li> binary_search_trees: binary trees, depth-first search, breadth-first search </li> <li>chess: two-player chess game in ruby </li> <li>connect_four: two-player connect_four game in ruby </li> <li>event_manager: Working with file inputs/outputs, populating templates </li> <li>google_homepage: HTML/CSS exercise: creating google home appearance</li> <li>hangman: Play hangman against the computer, ruby </li> <li>jumpstart_labs_blogger_app: Rails blogger application </li> <li>knights_travails: Finds fastest path from A to B for knight on chessboard </li> <li>mastermind: Play mastermind against the PC </li> <li>microreddit: Small rails app with user, post, and comment models </li> <li>re-former: Forms project </li> <li>recursion: Exercises in recursion: fibonacci and merge-sorting </li> <li>ruby_building_blocks: Exercises in ruby Enumerable methods </li> <li>sample_app "Sample application from Michael Hartl tutorial" <li>sketchpad: Javascript/jQuery sketchpad in browser </li> <li>sockets: Web server/browser from the command line </li> <li>testfirst-ruby: Exercises in rspec </li> <li>tic_tac_toe: Two-player tic-tac-toe in Ruby </li> </ul>
c7e0407e-1460-4c29-8388-dcf92a7237a5
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-20 06:28:28", "repo_name": "maopanpan/xjp.app", "sub_path": "/xjp.app/src/test/java/com/xjp/app/example/SysUserTest.java", "file_name": "SysUserTest.java", "file_ext": "java", "file_size_in_byte": 1270, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "f4d5a8d5d4bcfb13a6b1ae4bcbb1edad31acc0af", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.xjp.app.example; import com.alibaba.fastjson.JSON; import com.xjp.app.BaseTest; import com.xjp.app.common.interceptor.pageinterceptor.Page; import com.xjp.app.model.example.SysUser; import com.xjp.app.service.example.UserService; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import java.util.HashMap; import java.util.Map; /** * @Author: maopanpan * @Description: 单元测试样例 * @Date: 2017/10/17. **/ public class SysUserTest extends BaseTest { private Logger logger = LoggerFactory.getLogger(SysUserTest.class); @Autowired UserService userService; @Test public void findUserById() { Map<String, Object> params = new HashMap<>(); params.put("id", 2); SysUser sysUser = userService.findById(params); Assert.assertNotNull(sysUser); logger.info("测试结果为:{}", JSON.toJSONString(sysUser)); } @Test(timeout = 1000) public void findPage() { Page<SysUser> page = userService.findPage(new Page<SysUser>(), new SysUser()); Assert.assertNotNull(page); logger.info("测试结果为:{}", JSON.toJSONString(page)); } }
5c2a48e1-83d1-4b3f-bf2a-c66736b490c2
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-14 14:45:58", "repo_name": "KvalitetsIT/oioidws-public", "sub_path": "/oioidws-xua-scenarios/sts/src/main/java/dk/sds/sts/providers/AuthClaimsHandler.java", "file_name": "AuthClaimsHandler.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "122ab80b38806af464680a120f72382969257648", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package dk.sds.sts.providers; import java.net.URI; import java.util.ArrayList; import java.util.List; import org.apache.cxf.rt.security.claims.Claim; import org.apache.cxf.rt.security.claims.ClaimCollection; import org.apache.cxf.sts.claims.ClaimsHandler; import org.apache.cxf.sts.claims.ClaimsParameters; import org.apache.cxf.sts.claims.ProcessedClaim; import org.apache.cxf.sts.claims.ProcessedClaimCollection; public class AuthClaimsHandler implements ClaimsHandler { private static List<URI> knownURIs = new ArrayList<>(); private static final URI AUTH_CLAIM = URI.create("http://docs.oasis-open.org/wsfed/authorization/200706/authclaims"); static { knownURIs.add(AUTH_CLAIM); } public List<URI> getSupportedClaimTypes() { return knownURIs; } public ProcessedClaimCollection retrieveClaimValues(ClaimCollection claims, ClaimsParameters parameters) { if (claims != null && !claims.isEmpty()) { ProcessedClaimCollection claimCollection = new ProcessedClaimCollection(); for (Claim requestClaim : claims) { ProcessedClaim claim = new ProcessedClaim(); claim.setClaimType(requestClaim.getClaimType()); claimCollection.add(claim); } return claimCollection; } return null; } }
57079125-c0d9-414d-a022-5a5ea3fa05c8
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-17 20:58:31", "repo_name": "chvishal182/Timetables_Notification", "sub_path": "/TimeTable_S/app/src/main/java/com/cvishaldev/timetable_s/Edit.java", "file_name": "Edit.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "7d78577924d03735888fc5fe6baa1dbd0003209a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.cvishaldev.timetable_s; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; public class Edit extends AppCompatActivity { Button askEdit; Intent toReceiveIn; String toSendTopic; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit); toReceiveIn = getIntent(); toSendTopic = toReceiveIn.getStringExtra("userToken"); askEdit = findViewById(R.id.btnAskEdit); askEdit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(),toSendTopic,Toast.LENGTH_LONG).show(); fcmSender sender = new fcmSender(toSendTopic, "SWC_TimeTables", "Change waiting for Approval", Edit.this, Edit.this); sender.sendNotifications(); } }); } }
86c8a989-959e-40ce-af5f-63ac2f2c9b7f
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-14 08:36:29", "repo_name": "StepanMelnik/MultiThreading_Examples", "sub_path": "/src/main/java/com/sme/multithreading/model/DelayedMessage.java", "file_name": "DelayedMessage.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "fee1bad49cff1a01d74731925a28e04dbf273ce4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.sme.multithreading.model; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; /** * Provides POJO message with delay option. */ public final class DelayedMessage extends Message { private final int id; private final int delay; public DelayedMessage(int id, int delay, String message) { super(message); this.id = id; this.delay = delay; } public int getId() { return id; } public int getDelay() { return delay; } @Override public void setMessage(String message) { throw new UnsupportedOperationException("Immutable object does not allow to change a state"); } @Override public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } @Override public boolean equals(Object obj) { return EqualsBuilder.reflectionEquals(this, obj); } @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); } }
d21c86b9-355e-4201-aafe-247c9c4235b0
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-12-27T16:18:41", "repo_name": "Thanoskaloudis/travel-app", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1233, "line_count": 46, "lang": "en", "doc_type": "text", "blob_id": "1d3ab9f1305b652873d0dd728c52301f0affc66b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
# Travel App This project aims to build a web app that allows users to create trip plans. When a user submit a city name with trip date, the web page then dispalys destination with its photo and 3-day weather forecast returned from external APIs. ([GeoNames API](http://www.geonames.org/), [OpenWeather](https://openweathermap.org/), [pixabay](https://pixabay.com/api/docs/#)) ## Installation 1. Install npm packages ``` npm install ``` 2. Sign up for API keys at: * [GeoNames API](http://www.geonames.org/) * [OpenWeather](https://openweathermap.org/) * [pixabay](https://pixabay.com/api/docs/#) 3. Configure environment variables using dotenv package: 1. Install the dotenv package ``` npm install dotenv ``` 2. Create a new `.env` file in the root of your project 3. Fill the `.env` file with your API keys like this: ``` GUSERNAME=************************** WAPIKEY=************************** PAPIKEY=************************** ``` 4. Start project Command | Action :------------: | :-------------: `npm run build-prod` | Build project `npm start` | Run project 5. Open browser at http://localhost:8081/ ## Building Tools * HTML * CSS (SCSS) * JavaScript * Node * Express * Webpack * Jest (Unit test) * Workbox
a2174a50-58f3-4033-a333-bc19088aa6dd
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-23 02:49:35", "repo_name": "DiegogcFD/Android-Projects", "sub_path": "/NoteApp/app/src/main/java/com/diego/noteapp/NoteActivity.java", "file_name": "NoteActivity.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "208d164701099d4706093a5830a9f7fd22177fe2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.diego.noteapp; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.widget.EditText; public class NoteActivity extends AppCompatActivity { EditText editText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_note); editText = findViewById(R.id.editText); Intent intent = getIntent(); final int noteId = intent.getIntExtra("noteId", -1); if(noteId == -1) { editText.setText(MainActivity.notes.get(noteId)); } editText.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable text) { } public void beforeTextChanged(CharSequence text, int start, int count, int after) { } public void onTextChanged(CharSequence text, int start, int before, int count) { MainActivity.notes.set(noteId, String.valueOf(text)); MainActivity.arrayAdapter.notifyDataSetChanged(); } }); } }
175fe099-839a-48d7-8aa1-38d899caa3e5
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-28 11:16:57", "repo_name": "icecoldgeiten/nerdy-delivery", "sub_path": "/src/main/java/org/openjfx/Sidebar.java", "file_name": "Sidebar.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "48e30627c25acb95894817d7c96813e4a36f964a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package org.openjfx; import com.dao.AdminDao; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.input.MouseEvent; import javafx.scene.layout.BorderPane; import java.io.IOException; import java.util.Objects; public class Sidebar { private static String page; @FXML public BorderPane main; public Label user; public Button logout; @FXML private void initialize() throws IOException { load(Objects.requireNonNullElse(page, "admin_home")); user.setText(AdminDao.getAdmin()); } @FXML public void home() throws IOException { load("admin_home"); } @FXML public void routes() throws IOException { load("routes"); } @FXML public void drivers() throws IOException { load("manage_driver"); } @FXML public void logout() throws IOException { AdminDao.setAdmin(null); App.setRoot("start_screen"); } public void load(String fxml) throws IOException { main.setCenter(App.loadFXML(fxml)); } //Setters public static void setPage(String page) { Sidebar.page = page; } }
6407eb35-796e-42b1-b23d-07e6072c615c
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-04-16T09:59:59", "repo_name": "Uraharadono/EFCoreCodeFirstPostgressBoilerplate", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1233, "line_count": 24, "lang": "en", "doc_type": "text", "blob_id": "b6a083ab2b868069fbff272a1882d88399725298", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
# Entity Framework Core 3.1 - Code First - Postgress Boilerplate Boilerplate project for quick-start of EntityFrameworkCore CodeFirst approach with Postgress database ## Solution contents: Solution contains 2 projects in it: - 1st one contains only EFCore and functionalities to get quickstart with the setting up database. - 2nd one contains contents of 1st project regarding database setup along with Unit of Work and Repository patterns. There is big TODO regarding 2nd project, regarding me not knowing and Microsoft refusing to put resolve logic for properties contained in BaseController. So for now, you have to inject in every controller you are using Unit of Work. ### Setup: 1. Clone/download project 2. Restore (or just build) npm packages 3. Change connection string in "appsettings.json" to your creds 4. Open PM (Package Manager) Console: - Run command "Add-Migration InitialMigration" - Run command "Update-Database" 5. Database should be created 6. Run one of the projects depending on your choosing and start making requests. ** If you are new to development, and just want to see what this is all about, for methods of type POST (that post some data) you should use something like Postman to make requests
f52ff38d-e7ed-451b-8f04-a49f6f44f7c1
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-11 16:18:30", "repo_name": "Balvee/Reimbursement-System", "sub_path": "/src/main/java/com/balvee/servlets/AuthFilter.java", "file_name": "AuthFilter.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "4780034cad74cbfa3801f5008908b34ab0eb3a94", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.balvee.servlets; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class AuthFilter implements Filter { // Override @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest)request; HttpServletResponse res = (HttpServletResponse) response; String authHeader = req.getHeader("Authorization"); if(authHeader == null) { res.setStatus(401); return; } else { // Bearer token String token = authHeader.substring("Bearer ".length()); Claims claims = Jwts.parser() .setSigningKey("mySecret".getBytes("UTF-8")) .parseClaimsJws(token).getBody(); } chain.doFilter(request, response); } // doFilter @Override public void destroy() { } } // AuthFilter
fd3c6716-7eea-4955-af87-187f95cd3211
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-07 07:59:59", "repo_name": "xiaofeng613n/sample-rpc", "sub_path": "/src/main/java/com/rpc/client/HttpClientInitializer.java", "file_name": "HttpClientInitializer.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "700ebb70f3330867a04f87cd4f4b17471229fa71", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.rpc.client; import com.rpc.common.Constants; import com.rpc.server.codec.JsonCodec; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerAdapter; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeline; import io.netty.handler.codec.http.HttpClientCodec; import io.netty.handler.codec.http.HttpContentDecompressor; import io.netty.handler.codec.http.HttpObjectAggregator; import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LoggingHandler; /** * Created by xiao on 2017/8/24. */ public class HttpClientInitializer extends ChannelInitializer<Channel> { private ChannelHandlerAdapter serviceHandler; public HttpClientInitializer(ChannelHandlerAdapter bizHandler) { this.serviceHandler = bizHandler; } @Override protected void initChannel(Channel ch) throws Exception { ChannelPipeline p = ch.pipeline(); //p.addLast(new LoggingHandler(LogLevel.TRACE)); p.addLast("codec", new HttpClientCodec()); p.addLast("decompressor", new HttpContentDecompressor()); p.addLast("aggegator", new HttpObjectAggregator(Constants.MAX_DATA_LENGTH)); p.addLast("jsoncodec", new JsonCodec() ); p.addLast("handler", serviceHandler); } }
e5996b19-9ba0-415b-8db5-34c9de067b9b
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-02 10:56:13", "repo_name": "892031083/mplayer1", "sub_path": "/app/src/main/java/com/example/mplayer1/music/beaninfo/ScreenBroadcastReceiver.java", "file_name": "ScreenBroadcastReceiver.java", "file_ext": "java", "file_size_in_byte": 1261, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "d2eb32c05fc9cf09da942567ae479dba81df1dd1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.example.mplayer1.music.beaninfo; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import com.example.mplayer1.AppManager; import com.example.mplayer1.music.LockScreenMusicAvtivity; import com.example.mplayer1.music.MsplayActivity; import com.example.mplayer1.music.ServiceToutil; /** * @author master * @date 2018/1/23 */ public class ScreenBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(Intent.ACTION_SCREEN_OFF)) { if (!LockScreenMusicAvtivity.isStart&& ServiceToutil.getInstance().getMediaPlayer().isPlaying()) { //服务已经创建 并且 正在播放 Intent intent1 = new Intent(context, LockScreenMusicAvtivity.class); intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); AppManager.getContext().startActivity(intent1); } } else if (action.equals(Intent.ACTION_SCREEN_ON)) { }else if(action.equals(Intent.ACTION_USER_PRESENT)){ // LogUtil.e("开屏"); } } }
da9857ca-e528-4cdd-95d5-6e83556ebb25
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-01-12 16:47:53", "repo_name": "falka164/MountApp", "sub_path": "/src/FileManager.java", "file_name": "FileManager.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "0e7820fa1cf62b920879a83a2a843318a97e94d6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
import java.io.*; import java.util.LinkedList; import java.util.List; public class FileManager { public void readFile(String filePath) throws IOException { //FileReader odczyt pliku znak po znaku, dlatego opakowany w strumień BufferedReader FileReader fileReader = new FileReader(filePath); //BufferedReader - odczyt pliku linia po linii, udostępnia readLine BufferedReader bufferedReader = new BufferedReader(fileReader); try { String textLine = bufferedReader.readLine(); do { System.out.println(textLine); textLine = bufferedReader.readLine(); } while (textLine != null); } finally { bufferedReader.close(); } } public void writeFile(String filePath, List<String> mountList) throws IOException { FileWriter fileWriter = new FileWriter(filePath, true); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); try { for (String line : mountList) { bufferedWriter.write(line); bufferedWriter.newLine(); } } finally { bufferedWriter.close(); } } }
3e9109ff-6ea2-432c-bced-53a65d05437b
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-11-28T01:38:13", "repo_name": "smohamedjavid/react-native-paypal-wrapper", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1237, "line_count": 39, "lang": "en", "doc_type": "text", "blob_id": "1c29439a02b2342458d039cfaed2e3d3ae8932c2", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
# react-native-paypal-wrapper React Native PayPal wrapper for iOS and Android **Note: No longer maintained, happy to accept PR or takeover** ## Getting started `$ yarn add react-native-paypal-wrapper` ### Installation `$ react-native link react-native-paypal-wrapper` Extra steps for iOS 🙄 [see here](https://github.com/paypal/PayPal-ios-SDK#with-or-without-cocoapods) ## Usage ```javascript import PayPal from 'react-native-paypal-wrapper'; // 3 env available: NO_NETWORK, SANDBOX, PRODUCTION PayPal.initialize(PayPal.NO_NETWORK, "<your-client-id>"); PayPal.pay({ price: '40.70', currency: 'MYR', description: 'Your description goes here', }).then(confirm => console.log(confirm)) .catch(error => console.log(error)); ``` ### Disclaimer This project is created solely to suit our requirements, no maintenance/warranty are provided. Feel free to send in pull requests. ### Acknowledgement This project is inspired by [MattFoley](https://github.com/MattFoley/react-native-paypal) (which does not support both Android and iOS simultaneously, and [shovelapps](https://github.com/shovelapps/react-native-paypal) a fork of the former repo (which we had some problems trying to integrate due to React Native version).
634fb3e7-afd1-48a0-a34e-d8e7fae4535f
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-08-18 12:11:15", "repo_name": "kiranprojects/Swagger-Spring-Boot-Demo", "sub_path": "/src/main/java/com/wavelabs/springboot/swaggerexample/config/SwaggerConfig.java", "file_name": "SwaggerConfig.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "26ceb2e98bccaa5354af4faba1e941b6b082c472", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.wavelabs.springboot.swaggerexample.config; import static springfox.documentation.builders.PathSelectors.regex; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; /** * @author kiran kumar * */ @EnableSwagger2 @Configuration public class SwaggerConfig { @Bean public Docket productAPI() { return new Docket(DocumentationType.SWAGGER_2) .select().apis(RequestHandlerSelectors.basePackage("com.wavelabs.springboot.swaggerexample.resource")) .paths(regex("/rest.*")) .build() .apiInfo(moreInfo()); } public ApiInfo moreInfo() { @SuppressWarnings("deprecation") ApiInfo apiInfo = new ApiInfo("Wavelabs Swagger Example", "Wavelabs Swagger Example", "1.0", "termsOfServiceUrl", "[email protected]", "Wavelabs license 2.0", "https://wavelabs.in"); return apiInfo; } }
cb74d228-6aa0-44e3-9219-a07da8e437a9
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-10-02T14:37:31", "repo_name": "jbaysolutions/vue-bootstrap-select", "sub_path": "/docs/index.md", "file_name": "index.md", "file_ext": "md", "file_size_in_byte": 1234, "line_count": 72, "lang": "en", "doc_type": "text", "blob_id": "c8201779b0987fdcf89ca82c3a4de85d5df7dd64", "star_events_count": 5, "fork_events_count": 1, "src_encoding": "UTF-8"}
# Vue-Bootstrap-Select vue-bootstrap-select - A dropdown select component, that allows for single and multiple selection as well as filtering, for vue.js. ### Version : 0.0.1 - Beta version ### [Demo](https://jbaysolutions.github.io/vue-bootstrap-select/examples/01-basic.html) <!-- ## Table of Contents - [Features](#features) - [Installation](#installation) - [Usage](#usage) - [Contribute](#contribute) - [TODO List](#todo-list) ## Demos TODO UPDATE DOCS TODO UPDATE CHANGELOG --> #### Projects using vue-bootstrap-table *Know of others? Create a PR to let me know!* ## Features ## Requirements * Vue 2.* (tested with 2.3.3) * Bootstrap 4 ## Installation Install the vue-bootstrap-select [package](https://www.npmjs.org/package/vue-bootstrap-select) package using [npm](https://www.npmjs.com/): npm install vue-bootstrap-select Or add the js script to your html (download from [releases](https://github.com/jbaysolutions/vue-bootstrap-select/releases)): <script src="vue-bootstrap-table.js"></script> ## Usage Not written yet ## Contribute If you have a feature request, please add it as an issue or make a pull request. ## TODO List Many stuff, ## Changelog ### 0.0.1 * Starting point
83466cd3-6aac-4601-ac1c-049a91b2b2b9
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-09-29T03:53:55", "repo_name": "Nodirbek94/TeamProfileGenerator", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1235, "line_count": 40, "lang": "en", "doc_type": "text", "blob_id": "5bb120789b9828fd1b8efe51631b0bbcff45d9d0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
# Team Profile Generator ## Description This project demonstrates the node.js inquirer method and testing. It asks the user to enter information about individual team member such as engineer or intern and it renders the information and displays it the information to cards. ## Table of Contents * [Installation](#installation) * [Usage](#usage) * [License](#license) * [Contributions](#contributions) * [Tests](#tests) * [Questions](#questions) ## Installation User must have node.js installed and npm installed to run this application ## Usage This application can be used to created individual member information and it will run using the Terminal Video Demonstration: https://drive.google.com/file/d/1IjRhqszIVI5Xz1a_WNTdYyTz7Majiwy8/view <img src="./Assets/Screen%20Shot%202020-09-28%20at%2011.43.14%20PM.png"> ## License MIT ## Contributions Anyone can contribute to the application by just forking this repository ## Tests Application was tested using NPM and was run in the Terminal ## Questions Questions about this repository? Please contact me at [[email protected]](mailto:[email protected]). View more of my work in GitHub at [https://github.com/Nodirbek94](https://github.com/Nodirbek94)
464b3c97-1a2b-43bc-98a9-cec4ed535708
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-04 18:21:43", "repo_name": "rinighosh07/Rmg", "sub_path": "/RmgYantraApplication/src/test/java/com/comcast/EndToEnd/Create_Project_And_Allocate_User.java", "file_name": "Create_Project_And_Allocate_User.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 61, "lang": "en", "doc_type": "code", "blob_id": "2cf2f459095ee3bf428fb93c6bae6094eb245920", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.comcast.EndToEnd; import static io.restassured.RestAssured.*; import java.util.HashMap; import org.testng.annotations.Test; import io.restassured.http.ContentType; public class Create_Project_And_Allocate_User { @Test public void createProjAndAllocateUser() { baseURI = "http://localhost"; port = 8084; //create body HashMap map = new HashMap(); map.put("createdBy", "Rini860"); map.put("projectName", "airte560"); map.put("status", "Completed"); map.put("teamSize", 12); // create project given() .contentType(ContentType.JSON) .body(map) .when() .post("/addProject") .then() .log().all(); //create body HashMap map1 = new HashMap(); map1.put("designation", "SDET99"); map1.put("dob", 25/06/1999); map1.put("email", "[email protected]"); map1.put("empName", "nitesh3"); map1.put("experience", 15); map1.put("mobileNo", "9888777657"); map1.put("project", "abch7"); map1.put("role", "ROLE_ADMIN"); map1.put("username", "nitesh2"); given() .contentType(ContentType.JSON) .body(map1) .when() //create empl .post("http://localhost:8084/employees") .then() .log() .all() .assertThat().statusCode(201); } }
b4b031b3-6770-49a5-9972-64a29988e1b8
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-12 10:09:30", "repo_name": "mohamed-shalash/simple-booking-pro", "sub_path": "/app/src/main/java/com/example/trainbooking/remaking_per.java", "file_name": "remaking_per.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 65, "lang": "en", "doc_type": "code", "blob_id": "66debf7c8e2c6e08fb36d6ccc892a8d3fae0aace", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.example.trainbooking; public class remaking_per { int num; String name; String address; String seat; String hour; public int getNum() { return num; } public void setNum(int num) { this.num = num; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getSeat() { return seat; } public void setSeat(String seat) { this.seat = seat; } public String getHour() { return hour; } public void setHour(String hour) { this.hour = hour; } public remaking_per(String name, String address, String seat, String hour) { this.name = name; this.address = address; this.seat = seat; this.hour = hour; } public remaking_per(int num, String name,String seat, String hour, String address) { this.num = num; this.name = name; this.address = address; this.seat = seat; this.hour = hour; } }
981de14c-4d61-4ee8-876f-ff2c736968ab
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-22 04:20:14", "repo_name": "KN193/GroupB_FinalProject", "sub_path": "/src/GroupB_FinalProject/src/main/java/uow/finalproject/webapp/entity/Persons.java", "file_name": "Persons.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 74, "lang": "en", "doc_type": "code", "blob_id": "eda4261b5d7dede87e598312617557177f63dd7c", "star_events_count": 1, "fork_events_count": 2, "src_encoding": "UTF-8"}
package uow.finalproject.webapp.entity; import javax.persistence.Entity; import javax.persistence.Id; import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.Indexed; @Entity(name="Persons") @Indexed public class Persons { @Id public int PersonID; @Field public String Lastname; @Field public String Firstname; public String Address; String City; public Persons () {} public Persons(int personID, String lastName, String firstName, String address, String city) { super(); PersonID = personID; Lastname = lastName; Firstname = firstName; Address = address; City = city; } public int getPersonID() { return PersonID; } public void setPersonID(int personID) { PersonID = personID; } public String getLastName() { return Lastname; } public void setLastName(String lastName) { Lastname = lastName; } public String getFirstName() { return Firstname; } public void setFirstName(String firstName) { Firstname = firstName; } public String getAddress() { return Address; } public void setAddress(String address) { Address = address; } public String getCity() { return City; } public void setCity(String city) { City = city; } }
75a2378b-c210-4ba8-9d5b-9f407800df4a
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-08 18:52:52", "repo_name": "dasilva-gabriel/spigot-projects", "sub_path": "/2014-pvp-warcraft/2017-DayZ/eu/pvpwarcraft/dayz/listeners/Listeners.java", "file_name": "Listeners.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "239cd28271781bc66cfccb73d082b6db2f557a03", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package eu.pvpwarcraft.dayz.listeners; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; import eu.pvpwarcraft.dayz.listeners.player.FoodListeners; import eu.pvpwarcraft.dayz.listeners.player.PlayerJoin; import eu.pvpwarcraft.dayz.listeners.player.PlayerQuit; import eu.pvpwarcraft.dayz.listeners.weapons.PlayerReloadWeapon; public class Listeners { public static void init(Plugin instance) { PluginManager pm = instance.getServer().getPluginManager(); /* * PLAYERS LISTENERS */ instance.getLogger().info("Listeners: Starting players listeners."); try { pm.registerEvents(new PlayerJoin(), instance); pm.registerEvents(new FoodListeners(), instance); pm.registerEvents(new PlayerQuit(), instance); } catch (Exception e) { instance.getLogger().warning("Listeners: Error in the initialisation of players listeners."); e.printStackTrace(); } /* * WEAPONS LISTENERS */ instance.getLogger().info("Listeners: Starting weapons listeners."); try { pm.registerEvents(new PlayerReloadWeapon(), instance); } catch (Exception e) { instance.getLogger().warning("Listeners: Error in the initialisation of weapons listeners."); e.printStackTrace(); } } }
cb9f33b2-2bef-4608-be6b-599fb6ab3e04
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-06 23:59:16", "repo_name": "SGP0410/SmartCampus", "sub_path": "/SmartCampuslibrary/src/main/java/com/example/smartcampuslibrary/activity/BaseActivity.java", "file_name": "BaseActivity.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "fd0c2ae2c1347df2b1ded5479f6c12e9d300ed0c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.example.smartcampuslibrary.activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; public abstract class BaseActivity extends AppCompatActivity implements View.OnClickListener { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(layoutResID()); initView(); initData(); } protected abstract int layoutResID(); protected abstract void initView(); protected abstract void initData(); protected void toClass(Context context , Class<? extends BaseActivity> clazz , Bundle bundle){ Intent intent = new Intent(context, clazz); if (bundle != null) intent.putExtras(bundle); startActivity(intent); } protected void toClass(Context context , Class<? extends BaseActivity> clazz , Bundle bundle , int requestCode){ Intent intent = new Intent(context, clazz); if (bundle != null) intent.putExtras(bundle); startActivityForResult(intent , requestCode); } }
b6415ab1-9d5a-4d74-b0b4-cf14bf0a56dd
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-22 12:46:21", "repo_name": "lishuai13/Java-8", "sub_path": "/src/main/java/entity/Album.java", "file_name": "Album.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 62, "lang": "en", "doc_type": "code", "blob_id": "6142db631455fc44d97b508863d2a4e87ae2c9a5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package entity; import java.util.List; public class Album { private String name; private String tracks; private List<String> musicians; private int TrackList; public Album() { } public Album(String name, String tracks, int trackList) { this.name = name; this.tracks = tracks; TrackList = trackList; } public int getTrackList() { return TrackList; } public void setTrackList(int trackList) { TrackList = trackList; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getTracks() { return tracks; } public void setTracks(String tracks) { this.tracks = tracks; } public List<String> getMusicians() { return musicians; } public void setMusicians(List<String> musicians) { this.musicians = musicians; } @Override public String toString() { return "Album{" + "name='" + name + '\'' + ", tracks='" + tracks + '\'' + ", musicians=" + musicians + ", TrackList=" + TrackList + '}'; } }
1e484acb-87e0-48c5-a9ee-597cef9d84bc
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-07-14 13:41:46", "repo_name": "n1k0lai/Hotels", "sub_path": "/app/src/main/java/com/nplusnapps/hotels/ImageFromFileHelper.java", "file_name": "ImageFromFileHelper.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "7a2ea04fccd3db5d590bca371abd089c8955dc0b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.nplusnapps.hotels; import android.content.Context; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.util.Log; import android.widget.ImageView; import java.io.FileInputStream; import java.io.IOException; public class ImageFromFileHelper { public static void setImageFromFile(Context context, String file, ImageView image, boolean tint) { BitmapDrawable drawable = null; if (file != null) { try { FileInputStream input = context.openFileInput(file); drawable = new BitmapDrawable(BitmapFactory.decodeStream(input)); input.close(); } catch (IOException e) { Log.e("I/O exception", e.getMessage(), e); } } if (drawable != null) { if (tint) { image.setColorFilter(context.getResources().getColor(R.color.color_tint)); } image.setScaleType(ImageView.ScaleType.CENTER_CROP); image.setImageDrawable(drawable); } else { image.setScaleType(ImageView.ScaleType.CENTER); image.setImageResource(R.drawable.ic_action_photo); } } }
fc1d4d43-488d-48c0-b8ac-276a98c121e3
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-03 04:08:20", "repo_name": "cianni20/Object-Oriented-Java", "sub_path": "/Login.java", "file_name": "Login.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "41f0e4b78fecf432bab018f9d79f48b04456c8a0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
/* * 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 ingkungapss; import user.Users; /** * * @author ASUS */ public class Login { /** * @param args the command line arguments */ String input_username; String input_password; public static void main(String[] args) { Login login= new Login(); login.validation(); } public void validation(){ System.out.println("Masukan user password untuk login"); input_username="ingkungndeso"; input_password="123"; System.out.print("username: "+input_username+" "+"password: "+input_password+ "\n"); Users user=new Users("ingkungndeso","1234578"); //user.setUsername("ingkungndeso"); //user.setPassword("12345678"); if((input_username==user.getUsername())&&(input_password==user.getPassword())){ System.out.println("Login berhasil"); } else { System.out.println("Login Gagal"); } } }
adf9524f-95f3-4036-be09-48cc28e162c9
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-14 17:18:10", "repo_name": "SiriShortcutboi/New-Java-2020-6_7-projects", "sub_path": "/New Java 2020 6_7 projects/chapter 10 classes oop/src/holden/anderson/car/Car.java", "file_name": "Car.java", "file_ext": "java", "file_size_in_byte": 1236, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "540fb1cbacfd3ff7bd42f2d86810aaa538ab9fb7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package holden.anderson.car; import java.awt.Color; import java.util.Scanner; import Vehicle; import holden.anderson.carcomponents.Engine; public class Car extends Vehicle{ String color; int numDoors; String doorType; Long hardware; double price; Engine engine = new Engine(); public Car() { Scanner input = new Scanner(System.in); System.out.println("What color should your car be?"); color = input.nextLine(); System.out.println("What doors should your car have?"); numDoors = input.nextInt(); input.nextLine(); System.out.println("What kind of doors should your car have?"); doorType = input.nextLine(); System.out.println("How many wheels should your car have?"); input.nextLine(); hardware = input.nextLong(); System.out.println("What hardware should your car have?"); System.out.println("What price should your car have?"); input.nextLine(); price=(25000.00); input.close(); } public void drive() { if (engine.cylinders == 8) { System.out.println("I'm driving really fast"); } else { System.out.println("I'm driving"); } } public void start() { System.out.println("you started the car"); } }
624ee251-d9da-48f1-8bb2-cabdc1c51de2
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-02 19:44:40", "repo_name": "pm012/ftasks", "sub_path": "/fTasks/src/lesson16/SFileChooser.java", "file_name": "SFileChooser.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 65, "lang": "en", "doc_type": "code", "blob_id": "e1aae8a70b9f1dd12fdd2941ca4485148f13728f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package lesson16; import java.awt.BorderLayout; import java.awt.Container; import java.awt.FlowLayout; import java.io.File; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.filechooser.FileFilter; public class SFileChooser extends JFrame { JTextArea txt; SFileChooser() { super("Open and Save file"); setSize(200, 300); Container c = getContentPane(); JPanel pn = new JPanel(new FlowLayout(FlowLayout.CENTER, 8, 5)); JButton openBtn = new JButton("Open"); JButton saveBtn = new JButton("Save"); pn.add(openBtn); pn.add(saveBtn); c.add(pn, BorderLayout.NORTH); txt = new JTextArea(); JScrollPane sp = new JScrollPane(txt); c.add(sp, BorderLayout.CENTER); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args) { new SFileChooser(); } class ExtFileChooser extends FileFilter { String ext; String desc; ExtFileChooser(String ext, String desc) { this.ext = ext; this.desc = desc; } public boolean accept(File file) { return true; } public String getDescription() { return this.desc; } } }
b07f46f6-e026-4c9f-a8af-8ef51aa14d5e
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2014-05-14T02:49:50", "repo_name": "franleplant/SOM-box", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1233, "line_count": 55, "lang": "en", "doc_type": "text", "blob_id": "e9530037cf4750af2a2f086c66d2280d28fbd933", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
SOM-box ======= > PARTIAL INSTRUCTIONS: Opted to all-in-one installer: Enthought. Checkout [SOM repo](https://github.com/franleplant/SOM.git) This repository contains a Vagrant machine to work in the SOM project. ## Instructions ### Download and Install: 1. [Virtual Box](https://www.virtualbox.org/wiki/Downloads) 2. [Vagrant](http://www.vagrantup.com/downloads.html) ### Open the terminal and type: ```bash git clone https://github.com/franleplant/SOM-box.git SOM-box cd SOM-box vagrant up && vagrant ssh ``` This will install almost everything you need to work with the project: Ubuntu Virtual Machine, python, git, etc (inside the VM), and get you inside the Virtual Machine console. > This process might take a while since its need to download a fresh copy of Ubuntu 12.10 Quantal Quetzal. ### Access the Virtual Machine ```bash vagrant up && vagrant ssh ``` `vagrant up` turns on the virtual machine. `vagrant ssh` gets you inside the VM console. ### Manual Steps There are a couple of things that we need to by hand since they are not easy to automate. Follow this [instructions](https://github.com/franleplant/debian-based-samba-dance) to install Samba a share files between host and guests machines.
1a38e430-d7ce-43ad-b472-52455ecbe7b0
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-04 11:18:41", "repo_name": "saifgati/COVID-MOBILE-APP", "sub_path": "/app/src/main/java/com/example/myapplication/Notification_c.java", "file_name": "Notification_c.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "fb34f62b9cf3c2dc749dddb937f3d26e122110f0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.example.myapplication; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import androidx.core.app.NotificationCompat; class Notification_c extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { NotificationManager notif1 = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Intent reapeating_intent = new Intent(context, RE_C.class); reapeating_intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(context,100,reapeating_intent,PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setContentIntent(pendingIntent) .setSmallIcon(android.R.drawable.arrow_up_float) .setContentTitle("Important") .setContentText("D'ont forgot to clean your hands well and keep drinking water") .setAutoCancel(true); assert notif1 != null; notif1.notify(100,builder.build()); } }
b3f90505-c7a5-49b9-ac25-a64b9d1ef58b
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-09 14:00:48", "repo_name": "afdolash/spiro_2", "sub_path": "/app/src/main/java/com/pens/afdolash/spiro/main/FinishFragment.java", "file_name": "FinishFragment.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "0e34e6d33d6cd4199c9b17309dbad188348c0aea", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.pens.afdolash.spiro.main; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.CardView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.pens.afdolash.spiro.R; /** * A simple {@link Fragment} subclass. */ public class FinishFragment extends Fragment { private CardView cardAgree; public FinishFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_finish, container, false); cardAgree = (CardView) view.findViewById(R.id.card_agree); cardAgree.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ((MainActivity) getActivity()).finish(); Intent intent = new Intent(getContext(), MainActivity.class); startActivity(intent); } }); return view; } }
e8e98bf2-7c90-49c9-ac8a-bc65a92142c6
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-08-31T16:15:02", "repo_name": "indieweb/indieweb-chat-archive", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1232, "line_count": 23, "lang": "en", "doc_type": "text", "blob_id": "948619238778ed2d4127b4332abdc4d4ab795685", "star_events_count": 16, "fork_events_count": 10, "src_encoding": "UTF-8"}
# IndieWeb Chat Archive This repo contains the full archive of IndieWeb chat log data files visible at https://chat.indieweb.org Chat logs are added to this repo every 15 minutes. ## File Format Each channel's files can be read using [QuartzDB](https://github.com/aaronpk/QuartzDB). The files follow a simple format: ``` 2017-12-01 23:15:06.218000 {"type":"message","timestamp":1512170106.218,"network":"irc","server":"freenode","channel":{"uid":"#indieweb","name":"#indieweb"},"author":{"uid":"Loqi","nickname":"Loqi","username":"Loqi","name":"Loqi","photo":null,"url":null,"tz":"US\/Pacific"},"content":"[@indiewebcamp] This week in the #indieweb https://indieweb.org/this-week/2017-12-01.html https://pbs.twimg.com/media/DP_z5rCVwAAGdTk.jpg (http://twtr.io/1Yx4r5CHSBC)","modes":[]} ``` * Each line begins with the timestamp. * There will always be 26 characters followed by a space. * The timestamp is UTC and has 6 digits of precision for the seconds. * The rest of the line is a JSON-encoded string representing the IRC message and who sent it. ## Spam removal For a guide on how we deal with spam in these logs, see [How to remove spam](https://indieweb.org/discuss_infrastructure#How-to_remove_spam) on the wiki.
e445ecaa-273c-4124-84eb-8b062302995b
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-08-20 18:18:30", "repo_name": "doshmajhan/LookUp", "sub_path": "/src/JsonReader.java", "file_name": "JsonReader.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "0c094fd2594e0855d08e7fee18ddfcf9cd1d80af", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
import org.apache.commons.lang3.ObjectUtils; import org.codehaus.jackson.JsonParser; import org.json.JSONException; import org.json.JSONObject; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.Charset; /** * Created by MC on 4/23/2015. */ public class JsonReader { String URL; public JsonReader(String URL){ this.URL = URL; } private String readAll(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); } public JSONObject readJsonFromUrl() throws IOException, JSONException { InputStream is = new URL(this.URL).openStream(); JSONObject json; try { BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); String jsonText = readAll(rd); json = new JSONObject(jsonText); return json; } catch (IOException e){ e.printStackTrace(); json = new JSONObject(); } finally{ is.close(); } return json; } }
83f5d18e-782e-4341-b337-7e1e4f4c6b00
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-14 07:31:49", "repo_name": "bulkeshswami9999/CigarDriver", "sub_path": "/app/src/main/java/com/hav/cigar/driver/model/MobileNoExistsData.java", "file_name": "MobileNoExistsData.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 69, "lang": "en", "doc_type": "code", "blob_id": "858c83f036a201ab7bc9ac00e9f3f8c1efd94348", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.hav.cigar.driver.model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.io.Serializable; public class MobileNoExistsData implements Serializable { @SerializedName("message") @Expose String message; @SerializedName("id") @Expose String id=""; @SerializedName("full_name") @Expose String fullName=""; @SerializedName("email_id") @Expose String emailId=""; @SerializedName("mob") @Expose String mob; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public String getEmailId() { return emailId; } public void setEmailId(String emailId) { this.emailId = emailId; } public String getMob() { return mob; } public void setMob(String mob) { this.mob = mob; } }
f36969eb-d650-4029-8998-80ea3222374c
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-15 23:12:56", "repo_name": "daniel-kranowski/bluegreen-manager", "sub_path": "/src/main/java/bluegreen/manager/tasks/SshVmDeleteConfig.java", "file_name": "SshVmDeleteConfig.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "d7239132069ae6f79b70a98d2be7a26fef17dbf1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package bluegreen.manager.tasks; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; /** * Configures the commands sent over ssh for vm deletion. */ @Lazy @Component public class SshVmDeleteConfig { @Value("${bluegreen.sshvmdelete.initial.command}") private String initialCommand; @Value("${bluegreen.sshvmdelete.initial.regexp.success}") private String initialRegexpSuccess; //Warning: don't try to examine exitValue for success/failure, our ssh library Ganymed does not reliably return it. public SshVmDeleteConfig() { } public SshVmDeleteConfig(String initialCommand, String initialRegexpSuccess) { this.initialCommand = initialCommand; this.initialRegexpSuccess = initialRegexpSuccess; } public String getInitialCommand() { return initialCommand; } public void setInitialCommand(String initialCommand) { this.initialCommand = initialCommand; } public String getInitialRegexpSuccess() { return initialRegexpSuccess; } public void setInitialRegexpSuccess(String initialRegexpSuccess) { this.initialRegexpSuccess = initialRegexpSuccess; } }
11f0ef04-4fb0-4092-95cd-2e19430c4df7
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-05 15:44:04", "repo_name": "coadtan/Questio", "sub_path": "/app/src/main/java/com/questio/projects/questio/QuestioApplication.java", "file_name": "QuestioApplication.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "9aa84d9acd1ef3e854e6502d4656f81668deca0c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.questio.projects.questio; import android.app.Application; import android.content.res.Configuration; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.common.api.GoogleApiClient; public class QuestioApplication extends Application { private static final String LOG_TAG = QuestioApplication.class.getSimpleName(); public static GoogleApiClient mGoogleApiClient; public static GoogleSignInAccount mGoogleSignInAccount; private static QuestioApplication singleton; private static boolean login = false; public static boolean isLogin() { return login; } public static void setLogin(boolean login) { QuestioApplication.login = login; } public QuestioApplication getInstance() { return singleton; } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); } @Override public void onCreate() { super.onCreate(); singleton = this; } @Override public void onLowMemory() { super.onLowMemory(); } @Override public void onTerminate() { super.onTerminate(); } }
d3aadd5e-f8d0-412d-9d10-16d58b7c82e0
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-18 05:17:49", "repo_name": "XanderYe/service-monitor", "sub_path": "/api/src/main/java/cn/xanderye/controller/SystemController.java", "file_name": "SystemController.java", "file_ext": "java", "file_size_in_byte": 1244, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "3112d7248be175978993948f61d4cefb5b599b6a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package cn.xanderye.controller; import cn.xanderye.base.ResultBean; import cn.xanderye.entity.AccessLog; import cn.xanderye.service.AccessLogService; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * @author XanderYe * @description: * @date 2021/7/29 18:49 */ @RestController @RequestMapping("system") public class SystemController { @Autowired private AccessLogService accessLogService; /** * 分页获取日志 * @param pageNum * @param pageSize * @return cn.xanderye.base.ResultBean<com.github.pagehelper.PageInfo> * @author XanderYe * @date 2021/7/29 */ @GetMapping("getAccessLogList") public ResultBean<Page<AccessLog>> getAccessLogList(Integer pageNum, Integer pageSize) { pageNum = pageNum == null || pageNum < 0 ? 0 : pageNum; pageSize = pageSize == null || pageSize < 0 ? 12 : pageSize; return new ResultBean<>(accessLogService.getAccessLogPageInfo(pageNum, pageSize)); } }
5be28757-9fa3-40b7-bc65-7d0d0fcadcb9
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-27 06:42:33", "repo_name": "MartyAlien/HIS-Pro", "sub_path": "/HIS/src/main/java/com/hrbu/his/dao/impl/DeptDaoImpl.java", "file_name": "DeptDaoImpl.java", "file_ext": "java", "file_size_in_byte": 1288, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "b0314c0fb11d2e024cf7ae2a6adc2645f40a2373", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.hrbu.his.dao.impl; import com.hrbu.his.bean.Dept; import com.hrbu.his.dao.DeptDao; import com.hrbu.his.utils.JDBCUtils; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.BeanPropertyRowMapper; import org.springframework.jdbc.core.JdbcTemplate; import java.util.List; /** * @ClassName: DeptDaoImpl * @Author: Lemo-TanYajun * @CreateTime: 2020/12/20 13:15 */ public class DeptDaoImpl implements DeptDao { private JdbcTemplate jdbcTemplate= new JdbcTemplate(JDBCUtils.getDataSource()); @Override public List<Dept> getAllDept() { try { return jdbcTemplate.query("select * from dept", new BeanPropertyRowMapper<>(Dept.class)); } catch (DataAccessException e) { System.err.println("异常:DeptDaoImpl.class未能找到数据库中的数据"); return null; } } @Override public Dept getDeptById(Integer deptid) { try { return jdbcTemplate.queryForObject("select * from dept where id=?", new BeanPropertyRowMapper<>(Dept.class),deptid); } catch (DataAccessException e) { System.err.println("异常:DeptDaoImpl.class---getDeptById未能找到数据库中的数据"); return null; } } }
92d11640-4f9b-49fd-88e2-9b1df9c43985
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-08-08 09:46:05", "repo_name": "jaiiye/ddd", "sub_path": "/ui/web/src/test/java/cn/ddd/core/tools/ModuleTest.java", "file_name": "ModuleTest.java", "file_ext": "java", "file_size_in_byte": 1241, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "d8521aeb3f5f75631bfc4c2720884186f174f28d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package cn.ddd.core.tools; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.TransactionConfiguration; import org.springframework.transaction.annotation.Transactional; import cn.ddd.core.security.domain.Module; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/spring-base.xml", "/spring-data.xml" }) @TransactionConfiguration(transactionManager = "txManager", defaultRollback = false) public class ModuleTest { @Autowired private SessionFactory factory; @Test @Transactional public void testInsert() { Module internal = new Module(); internal.setTitle("用户管理"); internal.setName("user"); internal.setLink("user/index"); internal.addAction("view"); internal.addAction("create"); internal.addAction("update"); internal.addAction("delete"); Session session = factory.getCurrentSession(); session.save(internal); } }
3c11958a-dd78-49de-a567-fe29a5f4f02a
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-10 21:34:54", "repo_name": "georgianabrailoiu/mpai-project", "sub_path": "/mpai/src/main/java/eb/project/mpai/service/BiletNormalTeatruServiceImpl.java", "file_name": "BiletNormalTeatruServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "12b79a4628facd70351f6695a8921af53a79a959", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package eb.project.mpai.service; import eb.project.mpai.domain.bilete.BiletNormalConcert; import eb.project.mpai.domain.bilete.BiletNormalTeatru; import eb.project.mpai.repository.BiletNormalConcertRepository; import eb.project.mpai.repository.BiletNormalTeatruRepository; import eb.project.mpai.service.interfaces.BiletNormalConcertService; import eb.project.mpai.service.interfaces.BiletNormalTeatruService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.Optional; @Service public class BiletNormalTeatruServiceImpl implements BiletNormalTeatruService { @Autowired private BiletNormalTeatruRepository biletNormalTeatruRepository; @Override public List<BiletNormalTeatru> findAll() { return biletNormalTeatruRepository.findAll(); } @Override public void save(BiletNormalTeatru bilet){ biletNormalTeatruRepository.save(bilet); } @Override public void delete(BiletNormalTeatru bilet){ biletNormalTeatruRepository.delete(bilet); } @Override public Optional<BiletNormalTeatru> findById(Long id){ return biletNormalTeatruRepository.findById(id);} }
29e5fd2e-f5f4-4799-906f-9361b28ebebb
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-27 20:24:22", "repo_name": "Mariusz94/FacebookWeb", "sub_path": "/src/main/java/pl/lyszczarzmariusz/FacebookWeb/models/UserModel.java", "file_name": "UserModel.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "00bcfbad5bf4631d1b8c603165d64bd1ec690693", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package pl.lyszczarzmariusz.FacebookWeb.models; import lombok.Data; import org.hibernate.annotations.CreationTimestamp; import org.springframework.data.annotation.CreatedDate; import pl.lyszczarzmariusz.FacebookWeb.models.forms.RegisterForm; import javax.persistence.*; import java.sql.Timestamp; @Entity @Table(name = "user") @Data public class UserModel { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @Column(name = "first_name") private String firstName; @Column(name = "last_name") private String lastName; private String password; private String email; @Column(name = "phone_number") private int phoneNumber; @CreationTimestamp @Column(name = "day_of_register") private Timestamp dayOfRegister; public static UserModel createUser(RegisterForm registerForm){ UserModel userModel = new UserModel(); userModel.setFirstName(registerForm.getFirstName()); userModel.setLastName(registerForm.getLastName()); userModel.setPassword(registerForm.getPassword()); userModel.setEmail(registerForm.getEmail()); userModel.setPhoneNumber(registerForm.getPhoneNumber()); return userModel; } }
10ae9357-2095-4dec-b89a-9b36aa96bcb2
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-03 07:14:53", "repo_name": "Y00z/android_security", "sub_path": "/safe/src/main/java/org/yooz/dao/AntivirusDao.java", "file_name": "AntivirusDao.java", "file_ext": "java", "file_size_in_byte": 1304, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "04169e5fa907502e4eba9b72fb57bb5b43b3f65a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package org.yooz.dao; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; /** * Created by Yooz on 2016/2/11. */ public class AntivirusDao { //查询md5是否在病毒库里面 public static String checkFileVirus(String md6) { String desc = null; SQLiteDatabase db = SQLiteDatabase.openDatabase("data/data/org.yooz.safe/files/antivirus.db", null, SQLiteDatabase.OPEN_READWRITE); //查询程序md5是否在病毒数据库里面 Cursor cursor = db.rawQuery("select desc from datable where md5 =?", new String[]{md6}); if(cursor.moveToNext()) { desc = cursor.getString(0); } return desc; } //添加信息到病毒库 public static void addVirus(String md5 , String desc){ SQLiteDatabase db = SQLiteDatabase.openDatabase("data/data/org.yooz.safe/files/antivirus.db", null, SQLiteDatabase.OPEN_READWRITE); ContentValues contentValues = new ContentValues(); contentValues.put("md5" , md5); contentValues.put("desc", desc); contentValues.put("type",6); contentValues.put("name","病毒木马"); db.insert("datable",null,contentValues); db.close(); } }
f88ba76e-1365-4de1-b255-ae4a8f9e6b00
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-04-16T14:33:27", "repo_name": "DonovanGalloway/ISTA_220", "sub_path": "/Homework/Ch3Homework.md", "file_name": "Ch3Homework.md", "file_ext": "md", "file_size_in_byte": 1231, "line_count": 13, "lang": "en", "doc_type": "text", "blob_id": "82b983a821f6c377dcd458c3791c6e2694632182", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
# ISTA 220_C# CH2 HW ## Donovan Galloway ### February 27, 2018 1. What is a method? A named sequence of statements. Pg.59 1. What does a return statement do? Causes a method to finish, and controls return to the statement that called the method. Pg.61 1. What is an expression bodied method? A syntactic convenience; no different than an ordinary method. Pg.62 1. What is the scope of a variable? They can only be used after they have been created, and when the method ends the variable disappears and cannot be used elsewhere. Pg.66 1. What is an overloaded method? A method identifier that is declared more than once in the same scope using a different set of parameters. Pg.68 1. How do you call a method that requirements arguments? You supply a parenthesis with a comma-separated list of arguments, and the number and type of the arguments. Pg.68 1. How do you write a method, that is, specify the method definition, that requires a parameter list? 1. How do you a parameter specify as optional when defining a method? You provide a default value for the parameter. Pg.79 1. How do you pass an argument to a method as a named parameter? You specify the name of the parameter followed by a colon and the value to use. Pg.79
fc124411-dc0d-4d06-b373-d54dd85149a0
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-11-09 02:49:37", "repo_name": "gzchen008/jeesite", "sub_path": "/src/main/java/com/vanroid/dachuang/common/DaChuangUtils.java", "file_name": "DaChuangUtils.java", "file_ext": "java", "file_size_in_byte": 1276, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "33ae3b707e29477c9f70a61a00de08e3ed9fa7a9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.vanroid.dachuang.common; import com.thinkgem.jeesite.modules.sys.entity.Office; import com.thinkgem.jeesite.modules.sys.entity.Role; import com.thinkgem.jeesite.modules.sys.entity.User; import org.apache.log4j.Logger; import java.util.Iterator; import java.util.List; /** * Created by cgz on 16-10-22. */ public class DaChuangUtils { public static final Logger logger = Logger.getLogger(DaChuangUtils.class); public static final String BASE_OFFICE = "总部"; public static void transformUser(User user) { // 设置用户类型为2:部门经理 user.setUserType("2"); } public static void transformRoleList(List<Role> roleList) { for (Iterator<Role> iter = roleList.iterator(); iter.hasNext(); ) { if (iter.next().getId().equals("1")) { iter.remove(); } } } public static Office transformChildOffices(List<Office> childOffices) { for (Office o : childOffices) { if (o.getName().equals(BASE_OFFICE)) return o; } logger.error("没有找到[总部]部门"); return null; } public static void exceptionInTest() { if (true) throw new RuntimeException("test"); } }
c739aae3-a0d2-47b6-99bf-cf7983e6e38f
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-10-02 20:54:00", "repo_name": "PPPPPPika/rpo", "sub_path": "/src/main/java/com/example/rpo/Services/Operations/DeleteOperation.java", "file_name": "DeleteOperation.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "50e6c692a30fcf0ef3cfe2ad1184201d7f803685", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.example.rpo.Services.Operations; import com.example.rpo.Models.Comment; import com.example.rpo.Repositorys.CommentRepository; import com.example.rpo.Repositorys.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component("deleteOperation") public class DeleteOperation implements OperationsInterface { private final CommentRepository commentRepository; private final UserRepository userRepository; @Autowired public DeleteOperation(CommentRepository commentRepository, UserRepository userRepository) { this.commentRepository = commentRepository; this.userRepository = userRepository; } private Comment searchComment(Long id){ return commentRepository.findById(id).get(); } @Override public void deleteComment(Long id, String currentUser) { try { Comment comment = searchComment(id); if (comment.getAuthor().getName().equals(currentUser)){ comment.setAuthor(null); commentRepository.delete(comment); } } catch (Exception exception) { exception.printStackTrace(); } } }
ba501625-a08c-401b-86fe-61bee63068b4
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-07-17 17:58:39", "repo_name": "kj1995/PulsUhr-1", "sub_path": "/app/src/main/java/de/rwth/pulsuhr/pulsuhr/SettingsFragment.java", "file_name": "SettingsFragment.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "b42e589c861fd1c27973b15ee110ebf413786c2b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package de.rwth.pulsuhr.pulsuhr; import android.app.Fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.Toast; /** * Created by steffen on 16.06.16. */ public class SettingsFragment extends Fragment implements View.OnClickListener{ View myView; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { myView = inflater.inflate(R.layout.settings_fragment, container, false); Button btnResetDB = (Button)myView.findViewById(R.id.btnResetDB); btnResetDB.setOnClickListener(this); return myView; } @Override public void onClick(View v) { final SqlHelper myDB = new SqlHelper(getActivity()); switch (v.getId()){ case R.id.btnResetDB : int successful = myDB.deleteMeasurement(null,null); if(successful > 0){ Toast.makeText(getActivity(),"Datenbank zurückgesetzt !",Toast.LENGTH_SHORT).show(); } break; } } }
3cf1ac11-075b-42be-b741-e68ed9d62ace
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-08 02:11:54", "repo_name": "brnagirdan/oauth2", "sub_path": "/oauth2/client/src/main/java/com/ecquaria/interceptor/RestTemplateRequestInterceptor.java", "file_name": "RestTemplateRequestInterceptor.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "d145b1c48650528ce5cd1f8ac6040f7ce8b4762f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.ecquaria.interceptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpRequest; import org.springframework.http.client.ClientHttpRequestExecution; import org.springframework.http.client.ClientHttpRequestInterceptor; import org.springframework.http.client.ClientHttpResponse; import org.springframework.stereotype.Component; import java.io.IOException; @Component public class RestTemplateRequestInterceptor implements ClientHttpRequestInterceptor { protected Logger logger = LoggerFactory.getLogger(getClass()); @Override public ClientHttpResponse intercept(HttpRequest httpRequest, byte[] bytes, ClientHttpRequestExecution clientHttpRequestExecution) throws IOException { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("Header:").append(httpRequest.getHeaders()).append(" ") .append("Path:").append(httpRequest.getURI().getPath()).append(" "); if (bytes != null && bytes.length > 0) { stringBuilder.append("Body:").append(new String(bytes)); } logger.info(stringBuilder.toString()); return clientHttpRequestExecution.execute(httpRequest, bytes); } }
b7bd7632-257a-487e-a553-c8e856399edd
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-12 01:09:08", "repo_name": "Aran1018/SandW", "sub_path": "/android/app/src/main/java/com/triplebro/aran/sandw/managers/FirstPageManager.java", "file_name": "FirstPageManager.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "0e3f8ce4ab834ef3818f2deecfb506f252888b9c", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"}
package com.triplebro.aran.sandw.managers; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; import com.triplebro.aran.sandw.handlers.FirstPageHandler; import com.triplebro.aran.sandw.services.NetworkCommunicationService; public class FirstPageManager implements ServiceConnection { private Context context; private FirstPageHandler firstPageHandler; public FirstPageManager(Context context, FirstPageHandler firstPageHandler) { this.context = context; this.firstPageHandler = firstPageHandler; firstPageHandler.setFirstPageManager(this); } public void getGoodsInfo(){ Intent intent = new Intent(context, NetworkCommunicationService.class); context.bindService(intent,this,Context.BIND_AUTO_CREATE); } @Override public void onServiceConnected(ComponentName name, IBinder service) { NetworkCommunicationService.MyBinder myBinder = (NetworkCommunicationService.MyBinder) service; myBinder.getGoodsInfo(context,firstPageHandler); } @Override public void onServiceDisconnected(ComponentName name) { } }
6b40248d-b4c3-41d9-8891-de88ec9a0720
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-05 18:42:03", "repo_name": "Aman1kr/Road-Safety-", "sub_path": "/main/java/com/example/student/isafe/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "a77aba165fe6e7626f9d2009fe09ce0b40f44c72", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.example.student.isafe; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import java.util.Timer; import java.util.TimerTask; import android.annotation.SuppressLint; import android.graphics.drawable.AnimationDrawable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.constraint.ConstraintLayout; import android.content.Intent; public class MainActivity extends AppCompatActivity { Timer timer; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); timer = new Timer(); timer.schedule(new TimerTask(){ @Override public void run() { Intent intent=new Intent(MainActivity.this, Activity1.class); startActivity(intent); finish(); } }, 3000); } } /*public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }*/
36889ee5-bad2-4d6f-90a2-53d14cf0952b
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-09 07:00:06", "repo_name": "liupanfeng/YangQuanClien", "sub_path": "/app/src/main/java/com/meishe/yangquan/fragment/SlideFragment.java", "file_name": "SlideFragment.java", "file_ext": "java", "file_size_in_byte": 1250, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "3dfe41cf6735d80db91c2d82b5d5d1d6e67efb90", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.meishe.yangquan.fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.fragment.app.Fragment; /** * * @Author : LiuPanFeng * @CreateDate : 2021/4/20 18:37 * @Description : 这个是引导页面专用 */ public class SlideFragment extends Fragment { private static final String ARG_LAYOUT_RES_ID = "layoutResId"; public static SlideFragment newInstance(int layoutResId) { SlideFragment slideFragment = new SlideFragment(); Bundle args = new Bundle(); args.putInt(ARG_LAYOUT_RES_ID, layoutResId); slideFragment.setArguments(args); return slideFragment; } private int layoutResId; public SlideFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null && getArguments().containsKey(ARG_LAYOUT_RES_ID)) layoutResId = getArguments().getInt(ARG_LAYOUT_RES_ID); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(layoutResId, container, false); } }
9a056b10-7859-4a27-8f3f-18f86dcffa14
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-15 18:19:31", "repo_name": "lukFisz/journal", "sub_path": "/src/main/java/luk/fisz/journal/common/util/mail/MailSenderImpl.java", "file_name": "MailSenderImpl.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "b0ee34abe43103065cfe563b86fc95e8bf440fd6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package luk.fisz.journal.common.util.mail; import luk.fisz.journal.common.definition.mail.MailProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.stereotype.Service; @Service public class MailSenderImpl implements MailSender { private final Logger logger = LoggerFactory.getLogger(MailSenderImpl.class); private final MailProperties mailProperties; private final JavaMailSender mailSender; public MailSenderImpl(MailProperties mailProperties, JavaMailSender mailSender) { this.mailProperties = mailProperties; this.mailSender = mailSender; } @Override public void send(Mail mail) { SimpleMailMessage message = new SimpleMailMessage(); message.setFrom(mailProperties.SENDER); message.setTo(mail.getReceiver()); message.setSubject(mail.getSubject()); message.setText(mail.getBody()); mailSender.send(message); logger.info( "Email was sent. Receiver: " + mail.getReceiver() + " | Event type: " + mail.getEventType() ); } }
ff991a9f-7e18-4f4b-9da9-1bbeafa288a3
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-10 03:40:53", "repo_name": "originer/HZRPC", "sub_path": "/HZRPC/hzr-spring-provider/src/main/java/hzr/spring/provider/bean/ServerFactoryBean.java", "file_name": "ServerFactoryBean.java", "file_ext": "java", "file_size_in_byte": 1231, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "bd5f399312285c76d1c76a2195835d8a1a298a8c", "star_events_count": 11, "fork_events_count": 0, "src_encoding": "UTF-8"}
package hzr.spring.provider.bean; import hzr.common.bootstrap.ServerBuilder; import hzr.common.transport.server.Server; import hzr.common.transport.server.ServerImpl; import lombok.Data; import org.springframework.beans.factory.FactoryBean; import org.springframework.lang.Nullable; import org.springframework.stereotype.Component; import java.util.Map; /** * @author Zz **/ @Data public class ServerFactoryBean implements FactoryBean<Object> { private Class<?> serviceInterface; private Object serviceImpl; private int port; private String zkConn; private ServerImpl rpcServer; private Map<String,Object> serviceMap; public void start() { Server build = ServerBuilder.builder().zkConn(zkConn) .serviceMap(serviceMap) .port(port) .zkConn(zkConn).build2(); build.start(); } public void destroy() { rpcServer.shutdown(); } @Nullable @Override public Object getObject() throws Exception { return this; } @Nullable @Override public Class<?> getObjectType() { return this.getClass(); } @Override public boolean isSingleton() { return true; } }
b1cfc3a4-6a4e-4ab5-9320-9625ff661268
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-02 07:32:58", "repo_name": "ToanMobile/uHotel", "sub_path": "/app/src/main/java/com/acuteksolutions/uhotel/mvp/model/conciege/Room.java", "file_name": "Room.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 64, "lang": "en", "doc_type": "code", "blob_id": "6069d26749504487a858892767680bcd1e1c31be", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.acuteksolutions.uhotel.mvp.model.conciege; import com.acuteksolutions.uhotel.ui.adapter.concierge.RoomAdapter; import com.chad.library.adapter.base.entity.MultiItemEntity; import io.realm.RealmObject; import io.realm.annotations.PrimaryKey; /** * Created by Toan.IT on 5/14/17. * Email: [email protected] */ public class Room extends RealmObject implements MultiItemEntity { public String getName() { return name; } public void setName(String name) { this.name = name; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } public int getPosition() { return position; } public void setPosition(int position) { this.position = position; } public Room(String name, int value, int position) { this.name = name; this.value = value; this.position = position; } public Room(String name) { this.name = name; } @PrimaryKey private String name; private int value; private int position; public Room(){} @Override public int getItemType() { return RoomAdapter.TYPE_ROOM; } }
9e8c646b-6f30-406f-b183-f3be8e91a003
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-05-03T15:05:18", "repo_name": "CaseyJonesMedea/RushSeaBattle", "sub_path": "/app/src/main/java/com/example/caseyjones/seabattlerush/customviews/SeaBattleButton.java", "file_name": "SeaBattleButton.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 59, "lang": "en", "doc_type": "code", "blob_id": "0976ad81d7c44d95f87c7e8cd9b48386040acb90", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.example.caseyjones.seabattlerush.customviews; import android.content.Context; import android.widget.Button; import com.example.caseyjones.seabattlerush.models.Coordinate; /** * Created by CaseyJones on 01.05.2016. */ public class SeaBattleButton extends Button { private Coordinate coordinate; private int numShip; private boolean isPressed; // public SeaBattleButton(Context context) { // super(context); // } public SeaBattleButton(Context context, Coordinate coordinate, int numShip) { super(context); this.coordinate = coordinate; this.numShip = numShip; if(coordinate.isAlive()){ isPressed = false; }else isPressed = true; } @Override public boolean isPressed() { return isPressed; } @Override public void setPressed(boolean pressed) { isPressed = pressed; } public Coordinate getCoordinate() { return coordinate; } public void setCoordinate(Coordinate coordinate) { this.coordinate = coordinate; } public int getNumShip() { return numShip; } public void setNumShip(int numShip) { this.numShip = numShip; } }
297bba0e-b92a-4259-9071-e0fdd39c2d6f
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-02-25 08:04:27", "repo_name": "Divya0317/Divya", "sub_path": "/src/test/java/resources/stepdefination/project1.java", "file_name": "project1.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "ea3b8ac1f65be18ab033f660e97516f8ce474907", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package resources.stepdefination; import cucumber.api.java.en.*; public class project1 { @Given("^user is having valid url$") public void user_is_having_valid_url() { // Write code here that turns the phrase above into concrete actions System.out.println("success"); String str= null; int a=10; int b=0; try{ System.out.println(str.length()); str= "Divya"; } catch(NullPointerException npe) { System.out.println("catch block"); } catch(Exception npe){ System.out.println("parent exception block"); } finally { System.out.println("final block"); } } @Then("^application should launch$") public void application_should_launch(){ // Write code here that turns the phrase above into concrete actions System.out.println("succecess1"); try { throw new NullPointerException(); } catch(NullPointerException npe){ System.out.println("safas"); } } @Then("^sample throws$") public void sample_throws() throws Throwable { // Write code here that turns the phrase above into concrete actions throw new Exception(); } public void sample() throws Throwable{ throw new Exception(); } }
b240db4c-0d4a-48eb-a863-66e2a0cef9ad
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-11-20 14:38:51", "repo_name": "idea4j/mljr", "sub_path": "/mljr/src/test/java/com/mljr/demo/mq/MQDemo.java", "file_name": "MQDemo.java", "file_ext": "java", "file_size_in_byte": 1278, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "0445f191e913b9e1cafdbef0f96a2438b0da2e2b", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"}
package com.mljr.demo.mq; import org.apache.activemq.command.ActiveMQQueue; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.jms.core.JmsTemplate; import java.util.concurrent.locks.ReentrantLock; /** * @Description: * @Author: 牛神成--Tinker * @Company: * @CreateDate: 2016/11/12 */ public class MQDemo { /** * 消息生产者 * * @throws Exception */ @Test public void run1() throws Exception { ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:applicationContext-activemq-producer.xml"); JmsTemplate template = ac.getBean(JmsTemplate.class); ActiveMQQueue queue = ac.getBean(ActiveMQQueue.class); template.send(queue, session -> session.createTextMessage("2")); } /** * 消息消费者 * * @throws Exception */ @Test public void run2() throws Exception { ReentrantLock lock = new ReentrantLock(); if (lock.tryLock()) { try { System.out.println("尝试成功获取到了锁!"); } finally { lock.unlock(); } } } }
702be118-1d25-4e93-ac71-58c643237503
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-20 09:38:54", "repo_name": "APLK/rxjava2_Demo", "sub_path": "/src/main/java/com/szinternet/crm/adapter/BasePagerAdapter.java", "file_name": "BasePagerAdapter.java", "file_ext": "java", "file_size_in_byte": 1282, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "a41c066207c244847145ed924896037741db42ea", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.szinternet.crm.adapter; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import com.szinternet.crm.base.BaseFragment; import com.szinternet.crm.utils.CommonUtil; import java.util.ArrayList; import java.util.List; /** * * 免责声明:本项目不可用于违法用途,否则后果自负,技术无罪 */ public class BasePagerAdapter extends FragmentPagerAdapter { private List<BaseFragment> mFragmentList = new ArrayList<>(); private List<String> mTitles; public BasePagerAdapter(FragmentManager fm, List<BaseFragment> fragmentList) { super(fm); this.mFragmentList = fragmentList; } public BasePagerAdapter(FragmentManager fm, List<BaseFragment> fragmentList, List<String> titles) { super(fm); this.mFragmentList = fragmentList; this.mTitles = titles; } @Override public CharSequence getPageTitle(int position) { return !CommonUtil.isNullOrEmpty(mTitles) ? mTitles.get(position) : ""; } @Override public Fragment getItem(int position) { return mFragmentList.get(position); } @Override public int getCount() { return mFragmentList.size(); } }
1a40950c-c46e-4751-b5ef-676d9a4909fc
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-04 09:46:47", "repo_name": "bookwed/yuegou", "sub_path": "/yuegou-util/src/main/java/com/wei/util/upload/UploadDto.java", "file_name": "UploadDto.java", "file_ext": "java", "file_size_in_byte": 1267, "line_count": 73, "lang": "en", "doc_type": "code", "blob_id": "de2248d5117244c2172868d6e9d0696d133da13d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.wei.util.upload; ; /** * Description * Author ed * Created 2017-08-03 14:10 */ public class UploadDto { /** * 文件大小 */ private Long fileSize; /** * 真实文件名 */ private String fileName; /** * 随机文件名 */ private String uuidName; /** * 文件路径 */ private String filePath; public UploadDto() { } public UploadDto(Long fileSize, String fileName, String uuidName, String filePath) { this.fileSize = fileSize; this.fileName = fileName; this.uuidName = uuidName; this.filePath = filePath; } public Long getFileSize() { return fileSize; } public void setFileSize(Long fileSize) { this.fileSize = fileSize; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public String getUuidName() { return uuidName; } public void setUuidName(String uuidName) { this.uuidName = uuidName; } public String getFilePath() { return filePath; } public void setFilePath(String filePath) { this.filePath = filePath; } }
c4dded64-a204-4280-a6f3-0c2989d03610
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-07-12T11:05:01", "repo_name": "Vishal023/Weather-Reasoning", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1232, "line_count": 41, "lang": "en", "doc_type": "text", "blob_id": "4ffadc5978c6fe02bc71007dda0561c7b5403034", "star_events_count": 4, "fork_events_count": 1, "src_encoding": "UTF-8"}
# Make sure your fork/star this repo before cloning to your local system # Weather Reasoning System An artificial intelligence weather reasoning project which tells you the weather forecast of the next day. It also had auto day and night mode. ![Home Page](https://drive.google.com/uc?id=1bbDqaUw-_JwjlrXt751pjmyj3vKs2s6t) ## TECHNOLOGY USED This reasoning system uses: * [Python](https://www.python.org/) * [GUI] * [MATPLOTLIB] * [PANDAS] * [TKINTER] GUI * [SQLITE] v3 ## WORKING WATCH THIS VIDEO TO VIEW THE WORKING OF THIS GUI APP [VIDEO](https://drive.google.com/open?id=1ExX7HGeQVpdYtISiS8hr09AIQ7QxWZam) ## INSTALLATION Weather Reasoning requires [Python](https://www.python.org/) v3+ to run. [Jupyter Notebook](https://jupyter.org/) Clone the repository HTTPS: https://github.com/Vishal023/Weather-Reasoning.git Download: Dowload the GUI folder and execute the code inside WeatherReasoning.ipynb ## NOTE Note: The images,database and dataset file should be in the same directory as the WeatherReasoning.ipynb ## JUNK [11809777_K18KR](https://github.com/Vishal023/Weather-Reasoning/tree/master/11809777_K18KR) this folder was used for Class Project Purpose.
68dc89e7-1bca-40de-b921-67beb0a97aad
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-16 16:27:12", "repo_name": "pvtrieulh/thay_hung", "sub_path": "/demo/src/main/java/com/example/demo/controller/KhachHangController.java", "file_name": "KhachHangController.java", "file_ext": "java", "file_size_in_byte": 1230, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "797cf24fcf7a1a8fa8c78ecf3b0704364494c7a0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.example.demo.controller; import com.example.demo.dao.KhachhangDAO; import com.example.demo.dto.KhachHangDTO; import com.example.demo.model.KhachHang; import com.example.demo.model.Phong; import com.example.demo.repository.KhachHangRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; @Controller @RequestMapping("khach-hang") public class KhachHangController { @Autowired KhachHangRepository khachhangRepository; @Autowired KhachhangDAO khachhangDAO; @PostMapping("/add") public ResponseEntity<KhachHang> addKhachHang(@RequestBody KhachHangDTO khachHang){ Boolean check = khachhangDAO.addKhachHang(khachHang); if (check) return new ResponseEntity("Success", HttpStatus.ACCEPTED); else return new ResponseEntity("Fail", HttpStatus.BAD_REQUEST); } @GetMapping("/search") public ResponseEntity<KhachHang> searchKhachhang(@RequestParam String value){ return new ResponseEntity(khachhangDAO.searchKhachhang(value), HttpStatus.OK); } }
58e8f034-7835-40e4-ab56-b593350cde46
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2015-02-27T21:42:15", "repo_name": "savvytruffle/Astr511", "sub_path": "/HW2015/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1233, "line_count": 34, "lang": "en", "doc_type": "text", "blob_id": "ed1f819bdc3fe22c239bd54336d3cefc998dab4b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
* ipython notebooks with homework projects for Astr 511 class from Winter 2015 All assignments (and supporting files) are linked to http://www.astro.washington.edu/users/ivezic/t_astr511.html The first homework notebooks should go to Astr511/HW2015/Project1 Name your notebooks, using -your- last name (not "ivezic") as Astr511_HW0_ivezic.ipynb You need to fork this repo, add your notebook to the proper directory and then send me a pull request. * Paper assignments for in-class presentations: David Fleming: 3. Helmi & White 2001 (MNRAS 323, 529): "Simple dynamic models of the Sagittarius dwarf galaxy" Chris Suberlak: 4. Ibata et al. 2001 (ApJ 551, 294): "Great Circle Tidal Streams: Evidence for a Nearly Spherical Massive Dark Halo around the Milky Way" Grace Telford: 14. McGurk et al. 2010 (AJ, 139, 1261): "Principal Component Analysis of SDSS Stellar Spectra" Zhanglu Wang: 16. Schlaufman et al. 2009 (ApJ, 703, 2177): "Insight into the Formation of the Milky Way Through Cold Halo Substructure. I. The ECHOS of Milky Way Formation" Kolby Weisenburger: 13. Kauffmann et al. 2003 (MNRAS, 341, 33): "Stellar Masses and Star Formation Histories for 80,000 Galaxies from the Sloan Digital Sky Survey"
99c56ff0-91e5-418f-8e36-cad15e6ae972
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-02-15 04:13:26", "repo_name": "wcyz666/libapp", "sub_path": "/src/com/example/libapp/LibActivity.java", "file_name": "LibActivity.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 68, "lang": "en", "doc_type": "code", "blob_id": "7473cb8e323bea67ef83797abb33fae191c770d0", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.example.libapp; import java.net.URL; import java.text.DateFormat; import java.util.Date; public class LibActivity { private String eventTitle; private URL contentURL; private Date date; private String datestring; public LibActivity() { eventTitle = new String(""); } public void setTitle(String s) { eventTitle = s; } public String getTitle() { return eventTitle; } public void setURL(String url) { try { contentURL = new URL(url); } catch (Exception e){} } public void setDate(String s) { try { datestring = new String(s); date = DateFormat.getDateInstance().parse(s); } catch (Exception e) { date = new Date(); } } public Date getDate() { return this.date; } public String getDateString() { return this.datestring; } public URL getURL() { return contentURL; } public String getURLString() { return contentURL.toString(); } }
fb824dc5-5cc9-4769-852b-b142a06bbdb8
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-10 09:47:55", "repo_name": "devinbo/RRD", "sub_path": "/src/main/java/com/rrd/filter/DruidLoginFilter.java", "file_name": "DruidLoginFilter.java", "file_ext": "java", "file_size_in_byte": 1273, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "e521194279113bc7bc7f34b89aed76cccc07ccc8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.rrd.filter; import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * Created by Administrator on 2017/8/4. */ public class DruidLoginFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; String url = request.getRequestURI(); if(url.contains("/druid/")) { //如果是进入到监控管理台去, 那么需要进行session校验 if(request.getSession().getAttribute("adminUser") == null) { request.getRequestDispatcher("/adminuser.jsp").forward(request, response); }else{ filterChain.doFilter(servletRequest, servletResponse); } }else{ filterChain.doFilter(servletRequest, servletResponse); } } @Override public void destroy() { } }
f32db4a4-8ff9-408b-8620-a77d4fc9fc0a
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-10-04 13:54:07", "repo_name": "AntoTonyz/CarGarage", "sub_path": "/CarGarage/app/src/main/java/com/example/anto/cargarage/Booking.java", "file_name": "Booking.java", "file_ext": "java", "file_size_in_byte": 1232, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "49a95b5d2ab98a60ac67e1acd3f0ce5744e915f6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.example.anto.cargarage; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Spinner; public class Booking extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_booking); Spinner spinner1=(Spinner)findViewById(R.id.spinner1); String[] vehicles = new String[]{"Vehicle","Bus", "Truck", "Matatu","Personal Cars","Bikes"}; ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, vehicles); spinner1.setAdapter(adapter); Spinner spinner2=(Spinner)findViewById(R.id.spinner2); String[] Employees=new String[]{"Employee","John","Mark","Ken","Joshua","Kim"}; ArrayAdapter<String> adapter1=new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item,Employees); spinner2.setAdapter(adapter1); } }
cfa84b3d-1a5f-43cf-b4d6-741fd647b939
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-10 12:55:15", "repo_name": "Aaaaashin/ashin-mall", "sub_path": "/ashin-goods-service/src/main/java/com/ashin/controller/BrandController.java", "file_name": "BrandController.java", "file_ext": "java", "file_size_in_byte": 1246, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "0a5045d7b19c1e9e70c467ba384bcbbd71be8f3f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.ashin.controller; import com.ashin.entity.PageResult; import com.ashin.entity.QueryPageBean; import com.ashin.entity.Result; import com.ashin.pojo.Brand; import com.ashin.service.BrandService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping("/brand") public class BrandController { @Autowired private BrandService brandService; @GetMapping("/findPage") public PageResult findPage(QueryPageBean queryPageBean){ PageResult pageResult = brandService.findPage(queryPageBean); return pageResult; } @GetMapping("/findAll") public Result findAll(){ List<Brand> brandList = brandService.findAll(); return new Result(true,"查询成功", brandList); } @GetMapping("/find/{id}") public Result<Brand> findById(@PathVariable Integer id){ Brand brand = brandService.findById(id); return new Result(true,"查询成功", brand); } }
4e3af10a-5043-4cdc-90d3-e31f02147d15
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-10-05T15:49:46", "repo_name": "guymella/Hue_Console", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1232, "line_count": 46, "lang": "en", "doc_type": "text", "blob_id": "520f43263d87b2e6b23dd083ad7d4a48c8113cc6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
# Hue_Console Console app for interacting with Philips Hue API. Displays Full State of All lights on Bridge. Then will show only state changes after. if Username is not specified in the command line arguments the monitor will prompt you to initiate a handshake with the bridge device to get a username. # Simulator This program connects to the virtual Hue Bridge simulator. instructions at https://www.npmjs.com/package/hue-simulator # Arguments -v URL :: Specify Virtual Bridge URL, default = localhost. Use "localhost" for local virtual bridge -b URL :: Specify Actual Bridge URL -p port :: Specify Custom Port Number, default = 80 -u username :: Specify existing Username for bridge. Will initiate bridge handshake if username is not supplied. -f seconds :: Specify polling frequency for state monitor, Default = 2 seconds if -v is specified the API is set to Virtual Bridge Mode. # Example to connect to the Virtual bridge on local host port 8080 with default username. ./Hue_Console -v localhost -p 8080 -u newdeveloper to connect to the philips bridge on default port with handshake prompt. ./Hue_Console -b 10.0.0.238 -p 80 # Build in source directory. Run "cmake ." then "cmake --build ."
66f133d5-4b24-42dc-8dd1-1b88787ddf15
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-05 13:25:09", "repo_name": "camysandhu/CalculateMarks", "sub_path": "/app/src/main/java/com/example/calculatemarks/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1231, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "eca142430f3965294481c4e3d8df0f58f72cedd3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.example.calculatemarks; import androidx.appcompat.app.AppCompatActivity; import android.content.res.Configuration; import android.os.Bundle; import android.util.Log; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends AppCompatActivity { private static final String TAG = MainActivity.class.getSimpleName(); EditText m1; EditText m2; EditText m3; EditText m4; EditText m5; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Log.d(TAG, "onCreate()"); m1 = findViewById(R.id.ed3004); m1 = findViewById(R.id.ed3005); m1 = findViewById(R.id.ed3006); m1 = findViewById(R.id.ed3007); m1 = findViewById(R.id.ed3008); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { Log.d(TAG, "ORIENTATION_LANDSCAPE"); } else { Log.d(TAG, "ORIENTATION_PORTRAIT"); } } }
5a65a47d-6c65-45a6-a2ef-4b68e592beae
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-08-30 12:29:47", "repo_name": "gtu001/gtu-test-code", "sub_path": "/GTU/src/gtu/charset/CustomCharsetProvider.java", "file_name": "CustomCharsetProvider.java", "file_ext": "java", "file_size_in_byte": 1248, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "3c99931235d76899fe7ff27753e91e10b8d418e7", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"}
package gtu.charset; import java.nio.charset.Charset; import java.nio.charset.spi.CharsetProvider; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * 將此package包成檔案 CP937_FUCO.jar * 放到 C:\Program Files\Java\jdk1.8.0_73\jre\lib\ext\CP937_FUCO.jar * * Example : new String(bytearry, "CP937-FUCO") */ public class CustomCharsetProvider extends CharsetProvider { public CustomCharsetProvider() { } private List<Charset> charsets = new ArrayList<Charset>(); @Override public Iterator<Charset> charsets() { return charsets.iterator(); } @Override public Charset charsetForName(String charsetName) { charsetName = charsetName.toUpperCase(); for (Iterator<Charset> iter = charsets.iterator(); iter.hasNext();) { Charset charset = iter.next(); if (charset.name().equals(charsetName)) return charset; } for (Iterator<Charset> iter = charsets.iterator(); iter.hasNext();) { Charset charset = iter.next(); if (charset.aliases().contains(charsetName)) return charset; } return null; } }
b71fc850-7cb7-46e7-9bcf-7d1840bb8a4b
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-05-14 07:43:14", "repo_name": "bugzmanov/PSCafepos.fork", "sub_path": "/org/pscafepos/service/offline/ping/PingTimerTask.java", "file_name": "PingTimerTask.java", "file_ext": "java", "file_size_in_byte": 1231, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "76bd415c6bc28cd9186ec977a776d24817b3e39b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package org.pscafepos.service.offline.ping; import org.pscafepos.backends.database.jdbc.JdbcConnector; import org.pscafepos.backends.database.jdbc.JdbcUtils; import org.pscafepos.backends.database.jdbc.exception.JdbcConnectorException; import java.sql.Connection; import java.util.TimerTask; /** * @author bagmanov * Date: 04.09.2009 */ public class PingTimerTask extends TimerTask { private JdbcConnector connector; private boolean isConnected = false; private PingEventHandler eventHandler; public PingTimerTask(JdbcConnector connector, PingEventHandler eventHandler) { this.connector = connector; this.eventHandler = eventHandler; } public void run() { Connection connection = null; try { connection = connector.getNewConnection(); if (!isConnected) { eventHandler.onConnectionEstablished(); isConnected = true; } } catch (JdbcConnectorException e) { if (isConnected) { eventHandler.onConnectionLost(); isConnected = false; } } finally { JdbcUtils.closeIfNeededSilently(connection); } } }
60df13ce-59cb-4b62-a8be-75bbed3cfd5c
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-18 09:06:39", "repo_name": "Stellucidam/DigiBack_java_backend", "sub_path": "/src/main/java/ch/heigvd/digiback/business/activity/credential/StepCredentialDeserializer.java", "file_name": "StepCredentialDeserializer.java", "file_ext": "java", "file_size_in_byte": 1231, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "a41341f1062c91206ae092143a90843320e8ef64", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"}
package ch.heigvd.digiback.business.activity.credential; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.jackson.JsonComponent; import java.io.IOException; import java.sql.Date; @JsonComponent public class StepCredentialDeserializer extends JsonDeserializer<StepCredential> { private static final Logger logger = LoggerFactory.getLogger(StepCredentialDeserializer.class); @Override public StepCredential deserialize( JsonParser jsonParser, DeserializationContext deserializationContext ) throws IOException { JsonNode node = jsonParser.getCodec().readTree(jsonParser); Long idUser = node.get("idUser").longValue(); String date = node.get("date").asText(); Long nbrSteps = node.get("nbrSteps").longValue(); logger.info("Deserialized step"); return StepCredential.builder() .date(Date.valueOf(date)) .nbrSteps(nbrSteps) .build(); } }
bd651759-cdb2-40d8-a42b-afc2147edb07
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2011-12-08T17:34:26", "repo_name": "yorickvP/node-scgi-client", "sub_path": "/README.markdown", "file_name": "README.markdown", "file_ext": "markdown", "file_size_in_byte": 1230, "line_count": 36, "lang": "en", "doc_type": "text", "blob_id": "592b346ca0551a5ee41c3a5c4d0ddedb0cf41d5d", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"}
SCGI-Client =========== [Simple Common Gateway Interface](http://en.wikipedia.org/wiki/Simple_Common_Gateway_Interface) client for [node.js](http://nodejs.org/). This is basically a rewritten and updated version of [claudioc's node-scgi](https://github.com/claudioc/node-scgi), which I created so I could run firefox-sync behind a node proxy. Example ======= var SCGIClient = require('scgi-client'); var http = require('http'); http.createServer(SCGIClient(8085)).listen(80) Usage ======= SCGIClient(port, [host], [opts])(request, response) SCGIClient(path, [opts])(request, response) opts = { mountPoint: '', // when you have http://abc.def.com/blahscript/ and want blahscript to be your scgi path serverName: 'unknown', // ip/hostname of your server, passed to the scgi server serverPort: 80, // port of your server, passed to the scgi server documentRoot: '' } // directory your webserver is serving documents from, passed to scgi server Installation ============ npm install scgi-client Missing things ============== AUTH_TYPE and REMOTE_USER headers are not sent, because they seem to break firefox-sync. I've also not implemented them with digest auth.
64c6c5c0-09ee-4a5f-8bbc-be41e59ed8d2
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-08 10:09:49", "repo_name": "ZhuangCurator/curator-exam", "sub_path": "/curator-exam-paper/curator-exam-paper-backend/curator-exam-paper-backend-question-bank/src/main/java/com/curator/backend/paper/question/bank/entity/BankQuestion.java", "file_name": "BankQuestion.java", "file_ext": "java", "file_size_in_byte": 1318, "line_count": 65, "lang": "en", "doc_type": "code", "blob_id": "06ba90d3f3bf074f460d52ef9b417dd39c2dfd6e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.curator.backend.paper.question.bank.entity; import com.baomidou.mybatisplus.annotation.*; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; import java.time.LocalDateTime; /** * 试题库与试题关联表 * * @author Jun * @since 2021-05-08 */ @Data @EqualsAndHashCode(callSuper = false) public class BankQuestion implements Serializable { private static final long serialVersionUID = 1L; @TableId(value = "bank_question_id", type = IdType.ASSIGN_ID) private String bankQuestionId; /** * 试题库ID */ private String questionBankId; /** * 试题ID */ private String questionId; /** * 创建账户 id */ private String createAccountId; /** * 创建账户父账户 id */ private String parentAccountId; /** * 1 表示删除,0 表示未删除 */ @TableLogic @TableField(value = "is_deleted", fill = FieldFill.INSERT) private Integer deleted; /** * 插入时间 */ @TableField(fill = FieldFill.INSERT) private LocalDateTime createTime; /** * 更新时间 */ @TableField(fill = FieldFill.INSERT_UPDATE) private LocalDateTime updateTime; }
3c66303e-490a-46e5-b1b5-6a50c492adc8
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-20 16:20:54", "repo_name": "dengxianwei317/springboot-manage-system", "sub_path": "/src/main/java/com/spring/controller/file/ImageController.java", "file_name": "ImageController.java", "file_ext": "java", "file_size_in_byte": 1235, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "4877cc7e74fb1df7d940b48e54595e30a75bf90e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.spring.controller.file; import com.spring.entity.common.Result; import com.spring.service.file.FileImageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.stereotype.Controller; import org.springframework.web.multipart.MultipartFile; import java.util.Map; /** * <p> * 图片 * </p> * * @author dxw * @since 2020-08-29 */ @Controller @RequestMapping("api/file") public class ImageController { @Autowired FileImageService imageService; @PostMapping(value = "/upload") @ResponseBody public Result upload(@RequestParam(name = "file") MultipartFile[] files) { Result result = null; try { result = imageService.upload(files); } catch (Exception e) { e.printStackTrace(); } return result; } @GetMapping(value = "/getPageList") @ResponseBody public Result getPageList(@RequestParam Map<Object, Object> params) { Result result = null; try { result = imageService.getPageListFile(params); } catch (Exception e) { e.printStackTrace(); } return result; } }
f425c2c0-1717-40b6-a0f8-653a182f9c12
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-22 02:59:04", "repo_name": "tttttttt222/udp-frame-service", "sub_path": "/udp-frame-demo/src/main/java/com/udp/frame/demo/utils/MsgPackageUtils.java", "file_name": "MsgPackageUtils.java", "file_ext": "java", "file_size_in_byte": 1263, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "02c0621bc9facc57ff270a5b03537cbfff30d50d", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.udp.frame.demo.utils; import com.udp.frame.demo.dto.MsgPackage; import java.net.InetSocketAddress; import java.util.List; /** * 项目名称:udp-frame-demo * 描述: * 创建人:ryw * 创建时间:2018/5/18 */ public class MsgPackageUtils { public static <T> MsgPackage<T> createMsgPackage(String sender, List<String> receivers, InetSocketAddress serverAddress,T data){ //连接包 MsgPackage<T> msgPackage = new MsgPackage<T>(); msgPackage.setSender(sender); msgPackage.setAddress(serverAddress); msgPackage.setReceivers(receivers); msgPackage.setInfo(data); return msgPackage; } public static <T> MsgPackage<T> copyMsgPackage(MsgPackage<T> msgPackage){ MsgPackage<T> objectMsgPackage = new MsgPackage<>(); objectMsgPackage.setType(msgPackage.getType()); objectMsgPackage.setSeq(msgPackage.getSeq()); objectMsgPackage.setFrame(msgPackage.getFrame()); objectMsgPackage.setAddress(msgPackage.getAddress()); objectMsgPackage.setSender(msgPackage.getSender()); objectMsgPackage.setReceivers(msgPackage.getReceivers()); objectMsgPackage.setInfo(msgPackage.getInfo()); return objectMsgPackage; } }
10d1854f-b576-4507-ba1c-fa74212f223a
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-31 23:25:33", "repo_name": "douglasselph/weatherhunt", "sub_path": "/WeatherHunt/app/src/main/java/com/dugsolutions/weatherhunt/MyApplication.java", "file_name": "MyApplication.java", "file_ext": "java", "file_size_in_byte": 1231, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "aac5e5f559cdb044cc9abe8d45d7ee61716855fc", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.dugsolutions.weatherhunt; import android.app.Application; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import com.dugsolutions.weatherhunt.data.BitmapHelper; import timber.log.Timber; /** * Created by dug on 7/19/17. */ public class MyApplication extends Application { ConnectivityManager mCM; @Override public void onCreate() { super.onCreate(); mCM = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); BitmapHelper.Init(); if (BuildConfig.DEBUG) { Timber.plant(new Timber.DebugTree()); } } public void huntForWeather(String loc) { if (hasConnection()) { Intent intent = new Intent(this, WeatherHunterService.class); intent.putExtra(WeatherHunterService.GET_WEATHER_LOCATION, loc); startService(intent); } } boolean hasConnection() { final NetworkInfo ni = mCM.getActiveNetworkInfo(); if (ni != null) { if (ni.getType() == ConnectivityManager.TYPE_WIFI) { return true; } } return false; } }
8147bfc9-5fa4-4040-a1d9-86c1f25b5c02
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-21 15:47:12", "repo_name": "charlieboggus/simple-game-library", "sub_path": "/src/main/java/com/github/charlieboggus/sgl/graphics/gl/GLVertexArray.java", "file_name": "GLVertexArray.java", "file_ext": "java", "file_size_in_byte": 1231, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "eeee75fc04596aa8b764aa7aaae3c42580553a6a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.github.charlieboggus.sgl.graphics.gl; import static org.lwjgl.opengl.GL20.glDisableVertexAttribArray; import static org.lwjgl.opengl.GL20.glEnableVertexAttribArray; import static org.lwjgl.opengl.GL20.glVertexAttribPointer; import static org.lwjgl.opengl.GL30.glBindVertexArray; import static org.lwjgl.opengl.GL30.glDeleteVertexArrays; import static org.lwjgl.opengl.GL30.glGenVertexArrays; public class GLVertexArray { private final int id; public GLVertexArray() { this.id = glGenVertexArrays(); } public void destroy() { glDeleteVertexArrays(this.id); } public int getID() { return this.id; } public void bind() { glBindVertexArray(this.id); } public void unbind() { glBindVertexArray(0); } public void enableVertexAttribute(int location) { glEnableVertexAttribArray(location); } public void disableVertexAttribute(int location) { glDisableVertexAttribArray(location); } public void setVertexAttributePointer(int location, int size, int type, int stride, int offset) { glVertexAttribPointer(location, size, type, false, stride, offset); } }
e731f292-7ca4-435d-84da-eefdf295249c
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-06-16 08:10:29", "repo_name": "OpenConext/OpenConext-pdp", "sub_path": "/pdp-server/src/test/java/pdp/access/BasicAuthenticationManagerTest.java", "file_name": "BasicAuthenticationManagerTest.java", "file_ext": "java", "file_size_in_byte": 1230, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "968ce2cf14b7daf1703c559b9ca057bd66b77bd9", "star_events_count": 8, "fork_events_count": 13, "src_encoding": "UTF-8"}
package pdp.access; import org.junit.Test; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.userdetails.UsernameNotFoundException; import static org.junit.Assert.assertEquals; public class BasicAuthenticationManagerTest { private BasicAuthenticationProvider manager = new BasicAuthenticationProvider("user", "password"); @Test public void testAuthenticateHappyFlow() throws Exception { Authentication authenticate = manager.authenticate(new TestingAuthenticationToken("user", "password")); assertEquals("[ROLE_USER, ROLE_PEP]", authenticate.getAuthorities().toString()); } @Test(expected = UsernameNotFoundException.class) public void testAuthenticateUsername() throws Exception { manager.authenticate(new TestingAuthenticationToken("unknown", "password")); } @Test(expected = BadCredentialsException.class) public void testAuthenticateBadCredentials() throws Exception { manager.authenticate(new TestingAuthenticationToken("user", "faulty")); } }
761a125b-6898-49f8-8ae2-0c9c6b635f0b
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-08-29 10:11:28", "repo_name": "hanqunfeng/springbootchapter", "sub_path": "/chapter27/src/main/java/com/example/runner/IndexController.java", "file_name": "IndexController.java", "file_ext": "java", "file_size_in_byte": 1231, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "e18345e3e1a1b44690af795a015927f8d4420bc7", "star_events_count": 9, "fork_events_count": 10, "src_encoding": "UTF-8"}
package com.example.runner; import com.example.externalproperties.PropertiesDemo; import com.example.utils.ExternalPropertiesRefresh; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * <p>index</p> * Created by hanqf on 2020/4/16 22:36. */ @RestController public class IndexController { @Autowired private ExternalPropertiesRefresh externalPropertiesRefresh; @Autowired private PropertiesDemo propertiesDemo; @RequestMapping("/") public String index() { return "hello world"; } @RequestMapping("/refresh") public String refreshpro() { externalPropertiesRefresh.refresh(); return "refresh properties success"; } @RequestMapping("/{beanName}/refresh") public String refreshProByBeanName(@PathVariable String beanName) { externalPropertiesRefresh.refresh(beanName); return "refresh properties success for " + beanName; } @RequestMapping("/demo") public PropertiesDemo demo() { return propertiesDemo; } }
2ab00e0f-151d-45b7-bf9e-d7d4eaefd4c2
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-06-08 13:35:31", "repo_name": "Rahghul/Infralog", "sub_path": "/app/src/main/java/com/sncf/itif/Menu/ActAboutUs.java", "file_name": "ActAboutUs.java", "file_ext": "java", "file_size_in_byte": 1231, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "12c876641d7bf7b28969c86b7fa471b6a66c5371", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"}
package com.sncf.itif.Menu; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.Html; import android.view.MenuItem; import android.widget.TextView; import android.widget.Toast; import com.sncf.itif.R; public class ActAboutUs extends AppCompatActivity { TextView tvAboutUs; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.act_about_us); getSupportActionBar().setTitle(getResources().getString(R.string.main_act_menu_action_a_propos)); getSupportActionBar().setSubtitle(R.string.global_tv_short_title); getSupportActionBar().setDisplayHomeAsUpEnabled(true); tvAboutUs = (TextView) findViewById(R.id.tv_about_us); } @Override protected void onStart() { tvAboutUs.setText(getString(R.string.act_about_us_tv_context)); super.onStart(); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: super.onBackPressed(); break; } return super.onOptionsItemSelected(item); } }
cd501628-b727-4215-bc41-9c0990c2d22f
{"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-12 09:13:10", "repo_name": "SKKU-Capstone-Team2/danshow-server", "sub_path": "/src/main/java/com/danshow/danshowserver/domain/comment/Comment.java", "file_name": "Comment.java", "file_ext": "java", "file_size_in_byte": 1303, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "78fd45105b844faadbb6973aa8c2b21fb68f4b20", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"}
package com.danshow.danshowserver.domain.comment; import com.danshow.danshowserver.domain.BaseTimeEntity; import com.danshow.danshowserver.domain.user.Member; import com.danshow.danshowserver.domain.video.post.CoverVideoPost; import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; @Setter @Getter @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) public class Comment extends BaseTimeEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name ="comment_id") private Long id; private String comment; @ManyToOne @JoinColumn(name="user_id") private Member member; /*멤버 쪽에선 자기가 단 코멘트 조회 안해도 될거 같아 단방향으로 했습니다*/ @ManyToOne @JoinColumn(name ="video_post_id") private CoverVideoPost coverVideoPost; public void setComment(CoverVideoPost coverVideoPost) { this.coverVideoPost = coverVideoPost; //무한루프 방지 if(!coverVideoPost.getCommentList().contains(this)) { coverVideoPost.getCommentList().add(this); } } public void setCoverVideoPost(CoverVideoPost coverVideoPost) { this.coverVideoPost = coverVideoPost; } }
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
9