id stringlengths 36 36 | meta stringlengths 429 697 | url stringlengths 27 109 | tokens int64 137 584 | domain_prefix stringlengths 16 106 | score float64 0.16 0.3 | code_content stringlengths 960 1.25k |
|---|---|---|---|---|---|---|
c2f029e8-c6ab-45da-9e37-d2c17744268d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-22 19:33:54", "repo_name": "antonialoytorrens/pa-amb-oli", "sub_path": "/packages/Pamboliada_webapp_1.1-Android4.0+/app/src/main/java/com/pamboliada_webapp/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1193, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "ad6f845c11f08d54b297175f26919857662f7f8c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/antonialoytorrens/pa-amb-oli | 226 | FILENAME: MainActivity.java | 0.2227 | package com.pamboliada_webapp;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
public class MainActivity extends Activity {
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView = (WebView) findViewById(R.id.webview);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("https://www.pamboliada.cat");
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
if (18 < Build.VERSION.SDK_INT ){
//18 = JellyBean MR2, KITKAT=19
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
}
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
webView.reload();
}
});
}
}
|
6684ff23-840e-4f4b-905f-54310b25357f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2014-12-01T18:23:47", "repo_name": "dreck410/ARMSimulator", "sub_path": "/docs/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1193, "line_count": 35, "lang": "en", "doc_type": "text", "blob_id": "899650533834b2aa01c0f034aab06c9b5fa2ed6d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "WINDOWS-1252"} | https://github.com/dreck410/ARMSimulator | 304 | FILENAME: README.md | 0.245085 | GDBStub
=======
The finished product of a project at Bob Jones University. A complete userguide is located in sim2Report
Division of labor: during the GDB stub phase
An implemention of a gbd server for CpS 310 at BJU
Requirements
· Initial connect/handshake [C-level] -- Benjamin (FINISHED)
· Implement CPU methods in handshake -- Benjamin (FINISHED)
· Get/set general purpose registers [C] -- Daniel (FINISHED)
· Get/set regions of memory [C] -- Daniel (FINISHED)
· Single step/continue (execution faked at first, of course) [C] -- Benjamin (FINISHED) /Daniel(FINISHED)
· Load new binary image [B-level] --
gdb will use mov commands instead if you reply with an empty packet.
· Set/clear software breakpoints [A-level] -- Daniel(FINISHED) /Benjamin (FINISHED)
1110,00010010, immed 19..8, 0111, immed 3..0
where immed is ignored by arm hardware but can be used by a debugger
to store additional information about the breakpoint
All requirements are believed to have been completed.
GDB stub phase completed back to solo projects.
The simulator can intereact with a gdb client for debugging purposes.
|
f6ec0e03-0433-48d0-9c39-8d6f72fcd5ea | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-23 07:04:30", "repo_name": "enchenDai/grampusMiddle", "sub_path": "/src/main/java/com/deepblue/middleware/config/MiddlewareDatabaseConfiguration.java", "file_name": "MiddlewareDatabaseConfiguration.java", "file_ext": "java", "file_size_in_byte": 1098, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "1a5e48e5a102da00e0855e399c63353c2ca06dd3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/enchenDai/grampusMiddle | 174 | FILENAME: MiddlewareDatabaseConfiguration.java | 0.205615 |
package com.deepblue.middleware.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource;
@Configuration
@EnableJpaRepositories("com.deepblue.middleware.repository.middleware")
@EnableTransactionManagement
public class MiddlewareDatabaseConfiguration {
private final Logger log = LoggerFactory.getLogger(MiddlewareDatabaseConfiguration.class);
private final Environment env;
public MiddlewareDatabaseConfiguration(Environment env) {
this.env = env;
}
@Bean
@ConfigurationProperties(prefix="spring.datasource.middleware")
public DataSource dataSource() {
return new com.alibaba.druid.pool.DruidDataSource();
}
}
|
9d80ad7b-06a8-4d80-953f-5dfd5ac2ba5d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2011-03-09 07:56:59", "repo_name": "juanromanf/mypsp", "sub_path": "/mypsp/src/common/MyDefects.java", "file_name": "MyDefects.java", "file_ext": "java", "file_size_in_byte": 970, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "4f66644bb99c39fc04ffd816297a280cbe30bae9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/juanromanf/mypsp | 209 | FILENAME: MyDefects.java | 0.277473 | package common;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
@SuppressWarnings("serial")
public class MyDefects extends Properties {
public MyDefects(String path) throws FileNotFoundException, IOException {
this.load(new FileInputStream(path + File.separator
+ "checklist.properties"));
}
public MyDefect getDefect(String defectId) {
return new MyDefect(defectId, this.getProperty(defectId));
}
public final class MyDefect {
String id;
String description;
public MyDefect(String id, String desc) {
this.id = id;
this.description = desc;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String desc) {
this.description = desc;
}
}
}
|
b7735e36-f0ac-494a-990a-d086949acb84 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-23 10:14:32", "repo_name": "meiheyoupin/meiheyoupin", "sub_path": "/src/main/java/com/meiheyoupin/common/pay/WXPayConfig.java", "file_name": "WXPayConfig.java", "file_ext": "java", "file_size_in_byte": 1085, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "ea562fb8233b42181e2490ad0fa1114b0d9bae26", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/meiheyoupin/meiheyoupin | 292 | FILENAME: WXPayConfig.java | 0.271252 | package com.meiheyoupin.common.pay;
import java.io.*;
public class WXPayConfig implements com.github.wxpay.sdk.WXPayConfig {
private byte[] certData;
public WXPayConfig() throws IOException {
String certPath = this.getClass().getResource("/").getPath() + "apiclient_cert.p12";
File file = new File(certPath);
InputStream certStream = new FileInputStream(file);
this.certData = new byte[(int) file.length()];
certStream.read(this.certData);
certStream.close();
}
@Override
public String getAppID() {
return "wx4a300c4010f4be69";
}
@Override
public String getMchID() {
return "1414743002";
}
@Override
public String getKey() {
return "66fb35add2f7242f24102a9380115abb";
}
@Override
public InputStream getCertStream() {
return new ByteArrayInputStream(this.certData);
}
@Override
public int getHttpConnectTimeoutMs() {
return 8000;
}
@Override
public int getHttpReadTimeoutMs() {
return 10000;
}
}
|
2b7c7698-ba67-4c94-a541-852f93fa437e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-15 19:57:10", "repo_name": "priyanshagarwal18/Miriad", "sub_path": "/app/src/main/java/com/priyanshagarwal/miriad/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 1193, "line_count": 60, "lang": "en", "doc_type": "code", "blob_id": "cb646671a5cd3dadddd4460e18add62a87b0a662", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/priyanshagarwal18/Miriad | 243 | FILENAME: User.java | 0.23092 | package com.priyanshagarwal.miriad;
import java.io.Serializable;
import java.util.List;
public class User implements Serializable {
private String firstName,lastName;
public void setBest(List<String> best) {
this.best = best;
}
private List<String> best;
private String username,password;
private String email,phoneNo;
public User(String firstName,String lastName,List<String> best,String username,String password,String email,String phoneNo)
{
this.best=best;
this.email=email;
this.firstName=firstName;
this.lastName=lastName;
this.phoneNo=phoneNo;
this.username=username;
this.password=password;
}
public User()
{
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public List<String> getBest() {
return best;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public String getEmail() {
return email;
}
public String getPhoneNo() {
return phoneNo;
}
}
|
e905d392-9400-405c-bf34-f3f356c91685 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-12 08:44:38", "repo_name": "HUFGhani/pattern-based-survey", "sub_path": "/src/main/java/man/survey/TextQuestion.java", "file_name": "TextQuestion.java", "file_ext": "java", "file_size_in_byte": 972, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "9dcfc7f2f4513a695b21357735bc07c697674554", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/HUFGhani/pattern-based-survey | 217 | FILENAME: TextQuestion.java | 0.240775 | package man.survey;
public class TextQuestion extends Question {
private int id;
private String questionText;
private Answer answer;
public TextQuestion(){}
public TextQuestion(int id, String questionText) {
this.id = id;
this.questionText = questionText;
}
@Override
public int getId() {
return this.id;
}
@Override
public void setId(int id) {
this.id=id;
}
@Override
public String getQuestionText() {
return this.questionText;
}
@Override
public void setQuestionText(String questionText) {
this.questionText=questionText;
}
@Override
public Answer getAnswer() {
return this.answer;
}
@Override
public void setAnswer(Answer answer) {
this.answer = answer;
}
@Override
public void clearAnswer() {
this.answer = null;
}
@Override
public void setScale(int scale) {
}
}
|
c024b9ab-14a5-4649-b1f1-7230bed14b45 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-09-12T19:37:26", "repo_name": "faiyazrafeek/react_revision", "sub_path": "/fa-blog/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1047, "line_count": 38, "lang": "en", "doc_type": "text", "blob_id": "adce0f0b3a2cb3450246e5be861adac532f4b5be", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/faiyazrafeek/react_revision | 264 | FILENAME: README.md | 0.221351 | # FA Blog
Simpe micro blog application using React.
## API
Dummy API created using JSON server. You can just run `npm i -g json-server` to install JSON Server globally.
Then run `npx json-server --watch data/db.json --port 8000` this command to run your dummy backend.
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.\
You will also see any lint errors in the console.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
### Deployment
You just pull this repo to netlify with build command. [deploy-to-netlify](https://www.netlify.com/blog/2016/09/29/a-step-by-step-guide-deploying-on-netlify/) for more info
### Credits
@iamshaunjp
|
6ddfebb3-9e39-4ba3-930f-980ab8252724 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-02-02 07:56:56", "repo_name": "kiocahduaf/hahgz", "sub_path": "/src/main/java/com/jswhzl/api/entity/RolePermission.java", "file_name": "RolePermission.java", "file_ext": "java", "file_size_in_byte": 1122, "line_count": 66, "lang": "en", "doc_type": "code", "blob_id": "eec0b5e0db9de5c14ea14dbffacbbc889540d119", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kiocahduaf/hahgz | 269 | FILENAME: RolePermission.java | 0.229535 | package com.jswhzl.api.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jswhzl.common.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author xuchao
* @since 2018-11-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_role_permission")
public class RolePermission extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
/**
* 角色id
*/
@TableField("roleId")
private Long roleId;
/**
* 权限菜单id
*/
@TableField("perId")
private Long perId;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public Long getPerId() {
return perId;
}
public void setPerId(Long perId) {
this.perId = perId;
}
}
|
46037a43-ded7-4d2f-a962-181f88a39577 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-12-17 14:44:18", "repo_name": "Trambulin/oejee2015", "sub_path": "/projects/Javacsinta/jcs-ejbservice/src/main/java/hu/oe/pancakestore/ejbservice/holder/PancakeStateHolderImpl.java", "file_name": "PancakeStateHolderImpl.java", "file_ext": "java", "file_size_in_byte": 969, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "7bd2ece9d156f14bc4e5a916f41add1e6acdc785", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Trambulin/oejee2015 | 219 | FILENAME: PancakeStateHolderImpl.java | 0.288569 | package hu.oe.pancakestore.ejbservice.holder;
import javax.annotation.PostConstruct;
import javax.ejb.ConcurrencyManagement;
import javax.ejb.ConcurrencyManagementType;
import javax.ejb.Singleton;
import javax.ejb.Lock;
import javax.ejb.LockType;
import org.apache.log4j.Logger;
@Singleton(mappedName = "ejb/pancakestoreState")
@ConcurrencyManagement(ConcurrencyManagementType.CONTAINER)
public class PancakeStateHolderImpl implements PancakeStateHolder {
private static final Logger LOGGER = Logger.getLogger(PancakeStateHolderImpl.class);
private int reduction;
@PostConstruct
public void initialize() {
LOGGER.info("PancakeStateHolder is initialized.");
this.reduction=0;
}
@Override
@Lock(LockType.READ)
public int getCurrentReduction() {
return this.reduction;
}
@Override
@Lock(LockType.WRITE)
public void setCurrentReduction(int reduction) {
LOGGER.info("Change reduction rate: " + reduction);
this.reduction=reduction;
}
}
|
559ceb33-7f7c-4fa0-98d7-d02aa894b31a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-03-27T09:07:26", "repo_name": "foramjimuliak/mean-stack-app", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1193, "line_count": 26, "lang": "en", "doc_type": "text", "blob_id": "59d0994b2382870366c5f3de899433147acd78c3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/foramjimuliak/mean-stack-app | 280 | FILENAME: README.md | 0.243642 | # Modern Web Application using MEAN stack
This is a user search application for the MEAN stack ([MongoDB](https://www.mongodb.org/), [Express](http://expressjs.com/), [AngularJS](https://angularjs.org/) and [Node.js](https://nodejs.org))
#### Features
- MVC project structure
- User list and user search
- Authentication with username/password
- Protected routes that can only be accessed by authenticated users
- Bootstrap CSS framework
- [Mongoose](https://github.com/Automattic/mongoose) for MongoDB interactions.
## Application Requirements
- [Node.js (version 8.x or 10.x.)& NPM](https://nodejs.org/en/download/)
- [MongoDB](https://docs.mongodb.com/manual/administration/install-community/)
## Getting Started
##### Local Application Development
1. Clone or download this repo onto your machine.
2. Install [application requirements](#application-requirements) if not done so already.
3. Open application directory in your terminal and run `npm install`
4. Go to api folder and run `npm install`
5. Run `ng serve --o` on root folder to start angular app
6. Run `node server.js` to start your node server
7. Open a browser to the link provided in the terminal prompt to view your app
|
e664e30c-0d3b-4640-b78a-409fe96b3352 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-04-09T12:09:31", "repo_name": "impyadav/Hindi-Question-Answering-with-Haystack", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 973, "line_count": 24, "lang": "en", "doc_type": "text", "blob_id": "ccee85995ec93f0951e02e6c8f9b91712b8075d5", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/impyadav/Hindi-Question-Answering-with-Haystack | 341 | FILENAME: README.md | 0.276691 | # Building End-to-End to Question Answering system using Haystack.
1. Fine-Tune any base QA model on your custom dataset.
2. Basic building block of QA system in few lines of code using Haystack.
3. Training Content: History Books (In Hindi Language)
If you want to get detailed explanation of this app, please refer to my blog: https://impyadav.medium.com/building-end-to-end-question-answering-system-for-hindi-language-using-haystack-f4f6345766f2
<img width="697" alt="qa_ss_2" src="https://user-images.githubusercontent.com/20835098/114177819-78ef7f00-995a-11eb-8c2a-849da53b444d.PNG">
<img width="721" alt="qa_ss_6" src="https://user-images.githubusercontent.com/20835098/114177855-83aa1400-995a-11eb-93d7-f5333fb433a0.PNG">
To get started, install the below libs:
1. !pip install git+https://github.com/deepset-ai/haystack.git
2. !pip install urllib3==1.25.4
3. !pip install sentence-transformers
4. !pip install streamlit
5. !pip install st-annotated-text
|
07acf351-8d0f-4784-a2f7-b124afaa39c4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-06 07:23:16", "repo_name": "dbdmsdn10/JSPandServlet", "sub_path": "/src/test1/himyfriend.java", "file_name": "himyfriend.java", "file_ext": "java", "file_size_in_byte": 986, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "d5a9e2128895bf7674b6bc8cddd952f5ee11a16b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dbdmsdn10/JSPandServlet | 190 | FILENAME: himyfriend.java | 0.246533 | package test1;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class himyfriend
*/
@WebServlet("/himyfriend")
public class himyfriend extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
response.setCharacterEncoding("UTF-8");//이것과 아래것
response.setContentType("text/html; charset=UTF-8");
PrintWriter out=response.getWriter();
String fname=request.getParameter("first_name");
String lname=request.getParameter("last_name");
out.println("<html>");
out.println("<body>");
out.println("<h1>hellow 확인, "+fname+" "+lname+"</h1>");
out.println("</body>");
out.println("</html>");
out.close();
}
}
|
916a99b3-0e85-49cc-ada2-1c08fe320b3c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-02-04 10:20:12", "repo_name": "KartikSareen18/Kartik-EPAM", "sub_path": "/Maven/epam/src/main/java/sweets/Sweet.java", "file_name": "Sweet.java", "file_ext": "java", "file_size_in_byte": 967, "line_count": 51, "lang": "en", "doc_type": "code", "blob_id": "6098973d143b3ff4619fecbfd8f3031191bfd277", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/KartikSareen18/Kartik-EPAM | 213 | FILENAME: Sweet.java | 0.281406 | package sweets;
public class Sweet implements Comparable<Sweet>{
private String sweetName;
private int price;
private int weight;
public Sweet(String sweetName,int price,int weight)
{
this.sweetName=sweetName;
this.price=price;
this.weight=weight;
}
public String getName()
{
return sweetName;
}
public int getPrice()
{
return price;
}
public int getSweetWeight()
{
return weight;
}
public void setSweetName(String sweetName) {
this.sweetName = sweetName;
}
public void setPrice(int price) {
this.price = price;
}
public void setWeight(int weight) {
this.weight = weight;
}
public String toString(){
return "Sweet name : "+sweetName+" weight : "+weight+" price : "+price;
}
public int compareTo(Sweet s){
int result= getPrice()-s.getPrice();
return result;
}
} |
93a32a4e-dcb7-4d95-900d-96f3616410e5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-16 01:46:18", "repo_name": "hzr958/myProjects", "sub_path": "/scmv6/web-v8pub/src/main/java/com/smate/web/v8pub/service/fileimport/FileImportServiceImpl.java", "file_name": "FileImportServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1199, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "2b8be6d5331a7ec606f30edb17786290cf99023a", "star_events_count": 2, "fork_events_count": 3, "src_encoding": "UTF-8"} | https://github.com/hzr958/myProjects | 270 | FILENAME: FileImportServiceImpl.java | 0.279828 | package com.smate.web.v8pub.service.fileimport;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import com.smate.web.v8pub.service.fileimport.extract.FileExtractService;
import com.smate.web.v8pub.service.fileimport.extract.PubSaveDataForm;
/**
*
* @author aijiangbin
* @date 2018年7月30日
*/
public class FileImportServiceImpl implements FileImportService {
private Logger logger = LoggerFactory.getLogger(getClass());
private Map<String, FileExtractService> fileExtractService;
@Override
public PubSaveDataForm initFile(MultipartFile file, String dbType) throws Exception {
if (file == null || StringUtils.isBlank(dbType) || fileExtractService.get(dbType) == null) {
return null;
}
PubSaveDataForm form = fileExtractService.get(dbType).extract(file);
return form;
}
public Map<String, FileExtractService> getFileExtractService() {
return fileExtractService;
}
public void setFileExtractService(Map<String, FileExtractService> fileExtractService) {
this.fileExtractService = fileExtractService;
}
}
|
286a93cb-6894-4627-8ec8-c8c3456525bd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2022-06-15T12:59:47", "repo_name": "pytorch/elastic", "sub_path": "/.github/ISSUE_TEMPLATE/bug-report.md", "file_name": "bug-report.md", "file_ext": "md", "file_size_in_byte": 1195, "line_count": 57, "lang": "en", "doc_type": "text", "blob_id": "3c10116438fdc507c7b4aa4c7777b4f0a03a86f2", "star_events_count": 777, "fork_events_count": 110, "src_encoding": "UTF-8"} | https://github.com/pytorch/elastic | 313 | FILENAME: bug-report.md | 0.286169 | ---
name: "\U0001F41B Bug Report"
about: Submit a bug report to help us improve PyTorch Elastic
---
## 🐛 Bug
<!-- A clear and concise description of what the bug is. -->
Component (check all that applies):
* [ ] `state api`
* [ ] `train_step api`
* [ ] `train_loop`
* [ ] `rendezvous`
* [ ] `checkpoint`
* [ ] `rollback`
* [ ] `metrics`
* [ ] `petctl`
* [ ] `examples`
* [ ] `docker`
* [ ] other
## To Reproduce
Steps to reproduce the behavior:
1.
1.
1.
<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->
## Expected behavior
<!-- A clear and concise description of what you expected to happen. -->
## Environment
- torchelastic version (e.g. 0.1.0rc1):
- OS (e.g., Linux):
- How you installed torchelastic (`conda`, `pip`, source, `docker`):
- Docker image and tag (if using docker):
- Build command you used (if compiling from source):
- Git commit (if installed from source):
- Python version:
- CUDA/cuDNN version:
- GPU models and configuration:
- Execution environment (on-prem, aws, etc):
- Any other relevant information:
## Additional context
<!-- Add any other context about the problem here. -->
|
4de24cbd-afb0-4362-add5-7ba84e686bff | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-31T01:46:32", "repo_name": "KoddieBecker/Object-Compositing", "sub_path": "/src/com/company/Model/CheckingAccount.java", "file_name": "CheckingAccount.java", "file_ext": "java", "file_size_in_byte": 967, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "306b589e3ca01376a6b3a64f81417d0c149f4b65", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/KoddieBecker/Object-Compositing | 202 | FILENAME: CheckingAccount.java | 0.282988 | package com.company.Model;
public class CheckingAccount extends BankAccount {
private final double overDraftFee = 25;
private double overDraftLimit = 0;
public CheckingAccount(double balance) {
super(balance); //command n to get this code
}
@Override
public double withdraw(double amount) {
if (balance - amount < overDraftLimit) {
balance = balance - amount - overDraftFee;
System.out.println("Your account is overdrawn by $ " + amount);
System.out.println("Your account has been assessed an over draft " +
"fee $ " + overDraftFee + "new" + balance);
return balance;
} else {
balance -= amount;
System.out.println("Withdraw from checking $ " + amount + "new balance $ " + balance);
return balance;
}
}
@Override
public String toString() {
return "Checking Account";
}
}
|
d77e00f6-aba5-457b-aa90-e30d86eca1c5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-12 10:17:27", "repo_name": "HaiFengZhiNeng/BankApp", "sub_path": "/app/src/main/java/com/example/bankapp/moneyService/MoneyServicePresenter.java", "file_name": "MoneyServicePresenter.java", "file_ext": "java", "file_size_in_byte": 1211, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "cb2e222bc32c4e3af4300c2974ba0a8b05fc8016", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/HaiFengZhiNeng/BankApp | 263 | FILENAME: MoneyServicePresenter.java | 0.283781 | package com.example.bankapp.moneyService;
import android.os.Bundle;
import com.example.bankapp.base.presenter.BasePresenter;
/**
* Created by dell on 2017/12/11.
*/
public class MoneyServicePresenter extends BasePresenter<IMoneyServiceView> {
private boolean isIntroduce = true;
private boolean isIntroduceFinance = true;
public MoneyServicePresenter(IMoneyServiceView mView) {
super(mView);
}
@Override
public void onCreate(Bundle saveInstanceState) {
super.onCreate(saveInstanceState);
}
//理财介绍
public void setIntroduceVisibility() {
if (isIntroduce) {
mView.isIntroduceVisibility(false);
} else {
mView.isIntroduceVisibility(true);
}
isIntroduce = !isIntroduce;
}
//理财与财经
public void setIntroduceFinanceVisibility() {
if (isIntroduceFinance) {
mView.isIntroduceFinanceVisibility(false);
} else {
mView.isIntroduceFinanceVisibility(true);
}
isIntroduceFinance = !isIntroduceFinance;
}
@Override
public void onLocalError() {
}
@Override
public void onInsufficient() {
}
}
|
9c0a671a-e0d0-40c2-9cbd-60246937c9d0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-06 04:54:08", "repo_name": "changsu0/SpringStudyBS", "sub_path": "/SpringStudyBS/src/main/java/com/cs/bs/service/UserServiceImpl.java", "file_name": "UserServiceImpl.java", "file_ext": "java", "file_size_in_byte": 987, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "50989b267bbc7f4f19c2dd24e625ff75302d95b0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/changsu0/SpringStudyBS | 217 | FILENAME: UserServiceImpl.java | 0.272025 | package com.cs.bs.service;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import com.cs.bs.dao.UserDAO;
@Service("userService")
public class UserServiceImpl implements UserService {
Logger log = LoggerFactory.getLogger(this.getClass());
@Resource(name = "userDAO")
private UserDAO userDAO;
@Override
public List<Map<String, Object>> selectUserList(Map<String, Object> map) throws Exception {
return userDAO.selectUserList(map);
}
@Override
public int insertUser(Map<String, Object> map) {
return userDAO.insertUser(map);
}
@Override
public Map<String, Object> selectUser(Map<String, Object> map) {
return userDAO.selectUser(map);
}
@Override
public int updateUser(Map<String, Object> map) {
return userDAO.updateUser(map);
}
@Override
public int deleteUser(String empNo) {
return userDAO.deleteUser(empNo);
}
}
|
df0d315e-6500-40e5-af89-e00ee5657dfa | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-23 12:29:18", "repo_name": "agammishra12/KeanuIOS", "sub_path": "/iOS_Automation/src/main/java/keanu/iOS_Automation/PageObject/PushScreen.java", "file_name": "PushScreen.java", "file_ext": "java", "file_size_in_byte": 973, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "e0bb78e42145a941c8fe29e337297ee730f21d36", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/agammishra12/KeanuIOS | 219 | FILENAME: PushScreen.java | 0.253861 | package keanu.iOS_Automation.PageObject;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import keanu.iOS_Automation.Library.AppLibrary;
public class PushScreen {
private AppLibrary appLibrary;
AppiumDriver<MobileElement> driver;
/// enable push screen
public static String signInButton = "id:Sign In";
public static String enablePushLabel = "xpath://XCUIElementTypeOther[@name='Enable Push']";
public static String messageImg = "id:onboarding_push";
public static String permissionLabel = "xpath://XCUIElementTypeTextView[contains(@value,'Keanu needs permission')]";
public static String enablePushButton = "xpath://XCUIElementTypeButton[@name='Enable Push']";
public static String skipButton = "id:Skip";
public PushScreen(AppLibrary appLibrary) {
this.appLibrary = appLibrary;
this.driver = (AppiumDriver<MobileElement>) appLibrary.getCurrentDriverInstance();
}
}
|
4d96d851-1d93-49bf-b997-1451f43c0a83 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-27 02:20:09", "repo_name": "zhaoShuang1/swagger2", "sub_path": "/src/main/java/com/zs/entity/BaseRequsetVo.java", "file_name": "BaseRequsetVo.java", "file_ext": "java", "file_size_in_byte": 1051, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "3b272c7ab12da9ab0309e4a8c4bcae245e5587d6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zhaoShuang1/swagger2 | 233 | FILENAME: BaseRequsetVo.java | 0.249447 | package com.zs.entity;
public class BaseRequsetVo {
private String service;
private String login_name;
private String pid;
private String sign;
public String getService() {
return service;
}
public void setService(String service) {
this.service = service;
}
public String getLogin_name() {
return login_name;
}
public void setLogin_name(String login_name) {
this.login_name = login_name;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("BaseRequsetVo [service=");
builder.append(service);
builder.append(", login_name=");
builder.append(login_name);
builder.append(", pid=");
builder.append(pid);
builder.append(", sign=");
builder.append(sign);
builder.append("]");
return builder.toString();
}
}
|
855167a1-db4b-4fed-976b-49a7230721bd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-08-15 03:54:20", "repo_name": "rongcloud/server-sdk-java", "sub_path": "/src/main/java/io/rong/models/response/CheckChatRoomUsersResult.java", "file_name": "CheckChatRoomUsersResult.java", "file_ext": "java", "file_size_in_byte": 966, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "99f897444016a6573148a05de0b7c5fbab7a4ed7", "star_events_count": 295, "fork_events_count": 287, "src_encoding": "UTF-8"} | https://github.com/rongcloud/server-sdk-java | 218 | FILENAME: CheckChatRoomUsersResult.java | 0.26588 | package io.rong.models.response;
import io.rong.models.Result;
import io.rong.util.GsonUtil;
import java.util.List;
public class CheckChatRoomUsersResult extends Result {
private List<ChatRoomUserInChrm> result;
public List<ChatRoomUserInChrm> getResult() {
return result;
}
public void setResult(List<ChatRoomUserInChrm> result) {
this.result = result;
}
@Override
public String toString() {
return GsonUtil.toJson(this, CheckChatRoomUsersResult.class);
}
static class ChatRoomUserInChrm{
private String userId;
private int isInChrm;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public int getIsInChrm() {
return isInChrm;
}
public void setIsInChrm(int isInChrm) {
this.isInChrm = isInChrm;
}
}
}
|
dbcb03dd-f129-47a4-96db-05fe1f33a0e1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-23 19:14:44", "repo_name": "fredbrasils/learnvocab", "sub_path": "/src/main/java/br/com/learnvocab/dao/BoxDAOImpl.java", "file_name": "BoxDAOImpl.java", "file_ext": "java", "file_size_in_byte": 971, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "e54edb0eb9d0930ee475d64ffda60c389f90d1ea", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/fredbrasils/learnvocab | 182 | FILENAME: BoxDAOImpl.java | 0.292595 | package br.com.learnvocab.dao;
import br.com.learnvocab.entity.Box;
import br.com.learnvocab.entity.User;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
@Transactional
@EnableAspectJAutoProxy(proxyTargetClass = true)
public class BoxDAOImpl extends BaseDAOImpl<Box>{
public boolean existsDaysNumberSuperior(Integer daysNumber) {
Map<String,Object> params = new HashMap<String,Object>();
StringBuilder sql = new StringBuilder();
sql.append("select b from Box b where b.daysNumber >= :daysNumber ");
params.put("daysNumber", daysNumber);
List<Box> boxes = createQuery(Box.class,sql.toString(), params).getResultList();
return !boxes.isEmpty();
}
}
|
148542d2-743f-4580-bd9e-71f0c03cc768 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-17 11:35:49", "repo_name": "celine23/Humeur", "sub_path": "/SQLite.java", "file_name": "SQLite.java", "file_ext": "java", "file_size_in_byte": 1194, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "e21c2692e0016e4af78482138e5034edbedc125b", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/celine23/Humeur | 254 | FILENAME: SQLite.java | 0.285372 | package com.lin.celine.moodtracker.controller;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by celine on 30/03/2018.
*/
public class SQLite extends SQLiteOpenHelper {
private static final String mood_key= "mood_key";
private static final String mood_comment = "comment";
private static final String mood_date = "date";
private static final String mood_mood = "mood";
private static final String CREATE_TABLE = "CREATE TABLE " + mood_key +"("
+ mood_comment + " INTEGER COMMENT, " + mood_date + " DATE"
+ mood_mood + " MOOD)";
public SQLite(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
sqLiteDatabase.execSQL(CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
sqLiteDatabase.execSQL("table mood " + mood_key + ";");
onCreate(sqLiteDatabase);
}
}
|
438efcf2-a80c-4e73-94a0-8179ed9331fd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-02-23 18:41:57", "repo_name": "ovenbits/QuickActionView", "sub_path": "/quickactionview/src/main/java/com/ovenbits/quickactionview/ActionTitleView.java", "file_name": "ActionTitleView.java", "file_ext": "java", "file_size_in_byte": 1191, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "63c32252b0e1ca8d58dfebc5dcc8c81f23068812", "star_events_count": 145, "fork_events_count": 17, "src_encoding": "UTF-8"} | https://github.com/ovenbits/QuickActionView | 224 | FILENAME: ActionTitleView.java | 0.256832 | package com.ovenbits.quickactionview;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.widget.TextView;
/**
* Shows the title of the Action
*/
@SuppressLint("ViewConstructor")
class ActionTitleView extends TextView {
private Action mAction;
private ConfigHelper mConfigHelper;
public ActionTitleView(Context context, Action action, ConfigHelper configHelper) {
super(context);
mAction = action;
mConfigHelper = configHelper;
init();
}
@TargetApi(21)
private void init() {
setPadding(mConfigHelper.getTextPaddingLeft(), mConfigHelper.getTextPaddingTop(), mConfigHelper.getTextPaddingRight(), mConfigHelper.getTextPaddingBottom());
setTextColor(mConfigHelper.getTextColor());
setTextSize(mConfigHelper.getTextSize());
if (Build.VERSION.SDK_INT >= 16) {
setBackgroundDrawable(mConfigHelper.getTextBackgroundDrawable(getContext()));
} else {
setBackground(mConfigHelper.getTextBackgroundDrawable(getContext()));
}
setText(mAction.getTitle());
}
}
|
6b424329-a1f9-4e83-a2ce-1c0591f869d1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-04 07:50:06", "repo_name": "dangnguyenvan/Phone_Store", "sub_path": "/phone_store/src/main/java/com/mycompany/phone_store/service/AccountRoleService.java", "file_name": "AccountRoleService.java", "file_ext": "java", "file_size_in_byte": 967, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "bf2b62f11da72243a47a8a0df6264242db9bbf32", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dangnguyenvan/Phone_Store | 179 | FILENAME: AccountRoleService.java | 0.27513 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.phone_store.service;
import com.mycompany.phone_store.entities.AccountRoleEntity;
import com.mycompany.phone_store.enums.AccountRole;
import com.mycompany.phone_store.repositories.AccountRoleRepository;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
* @author dang
*/
@Service
public class AccountRoleService {
@Autowired
private AccountRoleRepository accountRoleRepository;
public List<AccountRoleEntity> getAccountRoles(){
return (List<AccountRoleEntity>) accountRoleRepository.findAll();
}
public AccountRoleEntity getAccountRolesByRole(AccountRole role){
return accountRoleRepository.findByRoles(role);
}
}
|
b9f8087f-9d7b-4353-a669-eaf41ae42d30 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-16 17:45:22", "repo_name": "surplus867/popular-movies-app", "sub_path": "/app/src/main/java/com/example/android/popular_movies_app/ViewModel/MainViewModel.java", "file_name": "MainViewModel.java", "file_ext": "java", "file_size_in_byte": 967, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "ac5cc9cc4baa64a57e49d0c9794ee96a58b05f9a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/surplus867/popular-movies-app | 169 | FILENAME: MainViewModel.java | 0.283781 | package com.example.android.popular_movies_app.ViewModel;
import android.app.Application;
import android.util.Log;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import com.example.android.popular_movies_app.database.MovieDatabase;
import com.example.android.popular_movies_app.database.MovieEntry;
import java.util.List;
public class MainViewModel extends AndroidViewModel {
// Constant for logging
private static final String TAG = MainViewModel.class.getSimpleName();
private LiveData<List<MovieEntry>> favorite;
public MainViewModel(Application application) {
super(application);
MovieDatabase movieDatabase = MovieDatabase.getInstance(this.getApplication());
Log.d(TAG, "Actively retrieving the tasks from the DataBase");
favorite = movieDatabase.movieDao().loadAllMovies();
}
public LiveData<List<MovieEntry>> getFavoriteMovies() {
return favorite;
}
} |
8eabd824-3a16-46c9-bcbc-57fbbe0b34c9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-09-04 13:46:11", "repo_name": "corda/corda", "sub_path": "/node-api/src/test/java/net/corda/nodeapi/internal/serialization/DummyCustomSerializationSchemeInJava.java", "file_name": "DummyCustomSerializationSchemeInJava.java", "file_ext": "java", "file_size_in_byte": 970, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "ca38f639ed8535287e339ae9c092eefd8d506673", "star_events_count": 4370, "fork_events_count": 1337, "src_encoding": "UTF-8"} | https://github.com/corda/corda | 187 | FILENAME: DummyCustomSerializationSchemeInJava.java | 0.226784 | package net.corda.nodeapi.internal.serialization;
import net.corda.core.serialization.SerializationSchemeContext;
import net.corda.core.serialization.CustomSerializationScheme;
import net.corda.core.serialization.SerializedBytes;
import net.corda.core.utilities.ByteSequence;
public class DummyCustomSerializationSchemeInJava implements CustomSerializationScheme {
public class DummyOutput {}
static final int testMagic = 7;
@Override
public int getSchemeId() {
return testMagic;
}
@Override
@SuppressWarnings("unchecked")
public <T> T deserialize(ByteSequence bytes, Class<T> clazz, SerializationSchemeContext context) {
return (T)new DummyOutput();
}
@Override
public <T> SerializedBytes<T> serialize(T obj, SerializationSchemeContext context) {
byte[] myBytes = {0xA, 0xA};
return new SerializedBytes<>(myBytes);
}
} |
b7800b37-0c36-4285-81f5-ee36ea22f574 | {"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": "/GtuSpringBoot/src/main/java/com/gtu/example/common/SecurityConfig.java", "file_name": "SecurityConfig.java", "file_ext": "java", "file_size_in_byte": 1260, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "9ccc4bdf107a8814ac7748d12089ca6f102996fe", "star_events_count": 3, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gtu001/gtu-test-code | 246 | FILENAME: SecurityConfig.java | 0.23092 | package com.gtu.example.common;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import com.gtu.example.rabbitmq.RabbitMqBeanDefiner;
/**
* 預設的 spring security
* 帳號 : user
* 密碼[[在log]]
* ↓↓↓↓↓↓
* Using generated security password: <password>
* ↑↑↑↑↑↑
*
* disable作法
* ↓↓↓↓↓↓
* org.springframework.boot:spring-boot-starter-security
* ↑↑↑↑↑↑
*/
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
private static final Logger log = LoggerFactory.getLogger(SecurityConfig.class);
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()//
.anyRequest()//
.permitAll()//
.and()//
.csrf()//
.disable();
}
} |
7f3cdd7b-808a-46d2-beff-1e46fe067585 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-09 09:59:44", "repo_name": "gyczk/mywork", "sub_path": "/src/main/java/com/czk/websocket/HandshakeInterceptor.java", "file_name": "HandshakeInterceptor.java", "file_ext": "java", "file_size_in_byte": 973, "line_count": 30, "lang": "en", "doc_type": "code", "blob_id": "b0c7ef24f5884f3ffebcc88fb6aee0d6c3fbcc5a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gyczk/mywork | 175 | FILENAME: HandshakeInterceptor.java | 0.243642 | package com.czk.websocket;
import java.util.Map;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor;
import com.czk.utils.UserUtils;
public class HandshakeInterceptor extends HttpSessionHandshakeInterceptor {
@Override
public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler,
Map<String, Object> attributes) throws Exception {
System.out.println("Before Handshake");
Long userID = UserUtils.getLoginUser().getUserId();
attributes.put("userID", userID);
return true;
}
@Override
public void afterHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler,
Exception ex) {
System.out.println("After Handshake");
}
}
|
addcbe1d-9633-4f85-9f7d-9bd22567d649 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-03 21:56:55", "repo_name": "EmergentIdeas/webhandle", "sub_path": "/src/com/emergentideas/webhandle/files/ClasspathFileStreamableResource.java", "file_name": "ClasspathFileStreamableResource.java", "file_ext": "java", "file_size_in_byte": 970, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "46fe284ad1153aa2699cc122b066105e5eec8251", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/EmergentIdeas/webhandle | 206 | FILENAME: ClasspathFileStreamableResource.java | 0.247987 | package com.emergentideas.webhandle.files;
import java.io.InputStream;
import com.emergentideas.logging.Logger;
import com.emergentideas.logging.SystemOutLogger;
import com.emergentideas.utils.StringUtils;
public class ClasspathFileStreamableResource implements StreamableResource {
protected String location;
protected String eTag;
protected static Logger log = SystemOutLogger.get(ClasspathFileStreamableResource.class);
public ClasspathFileStreamableResource(String location) {
this(location, System.currentTimeMillis() + "");
}
public ClasspathFileStreamableResource(String location, String eTag) {
this.location = location;
this.eTag = eTag;
}
public String getEtag() {
return eTag;
}
public InputStream getContent() {
try {
return StringUtils.getStreamFromClassPathLocation(location);
}
catch(Exception e) {
log.error("Could not get content for file: " + location, e);
throw new IllegalArgumentException(e);
}
}
}
|
6d8b077b-dc80-4057-b079-b6ee9a7b47a8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-03 16:29:39", "repo_name": "techtickaran/semantic3-API", "sub_path": "/app/src/main/java/com/app/semantics3api/Item.java", "file_name": "Item.java", "file_ext": "java", "file_size_in_byte": 1192, "line_count": 63, "lang": "en", "doc_type": "code", "blob_id": "7bf36c05cc0663eaa357c8801c5b985ec84c0eda", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/techtickaran/semantic3-API | 260 | FILENAME: Item.java | 0.239349 | package com.app.semantics3api;
public class Item
{
private int eventId;
private int id;
private int profileId;
private String name;
private double cost;
private String store;
private String encodedImage;
private boolean purchased;
public Item()
{
}
public Item(String name, double cost, String location, String encodedImage, int profileId, int eventId, int id, boolean purchased)
{
this.name = name;
this.cost = cost;
this.store = location;
this.encodedImage = encodedImage;
this.profileId = profileId;
this.eventId = eventId;
this.id = id;
this.purchased = purchased;
}
public String getName() {
return name;
}
public double getCost() {
return cost;
}
public String getStore() {
return store;
}
public String getEncodedImage() {
return encodedImage;
}
public int getId() {
return id;
}
public int getEventId() {
return eventId;
}
public int getProfileId() {
return profileId;
}
public boolean isPurchased() {
return purchased;
}
}
|
dc646eae-590c-4428-a3d4-b0d108c06412 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-05-25 05:13:54", "repo_name": "Deepanshuchauhan123/Spring-Hibernate", "sub_path": "/Mail_With_Attachment_Spring/src/main/java/com/deepanshu/MailMail.java", "file_name": "MailMail.java", "file_ext": "java", "file_size_in_byte": 971, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "a3f3fd19a49f45fbbb35d01d695da4ee36e3ec7a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Deepanshuchauhan123/Spring-Hibernate | 221 | FILENAME: MailMail.java | 0.278257 | package com.deepanshu;
import java.io.File;
import javax.mail.internet.MimeMessage;
import org.springframework.core.io.FileSystemResource;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
public class MailMail {
private JavaMailSender mailSender;
public void setMailSender(JavaMailSender mailSender)
{
this.mailSender=mailSender;
}
public void sendMail(final String from, final String to,final String subject,final String msg)
{
try {
MimeMessage message =mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message,true);
helper.setFrom(from);
helper.setTo(to);
helper.setSubject(subject);
helper.setText(msg);
FileSystemResource file=new FileSystemResource(new File("C:\\abc.jpg"));
helper.addAttachment("ImageFileName", file);
mailSender.send(message);
}catch(Exception e) {
e.printStackTrace();
}
}
}
|
5c6ce120-3ea6-413a-acaa-44d3aaf34185 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-15 12:43:26", "repo_name": "SamJ2018/smazon", "sub_path": "/sm-item/sm-item-service/src/main/java/com/smazon/item/web/ItemController.java", "file_name": "ItemController.java", "file_ext": "java", "file_size_in_byte": 1138, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "1ab715eba997d48bf322e86667e1ff3a257fc59d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/SamJ2018/smazon | 226 | FILENAME: ItemController.java | 0.250913 | package com.smazon.item.web;
import com.smazon.common.enums.ExceptionEnum;
import com.smazon.common.exception.SmException;
import com.smazon.item.pojo.Item;
import com.smazon.item.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author sam
* @apiNote
* @since 2019-08-15-7:58 PM
**/
@RestController
@RequestMapping("item")
public class ItemController {
@Autowired
private ItemService itemService;
@PostMapping
public ResponseEntity<Item> saveItem(Item item) {
//Rest风格返回
//校验价格
if (item.getPrice() == null) {
//传入自定义异常
throw new SmException(ExceptionEnum.PRICE_CANNOT_BE_NULL);
}
Item item1 = itemService.saveItem(item);
return ResponseEntity.status(HttpStatus.CREATED).body(item1);
}
}
|
989e70ea-dad0-4522-b9d5-11d00aec8fd5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-09-10 22:57:22", "repo_name": "Nerogar/NoiseEngine", "sub_path": "/src/main/java/de/nerogar/noise/file/FileResourceDescriptor.java", "file_name": "FileResourceDescriptor.java", "file_ext": "java", "file_size_in_byte": 1193, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "ef78750371e84a1b56b7ee5cfae835b33755be78", "star_events_count": 2, "fork_events_count": 3, "src_encoding": "UTF-8"} | https://github.com/Nerogar/NoiseEngine | 259 | FILENAME: FileResourceDescriptor.java | 0.26588 | package de.nerogar.noise.file;
import de.nerogar.noise.Noise;
import de.nerogar.noise.util.Logger;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
public class FileResourceDescriptor implements ResourceDescriptor {
private String filename;
private String subFolder;
private String folder;
public FileResourceDescriptor(String id, String subFolder) {
this.filename = FileUtil.getCanonicalPath(id);
this.subFolder = subFolder;
folder = filename.substring(0, filename.lastIndexOf('/'));
}
@Override
public InputStream asStream() {
try {
return new FileInputStream(filename);
} catch (FileNotFoundException e) {
Noise.getLogger().log(Logger.WARNING, "could not load resource from file: " + filename);
e.printStackTrace(Noise.getLogger().getWarningStream());
}
return null;
}
@Override
public ResourceDescriptor getRelative(String id) {
if (id.startsWith("<") || id.startsWith("(")) return FileUtil.get(id, subFolder);
return new FileResourceDescriptor(new File(filename).getParent() + "/" + id, subFolder);
}
@Override
public String getFilename() {
return filename;
}
}
|
c8bd1e0b-ea6f-4f7b-af83-90ed0c9899d9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-16 15:35:31", "repo_name": "lianyj/foodie", "sub_path": "/foodie-api/src/main/java/com/imooc/controller/HelloController.java", "file_name": "HelloController.java", "file_ext": "java", "file_size_in_byte": 1069, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "24d741a64e6f8a7635ec62db7cae1fae4b99b2ba", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lianyj/foodie | 188 | FILENAME: HelloController.java | 0.20947 | package com.imooc.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@RestController
@ApiIgnore
public class HelloController {
final static Logger log = LoggerFactory.getLogger(HelloController.class);
@GetMapping("/hello")
public String hello(){
log.debug("hello world");
log.info("hello world");
log.warn("hello world");
log.error("hello world");
return "hello world";
}
@GetMapping("/setSession")
public Object setSession(HttpServletRequest request){
HttpSession session = request.getSession();
session.setAttribute("userInfo","new user");
session.setMaxInactiveInterval(3600);
session.getAttribute("userInfo");
session.removeAttribute("userInfo");
return "ok";
}
}
|
3912fba9-5950-4718-bb54-fb09a5144b00 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-06-17 15:39:13", "repo_name": "cmosnick/arcgis-soe-template-java", "sub_path": "/arcgis-soe-template-core/src/main/java/com/esri/arcgis/soe/template/server/internal/RequestBodyArgumentResolver.java", "file_name": "RequestBodyArgumentResolver.java", "file_ext": "java", "file_size_in_byte": 1065, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "c8f46d38d9f153f479c8be36a8a4abdbe0c57fa4", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/cmosnick/arcgis-soe-template-java | 181 | FILENAME: RequestBodyArgumentResolver.java | 0.23793 | package com.esri.arcgis.soe.template.server.internal;
import com.esri.arcgis.soe.template.server.RestDelegate;
import com.esri.arcgis.soe.template.server.RestRequest;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.core.MethodParameter;
import javax.xml.bind.annotation.XmlRootElement;
public final class RequestBodyArgumentResolver implements ArgumentResolver {
private final ObjectMapper objectMapper;
public RequestBodyArgumentResolver(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
}
@Override
public Object resolveArgument(MethodParameter parameter,
RestRequest request, RestDelegate handler) throws Exception {
Class<?> type = parameter.getParameterType();
return objectMapper.readValue(request.getOperationInput(), type);
}
@Override
public boolean resolves(MethodParameter parameter) {
Class<?> type = parameter.getParameterType();
return type.getAnnotation(XmlRootElement.class) != null;
}
}
|
4d06f43f-2ee5-4a1f-a6f0-27d1b893f9c0 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-02 14:04:32", "repo_name": "Simerron/bot_discord", "sub_path": "/commands/SayCommand.java", "file_name": "SayCommand.java", "file_ext": "java", "file_size_in_byte": 1194, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "fce836242c95dcaefa1006df43ac9a2f2a9823be", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Simerron/bot_discord | 246 | FILENAME: SayCommand.java | 0.290981 | package Test.bot.commands;
import Test.bot.Command;
import Test.bot.MainBot;
import Test.bot.utils.SendMessage;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
/**
* Created by Simerron on 25/01/2017.
*/
public class SayCommand implements Command {
private final String HELP = ".say [text] -> Renvoie text";
@Override
public boolean called(String[] args, MessageReceivedEvent event) {
return true;
}
@Override
public void action(String[] args, MessageReceivedEvent event) {
MainBot.log("Command Log", "[Say] From User : "+event.getAuthor());
StringBuilder builder = new StringBuilder();
for(String s : args) {
if ((s!= null)) {
builder.append(s);
builder.append(' ');
}
}
event.getMessage().deleteMessage().queue();
SendMessage message = new SendMessage(event.getTextChannel(), builder.toString());
}
@Override
public String help() {
return HELP;
}
@Override
public void execute(boolean success, MessageReceivedEvent event) {
return;
}
}
|
a6e8727a-2711-46f8-a7d3-18dd8edcc9bf | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-04 13:58:13", "repo_name": "Odenilton/SGR", "sub_path": "/backend-java/src/main/java/br/com/oljsoft/sgr/service/UsuarioService.java", "file_name": "UsuarioService.java", "file_ext": "java", "file_size_in_byte": 1044, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "b0d4a7b2bd1c53a0b9197784189a2d3dc7cb8364", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Odenilton/SGR | 201 | FILENAME: UsuarioService.java | 0.242206 | package br.com.oljsoft.sgr.service;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import br.com.oljsoft.sgr.model.Perfil;
import br.com.oljsoft.sgr.model.Usuario;
import br.com.oljsoft.sgr.repository.PerfilRepository;
import br.com.oljsoft.sgr.repository.UsuarioRepository;
@Service
public class UsuarioService {
@Autowired
private UsuarioRepository repository;
@Autowired
private PerfilRepository repositoryPerfil;
public Optional<List<Usuario>> listar(){
return Optional.ofNullable(this.repository.findAll());
}
public Optional<Usuario> salvar(Usuario usuario){
return Optional.ofNullable(this.repository.save(usuario));
}
public Optional<Usuario> buscarPorEmail(String email){
return Optional.ofNullable(this.repository.findByEmail(email));
}
public Optional<List<Perfil>> listarPerfis(){
return Optional.ofNullable(this.repositoryPerfil.findAll());
}
}
|
79824452-3991-404a-9c4d-846e0903050b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-05-27T11:42:15", "repo_name": "smfarjad/Java-RMI-Chatroom", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1084, "line_count": 23, "lang": "en", "doc_type": "text", "blob_id": "a440efefad8f1372ac2f41d8a0ad96be085c30d5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/smfarjad/Java-RMI-Chatroom | 260 | FILENAME: README.md | 0.272799 | # Java-RMI-Chatroom
This project is a demonstration of chatroom development using Java RMI. Java RMI has been replaced with other better alternatives like RESTful APIs. The primary purpose of this project was to explore the working of distributed environment.
### Development Environment and Structure
I used Eclipse IDE for developing this project. The both directories, SMF_ChatServer and SMF_ChatClient, should be imported in Eclipse IDE. SMF_ChatServer should be executed before SMF_ChatClient. In order to add more participants, the SMF_ChatClient should be executed according to the desired number of participants in chatroom.
### Configuration Details
IP address for joining the chatroom: 192.168.122.131
Port: 1099
### Troubleshooting
If the port 1099 is already reserved by other process then /SMF_ChatServer/src/StartServer.java file should be modified with other port number. Replace 1099 with other port number that does not seem to be busy in other process.
### Snapshot

|
f6047d97-7b86-4763-9ed3-4f9ea926119b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-09-16 13:45:47", "repo_name": "chenyu600/onexus", "sub_path": "/org.onexus.website.api/src/main/java/org/onexus/website/api/pages/search/figures/html/HtmlFigureConfig.java", "file_name": "HtmlFigureConfig.java", "file_ext": "java", "file_size_in_byte": 455, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "10efde4e3eaf66b9da73b315de345b3a64beff37", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/chenyu600/onexus | 239 | FILENAME: HtmlFigureConfig.java | 0.228156 | /**
* Copyright 2012 Universitat Pompeu Fabra.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package org.onexus.website.api.pages.search.figures.html;
import org.onexus.resource.api.annotations.ResourceAlias;
import org.onexus.website.api.pages.search.FigureConfig;
@ResourceAlias("figure-html")
public class HtmlFigureConfig extends FigureConfig {
private String text;
public HtmlFigureConfig() {
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}
|
f8c23dd1-70d6-4cad-a329-156d923f9418 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-03-10 22:30:28", "repo_name": "Lowerland/yamba", "sub_path": "/src/com/example/yamba/StatusData.java", "file_name": "StatusData.java", "file_ext": "java", "file_size_in_byte": 1193, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "8893c34deddccdebc075e4e570813afe7ed24426", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Lowerland/yamba | 249 | FILENAME: StatusData.java | 0.29584 | package com.example.yamba;
import winterwell.jtwitter.Twitter.Status;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.provider.BaseColumns;
public class StatusData {
static final String TAG = "StatusData";
public static final String DB_NAME = "timeline.db";
public static final int DB_VERSION = 1;
public static final String TABLE = "status";
public static final String C_ID = BaseColumns._ID;
public static final String C_CREATED_AT = "created_at";
public static final String C_USER = "user_name";
public static final String C_TEXT = "status_text";
Context context;
public StatusData(Context context) {
this.context = context;
}
public void insert(Status status) {
ContentValues values = new ContentValues();
values.put(C_ID, status.id);
values.put(C_CREATED_AT, status.createdAt.getTime());
values.put(C_USER, status.user.name);
values.put(C_TEXT, status.text);
context.getContentResolver().insert(StatusProvider.CONTENT_URI, values);
}
public Cursor query() {
return context.getContentResolver().query(StatusProvider.CONTENT_URI,
null, null, null, C_CREATED_AT + " DESC");
}
}
|
b37855c1-0bad-497d-bd65-67c2806372c7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-05-15 16:05:29", "repo_name": "SeifMostafa/SoftwareEngineeringProject", "sub_path": "/app/src/main/java/Users/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 1192, "line_count": 67, "lang": "en", "doc_type": "code", "blob_id": "bbdd9ac609f6de22deaf337443bfb426810d0654", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/SeifMostafa/SoftwareEngineeringProject | 252 | FILENAME: User.java | 0.279042 | package Users;
import com.parse.ParseClassName;
import com.parse.ParseObject;
import com.parse.SignUpCallback;
import java.util.ArrayList;
import Notifications.Notification;
import Posts.Post;
@ParseClassName("User")
public class User extends ParseObject {
String username;
String Email;
String password;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
String name;
public User ()
{
}
ArrayList<Notification> notifications = new ArrayList<Notification>();
ArrayList<String> tastes = new ArrayList<String>();
ArrayList<Post> posts = new ArrayList<Post>();
ArrayList<User> friends = new ArrayList<User>();
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getEmail() {
return Email;
}
public void setEmail(String email) {
Email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public void AddNewFriend(User friend)
{
this.friends.add(friend);
}
public void AddNewTaste(String Taste)
{
this.tastes.add(Taste);
}
}
|
8552fc00-881b-40c2-9a86-2dd7855b14c4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-14 14:33:44", "repo_name": "gongxiaoyue/projectcode", "sub_path": "/project/taotao-manager/taotao-manager-web/src/test/java/test.java", "file_name": "test.java", "file_ext": "java", "file_size_in_byte": 1093, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "abb45119fb3eabb67115492ea6cafc1d705d4dcd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gongxiaoyue/projectcode | 260 | FILENAME: test.java | 0.284576 | import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.taotao.dao.TbItemCatMapper;
import com.taotao.pojo.TbItemCat;
import com.taotao.pojo.TbItemCatExample;
import com.taotao.pojo.TbItemCatExample.Criteria;
public class test {
private ApplicationContext ap;
@Before
public void dd() {
ap = new ClassPathXmlApplicationContext("classpath:spring/applicationContent-dao.xml");
}
@Test
public void tst() {
TbItemCatMapper bean = (TbItemCatMapper)ap.getBean("tbItemCatMapper",TbItemCatMapper.class);
TbItemCatExample ex = new TbItemCatExample();
Criteria createCriteria = ex.createCriteria();
long l=1;
createCriteria.andParentIdEqualTo(l);
TbItemCat selectByPrimaryKey = bean.selectByPrimaryKey(l);
System.out.println(selectByPrimaryKey.getName());
List<TbItemCat> selectByExample = bean.selectByExample(ex);
for (TbItemCat tbItemCat : selectByExample) {
System.out.println(tbItemCat.getName());
}
}
}
|
36644b47-9e03-4f03-b1ed-4af5d6c3a8d3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-28 10:53:45", "repo_name": "raihanArman/Nice-POS-Admin", "sub_path": "/app/src/main/java/id/co/myproject/nicepos_admin/model/Admin.java", "file_name": "Admin.java", "file_ext": "java", "file_size_in_byte": 1087, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "2ea7999dfd59905d70c5e15e3783e01754bbc2e0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/raihanArman/Nice-POS-Admin | 226 | FILENAME: Admin.java | 0.182426 | package id.co.myproject.nicepos_admin.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Admin {
@SerializedName("id_admin")
@Expose
private int idAdmin;
@SerializedName("username")
@Expose
private String username;
@SerializedName("nama")
@Expose
private String nama;
@SerializedName("password")
@Expose
private String password;
@SerializedName("avatar")
@Expose
private String avatar;
public Admin(int idAdmin, String username, String nama, String password, String avatar) {
this.idAdmin = idAdmin;
this.username = username;
this.nama = nama;
this.password = password;
this.avatar = avatar;
}
public int getIdAdmin() {
return idAdmin;
}
public String getUsername() {
return username;
}
public String getNama() {
return nama;
}
public String getPassword() {
return password;
}
public String getAvatar() {
return avatar;
}
}
|
0a26a2b7-bf77-41c6-9314-40ae65f19485 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-10-25 09:01:27", "repo_name": "AidenPage/backend", "sub_path": "/src/main/java/com/computerstore/backend/services/components/Impl/StorageDeviceServiceImpl.java", "file_name": "StorageDeviceServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1193, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "4047154619e1e486fb9d5570178eea2cf7c59aab", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AidenPage/backend | 229 | FILENAME: StorageDeviceServiceImpl.java | 0.280616 | package com.computerstore.backend.services.components.Impl;
import com.computerstore.backend.domain.components.StorageDevice;
import com.computerstore.backend.repositories.components.StorageDeviceRepository;
import com.computerstore.backend.services.components.StorageDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by Aiden on 2016/10/23.
*/
@Service
public class StorageDeviceServiceImpl implements StorageDeviceService {
@Autowired
private StorageDeviceRepository repository;
@Override
public StorageDevice create(StorageDevice entity) {
return repository.save(entity);
}
@Override
public StorageDevice readById(Long aLong) {
return repository.findOne(aLong);
}
@Override
public Iterable< StorageDevice> readAll() {
Iterable< StorageDevice> result = repository.findAll();
return result;
}
@Override
public StorageDevice update( StorageDevice entity) {
return repository.save(entity);
}
@Override
public void delete( StorageDevice entity) {
repository.delete(entity);
}
}
|
b2ca9df6-6355-4d98-97e9-b336e7179765 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-05T05:08:24", "repo_name": "mycguo/java-algorithm-education", "sub_path": "/algorithm/src/edu/java/concurrent/ch4/FutureResult.java", "file_name": "FutureResult.java", "file_ext": "java", "file_size_in_byte": 968, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "f5110d03ed19a1e8d1dc9ff04920e8effed5042c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mycguo/java-algorithm-education | 202 | FILENAME: FutureResult.java | 0.282196 | package edu.java.concurrent.ch4;
import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.Callable;
public class FutureResult {
protected Object value = null;
protected boolean ready = false;
protected InvocationTargetException exception = null;
public synchronized Object get() throws InterruptedException, InvocationTargetException {
while (!ready)
wait();
if (exception !=null)
throw exception;
else
return value;
}
public Runnable setter(final Callable<Object> function) {
return new Runnable()
{
public void run() {
try {
set(function.call());
} catch (Throwable t) {
setException(t);
}
}
};
}
synchronized void set(Object result) {
value = result;
ready = true;
notifyAll();
}
public void setException(Throwable t) {
exception = new InvocationTargetException(t);
ready=true;
notifyAll();
}
}
|
181bcc08-e5a6-4186-ab99-3a0160d1d3b6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-03-17 04:49:03", "repo_name": "brosander/pentaho-hadoop-gateway", "sub_path": "/pentaho-shim-gateway-api/src/main/java/org/pentaho/gateway/args/SetModifiedTimeParameters.java", "file_name": "SetModifiedTimeParameters.java", "file_ext": "java", "file_size_in_byte": 1020, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "2a112bc2861c1b11547221eab202bbe0641e397d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/brosander/pentaho-hadoop-gateway | 226 | FILENAME: SetModifiedTimeParameters.java | 0.214691 | package org.pentaho.gateway.args;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Created by bryan on 3/16/14.
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class SetModifiedTimeParameters {
@XmlElement
private PathAndConfig pathAndConfig;
@XmlElement
private long modtime;
public SetModifiedTimeParameters() {
}
public SetModifiedTimeParameters(PathAndConfig pathAndConfig, long modtime) {
this.pathAndConfig = pathAndConfig;
this.modtime = modtime;
}
public PathAndConfig getPathAndConfig() {
return pathAndConfig;
}
public void setPathAndConfig(PathAndConfig pathAndConfig) {
this.pathAndConfig = pathAndConfig;
}
public long getModtime() {
return modtime;
}
public void setModtime(long modtime) {
this.modtime = modtime;
}
}
|
a4a5d4d7-de82-4dbe-b8fb-30480ada2469 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-11 17:33:08", "repo_name": "pavelFilin/HavachMVC", "sub_path": "/src/main/java/ru/filin/HavachMVC/service/mail/MailSender.java", "file_name": "MailSender.java", "file_ext": "java", "file_size_in_byte": 1090, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "a06353feb9aa469738440f59da9b3d3aa1dc48c1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/pavelFilin/HavachMVC | 213 | FILENAME: MailSender.java | 0.26588 | package ru.filin.HavachMVC.service.mail;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;
@Service
public class MailSender {
@Value("${spring.mail.username}")
private String username;
@Autowired
private JavaMailSender mailSender;
private static final Logger logger = LoggerFactory.getLogger(MailSender.class);
public void send(String emailTo, String subject, String massage) {
SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
simpleMailMessage.setFrom(username);
simpleMailMessage.setTo(emailTo);
simpleMailMessage.setSubject(subject);
simpleMailMessage.setText(massage);
logger.info("send mail to" + emailTo + "\nsubject: " + subject +"\ntext: " + massage);
mailSender.send(simpleMailMessage);
}
}
|
60998e92-a301-461e-adf7-5b16916df9b4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-05-31 08:19:37", "repo_name": "ste7en/ing-sw-2019-chiappalupi-formicola-iannucci", "sub_path": "/src/main/java/it/polimi/ingsw/model/cards/TagbackGrenade.java", "file_name": "TagbackGrenade.java", "file_ext": "java", "file_size_in_byte": 972, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "e27e3e39e6132a9a3d1f5db72ab3836f5c509655", "star_events_count": 7, "fork_events_count": 6, "src_encoding": "UTF-8"} | https://github.com/ste7en/ing-sw-2019-chiappalupi-formicola-iannucci | 220 | FILENAME: TagbackGrenade.java | 0.240775 | package it.polimi.ingsw.model.cards;
import it.polimi.ingsw.model.board.GameMap;
import it.polimi.ingsw.model.player.Player;
import java.util.ArrayList;
import java.util.List;
public class TagbackGrenade extends Powerup {
@Override
public boolean isUsableDuringTurn() {
return false;
}
@Override
public boolean isUsableAfterDamageMade() {
return false;
}
@Override
public boolean isUsableAfterDamageTaken() {
return true;
}
@Override
public List<Damage> use(Player player, GameMap map, List<Player> players) {
List<Damage> damages = new ArrayList<>();
for(Player target : players) {
Damage damage = new Damage();
damage.setTarget(target);
damage.setMarks(1);
damages.add(damage);
}
return damages;
}
@Override
public String toString() {
return "TagbackGrenade - " + this.color.toString();
}
}
|
bf1993e2-38dc-4405-800a-b2ddeb1e4e17 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-12 06:25:36", "repo_name": "neuralnet-designer/Page101-Counter", "sub_path": "/CafeCounter_/app/src/main/java/com/turesw/oms/cafecounter/dto/QnAInfo.java", "file_name": "QnAInfo.java", "file_ext": "java", "file_size_in_byte": 1193, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "26b784f8bdba8af3d2f17d3c436280f963e9f01a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/neuralnet-designer/Page101-Counter | 317 | FILENAME: QnAInfo.java | 0.253861 | package com.turesw.oms.cafecounter.dto;
public class QnAInfo {
String qnaTitle;
String qnaContent;
String qnaStart;
String qnaEnd;
int state;
public QnAInfo() {
}
public QnAInfo(String _qnaTitle, String _qnaContent, String _qnaStart, String _qnaEnd, int _state)
{
this.qnaTitle = _qnaTitle;
this.qnaContent = _qnaContent;
this.qnaStart = _qnaStart;
this.qnaEnd = _qnaEnd;
this.state = _state;
}
public void put(String key, String object) {
if (key.equals("qnaTitle"))
this.qnaTitle = object;
else if (key.equals("qnaContent"))
this.qnaContent = object;
else if (key.equals("qnaStart"))
this.qnaStart = object;
else if (key.equals("qnaEnd"))
this.qnaEnd = object;
else if (key.equals("state"))
this.state = Integer.parseInt(object);
}
public String get_qnaitle() {
return qnaTitle;
}
public String get_qnaContent() {
return qnaContent;
}
public String get_qnaStart() {
return qnaStart;
}
public int get_state() {
return state;
}
}
|
195c8745-84cb-41b5-a908-11eeeb0bfab9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-16 02:39:06", "repo_name": "Wang-Shuaijie/Notepad", "sub_path": "/app/src/main/java/com/example/wangshuaijie/notepad_v1/VideoActivity.java", "file_name": "VideoActivity.java", "file_ext": "java", "file_size_in_byte": 1066, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "6b228d1d454fddb89ccebba031037f2b19e9aa1a", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Wang-Shuaijie/Notepad | 195 | FILENAME: VideoActivity.java | 0.225417 | package com.example.wangshuaijie.notepad_v1;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.MediaController;
import android.widget.VideoView;
/**
* Created by Administrator on 2018/6/5/005.
*/
public class VideoActivity extends AppCompatActivity {
private String videoPath;
private VideoView videoView;
private MediaController mediaController;
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video);
Intent intent=getIntent();
videoPath=intent.getStringExtra("videoPath");
videoView=(VideoView)findViewById(R.id.videoView);
mediaController = new MediaController(this);
videoView.setVideoPath(videoPath);
videoView.setMediaController(mediaController);
mediaController.setMediaPlayer(videoView);
videoView.requestFocus();
videoView.start();
}
}
|
2e0c7c0f-df7c-4cf1-9b28-77ab4b02c017 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-10 13:25:13", "repo_name": "zhilonglee/config-repo", "sub_path": "/microservice-zhilong-consumer-movie-fegin-customizing/src/main/java/com/ncs/zhilongcloud/controller/MovieController.java", "file_name": "MovieController.java", "file_ext": "java", "file_size_in_byte": 1193, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "41b75859d0c70fcf2dd2b3bc65742c9e0534c31b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zhilonglee/config-repo | 265 | FILENAME: MovieController.java | 0.289372 | package com.ncs.zhilongcloud.controller;
import java.math.BigDecimal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import com.ncs.zhilongcloud.EurekaFeginClient;
import com.ncs.zhilongcloud.UserFeginClient;
import com.ncs.zhilongcloud.entity.User;
@RestController
public class MovieController {
@Autowired
private UserFeginClient userFeginClient;
@Autowired
private EurekaFeginClient eurekaFeginClient;
@GetMapping("/movie/{id}")
public User findById(@PathVariable Long id){
return userFeginClient.findById(id);
}
@GetMapping("/test")
public User postUserTest(){
User user = new User();
user.setAge(18);
user.setBalance(BigDecimal.valueOf(200d));
user.setId(6l);
user.setName("caichao");
user.setUsername("caichaowangba");
return userFeginClient.postUserTest(user);
}
@GetMapping("/{serviceName}")
public String findServiceInfoViaEurekaApps(@PathVariable String serviceName){
return eurekaFeginClient.findServiceInfoViaEurekaApps(serviceName);
}
}
|
5cdf5275-44bf-4629-bcf4-12d2bf650dcd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-04-26 09:43:51", "repo_name": "noppakorn-wai/DatacenterVisualization", "sub_path": "/QueryAdapter/src/main/java/com/kmitl/b_mw/queryadapter/vCenter/dataConverter/nodeConverter/BasicModel.java", "file_name": "BasicModel.java", "file_ext": "java", "file_size_in_byte": 1064, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "d0890bb82148e171834547c59eab9ca6c2084763", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/noppakorn-wai/DatacenterVisualization | 216 | FILENAME: BasicModel.java | 0.252384 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.kmitl.b_mw.queryadapter.vCenter.dataConverter.nodeConverter;
import org.apache.log4j.Logger;
import org.json.JSONException;
import org.json.JSONObject;
/**
*
* @author B_MW (Wai & May)
*/
public abstract class BasicModel {
private static final Logger LOG = Logger.getLogger(BasicModel.class.getName());
JSONObject jsonData;
public String getKey() {
String key;
try {
key = jsonData.getJSONObject("MOR").getString("val");
} catch (JSONException ex) {
LOG.warn(ex);
key = "";
}
return key;
}
public String getName() {
String name;
try {
name = jsonData.getString("name");
} catch (JSONException ex) {
LOG.warn(ex);
name = "";
}
return name;
}
public abstract String getType();
}
|
28201473-022f-4926-abf6-41b12902d887 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-04-22 13:52:44", "repo_name": "minwan1/Spring-social-facebook", "sub_path": "/src/main/java/com/javacents/socialsignin/socialutils/PostSocialSignInAdapter.java", "file_name": "PostSocialSignInAdapter.java", "file_ext": "java", "file_size_in_byte": 1222, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "e80918279f7e9643d313855a0e85946a41d194f2", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/minwan1/Spring-social-facebook | 214 | FILENAME: PostSocialSignInAdapter.java | 0.23092 | package com.javacents.socialsignin.socialutils;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import org.springframework.social.connect.Connection;
import org.springframework.social.connect.UserProfile;
import org.springframework.social.connect.web.SignInAdapter;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.context.request.ServletWebRequest;
import com.javacents.socialsignin.infrastructure.repository.UserRepository;
import com.javacents.socialsignin.model.User;
public class PostSocialSignInAdapter implements SignInAdapter {
private UserRepository userRepository;
@Inject
public PostSocialSignInAdapter(UserRepository userRepository) {
this.userRepository = userRepository;
}
@Override
public String signIn(String localUserId, Connection<?> connection, NativeWebRequest request) {
UserProfile profile = connection.fetchUserProfile();
User user = userRepository.findByEmail(profile.getEmail());
HttpServletRequest req = ((ServletWebRequest) request).getRequest();
req.getSession().setAttribute("loggedUser", user);
return "/"; // will return to postSignInUrl 로그인한이후에 이동될 사이트인듯
}
}
|
108478ff-7fc1-4de2-9c04-a57729a26aff | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-28 10:02:05", "repo_name": "reachyu/spring-microservice", "sub_path": "/microservice-provider/src/main/java/com/reachyu/springcloud/controller/OrderController.java", "file_name": "OrderController.java", "file_ext": "java", "file_size_in_byte": 987, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "610dd9f35a30347de6c5afb8e5522c13c2f46d34", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/reachyu/spring-microservice | 192 | FILENAME: OrderController.java | 0.240775 | package com.reachyu.springcloud.controller;
import com.reachyu.springcloud.service.OrderService;
import com.reachyu.springcloud.vo.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author reachyu
*/
@RestController
public class OrderController {
@Autowired
private OrderService service;
@RequestMapping(value="/order/add", method=RequestMethod.POST)
public boolean addOrder(@RequestBody Order order){
boolean flag = service.addOrder(order);
return flag;
}
@RequestMapping(value="/order/info/{id}", method=RequestMethod.GET)
public Order getOrder(@PathVariable("id") String id){
Order order = service.getOrder(id);
return order;
}
@RequestMapping(value="/order/list", method=RequestMethod.GET)
public List<Order> getOrders(){
List<Order> orders = service.listOrder();
return orders;
}
}
|
81fb14f5-a71a-44d6-9107-9b336e7d4f63 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-05-14T13:43:07", "repo_name": "BricMichael/Full-Stack-MERN-Project", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1047, "line_count": 29, "lang": "en", "doc_type": "text", "blob_id": "5c262a3084528f33791e722f0714c154870ce406", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/BricMichael/Full-Stack-MERN-Project | 264 | FILENAME: README.md | 0.243642 | <h1 align="center">App Memories Full Stack MERN</h1>
<div align="center">
Testing my knowledge in React and Node <a href="https://memoriesappp.netlify.app/">Link Application</a>.
</div>
<div align="center">
<h2>Programador</h2>
<h3>
<a href="https://github.com/BricMichael">
Michael
</a>
</h3>
</div>
## About the Project

#English
Application with React, Node.js, Express and MongoDB. MERN Full Stack project completed. The application is called "Memories" and it is a social media application from MERN that allows users to post interesting events that happened in their lives.
#Spanish
Aplicación con React, Node.js, Express y MongoDB. Proyecto MERN Full Stack completado. La aplicación se llama "Memories" y es una aplicación de redes sociales de MERN que permite a los usuarios publicar eventos interesantes que sucedieron en sus vidas.
## Contact Dev
- MichaelBric [Dev](https://codepen.io/MichaelBricDev)
|
7404e65c-7a8b-4a40-9024-795873535945 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-08-02 08:54:47", "repo_name": "settingboy/iMusic", "sub_path": "/iMusic_server/src/main/java/com/yuchen/iMusic/business/service/YcSongInfoServiceImpl.java", "file_name": "YcSongInfoServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1003, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "294da065f7d32373423d7ddcdd1c8763554fb259", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/settingboy/iMusic | 238 | FILENAME: YcSongInfoServiceImpl.java | 0.275909 | package com.yuchen.iMusic.business.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.testng.log4testng.Logger;
import com.yuchen.iMusic.business.dao.YcSongInfoMapper;
import com.yuchen.iMusic.business.model.YcSongInfo;
import com.yuchen.iMusic.core.common.YcGeeException;
import com.yuchen.iMusic.core.util.RES_STATUS;
@Service
public class YcSongInfoServiceImpl implements YcSongInfoService {
private static final Logger logger = Logger.getLogger(YcSongInfoServiceImpl.class);
@Autowired
YcSongInfoMapper ycSongInfoMapper;
@Override
public YcSongInfo getSongInfoById(Long songInfoId) {
YcSongInfo ycSongInfo = ycSongInfoMapper.selectByPrimaryKey(songInfoId);
if (null == ycSongInfo || ycSongInfo.equals(null)) {
logger.error("当前播放歌曲:{songInfoId=" + songInfoId + "不存在或已下线!");
throw new YcGeeException(RES_STATUS.CURRENT_SONG_NOT_EXIST);
}
return ycSongInfo;
}
}
|
d942ba52-b160-46a6-8cb1-8e470212e3a8 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-08-27T10:00:35", "repo_name": "prplz/MemoryFix", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1193, "line_count": 19, "lang": "en", "doc_type": "text", "blob_id": "14085e70e7b617a5b3a536c5ee5186c0d2ad2e5f", "star_events_count": 35, "fork_events_count": 12, "src_encoding": "UTF-8"} | https://github.com/prplz/MemoryFix | 284 | FILENAME: README.md | 0.23092 | MemoryFix is a mod for Forge 1.8.9 that aims to fix known memory issues.
Which issues does it fix?
------
- **Optifine cape leak**: This is the main memory leak, anyone who has played minigames for a few hours would have experienced it. More information: https://github.com/sp614x/optifine/issues/526.
- **Oversized resource pack icons**: Some users download hundreds of resource packs and some resource pack makers (looking at you Apexay) put huge icons in their resource packs. This adds up and can use hundreds of megabytes of memory for some users.
- **System.gc() on world change**: Causes world changes to take a few seconds. The same effect can also be achieved by adding the JVM argument `-XX:+DisableExplicitGC`.
Special thanks
------

YourKit supports open source projects with its full-featured Java Profiler.
YourKit, LLC is the creator of [YourKit Java Profiler](https://www.yourkit.com/java/profiler/)
and [YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/),
innovative and intelligent tools for profiling Java and .NET applications.
Without the use of YourKit, this project would not have been possible.
|
20759049-bd0c-45e6-b112-6181c9447f62 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-02 21:10:41", "repo_name": "CodeFromStav/TransactionServer", "sub_path": "/TransactionServer/src/transaction/server/transaction/TransactionManager.java", "file_name": "TransactionManager.java", "file_ext": "java", "file_size_in_byte": 965, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "f7d09a2deec7e66fd662a59a33042d9f63bf19e6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/CodeFromStav/TransactionServer | 183 | FILENAME: TransactionManager.java | 0.281406 | package transaction.server.transaction;
import java.net.Socket;
import java.util.ArrayList;
import transaction.comm.MessageTypes;
/*
TransactionManager.java
-has transaction manager workers
-open up one connection per transaction, stays open until a close transaction is received.
-Read/Write requests handled by TransactionWorker
*/
public class TransactionManager extends Thread implements MessageTypes
{
// variables
public static int transactionCounter = 0;
public static final ArrayList<Transaction> transactions = new ArrayList<>();
// Constructor
public TransactionManager()
{
}
// getter of the list of transactions
public ArrayList<Transaction> getTransactions()
{
return transactions;
}
// function for running the threads
public void runTransaction( Socket client )
{
new TransactionManagerWorker(client).start();
// accept incoming connections
// call run() to start up worker threads
}
}
|
6c64b605-d46b-4c1e-8ab8-7e79f46f5895 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-05-10 20:47:56", "repo_name": "javier-delgado/upstack-demo", "sub_path": "/app/src/main/java/com/javierdelgado/upstack_demo/vistas/FullScreenImageActivity.java", "file_name": "FullScreenImageActivity.java", "file_ext": "java", "file_size_in_byte": 1109, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "2558b985e2a630678140819db780c5cf061075da", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/javier-delgado/upstack-demo | 215 | FILENAME: FullScreenImageActivity.java | 0.213377 | package com.javierdelgado.upstack_demo.vistas;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.javierdelgado.upstack_demo.R;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import uk.co.senab.photoview.PhotoViewAttacher;
public class FullScreenImageActivity extends AppCompatActivity {
@BindView(R.id.img)
ImageView img;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_full_screen_image);
ButterKnife.bind(this);
setupImage();
Toast.makeText(this, R.string.pinch_to_zoom_explain, Toast.LENGTH_SHORT).show();
}
private void setupImage() {
Glide.with(this)
.load(getIntent().getStringExtra("img_url"))
.into(img);
new PhotoViewAttacher(img);
}
@OnClick(R.id.btnClose)
public void onClose() {
onBackPressed();
}
}
|
c4a895a1-d2c5-425f-8021-600888f25156 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-03 05:20:56", "repo_name": "Littlexs/rxjavaRetrofitMvp", "sub_path": "/app/src/main/java/com/yunche/finance/android/http/converter/FastJsonResponseBodyConverter.java", "file_name": "FastJsonResponseBodyConverter.java", "file_ext": "java", "file_size_in_byte": 1092, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "8f452c4c682889093d7c4a11651d8063804afa59", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Littlexs/rxjavaRetrofitMvp | 221 | FILENAME: FastJsonResponseBodyConverter.java | 0.268941 | package com.yunche.finance.android.http.converter;
import com.alibaba.fastjson.JSON;
import com.yunche.finance.android.http.base.ApiException;
import com.yunche.finance.android.http.base.HttpStatus;
import java.io.IOException;
import java.lang.reflect.Type;
import okhttp3.ResponseBody;
import okio.BufferedSource;
import okio.Okio;
import retrofit2.Converter;
final class FastJsonResponseBodyConverter<T> implements Converter<ResponseBody, T> {
private final Type type;
public FastJsonResponseBodyConverter(Type type) {
this.type = type;
}
/*
* 转换方法
*/
@Override
public T convert(ResponseBody value) throws IOException {
BufferedSource bufferedSource = Okio.buffer(value.source());
String tempStr = bufferedSource.readUtf8();
bufferedSource.close();
HttpStatus resultBody = JSON.parseObject(tempStr,HttpStatus.class);
if (resultBody.isCodeInvalid()){
throw new ApiException(resultBody.getCode(),resultBody.getMsg());
}
return JSON.parseObject(tempStr,type);
}
}
|
8ab4f9ed-3766-47de-9b97-396faced4f6c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-21 09:07:58", "repo_name": "hugoYe/JavaLearn", "sub_path": "/service/src/main/java/com/system/common/utils/SHA256Utils.java", "file_name": "SHA256Utils.java", "file_ext": "java", "file_size_in_byte": 1144, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "fb5c7901dc3f8cc2d7aed8e2417f42cc7e828f81", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/hugoYe/JavaLearn | 280 | FILENAME: SHA256Utils.java | 0.293404 | package com.system.common.utils;
import org.apache.commons.codec.binary.Hex;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.security.MessageDigest;
public class SHA256Utils {
protected static final Logger LOG = LoggerFactory.getLogger(SHA256Utils.class);
/***
* 利用Apache的工具类实现SHA-256加密
*
* @param str 加密后的报文
* @return
*/
public static String sha256(String str) {
MessageDigest messageDigest;
String encdeStr = "";
try {
messageDigest = MessageDigest.getInstance("SHA-256");
byte[] hash = messageDigest.digest(str.getBytes("UTF-8"));
encdeStr = Hex.encodeHexString(hash);
} catch (Exception e) {
LOG.error("getSHA256Str has error:", e);
return str;
}
return encdeStr;
}
/**
* 密码加盐加密
*
* @param password
* @param salt
* @return
* @author guanliangyou515
*/
public static String encryptPassword(String password, String salt) {
return sha256(sha256(password) + salt);
}
} |
56c7d310-9dd8-4711-b945-8a2084e5d110 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-08 09:51:24", "repo_name": "thevlad/spring-boot-rss-aggregator", "sub_path": "/src/main/java/org/thevlad/rss/subscr/Subscription.java", "file_name": "Subscription.java", "file_ext": "java", "file_size_in_byte": 1193, "line_count": 65, "lang": "en", "doc_type": "code", "blob_id": "f68784737455a1a738749872c80f9b94a59a21ac", "star_events_count": 6, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/thevlad/spring-boot-rss-aggregator | 304 | FILENAME: Subscription.java | 0.249447 | package org.thevlad.rss.subscr;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.thevlad.rss.feed.Feed;
@Document(collection = "subscriptions")
public class Subscription {
@Id
private String id;
@Indexed(unique = true)
private String rssUrl;
private int subscrCount;
private Feed feed;
public Subscription() {
}
public Subscription(String id, String rssUrl, int subscrCount) {
this.id = id;
this.rssUrl = rssUrl;
this.subscrCount = subscrCount;
}
public Subscription(String id, String rssUrl, int subscrCount, Feed feed) {
this(id, rssUrl, subscrCount);
this.feed = feed;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getRssUrl() {
return rssUrl;
}
public void setRssUrl(String rssUrl) {
this.rssUrl = rssUrl;
}
public int getSubscrCount() {
return subscrCount;
}
public void setSubscrCount(int subscrCount) {
this.subscrCount = subscrCount;
}
public Feed getFeed() {
return feed;
}
public void setFeed(Feed feed) {
this.feed = feed;
}
}
|
555a2d4e-e5e6-4158-a105-6462686ecfde | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-18 08:36:37", "repo_name": "chenxiangzhen/taotao", "sub_path": "/taotao-web/src/main/java/com/taotao/controller/ContentController.java", "file_name": "ContentController.java", "file_ext": "java", "file_size_in_byte": 1217, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "242ab471624fe85976e70913350d49829019cb5c", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/chenxiangzhen/taotao | 258 | FILENAME: ContentController.java | 0.214691 | package com.taotao.controller;
import com.taotao.common.pojo.TaotaoResult;
import com.taotao.common.utils.HttpClientUtil;
import com.taotao.pojo.TbContent;
import com.taotao.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* Description:
*
* @author: ChenXiangzhen
* create 2017-04-15-14:31
*/
@Controller
@RequestMapping("/content")
public class ContentController {
@Autowired
private ContentService contentService;
@Value("${REST_BASE_URL}")
private String REST_BASE_URL;
@Value("${REST_CONTENT_SYNC_URL}")
private String REST_CONTENT_SYNC_URL;
@RequestMapping("/save")
@ResponseBody
public TaotaoResult insertContent(TbContent content) {
TaotaoResult result = contentService.insertContent(content);
// 调用taotao-rest发布的服务,同步缓存
HttpClientUtil.doGet(REST_BASE_URL + REST_CONTENT_SYNC_URL + content.getCategoryId());
return result;
}
}
|
1fd29bd7-d4f8-472b-b86d-8b7738c69b44 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-10 08:14:43", "repo_name": "qiaoyingemilytan/IntegerSequence", "sub_path": "/ArraySequence.java", "file_name": "ArraySequence.java", "file_ext": "java", "file_size_in_byte": 965, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "b0eaa25bbd3acb3c3e556ea8b067035a81c7a5e8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/qiaoyingemilytan/IntegerSequence | 227 | FILENAME: ArraySequence.java | 0.277473 | import java.util.NoSuchElementException;
public class ArraySequence implements IntegerSequence{
private int currentIndex;
private int [] data;
public ArraySequence(int [] other){
data = new int[other.length];
for(int i = 0; i < other.length; i++){
data[i] = other[i];
}
}
public ArraySequence(IntegerSequence otherseq){
otherseq.reset();
data = new int[otherseq.length()];
for(int i = 0; i < otherseq.length(); i++){
data[i] = otherseq.next();
}
}
public void reset(){
currentIndex = 0;
}
public int length(){
return data.length;
}
public boolean hasNext(){
if(currentIndex >= 0 && currentIndex < data.length){
return true;
}
return false;
}
public int next(){
if(hasNext() == false){
throw new NoSuchElementException(currentIndex + " is not in array " + data.toString());
}
int temp = data[currentIndex];
currentIndex ++;
return temp;
}
}
|
fc969b00-0872-46c5-8818-505e69b8aabb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-21 22:35:20", "repo_name": "AkbarMarunduri/belajar-creational-patter", "sub_path": "/spring-design-patter-creational/src/test/java/amd/programmer/java/spring/creational/prototype/PrototypeAppicationTest.java", "file_name": "PrototypeAppicationTest.java", "file_ext": "java", "file_size_in_byte": 971, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "c58f953d10373c70c1527f64737168f43387c7a3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AkbarMarunduri/belajar-creational-patter | 186 | FILENAME: PrototypeAppicationTest.java | 0.23231 | package amd.programmer.java.spring.creational.prototype;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import static org.junit.jupiter.api.Assertions.*;
@SpringBootTest(classes = PrototypeAppication.class)
class PrototypeAppicationTest {
@Autowired
private ApplicationContext applicationContext;
@Test
void testPrototype() {
Employe akbar = applicationContext.getBean("employeManager", Employe.class);
akbar.setNama("Akbar");
Employe minda = applicationContext.getBean("employeStaff", Employe.class);
minda.setNama("Minda");
Employe ibu = applicationContext.getBean("employeC_Level", Employe.class);
ibu.setNama("Ibu");
System.out.println(akbar);
System.out.println(minda);
System.out.println(ibu);
}
} |
8a29fcf2-59ac-46a2-a439-bf22f82d4f0a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-27 03:42:39", "repo_name": "mszok/android-easycomm", "sub_path": "/src/main/java/android/firefly/coltfashion/cc/netcomm/socketcomm/example/event/SessionEventCollection.java", "file_name": "SessionEventCollection.java", "file_ext": "java", "file_size_in_byte": 1193, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "e6192221dc9c2e51412d4f4ad32e78a7ed276716", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mszok/android-easycomm | 235 | FILENAME: SessionEventCollection.java | 0.295027 | package android.firefly.coltfashion.cc.netcomm.socketcomm.example.event;
import android.firefly.coltfashion.cc.netcomm.socketcomm.tcp.IPacketEvent;
public class SessionEventCollection {
// private HashMap<Long, IPacketEvent> mSessionEventMap = new HashMap<Long,
// IPacketEvent>();
static private SessionEventCollection _SessionEventCollection;
static {
_SessionEventCollection = new SessionEventCollection();
}
private IPacketEvent mCurrentPacketEvent;
static public SessionEventCollection inst() {
return _SessionEventCollection;
}
public synchronized IPacketEvent pollEventDealer() {
IPacketEvent reEvent = mCurrentPacketEvent;
mCurrentPacketEvent = null;
return reEvent;
}
public synchronized IPacketEvent getEventDealer() {
return mCurrentPacketEvent;
}
public synchronized void putEventDealer(IPacketEvent eventDealer) {
mCurrentPacketEvent = eventDealer;
}
public synchronized boolean existDealer() {
return mCurrentPacketEvent != null;
}
public synchronized void clearSessionMap() {
mCurrentPacketEvent = null;
}
}
|
99d4d142-18c6-47c4-a69e-7585c0b5ae3c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-12-11 23:54:17", "repo_name": "tkaraivanovuni/masters-assignment", "sub_path": "/masters-assignment/src/main/java/uni/fmi/assignment/AppUserDetailService.java", "file_name": "AppUserDetailService.java", "file_ext": "java", "file_size_in_byte": 972, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "8155a4719526a4dd97a395ff19cf6c0e92ae4a6b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/tkaraivanovuni/masters-assignment | 184 | FILENAME: AppUserDetailService.java | 0.283781 | package uni.fmi.assignment;
import java.util.Set;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import uni.fmi.assignment.bean.RoleBean;
import uni.fmi.assignment.bean.UserBean;
import uni.fmi.assignment.repo.UserRepo;
@Service
public class AppUserDetailService implements UserDetailsService{
private UserRepo userRepo;
public AppUserDetailService(UserRepo userRepo) {
this.userRepo = userRepo;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
UserBean user = userRepo.findUserByUsername(username);
if(user == null) {
throw new UsernameNotFoundException(username);
}
Set<RoleBean> userRoles = user.getRoles();
return new UserPrincipal(user, userRoles);
}
}
|
efc5576f-732f-47ed-bd90-fd53db8a874e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-21 02:16:47", "repo_name": "Inagawa365/Inagawa365", "sub_path": "/Servlet/src/jp/co/colla_tech/ServletTask3.java", "file_name": "ServletTask3.java", "file_ext": "java", "file_size_in_byte": 1179, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "cc032675b4c839719fdf6967a610912c13f5f2e9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Inagawa365/Inagawa365 | 235 | FILENAME: ServletTask3.java | 0.262842 | package jp.co.colla_tech;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Random;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/ServletTask3")
public class ServletTask3 extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//占いをランダムで決定
String[] fortune = {"大吉", "中吉", "小吉", "末吉", "凶", "大凶"};
Random random = new Random();
String luck = fortune[random.nextInt(6)];
response.setContentType("text/html; charset = UTF-8");
PrintWriter out = response.getWriter();
//headerとfooterの間に内容を記述
HtmlTemplate.header(out);
out.println("<title>Servlet Kadai</title>");
out.println("<p>↓占い結果↓</p>");
out.println("<h1>" + luck + "</h1>");
HtmlTemplate.footer(out);
}
}
|
9726bc70-f3d3-449b-9f27-b07ac9392e78 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-09 15:01:54", "repo_name": "2870597860/batch-demo", "sub_path": "/src/main/java/com/batch/define/step/writer/DefaultItemWriter.java", "file_name": "DefaultItemWriter.java", "file_ext": "java", "file_size_in_byte": 980, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "934e85bf1f8efd4806c06c09f5afc7594c8269d5", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/2870597860/batch-demo | 194 | FILENAME: DefaultItemWriter.java | 0.27048 | package com.batch.define.step.writer;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.adapter.ItemWriterAdapter;
import org.springframework.batch.item.support.CompositeItemWriter;
import java.util.ArrayList;
import java.util.List;
public abstract class DefaultItemWriter<T> {
private static final String targetMethodName = "executor";
/**
* 适配器模式
*/
public ItemWriter<T> adapterWriter(ProxyWriter pw){
ItemWriterAdapter<T> adapter = new ItemWriterAdapter();
adapter.setTargetMethod(targetMethodName);
adapter.setTargetObject(pw);
return adapter;
}
public ItemWriter<T> compositeWriter(ItemWriter ... itemWriters){
CompositeItemWriter writer = new CompositeItemWriter();
List<ItemWriter> writers = new ArrayList<>(itemWriters.length);
for (ItemWriter pw: itemWriters) {
writers.add(pw);
}
return writer;
}
}
|
d5c0df2f-7fa1-4fc0-ab4b-64c4c5742e44 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-13 08:48:28", "repo_name": "xinlingjushi/learnRecords", "sub_path": "/src/main/java/com/example/demo/com/WebC.java", "file_name": "WebC.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "7f6b9ff163359ae971b4ff1634c54e5d7214497d", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xinlingjushi/learnRecords | 254 | FILENAME: WebC.java | 0.279828 | package com.example.demo.com;
import jdk.internal.instrumentation.TypeMapping;
import org.springframework.stereotype.Controller;
import javax.servlet.http.HttpServletRequest;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
@Controller
public class WebC {
public String body(HttpServletRequest hsr) throws IOException {
String contentLength = hsr.getHeader("Content-Length");
byte[] buffer= new byte[Integer.valueOf(contentLength)];
DataInputStream dis = new DataInputStream(hsr.getInputStream());
InputStream in = hsr.getInputStream();
dis.readFully(buffer,0,buffer.length);
return new String(buffer,"UTF-8");
}
public final int readFully(InputStream in, byte b[], int off, int len) throws IOException {
if (len < 0)
throw new IndexOutOfBoundsException();
int n = 0;
while (n < len) {
int count = in.read(b, off + n, len - n);
if (count < 0)
break;
n += count;
}
return n;
}
public static void main(String argv[]){
//道可道也,非恒道也;名可名也,非恒名也。
}
}
|
0ea120c7-b736-43d7-b890-0b0be38d1034 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-12 22:31:51", "repo_name": "igorroncevic/isa2020-backend", "sub_path": "/src/main/java/team18/pharmacyapp/model/medicine/ReservedMedicines.java", "file_name": "ReservedMedicines.java", "file_ext": "java", "file_size_in_byte": 1191, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "147beafe8a72cc588606d8017da76c958dc6fa08", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/igorroncevic/isa2020-backend | 254 | FILENAME: ReservedMedicines.java | 0.274351 | package team18.pharmacyapp.model.medicine;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.GenericGenerator;
import team18.pharmacyapp.model.Pharmacy;
import team18.pharmacyapp.model.users.Patient;
import javax.persistence.*;
import java.util.Date;
import java.util.UUID;
@Entity(name = "reserved_medicines")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ReservedMedicines {
@Id
@GeneratedValue(generator = "UUID")
@GenericGenerator(
name = "UUID", strategy = "org.hibernate.id.UUIDGenerator"
)
private UUID id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(nullable = false)
private Patient patient;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(nullable = false)
private Medicine medicine;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(nullable = false)
private Pharmacy pharmacy;
private Date pickupDate; // Datum do kog ce pacijent preuzeti lijek
private boolean handled; // ako je pacijent pokupio lijek ili je dobio penal, bice true
@Version
private Long version = 0L;
}
|
dbfde73b-b5b1-48d0-90dd-232b263bc267 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-11-04T22:42:47", "repo_name": "DebojyotiK/TickledMedia", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 970, "line_count": 25, "lang": "en", "doc_type": "text", "blob_id": "1c590bbac8962d8aee7058864277c5f18be53a19", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DebojyotiK/TickledMedia | 221 | FILENAME: README.md | 0.229535 | # TickledMedia Assignment!
## Project Usage
Run `carthage update --platform iOS` to install the dependencies
## Frameworks
- **Alamofire** Used For Making Network calls
- **Alamofire Object Mapper** Used for mapping web Entities.I could also have used JSONDecoder
- **SDWebImage** Used for loading images from Server.
I could have implemented this on my own.However the challenges couldnot be solved in a short period of time
They are:
1.Downloading the Image and storing them on the disk manually
2.Maintain some Database where physical path of the image would be kept in relation to the imageURL
3.I would also have to respect the Cache-Control headers.Store the max age time,
4.Store the ETag so that if the image changes on the server side even if for the same URL I get the updated image
5.Make a custom network call.Manage its delegates on my own.Post notifications about image Progress.
## Remaining
Unit Test cases
UI Automation Testing
|
d8b7f3fa-900e-42f1-ae15-4c05ddd97f15 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-03-02 19:15:33", "repo_name": "zoostar/master-data", "sub_path": "/master-data-jobs/src/main/java/net/zoostar/md/job/processor/CustomerItemProcessorImpl.java", "file_name": "CustomerItemProcessorImpl.java", "file_ext": "java", "file_size_in_byte": 1065, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "c8b6797c735251c7a657288e7c0fec01b3e7085b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zoostar/master-data | 211 | FILENAME: CustomerItemProcessorImpl.java | 0.267408 | package net.zoostar.md.job.processor;
import java.util.UUID;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j;
import net.zoostar.md.model.Customer;
import net.zoostar.md.rule.impl.CustomerRequiredFieldRule;
@Slf4j
public class CustomerItemProcessorImpl implements ItemProcessor<Customer, Customer> {
protected CustomerRequiredFieldRule customerRequiredFieldRule;
@Autowired
public void setCustomerRequiredFieldRule(CustomerRequiredFieldRule customerRequiredFieldRule) {
log.debug("setCustomerRequiredFieldRule({})", customerRequiredFieldRule);
this.customerRequiredFieldRule = customerRequiredFieldRule;
}
@Override
public Customer process(Customer customer) throws Exception {
log.info("Processing item: {}", customer);
customerRequiredFieldRule.apply(customer);
if(customer.isNew()) {
customer.setId(UUID.randomUUID());
}
log.info("{}", "Processing item complete.");
return customer;
}
}
|
17506a7a-b303-43fa-9503-42fbbe1a59af | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-10-01T22:25:34", "repo_name": "Sustenance/generator-latex-resume", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 968, "line_count": 43, "lang": "en", "doc_type": "text", "blob_id": "1a2338163bd45a0d8663e0de56929c83db462d71", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Sustenance/generator-latex-resume | 248 | FILENAME: README.md | 0.255344 | # generator-latex-resume
[](https://github.com/RichardLitt/standard-readme)
> A Yeoman generator to build a skeleton resume LaTeX document
Use this [Yeoman](http://yeoman.io/) generator to bootstrap a basic resume in the LaTeX format, to which you can add content and then compile manually using your LaTeX compiler of choice.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [Maintainer](#maintainer)
- [Contribute](#contribute)
- [License](#license)
## Install
Requires `node>=4`
```sh
npm install -g yo generator-latex-resume
```
## Usage
```sh
yo latex-resume
```
## Maintainer
- [Sustenance](https://github.com/Sustenance)
## Contribute
Contributions welcomed!
For large changes, please file an issue first, before submitting a pull request.
Please squash extraneous commits, such as `Testing a thing`.
## License
MIT |
5af59e5d-9088-4593-a883-aa99184830fe | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-03-10T16:16:00", "repo_name": "Tunisian-GitHub-Community/LiveCode-Express", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 972, "line_count": 43, "lang": "en", "doc_type": "text", "blob_id": "f254f2ba9ee2751563b8de0eaba45d47ba1152ac", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Tunisian-GitHub-Community/LiveCode-Express | 255 | FILENAME: README.md | 0.26588 | # Live Code Express
This is live coding meeting : Wednesday, March 10, 2021
---
## Requirements
For development, you will only need Node.js and NPM or Yarn, installed in your environement.
### Node
- #### Node installation on Windows
Just go on [official Node.js website](https://nodejs.org/) and download the installer.
Also, be sure to have `git` available in your PATH, `npm` might need it (You can find git [here](https://git-scm.com/)).
- #### Node installation on Ubuntu
You can install nodejs and npm easily with apt install, just run the following commands.
$ sudo apt install nodejs
$ sudo apt install npm
If the installation was successful, you should be able to run the following command.
$ node --version
v14.16.0
$ npm --version
6.14.11
## Install
$ git clone https://github.com/Tunisian-GitHub-Community/LiveCode-Express
$ cd LiveCode-Express
$ npm install
## Running the project
$ npm start
|
f8bfe0e4-fbbd-46f9-9f30-fa08abb0cbf7 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-07-13T12:45:31", "repo_name": "onap/integration", "sub_path": "/test/mocks/datafilecollector-testharness/ftpes-sftp-server/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1194, "line_count": 38, "lang": "en", "doc_type": "text", "blob_id": "ed5e56d7f2668f87fb85617164d95eebc8841de2", "star_events_count": 10, "fork_events_count": 14, "src_encoding": "UTF-8"} | https://github.com/onap/integration | 287 | FILENAME: README.md | 0.247987 | # Deployment of certificates: (in case of update)
This folder is prepared with a set of keys matching DfC for test purposes.
Copy from datafile-app-server/config/keys to the ./tls/ the following files:
- dfc.crt
- ftp.crt
- ftp.key
# Docker preparations
Source: <https://docs.docker.com/install/linux/linux-postinstall/>
`sudo usermod -aG docker $USER`
then logout-login to activate it.
# Prepare files for the simulator
Run `prepare.sh` with an argument found in `test_cases.yml` (or add a new tc in that file) to create files (1MB, 5MB and 50MB files) and a large number of
symbolic links to these files to simulate PM files. The files names maches the files in
the events produced by the MR simulator. The dirs with the files will be mounted
by the ftp containers, defined in the docker-compse file, when started
# Starting/stopping the FTPES/SFTP server(s)
Start: `docker-compose up`
Stop: Ctrl +C, then `docker-compose down` or `docker-compose down --remove-orphans`
If you experience issues (or port collision), check the currently running other containers
by using 'docker ps' and stop them if necessary.
# Cleaning docker structure
Deep cleaning: `docker system prune`
|
cd487332-fb5d-48c6-b2e5-8c21e5b6b721 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-05 18:01:25", "repo_name": "deshpanderuchav/modernaAdapter", "sub_path": "/src/java/com/liconic/JobData.java", "file_name": "JobData.java", "file_ext": "java", "file_size_in_byte": 971, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "de6df22bfb2b990c53351677f0ef0806431e33bd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/deshpanderuchav/modernaAdapter | 220 | FILENAME: JobData.java | 0.264358 | package com.liconic;
import com.liconic.ServiceDao;
import java.io.FileNotFoundException;
import java.sql.SQLException;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
/*
* 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.
*/
/**
*
* @author Rucha Deshpande
*/
@Path("job")
public class JobData {
@GET
@Path("/{id}/data")
@Produces(MediaType.TEXT_PLAIN)
public Response getJobStatus(@PathParam("id") int jobId) throws ClassNotFoundException, FileNotFoundException, SQLException
{
ServiceDao dao = ServiceDao.getInstance();
return dao.jobData(jobId);
}
@GET
@Path("data")
@Produces(MediaType.TEXT_PLAIN)
public String getJob()
{
return "successful";
}
}
|
59623608-0f7c-4320-bfb4-108b52889d58 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-07-14 21:06:29", "repo_name": "icharny/walmartDemo", "sub_path": "/app/src/main/java/com/example/isaaccharny/walmartdemo/Tasks/LoadImageTask.java", "file_name": "LoadImageTask.java", "file_ext": "java", "file_size_in_byte": 971, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "0cbf570b3462d8b5d2af96a7c026ffea336352e4", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/icharny/walmartDemo | 196 | FILENAME: LoadImageTask.java | 0.253861 | package com.example.isaaccharny.walmartdemo.Tasks;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.widget.ImageView;
import com.example.isaaccharny.walmartdemo.model.ProductData;
public class LoadImageTask extends AsyncTask<Void, Void, Bitmap> {
private final ImageView mImageView;
private final String imgUrl;
private String imgPath;
public LoadImageTask(ImageView mImageView, String imgUrl) {
this.mImageView = mImageView;
this.imgUrl = imgUrl;
}
@Override
protected void onPreExecute() {
imgPath = ProductData.IMAGES.get(imgUrl);
}
@Override
protected Bitmap doInBackground(Void... voids) {
Bitmap imgBitmap = BitmapFactory.decodeFile(imgPath);
return imgBitmap;
}
@Override
protected void onPostExecute(Bitmap img) {
super.onPostExecute(img);
mImageView.setImageBitmap(img);
}
}
|
e43cfc38-2ab8-49d4-a570-aa60e54ca0e4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-12-07T00:39:03", "repo_name": "mbejda/pro-service-bootstrap-theme", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1196, "line_count": 66, "lang": "en", "doc_type": "text", "blob_id": "782b8e8af37d8407f4495a919ba23cce8a95c96b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mbejda/pro-service-bootstrap-theme | 388 | FILENAME: README.md | 0.245085 | 
# :computer: Getting Started
Built with Bootstrap `4.3.1`.
**Theme depends on the following tools**
- Node.js > `v10.x.x`
- NPM > `v6.x.x`
- Webpack > `4.x.x`
**Theme depends on the following plugins**
- animate.css `v3.7.2`
- hover.css `v2.3.2`
- countup.js `v2.0.4`
- jquery `v3.4.1`
- jquery-mask-plugin `v1.14.16`
- load-google-maps-api `v2.0.1`
- popper.js `v1.15.0`
**Theme depends on the following icon set**
- [IcoFont](https://icofont.com)
## :book: Commands
Install Dependencies <br>
```
npm install
```
Build <br>
```
npm run build
```
Browser Sync <br>
```
npm run watch
```
## :file_folder: Directory Structure
`/dist` theme html <br>
`/assets` theme images and other assets <br>
`/js` theme javascript files <br>
`/scss` theme styles <br>
`/src` main webpack entry file <br>
`/js/presentation.js` Is a presentation Javascript file <br>
`/scss/_extra.scss` Is a presentation SCSS file <br>
<hr>

### :trophy: Credits
Questions or need help? Send me a tweet!
[@notmilobejda](https://twitter.com/notmilobejda)
Or checkout my blog [mbejda.com](https://mbejda.com)
|
53b024e9-144a-44cf-a48e-b4b98a7366d6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-17 08:40:34", "repo_name": "GiriRaj12/Giri-Raj", "sub_path": "/Alphabet.java", "file_name": "Alphabet.java", "file_ext": "java", "file_size_in_byte": 982, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "7c37fad54388b69e563045371ff40449e1d1934c", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/GiriRaj12/Giri-Raj | 214 | FILENAME: Alphabet.java | 0.262842 | import java.util.*;
import java.lang.annotation.*;
public class Project {
public static void main(String []args) {
Scanner in=new Scanner(System.in);
String s=new String();
s=in.next();
int count=1;
for(int i=0;i<s.length()-1;i++){
if(Integer.parseInt(s.substring(i,i+1))==0){
System.out.println(s.substring(i,i+1));
continue;
}
if(Integer.parseInt(s.substring(i,i+2))<=26) {
System.out.println(s.substring(i,i+2));
count++;
}
}
for(int i=0;i<s.length();i++){
if(s.length()<4){
break;
}
if(i+4<s.length()) {
if (Integer.parseInt(s.substring(i, i + 2)) <= 26 && Integer.parseInt(s.substring(i + 2, i + 4)) <= 26) {
count++;
}
}
}
System.out.print(count);
}
}
|
6b4ad3e1-cc53-4d12-a86e-ed2321d7b07e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2016-06-02T02:00:29", "repo_name": "ShirleyxZhang/cs50_final", "sub_path": "/lib/hashtable/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 971, "line_count": 44, "lang": "en", "doc_type": "text", "blob_id": "bc8dd0add5b2a0cf5ce0dbbec1cb41cad6d2ea24", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ShirleyxZhang/cs50_final | 245 | FILENAME: README.md | 0.2227 | README for hashtable.c
Drew Waterman, April 2016
Compiling:
make
Usage:
/*
* hashtable.c - a hashtable module
* implemented using an array and linked lists
*
* The outline/structure of this program was modeled off of
* tree.c for the tree6 module, written by Professor David Kotz
*
* Drew Waterman, April 2016
*/
and
/*
* hashtest.c - a program to test the hashtable module
*
* Drew Waterman, April 2016
*/
[My testing program is called hashtest.c, not hashtabletest.c, but my Makefile
creates a file called hashtabletest]
Example command line:
./hashtabletest
Exit status:
0 - success
Assumptions:
- I could only test hashtable.c using strings for data, but the module should
work with other data types as well
- The user can make the hashtable as big or as small as they want
- The hashtable is implemented using a linked list
Limitations:
- hashtable.c does not have any delete functions to free memory, so memory
leaks are to be expected |
58c7ee20-3c88-4ab2-b08f-2b65c47255ff | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-03-04T08:59:22", "repo_name": "duobab/duobab.github.io", "sub_path": "/_posts/front/2021-02-06-angular.md", "file_name": "2021-02-06-angular.md", "file_ext": "md", "file_size_in_byte": 1399, "line_count": 53, "lang": "zh", "doc_type": "text", "blob_id": "6e2527526925472bc401ce4a1c7868fa90c79bcd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/duobab/duobab.github.io | 404 | FILENAME: 2021-02-06-angular.md | 0.255344 | ---
layout: post
title: angular 安装与使用过程
categories: 前端
description: angular 安装与使用过程
keywords: angular 安装与使用过程
---
本章介绍前端三大主流框架之一 angular 使用说明。
* * *
## 1.1 简介
Angular 是一个应用设计框架与开发平台,用于创建高效、复杂、精致的单页面应用。
* * *
## 1.2 环境搭建
- angular 依赖 Node.js, 需要[安装nodeJS](http://www.duobab.com/2021/02/05/nodejs)
- angular 依赖 npm, 需要[安装npm](http://www.duobab.com/2021/02/05/npm)
- 安装Angular CLI
`npm install -g @angular/cli`
* * *
## 1.3 angular 开发
- 创建新的angular工程和初始应用
`ng new my-app`
进入工程
`cd my-app`
启动工程(访问 http://localhost:4200/)
`ng serve`
- 定义angular应用
进入工程下执行: `ng generate application <application-name>`
- 定义angular组件(会生成html模板、Typescript类、 CSS 选择器、测试spec文件四个文件)
需要进入工程下的应用目录(app目录下)执行: `ng generate component <component-name>`
- 定义angular服务
需要进入工程下的应用目录(app目录下)执行: `ng generate service <service-name>`
- Angular 的双向数据绑定语法
`<input [(ngModel)]="hero.name" placeholder="name"/>`
* * *
## 1.4 参考资料
[angular 中文官网](https://angular.cn/)
* * *
|
93f807c6-2b2b-4ef2-8b47-491d8ed49b27 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-21 19:51:14", "repo_name": "aminoiu/aminoiu.gtihub.io", "sub_path": "/Backend/src/main/java/com/electronicvoting/service/admin/AdminServiceImpl.java", "file_name": "AdminServiceImpl.java", "file_ext": "java", "file_size_in_byte": 986, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "34897d728501261530b7db892b3d62514c4e296f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/aminoiu/aminoiu.gtihub.io | 206 | FILENAME: AdminServiceImpl.java | 0.250913 | package com.electronicvoting.service.admin;
import com.electronicvoting.entity.Admin;
import com.electronicvoting.repository.AdminRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
@Slf4j
public class AdminServiceImpl implements AdminService {
private final AdminRepository adminRepository;
public AdminServiceImpl(AdminRepository adminRepository) {
this.adminRepository = adminRepository;
}
@Override
public Admin findByEmail(String email) {
log.info("Find admin by e-mail[{}]",email);
return adminRepository.findByEmail(email);
}
@Override
public void saveUserAdmin(Admin admin) {
this.adminRepository.save(admin);
}
@Override
public String getHashPass(Admin admin) {
return admin.getHashPassword();
}
@Override
public void setHashPass(Admin admin,String hashedPass) {
}
}
|
a9e89d2f-5286-4b82-9982-64a04456e3c4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2020-07-23T17:03:39", "repo_name": "mattjuffs/WebApi", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1194, "line_count": 22, "lang": "en", "doc_type": "text", "blob_id": "d92bb2b96c0c17041835f8446b10bb6e6839851f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mattjuffs/WebApi | 288 | FILENAME: README.md | 0.253861 | # WebApi
.NET WebApi Demo demonstrating a simple .NET Core API to take data from a CSV, validate it and insert it into a SQL Database.
## /Data/
This is the Data Access Layer, using a .NET Core Library with Entity Framework. The database I used for testing is hosted in Azure.
## /SQL/
This contains the SQL scripts used to create the 2 tables and insert the test data.
## /WebApi/
This is the API itself, using .NET Core with the one **endpoint** `/api/meter-reading`
## Consuming the API
The API could be consumed in multiple ways:
* **[Postman](https://www.postman.com/)** to call the endpoint passing the CSV file contents in the raw body - _this method was used for testing_
* **React/Angular app** to take the CSV file and pass the contents of it to the endpoint using HTTP POST
* **Console Application** to read the CSV file from disc and HTTP POST the data to the endpoint
* **.NET Framework Web Forms** page to provide a fileupload control, which then reads the CSV and HTTP POST the data to the endpoint
* **.NET Framework/Core MVC** page to provide file upload and then HTTP POST to the endpoint
* **[.NET Blazor](https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor)** app
|
fafc6079-5f6f-41d6-9568-2aa78747241d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-04-09 12:46:24", "repo_name": "Nepxion/DiscoveryGuide", "sub_path": "/discovery-guide-service/src/main/java/com/nepxion/discovery/guide/service/feign/BFeignImpl.java", "file_name": "BFeignImpl.java", "file_ext": "java", "file_size_in_byte": 1107, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "742b56e7b53589e5bc8bcda4181eaf9c6c8e933e", "star_events_count": 1075, "fork_events_count": 248, "src_encoding": "UTF-8"} | https://github.com/Nepxion/DiscoveryGuide | 260 | FILENAME: BFeignImpl.java | 0.258326 | package com.nepxion.discovery.guide.service.feign;
/**
* <p>Title: Nepxion Discovery</p>
* <p>Description: Nepxion Discovery</p>
* <p>Copyright: Copyright (c) 2017-2050</p>
* <p>Company: Nepxion</p>
* @author Haojun Ren
* @version 1.0
*/
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import com.nepxion.discovery.common.constant.DiscoveryConstant;
import com.nepxion.discovery.guide.service.core.CoreImpl;
@RestController
@ConditionalOnProperty(name = DiscoveryConstant.SPRING_APPLICATION_NAME, havingValue = "discovery-guide-service-b")
public class BFeignImpl extends CoreImpl implements BFeign {
private static final Logger LOG = LoggerFactory.getLogger(BFeignImpl.class);
@Override
public String invoke(@PathVariable(value = "value") String value) {
value = getPluginInfo(value);
LOG.info("调用路径:{}", value);
return value;
}
} |
4aac9618-f74d-4ed4-9bda-a96c2aca39f6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-16 13:26:42", "repo_name": "arturvt/kalah-game", "sub_path": "/src/main/java/com/kalah/core/dto/PlayersDTO.java", "file_name": "PlayersDTO.java", "file_ext": "java", "file_size_in_byte": 1060, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "fe4a6b49819702ea7bcd219970e683ad102c5cb9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/arturvt/kalah-game | 217 | FILENAME: PlayersDTO.java | 0.259826 | package com.kalah.core.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.kalah.core.model.Game;
import com.kalah.core.model.Player;
import com.kalah.core.util.GameStatus;
import java.util.Date;
public class PlayersDTO {
@JsonProperty("gameStatus")
private final String gameStatus;
@JsonProperty("players")
private final Player[] players;
@JsonProperty("lastUpdate")
private final long lastUpdate;
@JsonProperty("playerTurn")
private final int playerTurn;
public PlayersDTO(Game game) {
this.gameStatus = game.getGameStatus().getValue();
this.playerTurn = game.getCurrentPlayerRound();
this.lastUpdate = new Date().getTime();
this.players = game.getPlayers();
}
final public Player[] getPlayers() {
return this.players;
}
final public int getPlayerTurn() {
return playerTurn;
}
final public long getLastUpdate() {
return lastUpdate;
}
final public String getGameStatus() {
return gameStatus;
}
}
|
4731dc41-8a7c-4dcc-85e2-2ede8d7f1e32 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-28 14:06:29", "repo_name": "liyork/concurrenttest", "sub_path": "/src/main/java/com/wolf/concurrenttest/hcpta/activeobject/ActiveObjectTest.java", "file_name": "ActiveObjectTest.java", "file_ext": "java", "file_size_in_byte": 1071, "line_count": 35, "lang": "en", "doc_type": "code", "blob_id": "1fef1530fc1c51b6686abd26f368f8f916cb571e", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/liyork/concurrenttest | 231 | FILENAME: ActiveObjectTest.java | 0.264358 | package com.wolf.concurrenttest.hcpta.activeobject;
import com.wolf.concurrenttest.hcpta.activeobject.generic.ActiveServiceFactory;
import com.wolf.concurrenttest.hcpta.future.Future;
/**
* Description:
* Created on 2021/9/26 10:15 PM
*
* @author 李超
* @version 0.0.1
*/
public class ActiveObjectTest {
public static void main(String[] args) throws InterruptedException {
//test();
testGeneric();
}
private static void testGeneric() throws InterruptedException {
OrderService orderService = ActiveServiceFactory.active(new OrderServiceImpl());
Future<String> future = orderService.findOrderDetails(22222);
System.out.println("i will be return immediately");
System.out.println(future.get());
}
private static void test() throws InterruptedException {
OrderService orderService = OrderServiceFactory.toActiveObject(new OrderServiceImpl());
orderService.order("hello", 44444);
System.out.println("return immediately");
Thread.currentThread().join();
}
}
|
439959dc-28d9-4fbe-87b5-c97920364f02 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-05-24 08:02:49", "repo_name": "sdl2256/JavaWeb", "sub_path": "/CXFTest/src/main/java/com/sundl/entity/Province.java", "file_name": "Province.java", "file_ext": "java", "file_size_in_byte": 972, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "4673ed539caf9a282297177f95add211474050f1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/sdl2256/JavaWeb | 216 | FILENAME: Province.java | 0.216012 | package com.sundl.entity;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* Created by SDL on 2015/5/29.
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder = { "name", "provCity" })
public class Province {
@XmlElement(name = "province_name")
private String name;
@XmlElement(name = "prov_city")
private String provCity;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getProvCity() {
return provCity;
}
public void setProvCity(String provCity) {
this.provCity = provCity;
}
@Override
public String toString() {
return "Province{" +
"name='" + name + '\'' +
", provCity='" + provCity + '\'' +
'}';
}
}
|
3c2412a0-1bad-4239-911c-62e9713afc68 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-03-18T11:36:44", "repo_name": "UedaTakeyuki/koshinto-doc", "sub_path": "/docs/users-manual/binds/status.md", "file_name": "status.md", "file_ext": "md", "file_size_in_byte": 974, "line_count": 30, "lang": "en", "doc_type": "text", "blob_id": "199f312e3e373440dc0fd28f184ecc9b60f2fc13", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/UedaTakeyuki/koshinto-doc | 254 | FILENAME: status.md | 0.272025 | ---
sidebarDepth: 2
posted: 2020-10-07
---
## status of bind
### 1. Not active
The bind is not active. All requests from sansi is rejected.
The result of calling **confirm()** is **false**.
### 2. Bind Waiting
The bind is waiting for the request. All requests from sansi is handled as **bind** request, that is, reported unique ids are registerd on the bind and status goes to **Bind Requsting**.
The result of calling **confirm()** is **false**.
### 3. Auto Bind Waiting
### 4. Bind Requesting
The sansi is requesting but not accepted. The status goes to **Binding** after acceptance by user.
The result of calling **confirm()** is **false**.
### 5. Binding
The bind is binding to the specific unique ids. All request from sansi is handled as confirmation request, that is, The result of calling **confirm()** is depend the result of confirmation.
The result of calling **confirm()** is **true** if match, or **false**
### 6. Invalidated
The bind is invalidated. |
9c2aeb6a-2e6e-4940-a67a-bb3e4f03f977 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-21 14:34:39", "repo_name": "cafpereira/dropwizard-example", "sub_path": "/src/main/java/com/acme/core/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 977, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "9833ff27b81b214d7281e347664c1f5c0635abc8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/cafpereira/dropwizard-example | 208 | FILENAME: User.java | 0.236516 | package com.acme.core;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.validation.constraints.NotNull;
import java.util.Objects;
public class User {
@NotNull
@JsonProperty
private Integer id;
@NotNull
@JsonProperty
private String name;
public User() {
// Jackson deserialization
}
public User(int id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return id;
}
public String getName() {
return name;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof User)) {
return false;
}
final User that = (User) o;
return Objects.equals(this.id, that.id) &&
Objects.equals(this.name, that.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
}
|
acac1f8b-8303-4267-b64c-9fae72003134 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-10-09 18:41:12", "repo_name": "Ferdows-dev/UserRegistrationFireBase", "sub_path": "/app/src/main/java/com/learning/userregistration/ProductAdapter.java", "file_name": "ProductAdapter.java", "file_ext": "java", "file_size_in_byte": 1194, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "45552457dcdd7eb423b9a1a057d8202a62e76a68", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Ferdows-dev/UserRegistrationFireBase | 196 | FILENAME: ProductAdapter.java | 0.290176 | package com.learning.userregistration;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.ArrayList;
class ProductAdapter extends ArrayAdapter {
private Context context;
private ArrayList<Product>productArrayList;
public ProductAdapter(@NonNull Context context, ArrayList<Product>productArrayList) {
super(context, R.layout.single_item_row,productArrayList);
this.context = context;
this.productArrayList = productArrayList;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(context);
convertView = inflater.inflate(R.layout.single_item_row,parent,false);
TextView productName = convertView.findViewById(R.id.productList);
productName.setText(productArrayList.get(position).getProductName());
return convertView;
}
}
|
313a4557-dc87-4d1d-861b-61ee42b109ce | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-02-07 04:19:11", "repo_name": "malqch/aibus", "sub_path": "/java_project/officer-modules/aibus-officer-interface/src/main/java/com/wntime/modules/officer/entity/SchoolEntity.java", "file_name": "SchoolEntity.java", "file_ext": "java", "file_size_in_byte": 1137, "line_count": 66, "lang": "en", "doc_type": "code", "blob_id": "5361f4ee0cdab288f9413f7bdd45a7bf025f2e2b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/malqch/aibus | 290 | FILENAME: SchoolEntity.java | 0.23092 | package com.wntime.modules.officer.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @desc 学校信息
*
* @author raute
* @email admin@wntime.com
* @date 2021-01-16 14:43:43
*/
@Data
@TableName("info_school")
public class SchoolEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* @desc 主键
*/
@TableId
private Long id;
/**
* @desc 学校名称
*/
private String schoolName;
/**
* $column.comments
*/
private Long educationBureauId;
/**
* @desc 备注
*/
private String remark;
/**
* @desc 创建人
*/
private Long createUserId;
/**
* @desc 创建时间
*/
private Date createDt;
/**
* @desc 更新人
*/
private Long modifyUserId;
/**
* @desc 更新时间
*/
private Date modifyDt;
private String isDeleted;
@TableField(exist = false)
private String createUserName;
@TableField(exist = false)
private String modifiedUserName;
}
|
81167015-e87f-4194-839c-091d1b7dc95b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-05-06 05:39:44", "repo_name": "rajansurani/COVID19_Tracker", "sub_path": "/app/src/main/java/com/rajansurani/covid19tracker/Model/Data.java", "file_name": "Data.java", "file_ext": "java", "file_size_in_byte": 1037, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "21396038ab850b0c8254c2def35199db9d7a1913", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rajansurani/COVID19_Tracker | 247 | FILENAME: Data.java | 0.236516 | package com.rajansurani.covid19tracker.Model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class Data {
@SerializedName ("cases_time_series")
@Expose
private List<CasesTimeSeries> mCasesTimeSeriesList;
@SerializedName ("statewise")
@Expose
private List<StateData> mStateData;
@SerializedName ("tested")
@Expose
private List<Tested> mTested;
public List<CasesTimeSeries> getCasesTimeSeriesList() {
return mCasesTimeSeriesList;
}
public void setCasesTimeSeriesList(List<CasesTimeSeries> casesTimeSeriesList) {
mCasesTimeSeriesList = casesTimeSeriesList;
}
public List<StateData> getStateData() {
return mStateData;
}
public void setStateData(List<StateData> stateData) {
mStateData = stateData;
}
public List<Tested> getTested() {
return mTested;
}
public void setTested(List<Tested> tested) {
mTested = tested;
}
}
|
3e2be1dc-ac4d-4074-b0ce-25791b0a4b34 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-03-26 14:35:34", "repo_name": "Allan-Contaret/Restory", "sub_path": "/app/src/main/java/com/example/allancontaret/restory/FavoritesActivity.java", "file_name": "FavoritesActivity.java", "file_ext": "java", "file_size_in_byte": 1194, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "9ab74f934ad0894361232deccc24f49055c4d602", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/Allan-Contaret/Restory | 211 | FILENAME: FavoritesActivity.java | 0.255344 | package com.example.allancontaret.restory;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class FavoritesActivity extends AppCompatActivity {
ListView mListView;
SharedPreferences settings;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_favorites);
setTitle(R.string.favorites_title);
mListView = (ListView) findViewById(R.id.listFavorite);
settings = getSharedPreferences("MyPrefsFile", 0);
Map<String, ?> allEntries = settings.getAll();
List<String> values = new ArrayList<String>();
for(Map.Entry<String,?> entry : allEntries.entrySet()){
values.add(entry.getValue().toString());
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, values);
mListView.setAdapter(adapter);
}
}
|
87d1730b-5a84-47dd-aa91-da82efcd4550 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-06-05 23:06:43", "repo_name": "WeronikaLorenczyk/ceneo-ID", "sub_path": "/src/controllers/SearchResult.java", "file_name": "SearchResult.java", "file_ext": "java", "file_size_in_byte": 977, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "35750874ade02a5225b58761b8073e83558ceb54", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/WeronikaLorenczyk/ceneo-ID | 186 | FILENAME: SearchResult.java | 0.253861 | package controllers;
import javafx.scene.control.Button;
import javafx.scene.text.Text;
public class SearchResult {
public Text name,attribute,rating;
public Button compareP;
SearchResult(Text name,Text attribute, Text rating, Button compareP){
this.name=name;
name.setText("");
this.attribute=attribute;
attribute.setText("");
this.rating=rating;
rating.setText("");
this.compareP=compareP;
compareP.setVisible(false);
compareP.setManaged(false);
}
public void set(String n, String a, float r, float p){
compareP.setManaged(true);
compareP.setVisible(true);
name.setText(n);
attribute.setText(a);
rating.setText("rating: "+Float.toString(r));
}
public void clear(){
name.setText("");
attribute.setText("");
rating.setText("");
compareP.setManaged(false);
compareP.setVisible(false);
}
}
|
1ffeb5ce-d366-4364-a77b-435a5b2256f2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-25 12:30:44", "repo_name": "dmytro-boiko-dev/javaee", "sub_path": "/fwqa/common/src/main/java/com/cumulus/EntryPoint.java", "file_name": "EntryPoint.java", "file_ext": "java", "file_size_in_byte": 975, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "c526cd454c25a51034b4b8806e1366b9955f4365", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/dmytro-boiko-dev/javaee | 157 | FILENAME: EntryPoint.java | 0.235108 | package com.cumulus;
import com.cumulus.config.DataAccessConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.Configuration;
import java.util.Properties;
@Configuration
//@EnableAutoConfiguration
//@ComponentScan
//@Import({DataAcessConfigInspections.class})
@SpringBootApplication
public class EntryPoint {
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(EntryPoint.class).properties(getProperties());
}
private static Properties getProperties() {
Properties pro = new Properties();
pro.put("cumulus.spring.config.location", "classpath:cumulus/");
return pro;
}
public static void main(String[] args) {
SpringApplication.run(EntryPoint.class, args);
}
}
|
4efceee4-faf0-4872-ab8a-fe09731d4990 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-07-19 04:41:03", "repo_name": "parkjg20/DeliveryTalk", "sub_path": "/app/src/main/java/com/dataflow/deliverytalk/Models/Person.java", "file_name": "Person.java", "file_ext": "java", "file_size_in_byte": 1194, "line_count": 62, "lang": "en", "doc_type": "code", "blob_id": "16da0102bdc1839855051b1bcdd1a7328d1c8451", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/parkjg20/DeliveryTalk | 243 | FILENAME: Person.java | 0.249447 | package com.dataflow.deliverytalk.Models;
import android.os.Parcel;
import android.os.Parcelable;
public class Person implements Parcelable {
String name;
String time;
public Person(){}
public Person(String name, String time) {
this.name = name;
this.time = time;
}
protected Person(Parcel in){
name = in.readString();
time = in.readString();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeString(name);
out.writeString(time);
}
public static final Creator<Person> CREATOR = new Creator<Person>() {
@Override
public Person createFromParcel(Parcel in) {
return new Person(in);
}
@Override
public Person[] newArray(int size) {
return new Person[size];
}
};
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
}
|
4c786866-4340-4fe2-bbe3-09a0ed9db276 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-22 16:28:45", "repo_name": "dominikk19/bank-microservices-cqrs-events-sourcing", "sub_path": "/user-microservice/user-query-api/src/main/java/pl/dkiszka/bank/handlers/UserEventHandlerImpl.java", "file_name": "UserEventHandlerImpl.java", "file_ext": "java", "file_size_in_byte": 1595, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "1e81b136b9c8ca3c97d2089c39462443691bc80b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/dominikk19/bank-microservices-cqrs-events-sourcing | 225 | FILENAME: UserEventHandlerImpl.java | 0.255344 | package pl.dkiszka.bank.handlers;
import lombok.RequiredArgsConstructor;
import org.axonframework.config.ProcessingGroup;
import org.axonframework.eventhandling.EventHandler;
import org.springframework.stereotype.Component;
import pl.dkiszka.bank.events.UserRegisteredEvent;
import pl.dkiszka.bank.events.UserRemovedEvent;
import pl.dkiszka.bank.events.UserUpdatedEvent;
import pl.dkiszka.bank.repositories.UserRepository;
/**
* @author Dominik Kiszka {dominikk19}
* @project bank-application
* @date 21.04.2021
*/
@RequiredArgsConstructor
@Component
@ProcessingGroup("user-group")
class UserEventHandlerImpl implements UserEventHandler {
private final UserRepository userRepository;
@EventHandler
@Override
public void consume(UserRegisteredEvent event) {
userRepository.save(event.getUser());
}
@EventHandler
@Override
public void consume(UserUpdatedEvent event) {
userRepository.save(event.getUser());
}
@EventHandler
@Override
public void consume(UserRemovedEvent event) {
userRepository.deleteById(event.getId());
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.