blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
53df3f7a34dcaed5aed994adfa754e0015604117 | f91a3991669100b8c145c1e442e34cc68943b3dc | /inner/src/main/java/com/gamesky/card/inner/controller/ContentHandler.java | a5dc2df750f856aca535ce01557c42ddf4caa825 | [] | no_license | lianghongbin/cardbox | ab8c68ca626f61a3af83970979e85142c9e1d076 | 7151338c479197668bf1d7930a46a37a19f56cef | refs/heads/master | 2021-01-10T08:43:52.749728 | 2015-11-17T06:51:09 | 2015-11-17T06:51:09 | 36,861,451 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 148 | java | package com.gamesky.card.inner.controller;
/**
* lianghongbin on 15/8/5.
*/
public interface ContentHandler<D> {
public void handle(D d);
}
| [
"lianghongbin@vip.sohu.com"
] | lianghongbin@vip.sohu.com |
abf6964a0eb2fb191e4dd4b854df205d6fa4666c | da68446ad3fa56c5d5f9a55b4428e21e0f0ed406 | /src/main/java/mac/appkit/enums/NSStackViewGravity.java | 01943e8b30d8a32c5793d63b219572ad0d55a91a | [] | no_license | multi-os-engine/moe-mac-core | 90d9764ab38807cac004aed70b68ca54c5c8a79b | 0ffb7b52af9cdd75f25b33d0c4723903a521d2f7 | refs/heads/master | 2020-04-06T06:58:01.357013 | 2016-08-09T18:57:05 | 2016-08-09T18:57:05 | 65,319,982 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,083 | java | /*
Copyright 2014-2016 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package mac.appkit.enums;
import org.moe.natj.general.ann.Generated;
@Generated
public final class NSStackViewGravity {
@Generated
private NSStackViewGravity() {
}
@Generated
public static final long Top = 0x0000000000000001L;
@Generated
public static final long Leading = 0x0000000000000001L;
@Generated
public static final long Center = 0x0000000000000002L;
@Generated
public static final long Bottom = 0x0000000000000003L;
@Generated
public static final long Trailing = 0x0000000000000003L;
}
| [
"alexey.suhov@intel.com"
] | alexey.suhov@intel.com |
a86e4239fbeeab25d9057b7bf28eb2e4afa393e7 | f5d71af461b1aee8b509dc85fe3b07aaa5c80e34 | /src/Chapter4/CompFuel.java | 46d02e005c2effc62fb51d71c1a7c3e6b47fabf4 | [] | no_license | Esmien/Shildt | 83815667650e5377ca92f23a3d1d5213ba270ed3 | 8c0233df290f9f12d4ddb7dd9d8693a9bed3d389 | refs/heads/master | 2020-08-11T21:05:58.242228 | 2019-10-12T10:26:19 | 2019-10-12T10:26:19 | 214,618,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | package Chapter4;
public class CompFuel {
public static void main(String[] args) {
Vehicle minivan = new Vehicle(7, 16, 21);
Vehicle sportscar = new Vehicle(2, 14, 12);
double gallons;
int dist = 252;
gallons = minivan.fuelneeded(dist);
System.out.println("Minivan needs " + gallons + " gallons of fuel to overcome " + dist + " miles.");
gallons = sportscar.fuelneeded(dist);
System.out.println("Sportscar needs " + gallons + " gallons of fuel to overcome " + dist + " miles.");
}
}
| [
"42712054+Esmien@users.noreply.github.com"
] | 42712054+Esmien@users.noreply.github.com |
6b6b4ae8c4aeed4fdd8fc1cfdb3435f6ca0a48a1 | eb55f2120008aaf634a30dc4102e41eb7b646288 | /src/com/company/Debt.java | 6adaee8749f48b56762207ce1d34d0019e9fc355 | [] | no_license | vladik1762/Client | ce12d681e5f23404c0aecccdf1b66febdb7baa97 | aa73d51bfafb4aaf122e337bdf1097ab1657d309 | refs/heads/master | 2023-01-31T09:33:45.683502 | 2020-12-13T19:36:23 | 2020-12-13T19:36:23 | 321,144,522 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 541 | java | package com.company;
public class Debt extends Operation {
private String destination;
private String kindOfDebt;
public String getDestination() {
return destination;
}
public void setDestination(String destination) {
this.destination = destination;
}
public String getKindOfDebt() {
return kindOfDebt;
}
public void setKindOfDebt(String kindOfDebt) {
this.kindOfDebt = kindOfDebt;
}
@Override
public String getType() {
return "Долг";
}
}
| [
"ostapko.01@mail.ru"
] | ostapko.01@mail.ru |
1ed22fe7adc854adf59633c2cdc6f7ff0e26398d | a8fa3df75b9be4daef1e9eade252a7bdc69e1177 | /src/main/java/com/imooc/o2o/dao/ShopDao.java | 248be09d9b1acd32c43ca5bb4b0315292bec50bb | [] | no_license | NJTKID/njtkidMaven | 1a33ce42c5ad65c38e6ee9062ab642d8c71317b5 | e0de461cbd2cfd5c272e3a42dff0776d72dd6908 | refs/heads/master | 2022-12-20T04:49:07.028341 | 2021-03-10T07:52:47 | 2021-03-10T07:52:47 | 243,459,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,102 | java | package com.imooc.o2o.dao;
import com.imooc.o2o.entity.ProductCategory;
import com.imooc.o2o.entity.Shop;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ShopDao {
/**
* 分页查询店铺,可输入的条件有:店铺名(模糊),店铺状态,店铺类别,区域ID,owner
* @param shopCondition
* @param rowIndex 从第几行开始取数据
* @param pageSize 返回的条数
*/
List<Shop> queryShopList(@Param("shopCondition") Shop shopCondition,@Param("rowIndex") int rowIndex,@Param("pageSize") int pageSize);
/**
*返回queryShopList总数
* @param shopCondition
* @return
*/
int queryShopCount(@Param("shopCondition") Shop shopCondition);
/**
* 通过shop id查询店铺
*
* @param shopId
* @return shop
*/
Shop queryByShopId(long shopId);
/**
* 新增店铺
* @param shop
* @return
*/
int insertShop(Shop shop);
/**
* 更新店铺
* @param shop
* @return
*/
int updateShop(Shop shop);
}
| [
"335600324@qq.com"
] | 335600324@qq.com |
2b44c3f1f2e06b59a04eda7a1ad5829b1f531a1d | b863a4cb472574417305d085d11155f05a31f2b5 | /src/goryachev/fxtexteditor/EditorSelection.java | 61d5177d5d686407d2b7d46cfb38292351a529c5 | [
"Apache-2.0"
] | permissive | andy-goryachev/FxTextEditor | 0d09a4eedb88bf4580b7d2647687124869b51877 | 44730cc1a24165c4214216cdbfaecb17d2949138 | refs/heads/master | 2023-02-23T19:46:15.865245 | 2023-02-06T00:18:56 | 2023-02-06T00:18:56 | 186,166,002 | 15 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,340 | java | // Copyright © 2017-2023 Andy Goryachev <andy@goryachev.com>
package goryachev.fxtexteditor;
import goryachev.common.util.CKit;
/**
* An immutable object that represents text selection within FxEditor.
* FxTextEditor supports neither multiple carets nor multiple selection segments.
*/
public class EditorSelection
{
public static final EditorSelection EMPTY = createEmpty();
private final SelectionSegment segment;
public EditorSelection(SelectionSegment segment)
{
this.segment = segment;
}
public String toString()
{
return CKit.toStringOrNull(segment);
}
private static EditorSelection createEmpty()
{
return new EditorSelection(new SelectionSegment(Marker.ZERO, Marker.ZERO, false));
}
/** returns original segment array */
public SelectionSegment getSegment()
{
return segment;
}
public boolean isEmpty()
{
return (segment == null);
}
public boolean isNotEmpty()
{
return !isEmpty();
}
public EditorSelection getSelection()
{
return new EditorSelection(segment);
}
public Marker getCaret()
{
if(isEmpty())
{
return null;
}
return segment.getCaret();
}
public Marker getAnchor()
{
if(isEmpty())
{
return null;
}
return segment.getAnchor();
}
}
| [
"andy@goryachev.com"
] | andy@goryachev.com |
e5e4ce4b9f8b0fa308022a7a58dd7a7beb397d41 | 3ba1e5505f66acef84427fe3819ddb53073dbc9f | /app/src/main/java/com/dyamail/gankapp/utils/PhoneUtils.java | 48d10d58e07fd86f24672d113670b8b4c37f999f | [] | no_license | dyamail/GankApp | fb6768c5cdf95dfb617dea997340dd3891fa505a | f9a71e3f03a7cf26862499d31737599151137467 | refs/heads/master | 2021-01-20T09:26:48.655521 | 2017-08-30T08:50:28 | 2017-08-30T08:50:28 | 101,594,957 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,010 | java | package com.dyamail.gankapp.utils;
import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.SystemClock;
import android.telephony.SmsManager;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.util.Xml;
import org.xmlpull.v1.XmlSerializer;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2016/08/02
* desc : 手机相关工具类
* </pre>
*/
public final class PhoneUtils {
private PhoneUtils() {
throw new UnsupportedOperationException("u can't instantiate me...");
}
/**
* 判断设备是否是手机
*
* @return {@code true}: 是<br>{@code false}: 否
*/
public static boolean isPhone() {
TelephonyManager tm = (TelephonyManager) Utils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
return tm != null && tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;
}
/**
* 获取IMEI码
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
*
* @return IMEI码
*/
@SuppressLint("HardwareIds")
public static String getIMEI() {
TelephonyManager tm = (TelephonyManager) Utils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
return tm != null ? tm.getDeviceId() : null;
}
/**
* 获取IMSI码
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
*
* @return IMSI码
*/
@SuppressLint("HardwareIds")
public static String getIMSI() {
TelephonyManager tm = (TelephonyManager) Utils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
return tm != null ? tm.getSubscriberId() : null;
}
/**
* 获取移动终端类型
*
* @return 手机制式
* <ul>
* <li>{@link TelephonyManager#PHONE_TYPE_NONE } : 0 手机制式未知</li>
* <li>{@link TelephonyManager#PHONE_TYPE_GSM } : 1 手机制式为GSM,移动和联通</li>
* <li>{@link TelephonyManager#PHONE_TYPE_CDMA } : 2 手机制式为CDMA,电信</li>
* <li>{@link TelephonyManager#PHONE_TYPE_SIP } : 3</li>
* </ul>
*/
public static int getPhoneType() {
TelephonyManager tm = (TelephonyManager) Utils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
return tm != null ? tm.getPhoneType() : -1;
}
/**
* 判断sim卡是否准备好
*
* @return {@code true}: 是<br>{@code false}: 否
*/
public static boolean isSimCardReady() {
TelephonyManager tm = (TelephonyManager) Utils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
return tm != null && tm.getSimState() == TelephonyManager.SIM_STATE_READY;
}
/**
* 获取Sim卡运营商名称
* <p>中国移动、如中国联通、中国电信</p>
*
* @return sim卡运营商名称
*/
public static String getSimOperatorName() {
TelephonyManager tm = (TelephonyManager) Utils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
return tm != null ? tm.getSimOperatorName() : null;
}
/**
* 获取Sim卡运营商名称
* <p>中国移动、如中国联通、中国电信</p>
*
* @return 移动网络运营商名称
*/
public static String getSimOperatorByMnc() {
TelephonyManager tm = (TelephonyManager) Utils.getContext().getSystemService(Context.TELEPHONY_SERVICE);
String operator = tm != null ? tm.getSimOperator() : null;
if (operator == null) return null;
switch (operator) {
case "46000":
case "46002":
case "46007":
return "中国移动";
case "46001":
return "中国联通";
case "46003":
return "中国电信";
default:
return operator;
}
}
/**
* 获取手机状态信息
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
*
* @return DeviceId(IMEI) = 99000311726612<br>
* DeviceSoftwareVersion = 00<br>
* Line1Number =<br>
* NetworkCountryIso = cn<br>
* NetworkOperator = 46003<br>
* NetworkOperatorName = 中国电信<br>
* NetworkType = 6<br>
* honeType = 2<br>
* SimCountryIso = cn<br>
* SimOperator = 46003<br>
* SimOperatorName = 中国电信<br>
* SimSerialNumber = 89860315045710604022<br>
* SimState = 5<br>
* SubscriberId(IMSI) = 460030419724900<br>
* VoiceMailNumber = *86<br>
*/
@SuppressLint("HardwareIds")
public static String getPhoneStatus() {
TelephonyManager tm = (TelephonyManager) Utils.getContext()
.getSystemService(Context.TELEPHONY_SERVICE);
String str = "";
str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\n";
str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + "\n";
str += "Line1Number = " + tm.getLine1Number() + "\n";
str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\n";
str += "NetworkOperator = " + tm.getNetworkOperator() + "\n";
str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\n";
str += "NetworkType = " + tm.getNetworkType() + "\n";
str += "PhoneType = " + tm.getPhoneType() + "\n";
str += "SimCountryIso = " + tm.getSimCountryIso() + "\n";
str += "SimOperator = " + tm.getSimOperator() + "\n";
str += "SimOperatorName = " + tm.getSimOperatorName() + "\n";
str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\n";
str += "SimState = " + tm.getSimState() + "\n";
str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\n";
str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\n";
return str;
}
/**
* 跳至拨号界面
*
* @param phoneNumber 电话号码
*/
public static void dial(final String phoneNumber) {
Utils.getContext().startActivity(IntentUtils.getDialIntent(phoneNumber));
}
/**
* 拨打电话
* <p>需添加权限 {@code <uses-permission android:name="android.permission.CALL_PHONE"/>}</p>
*
* @param phoneNumber 电话号码
*/
public static void call(final String phoneNumber) {
Utils.getContext().startActivity(IntentUtils.getCallIntent(phoneNumber));
}
/**
* 跳至发送短信界面
*
* @param phoneNumber 接收号码
* @param content 短信内容
*/
public static void sendSms(final String phoneNumber, final String content) {
Utils.getContext().startActivity(IntentUtils.getSendSmsIntent(phoneNumber, content));
}
/**
* 发送短信
* <p>需添加权限 {@code <uses-permission android:name="android.permission.SEND_SMS"/>}</p>
*
* @param phoneNumber 接收号码
* @param content 短信内容
*/
public static void sendSmsSilent(final String phoneNumber, final String content) {
if (StringUtils.isEmpty(content)) return;
PendingIntent sentIntent = PendingIntent.getBroadcast(Utils.getContext(), 0, new Intent(), 0);
SmsManager smsManager = SmsManager.getDefault();
if (content.length() >= 70) {
List<String> ms = smsManager.divideMessage(content);
for (String str : ms) {
smsManager.sendTextMessage(phoneNumber, null, str, sentIntent, null);
}
} else {
smsManager.sendTextMessage(phoneNumber, null, content, sentIntent, null);
}
}
/**
* 获取手机联系人
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>}</p>
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_CONTACTS"/>}</p>
*
* @return 联系人链表
*/
public static List<HashMap<String, String>> getAllContactInfo() {
SystemClock.sleep(3000);
ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
// 1.获取内容解析者
ContentResolver resolver = Utils.getContext().getContentResolver();
// 2.获取内容提供者的地址:com.android.contacts
// raw_contacts表的地址 :raw_contacts
// view_data表的地址 : data
// 3.生成查询地址
Uri raw_uri = Uri.parse("content://com.android.contacts/raw_contacts");
Uri date_uri = Uri.parse("content://com.android.contacts/data");
// 4.查询操作,先查询raw_contacts,查询contact_id
// projection : 查询的字段
Cursor cursor = resolver.query(raw_uri, new String[]{"contact_id"}, null, null, null);
try {
// 5.解析cursor
if (cursor != null) {
while (cursor.moveToNext()) {
// 6.获取查询的数据
String contact_id = cursor.getString(0);
// cursor.getString(cursor.getColumnIndex("contact_id"));//getColumnIndex
// : 查询字段在cursor中索引值,一般都是用在查询字段比较多的时候
// 判断contact_id是否为空
if (!StringUtils.isEmpty(contact_id)) {//null ""
// 7.根据contact_id查询view_data表中的数据
// selection : 查询条件
// selectionArgs :查询条件的参数
// sortOrder : 排序
// 空指针: 1.null.方法 2.参数为null
Cursor c = resolver.query(date_uri, new String[]{"data1",
"mimetype"}, "raw_contact_id=?",
new String[]{contact_id}, null);
HashMap<String, String> map = new HashMap<String, String>();
// 8.解析c
if (c != null) {
while (c.moveToNext()) {
// 9.获取数据
String data1 = c.getString(0);
String mimetype = c.getString(1);
// 10.根据类型去判断获取的data1数据并保存
if (mimetype.equals("vnd.android.cursor.item/phone_v2")) {
// 电话
map.put("phone", data1);
} else if (mimetype.equals("vnd.android.cursor.item/name")) {
// 姓名
map.put("name", data1);
}
}
}
// 11.添加到集合中数据
list.add(map);
// 12.关闭cursor
if (c != null) {
c.close();
}
}
}
}
} finally {
// 12.关闭cursor
if (cursor != null) {
cursor.close();
}
}
return list;
}
/**
* 打开手机联系人界面点击联系人后便获取该号码
* <p>参照以下注释代码</p>
*/
public static void getContactNum() {
Log.d("tips", "U should copy the following code.");
/*
Intent intent = new Intent();
intent.setAction("android.intent.action.PICK");
intent.setType("vnd.android.cursor.dir/phone_v2");
startActivityForResult(intent, 0);
@Override
protected void onActivityResult ( int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);
if (data != null) {
Uri uri = data.getData();
String num = null;
// 创建内容解析者
ContentResolver contentResolver = getContentResolver();
Cursor cursor = contentResolver.query(uri,
null, null, null, null);
while (cursor.moveToNext()) {
num = cursor.getString(cursor.getColumnIndex("data1"));
}
cursor.close();
num = num.replaceAll("-", "");//替换的操作,555-6 -> 5556
}
}
*/
}
/**
* 获取手机短信并保存到xml中
* <p>需添加权限 {@code <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>}</p>
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_SMS"/>}</p>
*/
public static void getAllSMS() {
// 1.获取短信
// 1.1获取内容解析者
ContentResolver resolver = Utils.getContext().getContentResolver();
// 1.2获取内容提供者地址 sms,sms表的地址:null 不写
// 1.3获取查询路径
Uri uri = Uri.parse("content://sms");
// 1.4.查询操作
// projection : 查询的字段
// selection : 查询的条件
// selectionArgs : 查询条件的参数
// sortOrder : 排序
Cursor cursor = resolver.query(uri, new String[]{"address", "date", "type", "body"}, null, null, null);
// 设置最大进度
int count = cursor.getCount();//获取短信的个数
// 2.备份短信
// 2.1获取xml序列器
XmlSerializer xmlSerializer = Xml.newSerializer();
try {
// 2.2设置xml文件保存的路径
// os : 保存的位置
// encoding : 编码格式
xmlSerializer.setOutput(new FileOutputStream(new File("/mnt/sdcard/backupsms.xml")), "utf-8");
// 2.3设置头信息
// standalone : 是否独立保存
xmlSerializer.startDocument("utf-8", true);
// 2.4设置根标签
xmlSerializer.startTag(null, "smss");
// 1.5.解析cursor
while (cursor.moveToNext()) {
SystemClock.sleep(1000);
// 2.5设置短信的标签
xmlSerializer.startTag(null, "sms");
// 2.6设置文本内容的标签
xmlSerializer.startTag(null, "address");
String address = cursor.getString(0);
// 2.7设置文本内容
xmlSerializer.text(address);
xmlSerializer.endTag(null, "address");
xmlSerializer.startTag(null, "date");
String date = cursor.getString(1);
xmlSerializer.text(date);
xmlSerializer.endTag(null, "date");
xmlSerializer.startTag(null, "type");
String type = cursor.getString(2);
xmlSerializer.text(type);
xmlSerializer.endTag(null, "type");
xmlSerializer.startTag(null, "body");
String body = cursor.getString(3);
xmlSerializer.text(body);
xmlSerializer.endTag(null, "body");
xmlSerializer.endTag(null, "sms");
System.out.println("address:" + address + " date:" + date + " type:" + type + " body:" + body);
}
xmlSerializer.endTag(null, "smss");
xmlSerializer.endDocument();
// 2.8将数据刷新到文件中
xmlSerializer.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"dyamail917@gmail.com"
] | dyamail917@gmail.com |
bd6f1ec2f0acbfb7ab9b2c7420cef052c6505a93 | a0167f108a63128cf5c8ce15f4911682fc0ba691 | /financep2p/financep2p_action/src/main/java/zyk/finance/action/filter/GetHttpResponseHeader.java | 3f982888e04a1ff5cc02a21763fc7c7f10cd608c | [] | no_license | zhouyankun/Finance_P2P | 755ae5404013fb40c7056f07ff15eb212fc7d9b4 | 5c78b47b4018eb68c6c1685ace76d065fa99f040 | refs/heads/master | 2021-04-15T04:15:37.122234 | 2018-03-26T06:21:44 | 2018-03-26T06:21:44 | 126,487,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,424 | java | package zyk.finance.action.filter;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.springframework.data.redis.core.RedisTemplate;
import zyk.finance.cache.BaseCacheService;
import zyk.finance.service.util.SpringContext;
import zyk.finance.utils.ConfigurableConstants;
public class GetHttpResponseHeader {
private static BaseCacheService baseCacheService = (BaseCacheService) SpringContext.getInstance().getBean("redisCache");
private static RedisTemplate<String, Object> redisTemplate;
/**
* @param request
* @return
*/
public static String getHeadersInfo(HttpServletRequest request) {
Map<String, String> map = new HashMap<String, String>();
Enumeration headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String key = (String) headerNames.nextElement();
String value = request.getHeader(key);
map.put(key, value);
}
String token=map.get("token"); //获取token
if (!StringUtils.isEmpty(token)) { // 判断token是否为空,如果token不为空,取消失效时间,重新设置失效时间
baseCacheService.setPersist(token);
String tokenValid=ConfigurableConstants.getProperty("token.validity", "30");
baseCacheService.expire(token, Integer.parseInt(tokenValid)*60);//设置过期时间
}
return token;
}
} | [
"s_zhouyk@jiedaibao.com"
] | s_zhouyk@jiedaibao.com |
f5fb9b2f619f31f7523605b056570e0dda6d8bff | a00326c0e2fc8944112589cd2ad638b278f058b9 | /src/main/java/000/129/478/CWE190_Integer_Overflow__int_getParameter_Servlet_add_66b.java | 1e7ab2ad09a1a28d10b534a72b5181963ddfb3e1 | [] | no_license | Lanhbao/Static-Testing-for-Juliet-Test-Suite | 6fd3f62713be7a084260eafa9ab221b1b9833be6 | b095b11c7cb6d4a5bb2b76181e35d6ee00e96e68 | refs/heads/master | 2020-08-24T13:34:04.004149 | 2019-10-25T09:26:00 | 2019-10-25T09:26:00 | 216,822,684 | 0 | 1 | null | 2019-11-08T09:51:54 | 2019-10-22T13:37:13 | Java | UTF-8 | Java | false | false | 2,058 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__int_getParameter_Servlet_add_66b.java
Label Definition File: CWE190_Integer_Overflow__int.label.xml
Template File: sources-sinks-66b.tmpl.java
*/
/*
* @description
* CWE: 190 Integer Overflow
* BadSource: getParameter_Servlet Read data from a querystring using getParameter()
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks: add
* GoodSink: Ensure there will not be an overflow before adding 1 to data
* BadSink : Add 1 to data, which can cause an overflow
* Flow Variant: 66 Data flow: data passed in an array from one method to another in different source files in the same package
*
* */
import javax.servlet.http.*;
public class CWE190_Integer_Overflow__int_getParameter_Servlet_add_66b
{
public void badSink(int dataArray[] , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
int data = dataArray[2];
/* POTENTIAL FLAW: if data == Integer.MAX_VALUE, this will overflow */
int result = (int)(data + 1);
IO.writeLine("result: " + result);
}
/* goodG2B() - use goodsource and badsink */
public void goodG2BSink(int dataArray[] , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
int data = dataArray[2];
/* POTENTIAL FLAW: if data == Integer.MAX_VALUE, this will overflow */
int result = (int)(data + 1);
IO.writeLine("result: " + result);
}
/* goodB2G() - use badsource and goodsink */
public void goodB2GSink(int dataArray[] , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
int data = dataArray[2];
/* FIX: Add a check to prevent an overflow from occurring */
if (data < Integer.MAX_VALUE)
{
int result = (int)(data + 1);
IO.writeLine("result: " + result);
}
else
{
IO.writeLine("data value is too large to perform addition.");
}
}
}
| [
"anhtluet12@gmail.com"
] | anhtluet12@gmail.com |
7446651d22690c23c3a467ce10067a87ab25b118 | 134581bf28ed36991b2a79e4443751afd9d0fa5f | /wms/src/main/java/com/free4lab/account/annotation/util/PrivacyUtil.java | 8eacae926a9f9331be7b04f60ee5eb1e66b17d36 | [
"MIT"
] | permissive | zihanbobo/WebRTC | b6e8b111d71ef325a3ce8ac2895475c78461b19f | 0044d07f8b96fb6ed8439b75864b65f525092800 | refs/heads/master | 2021-06-13T05:44:42.591871 | 2017-03-10T02:20:19 | 2017-03-10T02:20:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 800 | java | /**
* File: PrivacyUtil.java
* Author: weed
* Create Time: 2013-4-3
*/
package com.free4lab.account.annotation.util;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import com.free4lab.account.annotation.Privacy;
/**
* @author weed
*
*/
public class PrivacyUtil {
public static void setPrivacyByAnnotaion(Object o, String key, String value)
throws IllegalArgumentException, IllegalAccessException,
InvocationTargetException {
Method[] methods = o.getClass().getMethods();
for (Method m : methods) {
if (m.getName().startsWith("set")) {
String annoKey = m.getAnnotation(Privacy.class).key();
if (annoKey != null && annoKey.equals(key)) {
m.invoke(o, value);
break;
}
}
}
}
}
| [
"puqian1992@163.com"
] | puqian1992@163.com |
d56a4021ffc5482fe69262c43241d31fed382d0a | 327974f3330a7b609905205ee74724f23952dabb | /src/main/java/com/lp2/equipos_app/modelo/Equipo.java | f3c81a0a485c95b527966992fbeb299e6c95c61c | [] | no_license | cheloesperguel/equipo_app_spring | 660424eb3abc07b064ccc4394803977ee1562bb7 | 9790e1df166b8a2cf1859f2e9dff9723da5fe01b | refs/heads/master | 2020-05-31T17:45:15.519878 | 2019-06-05T15:05:26 | 2019-06-05T15:05:26 | 190,416,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,697 | java | /*
* 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.lp2.equipos_app.modelo;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
/**
*
* @author Marcelo Esperguel
*/
@Entity
@Table(name = "equipo")
@NamedQueries({
@NamedQuery(name = "Equipo.findAll", query = "SELECT e FROM Equipo e")})
public class Equipo implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Size(max = 255)
@Column(name = "nombre")
private String nombre;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "idEquipo", fetch = FetchType.LAZY)
private List<Jugador> jugadorList;
public Equipo() {
}
public Equipo(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public List<Jugador> getJugadorList() {
return jugadorList;
}
public void setJugadorList(List<Jugador> jugadorList) {
this.jugadorList = jugadorList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Equipo)) {
return false;
}
Equipo other = (Equipo) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.lp2.equipos_app.modelo.Equipo[ id=" + id + " ]";
}
}
| [
"chelo.esperguel@gmail.com"
] | chelo.esperguel@gmail.com |
96f9094270c4509bd3ca6b2be1d9147442e8a40a | c7116095ce5082db69eab7a5b3b60ff6c5235c17 | /Laborator04/ContactsManager/app/src/main/java/lab04/eim/systems/cs/pub/ro/contactsmanager/MainActivity.java | e757fa1811631ba7b745f69128576802e2bea9a0 | [] | no_license | Meehai/EIM-Labs-2016 | 9dd298aa0d4bded7a5ccdafe4276a1fc774628c5 | 7b2808728704c118bb677eb323f9e19bc3b41266 | refs/heads/master | 2021-01-18T21:56:48.287760 | 2016-05-21T13:55:21 | 2016-05-21T13:55:21 | 53,205,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,839 | java | package lab04.eim.systems.cs.pub.ro.contactsmanager;
import android.app.Activity;
import android.content.ContentValues;
import android.content.Intent;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.widget.ToggleButton;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
private Button saveButton, cancelButton;
private ToggleButton additionalFieldsButton;
private EditText nameText, phoneText, emailText, addressText, jobTitleText, companyNameText,
websiteText, IMText;
private void changeButtonsVisibility() {
jobTitleText.setVisibility(additionalFieldsButton.isChecked() ?
View.VISIBLE : View.GONE);
companyNameText.setVisibility(additionalFieldsButton.isChecked() ?
View.VISIBLE : View.GONE);
websiteText.setVisibility(additionalFieldsButton.isChecked() ?
View.VISIBLE : View.GONE);
IMText.setVisibility(additionalFieldsButton.isChecked() ?
View.VISIBLE : View.GONE);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
additionalFieldsButton = (ToggleButton)findViewById(R.id.aditional_fields_button);
saveButton = (Button)findViewById(R.id.save_button);
cancelButton = (Button)findViewById(R.id.cancel_action);
nameText = (EditText)findViewById(R.id.name_text);
phoneText = (EditText)findViewById(R.id.phone_number_text);
emailText = (EditText)findViewById(R.id.email_text);
addressText = (EditText)findViewById(R.id.address_text);
jobTitleText = (EditText)findViewById(R.id.job_title);
companyNameText = (EditText)findViewById(R.id.company_name);
websiteText = (EditText)findViewById(R.id.web_site);
IMText = (EditText)findViewById(R.id.IM);
if(savedInstanceState != null)
this.changeButtonsVisibility();
Intent intent = getIntent();
if (intent != null) {
String phone = intent.getStringExtra("ro.pub.cs.systems.eim.lab04.contactsmanager.PHONE_NUMBER_KEY");
if (phone != null) {
phoneText.setText(phone);
} else {
Toast.makeText(this, getResources().getString(R.string.phone_error), Toast.LENGTH_LONG).show();
}
}
View.OnClickListener buttonListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
switch(v.getId()) {
case R.id.aditional_fields_button:
changeButtonsVisibility();
break;
case R.id.cancel_action:
setResult(Activity.RESULT_CANCELED, new Intent());
finish();
break;
case R.id.save_button:
Intent intent = new Intent(ContactsContract.Intents.Insert.ACTION);
intent.setType(ContactsContract.RawContacts.CONTENT_TYPE);
if (nameText != null) {
intent.putExtra(ContactsContract.Intents.Insert.NAME,
nameText.getText().toString());
}
if (phoneText != null) {
intent.putExtra(ContactsContract.Intents.Insert.PHONE,
phoneText.getText().toString());
}
if (emailText != null) {
intent.putExtra(ContactsContract.Intents.Insert.EMAIL,
emailText.getText().toString());
}
if (addressText != null) {
intent.putExtra(ContactsContract.Intents.Insert.POSTAL,
addressText.getText().toString());
}
if (jobTitleText != null) {
intent.putExtra(ContactsContract.Intents.Insert.JOB_TITLE,
jobTitleText.getText().toString());
}
if (companyNameText != null) {
intent.putExtra(ContactsContract.Intents.Insert.COMPANY,
companyNameText.getText().toString());
}
ArrayList<ContentValues> contactData = new ArrayList<ContentValues>();
if (websiteText != null) {
ContentValues websiteRow = new ContentValues();
websiteRow.put(ContactsContract.Data.MIMETYPE,
ContactsContract.CommonDataKinds.Website.CONTENT_ITEM_TYPE);
websiteRow.put(ContactsContract.CommonDataKinds.Website.URL,
websiteText.getText().toString());
contactData.add(websiteRow);
}
if (IMText != null) {
ContentValues imRow = new ContentValues();
imRow.put(ContactsContract.Data.MIMETYPE,
ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE);
imRow.put(ContactsContract.CommonDataKinds.Im.DATA,
IMText.getText().toString());
contactData.add(imRow);
}
intent.putParcelableArrayListExtra(ContactsContract.Intents.Insert.DATA,
contactData);
startActivityForResult(intent, Constants.CONTACTS_MANAGER_REQUEST_CODE);
break;
}
}
};
additionalFieldsButton.setOnClickListener(buttonListener);
saveButton.setOnClickListener(buttonListener);
cancelButton.setOnClickListener(buttonListener);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void onRestoreInstanceState(Bundle savedState) {
super.onRestoreInstanceState(savedState);
this.changeButtonsVisibility();
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
switch(requestCode) {
case Constants.CONTACTS_MANAGER_REQUEST_CODE:
setResult(resultCode, new Intent());
finish();
break;
}
}
}
| [
"mihaicristianpirvu@gmail.com"
] | mihaicristianpirvu@gmail.com |
50971ec62b3ddc8559ee70df94481375a75d819e | 166ea65ce52b48df3c186d8bd3be15882e7f6f55 | /src/main/java/repository/user/SQL_Server_UserDAO.java | 72cf04725def9474d9af33a85e9edda6bce12212 | [] | no_license | lisek96/WarCardGame | e857ec5f9625f49ba203f0b5cdeaf552047596f0 | 273dcf4449b671c69168b99b553cc4f292994cf0 | refs/heads/main | 2023-03-19T06:13:50.191817 | 2021-03-09T02:30:45 | 2021-03-09T02:30:45 | 337,875,419 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,561 | java | package repository.user;
import model.user.User;
import repository.utils.Helper;
import repository.connection.SQL_Server_DBConnectionProvider;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
public class SQL_Server_UserDAO implements UserDAO {
@Override
public void create(User user) {
CallableStatement callableStatement = null;
SQL_Server_DBConnectionProvider sql_server_dbConnectionProvider = new SQL_Server_DBConnectionProvider();
try (Connection connection = sql_server_dbConnectionProvider.provideConnection()) {
String sql = "EXEC createNewUser ?, ?, ?, ?";
callableStatement = connection.prepareCall(sql);
callableStatement.setEscapeProcessing(true);
callableStatement.setString(1, user.getLogin());
callableStatement.setString(2, user.getSalt());
callableStatement.setString(3, user.getPassword());
callableStatement.setString(4, user.getEmail());
callableStatement.execute();
} catch (SQLException e ){
e.printStackTrace();
}
}
@Override
public Integer getIDByLogin(String login) {
CallableStatement callableStatement = null;
SQL_Server_DBConnectionProvider sql_server_dbConnectionProvider = new SQL_Server_DBConnectionProvider();
try
(Connection connection = sql_server_dbConnectionProvider.provideConnection()) {
String sql = "EXEC getIDByLogin ?";
callableStatement = connection.prepareCall(sql);
callableStatement.setEscapeProcessing(true);
callableStatement.setString(1, login);
ResultSet resultSet = callableStatement.executeQuery();
if (resultSet.next()) return resultSet.getInt(1);
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
@Override
public Integer getIDByEmail(String email) {
CallableStatement callableStatement;
SQL_Server_DBConnectionProvider sql_server_dbConnectionProvider = new SQL_Server_DBConnectionProvider();
try (Connection connection = sql_server_dbConnectionProvider.provideConnection()) {
String sql = "EXEC getIDByEmail ?";
callableStatement = connection.prepareCall(sql);
callableStatement.setEscapeProcessing(true);
callableStatement.setString(1, email);
ResultSet resultSet = callableStatement.executeQuery();
if (resultSet.next()) return resultSet.getInt(1);
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
@Override
public String[] getIdAndEmailByLogin(String login) {
CallableStatement callableStatement;
SQL_Server_DBConnectionProvider sql_server_dbConnectionProvider = new SQL_Server_DBConnectionProvider();
try (Connection connection = sql_server_dbConnectionProvider.provideConnection()) {
String sql = "EXEC getIdAndEmailByLogin ?";
callableStatement = connection.prepareCall(sql);
callableStatement.setEscapeProcessing(true);
callableStatement.setString(1, login);
ResultSet rs = callableStatement.executeQuery();
rs.next();
return new String[]{rs.getString(1), rs.getString(2)};
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
@Override
public String getEmailByLogin(String login) {
CallableStatement callableStatement;
SQL_Server_DBConnectionProvider sql_server_dbConnectionProvider = new SQL_Server_DBConnectionProvider();
try
(Connection connection = sql_server_dbConnectionProvider.provideConnection()) {
String sql = "EXEC getEmailByLogin ?";
callableStatement = connection.prepareCall(sql);
callableStatement.setEscapeProcessing(true);
callableStatement.setString(1, login);
ResultSet resultSet = callableStatement.executeQuery();
if (resultSet.next()) return resultSet.getString(1);
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
@Override
public String getPasswordByLogin(String login) {
CallableStatement callableStatement;
SQL_Server_DBConnectionProvider sql_server_dbConnectionProvider = new SQL_Server_DBConnectionProvider();
try
(Connection connection = sql_server_dbConnectionProvider.provideConnection()) {
String sql = "EXEC getPasswordByLogin ?";
callableStatement = connection.prepareCall(sql);
callableStatement.setEscapeProcessing(true);
callableStatement.setString(1, login);
ResultSet resultSet = callableStatement.executeQuery();
if (resultSet.next()) return resultSet.getString(1);
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
@Override
public String getSaltByLogin(String login) {
CallableStatement callableStatement;
SQL_Server_DBConnectionProvider sql_server_dbConnectionProvider = new SQL_Server_DBConnectionProvider();
try
(Connection connection = sql_server_dbConnectionProvider.provideConnection()) {
String sql = "EXEC getSaltByLogin ?";
callableStatement = connection.prepareCall(sql);
callableStatement.setEscapeProcessing(true);
callableStatement.setString(1, login);
ResultSet resultSet = callableStatement.executeQuery();
if (resultSet.next()) return resultSet.getString(1);
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
@Override
public void setActivated(boolean status, int id) {
CallableStatement callableStatement;
SQL_Server_DBConnectionProvider sql_server_dbConnectionProvider = new SQL_Server_DBConnectionProvider();
try (Connection connection = sql_server_dbConnectionProvider.provideConnection()) {
String sql = "EXEC setActivated ?, ?";
callableStatement = connection.prepareCall(sql);
callableStatement.setEscapeProcessing(true);
if (status == true)
callableStatement.setString(1, "true");
else
callableStatement.setString(1, "false");
callableStatement.setInt(2, id);
callableStatement.execute();
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
public boolean isUserActivated(String login) {
CallableStatement callableStatement;
SQL_Server_DBConnectionProvider sql_server_dbConnectionProvider = new SQL_Server_DBConnectionProvider();
try (Connection connection = sql_server_dbConnectionProvider.provideConnection()) {
String sql = "EXEC isUserActivated ?";
callableStatement = connection.prepareCall(sql);
callableStatement.setEscapeProcessing(true);
callableStatement.setString(1, login);
ResultSet info = callableStatement.executeQuery();
info.next();
String isActivated = info.getString(1);
if (isActivated.equals("true")) return true;
else return false;
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}
@Override
public int[] getWinsAndLoses(int userId) {
CallableStatement callableStatement;
SQL_Server_DBConnectionProvider sql_server_dbConnectionProvider = new SQL_Server_DBConnectionProvider();
try (Connection connection = sql_server_dbConnectionProvider.provideConnection()) {
String sql = "EXEC getWinsAndLoses ?";
callableStatement = connection.prepareCall(sql);
callableStatement.setEscapeProcessing(true);
callableStatement.setInt(1, userId);
ResultSet rs = callableStatement.executeQuery();
rs.next();
return new int[]{rs.getInt(1), rs.getInt(2)};
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
@Override
public void incrementWins(int idUser) {
CallableStatement callableStatement;
SQL_Server_DBConnectionProvider sql_server_dbConnectionProvider = new SQL_Server_DBConnectionProvider();
try (Connection connection = sql_server_dbConnectionProvider.provideConnection()) {
String sql = "EXEC incrementWins ?";
callableStatement = connection.prepareCall(sql);
callableStatement.setEscapeProcessing(true);
callableStatement.setInt(1, idUser);
callableStatement.execute();
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
public void incrementLoses(int idUser) {
CallableStatement callableStatement;
SQL_Server_DBConnectionProvider sql_server_dbConnectionProvider = new SQL_Server_DBConnectionProvider();
try (Connection connection = sql_server_dbConnectionProvider.provideConnection()) {
String sql = "EXEC incrementLoses ?";
callableStatement = connection.prepareCall(sql);
callableStatement.setEscapeProcessing(true);
callableStatement.setInt(1, idUser);
callableStatement.execute();
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
public List<List<String>> getLoginWinsLosesOfUsers(int howMany) {
CallableStatement callableStatement;
SQL_Server_DBConnectionProvider sql_server_dbConnectionProvider = new SQL_Server_DBConnectionProvider();
try (Connection connection = sql_server_dbConnectionProvider.provideConnection()) {
String sql = "EXEC getLoginWinsLosesOfUsers ?";
callableStatement = connection.prepareCall(sql);
callableStatement.setEscapeProcessing(true);
callableStatement.setInt(1, howMany);
ResultSet rs = callableStatement.executeQuery();
List<List<String>> listOfRows = Helper.getAllRowsFromResultSetIntoStringList(rs, 3);
return listOfRows;
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
}
| [
"r.wojcik96@gmail.com"
] | r.wojcik96@gmail.com |
073b99aa66607d15258bae13ee85f44ff6a092f1 | de03b252a8306b7a36d04b7d00517c88867a6a4a | /Microservice-Parent/Microservice-Task/src/main/java/com/beyondalgo/app/controllers/TaskController.java | 7db0d5576b2fcbbd7262bd091822b11170f7b5d9 | [] | no_license | ronymathewjose/SpringBoot-SampleApplication | 2973d53ba7a897bf563742b55134d3ba91e8f8ca | 47efba89767f5850700819334025093a4c8d6f1e | refs/heads/master | 2021-12-10T07:12:45.851493 | 2016-07-14T12:13:41 | 2016-07-14T12:13:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | package com.beyondalgo.app.controllers;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TaskController {
@RequestMapping(value="/task")
public String testTask(){
System.out.println("Task Service - Task Controller Hit");
return "Welcome to Task Service";
}
}
| [
"pankaj.kalwar@capgemini.com"
] | pankaj.kalwar@capgemini.com |
b0ae79c0e98abc55de70374371e2e2d6a95e0878 | eaea5e3d29fbd882dc0825b9b48bcadb7d3b6860 | /app/src/main/java/com/silvaaisya/uas_rating_silva_wirda/product/IdolAdapter.java | dbc6e03615474307509abca1438f8cedbdd06006 | [] | no_license | SilvaAisya/UAS_Rating_Silva_Wirda | 7777f8b78d963989c94cb2e3ffc33d49f778e490 | f9d896f8258c06235a41c9557f9f307b67cb0aba | refs/heads/master | 2020-05-28T10:48:31.179603 | 2019-05-30T13:16:37 | 2019-05-30T13:16:37 | 188,974,080 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,714 | java | package com.silvaaisya.uas_rating_silva_wirda.product;
import android.support.annotation.NonNull;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.google.gson.Gson;
import com.silvaaisya.uas_rating_silva_wirda.R;
import com.silvaaisya.uas_rating_silva_wirda.model.IdolModel;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import me.zhanghai.android.materialratingbar.MaterialRatingBar;
public class IdolAdapter extends RecyclerView.Adapter<IdolAdapter.IdolHolder> {
public interface OnClickListenerAdapter {
void onItemClicked(String idol);
}
private IdolAdapter.OnClickListenerAdapter onClickListenerAdapter;
private List<IdolModel> listIdolModel;
public IdolAdapter(List<IdolModel> listIdolModel) {
this.listIdolModel = listIdolModel;
}
@NonNull
@Override
public IdolAdapter.IdolHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_idol, parent, false);
return new IdolAdapter.IdolHolder(view);
}
@Override
public void onBindViewHolder(@NonNull IdolAdapter.IdolHolder holder, int position) {
final IdolModel model = listIdolModel.get(position);
holder.totalStarRating.setRating(Float.parseFloat(String.valueOf(model.getTotalRating())));
holder.tvIdolName.setText(model.getNameIdol());
holder.tvAgensi.setText(model.getAgensi());
holder.cvItem.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onClickListenerAdapter != null) {
onClickListenerAdapter.onItemClicked(new Gson().toJson(model));
}
}
});
}
@Override
public int getItemCount() {
return listIdolModel.size();
}
public void setOnClickListenerAdapter(IdolAdapter.OnClickListenerAdapter onClickListenerAdapter) {
this.onClickListenerAdapter = onClickListenerAdapter;
}
public class IdolHolder extends RecyclerView.ViewHolder {
@BindView(R.id.tv_idol_name)
TextView tvIdolName;
@BindView(R.id.tv_agensi)
TextView tvAgensi;
@BindView(R.id.total_star_rating)
MaterialRatingBar totalStarRating;
@BindView(R.id.cv_item)
CardView cvItem;
public IdolHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
}
| [
"wirdansari@gmail.com"
] | wirdansari@gmail.com |
d9f773d06331356acba018a3f31a538bd2b37a70 | 37ff7404e19a46a57ed0de8b02fb8bd2f7700b2e | /example-spring-java/src/main/java/com/peak/config/CompactDisc.java | 960416979b19a1a433a3c541cfab370756a870b6 | [] | no_license | gaofeng0527/example | 4cee6565c06e65e4ae82cb7e51bd9083c7148cd2 | 11de5aa934a41264e1121c1d4f1a01b32392a446 | refs/heads/master | 2020-04-11T15:27:46.604917 | 2019-05-24T05:31:44 | 2019-05-24T05:31:44 | 139,731,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 77 | java | package com.peak.config;
public interface CompactDisc {
void play();
}
| [
"gaofeng0527@163.com"
] | gaofeng0527@163.com |
a58db8621ff8d274d666564e4c2b1582fe21c87d | 0a08715b41d7dacfffd5a45698a07b39aca5d3fc | /app/src/main/java/com/syzible/hair/Common/Objects/OpeningTime.java | 55ff70a0de20d4f80ddf92c9e1c4abff0d29b77e | [] | no_license | oflynned/Trym-Android | 800482d2398ad56eee8e3b052d4828d2a73388b7 | c96dcf36548769e88baa2fa34fa5ca1d53184da3 | refs/heads/master | 2021-09-09T11:40:47.959116 | 2018-03-15T19:56:17 | 2018-03-15T19:56:17 | 118,915,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,421 | java | package com.syzible.hair.Common.Objects;
import java.util.Calendar;
public class OpeningTime {
private String day, openingTime, closingTime;
public OpeningTime(String day, String openingTime, String closingTime) throws OpeningTimeNotFoundException {
this.day = day;
this.openingTime = openingTime;
this.closingTime = closingTime;
}
public Calendar getOpeningTime() throws OpeningTimeNotFoundException {
return getTimeAsDate(day, openingTime);
}
public Calendar getClosingTime() throws OpeningTimeNotFoundException {
return getTimeAsDate(day, closingTime);
}
private Calendar getCurrentTime() {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
return calendar;
}
public String getFormattedOpeningTime() {
return openingTime + " - " + closingTime;
}
public boolean isOpenNow() throws OpeningTimeNotFoundException {
Calendar currentTime = getCurrentTime();
return currentTime.getTime().getDay() == getOpeningTime().getTime().getDay() &&
currentTime.after(getOpeningTime()) &&
currentTime.before(getClosingTime());
}
private Calendar getTimeAsDate(String day, String time) throws OpeningTimeNotFoundException {
String[] separatedTime = time.split(":");
int hour = Integer.parseInt(separatedTime[0]);
int minutes = Integer.parseInt(separatedTime[1]);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MINUTE, minutes);
calendar.set(Calendar.HOUR, hour);
calendar.set(Calendar.AM_PM, (hour >= 0 || hour < 12) ? Calendar.AM : Calendar.PM);
calendar.set(Calendar.DAY_OF_WEEK, getDayOfWeek(day));
return calendar;
}
private int getDayOfWeek(String dayName) throws OpeningTimeNotFoundException {
switch (dayName) {
case "sunday":
return 1;
case "monday":
return 2;
case "tuesday":
return 3;
case "wednesday":
return 4;
case "thursday":
return 5;
case "friday":
return 6;
case "saturday":
return 7;
}
throw new OpeningTimeNotFoundException("Day name not found in map");
}
}
| [
"oflynned@tcd.ie"
] | oflynned@tcd.ie |
563cd849ece551a1475a24e9fd2c9438258963dc | 1fade6d8c6650a6af485720ea442f0ac272c7c8d | /src/main/java/net/devaction/kafka/accountbalanceconsumer/AccountBalanceConsumer.java | ce2766b135fd4bb39a093832fb3a3009f2990ce4 | [
"MIT"
] | permissive | chmad18/transfers_websockets_service | 51d1e0f123f2ad615b6fe47ac3f4ccbf095fac2c | 8825512f1051bd25c5a6fcaba8971a9a8291f06d | refs/heads/master | 2023-03-15T18:19:59.921890 | 2020-04-13T17:57:46 | 2020-04-13T17:57:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 293 | java | package net.devaction.kafka.accountbalanceconsumer;
import net.devaction.kafka.avro.AccountBalance;
import net.devaction.kafka.consumer.TopicConsumer;
/**
* @author Víctor Gil
*
* since September 2019
*/
public interface AccountBalanceConsumer extends TopicConsumer<AccountBalance> {
}
| [
"victorgilsanz@gmail.com"
] | victorgilsanz@gmail.com |
daf1ff636e7fa368f1e22f0964d2b7a8b1d7a584 | 64e2975070d6c1a0b296a103b5c8d1aeefa6b78e | /src/com/company/Account.java | 21bd6776d11bd6c7ce57edd389c374ea2d54276f | [] | no_license | Camilla666/OOP-projects | f2a0a3b5d14dd63d1106a9982ba9b7be637d8047 | 46e15dc621c6aa99428a13d14d7ea882d2283032 | refs/heads/master | 2020-04-24T22:23:30.221532 | 2019-02-24T07:50:10 | 2019-02-24T07:50:10 | 172,310,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,197 | java | package com.company;
public class Account {
int id;
Customer customer;
double balance = 0.0;
public Account(int id, Customer customer, double balance) {
this.id = id;
this.customer = customer;
this.balance = balance;
}
public Account(int id, Customer customer) {
this.id = id;
this.customer = customer;
}
public int getId() {
return id;
}
public Customer getCustomer() {
return customer;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance){
this.balance = balance;
}
public String getCustomerName(){
return customer.getName();
}
public Account deposit(double amount){
this.balance+=amount;
return this;
}
public Account withdraw(double amount){
if(balance >= amount)
{
this.balance -= amount;
}else{
System.out.println("amount withdraw exceeds the current balance?");
}
return this;
}
@Override
public String toString() {
return String.format("%s balance=$%2f", customer, balance);
}
}
| [
"camilla@Camillas-MacBook-Pro.local"
] | camilla@Camillas-MacBook-Pro.local |
3d65195d1b96185b33648ca2c20320969c0ef47e | c0e3af1cee9fc53559f76b0f361fc7258e9fd821 | /scala/scala-impl/testdata/projectsForHighlightingTests/local/akka-samples/src/main/java/sample/java/sharding/ShardingApp.java | ce9f0cbab9ee556b10be6112067f47fb199217a5 | [
"LicenseRef-scancode-public-domain",
"CC0-1.0",
"Apache-2.0"
] | permissive | JetBrains/intellij-scala | b2924f4265466a2609a40dad6cb6285d9b41abd4 | 4059fba4822e1cb9ed820b2303f8a6eb28c8620a | refs/heads/idea232.x | 2023-08-31T23:17:57.635634 | 2023-08-30T13:08:09 | 2023-08-30T13:08:09 | 2,756,223 | 1,000 | 430 | Apache-2.0 | 2023-05-17T16:20:39 | 2011-11-11T14:34:07 | Scala | UTF-8 | Java | false | false | 866 | java | package sample.java.sharding;
import akka.actor.ActorSystem;
import akka.actor.Props;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
public class ShardingApp {
public static void main(String[] args) {
if (args.length == 0)
startup(new String[] { "2551", "2552", "0" });
else
startup(args);
}
public static void startup(String[] ports) {
for (String port : ports) {
// Override the configuration of the port
Config config = ConfigFactory.parseString(
"akka.remote.netty.tcp.port=" + port).withFallback(
ConfigFactory.load());
// Create an Akka system
ActorSystem system = ActorSystem.create("ShardingSystem", config);
// Create an actor that starts the sharding and sends random messages
system.actorOf(Props.create(Devices.class));
}
}
} | [
"Nikolay.Tropin@jetbrains.com"
] | Nikolay.Tropin@jetbrains.com |
392834fa36588dbc167d406c9f5a11fc93635d64 | fefa0ac67409e985633dc46482d232f921957428 | /services/hrdb/src/com/auto_kusnjyaduy/hrdb/Employee.java | 92ad7a89d6112f47140597088388eb90601e8896 | [] | no_license | wavemakerapps/Auto_KUsNJYaDuY | f4a9a7eaff796766414353dec9fffea98f6b1bfd | c491ef3a7cc0990944eb0c4417bf92e3e8afc3d9 | refs/heads/master | 2020-03-17T17:52:55.372262 | 2018-05-17T11:51:39 | 2018-05-17T11:51:39 | 133,805,816 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,431 | java | /*Copyright (c) 2015-2016 wavemaker.com All Rights Reserved.
This software is the confidential and proprietary information of wavemaker.com You shall not disclose such Confidential Information and shall use it only in accordance
with the terms of the source code license agreement you entered into with wavemaker.com*/
package com.auto_kusnjyaduy.hrdb;
/*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/
import java.io.Serializable;
import java.sql.Date;
import java.util.List;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.PostPersist;
import javax.persistence.Table;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
/**
* Employee generated by WaveMaker Studio.
*/
@Entity
@Table(name = "`EMPLOYEE`")
public class Employee implements Serializable {
private Integer empId;
private String firstname;
private String lastname;
private String street;
private String city;
private String state;
private String zip;
private Date birthdate;
private String picurl;
private String jobTitle;
private Integer deptId;
private String username;
private String password;
private String role;
private Integer managerId;
private Integer tenantId;
private Department department;
private Employee employeeByManagerId;
private List<Employee> employeesForManagerId;
private List<Vacation> vacations;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "`EMP_ID`", nullable = false, scale = 0, precision = 10)
public Integer getEmpId() {
return this.empId;
}
public void setEmpId(Integer empId) {
this.empId = empId;
}
@Column(name = "`FIRSTNAME`", nullable = true, length = 255)
public String getFirstname() {
return this.firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
@Column(name = "`LASTNAME`", nullable = true, length = 255)
public String getLastname() {
return this.lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
@Column(name = "`STREET`", nullable = true, length = 255)
public String getStreet() {
return this.street;
}
public void setStreet(String street) {
this.street = street;
}
@Column(name = "`CITY`", nullable = true, length = 255)
public String getCity() {
return this.city;
}
public void setCity(String city) {
this.city = city;
}
@Column(name = "`STATE`", nullable = true, length = 2)
public String getState() {
return this.state;
}
public void setState(String state) {
this.state = state;
}
@Column(name = "`ZIP`", nullable = true, length = 255)
public String getZip() {
return this.zip;
}
public void setZip(String zip) {
this.zip = zip;
}
@Column(name = "`BIRTHDATE`", nullable = true)
public Date getBirthdate() {
return this.birthdate;
}
public void setBirthdate(Date birthdate) {
this.birthdate = birthdate;
}
@Column(name = "`PICURL`", nullable = true, length = 255)
public String getPicurl() {
return this.picurl;
}
public void setPicurl(String picurl) {
this.picurl = picurl;
}
@Column(name = "`JOB_TITLE`", nullable = true, length = 40)
public String getJobTitle() {
return this.jobTitle;
}
public void setJobTitle(String jobTitle) {
this.jobTitle = jobTitle;
}
@Column(name = "`DEPT_ID`", nullable = true, scale = 0, precision = 10)
public Integer getDeptId() {
return this.deptId;
}
public void setDeptId(Integer deptId) {
this.deptId = deptId;
}
@Column(name = "`USERNAME`", nullable = true, length = 255)
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
@Column(name = "`PASSWORD`", nullable = true, length = 255)
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
@Column(name = "`ROLE`", nullable = true, length = 255)
public String getRole() {
return this.role;
}
public void setRole(String role) {
this.role = role;
}
@Column(name = "`MANAGER_ID`", nullable = true, scale = 0, precision = 10)
public Integer getManagerId() {
return this.managerId;
}
public void setManagerId(Integer managerId) {
this.managerId = managerId;
}
@Column(name = "`TENANT_ID`", nullable = true, scale = 0, precision = 10)
public Integer getTenantId() {
return this.tenantId;
}
public void setTenantId(Integer tenantId) {
this.tenantId = tenantId;
}
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "`DEPT_ID`", referencedColumnName = "`DEPT_ID`", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "`DEPTFKEY`"))
@Fetch(FetchMode.JOIN)
public Department getDepartment() {
return this.department;
}
public void setDepartment(Department department) {
if(department != null) {
this.deptId = department.getDeptId();
}
this.department = department;
}
// ignoring self relation properties to avoid circular loops & unwanted fields from the related entity.
@JsonIgnoreProperties({"employeeByManagerId", "employeesForManagerId"})
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "`MANAGER_ID`", referencedColumnName = "`EMP_ID`", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "`MGRFKEY`"))
@Fetch(FetchMode.JOIN)
public Employee getEmployeeByManagerId() {
return this.employeeByManagerId;
}
public void setEmployeeByManagerId(Employee employeeByManagerId) {
if(employeeByManagerId != null) {
this.managerId = employeeByManagerId.getEmpId();
}
this.employeeByManagerId = employeeByManagerId;
}
// ignoring self relation properties to avoid circular loops & unwanted fields from the related entity.
@JsonIgnoreProperties({"employeeByManagerId", "employeesForManagerId"})
@JsonInclude(Include.NON_EMPTY)
@OneToMany(fetch = FetchType.LAZY, mappedBy = "employeeByManagerId")
@Cascade({CascadeType.SAVE_UPDATE})
public List<Employee> getEmployeesForManagerId() {
return this.employeesForManagerId;
}
public void setEmployeesForManagerId(List<Employee> employeesForManagerId) {
this.employeesForManagerId = employeesForManagerId;
}
@JsonInclude(Include.NON_EMPTY)
@OneToMany(fetch = FetchType.LAZY, mappedBy = "employee")
@Cascade({CascadeType.SAVE_UPDATE})
public List<Vacation> getVacations() {
return this.vacations;
}
public void setVacations(List<Vacation> vacations) {
this.vacations = vacations;
}
@PostPersist
public void onPostPersist() {
if(employeesForManagerId != null) {
employeesForManagerId.forEach(employee -> employee.setEmployeeByManagerId(this));
}
if(vacations != null) {
vacations.forEach(vacation -> vacation.setEmployee(this));
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Employee)) return false;
final Employee employee = (Employee) o;
return Objects.equals(getEmpId(), employee.getEmpId());
}
@Override
public int hashCode() {
return Objects.hash(getEmpId());
}
}
| [
"automate1@wavemaker.com"
] | automate1@wavemaker.com |
947dc223450292f6e22e62b5c8b257b5f07f34f6 | 1b2ea02b63c62847e195ce7f8d49220909e6f409 | /src/main/java/hu/unideb/fupn26/controller/dto/MatchFullRequestDto.java | 8b40e7f0a0229a825dfe0599f7badfc30e41c18d | [] | no_license | fupn26/Webfejl_2020_AustralianFootball | c33170dcd51794ba791093d0f73504fec96b8daa | df2ee50b7aeaaf72c1b2274db8e2b924372409fa | refs/heads/main | 2023-01-23T19:42:55.936580 | 2020-12-09T19:48:54 | 2020-12-09T19:48:54 | 315,746,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,155 | java | package hu.unideb.fupn26.controller.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.time.LocalDateTime;
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class MatchFullRequestDto extends MatchMinimalRequestDto{
private String startDate;
private String venue;
private Integer attendants;
private Integer margin;
private Integer homeQ1Goals;
private Integer homeQ2Goals;
private Integer homeQ3Goals;
private Integer homeQ4Goals;
private Integer homeExtraTimeGoals;
private Integer homeQ1Behinds;
private Integer homeQ2Behinds;
private Integer homeQ3Behinds;
private Integer homeQ4Behinds;
private Integer homeExtraTimeBehinds;
private Integer awayQ1Goals;
private Integer awayQ2Goals;
private Integer awayQ3Goals;
private Integer awayQ4Goals;
private Integer awayExtraTimeGoals;
private Integer awayQ1Behinds;
private Integer awayQ2Behinds;
private Integer awayQ3Behinds;
private Integer awayQ4Behinds;
private Integer awayExtraTimeBehinds;
}
| [
"fupn26@hotmail.hu"
] | fupn26@hotmail.hu |
42176865c977839e64e4e684d4dfa5742371d9fb | 4873dff9f0e7275aeab8b6d9c13bda95318aa238 | /SpringBootExample/src/main/java/com/example/demo/controller/StudentController.java | d9f258e3687e25916ee3f81187564498e825be97 | [] | no_license | aseemahuja/SpringBootApp | 30c9921396fb0d69ad4b6b5d630f64b726852717 | 2f7dfbe726372a50dece7ff654e120512bd085ae | refs/heads/master | 2021-04-22T23:07:14.843312 | 2020-04-19T15:56:58 | 2020-04-19T15:56:58 | 249,879,431 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,262 | java | package com.example.demo.controller;
import java.util.List;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.example.demo.data.ResponseDataSource;
import com.example.demo.exception.ServiceException;
import com.example.demo.model.GetStudentByIdResponse;
import com.example.demo.model.GetStudentListResponse;
import com.example.demo.model.Student;
import com.example.demo.model.StudentDataRequest;
@RestController
@RequestMapping("/student")
public class StudentController {
private static final Logger LOGGER = LoggerFactory.getLogger(StudentController.class);
@Autowired
ResponseDataSource responseDataSource;
@Value("${student.application.switch}")
boolean applicationSwitch;
@Value("${student.application.name}")
String applicationName;
@Value("#{'${student.application.studentIds}'.split(',')}")
List<Integer> studentIdList;
@RequestMapping("/data")
public String studentData() {
System.out.println("I'm in studentData...................");
LOGGER.info("I'm in studentData..applicationSwitch:{}... applicationName:{}...",applicationSwitch, applicationName);
LOGGER.error("I'm in studentData...................");
if(applicationSwitch) {
return "Greeting Students!! From:" +applicationName + studentIdList.get(1);
} else {
return "Greetings Guests!! From:" + applicationName + studentIdList.get(1);
}
}
@RequestMapping(value="/list", method = RequestMethod.GET)
public ResponseEntity<GetStudentListResponse> studentList()
{
GetStudentListResponse response = new GetStudentListResponse();
response.setStudentList(responseDataSource.getStudentDataFromDB());
if(null!=response.getStudentList() && !response.getStudentList().isEmpty()) {
return new ResponseEntity<>(response, HttpStatus.OK);
} else {
throw new ServiceException("DATA_NOT_FOUND");
}
}
@RequestMapping(value="/byId/{studentId}", method= RequestMethod.GET)
public ResponseEntity<GetStudentByIdResponse> studentDataById(@PathVariable(value="studentId") int studentId){
GetStudentByIdResponse response = new GetStudentByIdResponse();
if(StringUtils.isEmpty(studentId)) {
throw new ServiceException("STUDENT_ID_NOT_FOUND");
}
List<Student> studentList = ResponseDataSource.getStudentData();
Optional<Student> studentOptional = studentList
.stream()
.filter(student -> studentId==student.getStudentId())
.findFirst();
if(!studentOptional.isPresent()) {
response.setErrorMessage("Student Id not found");
return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST);
} else {
response.setStudent(studentOptional.get());
return new ResponseEntity<>(response, HttpStatus.OK);
}
}
@RequestMapping(value="/add", method= RequestMethod.POST)
public ResponseEntity<GetStudentListResponse> addStudent(@RequestBody StudentDataRequest studentDataRequest){
GetStudentListResponse response = new GetStudentListResponse();
if(null== studentDataRequest
|| null== studentDataRequest.getStudent()
|| StringUtils.isEmpty(studentDataRequest.getStudent().getFirstName())) {
response.setErrorMessage("Student details not found in request.");
return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST);
}
responseDataSource.addStudentToDB(studentDataRequest.getStudent());
List<Student> studentList = responseDataSource.getStudentDataFromDB();
//List<Student> studentList = ResponseDataSource.getStudentData();
//studentList.add(studentDataRequest.getStudent());
response.setStudentList(studentList);
return new ResponseEntity<>(response, HttpStatus.OK);
}
}
| [
"aseem.ahuja@gmail.com"
] | aseem.ahuja@gmail.com |
1d3b5717412046b56caa4659e34ef5dd2ea3173a | cef6d4f1a0d17f35f0bce0d21c1901e5e2db62ed | /2da Parte/charat/src/charat/MuestraCaracteresApp.java | 5e1fa7498d81a83d972c0bc5f020b8e5820fc81d | [] | no_license | babolat22/cotorras | 11057e649cb5f3c4cb3656b9518d5e366292b218 | 3a4ab8f6e14401885ee66ab56bc56806a3593cef | refs/heads/master | 2023-07-31T19:47:06.084164 | 2021-09-16T02:01:55 | 2021-09-16T02:01:55 | 406,980,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,209 | java | /*
* 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 charat;
import java.util.Scanner;
/**
*
* @author juanj
*/
public class MuestraCaracteresApp {
public static void main(String[] args) {
Scanner sn=new Scanner(System.in);
//Pido al usuario que escriba una frase
System.out.println("Escriban una frase");
//Recomiendo usar nextLine en lugar de next por los espacios
String frase="es lindo vivir";
// String frase = sn.nextLine();
//Creamos un array de caracteres
//char caracteres[]=new char[frase.length()];
//Creamos un array de caracteres usando el metodo de String
char caracteres[]=frase.toCharArray();
char carac[]= new char[20];
//Recorremos la frase y cogemos cada caracter y lo metemos en el array
for(int i=0;i<frase.length();i++){
carac[i]=frase.charAt(i);
System.out.println("CharAT: "+carac[i]);
System.out.println("toChar: "+caracteres[i]);
}
}
}
| [
"jjsaez@ulp.edu.ar"
] | jjsaez@ulp.edu.ar |
13a591115e8602da16b122178c5a25a8c4348d34 | f2d7262deb82f713c99832f6aa4b59a0104b5447 | /Mapmo/app/src/main/java/com/example/mapmo/getUUID.java | 9a3deef523202de8e450ed725c67883dd13cdc5c | [] | no_license | taese0ng/MapmoProject | 0d2d24b7bbbacb85f4f01da48ae4f3c5f253dba5 | 24cd71ff560e5817237114c3a555a57fa77a5694 | refs/heads/master | 2020-07-26T18:42:55.250758 | 2019-09-30T00:27:27 | 2019-09-30T00:27:27 | 208,735,596 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,943 | java | package com.example.mapmo;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.provider.Settings.Secure;
import android.telephony.TelephonyManager;
import java.io.UnsupportedEncodingException;
import java.util.UUID;
public class getUUID {
protected static final String PREFS_FILE = "device_id.xml";
protected static final String PREFS_DEVICE_ID = "device_id";
protected volatile static UUID uuid;
public getUUID(Context context) {
if (uuid == null) {
synchronized (getUUID.class) {
if (uuid == null) {
final SharedPreferences prefs = context
.getSharedPreferences(PREFS_FILE, 0);
final String id = prefs.getString(PREFS_DEVICE_ID, null);
if (id != null) {
// Use the ids previously computed and stored in the
// prefs file
uuid = UUID.fromString(id);
} else {
final String androidId = Secure.getString(
context.getContentResolver(), Secure.ANDROID_ID);
// Use the Android ID unless it's broken, in which case
// fallback on deviceId,
// unless it's not available, then fallback on a random
// number which we store to a prefs file
try {
if (!"9774d56d682e549c".equals(androidId)) {
uuid = UUID.nameUUIDFromBytes(androidId
.getBytes("utf8"));
} else {
@SuppressLint("MissingPermission") final String deviceId = (
(TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE))
.getDeviceId();
uuid = deviceId != null ? UUID
.nameUUIDFromBytes(deviceId
.getBytes("utf8")) : UUID
.randomUUID();
}
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
// Write the value out to the prefs file
prefs.edit()
.putString(PREFS_DEVICE_ID, uuid.toString())
.commit();
}
}
}
}
}
public UUID getDeviceUuid() {
return uuid;
}
}
| [
"taese0ngjp@gmail.com"
] | taese0ngjp@gmail.com |
4ed8966bb0378225d145f9c71307053cf5b43e25 | 65905f969ffc8ab37dcdde6616ac7d3980b7fe2f | /src/first_week/statements/lekcja_statements.java | d53db39f7195158a9a1f581c308e0e8f0f177e5b | [] | no_license | MarcinRozkwitalski/ZSE_Praktyki | 88003b9c28a8b9aa9f1c61279593c17866cf9cb2 | 8d4c303cd246a0a7dfb2a42845787a0942dbca70 | refs/heads/master | 2023-04-06T04:29:32.647187 | 2021-03-18T21:49:04 | 2021-03-18T21:49:04 | 341,393,268 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,867 | java | package first_week.statements;
import java.util.Scanner;
public class lekcja_statements {
/*
postać instrukcji warunkowej IF oraz ELSE:
(musi istnieć IF przed ELSE):
if (warunek){
zrobCos1;
zrobCos2;
...
zrobCosX;
}
else{
zrobCosInnego1;
zrobCosInnego2;
...
zrobCosInnegoX;
}
*/
/*
if (warunek){
zrobCos1;
zrobCos2;
...
zrobCosX;
}
else{
zrobCosInnego1;
zrobCosInnego2;
...
zrobCosInnegoX;
}
if (warunek){
zrobCos1;
zrobCos2;
...
zrobCosX;
}
else{
zrobCosInnego1;
zrobCosInnego2;
...
zrobCosInnegoX;
}
if (warunek){
zrobCos1;
zrobCos2;
...
zrobCosX;
}
else{
zrobCosInnego1;
zrobCosInnego2;
...
zrobCosInnegoX;
}
*/
public static void main(String[] args) {
Scanner skaner = new Scanner(System.in);
boolean stan = false;
if(stan){
System.out.println("Wykonała się instrukcja IF.");
}
else{
System.out.println("Wykonała się instrukcja ELSE.");
}
System.out.print("Podaj swój wiek: ");
int wiek = skaner.nextInt();
if(wiek >= 18){
System.out.println("Jesteś pełnoletni!");
}
else{
System.out.println("Jesteś niepełnoletni!");
}
System.out.println("Podaj liczbę: ");
int liczba = skaner.nextInt();
if(10 < liczba && liczba < 20){
System.out.println("Liczba mieści się w zakresie.");
}
else{
System.out.println("Liczba NIE mieści się w zakresie.");
}
System.out.print("Podaj liczbę całkowitą A: ");
int a = skaner.nextInt();
System.out.print("Podaj liczbę całkowitą B: ");
int b = skaner.nextInt();
if(a > b){
System.out.println("A jest większe od B.");
}
if(a < b){
System.out.println("A jest mniejsze od B.");
}
if(a == b){
System.out.println("A jest równe B.");
}
if(a > b){
System.out.println("A jest większe od B.");
}
else {
if (a < b) {
System.out.println("A jest mniejsze od B.");
}
else {
System.out.println("A jest równe B.");
}
}
char charA = 'A';
char charB = 'B';
if (charA > charB){
System.out.println("charA ma większą wartość od charB w tabeli ASCII.");
}
else{
System.out.println("charA ma mniejszą wartość od charB w tabeli ASCII.");
}
String hello = "hello";
String world = "world";
if(hello.equals(world)){
System.out.println("hello jest równe world");
}
else {
System.out.println("hello nie jest równe world");
}
System.out.print("Podaj swój wybór (1, 2): ");
int x = skaner.nextInt();
switch (x){
case 1:
System.out.println("Przypadek pierwszy.");
break;
case 2:
System.out.println("Przypadek drugi.");
break;
default:
System.out.println("Nie wybrano poprawnej opcji.");
break;
}
System.out.print("Podaj swój wybór (1, 2, A, B): ");
String y = skaner.next();
switch (y){
case "1":
System.out.println("Przypadek pierwszy.");
break;
case "2":
System.out.println("Przypadek drugi.");
break;
case "A":
System.out.println("Przypadek A.");
break;
case "B":
System.out.println("Przypadek B.");
break;
default:
System.out.println("Nie wybrano poprawnej opcji.");
break;
}
System.out.print("Podaj swój wybór (1, 2, A, B): ");
char z = skaner.next().charAt(0);
switch (z){
case '1':
System.out.println("Przypadek pierwszy.");
break;
case '2':
System.out.println("Przypadek drugi.");
break;
case 'A':
System.out.println("Przypadek A.");
break;
case 'B':
System.out.println("Przypadek B.");
break;
default:
System.out.println("Nie wybrano poprawnej opcji.");
break;
}
}
}
| [
"marcinrozkwitalski98@gmail.com"
] | marcinrozkwitalski98@gmail.com |
573fb386bb3f00c3314681805285070b1842008d | e810dc89b79cd24217f41482bc5539d1dcdb9069 | /src/main/java/nz/ringfence/ack/web/websocket/dto/package-info.java | 2c1d56e6bcb6fc8848bfb7487640917a967421c2 | [] | no_license | AlexanderNZ/ack | 21bc0817249c4814dc07ba539c1b5baa02ddd5f0 | cb86e2ee8d00e566de618f18c90e76ec3760eeb6 | refs/heads/master | 2020-07-01T12:23:59.528162 | 2016-11-02T20:07:20 | 2016-11-02T20:07:20 | 74,078,045 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 103 | java | /**
* Data Access Objects used by WebSocket services.
*/
package nz.ringfence.ack.web.websocket.dto;
| [
"alexcorkin@gmail.com"
] | alexcorkin@gmail.com |
9f6d5deac2072a5a4a4b204a4201491cda0c1a3e | 1bd3c852d5ed20717cf2f4571dd2087ce9fbb5f0 | /src/main/com/hsw/main/App.java | f5b750f7f16fbdfd5397727c9a0327f8ab3bbe49 | [] | no_license | hsw123456/SpringTask | b98758d3a2279e8029fdd00a848172db66a7f1e8 | 0ad146bfe0798ca946975e9ebaf9197cf1aaaa84 | refs/heads/master | 2020-03-26T21:32:01.352267 | 2018-08-20T09:04:24 | 2018-08-20T09:04:24 | 145,393,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 424 | java | package com.hsw.main;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Hello world!
*/
public class App {
private static final Logger logger = LoggerFactory.getLogger(App.class);
public static void main(String[] args) {
System.out.println("Hello World!");
int i=1;
String j= "Hello";
String k= "World";
logger.error("haha:i={},j={},k={}",i,j,k);
}
}
| [
"hushuwei@cmhi.chinamobile.com"
] | hushuwei@cmhi.chinamobile.com |
49dff34eca25f5093783912042c50df51b7ae084 | 95746979c032245baca8416e232400d939ad4f7f | /tests/robotests/src/com/android/settings/gestures/ButtonNavigationSettingsAssistControllerTest.java | d961cdf161d40548bfc382ad51b373fbb3a2e2e0 | [
"Apache-2.0"
] | permissive | Bootleggers-BrokenLab/packages_apps_Settings | a62382fb552834a1caf4e9c8f945165108b65f00 | bfbe2603b66216093677a932774c2a32c6f85a8c | refs/heads/tirimbino | 2023-08-22T13:42:41.667571 | 2023-05-27T17:14:30 | 2023-05-27T17:14:30 | 213,136,686 | 0 | 2 | NOASSERTION | 2019-11-26T13:12:57 | 2019-10-06T08:57:16 | Java | UTF-8 | Java | false | false | 3,474 | java | /*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.gestures;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.res.Resources;
import android.provider.Settings;
import androidx.test.core.app.ApplicationProvider;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
@RunWith(RobolectricTestRunner.class)
public class ButtonNavigationSettingsAssistControllerTest {
private static final String KEY_LONG_PRESS_HOME_FOR_ASSIST =
"assistant_long_press_home_gesture";
private Context mContext;
private Resources mResources;
private ButtonNavigationSettingsAssistController mController;
@Before
public void setUp() {
mContext = spy(ApplicationProvider.getApplicationContext());
mResources = mock(Resources.class);
when(mContext.getResources()).thenReturn(mResources);
mController = new ButtonNavigationSettingsAssistController(
mContext, KEY_LONG_PRESS_HOME_FOR_ASSIST);
}
@Test
public void isChecked_valueUnknownDefaultTrue_shouldReturnTrue() {
when(mResources.getBoolean(
com.android.internal.R.bool.config_assistLongPressHomeEnabledDefault)).thenReturn(
true);
assertThat(mController.isChecked()).isTrue();
}
@Test
public void isChecked_valueUnknownDefaultFalse_shouldReturnFalse() {
when(mResources.getBoolean(
com.android.internal.R.bool.config_assistLongPressHomeEnabledDefault)).thenReturn(
true);
assertThat(mController.isChecked()).isTrue();
}
@Test
public void isChecked_valueTrue_shouldReturnTrue() {
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.ASSIST_LONG_PRESS_HOME_ENABLED, 1);
assertThat(mController.isChecked()).isTrue();
}
@Test
public void isChecked_valueFalse_shouldReturnFalse() {
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.ASSIST_LONG_PRESS_HOME_ENABLED, 0);
assertThat(mController.isChecked()).isFalse();
}
@Test
public void setChecked_valueFalse_shouldSetFalse() {
mController.setChecked(false);
assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.ASSIST_LONG_PRESS_HOME_ENABLED, -1)).isEqualTo(0);
}
@Test
public void setChecked_valueTrue_shouldSetTrue() {
mController.setChecked(true);
assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.ASSIST_LONG_PRESS_HOME_ENABLED, -1)).isEqualTo(1);
}
}
| [
"jernej@google.com"
] | jernej@google.com |
192b84d1bbf8e66136c1a16a59a2ab18d906d956 | 0b8333cb0f25ced0955f50c2fb8eec0ea07751d9 | /src/main/java/gds/health/security/jwt/JWTConfigurer.java | 1b8b7dd9458d874baa7a66a90dfc7e57142ea0ad | [] | no_license | sunxing109/twentyOnePoints | 0b5a75cf0446cfff0b9b4d012dda819764c653ab | 6404a0d25062ed0e22152b664b0407f4f2c6fe10 | refs/heads/master | 2022-12-23T16:18:24.945339 | 2019-09-12T08:06:46 | 2019-09-12T08:06:46 | 207,997,828 | 0 | 0 | null | 2022-12-16T05:03:31 | 2019-09-12T08:07:53 | Java | UTF-8 | Java | false | false | 850 | java | package gds.health.security.jwt;
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.DefaultSecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
public class JWTConfigurer extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {
private TokenProvider tokenProvider;
public JWTConfigurer(TokenProvider tokenProvider) {
this.tokenProvider = tokenProvider;
}
@Override
public void configure(HttpSecurity http) throws Exception {
JWTFilter customFilter = new JWTFilter(tokenProvider);
http.addFilterBefore(customFilter, UsernamePasswordAuthenticationFilter.class);
}
}
| [
"sunxingba@e-u.cn"
] | sunxingba@e-u.cn |
ed2d214ce19a8a280e984dbf486ae3c32136aa28 | e14bdeb92eab65e8bae00f3b29dfb9afac7c2ac2 | /src/main/java/zxc/person/design_pattern/pattern/behavioral/iterator/CourseIterator.java | 580e96b8a65e80c7ebbff70e20caedcd76d52362 | [] | no_license | zxccong/design_pattern | 153a64f0fbd2efc93242d62a4312469161563ff6 | 085339a640d11b15fdebc5996fd2c9d367ec0682 | refs/heads/master | 2022-06-28T18:01:51.809822 | 2019-08-08T14:48:14 | 2019-08-08T14:48:14 | 199,156,475 | 0 | 0 | null | 2022-06-21T01:37:28 | 2019-07-27T11:31:27 | Java | UTF-8 | Java | false | false | 202 | java | package zxc.person.design_pattern.pattern.behavioral.iterator;
/**
* Created by geely.
* 迭代器接口
*/
public interface CourseIterator {
Course nextCourse();
boolean isLastCourse();
}
| [
"1209252967@qq.com"
] | 1209252967@qq.com |
b3c50a8c02cda56f54e18383732693a1af54e113 | 1393305d4573ac73d159d9efd2d58ade00f17dc8 | /Java/BD/Trabalho 2/src/DBConnection.java | 8fc826ab54e9294daffe199b3955fd9c5b774d47 | [] | no_license | ShutDownMan/UniProjects | f865136169b4626fc79e92c36e5c6590496216d2 | 40704eb1f51f82df50fb7497985c2ab55a3aff26 | refs/heads/master | 2022-06-02T22:38:04.137699 | 2022-05-12T00:19:40 | 2022-05-12T00:19:40 | 113,806,338 | 3 | 2 | null | 2022-04-04T23:04:57 | 2017-12-11T03:11:54 | C++ | UTF-8 | Java | false | false | 9,974 | java | import Entity.*;
import java.sql.*;
import java.util.ArrayList;
import java.util.Properties;
class DBConnection {
private Connection connection;
void initialize() throws SQLException {
String url = "jdbc:postgresql://localhost:5432/empresa_telecom";
Properties props = new Properties();
props.setProperty("user", "postgres");
props.setProperty("password", "NotSafePasswd321");
connection = DriverManager.getConnection(url, props);
}
void populate() throws SQLException {
Statement st;
// ResultSet rs;
st = this.connection.createStatement();
st.execute("INSERT INTO rua(nome) VALUES " +
"('Rio de Janeiro'), ('377'), ('Brasil')");
st.execute("INSERT INTO logradouro(nome) VALUES " +
"('rua'), ('avenida'), ('rodovia')");
st.execute("INSERT INTO pais(nome) VALUES " +
"('Brasil')");
st.execute("INSERT INTO estado(nome, id_pais) VALUES " +
"('Parana', 1)");
st.execute("INSERT INTO cidade(nome, id_estado) VALUES " +
"('foz do iguacu', 1), ('curitiba', 1)");
st.execute("INSERT INTO endereco(id_rua, id_logradouro, id_cidade, numero) VALUES " +
"(1, 1, 1, 44), (2, 3, 2, 1456), (3, 2, 1, 445)");
st.execute("INSERT INTO empresa_telecomunicacao(razao_social, cnpj, id_endereco) VALUES " +
"('Click Internet', '12345678910119', 1)");
st.execute("INSERT INTO cliente(nome, cpf, id_endereco) VALUES " +
"('Guilherme Sganderla', '43423798645', 2)," +
"('Vivian Fugihara', '46716678352', 3)");
st.execute("INSERT INTO fatura(cod_barra, vencimento, emissao, id_empresa_telecomunicacao) VALUES " +
"('1312151245495486', DATE '2019-09-30', DATE '2019-09-13', 1), " +
"('5166516516516651', DATE '2019-08-29', DATE '2019-09-13', 1)");
st.execute("INSERT INTO cliente_fatura(id_cliente, id_fatura) VALUES " +
"(1, 2)," +
"(2, 1)");
st.execute("INSERT INTO ligacao(id_fatura, valor, hora, duracao, telefone, tipo) VALUES " +
"(2, 1.27, TIMESTAMP WITH TIME ZONE '2019-08-15 13:15:54-03', INTERVAL '0 hours 07 mins 12 secs', '+55 45 9945-1231', 'local')," +
"(2, 3.50, TIMESTAMP WITH TIME ZONE '2019-08-16 21:51:21-03', INTERVAL '0 hours 21 mins 51 secs', '+45 15 1651-515', 'internacional')," +
"(2, 2.44, TIMESTAMP WITH TIME ZONE '2019-08-16 06:23:12-03', INTERVAL '0 hours 16 mins 31 secs', '+55 45 9906-3072', 'local')," +
"(2, 3.57, TIMESTAMP WITH TIME ZONE '2019-08-16 02:16:11-03', INTERVAL '0 hours 28 mins 51 secs', '+55 41 9842-0677', 'interurbano')," +
"(2, 5.32, TIMESTAMP WITH TIME ZONE '2019-08-16 15:46:12-03', INTERVAL '0 hours 41 mins 01 secs', '+55 45 9855-11191', 'local')");
st.execute("INSERT INTO ligacao(id_fatura, valor, hora, duracao, telefone, tipo) VALUES " +
"(1, 3.19, TIMESTAMP WITH TIME ZONE '2019-09-15 22:23:54-03', INTERVAL '0 hours 32 mins 33 secs', '+55 45 9926-5773', 'local')," +
"(1, 1.26, TIMESTAMP WITH TIME ZONE '2019-09-16 10:15:12-03', INTERVAL '0 hours 06 mins 02 secs', '+55 45 9842-0677', 'local')," +
"(1, 2.11, TIMESTAMP WITH TIME ZONE '2019-09-16 12:16:11-03', INTERVAL '0 hours 19 mins 10 secs', '+55 41 9842-0677', 'interurbano')," +
"(1, 2.08, TIMESTAMP WITH TIME ZONE '2019-09-16 12:16:11-03', INTERVAL '0 hours 19 mins 30 secs', '+55 41 84165-5447', 'interurbano')," +
"(1, 3.59, TIMESTAMP WITH TIME ZONE '2019-09-16 16:46:21-03', INTERVAL '0 hours 21 mins 21 secs', '+45 15 1651-515', 'internacional')," +
"(1, 4.34, TIMESTAMP WITH TIME ZONE '2019-09-16 21:53:12-03', INTERVAL '0 hours 53 mins 35 secs', '+55 45 9926-5773', 'local')");
st.execute("INSERT INTO internet(id_fatura, data, volume, valor) VALUES" +
"(1, TIMESTAMP WITH TIME ZONE '2019-09-15 16:26:45-03', 2640, 0.03)," +
"(1, TIMESTAMP WITH TIME ZONE '2019-09-16 01:57:39-03', 51302, 0.68)," +
"(1, TIMESTAMP WITH TIME ZONE '2019-09-16 18:46:30-03', 21584, 0.20)");
st.execute("INSERT INTO internet(id_fatura, data, volume, valor) VALUES" +
"(2, TIMESTAMP WITH TIME ZONE '2019-08-15 17:13:42-03', 561320, 10.15)," +
"(2, TIMESTAMP WITH TIME ZONE '2019-08-16 14:52:28-03', 651350, 12.41)");
st.close();
}
ArrayList<Cliente> searchClientByName(String buffer) throws SQLException {
ArrayList<Cliente> clientes = new ArrayList<>();
Statement st = this.connection.createStatement();
ResultSet rs;
rs = st.executeQuery("SELECT * FROM cliente WHERE nome LIKE '%" + buffer + "%'");
while (rs.next()) {
clientes.add(new Cliente(
rs.getInt("id"),
rs.getString("nome"),
rs.getString("cpf"),
this.getEnderecoById(rs.getInt("id_endereco"))));
}
st.close();
rs.close();
return clientes;
}
private Endereco getEnderecoById(int id) throws SQLException {
Endereco foundEndereco = null;
Statement st = this.connection.createStatement();
ResultSet rs;
rs = st.executeQuery("SELECT * FROM endereco WHERE id=" + id + "");
rs.next();
foundEndereco = new Endereco(
rs.getInt("id"),
getStringAttrTableId("rua", "nome", rs.getInt("id_rua")),
getStringAttrTableId("logradouro", "nome", rs.getInt("id_logradouro")),
getStringAttrTableId("cidade", "nome", rs.getInt("id_cidade")),
rs.getInt("numero"));
st.close();
rs.close();
return foundEndereco;
}
private String getStringAttrTableId(String table, String attr, int id) throws SQLException {
Statement st = this.connection.createStatement();
ResultSet rs = st.executeQuery("SELECT * FROM " + table + " WHERE id=" + id + "");
rs.next();
String res = rs.getString(attr);
st.close();
rs.close();
return res;
}
Cliente getClientById(int id) throws SQLException {
Cliente foundCliente = null;
Statement st = this.connection.createStatement();
ResultSet rs;
rs = st.executeQuery("SELECT * FROM cliente WHERE id=" + id + "");
rs.next();
foundCliente = new Cliente(
rs.getInt("id"),
rs.getString("nome"),
rs.getString("cpf"),
this.getEnderecoById(rs.getInt("id_endereco")));
st.close();
rs.close();
return foundCliente;
}
ArrayList<Fatura> getFaturasByClientId(int id) throws SQLException {
ArrayList<Fatura> faturas = new ArrayList<>();
Cliente foundCliente = this.getClientById(id);
Statement st = this.connection.createStatement();
ResultSet rs;
if (foundCliente == null)
return null;
rs = st.executeQuery("SELECT * FROM fatura WHERE id=" + id + "");
while (rs.next()) {
faturas.add(new Fatura(
rs.getInt("id"),
rs.getString("cod_barra"),
rs.getString("vencimento"),
rs.getString("emissao"),
rs.getInt("id_empresa_telecomunicacao")));
}
st.close();
rs.close();
return faturas;
}
Fatura getFaturaById(int id) throws SQLException {
Fatura foundFatura = null;
Statement st = this.connection.createStatement();
ResultSet rs;
rs = st.executeQuery("SELECT * FROM fatura WHERE id=" + id + "");
rs.next();
foundFatura = new Fatura(
rs.getInt("id"),
rs.getString("cod_barra"),
rs.getString("vencimento"),
rs.getString("emissao"),
rs.getInt("id_empresa_telecomunicacao"));
st.close();
rs.close();
return foundFatura;
}
ArrayList<Ligacao> getLigacoesByFaturaId(int id) throws SQLException {
ArrayList<Ligacao> faturas = new ArrayList<>();
Fatura foundFatura = this.getFaturaById(id);
Statement st = this.connection.createStatement();
ResultSet rs;
if (foundFatura == null)
return null;
rs = st.executeQuery("SELECT * FROM ligacao WHERE id_fatura=" + id + "");
while (rs.next()) {
faturas.add(new Ligacao(
rs.getInt("id"),
rs.getString("hora"),
rs.getFloat("valor"),
rs.getInt("id_fatura"),
rs.getString("duracao"),
rs.getString("telefone"),
rs.getString("tipo")));
}
st.close();
rs.close();
return faturas;
}
ArrayList<Internet> getInternetByFaturaId(int id) throws SQLException {
ArrayList<Internet> internetList = new ArrayList<>();
Fatura foundFatura = this.getFaturaById(id);
Statement st = this.connection.createStatement();
ResultSet rs;
if (foundFatura == null)
return null;
rs = st.executeQuery("SELECT * FROM internet WHERE id_fatura=" + id + "");
while (rs.next()) {
internetList.add(new Internet(
rs.getInt("id"),
rs.getString("data"),
rs.getInt("volume"),
rs.getFloat("valor"),
rs.getInt("id_fatura")));
}
st.close();
rs.close();
return internetList;
}
void close() throws SQLException {
this.connection.close();
}
}
| [
"jedson_gabriel@hotmail.com"
] | jedson_gabriel@hotmail.com |
b13a6c522715735cf8c548e62670fef923921d21 | 3d3161098b38a4ba74b52eb8c53c70745e60289e | /app/src/main/java/com/groovin101/chooseyourownadventure/MainActivity.java | 7dc300f259a0355d15c58ced8af7a72a04b0f736 | [] | no_license | groovin101/android-cyoa | 3b53a38260d90d727eb9444eb1c169c4bea7d6a1 | adf1b72bfde66431770329ea80ba57d91fcf7e6d | refs/heads/master | 2020-09-16T05:01:15.053974 | 2016-08-24T13:44:55 | 2016-08-24T13:44:55 | 66,372,032 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,235 | java | package com.groovin101.chooseyourownadventure;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private EditText nameField;
private Button startButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
nameField = (EditText)findViewById(R.id.nameEditText);
startButton = (Button)findViewById(R.id.startButton);
startButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String name = nameField.getText().toString();
Toast.makeText(MainActivity.this, name, Toast.LENGTH_SHORT).show();
startStoryActivity(name);
}
});
}
private void startStoryActivity(String username) {
Intent intent = new Intent(this, StoryActivity.class);
intent.putExtra("NAME", username);
startActivity(intent);
}
}
| [
"groovin101@gmail.com"
] | groovin101@gmail.com |
72763c34ef63973bbacdc2d441be5b4683da39d8 | 1953115dec10d657d671ff4441e36a7f7ee2bd4d | /src/main/java/com/econception/employemanagement/controller/LeaveController.java | ab7a43341478bc498acd035ed11eccf718002e49 | [] | no_license | salman-mehboob/employee-management-system | 508312db6d91fb4e4b99faa9cbbfea8e80ed8b64 | ffab44f5423a70a7ccd91dc745d01a2377f1c04c | refs/heads/master | 2023-08-28T06:59:35.111676 | 2021-10-12T20:44:51 | 2021-10-12T20:44:51 | 416,454,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,843 | java | package com.econception.employemanagement.controller;
import com.econception.employemanagement.domain.*;
import com.econception.employemanagement.domain.Module;
import com.econception.employemanagement.dto.LeavesDTO;
import com.econception.employemanagement.dto.NewEmployeeDTO;
import com.econception.employemanagement.enumeration.ApprovedStatus;
import com.econception.employemanagement.enumeration.ModuleTitles;
import com.econception.employemanagement.repository.*;
import com.econception.employemanagement.service.EmployeeLeaveService;
import com.econception.employemanagement.service.UserService;
import groovy.util.logging.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import javax.validation.Valid;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import static com.econception.employemanagement.enumeration.ApprovedStatus.*;
import static com.econception.employemanagement.enumeration.ModuleTitles.Leaves;
@Controller
@Slf4j
@RequestMapping("/leave")
public class LeaveController {
@Autowired
UserRepository userRepository;
@Autowired
UserService userService;
@Autowired
LeaveCategoryRepository leaveCategoryRepository;
@Autowired
EmployeeLeavesRepository employeeLeavesRepository;
@Autowired
ModuleRepository moduleRepository;
@Autowired
CommentRepository commentRepository;
@Autowired
EmployeeLeaveService employeeLeaveService;
private Session session;
@RequestMapping("/showLeaves")
public String leaves(Model model) {
User user = userService.findUserByCurrentUserName();
if (user != null) {
model.addAttribute("userList", user);
List<LeavesCategories> leavesCategoriesList = leaveCategoryRepository.findAll();
model.addAttribute("leavesCategoriesList", leavesCategoriesList);
return "Leaves";
}
return null;
}
@RequestMapping("/requestLeave")
public ResponseEntity<String> requestLeave(@Valid LeavesDTO leavesDTO) {
EmployeeLeaves employeeLeaves = new EmployeeLeaves();
Employee employee = new Employee();
employee.setId(leavesDTO.getEmployeeID());
employeeLeaves.setEmployee(employee);
LeavesCategories leavesCategories = new LeavesCategories();
leavesCategories.setId(leavesDTO.getEmployeeLeaveId());
employeeLeaves.setLeavesCategories(leavesCategories);
DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date dateobj = new Date();
String date1 = df.format(dateobj);
employeeLeaves.setDateCreated(date1);
employeeLeaves.setDateFrom(leavesDTO.getDateFrom());
employeeLeaves.setDateTo(leavesDTO.getDateTo());
EmployeeLeaves savedLeave = new EmployeeLeaves();
ApprovedStatus status = PENDING;
employeeLeaves.setStatus(status);
savedLeave = employeeLeavesRepository.save(employeeLeaves);
if(!leavesDTO.getText().isEmpty()) {
Comments comments = new Comments();
comments.setEmployee(employee);
comments.setText(leavesDTO.getText());
String date = df.format(dateobj);
comments.setDateCreated(date);
Module module1 = new Module();
module1.setId((long) 1);
comments.setModule(module1);
comments.setParent(savedLeave.getId());
commentRepository.save(comments);
}
return ResponseEntity.ok("Success");
}
@RequestMapping("/leavesRequestList")
public String leavesRequestList(Model model) {
// ApprovedStatus status1 = PENDING;
// ApprovedStatus status2 = APPROVED;
// ApprovedStatus status3 = REJECTED;
User user = userService.findUserByCurrentUserName();
if (user != null) {
Long id = user.getEmployee().getId();
List<EmployeeLeaves> employeeLeavesList1 = employeeLeavesRepository.findAllByEmployeeIdOrderByIdDesc(id);
model.addAttribute("requestLeavesList", employeeLeavesList1);
// List<EmployeeLeaves> employeeLeavesList2 = employeeLeavesRepository.findAllByStatusAndEmployeeId(status2, id);
// model.addAttribute("approvedLeavesList", employeeLeavesList2);
// List<EmployeeLeaves> employeeLeavesList3 = employeeLeavesRepository.findAllByStatusAndEmployeeId(status3, id);
// model.addAttribute("deniedLeavesList", employeeLeavesList3);
return "leavesRequestList";
}
return "leavesRequestList";
}
@RequestMapping("/requestListDetail")
public String requestListDetail(@RequestParam(value = "employeeLeaveId") Long employeeLeaveId, Model model) {
EmployeeLeaves employeeLeaves = employeeLeavesRepository.findById(employeeLeaveId)
.map(iss -> iss)
.orElseThrow();
List<Comments> commentsList = commentRepository.findAllByParentAndModuleId(employeeLeaveId, (long) 1);
model.addAttribute("employeeLeaveId", employeeLeaveId);
model.addAttribute("employeeLeaves", employeeLeaves);
model.addAttribute("comtList", commentsList);
return "requestListDetailForm";
}
}
| [
"sulman.mehboob@theveryoffice.com"
] | sulman.mehboob@theveryoffice.com |
eb5d9be61aeeb59b24b73175f7b6c0e31aa236c8 | 678a3d58c110afd1e9ce195d2f20b2531d45a2e0 | /sources/com/airbnb/android/contentframework/fragments/StoryFeedFragment$$Lambda$1.java | 2b19f3abdffe1650a989d38083a1ea0940e2cf71 | [] | no_license | jasonnth/AirCode | d1c37fb9ba3d8087efcdd9fa2103fb85d13735d5 | d37db1baa493fca56f390c4205faf5c9bbe36604 | refs/heads/master | 2020-07-03T08:35:24.902940 | 2019-08-12T03:34:56 | 2019-08-12T03:34:56 | 201,842,970 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 652 | java | package com.airbnb.android.contentframework.fragments;
import android.support.p000v4.widget.SwipeRefreshLayout.OnRefreshListener;
final /* synthetic */ class StoryFeedFragment$$Lambda$1 implements OnRefreshListener {
private final StoryFeedFragment arg$1;
private StoryFeedFragment$$Lambda$1(StoryFeedFragment storyFeedFragment) {
this.arg$1 = storyFeedFragment;
}
public static OnRefreshListener lambdaFactory$(StoryFeedFragment storyFeedFragment) {
return new StoryFeedFragment$$Lambda$1(storyFeedFragment);
}
public void onRefresh() {
StoryFeedFragment.lambda$onCreateView$0(this.arg$1);
}
}
| [
"thanhhuu2apc@gmail.com"
] | thanhhuu2apc@gmail.com |
4aae67d8cb3809eca186e54e87c056972c3d6bff | 099d1b1cd8046881c26b3a388acff0c9cf46a563 | /src/main/java/com/example/WowApp/Model/WorldQuest.java | 77e92c8355144d5185096b68ccc44999fb5e9bf4 | [] | no_license | jean2978/worldquest-tracker | 3308f1f39c4fb57ebba9594cf01dd8a833d934ca | 45eeb23dc6d553bee9cae61911076baed0940c27 | refs/heads/main | 2023-01-23T10:49:06.286057 | 2020-11-20T19:02:59 | 2020-11-20T19:02:59 | 304,427,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 852 | java | package com.example.WowApp.Model;
public class WorldQuest {
private boolean venomfin;
private boolean skreeg;
private boolean vraxthul;
private boolean puscilla;
private boolean blistermaw;
public boolean isVenomfin() {
return venomfin;
}
public void setVenomfin(boolean venomfin) {
this.venomfin = venomfin;
}
public boolean isSkreeg() {
return skreeg;
}
public void setSkreeg(boolean skreeg) {
this.skreeg = skreeg;
}
public boolean isVraxthul() {
return vraxthul;
}
public void setVraxthul(boolean vraxthul) {
this.vraxthul = vraxthul;
}
public boolean isPuscilla() {
return puscilla;
}
public void setPuscilla(boolean puscilla) {
this.puscilla = puscilla;
}
public boolean isBlistermaw() {
return blistermaw;
}
public void setBlistermaw(boolean blistermaw) {
this.blistermaw = blistermaw;
}
}
| [
"jeppe1934@hotmail.com"
] | jeppe1934@hotmail.com |
620a7639c4ffd32c0682e435220834f758c66bd8 | e02522140a29387738fb80af5c5980db7341c390 | /modules/metrics/src/test/java/com/spotify/apollo/metrics/ConfigTest.java | 2f580a858d18e1ec4df4be195d47279f5f63376d | [
"Apache-2.0"
] | permissive | irock/apollo | 7461650b8e60f8b024d5759e81376ae77104c264 | f97640154371c426b21d6c3bd8afa7a5eee7bc1e | refs/heads/master | 2020-12-21T19:14:30.953874 | 2019-12-09T12:03:56 | 2019-12-09T12:03:56 | 236,531,859 | 0 | 0 | Apache-2.0 | 2020-01-27T16:09:47 | 2020-01-27T16:09:46 | null | UTF-8 | Java | false | false | 1,719 | java | /*
* -\-\-
* Spotify Apollo Metrics Module
* --
* Copyright (C) 2013 - 2016 Spotify AB
* --
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* -/-/-
*/
package com.spotify.apollo.metrics;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
@RunWith(Enclosed.class)
public class ConfigTest {
public static class FfwdSettings {
@Test
public void ffwdScheduleDefaultsToEvery39Seconds() {
String json = "{}";
FfwdConfig ffwdCompletelyEmpty = new FfwdConfig(conf(json));
String ffwdjson = "{\"ffwd\":{}}";
FfwdConfig ffwdEmpty = new FfwdConfig(conf(ffwdjson));
assertEquals(30, ffwdCompletelyEmpty.getInterval());
assertEquals(30, ffwdEmpty.getInterval());
}
@Test
public void ffwdScheduleCanBeSetFromConfig() {
String json = "{\"ffwd\":{ \"interval\": 15}}";
FfwdConfig ffwd = new FfwdConfig(conf(json));
assertEquals(15, ffwd.getInterval());
}
}
private static Config conf(String json) {
return ConfigFactory.parseString(json);
}
}
| [
"petter@spotify.com"
] | petter@spotify.com |
c5990f13110a107d3b12846502d5ea7315cb2d49 | 4d05782d86c549eeea0e78fdba5b40f1d03862dc | /app/src/main/java/tech/boshu/changjiangshidai/ui/activity/stockinfo/allocatehistory/IStockAllocateHistoryPresenter.java | f2c5d1729aec245d5236f84744f4aa335a53c491 | [] | no_license | JETYIN/changjiang | 4898367cbff2b1c981aebb4b46df78a57d1d4967 | ff16ed18dddc8e197f6b2458e6b71bb8f2941fb2 | refs/heads/master | 2020-09-22T06:05:35.757974 | 2016-08-29T14:24:14 | 2016-08-29T14:24:14 | 66,849,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package tech.boshu.changjiangshidai.ui.activity.stockinfo.allocatehistory;
import tech.boshu.changjiangshidai.libs.activity.IBasePresenter;
/**
* @author allipper
* @version 1.00 2016/1/6
* @(#)IStockAllocateHistoryPresenter.java
*/
public interface IStockAllocateHistoryPresenter extends IBasePresenter {
void add();
void gotoSearch();
} | [
"494699974@qq.com"
] | 494699974@qq.com |
438e2f7d730d70dff895a5c7d8b19d204991e201 | 9d09df7eded8f2922b6e80bfeba7c9fb53ac1a60 | /org/pscafepos/backends/domain/pos/GlobalPOSPropertiesImpl.java | 3050c5c3ca74d44beba766b086d4a7445462edba | [] | no_license | bugzmanov/PSCafepos.fork | 3bcabe29cc453a9bce1440eb7ada158402b89601 | 3e1948ffc2a66c0c07ae8756a91dea47382ea5f1 | refs/heads/master | 2020-08-06T15:26:30.580054 | 2013-05-14T07:43:14 | 2013-05-14T07:43:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,734 | java | /* PSCafePOS is an Open Source Point of Sale System for Schools
* Copyright (C) 2007 Charles Syperski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.pscafepos.backends.domain.pos;
import org.pscafepos.backends.database.dao.ResultsetProcessor;
import org.pscafepos.backends.pos.IPosSettings;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import org.pscafepos.backends.database.dao.BasePOSDao;
import org.pscafepos.backends.database.dao.DAOException;
public class GlobalPOSPropertiesImpl extends BasePOSDao implements GlobalPOSProperties {
private int registrationID;
private Map<String, String> propertiesCach;
public GlobalPOSPropertiesImpl(int registrationID) {
this.registrationID = registrationID;
propertiesCach = new HashMap<String,String>();
}
public GlobalPOSPropertiesImpl(Connection connection, IPosSettings settings, int posRegistrationId) {
super(connection, settings);
this.registrationID = posRegistrationId;
}
public String getMessage() throws DAOException {
String sql = "select m_text, m_id from " + posTablesPrefix + "pos_messages where m_posid = " + registrationID + " and m_viewed <> '1'";
List<String> messages = executeQuery(sql, new ResultsetProcessor<String>() {
public String processEntity(ResultSet resultSet) throws SQLException {
String updateSql = "update " + posTablesPrefix + "pos_messages set m_viewed = '1' where m_id = '" + resultSet.getInt("m_id") + "'";
executeUpdateSqlSilently(updateSql);
return resultSet.getString("m_text");
}
});
return messages.isEmpty() ? null : messages.get(0);
}
public boolean hasMessage() throws DAOException {
String sql = "select count(*) as cnt from " + posTablesPrefix + "pos_messages where m_posid = '" + registrationID + "' and m_viewed <> '1'";
Boolean hasMessage = executeSingleResultQuery(sql, new ResultsetProcessor<Boolean>() {
public Boolean processEntity(ResultSet resultSet) throws SQLException {
return resultSet.getInt("cnt") > 0;
}
});
return hasMessage != null ? hasMessage : false;
}
public String getGeneralSettings(String key) throws DAOException {
String value = propertiesCach.get(key);
if(propertiesCach.containsKey(key)){
return value;
}
String sql = "select set_value from " + posTablesPrefix + "pos_settings where set_key = '" + key + "' and set_posid = '" + registrationID + "'";
value = executeSingleResultQuery(sql, new ResultsetProcessor<String>() {
public String processEntity(ResultSet resultSet) throws SQLException {
return resultSet.getString("set_value");
}
});
propertiesCach.put(key, value);
return value;
}
}
| [
"bugzmanov@gmail.com"
] | bugzmanov@gmail.com |
33dded92b72e0107eedc7dd2975b4b5775414c00 | 5db42e96dfa0ad3f4e3a321d610fad94f5881e53 | /jobqueue/src/main/java/com/birbit/android/jobqueue/scheduling/GcmScheduler.java | 1f9e133f8229f8526b164e178ae4fa5aea8fa905 | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | skynewborn/android-priority-jobqueue | b8ab3fc49b134add341b7bb5f530d1d2409731e6 | 7ca91565cc90be7e01ff8bda43bfa4263709bfbc | refs/heads/master | 2020-12-25T21:12:32.389618 | 2016-05-16T08:23:18 | 2016-05-16T08:23:18 | 29,381,959 | 1 | 0 | null | 2015-01-17T06:06:03 | 2015-01-17T06:06:02 | null | UTF-8 | Java | false | false | 6,683 | java | package com.birbit.android.jobqueue.scheduling;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import com.birbit.android.jobqueue.BatchingScheduler;
import com.birbit.android.jobqueue.log.JqLog;
import com.birbit.android.jobqueue.network.NetworkUtil;
import com.google.android.gms.gcm.GcmNetworkManager;
import com.google.android.gms.gcm.GcmTaskService;
import com.google.android.gms.gcm.OneoffTask;
import com.google.android.gms.gcm.Task;
import com.google.android.gms.gcm.TaskParams;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class GcmScheduler extends Scheduler {
private static final String KEY_UUID = "uuid";
private static final String KEY_ID = "id";
private static final String KEY_DELAY = "delay";
private static final String KEY_NETWORK_STATUS = "networkStatus";
private static SharedPreferences preferences;
private final GcmNetworkManager gcmNetworkManager;
private final Class<? extends GcmJobSchedulerService> serviceClass;
public GcmScheduler(Context context, Class<? extends GcmJobSchedulerService> serviceClass) {
this.serviceClass = serviceClass;
gcmNetworkManager = GcmNetworkManager.getInstance(context.getApplicationContext());
}
private static SharedPreferences getPreferences(Context context) {
synchronized (GcmScheduler.class) {
if (preferences == null) {
preferences = context.getSharedPreferences("jobqueue_gcm_scheduler",
Context.MODE_PRIVATE);
}
return preferences;
}
}
/**
* Creates a new ID for the job info. Can be overridden if you need to provide different ids not
* to conflict with the rest of your application.
*
* @return A unique integer id for the next Job request to be sent to system scheduler
*/
@SuppressLint("CommitPrefEdits")
public int createId() {
synchronized (GcmScheduler.class) {
final SharedPreferences preferences = getPreferences(getApplicationContext());
final int id = preferences.getInt(KEY_ID, 0) + 1;
preferences.edit().putInt(KEY_ID, id).commit();
return id;
}
}
@Override
public void request(SchedulerConstraint constraint) {
if (JqLog.isDebugEnabled()) {
JqLog.d("creating gcm wake up request for %s", constraint);
}
OneoffTask oneoffTask = new OneoffTask.Builder()
.setExecutionWindow(constraint.getDelayInMs(), constraint.getDelayInMs()
+ getExecutionWindowSizeInSeconds())
.setRequiredNetwork(toNetworkState(constraint.getNetworkStatus()))
.setPersisted(true)
.setService(serviceClass)
.setTag("jobmanager-" + createId())
.setExtras(toBundle(constraint))
.build();
gcmNetworkManager.schedule(oneoffTask);
}
/**
* GCMNetworkManager accepts an execution window for jobs so that it can batch them together for
* better battery utilization. You can override this method to provide a different execution
* window. The default value is {@link BatchingScheduler#DEFAULT_BATCHING_PERIOD_IN_MS} (converted
* to seconds).
*
* @return The execution window time for the Job request
*/
public long getExecutionWindowSizeInSeconds() {
return TimeUnit.MILLISECONDS.toSeconds(BatchingScheduler.DEFAULT_BATCHING_PERIOD_IN_MS);
}
@Override
public void cancelAll() {
gcmNetworkManager.cancelAllTasks(serviceClass);
}
private static int toNetworkState(@NetworkUtil.NetworkStatus int networkStatus) {
switch (networkStatus) {
case NetworkUtil.DISCONNECTED:
return Task.NETWORK_STATE_ANY;
case NetworkUtil.METERED:
return Task.NETWORK_STATE_CONNECTED;
case NetworkUtil.UNMETERED:
return Task.NETWORK_STATE_UNMETERED;
}
JqLog.e("unknown network status %d. Defaulting to CONNECTED", networkStatus);
return Task.NETWORK_STATE_CONNECTED;
}
private static Bundle toBundle(SchedulerConstraint constraint) {
Bundle bundle = new Bundle();
// put boolean is api 22
bundle.putString(KEY_UUID, constraint.getUuid());
bundle.putInt(KEY_NETWORK_STATUS, constraint.getNetworkStatus());
bundle.putLong(KEY_DELAY, constraint.getDelayInMs());
return bundle;
}
private static SchedulerConstraint fromBundle(Bundle bundle) {
SchedulerConstraint constraint = new SchedulerConstraint(bundle.getString(KEY_UUID));
if (constraint.getUuid() == null) {
// backward compatibility
constraint.setUuid(UUID.randomUUID().toString());
}
constraint.setNetworkStatus(bundle.getInt(KEY_NETWORK_STATUS, NetworkUtil.DISCONNECTED));
constraint.setDelayInMs(bundle.getLong(KEY_DELAY, 0));
return constraint;
}
public int onStartJob(TaskParams taskParams) {
SchedulerConstraint constraint = fromBundle(taskParams.getExtras());
if (JqLog.isDebugEnabled()) {
JqLog.d("starting job %s", constraint);
}
ResultCallback callback = new ResultCallback();
constraint.setData(callback);
start(constraint);
return callback.get() ? GcmNetworkManager.RESULT_RESCHEDULE : GcmNetworkManager.RESULT_SUCCESS;
}
@Override
public void onFinished(SchedulerConstraint constraint, boolean reschedule) {
Object data = constraint.getData();
if (JqLog.isDebugEnabled()) {
JqLog.d("finished job %s", constraint);
}
if (data instanceof ResultCallback) {
ResultCallback callback = (ResultCallback) data;
callback.onDone(reschedule);
}
}
private static class ResultCallback {
volatile boolean reschedule;
CountDownLatch latch;
public ResultCallback() {
latch = new CountDownLatch(1);
reschedule = false;
}
public boolean get() {
try {
latch.await(10 * 60, TimeUnit.SECONDS);
} catch (InterruptedException e) {
JqLog.e("job did not finish in 10 minutes :/");
}
return reschedule;
}
public void onDone(boolean reschedule) {
this.reschedule = reschedule;
latch.countDown();
}
}
}
| [
"skynewborn@gmail.com"
] | skynewborn@gmail.com |
5c3ddac52c14f1c77191940544b988a592f175da | dd39d6f7c5129d8d3a9d597245cc9e4f220eeb8d | /src/main/java/geym/nn/mlperceptron/MIPerceptronAndOutputNoLearn.java | 53cc51bf17c3d58c4d500e3da087acabf1816139 | [] | no_license | anglabace/nn.practice | 2a0bb74bffa6634895825da7d8ce8d5f6941a1bd | 069ba22810ea6461d7551bd18c7c8c4508f43bab | refs/heads/master | 2022-04-07T20:06:49.061136 | 2020-02-24T15:24:31 | 2020-02-24T15:24:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,413 | java | package geym.nn.mlperceptron;
import org.neuroph.core.Connection;
import org.neuroph.core.Layer;
import org.neuroph.core.Neuron;
import org.neuroph.core.Weight;
import org.neuroph.core.input.And;
import org.neuroph.core.transfer.Linear;
import org.neuroph.nnet.comp.neuron.BiasNeuron;
import org.neuroph.nnet.comp.neuron.InputNeuron;
import org.neuroph.util.*;
import java.util.List;
public class MIPerceptronAndOutputNoLearn extends MlPerceptron {
public MIPerceptronAndOutputNoLearn(TransferFunctionType transferFunctionType, int... neuronsInLayers) {
super(transferFunctionType, neuronsInLayers);
}
@Override
protected void createNetWork(List<Integer> neuronsInLayers, NeuronProperties neuronProperties) {
this.setNetworkType(NeuralNetworkType.MULTI_LAYER_PERCEPTRON);
NeuronProperties inputNeuronProperties = new NeuronProperties(InputNeuron.class, Linear.class);
Layer layer = LayerFactory.createLayer(neuronsInLayers.get(0), inputNeuronProperties);
layer.addNeuron(new BiasNeuron());
this.addLayer(layer);
Layer prevLayer = layer;
int layerIdx;
for (layerIdx = 1; layerIdx < neuronsInLayers.size() - 1; layerIdx++) {
Integer neuronsNum = neuronsInLayers.get(layerIdx);
layer = LayerFactory.createLayer(neuronsNum, neuronProperties);
layer.addNeuron(new BiasNeuron());
this.addLayer(layer);
ConnectionFactory.fullConnect(prevLayer, layer);
prevLayer = layer;
}
Neuron n1=layer.getNeuronAt(0);
List<Connection> c1=n1.getInputConnections();
c1.get(0).setWeight(new Weight(2));
c1.get(1).setWeight(new Weight(2));
c1.get(2).setWeight(new Weight(-1));
Neuron n2=layer.getNeuronAt(1);
List<Connection> c2=n2.getInputConnections();
c2.get(0).setWeight(new Weight(-2));
c2.get(1).setWeight(new Weight(-2));
c2.get(2).setWeight(new Weight(3));
//建立输出层
Integer neuronsNum=neuronsInLayers.get(layerIdx);
NeuronProperties outProperties=new NeuronProperties();
outProperties.put("inputFunction", And.class);
layer=LayerFactory.createLayer(neuronsNum,outProperties);
this.addLayer(layer);
ConnectionFactory.fullConnect(prevLayer,layer);
NeuralNetworkFactory.setDefaultIO(this);
}
}
| [
"jimma0312@outlook.com"
] | jimma0312@outlook.com |
28a0b28c12d7a4c694d051cbe42f64e9bd9d17fb | 6721c72a07072a52fe6a4984c7ecad7db22cac7e | /verclaim/src/main/java/com/idhub/magic/did/parser/ParserContext.java | 56d54c02492ff2a5ae0a59984accf34b1197a04c | [] | no_license | idhub-did-plus/magic-center | f5502e1190d795c9737a1edd9ab4f2e2b2c84f2c | ac3cd126882de91bcfc7b4c8bda811976b5a2c8c | refs/heads/master | 2020-07-05T03:09:31.618624 | 2020-06-15T08:01:07 | 2020-06-15T08:01:07 | 202,502,778 | 0 | 0 | null | 2019-08-15T08:22:09 | 2019-08-15T08:22:09 | null | UTF-8 | Java | false | false | 2,292 | java | /* -----------------------------------------------------------------------------
* ParserContext.java
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Fri Apr 19 22:09:52 CEST 2019
*
* -----------------------------------------------------------------------------
*/
package com.idhub.magic.did.parser;
import java.util.Stack;
public class ParserContext {
public final String text;
public int index;
private Stack<Integer> startStack = new Stack<Integer>();
private Stack<String> callStack = new Stack<String>();
private Stack<String> errorStack = new Stack<String>();
private int level = 0;
private int errorIndex = 0;
private final boolean traceOn;
public ParserContext(String text, boolean traceOn) {
this.text = text;
this.traceOn = traceOn;
index = 0;
}
public void push(String rulename) {
push(rulename, "");
}
public void push(String rulename, String trace) {
callStack.push(rulename);
startStack.push(new Integer(index));
if (traceOn) {
System.out.println("-> " + ++level + ": " + rulename + "(" + (trace != null ? trace : "") + ")");
System.out.println(
index + ": " + text.substring(index, index + 10 > text.length() ? text.length() : index + 10)
.replaceAll("[\\x00-\\x1F]", " "));
}
}
public void pop(String function, boolean result) {
Integer start = startStack.pop();
callStack.pop();
if (traceOn) {
System.out.println("<- " + level-- + ": " + function + "(" + (result ? "true" : "false") + ",s=" + start
+ ",l=" + (index - start) + ",e=" + errorIndex + ")");
}
if (!result) {
if (index > errorIndex) {
errorIndex = index;
errorStack = new Stack<String>();
errorStack.addAll(callStack);
} else if (index == errorIndex && errorStack.isEmpty()) {
errorStack = new Stack<String>();
errorStack.addAll(callStack);
}
} else {
if (index > errorIndex)
errorIndex = 0;
}
}
public Stack<String> getErrorStack() {
return errorStack;
}
public int getErrorIndex() {
return errorIndex;
}
}
/*
* -----------------------------------------------------------------------------
* eof
* -----------------------------------------------------------------------------
*/
| [
"1353813001@qq.com"
] | 1353813001@qq.com |
3ffd5fa8a76546604603e8ae0e1674a459f350a5 | f67beaa4e7ff2dbb7315a3d1d64e9285d94dd7b3 | /phoenix-ui/src/main/java/com/guoxiaoxing/phoenix/picker/ui/camera/config/model/Record.java | 1a9ace368e7417fba82fb7a67ddd3d191654159c | [
"Apache-2.0"
] | permissive | lianwt115/qmqiu | c7a731cd07861648cd1ed5a8a31f3aa4260fc636 | 2fec69b68b593b6eca530019f383d25699b6650b | refs/heads/master | 2020-04-01T00:13:53.677088 | 2019-07-31T09:03:50 | 2019-07-31T09:03:50 | 152,687,979 | 5 | 2 | null | null | null | null | UTF-8 | Java | false | false | 541 | java | package com.guoxiaoxing.phoenix.picker.ui.camera.config.model;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import androidx.annotation.IntDef;
public class Record {
public static final int TAKE_PHOTO_STATE = 0;
public static final int READY_FOR_RECORD_STATE = 1;
public static final int RECORD_IN_PROGRESS_STATE = 2;
@IntDef({TAKE_PHOTO_STATE, READY_FOR_RECORD_STATE, RECORD_IN_PROGRESS_STATE})
@Retention(RetentionPolicy.SOURCE)
public @interface RecordState {
}
}
| [
"lianwt115@163.com"
] | lianwt115@163.com |
c24b01e27f913f566d19bfba08bd657652d83904 | 46ff29d986dbc25e8f104bf19b19a5daea96c05d | /src/main/java/com/dewey/core/controller/DataInsertController.java | 1c79846d5cacc2201a37e7b47d49ba59de916daa | [] | no_license | DeweyNULL/dataMaker | 1e661015c084fbafbe162749933a6bdca58febbd | 100064a7ed0a46d35666d526250784e78f61b25d | refs/heads/master | 2022-07-03T16:33:04.170412 | 2019-07-26T08:48:53 | 2019-07-26T08:48:53 | 198,635,796 | 0 | 0 | null | 2022-06-21T01:32:14 | 2019-07-24T12:56:20 | Java | UTF-8 | Java | false | false | 1,901 | java | package com.dewey.core.controller;
import com.alibaba.fastjson.JSONObject;
import com.dewey.core.service.DataInsertService;
import com.dewey.core.utils.MapUtils;
import com.dewey.core.utils.TaskMapUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ThreadPoolExecutor;
/**
* @program dataMaker
* @description: 数据开始插入
* @author: xielinzhi
* @create: 2019/07/24 20:11
*/
@RestController
@RequestMapping("/insert")
@Slf4j
public class DataInsertController {
@Autowired
DataInsertService dataInsertService;
@PostMapping("/start")
public ResponseEntity add(@RequestBody Map<String, Object> params){
Map<String ,Object> returnMap = new HashMap<>();
int id = MapUtils.getInteger(params,"id",0);
int size = MapUtils.getInteger(params,"size",0);
String tableName = MapUtils.getString(params,"tableName","");
returnMap.put("msg",dataInsertService.insertTask(id,size,tableName));
return ResponseEntity.ok(returnMap);
}
@PostMapping("/check")
public ResponseEntity getSchedule(@RequestBody Map<String, Object> params){
Map<String ,Object> returnMap = new HashMap<>();
int id = MapUtils.getInteger(params,"id",0);
int size = MapUtils.getInteger(params,"size",0);
String tableName = MapUtils.getString(params,"tableName","");
returnMap.put("schedule",dataInsertService.checkTask(id,tableName,size));
return ResponseEntity.ok(returnMap);
}
}
| [
"xielz@bsfit.com.cn"
] | xielz@bsfit.com.cn |
19816d04b69eed4458bac9c236494ecfc53d3aa7 | d00ee8570e4b88cbee1aa0280d5748e8ba03db1c | /exampleplain/src/main/java/com/anadeainc/exampleplain/firstscreen/FirstPresenter.java | 929e6c18bed882e4591f294bd6ed673c207ca3ac | [
"LicenseRef-scancode-public-domain",
"Unlicense"
] | permissive | shinevit/LightMVP | ad49c9b6ab548505503fa0a0deb68d1c7c4cee16 | 500cc31e3eefddb01afc712149d144b2f3cb99c5 | refs/heads/master | 2020-03-11T15:36:59.516748 | 2017-02-08T14:25:03 | 2017-02-08T14:25:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | package com.anadeainc.exampleplain.firstscreen;
import android.support.annotation.NonNull;
import com.anadeainc.lightmvp.Presenter;
class FirstPresenter extends Presenter<FirstMvp.View> implements FirstMvp.Presenter {
private int counter;
@Override
public void attachView(@NonNull FirstMvp.View mvpView) {
super.attachView(mvpView);
mvpView().setScreenTitle();
mvpView().setCounter(++counter);
}
@Override
public void onButtonClick() {
mvpView().toSecondActivity();
}
}
| [
"and@anahoret.com"
] | and@anahoret.com |
1e7841ed260f65a3345074e7b916c2974d40c542 | 7e3eb8ba00f4a7b86ad525125abd8bd4f77650c1 | /mobile/src/main/java/com/isoftzone/yoappstore/adapter/SubCatAdapter.java | 4bfd38682b9c7d747accc89455c8725c5a298629 | [] | no_license | chetanthakurgit/YoAppConsumer | 5a26a064f8bd9380002cf8362899b4aa76f3dbb3 | ae4a0934539ea79c35eb556b233a07cef6c18b51 | refs/heads/master | 2022-12-28T06:45:57.530141 | 2020-10-13T08:37:53 | 2020-10-13T08:37:53 | 302,822,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,292 | java | package com.isoftzone.yoappstore.adapter;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.isoftzone.yoappstore.R;
import com.isoftzone.yoappstore.bean.CompanyDetails;
import com.isoftzone.yoappstore.bean.SubCategoryBean;
import com.nostra13.universalimageloader.core.ImageLoader;
import java.util.ArrayList;
public class SubCatAdapter extends RecyclerView.Adapter<SubCatAdapter.MyViewHolder> {
private ArrayList<SubCategoryBean> subCategoryBeanArrayList;
private Context context;
private Listner recyclerClickDelegate;
protected ImageLoader imageLoader;
public interface Listner {
void onClickSubCat(int pos, String subCatId, SubCategoryBean bean);
}
public SubCatAdapter(ArrayList<SubCategoryBean> subCategoryBeanArrayList, ImageLoader imageLoader, Context context,
Listner recyclerClickDelegate) {
this.subCategoryBeanArrayList = subCategoryBeanArrayList;
this.imageLoader = imageLoader;
this.context = context;
this.recyclerClickDelegate = recyclerClickDelegate;
}
@NonNull
@Override
public SubCatAdapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if (CompanyDetails.getInstance().getDetails().getSubcat_grid().equalsIgnoreCase("0")) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.subcat_row, parent, false);
return new MyViewHolder(view);
} else {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.subcat_rowgrid, parent, false);
return new MyViewHolder(view);
}
}
@Override
public void onBindViewHolder(@NonNull final MyViewHolder holder, final int position) {
final SubCategoryBean bean = subCategoryBeanArrayList.get(position);
holder.titleTextView.setText(bean.getSubCatName());
String imgPath = bean.getThumbnail_image().trim().replaceAll(" ", "%20");
imageLoader.displayImage(imgPath, holder.homeRowIcon);
holder.descTextView.setText(bean.getSubCatDesc());
holder.linearHome.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
recyclerClickDelegate.onClickSubCat(position, bean.getId(), bean);
}
});
}
@Override
public int getItemCount() {
return subCategoryBeanArrayList.size();
}
public static class MyViewHolder extends RecyclerView.ViewHolder {
private TextView titleTextView;
private TextView descTextView;
private ImageView homeRowIcon;
private LinearLayout linearHome;
public MyViewHolder(View view) {
super(view);
titleTextView = view.findViewById(R.id.titleTextView);
descTextView = view.findViewById(R.id.descTextView);
homeRowIcon = view.findViewById(R.id.homeRowIcon);
linearHome = view.findViewById(R.id.linearHome);
}
}
}
| [
"t.chetan@isoftzone.com"
] | t.chetan@isoftzone.com |
be8f41680d056b05e46400dd81e89aee1fc19698 | 45dd9e8dc389f9f99e4f4e626dd2b03aec7329bc | /app/src/main/java/com/aiqing/kaiheiba/MyActivity.java | e507cce617f0e8ca0273734914431c4654a931b4 | [] | no_license | huxq17/app | fb0538f375ad2c85c677da58429bdc10ea5437ab | d80be52541ce064affbc4b87455a4e6861bc432c | refs/heads/master | 2020-03-07T09:46:06.305994 | 2018-05-19T14:28:23 | 2018-05-19T14:28:23 | 127,415,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,023 | java | package com.aiqing.kaiheiba;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.aiqing.kaiheiba.common.BaseActivity;
import com.aiqing.kaiheiba.login.LoginAct;
import com.aiqing.kaiheiba.neteasyim.IMActivity;
import com.aiqing.kaiheiba.personal.download.MyDownloadAct;
import com.aiqing.kaiheiba.personal.invite.InviteFriendAct;
import com.aiqing.kaiheiba.personal.profile.EditPersonProfileAct;
import com.aiqing.kaiheiba.personal.relationship.MyFansAct;
import com.aiqing.kaiheiba.personal.relationship.MyFollowAct;
import com.aiqing.kaiheiba.personal.wallet.MyWalletAct;
import com.aiqing.kaiheiba.personal.wallet.TradeRecordAct;
import com.aiqing.kaiheiba.settings.SettingsAct;
import pub.devrel.easypermissions.AfterPermissionGranted;
public class MyActivity extends BaseActivity {
private final int RC_BASIC_PERMISSIONS = 1;
/**
* 基本权限管理
*/
private final String[] BASIC_PERMISSIONS = new String[]{
android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
android.Manifest.permission.READ_EXTERNAL_STORAGE,
android.Manifest.permission.CAMERA,
android.Manifest.permission.READ_PHONE_STATE,
android.Manifest.permission.RECORD_AUDIO,
android.Manifest.permission.ACCESS_COARSE_LOCATION,
android.Manifest.permission.ACCESS_FINE_LOCATION
};
@AfterPermissionGranted(RC_BASIC_PERMISSIONS)
private void onBasicPermissionGranted() {
// takePhoto();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void jumpToPersonalProfile(View v) {
jumpTo(EditPersonProfileAct.class);
}
public void jumpToMyFollow(View v) {
jumpTo(MyFollowAct.class);
}
public void jumpToMyFans(View v) {
jumpTo(MyFansAct.class);
}
public void jumpToMyDowload(View v) {
jumpTo(MyDownloadAct.class);
}
public void jumpToMyWallet(View v) {
jumpTo(MyWalletAct.class);
}
public void jumpToTradeRecord(View v) {
jumpTo(TradeRecordAct.class);
}
public void jumpToInviteFriend(View v) {
jumpTo(InviteFriendAct.class);
}
public void jumpToSettings(View v) {
jumpTo(SettingsAct.class);
}
public void jumpToLogin(View v) {
jumpTo(LoginAct.class);
}
public void jumpToIM(View v) {
jumpTo(IMActivity.class);
}
private void jumpTo(Class<?> activity) {
Intent intent = new Intent(this, activity);
startActivity(intent);
}
public static void start(Context context) {
Intent intent = new Intent(context, MyActivity.class);
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(intent);
}
}
| [
"huxq17@163.com"
] | huxq17@163.com |
3173796a023db2f0aef36f22eabd68800786b47d | 534d10446c104ca6efde8db41460aa5928800777 | /src/main/java/com/niit/interact/daoimpl/BlogLikesDAOImpl.java | 9f07c0a360dbe88a0e45b0d895823b1ffaa80ba0 | [] | no_license | TejaswiGudimalla/InteractBackEnd | 2bb901d4f186d54cb76a87b91f3f0f0ab11cd30b | 993ebf5c71127941a844dcbece5b6a1b66183396 | refs/heads/master | 2020-04-06T04:12:32.597514 | 2017-03-18T04:04:28 | 2017-03-18T04:04:28 | 83,013,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,254 | java | package com.niit.interact.daoimpl;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.niit.interact.dao.BlogLikesDAO;
import com.niit.interact.model.BlogLikes;
@SuppressWarnings({ "unchecked", "deprecation" })
@Repository
public class BlogLikesDAOImpl implements BlogLikesDAO {
@Autowired
private SessionFactory sessionFactory;
public BlogLikesDAOImpl(SessionFactory sessionFactory) {
this.sessionFactory=sessionFactory;
}
@Transactional
public boolean saveOrUpdate(BlogLikes blogLikes) {
try {
sessionFactory.getCurrentSession().saveOrUpdate(blogLikes);
System.out.println("save");
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
@Transactional
public boolean delete(BlogLikes blogLikes) {
try {
sessionFactory.getCurrentSession().delete(blogLikes);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
@SuppressWarnings("rawtypes")
@Transactional
public BlogLikes list(int uid, int bid) {
String hql="from Bloglikes where blogid='"+bid+"' and userid='"+uid+"'";
Query query=sessionFactory.getCurrentSession().createQuery(hql);
List<BlogLikes>list= query.list();
if(list==null)
{
return null;
}
else
{
return list.get(0);
}
}
@Transactional
public List<BlogLikes> bloglist(int bid) {
Criteria c=sessionFactory.getCurrentSession().createCriteria(BlogLikes.class);
c.add(Restrictions.eq("blogid",bid));
List<BlogLikes> list=c.list();
return list;
}
@Transactional
public List<BlogLikes> list(int uid) {
// Criteria c=sessionFactory.getCurrentSession().createCriteria(BlogLikes.class);
String hql = "from BlogLikes where userid ="+uid;
List<BlogLikes> list=sessionFactory.getCurrentSession().createQuery(hql).list();
System.err.println("featching BlogLikes..........!");
return list;
}
}
| [
"hp-pc@Teja"
] | hp-pc@Teja |
2a8f70a12b87d2c97faa5a09fc4b60ffdfcba608 | 5be21acad34d8f53c77d30a9f847c7dced179e8d | /microservice-consumer-safe-manage/src/main/java/com/cloud/consumer/safe/service/IBaseUserService.java | 6528a562703b88f4f5cadda5f6454a5336a18a1e | [] | no_license | comeNie/safe | 38a260422b5fb1b05eec7fdb1c663566b09d5089 | 7e895588f4152806ca05b30a94c0aedbb9c5f839 | refs/heads/master | 2020-05-29T14:24:19.086960 | 2019-05-24T02:52:35 | 2019-05-24T02:52:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | package com.cloud.consumer.safe.service;
import com.alibaba.fastjson.JSONObject;
public interface IBaseUserService {
/**
* 用户登录
* @param params
* @return JSONObject
*/
public JSONObject login(Object params);
} | [
"wei442@sina.com"
] | wei442@sina.com |
3dc86fdb000bce173a388f844b98096484de5604 | 0de4ed4a4434063f9c6974b5e1bc7b5953bd5265 | /src/main/java/com/example/demo/model/Game.java | 55d6e329061ae3e9b28ce5dcd3e4a5f8e88c6c3f | [] | no_license | contactniraj/tictactoe | 6ad62ff3cb83f36de9e4d16b1f7101673958c12b | ccf1cced53ae2a8544828ab85f5548bc98ac30bd | refs/heads/master | 2021-05-07T16:56:59.514573 | 2017-10-30T22:50:08 | 2017-10-30T22:50:08 | 108,688,200 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,693 | java | package com.example.demo.model;
import com.example.demo.exceptions.GameException;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
@EqualsAndHashCode(exclude={"board", "gameSteps"})
public class Game {
@Getter
@Setter
private String id;
@Getter
private char[][] board = new char[3][3];
@Getter
private Player player1;
@Getter
private Player player2;
@Getter
private Player winner;
private List<GameStep> gameSteps;
public Game(String channelId, String player1, String player2){
this.id = channelId;
this.player1 = new Player(player1);
this.player2 = new Player(player2);
char count = '1';
for(int i=0; i<board.length; i++){
for(int j=0;j<board.length;j++){
board[i][j] = count++;
}
}
}
public Response start(){
this.player1.setSymbol('X');
this.player2.setSymbol('O');
this.gameSteps = new ArrayList<>();
return new Response(null, board, "", player1, player2);
}
public Response start(String id, Player p1, Player p2){
this.player1 = p1;
this.player1.setSymbol('X');
this.player2 = p2;
this.player2.setSymbol('O');
this.gameSteps = new ArrayList<>();
return new Response(null, board, "", player1, player2);
}
public Response play(Player player, int x, int y){
validateUser(player);
validateCell(x,y);
gameSteps.add(new GameStep(player, x, y));
board[x][y] = player.getSymbol();
doPlayerWon(player, x, y);
Player nextPlayer = getNextPlayer(player);
if(this.winner != null){
return new Response(winner, board,
"", player,
nextPlayer,
"Congratulations " + winner.toString() +", you won!! Play again soon");
}
return new Response(null,
board,
"",
player,
nextPlayer,
"Game on, Take your turn " + nextPlayer.toString());
}
public void doPlayerWon(Player player, int x, int y) {
char symbol = player.getSymbol();
boolean hasWon = (board[x][0] == symbol && symbol == board[x][1] && symbol == board[x][2])
|| (board[0][y] == symbol && board[1][y] == symbol && symbol == board[2][y])
|| (x == y && board[0][0] == symbol && board[1][1] == symbol && board[2][2] == symbol)
|| (x + y == 2 && board[0][2] == symbol && symbol == board[1][1] && board[2][0] == symbol);
if(hasWon) {
winner = player;
};
}
private void validateUser(Player p){
if(!(p.equals(player1) || p.equals(player2))) {
throw new GameException(this, p.getId() + " cannot participate in this game");
}
if(gameSteps.size() > 0 && p.equals(gameSteps.get(gameSteps.size()-1).getPlayer())){
throw new GameException(this, "Wait!! go slow. Next play belongs to other user " + getNextPlayer(p).toString());
}
}
private void validateCell(int x, int y){
if(!( (0 <= x && x < board.length) || (0 <= y && y < board[0].length))){
throw new GameException(this, "Please know your boundries[1-9] for game :D ");
}
if(board[x][y] == 'X' || board[x][y] == 'O'){
throw new GameException(this, "Please choose unused slot");
}
}
public Response view(String channel){
Player winner = getWinner();
Player nextPlayer = gameSteps.size() > 0?getNextPlayer(gameSteps.get(gameSteps.size()-1).getPlayer()):player1;
if(winner != null){
return new Response(winner, board, "",
gameSteps.get(gameSteps.size()-1).getPlayer(), nextPlayer,
"Congratulations " + winner.toString() +", you won!! Play again soon");
}
return new Response(null, board,"",
gameSteps.get(gameSteps.size()-1).getPlayer(), nextPlayer,
"Game on," + nextPlayer.toString() + " takes the next turn" );
}
public boolean isFinished(){
return true;
}
public boolean isRowUnique(char[] row, char ch){
boolean isUnique = true;
for(char c:row){
if(c != ch){
return false;
}
}
return isUnique;
}
public boolean isColumnUnique(int column, char ch){
boolean isUnique = true;
for(int i=0; i<board[0].length;i++ ){
if(board[i][column] != ch){
return false;
}
}
return isUnique;
}
public boolean isDiagonalUniqe(char ch){
boolean isUnique = true;
for(int i=0, j=0; i<board.length; i++,j++){
if(board[i][j] != ch){
return false;
}
}
for(int i=0, j=board.length-1; i<board.length; i++, j--){
if(board[i][j] != ch){
return false;
}
}
return isUnique;
}
public Player getPlayerById(String id){
if(player1.getId().equals(id)){
return player1;
}else if(player2.getId().equals(id)){
return player2;
}
return null;
}
public Player getNextPlayer(Player currentPlayer){
if(player1.getId().equals(currentPlayer.getId())){
return player2;
}else{
return player1;
}
}
public boolean isGameDone(){
return gameSteps.size() == 9;
}
}
| [
"contactniraj@gmail.com"
] | contactniraj@gmail.com |
84547ff43b60bce6745a5c3128085fe6676e0a9d | 97c0a67db6558f8ade85dbadb771ac257d5a0e8c | /opentasks/src/main/java/org/dmfs/tasks/widget/PercentageFieldView.java | f560d7e6d49c0e1a98b2a05f392c91b8780f2eb4 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | sknaht/mobad-opentasks | 29079d792aeab939da0bbec58632f3e20ab70fe7 | f436d770aeb20b49f1b21363567f6d30bca6b36a | refs/heads/master | 2021-01-21T13:18:09.876101 | 2016-04-26T22:38:11 | 2016-04-26T22:38:11 | 54,916,577 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,353 | java | /*
* Copyright (C) 2013 Marten Gajda <marten@dmfs.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dmfs.tasks.widget;
import org.dmfs.tasks.R;
import org.dmfs.tasks.model.ContentSet;
import org.dmfs.tasks.model.FieldDescriptor;
import org.dmfs.tasks.model.adapters.IntegerFieldAdapter;
import org.dmfs.tasks.model.layout.LayoutOptions;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
/**
* Widget to display Integer values.
*
* @author Arjun Naik <arjun@arjunnaik.in>
*/
public class PercentageFieldView extends AbstractFieldView
{
private IntegerFieldAdapter mAdapter;
private TextView mText;
private ProgressBar mProgress;
public PercentageFieldView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
}
public PercentageFieldView(Context context, AttributeSet attrs)
{
super(context, attrs);
}
public PercentageFieldView(Context context)
{
super(context);
}
@Override
protected void onFinishInflate()
{
super.onFinishInflate();
mText = (TextView) findViewById(R.id.text);
mProgress = (ProgressBar) findViewById(R.id.percentage_progress_bar);
}
@Override
public void setFieldDescription(FieldDescriptor descriptor, LayoutOptions layoutOptions)
{
super.setFieldDescription(descriptor, layoutOptions);
mAdapter = (IntegerFieldAdapter) descriptor.getFieldAdapter();
}
@Override
public void onContentChanged(ContentSet contentSet)
{
if (mValues != null && mAdapter.get(mValues) != null)
{
int percentage = mAdapter.get(mValues);
mProgress.setProgress(percentage);
mText.setText(Integer.toString(percentage) + "%");
setVisibility(View.VISIBLE);
}
else
{
setVisibility(View.GONE);
}
}
}
| [
"yangzy.orz@gmail.com"
] | yangzy.orz@gmail.com |
97d9192bb9e1261bf4915406b95286b4c1daf72d | e6d47d1d0d9f5f644bcf05ff9ed866517340c38a | /example-web-struts/src/main/java/cn/fireface/call/web/action/HelloAction.java | 7de37de539c32cd49fd33865640f0ce44d060f94 | [] | no_license | GoWith/callChain | 2e56c92ec7e02a0e12b4408230fc6d635b884ea1 | 042d38576d6671855e43877c5423a54c25ca4fef | refs/heads/master | 2023-06-09T19:53:36.456824 | 2023-05-29T05:50:42 | 2023-05-29T05:50:42 | 155,153,424 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 761 | java | package cn.fireface.call.web.action;
import cn.fireface.call.core.proxy.CallChain;
import cn.fireface.call.web.service.HelloService;
import cn.fireface.call.web.uitls.RandomTime;
import com.opensymphony.xwork2.ActionSupport;
/**
* Created by maoyi on 2018/10/29.
* don't worry , be happy
*/
@CallChain
public class HelloAction extends ActionSupport{
public String hello() throws InterruptedException {
Thread.sleep(RandomTime.next());
new HelloService().sayHello();
new HelloService().sayBye();
return SUCCESS;
}
public String hi() throws InterruptedException {
Thread.sleep(RandomTime.next());
new HelloService().sayHello();
new HelloService().sayBye();
return SUCCESS;
}
}
| [
"maoyi@jd.com"
] | maoyi@jd.com |
be762274ded917badf3be9253f2136b0978efa8b | 70edbd5fdeb05cb4b87a0129bc0598e3d0904afc | /src/main/java/it/michelepiccirillo/mirror/reflect/QNameMap.java | 4dc6807142627bf4585585ba7b00e45374d73f12 | [] | no_license | lordofthelake/mirror | 50c362313fdf46948dd1c3f965d1a3590c536d6a | 2479e7d181a13529b8bd18213ebb192a54a5ffab | refs/heads/master | 2020-05-18T08:18:12.547275 | 2013-06-25T17:04:57 | 2013-06-25T17:04:57 | 10,943,524 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,711 | java | package it.michelepiccirillo.mirror.reflect;
import javax.xml.namespace.QName;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* Represents a mapping of {@link QName} instances to Java class names
* allowing class aliases and namespace aware mappings of QNames to class names.
*
* @version $Revision: 1345 $
*/
public class QNameMap {
private String defaultNamespace = "";
private String defaultPrefix = "";
private Map javaToQName;
// lets make the mapping a no-op unless we specify some mapping
private Map qnameToJava;
public String getDefaultNamespace() {
return defaultNamespace;
}
public String getDefaultPrefix() {
return defaultPrefix;
}
/**
* Returns the Java class name that should be used for the given QName.
* If no explicit mapping has been made then the localPart of the QName is used
* which is the normal default in XStream.
*/
public String getJavaClassName(QName qname) {
if (qnameToJava != null) {
String answer = (String) qnameToJava.get(qname);
if (answer != null) {
return answer;
}
}
return qname.getLocalPart();
}
/**
* Returns the Java class name that should be used for the given QName.
* If no explicit mapping has been made then the localPart of the QName is used
* which is the normal default in XStream.
*/
public QName getQName(String javaClassName) {
if (javaToQName != null) {
QName answer = (QName) javaToQName.get(javaClassName);
if (answer != null) {
return answer;
}
}
return new QName(defaultNamespace, javaClassName, defaultPrefix);
}
/**
* Registers the mapping of the type to the QName
*/
public synchronized void registerMapping(QName qname, Class type) {
registerMapping(qname, type.getName());
}
/**
* Registers the mapping of the Java class name to the QName
*/
public synchronized void registerMapping(QName qname, String javaClassName) {
if (javaToQName == null) {
javaToQName = Collections.synchronizedMap(new HashMap());
}
if (qnameToJava == null) {
qnameToJava = Collections.synchronizedMap(new HashMap());
}
javaToQName.put(javaClassName, qname);
qnameToJava.put(qname, javaClassName);
}
public void setDefaultNamespace(String defaultNamespace) {
this.defaultNamespace = defaultNamespace;
}
public void setDefaultPrefix(String defaultPrefix) {
this.defaultPrefix = defaultPrefix;
}
}
| [
"michele.piccirillo@gmail.com"
] | michele.piccirillo@gmail.com |
a08685f8155f858ea8c6e06a2535ae8cd7ecd796 | 31a6fa040421d9d9869bcfea377dae84e6319ef0 | /49-GroupAnagrams/Solution.java | 7954761db23a2c36ce8f8280e4f16b1a41d7620b | [] | no_license | JiananZhang/leetcode-answers | 176b78978158139903d0dc5a50dd64d6a2f009e0 | e86ab6cea73ebb8772bf3b6343a7e946ac6b3816 | refs/heads/master | 2022-03-26T07:11:52.081296 | 2018-10-12T09:20:52 | 2018-10-12T09:20:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,025 | java | class Solution {
public List<List<String>> groupAnagrams(String[] strs) {
// key: a string to represent the feature of a anagram
// value: a list to contain all String which has the same feature
Map<String, List> map = new HashMap<String, List>();
int[] count = new int[26];
for(String str : strs) {
// generate the key: a string to represent the feature of a anagram
Arrays.fill(count, 0);
for(char c : str.toCharArray()) {
count[c - 'a']++;
}
StringBuilder sb = new StringBuilder();
for(int i = 0; i < 26; i++) {
sb.append("#");
sb.append(count[i]);
}
String key = sb.toString();
if(!map.containsKey(key)) {
map.put(key, new ArrayList());
}
map.get(key).add(str);
}
return new ArrayList(map.values());
}
}
| [
"xianch@amazon.com"
] | xianch@amazon.com |
05ffe2aa7ebbf336fa0860d7ed13cdbcd95c0e6c | 84d394e0928999840842b8a1c3c9402e64e0f90e | /Program/web/src/dev/boom/services/QuizOptionData.java | 449326671f3098fabb591962127e08c116ae5ed7 | [] | no_license | KenyDinh/boom | 7eac8f27b79fde4925952ce600a39f6f2e5c3543 | 634513603528dcfd4c3639207480c816f4937f97 | refs/heads/master | 2023-04-07T01:20:07.536209 | 2023-04-05T03:19:15 | 2023-04-05T03:19:15 | 128,220,068 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 625 | java | package dev.boom.services;
import dev.boom.dao.DaoValue;
public class QuizOptionData {
private DaoValue tblQuizOptionData;
public QuizOptionData() {
}
public QuizOptionData(DaoValue tblQuizOptionData) {
this.tblQuizOptionData = tblQuizOptionData;
}
public int getId() {
return (Integer) tblQuizOptionData.Get("id");
}
public int getQuizDataId() {
return (Integer) tblQuizOptionData.Get("quiz_data_id");
}
public String getOption() {
return (String) this.tblQuizOptionData.Get("option");
}
public boolean isCorrectAnswer() {
return ((Integer) this.tblQuizOptionData.Get("correct") != 0);
}
}
| [
"kenydinh@gmail.com"
] | kenydinh@gmail.com |
74389bc47afd664290dca08009429b851529edc5 | f50746ff091593ce231d0821a7179d7c7cc99ddc | /src/main/java/pe/edu/upc/serviceimpl/TiendaServiceImpl.java | 4d15d6d302b5f4e8856d38ef0c359c7482b4d7f0 | [] | no_license | Leslie144/demoIdealPC | 4b27fa3e5d96b452ef69217f8cc7dd2c871e5b34 | 6ddb43dffcb750b3ffe09a1cecbbeca407501e42 | refs/heads/master | 2023-08-13T02:59:13.310898 | 2021-09-29T00:48:36 | 2021-09-29T00:48:36 | 407,984,164 | 0 | 0 | null | 2021-09-27T21:04:46 | 2021-09-18T22:54:41 | Java | UTF-8 | Java | false | false | 779 | java | package pe.edu.upc.serviceimpl;
import java.util.List;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import pe.edu.upc.dao.ITiendaDao;
import pe.edu.upc.entities.Tienda;
import pe.edu.upc.service.ITiendaService;
@Named
@RequestScoped
public class TiendaServiceImpl implements ITiendaService{
@Inject
private ITiendaDao tDao;
@Override
public void insert(Tienda t) {
tDao.insert(t);
}
@Override
public void eliminar(int idTienda) {
tDao.eliminar(idTienda);
}
@Override
public void modificar(Tienda tienda) {
tDao.modificar(tienda);
}
@Override
public List<Tienda>list(){
return tDao.list();
}
@Override
public List<Tienda> finByNameTienda(Tienda de) {
return tDao.finByNameTienda(de);
}
}
| [
"rojaspachecodiegofernando@gmail.com"
] | rojaspachecodiegofernando@gmail.com |
3c6d7425ac29902bb0ddb79541f190527237b7d5 | 721d7291504d76ffb3dcd3159bd91434246ae0b2 | /src/neunet/HeuristicEvaluation.java | 44ec05a8996e74bdcacf0089182a758fec1d6390 | [] | no_license | Mika412/Checkers-Neuroevolution | 929e07bc74861689d0f67eb9fa86995c42b9770b | be45ea84a56a1ae743fb3362da96dde32ce065fe | refs/heads/master | 2020-05-02T16:58:48.366160 | 2019-03-27T23:21:44 | 2019-03-27T23:21:44 | 178,084,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,154 | java | package neunet;
import checkers.*;
import java.util.ArrayList;
import java.util.List;
/**
* Heuristic evaluation class
*/
public class HeuristicEvaluation {
boolean typeA = true; //Switch to check between normalized and real values
/**
* Evaluation function
* @param board current board
* @param player which player, black or white
* @return
*/
public double[] evaluateBoard(Board board, Player player) {
double[] boardValue;
if (player == Player.black) {
boardValue = getScore(board.getFlipped());
} else {
boardValue = getScore(board);
}
return boardValue;
}
/**
* Temporary class to save board positions
*/
private static class TempPos{
int row;
int col;
TempPos(int row, int col){
this.row = col;
this.col = row;
}
}
/**
* Calculate score for the board
*
* @param board board configuration
* @return an array of scores
*/
private double[] getScore(Board board) {
White white = new White();
Black black = new Black();
int nPawns = 0;
int nKings = 0;
int enemyPawns = 0;
int enemyKings = 0;
int safePawns = 0;
int safeKings = 0;
int movablePawns = 0;
int movableKings = 0;
int defenderPieces = 0;
int centralPawns = 0;
int centralKings = 0;
int cornerPawns = 0;
int cornerKings = 0;
int aggregatedDistance = 0;
int unocPromotion = 0;
int lonerPawns = 0;
int lonerKings = 0;
int countEmpty = 0;
double agrDistPawns = 0;
double agrDistKings = 0;
List<TempPos> blacksPos = new ArrayList<>();
List<TempPos> whitesPos = new ArrayList<>();
// Scan across the board
for (int r = 0; r < Board.rows; r++) {
// Check only valid cols
int c = (r % 2 == 0) ? 0 : 1;
for (; c < Board.cols; c += 2) {
CellEntry entry = board.cell[r][c];
// 1,2. Check pawns and kings
if (entry == CellEntry.white)
nPawns++;
else if (entry == CellEntry.whiteKing)
nKings++;
// 1,2. Check pawns and kings
if (entry == CellEntry.black)
enemyPawns++;
else if (entry == CellEntry.blackKing)
enemyKings++;
// 2,3. Check if the pawn and king is safe
if(entry == CellEntry.white && (c == 0 || c == Board.cols-1))
safePawns++;
else if(entry == CellEntry.whiteKing && (c == 0 || c == Board.cols-1))
safeKings++;
// 4,5. Check if pawn and king is movable
if(entry == CellEntry.white) {
if(white.ForwardLeftForWhite(r, c, board) != null || white.ForwardRightForWhite(r, c, board) != null)
movablePawns += 1;
}else if(entry == CellEntry.whiteKing) {
if(white.ForwardLeftForWhite(r, c, board) != null || white.ForwardRightForWhite(r, c, board) != null || white.BackwardLeftForWhite(r, c, board) != null || white.BackwardRightForWhite(r, c, board) != null)
movableKings += 1;
}
// 9. Defender pieces
if(r < 2 && (entry == CellEntry.white || entry == CellEntry.whiteKing))
defenderPieces++;
// 10. Attacking pieces
if(r > 4 && entry == CellEntry.white)
defenderPieces++;
// Aggregated distance
if(entry == CellEntry.white)
aggregatedDistance += 7 - r;
if(entry == CellEntry.empty && r == 7)
unocPromotion++;
//Central pawns and kings
if(r > 1 && r < 6 && c > 1 && c < 6){
if(entry == CellEntry.white)
centralPawns++;
else if(entry == CellEntry.whiteKing)
centralKings++;
}
//Pawns and kings in the corner
if((r == 0 && c == 0) || (r == 7 && c == 7)) {
if (entry == CellEntry.white)
cornerPawns++;
else if (entry == CellEntry.whiteKing)
cornerKings++;
}
//Count lonely pieces
if(white.ForwardLeftForWhite(r, c, board) != null
&& white.ForwardRightForWhite(r, c, board) != null
&& white.BackwardLeftForWhite(r, c, board) != null
&& white.BackwardRightForWhite(r, c, board) != null) {
if (entry == CellEntry.white)
lonerPawns++;
else if(entry == CellEntry.whiteKing)
lonerKings++;
}
//Count empty slots
if(entry == CellEntry.empty)
countEmpty++;
if(entry == CellEntry.black || entry == CellEntry.blackKing)
blacksPos.add(new TempPos(r, c));
if(entry == CellEntry.white || entry == CellEntry.whiteKing)
whitesPos.add(new TempPos(r, c));
}
}
for(TempPos w : whitesPos){
for(TempPos b : blacksPos){
double dx = Math.abs(w.col - b.col); //Col
double dy = Math.abs(w.row - b.row); //Row
if(black.equals(CellEntry.black))
agrDistPawns += Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
else
agrDistKings += Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
}
}
if(typeA) {
double difPawns = (nPawns - enemyPawns) / 12.0f;
difPawns = (difPawns + 12.0f) / (12f + 12f);
double difKings = (nKings - enemyKings) / 12.0f;
difKings = (difKings + 12.0f) / (12f + 12f);
double[] result = new double[]{nPawns / 12f, nKings / 12f, difPawns, difKings, safePawns / 12f, safeKings / 12f, movablePawns / 12f, movableKings / 12f, defenderPieces / 8f, centralPawns / 8f, centralKings / 8f, cornerPawns / 2f, cornerKings / 2f, aggregatedDistance / 20f, unocPromotion / 4f, lonerPawns / 12f, lonerKings / 12f, countEmpty / 24f, agrDistPawns / 1000f, agrDistKings / 1000f};
return result;
}else{
double difPawns = nPawns - enemyPawns;
double difKings = nKings - enemyKings;
double[] result = new double[]{nPawns, nKings, difPawns, difKings, safePawns, safeKings, movablePawns, movableKings, defenderPieces, centralPawns, centralKings, cornerPawns, cornerKings, aggregatedDistance, unocPromotion, lonerPawns, lonerKings, countEmpty, agrDistPawns, agrDistKings};
return result;
}
}
}
| [
"mykhamarf17@gmail.com"
] | mykhamarf17@gmail.com |
56c4fca557e7ef52cc55ec158732980ed55d9edc | 32167fc1851fdb5d88d5d1d8fb27523a59ad6b4d | /android/app/src/main/java/com/secureapp/MainActivity.java | 67c70ae2372da06f73459edc2f8d7e9c19ab274a | [] | no_license | mraible/react-native-logout-issue | 8e609ac9a9f815e91f47222597de9d02571897b3 | e384133fa751854771df4cf7c9c534347b01acdc | refs/heads/main | 2023-07-31T04:07:20.564047 | 2021-09-27T14:39:52 | 2021-09-27T14:39:52 | 410,899,029 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package com.secureapp;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "SecureApp";
}
}
| [
"matt.raible@okta.com"
] | matt.raible@okta.com |
4b0eeabdf8063e7dc0600892b24a4cfc20d36c22 | 4a5d43387557b87f9e17f45940b6e715dc7a600b | /src/com/dsj/proj/controller/PriorityQ.java | 54e33e4ca2c1bb329d1212e9a3a936d65a051d15 | [] | no_license | susheels/Huffman-Coding-Using-Java | c977d06230f6994f18854e1da0851f875e2d9479 | 9f95065cab3f92d8ec127a3417ed694267259d40 | refs/heads/master | 2020-05-20T00:19:56.218795 | 2014-11-21T15:28:59 | 2014-11-21T15:28:59 | 26,965,103 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,965 | java | package com.dsj.proj.controller;
import java.util.ArrayList;
import java.util.NoSuchElementException;
public class PriorityQ<T extends Comparable<T>> {// Using min Heap
private ArrayList<T> items;
int size = 0;
public PriorityQ(){
items = new ArrayList<T>();
}
public void shiftUp(){
int k = items.size()-1;
while(k > 0){
T item = items.get(k);
int p = (k-1)/2;
T parent = items.get(p);
if(item.compareTo(parent) < 0){
//swap
items.set(p, item);
items.set(k, parent);
// up
k = p;
}else{
break;
}
}
}
public void shiftDown(){
int k = 0;
int l = 2*k+1;
while (l < items.size()) {
int min=l, r=l+1;
if (r < items.size()) { // there is a right child
if (items.get(l).compareTo(items.get(r)) <= 0) {
min = l;
}else{
min = r;
}
}
if (items.get(k).compareTo(items.get(min)) > 0) {
// switch
T temp = items.get(k);
items.set(k, items.get(min));
items.set(min, temp);
k = min;
l = 2*k+1;
} else {
break;
}
}
}
public T de() throws NoSuchElementException {
if (items.size() == 0) {
throw new NoSuchElementException();
}
if (items.size() == 1) {
size--;
return items.remove(0);
}
T hold = items.get(0);
items.set(0, items.remove(items.size()-1));
size--;
shiftDown();
return hold;
}
public void en(T item){
items.add(item);
//shiftUp
size++;
//System.out.println(size);
shiftUp();
}
public int size() {
// TODO Auto-generated method stub
return size;
}
}
| [
"susheel.suresh@gmail.com"
] | susheel.suresh@gmail.com |
0f201ab61638f65d5c6decaaab986d9f02bafe6e | 0ea7c5c88c62773f8b612bdd4b10604c81056a2b | /src/main/java/javaday/istanbul/sliconf/micro/survey/controller/survey/UserViewedSurvey.java | 7f514dda8feeb8422d9494edd02a3de5a51a4823 | [] | no_license | taliptayfur/sliconf-micro | 8813c3e2bfe64d28acb59dfaed35d91d80b4ea06 | a24bc2b34491457cd2a6efb61283687afe6f2ab3 | refs/heads/master | 2022-03-02T01:12:29.919158 | 2019-07-24T11:16:47 | 2019-07-24T11:16:47 | 279,097,942 | 1 | 0 | null | 2020-07-12T15:55:52 | 2020-07-12T15:55:52 | null | UTF-8 | Java | false | false | 2,738 | java | package javaday.istanbul.sliconf.micro.survey.controller.survey;
import io.swagger.annotations.*;
import javaday.istanbul.sliconf.micro.response.ResponseMessage;
import javaday.istanbul.sliconf.micro.survey.service.SurveyService;
import javaday.istanbul.sliconf.micro.util.json.JsonUtil;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import spark.Request;
import spark.Response;
import spark.Route;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import java.util.Map;
import java.util.Objects;
@AllArgsConstructor
@Api(value = "survey", authorizations = {@Authorization(value = "Bearer")})
@Path("/service/events/:eventIdentifier/surveys/:surveyId/view")
@Produces("application/json")
@Component
public class UserViewedSurvey implements Route {
private SurveyService surveyService;
@POST
@ApiOperation(value = "Save that user viewed the survey", nickname = "UserViewSurvey")
@ApiImplicitParams({ //
@ApiImplicitParam(required = true, dataType = "string", name = "token", paramType = "header",
example = "Authorization: Bearer <tokenValue>"), //
@ApiImplicitParam(required = true, dataTypeClass = Map.Entry.class, name = "userId", paramType = "body"), //
@ApiImplicitParam(required = true, dataType = "string", name = "eventIdentifier", paramType = "request"), //
@ApiImplicitParam(required = true, dataType = "string", name = "surveyId", paramType = "request"), //
}) //
@ApiResponses(value = { //
@ApiResponse(code = 200, message = "Success", response = ResponseMessage.class), //
@ApiResponse(code = 400, message = "Invalid input data", response = ResponseMessage.class), //
@ApiResponse(code = 401, message = "Unauthorized", response = ResponseMessage.class), //
@ApiResponse(code = 404, message = "User not found", response = ResponseMessage.class) //
})
@Override
public ResponseMessage handle(@ApiParam(hidden = true) Request request,
@ApiParam(hidden = true) Response response) throws Exception {
ResponseMessage responseMessage;
String body = request.body();
Map<String, String> userIdFromBody = body.isEmpty() ? null : JsonUtil.fromJson(body, Map.class);
String surveyId = request.params("surveyId");
String eventIdentifier = request.params("eventIdentifier");
String userId = Objects.isNull(userIdFromBody) ? null : userIdFromBody.values().stream().findFirst().orElse(null);
responseMessage = surveyService.updateSurveyViewers(userId, surveyId, eventIdentifier);
return responseMessage;
}
}
| [
"murat.ozer@yahoo.com"
] | murat.ozer@yahoo.com |
7dd799a7d945b0f19b9b7f1c8668f90bcd93c860 | b8afc09e004f705b06561d3540bf84f348d6d207 | /core/src/main/java/org/kohsuke/stapler/compression/CompressionServletResponse.java | 0bcf5aea59a9d65c3eb32ec5a0320808b8e609e8 | [
"BSD-2-Clause"
] | permissive | jglick/stapler | 4341fa6226a785d76704b1aa673d173b040ab04c | c6f7b324ddcb082e9c810b89debe8a401178b279 | refs/heads/master | 2023-02-07T22:06:35.564420 | 2013-04-29T16:42:16 | 2013-04-29T16:42:16 | 9,800,974 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,027 | java | package org.kohsuke.stapler.compression;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.zip.GZIPOutputStream;
/**
* {@link HttpServletResponse} that recognizes Content-Encoding: gzip in the response header
* and acts accoringly.
*
* @author Kohsuke Kawaguchi
*/
public class CompressionServletResponse extends HttpServletResponseWrapper {
/**
* If not null, we are compressing the stream.
*/
private ServletOutputStream stream;
private PrintWriter writer;
public CompressionServletResponse(HttpServletResponse response) {
super(response);
}
@Override
public void setHeader(String name, String value) {
super.setHeader(name, value);
activateCompressionIfNecessary(name,value);
}
@Override
public void addHeader(String name, String value) {
super.addHeader(name, value);
activateCompressionIfNecessary(name, value);
}
private void activateCompressionIfNecessary(String name, String value) {
try {
if (name.equals("Content-Encoding") && value.equals("gzip")) {
if (stream==null)
stream = new FilterServletOutputStream(new GZIPOutputStream(super.getOutputStream()));
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public PrintWriter getWriter() throws IOException {
if (writer!=null) return writer;
if (stream!=null) {
writer = new PrintWriter(new OutputStreamWriter(stream,getCharacterEncoding()));
return writer;
}
return super.getWriter();
}
@Override
public ServletOutputStream getOutputStream() throws IOException {
if (stream!=null) return stream;
return super.getOutputStream();
}
}
| [
"kk@kohsuke.org"
] | kk@kohsuke.org |
5b9050b1a9e8ffc698d194edf4c6f97b46fb2fb5 | 2968a4051e107f35970c1ddf7110e52a887cc243 | /kmls/kmls-db/src/main/java/ch/ntb/inf/klms/model/objects/base/Credential.java | 04755f6bbf172f73397739545ff29ea1b87d7314 | [
"BSD-2-Clause-Views"
] | permissive | LabSEC/kmip4j | e278b6bc62bbed9a3b2809bb3d67e606b2885e48 | 11be6b512c5e86aeb8ef0aba48c9d3d2d19fbb27 | refs/heads/master | 2022-02-19T15:48:07.331431 | 2017-10-01T22:09:34 | 2017-10-01T22:09:34 | 104,767,679 | 0 | 2 | NOASSERTION | 2019-09-12T02:02:24 | 2017-09-25T15:25:36 | Java | UTF-8 | Java | false | false | 1,513 | java | package ch.ntb.inf.klms.model.objects.base;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import ch.ntb.inf.klms.model.objects.CredentialValue;
@Entity
public class Credential {
@Id @GeneratedValue(strategy = GenerationType.AUTO)
private String id;
private String credentialType;
@ManyToOne ( cascade = CascadeType.ALL)
private CredentialValue credentialValue;
public Credential(){
}
public Credential(CredentialValue credentialValue) {
this.credentialValue = credentialValue;
}
public Credential(CredentialValue credentialValue, String credentialType) {
this.credentialValue = credentialValue;
this.credentialType = credentialType;
}
public void setCredentialType(String credentialType) {
this.credentialType = credentialType;
}
public CredentialValue getCredentialValue() {
return credentialValue;
}
public String getCredentialType(){
return this.credentialType;
}
public void setCredentialValue(CredentialValue credentialValue) {
this.credentialValue = credentialValue;
}
public boolean equals(Credential otherCredential){
if(this.credentialType.equals(otherCredential.getCredentialType())){
if(this.credentialValue.equals(otherCredential.getCredentialValue())){
return true;
}
}
return false;
}
} | [
"jeffjcrowe@gmail.com"
] | jeffjcrowe@gmail.com |
8d3e11315edd51bdd3ba506237aba2c06ed96d73 | 7d4a947e824c94722519ac607f677312cf150900 | /SecurityShepherdCore/src/servlets/module/challenge/CsrfChallengeOne.java | 42f94413d2b36bb66b9171bd0d9fbd770619adb8 | [] | no_license | markdenihan/LatamOwaspSecurityShepherd | 69fbb89467b91f0aadd64daa8ff59413175bb2d6 | 655ca7407dfceb1ffdb1dccb810e0d250c5a3791 | refs/heads/master | 2020-04-10T00:51:29.001344 | 2015-04-21T11:45:41 | 2015-04-21T11:45:41 | 30,969,859 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,004 | java | package servlets.module.challenge;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import utils.ShepherdLogManager;
import utils.Validate;
import dbProcs.Getter;
import dbProcs.Setter;
/**
* Cross Site Request Forgery Challenge One - Does not return reslut key
* <br/><br/>
* This file is part of the Security Shepherd Project.
*
* The Security Shepherd project is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.<br/>
*
* The Security Shepherd project is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.<br/>
*
* You should have received a copy of the GNU General Public License
* along with the Security Shepherd project. If not, see <http://www.gnu.org/licenses/>.
* @author Mark Denihan
*
*/
public class CsrfChallengeOne extends HttpServlet
{
private static final long serialVersionUID = 1L;
private static org.apache.log4j.Logger log = Logger.getLogger(CsrfChallengeOne.class);
private static String levelName = "Cross-SiteForegery Challenge One";
private static String levelHash = "s74a796e84e25b854906d88f622170c1c06817e72b526b3d1e9a6085f429cf52";
/**
* Allows users to set their CSRF attack string to complete this module
* @param myMessage To Be stored as the users message for this module
*/
public void doPost (HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
//Setting IpAddress To Log and taking header for original IP if forwarded from proxy
ShepherdLogManager.setRequestIp(request.getRemoteAddr(), request.getHeader("X-Forwarded-For"));
log.debug(levelName + " Servlet Accessed");
PrintWriter out = response.getWriter();
out.print(getServletInfo());
try
{
HttpSession ses = request.getSession(true);
if(Validate.validateSession(ses))
{
ShepherdLogManager.setRequestIp(request.getRemoteAddr(), request.getHeader("X-Forwarded-For"), ses.getAttribute("userName").toString());
log.debug(levelName + " servlet accessed by: " + ses.getAttribute("userName").toString());
Cookie tokenCookie = Validate.getToken(request.getCookies());
Object tokenParmeter = request.getParameter("csrfToken");
if(Validate.validateTokens(tokenCookie, tokenParmeter))
{
String myMessage = request.getParameter("myMessage");
log.debug("User Submitted - " + myMessage);
myMessage = Validate.makeValidUrl(myMessage);
log.debug("Updating User's Stored Message");
String ApplicationRoot = getServletContext().getRealPath("");
String moduleId = Getter.getModuleIdFromHash(ApplicationRoot, levelHash);
String userId = (String)ses.getAttribute("userStamp");
Setter.setStoredMessage(ApplicationRoot, myMessage, userId, moduleId);
log.debug("Retrieving user's class's forum");
String classId = null;
if(ses.getAttribute("userClass") != null)
classId = (String)ses.getAttribute("userClass");
String htmlOutput = Getter.getCsrfForumWithImg(ApplicationRoot, classId, moduleId);
log.debug("Outputting HTML");
out.write(htmlOutput);
}
}
}
catch(Exception e)
{
out.write("An Error Occurred! You must be getting funky!");
log.fatal(levelName + " - " + e.toString());
}
}
public static String getLevelHash()
{
return levelHash;
}
}
| [
"mark.denihan@owasp.org"
] | mark.denihan@owasp.org |
437f1a26921d92ac02d700651bfd970b556a40db | 0cf25af7bf547f401ce603ecadba42c8fa37b9b8 | /imooc-coupon-service/coupon-template/src/main/java/com/imooc/coupon/TemplateApplication.java | 911bf68aadd767f69e49d5a0609f57fa89630b6e | [] | no_license | EngineerSun/imooc-coupon | f21980645feea15cf283550e17977953d2a3ab17 | 386493ef7fab69bea9c60a0c795aeec3ec51981b | refs/heads/master | 2022-12-29T17:34:18.738068 | 2020-10-18T02:38:07 | 2020-10-18T02:38:07 | 305,008,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 610 | java | package com.imooc.coupon;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling//开启定时任务
@EnableJpaAuditing
@EnableEurekaClient
@SpringBootApplication
public class TemplateApplication {
public static void main(String[] args) {
SpringApplication.run(TemplateApplication.class, args);
}
}
| [
"1770629017@qq.com"
] | 1770629017@qq.com |
2a3e90386409b1fdd58f20dcd88e7d1ae96e76d9 | 48c4b5cae0739829e9f590a888c276b732572395 | /boot/src/main/java/com/spring/gameloft/BootApplication.java | 92330945b9cf7a54e762d90ed3b4b9450b7c9d97 | [] | no_license | Ionut09/spring-course | 0d4beeec8f47c235654f284f600943943a56b033 | dffc045007367faf0e4c496b57caf2f1315ea0b7 | refs/heads/master | 2020-08-28T09:40:25.921798 | 2019-10-30T17:06:39 | 2019-10-30T17:06:39 | 217,663,154 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,155 | java | package com.spring.gameloft;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import java.text.SimpleDateFormat;
@SpringBootApplication
public class BootApplication {
public static void main(String[] args) {
SpringApplication.run(BootApplication.class, args);
}
@Bean
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd"));
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(mapper);
return converter;
}
}
| [
"ionut.spalatelu@gohenry.co.uk"
] | ionut.spalatelu@gohenry.co.uk |
0de33378c5f966cf9740a2a7176370a812d1d98b | 178b5107fefb53f63d4b32e8e8f7f52084230b01 | /rpc-core/src/main/java/top/huhong/rpc/transport/socket/util/ObjectWriter.java | 658ab597de38dfe30415204a1f21903a095e6e7f | [] | no_license | 873696121/my-rpc-framework | c252117c66debe5bc046a3e55ca17509875d658c | c975ac180b95654b780dad19560349c70d0c8559 | refs/heads/main | 2023-04-19T10:11:00.274814 | 2021-05-03T07:45:52 | 2021-05-03T07:45:52 | 362,754,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,273 | java | package top.huhong.rpc.transport.socket.util;
import top.huhong.rpc.entity.RpcRequest;
import top.huhong.rpc.enumeration.PackageType;
import top.huhong.rpc.serializer.CommonSerializer;
import java.io.IOException;
import java.io.OutputStream;
public class ObjectWriter {
private static final int MAGIC_NUMBER = 0xCAFEBABE;
public static void writeObject(OutputStream outputStream, Object object, CommonSerializer serializer) throws IOException {
outputStream.write(intToBytes(MAGIC_NUMBER));
if (object instanceof RpcRequest) {
outputStream.write(intToBytes(PackageType.REQUEST_PACK.getCode()));
} else {
outputStream.write(intToBytes(PackageType.RESPONSE_PACK.getCode()));
}
outputStream.write(intToBytes(serializer.getCode()));
byte[] bytes = serializer.serialize(object);
outputStream.write(intToBytes(bytes.length));
outputStream.write(bytes);
outputStream.flush();
}
private static byte[] intToBytes(int value) {
byte[] src = new byte[4];
src[0] = (byte) ((value>>24) & 0xFF);
src[1] = (byte) ((value>>16)& 0xFF);
src[2] = (byte) ((value>>8)&0xFF);
src[3] = (byte) (value & 0xFF);
return src;
}
}
| [
"huhong@huhongdeMacBook-Pro.local"
] | huhong@huhongdeMacBook-Pro.local |
cdd77b6b0b1b685f3fb9742854ad148dc9a18606 | 3bc9371c8348c60d553536d11a0d232e7834065c | /mobile/src/main/java/com/elegion/androidschool/finalproject/event/EntrySelectedEvent.java | 980076fdc295b7be06221c0eae0082167639c499 | [] | no_license | bobrusha/final_project | 0a09e78e131e8af4bc6663be4dbe8952a2d96f14 | 62fe1af57b76a9a02750d2c4c9cca3eee00c0b8a | refs/heads/master | 2020-12-11T04:11:59.975023 | 2015-10-28T14:25:19 | 2015-10-28T14:25:19 | 44,129,574 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 453 | java | package com.elegion.androidschool.finalproject.event;
/**
* Created by Aleksandra on 24.10.15.
*/
public class EntrySelectedEvent {
private long mEntryId;
private long mProductId;
public EntrySelectedEvent(long productId, long entryId) {
mProductId = productId;
mEntryId = entryId;
}
public long getEntryId() {
return mEntryId;
}
public long getProductId() {
return mProductId;
}
}
| [
"bobrova.aleksand@gmail.com"
] | bobrova.aleksand@gmail.com |
bf0522ad700fa14861aff672b172d0d6f7e93e14 | e999a519d9fb7a344bf791eaf0fe62e8f98dfa4a | /app/src/main/java/com/example/student/smsapplication/MainActivity.java | 2ebde87e62cc9c0ff85a200dc5667b6db752cdb5 | [] | no_license | mercyngatia/SMSApplication | 6ed2afe569eaafd83df34d3e1936259324af0175 | 6343f938f5e174b72d67d58cc7e94781e3248c97 | refs/heads/master | 2021-01-23T22:29:54.435380 | 2017-09-09T07:02:54 | 2017-09-09T07:02:54 | 102,764,209 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,092 | java | package com.example.student.smsapplication;
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.provider.Telephony;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
Button button;
EditText editText, editText2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(ContextCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.SEND_SMS) != PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this,
Manifest.permission.SEND_SMS)){
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.SEND_SMS}, 1);
}else {
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.SEND_SMS}, 1);
}
}else {
// do nothing
}
button=(Button) findViewById(R.id.button);
editText =(EditText) findViewById(R.id.editText);
editText2 =(EditText) findViewById(R.id.editText2);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String number = editText.getText().toString();
String sms = editText2.getText().toString();
try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(number, null, sms, null, null);
Toast.makeText(MainActivity.this, "sent!", Toast.LENGTH_SHORT).show();
} catch (Exception e){
Toast.makeText(MainActivity.this, "Failed!", Toast.LENGTH_SHORT).show();
}
}
});
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
switch (requestCode) {
case 1:{
if(grantResults.length>0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
if(ContextCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED){
Toast.makeText(this, "Permission granted!", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(this, "No permission granted!", Toast.LENGTH_SHORT) .show();
}
return;
}
}
}
}
| [
"mercyngatia02@mail.com"
] | mercyngatia02@mail.com |
de2ffc79c4942b640115eb48ee77dc75961d5e77 | ea91069f5ac25973d612d333c5dd29ee3c3f7d3b | /app/src/main/java/greencode/ir/consulant/dialog/FreeTimeInterface.java | fddd7ea1e6d512f99b0b41144f0da1ef971446e1 | [] | no_license | alirezat66/consultant | fe797cb9050f5dbc5f4387b2f4811767e7d81fb4 | 8df40a38ab68ecc33dd7ebbadf93908fd03fd4a2 | refs/heads/master | 2022-02-05T19:20:17.577589 | 2019-06-18T10:16:30 | 2019-06-18T10:16:30 | 192,516,171 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 155 | java | package greencode.ir.consulant.dialog;
public interface FreeTimeInterface {
void onSuccess(String start,String end);
public void onRejected();
}
| [
"alirezataghizadeh66@gmail.com"
] | alirezataghizadeh66@gmail.com |
b18ded40a42c482909ee5c6a5cb3cd95dc16d4f0 | f099ca4184b15a8bca436d4ea7182a451ed1a40e | /Licenciatura_BSc/3º Ano/1º Semestre/Sistemas Distribuidos/Guiões TP/Feito em Aulas/Guiao 5/Writer.java | 14567a111ba98eec2616c5a5ea2096fa2c960dd3 | [
"MIT"
] | permissive | MikeDM16/Computer-Science-UMinho | f74c5a57877235908d7c5125ffa93e2936993795 | 74a3441762fd5557234c5080579567f7c4b019eb | refs/heads/master | 2020-05-03T09:06:40.225626 | 2019-03-30T15:59:42 | 2019-03-30T15:59:42 | 178,545,377 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 636 | java |
/**
* Escreva a descrição da classe Writer aqui.
*
* @author (seu nome)
* @version (número de versão ou data)
*/
public class Writer implements Runnable
{
RWLock rw;
public Writer(RWLock rw){ this.rw = rw; }
public void escrever() throws InterruptedException {
while( rw.nEscritores >0 || rw.nLeitores > 0 ){
rw.escritores.await();
}
rw.writerLock();
rw.nEscritores++;
rw.escrever();
rw.nEscritores--;
rw.writerUnlock();
rw.escritores.signalAll();
rw.leitores.signalAll();
}
public void run(){}
}
| [
"miguel_miranda96@live.com.pt"
] | miguel_miranda96@live.com.pt |
81eb52bce4d9367bb2efdbdd21da362e77c72698 | ce0fb19d8bda8dc26bb053525b3801965768b675 | /app/src/main/java/com/color_analysis_in_xinjiangtimes/view/Indicator.java | 8796be414ac2877bea9798661664bdfd314b9a73 | [] | no_license | agony48/doushouqi | e90b5ad824d9b9b770de0f1a60e562ca72f3f6fb | a85fa36733f3fac8cca227a27b4d06c83168034c | refs/heads/master | 2020-05-04T08:37:44.852220 | 2019-04-02T10:04:58 | 2019-04-02T10:04:58 | 179,050,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,589 | java | package com.color_analysis_in_xinjiangtimes.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import com.color_analysis_in_xinjiangtimes.R;
/**
* 选中菜单
* @author lishan
* @date 16/7/27
* @version 1.0
*/
public class Indicator extends View {
private Paint mPaint; // 画指示符的paint
private int mTop; // 指示符的top
private int mLeft; // 指示符的left
private int mWidth; // 指示符的width
private int mHeight = 5; // 指示符的高度
private int mColor; // 指示符的颜色
private int mChildCount;
private int position=0;
public Indicator(Context context, AttributeSet attrs) {
super(context, attrs);
// setBackgroundColor(Color.TRANSPARENT); // 必须设置背景,否则onDraw不执行
// 获取自定义属性 指示符的颜色
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.Indicator, 0, 0);
mChildCount= ta.getInt(R.styleable.Indicator_count,1);
mColor = ta.getColor(R.styleable.Indicator_Indicator_color, Color.parseColor("#3cb1f7"));
ta.recycle();
// 初始化paint
mPaint = new Paint();
mPaint.setColor(mColor);
mPaint.setAntiAlias(true);
}
public void setChildCount(int childCount){
this.mChildCount = childCount;
postInvalidate();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
mTop = getMeasuredHeight(); // 测量的高度即指示符的顶部位置
int width = getMeasuredWidth(); // 获取测量的总宽度
int height = mTop + mHeight; // 重新定义一下测量的高度
setMeasuredDimension(width, height);
}
public void scroll(int position) {
this.position = position;
mLeft = position * mWidth;
postInvalidate();
}
@Override
protected void onDraw(Canvas canvas) {
int width = getMeasuredWidth(); // 获取测量的总宽度
mWidth = width / mChildCount; // 指示符的宽度为总宽度/item的个数
mLeft = position * mWidth;
// 圈出一个矩形
Rect rect = new Rect(mLeft, mTop, mLeft + mWidth, mTop + mHeight);
canvas.drawRect(rect, mPaint); // 绘制该矩形
super.onDraw(canvas);
}
}
| [
"qagony@foxmail.com"
] | qagony@foxmail.com |
c24c6f9100cbdb580d90214dc00f06880ef17e89 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Lang/31/org/apache/commons/lang3/exception/ContextedRuntimeException_getValue_162.java | ca812f519f0066a86cfaebacd114254b6e422611 | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 1,589 | java |
org apach common lang3 except
runtim except easi safe add contextu inform
except trace insuffici provid rapid diagnosi issu
frequent need select piec local contextu data
provid data tricki due concern format null
context except approach except creat
map context valu addit inform automat includ
messag print stack trace
check version except provid context except contextedexcept
write code
pre
except
context except contextedexcept error post account transact
add addvalu account number accountnumb account number accountnumb
add addvalu amount post amountpost amount post amountpost
add addvalu previou balanc previousbal previou balanc previousbal
pre
output print stacktrac printstacktrac written log
pre
org apach common lang3 except context runtim except contextedruntimeexcept java lang except error post account transact
except context
account number accountnumb
amount post amountpost
previou balanc previousbal
org apach common lang3 except context runtim except test contextedruntimeexceptiontest test add testaddvalu context except test contextedexceptiontest java
rest trace
pre
context except contextedexcept
author apach softwar foundat
author ashmor
author ouml schaibl
context runtim except contextedruntimeexcept runtim except runtimeexcept except context exceptioncontext
retriev contextu data label
param label label contextu
contextu label
object getvalu string label
except context exceptioncontext getvalu label
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
c6903e9a1619f2b90f1929da15e724f9402c2add | 27120d2eb1026907d9af88b224214bfc8bbe2166 | /src/test/java/ucles/weblab/common/files/webapi/FileController_IT.java | 7168120cbbdd0f8d76e8d47c8de166c12d34e8f1 | [
"Apache-2.0"
] | permissive | eccosolutions/secure-files | 9a234f3223d7190bc5ebdb1c91280e3805fcc0a4 | 1bbf2e966fb12799ba40c4170ff443a8342772cb | refs/heads/master | 2021-05-05T17:32:47.326363 | 2018-01-13T00:58:34 | 2018-01-13T01:26:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,241 | java | package ucles.weblab.common.files.webapi;
import com.google.common.io.Resources;
import com.jayway.jsonpath.JsonPath;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.multipart.MultipartException;
import org.springframework.web.multipart.MultipartResolver;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.util.NestedServletException;
import ucles.weblab.common.domain.ConfigurableEntitySupport;
import ucles.weblab.common.files.domain.*;
import ucles.weblab.common.files.domain.jpa.FilesFactoryJpa;
import ucles.weblab.common.files.domain.jpa.SecureFileCollectionRepositoryJpa;
import ucles.weblab.common.files.domain.jpa.SecureFileEntityJpa;
import ucles.weblab.common.files.webapi.converter.FilesConverters;
import ucles.weblab.common.files.webapi.resource.FileCollectionResource;
import ucles.weblab.common.test.webapi.AbstractRestController_IT;
import ucles.weblab.common.multipart.webapi.jersey.JerseyMultipartResolver;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.text.MessageFormat;
import java.time.Instant;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
import java.util.concurrent.CompletableFuture;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hamcrest.Matchers.is;
import static org.springframework.http.HttpHeaders.LOCATION;
import static org.springframework.http.MediaType.IMAGE_JPEG;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Integration test to check HTTP interaction with base64-encoded file content.
*
* @since 25/06/15
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
//@WebIntegrationTest(value = "classpath:/public", randomPort = true)
@Transactional
public class FileController_IT extends AbstractRestController_IT {
/** This multipart resource MUST have CR LF line terminators, not just LF. */
private static final String BASE64_RESOURCE_NAME_1 = "base64multipart.crlf.txt";
private static final String BASE64_RESOURCE_NAME_2 = "base64-post-error500.crlf.txt";
private static final String BASE64_RESOURCE_NAME_3 = "base64-post-error400.crlf.txt";
private static final String IMAGE_RESOURCE_PATH = "beautiful_st_ives_cornwall_england_uk-1532356.jpg";
@Autowired
private FileDownloadCache fileDownloadCache;
@Autowired
private DownloadController downloadController;
@Configuration
@EnableJpaRepositories(basePackageClasses = {SecureFileCollectionRepositoryJpa.class})
@EntityScan(basePackageClasses = {SecureFileEntityJpa.class, Jsr310JpaConverters.class})
@ComponentScan(basePackageClasses = {FileController.class, DownloadController.class})
@Import({ConfigurableEntitySupport.class, DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, FilesConverters.class, FilesBuilders.class})
@EnableAutoConfiguration
public static class Config {
@Bean
public FilesFactory filesFactoryJpa() {
return new FilesFactoryJpa();
}
@Bean
public EncryptionService encryptionService() {
return new EncryptionServiceImpl(Arrays.asList(new AesGcmEncryptionStrategy("some-test-aad"), new DummyEncryptionStrategy()),
"0123456789012345".getBytes(UTF_8));
}
@Bean
public SecureFileCollectionService secureFileCollectionService(SecureFileCollectionRepository secureFileCollectionRepository, SecureFileRepository secureFileRepository) {
return new AutoPurgeSecureFileCollectionServiceImpl(secureFileCollectionRepository, secureFileRepository);
}
/**
* Use JerseyMultipartResolver instead of the default StandardServletMultipartResolver or CommonsMultipartResolver
* as it can handle base64 Content-Transfer-Encoding.
*/
@Bean(name = DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME)
MultipartResolver multipartResolver() {
return new JerseyMultipartResolver();
}
@Bean
FileDownloadCache fileDownloadCache() {
return new FileDownloadCacheInMemory();
}
}
@Test
public void testUploadingBase64EncodedFile() throws Exception {
MediaType multipartType = new MediaType(MediaType.MULTIPART_FORM_DATA, new HashMap<String, String>() {{
put("boundary", "----WebKitFormBoundaryrH2JPoateChY15Vo");
}});
final String collectionName = getClass().getSimpleName() + "-01";
final String notes = getClass().getSimpleName() + "-notes-01";
// Create the collection
mockMvc.perform(post("/api/files/")
.contentType(APPLICATION_JSON_UTF8)
.content(json(new FileCollectionResource(collectionName, Instant.now()))))
.andExpect(status().is2xxSuccessful());
// Upload the image
final CompletableFuture<String> imageLocation = new CompletableFuture<>();
final CompletableFuture<URI> imageDownload = new CompletableFuture<>();
final InputStream resource = getClass().getResourceAsStream(BASE64_RESOURCE_NAME_1);
try (final InputStreamReader readable = new InputStreamReader(resource, StandardCharsets.UTF_8)) {
final String base64PostData = readAll(readable);
mockMvc.perform(post("/api/files/")
.contentType(multipartType)
.accept("*/*")
.content(MessageFormat.format(base64PostData, collectionName, notes)))
.andExpect(status().isCreated())
.andExpect(content().contentType(APPLICATION_JSON_UTF8))
.andExpect(jsonPath("$.notes", is(notes)))
.andDo(result -> {
String loc = result.getResponse().getHeader(LOCATION);
System.out.println("imageLocation: " + loc);
imageLocation.complete(loc);
})
.andDo(result -> {
String loc = ((List<String>) JsonPath.read(result.getResponse().getContentAsString(),"$.links[?(@.rel=='enclosure')].href")).get(0);
System.out.println("imageDownload: " + loc);
imageDownload.complete(URI.create(loc));
});
}
// Follow the download link to get redirected to a temporary link
final URI contextRoot = getContextRoot(imageLocation.get());
URI relativeDownload = toContextRelativeUri(imageDownload.get(), contextRoot);
final CompletableFuture<URI> imageDownloadRedirected = new CompletableFuture<>();
mockMvc.perform(get(relativeDownload))
.andExpect(status().is3xxRedirection())
.andDo(result -> imageDownloadRedirected.complete(URI.create(result.getResponse().getHeader(LOCATION))));
// Fetch the temporary link and check we got the binary data back.
relativeDownload = toContextRelativeUri(imageDownloadRedirected.get(), contextRoot);
final byte[] originalData = Resources.toByteArray(getClass().getResource(IMAGE_RESOURCE_PATH));
mockMvc.perform(get(relativeDownload))
.andExpect(status().isOk())
.andExpect(content().contentType(IMAGE_JPEG))
.andExpect(content().bytes(originalData));
}
/**
* This test uses data generated by the real front-end code which was erroneously including the leading dashes
* in the Content-Type header.
* <p>
* These headers were used:
* <pre>
* Host: localhost:8080
* Connection: keep-alive
* Content-Length: 39817
* Pragma: no-cache
* Cache-Control: no-cache
* Origin: http://localhost:8080
* X-Requested-With: XMLHttpRequest
* User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36
* Content-Type: multipart/form-data; boundary=--FormDataObject0
* Referer: http://localhost:8080/
* Accept-Encoding: gzip, deflate
* Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
* </pre>
*/
@Test(expected = MultipartException.class)
public void testFrontEndGeneratedUploadFailsDueToBoundaryFailure() throws Throwable {
MediaType multipartType = new MediaType(MediaType.MULTIPART_FORM_DATA, new HashMap<String, String>() {{
put("boundary", "--FormDataObject0");
}});
final String collectionName = getClass().getSimpleName() + "-02";
// Create the collection
mockMvc.perform(post("/api/files/")
.contentType(APPLICATION_JSON_UTF8)
.content(json(new FileCollectionResource(collectionName, Instant.now()))))
.andExpect(status().is2xxSuccessful());
// Upload the image
final InputStream resource = getClass().getResourceAsStream(BASE64_RESOURCE_NAME_2);
try (final InputStreamReader readable = new InputStreamReader(resource, StandardCharsets.UTF_8)) {
final String base64PostData = readAll(readable);
mockMvc.perform(post("/api/files/")
.contentType(multipartType)
.accept("*/*")
.content(MessageFormat.format(base64PostData, collectionName)))
.andExpect(status().isBadRequest());
} catch (NestedServletException e) {
throw e.getRootCause();
}
}
/**
* This test uses data generated by the real front-end code.
* <p>
* These headers were used:
* <pre>
* Host: localhost:3000
* Connection: keep-alive
* Content-Length: 39864
* Pragma: no-cache
* Cache-Control: no-cache
* Origin: http://localhost:3000
* X-Requested-With: XMLHttpRequest
* User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36
* Content-Type: multipart/form-data; boundary=FormDataObject3c9
* Referer: http://localhost:3000/
* Accept-Encoding: gzip, deflate
* Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
* </pre>
*/
@Test
public void testFrontEndGeneratedUploadFailsDueToBoundaryFailureAgain() throws Exception {
MediaType multipartType = new MediaType(MediaType.MULTIPART_FORM_DATA, new HashMap<String, String>() {{
put("boundary", "FormDataObject3c9");
}});
final String collectionName = "a7f43deb-3bb8-471a-a88c-e02a55082b9a";
// Create the collection
mockMvc.perform(post("/api/files/")
.contentType(APPLICATION_JSON_UTF8)
.content(json(new FileCollectionResource(collectionName, Instant.now()))))
.andExpect(status().is2xxSuccessful());
// Upload the image
final InputStream resource = getClass().getResourceAsStream(BASE64_RESOURCE_NAME_3);
try (final InputStreamReader readable = new InputStreamReader(resource, StandardCharsets.UTF_8)) {
final String base64PostData = readAll(readable);
mockMvc.perform(post("/api/files/")
.contentType(multipartType)
.accept("*/*")
.content(MessageFormat.format(base64PostData, collectionName)))
.andExpect(status().is2xxSuccessful());
}
}
/**
* From https://weblogs.java.net/blog/pat/archive/2004/10/stupid_scanner.html
*/
String readAll(Readable readable) {
return new Scanner(readable).useDelimiter("\\A").next();
}
}
| [
"gdb20@cam.ac.uk"
] | gdb20@cam.ac.uk |
2d677bcf0d22657a843df33089061d0c96f4ea22 | e36ae1983bf911caa7347c3c6a7c46ef7ab58112 | /src/jCode/Empresa.java | 6ed529944d129c40fe9e77ecf71f2639cd2d7154 | [] | no_license | murilorcm/primeiros-passos | cfa3c3317d1d202c1587522cc08a1775749ece42 | 0b171d9abb63b890b7adead53637d64115481bc2 | refs/heads/master | 2021-05-14T19:25:15.416631 | 2018-01-17T17:57:37 | 2018-01-17T17:57:37 | 116,156,967 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 847 | java | package jCode;
import java.util.ArrayList;
import java.util.List;
public class Empresa {
protected String nome;
protected List<Funcionario> funcionarios = new ArrayList();
protected String cpnj;
public void adicionarFuncionario (Funcionario f){
this.funcionarios.add(new Funcionario(f));
}
public void mostraFuncionarios(){
for (Funcionario funcionario: this.funcionarios) {
funcionario.mostraFuncionario();
}
}
public Funcionario getFuncionarios(int posicao) {
return funcionarios.get(posicao);
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCpnj() {
return cpnj;
}
public void setCpnj(String cpnj) {
this.cpnj = cpnj;
}
}
| [
"murilo.rodrigues@kaffa.com.br"
] | murilo.rodrigues@kaffa.com.br |
4c001f4e022ab1151f7ed0b068c5cdbabad1357d | 07b996b8440dbe5499b857f284e0aa86193f2faa | /src/test/java/com/sky/ddt/service/UserServiceTest2.java | b0499d7e01baedef2d7f1e39e2a4c2d65e2a5720 | [] | no_license | skywhitebai/ddt | 2b0b35194199abf2126e8297316ad16fec2186b9 | 33ce8da01d75f185c832e32ac117e23a7040cf64 | refs/heads/master | 2023-06-07T00:29:53.206163 | 2023-06-04T04:19:53 | 2023-06-04T04:19:53 | 311,826,029 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 773 | java | package com.sky.ddt.service;
import com.sky.ddt.BaseControllerTest;
import com.sky.ddt.entity.User;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations = {"classpath*:/spring-mvc.xml","classpath*:spring-mybatis.xml"})
public class UserServiceTest2 {
@Autowired
public IUserService userService;
@Test
public void getUserList() {
System.out.println("123");
}
}
| [
"baixueping@rfchina.com"
] | baixueping@rfchina.com |
b410d8152cc8a2c6e08881709090fa1965a70a1f | e6f74cc2c044ab10894d856d316b0226bff7319a | /src/mx/com/rodel/utils/SoundHelper.java | 89bd5058da8772408001ef0c3b99af0ef8a234af | [] | no_license | rodel77/ItemRescuer | 182c46a28c6145eae6e57e6fc08054319a22c8f9 | 2e89979e33bc7ae23a1bffb383e90dd415502da4 | refs/heads/master | 2020-03-23T06:21:23.630514 | 2018-07-16T23:27:36 | 2018-07-16T23:27:36 | 141,205,442 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 31,220 | java | package mx.com.rodel.utils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
/**
* Sound helper enum
*
* Select one sound and play it, in 1.7/1.8/1.9/1.10
*
* @author rodel77
*/
public enum SoundHelper {
AMBIENT_CAVE("ambient_cave", "ambient.cave"),
BLOCK_ANVIL_BREAK("dig.stone", "block.anvil.break"),
BLOCK_ANVIL_DESTROY("random.anvil_break", "block.anvil.destroy"),
BLOCK_ANVIL_FALL("step.stone", "block.anvil.fall"),
BLOCK_ANVIL_HIT("step.stone", "block.anvil.hit"),
BLOCK_ANVIL_LAND("random.anvil_land", "block.anvil.land"),
BLOCK_ANVIL_PLACE("random.anvil_land", "block.anvil.place"),
BLOCK_ANVIL_STEP("step.stone", "block.anvil.step"),
BLOCK_ANVIL_USE("random.anvil_use", "block.anvil.use"),
BLOCK_BREWING_STAND_BREW("random.brup:0", "block.brewing_stand.brew"),
BLOCK_CHEST_CLOSE("random.chestopen", "block.chest.close"),
BLOCK_CHEST_LOCKED("random.door_open", "block.chest.locked"),
BLOCK_CHEST_OPEN("random.chestclosed", "block.chest.open"),
BLOCK_CHORUS_FLOWER_DEATH("step.gravel:0", "block.chorus_flower.death"),
BLOCK_CHORUS_FLOWER_GROW("step.gravel:0", "block.chorus_flower.grow"),
BLOCK_CLOTH_BREAK("dig.cloth", "block.cloth.break"),
BLOCK_CLOTH_FALL("step.cloth", "block.cloth.fall"),
BLOCK_CLOTH_HIT("step.cloth", "block.cloth.hit"),
BLOCK_CLOTH_PLACE("dig.cloth", "block.cloth.place"),
BLOCK_CLOTH_STEP("step.cloth", "block.cloth.step"),
BLOCK_COMPARATOR_CLICK("random.click", "block.comparator.click"),
BLOCK_DISPENSER_DISPENSE("random.click", "block.dispenser.dispense"),
BLOCK_DISPENSER_FAIL("random.click", "block.dispenser.fail"),
BLOCK_DISPENSER_LAUNCH("random.bow", "block.dispenser.launch"),
BLOCK_ENDERCHEST_CLOSE("random.chestclosed", "block.enderchest.close"),
BLOCK_ENDERCHEST_OPEN("random.chestopen", "block.enderchest.open"),
BLOCK_END_GATEWAY_SPAWN("random.explode", "block.end_gateway.spawn"),
BLOCK_FENCE_GATE_CLOSE("random.door_close", "block.fence_gate.close"),
BLOCK_FENCE_GATE_OPEN("random.door_open", "block.fence_gate.open"),
BLOCK_FIRE_AMBIENT("fire.fire", "block.fire.ambient"),
BLOCK_FIRE_EXTINGUISH("random.fizz", "block.fire.extinguish"),
BLOCK_FURNACE_FIRE_CRACKLE("fire.fire", "block.furnace.fire_crackle"),
BLOCK_GLASS_BREAK("random.glass", "block.glass.break"),
BLOCK_GLASS_FALL("step.stone", "block.glass.fall"),
BLOCK_GLASS_HIT("step.stone", "block.glass.hit"),
BLOCK_GLASS_PLACE("dig.stone", "block.glass.place"),
BLOCK_GLASS_STEP("step.stone", "block.glass.step"),
BLOCK_GRASS_BREAK("dig.grass", "block.grass.break"),
BLOCK_GRASS_FALL("step.grass", "block.grass.fall"),
BLOCK_GRASS_HIT("step.grass", "block.grass.hit"),
BLOCK_GRASS_PLACE("dig.grass", "block.grass.place"),
BLOCK_GRASS_STEP("step.grass", "block.grass.step"),
BLOCK_GRAVEL_BREAK("dig.gravel", "block.gravel.break"),
BLOCK_GRAVEL_FALL("step.gravel", "block.gravel.fall"),
BLOCK_GRAVEL_HIT("step.gravel", "block.gravel.hit"),
BLOCK_GRAVEL_PLACE("dig.gravel", "block.gravel.place"),
BLOCK_GRAVEL_STEP("step.gravel", "block.gravel.step"),
BLOCK_IRON_DOOR_CLOSE("random.door_close", "block.iron_door.close"),
BLOCK_IRON_DOOR_OPEN("random.door_open", "block.iron_door.open"),
BLOCK_IRON_TRAPDOOR_CLOSE("random.door_close", "block.iron_trapdoor.close"),
BLOCK_IRON_TRAPDOOR_OPEN("random.door_open", "block.iron_trapdoor.open"),
BLOCK_LADDER_BREAK("dig.ladder", "block.ladder.break"),
BLOCK_LADDER_FALL("step.ladder", "block.ladder.fall"),
BLOCK_LADDER_HIT("step.ladder", "block.ladder.hit"),
BLOCK_LADDER_PLACE("dig.ladder", "block.ladder.place"),
BLOCK_LADDER_STEP("step.ladder", "block.ladder.step"),
BLOCK_LAVA_AMBIENT("liquid.lava", "block.lava.ambient"),
BLOCK_LAVA_EXTINGUISH("random.fizz", "block.lava.extinguish"),
BLOCK_LAVA_POP("liquid.lavapop", "block.lava.pop"),
BLOCK_LEVER_CLICK("random.click", "block.lever.click"),
BLOCK_METAL_BREAK("dig.stone", "block.metal.break"),
BLOCK_METAL_FALL("step.stone", "block.metal.fall"),
BLOCK_METAL_HIT("step.stone", "block.metal.hit"),
BLOCK_METAL_PLACE("dig.stone", "block.metal.place"),
BLOCK_METAL_PRESSUREPLATE_CLICK_OFF("random.click", "block.metal_pressureplate.click_off"),
BLOCK_METAL_PRESSUREPLATE_CLICK_ON("random.click", "block.metal_pressureplate.click_on"),
BLOCK_METAL_STEP("step.stone", "block.metal.step"),
BLOCK_NOTE_BASEDRUM("note.bd", "block.note.basedrum"),
BLOCK_NOTE_BASS("note.bass", "block.note.bass"),
BLOCK_NOTE_HARP("note.harp", "block.note.harp"),
BLOCK_NOTE_HAT("note.hat", "block.note.hat"),
BLOCK_NOTE_PLING("note.pling", "block.note.pling"),
BLOCK_NOTE_SNARE("note.snare", "block.note.snare"),
BLOCK_PISTON_CONTRACT("tile.piston.in", "block.piston.contract"),
BLOCK_PISTON_EXTEND("tile.piston.out", "block.piston.extend"),
BLOCK_PORTAL_AMBIENT("portal.portal", "block.portal.ambient"),
BLOCK_PORTAL_TRAVEL("portal.travel", "block.portal.travel"),
BLOCK_PORTAL_TRIGGER("portal.trigger", "block.portal.trigger"),
BLOCK_REDSTONE_TORCH_BURNOUT("random.fizz", "block.redstone_torch.burnout"),
BLOCK_SAND_BREAK("dig.sand", "block.sand.break"),
BLOCK_SAND_FALL("step.sand", "block.sand.fall"),
BLOCK_SAND_HIT("step.sand", "block.sand.hit"),
BLOCK_SAND_PLACE("dig.sand", "block.sand.place"),
BLOCK_SAND_STEP("step.sand", "block.sand.step"),
BLOCK_SLIME_BREAK("mob.slime.big", "block.slime.break"),
BLOCK_SLIME_FALL("mob.slime.attack", "block.slime.fall"),
BLOCK_SLIME_HIT("mob.slime.attack", "block.slime.hit"),
BLOCK_SLIME_PLACE("mob.slime.big", "block.slime.place"),
BLOCK_SLIME_STEP("mob.slime.attack", "block.slime.step"),
BLOCK_SNOW_BREAK("dig.snow", "block.snow.break"),
BLOCK_SNOW_FALL("step.snow", "block.snow.fall"),
BLOCK_SNOW_HIT("step.snow", "block.snow.hit"),
BLOCK_SNOW_PLACE("dig.snow", "block.snow.place"),
BLOCK_SNOW_STEP("step.snow", "block.snow.step"),
BLOCK_STONE_BREAK("dig.stone", "block.stone.break"),
BLOCK_STONE_BUTTON_CLICK_OFF("random.click", "block.stone_button.click_off"),
BLOCK_STONE_BUTTON_CLICK_ON("random.click", "block.stone_button.click_on"),
BLOCK_STONE_FALL("step.stone", "block.stone.fall"),
BLOCK_STONE_HIT("step.stone", "block.stone.hit"),
BLOCK_STONE_PLACE("dig.stone", "block.stone.place"),
BLOCK_STONE_PRESSUREPLATE_CLICK_OFF("random.click", "block.stone_pressureplate.click_off"),
BLOCK_STONE_PRESSUREPLATE_CLICK_ON("random.click", "block.stone_pressureplate.click_on"),
BLOCK_STONE_STEP("step.stone", "block.stone.step"),
BLOCK_TRIPWIRE_ATTACH("random.click", "block.tripwire.attach"),
BLOCK_TRIPWIRE_CLICK_OFF("random.click", "block.tripwire.click_off"),
BLOCK_TRIPWIRE_CLICK_ON("random.click", "block.tripwire.click_on"),
BLOCK_TRIPWIRE_DETACH("random.bowhit", "block.tripwire.detach"),
BLOCK_WATERLILY_PLACE("mob.slime.small", "block.waterlily.place"),
BLOCK_WATER_AMBIENT("liquid.water", "block.water.ambient"),
BLOCK_WOODEN_DOOR_CLOSE("random.door_close", "block.wooden_door.close"),
BLOCK_WOODEN_DOOR_OPEN("random.door_open", "block.wooden_door.open"),
BLOCK_WOODEN_TRAPDOOR_CLOSE("random.door_close", "block.wooden_trapdoor.close"),
BLOCK_WOODEN_TRAPDOOR_OPEN("random.door_open", "block.wooden_trapdoor.open"),
BLOCK_WOOD_BREAK("dig.wood", "block.wood.break"),
BLOCK_WOOD_BUTTON_CLICK_OFF("random.click", "block.wood_button.click_off"),
BLOCK_WOOD_BUTTON_CLICK_ON("random.click", "block.wood_button.click_on"),
BLOCK_WOOD_FALL("step.wood", "block.wood_fall"),
BLOCK_WOOD_HIT("step.wood", "block.wood.hit"),
BLOCK_WOOD_PLACE("dig.wood", "block.wood.place"),
BLOCK_WOOD_PRESSUREPLATE_CLICK_OFF("random.click", "block.wood_pressureplate.click_off"),
BLOCK_WOOD_PRESSUREPLATE_CLICK_ON("random.click", "block.wood_pressureplate.click_on"),
BLOCK_WOOD_STEP("step.wood", "block.wood.step"),
ENCHANT_THORNS_HIT("damage.hit", "enchant.thorns.hit"),
ENTITY_ARMORSTAND_BREAK("dig.wood", "entity.armorstand.break"),
ENTITY_ARMORSTAND_FALL("step.wood", "entity.armorstand.fall"),
ENTITY_ARMORSTAND_HIT("step.wood", "entity.armorstand.hit"),
ENTITY_ARMORSTAND_PLACE("dig.wood", "entity.armorstand.place"),
ENTITY_ARROW_HIT("random.bowhit", "entity.arrow.hit"),
ENTITY_ARROW_HIT_PLAYER("random.successful_hit", "entity.arrow.hit_player"),
ENTITY_ARROW_SHOOT("random.bow", "entity.arrow.shoot"),
ENTITY_BAT_AMBIENT("mob.bat.loop", "entity.bat.ambient"),
ENTITY_BAT_DEATH("mob.bat.idle", "entity.bat.death"),
ENTITY_BAT_HURT("mob.bat.hurt", "entity.bat.hurt"),
ENTITY_BAT_LOOP("mob.bat.loop", "entity.bat.loop"),
ENTITY_BAT_TAKEOFF("mob.bat.takeoff", "entity.bat.takeoff"),
ENTITY_BLAZE_AMBIENT("mob.blaze.breathe", "entity.blaze.ambient"),
ENTITY_BLAZE_BURN("fire.fire", "entity.blaze.burn"),
ENTITY_BLAZE_DEATH("mob.blaze.death", "entity.blaze.death"),
ENTITY_BLAZE_HURT("mob.blaze.hit", "entity.blaze.hurt"),
ENTITY_BLAZE_SHOOT("mob.ghast.fireball4", "entity.blaze.shoot"),
ENTITY_BOBBER_SPLASH("liquid.splash", "entity.bobber_splash"),
ENTITY_BOBBER_THROW("random.bow", "entity.bobber_throw"),
ENTITY_CAT_AMBIENT("mob.cat.meow", "entity.cat.ambient"),
ENTITY_CAT_DEATH("mob.cat.hitt", "entity.cat.death"),
ENTITY_CAT_HISS("mob.cat.hiss", "entity.cat.hiss"),
ENTITY_CAT_HURT("mob.cat.hitt", "entity.cat.hurt"),
ENTITY_CAT_PURR("mob.cat.purr", "entity.cat.purr"),
ENTITY_CAT_PURREOW("mob.cat.purreow", "entity.cat.purreow"),
ENTITY_CHICKEN_AMBIENT("mob.chicken.say", "entity.chicken.ambient"),
ENTITY_CHICKEN_DEATH("mob.chicken.hurt", "entity.chicken.death"),
ENTITY_CHICKEN_EGG("mob.chicken.plop", "entity.chicken.egg"),
ENTITY_CHICKEN_HURT("mob.chicken.hurt", "entity.chicken.hurt"),
ENTITY_CHICKEN_STEP("mob.chicken.step", "entity.chicken.step"),
ENTITY_COW_AMBIENT("mob.cow.say", "entity.cow.ambient"),
ENTITY_COW_DEATH("mob.cow.hurt", "entity.cow.death"),
ENTITY_COW_HURT("mob.cow.hurt", "entity.cow.hurt"),
ENTITY_COW_MILK("random.pop", "entity.cow.milk"),
ENTITY_COW_STEP("mob.cow.step", "entity.cow.step"),
ENTITY_CREEPER_DEATH("mob.creeper.death", "entity.creeper.death"),
ENTITY_CREEPER_HURT("mob.creeper.death", "entity.creeper.hurt"),
ENTITY_CREEPER_PRIMED("random.fuse", "entity.creeper.primed"),
ENTITY_DONKEY_AMBIENT("mob.donkey.idle", "entity.donkey.ambient"),
ENTITY_DONKEY_ANGRY("mob.donkey.angry", "entity.donkey.angry"),
ENTITY_DONKEY_CHEST("random.pop", "entity.donkey.chest"),
ENTITY_DONKEY_DEATH("mob.donkey.death", "entity.donkey.death"),
ENTITY_DONKEY_HURT("mob.donkey.hit", "entity.donkey.hurt"),
ENTITY_EGG_THROW("random.bow", "entity.egg.throw"),
ENTITY_ELDER_GUARDIAN_AMBIENT("mob.guardian.elder.idle", "entity.elder_guardian.ambient"),
ENTITY_ELDER_GUARDIAN_AMBIENT_LAND("mob.guardian.elder.land.idle", "entity.elder_guardian.ambient_land"),
ENTITY_ELDER_GUARDIAN_CURSE("mob.guardian.elder.curse", "entity.elder_guardian.curse"),
ENTITY_ELDER_GUARDIAN_DEATH("mob.guardian.elder.death", "entity.elder_guardian.death"),
ENTITY_ELDER_GUARDIAN_DEATH_LAND("mob.guardian.land.death", "entity.elder_guardian.death_land"),
ENTITY_ELDER_GUARDIAN_HURT("mob.guardian.elder.hit", "entity.elder_guardian.hurt"),
ENTITY_ELDER_GUARDIAN_HURT_LAND("mob.guardian.land.hit", "entity.elder_guardian.hurt_land"),
ENTITY_ENDERDRAGON_AMBIENT("mob.enderdragon.idle", "entity.enderdragon.ambient"),
ENTITY_ENDERDRAGON_DEATH("mob.enderdragon.end", "entity.enderdragon.death"),
ENTITY_ENDERDRAGON_FIREBALL_EXPLODE("", "entity.enderdragon.fireball_explode"),
ENTITY_ENDERDRAGON_FLAP("mob.enderdragon.wings", "entity.enderdragon.flap"),
ENTITY_ENDERDRAGON_GROWL("mob.enderdragon.growl", "entity.enderdragon.growl"),
ENTITY_ENDERDRAGON_HURT("mob.enderdragon.hit", "entity.enderdragon.hurt"),
ENTITY_ENDERDRAGON_SHOOT("mob.ghast.fireball4", "entity.enderdragon.shoot"),
ENTITY_ENDEREYE_LAUNCH("random.bow", "entity.endereye.launch"),
ENTITY_ENDERMEN_AMBIENT("mob.endermen.idle", "entity.endermen.ambient"),
ENTITY_ENDERMEN_DEATH("mob.endermen.death", "entity.endermen.death"),
ENTITY_ENDERMEN_HURT("mob.endermen.hit", "entity.endermen.hurt"),
ENTITY_ENDERMEN_SCREAM("mob.endermen.scream", "entity.endermen.scream"),
ENTITY_ENDERMEN_STARE("mob.endermen.stare", "entity.endermen.stare"),
ENTITY_ENDERMEN_TELEPORT("mob.endermen.portal", "entity.endermen.teleport"),
ENTITY_ENDERMITE_AMBIENT("mob.silverfish.say", "entity.endermite.ambient"),
ENTITY_ENDERMITE_DEATH("mob.silverfish.kill", "entity.endermite.death"),
ENTITY_ENDERMITE_HURT("mob.silverfish.hit", "entity.endermite.hurt"),
ENTITY_ENDERMITE_STEP("mob.silverfish.step", "entity.endermite.step"),
ENTITY_ENDERPEARL_THROW("random.bow", "entity.enderpearl.throw"),
ENTITY_EXPERIENCE_BOTTLE_THROW("random.bow", "entity.experience_bottle.throw"),
ENTITY_EXPERIENCE_ORB_PICKUP("random.orb", "entity.experience_orb.pickup"),
ENTITY_EXPERIENCE_ORB_TOUCH("random.orb", "entity.experience_orb.touch"),
ENTITY_FIREWORK_BLAST("firework.blast1", "entity.firework.blast"),
ENTITY_FIREWORK_BLAST_FAR("firework.blast_far1", "entity.firework.blast_far"),
ENTITY_FIREWORK_LARGE_BLAST("firework.largeBlast1", "entity.firework.large_blast"),
ENTITY_FIREWORK_LARGE_BLAST_FAR("firework.largeBlast_far1", "entity.firework.large_blast_far"),
ENTITY_FIREWORK_LAUNCH("firework.launch1", "entity.firework.launch"),
ENTITY_FIREWORK_SHOOT("random.bow", "entity.firework.shoot"),
ENTITY_FIREWORK_TWINKLE("firework.twinkle1", "entity.firework.twinkle"),
ENTITY_FIREWORK_TWINKLE_FAR("firework.twinkle_far1", "entity.firework.twinkle_far"),
ENTITY_GENERIC_BIG_FALL("damage.fallbig", "entity.generic.big_fall"),
ENTITY_GENERIC_BURN("random.fizz", "entity.generic.burn"),
ENTITY_GENERIC_DEATH("damage.hit", "entity.generic.death"),
ENTITY_GENERIC_DRINK("random.drink", "entity.generic.drink"),
ENTITY_GENERIC_EAT("random.eat", "entity.generic.eat"),
ENTITY_GENERIC_EXPLODE("random.explode", "entity.generic.explode"),
ENTITY_GENERIC_EXTINGUISH_FIRE("random.fizz", "entity.generic.extinguish_fire"),
ENTITY_GENERIC_HURT("damage.hurt", "entity.generic.hurt"),
ENTITY_GENERIC_SMALL_FALL("damage.fallsmall", "entity.generic.small_fall"),
ENTITY_GENERIC_SPLASH("liquid.splash", "entity.generic.splash"),
ENTITY_GENERIC_SWIM("liquid.swim", "entity.generic_swim"),
ENTITY_GHAST_AMBIENT("mob.ghast.moan", "entity.ghast.ambient"),
ENTITY_GHAST_DEATH("mob.ghast.death", "entity.ghast.death"),
ENTITY_GHAST_HURT("mob.ghast.scream", "entity.ghast.hurt"),
ENTITY_GHAST_SCREAM("mob.ghast.scream", "entity.ghast.scream"),
ENTITY_GHAST_SHOOT("mob.ghast.fireball4", "entity.ghast.shoot"),
ENTITY_GHAST_WARN("mob.ghast.charge", "entity.ghast.warn"),
ENTITY_GUARDIAN_AMBIENT("mob.guardian.idle", "entity.guardian.ambient"),
ENTITY_GUARDIAN_AMBIENT_LAND("mob.guardian.land.idle", "entity.guardian.ambient_land"),
ENTITY_GUARDIAN_ATTACK("mob.guardian.attack.loop", "entity.guardian.attack"),
ENTITY_GUARDIAN_DEATH("mob.guardian.death", "entity.guardian.death"),
ENTITY_GUARDIAN_DEATH_LAND("mob.guardian.land.death", "entity.guardian.death_land"),
ENTITY_GUARDIAN_FLOP("mob.guardian.flop", "entity.guardian.flop"),
ENTITY_GUARDIAN_HURT("mob.guardian.hit", "entity.guardian.hurt"),
ENTITY_GUARDIAN_HURT_LAND("mob.guardian.land.hit", "entity.guardian.hurt_land"),
ENTITY_HORSE_AMBIENT("mob.horse.idle", "entity.horse.ambient"),
ENTITY_HORSE_ANGRY("mob.horse.angry1", "entity.horse.angry"),
ENTITY_HORSE_ARMOR("mob.horse.armor", "entity.horse.armor"),
ENTITY_HORSE_BREATHE("mob.horse.breathe", "entity.horse.breathe"),
ENTITY_HORSE_DEATH("mob.horse.death", "entity.horse.death"),
ENTITY_HORSE_EAT("", "entity.horse.eat"),
ENTITY_HORSE_GALLOP("mob.horse.gallop", "entity.horse.gallop"),
ENTITY_HORSE_HURT("mob.horse.hit", "entity.horse.hurt"),
ENTITY_HORSE_JUMP("mob.horse.jump", "entity.horse.jump"),
ENTITY_HORSE_LAND("mob.horse.land", "entity.horse.land"),
ENTITY_HORSE_SADDLE("mob.horse.leather", "entity.horse.saddle"),
ENTITY_HORSE_STEP("mob.horse.soft", "entity.horse.step"),
ENTITY_HORSE_STEP_WOOD("mob.horse.wood", "entity.horse.step_wood"),
ENTITY_HOSTILE_BIG_FALL("damage.fallbig", "entity.hostile.big_fall"),
ENTITY_HOSTILE_DEATH("damage.hit", "entity.hostile.death"),
ENTITY_HOSTILE_HURT("damage.hit", "entity.hostile.hurt"),
ENTITY_HOSTILE_SMALL_FALL("damage.fallsmall", "entity.hostile.small_fall"),
ENTITY_HOSTILE_SPLASH("liquid.splash", "entity.hostile.splash"),
ENTITY_HOSTILE_SWIM("liquid.swin", "entity.hostile.swim"),
ENTITY_IRONGOLEM_ATTACK("mob.irongolem.hit", "entity.irongolem.attack"),
ENTITY_IRONGOLEM_DEATH("mob.irongolem.death", "entity.irongolem.death"),
ENTITY_IRONGOLEM_HURT("mob.irongolem.hit", "entity.irongolem.hurt"),
ENTITY_IRONGOLEM_STEP("mob.irongolem.step", "entity.irongolem.step"),
ENTITY_ITEMFRAME_ADD_ITEM("random.pop", "entity.itemframe.add_item"),
ENTITY_ITEMFRAME_BREAK("random.pop", "entity.itemframe.break"),
ENTITY_ITEMFRAME_PLACE("random.pop", "entity.itemframe.place"),
ENTITY_ITEMFRAME_REMOVE_ITEM("random.pop", "entity.itemframe.remove_item"),
ENTITY_ITEMFRAME_ROTATE_ITEM("random.pop", "entity.itemframe.rotate_item"),
ENTITY_ITEM_BREAK("random.pop", "entity.item.break"),
ENTITY_ITEM_PICKUP("random.pop", "entity.item.pickup"),
ENTITY_LEASHKNOT_BREAK("mob.horse.leather", "entity.leashknot.break"),
ENTITY_LEASHKNOT_PLACE("mob.horse.leather", "entity.leashknot.place"),
ENTITY_LIGHTNING_IMPACT("random.explode", "entity.lightning.impact"),
ENTITY_LIGHTNING_THUNDER("ambient.weather.thunder", "entity.lightning.thunder"),
ENTITY_LINGERINGPOTION_THROW("random.bow", "entity.lingeringpotion.throw"),
ENTITY_MAGMACUBE_DEATH("mob.magmacube.big", "entity.magmacube.death"),
ENTITY_MAGMACUBE_HURT("mob.magmacube.big", "entity.magmacube.hurt"),
ENTITY_MAGMACUBE_JUMP("mob.magmacube.jump", "entity.magmacube.jump"),
ENTITY_MAGMACUBE_SQUISH("mob.magmacube.small", "entity.magmacube.squish"),
ENTITY_MINECART_INSIDE("minecart.inside", "entity.minecart.inside"),
ENTITY_MINECART_RIDING("minecart.base", "entity.minecart.riding"),
ENTITY_MOOSHROOM_SHEAR("mob.sheep.shear", "entity.mooshroom.shear"),
ENTITY_MULE_AMBIENT("mob.horse.donkey.idle", "entity.mule.ambient"),
ENTITY_MULE_DEATH("mob.horse.donkey.death", "entity.mule.death"),
ENTITY_MULE_HURT("mob.horse.donkey.hit", "entity.mule.hurt"),
ENTITY_PAINTING_BREAK("dig.wool", "entity.painting.break"),
ENTITY_PAINTING_PLACE("dig.wool", "entity.painting.place"),
ENTITY_PIG_AMBIENT("mob.pig.say", "entity.pig.ambient"),
ENTITY_PIG_DEATH("mob.pig.death", "entity.pig.death"),
ENTITY_PIG_HURT("mob.pig.say", "entity.pig.hurt"),
ENTITY_PIG_SADDLE("mob.horse.leather", "entity.pig.saddle"),
ENTITY_PIG_STEP("mob.pig.step", "entity.pig.step"),
ENTITY_PLAYER_ATTACK_CRIT("damage.hit", "entity.player.attack.crit"),
ENTITY_PLAYER_ATTACK_KNOCKBACK("damage.hit", "entity.player.attack.knockback"),
ENTITY_PLAYER_ATTACK_NODAMAGE("damage.hit", "entity.player.attack.nodamage"),
ENTITY_PLAYER_ATTACK_STRONG("damage.hit", "entity.player.attack.strong"),
ENTITY_PLAYER_ATTACK_SWEEP("damage.hit", "entity.player.attack.sweep"),
ENTITY_PLAYER_ATTACK_WEAK("damage.hit", "entity.player.attack.weak"),
ENTITY_PLAYER_BIG_FALL("damage.fallbig", "entity.player.big_fall"),
ENTITY_PLAYER_BREATH("random.breath", "entity.player.breath"),
ENTITY_PLAYER_BURP("random.burp", "entity.player.burp"),
ENTITY_PLAYER_DEATH("damage.hit", "entity.player.death"),
ENTITY_PLAYER_HURT("damage.hit", "entity.player.hurt"),
ENTITY_PLAYER_LEVELUP("random.levelup", "entity.player.levelup"),
ENTITY_PLAYER_SMALL_FALL("damage.fallsmall", "entity.player.small_fall"),
ENTITY_PLAYER_SPLASH("liquid.splash", "entity.player.splash"),
ENTITY_PLAYER_SWIM("liquid.swim", "entity.player.swim"),
ENTITY_RABBIT_AMBIENT("mob.rabbit.idle", "entity.rabbit.ambient"),
ENTITY_RABBIT_ATTACK("damage.hit", "entity.rabbit.attack"),
ENTITY_RABBIT_DEATH("mob.rabbit.death", "entity.rabbit.death"),
ENTITY_RABBIT_HURT("mob.rabbit.hurt", "entity.rabbit.hurt"),
ENTITY_RABBIT_JUMP("mob.rabbit.hop", "entity.rabbit.jump"),
ENTITY_SHEEP_AMBIENT("mob.sheep.say", "entity.sheep.ambient"),
ENTITY_SHEEP_DEATH("mob.sheep.say", "entity.sheep.death"),
ENTITY_SHEEP_HURT("mob.sheep.say", "entity.sheep.hurt"),
ENTITY_SHEEP_SHEAR("mob.sheep.shear", "entity.sheep.shear"),
ENTITY_SHEEP_STEP("mob.sheep.step", "entity.sheep.step"),
ENTITY_SHULKER_AMBIENT("", "entity.shulker.ambient"),
ENTITY_SHULKER_BULLET_HIT("", "entity.shulker.bullet.hit"),
ENTITY_SHULKER_BULLET_HURT("", "entity.shulker.bullet.hurt"),
ENTITY_SHULKER_CLOSE("", "entity.shulker.close"),
ENTITY_SHULKER_DEATH("", "entity.shulker.death"),
ENTITY_SHULKER_HURT("", "entity.shulker.hurt"),
ENTITY_SHULKER_HURT_CLOSED("", "entity.shulker.hurt_closed"),
ENTITY_SHULKER_OPEN("", "entity.shulker.open"),
ENTITY_SHULKER_SHOOT("", "entity.shulker.shoot"),
ENTITY_SHULKER_TELEPORT("", "entity.shulker.teleport"),
ENTITY_SILVERFISH_AMBIENT("mob.silverfish.say", "entity.silverfish.ambient"),
ENTITY_SILVERFISH_DEATH("mob.silverfish.kill", "entity.silverfish.death"),
ENTITY_SILVERFISH_HURT("mob.silverfish.hit", "entity.silverfish.hurt"),
ENTITY_SILVERFISH_STEP("mob.silverfish.step", "entity.silverfish.step"),
ENTITY_SKELETON_AMBIENT("mob.skeleton.say", "entity.skeleton.ambient"),
ENTITY_SKELETON_DEATH("mob.skeleton.death", "entity.skeleton.death"),
ENTITY_SKELETON_HORSE_AMBIENT("mob.horse.skeleton.idle", "entity.skeleton_horse.ambient"),
ENTITY_SKELETON_HORSE_DEATH("mob.horse.skeleton.death", "entity.skeleton_horse.death"),
ENTITY_SKELETON_HORSE_HURT("mob.horse.skeleton.hit", "entity.skeleton_horse.hurt"),
ENTITY_SKELETON_HURT("mob.skeleton.hurt", "entity.skeleton.hurt"),
ENTITY_SKELETON_SHOOT("random.bow", "entity.skeleton.shoot"),
ENTITY_SKELETON_STEP("mob.skeleton.step", "entity.skeleton.step"),
ENTITY_SLIME_ATTACK("mob.slime.attack", "entity.slime.attack"),
ENTITY_SLIME_DEATH("mob.slime.big", "entity.slime.death"),
ENTITY_SLIME_HURT("mob.slime.big", "entity.slime.hurt"),
ENTITY_SLIME_JUMP("mob.slime.big", "entity.slime.jump"),
ENTITY_SLIME_SQUISH("mob.slime.small", "entity.slime.squish"),
ENTITY_SMALL_MAGMACUBE_DEATH("mob.magmacube.small", "entity.small_magmacube.death"),
ENTITY_SMALL_MAGMACUBE_HURT("mob.magmacube.small", "entity.small_magmacube.hurt"),
ENTITY_SMALL_MAGMACUBE_SQUISH("mob.magmacube.small", "entity.small_magmacube.squish"),
ENTITY_SMALL_SLIME_DEATH("mob.slime.small", "entity.small_slime.death"),
ENTITY_SMALL_SLIME_HURT("mob.slime.small", "entity.small_slime.hurt"),
ENTITY_SMALL_SLIME_JUMP("mob.slime.small", "entity.small_slime.jump"),
ENTITY_SMALL_SLIME_SQUISH("mob.slime.small", "entity.small_slime.squish"),
ENTITY_SNOWBALL_THROW("random.bow", "entity.snowball.throw"),
ENTITY_SNOWMAN_AMBIENT("", "entity.snowman.ambient"),
ENTITY_SNOWMAN_DEATH("dig.snow", "entity.snowman.death"),
ENTITY_SNOWMAN_HURT("dig.snow", "entity.snowman.hurt"),
ENTITY_SNOWMAN_SHOOT("random.bow", "entity.snowman.shoot"),
ENTITY_SPIDER_AMBIENT("mob.spider.say", "entity.spider.ambient"),
ENTITY_SPIDER_DEATH("mob.spider.death", "entity.spider.death"),
ENTITY_SPIDER_HURT("mob.spider.say", "entity.spider.hurt"),
ENTITY_SPIDER_STEP("mob.spider.step", "entity.spider.step"),
ENTITY_SPLASH_POTION_BREAK("game.potion.smash", "entity.splash_potion.break"),
ENTITY_SPLASH_POTION_THROW("random.bow", "entity.splash_potion.throw"),
ENTITY_SQUID_AMBIENT("", "entity.squid.ambient"),
ENTITY_SQUID_DEATH("", "entity.squid.death"),
ENTITY_SQUID_HURT("", "entity.squid.hurt"),
ENTITY_TNT_PRIMED("random.fuse", "entity.tnt.primed"),
ENTITY_VILLAGER_AMBIENT("mob.villager.idle", "entity.villager.ambient"),
ENTITY_VILLAGER_DEATH("mob.villager.death", "entity.villager.death"),
ENTITY_VILLAGER_HURT("mob.villager.hit", "entity.villager.hurt"),
ENTITY_VILLAGER_NO("mob.villager.no", "entity.villager.no"),
ENTITY_VILLAGER_TRADING("mob.villager.haggle", "entity.villager.trading"),
ENTITY_VILLAGER_YES("mob.villager.yes", "entity.villager.yes"),
ENTITY_WITCH_AMBIENT("mob.villager.idle", "entity.witch.ambient"),
ENTITY_WITCH_DEATH("mob.villager.death", "entity.witch.death"),
ENTITY_WITCH_DRINK("liquid.splash", "entity.witch.drink"),
ENTITY_WITCH_HURT("mob.villaher.hit", "entity.witch_hurt"),
ENTITY_WITCH_THROW("random.bow", "entity.witch_throw"),
ENTITY_WITHER_AMBIENT("mob.wither.idle", "entity.wither.ambient"),
ENTITY_WITHER_BREAK_BLOCK("mob.zombie.woodbreak", "entity.wither.break_block"),
ENTITY_WITHER_DEATH("mob.wither.death", "entity.wither.death"),
ENTITY_WITHER_HURT("mob.wither.hurt", "entity.wither.hurt"),
ENTITY_WITHER_SHOOT("mob.wither.shoot", "entity.wither.shoot"),
ENTITY_WITHER_SPAWN("mob.wither.spawn", "entity.wither.spawn"),
ENTITY_WOLF_AMBIENT("mob.wolf.bark", "entity.wolf.ambient"),
ENTITY_WOLF_DEATH("mob.wolf.death", "entity.wolf.death"),
ENTITY_WOLF_GROWL("mob.wolf.growl", "entity.wolf.growl"),
ENTITY_WOLF_HOWL("mob.wolf.howl", "entity.wolf.howl"),
ENTITY_WOLF_HURT("mob.wolf.hurt", "entity.wolf.hurt"),
ENTITY_WOLF_PANT("mob.wolf.panting", "entity.wolf.pant"),
ENTITY_WOLF_SHAKE("mob.wolf.shake", "entity.wolf.shake"),
ENTITY_WOLF_STEP("mob.wolf.step", "entity.wolf.step"),
ENTITY_WOLF_WHINE("mob.wolf.whine", "entity.wolf.whine"),
ENTITY_ZOMBIE_AMBIENT("mob.zombie.idle", "entity.zombie.ambient"),
ENTITY_ZOMBIE_ATTACK_DOOR_WOOD("mob.zombie.wood", "entity.zombie.attack.door_wood"),
ENTITY_ZOMBIE_ATTACK_IRON_DOOR("mob.zombie.wood", "entity.zombie.attack.iron_door"),
ENTITY_ZOMBIE_BREAK_DOOR_WOOD("mob.zombie.woodbreak", "entity.zombie.break_door_wood"),
ENTITY_ZOMBIE_DEATH("mob.zombie.death", "entity.zombie.death"),
ENTITY_ZOMBIE_HORSE_AMBIENT("mob.horse.zombie.idle", "entity.zombie_horse.ambient"),
ENTITY_ZOMBIE_HORSE_DEATH("mob.horse.zombie.death", "entity.zombie_horse.death"),
ENTITY_ZOMBIE_HORSE_HURT("hit", "entity.zombie.horse_hurt"),
ENTITY_ZOMBIE_HURT("mob.zombie.hurt", "entity.zombie.hurt"),
ENTITY_ZOMBIE_INFECT("mob.zombie.infect", "entity.zombie.infect"),
ENTITY_ZOMBIE_PIG_AMBIENT("mob.zombiepig.zpig", "entity.zombie_pig.ambient"),
ENTITY_ZOMBIE_PIG_ANGRY("mob.zombiepig.zpigangry", "entity.zombie_pig.angry"),
ENTITY_ZOMBIE_PIG_DEATH("mob.zombiepig.zpigdeath", "entity.zombie_pig.death"),
ENTITY_ZOMBIE_PIG_HURT("mob.zombiepig.hurt", "entity.zombie_pig.hurt"),
ENTITY_ZOMBIE_STEP("mob.zombie.step", "entity.zombie.step"),
ENTITY_ZOMBIE_VILLAGER_AMBIENT("mob.zombie.idle", "entity.zombie.villager_ambient"),
ENTITY_ZOMBIE_VILLAGER_CONVERTED("mob.zombie.unfect", "entity.zombie.villager_converted"),
ENTITY_ZOMBIE_VILLAGER_CURE("mob.zombie.remedy", "entity.zombie.villager_cure"),
ENTITY_ZOMBIE_VILLAGER_DEATH("mob.zombie.death", "entity.zombie.villager_death"),
ENTITY_ZOMBIE_VILLAGER_HURT("mob.zombie.hurt", "entity.zombie.villager_hurt"),
ENTITY_ZOMBIE_VILLAGER_STEP("mob.zombie.step", "entity.zombie.villager_step"),
ITEM_ARMOR_EQUIP_CHAIN("random.pop", "item.armor.equip_chain"),
ITEM_ARMOR_EQUIP_DIAMOND("random.pop", "item.armor.equip_diamond"),
ITEM_ARMOR_EQUIP_GENERIC("random.pop", "item.armor.equip_generic"),
ITEM_ARMOR_EQUIP_GOLD("random.pop", "item.armor.equip_gold"),
ITEM_ARMOR_EQUIP_IRON("random.pop", "item.armor.equip_iron"),
ITEM_ARMOR_EQUIP_LEATHER("mob.horse.leather", "item.armor.equip_leather"),
ITEM_BOTTLE_FILL("liquid.splash", "item.bottle.fill"),
ITEM_BOTTLE_FILL_DRAGONBREATH("liquid.splash", "item.bottle.fill_dragonbreath"),
ITEM_BUCKET_EMPTY("liquid.splash", "item.bucket.empty"),
ITEM_BUCKET_EMPTY_LAVA("liquid.splash", "item.bucket.empty_lava"),
ITEM_BUCKET_FILL("liquid.splash", "item.bucket.fill"),
ITEM_BUCKET_FILL_LAVA("liquid.splash", "item.bucket.fill_lava"),
ITEM_CHORUS_FRUIT_TELEPORT("mob.endermen.portal", "item.chorus_fruit.teleport"),
ITEM_ELYTRA_FLYING("", "item.elytra_flying"),
ITEM_FIRECHARGE_USE("item.fireCharge.use", "item.firecharge.use"),
ITEM_FLINTANDSTEEL_USE("fire.ingnite", "item.flintandsteel.use"),
ITEM_HOE_TILL("step.grass", "item.hoe.till"),
ITEM_SHIELD_BLOCK("", "item.shield.block"),
ITEM_SHIELD_BREAK("random.anvil_break", "item.shield.break"),
ITEM_SHOVEL_FLATTEN("dig.grass", "item.shovel.flatten"),
MUSIC_CREATIVE("music.game.creative", "music.creative"),
MUSIC_CREDITS("music.game.end.credits", "music.credits"),
MUSIC_DRAGON("music.game.end.dragon", "music.dragon"),
MUSIC_END("music.game.end", "music.end"),
MUSIC_GAME("music.game", "music.game"),
MUSIC_MENU("music.menu", "music.menu"),
MUSIC_NETHER("music.game.nether", "music.nether"),
RECORD_11("records.record_11", "record.11"),
RECORD_13("records.record_13", "record.13"),
RECORD_BLOCKS("records.blocks", "record.blocks"),
RECORD_CAT("records.cat", "record.cat"),
RECORD_CHIRP("records.chrip", "record.chirp"),
RECORD_FAR("records.far", "record.far"),
RECORD_MALL("records.mall", "record.mall"),
RECORD_MELLOHI("records.mellohi", "record.mellohi"),
RECORD_STAL("records.stal", "record.stal"),
RECORD_STRAD("records.strad", "record.strad"),
RECORD_WAIT("records.wait", "record.wait"),
RECORD_WARD("records.ward", "record.ward"),
UI_BUTTON_CLICK("random.click", "ui.button.click"),
WEATHER_RAIN("ambient.weather.rain", "weather.rain"),
WEATHER_RAIN_ABOVE("ambient.weather.rain", "weather.rain.above");
private String oldSound;
private String newSound;
SoundHelper(String oldSound, String newSound) {
this.oldSound = oldSound;
this.newSound = newSound;
}
/**
* Play sound with version bridge!
*
* @param player
* @param sound
* @param volume
* @param pitch
*/
public static void playSound(Player player, SoundHelper sound, float volume, float pitch){
String s = "";
if(getVersion()>=110){
s = sound.newSound;
}else{
s = sound.oldSound;
}
player.playSound(player.getLocation(), s, volume, pitch);
}
public void play(Player player, float volume, float pitch){
playSound(player, this, volume, pitch);
}
public static int getVersion(){
return Integer.parseInt(Bukkit.getVersion().substring(Bukkit.getVersion().lastIndexOf("MC: ")+4).replace(")", "").replace(".", ""));
}
public String getOldSound() {
return oldSound;
}
public String getNewSound() {
return newSound;
}
} | [
"rodel1407@hotmail.com"
] | rodel1407@hotmail.com |
006c42b997952885ef238832c11a0f198e55d1f8 | f2efeb58610b52d9ea30d9374c8107b92a8ee022 | /src/main/test/com/lgd/Mysql_Con_test.java | 40c5b490953ae4d0df2ca53d8b18cf2557acffeb | [] | no_license | GirlFriendNotFindException/jungle | af754c17c8e5d0e1caa6e30924c8c5435d7db5b1 | dc77ee3a4236af2c0951ebda476fcba80ec6c350 | refs/heads/master | 2020-03-10T13:12:27.990327 | 2018-04-13T11:57:14 | 2018-04-13T11:57:14 | 129,394,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | package com.lgd;
import javax.annotation.Resource;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:springConfig.xml")
public class Mysql_Con_test {
@Resource(name="dataSource")
private BasicDataSource dataSource;
@Resource(name="sqlSession")
private SqlSession session;
@Test
public void getDataSource(){
System.out.println(dataSource);
}
@Test
public void getSqlSession(){
System.out.println(session);
}
}
| [
"18473481886@163.com"
] | 18473481886@163.com |
e0a66487f976b51145ccd88c40080b1965e1958c | b49c6f309316b0e588f131ec14b124d9d99a534d | /src/com/codechef/CodeChef1.java | a703278b3c2828c3f69f98a11d67d20c5c665a7b | [] | no_license | silversteak/coding-practices | 058ae13ab3b2f2db68dda4b9ccb910c778a41519 | f463a1467eaae2e243933085b885d2e2c5f61eb7 | refs/heads/master | 2021-06-25T21:47:31.122855 | 2021-04-10T10:10:59 | 2021-04-10T10:10:59 | 224,480,793 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,122 | java | package com.codechef;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
public class CodeChef1 {
public static void main(String[] args) {
int t;
try {
BufferedReader inp = new BufferedReader(new InputStreamReader(System.in));
t = Integer.parseInt(inp.readLine());
while(t > 0){
int j = Integer.parseInt(inp.readLine());
String input[] = new String[j];
for(int i = 0; i < j ; i++)
input[i] = inp.readLine();
Boolean prim[] = new Boolean[26];
Arrays.fill(prim, new Boolean(true));
for(int i = 0; i < j; i++) {
Boolean sec[] = new Boolean[26];
Arrays.fill(sec, new Boolean(false));
for(int k = 0; k < input[i].length(); k++) {
if(prim[input[i].charAt(k)-'a'])
sec[input[i].charAt(k)-'a'] = true;
}
System.arraycopy(sec, 0, prim, 0, 26);
}
int count = 0;
for(int i = 0; i < 26;i++) {
if(prim[i])
count++;
}
System.out.println(count);
t--;
}
}
catch(Exception e) {
}
}
}
| [
"tauseef.rahaman@highradius.com"
] | tauseef.rahaman@highradius.com |
b3d17cf12972f3710b71e91d5edf53a9c3c65da3 | b93e801bb9a11fd820201ad56894b896e0831ff1 | /CleverWeb-Service/src/main/java/com/cleverweb/service/fhdb/brdb/BRdbManager.java | 53d5fd8bc89b6d8433d66cd24ca6e313dbe664bf | [
"Apache-2.0"
] | permissive | showtofly/CleverWeb | c41569f7a238112196fa37a8cb7f317bc0a49a97 | f7a9079f2e3206c255fe37ae6b750a3f453807c0 | refs/heads/master | 2023-04-13T13:34:35.442782 | 2017-02-06T14:29:10 | 2017-02-06T14:29:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,098 | java | package com.cleverweb.service.fhdb.brdb;
import java.util.List;
import com.cleverweb.core.entity.Page;
import com.cleverweb.common.util.PageData;
/**
* 说明: 数据库管理接口
* 创建人:FH Q313596790
* 创建时间:2016-03-30
* @version
*/
public interface BRdbManager{
/**新增
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception;
/**删除
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception;
/**修改
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception;
/**列表
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception;
/**列表(全部)
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception;
/**通过id获取数据
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception;
/**批量删除
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception;
}
| [
"863475209@qq.com"
] | 863475209@qq.com |
63bf692c3bf4ba310ba353d93126af7b597463c0 | 6a14cc6ffacbe4459b19f882b33d307ab08e8783 | /aliyun-java-sdk-drds/src/main/java/com/aliyuncs/drds/transform/v20150413/CreateTableResponseUnmarshaller.java | 1edd45e0dc7ef1780df350ca1bd14da40e12d8e7 | [
"Apache-2.0"
] | permissive | 425296516/aliyun-openapi-java-sdk | ea547c7dc8f05d1741848e1db65df91b19a390da | 0ed6542ff71e907bab3cf21311db3bfbca6ca84c | refs/heads/master | 2023-09-04T18:27:36.624698 | 2015-11-10T07:52:55 | 2015-11-10T07:52:55 | 46,623,385 | 1 | 2 | null | 2016-12-07T18:36:30 | 2015-11-21T16:28:33 | Java | UTF-8 | Java | false | false | 1,354 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.aliyuncs.drds.transform.v20150413;
import com.aliyuncs.drds.model.v20150413.CreateTableResponse;
import com.aliyuncs.transform.UnmarshallerContext;
public class CreateTableResponseUnmarshaller {
public static CreateTableResponse unmarshall(CreateTableResponse createTableResponse, UnmarshallerContext context) {
createTableResponse.setRequestId(context.stringValue("CreateTableResponse.RequestId"));
createTableResponse.setTaskId(context.stringValue("CreateTableResponse.TaskId"));
return createTableResponse;
}
} | [
"lijie.ma@alibaba-inc.com"
] | lijie.ma@alibaba-inc.com |
07e8c2bcbe15251d58a10e8669b94d86756a3e00 | 716e8d06b67be4d9d2358d630f8d6cd762a20c7f | /zuul/src/main/java/com/zhuge/spring/cloud/learn/zuul/MyZuulFilter.java | 3866de1f338a9a0e36c60d7a6e5c4c57b3193280 | [] | no_license | zhuge134/spring-cloud-learn | 3b1da82fe1423f8fe36e77a17fbe1921edd6be39 | 94e40318c15b89ce91659f4bb0b15ea1ec9a18cb | refs/heads/master | 2020-04-14T23:57:21.235066 | 2019-02-17T11:25:24 | 2019-02-17T11:25:24 | 163,741,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,561 | java | package com.zhuge.spring.cloud.learn.zuul;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
@Component
public class MyZuulFilter extends ZuulFilter {
private static Logger log = LoggerFactory.getLogger(MyZuulFilter.class);
@Override
public String filterType() {
return "pre";
}
@Override
public int filterOrder() {
return 0;
}
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() throws ZuulException {
RequestContext ctx = RequestContext.getCurrentContext();
HttpServletRequest request = ctx.getRequest();
log.info("method:{}, url:{}", request.getMethod(), request.getRequestURL().toString());
String token = request.getParameter("token");
if (null == token) {
log.warn("token is empty!");
ctx.setSendZuulResponse(false);
ctx.setResponseStatusCode(HttpStatus.UNAUTHORIZED.value());
try {
ctx.getResponse().getWriter().write("token is empty !");
} catch (IOException e) {
log.error("IOException for", e);
}
return null;
}
log.info("ok!");
return null;
}
}
| [
"zhuge134@outlook.com"
] | zhuge134@outlook.com |
c0f18956897fab9d71a9466b874d4ec459e19de3 | 34647c0c9ca162f506b5487e1f392a239858c821 | /spring-X/spring/src/com/xlj/spring/aop/ThrowsInterceptor.java | 16fca6ac828721d42d772cd9ec002e32daaa12b7 | [] | no_license | jguoguo/javaStudy | 8860d0ca19abb339314cda450a37e8e5e9f7a1c4 | 41df2d5834e499d477f56881452a3e5c25315b6e | refs/heads/master | 2021-08-08T01:51:47.501645 | 2017-11-09T10:01:02 | 2017-11-09T10:01:02 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 552 | java | package com.xlj.spring.aop;
import java.lang.reflect.Method;
import javax.security.auth.login.AccountException;
import org.springframework.aop.ThrowsAdvice;
public class ThrowsInterceptor implements ThrowsAdvice {//异常拦截器
public void afterThrowing(Method method, Object[] arg,Object instance,
AccountException ex) throws Throwable {
System.out.println("方法"+method.getName()+"抛出了异常:"+ex);
}
public void afterThrowing(NullPointerException ex) throws Throwable {
System.out.println("抛出了异常:"+ex);
}
}
| [
"xielijiang@itangquan.com"
] | xielijiang@itangquan.com |
11c48d4c675108420f4813de5cc407e6030a810a | 3813f1a7bac934b26057b5f44d1b65a14543397d | /workspace/03_array/src/ex01_array/Ex03_array_reference.java | 2870af52ef9abe66aef1d9bca3ff667e80d2dfc0 | [] | no_license | dksqjq4851/javastudy | 156da0449c2414f717bee44cd5f9397a41801f88 | 0960a4ddc752dd2f9d575e7e93d8e7f4937ab806 | refs/heads/main | 2023-04-01T21:52:52.998771 | 2021-03-31T05:54:01 | 2021-03-31T05:54:01 | 347,885,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 991 | java | package ex01_array;
public class Ex03_array_reference {
public static void main(String[] args) {
// 배열은 reference type입니다.
int[] arr = new int[3];
System.out.println(arr); // new int[3]을 통해서 생성된 배열요소들의 주소가 저장되어 있습니다.
// 배열의 길이를 조정하는 (일반적으로 늘이는 작업) 코드입니다.
int[] a = { 1, 2, 3 }; // 배열 a의 길이는 3입니다.
int[] b = new int[10]; // 배열 b의 길이는 10입니다.
// b[0] = a[0], b[1] = a[1], b[2] = a[2]
for (int i = 0; i < a.length; i++) {
b[i] = a[i];
}
// a에는 {1, 2, 3}이 저장된 주소가 있습니다.
// b에는 {1, 2, 3, 0, 0, 0, 0, 0, 0, 0}이 저장된 주소가 있습니다.
a = b; // a에는 {1, 2, 3, 0, 0, 0, 0, 0, 0, 0}이 저장된 주소가 있습니다.
// 배열 a의 길이가 증가했습니다.
for (int i = 0; i < a.length; i++) {
System.out.println(a[i]);
}
}
}
| [
"dksqjq4851@naver.com"
] | dksqjq4851@naver.com |
fed59e1c9dcf0dfa0c2cdff6f324244b0b39230e | 16f17a0d585229ac6dcf395e5275381e2cece5ea | /src/com/MainMethod.java | 0ce26c8254adf76d734df2abaf54894081071b46 | [] | no_license | chinmoysihi/QueryDatasetWithoutSQLin-JAVA | 06fdf124fbcb770ec8d7b2050669c8243a33bb6b | bcfae8af4334f2dd43fe81615c85243fca8e33cd | refs/heads/master | 2020-03-29T08:48:11.858878 | 2018-09-21T08:15:54 | 2018-09-21T08:15:54 | 149,727,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,501 | java | package com;
import java.util.*;
public class MainMethod {
public static final String CSV_deliveries="D:\\EclipseWorkSpace\\QueryDatasetWithoutSQLin-JAVA\\iplDataset\\deliveries.csv";
public static final String CSV_matches="D:\\EclipseWorkSpace\\QueryDatasetWithoutSQLin-JAVA\\iplDataset\\matches.csv";
static ArrayList dell=null;
static ArrayList matt=null;
public static void main(String[] args) {
// TODO Auto-generated method stub
dell=ReadDeliveries.readDataLineByLine(CSV_deliveries);
System.out.println(" Deliveries read Completed");
matt=ReadMatches.readDataLineByLine(CSV_matches);
System.out.println(" Matches read Completed");
System.out.println();
System.out.println("Top 4 teams which elected to field first after winning toss in the year 2016 and 2017.");
Top4TeamsFieldFirst.fieldFirst(matt);
System.out.println();
System.out.println("List of Total number of fours, sixes, total score with respect to team and year");
TotalFourSixScore.score(dell, matt);
System.out.println();
System.out.println("Top 10 best economy rate bowler with respect to year who bowled at least 10 overs");
TopTenEconomy.economy(dell, matt);
System.out.println();
System.out.println("Team name which has Highest Net Run Rate with respect to year");
TeamNetRunRate.netRunRate(dell, matt);
}
}
| [
"chinmoysihi@gmail.com"
] | chinmoysihi@gmail.com |
2942da9b513be3e4c107165ac8350665fe66a199 | 514c4359c5379f0049ce4f9523aea4ef56a908a0 | /sisyphos-core/src/main/java/org/ops4j/sisyphos/core/builder/DuringFluxBuilder.java | 48964bf3dace5e35d8ac96f04053a36198a42df9 | [
"Apache-2.0"
] | permissive | hwellmann/org.ops4j.sisyphos | 894a42a79f5dfea55d72eebfb45846bddb9acffa | 05914831547d090b822ca2b1d9fac9f7762f08dd | refs/heads/master | 2020-03-17T03:09:45.536428 | 2018-06-10T08:51:04 | 2018-06-10T08:51:04 | 133,223,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,442 | java | /*
* Copyright 2018 OPS4J Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ops4j.sisyphos.core.builder;
import org.ops4j.sisyphos.api.action.DuringBuilder;
import org.ops4j.sisyphos.api.session.Session;
import org.ops4j.sisyphos.core.common.ScenarioContext;
import reactor.core.publisher.Flux;
import reactor.retry.Repeat;
public class DuringFluxBuilder implements FluxBuilder {
private DuringBuilder duringBuilder;
public DuringFluxBuilder(DuringBuilder duringBuilder) {
this.duringBuilder = duringBuilder;
}
@Override
public Flux<Session> buildFlux(ScenarioContext context) {
FluxBuilderAdapter adapter = new FluxBuilderAdapter();
FluxBuilder fluxBuilder = adapter.adapt(duringBuilder.getStepBuilder());
return Repeat.times(Integer.MAX_VALUE).timeout(duringBuilder.getDuration())
.apply(fluxBuilder.buildFlux(context));
}
}
| [
"harald.wellmann@gmx.de"
] | harald.wellmann@gmx.de |
ccc97b03a98579abe1a1076f8c4a156fe6430c1e | 778d73eda9c72e1763d92a44f181d58d79205f8e | /framework/soa-web-framework/src/main/java/com/lebaoxun/soa/web/framework/http/UploadDownload.java | c436b499d5e52bfd3ea7abc3e27d4f394e8bed88 | [] | no_license | caiqianyi/guess | c3839e85dc600862fafa0901143b83719a773920 | 40784bcc7745371cd8ff6866031524942ba7c528 | refs/heads/master | 2021-09-25T21:56:50.024422 | 2018-10-26T02:37:17 | 2018-10-26T02:37:17 | 103,381,452 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,530 | java | /**
*
*/
package com.lebaoxun.soa.web.framework.http;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;
/**
* 上传下载
* @author xjc
*
*/
public class UploadDownload {
public static void dounload(HttpServletRequest request, HttpServletResponse response, String storeName) throws Exception{
request.setCharacterEncoding("UTF-8");
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
//获取项目根目录
String ctxPath = request.getSession().getServletContext().getRealPath("");
//获取下载文件路径 (storeName 文件名称)
String downLoadPath = ctxPath+"/download/"+ storeName;
//获取文件的长度
long fileLength = new File(downLoadPath).length();
//设置文件输出类型
response.setContentType("application/octet-stream");
response.setHeader("Content-disposition", "attachment; filename=" + new String(storeName.getBytes("utf-8"), "ISO8859-1"));
//设置输出长度
response.setHeader("Content-Length", String.valueOf(fileLength));
//获取输入流
bis = new BufferedInputStream(new FileInputStream(downLoadPath));
//输出流
bos = new BufferedOutputStream(response.getOutputStream());
byte[] buff = new byte[2048];
int bytesRead;
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
//关闭流
bis.close();
bos.close();
}
public static Map<String, String> upload(MultipartFile file, HttpServletRequest request){
Map<String, String> resMap = new HashMap<String, String>();
String s = UUID.randomUUID().toString();
String replace = s.replace('-', '_');
String fileName = file.getOriginalFilename();
String newName = replace + "." + fileName.substring(fileName.lastIndexOf(".") + 1);
String path = request.getSession().getServletContext().getRealPath("upfile") + "/";
String pa = path+newName;
resMap.put("path", path+newName);
try {
file.transferTo(new File(path+newName));
resMap.put("flag", "VIP0000");
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return resMap;
}
}
| [
"270852221@qq.com"
] | 270852221@qq.com |
216ef295a927e7ffd5bc647f70bbd1bd25909d78 | a7075e63f1e89c66eb6192b905dff3016966b25b | /src/entities/SolverProperties.java | cf1a0eeef45e59dc6e2bb1a27d076a4692caf632 | [] | no_license | jargelich/SolverAssistant | e11d1f554af6c7407b52362c65a60031d7c0016a | 193139ac75f0f8dfadb57a11c4e66b7349cabdf9 | refs/heads/master | 2021-01-14T12:47:38.200550 | 2015-01-07T19:18:11 | 2015-01-07T19:18:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,481 | java | /*
* TFG: Daniel Casanovas Gayoso
* Grau en Enginyeria Informàtica - Escola Politècnica Superior de Lleida
* 2014/2015
* Solver entity
*/
package entities;
import java.util.List;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
public class SolverProperties {
private Solver solver;
private StringProperty name = new SimpleStringProperty() {
@Override
public void set(String name) {
super.set(name);
solver.setName(name);
}
};
private StringProperty benchmark = new SimpleStringProperty() {
@Override
public void set(String benchmark) {
super.set(benchmark);
solver.setBenchmark(benchmark);
}
};
private StringProperty type = new SimpleStringProperty() {
@Override
public void set(String type) {
super.set(type);
solver.setType(type);
}
};
private IntegerProperty timeOut = new SimpleIntegerProperty() {
@Override
public void set(int timeout) {
super.set(timeout);
solver.setTimeOut(timeout);
}
};
private IntegerProperty memory = new SimpleIntegerProperty() {
@Override
public void set(int memory) {
super.set(memory);
solver.setMemory(memory);
}
};
private IntegerProperty numberOfCores = new SimpleIntegerProperty() {
@Override
public void set(int numberOfCores) {
super.set(numberOfCores);
solver.setNumberOfCores(numberOfCores);
}
};
private List<SolverInstance> instancesList;
public SolverProperties(Solver solver) {
this.setSolver(solver);
}
private void setSolver(Solver solver) {
if (solver != null) {
this.solver = solver;
getNameProperty().set(this.solver.getName());
getBenchmarkProperty().set(this.solver.getBenchmark());
getTypeProperty().set(this.solver.getType());
getTimeOutProperty().set(this.solver.getTimeOut());
getMemoryProperty().set(this.solver.getMemory());
getNumberOfCoresProperty().set(this.solver.getNumberOfCores());
solver.setInstancesList(this.solver.getInstancesList());
}
}
public Solver getSolver() {
return solver;
}
public StringProperty getNameProperty() {
return name;
}
public String getName() {
return name.getValue();
}
public StringProperty getBenchmarkProperty() {
return benchmark;
}
public String getBenchmark() {
return benchmark.getValue();
}
public StringProperty getTypeProperty() {
return type;
}
public String getType() {
return type.getValue();
}
public IntegerProperty getTimeOutProperty() {
return timeOut;
}
public int getTimeOut() {
return timeOut.getValue();
}
public IntegerProperty getMemoryProperty() {
return memory;
}
public int getMemory() {
return memory.getValue();
}
public IntegerProperty getNumberOfCoresProperty() {
return numberOfCores;
}
public int getNumberOfCores() {
return numberOfCores.getValue();
}
public List<SolverInstance> getInstancesList() {
return instancesList;
}
/**
* @param name the name to set
*/
public void setNameProperty(StringProperty name) {
this.name = name;
}
/**
* @param benchmark the benchmark to set
*/
public void setBenchmarkProperty(StringProperty benchmark) {
this.benchmark = benchmark;
}
/**
* @param type the type to set
*/
public void setTypeProperty(StringProperty type) {
this.type = type;
}
/**
* @param timeOut the timeOut to set
*/
public void setTimeOutProperty(IntegerProperty timeOut) {
this.timeOut = timeOut;
}
/**
* @param memory the memory to set
*/
public void setMemoryProperty(IntegerProperty memory) {
this.memory = memory;
}
/**
* @param numberOfCores the numberOfCores to set
*/
public void setNumberOfCoresProperty(IntegerProperty numberOfCores) {
this.numberOfCores = numberOfCores;
}
}
| [
"danius4@gmail.com"
] | danius4@gmail.com |
ebdb8712888dd34d8a1abb4da04e47c9c2fdf8f7 | e75be673baeeddee986ece49ef6e1c718a8e7a5d | /submissions/blizzard/Corpus/eclipse.jdt.core/4651.java | 431a8ccbe2d38dcd22d09321d6f1a0299de1d91b | [
"MIT"
] | permissive | zhendong2050/fse18 | edbea132be9122b57e272a20c20fae2bb949e63e | f0f016140489961c9e3c2e837577f698c2d4cf44 | refs/heads/master | 2020-12-21T11:31:53.800358 | 2018-07-23T10:10:57 | 2018-07-23T10:10:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 82 | java | package b142044;
public class X142044_AB implements I142044_A, I142044_B {
}
| [
"tim.menzies@gmail.com"
] | tim.menzies@gmail.com |
ecda4ad6f7d07b9214a878b0c052334d86fbe219 | 23cb6471a45b54d353bf83a40c4bd89160fe4a1d | /src/calculadora/Calculadora.java | 719ae67868eb4ebcea1750c6801f01f1fb0ebce4 | [] | no_license | VlamirD/Calculadora111 | a32cceafe81748573d8990ae31257775d3f02985 | bedaf6b00fd892e8e2c10b189448a770eec54d9e | refs/heads/master | 2021-01-09T20:08:21.746519 | 2016-06-17T16:21:21 | 2016-06-17T16:21:21 | 61,387,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 864 | java | /*
* 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 calculadora;
/**
*
* @author EPIS
*/
public class Calculadora {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
float sumar(float a, float b){
return a+b;
}
float resta(float a,float b){
return a-b;
}
float multiplicacion(float a,float b){
return a*b;
}
float division(float a,float b){
if (b == 0) {
System.out.print("no se puede imprimir");
return -1;
}
return a/b;
}
double potencia(double a,double b){
return Math.pow(a, b);
}
}
| [
"vladicha0912@gmail.com"
] | vladicha0912@gmail.com |
e7cb26699caac8d1512655c8421e378d9d5a327b | 67c2a85a9225c5f41ca1effaec1caa2abb3f9e32 | /yytj_java/utils/src/main/java/com/hongbao/utils/NumberUtil.java | d9264a5397ec87af0e9e50cc3fa35842da93661c | [] | no_license | qinbo89/yytj_java | 789a31e1f3d17ad16f05b63b70306b171ffd144e | 4de9e02e49dbbb5d58f55fdb37ff6c8e43c313e3 | refs/heads/master | 2021-01-18T22:11:42.721730 | 2016-09-27T02:21:53 | 2016-09-27T02:21:53 | 69,311,520 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,176 | java | package com.hongbao.utils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
public class NumberUtil {
public static final long MILLION = 1000000;
public static String formatUserId(long id) {
return new DecimalFormat("0000").format(id);
}
/**
* 相加
* @param num1
* @param num2
* @return
*/
public static Integer add(Integer num1,Integer num2){
if(num1 == null){
num1 = 0;
}
if(num2 == null){
num2 = 0;
}
return num1 + num2;
}
/**
* 分转化成元
* @param amount
* @return
*/
public static double fen2Yuan(Integer amount){
if(amount == null){
return 0.00;
}else{
return BigDecimal.valueOf(amount).divide(BigDecimal.valueOf(100)).doubleValue();
}
}
/**
* 分转化成元
* @param amount
* @return
*/
public static double longFen2Yuan(Long amount){
if(amount == null){
return 0.00;
}else{
return BigDecimal.valueOf(amount).divide(BigDecimal.valueOf(100)).doubleValue();
}
}
}
| [
"qinbo89@163.com"
] | qinbo89@163.com |
fbc5c9e11eb4019d3daeff72eddee0e952263417 | 97683fcec4cd1a73ee9b5bf5365cc09f64509e15 | /app/src/main/java/worknasi/model/PlanItem.java | a716ede00dfdf25eab15703952870996e93d6961 | [] | no_license | nyumbanicreative/worknasi_android | 44304e3b3b691efb857919e4cf92f6b2ce126579 | eb91eac94435786c0e1a0b598581782f9b9b56aa | refs/heads/master | 2020-03-12T10:35:03.538308 | 2018-04-22T16:01:03 | 2018-04-22T16:01:03 | 130,576,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package worknasi.model;
/**
* Created by user on 1/25/2018.
*/
public class PlanItem {
private int plan_id;
private String plan_description;
public PlanItem() {
}
public int getPlan_id() {
return plan_id;
}
public void setPlan_id(int plan_id) {
this.plan_id = plan_id;
}
public String getPlan_description() {
return plan_description;
}
public void setPlan_description(String plan_description) {
this.plan_description = plan_description;
}
}
| [
"francizevarist@gmail.com"
] | francizevarist@gmail.com |
0ba6c22ce7624b08b260b8663a1b569629ee86f6 | 6b1b0902a4000343820846ccaf57085287aeb311 | /assignment2/at.ac.tuwien.big.forms.form/src/at/ac/tuwien/big/forms/form/FormRuntimeModule.java | 68301a376889a8269f61c2a22e7c59666dd5417b | [] | no_license | Model-Engineering-AG-34/model-engineering-ws14 | 5bdfd5e64152ec87d3644243d21039d7822689d8 | 95bf13fdd30c6296e4e39a7fd8f1ae7c0ccb3023 | refs/heads/master | 2020-03-29T13:47:47.026520 | 2015-01-12T21:22:56 | 2015-01-12T21:22:56 | 27,044,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 278 | java | /*
* generated by Xtext
*/
package at.ac.tuwien.big.forms.form;
/**
* Use this class to register components to be used at runtime / without the Equinox extension registry.
*/
public class FormRuntimeModule extends at.ac.tuwien.big.forms.form.AbstractFormRuntimeModule {
}
| [
"christian.beikov@gmail.com"
] | christian.beikov@gmail.com |
e2058486a072cf4560075671601cefe7cf065cac | e0b0846eb7283081f34dc9c886d6f0fd60c6d1ec | /app/src/main/java/vn/bongtran/scar/ui/login/LoggedInUserView.java | 4438184b1ad76a6bffdf8ffb3b04e39340b1b6c3 | [] | no_license | bongtran/scar | 75dd04e452157f9cac98f7c5eb4ea56f7f0a8e2e | 88af6dbbdff9fbf7063f00f810d0bb3a87de6791 | refs/heads/master | 2020-05-19T18:57:20.209490 | 2019-05-06T09:43:49 | 2019-05-06T09:43:49 | 185,168,078 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | package vn.bongtran.scar.ui.login;
/**
* Class exposing authenticated user details to the UI.
*/
class LoggedInUserView {
private String displayName;
//... other data fields that may be accessible to the UI
LoggedInUserView(String displayName) {
this.displayName = displayName;
}
String getDisplayName() {
return displayName;
}
}
| [
"bongtran@gmail.com"
] | bongtran@gmail.com |
8fddb5163299c9cc224fd9d65f459a90b8cacdf6 | 16f7f839a31248bc0df97f9bd987a4ce2d9cb248 | /horx-wdf-sys/horx-wdf-sys-impl/src/main/java/org/horx/wdf/sys/manager/SessionManager.java | ff4bd6c31aa207244ee12c58f76913cde4ab73ca | [
"Apache-2.0"
] | permissive | horxorg/horx-wdf | 2421c61f12149fee57a69ec262a7c9e299c29192 | 15abf81f21c70be8203b780f28d8c38057daf5a4 | refs/heads/master | 2022-12-11T19:17:44.093726 | 2020-09-13T08:43:31 | 2020-09-13T08:43:31 | 221,460,302 | 3 | 0 | Apache-2.0 | 2020-07-18T04:08:09 | 2019-11-13T13:00:23 | Java | UTF-8 | Java | false | false | 1,279 | java | package org.horx.wdf.sys.manager;
import org.horx.wdf.common.entity.PaginationParam;
import org.horx.wdf.common.entity.PaginationResult;
import org.horx.wdf.sys.domain.OnlineUser;
import org.horx.wdf.sys.domain.Session;
import org.horx.wdf.sys.domain.SessionAttr;
import org.horx.wdf.sys.dto.dataauth.SysDataAuthDTO;
import org.horx.wdf.sys.dto.query.OnlineUserQueryDTO;
import java.util.List;
/**
* 会话Manager。
* @since 1.0
*/
public interface SessionManager {
void create(Session session);
void modify(Session session);
void removeBySessionKey(String sessionKey);
void removeExpired();
Session getBySessionKey(String sessionKey);
void createAttr(SessionAttr sessionAttr);
void modifyAttr(SessionAttr sessionAttr);
void removeAttrByKey(Long sessionId, String attrKey);
List<SessionAttr> queryAttrBySessionId(Long sessionId);
SessionAttr getAttrByKey(Long sessionId, String attrKey);
PaginationResult<OnlineUser> paginationQueryOnlineUser(OnlineUserQueryDTO query, PaginationParam paginationParam);
/**
* 检查用户是否可下线。
* @param ids
* @param sysDataAuth
* @return 可下线的sessionKey数组。
*/
String[] offlineCheck(Long[] ids, SysDataAuthDTO sysDataAuth);
}
| [
"horxorg@163.com"
] | horxorg@163.com |
431175e87c8775ad05b08158485d5c78ebd86258 | 77a525fdb04426f20701ad9f78fad6d5c19e2a0e | /src/main/java/hr/tvz/njakopcic/zavrsnijakopcic/engine/graphics/particle/Particle.java | 7043da5a031b660411af1c6e5414aa8d1258fb01 | [] | no_license | nevenjakopcic/ZavrsniJakopcic | 90cedd99d109960cdb03d1361dde9b5268118f9d | cd9934dc57770c3d2eacb4cf0144d88402707e43 | refs/heads/master | 2022-12-07T09:36:46.123581 | 2020-09-02T03:21:15 | 2020-09-02T03:21:15 | 272,475,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,165 | java | package hr.tvz.njakopcic.zavrsnijakopcic.engine.graphics.particle;
import hr.tvz.njakopcic.zavrsnijakopcic.engine.GameItem;
import hr.tvz.njakopcic.zavrsnijakopcic.engine.graphics.Mesh;
import hr.tvz.njakopcic.zavrsnijakopcic.engine.graphics.Texture;
import lombok.Getter;
import lombok.Setter;
import org.joml.Vector3f;
public class Particle extends GameItem {
private long currentAnimTimeMillis;
@Getter @Setter private long updateTextureMillis;
@Getter @Setter private Vector3f speed;
@Getter @Setter private long lifespan;
@Getter private final int animFrames;
public Particle(Mesh mesh, Vector3f speed, long lifespan, long updateTextureMillis) {
super(mesh);
this.speed = new Vector3f(speed);
this.lifespan = lifespan;
this.updateTextureMillis = updateTextureMillis;
this.currentAnimTimeMillis = 0;
Texture texture = this.getMesh().getMaterial().getTexture();
this.animFrames = texture.getNumCols() * texture.getNumRows();
}
public Particle(Particle baseParticle) {
super(baseParticle.getMesh());
Vector3f aux = baseParticle.getPosition();
setPosition(aux.x, aux.y, aux.z);
aux = baseParticle.getRotation();
setRotation(aux.x, aux.y, aux.z);
setScale(baseParticle.getScale());
this.speed = new Vector3f(baseParticle.speed);
this.lifespan = baseParticle.getLifespan();
this.updateTextureMillis = baseParticle.getUpdateTextureMillis();
this.currentAnimTimeMillis = 0;
this.animFrames = baseParticle.getAnimFrames();
}
public long updateLifespan(long elapsedTime) {
this.lifespan -= elapsedTime;
this.currentAnimTimeMillis += elapsedTime;
if (this.currentAnimTimeMillis >= this.getUpdateTextureMillis() && this.animFrames > 0) {
this.currentAnimTimeMillis = 0;
int pos = this.getTexturePos();
pos++;
if (pos < this.animFrames) {
this.setTexturePos(pos);
} else {
this.setTexturePos(0);
}
}
return this.lifespan;
}
}
| [
"nevenjakopcic@gmail.com"
] | nevenjakopcic@gmail.com |
45c5c9691c0a6d4758c2d632c664bb8e2bfbc81a | 146ab29e1d12a238c01019bb0c331790d97ecde7 | /src/main/java/com/mashibing/service/WyCarSpaceManageService.java | 359d70e8a046734046df7351953482096e108868 | [] | no_license | DT0352/family_service | 9d4477af02e934614bc710b1f3f54bed1fe5856b | 50dc5801dd74c0030f80f0c9a0588106174d0d40 | refs/heads/master | 2023-02-16T14:31:22.413132 | 2021-01-09T07:37:47 | 2021-01-09T07:37:47 | 328,101,063 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package com.mashibing.service;
import com.mashibing.bean.WyCarSpaceManage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 车位管理 服务类
* </p>
*
* @author lian
* @since 2021-01-09
*/
public interface WyCarSpaceManageService extends IService<WyCarSpaceManage> {
}
| [
"18535222330fzd@gmail.com"
] | 18535222330fzd@gmail.com |
785ffe329962a23766c85fedc67c2afec931c2e6 | 6b6765763691a89cfdf691084410cd84194f78e5 | /src/main/java/cn/itcast/dao/UsersMapper.java | c2528cd2cc84db630f1ec24af5dd432f3a7c2efb | [] | no_license | dadalili2019/U4_house | 20ceea5d5b71804f5d5dad02bcd2bbc3aa46e1ee | 23f01581d65f5bb81585b21c3fde07195ea7f0e9 | refs/heads/master | 2022-12-22T20:36:11.553886 | 2020-01-13T10:07:54 | 2020-01-13T10:07:54 | 231,852,469 | 0 | 0 | null | 2022-12-15T23:53:29 | 2020-01-05T01:32:05 | JavaScript | UTF-8 | Java | false | false | 1,659 | java | package cn.itcast.dao;
import cn.itcast.model.UserHouseMsg;
import cn.itcast.model.Users;
import cn.itcast.model.UsersExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface UsersMapper {
int deleteByPrimaryKey(Integer id);
int insert(Users record);
int insertSelective(Users record);
List<Users> selectByExample(UsersExample example);
Users selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(Users record);
int updateByPrimaryKey(Users record);
/**
* 验证用户名是否存在
* @param username
* @return
*/
@Select("select * from users where name =#{username}")
List<Users> checkUserName(@Param(value = "username") String username);
/**
* 用户登录
* @param users
* @return
*/
@Select("SELECT * FROM users WHERE NAME=#{name} AND PASSWORD=#{password}")
Users findUser(Users users);
/**
* 根据用户id+房屋id查询房屋详细信息
* @param userHouseMsg+hid
* @return
*/
Users getHouseMsgById(UserHouseMsg userHouseMsg);
/**
* 根据用户名查询用户是否存在
* @param username
* @return
*/
@Select("SELECT * FROM users WHERE NAME =#{username} ")
Users checkUser(@Param(value = "username") String username);
/**
* 前台验证旧密码是否正确
* @param users
* @return
*/
@Select("SELECT * FROM users WHERE NAME =#{name} AND PASSWORD =#{password}")
int checkPassword(Users users);
} | [
"caoqian@196.cn"
] | caoqian@196.cn |
c7ac56aec046cd944e5438a0c3a4984c0573cd1b | d28d31a687f653bf033892e8c84b55d61882741a | /workshops/cadenaj/unit3/WS30BookStore/Bookstore/src/ec/edu/espe/bookstore/view/FrmDelete.java | 175b9d1adf9d502301477715194ef16ee0e0f43a | [] | no_license | elascano/ESPE202105-OOP-SW-3682 | 02debcbd73540438ac39e04eb5ed2c4c99c72eb0 | 6198fb3b90faeee6ea502f3eb80532a67cf5739f | refs/heads/main | 2023-08-29T12:30:09.487090 | 2021-09-20T14:40:03 | 2021-09-20T14:40:03 | 369,223,490 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,769 | java | /*
* 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 ec.edu.espe.bookstore.view;
/**
*
* @author Steven Achig Future Programmers ESPE-DCCO
*/
public class FrmDelete extends javax.swing.JFrame {
/**
* Creates new form FrmDelete
*/
public FrmDelete() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
btnCancel = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
btnCancel.setText("Cancel");
btnCancel.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
btnCancelMouseClicked(evt);
}
});
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 60)); // NOI18N
jLabel1.setText("Buy");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnCancel)
.addGap(172, 172, 172))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(317, 317, 317)
.addComponent(jLabel1)
.addContainerGap(346, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 310, Short.MAX_VALUE)
.addComponent(btnCancel)
.addGap(84, 84, 84))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnCancelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCancelMouseClicked
FrmBookstore bookstore = new FrmBookstore();
bookstore.setVisible(true);
dispose();
}//GEN-LAST:event_btnCancelMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrmDelete.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmDelete.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmDelete.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmDelete.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FrmDelete().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancel;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
// End of variables declaration//GEN-END:variables
}
| [
"jejocad2000@hotmail.com"
] | jejocad2000@hotmail.com |
4b46f9431b333f5b5b6749cd783d6a261e4ffba4 | 22ce9377722aa28b56ea022c05165c3caf090656 | /Practice/src/Array/ContainerWithMostWater.java | d5668fea480dc536f119f5a307806b0004fc3866 | [] | no_license | nikhilbarapatre/leetcode | ec95b1009600ada78a825b7866e416e161f1be19 | b9c16cab093c211931d7c08cfd70d51415fb1263 | refs/heads/master | 2020-08-04T04:11:48.303258 | 2019-12-17T23:18:15 | 2019-12-17T23:18:15 | 211,997,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 591 | java | package Array;
public class ContainerWithMostWater {
public int maxArea(int[] height){
int max = 0;
for(int i = 0; i < height.length; i++){
for(int j = i + 1; j < height.length; j++) {
max = Math.max(max, Math.min(height[i], height[j]) * (j - i));
}
}
return max;
}
public static void main(String[] args) {
ContainerWithMostWater con = new ContainerWithMostWater();
int[] height = {1,8,6,2,5,4,8,3,7};
int result = con.maxArea(height);
System.out.println(result);
}
}
| [
"nbarapatre@dons.usfca.edu"
] | nbarapatre@dons.usfca.edu |
1ca08178b025c77428a801454dda00676815d48a | 3b539d430d8c66e9f726982737028f3aa7c707d3 | /src/com/android/tradefed/targetprep/TargetSetupError.java | b501e8f8e22609072db2ea92d3710cbbfd928f02 | [] | no_license | hi-cbh/CrashMonkey4Android_tradefederation_C | e6ea1fdf5344021c29cab6b019613a4c53834369 | 6c539ad75bdf930bab00f8a789048e08a259b76f | refs/heads/master | 2020-12-24T10:11:07.533244 | 2016-11-09T02:10:13 | 2016-11-09T02:10:13 | 73,245,095 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,519 | java | /*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.tradefed.targetprep;
/**
* A fatal error occurred while preparing the target for testing.
*/
public class TargetSetupError extends Exception {
private static final long serialVersionUID = 2202987086655357201L;
/**
* Constructs a new (@link TargetSetupError} with a meaningful error message.
*
* @param reason a error message describing the cause of the error
*/
public TargetSetupError(String reason) {
super(reason);
}
/**
* Constructs a new (@link TargetSetupError} with a meaningful error message, and a
* cause.
*
* @param reason a detailed error message.
* @param cause a {@link Throwable} capturing the original cause of the TargetSetupError
*/
public TargetSetupError(String reason, Throwable cause) {
super(reason, cause);
}
}
| [
"hi_cbh@qq.com"
] | hi_cbh@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.