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 |
|---|---|---|---|---|---|---|
4cc32ad9-9e00-424c-af5e-cf91f53172a4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-14 09:24:02", "repo_name": "Mr-Coding/MyClock-Kotlin", "sub_path": "/app/src/main/java/com/frank/myclock/view/MyRelativeLayout.java", "file_name": "MyRelativeLayout.java", "file_ext": "java", "file_size_in_byte": 1183, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "62c4ef6aa466f3b02425b6a6dda84f08ed73959a", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Mr-Coding/MyClock-Kotlin | 219 | FILENAME: MyRelativeLayout.java | 0.286169 | package com.frank.myclock.view;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.RelativeLayout;
public class MyRelativeLayout extends RelativeLayout {
private OnUnlockListener listener;
private float yStart,yEnd;
public MyRelativeLayout(Context context) {
super(context);
}
public MyRelativeLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
Log.i("LockActivity","onTouchEvent");
switch (event.getAction()){
case MotionEvent.ACTION_DOWN:
yStart = event.getRawY();
break;
case MotionEvent.ACTION_UP:
yEnd = event.getRawY();
if (yStart > yEnd+400){
listener.OnUnlock();
}
break;
}
return true;
}
public void setOnUnlockListener(OnUnlockListener listener){
this.listener = listener;
}
public interface OnUnlockListener{
public void OnUnlock();
}
}
|
d15c0608-e714-47c0-a224-ff9fc6abd643 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-25 17:25:10", "repo_name": "Clomez/HTML_Mail_sending_system", "sub_path": "/src/main/java/com/clomez/invalane/services/OptionServiceImpl.java", "file_name": "OptionServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1100, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "8a63a93de2af94495406711659cb994077a59313", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Clomez/HTML_Mail_sending_system | 205 | FILENAME: OptionServiceImpl.java | 0.249447 | package com.clomez.invalane.services;
import com.clomez.invalane.beans.Options;
import com.clomez.invalane.repositories.OptionsRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class OptionServiceImpl implements OptionService {
@Autowired
private OptionsRepository repository;
@Override
public void save(Options options){
System.out.println(options.toString());
Options optionsHolder = options;
optionsHolder.setNameo("test");
optionsHolder.setId(0L);
optionsHolder.setLocalhost(options.getLocalhost());
System.out.println(optionsHolder.toString());
repository.save(options);
}
@Override
public List<Options> getOptions() {
List<Options> optionsList = (List<Options>) repository.findAll();
return optionsList;
}
@Override
public Options getOption(Long id) {
Options options = new Options();
repository.findOne(id);
return options;
}
}
|
21ec6810-fd7d-4d04-a336-809703749e52 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-19 13:06:27", "repo_name": "nikasamadalashvili/TechStore", "sub_path": "/src/main/java/web/app/TechStore/TechStore/Services/models/FilteredMobileListResponse.java", "file_name": "FilteredMobileListResponse.java", "file_ext": "java", "file_size_in_byte": 1134, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "e0bd6628d2ed52f7469f3e13d3126a6d73774d3b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/nikasamadalashvili/TechStore | 208 | FILENAME: FilteredMobileListResponse.java | 0.261331 | package web.app.TechStore.TechStore.Services.models;
import java.util.List;
public class FilteredMobileListResponse {
private List<ProductDto> filteredProducts;
public FilteredMobileListResponse(List<ProductDto> filteredProducts) {
this.filteredProducts = filteredProducts;
}
public List<ProductDto> getFilteredProducts() {
return filteredProducts;
}
//missing price and photo
public static class ProductDto {
private long productId;
private String name;
private Double price;
private String imageName;
public ProductDto(long productId, String name, Double price, String imageName) {
this.productId = productId;
this.name = name;
this.price = price;
this.imageName = imageName;
}
public long getProductId() {
return productId;
}
public String getName() {
return name;
}
public Double getPrice() {
return price;
}
public String getImageName() {
return imageName;
}
}
}
|
e4b502d2-d0bc-4d8a-9dae-7b48c9aa52d5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-06-01 15:26:53", "repo_name": "andianderson522/fatcatsolutions_utils", "sub_path": "/src/main/java/org/fatcatsolutions/utils/strings/StringUtils.java", "file_name": "StringUtils.java", "file_ext": "java", "file_size_in_byte": 1219, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "76a9fd24290ad6ca49e1e8c5a2d73ae60c381183", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/andianderson522/fatcatsolutions_utils | 268 | FILENAME: StringUtils.java | 0.292595 | package org.fatcatsolutions.utils.strings;
public final class StringUtils {
public static final String EMPTY_STRING = "";
public static final CharSequence EMPTY_CHARSEQUENCE = EMPTY_STRING;
private StringUtils() {
// hide utility class
}
/**
* @param toTest
* {@link CharSequence} to default if is blank
* @return {@link StringUtils#EMPTY_STRING} if CharSequence is null, blank or only contains spaces
*/
public static String defaultToEmptyIfBlank(final CharSequence toTest) {
if (isBlank(toTest)) {
return EMPTY_STRING;
}
return toTest.toString();
}
/**
* @param toCheck
* {@link CharSequence} to check
* @return boolean whether or not the given CharSequence is null, blank or only contains spaces
*/
public static boolean isBlank(final CharSequence toCheck) {
return org.apache.commons.lang3.StringUtils.isBlank(toCheck);
}
/**
* @param toCheck
* {@link CharSequence} to check
* @return boolean Returns true if the CharSequence to check is not null and contains text other then white space
*/
public static boolean isNotBlank(final CharSequence toCheck) {
return org.apache.commons.lang3.StringUtils.isNotBlank(toCheck);
}
}
|
e0ba9c13-d6d0-452e-8815-b59f3e2abb88 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-10 12:53:25", "repo_name": "gcliupeng/kafka-proxy", "sub_path": "/src/main/java/org/kafka_proxy/config/GlobalConfig.java", "file_name": "GlobalConfig.java", "file_ext": "java", "file_size_in_byte": 1096, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "5f64bc09fe280c51e687b6497e7298a85661a050", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gcliupeng/kafka-proxy | 225 | FILENAME: GlobalConfig.java | 0.274351 | package org.kafka_proxy.config;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;
import org.apache.log4j.Logger;
public class GlobalConfig {
public static Integer thread_num = null;
public static Integer listen_port = null;
public static String kafka_server = null;
public static String token = null;
private static final Logger log = Logger.getLogger(GlobalConfig.class);
public static void loadConfig(String args){
String path = System.getProperty("user.dir") + "/src/main/resources/"
+ args + "/message_bus.properties";
Properties prop = new Properties();
InputStream in;
try {
in = new BufferedInputStream(new FileInputStream(path));
prop.load(in);
thread_num = Integer.valueOf(prop.getProperty("messagebus.thread_num"));
listen_port = Integer.valueOf(prop.getProperty("messagebus.listen_port"));
token = prop.getProperty("messagebus.token");
kafka_server = prop.getProperty("kafka.server");
} catch (Exception e) {
log.warn(e.getMessage());
}
}
}
|
f372419c-4405-4135-be6d-d683f51ba5f1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2018-07-19T13:31:21", "repo_name": "mor1/mor1.github.io", "sub_path": "/_posts/2016-09-13-grubbing-around.md", "file_name": "2016-09-13-grubbing-around.md", "file_ext": "md", "file_size_in_byte": 1158, "line_count": 37, "lang": "en", "doc_type": "text", "blob_id": "6dd50155f0932f60210f298e2e3888c114429701", "star_events_count": 2, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/mor1/mor1.github.io | 313 | FILENAME: 2016-09-13-grubbing-around.md | 0.261331 | ---
title: Grubbing Around
subtitle: Some commands I found useful
layout: post
category: blog
---
Nothing earth-shattering here: I recently had the "pleasure" of setting up an
ARM64 server. After considerable support, several firmware upgrades, corruption
of the main HDD, reinstallation of CentOS7 (recommended, somewhat to my
surprise), all that remained was to get an up-to-date Linux built and installed
with 32 bit binary support. This took a bit of `make config` fiddling, but got
there after a few tries.
And then I had to relearn how `grub`/`grub2` works in this brave new (to me)
UEFI CentOS7 world. Herewith some brief commands I found useful while doing
so...
{% highlight bash %}
sudo grep "^menu entry" /boot/efi/EFI/centos/grub.cfg \
| tr -s " " | cut -f 2 -d "'" | cat -n
{% endhighlight %}
Edit `/etc/default/grub` to set `GRUB_DEFAULT=N` for desired value of `N`
Temporarily set the default for the next reboot:
{% highlight bash %}
sudo grub2-reboot 1 # based on output of above
{% endhighlight %}
Regenerate the grub2 configuration:
{% highlight bash %}
sudo grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
{% endhighlight %}
|
6fb53b66-b04c-4ea2-8482-2998029ccfcc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-09-14T06:18:38", "repo_name": "AIESydProgYr12021/aie_cpd-karmalmao", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1183, "line_count": 39, "lang": "en", "doc_type": "text", "blob_id": "9a0e8ad9ddb54aa816fa6a6b5a281d7c963178f6", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/AIESydProgYr12021/aie_cpd-karmalmao | 279 | FILENAME: README.md | 0.243642 | # PROJECT NAME
## About the Game
endless runner
### Contributors:
Contributors to the project are strictly limeted to AIE Students as part of their group work project.
Members (example):
Programmer: Jack Norrie
## Build Steps:
The project can currently be built for both windows and webgl in the following ways:
* **Manual:** Via the Unity Engine Build Settings.
* Open the project in untiy
* Select `File->BuildSettings`
* Switch to the desired build platform (windows or webgl)
* Select `Build`
* You will be prompted to select an output directory
* Once the build has finished open your chosed folder to find your build
* **Automated**: `build_all.bat` will run build and `pc` and `webgl` version of the project
* Double click on `build_all.bat`
* The process will take some time, leave the console window open
* The following files will be produced:
* PC Build: `builds/pc/YourGame.exe`
* WebGL Build: `builds/web/index.html`
## Daily Builds:
Daily builds of the project should be placed on the local campus network drive
# Credits:
Are there assets, sounds or media included within the project that require attributation? list them here:
|
4b6e95f6-6269-4495-a581-b3d20b243f9b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-03 21:08:37", "repo_name": "Bezneima/testApp", "sub_path": "/app/src/main/java/com/example/testovoe4/dataclasses/RealtimeCurrencyExchangeRate.java", "file_name": "RealtimeCurrencyExchangeRate.java", "file_ext": "java", "file_size_in_byte": 1219, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "2844146ad12d11258534d7d1eaae5d7e2c9de50d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Bezneima/testApp | 237 | FILENAME: RealtimeCurrencyExchangeRate.java | 0.256832 | package com.example.testovoe4.dataclasses;
import com.fasterxml.jackson.annotation.*;
import java.util.HashMap;
import java.util.Map;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"Realtime Currency Exchange Rate"
})
public class RealtimeCurrencyExchangeRate {
@JsonProperty("Realtime Currency Exchange Rate")
private RealtimeCurrencyExchangeRate_ realtimeCurrencyExchangeRate;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
@JsonProperty("Realtime Currency Exchange Rate")
public RealtimeCurrencyExchangeRate_ getRealtimeCurrencyExchangeRate() {
return realtimeCurrencyExchangeRate;
}
@JsonProperty("Realtime Currency Exchange Rate")
public void setRealtimeCurrencyExchangeRate(RealtimeCurrencyExchangeRate_ realtimeCurrencyExchangeRate) {
this.realtimeCurrencyExchangeRate = realtimeCurrencyExchangeRate;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
|
9ad7928b-f1aa-4362-b42d-9f8fb88231e4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-07-20 16:40:50", "repo_name": "opendistro-for-elasticsearch/anomaly-detection", "sub_path": "/src/main/java/com/amazon/opendistroforelasticsearch/ad/caching/CacheProvider.java", "file_name": "CacheProvider.java", "file_ext": "java", "file_size_in_byte": 562, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "82da4e2377e92d4bf6fee1e946b1fe3b779781ef", "star_events_count": 89, "fork_events_count": 44, "src_encoding": "UTF-8"} | https://github.com/opendistro-for-elasticsearch/anomaly-detection | 248 | FILENAME: CacheProvider.java | 0.290176 | /*
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazon.opendistroforelasticsearch.ad.caching;
import org.elasticsearch.common.inject.Provider;
/**
* A wrapper to call concrete implementation of caching. Used in transport
* action. Don't use interface because transport action handler constructor
* requires a concrete class as input.
*
*/
public class CacheProvider implements Provider<EntityCache> {
private EntityCache cache;
public CacheProvider(EntityCache cache) {
this.cache = cache;
}
@Override
public EntityCache get() {
return cache;
}
}
|
b0dc271c-256a-4783-ab16-a6001b0a253e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2023-08-02T22:54:16", "repo_name": "apache/couchdb-fauxton", "sub_path": "/assets/iconfontgenerator/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1135, "line_count": 22, "lang": "en", "doc_type": "text", "blob_id": "78e2f3cb12c54a9b61bc6e87f9eca6ee1ab248f7", "star_events_count": 356, "fork_events_count": 270, "src_encoding": "UTF-8"} | https://github.com/apache/couchdb-fauxton | 298 | FILENAME: README.md | 0.249447 | ### How to regenerate Fauxton's icon fonts
The steps below describe how to use [svgtofont](https://github.com/jaywcjlove/svgtofont) to generate a new set of
CSS and font files based on an input set of SVG icons.
**IMPORTANT**: The source SVG files can not contain any comments or metatags (e.g. `<?xml ...?>` , `<!-- -->` or `<!DOCTYPE ... >`) otherwise the `svgtofont` tool will fail.
1. Add, remove or replace SVG icons in the [assets/icons](assets/icons) folder.
2. Run `npm install svgtofont --no-save` to install the tool.
3. Then run
```
cd assets/iconfontgenerator
node createfonts.js <fauxtonicon[INTEGER]>
```
Specifiying `fauxtonicon[INTEGER]` will update the value of `fauxtonFontname` in `assets/iconfontgenerator/createfonts.js` which is the name of the new font files. This is needed because the font files are bundled as-is by Webpack, so in order to burst the browser's cache, you need to specify a different name. Take note of the current value and increment by 1 for consistency (e.g., `fauxtonicon5` --> `fauxtonicon6`)
The new CSS and font files are generated and copied to the appropriate Fauxton folders.
|
bd7a43cf-380f-40a6-b719-7aebb95768fc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-30 13:36:02", "repo_name": "isxiongyu/concurrency-basis", "sub_path": "/src/main/java/cn/xiongyu/juc/CyclicBarrierTest.java", "file_name": "CyclicBarrierTest.java", "file_ext": "java", "file_size_in_byte": 1060, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "e32e2bc709617d043db9077679a4225e0d8e86d3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/isxiongyu/concurrency-basis | 231 | FILENAME: CyclicBarrierTest.java | 0.276691 | package cn.xiongyu.juc;
import java.util.concurrent.*;
/**
* ClassName: CyclicBarrierTest
* Package: cn.xiongyu.juc
* Description:
* Date: 19-8-9 下午9:14
* Author: xiongyu
*/
public class CyclicBarrierTest {
private static CyclicBarrier cyclicBarrier = new CyclicBarrier(5);
public static void main(String[] args) throws InterruptedException {
ExecutorService executorService = Executors.newCachedThreadPool();
for (int i = 0; i < 20; i++) {
Thread.sleep(1000);
executorService.execute(() -> {
add();
});
}
executorService.shutdown();
}
private static void add(){
System.out.println(Thread.currentThread().getId() + "thread is ready");
try {
cyclicBarrier.await();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getId() + "thread is continue");
}
}
|
f9b2edb5-226d-487f-b6d9-032336bf4c7a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-30 17:32:52", "repo_name": "kihabit/MUB", "sub_path": "/app/src/main/java/com/prayosof/yvideo/view/browser/fragments/ContentFragment.java", "file_name": "ContentFragment.java", "file_ext": "java", "file_size_in_byte": 1088, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "1a1b0ce93b17cae657cb0158f96af7250e73226a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kihabit/MUB | 194 | FILENAME: ContentFragment.java | 0.204342 | package com.prayosof.yvideo.view.browser.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import com.prayosof.yvideo.R;
import com.prayosof.yvideo.databinding.FragmentContentBinding;
/**
* A simple {@link Fragment} subclass.
*/
public class ContentFragment extends Fragment {
public ContentFragment() {
// Required empty public constructor
}
private FragmentContentBinding binding;
public static String url = "";
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
binding = DataBindingUtil.inflate(inflater, R.layout.fragment_content, container, false);
url = getArguments().getString("url");
getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.frame, new HomeFragment()).commit();
return binding.getRoot();
}
}
|
33e61fe6-e1c7-4b8e-bb64-da8b07ce2a3c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-10-06T14:52:19", "repo_name": "jnplonte/nine-gag", "sub_path": "/9gag-site/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1099, "line_count": 33, "lang": "en", "doc_type": "text", "blob_id": "1cecd46b5d16f8de416ad9035b2acc6055a6aa26", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jnplonte/nine-gag | 289 | FILENAME: README.md | 0.275909 | # SITE APPLICATION
## Dependencies
* nodejs: [https://nodejs.org/](https://nodejs.org/en/)
* angular4: [https://angular.io/](https://angular.io/)
* webpack: [https://webpack.github.io/](https://webpack.github.io/)
* lodash: [https://lodash.com/](https://lodash.com/)
* sass: [http://sass-lang.com/](http://sass-lang.com/)
* typescript: [https://www.typescriptlang.org/](https://www.typescriptlang.org/)
* karma: [https://karma-runner.github.io](https://karma-runner.github.io/1.0/index.html)
* tslint: [https://palantir.github.io/tslint](https://palantir.github.io/tslint/)
## Installation
- install typescript globally `npm install -g typescript`
- install npm dependencies by running `npm install`
- install karma-cli globally `npm install -g karma-cli`
- update the following configurations and database credentials on `{root}/config/site/nineGag-config.json`
## How to Use
- run `npm start` it will listen to default http://localhost:8181
## Testing
- run `npm test`
- run `tslint --type-check --project tsconfig.json --config tslint.json`
## Building Production
- run `npm run build`
|
db209a17-d428-4ac8-aee2-74a25fa6104e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-07-02 08:33:44", "repo_name": "vevake/Service_Design", "sub_path": "/HealthProfileClient/src/ehealth/ws/DeleteUserResponse.java", "file_name": "DeleteUserResponse.java", "file_ext": "java", "file_size_in_byte": 1184, "line_count": 53, "lang": "en", "doc_type": "code", "blob_id": "5d03a5ea10a59b77955135cf692de1d270cc11a5", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/vevake/Service_Design | 282 | FILENAME: DeleteUserResponse.java | 0.278257 |
package ehealth.ws;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for deleteUserResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="deleteUserResponse">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="deleteUser" type="{http://www.w3.org/2001/XMLSchema}int"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "deleteUserResponse", propOrder = {
"deleteUser"
})
public class DeleteUserResponse {
protected int deleteUser;
/**
* Gets the value of the deleteUser property.
*
*/
public int getDeleteUser() {
return deleteUser;
}
/**
* Sets the value of the deleteUser property.
*
*/
public void setDeleteUser(int value) {
this.deleteUser = value;
}
}
|
25c83c30-f5b2-4469-b902-48a333056878 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-09-17 08:52:57", "repo_name": "kazinarka/final_project", "sub_path": "/src/test/java/com/nix/cinema/ActorServiceTest.java", "file_name": "ActorServiceTest.java", "file_ext": "java", "file_size_in_byte": 1097, "line_count": 54, "lang": "en", "doc_type": "code", "blob_id": "63634a5362ae8e83bfe6b610106a359be9b1384d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kazinarka/final_project | 237 | FILENAME: ActorServiceTest.java | 0.281406 | package com.nix.cinema;
import com.nix.cinema.model.Actor;
import com.nix.cinema.repository.ActorRepository;
import com.nix.cinema.services.ActorService;
import com.nix.cinema.services.impl.ActorServiceImpl;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.*;
public class ActorServiceTest {
ActorService actorService;
ActorRepository actorRepository;
@BeforeEach
void setUp() {
actorRepository = mock(ActorRepository.class);
actorService = new ActorServiceImpl(actorRepository);
}
@Test
void addActorTest() {
}
@Test
void getAllActorsTest() {
List<Actor> actors = actorService.getAllActors();
assertEquals(0, actors.size());
verify(actorRepository).findAll();
verifyNoInteractions(actorRepository);
}
@Test
void getAllActorsPageTest() {
}
@Test
void getActorByIdTest() {
}
@Test
void deleteActorById() {
}
}
|
8c8f3708-9632-4cc7-98b5-29fddc3bfc01 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-09-12T15:29:40", "repo_name": "Traumjager/client", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1219, "line_count": 47, "lang": "en", "doc_type": "text", "blob_id": "6ec1189dd5117af8c05cb47cf4633b6fb9dfe780", "star_events_count": 2, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/Traumjager/client | 298 | FILENAME: README.md | 0.233706 | # I Saloon
## Developers
- Hatem Husnieh
- Ahmad Ammoura
- Ahmad Abu Osbeh
- Mohammed Al-Ramahi
---
## Description :
- A website/application that allows users to discover barbers within their areas in a professional way, this app will ease the contacting process and introducing services for the clients. As it will allow barbers to manage their work and reach their customers and subscribers.
---
## Install and operate.
1. copy front-end repos link and download it using `git clone <repo-link>`.
1. copy back-end repos link and download it using `git clone <repo-link>`.
1. download each repo dependencies by typing the following on you terminal `npm install`.
1. for back-end repo, copy the variables inside `.enc.sample` file inside a folder and call it `.env` and fill it with the following:
- SECRET: any combination of number and letters.
- PORT: any free port at you system.
- DATABASE_URL: postgreSQL url at your system.
1. start the back-end by `npm start` or `nodemon`.
1. start front-end by `npm start`
1. enjoy!
---
## Technologies
- React
- Redux
- Material UI components.
- CSS and SCSS
- PostgreSQL
- Json Web token (jwt)
- bcrypt
- Node.js
- Express
- base-64
- nodemailer
- multer
|
4bd16bf0-848f-49a0-ba4a-76bebc6ce3be | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-05-21 10:17:48", "repo_name": "mxdldev/android-touch-event", "sub_path": "/app/src/main/java/com/android/touchevent/view/MyButton.java", "file_name": "MyButton.java", "file_ext": "java", "file_size_in_byte": 1073, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "f60c0458b74bd42a9824b85ee6b96a9a95455978", "star_events_count": 3, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/mxdldev/android-touch-event | 238 | FILENAME: MyButton.java | 0.27048 | package com.android.touchevent.view;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.Button;
import com.android.touchevent.util.MotionEventUtil;
/**
* Description: <MyButton><br>
* Author: gxl<br>
* Date: 2019/5/10<br>
* Version: V1.0.0<br>
* Update: <br>
*/
@SuppressLint("AppCompatCustomView")
public class MyButton extends Button {
public static final String TAG = "MYTAG";
public MyButton(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
Log.v(TAG,"MyButton dispatchTouchEvent start:"+MotionEventUtil.getMotionEventName(ev));
return super.dispatchTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
Log.v(TAG,"MyButton onTouchEvent start:"+MotionEventUtil.getMotionEventName(event));
return super.onTouchEvent(event);
}
}
|
504259bf-57d7-44be-9f4a-1cb474608be4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2019-09-10T00:20:59", "repo_name": "hansCodeJam/what-i-learned-in-week-0", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1160, "line_count": 29, "lang": "en", "doc_type": "text", "blob_id": "92c0ce84ffb4f44a4a182d5ac5c5cac29eb6564c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hansCodeJam/what-i-learned-in-week-0 | 268 | FILENAME: README.md | 0.177811 | Things I've learnt on Week 0
Mac keyboard shortcuts
* Command Space -
* it brings up the the search field. This features allows you to look up anything on your mac, including applications(chrome, terminal), files, etc.
* workflow - control(change to caps lock)
* - control ^ and left or right key will switch between different open application
* how to change keyboard bindings
* Go to System prefrences>Keyboard> Click on Modifier Keys> Switch caps lock to ^ control and switch control to caps lock
Setting up things on vs code
* Downloading extension
* how to - click on the extension icon (four squares seperated by one) then search any extension
* extension installed
* Bracket Pair Colorizer
* Code Spell Checker
* Indent-rainbow
* Markdown all in one
* setting sync
* next time you set up a new computer your settings will be sync up through github
Terminal
* An application the allows you to control anything on your mac
* Bash-cheat-sheet https://github.com/hansCodeJam/bash-cheat-sheet
* cd, ls, pwd, mv, rm, mkdir, touch, cp
|
c3d1b77f-1b57-4b99-bbb6-e7c30bb797d5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-16 13:01:45", "repo_name": "a-makarov-alex/selenium-interview", "sub_path": "/src/test/java/GoogleTest.java", "file_name": "GoogleTest.java", "file_ext": "java", "file_size_in_byte": 1032, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "1220e6c31b24d78fee3ee3f9f64b12289981dccd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/a-makarov-alex/selenium-interview | 214 | FILENAME: GoogleTest.java | 0.236516 | import io.github.bonigarcia.wdm.WebDriverManager;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
public class GoogleTest {
private WebDriver driver;
private String baseUrl;
@Before
public void setup() {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
baseUrl = "https://google.com";
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
//System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");
}
@Test
public void openPage() {
driver.get(baseUrl);
GooglePage googlePage = new GooglePage(driver);
googlePage.typeSerachRequest("test line");
//driver.findElement(By.xpath("//input[@name='q']"));
}
@After
public void tearDown() {
driver.quit();
}
}
|
886fc1b8-0b97-48c3-aea3-bfcec47533ab | {"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/workerthread/WorkerThreadTest.java", "file_name": "WorkerThreadTest.java", "file_ext": "java", "file_size_in_byte": 1068, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "350f54a5760a6c6c2df3545ad971990655de7604", "star_events_count": 0, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/liyork/concurrenttest | 207 | FILENAME: WorkerThreadTest.java | 0.253861 | package com.wolf.concurrenttest.hcpta.workerthread;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;
/**
* Description:
* Created on 2021/9/26 6:32 PM
*
* @author 李超
* @version 0.0.1
*/
public class WorkerThreadTest {
public static void main(String[] args) {
ProductionChannel channel = new ProductionChannel(5);
AtomicInteger productNo = new AtomicInteger();
// 8人放,5人工作
IntStream.range(1, 8).forEach(i ->
new Thread(() -> {
while (true) {
channel.offerProduction(new Production(productNo.getAndIncrement()));
try {
TimeUnit.SECONDS.sleep(ThreadLocalRandom.current().nextInt(10));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start());
}
}
|
c0b8a283-c06f-4b4b-93c6-c860b396815a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-01-31 12:27:55", "repo_name": "iTreeC/DevelopmentDocument", "sub_path": "/Service/wjf/time_update/src/test/java/com/turing/activity/service/entity/test/TestEntity.java", "file_name": "TestEntity.java", "file_ext": "java", "file_size_in_byte": 1109, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "945256e446eaccdc1dbe2238e94fde51c897a4b0", "star_events_count": 4, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/iTreeC/DevelopmentDocument | 203 | FILENAME: TestEntity.java | 0.262842 | package com.turing.activity.service.entity.test;
import static org.junit.Assert.*;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
import org.junit.After;
import org.junit.Before;
public class TestEntity {
private SessionFactory sessionFactory;
private Session session;
private Transaction transaction;
@Before
public void init(){
Configuration configuration = new Configuration().configure();
ServiceRegistry serviceRegistry =
new ServiceRegistryBuilder().applySettings(configuration.getProperties())
.buildServiceRegistry();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
//打开session
session = sessionFactory.openSession();
//开启事物
transaction = session.beginTransaction();
}
@After
public void destroy(){
transaction.commit();
session.close();
sessionFactory.close();
}
@org.junit.Test
public void test() {
}
}
|
87766863-a73a-4375-84ff-843bdb94c7c2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2013-03-21T18:09:53", "repo_name": "danveloper/real-time-logging", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1135, "line_count": 22, "lang": "en", "doc_type": "text", "blob_id": "adfd1705ab5d5c69d2de2a273791932c94628e77", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/danveloper/real-time-logging | 273 | FILENAME: README.md | 0.247987 | Grails Real Time Logging Application
=================
***
This project is a Grails application that receives Log4j messages from a JMS channel and streams them to a web page view using Atmosphere and websockets. The full write up is available at [http://danveloper.github.com/grails-real-time-logging.html](http://danveloper.github.com/grails-real-time-logging.html).
Usage
===
***
The Grails app is contained inside of [log-server](https://github.com/danveloper/real-time-logging/log-server) directory. From there you can simply do **grails run-app** and it will fire up appropriately. Once the application is up and running, you can use the runnable [TestJMSRunner](https://github.com/danveloper/real-time-logging/blob/master/enhanced-log4j-jms-appender/src/test/java/com/danveloper/log4j/jms/TestJMSLogger.java) to test streaming log messages.
Remember, you need to be using a browser that supports websockets. I **only** tested this in Chrome.
License
===
***
As always, free for all. Do enjoy.
Contact
===
***
t([@danveloper](http://twitter.com/danveloper)) *** g([daniel.p.woods@gmail.com](mailto:daniel.p.woods@gmail.com))
|
6eed90e4-bc84-4efe-ae8c-fa8129978304 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-14 06:27:45", "repo_name": "Ccalary/Cai_android", "sub_path": "/app/src/main/java/com/bc/caibiao/utils/ProgressDialogUtils.java", "file_name": "ProgressDialogUtils.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "56fae97afded6dcd1b3e68e55b4a671f31ae93ab", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Ccalary/Cai_android | 256 | FILENAME: ProgressDialogUtils.java | 0.245085 | package com.bc.caibiao.utils;
import android.app.ProgressDialog;
import android.content.Context;
import android.text.TextUtils;
/**
* @author wangkai
* @create 16/9/8 上午10:48
* @Description :
*/
public class ProgressDialogUtils {
private String defaultMsg = "数据加载中...";
private ProgressDialog mDialog;
private boolean isCancelable = true;
private Context context;
public ProgressDialogUtils(Context context) {
this.context = context;
}
public ProgressDialogUtils(Context context, String tipMsg) {
this.context = context;
if (!TextUtils.isEmpty(tipMsg))
defaultMsg = tipMsg;
}
public ProgressDialogUtils(Context context, String tipMsg, boolean isCancelable) {
this.context = context;
this.isCancelable = isCancelable;
if (!TextUtils.isEmpty(tipMsg))
defaultMsg = tipMsg;
}
public void show() {
mDialog = new ProgressDialog(context);
mDialog.setMessage(defaultMsg);
mDialog.setCancelable(isCancelable);
mDialog.show();
}
public void dismiss() {
if (mDialog != null) {
mDialog.dismiss();
mDialog = null;
}
}
}
|
d1172619-3f84-450a-a9aa-3d2c1abbd768 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-05-12 04:40:50", "repo_name": "theguywhodoesthething/SD_Projects", "sub_path": "/workspace/Java2-Chapter03/labs/Order.java", "file_name": "Order.java", "file_ext": "java", "file_size_in_byte": 1073, "line_count": 58, "lang": "en", "doc_type": "code", "blob_id": "a63192d29fa50b61343dee3dd753d05a7d4b108c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/theguywhodoesthething/SD_Projects | 261 | FILENAME: Order.java | 0.26588 | package labs;
import java.io.DataOutputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Serializable;
public class Order implements Serializable{
private Integer customerID;
private String name;
public Order() {
super();
this.customerID = 696969;
this.name = "rando_name";
}
public Order(Integer customerID, String name) {
super();
this.customerID = customerID;
this.name = name;
}
public void writeText() {
try {
PrintWriter pw = new PrintWriter(new FileWriter("order.txt"));
pw.println("Customer ID: " + customerID + " Name: " + name);
pw.close();
} catch (IOException e) {
System.err.println(e);
e.printStackTrace();
}
}
public void writeBinary() {
try {
FileOutputStream fos = new FileOutputStream(fos);
DataOutputStream dos = new DataOutputStream("order.txt");
dos.writeUTF("\n" + name);
dos.close();
} catch (IOException e) {
System.err.println(e);
e.printStackTrace();
}
}
}
|
df96fd61-c3e7-463b-8a61-dea9ed47b1c5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-04 14:39:10", "repo_name": "ericthelemur/Hex-Wars", "sub_path": "/src/com/owen/game/battlemap/players/BattleArcher.java", "file_name": "BattleArcher.java", "file_ext": "java", "file_size_in_byte": 1036, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "3b23095f718d66d47023062e9529d3b4e834a25a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ericthelemur/Hex-Wars | 238 | FILENAME: BattleArcher.java | 0.282196 | package com.owen.game.battlemap.players;
import com.owen.game.Game;
import com.owen.game.battlemap.BattleMap;
import com.owen.game.map.Position;
import com.owen.game.sprites.CharacterGenerator;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
public class BattleArcher extends BattlePlayer {
public BattleArcher(Position mapPosition, BufferedImage sprite, BattleMap map, Game game) {
super(mapPosition, sprite, map, game);
Graphics g = this.sprite.getGraphics();
g.drawImage(CharacterGenerator.getWeapons().get(0), 0, 0, null);
g.dispose();
}
@Override
public void select() {
possibleMoves = getPossibilities(5);
possibleAttacks = getPossibleAttacks(mapPosition);
}
public ArrayList<Position> getPossibleAttacks(Position pos) {
ArrayList<Position> possible = new ArrayList<>();
for (int i = 0; i < 8; i++) {
possible.addAll(map.getHex(pos).getRing(i));
}
return possible;
}
}
|
a672837e-1fb6-4976-87e0-074c6ac79e06 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-27 15:00:38", "repo_name": "piotrneumann/Simple-CRUD-Spring-Boot-Angular-6", "sub_path": "/src/main/java/com/cube/cubeanimation/controller/PostController.java", "file_name": "PostController.java", "file_ext": "java", "file_size_in_byte": 1183, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "f9eba9d9ad5e30cf2ef34b92d13c548d738ed8d8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/piotrneumann/Simple-CRUD-Spring-Boot-Angular-6 | 248 | FILENAME: PostController.java | 0.271252 | package com.cube.cubeanimation.controller;
import com.cube.cubeanimation.model.dto.PostDto;
import com.cube.cubeanimation.services.PostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api")
public class PostController {
private final PostService postService;
@Autowired
public PostController(PostService postService) {
this.postService = postService;
}
@GetMapping("/posts")
public List<PostDto> getPosts() {
return postService.getPostsDto();
}
@GetMapping("/posts/{id}")
public PostDto getPost(@PathVariable long id) {
return postService.getPostDto(id);
}
@PostMapping("/posts")
public void addPost(@RequestBody PostDto postDto) {
postService.addPost(postDto);
}
@PutMapping("/posts")
public void editPost(@RequestBody PostDto postDto) {
System.out.println(postDto);
postService.editPost(postDto);
}
@DeleteMapping("/posts/{id}")
public void deletePost(@PathVariable long id) {
postService.deletePost(id);
}
}
|
3fecf2c5-362a-48f8-9493-09af88f1d34f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-17 11:55:50", "repo_name": "roy-as/hotel-cloud", "sub_path": "/hotel-cloud-api/src/main/java/com/hotel/cloud/common/vo/equip/DeviceVo.java", "file_name": "DeviceVo.java", "file_ext": "java", "file_size_in_byte": 1146, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "c6b6286796dd2e79318a2962a835e8143292ffd6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/roy-as/hotel-cloud | 239 | FILENAME: DeviceVo.java | 0.243642 | package com.hotel.cloud.common.vo.equip;
import com.hotel.cloud.modules.equipment.entity.DeviceEntity;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class DeviceVo {
/**
* 主键
*/
private Long id;
/**
* 名称
*/
@NotBlank(message = "名称不能为空")
private String name;
/**
* 文件id
*/
private Long ossId;
/**
* 图片url
*/
private String pictureUrl;
/**
* 价格
*/
@NotNull(message = "价格不能为空")
private BigDecimal price;
/**
* 描述
*/
private String remark;
/**
* 当前数量
*/
@NotNull(message = "数量不能为空")
private Integer amount;
private MultipartFile picture;
public DeviceEntity getEntity() {
DeviceEntity entity = new DeviceEntity();
BeanUtils.copyProperties(this, entity);
return entity;
}
}
|
c94d7c52-6554-4b70-9eca-f746e6ea252b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-10-04 01:12:11", "repo_name": "Frankyang88/cs344labfile", "sub_path": "/assign2/asgn2_group9/backpack.java", "file_name": "backpack.java", "file_ext": "java", "file_size_in_byte": 1107, "line_count": 60, "lang": "en", "doc_type": "code", "blob_id": "a1b2675e327e0898bf1cd2c54b0e6a1f68eb6cd8", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Frankyang88/cs344labfile | 269 | FILENAME: backpack.java | 0.258326 | public class backpack{
private int ownerid;
private String bname;
private int size;
private int money;
private ArrayList<String> consumable;
public backpack(int id,int name,int size,int money,ArrayList<String> consumable){
this.ownerid=id;
this.bname=name;
this.money=money;
this.size=size;
this.consumable=consumable;
}
public int getownerid(){
return this.ownerid;
}
public String getbackpackname(){
return this.bname;
}
public int getsize(){
return this.size;
}
public int getmoney(){
return this.money;
}
public ArrayList<String> getconsumable(){
return this.consumable;
}
public int setownerid(int id){
return this.ownerid=id;
}
public int setbackpacksize(int size){
return this.size=size;
}
public int setmoney(int money){
return this.money=money;
}
public String setbackpackname(String name){
return this.bname=name;
}
public ArrayList<String> setconsumable(ArrayList<String> consumable){
return this.consumbale=consumable;
}
public String toString() {
return this.ownerid+ " " + this.bname+ " " + this.size+ " "+this.money;
}
}
|
ae010ad2-8422-420a-ab3b-74ae7857d879 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-18 09:33:31", "repo_name": "JecyG/dreamweb", "sub_path": "/src/main/java/cc/landingzone/dreamweb/common/CommonConstants.java", "file_name": "CommonConstants.java", "file_ext": "java", "file_size_in_byte": 1231, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "98e952f85fe897632e8670b5e5e2bdf59e83072f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JecyG/dreamweb | 234 | FILENAME: CommonConstants.java | 0.243642 | package cc.landingzone.dreamweb.common;
import java.io.InputStream;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CommonConstants {
private static final Logger logger = LoggerFactory.getLogger(CommonConstants.class);
public static final String Aliyun_AccessKeyId;
public static final String Aliyun_AccessKeySecret;
public static final String Aliyun_REGION_HANGZHOU = "cn-hangzhou";
// 是否线上环境
public static final boolean ENV_ONLINE;
static {
Properties properties = loadProperties();
ENV_ONLINE = Boolean.parseBoolean(properties.getProperty("env_online"));
Aliyun_AccessKeyId = properties.getProperty("aliyun_accesskeyid");
Aliyun_AccessKeySecret = properties.getProperty("aliyun_accesskeysecret");
}
public static Properties loadProperties() {
Properties properties = new Properties();
try {
InputStream ins = CommonConstants.class.getResourceAsStream("/dreamweb.properties");
properties.load(ins);
ins.close();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return properties;
}
}
|
18d9c044-cffe-4fe0-a8be-b9c1c0d65751 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-07-28 14:53:19", "repo_name": "zidquocviet1/Toeic-Application", "sub_path": "/app/src/main/java/com/example/toeicapplication/adapters/LoginPagerAdapter.java", "file_name": "LoginPagerAdapter.java", "file_ext": "java", "file_size_in_byte": 1087, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "48fcdc6d96aec137a479d732cf836f37bdde4935", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/zidquocviet1/Toeic-Application | 197 | FILENAME: LoginPagerAdapter.java | 0.243642 | package com.example.toeicapplication.adapters;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import com.example.toeicapplication.view.fragment.LoginFragment;
import com.example.toeicapplication.view.fragment.SignUpFragment;
import org.jetbrains.annotations.NotNull;
public class LoginPagerAdapter extends FragmentStateAdapter {
private final int NUM_PAGES;
public LoginPagerAdapter(FragmentManager fm, Lifecycle lifecycle, int NUM_PAGES){
super(fm, lifecycle);
this.NUM_PAGES = NUM_PAGES;
}
@NonNull
@NotNull
@Override
public Fragment createFragment(int position) {
switch(position){
case 0:
return new LoginFragment();
case 1:
return new SignUpFragment();
default:
return null;
}
}
@Override
public int getItemCount() {
return NUM_PAGES;
}
}
|
51c0cd86-a557-459a-8fd7-3f094de9b884 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-03-27 08:37:54", "repo_name": "p0po/disk-mq", "sub_path": "/src/main/java/net/yongpo/TestDiskQueue.java", "file_name": "TestDiskQueue.java", "file_ext": "java", "file_size_in_byte": 1158, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "f1dd2f871a5bf35983c7d2bc5d800c6fe18f53b6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/p0po/disk-mq | 230 | FILENAME: TestDiskQueue.java | 0.259826 | package net.yongpo;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by p0po on 2019/3/18 0018.
*/
public class TestDiskQueue {
static ExecutorService e = Executors.newFixedThreadPool(1);
public static void main(String[] args) {
final DiskMq diskMq = new DiskMqImpl("/export/data/", "test");
e.submit(new Runnable() {
public void run() {
while (true) {
long start = System.nanoTime();
Object o = diskMq.peek();
long stop = System.nanoTime();
System.out.println("cost :" + (stop - start) + " ws");
try {
Thread.sleep(1);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
}
});
while (true) {
diskMq.add(System.getenv());
try {
Thread.sleep(10);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
}
}
|
9be8a59b-6e05-4e46-a583-4e4f1de20b86 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2013-07-03T09:38:29", "repo_name": "wontfix-org/bash-bundles-nscreen", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1080, "line_count": 22, "lang": "en", "doc_type": "text", "blob_id": "f6118868644a9bfb273423493f37a0d028f11ab6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wontfix-org/bash-bundles-nscreen | 248 | FILENAME: README.md | 0.228156 | # nscreen bash bundle
Provides easy access to named screens with autocompletion of running sessions, as well as optional screen configs on a per-name basis, with the main ~/.screenrc being merged with the topic config
# Usage
nscreen mysessionname
Opens a new screen session with the given name. As long as the session is alive, the same command will now attach to the session (detaching it from the previously attached terminal)
# Topic configs
If you create a file ~/.screen-<name>, upon creation of a named session of the same name, nscreen will concatenate your ~/.screenrc and ~/.screen-<name> file, store it as ~/.nscreen-<md5>, and start screen with this file as its config file.
This way, you may preconfigure a bunch of ssh sessions, like loadbalancer or database failover pairs, a bunch of slave databases of a common master etc.
zombie k
screen ssh databasenode1
screen ssh databasenode2
zombie k will make screen not close a window when the ssh session disconnects, and ask you to hit k to really close the window or CTRL-Space to reopen the ssh session.
|
f01b7180-dcb9-4291-af94-8e6de1f93885 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-29 12:28:06", "repo_name": "PrasannakumarPatil/PrasannakumarPatil-OOPsLabSolution", "sub_path": "/OppsLab1/src/com/gl/main/Driver.java", "file_name": "Driver.java", "file_ext": "java", "file_size_in_byte": 1094, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "d2acd346689be850ea37d1b779497dde31e28482", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/PrasannakumarPatil/PrasannakumarPatil-OOPsLabSolution | 221 | FILENAME: Driver.java | 0.236516 | package com.gl.main;
import com.gl.model.Employee;
import com.gl.services.CredentialService;
import java.util.Scanner;
public class Driver {
public static void main(String[] args) {
Employee e1 = new Employee("Prasannakumar", "patil");
int choice;
CredentialService credentialService = new CredentialService();
System.out.println("Please enter the department from the following");
System.out.println("1. Technical");
System.out.println("2. Admin");
System.out.println("3. Human Resource");
System.out.println("4. Legal");
Scanner scanner = new Scanner(System.in);
choice = scanner.nextInt();
switch (choice){
case 1: credentialService.showCredentials(e1,"tech"); break;
case 2: credentialService.showCredentials(e1,"admin"); break;
case 3: credentialService.showCredentials(e1,"hr"); break;
case 4: credentialService.showCredentials(e1,"legal"); break;
default:
System.out.println("Invalid host");
}
}
}
|
776a8422-4f88-440c-94e3-a37a86d1574a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-08-31 03:31:12", "repo_name": "ThangVu1903/lybrary", "sub_path": "/src/com/java/dao/BookManagement.java", "file_name": "BookManagement.java", "file_ext": "java", "file_size_in_byte": 1111, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "2f689a605e86a0d20fd404ff68b360ae73f47cb3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ThangVu1903/lybrary | 230 | FILENAME: BookManagement.java | 0.292595 | package com.java.dao;
import com.java.model.Book;
import java.util.ArrayList;
import java.util.List;
public class BookManagement {
private List<Book> bookList = new ArrayList<>();
public List<Book> getBookList() {
return bookList;
}
public void addBook(Book addBook){
for (Book book: bookList){
if (book.getID()==addBook.getID()){
System.out.println("Book already exists, please re-enter");
return;
}
}
bookList.add(addBook);
}
public void removeBook(Book book){
bookList.remove(book);
}
public void updateBook(Book updatedBook) {
for (Book book: bookList) {
if (book.getID() == updatedBook.getID()) {
book.setReleaseNumber(updatedBook.getReleaseNumber());
book.setAuthor(updatedBook.getAuthor());
}
}
}
public Book searchBookID(long ID) {
for (Book book: bookList) {
if (book.getID() == ID) {
return book;
}
}
return null;
}
}
|
5031fd2b-d864-4a71-a582-2484877efc6d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-07-08T00:25:11", "repo_name": "4ka0/blog_project", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1135, "line_count": 34, "lang": "en", "doc_type": "text", "blob_id": "8634719b78aa08da6a3579f8344483a8cf57fab4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/4ka0/blog_project | 278 | FILENAME: README.md | 0.259826 | # Blog Project
### Overview
A basic blog application provided with CRUD functionality.</br>
Built following chapters 5-7 of [Django for Beginners](https://djangoforbeginners.com).</br>
### Features
Uses a basic Post model including title, body, and author fields. The author field is linked to Django's User model through use of a foreign key, providing a one-to-many relationship between authors and posts.</br>
Utilises Django's built-in class-based views, specifically ListView and DetailView for displaying blog posts, CreateView and UpdateView for form-handling when creating and updating blog entries, and DeleteView for deleting individual posts.</br>
Also Uses Django's auth app for user authentication as well as the form class UserCreationForm for user sign up.</br>
Doesn't include user authentication permissions as this was addressed in later chapters in the textbook.
### Built using:
* Python 3.7
* Django 3.0.8
* django-crispy-forms 1.9.2
* Gunicorn 20.0.4
* Bootstrap 4
* Visual Studio Code 1.47.3
* macOS 10.14.6
* Heroku
* Pipenv
### Screenshot:

|
59bbd7e1-036c-4684-9cf1-38a21beefe6d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-08-31 05:26:47", "repo_name": "rsalesc/roborio", "sub_path": "/src/rsalesc/roborio/utils/Checkpoint.java", "file_name": "Checkpoint.java", "file_ext": "java", "file_size_in_byte": 1025, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "ecebaf1dede25350e7fa15b571196d4c0d5fb004", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/rsalesc/roborio | 248 | FILENAME: Checkpoint.java | 0.287768 | package rsalesc.roborio.utils;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Roberto Sales on 12/08/17.
*/
public class Checkpoint {
private static final Checkpoint SINGLETON = new Checkpoint();
private HashMap<String, Integer> hs;
public static Checkpoint getInstance() {
return SINGLETON;
}
private Checkpoint() {
hs = new HashMap<>();
}
public void enter(String cp) {
if(!hs.containsKey(cp)) {
hs.put(cp, 0);
}
hs.put(cp, hs.get(cp) + 1);
}
public void leave(String cp) {
if(!hs.containsKey(cp)) {
hs.put(cp, 0);
}
hs.put(cp, hs.get(cp) - 1);
}
public int get(String cp) {
if(!hs.containsKey(cp)) {
hs.put(cp, 0);
}
return hs.get(cp);
}
public void dump() {
for(Map.Entry<String, Integer> entry : hs.entrySet()) {
System.out.println(entry.getKey() + " " + entry.getValue());
}
}
}
|
d293df3e-6923-44b1-aeaf-817c4278825d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-12-18 06:47:43", "repo_name": "ArchkWay/brewmapp", "sub_path": "/app/src/main/java/com/brewmapp/presentation/presenter/impl/InvitePresenterImpl.java", "file_name": "InvitePresenterImpl.java", "file_ext": "java", "file_size_in_byte": 1080, "line_count": 39, "lang": "en", "doc_type": "code", "blob_id": "f852a63aefc3bb60e564c67f87b04dad214b6280", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ArchkWay/brewmapp | 213 | FILENAME: InvitePresenterImpl.java | 0.282196 | package com.brewmapp.presentation.presenter.impl;
import android.net.Uri;
import com.facebook.share.model.ShareLinkContent;
import com.facebook.share.widget.ShareDialog;
import javax.inject.Inject;
import com.brewmapp.R;
import com.brewmapp.presentation.view.contract.InviteView;
import ru.frosteye.ovsa.presentation.presenter.BasePresenter;
import com.brewmapp.presentation.presenter.contract.InvitePresenter;
import static ru.frosteye.ovsa.data.storage.ResourceHelper.getString;
public class InvitePresenterImpl extends BasePresenter<InviteView> implements InvitePresenter {
@Inject
public InvitePresenterImpl() {
}
@Override
public void onDestroy() {
}
@Override
public void onFacebookShare() {
ShareDialog shareDialog = new ShareDialog(view.getActivity());
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setQuote(getString(R.string.invite_message))
.setContentUrl(Uri.parse(getString(R.string.config_site_url))).build();
shareDialog.show(linkContent);
}
}
|
01e56939-a442-4557-8b64-a6b4a52a988f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-02 14:15:40", "repo_name": "Feiju12138/Landlord", "sub_path": "/src/pojo/PlayArea.java", "file_name": "PlayArea.java", "file_ext": "java", "file_size_in_byte": 1457, "line_count": 67, "lang": "zh", "doc_type": "code", "blob_id": "899a1797fb0225f95291de877521dac1703ff76f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Feiju12138/Landlord | 418 | FILENAME: PlayArea.java | 0.295027 | package pojo;
import java.util.ArrayList;
import java.util.List;
/**
* 出牌区对象
*/
public class PlayArea {
/*
* cards:当前出牌区最后一次出的牌
* status:这组排的类别
* -1:不合法
* 0:空出牌区
* 1:火箭(双王)
* 2:炸弹(aaaa)
* 3:单牌(a)
* 4:对牌(aa)
* 5:三牌(aaa)
* 6:三带一(aaab)
* 7:三带一对(aaabb)
* 8:四带二(aaaabc)
* 9:四带二对(aaaabbcc)
* 10:单顺(abcde)
* 11:双顺(aabbccdd)
* 12:三顺-飞机-不带翅膀(aaabbb)
* 13:飞机-带翅膀-单(aaabbbcd)
* 14:飞机-带翅膀-对(aaabbbccdd)
* player:上一次出牌的玩家信息
*
*/
private List<Card> cards;
private Integer status;
private Player player;
public PlayArea() {
cards = new ArrayList<>();
status = -1;
player = null;
}
public List<Card> getCards() {
return cards;
}
public void setCards(List<Card> cards) {
this.cards = cards;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Player getPlayer() {
return player;
}
public void setPlayer(Player player) {
this.player = player;
}
}
|
daf8a89e-d532-4b92-88ce-6ac910f3b6f3 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2022-02-13 12:06:23", "repo_name": "abarhub/rssreader", "sub_path": "/src/main/java/org/simplerss/rssreader/service/InitialisationService.java", "file_name": "InitialisationService.java", "file_ext": "java", "file_size_in_byte": 1082, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "bd6c59c6f1dc9af011fa7c7b3d88587ce1d0b1fe", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/abarhub/rssreader | 226 | FILENAME: InitialisationService.java | 0.276691 | package org.simplerss.rssreader.service;
import org.simplerss.rssreader.properties.RssReaderProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct;
import java.util.List;
public class InitialisationService {
public static final Logger LOGGER = LoggerFactory.getLogger(InitialisationService.class);
private SiteRssService siteRssService;
private RssReaderProperties rssReaderProperties;
public InitialisationService(SiteRssService siteRssService, RssReaderProperties rssReaderProperties) {
this.siteRssService = siteRssService;
this.rssReaderProperties = rssReaderProperties;
}
@PostConstruct
public void init(){
List<String> listeSites=rssReaderProperties.getSiteInitial();
LOGGER.info("listeSites={}", listeSites);
if(!CollectionUtils.isEmpty(listeSites)) {
for(String url:rssReaderProperties.getSiteInitial()) {
siteRssService.ajouteSite(url);
}
}
}
}
|
5baa5121-233f-4593-a085-d41a9e2dcfbc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-08-12 02:46:32", "repo_name": "Engeltj/UntoldRealm", "sub_path": "/src/com/depths/untold/Commands.java", "file_name": "Commands.java", "file_ext": "java", "file_size_in_byte": 1134, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "6d588ffdb22420a0f6d138cdc359119030374d4e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Engeltj/UntoldRealm | 235 | FILENAME: Commands.java | 0.272025 | /*
* 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.depths.untold;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Listener;
/**
*
* @author Tim
*/
public class Commands implements Listener{
private Untold plugin;
private CommandSender sender;
private Command cmd;
private String label;
private String[] args;
public Commands(){
}
public Commands(Untold plugin, CommandSender sender, Command cmd, String label, String[] args) {
this.sender = sender;
this.plugin = plugin;
this.cmd = cmd;
this.label = label;
this.args = args;
}
public boolean executeCommand(){
String command = cmd.getName();
// if (command.equalsIgnoreCase("life"))
// if (args.length == 0){
// sender.sendMessage(ChatColor.YELLOW + "Time format: YYYY/WW/DD/HH/MM/SS");
// }
return true;
}
}
|
2b3cd1f0-952f-41e5-be71-46a460e4cf24 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-06 10:02:42", "repo_name": "mremac/mental-snapp-android", "sub_path": "/MentalSnapp/app/src/main/java/com/mentalsnapp/com/mentalsnapp/activities/PrivacyPolicyActivity.java", "file_name": "PrivacyPolicyActivity.java", "file_ext": "java", "file_size_in_byte": 1219, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "b16fbbe6cbfbc28cbf7720a2fe7971302332a4e7", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mremac/mental-snapp-android | 222 | FILENAME: PrivacyPolicyActivity.java | 0.208179 | package com.mentalsnapp.com.mentalsnapp.activities;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import com.mentalsnapp.com.mentalsnapp.R;
/**
* Created by gchandra on 9/1/17.
*/
public class PrivacyPolicyActivity extends BaseActivity {
private Toolbar mToolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_privacy_policy);
registerViews();
initialiseVariables();
}
private void initialiseVariables() {
setSupportActionBar(mToolbar);
setHeader(getResources().getString(R.string.privacy_policy_title));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
private void registerViews() {
mToolbar = (Toolbar) findViewById(R.id.toolbar);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
break;
}
return super.onOptionsItemSelected(item);
}
}
|
ab492731-b65f-4aea-a263-f35ddd5bba84 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-31 02:15:42", "repo_name": "NYY-Java-Python/excel-demo", "sub_path": "/src/main/java/com/gjing/excel/demo/entity/User.java", "file_name": "User.java", "file_ext": "java", "file_size_in_byte": 1180, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "7a2ca7c869710f559db6a9c3aa51a0fa7429902b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/NYY-Java-Python/excel-demo | 272 | FILENAME: User.java | 0.256832 | package com.gjing.excel.demo.entity;
import cn.gjing.tools.excel.Excel;
import cn.gjing.tools.excel.ExcelEnumConvert;
import cn.gjing.tools.excel.ExcelField;
import cn.gjing.tools.excel.Type;
import cn.gjing.tools.excel.valid.ExplicitValid;
import com.gjing.excel.demo.config.MyExcelStyle;
import com.gjing.excel.demo.enums.GenderEnum;
import lombok.*;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* @author Gjing
**/
@Data
@Entity
@Table(name = "user")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Excel(value = "用户列表", style = MyExcelStyle.class, type = Type.XLS)
public class User extends BaseModel {
@Column(name = "user_name", columnDefinition = "varchar(30)")
@ExcelField("用户名")
private String userName;
@ExcelField("性别")
@ExplicitValid(combobox = {"男,女"})
@Column(name = "user_gender", columnDefinition = "tinyint(2)")
@ExcelEnumConvert(convert = GenderEnum.MyExcelEnumConvert.class)
@Convert(converter = GenderEnum.GenderEnumDbConvert.class)
private GenderEnum genderEnum;
}
|
182cf9b2-f25d-40ec-b8e6-8afb2ef9cabe | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2021-06-03T05:23:53", "repo_name": "amarjit-singh/LAMP", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1183, "line_count": 24, "lang": "en", "doc_type": "text", "blob_id": "f91e7b6b5ef892f936bbdd149944ecba7d4f33d0", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/amarjit-singh/LAMP | 296 | FILENAME: README.md | 0.262842 | # LAMP
## Usage
1. Clone the repo and cd into the repo directory
2. Create .env file from .env.example
`cp .env.example .env`
3. Edit .env file according to your requirements.
APACHE_PORT: The port that is free on your machine which you want to bind Apache's listening Port.
This Port will determine how you will access your localhost from the browser.
SSH_PORT: The port that is free on your machine which you want bind the ssh service of apache container.
This Port will determine how you will access ssh into apache container. eg: if SSH_PORT var is 2226 then to ssh into
apache container type `ssh root@127.0.0.1 -p 2226`
PHP_VERSION: The version of php that you want to be installed in the container. eg 7.2,7.4,8.0 etc
VHOSTS_DIR: Path for the directory where you have your apache's virtual hosts conf files.
PROJECTS_PATH: Path for the root directory of your all projects.
MYSQL_DATA_DIR: Path where you want the mysql data to be stored or taken from.
4. Execute command `docker-compose up` to start the docker LAMP stack. To recreate the docker LAMP stack execute command `docker-compose up -d --build --force-recreate`.
|
e5a33c54-f55f-44c2-a803-d338b39f9fc6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-29 15:57:48", "repo_name": "wenhao555/mathapp", "sub_path": "/app/src/main/java/com/example/justloginregistertest/VideoActivity.java", "file_name": "VideoActivity.java", "file_ext": "java", "file_size_in_byte": 1079, "line_count": 28, "lang": "en", "doc_type": "code", "blob_id": "bad6508e60e2c424732da3c4fb09baa404b3e7e6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/wenhao555/mathapp | 226 | FILENAME: VideoActivity.java | 0.20947 | package com.example.justloginregistertest;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
import android.webkit.WebView;
import android.widget.VideoView;
public class VideoActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
setContentView(R.layout.activity_video);
VideoView webView=findViewById(R.id.video_view);
webView.setVideoPath("http://vfx.mtime.cn/Video/2019/02/04/mp4/190204084208765161.mp4");
// webView.setVideoPath("android.resource://" + getPackageName() + "/" + R.raw.video1);
//webView.setVideoPath("android.resource://" + getPackageName() + "/" + R.raw.video2);
// webView.setVideoPath("android.resource://" + getPackageName() + "/" + R.raw.video3);
webView.start();
}
}
|
6da9b4fe-9d7d-4707-a1b2-8e95b6a0f34d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-03-22T19:35:20", "repo_name": "JediLuke/embed-yaws", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1048, "line_count": 29, "lang": "en", "doc_type": "text", "blob_id": "37a6370e8c80cce2ef727ebcbe280d79b8af213a", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JediLuke/embed-yaws | 284 | FILENAME: README.md | 0.218669 | embed_yaws
=====
Example of embedding yaws inside a larger Erlang application. Also has a simple API implemented using appmods.
FreeBSD Build
-------------
See: http://www.bsdguides.org/2005/hardening-freebsd/
See: https://www.digitalocean.com/community/tutorials/recommended-steps-for-new-freebsd-10-1-servers
$ sudo pkg install git
$ sudo pkg install erlang
$ sudo pkg install rebar3
Inside the embed-yaws directory (where README.md and rebar.config live). The directory can be changed in ybed.erl
$ mkdir logs
To start the application, including embedded yaws
$ rebar3 shell
1> application:start(embed_yaws).
Known issues
------------
* This example is incompatible with windows ("There's no official support for rebar3 yet in yaws" 23/2/2016) - https://github.com/klacke/yaws/issues/254. Works fine on FreeBSD.
* Embedding yaws in another application has issues when trying to make a release - http://lists.basho.com/pipermail/rebar_lists.basho.com/2016-February/002311.html. It works fine as a normal app though. |
d2207539-153d-4d72-a6d0-395b27d736d1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-06-28 06:33:46", "repo_name": "songwenbin/wyhtorm", "sub_path": "/src/main/java/com/wyht/worm/ColumnMetadata.java", "file_name": "ColumnMetadata.java", "file_ext": "java", "file_size_in_byte": 1157, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "2917026b36faaffd0afb82165937fad93d7941f9", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/songwenbin/wyhtorm | 245 | FILENAME: ColumnMetadata.java | 0.258326 | package com.wyht.worm;
public class ColumnMetadata {
private final String columnName;
private final String typeName;
private final int columnSize;
public ColumnMetadata(String columnName, String typeName, int columnSize) {
this.columnName = columnName;
this.typeName = typeName;
this.columnSize = columnSize;
}
/**
* Column name as reported by DBMS driver.
*
* @return column name as reported by DBMS driver.
*/
public String getColumnName() {
return columnName;
}
/**
* Column size as reported by DBMS driver.
*
* @return column size as reported by DBMS driver.
*/
public int getColumnSize() {
return columnSize;
}
/**
* Column type name as reported by DBMS driver.
*
* @return column type name as reported by DBMS driver.
*/
public String getTypeName() {
return typeName;
}
@Override
public String toString() {
return "[ columnName=" + columnName
+ ", typeName=" + typeName
+ ", columnSize=" + columnSize
+ "]";
}
}
|
74b3313f-0dfd-4a75-8152-0cf04c782149 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-04-28 20:56:09", "repo_name": "nvv/Far-On-Droid", "sub_path": "/farondroid/libs-src/skydrive/src/internal/com/microsoft/live/DownloadRequest.java", "file_name": "DownloadRequest.java", "file_ext": "java", "file_size_in_byte": 849, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "da1f28a418be15df13deeba59fbd4aeab6a64789", "star_events_count": 32, "fork_events_count": 5, "src_encoding": "UTF-8"} | https://github.com/nvv/Far-On-Droid | 188 | FILENAME: DownloadRequest.java | 0.258326 | //------------------------------------------------------------------------------
// Copyright (c) 2012 Microsoft Corporation. All rights reserved.
//
// Description: See the class level JavaDoc comments.
//------------------------------------------------------------------------------
package com.microsoft.live;
import java.io.InputStream;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpUriRequest;
class DownloadRequest extends ApiRequest<InputStream> {
public static final String METHOD = HttpGet.METHOD_NAME;
public DownloadRequest(LiveConnectSession session, HttpClient client, String path) {
super(session,
client,
InputStreamResponseHandler.INSTANCE,
path,
ResponseCodes.UNSUPPRESSED,
Redirects.UNSUPPRESSED);
}
@Override
public String getMethod() {
return METHOD;
}
@Override
protected HttpUriRequest createHttpRequest() throws LiveOperationException {
return new HttpGet(this.requestUri.toString());
}
}
|
04ef3278-d5ac-43fe-9d24-55f2112f7c50 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-02 09:57:31", "repo_name": "steinwurf/petro-android", "sub_path": "/app/src/main/java/com/steinwurf/petro/AudioExtractorActivity.java", "file_name": "AudioExtractorActivity.java", "file_ext": "java", "file_size_in_byte": 891, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "b5bd97634d116d7d0f70cd23833ac3662706c278", "star_events_count": 2, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/steinwurf/petro-android | 199 | FILENAME: AudioExtractorActivity.java | 0.271252 | // Copyright (c) 2014 Steinwurf ApS
// All Rights Reserved
//
// Distributed under the "BSD License". See the accompanying LICENSE.rst file.
package com.steinwurf.petro;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
public class AudioExtractorActivity extends AppCompatActivity
{
private static final String TAG = "AudioExtractorActivity";
private AudioExtractorDecoder mAudioDecoder;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.audio_activity);
Intent intent = getIntent();
String filePath = intent.getStringExtra(MainActivity.FILEPATH);
mAudioDecoder = new AudioExtractorDecoder();
mAudioDecoder.init(filePath);
mAudioDecoder.start();
}
@Override
public void onStop()
{
super.onStop();
if (mAudioDecoder != null)
{
mAudioDecoder.close();
}
}
}
|
e5a55ce6-806d-4c00-9af1-d4992fde6713 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-10-12 21:52:35", "repo_name": "falopez/EmployeeInformation", "sub_path": "/EmployeeInformationApi/src/main/java/co/com/MASGlobalConsulting/microservice/employee/model/RequestData.java", "file_name": "RequestData.java", "file_ext": "java", "file_size_in_byte": 1107, "line_count": 59, "lang": "en", "doc_type": "code", "blob_id": "ccdba603eb5096becd39258e5ce0a0f98a30144b", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/falopez/EmployeeInformation | 261 | FILENAME: RequestData.java | 0.246533 | package co.com.MASGlobalConsulting.microservice.employee.model;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.springframework.validation.annotation.Validated;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
/**
* RequestData
*/
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-09-20T19:10:52.217-05:00")
public class RequestData {
@JsonProperty("header")
private Header header = null;
@JsonProperty("idEmployee")
private String idEmployee = null;
/**
* Get header
* @return header
**/
@ApiModelProperty(value = "")
@Valid
public Header getHeader() {
return header;
}
public void setHeader(Header header) {
this.header = header;
}
/**
* Get idEmployee
* @return idEmployee
**/
@ApiModelProperty(required = true, value = "")
@NotNull
public String getIdEmployee() {
return idEmployee;
}
public void setIdEmployee(String idEmployee) {
this.idEmployee = idEmployee;
}
}
|
1dad81ea-10cc-4fa2-b0bc-7d853e2efc6e | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-01-19 15:51:01", "repo_name": "DerekJin/RobotRace-Mater", "sub_path": "/RobotRace/src/robotrace/Textures.java", "file_name": "Textures.java", "file_ext": "java", "file_size_in_byte": 1183, "line_count": 42, "lang": "en", "doc_type": "code", "blob_id": "7b0fd15bccfdafcaee043e9e70d186cd2c521657", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/DerekJin/RobotRace-Mater | 252 | FILENAME: Textures.java | 0.290176 | package robotrace;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureIO;
/**
*
* @author Niels Rood
*/
public class Textures {
public static Texture head = null;
public static Texture torso = null;
public static Texture track = null;
public static Texture brick = null;
// public static Texture finish = null;
public static void loadTextures() {
head = loadTexture("textures/head.jpg");
torso = loadTexture("textures/torso.jpg");
track = loadTexture("textures/track.jpg");
brick = loadTexture("textures/brick.jpg");
// finish = loadTexture("textures/finish.jpg");
}
/**
* Try to load a texture from the given file. The file
* should be located in the same folder as RobotRace.java.
*/
private static Texture loadTexture(String file) {
Texture result = null;
try {
// Try to load from local folder.
result = TextureIO.newTexture(Textures.class.getResource(file), false, null);
} catch(Exception e1) {
e1.printStackTrace();
}
return result;
}
}
|
fe5cb0ef-45c7-4a37-bbc6-5e160797fb69 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-11-02 14:35:28", "repo_name": "fjnu-zs/intent", "sub_path": "/app/src/main/java/com/example/myapplication/MainActivity.java", "file_name": "MainActivity.java", "file_ext": "java", "file_size_in_byte": 1218, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "2d9ca6be3738640942053728f016dbbdad92e860", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/fjnu-zs/intent | 197 | FILENAME: MainActivity.java | 0.220007 | package com.example.myapplication;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private Button bt1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bt1=findViewById(R.id.button);
bt1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
Intent in1= new Intent(Intent.ACTION_VIEW);
EditText ed =findViewById(R.id.editText);
final String net= ed.getText().toString();
if(!net.equals("")&&net != ""){
in1.setData(Uri.parse(net));
startActivity(in1);
}else {
Toast.makeText(getApplicationContext(),"please enter Url",Toast.LENGTH_SHORT).show();
}
}
});
}
} |
5c9db6cc-370b-468c-8698-e7403104dedd | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-30 17:24:49", "repo_name": "shugan90/ProjectA", "sub_path": "/app/src/main/java/com/example/shugan/myapplicationalarm/MyService.java", "file_name": "MyService.java", "file_ext": "java", "file_size_in_byte": 1080, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "22b8a1b01419d16ed7c32a17472f72ef65b1c8df", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/shugan90/ProjectA | 210 | FILENAME: MyService.java | 0.228156 | package com.example.shugan.myapplicationalarm;
import android.app.Service;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Binder;
import android.os.IBinder;
import androidx.annotation.Nullable;
public class MyService extends Service {
ServiceConnection m_service;
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_NOT_STICKY;
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
public class MyBinder extends Binder {
public MyService getService() {
return MyService.this;
}
}
private ServiceConnection m_serviceConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
m_service = (ServiceConnection) ((MyBinder)service).getService();
}
public void onServiceDisconnected(ComponentName className) {
m_service = null;
}
};
} |
f86e4d70-294d-46d1-8e9a-618403965f63 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-08 12:14:09", "repo_name": "iosdt5/cmfz", "sub_path": "/src/main/java/com/baizhi/gjc/service/AlbumServiceImpl.java", "file_name": "AlbumServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1158, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "b23bb3045b5cabd9c3b7945c7bfcf0a96f5ee4dd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/iosdt5/cmfz | 255 | FILENAME: AlbumServiceImpl.java | 0.267408 | package com.baizhi.gjc.service;
import com.baizhi.gjc.dao.AlbumDao;
import com.baizhi.gjc.entity.Album;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
@Service
public class AlbumServiceImpl implements AlbumService {
@Autowired
AlbumDao albumDao;
@Override
public List<Album> queryPage(Integer page, Integer rows) {
List<Album> albums = albumDao.selectByRowBounds(null, new RowBounds((page-1)*rows, rows));
return albums;
}
@Override
public Integer selectCount() {
int i = albumDao.selectCount(null);
return i;
}
@Override
public void insert(Album album) {
albumDao.insert(album);
}
@Override
public void delete(String[] id) {
albumDao.deleteByIdList(Arrays.asList(id));
}
@Override
public void update(Album album) {
albumDao.updateByPrimaryKey(album);
}
@Override
public void updateMap(Album album) {
albumDao.updateByPrimaryKeySelective(album);
}
}
|
95a1f5df-68bb-441f-bbe2-738459d1932c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-04-27 12:43:18", "repo_name": "chenlyt/qrcode", "sub_path": "/app/src/main/java/com/cl/qrcode/decode/DecodeThread.java", "file_name": "DecodeThread.java", "file_ext": "java", "file_size_in_byte": 1099, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "c864ddc6561a3e1ab5ecc8cf58e91cd40f83ecf0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/chenlyt/qrcode | 219 | FILENAME: DecodeThread.java | 0.291787 | package com.cl.qrcode.decode;
import android.os.Handler;
import android.os.Looper;
import com.cl.qrcode.activity.CaptureActivity;
import com.google.zxing.DecodeHintType;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
public class DecodeThread extends Thread {
public static final String BARCODE_BITMAP = "barcode_bitmap";
private final CaptureActivity activity;
private final Map<DecodeHintType, Object> hints;
private final CountDownLatch handlerInitLatch;
private Handler handler;
public DecodeThread(CaptureActivity activity, int decodeMode) {
this.activity = activity;
handlerInitLatch = new CountDownLatch(1);
hints = DecodeUtils.getHints(decodeMode);
}
public Handler getHandler() {
try {
handlerInitLatch.await();
} catch (InterruptedException ie) {
}
return handler;
}
@Override
public void run() {
Looper.prepare();
handler = new DecodeHandler(activity, hints);
handlerInitLatch.countDown();
Looper.loop();
}
}
|
da254860-ca0f-4479-a014-b99dd493fc58 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2012-09-21 06:56:47", "repo_name": "hsolia/rankrepo", "sub_path": "/src/com/vidyo/jsf/csv/CsvTextRenderer.java", "file_name": "CsvTextRenderer.java", "file_ext": "java", "file_size_in_byte": 1220, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "50a5e05a601f873c7cce158a5cd9308d4730b952", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/hsolia/rankrepo | 232 | FILENAME: CsvTextRenderer.java | 0.283781 |
package com.vidyo.jsf.csv;
import java.io.IOException;
import javax.faces.component.UIComponent;
import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.Renderer;
public class CsvTextRenderer extends Renderer {
/**
* Encode end.
*
* @param context the Faces context.
* @param component the UI component.
* @throws IOException when an I/O error occurs.
*/
@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (context == null) {
throw new NullPointerException("Context cannot be null");
}
if (component == null) {
throw new NullPointerException("Component cannot be null");
}
ResponseWriter writer = context.getResponseWriter();
if (component instanceof UIOutput) {
UIOutput output = (UIOutput) component;
if (output.getValue() instanceof Number) {
writer.write(output.getValue().toString());
} else {
writer.write("\"" + output.getValue().toString() + "\"");
}
}
}
}
|
407eac8c-999e-48dd-b834-0c92172ae53c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-11 12:55:36", "repo_name": "TomaszFigat/politicsForDummies", "sub_path": "/src/main/java/com/tomaszfigat/politicsForDummies/service/UserService.java", "file_name": "UserService.java", "file_ext": "java", "file_size_in_byte": 1013, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "3d5484d9f30749efc59f99a0bafd1a535feec66f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/TomaszFigat/politicsForDummies | 191 | FILENAME: UserService.java | 0.273574 | package com.tomaszfigat.politicsForDummies.service;
import com.tomaszfigat.politicsForDummies.repository.UserRepository;
import com.tomaszfigat.politicsForDummies.entity.User;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@AllArgsConstructor
public class UserService {
private final UserRepository userRepository;
// private final UserMapper userMapper;
//
@Transactional
public List<User> findAll(){
return userRepository.findAll();
}
//
@Transactional
public User findById(Long theId){
return userRepository.findById(theId).orElseThrow();
}
// //public User findByName(String userName){
// return null;
// }
@Transactional
public User save(User user){
return userRepository.save(user);
}
@Transactional
public void deleteById(Long id){
userRepository.deleteById(id);
}
}
|
3546d643-2469-454f-9f4c-26c23a681ff2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-08-09 14:50:34", "repo_name": "lbzhello/caiwei", "sub_path": "/caiwei-web/src/main/java/xyz/lius/web/config/AppExceptionHandlerAdvice.java", "file_name": "AppExceptionHandlerAdvice.java", "file_ext": "java", "file_size_in_byte": 1153, "line_count": 31, "lang": "en", "doc_type": "code", "blob_id": "1bfe17a804d426ded37163425f4b034f8996d2f0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lbzhello/caiwei | 205 | FILENAME: AppExceptionHandlerAdvice.java | 0.239349 | package xyz.lius.web.config;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import xyz.lius.web.controller.UserController;
import java.util.HashMap;
import java.util.Map;
// 可以配置拦截指定的类或者包等
// @RestControllerAdvice 使 @ExceptionHandler 注解的方法默认具有 @ResponseBody 注解
@RestControllerAdvice(basePackageClasses = UserController.class)
public class AppExceptionHandlerAdvice {
// 配置拦截的错误类型
@ExceptionHandler(Exception.class)
public ResponseEntity<Object> responseEntity(Exception e) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
Map<String, Object> map = new HashMap<>();
map.put("status", 400);
map.put("message", e.getMessage());
return new ResponseEntity<>(map, headers, HttpStatus.BAD_REQUEST);
}
}
|
f64ccbc5-6eec-433a-89e2-284df79076f1 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-19 05:46:00", "repo_name": "kishanhaldar78/Ciphers", "sub_path": "/app/src/main/java/com/example/kishan/ciphers/Main_menu.java", "file_name": "Main_menu.java", "file_ext": "java", "file_size_in_byte": 1135, "line_count": 40, "lang": "en", "doc_type": "code", "blob_id": "d9a5ebd26f9a5911c12576b4cf0aa170dba16e62", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/kishanhaldar78/Ciphers | 211 | FILENAME: Main_menu.java | 0.226784 | package com.example.kishan.ciphers;
import android.content.Intent;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class Main_menu extends AppCompatActivity {
ActionBar actionBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_menu);
}
public void encrypt(View view) {
Intent i=new Intent(this,Msg_pass.class);
i.putExtra("msg","Enter your Encryption Message ");
i.putExtra("msg1","Encrypt");
startActivity(i);
}
public void decrypt(View view) {
Intent i=new Intent(this,Msg_pass.class);
i.putExtra("msg","Enter your Decryption Message ");
i.putExtra("msg1","Decrypt");
startActivity(i);
}
public void onBackPressed()
{
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
}
|
9ede0dbe-a802-45e6-a1e8-2a92230f1f22 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2015-11-20T02:08:12", "repo_name": "ynwh/repeat-junction-mapper", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1072, "line_count": 36, "lang": "en", "doc_type": "text", "blob_id": "a4665af60f508b2ef3a7ec37be7043f4f694231a", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/ynwh/repeat-junction-mapper | 278 | FILENAME: README.md | 0.246533 | RJMapper package version 0.1
A Tool to Improving Genome Assemblies with Repeat Junction Markers
Authors: Hao Wang
Address: Department of Genetics, University of Georgia, GA U.S.A.
Email: ynwh.km@gmail.com
Requirement:
- Linux system
- Perl 5.8 or higher
- Python 2.6 (to run Easyfig)
- NCBI Blastall program installed
- Easyfig program installed (http://mjsull.github.io/Easyfig/)
How to use:
1. Prepare sequences:
- Query data set: FASTA format. Unanchored sequences
that need to be mapped.
- Reference data set: FASTA format.
3. Install program:
- Download RJMapper-vXX.tar.gz
- Untar RJMapper-v0.1.tar.gz and copy the package of
"RJMapper-vXX" to a folder.
4. Run program:
- Type "perl RJMapper.pl", and provide pathes for
reqired programs according to instructions
5. Examples:
- perl RJMapper.pl -b /RJMapper/path/ -B /blastall/path
-i query.fasta -j ref.fasta -t LTR.fasta -o Map
-E /easyfig/path/
|
bfd14e08-c569-43c1-b6aa-c42d8c5610ef | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2022-11-13T08:44:35", "repo_name": "jandusek/twilio-phone-client", "sub_path": "/CHANGELOG.md", "file_name": "CHANGELOG.md", "file_ext": "md", "file_size_in_byte": 1183, "line_count": 24, "lang": "en", "doc_type": "text", "blob_id": "0691a41e7a65c875ccdd05b15d8d1277bd5fdb3b", "star_events_count": 26, "fork_events_count": 13, "src_encoding": "UTF-8"} | https://github.com/jandusek/twilio-phone-client | 258 | FILENAME: CHANGELOG.md | 0.233706 | # Changelog
## v1.0 - First stable version
- This is a breaking change version and reinstallation is recommended (identity used in SDKs and Chat channel member name is now tied to the phone number, API key env variables have been renamed)
- Moved from Capability to Access tokens for Client.js
- Auth Token no longer needed, authentication fully via API keys
- Fixed numerous issues associated with switching between the SMS and Call tabs
- Fixed issue with mute button not working under certain circumstances
- Message compose input field now always retains focus for smoother back and forth messaging experience
- Added support for inbound calls
- Added ability to delete messaging history with a given contact
- Added basic access control using a shared secret
### Upgrade steps from v0.9
- rename env variables in `deploy/.env` from `SYNC_API_KEY` and `SYNC_API_SECRET` to `API_KEY` and `API_SECRET`
- create a new [Chat Service](https://www.twilio.com/console/chat/services) and update CHAT_SERVICE_SID with its SID in `deploy/.env`
- add a SECRET env variable with some shared secret (effectively a password) to `deploy/.env`
## v0.9 - Proof of concept
- Initial version
|
05ea9af3-321d-4a11-b1ca-71dc4b4cf969 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-11-20 13:54:44", "repo_name": "JozephineG/QuizKampen", "sub_path": "/src/server/Server.java", "file_name": "Server.java", "file_ext": "java", "file_size_in_byte": 1134, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "b4b910aad6ad2e7b5b278b721857304e43a0cfad", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/JozephineG/QuizKampen | 246 | FILENAME: Server.java | 0.286169 | package server;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
public class Server {
private int port = 1337;
private Socket connection;
private ServerSocket listener;
Server(){
try {
listener = new ServerSocket(port);
} catch (IOException e) {
System.out.println("Could not create ServerSocket...");
}
setupConnection();
}
private void setupConnection() {
try {
while(true) {
System.out.println("Waiting to connect to first client...");
connection = listener.accept();
Player p1 = new Player(connection, 1);
System.out.println("Player 1 connected: " + connection.getInetAddress().getHostName());
System.out.println("Waiting to connect to second client...");
connection = listener.accept();
Player p2 = new Player(connection, 2);
System.out.println("Player 2 connected: " + connection.getInetAddress().getHostName());
}
} catch (IOException e) {
System.out.println("Unable to connect to client...");
}
}
public static void main(String[] args) {
new Server();
}
}
|
00d5ab87-3fe6-4c44-9f1a-144ff53c45ee | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-12-31 18:07:01", "repo_name": "guanqing123/demo-wx", "sub_path": "/demo-wx/src/main/java/com/demo/core/weixin/wxobj/ConditionMenu.java", "file_name": "ConditionMenu.java", "file_ext": "java", "file_size_in_byte": 1234, "line_count": 55, "lang": "en", "doc_type": "code", "blob_id": "89a4b12f4abef25d31572516ec9efbc53d632eb9", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/guanqing123/demo-wx | 248 | FILENAME: ConditionMenu.java | 0.246533 | package com.demo.core.weixin.wxobj;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* 个性化菜单配置
*
* @author hst on 2016/12/13
*/
@Getter
@Setter
public class ConditionMenu extends Menu {
@JSONField(name = "matchrule")
@JsonProperty("matchrule")
private MatchRule matchRule;
public ConditionMenu(List<Button> buttons) {
super(buttons);
}
public ConditionMenu(List<Button> buttons, MatchRule matchRule) {
super(buttons);
this.matchRule = matchRule;
}
@Getter
@Setter
public static class MatchRule {
@JSONField(name = "group_id")
@JsonProperty("group_id")
private String groupId;
private Integer sex;
private String country;
private String province;
private String city;
@JSONField(name = "client_platform_type")
@JsonProperty("client_platform_type")
private Integer clientPlatformType;
public MatchRule(String groupId) {
this.groupId = groupId;
}
}
}
|
75a8d490-de6b-4506-855e-92a0803992f6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-05-29T17:31:56", "repo_name": "roomthily/inat-hyperlocal-dash", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1157, "line_count": 20, "lang": "en", "doc_type": "text", "blob_id": "2ad0d3d7a6699d203a48c375c6eaea18462f9be1", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/roomthily/inat-hyperlocal-dash | 298 | FILENAME: README.md | 0.214691 | # Example iNaturalist dashboard for current local observations
A quick little viewer to show the species (plants, birds or mammals) seen around Boulder County, CO over a two week window to demo the iNaturalist search API.
The [dashboard](https://married-soy.glitch.me) shows an example observation from each species observed over that time period:

(limited to the most recent 100 observations).
This uses the speedy node.js based [iNaturalist API](http://api.inaturalist.org/v1/docs/#!/Observations/get_observations) with [additional documentation](https://www.inaturalist.org/pages/api+reference#get-observations) available.
## Remixing!
Most of the search parameters are not used by this demo! Check out client.js for the parameters used for the dashboard if, say, you're not in Boulder County.
## Getting Help
You can see other example projects on our [Community Projects](https://glitch.com/) page. And if you get stuck, let us know on the [forum](http://support.glitch.com/) and we can help you out. |
c3cd6ceb-2ec8-4e10-a48e-4ec84abe1bf9 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-11-29 07:30:29", "repo_name": "Spaceman1701/cafe.connor.fun-backend", "sub_path": "/src/main/java/fun/connor/cafe/security/authentication/Role.java", "file_name": "Role.java", "file_ext": "java", "file_size_in_byte": 1182, "line_count": 56, "lang": "en", "doc_type": "code", "blob_id": "12925adb9a9f88f32e1a16da4c137de1caa34a76", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Spaceman1701/cafe.connor.fun-backend | 254 | FILENAME: Role.java | 0.262842 | package fun.connor.cafe.security.authentication;
import java.util.Objects;
/**
* A role to be consumed by authorization logic. Roles define broad categories of
* permissions for subjects.
*/
public class Role {
/**
* Default role for normal, signed-in users.
*/
public static final Role DEFAULT = new Role("default");
/**
* Anonymous role for clients that have no attempted sign-in
*/
public static final Role ANON = new Role("anon");
/**
* Admin role for service administrators
*/
public static final Role ADMIN = new Role("admin");
private final String name;
/**
* Creates a new role
* @param name the role name
*/
Role(String name) {
Objects.requireNonNull(name);
this.name = name;
}
/**
* @return this Role's name. Cannot be null.
*/
public String getName() {
return name;
}
@Override
public boolean equals(Object o) {
if (!(o instanceof Role)) return false;
Role other = (Role) o;
return other.name.equals(name);
}
@Override
public int hashCode() {
return name.hashCode();
}
}
|
372e0551-bc48-454f-af8c-2e9fb2bea512 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-12-01 05:45:58", "repo_name": "gagan850/GeeksForGeeks", "sub_path": "/StudentManagement4/src/main/java/com/management/student/dao/UserDao.java", "file_name": "UserDao.java", "file_ext": "java", "file_size_in_byte": 1114, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "b5752018287c69ee554b5128b7aac0cde3d0bf3c", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/gagan850/GeeksForGeeks | 201 | FILENAME: UserDao.java | 0.240775 | package com.management.student.dao;
import org.apache.log4j.Logger;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
import com.management.student.model.User;
@Repository
public class UserDao implements IUserDao {
/** The Constant logger. */
final static Logger logger = Logger.getLogger(UserDao.class);
/** The jdbc template. */
private MongoTemplate jdbcTemplate;
public User getUserByUserName(final String userName) {
User user = this.jdbcTemplate.findOne(new Query(Criteria.where("userName").is(userName)),User.class);
return user;
}
/**
* @return the jdbcTemplate
*/
public MongoTemplate getJdbcTemplate() {
return jdbcTemplate;
}
/**
* @param jdbcTemplate the jdbcTemplate to set
*/
public void setJdbcTemplate(final MongoTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
}
|
3c8a25bd-7820-4929-a84c-28bfac4a70a5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-09-25 11:39:46", "repo_name": "chethan22/SeleniumJavaCucumberFrameWork", "sub_path": "/src/test/java/pom/EnterTimeTrack.java", "file_name": "EnterTimeTrack.java", "file_ext": "java", "file_size_in_byte": 1112, "line_count": 59, "lang": "en", "doc_type": "code", "blob_id": "725da67ec72293bbde73832758ceda1028ec8209", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/chethan22/SeleniumJavaCucumberFrameWork | 256 | FILENAME: EnterTimeTrack.java | 0.250913 | package pom;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import generic.Base_Page;
public class EnterTimeTrack extends Base_Page {
@FindBy(xpath = "//div[@class='popup_menu_icon support_icon']")
private WebElement help;
@FindBy(xpath = "//a[contains(.,'About actiTIME')]")
private WebElement aboutActime;
@FindBy(xpath = "//span[contains(.,'actiTIME 2014 Pro')]")
private WebElement aVersion;
@FindBy(xpath = "//td[@class='close-button']//img")
private WebElement close;
@FindBy(xpath = "//a[contains(.,'Report a Bug to Vendor')]")
private WebElement report;
@FindBy(id = "logoutLink")
private WebElement logout;
public EnterTimeTrack(WebDriver driver) {
super(driver);
}
public void clickHelp() {
help.click();
}
public void clickAboutActimeTime() {
aboutActime.click();
}
public String actTimeVersion() {
return aVersion.getText();
}
public void clickClose() {
close.click();
}
public void clickReport() {
report.click();
}
public void clickOnLogout() {
logout.click();
}
}
|
4685066c-b5e9-4c22-af39-649564e370bb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-04 15:26:24", "repo_name": "cyrillwork/upload", "sub_path": "/src/main/java/com/cyrillwork/upload/controllers/UploadMultipartFile.java", "file_name": "UploadMultipartFile.java", "file_ext": "java", "file_size_in_byte": 1135, "line_count": 57, "lang": "en", "doc_type": "code", "blob_id": "feece3757372bc473b5f2c6ab22219ee1bb3301d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/cyrillwork/upload | 225 | FILENAME: UploadMultipartFile.java | 0.20947 | package com.cyrillwork.upload.controllers;
import com.cyrillwork.upload.models.UploadFiles;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
public class UploadMultipartFile implements MultipartFile {
private UploadFiles file;
public UploadMultipartFile(UploadFiles file){
this.file = file;
}
@Override
public String getName() {
return file.getName();
}
@Override
public String getOriginalFilename() {
return file.getName();
}
@Override
public String getContentType() {
return null;
}
@Override
public boolean isEmpty() {
return false;
}
@Override
public long getSize() {
return file.getFileSize();
}
@Override
public byte[] getBytes() throws IOException {
return file.getFile().getFile();
}
@Override
public InputStream getInputStream() throws IOException {
return null;
}
@Override
public void transferTo(File file) throws IOException, IllegalStateException {
}
}
|
bebcdcd7-5fd9-46f7-801e-e9b9f9191695 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-01-26 09:44:02", "repo_name": "Eillot/MagicCube", "sub_path": "/magiccube-web/src/main/java/com/missfresh/magiccube/web/MagicCubeWebApplication.java", "file_name": "MagicCubeWebApplication.java", "file_ext": "java", "file_size_in_byte": 1106, "line_count": 26, "lang": "en", "doc_type": "code", "blob_id": "cfebd37bbb5b7e79ed497d16bca485b409853343", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/Eillot/MagicCube | 191 | FILENAME: MagicCubeWebApplication.java | 0.20947 | package com.simon.magiccube.web;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@SpringBootApplication
@ComponentScan(basePackages = {"com.simon.magiccube"})
@ServletComponentScan("com.simon.magiccube")
@MapperScan(value = "com.simon.magiccube.dao.mapper")
@EnableTransactionManagement(proxyTargetClass = true)
public class MagicCubeWebApplication implements WebMvcConfigurer {
private static Logger LOG = LoggerFactory.getLogger(MagicCubeWebApplication.class);
public static void main(String[] args) {
SpringApplication.run(MagicCubeWebApplication.class, args);
LOG.info("magiccube SpringBoot Start Success");
}
} |
8fbd07b4-acaa-42cc-9779-16064daacebb | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-09-25 10:47:36", "repo_name": "agawda/HAL9000", "sub_path": "/crawler/src/main/java/com/javaacademy/crawler/common/CustomCallback.java", "file_name": "CustomCallback.java", "file_ext": "java", "file_size_in_byte": 1091, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "9a866556b8b76303d35ea6b95109bca882601c6c", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/agawda/HAL9000 | 214 | FILENAME: CustomCallback.java | 0.271252 | package com.javaacademy.crawler.common;
import com.javaacademy.crawler.common.logger.AppLogger;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import java.util.function.Consumer;
import java.util.logging.Level;
@Getter
@EqualsAndHashCode
@AllArgsConstructor
public class CustomCallback<T> implements Callback<T> {
@NonNull
Consumer<T> consumer;
@Override
public void onResponse(Call<T> call, Response<T> response) {
if(response.isSuccessful()) {
consumer.accept(response.body());
} else {
AppLogger.logger.log(Level.WARNING, "error code " + response.code() +
", message = " +response.errorBody());
}
}
@Override
public void onFailure(Call<T> call, Throwable throwable) {
AppLogger.logger.log(Level.WARNING, "There was an error while making a custom retrofit call: "
+ throwable.getMessage() +"\n" + call.request());
}
}
|
432e937c-ad29-479c-a92f-a39d4cf0ab04 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-06-03 07:27:04", "repo_name": "lzjqcc/web_search", "sub_path": "/src/main/java/com/lzj/control/SearchAction.java", "file_name": "SearchAction.java", "file_ext": "java", "file_size_in_byte": 1111, "line_count": 34, "lang": "en", "doc_type": "code", "blob_id": "08f052989ef6e353b7eb78d7119c513c60c6917f", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/lzjqcc/web_search | 214 | FILENAME: SearchAction.java | 0.279042 | package com.lzj.control;
import com.lzj.domain.WebEntity;
import com.lzj.utils.WebSearch;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* Created by Administrator on 2017/5/25 0025.
*/
@WebServlet("/searchAction")
public class SearchAction extends HttpServlet{
private WebSearch webSearch;
@Override
public void init() throws ServletException {
webSearch=new WebSearch();
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setContentType("text/html;charset=utf-8");
String key=req.getParameter("weburl");
List<WebEntity>list=webSearch.listWebEntities(key);
req.setAttribute("list",list);
req.getRequestDispatcher("/index.jsp").forward(req,resp);
}
}
|
074d6963-7f06-499c-bb36-c4d2b13e0b09 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-01-27 14:30:46", "repo_name": "Caddarik/theblog", "sub_path": "/src/main/java/fr/caddarik/theblog/dao/converter/DateConverter.java", "file_name": "DateConverter.java", "file_ext": "java", "file_size_in_byte": 1184, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "38b7751f2d1ad6f0ef04d916a4f198f75b36de9d", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Caddarik/theblog | 226 | FILENAME: DateConverter.java | 0.253861 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package fr.caddarik.theblog.dao.converter;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.persistence.AttributeConverter;
/**
*
* @author cedric
*/
public class DateConverter implements AttributeConverter<Date, String> {
private final String pattern = "yyyy-MM-dd HH:mm:ss";
private final DateFormat format = new SimpleDateFormat(pattern);
@Override
public String convertToDatabaseColumn(Date date) {
if (date == null) {
return null;
}
return format.format(date);
}
@Override
public Date convertToEntityAttribute(String cell) {
if (cell == null) {
return null;
}
try {
return format.parse(cell);
} catch (ParseException ex) {
throw new IllegalArgumentException(cell + " can't parse with " + pattern, ex);
}
}
}
|
b8725d93-5372-4b8c-ab20-4d21241ab92d | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-09 11:47:22", "repo_name": "xiaohaoni/haotest", "sub_path": "/src/main/java/com/hao/mode/flyweight/AuthorizationFlyweight.java", "file_name": "AuthorizationFlyweight.java", "file_ext": "java", "file_size_in_byte": 1231, "line_count": 52, "lang": "en", "doc_type": "code", "blob_id": "755f29be3a5c8c36b52aa99fd3bd3530d5e68923", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/xiaohaoni/haotest | 293 | FILENAME: AuthorizationFlyweight.java | 0.281406 | package com.hao.mode.flyweight;
/**
* 封装授权数据中重复出现部分数据得享元对象
*
* @author zrh
* @version 1.0
* @date 2020-11-19 09:37
**/
public class AuthorizationFlyweight implements Flyweight{
/**
* 内部实体,安全实体
* */
private String securityEntity;
/**
* 内部状态 权限
* */
private String permit;
/**
* 构造方法,转入状态数据
* @param state 状态数据,包含安全实体喝权限得数据,用 ”,“分隔
* */
public AuthorizationFlyweight(String state){
String ss[] = state.split(",");
securityEntity = ss[0];
permit = ss[1];
}
public String getSecurityEntity() {
return securityEntity;
}
public String getPermit() {
return permit;
}
@Override
public boolean match(String securityEntity, String permit) {
return this.securityEntity.equals(securityEntity) && this.permit.equals(permit);
}
@Override
public String toString() {
return "AuthorizationFlyweight{" +
"securityEntity='" + securityEntity + '\'' +
", permit='" + permit + '\'' +
'}';
}
}
|
1f152020-9db4-4a67-b160-cb29851ac4e2 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-08-10 12:44:34", "repo_name": "RookieWangXF/Framework-base", "sub_path": "/DAOProject/src/main/java/cn/rookie/dbc/DatabaseConnection.java", "file_name": "DatabaseConnection.java", "file_ext": "java", "file_size_in_byte": 1134, "line_count": 46, "lang": "en", "doc_type": "code", "blob_id": "b259ccd5bfb760190abb7ed90362fcc53a583eeb", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/RookieWangXF/Framework-base | 224 | FILENAME: DatabaseConnection.java | 0.220007 | package cn.rookie.dbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
* Created by Rookie on 2016/4/13.
* Description:
* Project_name: DAOProject
* Copyright (c) All Rights Reserved.
*/
public class DatabaseConnection {
private static final String URL = "jdbc:mysql:///info";
private static final String USERNAME = "root";
private static final String PASSWD = "root";
private static final String DBDRIVER = "com.mysql.jdbc.Driver";
private Connection connection;
public DatabaseConnection() {
try {
Class.forName(DBDRIVER);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
this.connection = DriverManager.getConnection(URL, USERNAME, PASSWD);
} catch (SQLException e) {
e.printStackTrace();
}
}
public Connection getConnection() {
return this.connection;
}
public void close() {
try {
this.connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
|
f3f68c1a-f8dd-4028-940e-3e1c3df9ab3b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-01-11 00:41:06", "repo_name": "ibrahimyazar/Summer2019OnlineSelenium", "sub_path": "/src/test/java/test/day4_FindElements/ReadAttributeTest.java", "file_name": "ReadAttributeTest.java", "file_ext": "java", "file_size_in_byte": 1219, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "3e83d446dd69459befdce8787b69f761da477706", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ibrahimyazar/Summer2019OnlineSelenium | 248 | FILENAME: ReadAttributeTest.java | 0.27513 | package test.day4_FindElements;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import utils.BrowserFactory;
import utils.BrowserUtils;
public class ReadAttributeTest {
public static void main(String[] args) {
WebDriver driver = BrowserFactory.getDriver("chrome");
driver.get("http://practice.cybertekschool.com/forgot_password");
WebElement input = driver.findElement(By.name("email"));
System.out.println(input.getAttribute("pattern"));
input.sendKeys("randomemails@email.com");
System.out.println(input.getAttribute("value"));
WebElement retreviePasswordButton = driver.findElement(By.id("form_submit"));
String expectetresult1 = "[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,3}$";
String expectedresult2 = "randomemails@email.com";
if(expectetresult1.equals(input.getAttribute("pattern")) && expectedresult2.equals(input.getAttribute("value"))) {
System.out.println("Test passed");
}else{
System.out.println("Test failed");
}
retreviePasswordButton.submit();
BrowserUtils.wait(5);
driver.close();
}
}
|
d1b800df-dee3-4d10-a12e-3e29768ce8ed | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-22 16:38:47", "repo_name": "yaelna/microserviceExample", "sub_path": "/src/main/java/service/model/UpperResponseMsg.java", "file_name": "UpperResponseMsg.java", "file_ext": "java", "file_size_in_byte": 1158, "line_count": 48, "lang": "en", "doc_type": "code", "blob_id": "0965093347e1296d7d00a9e1911437c47487cc15", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/yaelna/microserviceExample | 235 | FILENAME: UpperResponseMsg.java | 0.280616 | package service.model;
import java.time.Instant;
import java.util.Objects;
public class UpperResponseMsg {
private Instant instant;
private String incomingMsg;
private String responseMsg;
public UpperResponseMsg(Instant instant, String incomingMsg, String responseMsg) {
this.instant = instant;
this.incomingMsg = incomingMsg;
this.responseMsg = responseMsg;
}
public Instant getInstance() {
return instant;
}
public String getIncomingMsg() {
return incomingMsg;
}
public String getResponseMsg() {
return responseMsg;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UpperResponseMsg that = (UpperResponseMsg) o;
return getInstance().equals(that.getInstance()) &&
getIncomingMsg().equals(that.getIncomingMsg()) &&
getResponseMsg().equals(that.getResponseMsg());
}
@Override
public int hashCode() {
return Objects.hash(getInstance(), getIncomingMsg(), getResponseMsg());
}
}
|
508624b8-e2ee-4096-abf3-431e034d97ab | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-06-08 03:27:44", "repo_name": "Blazej-Zielinski/My-Little-Savings", "sub_path": "/src/main/java/application/database/models/CategoryType.java", "file_name": "CategoryType.java", "file_ext": "java", "file_size_in_byte": 1082, "line_count": 64, "lang": "en", "doc_type": "code", "blob_id": "4efe6c18cb4b45ae4f761e0d5c5d0496137bdb53", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Blazej-Zielinski/My-Little-Savings | 245 | FILENAME: CategoryType.java | 0.235108 | package application.database.models;
import javax.persistence.*;
@Entity
@Table(name = "category_types")
public class CategoryType {
@Id
@Column(name = "id")
private Long id;
@Column(name = "name")
private String name;
@Column(name = "icon")
private String icon;
@Column(name = "color")
private String color;
public CategoryType() {
}
public CategoryType(Long id, String name, String icon, String color) {
this.id = id;
this.name = name;
this.icon = icon;
this.color = color;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
}
|
eb50d45d-2022-483d-8b12-85e677851f56 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2014-12-14 08:15:45", "repo_name": "Camambar/CheeseSqueeze", "sub_path": "/core/src/cheese/squeeze/gameObjects/Trap.java", "file_name": "Trap.java", "file_ext": "java", "file_size_in_byte": 1184, "line_count": 62, "lang": "en", "doc_type": "code", "blob_id": "4978d9a2e69814b14cde7e9c14628915876635f6", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Camambar/CheeseSqueeze | 269 | FILENAME: Trap.java | 0.286169 | package cheese.squeeze.gameObjects;
import cheese.squeeze.game.CSGame;
import cheese.squeeze.game.GameState;
import cheese.squeeze.helpers.AssetLoader;
import cheese.squeeze.tweenAccessors.MusicAccessor;
import cheese.squeeze.tweenAccessors.SoundAccessor;
import com.badlogic.gdx.math.Vector2;
public class Trap implements Goal{
private Vector2 position;
private boolean snapped = false;
private Line l;
/**
* The vector is the position of the end of the line were the trap must come
* @param point2
*/
public Trap(Line l) {
this.setPosition(l.getPoint2());
this.l = l;
}
public Trap() {
}
public Vector2 getPosition() {
return position;
}
public void setPosition(Vector2 position) {
this.position = position;
}
@Override
public void activate() {
snapped = true;
SoundAccessor.play(AssetLoader.death);
CSGame.currentState = GameState.GAMEOVER;
}
public boolean isSnapped() {
return snapped;
}
public Line getLine() {
return l;
}
public void setLine(Line l) {
this.setPosition(l.getPoint2());
this.l = l;
}
public Trap clone() {
return new Trap(l);
}
}
|
5e922576-a810-40d4-8d4b-31d7c9335185 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-07-26 23:31:54", "repo_name": "GDMSProduction/PocketPantry", "sub_path": "/GroceryAppV1/app/src/main/java/com/softwaredev/groceryappv1/EntryUI.java", "file_name": "EntryUI.java", "file_ext": "java", "file_size_in_byte": 1214, "line_count": 47, "lang": "en", "doc_type": "code", "blob_id": "d2844319a1fcb5b538f852d996f266b315cb7ad0", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/GDMSProduction/PocketPantry | 242 | FILENAME: EntryUI.java | 0.252384 | package com.softwaredev.groceryappv1;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
public class EntryUI extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_entry_ui);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
public void sendPantry(View v)
{
Intent pantryIntent = new Intent(this, PantryUI.class);
pantryIntent.putExtra("isPantry", true);
startActivity(pantryIntent);
}
public void sendGroc(View v)
{
Intent grocIntent = new Intent(this, PantryUI.class);
grocIntent.putExtra("isPantry", false);
startActivity(grocIntent);
}
public void sendRecipe(View v)
{
Intent recipeIntent = new Intent(this, RecipeList.class);
startActivity(recipeIntent);
}
public void sendHelp(View v)
{
Intent helpIntent = new Intent(this, HelpUI.class);
startActivity(helpIntent);
}
}
|
b345a5ba-f045-4721-8698-88fe0f6f5176 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-07-17 14:20:04", "repo_name": "vther/spring-demo", "sub_path": "/spring-data-jpa/src/main/java/com/vther/spring/data/jpa/entity/wiki/Address.java", "file_name": "Address.java", "file_ext": "java", "file_size_in_byte": 1157, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "b1ad4b6ed1d48299992a95e38b6795c0d67df6cd", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/vther/spring-demo | 244 | FILENAME: Address.java | 0.281406 | package com.vther.spring.data.jpa.entity.wiki;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.persistence.*;
@Getter
@Setter
@ToString
@Entity(name = "T_ADDRESS")
public class Address {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer addressId;
private String city;
private String street;
private String country;
private String postCode;
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL, targetEntity = Employee.class)
@JoinColumn(name = "EMPLOYEEID", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
private Employee owner;
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Address{");
sb.append("addressId=").append(addressId);
sb.append(", city='").append(city).append('\'');
sb.append(", street='").append(street).append('\'');
sb.append(", country='").append(country).append('\'');
sb.append(", postCode='").append(postCode).append('\'');
sb.append(", owner=").append(owner);
sb.append('}');
return sb.toString();
}
}
|
9fe92cf2-ef58-4239-afc5-c7e0e1b1c30f | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-01-13 19:37:11", "repo_name": "khoitnm/practice-spring-rest", "sub_path": "/pro01-client-server/client/src/main/java/org/tnmk/practicespringrest/client/item/service/ClientItemService.java", "file_name": "ClientItemService.java", "file_ext": "java", "file_size_in_byte": 1108, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "3e23e028992d6109ab3e78cc793cc1fafbc65be4", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/khoitnm/practice-spring-rest | 217 | FILENAME: ClientItemService.java | 0.293404 | package org.tnmk.practicespringrest.client.item.service;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.tnmk.practicespringrest.client.item.model.ClientItem;
import org.tnmk.practicespringrest.server.rest.dto.ServerItemDto;
@Service
public class ClientItemService {
@Autowired
private final ServerItemRestClient serverItemRestClient;
public ClientItemService(ServerItemRestClient serverItemRestClient) {
this.serverItemRestClient = serverItemRestClient;
}
public ClientItem addRandomItem(){
ServerItemDto serverItem = new ServerItemDto();
serverItem.setName("Item_"+System.nanoTime());
ServerItemDto createdServerItem = serverItemRestClient.createServerItem(serverItem);
ClientItem clientItem = new ClientItem();
BeanUtils.copyProperties(createdServerItem, clientItem);
return clientItem;
}
public void deleteItem(Integer itemId) {
serverItemRestClient.deleteServerItemById(itemId);
}
}
|
8c57401a-c7de-41de-91a3-d03e3a5e4ecc | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2013-08-04 15:40:48", "repo_name": "andyglick/javATE", "sub_path": "/authorizate/src/main/java/it/amattioli/authorizate/sessions/DefaultAuthorizationSession.java", "file_name": "DefaultAuthorizationSession.java", "file_ext": "java", "file_size_in_byte": 1136, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "073f689295fa9734c0ea12ce4cbdfb9545fb6fcb", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/andyglick/javATE | 227 | FILENAME: DefaultAuthorizationSession.java | 0.26971 | package it.amattioli.authorizate.sessions;
import it.amattioli.authorizate.AuthorizationManager;
import it.amattioli.authorizate.users.User;
import it.amattioli.authorizate.users.UserRepository;
import it.amattioli.dominate.RepositoryRegistry;
public class DefaultAuthorizationSession extends AuthorizationSession {
private static Class<? extends User> userClass;
public static Class<? extends User> getUserClass() {
return userClass;
}
public static void setUserClass(Class<? extends User> userClass) {
DefaultAuthorizationSession.userClass = userClass;
}
private User user;
private AuthorizationManager manager;
@Override
public AuthorizationManager getAuthorizationManager() {
return manager;
}
public void setAuthorizationManager(AuthorizationManager manager) {
this.manager = manager;
}
@Override
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public void setUser(String userName) {
this.user = ((UserRepository)RepositoryRegistry.instance().getRepository(userClass)).getByName(userName);
}
}
|
05cd0ed7-ed57-4214-bea7-d7502767d0d4 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2015-05-27 19:30:24", "repo_name": "Puharesource/Nuggit", "sub_path": "/src/main/java/io/puharesource/mc/nuggit/command/v2/AnnotationSubCommandExecutor.java", "file_name": "AnnotationSubCommandExecutor.java", "file_ext": "java", "file_size_in_byte": 1069, "line_count": 29, "lang": "en", "doc_type": "code", "blob_id": "6b32b74abb115a7f4f9f66ab5174cb522f4db900", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Puharesource/Nuggit | 204 | FILENAME: AnnotationSubCommandExecutor.java | 0.264358 | package io.puharesource.mc.nuggit.command.v2;
import io.puharesource.mc.nuggit.command.v1.SubCommandExecutor;
import lombok.NonNull;
import org.bukkit.command.CommandSender;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public final class AnnotationSubCommandExecutor extends SubCommandExecutor {
private final Method execute;
private final CommandContainer container;
public AnnotationSubCommandExecutor(@NonNull final SubCommand cmd, @NonNull final Method execute, @NonNull final CommandContainer container) {
super(cmd.name(), cmd.permission(), cmd.allowedSender(), cmd.usage(), cmd.description(), cmd.executionType(), cmd.aliases());
this.execute = execute;
this.container = container;
}
@Override
public void execute(String cmdName, String[] args, CommandSender sender) {
try {
execute.invoke(container, cmdName, args, sender);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
}
|
bca876d2-0916-4b3b-960b-f9b371ee1408 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2016-05-23 09:56:41", "repo_name": "Rukey7/DaggerStudy", "sub_path": "/app/src/main/java/com/dl7/daggerstudy/activity/BaseMarketActivity.java", "file_name": "BaseMarketActivity.java", "file_ext": "java", "file_size_in_byte": 1104, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "aea92f91f5228c1a9b64788334a7fd42eee91d94", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/Rukey7/DaggerStudy | 225 | FILENAME: BaseMarketActivity.java | 0.233706 | package com.dl7.daggerstudy.activity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import com.dl7.androidlib.activity.BaseActivity;
import com.dl7.daggerstudy.R;
/**
* Created by long on 2016/5/3.
*/
public abstract class BaseMarketActivity extends BaseActivity {
private boolean mHideSearchView = false;
protected void hideSearchView() {
mHideSearchView = true;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.market_toolbar, menu);
if (mHideSearchView) {
menu.removeItem(R.id.m_search);
}
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.m_search:
Log.e("BaseMarketActivity", "m_search");
break;
case R.id.m_download:
Log.e("BaseMarketActivity", "m_download");
break;
}
return super.onOptionsItemSelected(item);
}
}
|
e206c47c-19e1-4ab2-a1bf-5bb51edf64e6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-04-30 00:56:00", "repo_name": "alesalsa10/OOProgrammingWithJava-Part-II", "sub_path": "/week9-week9_26.PhoneSearch/src/Person.java", "file_name": "Person.java", "file_ext": "java", "file_size_in_byte": 1090, "line_count": 50, "lang": "en", "doc_type": "code", "blob_id": "a21076884135903cb1001011e17f19cec50770f3", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/alesalsa10/OOProgrammingWithJava-Part-II | 218 | FILENAME: Person.java | 0.268941 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author alesa
*/
import java.util.List;
import java.util.ArrayList;
public class Person {
private String name;
private List<String> phoneNumbers;
private List<String> address;
public Person(String name){
this.name = name;
this.phoneNumbers = new ArrayList<String>();
this.address = new ArrayList<String>();
}
public void addPhoneNumber(String phoneNumber){
phoneNumbers.add(phoneNumber);
}
public void addAddress(String street, String city){
this.address.add(street + city);
}
public String getName(){
return this.name;
}
public List<String> getNumber(){
return this.phoneNumbers;
}
public List<String> getAddress(){
return this.address;
}
public void removeInfo(){
phoneNumbers.clear();
address.clear();
}
}
|
2797cd90-a95d-4962-ad14-541ed8969478 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-20 15:00:24", "repo_name": "thanhtung100397/spring-rest-service-base", "sub_path": "/src/main/java/com/spring/baseproject/modules/auth/services/AuthorizationService.java", "file_name": "AuthorizationService.java", "file_ext": "java", "file_size_in_byte": 1104, "line_count": 28, "lang": "en", "doc_type": "code", "blob_id": "6efd89d946ec321c4d368bc5335e75dc043af7ea", "star_events_count": 7, "fork_events_count": 2, "src_encoding": "UTF-8"} | https://github.com/thanhtung100397/spring-rest-service-base | 173 | FILENAME: AuthorizationService.java | 0.252384 | package com.spring.baseproject.modules.auth.services;
import com.spring.baseproject.constants.ResponseValue;
import com.spring.baseproject.exceptions.auth.AuthorizationException;
import com.spring.baseproject.modules.auth.models.dtos.AuthorizedUser;
import com.spring.baseproject.modules.auth.repositories.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.stereotype.Service;
import java.util.Collection;
@Service
public class AuthorizationService implements IAuthorization {
@Autowired
private UserRepository userRepository;
@Override
public void authorizeUser(String method, String route,
AuthorizedUser authorizedUser, Collection<? extends GrantedAuthority> authorities)
throws AuthorizationException {
boolean authorizationResult = userRepository.isUserBanned(authorizedUser.getUserID());
if (authorizationResult) {
throw new AuthorizationException(ResponseValue.USER_BANNED);
}
}
}
|
e4f2e302-95ee-4eca-b8a8-12e377e46f25 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-04-06 11:55:30", "repo_name": "jasonyell/JasonyellCode", "sub_path": "/rocket2/stu-info-sys/src/main/java/com/jasonyell/util/JSONUtil.java", "file_name": "JSONUtil.java", "file_ext": "java", "file_size_in_byte": 1233, "line_count": 41, "lang": "en", "doc_type": "code", "blob_id": "aa95e74da3a3fc1377a6b0e72f5e9f14101ec748", "star_events_count": 2, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jasonyell/JasonyellCode | 262 | FILENAME: JSONUtil.java | 0.279042 | package com.jasonyell.util;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
/**
* @program: Fo
* @description
* @author: JasonYell
* @create: 2020-11-04 01:08
**/
public class JSONUtil {
private static final ObjectMapper M = new ObjectMapper();
static {
//设置序列化和反序列化的日期格式
M.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
}
//反序列化json字符串为java对象
public static <T> T read(InputStream is, Class<T> clazz){
try {
return M.readValue(is, clazz);
} catch (IOException e) {
throw new RuntimeException("json反序列化失败,传入的数据格式和class类型不匹配", e);
}
}
//序列化java对象为json字符串
public static String write(Object o){
try {
return M.writerWithDefaultPrettyPrinter().writeValueAsString(o);
} catch (JsonProcessingException e) {
throw new RuntimeException("json序列化失败", e);
}
}
}
|
d16bdb27-b0b5-4777-93e1-360ff19816ba | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-10-17 05:15:46", "repo_name": "chaokubi/wooxsoft", "sub_path": "/sso/src/com/mip/software/admin/controller/CommonVertifyController.java", "file_name": "CommonVertifyController.java", "file_ext": "java", "file_size_in_byte": 1217, "line_count": 43, "lang": "en", "doc_type": "code", "blob_id": "51ce977ec9819f9ac546dd6fb5676d538783c4ef", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/chaokubi/wooxsoft | 244 | FILENAME: CommonVertifyController.java | 0.268941 | package com.mip.software.admin.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.mip.software.admin.entity.CommonVertify;
import com.mip.software.admin.service.CommonVertifyService;
import com.mip.software.common.util.JsonHelper;
/**
* 审核日志
*/
@Controller
@RequestMapping("/admin/commonVertify")
public class CommonVertifyController extends BaseController{
public static JsonHelper util = new JsonHelper();
@Autowired
private CommonVertifyService commonVertifyService;
/**
* 保存信息
* @return
* @throws Exception
*/
@RequestMapping("/save")
public void saveCommonVertify(HttpServletRequest request,HttpServletResponse response,
CommonVertify commonVertify) {
try {
//commonVertifyService.saveCommonVertify(commonVertify, request);
util.toJsonMsg(response, 0, "操作成功");
} catch (Exception e) {
e.printStackTrace();
util.toJsonMsg(response, 1, "操作失败");
}
}
}
|
e585b827-c26d-401c-b192-cd7016a81c5b | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-09-16 12:49:21", "repo_name": "nskdd/springboot-web-data-jdbc", "sub_path": "/src/test/java/com/nieshenkuan/SpringbootWebDataJdbcApplicationTests.java", "file_name": "SpringbootWebDataJdbcApplicationTests.java", "file_ext": "java", "file_size_in_byte": 1025, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "76f4c9c056ce07583a2c80d0d29e836bc2454fcb", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/nskdd/springboot-web-data-jdbc | 196 | FILENAME: SpringbootWebDataJdbcApplicationTests.java | 0.221351 | package com.nieshenkuan;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
@RunWith(SpringRunner.class)
@SpringBootTest
public class SpringbootWebDataJdbcApplicationTests {
@Autowired
DataSource dataSource;
@Autowired
JdbcTemplate jdbcTemplate;
@Test
public void contextLoads() throws SQLException {
//class com.zaxxer.hikari.HikariDataSource 2.1.16版本
//class org.apache.tomcat.jdbc.pool.DataSource 1.5.10 版本
System.out.println(dataSource.getClass());
Connection connection = dataSource.getConnection();
System.out.println(connection);
connection.close();
System.out.println(jdbcTemplate);
}
}
|
0dad66f1-9876-4d7c-a63f-f800faf5e82c | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-09-17 15:27:20", "repo_name": "carlosmc23/ssi-testing-automation", "sub_path": "/src/main/java/org/umssdiplo/automationv01/core/managepage/Login/Login.java", "file_name": "Login.java", "file_ext": "java", "file_size_in_byte": 1087, "line_count": 36, "lang": "en", "doc_type": "code", "blob_id": "509cadf42b0aae4a3757d901c3c0a26b55316e81", "star_events_count": 0, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/carlosmc23/ssi-testing-automation | 227 | FILENAME: Login.java | 0.212069 | package org.umssdiplo.automationv01.core.managepage.Login;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.umssdiplo.automationv01.core.managepage.BasePage;
import org.umssdiplo.automationv01.core.utils.CommonEvents;
import org.umssdiplo.automationv01.core.utils.PropertyAccessor;
public class Login extends BasePage {
@FindBy(name = "username")
private WebElement userTextbox;
@FindBy(id = "password")
private WebElement passwordTextBox;
@FindBy(name = "submit")
private WebElement loginButton;
@FindBy(xpath = "//span[contains(text(),' Logout')]")
private WebElement logout;
public void login() {
String username = PropertyAccessor.getInstance().getUser();
String password = PropertyAccessor.getInstance().getPassword();
CommonEvents.setInputField(userTextbox, username);
CommonEvents.setInputField(passwordTextBox, password);
CommonEvents.clickButton(loginButton);
}
public void cerrarSesion() {
CommonEvents.clickButton(logout);
}
}
|
1bcb640b-3951-4a58-a5fb-0380fe5932d6 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-02-10 00:58:37", "repo_name": "jdcalderin/facturapp", "sub_path": "/app/src/main/java/com/bytecodr/invoicing/model/Cliente.java", "file_name": "Cliente.java", "file_ext": "java", "file_size_in_byte": 1219, "line_count": 63, "lang": "en", "doc_type": "code", "blob_id": "d7d34428ba256efd1f73a960b20069d1607d4b1e", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/jdcalderin/facturapp | 297 | FILENAME: Cliente.java | 0.262842 | package com.bytecodr.invoicing.model;
import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
import java.util.List;
/**
* Created by josedaniel on 25/12/16.
*/
@Table(name = "Clientes")
public class Cliente extends Model {
@Column(name = "Nit", unique = true)
public String Nit;
@Column(name = "Nombre")
public String Nombre;
@Column(name = "Email")
public String Email ;
@Column(name = "Telefono")
public String Telefono;
@Column(name = "Celular")
public String Celular;
@Column(name = "Direccion")
public String Direccion;
@Column(name = "PlazoDias")
public int PlazoDias ;
public Cliente(){
super();
}
public Cliente(int Id, String Nombre, String Email, String Telefono, String Celular, String Direccion, int PlazoDias)
{
super();
this.Nombre = Nombre;
this.Email = Email;
this.Telefono = Telefono;
this.Celular = Celular;
this.Direccion = Direccion;
this.PlazoDias = PlazoDias;
}
public List<Documento> documentos(){
return getMany(Documento.class, "Cliente");
}
}
|
ffa620a4-fbb5-4d6f-9a17-4b05c3fb8741 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-04-07 07:49:05", "repo_name": "mays1026/test", "sub_path": "/shop-web/src/main/java/org/fh/shop/admin/mays/web/action/logs/LogsController.java", "file_name": "LogsController.java", "file_ext": "java", "file_size_in_byte": 1166, "line_count": 44, "lang": "en", "doc_type": "code", "blob_id": "394d1f3e31cbaea7aec487f2c1715d5575721658", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mays1026/test | 251 | FILENAME: LogsController.java | 0.247987 | package org.fh.shop.admin.mays.web.action.logs;
import org.fh.shop.admin.mays.model.logs.LogsInfo;
import org.fh.shop.admin.mays.service.logs.ILogsService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/logs")
public class LogsController {
@Resource
private ILogsService logsService;
@RequestMapping("tologsMangerPage")
public String tologsMangerPage(){
return "logs/logsList";
}
/**
* 日志查询
*/
@RequestMapping("findLogsList")
@ResponseBody
public Map findLogsList(LogsInfo logsInfo){
Long count = logsService.countListSize(logsInfo);
List<LogsInfo> list = logsService.findLogsList(logsInfo);
Map map = new HashMap();
map.put("draw", logsInfo.getDraw());
map.put("recordsTotal", list.size());
map.put("recordsFiltered", count);
map.put("data", list);
return map;
}
}
|
872d4776-4064-4504-a428-c1a72ba70a1a | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2023-08-14 05:44:21", "repo_name": "zhouzgang/ecomb", "sub_path": "/ecomb-park/ecomb-park-class-load/src/main/java/cn/ecomb/park/classload/dynamic/ServiceProviderFactory.java", "file_name": "ServiceProviderFactory.java", "file_ext": "java", "file_size_in_byte": 1162, "line_count": 36, "lang": "zh", "doc_type": "code", "blob_id": "c36e5f7837c9c4643df29eb61e99826a96f9499a", "star_events_count": 3, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/zhouzgang/ecomb | 231 | FILENAME: ServiceProviderFactory.java | 0.27513 | package cn.ecomb.park.classload.dynamic;
import cn.ecomb.park.spi.IServiceProvider;
import java.net.URL;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Optional;
import java.util.ServiceLoader;
/**
* ServiceProvider 工厂类
*
* @author brian.zhou
* @date 2021/7/12
*/
public class ServiceProviderFactory {
ServiceLoader<IServiceProvider> serviceLoader = ServiceLoader.load(IServiceProvider.class);
public static void main(String[] args) {
// 如果之类没错的话,使用 jar 自己的,对应版本的load。
// ExtensionJarLoader extensionJarLoader =
// new ExtensionJarLoader(Thread.currentThread().getContextClassLoader().getParent());
ServiceLoader<IServiceProvider> serviceLoader = ServiceLoader.load(IServiceProvider.class, Thread.currentThread().getContextClassLoader().getParent());
// 这里浪费点性能,直接只要对应 jar 的功能
Iterator iterator = serviceLoader.iterator();
while (iterator.hasNext()) {
IServiceProvider item = (IServiceProvider) iterator.next();
item.sayHello();
}
}
}
|
4ee61ad0-c325-4a1b-ae2a-61c40b896669 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-08-26 08:27:31", "repo_name": "mosesgi/design-patterns", "sub_path": "/src/main/java/com/moses/designpatterns/proxy/YellowCow.java", "file_name": "YellowCow.java", "file_ext": "java", "file_size_in_byte": 1051, "line_count": 33, "lang": "en", "doc_type": "code", "blob_id": "51a0a111db8c420a230423f5c32811cb77b364df", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/mosesgi/design-patterns | 196 | FILENAME: YellowCow.java | 0.27048 | package com.moses.designpatterns.proxy;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
/**
* JDK Proxy API usage, 动态代理. 代理模式
*/
public class YellowCow implements InvocationHandler {
private Person person; //被代理对象
public Object getInstance(Person person) throws Exception{
this.person = person;
Class clazz = person.getClass();
System.out.println("被代理对象的class是: " + clazz);
return Proxy.newProxyInstance(clazz.getClassLoader(), clazz.getInterfaces(), this);
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
System.out.println("I'm YellowCow, I will buy ticket for you..");
System.out.println("------------------------------------------");
method.invoke(person, args);
System.out.println("------------------------------------------");
System.out.println("买到了.");
return null;
}
}
|
60db16bf-0576-4d6a-a3d9-822fe61add34 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2021-03-20 16:00:58", "repo_name": "NiFengGe123/JAVA-01", "sub_path": "/Week_02/src/main/java/com/nio/HttpClientTest.java", "file_name": "HttpClientTest.java", "file_ext": "java", "file_size_in_byte": 1243, "line_count": 38, "lang": "en", "doc_type": "code", "blob_id": "b6c07bd6f81773130f25b953f1dcb2097e3e1c0a", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/NiFengGe123/JAVA-01 | 261 | FILENAME: HttpClientTest.java | 0.224055 | package com.nio;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
/**
* Copyright (C), 2021
* FileName: HttpClientTest
* Author: xzw
* Date: 2021/1/22 21:00
* Description:
*/
public class HttpClientTest {
private static final String URL = "http://localhost:8081";
public static void main(String[] args) {
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(URL);
CloseableHttpResponse response = httpClient.execute(httpGet);
if (response.getStatusLine().getStatusCode() == 200){
HttpEntity entity = response.getEntity();
String result = EntityUtils.toString(entity,"utf-8");
System.out.println("服务返回值:"+result);
}else {
System.out.println(" 服务调用异常");
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
84dbb072-0911-49a4-ad5a-0db04dabb550 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "markdown", "committer_date": "2017-04-14T07:42:49", "repo_name": "damesek/clojure-nginx-setup-ssh", "sub_path": "/README.md", "file_name": "README.md", "file_ext": "md", "file_size_in_byte": 1073, "line_count": 28, "lang": "en", "doc_type": "text", "blob_id": "c8696d2f4457beadd74fe6685750cba151a4f71a", "star_events_count": 4, "fork_events_count": 1, "src_encoding": "UTF-8"} | https://github.com/damesek/clojure-nginx-setup-ssh | 307 | FILENAME: README.md | 0.23231 | # Clojure-nginx quick start/ setup
Quick Clojure-Nginx server setup with ssh file
I created a quick and easy start for Clojure-Nginx server on Ubuntu 14.04 Trusty. Around 50 steps in 1. If you don't want to create manually that is a great start. I added lein2, MongoDB, Redis for session handling, plus Nginx-Clojure package if you want to compile custom Nginx setup.
If you installed `lein` before this, please use this code:
```
lein -v
whereis lein
sudo mv [[whatyougetURL]] [[whatyougeturl]]1
```
Start the setup process run these lines:
``` ruby
sudo apt-get install git
git clone https://github.com/damesek/clojure-nginx-setup-ssh.git
cd clojure-nginx-setup-ssh
sudo sh nginx-clojure-server-setup.ssh
```
When the script will finish (few Y, agree etc), check your IP address/ or your domain:
- YOURIP:8080/clojure or YOURIP:8080
- domain:8080
Your Clojure-Nginx server is running now!
Put your project in the main folder. Do you need to drop uberjar compiled jars in the jars folder and you can reload the server with `./nginx -s reload`.
Have a nice day!
|
a54c4758-13e6-4070-9ba7-b5c4aed1d927 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2017-10-23 22:42:58", "repo_name": "klimmik/sandbox", "sub_path": "/2009/cmf-0.0.1/code/src/java/com/mks/domain/offer/TermsAndConditions.java", "file_name": "TermsAndConditions.java", "file_ext": "java", "file_size_in_byte": 1106, "line_count": 49, "lang": "en", "doc_type": "code", "blob_id": "3c7fd9710dd4ec46731f523e41eeca8455ce2c84", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/klimmik/sandbox | 239 | FILENAME: TermsAndConditions.java | 0.259826 | package com.mks.domain.offer;
import com.mks.domain.Identifiable;
import com.mks.domain.annotation.XEntity;
import com.mks.domain.annotation.XField;
import javax.persistence.*;
@Entity @Table(name = "TERMS_AND_CONDITIONS")
@XEntity(topLevel = true, url = "terms-and-conditions", displayProperty = "name")
public class TermsAndConditions implements Identifiable<Long> {
@Id
@GeneratedValue
@Column(name = "TERMS_AND_CONDITIONS_ID")
@XField
private Long id;
@Column(name = "NAME", nullable = false)
@XField
private String name;
@Column(name = "DESCRIPTION")
@XField
private String description;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
|
d559ed35-4fb9-4c63-bb85-83929f2282b5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-12-18 00:33:37", "repo_name": "ftk112233/meitiandeguanwang", "sub_path": "/src/main/java/com/mt/portalcms/service/impl/CmsSiteinfoServiceImpl.java", "file_name": "CmsSiteinfoServiceImpl.java", "file_ext": "java", "file_size_in_byte": 1135, "line_count": 37, "lang": "en", "doc_type": "code", "blob_id": "a3f39fad936c8aa496ed4ffb2ed5967a2723ce3f", "star_events_count": 1, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/ftk112233/meitiandeguanwang | 246 | FILENAME: CmsSiteinfoServiceImpl.java | 0.295027 | package com.mt.portalcms.service.impl;
import com.mt.portalcms.mapper.CmsSiteinfoMapper;
import com.mt.portalcms.pojo.CmsSiteinfo;
import com.mt.portalcms.service.ICmsSiteinfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.Date;
import java.util.List;
@Service
public class CmsSiteinfoServiceImpl implements ICmsSiteinfoService {
@Autowired
CmsSiteinfoMapper cmsSiteinfoMapper;
@Override
public List<CmsSiteinfo> findAll() {
return cmsSiteinfoMapper.selectAll();
}
@Override
public CmsSiteinfo findById(Long id) {
return cmsSiteinfoMapper.selectByPrimaryKey(id);
}
@Override
public Integer updateSiteInfo(CmsSiteinfo cmsSiteinfo) {
cmsSiteinfo.setUpdateTime(new Date());
Example example = new Example(CmsSiteinfo.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("id", cmsSiteinfo.getId());
return cmsSiteinfoMapper.updateByExampleSelective(cmsSiteinfo, example);
}
}
|
201c641c-24fb-4570-96a4-02ab6b5388ab | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2019-04-14 12:45:46", "repo_name": "artemesin/cybersportParser", "sub_path": "/src/main/java/Parser.java", "file_name": "Parser.java", "file_ext": "java", "file_size_in_byte": 1078, "line_count": 28, "lang": "en", "doc_type": "code", "blob_id": "3d9db7f13e6b6db20948cc726a7eb31afcf62720", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/artemesin/cybersportParser | 248 | FILENAME: Parser.java | 0.201813 | import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class Parser {
public static void main(String[] args) throws IOException {
List<PreveousMatch> preveousMatchList = new ArrayList<PreveousMatch>();
List<UpcommingMatch> upcommingMatchList = new ArrayList<UpcommingMatch>();
String urlPrevMatch = "https://www.cybersport.ru/base/match?disciplines=21&status=past&page=1";
String urlUpcomMatch = "https://www.cybersport.ru/base/match?disciplines=21&status=future&page=1";
Document docPrevMatch = Jsoup.connect(urlPrevMatch).get();
Document docUpcomMatch = Jsoup.connect(urlUpcomMatch).get();
Elements elementsPrev = docPrevMatch.getElementsByAttributeValue("class", "matches__item");
elementsPrev.forEach(elementsPrev ->{
Element element = elementsPrev.child(3);
String nameLeftTeam = element.attr("href");
});
}
}
|
db6adad6-effa-4787-98ef-0797083d8ff5 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2018-06-09 09:24:21", "repo_name": "m3ksyk/CL_WAR_Amelco_Repos_Reupload", "sub_path": "/Hibernate1/src/main/java/pl/coderslab/dao/PersonDao.java", "file_name": "PersonDao.java", "file_ext": "java", "file_size_in_byte": 1095, "line_count": 45, "lang": "en", "doc_type": "code", "blob_id": "0890c6d52188bbfe792fd2b8878ad2b58a30a3cf", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/m3ksyk/CL_WAR_Amelco_Repos_Reupload | 195 | FILENAME: PersonDao.java | 0.294215 | package pl.coderslab.dao;
import org.springframework.stereotype.Component;
import pl.coderslab.entity.Person;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.transaction.Transactional;
import java.util.List;
@Component
@Transactional
public class PersonDao {
@PersistenceContext
EntityManager entityManager;
public void savePerson(Person entity) {
entityManager.persist(entity);
}
public Person findById(long id) {
return entityManager.find(Person.class, id);
}
public void update(Person entity) {
entityManager.merge(entity);
}
public void delete(long id) {
Person entity = findById(id);
entityManager.remove(entityManager.contains(entity) ? entity : entityManager.merge(entity));
}
public List<Person> readAll(){
Query query = entityManager.createQuery("SELECT p FROM Person p "); //add join to make authors and publishers work?
List<Person> ppl = query.getResultList();
return ppl;
}
}
|
8fc99544-bc1b-47a1-81e6-3200e2c24561 | {"source": "refinecode", "ori_score": "", "domain": "code", "program_lang": "java", "committer_date": "2020-07-09 13:10:33", "repo_name": "bsankuratri/language-identifier", "sub_path": "/src/main/java/com/personal/languageidentifier/LanguageIdentifierApplication.java", "file_name": "LanguageIdentifierApplication.java", "file_ext": "java", "file_size_in_byte": 1118, "line_count": 32, "lang": "en", "doc_type": "code", "blob_id": "706299a105d513d0a33233223dafafc7126aeb37", "star_events_count": 0, "fork_events_count": 0, "src_encoding": "UTF-8"} | https://github.com/bsankuratri/language-identifier | 208 | FILENAME: LanguageIdentifierApplication.java | 0.220007 | package com.personal.languageidentifier;
import org.jsoup.Jsoup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
@SpringBootApplication
public class LanguageIdentifierApplication implements CommandLineRunner {
@Autowired
LanguageService languageService;
public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(LanguageIdentifierApplication.class, args);
context.close();
}
@Override
public void run(String... args) throws Exception {
String content = "<h3>Ça change vite: restons en contact.</h3><p>Rien ne semble correspondre à ton profil? Soumets ton CV et abonne-toi à nos alertes et notre infolettre: ça viendra!</p>";
String parsed = Jsoup.parse(content).text();
String language = languageService.determineLanguage(parsed);
System.out.println(language);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.