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
94438c14a150d3207fe74162256ac146fbab01a9
cfd563a380631f3b9d5741533d6a0c93fb418fce
/Genoscope/src/com/genoscope/renderer/visualizers/SingleChromosomeVisualizer.java
171e9b6b07947e2b848c1336e61f969dfc711295
[]
no_license
alimg/parasight
430edd561758f3f988dba99d9a0cee9c84653f64
cd3f8cb270aa72c6f1e5c3e9c126cf2cc51999f4
refs/heads/master
2021-03-12T22:21:43.098358
2013-01-19T21:43:02
2013-01-19T21:43:02
3,494,193
0
1
null
null
null
null
UTF-8
Java
false
false
3,962
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.genoscope.renderer.visualizers; import com.genoscope.types.Chromosome; import com.genoscope.types.Cytoband; import com.genoscope.types.Feature; import static org.lwjgl.opengl.GL11.*; /** * * @author alim */ public abstract class SingleChromosomeVisualizer extends ChromosomeVisualizer { float paddingTop=1; float paddingLeft=1; float paddingBottom=0; float paddingRight=1; int startPos;//position in a chromosome; int endPos; Chromosome cytoband; public SingleChromosomeVisualizer(int w, int h,Chromosome chr) { super(w, h,chr); } public int getTotalRowHeight() { int r=0; for(int i=0;i<getRowCount();i++) r+=getRowHeight(i); return r; } public void resize() { setAbsoluteHeight((int)(paddingTop+getTotalRowHeight())); } public void setCytoband(Chromosome chr){ cytoband=chr; resize(); } public void drawCytoband(float height) { glDisable(GL_TEXTURE_2D); glColor4f(0, 0, 0, 1); glLineWidth(1.0f); glBegin(GL_LINE_LOOP); glVertex2f(paddingLeft+0, 0); glVertex2f(paddingLeft+0, height); glVertex2f(getWidth(), height); glVertex2f(getWidth(), 0); glEnd(); boolean black = true; int cenDir= 1; for(Feature i:cytoband.getFeatures()){ glBegin(GL_POLYGON); float x1 = getPositionX(i.getPosition()); float y1 = 0; float x2 = getPositionX(i.getPosition()+((Cytoband)i).getLength()); float y2 = height; int gieStain=((Cytoband)i).getGieStain(); switch(gieStain) { case Cytoband.GPOS25: glColor4f(0.7f,0.7f,0.7f,1); break; case Cytoband.GPOS50: glColor4f(0.5f,0.5f,0.5f,1); break; case Cytoband.GPOS75: glColor4f(0.3f,0.3f,0.3f,1); break; case Cytoband.GNEG: glColor4f(0.9f,0.9f,0.9f,1); break; default: glColor4f(0,0,0,1); break; } if(gieStain==Cytoband.ACEN && cenDir==1){ glColor4f(0.8f,0.1f,0.1f,1); glVertex2f(x1,y1); glVertex2f(x2,(y1+y2)/2); glVertex2f(x1,y2); cenDir=0; } else if(gieStain==Cytoband.ACEN && cenDir==0){ glColor4f(0.8f,0.1f,0.1f,1); glVertex2f(x1,(y1+y2)/2); glVertex2f(x2,y1); glVertex2f(x2,y2); } else { glVertex2f(x1,y1); glVertex2f(x2,y1); glVertex2f(x2,y2); glVertex2f(x1,y2); } glEnd(); black = !black; } } /** * Subclasses should implement this for drawing. * * @param rowNumber */ abstract public void drawRow(int rowNumber); abstract public int getRowCount(); abstract public float getRowHeight(int rowNumber); abstract public String getRowLabel(int rowNumber); @Override final public void draw(){ glClearColor(1, 1, 1, 0); glClear(GL_COLOR_BUFFER_BIT); glTranslatef(0, paddingTop , 0); for(int i=0;i<getRowCount();i++){ glPushMatrix(); glEnable(GL_TEXTURE_2D); glColor4f(0, 0, 0, 1); font.drawString(0, 0, getRowLabel(i), 1,1); glDisable(GL_TEXTURE_2D); drawRow(i); glPopMatrix(); glTranslatef(0, getRowHeight(i) , 0); } } }
[ "alim@alim-12.10" ]
alim@alim-12.10
48efc6d817795e2da5d01ba273b7f00ec06aaece
0196a63e92676518faceb08563e97c4e58acacae
/src/DAO/DAOHoaDon.java
67cf06b00f217cd4b1b07e2babecbf77689b8b57
[]
no_license
super3152/TestDuAn
eda05eea862b2a1abc886e71e33c482fa57b97d6
3527ef1d9721b60d9a3bafc923f11e48f63ec79f
refs/heads/master
2023-01-15T14:32:46.643156
2020-11-28T04:20:09
2020-11-28T04:20:09
316,141,434
0
0
null
null
null
null
UTF-8
Java
false
false
5,670
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 DAO; import DTO.DTOHoaDon; import DTO.DTOSanPham; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Administrator */ public class DAOHoaDon { public static ResultSet LayHoaDon(String TuKhoa) { String query = "Select * from hoadon where idhoadon like '%" + TuKhoa + "%' or sohoadon like '%" + TuKhoa + "%' or ngaytaohoadon like '%" + TuKhoa + "%' or idnguoidung like '%" + TuKhoa + "%' or tongtien like '%" + TuKhoa + "%' or idkhachhang like '%" + TuKhoa + "%' or congno like '%" + TuKhoa + "%'"; ResultSet rs = DAO.DBConection.GetData(query); return rs; } public static ResultSet LayPhieuNhapTheoID(String IDPhieuNhap) { String query = "SELECT * FROM `phieunhap` WHERE `idphieunhap`= '" + IDPhieuNhap + "'"; ResultSet rs = DBConection.GetData(query); return rs; } public static ResultSet LayCTHDTheoMaHD(int MaHD) { String query = "SELECT * FROM `chitiethoadon` WHERE `idhoadon`= '" + MaHD + "'"; ResultSet rs = DBConection.GetData(query); return rs; } public static int ThemHoaDon(DTOHoaDon hd) { String query = "INSERT INTO `hoadon`" + "( `sohoadon`, `ngaytaohoadon`, `idnguoidung`, `tinhtrang`, `tongtien`, `idkhachhang`, `trahang`, `congno`)" + " VALUES " + "('" + hd.getSoHoaDon() + "'," + "'" + hd.getNgayTaoHoaDon() + "'," + "'" + hd.getMaNV() + "'," + "'" + hd.getTinhTrang() + "'," + "'" + hd.getTongTien() + "'," + "'" + hd.getMaKhachHang() + "'," + "'" + hd.getTraHang() + "'," + "'" + hd.getCongNo() + "')"; System.out.println(query); return DBConection.ExcuteTruyVan(query); } public static ResultSet GetByTenHD(String SoHoaDon) { String cauTruyVan = "select * from hoadon where sohoadon = '" + SoHoaDon + "'"; ResultSet rs = DBConection.GetData(cauTruyVan); return rs; } public static ResultSet GetByTenNV(String TenNV) { String cauTruyVan = "select * from nguoidung where tennguoidung = '" + TenNV + "'"; ResultSet rs = DBConection.GetData(cauTruyVan); return rs; } public static ResultSet GetByMaSP(String MaSP) { String cauTruyVan = "select * from sanpham where masanpham = '" + MaSP + "'"; ResultSet rs = DBConection.GetData(cauTruyVan); return rs; } public static void SuaTrangThai(DTOHoaDon HD) { String query = "UPDATE `hoadon` SET `tinhtrang`='"+HD.getTinhTrang()+"' WHERE `sohoadon`='"+HD.getSoHoaDon()+"'"; System.out.println(query); DBConection.ExcuteTruyVan(query); } public static void SuaTrangThaiHanNoHoaDon(DTOHoaDon HD) { String query = "UPDATE `hoadon` SET `tinhtrang`='"+HD.getTinhTrang()+"', `congno`='"+HD.getCongNo()+"',`hantracongno`='"+HD.getHanTraCongNo()+"' WHERE `sohoadon`='"+HD.getSoHoaDon()+"'"; System.out.println(query); DBConection.ExcuteTruyVan(query); } public static void SuaNoHoaDonPhieuTra(DTOHoaDon HD) { String query = "UPDATE `hoadon` SET `congno`='" + HD.getCongNo() + "' WHERE `sohoadon`='" + HD.getSoHoaDon() + "'"; System.out.println(query); DBConection.ExcuteTruyVan(query); } public static void SuaTraHangHoaDon(DTOHoaDon HD) { String query = "UPDATE `hoadon` SET `trahang`='" + HD.getTraHang() + "' WHERE `idhoadon`='" + HD.getMaHoaDon() + "'"; System.out.println(query); DBConection.ExcuteTruyVan(query); } public static void TraNoHoaDon(DTOHoaDon HD) { String query = "UPDATE `hoadon` SET `tinhtrang`='"+HD.getTinhTrang()+"', `congno`='" + HD.getCongNo() + "' WHERE `idhoadon`='" + HD.getMaHoaDon() + "'"; System.out.println(query); DBConection.ExcuteTruyVan(query); } public static ResultSet LayHoaDonTheoMa(int MaHD) { String query = "Select * from hoadon where idhoadon = '" + MaHD + "'"; ResultSet rs = DAO.DBConection.GetData(query); return rs; } public static ResultSet LayHoaDonTheoSoHD(String SoHD) { String query = "Select * from hoadon where sohoadon = '" + SoHD + "'"; ResultSet rs = DAO.DBConection.GetData(query); return rs; } public static ArrayList<DTOSanPham> GetSanPhamHayDung() { ResultSet rs; ArrayList<DTOSanPham> sanpham = null; String cauTruyVan = "SELECT DISTINCT chitiethoadon.`idsanpham` AS idsanpham, sanpham.`tensanpham` AS tensanpham, sanpham.`anhsanpham` AS anhsanpham " + "FROM `chitiethoadon` chitiethoadon INNER JOIN `sanpham` sanpham ON chitiethoadon.`idsanpham` = sanpham.`idsanpham` LIMIT 5"; rs = DBConection.GetData(cauTruyVan); sanpham = new ArrayList<DTOSanPham>(); try { while (rs.next()) { DTOSanPham sp = new DTOSanPham(rs.getString("tensanpham"), rs.getBytes("anhsanpham")); sanpham.add(sp); } } catch (SQLException ex) { Logger.getLogger(DAOLoaiKhachHang.class.getName()).log(Level.SEVERE, null, ex); } return sanpham; } }
[ "Administrator@21AK22-COM" ]
Administrator@21AK22-COM
a1d0019b9b6635be2a3b62e7a7dce2b1216c2024
be0da0878bc5cea45eea0f1c72b1472ff518e5dc
/cbrslod/src/br/com/tools/SparseVector.java
ece1388f40e74018566c67c47a3b5e73ab887d6d
[]
no_license
italompereira/cbrslod
56e27861fc60d1a18b0f5832ddbb014994f808f8
7f9b57d63d525799002ef8cd771e4258b1e062a3
refs/heads/master
2023-04-29T06:16:07.208891
2019-07-06T21:10:07
2019-07-06T21:10:07
133,700,829
0
0
null
2022-09-01T22:47:36
2018-05-16T17:22:06
Java
WINDOWS-1252
Java
false
false
3,352
java
package br.com.tools; import java.io.Serializable; /****************************************************************************** * Compilation: javac SparseVector.java * Execution: java SparseVector * * A sparse vector, implementing using a symbol table. * * [Not clear we need the instance variable n except for error checking.] * * Copyright © 2000–2017, Robert Sedgewick and Kevin Wayne. * Last updated: Fri Oct 20 14:12:12 EDT 2017. * https://introcs.cs.princeton.edu/java/44st/ ******************************************************************************/ public class SparseVector implements Serializable { private static final long serialVersionUID = 6329650240189791422L; private final int n; // length private ST<Integer, Double> st; // the vector, represented by index-value pairs // initialize the all 0s vector of length n public SparseVector(int n) { this.n = n; this.st = new ST<Integer, Double>(); } // put st[i] = value public void put(int i, double value) { if (i < 0 || i >= n) throw new RuntimeException("Illegal index"); if (value == 0.0) st.remove(i); else st.put(i, value); } // return st[i] public double get(int i) { if (i < 0 || i >= n) throw new RuntimeException("Illegal index"); if (st.contains(i)) return st.get(i); else return 0.0; } // return the number of nonzero entries public int nnz() { return st.size(); } // return the size of the vector public int size() { return n; } // return the dot product of this vector with that vector public double dot(SparseVector that) { if (this.n != that.n) throw new IllegalArgumentException("Vector lengths disagree"); double sum = 0.0; // iterate over the vector with the fewest nonzeros if (this.st.size() <= that.st.size()) { for (int i : this.st.keys()) if (that.st.contains(i)) sum += this.get(i) * that.get(i); } else { for (int i : that.st.keys()) if (this.st.contains(i)) sum += this.get(i) * that.get(i); } return sum; } // return the 2-norm public double norm() { return Math.sqrt(this.dot(this)); } // return alpha * this public SparseVector scale(double alpha) { SparseVector result = new SparseVector(n); for (int i : this.st.keys()) result.put(i, alpha * this.get(i)); return result; } // return this + that public SparseVector plus(SparseVector that) { if (this.n != that.n) throw new IllegalArgumentException("Vector lengths disagree"); SparseVector result = new SparseVector(n); for (int i : this.st.keys()) result.put(i, this.get(i)); for (int i : that.st.keys()) result.put(i, that.get(i) + result.get(i)); return result; } // return a string representation public String toString() { StringBuilder s = new StringBuilder(); for (int i : st.keys()) { s.append("(" + i + ", " + st.get(i) + ") "); } return s.toString(); } }
[ "italo@DESKTOP-OM34DTU" ]
italo@DESKTOP-OM34DTU
b1b03ffdf382fae47de9f015048cd9074dab910c
1c7428df2fe123925aaee9df87c0c361b74cca8a
/src/main/java/fi/utu/tech/distributed/gorilla/logic/GameWorld.java
82446324180885d34e4dab8c433daf187cec49d7
[]
no_license
rvpout/Gorillagame
ebf262aaf07f222298c439a95e63c118b6003d0c
dc226c84f1ee6e939ad0008408baf8b6900f68f8
refs/heads/master
2023-02-16T12:38:56.140508
2021-01-14T08:39:55
2021-01-14T08:39:55
329,551,968
0
0
null
null
null
null
UTF-8
Java
false
false
5,830
java
package fi.utu.tech.distributed.gorilla.logic; import fi.utu.tech.distributed.gorilla.engine.Engine; import fi.utu.tech.distributed.gorilla.engine.ProxyGameObject; import fi.utu.tech.distributed.gorilla.engine.SimpleEngine; import fi.utu.tech.distributed.gorilla.objects.*; import fi.utu.tech.distributed.gorilla.views.BuildingView; import fi.utu.tech.oomkit.app.Scheduled; import fi.utu.tech.oomkit.canvas.Point2D; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; /** * The game world class contains methods for creating a game world. * <p> * The class contains state that doesn't need to be shared on remote systems, * the initial state can be fully reconstructed from 'configuration' and 'players'. * </p> */ public class GameWorld implements Scheduled { private final GameConfiguration configuration; private final ArrayList<Cloud> clouds = new ArrayList<>(); private final List<Banana> bananas = new ArrayList<>(); private final Wind wind = new Wind(); public final Engine engine; public final long initialStateSeed; /** * The initial state can be fully reconstructed from 'configuration' and 'players'. * * @param configuration * @param players */ public GameWorld(GameConfiguration configuration, List<Player> players) { this.configuration = configuration; Random builder = new Random(configuration.seed); initialStateSeed = builder.nextLong(); engine = new SimpleEngine(configuration.gameWorldHeight, configuration.maxObjects, configuration.timeStep); init(builder, players); } /** * 1) Moves the cloud (just aesthetic, does not affect game outcome) * 2) Adjusts the banana trajectories based on wind (deterministic, affects game outcome) */ @Override public void tick() { wind.tick(); for (Cloud c : clouds) c.tick(); for (Banana b : bananas) b.tick(); } /** * Changes the wind speed when a new turn begins. Deterministic, affects game outcome. */ public void newTurn(Turn currentTurn) { wind.setTarget(currentTurn.windSpeed); } protected void addGorilla(Point2D position, Player player) { Gorilla gorilla = new Gorilla(engine, position, player); engine.bindObject(gorilla, true); } protected void addBanana(Point2D initParams, Point2D initPosition) { Banana banana = new Banana(engine, initParams, initPosition, configuration.safetyZone, wind, configuration.windFactor, bananas::remove); bananas.add(banana); engine.bindObject(banana, true); } protected void addClouds(Random builder, double width, double maxHeight, int cloudCount) { for (int i = 0; i < cloudCount; i++) { Point2D position = new Point2D(builder.nextDouble() * width, builder.nextDouble() * maxHeight); Cloud cloud = new Cloud(engine, position, wind, builder.nextDouble() * 2 + 0.5, width, (i + 1) * -2); clouds.add(cloud); engine.bindObject(cloud, true); } } protected void addSun(double x, double y, int z) { Sun sun = new Sun(engine, new Point2D(x, y), z); engine.bindObject(sun, false); } protected void addFloor(double sceneHeight, double x1, double x2) { ProxyGameObject floor = new SceneBorder(engine, new Point2D(x1, sceneHeight + 1), new Point2D(x2, 10)); engine.bindObject(floor, false); } protected void determinePlayerPositions(List<Player> players, List<Point2D> playerPositions, Random builder) { Collections.shuffle(playerPositions, builder); for (Player player : players) { Point2D position = playerPositions.remove(0); addGorilla(position, player); } } protected void init(Random builder, List<Player> players) { final double sceneHeight = configuration.gameWorldHeight; final List<Point2D> playerPositions = new ArrayList<>(); double currentX = 0; engine.init(); clouds.clear(); // landscape construction, also populates 'playerPositions' { Point2D tmp = new Point2D(); Point2D tmp2 = new Point2D(); double nextDistance = -1; double distance = 0; while (playerPositions.size() < players.size()) { BuildingView bv = BuildingView.createRandom(builder.nextLong(), 140, 500, 0.0, tmp, tmp2); Point2D tl = new Point2D(currentX, sceneHeight - bv.height); Building building = new Building(engine, tl, bv); engine.bindObject(building, true); distance += bv.width + 1; if (nextDistance == -1) { nextDistance = configuration.minGorillaDistance + builder.nextDouble() * (configuration.maxGorillaDistance - configuration.minGorillaDistance); } if (distance > nextDistance && bv.width > 95) { distance = 0; nextDistance = -1; playerPositions.add(tl.copy().add(bv.width / 2.0, 0)); } currentX += bv.width + 1; } } addFloor(sceneHeight, -10, currentX + 20); determinePlayerPositions(players, playerPositions, builder); // construct clouds & sun { int cloudCount = (int) (currentX / 300); if (configuration.enableClouds) addClouds(builder, currentX, configuration.gameWorldHeight / 8.0, cloudCount); if (configuration.enableSun) addSun(currentX / 2, configuration.gameWorldHeight / 16, -(cloudCount / 2) * 2 - 1); } } }
[ "rvpout@utu.fi" ]
rvpout@utu.fi
97fd12ecaf6b45e5e3fce7e1c49cc94d9b4dabb6
1b8282c1e5ad82b16526d2b78b75e209b4d96906
/src/es/mesacarlos/webconsole/websocket/command/LogInCommand.java
11a4a72cc35390418a855a50fbb2b8050e65471a
[ "MIT" ]
permissive
gabrielvicenteYT/WebConsole-HostedInstance
e4d8d585ad50e1e459f4930dd84ca41e7b938d11
a30302bbe5a052d63fb4894691a95a09fc74d552
refs/heads/master
2023-02-09T02:11:17.179250
2020-06-18T01:06:06
2020-06-18T01:06:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,492
java
package es.mesacarlos.webconsole.websocket.command; import org.bukkit.Bukkit; import org.java_websocket.WebSocket; import es.mesacarlos.webconsole.util.Internationalization; import es.mesacarlos.webconsole.util.LoginManager; import es.mesacarlos.webconsole.websocket.WSServer; import es.mesacarlos.webconsole.websocket.response.LoginRequired; import es.mesacarlos.webconsole.websocket.response.Processed; public class LogInCommand implements WSCommand { @Override public void execute(WSServer wsServer, WebSocket conn, String password) { // If user is logged in, then return. if (LoginManager.getInstance().isLoggedIn(conn.getRemoteSocketAddress())) return; // Get password from config files String receivedPassword = wsServer.getMainClass().getConfig().getString("password"); if (receivedPassword.equals(password)) { // Password is correct, logging in LoginManager.getInstance().logIn(conn.getRemoteSocketAddress()); wsServer.sendToClient(conn, new Processed(Internationalization.getPhrase("login-sucessful-message"), "LOGIN ********")); Bukkit.getLogger().info(Internationalization.getPhrase("login-sucessful-console", conn.getRemoteSocketAddress())); } else { // Password was incorrect wsServer.sendToClient(conn, new LoginRequired(Internationalization.getPhrase("login-failed-message"))); Bukkit.getLogger().info(Internationalization.getPhrase("login-failed-console", conn.getRemoteSocketAddress())); } } }
[ "28845529+mesacarlos@users.noreply.github.com" ]
28845529+mesacarlos@users.noreply.github.com
b5b56946ad1877fe70afc2626fb6c40cc5f1043f
733968fb66958c086c2da47c2d1602158fd919b9
/app/src/androidTest/java/com/example/gardenerrobot/ExampleInstrumentedTest.java
17a7564188414baf413836850ccf1ef66157f5ae
[]
no_license
atiqrahid/Smart-Gardener-Application
7d37805c7b1c1b1469d647950cf377266827d9e5
65f137ae6366aa008d670c7a3d67e1b9210f39de
refs/heads/master
2020-05-17T13:26:13.311173
2019-05-05T12:54:10
2019-05-05T12:54:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
734
java
package com.example.gardenerrobot; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.gardenerrobot", appContext.getPackageName()); } }
[ "islam.atiqul@northsouth.edu" ]
islam.atiqul@northsouth.edu
a9cb7b33e6ca990c680678e48dcaa311daac0389
f8c3107341fd9358523a069f9bdec4ac2385c8e4
/src/cn/org/rapid_framework/generator/provider/db/sql/SqlFactory.java
ee4f1abb3b64366dd269b92cbfbc78d10e675da3
[]
no_license
Mrwb/CodeGeneratorRapid
1152f78fa50cb8b2e5db9033baabd6f2a4bdc26b
7e4270ddd151abfda761442e07711854a04d83d0
refs/heads/master
2021-09-19T19:19:27.384729
2018-07-31T03:39:04
2018-07-31T03:39:04
103,624,803
0
0
null
null
null
null
UTF-8
Java
false
false
15,432
java
package cn.org.rapid_framework.generator.provider.db.sql; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; import cn.org.rapid_framework.generator.provider.db.sql.model.Sql; import cn.org.rapid_framework.generator.provider.db.sql.model.SqlParameter; import cn.org.rapid_framework.generator.provider.db.table.TableFactory; import cn.org.rapid_framework.generator.provider.db.table.TableFactory.NotFoundTableException; import cn.org.rapid_framework.generator.provider.db.table.model.Column; import cn.org.rapid_framework.generator.provider.db.table.model.Table; import cn.org.rapid_framework.generator.util.BeanHelper; import cn.org.rapid_framework.generator.util.GLogger; import cn.org.rapid_framework.generator.util.StringHelper; import cn.org.rapid_framework.generator.util.sqlparse.NamedParameterUtils; import cn.org.rapid_framework.generator.util.sqlparse.ParsedSql; import cn.org.rapid_framework.generator.util.sqlparse.ResultSetMetaDataHolder; import cn.org.rapid_framework.generator.util.sqlparse.SqlParseHelper; import cn.org.rapid_framework.generator.util.sqlparse.SqlParseHelper.NameWithAlias; import cn.org.rapid_framework.generator.util.typemapping.JdbcType; /** * * 根据SQL语句生成Sql对象,用于代码生成器的生成<br /> * * 示例使用: * <pre> * Sql sql = new SqlFactory().parseSql("select * from user_info where username=#username# and password=#password#"); * </pre> * * @author badqiu * */ public class SqlFactory { private List<SqlParameter> customParameters = new ArrayList<SqlParameter>(); private List<Column> customColumns = new ArrayList<Column>(); public SqlFactory() { } public SqlFactory(List<SqlParameter> customParameters,List<Column> customColumns) { this.customParameters = customParameters; this.customColumns = customColumns; } public Sql parseSql(String sourceSql) { String beforeProcessedSql = beforeParseSql(sourceSql); // String unscapedSourceSql = StringHelper.unescapeXml(beforeProcessedSql); String namedSql = SqlParseHelper.convert2NamedParametersSql(beforeProcessedSql,":",""); ParsedSql parsedSql = NamedParameterUtils.parseSqlStatement(namedSql); String executeSql = NamedParameterUtils.substituteNamedParameters(parsedSql); Sql sql = new Sql(); sql.setSourceSql(sourceSql); sql.setExecuteSql(executeSql); GLogger.debug("\n*******************************"); GLogger.debug("sourceSql :"+sql.getSourceSql()); GLogger.debug("namedSql :"+namedSql); GLogger.debug("executeSql :"+sql.getExecuteSql()); GLogger.debug("*********************************"); Connection conn = TableFactory.getInstance().getConnection(); try { conn.setReadOnly(true); conn.setAutoCommit(false); PreparedStatement ps = conn.prepareStatement(SqlParseHelper.removeOrders(executeSql)); ResultSetMetaData resultSetMetaData = executeForResultSetMetaData(executeSql,ps); sql.setColumns(new SelectColumnsParser().convert2Columns(sql,resultSetMetaData)); sql.setParams(new SqlParametersParser().parseForSqlParameters(parsedSql,sql)); return afterProcessedSql(sql); }catch(Exception e) { throw new RuntimeException("sql parse error,\nsourceSql:"+sourceSql+"\nnamedSql:"+namedSql+"\nexecutedSql:"+executeSql,e); }finally { try { conn.rollback(); conn.close(); }catch(Exception e) { throw new RuntimeException(e); } } } protected Sql afterProcessedSql(Sql sql) { return sql; } protected String beforeParseSql(String sourceSql) { return sourceSql; } private ResultSetMetaData executeForResultSetMetaData(String executeSql,PreparedStatement ps)throws SQLException { SqlParseHelper.setRandomParamsValueForPreparedStatement(SqlParseHelper.removeOrders(executeSql), ps); ps.setMaxRows(3); ps.setFetchSize(3); ps.setQueryTimeout(20); try { ResultSet rs = ps.executeQuery(); return rs.getMetaData(); } catch (Exception e) { return ps.getMetaData(); } } public class SelectColumnsParser { private LinkedHashSet<Column> convert2Columns(Sql sql,ResultSetMetaData metadata) throws SQLException, Exception { if(metadata == null) return new LinkedHashSet(); LinkedHashSet<Column> columns = new LinkedHashSet(); for(int i = 1; i <= metadata.getColumnCount(); i++) { Column c = convert2Column(sql,metadata, i); if(c == null) throw new IllegalStateException("column must be not null"); columns.add(c); } return columns; } private Column convert2Column(Sql sql,ResultSetMetaData metadata, int i) throws SQLException, Exception { ResultSetMetaDataHolder m = new ResultSetMetaDataHolder(metadata, i); if(StringHelper.isNotBlank(m.getTableName())) { //FIXME 如果表有别名,将会找不到表,如 inner join user_info t1, tableName将为t1,应该转换为user_info Table table = foundTableByTableNameOrTableAlias(sql, m.getTableName()); if(table == null) { return newColumn(m); } Column column = table.getColumnBySqlName(m.getColumnNameOrLabel()); if(column == null) { //可以再尝试解析sql得到 column以解决 password as pwd找不到column问题 //Table table, int sqlType, String sqlTypeName,String sqlName, int size, int decimalDigits, boolean isPk,boolean isNullable, boolean isIndexed, boolean isUnique,String defaultValue,String remarks column = new Column(table,m.getColumnType(),m.getColumnTypeName(),m.getColumnNameOrLabel(),m.getColumnDisplaySize(),m.getScale(),false,false,false,false,null,null); GLogger.trace("not found column:"+m.getColumnNameOrLabel()+" on table:"+table.getSqlName()+" "+BeanHelper.describe(column)); //isInSameTable以此种判断为错误 }else { GLogger.trace("found column:"+m.getColumnNameOrLabel()+" on table:"+table.getSqlName()+" "+BeanHelper.describe(column)); } return column; }else { return newColumn(m); } } private Column newColumn(ResultSetMetaDataHolder m) { Column column = new Column(null,m.getColumnType(),m.getColumnTypeName(),m.getColumnNameOrLabel(),m.getColumnDisplaySize(),m.getScale(),false,false,false,false,null,null); GLogger.trace("not found on table by table emtpty:"+BeanHelper.describe(column)); return column; } private Table foundTableByTableNameOrTableAlias(Sql sql,String tableNameId) throws Exception { try { return TableFactory.getInstance().getTable(tableNameId); }catch(NotFoundTableException e) { Set<NameWithAlias> tableNames = SqlParseHelper.getTableNamesByQuery(sql.getExecuteSql()); for(NameWithAlias tableName : tableNames) { if(tableName.getAlias().equalsIgnoreCase(tableNameId)) { return TableFactory.getInstance().getTable(tableName.getName()); } } } return null; } } public class SqlParametersParser { Map<String,Column> specialParametersMapping = new HashMap<String,Column>(); { specialParametersMapping.put("offset", new Column(null,JdbcType.INTEGER.TYPE_CODE,"INTEGER","offset",0,0,false,false,false,false,null,null)); specialParametersMapping.put("limit", new Column(null,JdbcType.INTEGER.TYPE_CODE,"INTEGER","limit",0,0,false,false,false,false,null,null)); specialParametersMapping.put("pageSize", new Column(null,JdbcType.INTEGER.TYPE_CODE,"INTEGER","pageSize",0,0,false,false,false,false,null,null)); specialParametersMapping.put("pageNo", new Column(null,JdbcType.INTEGER.TYPE_CODE,"INTEGER","pageNo",0,0,false,false,false,false,null,null)); specialParametersMapping.put("pageNumber", new Column(null,JdbcType.INTEGER.TYPE_CODE,"INTEGER","pageNumber",0,0,false,false,false,false,null,null)); specialParametersMapping.put("page", new Column(null,JdbcType.INTEGER.TYPE_CODE,"INTEGER","page",0,0,false,false,false,false,null,null)); specialParametersMapping.put("beginRow", new Column(null,JdbcType.INTEGER.TYPE_CODE,"INTEGER","beginRow",0,0,false,false,false,false,null,null)); specialParametersMapping.put("beginRows", new Column(null,JdbcType.INTEGER.TYPE_CODE,"INTEGER","beginRows",0,0,false,false,false,false,null,null)); specialParametersMapping.put("startRow", new Column(null,JdbcType.INTEGER.TYPE_CODE,"INTEGER","startRow",0,0,false,false,false,false,null,null)); specialParametersMapping.put("startRows", new Column(null,JdbcType.INTEGER.TYPE_CODE,"INTEGER","startRows",0,0,false,false,false,false,null,null)); specialParametersMapping.put("endRow", new Column(null,JdbcType.INTEGER.TYPE_CODE,"INTEGER","endRow",0,0,false,false,false,false,null,null)); specialParametersMapping.put("endRows", new Column(null,JdbcType.INTEGER.TYPE_CODE,"INTEGER","endRows",0,0,false,false,false,false,null,null)); specialParametersMapping.put("lastRow", new Column(null,JdbcType.INTEGER.TYPE_CODE,"INTEGER","lastRow",0,0,false,false,false,false,null,null)); specialParametersMapping.put("lastRows", new Column(null,JdbcType.INTEGER.TYPE_CODE,"INTEGER","lastRows",0,0,false,false,false,false,null,null)); specialParametersMapping.put("orderBy", new Column(null,JdbcType.VARCHAR.TYPE_CODE,"VARCHAR","orderBy",0,0,false,false,false,false,null,null)); specialParametersMapping.put("orderby", new Column(null,JdbcType.VARCHAR.TYPE_CODE,"VARCHAR","orderby",0,0,false,false,false,false,null,null)); specialParametersMapping.put("sortColumns", new Column(null,JdbcType.VARCHAR.TYPE_CODE,"VARCHAR","sortColumns",0,0,false,false,false,false,null,null)); } private LinkedHashSet<SqlParameter> parseForSqlParameters(ParsedSql parsedSql,Sql sql) throws Exception { LinkedHashSet<SqlParameter> result = new LinkedHashSet<SqlParameter>(); for(int i = 0; i < parsedSql.getParameterNames().size(); i++) { String paramName = parsedSql.getParameterNames().get(i); Column column = findColumnByParamName(parsedSql, sql, paramName); if(column == null) { column = specialParametersMapping.get(paramName); if(column == null) { //FIXME 不能猜测的column类型 column = new Column(null,JdbcType.UNDEFINED.TYPE_CODE,"UNDEFINED",paramName,0,0,false,false,false,false,null,null); } } SqlParameter param = new SqlParameter(column); param.setParamName(paramName); if(isMatchListParam(sql.getSourceSql(), paramName)) { //FIXME 只考虑(:username)未考虑(#inUsernames#) and (#{inPassword}),并且可以使用 #inUsername[]# param.setListParam(true); } result.add(param); } return result; } public boolean isMatchListParam(String sql, String paramName) { return sql.matches("(?s).*\\([:#\\$&]\\{?"+paramName+"\\}?[$#}]?\\).*") // match (:username) (#username#) || sql.matches(".*[#$]"+paramName+"\\[]\\.?\\w*[#$].*"); //match #user[]# $user[]$ #user[].age# } private Column findColumnByParamName(ParsedSql parsedSql,Sql sql, String paramName) throws Exception { Column column = sql.getColumnByName(paramName); if(column == null) { //FIXME 还未处理 t.username = :username的t前缀问题 column = findColumnByParseSql(parsedSql, SqlParseHelper.getColumnNameByRightCondition(parsedSql.toString(), paramName) ); } if(column == null) { column = findColumnByParseSql(parsedSql, paramName); } return column; } private Column findColumnByParseSql(ParsedSql sql, String paramName) throws Exception { Collection<NameWithAlias> tableNames = SqlParseHelper.getTableNamesByQuery(sql.toString()); for(NameWithAlias tableName : tableNames) { Table t = TableFactory.getInstance().getTable(tableName.getName()); if(t != null) { Column column = t.getColumnByName(paramName); if(column != null) { return column; } } } return null; } } public static void main(String[] args) throws Exception { // ? parameters // SelectSqlMetaData t1 = new SqlQueryFactory().getByQuery("select * from user_info"); // SelectSqlMetaData t2 = new SqlQueryFactory().getByQuery("select user_info.username,password pwd from user_info where username=? and password =?"); // SelectSqlMetaData t3 = new SqlQueryFactory().getByQuery("select username,password,role.role_name,role_desc from user_info,role where user_info.user_id = role.user_id and username=? and password =?"); // SelectSqlMetaData t4 = new SqlQueryFactory().getByQuery("select count(*) cnt from user_info,role where user_info.user_id = role.user_id and username=? and password =?"); // SelectSqlMetaData t5 = new SqlQueryFactory().getByQuery("select sum(age) from user_info,role where user_info.user_id = role.user_id and username=? and password =?"); // SelectSqlMetaData t6 = new SqlQueryFactory().getByQuery("select username,password,role_desc from user_info,role where user_info.user_id = role.user_id and username=? and password =? limit ?,?"); // SelectSqlMetaData t7 = new SqlQueryFactory().getByQuery("select username,password,count(role_desc) role_desc_cnt from user_info,role where user_info.user_id = role.user_id group by username"); // Sql n2 = new SqlFactory().parseSql("select user_info.username,password pwd from user_info where username=:username and password =:password"); Sql n3 = new SqlFactory().parseSql("select username,password,role.role_name,role_desc from user_info,role where user_info.user_id = role.user_id and username=:username and password =:password"); Sql n4 = new SqlFactory().parseSql("select count(*) cnt from user_info,role where user_info.user_id = role.user_id and username=:username and password =:password"); Sql n5 = new SqlFactory().parseSql("select sum(age) from user_info,role where user_info.user_id = role.user_id and username=:username and password =:password"); Sql n7 = new SqlFactory().parseSql("select username,password,count(role_desc) role_desc_cnt from user_info,role where user_info.user_id = role.user_id group by username"); Sql n8 = new SqlFactory().parseSql("select username,password,count(role_desc) role_desc_cnt from user_info,role where user_info.user_id = :userId group by username"); new SqlFactory().parseSql("select username,password,role_desc from user_info,role where user_info.user_id = role.user_id and username=:username and password =:password and birth_date between :birthDateBegin and :birthDateEnd"); new SqlFactory().parseSql("select username,password,role_desc from user_info,role where user_info.user_id = role.user_id and username=:username and password =:password and birth_date between :birthDateBegin and :birthDateEnd limit :offset,:limit"); System.out.println(n2); } }
[ "1595905476@qq.com" ]
1595905476@qq.com
259cf777103a612adbe36d8d0570ed5b798aebd1
fc0c32ee3f833ee517dbb36f1a0901992ef41480
/src/main/java/main/service/CommentService.java
e6ac3074b1df9b2ed3703aa32484b4c2414d8903
[]
no_license
1goruxa/BlogEngine
b0814c6ec3351405d76f169943d8eba1957e672a
99174da411d6e47fcbb85ba2019562cf2b118032
refs/heads/master
2023-02-15T02:57:08.752468
2021-01-13T11:27:04
2021-01-13T11:27:04
296,507,051
0
0
null
null
null
null
UTF-8
Java
false
false
2,695
java
package main.service; import main.repo.CommentRepository; import main.repo.PostRepository; import main.repo.UserRepository; import main.api.request.AddCommentRequest; import main.api.response.AddCommentResponse; import main.api.response.ErrorsOnAddingComment; import main.model.Comment; import main.model.Post; import main.model.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.security.Principal; import java.util.Date; import java.util.Optional; @Service public class CommentService { @Autowired private UserRepository userRepository; @Autowired private CommentRepository commentRepository; @Autowired private PostRepository postRepository; public AddCommentResponse addComment(AddCommentRequest addCommentRequest, Principal principal){ AddCommentResponse addCommentResponse = new AddCommentResponse(); Optional<User> optionalUser = null; addCommentResponse.setResult(false); if(principal != null) { optionalUser = userRepository.findOneByEmail(principal.getName()); if (optionalUser.isPresent()) { User currentUser = optionalUser.get(); Comment comment = new Comment(); Optional<Post> optionalPost = postRepository.findById(addCommentRequest.getPostId()); Post post = optionalPost.get(); if(addCommentRequest.getText().length() > 3) { comment.setParentId(addCommentRequest.getParentId()); comment.setPost(post); comment.setText(addCommentRequest.getText()); comment.setTime(new Date()); comment.setUser(currentUser); commentRepository.save(comment); addCommentResponse.setResult(null); addCommentResponse.setId(comment.getId()); } else{ ErrorsOnAddingComment errorsOnAddingComment = new ErrorsOnAddingComment(); errorsOnAddingComment.setText("Текст комментария не задан или слишком короткий"); addCommentResponse.setErrors(errorsOnAddingComment); addCommentResponse.setId(null); } } } else { try { throw new NullPointerException("Пользователь не авторизован"); } catch (NullPointerException e) { System.out.println(e.getMessage()); } } return addCommentResponse; } }
[ "89235974301@mail.ru" ]
89235974301@mail.ru
b73a551fce4c86b18958447238e4a280f6214fe4
e75be673baeeddee986ece49ef6e1c718a8e7a5d
/submissions/blizzard/Corpus/eclipse.jdt.ui/4506.java
1ced3b2dc4e3052d9307db02093f4bd2ac4f31f9
[ "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
14,822
java
/******************************************************************************* * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.ui.fix; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import java.util.Map; import org.eclipse.core.runtime.CoreException; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.internal.corext.fix.CleanUpConstants; import org.eclipse.jdt.internal.corext.fix.CodeStyleFix; import org.eclipse.jdt.ui.cleanup.CleanUpRequirements; import org.eclipse.jdt.ui.cleanup.ICleanUpFix; import org.eclipse.jdt.ui.text.java.IProblemLocation; /** * Creates fixes which can resolve code style issues * @see org.eclipse.jdt.internal.corext.fix.CodeStyleFix */ public class CodeStyleCleanUp extends AbstractMultiFix { public CodeStyleCleanUp() { } public CodeStyleCleanUp(Map<String, String> options) { super(options); } @Override public CleanUpRequirements getRequirements() { boolean requireAST = requireAST(); Map<String, String> requiredOptions = requireAST ? getRequiredOptions() : null; return new CleanUpRequirements(requireAST, false, false, requiredOptions); } private boolean requireAST() { boolean nonStaticFields = isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS); boolean nonStaticMethods = isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS); boolean qualifyStatic = isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS); return nonStaticFields && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS) || qualifyStatic && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS) || qualifyStatic && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD) || qualifyStatic && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS) || nonStaticMethods && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS) || qualifyStatic && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD) || nonStaticFields && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY) || nonStaticMethods && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY); } @Override protected ICleanUpFix createFix(CompilationUnit compilationUnit) throws CoreException { if (compilationUnit == null) return null; boolean nonStaticFields = isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS); boolean nonStaticMethods = isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS); boolean qualifyStatic = isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS); return CodeStyleFix.createCleanUp(compilationUnit, nonStaticFields && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS), qualifyStatic && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS), qualifyStatic && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD), qualifyStatic && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS), nonStaticMethods && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS), qualifyStatic && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD), nonStaticFields && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY), nonStaticMethods && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY)); } @Override protected ICleanUpFix createFix(CompilationUnit compilationUnit, IProblemLocation[] problems) throws CoreException { return CodeStyleFix.createCleanUp(compilationUnit, problems, isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS), isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS), isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS)); } private Map<String, String> getRequiredOptions() { Map<String, String> result = new Hashtable(); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS)) result.put(JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER, JavaCore.WARNING); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS)) result.put(JavaCore.COMPILER_PB_INDIRECT_STATIC_ACCESS, JavaCore.WARNING); return result; } @Override public String[] getStepDescriptions() { List<String> result = new ArrayList(); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS)) result.add(MultiFixMessages.CodeStyleMultiFix_AddThisQualifier_description); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS)) result.add(MultiFixMessages.CodeStyleCleanUp_QualifyNonStaticMethod_description); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY)) result.add(MultiFixMessages.CodeStyleCleanUp_removeFieldThis_description); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY)) result.add(MultiFixMessages.CodeStyleCleanUp_removeMethodThis_description); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD)) result.add(MultiFixMessages.CodeStyleMultiFix_QualifyAccessToStaticField); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD)) result.add(MultiFixMessages.CodeStyleCleanUp_QualifyStaticMethod_description); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS)) result.add(MultiFixMessages.CodeStyleMultiFix_ChangeNonStaticAccess_description); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS)) result.add(MultiFixMessages.CodeStyleMultiFix_ChangeIndirectAccessToStaticToDirect); return result.toArray(new String[result.size()]); } @Override public String getPreview() { StringBuffer buf = new StringBuffer(); //$NON-NLS-1$ buf.append("private int value;\n"); //$NON-NLS-1$ buf.append("public int get() {\n"); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS)) { //$NON-NLS-1$ buf.append(" return this.value + this.value;\n"); } else if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY)) { //$NON-NLS-1$ buf.append(" return value + value;\n"); } else { //$NON-NLS-1$ buf.append(" return this.value + value;\n"); } //$NON-NLS-1$ buf.append("}\n"); //$NON-NLS-1$ buf.append("\n"); //$NON-NLS-1$ buf.append("public int getZero() {\n"); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS)) { //$NON-NLS-1$ buf.append(" return this.get() - this.get();\n"); } else if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY)) { //$NON-NLS-1$ buf.append(" return get() - get();\n"); } else { //$NON-NLS-1$ buf.append(" return this.get() - get();\n"); } //$NON-NLS-1$ buf.append("}\n"); //$NON-NLS-1$ buf.append("\n"); //$NON-NLS-1$ buf.append("class E {\n"); //$NON-NLS-1$ buf.append(" public static int NUMBER;\n"); //$NON-NLS-1$ buf.append(" public static void set(int i) {\n"); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD)) { //$NON-NLS-1$ buf.append(" E.NUMBER= i;\n"); } else { //$NON-NLS-1$ buf.append(" NUMBER= i;\n"); } //$NON-NLS-1$ buf.append(" }\n"); //$NON-NLS-1$ buf.append("\n"); //$NON-NLS-1$ buf.append(" public void reset() {\n"); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD)) { //$NON-NLS-1$ buf.append(" E.set(0);\n"); } else { //$NON-NLS-1$ buf.append(" set(0);\n"); } //$NON-NLS-1$ buf.append(" }\n"); //$NON-NLS-1$ buf.append("}\n"); //$NON-NLS-1$ buf.append("\n"); //$NON-NLS-1$ buf.append("class ESub extends E {\n"); //$NON-NLS-1$ buf.append(" public void reset() {\n"); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS)) { //$NON-NLS-1$ buf.append(" E.NUMBER= 0;\n"); } else { //$NON-NLS-1$ buf.append(" ESub.NUMBER= 0;\n"); } //$NON-NLS-1$ buf.append(" }\n"); //$NON-NLS-1$ buf.append("}\n"); //$NON-NLS-1$ buf.append("\n"); //$NON-NLS-1$ buf.append("public void dec() {\n"); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS)) { //$NON-NLS-1$ buf.append(" E.NUMBER--;\n"); } else { //$NON-NLS-1$ buf.append(" (new E()).NUMBER--;\n"); } //$NON-NLS-1$ buf.append("}\n"); return buf.toString(); } @Override public boolean canFix(ICompilationUnit compilationUnit, IProblemLocation problem) { if (IProblem.UnqualifiedFieldAccess == problem.getProblemId()) return isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS); if (CodeStyleFix.isIndirectStaticAccess(problem)) return isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS); if (CodeStyleFix.isNonStaticAccess(problem)) return isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS); return false; } @Override public int computeNumberOfFixes(CompilationUnit compilationUnit) { int result = 0; IProblem[] problems = compilationUnit.getProblems(); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS)) result += getNumberOfProblems(problems, IProblem.UnqualifiedFieldAccess); if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS)) { for (int i = 0; i < problems.length; i++) { int id = problems[i].getID(); if (id == IProblem.IndirectAccessToStaticField || id == IProblem.IndirectAccessToStaticMethod) result++; } } if (isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS) && isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS)) { for (int i = 0; i < problems.length; i++) { int id = problems[i].getID(); if (id == IProblem.NonStaticAccessToStaticField || id == IProblem.NonStaticAccessToStaticMethod) result++; } } return result; } }
[ "tim.menzies@gmail.com" ]
tim.menzies@gmail.com
bee3f53edd57ffc76432e42d01770ab2a0517804
64e513ff6b7cdd258956114352c1c4c7cf63954f
/src/main/java/com/example/sell_demo04/common/ResultResponse.java
96d0e6fb6415362a6a8e3dcc5ef61d543b94467f
[]
no_license
YangZhuPing/sell_yzp01
619809575fb1d3414d564d46f30b020764e0dcfe
738a13f92f9ceab0940e7a366525aa210a34e646
refs/heads/master
2020-05-09T21:35:51.124779
2019-04-16T12:33:09
2019-04-16T12:33:09
181,448,671
0
0
null
null
null
null
UTF-8
Java
false
false
1,704
java
package com.example.sell_demo04.common; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @NoArgsConstructor @AllArgsConstructor public class ResultResponse<T> { private int code; private String msg; @JsonInclude(JsonInclude.Include.NON_NULL)//返回json时忽略为null的属性 private T data; //失败了或者成功了 有时候不需要返回data public ResultResponse(int code,String msg){ this.code=code; this.msg=msg; } //失败了 不携带数据、不携带信息的方法 public static ResultResponse fail(){ return new ResultResponse<>(ResultEnums.FAIL.getCode(),ResultEnums.FAIL.getMsg()); } //失败了 不携带数据、携带信息的方法 public static ResultResponse fail(String msg){ return new ResultResponse<>(ResultEnums.FAIL.getCode(),msg); } //失败了 携带数据、携带信息的方法 public static <T>ResultResponse fail(String msg,T t){ return new ResultResponse<>(ResultEnums.FAIL.getCode(),msg,t); } //失败了 携带数据、不携带信息的方法 public static <T>ResultResponse fail(T t){ return new ResultResponse<>(ResultEnums.FAIL.getCode(),ResultEnums.FAIL.getMsg(),t); } //成功 携带数据 public static <T> ResultResponse success(T t){ return new ResultResponse(ResultEnums.SUCCESS.getCode(),ResultEnums.SUCCESS.getMsg(),t); } //成功 不携带数据 public static <T> ResultResponse success(){ return new ResultResponse(ResultEnums.SUCCESS.getCode(),ResultEnums.SUCCESS.getMsg()); } }
[ "y2523169532@163.com" ]
y2523169532@163.com
4cc6f6f72a745e1b7c32bb3471a06ef0ea4e704a
7e87b386c03a8e7c0f31eb02369bc8248a6ca47d
/drivers/ems/sems/boco/ems-driver/src/main/java/org/openo/nfvo/emsdriver/collector/alarm/AlarmTaskThread.java
603e22b873304b2e14dc1b05e69656644a588fb5
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "LicenseRef-scancode-public-domain", "CC-BY-4.0" ]
permissive
openov2/nfvo
19685a51c6960508c20f16fe88310c6e3f5cf140
6d4dd2cd45ef0131fca23ef07e4e8ffe8fc5fd55
refs/heads/master
2021-09-01T00:01:38.630277
2017-05-19T10:21:17
2017-05-19T10:21:17
115,208,180
0
0
null
null
null
null
UTF-8
Java
false
false
7,549
java
/** * Copyright 2017 BOCO 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 org.openo.nfvo.emsdriver.collector.alarm; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.IOException; import java.net.Socket; import java.net.SocketException; import java.net.UnknownHostException; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.openo.nfvo.emsdriver.commons.constant.Constant; import org.openo.nfvo.emsdriver.commons.model.CollectVo; import org.openo.nfvo.emsdriver.commons.utils.StringUtil; import org.openo.nfvo.emsdriver.messagemgr.MessageChannel; import org.openo.nfvo.emsdriver.messagemgr.MessageChannelFactory; import com.alibaba.fastjson.JSONObject; public class AlarmTaskThread extends Thread{ public Log log = LogFactory.getLog(AlarmTaskThread.class); private HeartBeat heartBeat = null; private boolean isStop = false; private CollectVo collectVo = null; private int read_timeout = Constant.READ_TIMEOUT_MILLISECOND; private int reqId; private Socket socket = null; private BufferedInputStream is = null; private BufferedOutputStream dos = null; private MessageChannel alarmChannel; public AlarmTaskThread(CollectVo collectVo) { this.collectVo = collectVo; } public void run() { alarmChannel = MessageChannelFactory.getMessageChannel(Constant.ALARM_CHANNEL_KEY); try { this.init(); while(!this.isStop){ String body; try { body = this.receive(); String alarm120 = this.build120Alarm(body); this.send120Alarm(alarm120); } catch (Exception e) { reinit(); } } } catch (Exception e) { log.error(StringUtil.getStackTrace(e)); } } private void send120Alarm(String alarm120) { try { alarmChannel.put(alarm120); } catch (InterruptedException e) { log.error(StringUtil.getStackTrace(e)); } } private String build120Alarm(String body) { StringBuilder content = new StringBuilder( "<?xml version='1.0' encoding='iso-8859-1'?>\n") .append("<WholeMsg MsgMark='120' Priority='2' FieldNum='5'><FM_ALARM_MSG>\n"); JSONObject reagobj = JSONObject.parseObject(body); Set<String> keys = reagobj.keySet(); for (String key : keys) { String value = (String)reagobj.get(key); content.append("<").append(key).append(">"); content.append(value); content.append("</").append(key).append(">\n"); } content.append("</FM_ALARM_MSG></WholeMsg>"); return content.toString(); } public String receive() throws Exception { Msg msg =null; String retString = null; while (retString == null && !this.isStop) { msg = MessageUtil.readOneMsg(is); if("ackLoginAlarm".equalsIgnoreCase(msg.getMsgType().name)){ log.debug("receive login ack"); boolean suc = this.ackLoginAlarm(msg); if(suc){ if(reqId == Integer.MAX_VALUE){ reqId = 0; } reqId ++; Msg msgheart = MessageUtil.putHeartBeatMsg(reqId); heartBeat = new HeartBeat(socket,msgheart); heartBeat.setName("CMCC_JT_HeartBeat"); // start heartBeat heartBeat.start(); } retString = null; } if("ackHeartBeat".equalsIgnoreCase(msg.getMsgType().name)){ log.debug("received heartBeat��"+msg.getBody()); retString = null; } if("realTimeAlarm".equalsIgnoreCase(msg.getMsgType().name)){ log.debug("received alarm message"); retString = msg.getBody(); } } return retString; } public void init() throws Exception { isStop = false; //host String host = collectVo.getIP(); //port String port = collectVo.getPort(); //user String user = collectVo.getUser(); //password String password = collectVo.getPassword(); String read_timeout = collectVo.getRead_timeout(); if ((read_timeout != null) && (read_timeout.trim().length() > 0)) { try { this.read_timeout = Integer.parseInt(read_timeout); } catch (NumberFormatException e) { log.error(StringUtil.getStackTrace(e)); } } log.debug("socket connect host=" + host + ", port=" + port); try { int portInt = Integer.parseInt(port); socket = new Socket(host, portInt); } catch (UnknownHostException e) { throw new Exception("remote host [" + host + "]connect fail" + StringUtil.getStackTrace(e)); } catch (IOException e) { throw new Exception("create socket IOException " + StringUtil.getStackTrace(e)); } try { socket.setSoTimeout(this.read_timeout); socket.setTcpNoDelay(true); socket.setKeepAlive(true); } catch (SocketException e) { throw new Exception(" SocketException " + StringUtil.getStackTrace(e)); } try { dos = new BufferedOutputStream(socket.getOutputStream()); Msg msg = MessageUtil.putLoginMsg(user,password); try { log.debug("send login message "+msg.toString(false)); MessageUtil.writeMsg(msg,dos); } catch (Exception e) { log.error("send login message is fail "+StringUtil.getStackTrace(e)); } is = new BufferedInputStream(socket.getInputStream()); } catch (SocketException e) { throw new Exception(StringUtil.getStackTrace(e)); } } private boolean ackLoginAlarm(Msg msg) throws Exception { boolean is_success = false; try { String loginres = msg.getBody(); //ackLoginAlarm; result=fail(succ); resDesc=username-error String [] loginbody = loginres.split(";"); if(loginbody.length > 1){ for(String str :loginbody){ if(str.contains("=")){ String [] paras1 = str.split("=",-1); if("result".equalsIgnoreCase(paras1[0].trim())){ if("succ".equalsIgnoreCase(paras1[1].trim())){ is_success = true; }else{ is_success = false; } } } } }else { log.error("login ack body Incorrect formatbody=" + loginres); } } catch (Exception e) { log.error("pocess login ack fail"+StringUtil.getStackTrace(e)); } if (is_success) { log.info("login sucess receive login ack " + msg.getBody()); } else { log.error("login fail receive login ack " + msg.getBody()); this.close(); this.isStop = true; throw new Exception("login fail quit"); } return is_success; } public void close() { if(heartBeat != null){ heartBeat.setStop(true); } if (is != null) { try { is.close(); } catch (IOException e) { } finally { is = null; } } if (dos != null) { try { dos.close(); } catch (IOException e) { } finally { dos = null; } } if (socket != null) { try { socket.close(); } catch (IOException e) { } finally { socket = null; } } } public void reinit() { int time = 0; close(); while(!this.isStop) { close(); time++; try { Thread.sleep(1000 * 10); init(); return; } catch (Exception e) { log.error("Number ["+time+"]reconnect ["+collectVo.getIP()+"]fail" ); } } } }
[ "wangguirong@boco.com.cn" ]
wangguirong@boco.com.cn
db9034533639cbe45af20d0b979c282380c096be
4118f7d8f74e6c0773517fd6b308df83c7cf3518
/src/week5_A2_INHERITANCE_ACTIVITY/InheritanceActivity.java
ec63fcca26b58309fab3cb155d0a8425f6459505
[]
no_license
resv/PERSCHOLAS-JD-ASSIGNMENTS
1fb0b2a7e7e4787276d77716a11b95a95fff4699
a3051ca9c6d5c8f250ce54c6b658b3b4bedef1e7
refs/heads/master
2020-03-28T04:21:38.457643
2018-09-06T17:56:40
2018-09-06T17:56:40
147,709,833
0
0
null
null
null
null
UTF-8
Java
false
false
1,130
java
package week5_A2_INHERITANCE_ACTIVITY; public class InheritanceActivity { public static void main(String[] args) { // CREATING CONSTRUCTOR FOR MANAGER Manager manager1 = new Manager(126534, "Peter", "Chennai India", 237844, 65000); // PRINTING OUT REFERENCE MESSAGE FOR MANAGER'S CALCULATESALARY METHOD THEN EXECUTES System.out.printf("The salary for the manager is : $ "); manager1.calculateSalary(); System.out.printf("The transport allowance for manager1, named " + manager1.getEmployeeName() + " is : $ "); manager1.calculateTransportAllowance(); // SPACING FOR RESULTS System.out.println(); // CREATING CONSTRUCTOR FOR TRAINEE Trainee trainee1 = new Trainee(29846, "Jack", "Mumbai India", 442085, 45000); // PRINTING OUT REFERENCE MESSAGE FOR TRAINEE'S CALCULATE SALARY & TRANSPORT ALLOWANCE METHOD THEN EXECUTES System.out.printf("The salary for the trainee is : $ "); trainee1.calculateSalary(); System.out.printf("The transport allowance for trainee1, named " + trainee1.getEmployeeName() + " is : $ "); trainee1.calculateTransportAllowance(); } }
[ "akim456@gmail.com" ]
akim456@gmail.com
ac883490d91985d792140b4ba50a4eb9fa7f8cc5
2b554e2b3f99a6b2645c5ded7c788b621191d653
/server-dispatcher/src/main/java/com/unwulian/server/dispatcher/sender/ISenderConfigure.java
c7846201292cdc7a1b5b769681755f9f0ddedc17
[]
no_license
yaojie-me/adx-server
97cba1b4d6ad2aee19a7f4cf9f320dae6fd3e1f7
e20cafa7f037f4772052fd5145adc1cd46365c54
refs/heads/master
2023-03-27T22:04:19.140797
2021-03-26T09:29:18
2021-03-26T09:29:18
351,728,067
0
0
null
null
null
null
UTF-8
Java
false
false
1,118
java
package com.unwulian.server.dispatcher.sender; import com.unwulian.server.dispatcher.model.DispatcherContext; import java.util.Map; /** * 转发配置器 */ public interface ISenderConfigure<Q, R> { /** * 返回发送请求方式 * * @return */ String getMethod(); /** * 返回消息类型 * * @return */ String getContentType(); /** * 请求超时设置,单位 毫秒 */ int getTimeout(DispatcherContext context); /** * 返回请求url * * @param sendPacket * @return */ String getRequestUrl(DispatcherContext context); /** * 返回请求Header信息 * * @param sendPacket * @return */ Map<String, String> getHeader(DispatcherContext context); /** * 返回发送数据 * * @param context * @return */ Object getHttpBody(DispatcherContext context); /** * 读取HTTP响应数据 * * @param context * @param data * @return 结果 */ R readHttpResponse(DispatcherContext context, byte[] data); }
[ "yaojie@unwulian.com" ]
yaojie@unwulian.com
2e5fc43448337ec2efa83c6b274cbcfb1ff09639
b3b2380bd5872cd3075461f0a2e8539cb47c89aa
/demo-projects/dynamic-datasource-demo/src/main/java/com/zsx/demo/dynamicdatasource/controller/TestController.java
57854d26df658b231cdb13facecd452e6f707c8d
[ "Apache-2.0" ]
permissive
chenglinjava68/spring-boot-starters
025c1b381a86227922bec7889fd3628a9eef0f8e
4ac0126ff96d18ef6885da05c9cfc64858d99aa9
refs/heads/master
2023-06-15T15:29:24.025703
2021-07-15T03:46:03
2021-07-15T03:46:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,540
java
package com.zsx.demo.dynamicdatasource.controller; import com.zsx.demo.dynamicdatasource.service.TestService; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import java.util.List; import java.util.Map; @Controller @RequestMapping("/test") public class TestController { @Autowired private TestService testService; @GetMapping("/hello2") @ResponseBody @ApiOperation(value="hello2") public List<Map<String, Object>> hello2(String name){ testService.hello2(name); return testService.hello(name); } @GetMapping("/hello") @ResponseBody @ApiOperation(value="hello") public List<Map<String, Object>> hello(String name){ return testService.hello(name); } @GetMapping("/list") @ResponseBody @ApiOperation(value="@value注解的方式获取配置文件信息", notes="@value注解的方式获取配置文件信息") public List<Map<String, Object>> list(@RequestParam(required=false, value="name") String name){ return testService.getList(); } @ApiOperation(value = "获取新的订单信息") @GetMapping(value = "/order") public String getOrder(@ApiParam(value = "订单编号", required = true) @RequestParam(value = "orderNo", required = false) String orderNo, @ApiParam(value = "当前页") @RequestParam(value = "pageNum", required = false) Integer pageNum, @ApiParam(value = "每页显示数量") @RequestParam(value = "pageSize", required = false) Integer pageSize) { return "请求测试成功"; } @GetMapping(value = "/thymleaf") public String test(ModelMap modelMap) { modelMap.addAttribute("test","thymeleaf模板引擎测试"); modelMap.addAttribute("password","thymeleaf模板引擎测试--password"); return "html/test"; } @GetMapping(value = "/jsp") public String testjsp(ModelMap modelMap) { modelMap.addAttribute("test","jsp模板引擎测试"); modelMap.addAttribute("password","jsp模板引擎测试--password"); return "jsp/test"; } }
[ "zhushuxian@digitalgd.com.cn" ]
zhushuxian@digitalgd.com.cn
76ae44342a3ed025be4102ff4e8d1b1b347e53bf
63dc9b63d9764648c4bc670a5ac0220765e5ac1f
/back-end/libraryapp/src/main/java/mk/com/iwec/BookApp/infrastructure/controller/ControllerLayer.java
f87456ed0aa6a693e4d8136dbe988ebc766e6ca3
[]
no_license
thristovska098/library-spring-boot-and-react
8fa59786593e16166ebf904a220646a509a769cc
96da830eb3ee5f36f38384beb18ed452bec7f511
refs/heads/main
2023-03-13T09:06:34.466359
2021-03-05T10:27:03
2021-03-05T10:27:03
344,643,276
0
0
null
null
null
null
UTF-8
Java
false
false
268
java
package mk.com.iwec.BookApp.infrastructure.controller; import java.util.List; public interface ControllerLayer<T, I> { public List<I> findAll(); public I findId(Long id); public void deleteId(Long id); public T save(T t); public T update(Long id, T t); }
[ "thristovska098@gmail.com" ]
thristovska098@gmail.com
fb330d60a4a00212bc476d3f02ec276834e93199
f9c1de75582566e1243ce00942392a6731b84cdf
/org.evansnet.dataconnector/src/org/evansnet/dataconnector/internal/dbms/MySQLConnection.java
12f9bdb5151ff87969519b255aeb6b3c7ac191c6
[]
no_license
danevans0724/dataconnector
8b0578f2935f749513272a572df4e32dce47097c
4b5466d4d2d312b85b5a85e13c33a32265cce98e
refs/heads/master
2023-07-18T10:16:02.621945
2020-02-25T11:26:57
2020-02-25T11:26:57
112,529,207
0
0
null
null
null
null
UTF-8
Java
false
false
1,836
java
package org.evansnet.dataconnector.internal.dbms; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; import org.evansnet.dataconnector.internal.core.DBMS; import org.evansnet.dataconnector.internal.core.DBType; import org.evansnet.dataconnector.internal.core.IHost; public class MySQLConnection extends DBMS { Logger javaLogger = Logger.getLogger("SQL Server Host logger"); String connStr; Connection conn; Properties parmList; public MySQLConnection() throws ClassNotFoundException, SQLException { super(); getHost().setPort(3306); connStr = ""; parmList = new Properties(); setDBMS(DBType.MySQL); } public MySQLConnection(IHost h) throws ClassNotFoundException, SQLException { this(); super.setHost(h); } @Override public String buildConnectionString(DBType dbt) throws Exception { javaLogger.log(Level.INFO, "Building MySQL Connection String."); ConnectionStrFactory csf = new ConnectionStrFactory(getHost(), this); return csf.getConnString(); } @Override public Connection connect(String connStr) throws SQLException { try { Connection c = DriverManager.getConnection(connStr); setConnection(c); javaLogger.log(Level.INFO,"Successful connection to " + getDatabaseName()); return c; } catch (Exception e) { javaLogger.log(Level.INFO, "Failed to connect to " + getDatabaseName() + "\n" + "Cause: " + e.getCause()); return null; } } @Override public Connection getConnection() { return conn; } protected void setConnection(Connection c) { conn = c; } @Override public String getConnectionString() { return connStr; } @Override public Object addParms(String p, char[] v) { return parmList.put(p, v); } }
[ "daniel.evans@compuware.com" ]
daniel.evans@compuware.com
d01c0cabac9be5b6861c7607f883816fb86f544e
7b4e34301cb88033fcb1373fdc3f935fdf36966c
/reactivejava/src/main/java/com/sopark/book/chapter1/HelloWorld.java
75bbb84cb621aa9773b9e2c44c5045f7989ac770
[]
no_license
Sopark0724/study
1ce5186066753d18028460c1a3a5dd6589e55d19
293cd49bd418204364d281b8f04f3d43d5593a58
refs/heads/master
2022-12-24T09:22:19.364944
2019-06-17T06:04:21
2019-06-17T06:04:21
89,183,353
0
0
null
2022-12-15T23:52:41
2017-04-24T00:59:31
Java
UTF-8
Java
false
false
357
java
package com.sopark.book.chapter1; import io.reactivex.Observable; public class HelloWorld { public void emit(){ Observable.just("Hello", "World") .subscribe(System.out::println); } public static void main(String[] args) { HelloWorld helloWorld = new HelloWorld(); helloWorld.emit(); } }
[ "sopark@daou.co.kr" ]
sopark@daou.co.kr
bbef83e9edc1bd28eb0b3385801d20e00e52c64e
893333e58b1ef5a8fccc08ff79fe9d5ec99bbd14
/app/src/main/java/com/example/mobileappdevelop/testcustomlistviewexam/MainActivity.java
2d5cb228f8a93c69f326e8a675dea0db88e8e62d
[]
no_license
ASIF-006/TestCustomListViewExam
3a80054760700364e412b56210c9ef6d21ecea49
69aba89fecccc6092b3cdd41152f1caf55bb66f7
refs/heads/master
2021-01-20T16:16:47.530430
2016-07-16T18:24:03
2016-07-16T18:24:03
63,474,975
0
0
null
null
null
null
UTF-8
Java
false
false
720
java
package com.example.mobileappdevelop.testcustomlistviewexam; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ListView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { ListView contactList; ArrayList<Data> datas; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); contactList = (ListView) findViewById(R.id.firstListView); Data data = new Data(); datas = data.getAlldata(); ContactAdapter adapter = new ContactAdapter(this, datas); contactList.setAdapter(adapter); } }
[ "Professional100001@yahoo.com" ]
Professional100001@yahoo.com
c53a0fd426cebec3db4b005493d758e381a99e3e
87ead0c203a3818db47148069774255e24a72427
/src/main/java/com/example/lancamentos/api/model/Endereco_.java
2aa1b78265009753e51f7d20752e672151629a09
[]
no_license
kleyton032/lancamentos-api-springboot
9ce60a172e0f02f6f4539512016fe25b2d364699
a82f3dfd5de42d1d46172261431982ed783a5018
refs/heads/master
2020-03-18T20:07:41.793724
2018-06-21T14:59:09
2018-06-21T14:59:09
123,728,258
0
0
null
null
null
null
UTF-8
Java
false
false
816
java
package com.example.lancamentos.api.model; import javax.annotation.Generated; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.StaticMetamodel; @Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor") @StaticMetamodel(Endereco.class) public abstract class Endereco_ { public static volatile SingularAttribute<Endereco, String> cidade; public static volatile SingularAttribute<Endereco, String> estado; public static volatile SingularAttribute<Endereco, String> complemento; public static volatile SingularAttribute<Endereco, String> numero; public static volatile SingularAttribute<Endereco, String> logradouro; public static volatile SingularAttribute<Endereco, String> bairro; public static volatile SingularAttribute<Endereco, String> cep; }
[ "kleyton.joao@gmail.com" ]
kleyton.joao@gmail.com
95a4b1dde2b363568b1ccb1f5aaf53be17147141
2f045bda978cd3a92bb2ec2ac6e1607a195c9022
/app/src/main/java/com/example/darwin/umnify/about/qoute_of_the_day/AddQouteOfTheDayActivity.java
95c611176800fd59c6bb6040770a2421c3d98599
[]
no_license
DarwinSardual/umnify
36062b9370a8b32a045d8b334f0fe3eebeb02851
10c028b5bb9eaf57999984af34d59c242c500932
refs/heads/master
2021-01-01T17:53:19.959666
2017-10-21T04:40:23
2017-10-21T04:40:23
98,184,357
0
0
null
2017-10-21T04:40:25
2017-07-24T11:39:24
Java
UTF-8
Java
false
false
1,471
java
package com.example.darwin.umnify.about.qoute_of_the_day; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.ImageButton; import com.example.darwin.umnify.R; public class AddQouteOfTheDayActivity extends AppCompatActivity { private EditText contentField; private ImageButton backButtton; private ImageButton submitButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_qoute_of_the_day); contentField = (EditText) findViewById(R.id.content_field); backButtton = (ImageButton) findViewById(R.id.back); submitButton = (ImageButton) findViewById(R.id.submit); ClickHandler handler = new ClickHandler(); submitButton.setOnClickListener(handler); backButtton.setOnClickListener(handler); } private class ClickHandler implements View.OnClickListener{ @Override public void onClick(View view) { if(view == submitButton){ Intent data = new Intent(); data.putExtra("ADD_QOUTE_CONTENT", contentField.getText().toString()); setResult(RESULT_OK, data); finish(); }else if(view ==backButtton){ finish(); } } } }
[ "darwin.sardual@gmail.com" ]
darwin.sardual@gmail.com
aeef609285bbb8679ae90f0ad88c392603048151
12a3430f1647a7cd31f714473b204f362ada38c2
/app/src/main/java/com/ashok/appclone/Movie.java
ca4b16b83d4b43cf90d7746337dc71c00d212b4c
[]
no_license
ashokmachineni/AppClone
e86e2158516630a13e2e801be09beba77316d8fa
e8a131240a5a76a07915f026b7f7f1da0c6b1564
refs/heads/master
2020-04-14T23:04:55.449356
2016-09-14T01:02:57
2016-09-14T01:02:57
68,157,369
0
0
null
null
null
null
UTF-8
Java
false
false
702
java
package com.ashok.appclone; /** * Created by ashok on 9/13/16. */ public class Movie { private String title,image,link; public Movie(){} public Movie(String title, String image, String link) { this.title = title; this.image = image; this.link = link; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getLink() { return link; } public void setLink(String link) { this.link = link; } }
[ "ashok5679m@gmail.com" ]
ashok5679m@gmail.com
55ca6ef853fd825bd02132c5cb131b93efd3ae32
5b9245cf1c04cf80fe5065c6f829ac53c42381ce
/DatePickerDialogDemo/app/src/androidTest/java/com/example/datepickerdialogdemo/ExampleInstrumentedTest.java
98aff3685f023a9fd25fa97c9da1ad9e05686cff
[]
no_license
Shahriar201/androidProject
d733f11ef4ce04b0cafc8947d7ca9cdc74f18043
67215662aa0b9060ad4b8238430335cc4caef321
refs/heads/master
2021-06-25T21:25:29.087189
2021-04-08T04:23:59
2021-04-08T04:23:59
218,176,052
0
0
null
null
null
null
UTF-8
Java
false
false
778
java
package com.example.datepickerdialogdemo; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.datepickerdialogdemo", appContext.getPackageName()); } }
[ "shahriarbrine201@gmail.com" ]
shahriarbrine201@gmail.com
e0ee25ca32daae5baa8ef264175f285553590b8e
d4a6a465366746875fe152a96916e9218e182e1a
/app/src/main/java/com/example/gopal/smsreader/Message.java
7cd171088568e0ac53130aec60cad4260d902577
[]
no_license
GopalDan/SmsReader
dfdd0487b917dd07dcb3cf7cd5c917e9a3cdcdf4
78c1c31edd1b27d88a27e1ef8b5f8116c9164e94
refs/heads/master
2020-12-09T23:00:24.931876
2020-01-12T18:45:19
2020-01-12T18:45:19
233,440,806
0
0
null
null
null
null
UTF-8
Java
false
false
971
java
package com.example.gopal.smsreader; /** * Created by Gopal on 11/10/2019. */ public class Message { private String id; private String address; private String msg; private String readState; //"0" for have not read sms and "1" for have read sms private String time; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public String getReadState() { return readState; } public void setReadState(String readState) { this.readState = readState; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } }
[ "gopal125dan@gmail.com" ]
gopal125dan@gmail.com
1638cc9ebcbe7108bddf1f66b8320e0b3f2f71bc
8374f31520d2b16f1432c148c5738ab4f063c26b
/belong-common/belong-common-core/src/main/java/com/belong/common/core/base/ResponseVO.java
40310d7e9a1545bddbd4544e77128b300e808316
[]
no_license
xuehua312741499/belong
3ffb141ccd24ebc5b44394db23d34d7fd4e9bb04
1fd5779a391eb386ce32349177ad85cae6c6c1fe
refs/heads/master
2020-09-21T15:20:04.240766
2019-11-29T07:43:35
2019-11-29T07:43:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,574
java
package com.belong.common.core.base; import com.belong.common.core.constant.ResponseCodeConstans; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.*; import lombok.experimental.Accessors; import java.io.Serializable; /** * @Description: 响应信息主体 * @Author: fengyu * @CreateDate: 2019/11/20 15:25 * @UpdateUser: fengyu * @UpdateDate: 2019/11/20 15:25 * @UpdateRemark: 修改内容 * @Version: 1.0 */ @ToString @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true) @ApiModel(description = "全局响应信息主体") public class ResponseVO<T> implements Serializable { private static final long serialVersionUID = 1L; @Getter @Setter @ApiModelProperty(value = "返回标记:成功标记=200,失败标记=-1") private Integer code; @Getter @Setter @ApiModelProperty(value = "返回信息") private String msg; @Getter @Setter @ApiModelProperty(value = "数据") private T data; public static <T> ResponseVO<T> ok() { return restResult(null, ResponseCodeConstans.REQUEST_SUCCESS, null); } public static <T> ResponseVO<T> ok(T data) { return restResult(data, ResponseCodeConstans.REQUEST_SUCCESS, null); } public static <T> ResponseVO<T> ok(Integer code, String msg) { return restResult(code, msg); } public static <T> ResponseVO<T> failed() { return restResult(null, ResponseCodeConstans.REQUEST_FAIL, null); } public static <T> ResponseVO<T> failed(String msg) { return restResult(null, ResponseCodeConstans.REQUEST_FAIL, msg); } public static <T> ResponseVO<T> failed(T data) { return restResult(data, ResponseCodeConstans.REQUEST_FAIL, null); } public static <T> ResponseVO<T> failed(T data, String msg) { return restResult(data, ResponseCodeConstans.REQUEST_FAIL, msg); } public static <T> ResponseVO<T> failed(Integer code, String msg) { return restResult(code, msg); } private static <T> ResponseVO<T> restResult(T data, int code, String msg) { ResponseVO<T> apiResult = new ResponseVO<>(); apiResult.setCode(code); apiResult.setData(data); apiResult.setMsg(msg); return apiResult; } private static <T> ResponseVO<T> restResult(int code, String msg) { ResponseVO<T> apiResult = new ResponseVO<>(); apiResult.setCode(code); apiResult.setData(null); apiResult.setMsg(msg); return apiResult; } }
[ "belongfeng@gmail.com" ]
belongfeng@gmail.com
59f54872475c14475dbcb4e3bb7a081f25e3c7c3
605972df89bd2481af76c8ea4b79a5295597f8e8
/src/main/java/utils/EventReporter.java
dbcb2e84d0674a85f24eef8feef803f7a508fd42
[]
no_license
RussellJQA/tau_webdriver_java
df015ef6b883bb50523936d22d9c0e4db33d0dbe
a07572fb4619d2975b3726149f9648f41072679e
refs/heads/master
2023-06-01T18:34:35.330140
2021-06-20T00:07:39
2021-06-20T00:07:39
370,760,503
1
0
null
null
null
null
UTF-8
Java
false
false
3,281
java
package utils; import org.openqa.selenium.By; import org.openqa.selenium.OutputType; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.events.WebDriverEventListener; // TODO: Acc. to // https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/support/events/WebDriverEventListener.html // WebDriverEventListener has been deprecated: // Use EventFiringDecorator and WebDriverListener instead public class EventReporter implements WebDriverEventListener { @Override public void beforeAlertAccept(WebDriver webDriver) { } @Override public void afterAlertAccept(WebDriver webDriver) { } @Override public void afterAlertDismiss(WebDriver webDriver) { } @Override public void beforeAlertDismiss(WebDriver webDriver) { } @Override public void beforeNavigateTo(String s, WebDriver webDriver) { System.out.println("Navigating to: " + s); } @Override public void afterNavigateTo(String s, WebDriver webDriver) { } @Override public void beforeNavigateBack(WebDriver webDriver) { } @Override public void afterNavigateBack(WebDriver webDriver) { } @Override public void beforeNavigateForward(WebDriver webDriver) { } @Override public void afterNavigateForward(WebDriver webDriver) { } @Override public void beforeNavigateRefresh(WebDriver webDriver) { } @Override public void afterNavigateRefresh(WebDriver webDriver) { } @Override public void beforeFindBy(By by, WebElement webElement, WebDriver webDriver) { } @Override public void afterFindBy(By by, WebElement webElement, WebDriver webDriver) { } @Override public void beforeClickOn(WebElement webElement, WebDriver webDriver) { System.out.println("Clicking on element: " + webElement.getText()); } @Override public void afterClickOn(WebElement webElement, WebDriver webDriver) { } @Override public void beforeChangeValueOf(WebElement webElement, WebDriver webDriver, CharSequence[] charSequences) { } @Override public void afterChangeValueOf(WebElement webElement, WebDriver webDriver, CharSequence[] charSequences) { } @Override public void beforeScript(String s, WebDriver webDriver) { System.out.println("Executing script: " + s); } @Override public void afterScript(String s, WebDriver webDriver) { } @Override public void beforeSwitchToWindow(String s, WebDriver webDriver) { System.out.println("Switching to window: " + s); } @Override public void afterSwitchToWindow(String s, WebDriver webDriver) { } @Override public void onException(Throwable throwable, WebDriver webDriver) { } @Override public <X> void beforeGetScreenshotAs(OutputType<X> outputType) { } @Override public <X> void afterGetScreenshotAs(OutputType<X> outputType, X x) { } @Override public void beforeGetText(WebElement webElement, WebDriver webDriver) { } @Override public void afterGetText(WebElement webElement, WebDriver webDriver, String s) { System.out.println("Got text of: " + s); } }
[ "16086475+RussellJQA@users.noreply.github.com" ]
16086475+RussellJQA@users.noreply.github.com
fde3046bbf0e2ccece02e912c780fc49ce3cf20f
54ac2b3b2968219d6982e0bc2bbf96ae26c197dd
/src/main/java/cn/sihai/soft/api/service/AddressService.java
13c4e2595d5ebe6042817d212f4921aa823d0f59
[]
no_license
zhengxiangchen/mall--api
75af9aff82678d5e30da778d48f8e8421af15a20
ccb27cb526a5710078b92e6edda0f2e93400dc12
refs/heads/master
2020-04-06T13:55:52.508194
2018-11-15T09:52:26
2018-11-15T09:52:26
157,520,143
0
1
null
null
null
null
UTF-8
Java
false
false
564
java
package cn.sihai.soft.api.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import cn.sihai.soft.api.dao.AddressDao; import cn.sihai.soft.api.entity.AddressEntity; @Service public class AddressService { @Autowired private AddressDao addressDao; /** * 保存/修改用户信息 * @param address */ public void saveOrUpdate(AddressEntity address){ addressDao.save(address); } public AddressEntity getAddress(String openid) { return addressDao.getAddress(openid); } }
[ "510849431@qq.com" ]
510849431@qq.com
1c707cdff867c89a989d62eb5875d506c7ff1b59
8342fea05737da7019a17991105e4e297c280d97
/app/src/androidTest/java/com/example/cl/crzayandroiddemo37/ApplicationTest.java
8461f391129dc887d8e77e363c09a1fcba738000
[]
no_license
chinadarren/CrzayAndroidDemo37
47072e77f069ab27715d4d45a1bd9b29b3e4d578
3174ff67b5d401ed906b82f18c153467fe676ecf
refs/heads/master
2016-08-11T17:19:12.959487
2015-10-23T03:27:35
2015-10-23T03:27:35
44,788,499
0
0
null
null
null
null
UTF-8
Java
false
false
364
java
package com.example.cl.crzayandroiddemo37; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "chinadarren@outlook.com" ]
chinadarren@outlook.com
876f0ebb7eb9dd0a4aa66c12ec61116add7ac2e8
e77d5064136920b266ba47a42291383b74e4ac88
/src/main/java/com/example/blog/config/shiro/ShiroConfig.java
7381abb551b4045a0a50651b238763bc37cd5f80
[]
no_license
JFSZ/blog-demo
0928556ea6cb78d1b9fd497f43efc33f14c837a2
fa692fd8ba4afb3695a8cab4e4e35cf48f0b4456
refs/heads/master
2022-06-29T21:53:10.257928
2019-07-25T06:43:48
2019-07-25T06:43:48
195,908,830
1
0
null
2022-06-17T02:17:05
2019-07-09T01:20:39
TSQL
UTF-8
Java
false
false
6,666
java
package com.example.blog.config.shiro; import org.apache.shiro.cache.CacheManager; import org.apache.shiro.cache.MemoryConstrainedCacheManager; import org.apache.shiro.codec.Base64; import org.apache.shiro.mgt.RememberMeManager; import org.apache.shiro.mgt.SecurityManager; import org.apache.shiro.realm.Realm; import org.apache.shiro.session.mgt.SessionManager; import org.apache.shiro.spring.LifecycleBeanPostProcessor; import org.apache.shiro.spring.web.ShiroFilterFactoryBean; import org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition; import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition; import org.apache.shiro.web.mgt.CookieRememberMeManager; import org.apache.shiro.web.mgt.DefaultWebSecurityManager; import org.apache.shiro.web.servlet.SimpleCookie; import org.crazycake.shiro.RedisCacheManager; import org.crazycake.shiro.RedisManager; import org.crazycake.shiro.RedisSessionDAO; import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.DependsOn; import redis.clients.jedis.JedisPool; import javax.servlet.Filter; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; /** * @ClassName ShiroConfig * @Author chenxue * @Description shiro 配置类 * @Date 2019/7/4 15:29 **/ @Configuration public class ShiroConfig { @Value("${spring.redis.host}") private String host; @Value("${spring.redis.port}") private int port; @Value("${spring.redis.password}") private String password; @Value("${spring.redis.jedis.poll}") private JedisPool jedisPool; @Bean public Realm realm(){ return new MyRealm(); } @Bean public ShiroFilterChainDefinition shiroFilterChainDefinition(){ return new DefaultShiroFilterChainDefinition(); } @Bean public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager){ ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean(); shiroFilterFactoryBean.setSecurityManager(securityManager); shiroFilterFactoryBean.setLoginUrl("/unauthorized"); shiroFilterFactoryBean.setUnauthorizedUrl("/unauthorized"); //拦截器 系统默认拦截器 Map<String,String> filterChainDefinitionMap = new LinkedHashMap<>(); //添加自己的过滤器 Map<String,Filter> filterMap = new HashMap<>(16); //自定义过滤器 filterMap.put("authc",new CheckTokenFilter()); //登录 退出 默认不拦截 filterChainDefinitionMap.put("/login","anon"); filterChainDefinitionMap.put("/logout","anon"); filterChainDefinitionMap.put("/static/**","anon"); filterChainDefinitionMap.put("/unauthorized","anon"); filterChainDefinitionMap.put("/article/dataStatistics","authc,roles[admin]"); filterChainDefinitionMap.put("/admin/**","authc,roles[admin]"); //其他所有请求都需要验证 filterChainDefinitionMap.put("/**","authc"); shiroFilterFactoryBean.setFilters(filterMap); shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); return shiroFilterFactoryBean; } @Bean public DefaultWebSecurityManager securityManager(){ DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); securityManager.setRealm(realm()); securityManager.setSessionManager(sessionManager()); securityManager.setCacheManager(redisCacheManager()); securityManager.setRememberMeManager(rememberMeManager()); return securityManager; } @Bean public SessionManager sessionManager(){ MySessionManager mySessionManager = new MySessionManager(); mySessionManager.setSessionDAO(redisSessionDAO()); return mySessionManager; } @Bean public RedisSessionDAO redisSessionDAO(){ RedisSessionDAO redisSessionDAO = new RedisSessionDAO(); redisSessionDAO.setRedisManager(redisManager()); redisSessionDAO.setExpire(1800); return redisSessionDAO; } @Bean public RedisManager redisManager(){ RedisManager redisManager = new RedisManager(); redisManager.setPassword(""); redisManager.setTimeout(21600); redisManager.setJedisPool(new JedisPool("127.0.0.1",6379)); return redisManager; } @Bean public RedisCacheManager redisCacheManager(){ RedisCacheManager redisCacheManager = new RedisCacheManager(); redisCacheManager.setRedisManager(redisManager()); redisCacheManager.setKeyPrefix("blog-demo:cache:"); return redisCacheManager; } @Bean public CacheManager cacheManager(){ return new MemoryConstrainedCacheManager(); } /** * 下面的代码是添加注解支持 * 使用aop 需要加上。不加shiro注解不起作用 * @return */ @Bean @DependsOn("lifecycleBeanPostProcessor") public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator(){ DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator(); defaultAdvisorAutoProxyCreator.setProxyTargetClass(true); return defaultAdvisorAutoProxyCreator; } /* * @Author chenxue * @Description shiro 生命周期 * @Date 2019/7/9 11:57 * @Param [] * @return org.apache.shiro.spring.LifecycleBeanPostProcessor **/ @Bean public LifecycleBeanPostProcessor lifecycleBeanPostProcessor(){ return new LifecycleBeanPostProcessor(); } @Bean public SimpleCookie rememberMeCookie() { SimpleCookie simpleCookie = new SimpleCookie("rememberMe"); //如果httyOnly设置为true,则客户端不会暴露给客户端脚本代码,使用HttpOnly cookie有助于减少某些类型的跨站点脚本攻击; simpleCookie.setHttpOnly(true); // 设置cookie有效时间 30天 simpleCookie.setMaxAge(2592000); return simpleCookie; } @Bean public RememberMeManager rememberMeManager(){ CookieRememberMeManager meManager = new CookieRememberMeManager(); meManager.setCookie(rememberMeCookie()); //cookie加密的密钥 建议每个项目都不一样 默认AES算法 密钥长度(128 256 512 位) meManager.setCipherKey(Base64.decode("wGiHplamyXlVB11UXWol8g==")); return meManager; } }
[ "843400447@qq.com" ]
843400447@qq.com
1acfe2994d4502babbc86c07eb577e0ed61ec65e
6af969173756745dd384c5c4c457185cca6b92b6
/G03_CENG431_Midterm1/src/module-info.java
2bde1cf2aba0509dcbe83cd975828d4282fa7d38
[ "MIT" ]
permissive
arifBurakDemiray/ceng431-homeworks
652de26cf542cceb2968fde5296e16f01aa73168
33c9829148b1c375852a53184c62390252a02b36
refs/heads/main
2023-04-24T00:17:35.574499
2021-05-03T14:05:43
2021-05-03T14:05:43
341,233,817
0
1
null
null
null
null
UTF-8
Java
false
false
31
java
module G03_CENG431_Midterm1 { }
[ "57103426+arifBurakDemiray@users.noreply.github.com" ]
57103426+arifBurakDemiray@users.noreply.github.com
b539986ace1cd2447b50841b81f102402313719c
af9d2ea8a54016effd773b3f1d1fc1546301956e
/src/meatbol/SubClassif.java
f17fa0ca7f4a05803db34af9de1e6715af01eabf
[]
no_license
hlpd-pham/meatbol_v2
69a64abed05a66e1898c7c9f14f575d2743121a2
e717746d5b295cd82bc3ad6a0c531f87adaf4bfd
refs/heads/master
2022-01-05T13:15:49.639405
2019-05-03T05:37:59
2019-05-03T05:37:59
183,647,568
0
0
null
null
null
null
UTF-8
Java
false
false
1,426
java
package meatbol; public enum SubClassif { EMPTY, // empty // OPERAND's subclassifications IDENTIFIER, // identifier INTEGER, // integer constant FLOAT, // float constant BOOLEAN, // boolean constant STRING, // string constant DATE, // date constant VOID, // void // CONTROL's subclassifications FLOW, // flow statement (e.g., if) END, // end statement (e.g., endif) DECLARE, // declare statement (e.g., Int) DEBUG, // for debugger // FUNCTION's subclassfications BUILTIN, // builtin function (e.g., print) USER, // user-defined function // Simple operator classification PLUS, // addition MINUS, // subtraction MULTIPLY, // multiplication DIVIDE, // division UNARYMINUS, // unary minus SMALLER, // smaller than LARGER, // larger than SEQUAL, // smaller than or equal to LEQUAL, // larger than or equal to EQUI, // equivalant NEQUI, // not equivalent PEQUAL, // plus equal MEQUAL, // minus equal ASSIGN, // assignment ARRAY_SLICE, // array slicing EXPO, // exponent (^) GOOD }
[ "rzz934@my.utsa.edu" ]
rzz934@my.utsa.edu
9a4af3a907cd71a093d204657e00ffd9fb1ae40b
fa93c9be2923e697fb8a2066f8fb65c7718cdec7
/sources/com/avito/android/floating_views/FloatingViewsPresenterState.java
3bcb42ca27e2f33ca6e6e7e3fc78705042dda070
[]
no_license
Auch-Auch/avito_source
b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b
76fdcc5b7e036c57ecc193e790b0582481768cdc
refs/heads/master
2023-05-06T01:32:43.014668
2021-05-25T10:19:22
2021-05-25T10:19:22
370,650,685
0
0
null
null
null
null
UTF-8
Java
false
false
643
java
package com.avito.android.floating_views; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import javax.inject.Qualifier; import kotlin.Metadata; @Qualifier @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u001b\n\u0002\b\u0003\b‡\u0002\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Lcom/avito/android/floating_views/FloatingViewsPresenterState;", "", "<init>", "()V", "floating-views_release"}, k = 1, mv = {1, 4, 2}) @Retention(RetentionPolicy.RUNTIME) @kotlin.annotation.Retention public @interface FloatingViewsPresenterState { }
[ "auchhunter@gmail.com" ]
auchhunter@gmail.com
1954da5307c079c9304a2524295c9706af141818
732009a247621c02e388eca96a425586d84c9c9c
/ShareCare/ShareCare/app/src/main/java/com/example/sharecare/Fragments/ProfileFragment/ProfileTabFragment.java
050905a6f86297caf5c1112281555ee6dcace39c
[]
no_license
AhmadShaheer28/ShareNCare
5757c29e0241a38316f30c16babeb9c68ef8f8eb
ccc2426a75d4caf0ac2ec8a1498e090edbb631ad
refs/heads/master
2023-05-27T07:39:02.120365
2023-05-13T22:51:01
2023-05-13T22:51:01
247,715,169
2
0
null
2023-05-13T22:51:07
2020-03-16T13:53:14
Java
UTF-8
Java
false
false
7,768
java
package com.example.sharecare.Fragments.ProfileFragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.RatingBar; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentPagerAdapter; import androidx.viewpager.widget.ViewPager; import com.example.sharecare.ApiResponse.LoginResponse.User; import com.example.sharecare.AppPreferences; import com.example.sharecare.Fragments.RestaurantFragment.FeedbackListFragment; import com.example.sharecare.MainActivity; import com.example.sharecare.R; import com.google.android.material.tabs.TabLayout; import java.util.ArrayList; import java.util.List; /** * Created by admin on 2017-08-12. */ public class ProfileTabFragment extends Fragment { private static final String TEAM_PARAM = "TEAM"; private static final String LOG_TAG = "ProfileTabFragment"; static final int MARK_ID2 = 3; private TextView teamName; private TextView clubName; private Button switch_team; private ImageView teamLogo; private RatingBar ratingBar; //private Team team; Toolbar toolbar; AppPreferences appPreferences; User user; public static ProfileTabFragment newInstance() { ProfileTabFragment fragment = new ProfileTabFragment(); Bundle args = new Bundle(); //args.putString(TEAM_PARAM, team.toJson()); fragment.setArguments(args); //fragment.setTeam(team); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true); View view = inflater.inflate(R.layout.fragment_tab_profile, container, false); switch_team = view.findViewById(R.id.switchTeam); //SessionManager sessionManager = new SessionManager(getContext()); appPreferences=AppPreferences.getInstance(getContext()); user=appPreferences.getUserData(); toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar); toolbar.inflateMenu(R.menu.main); TabLayout tabs = view.findViewById(R.id.tab_layout); tabs.addTab((tabs.newTab().setText("Profile"))); tabs.addTab((tabs.newTab().setText("Feedback"))); /*OnBoardingChecker onBoardingChecker = new OnBoardingChecker(getActivity(), getSession()); if (!onBoardingChecker.getProfileOnBorading()) { new TapTargetSequence(getActivity()) .targets( TapTarget.forView(((ViewGroup) tabs.getChildAt(0)).getChildAt(1), getString(R.string.switch_Team), getString(R.string.switch_Team_des)) , TapTarget.forToolbarMenuItem(toolbar, R.id.onBoarding, getString(R.string.add_team), "") .dimColor(android.R.color.darker_gray) .outerCircleColor(R.color.primary) .targetCircleColor(R.color.white) .textColor(android.R.color.white)) .listener(new TapTargetSequence.Listener() { // This listener will tell us when interesting(tm) events happen in regards // to the sequence @Override public void onSequenceFinish() { // Yay } @Override public void onSequenceStep(TapTarget lastTarget, boolean targetClicked) { } @Override public void onSequenceCanceled(TapTarget lastTarget) { // Boo } }).start(); //sessionManager.setProfileOnBoarding(true); onBoardingChecker.setProfileOnBoarding(true); }*/ return view; } public void onResume() { super.onResume(); // Set title bar ((MainActivity) getActivity()) .setActionBarTitle(getString(R.string.profile)); } // public Team getTeam() { // return team; // } // private void setTeam(Team team) { // this.team = team; // } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); initUI(view); //setProfileData(); } private void initUI(View view) { ViewPager viewPager = view.findViewById(R.id.viewpager); setupViewPager(viewPager); TabLayout tabs = view.findViewById(R.id.tab_layout); tabs.setupWithViewPager(viewPager); teamLogo = view.findViewById(R.id.team_view_profile_logo); teamName = view.findViewById(R.id.team_name_txt); teamName.setText(user.getName()); clubName = view.findViewById(R.id.profile_club_name); ratingBar = view.findViewById(R.id.ratingBar); ratingBar.setVisibility(View.VISIBLE); } // private void setProfileData() { // // // if (team.getTeamLogo() != null) // ImageHelper.renderImage(team.getTeamLogo(), getContext(), teamLogo); // // teamName.setText(team.getName()); // clubName.setText(team.getClientName()); ///* // if (team.getRating() != null) // ratingBar.setRating(team.getRating().floatValue()); // // // if (team.getExperiencePoints() != null) // experiencePoints.setText(team.getExperiencePoints() + " EXP"); // else // experiencePoints.setText("0 EXP"); // */ // // // } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { switch (item.getItemId()) { case R.id.onBoarding: //replaceFragment(new CreateTeamFragment()); return true; } return super.onOptionsItemSelected(item); } private void setupViewPager(ViewPager viewPager) { Adapter adapter = new Adapter(getChildFragmentManager()); adapter.addFragment(ProfileViewFragment.newInstance(), getString(R.string.profile)); adapter.addFragment(FeedbackListFragment.newInstance(), "Feedback"); // adapter.addFragment(TeamStatisticsFragment.newInstance(getSession().getTeam().toJson()), getString(R.string.statistics)); viewPager.setAdapter(adapter); viewPager.setOffscreenPageLimit(1); } static class Adapter extends FragmentPagerAdapter { private final List<Fragment> mFragmentList = new ArrayList<>(); private final List<String> mFragmentTitleList = new ArrayList<>(); public Adapter(FragmentManager manager) { super(manager); } @Override public Fragment getItem(int position) { return mFragmentList.get(position); } @Override public int getCount() { return mFragmentList.size(); } public void addFragment(Fragment fragment, String title) { mFragmentList.add(fragment); mFragmentTitleList.add(title); } @Override public CharSequence getPageTitle(int position) { return mFragmentTitleList.get(position); } } }
[ "mufarooq3@gmail.com" ]
mufarooq3@gmail.com
ff809143d178bfbb4862168de7732cf3c8650714
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.mobileqqi/classes.jar/com/tencent/a/a/a/c.java
bd74cb56aca31f4165803743246775bf183dc217
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
6,040
java
package com.tencent.a.a.a; import android.os.IBinder; import android.os.Parcel; final class c implements a { private IBinder a; c(IBinder paramIBinder) { this.a = paramIBinder; } /* Error */ public final int a(d paramd) { // Byte code: // 0: invokestatic 23 android/os/Parcel:obtain ()Landroid/os/Parcel; // 3: astore_3 // 4: invokestatic 23 android/os/Parcel:obtain ()Landroid/os/Parcel; // 7: astore 4 // 9: aload_3 // 10: ldc 25 // 12: invokevirtual 29 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V // 15: aload_1 // 16: ifnull +52 -> 68 // 19: aload_1 // 20: invokeinterface 35 1 0 // 25: astore_1 // 26: aload_3 // 27: aload_1 // 28: invokevirtual 38 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V // 31: aload_0 // 32: getfield 15 com/tencent/a/a/a/c:a Landroid/os/IBinder; // 35: iconst_2 // 36: aload_3 // 37: aload 4 // 39: iconst_0 // 40: invokeinterface 44 5 0 // 45: pop // 46: aload 4 // 48: invokevirtual 47 android/os/Parcel:readException ()V // 51: aload 4 // 53: invokevirtual 51 android/os/Parcel:readInt ()I // 56: istore_2 // 57: aload 4 // 59: invokevirtual 54 android/os/Parcel:recycle ()V // 62: aload_3 // 63: invokevirtual 54 android/os/Parcel:recycle ()V // 66: iload_2 // 67: ireturn // 68: aconst_null // 69: astore_1 // 70: goto -44 -> 26 // 73: astore_1 // 74: aload 4 // 76: invokevirtual 54 android/os/Parcel:recycle ()V // 79: aload_3 // 80: invokevirtual 54 android/os/Parcel:recycle ()V // 83: aload_1 // 84: athrow // Local variable table: // start length slot name signature // 0 85 0 this c // 0 85 1 paramd d // 56 11 2 i int // 3 77 3 localParcel1 Parcel // 7 68 4 localParcel2 Parcel // Exception table: // from to target type // 9 15 73 finally // 19 26 73 finally // 26 57 73 finally } /* Error */ public final int a(String paramString1, String paramString2, d paramd) { // Byte code: // 0: invokestatic 23 android/os/Parcel:obtain ()Landroid/os/Parcel; // 3: astore 5 // 5: invokestatic 23 android/os/Parcel:obtain ()Landroid/os/Parcel; // 8: astore 6 // 10: aload 5 // 12: ldc 25 // 14: invokevirtual 29 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V // 17: aload 5 // 19: aload_1 // 20: invokevirtual 58 android/os/Parcel:writeString (Ljava/lang/String;)V // 23: aload 5 // 25: aload_2 // 26: invokevirtual 58 android/os/Parcel:writeString (Ljava/lang/String;)V // 29: aload_3 // 30: ifnull +57 -> 87 // 33: aload_3 // 34: invokeinterface 35 1 0 // 39: astore_1 // 40: aload 5 // 42: aload_1 // 43: invokevirtual 38 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V // 46: aload_0 // 47: getfield 15 com/tencent/a/a/a/c:a Landroid/os/IBinder; // 50: iconst_1 // 51: aload 5 // 53: aload 6 // 55: iconst_0 // 56: invokeinterface 44 5 0 // 61: pop // 62: aload 6 // 64: invokevirtual 47 android/os/Parcel:readException ()V // 67: aload 6 // 69: invokevirtual 51 android/os/Parcel:readInt ()I // 72: istore 4 // 74: aload 6 // 76: invokevirtual 54 android/os/Parcel:recycle ()V // 79: aload 5 // 81: invokevirtual 54 android/os/Parcel:recycle ()V // 84: iload 4 // 86: ireturn // 87: aconst_null // 88: astore_1 // 89: goto -49 -> 40 // 92: astore_1 // 93: aload 6 // 95: invokevirtual 54 android/os/Parcel:recycle ()V // 98: aload 5 // 100: invokevirtual 54 android/os/Parcel:recycle ()V // 103: aload_1 // 104: athrow // Local variable table: // start length slot name signature // 0 105 0 this c // 0 105 1 paramString1 String // 0 105 2 paramString2 String // 0 105 3 paramd d // 72 13 4 i int // 3 96 5 localParcel1 Parcel // 8 86 6 localParcel2 Parcel // Exception table: // from to target type // 10 29 92 finally // 33 40 92 finally // 40 74 92 finally } public final byte[] a(String paramString, byte[] paramArrayOfByte) { Parcel localParcel1 = Parcel.obtain(); Parcel localParcel2 = Parcel.obtain(); try { localParcel1.writeInterfaceToken("com.tencent.assistant.sdk.remote.BaseService"); localParcel1.writeString(paramString); localParcel1.writeByteArray(paramArrayOfByte); this.a.transact(3, localParcel1, localParcel2, 0); localParcel2.readException(); paramString = localParcel2.createByteArray(); return paramString; } finally { localParcel2.recycle(); localParcel1.recycle(); } } public final IBinder asBinder() { return this.a; } public final void b(String paramString, byte[] paramArrayOfByte) { Parcel localParcel1 = Parcel.obtain(); Parcel localParcel2 = Parcel.obtain(); try { localParcel1.writeInterfaceToken("com.tencent.assistant.sdk.remote.BaseService"); localParcel1.writeString(paramString); localParcel1.writeByteArray(paramArrayOfByte); this.a.transact(4, localParcel1, localParcel2, 0); localParcel2.readException(); return; } finally { localParcel2.recycle(); localParcel1.recycle(); } } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mobileqqi\classes2.jar * Qualified Name: com.tencent.a.a.a.c * JD-Core Version: 0.7.0.1 */
[ "98632993+tsuzcx@users.noreply.github.com" ]
98632993+tsuzcx@users.noreply.github.com
8e8530a997306c3cce136a9835a033a35f89d22c
39bbd5da14f1ad4646c1d0c95f2cdb2f8ee8b360
/src/lt/martynassateika/idea/inspection/util/MyPsiUtil.java
10ebffe5ff3f7fa382bf9254c8301f0a3da406c9
[ "Apache-2.0" ]
permissive
martynassateika/my-idea-inspections
9da50edb7078fb9a80e6fd2e1404029d2b90fec5
12302a3ed7c372ef72e7052f5b51dc4fd02da21d
refs/heads/master
2020-03-21T06:34:24.928737
2018-06-21T22:48:38
2018-06-21T22:49:58
138,228,886
0
0
null
null
null
null
UTF-8
Java
false
false
2,202
java
package lt.martynassateika.idea.inspection.util; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiReference; import com.intellij.psi.PsiReferenceExpression; import com.intellij.psi.impl.compiled.ClsClassImpl; /** * <p>Provides various PSI utility methods.</p> * <p> * <p>Created on 10/06/2018 by martynas.sateika</p> * * @author martynas.sateika * @since 1.0 */ public class MyPsiUtil { /** * @param methodExpression method expression reference * @param methodName expected method name, e.g. 'hashCode' * @param classQname qualified name of the class housing the {@code methodName} method, e.g. 'java.util.Objects' * @return {@code true} if {@code methodExpression} represents the method {@code methodName} in {@code classQname} */ public static boolean isMethodCall(PsiReferenceExpression methodExpression, String methodName, String classQname) { PsiReference reference = methodExpression.getReference(); if (methodName.equals(methodExpression.getReferenceName())) { if (reference != null) { PsiElement resolve = reference.resolve(); if (resolve != null) { PsiElement parent = resolve.getOriginalElement().getParent(); if (parent instanceof ClsClassImpl) { ClsClassImpl clsClass = (ClsClassImpl) parent; return classQname.equals(clsClass.getQualifiedName()); } } } } return false; } /** * @param aClass a class PSI element * @param parentClassQname qualified name of a class * @return {@code true} if {@code aClass} is a sub-class of {@code parentClassQname} */ public static boolean isSubclassOf(PsiClass aClass, String parentClassQname) { PsiClass superClass = aClass.getSuperClass(); while (superClass != null) { if (parentClassQname.equals(superClass.getQualifiedName())) { return true; } superClass = superClass.getSuperClass(); } return false; } }
[ "martynas.sateika@gmail.com" ]
martynas.sateika@gmail.com
01e7ed66bf7d719d4f062cda0ddd3fd2e15ab396
4e5855a5f8e3bc26af3895e5d5b39dd63b4f46ac
/src/main/java/com/tutorialq/services/TimesheetServiceImpl.java
026d9f16d8ac8f09571b26acf665656c18a40150
[]
no_license
testingstar9/eams
58a4437b44249491c3aacee9cc076d9250138553
c078305d0c2da138b4a797dc6e3509787410e4de
refs/heads/master
2021-07-08T15:49:33.891289
2020-02-02T19:51:19
2020-02-02T19:51:19
237,826,956
0
0
null
2021-04-26T19:55:36
2020-02-02T19:49:19
Java
UTF-8
Java
false
false
4,160
java
package com.tutorialq.services; import com.tutorialq.constants.ApplicationConstants; import com.tutorialq.entities.Employee; import com.tutorialq.entities.Timesheet; import com.tutorialq.repositories.TimesheetRepository; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; @Service @Slf4j public class TimesheetServiceImpl implements TimesheetService { @Autowired TimesheetRepository timesheetRepository; @Override public void save(Timesheet timesheetObj) throws Exception { //log.info("Inside save method of TimesheetServiceImpl :: " + timesheetObj.getTimesheetId()); timesheetRepository.save(timesheetObj); } @Override public List<Timesheet> getTimesheetsByEmpId(long employeeId) throws Exception { return timesheetRepository.findByEmployeeEmployeeId(employeeId); } @Override public Timesheet getTimesheetByTimesheetId(long timesheetId) throws Exception { //log.info("Inside getTimesheetByTimesheetId method of TimesheetServiceImpl --> timesheetId: " + timesheetId); return timesheetRepository.findById(timesheetId).orElse(new Timesheet()); } @Override public Timesheet getTimesheetByEndDate(LocalDate endDate, Employee employee) throws Exception { //log.info("Inside getTimesheetByEndDate method of TimesheetServiceImpl :: endDate: " + endDate); return timesheetRepository.findTimesheetByToDateAndEmployee(endDate, employee); } @Override public List<Timesheet> getTimesheetSummaryStaff(LocalDate fromDate, LocalDate toDate, String timesheetStatus) throws Exception { /* * //log. * info("Inside getTimesheetSummaryStaff method of TimesheetServiceImpl :: fromDate: " * + fromDate + "toDate: " + toDate + " timesheetStatus: " + timesheetStatus; */ if (StringUtils.isBlank(timesheetStatus) || StringUtils.equalsIgnoreCase(timesheetStatus, "ALL")) { // log.info("Inside the timesheet status of ALL."); return timesheetRepository.findTimesheetsByFromDateGreaterThanEqualAndToDateLessThanEqual(fromDate, toDate); } else { // log.info("Inside the timesheet status based on fromDate, toDate and Timesheet status."); return timesheetRepository.findTimesheetsByFromDateGreaterThanEqualAndToDateLessThanEqualAndTimesheetStatus (fromDate, toDate, timesheetStatus); } } @Override public void approveTimesheet(long timesheetId, String reviewerName, String reviewComments) throws Exception { // log.info("Inside approveTimesheet method of TimesheetServiceImpl, timesheetId :: " + timesheetId); Timesheet timesheetObj = timesheetRepository.findById(timesheetId).get(); timesheetObj.setTimesheetStatus(ApplicationConstants.TIMESHEET_STATUS_APPROVED); timesheetObj.setDateApproved(LocalDateTime.now()); timesheetObj.setNameApproved(reviewerName); timesheetObj.setReviewerComments(reviewComments); timesheetObj.setNameLastModified(reviewerName); //Updating the Timesheet object with necessary information. timesheetRepository.save(timesheetObj); } @Override public void rejectTimesheet(long timesheetId, String reviewerName, String reviewComments) throws Exception { /* * log. * info("Inside rejectTimesheet method of TimesheetServiceImpl, timesheetId :: " * + timesheetId + " reviewerComments: " + reviewComments); */ Timesheet timesheetObj = timesheetRepository.findById(timesheetId).get(); timesheetObj.setTimesheetStatus(ApplicationConstants.TIMESHEET_STATUS_REJECTED); timesheetObj.setDateApproved(null); timesheetObj.setNameApproved(""); timesheetObj.setReviewerComments(reviewComments); timesheetObj.setNameLastModified(reviewerName); //Updating the Timesheet object with necessary information. timesheetRepository.save(timesheetObj); } }
[ "ANIL INDLA@ANIL" ]
ANIL INDLA@ANIL
4dd2c8c23ec4c3df1259fafc1265d34087bf3061
8a5fbb2cea6b411e2d382db17010100685500b0e
/android/app/build/generated/source/r/debug/com/facebook/fbui/textlayoutbuilder/R.java
14768140b72f097650097d3380a7dcb64e318d70
[]
no_license
liaopeng541/new-rnbase
3696934299343de5b593720132a87ce2d7fb41a2
c748fb13df2976720d6f208ffeee5ab87b999e1f
refs/heads/master
2021-05-12T12:43:31.330699
2018-01-14T09:02:51
2018-01-14T09:02:51
117,417,300
0
0
null
null
null
null
UTF-8
Java
false
false
1,734
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.facebook.fbui.textlayoutbuilder; public final class R { public static final class styleable { public static final int[] TextAppearance = { 0x01010095, 0x01010096, 0x01010097, 0x01010098, 0x01010161, 0x01010162, 0x01010163, 0x01010164, 0x7f01003d }; public static final int TextAppearance_android_shadowColor = 4; public static final int TextAppearance_android_shadowDx = 5; public static final int TextAppearance_android_shadowDy = 6; public static final int TextAppearance_android_shadowRadius = 7; public static final int TextAppearance_android_textColor = 3; public static final int TextAppearance_android_textSize = 0; public static final int TextAppearance_android_textStyle = 2; public static final int[] TextStyle = { 0x01010034, 0x01010095, 0x01010097, 0x01010098, 0x010100ab, 0x01010153, 0x0101015d, 0x01010161, 0x01010162, 0x01010163, 0x01010164 }; public static final int TextStyle_android_ellipsize = 4; public static final int TextStyle_android_maxLines = 5; public static final int TextStyle_android_shadowColor = 7; public static final int TextStyle_android_shadowDx = 8; public static final int TextStyle_android_shadowDy = 9; public static final int TextStyle_android_shadowRadius = 10; public static final int TextStyle_android_singleLine = 6; public static final int TextStyle_android_textAppearance = 0; public static final int TextStyle_android_textColor = 3; public static final int TextStyle_android_textSize = 1; public static final int TextStyle_android_textStyle = 2; } }
[ "liaopeng541@outlook.com" ]
liaopeng541@outlook.com
be28ed848072670bbfe297088f975336b225c240
e23006e77306bc70ad447f9066c21cdd6b13112e
/EMG Client/src/Pages/Menu.java
cc1274debbc408125cda5ae2d72757104e183ef0
[]
no_license
usymmij/neuroMuscleDemo
8f41827a752734cd05ec63b1b32015e286ea5af9
ea3a5e1552fca71012b44f6472c7bfeea794dbb1
refs/heads/master
2020-06-14T04:09:53.475917
2019-07-09T03:22:07
2019-07-09T03:22:07
194,893,840
0
0
null
2019-07-07T13:10:35
2019-07-02T15:53:34
C++
UTF-8
Java
false
false
1,177
java
package Pages; import java.awt.*; public class Menu extends Page { public Menu() { } @Override public void paintComponent(Graphics g) { super.paintComponent(g); for(int i = 0; i < 6; i++) { g.fillRect(getWidth() / 2 - 500, ((getHeight() / 10) * (i + 1)) + (i * 10), 1000, 100); } //remember to add auto text removal for the current mode in the future g.setColor(Color.BLACK); g.drawString("Uninterpolated data", getWidth() / 2 - 480, (getHeight() / 10) + 70); g.drawString("derivative data", getWidth() / 2 - 480, (getHeight() / 10 * 2) + 90); g.drawString("add servo to pin 12", getWidth() / 2 - 480, (getHeight() / 10 * 3) + 100); g.drawString("switch input method (audio/serial)", getWidth() / 2 - 480, (getHeight() / 10 * 4) + 110); g.drawString("change colour scheme", getWidth() / 2 - 480, (getHeight() / 10 * 5) + 120); g.drawString("Reconnect arduino", getWidth() / 2 - 480, (getHeight() / 10 * 6) + 130); } }
[ "" ]
c2dc4e88a2545ffe7d5b5a0c5e3a2c0e2d8e2784
499c691b574ae3b89afa4e490b940e5108900c8f
/src/test/jp/ac/uryukyu/ie/e185703/EnemyTest.java
65d585c702fc7d41e81c45b3d751e55f9c28b4fa
[]
no_license
pine0619/Report3
a1f57726aba498a0122d4a2f5e96c4fcfb12c94b
d6826da0f550f4fd4e0a2de3fef0e572308aaf21
refs/heads/master
2020-04-03T19:10:47.877722
2018-11-10T00:52:50
2018-11-10T00:52:50
155,513,253
0
0
null
null
null
null
UTF-8
Java
false
false
63
java
package jp.ac.uryukyu.ie.e185703; public class EnemyTest { }
[ "e185703@ie.u-ryukyu.ac.jp" ]
e185703@ie.u-ryukyu.ac.jp
3ca469f8cc0056a81cd467028f9692d9bfef85b2
1b38a3a2454f878a8f29d455a0c1c8e35230d3a4
/salsa-core-pom/salsa-pioneer/src/main/java/at/ac/tuwien/dsg/cloud/salsa/pioneer/instruments/ArtifactConfigurationInterface.java
9047a63cd7ae82fd8071787a5f87d15a43772786
[ "Apache-2.0" ]
permissive
anhtuan98/SALSA
0a9865702a50e1366c30a768cce9c7bdd72c74b2
fd0b5d786cba087accae72e6ce5aab70898de687
refs/heads/master
2021-01-11T08:21:32.314532
2016-06-28T14:32:32
2016-06-28T14:32:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,729
java
/* * Copyright (c) 2013 Technische Universitat Wien (TUW), Distributed Systems Group. http://dsg.tuwien.ac.at * * This work was partially supported by the European Commission in terms of the CELAR FP7 project (FP7-ICT-2011-8 #317790), http://www.celarcloud.eu/ * * 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 at.ac.tuwien.dsg.cloud.salsa.pioneer.instruments; import at.ac.tuwien.dsg.cloud.salsa.messaging.model.Salsa.SalsaMsgConfigureArtifact; import at.ac.tuwien.dsg.cloud.salsa.messaging.model.Salsa.SalsaMsgConfigureState; public interface ArtifactConfigurationInterface { /** * Configure an artifact * * @param configInfo The configuration info * @return The state of the configuration either successful or error */ public SalsaMsgConfigureState configureArtifact(SalsaMsgConfigureArtifact configInfo); /** * Define how to get status of a running instance. E.g, with system service-based, state can be get via "system serviceName status" * * @param configInfo The info of the instance * @return A custom description of the status */ public String getStatus(SalsaMsgConfigureArtifact configInfo); }
[ "d.le@dsg.tuwien.ac.at" ]
d.le@dsg.tuwien.ac.at
dcb9fcc40fb8fcc647d0e5fcdc633580ad8a1ce0
9ac0b9ae36538bec2f97f2ce194fd4ec51fae745
/app/src/main/java/a/a/b/c.java
3eb1a6df6ec6debfdf88a27b6f028cda0f9c34f9
[]
no_license
siyamkhan/HomeAutomaation
f7fceefb9d59f55f4c268d65501affa5e2d148e1
114945fd602cbed1bf4b857dd184abb62b40f851
refs/heads/master
2020-09-01T18:32:21.695359
2019-11-01T19:27:34
2019-11-01T19:27:34
219,026,745
0
0
null
null
null
null
UTF-8
Java
false
false
2,434
java
package a.a.a.a.a.b; import a.a.a.a.a.f.c; import a.a.a.a.a.f.d; import a.a.a.a.c; import a.a.a.a.l; import android.annotation.SuppressLint; import android.content.Context; import android.text.TextUtils; class c { private final Context a; private final c b; public c(Context paramContext) { this.a = paramContext.getApplicationContext(); this.b = new d(paramContext, "TwitterAdvertisingInfoPreferences"); } private void a(b paramb) { (new Thread(new h(this, paramb) { public void a() { b b1 = c.a(this.b); if (!this.a.equals(b1)) { c.g().a("Fabric", "Asychronously getting Advertising Info and storing it to preferences"); c.a(this.b, b1); } } })).start(); } @SuppressLint({"CommitPrefEdits"}) private void b(b paramb) { if (c(paramb)) { c c2 = this.b; c2.a(c2.b().putString("advertising_id", paramb.a).putBoolean("limit_ad_tracking_enabled", paramb.b)); return; } c c1 = this.b; c1.a(c1.b().remove("advertising_id").remove("limit_ad_tracking_enabled")); } private boolean c(b paramb) { return (paramb != null && !TextUtils.isEmpty(paramb.a)); } private b e() { String str2; String str1; l l; b b1 = c().a(); if (!c(b1)) { b1 = d().a(); if (!c(b1)) { l = c.g(); str1 = "Fabric"; str2 = "AdvertisingInfo not present"; } else { l = c.g(); str1 = "Fabric"; str2 = "Using AdvertisingInfo from Service Provider"; } } else { l = c.g(); str1 = "Fabric"; str2 = "Using AdvertisingInfo from Reflection Provider"; } l.a(str1, str2); return b1; } public b a() { b b1 = b(); if (c(b1)) { c.g().a("Fabric", "Using AdvertisingInfo from Preference Store"); a(b1); return b1; } b b2 = e(); b(b2); return b2; } protected b b() { return new b(this.b.a().getString("advertising_id", ""), this.b.a().getBoolean("limit_ad_tracking_enabled", false)); } public f c() { return new d(this.a); } public f d() { return new e(this.a); } } /* Location: C:\Users\Siyam\Desktop\Home automation with java source files\Decompile tools\New folder\dex2jar-0.0.9.15-master\classes_dex2jar.jar!\a\a\a\a\a\b\c.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.0.7 */
[ "siyamk756@gmail.com" ]
siyamk756@gmail.com
1e54fef07289f1e37d8f483908d4708fa200103d
74b47b895b2f739612371f871c7f940502e7165b
/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/UpdateWorkflowResult.java
1ff0872866500885e41265046e9692cb700b5d9d
[ "Apache-2.0" ]
permissive
baganda07/aws-sdk-java
fe1958ed679cd95b4c48f971393bf03eb5512799
f19bdb30177106b5d6394223a40a382b87adf742
refs/heads/master
2022-11-09T21:55:43.857201
2022-10-24T21:08:19
2022-10-24T21:08:19
221,028,223
0
0
Apache-2.0
2019-11-11T16:57:12
2019-11-11T16:57:11
null
UTF-8
Java
false
false
3,736
java
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.glue.model; import java.io.Serializable; import javax.annotation.Generated; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/glue-2017-03-31/UpdateWorkflow" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class UpdateWorkflowResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable { /** * <p> * The name of the workflow which was specified in input. * </p> */ private String name; /** * <p> * The name of the workflow which was specified in input. * </p> * * @param name * The name of the workflow which was specified in input. */ public void setName(String name) { this.name = name; } /** * <p> * The name of the workflow which was specified in input. * </p> * * @return The name of the workflow which was specified in input. */ public String getName() { return this.name; } /** * <p> * The name of the workflow which was specified in input. * </p> * * @param name * The name of the workflow which was specified in input. * @return Returns a reference to this object so that method calls can be chained together. */ public UpdateWorkflowResult withName(String name) { setName(name); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getName() != null) sb.append("Name: ").append(getName()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof UpdateWorkflowResult == false) return false; UpdateWorkflowResult other = (UpdateWorkflowResult) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); return hashCode; } @Override public UpdateWorkflowResult clone() { try { return (UpdateWorkflowResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
[ "" ]
84c394462c725bb0345500340c90ed6316bc2204
f794a90792a55ae244d6166e2887b7bc96d8f46a
/app/src/main/java/ru/max314/wwwnanohttp/MainActivity.java
09aa5a3eeb508c4673297c79bf7b3a0381945cdf
[]
no_license
max314/wwwnanohttp
e7985bd11c15825e631d6914f5d2ef689b43c1aa
eb3f16a02c3c6b42cbd9160482ae3843f07a9aa0
refs/heads/master
2021-01-10T07:19:34.599933
2015-11-23T04:38:35
2015-11-23T04:38:35
45,819,357
0
0
null
null
null
null
UTF-8
Java
false
false
3,881
java
package ru.max314.wwwnanohttp; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.webkit.WebView; import java.io.IOException; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.util.Enumeration; import java.util.logging.Level; import java.util.logging.Logger; import fi.iki.elonen.NanoHTTPD; import ru.max314.Torque.TorqueHelper; import ru.max314.util.LogHelper; public class MainActivity extends AppCompatActivity { private static final LogHelper LOG = new LogHelper(MainActivity.class); TorqueHelper torqueHelper = new TorqueHelper(this); //HTTPServer httpServer = new HTTPServer(); WebView webView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); webView = (WebView) this.findViewById(R.id.webView); } public void startClick(View view) { torqueHelper.start(); // try { // httpServer.start(); // } catch (IOException e) { // e.printStackTrace(); // } LOG.d("Started"); } @Override protected void onPause() { super.onPause(); torqueHelper.stop(); // httpServer.stop(); } public void testClick(View view) { torqueHelper.refresh(); } public void webClick(View view) { webView.loadUrl("http::/localhost:8080/"); } public void startService(View view) { Intent i= new Intent(this, MyServiceTest.class); i.putExtra("KEY1", "Value to be used by the service"); this.startService(i); } public void stopService(View view) { Intent i= new Intent(this, MyServiceTest.class); i.putExtra(MyServiceTest.c_COMMAND, MyServiceTest.c_STOP); this.startService(i); } public void refreshService(View view) { Intent i= new Intent(this, MyServiceTest.class); i.putExtra(MyServiceTest.c_COMMAND, MyServiceTest.c_REFRESH); this.startService(i); } public void startTQService(View view) { Intent intent = new Intent(); intent.setClassName("org.prowl.torque", "org.prowl.torque.remote.TorqueService"); this.startService(intent); } public void getNewtwok(View view) { try { String buff = getNetwork(); webView.loadData(buff,"text/html", "UTF-8"); LOG.d("Network"); LOG.d(buff); } catch (SocketException e) { e.printStackTrace(); } } private String getNetwork() throws SocketException { StringBuilder sb = new StringBuilder(); // Iterate over all network interfaces. for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) { NetworkInterface intf = en.nextElement(); sb.append(String.format("{%s}\n<br>",intf.toString())); // Iterate over all IP addresses in each network interface. for (Enumeration<InetAddress> enumIPAddr = intf.getInetAddresses(); enumIPAddr.hasMoreElements();) { InetAddress iNetAddress = enumIPAddr.nextElement(); // Loop back address (127.0.0.1) doesn't count as an in-use // IP address. if (!iNetAddress.isLoopbackAddress()) { String sLocalIP = iNetAddress.getHostAddress().toString(); String sInterfaceName = intf.getName(); sb.append(String.format("{%s}:{%s}\n<br>",sInterfaceName,sLocalIP)); } } } return sb.toString(); } }
[ "max314@mail.ru" ]
max314@mail.ru
835b9383b228b33d38ed14bcded279d6bf45cfb9
2c319d505e8f6a21708be831e9b5426aaa86d61e
/base/lang/src/test/java/leap/lang/csv/CSVLexerTest.java
42384a957a5fd184d6af43e9ff416eca620a0dd0
[ "Apache-2.0", "MIT", "BSD-3-Clause" ]
permissive
leapframework/framework
ed0584a1468288b3a6af83c1923fad2fd228a952
0703acbc0e246519ee50aa9957f68d931fab10c5
refs/heads/dev
2023-08-17T02:14:02.236354
2023-08-01T09:39:07
2023-08-01T09:39:07
48,562,236
47
23
Apache-2.0
2022-12-14T20:36:57
2015-12-25T01:54:52
Java
UTF-8
Java
false
false
19,305
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 leap.lang.csv; import static leap.lang.csv.Constants.BACKSPACE; import static leap.lang.csv.Constants.CR; import static leap.lang.csv.Constants.FF; import static leap.lang.csv.Constants.LF; import static leap.lang.csv.Constants.TAB; import static leap.lang.csv.Token.Type.COMMENT; import static leap.lang.csv.Token.Type.EOF; import static leap.lang.csv.Token.Type.EORECORD; import static leap.lang.csv.Token.Type.TOKEN; import static leap.lang.csv.TokenMatchers.hasContent; import static leap.lang.csv.TokenMatchers.matches; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import java.io.IOException; import java.io.StringReader; import leap.lang.csv.CSVFormat; import leap.lang.csv.ExtendedBufferedReader; import leap.lang.csv.Lexer; import leap.lang.csv.Token; import org.junit.Before; import org.junit.Test; /** * * * @version $Id: CSVLexerTest.java 1511462 2013-08-07 20:00:26Z ggregory $ */ public class CSVLexerTest { private CSVFormat formatWithEscaping; @Before public void setUp() { formatWithEscaping = CSVFormat.DEFAULT.withEscape('\\'); } private Lexer getLexer(final String input, final CSVFormat format) { return new Lexer(format, new ExtendedBufferedReader(new StringReader(input))); } @Test public void testSurroundingSpacesAreDeleted() throws IOException { final String code = "noSpaces, leadingSpaces,trailingSpaces , surroundingSpaces , ,,"; final Lexer parser = getLexer(code, CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true)); assertThat(parser.nextToken(new Token()), matches(TOKEN, "noSpaces")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "leadingSpaces")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "trailingSpaces")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "surroundingSpaces")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "")); assertThat(parser.nextToken(new Token()), matches(EOF, "")); } @Test public void testSurroundingTabsAreDeleted() throws IOException { final String code = "noTabs,\tleadingTab,trailingTab\t,\tsurroundingTabs\t,\t\t,,"; final Lexer parser = getLexer(code, CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true)); assertThat(parser.nextToken(new Token()), matches(TOKEN, "noTabs")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "leadingTab")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "trailingTab")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "surroundingTabs")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "")); assertThat(parser.nextToken(new Token()), matches(EOF, "")); } @Test public void testIgnoreEmptyLines() throws IOException { final String code = "first,line,\n"+ "\n"+ "\n"+ "second,line\n"+ "\n"+ "\n"+ "third line \n"+ "\n"+ "\n"+ "last, line \n"+ "\n"+ "\n"+ "\n"; final CSVFormat format = CSVFormat.DEFAULT.withIgnoreEmptyLines(true); final Lexer parser = getLexer(code, format); assertThat(parser.nextToken(new Token()), matches(TOKEN, "first")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "line")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "second")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "line")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "third line ")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "last")); assertThat(parser.nextToken(new Token()), matches(EORECORD, " line ")); assertThat(parser.nextToken(new Token()), matches(EOF, "")); assertThat(parser.nextToken(new Token()), matches(EOF, "")); } @Test public void testComments() throws IOException { final String code = "first,line,\n"+ "second,line,tokenWith#no-comment\n"+ "# comment line \n"+ "third,line,#no-comment\n"+ "# penultimate comment\n"+ "# Final comment\n"; final CSVFormat format = CSVFormat.DEFAULT.withCommentStart('#'); final Lexer parser = getLexer(code, format); assertThat(parser.nextToken(new Token()), matches(TOKEN, "first")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "line")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "second")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "line")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "tokenWith#no-comment")); assertThat(parser.nextToken(new Token()), matches(COMMENT, "comment line")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "third")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "line")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "#no-comment")); assertThat(parser.nextToken(new Token()), matches(COMMENT, "penultimate comment")); assertThat(parser.nextToken(new Token()), matches(COMMENT, "Final comment")); assertThat(parser.nextToken(new Token()), matches(EOF, "")); assertThat(parser.nextToken(new Token()), matches(EOF, "")); } @Test public void testCommentsAndEmptyLines() throws IOException { final String code = "1,2,3,\n"+ // 1 "\n"+ // 1b "\n"+ // 1c "a,b x,c#no-comment\n"+ // 2 "#foo\n"+ // 3 "\n"+ // 4 "\n"+ // 4b "d,e,#no-comment\n"+ // 5 "\n"+ // 5b "\n"+ // 5c "# penultimate comment\n"+ // 6 "\n"+ // 6b "\n"+ // 6c "# Final comment\n"; // 7 final CSVFormat format = CSVFormat.DEFAULT.withCommentStart('#').withIgnoreEmptyLines(false); assertFalse("Should not ignore empty lines", format.getIgnoreEmptyLines()); final Lexer parser = getLexer(code, format); assertThat(parser.nextToken(new Token()), matches(TOKEN, "1")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "2")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "3")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "")); // 1 assertThat(parser.nextToken(new Token()), matches(EORECORD, "")); // 1b assertThat(parser.nextToken(new Token()), matches(EORECORD, "")); // 1c assertThat(parser.nextToken(new Token()), matches(TOKEN, "a")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "b x")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "c#no-comment")); // 2 assertThat(parser.nextToken(new Token()), matches(COMMENT, "foo")); // 3 assertThat(parser.nextToken(new Token()), matches(EORECORD, "")); // 4 assertThat(parser.nextToken(new Token()), matches(EORECORD, "")); // 4b assertThat(parser.nextToken(new Token()), matches(TOKEN, "d")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "e")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "#no-comment")); // 5 assertThat(parser.nextToken(new Token()), matches(EORECORD, "")); // 5b assertThat(parser.nextToken(new Token()), matches(EORECORD, "")); // 5c assertThat(parser.nextToken(new Token()), matches(COMMENT, "penultimate comment")); // 6 assertThat(parser.nextToken(new Token()), matches(EORECORD, "")); // 6b assertThat(parser.nextToken(new Token()), matches(EORECORD, "")); // 6c assertThat(parser.nextToken(new Token()), matches(COMMENT, "Final comment")); // 7 assertThat(parser.nextToken(new Token()), matches(EOF, "")); assertThat(parser.nextToken(new Token()), matches(EOF, "")); } // simple token with escaping not enabled @Test public void testBackslashWithoutEscaping() throws IOException { /* file: a,\,,b * \,, */ final String code = "a,\\,,b\\\n\\,,"; final CSVFormat format = CSVFormat.DEFAULT; assertFalse(format.isEscaping()); final Lexer parser = getLexer(code, format); assertThat(parser.nextToken(new Token()), matches(TOKEN, "a")); // an unquoted single backslash is not an escape char assertThat(parser.nextToken(new Token()), matches(TOKEN, "\\")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "b\\")); // an unquoted single backslash is not an escape char assertThat(parser.nextToken(new Token()), matches(TOKEN, "\\")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "")); assertThat(parser.nextToken(new Token()), matches(EOF, "")); } // simple token with escaping enabled @Test public void testBackslashWithEscaping() throws IOException { /* file: a,\,,b * \,, */ final String code = "a,\\,,b\\\\\n\\,,\\\nc,d\\\r\ne"; final CSVFormat format = formatWithEscaping.withIgnoreEmptyLines(false); assertTrue(format.isEscaping()); final Lexer parser = getLexer(code, format); assertThat(parser.nextToken(new Token()), matches(TOKEN, "a")); assertThat(parser.nextToken(new Token()), matches(TOKEN, ",")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "b\\")); assertThat(parser.nextToken(new Token()), matches(TOKEN, ",")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "\nc")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "d\r")); assertThat(parser.nextToken(new Token()), matches(EOF, "e")); } // encapsulator tokenizer (single line) @Test public void testNextToken4() throws IOException { /* file: a,"foo",b * a, " foo",b * a,"foo " ,b // whitespace after closing encapsulator * a, " foo " ,b */ final String code = "a,\"foo\",b\na, \" foo\",b\na,\"foo \" ,b\na, \" foo \" ,b"; final Lexer parser = getLexer(code, CSVFormat.DEFAULT.withIgnoreSurroundingSpaces(true)); assertThat(parser.nextToken(new Token()), matches(TOKEN, "a")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "foo")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "b")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "a")); assertThat(parser.nextToken(new Token()), matches(TOKEN, " foo")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "b")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "a")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "foo ")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "b")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "a")); assertThat(parser.nextToken(new Token()), matches(TOKEN, " foo ")); // assertTokenEquals(EORECORD, "b", parser.nextToken(new Token())); assertThat(parser.nextToken(new Token()), matches(EOF, "b")); } // encapsulator tokenizer (multi line, delimiter in string) @Test public void testNextToken5() throws IOException { final String code = "a,\"foo\n\",b\n\"foo\n baar ,,,\"\n\"\n\t \n\""; final Lexer parser = getLexer(code, CSVFormat.DEFAULT); assertThat(parser.nextToken(new Token()), matches(TOKEN, "a")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "foo\n")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "b")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "foo\n baar ,,,")); assertThat(parser.nextToken(new Token()), matches(EOF, "\n\t \n")); } // change delimiters, comment, encapsulater @Test public void testNextToken6() throws IOException { /* file: a;'b and \' more * ' * !comment;;;; * ;; */ final String code = "a;'b and '' more\n'\n!comment;;;;\n;;"; final CSVFormat format = CSVFormat.DEFAULT.withQuoteChar('\'').withCommentStart('!').withDelimiter(';'); final Lexer parser = getLexer(code, format); assertThat(parser.nextToken(new Token()), matches(TOKEN, "a")); assertThat(parser.nextToken(new Token()), matches(EORECORD, "b and ' more\n")); } // From CSV-1 @Test public void testDelimiterIsWhitespace() throws IOException { final String code = "one\ttwo\t\tfour \t five\t six"; final Lexer parser = getLexer(code, CSVFormat.TDF); assertThat(parser.nextToken(new Token()), matches(TOKEN, "one")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "two")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "four")); assertThat(parser.nextToken(new Token()), matches(TOKEN, "five")); assertThat(parser.nextToken(new Token()), matches(EOF, "six")); } @Test public void testEscapedCR() throws Exception { final Lexer lexer = getLexer("character\\" + CR + "Escaped", formatWithEscaping); assertThat(lexer.nextToken(new Token()), hasContent("character" + CR + "Escaped")); } @Test public void testCR() throws Exception { final Lexer lexer = getLexer("character" + CR + "NotEscaped", formatWithEscaping); assertThat(lexer.nextToken(new Token()), hasContent("character")); assertThat(lexer.nextToken(new Token()), hasContent("NotEscaped")); } @Test public void testEscapedLF() throws Exception { final Lexer lexer = getLexer("character\\" + LF + "Escaped", formatWithEscaping); assertThat(lexer.nextToken(new Token()), hasContent("character" + LF + "Escaped")); } @Test public void testLF() throws Exception { final Lexer lexer = getLexer("character" + LF + "NotEscaped", formatWithEscaping); assertThat(lexer.nextToken(new Token()), hasContent("character")); assertThat(lexer.nextToken(new Token()), hasContent("NotEscaped")); } @Test // TODO is this correct? Do we expect <esc>TAB to be unescaped? public void testEscapedTab() throws Exception { final Lexer lexer = getLexer("character\\" + TAB + "Escaped", formatWithEscaping); assertThat(lexer.nextToken(new Token()), hasContent("character" + TAB + "Escaped")); } @Test public void testTab() throws Exception { final Lexer lexer = getLexer("character" + TAB + "NotEscaped", formatWithEscaping); assertThat(lexer.nextToken(new Token()), hasContent("character" + TAB + "NotEscaped")); } @Test // TODO is this correct? Do we expect <esc>BACKSPACE to be unescaped? public void testEscapedBackspace() throws Exception { final Lexer lexer = getLexer("character\\" + BACKSPACE + "Escaped", formatWithEscaping); assertThat(lexer.nextToken(new Token()), hasContent("character" + BACKSPACE + "Escaped")); } @Test public void testBackspace() throws Exception { final Lexer lexer = getLexer("character" + BACKSPACE + "NotEscaped", formatWithEscaping); assertThat(lexer.nextToken(new Token()), hasContent("character" + BACKSPACE + "NotEscaped")); } @Test // TODO is this correct? Do we expect <esc>FF to be unescaped? public void testEscapedFF() throws Exception { final Lexer lexer = getLexer("character\\" + FF + "Escaped", formatWithEscaping); assertThat(lexer.nextToken(new Token()), hasContent("character" + FF + "Escaped")); } @Test public void testFF() throws Exception { final Lexer lexer = getLexer("character" + FF + "NotEscaped", formatWithEscaping); assertThat(lexer.nextToken(new Token()), hasContent("character" + FF + "NotEscaped")); } @Test public void testEscapedMySqlNullValue() throws Exception { // MySQL uses \N to symbolize null values. We have to restore this final Lexer lexer = getLexer("character\\NEscaped", formatWithEscaping); assertThat(lexer.nextToken(new Token()), hasContent("character\\NEscaped")); } @Test public void testEscapedCharacter() throws Exception { final Lexer lexer = getLexer("character\\aEscaped", formatWithEscaping); assertThat(lexer.nextToken(new Token()), hasContent("character\\aEscaped")); } @Test public void testEscapedControlCharacter() throws Exception { // we are explicitly using an escape different from \ here final Lexer lexer = getLexer("character!rEscaped", CSVFormat.DEFAULT.withEscape('!')); assertThat(lexer.nextToken(new Token()), hasContent("character" + CR + "Escaped")); } @Test public void testEscapedControlCharacter2() throws Exception { final Lexer lexer = getLexer("character\\rEscaped", CSVFormat.DEFAULT.withEscape('\\')); assertThat(lexer.nextToken(new Token()), hasContent("character" + CR + "Escaped")); } @Test(expected = IOException.class) public void testEscapingAtEOF() throws Exception { final String code = "escaping at EOF is evil\\"; final Lexer lexer = getLexer(code, formatWithEscaping); lexer.nextToken(new Token()); } }
[ "live.evan@gmail.com" ]
live.evan@gmail.com
21d0e80c9d68ac1f1a99b9f0a8cda255d8618a25
c25d6df96ac47b0b99f5f6f06d1754f418982576
/enderio-machines/src/main/java/crazypants/enderio/machines/machine/teleport/telepad/gui/IDialingDeviceRemoteExec.java
6e5cca6d9c7dbf7ad587c3ee5170cb0d82b58087
[ "Unlicense", "CC-BY-NC-3.0", "CC0-1.0", "CC-BY-3.0", "LicenseRef-scancode-public-domain" ]
permissive
HenryLoenwind/EnderIO
243183bffdef65134d8aeda5c756bc68977f32f5
ec8b521f3065fbf7dbe12e17813ccbdd1762f0ae
refs/heads/master
2021-05-25T12:09:28.460330
2020-05-30T15:48:23
2020-05-30T15:48:23
30,419,947
0
0
Unlicense
2020-06-01T06:26:12
2015-02-06T15:55:10
Java
UTF-8
Java
false
false
1,061
java
package crazypants.enderio.machines.machine.teleport.telepad.gui; import javax.annotation.Nonnull; import crazypants.enderio.base.network.GuiPacket; import crazypants.enderio.base.network.IRemoteExec; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; public interface IDialingDeviceRemoteExec { static final int ID_DO_TELEPORT = 0; public interface GUI extends IRemoteExec.IGui { default void doTeleport(@Nonnull BlockPos telepad, int targetID, boolean initiateTeleport) { GuiPacket.send(this, ID_DO_TELEPORT, targetID, initiateTeleport, telepad); } } public interface Container extends IRemoteExec.IContainer { IMessage doTeleport(@Nonnull BlockPos telepad, int targetID, boolean initiateTeleport); @Override default IMessage networkExec(int id, @Nonnull GuiPacket message) { if (id == ID_DO_TELEPORT) { return doTeleport(BlockPos.fromLong(message.getLong(2)), message.getInt(0), message.getBoolean(1)); } return null; } } }
[ "henry@loenwind.info" ]
henry@loenwind.info
b79f71fa64f154b9e091287e32fc814056ea49b5
60ed978a5c984d0246c1db3e3171d8398d579e39
/src/Bean.java
001b009649b1e57010804dfaab808a0a65ab04f6
[]
no_license
DinoDafor/Lab3pip
c817f5f26c0f24b139a7faffa7afd4dd09e57b12
615cd3d7df600f28ae9480ba7b2a8333b0f5fa39
refs/heads/master
2020-09-27T16:54:11.768883
2020-05-14T14:17:50
2020-05-14T14:17:50
226,562,570
0
1
null
null
null
null
UTF-8
Java
false
false
5,208
java
import javax.faces.bean.ApplicationScoped; import javax.faces.bean.ManagedBean; import java.io.Serializable; import java.sql.*; import java.util.ArrayList; import java.util.List; @ManagedBean(name = "Bean", eager = true) @ApplicationScoped public class Bean implements Serializable { private String url = "jdbc:postgresql://pg:5432/studs";//Записываем url, в конце имя DB private String nameOfAdmin = "s263895";//Name private String pass = "vcf781";//Пароль private double x = 0; private double y = 0; private double r = 0; private boolean r1 = true; //Сделал true, чтобы при первой загрузке был выбран private boolean r2 = false; private boolean r3 = false; private boolean r4 = false; private boolean r5 = false; private boolean fromCanvas = false; List<Dot> list = new ArrayList<Dot>(); public List<Dot> getList() throws SQLException, ClassNotFoundException { return getDotList(); } public void setList(List<Dot> list) throws SQLException, ClassNotFoundException { this.list = getDotList(); } public boolean isFromCanvas() { return fromCanvas; } public void setFromCanvas(boolean fromCanvas) { this.fromCanvas = fromCanvas; } public boolean isR1() { return r1; } public void setR1(boolean r1) { this.r1 = r1; } public boolean isR2() { return r2; } public void setR2(boolean r2) { this.r2 = r2; } public boolean isR3() { return r3; } public void setR3(boolean r3) { this.r3 = r3; } public boolean isR4() { return r4; } public void setR4(boolean r4) { this.r4 = r4; } public boolean isR5() { return r5; } public void setR5(boolean r5) { this.r5 = r5; } public double getX() { return x; } public double getY() { return y; } public double getR() { return r; } // public String getR(){ // return r; // } private void setRFromBoolean() { if (r1) r = 1; if (r2) r = 1.5; if (r3) r = 2; if (r4) r = 2.5; if (r5) r = 3; } public void setX(double x) { if (fromCanvas) { this.x = x; } else this.x = x / 10; fromCanvas=false; } public void setY(double y) { this.y = y; } public void setR(double r) { this.r = r; r1=false; r2=false; r3=false; r4=false; r5=false; } Connection connection; public Connection getConnection() { try { Class.forName("org.postgresql.Driver"); //Подключаем драйвер System.out.println("Драйвер загружен!");//Выводим сообщение connection = DriverManager.getConnection(url, nameOfAdmin, pass);//Устанавливаем соединение System.out.println("Соединение успешно установлено! ");//Сообщение о подключении } catch (Exception e) { e.printStackTrace(); //Выводим стректрейс ошибки System.out.println("Cannot connect to database!"); } return connection; } public List<Dot> getDotList() throws ClassNotFoundException, SQLException { Connection c = getConnection(); list = new ArrayList<Dot>(); //Коллекция для хранения точек, нужна для извлечения данных из DB PreparedStatement st = c.prepareStatement("select x, y, r, inArea from studs"); ResultSet rs = st.executeQuery(); while (rs.next()) { Dot d = new Dot(rs.getDouble("x"), rs.getDouble("y"), rs.getDouble("r"), rs.getBoolean("inArea")); list.add(d); } rs.close(); st.close(); c.close(); return list; } public String addToList() { setRFromBoolean(); //Устанавливаем R изходя из boolean значений x = Math.round(x * 100) / 100.0; //Округляем y = Math.round(y * 100) / 100.0; r = Math.round(r * 100) / 100.0; try { connection = getConnection(); System.out.println(x + " " + y + " " + r); PreparedStatement st = connection.prepareStatement("INSERT INTO studs values(?, ?, ?, ?)"); st.setDouble(1, x); st.setDouble(2, y); st.setDouble(3, r); st.setBoolean(4, Dot.check(x, y, r)); st.executeUpdate(); st.close(); connection.close(); } catch (Exception e) { System.out.println(e); }// todo это переход на начальную? зачем? return "application.xhtml?faces-redirect=true"; } public String toIndex() { return "index.xhtml?faces-redirect=true"; } public String toTable() { return "application.xhtml?faces-redirect=true"; } }
[ "dinodafor@mail.ru" ]
dinodafor@mail.ru
984a0b11f85424b98d88d1da097dfe8eab92172c
7cb605131e1a16ff7dc01be981fa52c00cbd2dc1
/hw1/synthesizer/AbstractBoundedQueue.java
bc02c551f86cdc2686e0af017e211c201ab59108
[]
no_license
gioon/cs61b
6109ccec692e4c5a8486db2e0c6cf8f76d2984ae
3d665e5ec21e81c1c8d7c11fa70bbd113852328c
refs/heads/master
2023-06-25T19:21:14.796680
2021-07-29T17:39:15
2021-07-29T17:39:15
340,641,013
0
0
null
null
null
null
UTF-8
Java
false
false
278
java
package synthesizer; public abstract class AbstractBoundedQueue<T> implements BoundedQueue<T> { protected int fillCount; protected int capacity; public int capacity() { return capacity; } public int fillCount() { return fillCount; } }
[ "gioon@foxmail.com" ]
gioon@foxmail.com
b0f34558b5b3b2e5c4ed5f588482f7b4e15e172c
1719da83896537005fba7214b294cc76a3d5e667
/src/vo/MemberVO.java
f1b622dc236756fa030187382eaadb3d56f2d4e1
[]
no_license
samgo222/Member
7bdb0fd96be2ce540b1903092844dc1a354ce011
e4b72e0d5681965c919e171477a8a02516ec18f0
refs/heads/master
2021-01-10T03:56:05.483741
2015-10-06T05:54:12
2015-10-06T05:54:12
43,732,461
0
0
null
null
null
null
UTF-8
Java
false
false
865
java
package vo; public class MemberVO { private String id; private String name; private String tel; private String add; public MemberVO(String id, String name, String tel, String add) { this.setId(id); this.setName(name); this.setTel(tel); this.setAdd(add); } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getTel() { return tel; } public void setTel(String tel) { this.tel = tel; } public String getAdd() { return add; } public void setAdd(String add) { this.add = add; } public String toString() { return "MemberVO [id=" + id + ", name=" + name + ", tel=" + tel + ", add=" + add + "]"; } }
[ "bit-user@bit" ]
bit-user@bit
595c878585b0b60632c7b7f387a441110179cc1b
2cae38112ac5683460c533539de17775f2da6553
/src/test/java/com/alibaba/druid/bvt/sql/sqlserver/SQLServerInsertTest8.java
ac271c520fba258bb947315b38f285fe461cea0e
[ "Apache-2.0" ]
permissive
z7658329/druid1.0.29
93b58335ad6c20ac2fb1e50e3ed2be52064ac515
aab2e03d61b56ae943ffdd1836c9c9cb76ece6ac
refs/heads/master
2021-01-22T21:22:18.787260
2017-03-18T16:44:47
2017-03-18T16:44:47
85,416,411
0
0
null
null
null
null
UTF-8
Java
false
false
4,224
java
/* * Copyright 1999-2017 Alibaba Group Holding Ltd. * * 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.alibaba.druid.bvt.sql.sqlserver; import java.util.List; import junit.framework.TestCase; import org.junit.Assert; import com.alibaba.druid.sql.SQLUtils; import com.alibaba.druid.sql.ast.SQLStatement; import com.alibaba.druid.sql.dialect.sqlserver.ast.stmt.SQLServerInsertStatement; import com.alibaba.druid.sql.dialect.sqlserver.parser.SQLServerStatementParser; import com.alibaba.druid.sql.dialect.sqlserver.visitor.SQLServerSchemaStatVisitor; public class SQLServerInsertTest8 extends TestCase { public void test_0() throws Exception { String sql = "INSERT Production.ScrapReason OUTPUT INSERTED.ScrapReasonID, INSERTED.Name, INSERTED.ModifiedDate INTO @MyTableVar VALUES (N'Operator error', GETDATE());"; SQLServerStatementParser parser = new SQLServerStatementParser(sql); parser.setParseCompleteValues(false); parser.setParseValuesSize(3); List<SQLStatement> statementList = parser.parseStatementList(); SQLStatement stmt = statementList.get(0); SQLServerInsertStatement insertStmt = (SQLServerInsertStatement) stmt; Assert.assertEquals(1, insertStmt.getValuesList().size()); Assert.assertEquals(2, insertStmt.getValues().getValues().size()); Assert.assertEquals(0, insertStmt.getColumns().size()); Assert.assertEquals(1, statementList.size()); SQLServerSchemaStatVisitor visitor = new SQLServerSchemaStatVisitor(); stmt.accept(visitor); String formatSql = "INSERT INTO Production.ScrapReason"// + "\nOUTPUT INSERTED.ScrapReasonID, INSERTED.Name, INSERTED.ModifiedDate"// + "\n\tINTO @MyTableVar"// + "\nVALUES (N'Operator error', GETDATE())"; Assert.assertEquals(formatSql, SQLUtils.toSQLServerString(insertStmt)); } public void test_1() throws Exception { String sql = "INSERT TOP(5)INTO dbo.EmployeeSales OUTPUT inserted.EmployeeID, inserted.FirstName, inserted.LastName, inserted.YearlySales SELECT sp.BusinessEntityID, c.LastName, c.FirstName, sp.SalesYTD FROM Sales.SalesPerson AS sp INNER JOIN Person.Person AS c ON sp.BusinessEntityID = c.BusinessEntityID WHERE sp.SalesYTD > 250000.00 ORDER BY sp.SalesYTD DESC;"; SQLServerStatementParser parser = new SQLServerStatementParser(sql); parser.setParseCompleteValues(false); parser.setParseValuesSize(3); List<SQLStatement> statementList = parser.parseStatementList(); SQLStatement stmt = statementList.get(0); SQLServerInsertStatement insertStmt = (SQLServerInsertStatement) stmt; Assert.assertEquals(0, insertStmt.getValuesList().size()); Assert.assertEquals(0, insertStmt.getColumns().size()); Assert.assertEquals(1, statementList.size()); SQLServerSchemaStatVisitor visitor = new SQLServerSchemaStatVisitor(); stmt.accept(visitor); String formatSql = "INSERT TOP (5) INTO dbo.EmployeeSales"// + "\nOUTPUT inserted.EmployeeID, inserted.FirstName, inserted.LastName, inserted.YearlySales"// + "\nSELECT sp.BusinessEntityID, c.LastName, c.FirstName, sp.SalesYTD"// + "\nFROM Sales.SalesPerson sp"// + "\nINNER JOIN Person.Person c ON sp.BusinessEntityID = c.BusinessEntityID"// + "\nWHERE sp.SalesYTD > 250000.00"// + "\nORDER BY sp.SalesYTD DESC"; Assert.assertEquals(formatSql, SQLUtils.toSQLServerString(insertStmt)); } }
[ "1043706593@qq.com" ]
1043706593@qq.com
81205e3e4ec5461666c89598a5cc1cce135328c5
6b60c75f280b8823bbf5340d5167ab4a7ad7e2a0
/src/main/java/org/peercentrum/h2pk/HashIdentifier.java
8c41f165284b3ac67de36d26760cdb0574224d72
[ "MIT" ]
permissive
pmarches/peercentrum-core
7b54610dd60f1142879e70161835c02e9487a789
487cbd5efc1888cbb20eec83095030d4451fe02e
refs/heads/master
2021-01-17T15:30:18.475438
2016-05-07T06:54:46
2016-05-07T06:54:46
21,343,173
0
0
null
null
null
null
UTF-8
Java
false
false
313
java
package org.peercentrum.h2pk; import org.peercentrum.core.Identifier; public class HashIdentifier extends Identifier { public HashIdentifier() { super(); } public HashIdentifier(byte[] byteArray) { super(byteArray); } public HashIdentifier(String hexHashString) { super(hexHashString); } }
[ "pmarches@gmail.com" ]
pmarches@gmail.com
d8d22c91941c03c40882a969c4b6152d984a5372
c69f98be07a55b59ed8eb060a675a25a4a1dd3d1
/springmvc-2-integracao-cache-seguranca-e-templates/springmvc2-projeto-inicial/casadocodigo/src/main/java/br/com/casadocodigo/loja/infra/GeraSenha.java
509065aa74dc9f1bdd0fd7bd379e3cc4ca60f3b6
[]
no_license
ferreiraapfernanda/alura-java
6a9b927c2e3e0fbda0e67db55037fae36f6e7b8a
f34b34c1ec2b2d6cb6adbf6213e4b717e9bd2f65
refs/heads/master
2021-09-26T13:44:36.318751
2018-10-30T19:51:38
2018-10-30T19:51:38
109,114,509
2
4
null
null
null
null
UTF-8
Java
false
false
308
java
package br.com.casadocodigo.loja.infra; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; public class GeraSenha { public static void main(String[] args) { String senhaCriptografado = new BCryptPasswordEncoder().encode("123456"); System.out.println(senhaCriptografado); } }
[ "fernanda@amee.com.br" ]
fernanda@amee.com.br
3aa85f0b0b7c61a96bc018c3bfadf269339830e5
96e8af3fe2383cec722ef0afce54169638a7ffb2
/src/net/i2p/crypto/eddsa/X25519Key.java
ae079e8e36abbc4a8c45ecaefdcab4aada2adc1b
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference", "CC0-1.0" ]
permissive
vikram919/ed25519-java
4a11670a63a45c2040667a26413b8c29f7be1fcb
9fe251b135130fadd3e393564316ee39d3a2e6dc
refs/heads/master
2020-03-08T08:45:25.147824
2018-04-06T09:09:03
2018-04-06T09:09:03
128,029,973
0
0
null
2018-04-04T08:13:28
2018-04-04T08:13:28
null
UTF-8
Java
false
false
385
java
package net.i2p.crypto.eddsa; import java.security.Key; class X25519Key implements Key { private byte[] mKey; X25519Key(byte[] key) { mKey = key; } public String getAlgorithm() { return "X.25519"; } public String getFormat() { return null; } public byte[] getEncoded() { return mKey; } }
[ "gopuvikram818@gmail.com" ]
gopuvikram818@gmail.com
ca9f0021e50377411376f82f0739a7c01a1c07e6
ab5d335e026d22d16e957eced2adf0ff7afb6fe5
/yoti-sdk-impl/src/main/java/com/yoti/api/client/spi/remote/call/YotiConstants.java
81f0c16ae3a1bf226083fedbf50123d4450a3463
[ "MIT" ]
permissive
jlmartyres/yoti-java-sdk
a223d7cda1616ceb20699ba2af51bd6fb3b40e84
d56bc5a2378fc9c2656b195a2d4b46fd198c2b7d
refs/heads/master
2020-04-10T05:45:04.052289
2018-12-05T12:22:02
2018-12-06T10:22:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,149
java
package com.yoti.api.client.spi.remote.call; public final class YotiConstants { private YotiConstants() {} public static final String PROPERTY_YOTI_API_URL = "yoti.api.url"; private static final String DEFAULT_YOTI_HOST = "https://api.yoti.com"; public static final String YOTI_API_PATH_PREFIX = "/api/v1"; public static final String DEFAULT_YOTI_API_URL = DEFAULT_YOTI_HOST + YOTI_API_PATH_PREFIX; public static final String AUTH_KEY_HEADER = "X-Yoti-Auth-Key"; public static final String DIGEST_HEADER = "X-Yoti-Auth-Digest"; public static final String YOTI_SDK_HEADER = "X-Yoti-SDK"; public static final String CONTENT_TYPE = "Content-Type"; public static final String CONTENT_TYPE_JSON = "application/json"; public static final String JAVA = "Java"; public static final String BOUNCY_CASTLE_PROVIDER = "BC"; public static final String SIGNATURE_ALGORITHM = "SHA256withRSA"; public static final String ASYMMETRIC_CIPHER = "RSA/NONE/PKCS1Padding"; public static final String SYMMETRIC_CIPHER = "AES/CBC/PKCS7Padding"; public static final String DEFAULT_CHARSET = "UTF-8"; }
[ "michael.buck@yoti.com" ]
michael.buck@yoti.com
c87b66649bc1a074044fc8bbc1d6e051a47ebaee
b62a9c9ff623e2f7b88b2b89520d078a865faca3
/src/exception/PayException.java
212bbdfd51754e6b5312e6d3a3a34be8ba0b76be
[]
no_license
junbeomm-park/java-basic
28ef70c8f31765cb9fc3ed44852634b45c4b16c4
35f0c45e4467454f681c8d1259f67c8205ac0915
refs/heads/master
2023-07-13T01:44:40.482830
2021-08-26T12:28:51
2021-08-26T12:28:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
241
java
package exception; import java.lang.Exception; // 사용자 정의 Exception : 수정하지 말고 그대로 사용하세요. public class PayException extends Exception { public PayException(String message){ super(message); } }
[ "junbum0674@gmail.com" ]
junbum0674@gmail.com
7c7c21cf2feedbc5e83cb47c0e659b30733a8e3e
77cb78ffafe520eaef71939f3fe6ebe8845a954f
/OnlineShop/src/main/java/online/shop/example/OnlineShop/common/InitialData.java
6f321f186cd5b2f7d9d3d48c336b9d0789539ce0
[]
no_license
ukraine08107/onlineShop
6acd02d9f3f12c09d33a0c7b0d2e2a77b14b4025
cef31153336b32062c895981c15711cfccf50131
refs/heads/master
2020-11-25T08:29:07.232469
2019-12-17T08:55:28
2019-12-17T08:55:28
228,574,577
0
0
null
null
null
null
UTF-8
Java
false
false
3,621
java
package online.shop.example.OnlineShop.common; import online.shop.example.OnlineShop.product.model.Product; import online.shop.example.OnlineShop.user.model.Role; import online.shop.example.OnlineShop.user.model.User; import online.shop.example.OnlineShop.product.service.ProductService; import online.shop.example.OnlineShop.user.service.UserService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.security.crypto.password.PasswordEncoder; import javax.annotation.PostConstruct; @Configuration public class InitialData { private static final Logger log = LoggerFactory.getLogger(InitialData.class); private UserService userService; private PasswordEncoder passwordEncoder; private ProductService productService; // private CartService cartService; @Autowired public InitialData(UserService userService, ProductService productService, // CartService cartService, PasswordEncoder passwordEncoder) { this.userService = userService; this.productService = productService; this.passwordEncoder = passwordEncoder; // this.cartService = cartService; } @PostConstruct public void init() { User userOne = new User("Test First Name", "Test Last Name", "+15545454547", "test@email.com", passwordEncoder.encode("test")); userOne.setRole(Role.User); // Cart cart = new Cart(0, userOne.getId()); // cart.setUser(userOne); // cart.setIdOfUser(userOne.getId()); User admin = new User("Test Admin Name", "Test Admin Name", "+15545454547", "admin@email.com", passwordEncoder.encode("admin")); userOne.setRole(Role.Admin); try { userService.createUser(userOne); // cartService.createCart(cart); } catch (Exception ex) { log.info(ex.getMessage()); } Product product = new Product("Asus", "laptop", 799, 0, "computers and laptops"); Product product1 = new Product("Lenovo", "laptop", 749, 15.5, "computers and laptops"); Product product2 = new Product("Apple", "laptop", 1300, 1, "computers and laptops"); Product product3 = new Product("Apple", "smartphone", 1200, 0, "smartphones"); Product product4 = new Product("Asus", "smartphone", 300, 40, "smartphones"); Product product5 = new Product("Xiaomi", "smartphone", 150, 4, "smartphones"); Product product6 = new Product("Nokia", "smarthone", 355, 17, "smartphones"); Product product7 = new Product("Fantastic jorney", "book", 17, 3, "books"); Product product8 = new Product("Great Gatsby", "book", 25, 14, "books"); Product product9 = new Product("Spring in action", "book", 30, 13, "books"); try { productService.createProduct(product); productService.createProduct(product1); productService.createProduct(product2); productService.createProduct(product3); productService.createProduct(product4); productService.createProduct(product5); productService.createProduct(product6); productService.createProduct(product7); productService.createProduct(product8); productService.createProduct(product9); } catch (Exception ex) { log.info(ex.getMessage()); } } }
[ "sobianin2008@gmail.com" ]
sobianin2008@gmail.com
70612bdc52cd4f0ac5686a36a9c77231dca88caf
c6394252ed22b797393994ecc848bdd9c9088d56
/Guiaextra/app/src/main/java/com/example/alberto/guiaextra/acti/activitis/DetailStudentActivity.java
b93d595282ce0ae6217ec6b80eec4cb7f495fe8a
[]
no_license
mariyita2/uca
824bd65f34812056c2efd97704cc2cf4468c25c5
42a222eb15cd72c0f9729136688303f937f6ebf3
refs/heads/master
2021-08-20T02:11:31.968809
2017-11-24T16:44:00
2017-11-24T16:44:00
110,604,998
0
0
null
2017-11-28T00:02:03
2017-11-13T21:34:44
Java
UTF-8
Java
false
false
1,654
java
package com.example.alberto.guiaextra.acti.activitis; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.example.alberto.guiaextra.R; public class DetailStudentActivity extends AppCompatActivity implements View.OnClickListener { TextView tvName; TextView tvGrade; Button btnCall; private String mName; private String mGrade; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail_student); tvName = (TextView) findViewById(R.id.tv_name); tvGrade = (TextView) findViewById(R.id.tv_grades); btnCall = (Button) findViewById(R.id.btn_call); btnCall.setOnClickListener(this); Bundle example = getIntent().getExtras(); if(example != null){ mName = example.getString("StudentName"); mGrade = example.getString("StudentGrade"); } tvName.setText(mName); tvGrade.setText(mGrade); } @Override public void onClick(View v) { /* Intent intent =new Intent(Intent.ACTION_DIAL).setData(Uri.parse("tel:" + "22802608")); //startActivity(new Intent(Intent.ACTION_DIAL).setData(Uri.parse("tel:" + response.getCellPhone()))); startActivity(intent); */ Uri uri = Uri.parse("http://www.google.com.ni"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } }
[ "33670007+castillo310799@users.noreply.github.com" ]
33670007+castillo310799@users.noreply.github.com
c16497ecbdcf076354b83919c631bcde612e2e55
7dbc40ea98d17fdc2180563c2ffd8b25504714b3
/org/yaml/snakeyaml/introspector/GenericProperty.java
bf6a3be7462c41751e1da91384b523918a05be51
[]
no_license
WarriorCrystal/Zenith-0.7-src
c144e3548f7ae1542df2ce6a29de864aec25b87d
34fd7a76d0e1b59518c813da6f5dd339a0425d58
refs/heads/main
2023-01-21T04:42:58.249921
2020-11-29T21:37:31
2020-11-29T21:37:31
317,043,706
1
2
null
null
null
null
UTF-8
Java
false
false
3,118
java
// // Decompiled by Procyon v0.5.36 // package org.yaml.snakeyaml.introspector; import java.lang.reflect.Array; import java.lang.reflect.GenericArrayType; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; public abstract class GenericProperty extends Property { private Type genType; private boolean actualClassesChecked; private Class<?>[] actualClasses; public GenericProperty(final String name, final Class<?> aClass, final Type aType) { super(name, aClass); this.genType = aType; this.actualClassesChecked = (aType == null); } @Override public Class<?>[] getActualTypeArguments() { if (!this.actualClassesChecked) { if (this.genType instanceof ParameterizedType) { final ParameterizedType parameterizedType = (ParameterizedType)this.genType; final Type[] actualTypeArguments = parameterizedType.getActualTypeArguments(); if (actualTypeArguments.length > 0) { this.actualClasses = (Class<?>[])new Class[actualTypeArguments.length]; for (int i = 0; i < actualTypeArguments.length; ++i) { if (actualTypeArguments[i] instanceof Class) { this.actualClasses[i] = (Class<?>)actualTypeArguments[i]; } else if (actualTypeArguments[i] instanceof ParameterizedType) { this.actualClasses[i] = (Class<?>)((ParameterizedType)actualTypeArguments[i]).getRawType(); } else { if (!(actualTypeArguments[i] instanceof GenericArrayType)) { this.actualClasses = null; break; } final Type componentType = ((GenericArrayType)actualTypeArguments[i]).getGenericComponentType(); if (!(componentType instanceof Class)) { this.actualClasses = null; break; } this.actualClasses[i] = Array.newInstance((Class<?>)componentType, 0).getClass(); } } } } else if (this.genType instanceof GenericArrayType) { final Type componentType2 = ((GenericArrayType)this.genType).getGenericComponentType(); if (componentType2 instanceof Class) { this.actualClasses = (Class<?>[])new Class[] { (Class)componentType2 }; } } else if (this.genType instanceof Class) { final Class<?> classType = (Class<?>)this.genType; if (classType.isArray()) { (this.actualClasses = (Class<?>[])new Class[1])[0] = this.getType().getComponentType(); } } this.actualClassesChecked = true; } return this.actualClasses; } }
[ "68621329+Warrior80@users.noreply.github.com" ]
68621329+Warrior80@users.noreply.github.com
f8fe8fa88f7c3db0824b6d7e14bfaaea81e2f7dc
52b4bde1243dc4e9a06b0c82d5868e0beb70d55f
/src/main/java/pe/euler/demo/securityjwt/configuration/ServiceConfig.java
7cf0ada9e5ebcd2ff54a8a2c636b0a4c7eaafe18
[]
no_license
Abel-Landeo/security-jwt
6d3c11666e29f5eebf908a9e40023ae36ad79e0d
edc9a67c0d208b3c155c5204184573e5d1659723
refs/heads/master
2023-05-08T14:53:46.883354
2021-06-06T19:57:26
2021-06-06T19:57:26
374,448,590
1
0
null
null
null
null
UTF-8
Java
false
false
607
java
package pe.euler.demo.securityjwt.configuration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import pe.euler.demo.securityjwt.service.BookService; import pe.euler.demo.securityjwt.service.JwtService; import pe.euler.demo.securityjwt.service.impl.BookServiceImpl; import pe.euler.demo.securityjwt.service.impl.JwtServiceImpl; @Configuration public class ServiceConfig { @Bean public JwtService getJwtService() { return new JwtServiceImpl(); } @Bean public BookService getBookService() { return new BookServiceImpl(); } }
[ "abel.landeo@gmail.com" ]
abel.landeo@gmail.com
aa4f6080f67dd901ab4487ad9febe0d7a493307e
1629e37bba65c44f8cf5e88d73c71870089041a4
/JAVA基础/day04/代码/控制流程语句/Demo1.java
fac7cc9688ba298a17bae64e1e1bfc6f713a1543
[]
no_license
15529343201/Java-Web
e202e242663911420879685c6762c8d232ef5d61
15886604aa7b732d42f7f5783f73766da34923e2
refs/heads/master
2021-01-19T08:50:32.816256
2019-03-28T23:34:31
2019-03-28T23:34:31
87,683,430
0
0
null
null
null
null
GB18030
Java
false
false
787
java
/* 控制流程语句之---if 判断语句 格式一: 只适用于一种情况下去使用。 if(判断条件){ 符合条件执行的代码; } 格式二:适用于两种情况下去使用 if(判断条件){ 符合条件执行的代码 }else{ 不符合条件执行 的 代码 } ] 格式3: 适用于多种情况使用的 if(判断条件1){ 符合条件1执行的 语句; }else if(判断条件2){ 符合条件2执行 的语句; }else if(判断条件3){ 符合条件3执行 的语句; }else if(判断条件4){ 符合条件4执行 的语句; }......else{ 都不符合上述 条件执行的代码... } */ class Demo1 { public static void main(String[] args) { System.out.println("Hello World!"); } }
[ "15529343201@139.com" ]
15529343201@139.com
f6fa08b881b20029a23dc2a26a8550f97e59b24f
ef47006805a6ea4936134dacaabf8e32123d9835
/app/src/test/java/com/example/www/qy_utils/ExampleUnitTest.java
5bfdc7441daef66a969c93308f7e76db3faecd40
[]
no_license
mraben/QY_Utils
0415d22c3bff4fdcf12dfeb4c70ebe5e4183dc77
d8433ab91c90ddc8459dc8515b802535be666570
refs/heads/master
2020-03-26T13:03:30.382878
2018-08-16T01:34:20
2018-08-16T01:34:20
144,868,150
0
0
null
null
null
null
UTF-8
Java
false
false
385
java
package com.example.www.qy_utils; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "liuhuan@efanghang.com" ]
liuhuan@efanghang.com
457a31f426977c256b775e4e90c8f704f0fbe4a5
d80e2f9a7c6743edf41d1f1ac597cba5748e0953
/app/src/androidTest/java/com/example/a15017484/demoexplicitintent/ExampleInstrumentedTest.java
8f48f569f3a156eb8328f897e23b065d54ccfcbe
[]
no_license
actuallycoding/DemoExplicitIntent
53f44d52660324cc4ec507bc82955b886ed4b845
5e5bbe9c5459ee44dc5bfb0b489b2e2b922ad638
refs/heads/master
2021-01-20T07:15:17.568810
2017-05-02T02:27:21
2017-05-02T02:27:21
89,982,482
0
0
null
null
null
null
UTF-8
Java
false
false
784
java
package com.example.a15017484.demoexplicitintent; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.a15017484.demoexplicitintent", appContext.getPackageName()); } }
[ "15017484@myrp.edu.sg" ]
15017484@myrp.edu.sg
1f6c48d884a988cb4fd662ab2d1399672a0f57be
6727401afd400ab2ca1cf5c030b23bab8cdc33cf
/src/main/java/com/example/demo/Client.java
5ec0e8bdf073b29f0c1a800e8022fc621112134f
[]
no_license
artsevruk/webDemo
42fc581e242c5ae1e7000a6f72249b0b08ad7266
09729406933b8461822505b9e12c6f68121c25c2
refs/heads/master
2021-07-04T22:23:28.051096
2017-09-27T13:27:49
2017-09-27T13:27:49
105,019,538
0
0
null
null
null
null
UTF-8
Java
false
false
486
java
package com.example.demo; public class Client { private String id; private String fullName; public Client(String id, String fullName) { this.id = id; this.fullName = fullName; } public String getId() { return id; } public String getFullName() { return fullName; } public void setId(String id) { this.id = id; } public void setFullName(String fullName) { this.fullName = fullName; } }
[ "artsevruk@gmail.ru" ]
artsevruk@gmail.ru
d9985c9f60d6c74accbbef402ee598863937190f
53f6fdfc1f363a910c42ae7ec64f4f147992db42
/app/src/androidTest/java/com/example/test_button/ExampleInstrumentedTest.java
7f14876ebc3e5a40ebfb32e01ad74cf1644f4b7c
[]
no_license
The-sun-does-shine/Test_button
fcb3a9203e892c8a75ddf0dfb4aff64f058f5ffd
468a82977fe121ea017debc44818a5d64a865ac2
refs/heads/master
2020-07-23T06:06:49.224613
2019-09-10T04:48:40
2019-09-10T04:48:40
207,467,751
0
0
null
null
null
null
UTF-8
Java
false
false
762
java
package com.example.test_button; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.test_button", appContext.getPackageName()); } }
[ "1334558595@qq.com" ]
1334558595@qq.com
8aa3e1ac176924a95226df7a1711a0302ce01123
ad0c8e61f237ae4c2a68543fb19e19e892a7b677
/springproject-master/src/main/java/com/ltts/project/Dao/MovieDao.java
590de12c60e7e0e8bd7f18a651e5fc1a3d8eca1c
[]
no_license
PS99003576/preFiinal
5a0d80667c65b42f757f6ddc8e16da27693edaba
66ad5214f5b706af5c3a43e9e5b6630890ef1e66
refs/heads/main
2023-03-08T23:16:17.299395
2021-03-19T11:35:13
2021-03-19T11:35:13
349,394,520
0
0
null
null
null
null
UTF-8
Java
false
false
1,218
java
package com.ltts.project.Dao; import java.util.List; import javax.persistence.EntityManager; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.ltts.project.model.Member; import com.ltts.project.model.Movie; @Repository public class MovieDao { @Autowired private EntityManager em; @Autowired private SessionFactory sf; public boolean InsertMovie(Movie m) { boolean b=false; Session s=null; try { s=sf.openSession(); s.beginTransaction(); s.save(m); //System.out.println(st); s.getTransaction().commit(); } catch(Exception e) { System.out.println("Exception "+e); b=true; } /* * finally { sf.close(); } */ return b; } public List<Movie> getAllMovies(){ Session session=sf.openSession(); session.beginTransaction(); List<Movie> li=sf.openSession().createCriteria(Movie.class).list(); //List<ProductsModel> product=sessionFactory.openSession().createCriteria(ProductsModel.class).list(); session.getTransaction().commit(); return li; } }
[ "roshanzameer.shaik@ltts.com" ]
roshanzameer.shaik@ltts.com
8b1c6543717a86f36875987b3e07961e32fe213c
34af8051b54b7c154067d5cb8958d27586bc6081
/src/main/java/com/gocpf/repository/AuditeurRepository.java
4b966c9718a89536bab14c0e78065d195996677e
[]
no_license
ericametepe/rest-es-project-java8
a36c1298ac33236e9384a9ae4433b249487b5aff
b287ebb6bb333f09aba926ee3b138d0b7decb6d4
refs/heads/master
2021-01-10T11:50:35.744039
2016-02-25T05:37:04
2016-02-25T05:37:04
52,097,291
0
0
null
null
null
null
UTF-8
Java
false
false
315
java
package com.gocpf.repository; import java.util.Optional; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import com.gocpf.entities.Auditeur; public interface AuditeurRepository extends ElasticsearchRepository<Auditeur, String> { Optional<Auditeur> findByNom(String nom); }
[ "ericametepe@gmail.com" ]
ericametepe@gmail.com
1a198fbface7d4ddf1e6beba16b75e79e959b396
909fa2df3454faf7ac573b4b1008b20b1974d6f0
/src/main/java/org/autolook/controller/ShortenController.java
36958ccf356f62075c1f6899fb38d5ef78c6ab49
[]
no_license
ichaly/shortenurl
23122b2a8e0b10810fb132185f23d75f8e558094
c7fb59b5323a40b85bc66a690795ad1f0e647011
refs/heads/master
2021-04-21T13:44:05.263249
2016-09-29T03:05:39
2016-09-29T03:05:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,350
java
package org.autolook.controller; import org.autolook.model.ShortenResult; import org.autolook.service.ShortenService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Created by raoshaoquan on 16/5/27. */ @RestController @RequestMapping(value = "/api") @EnableAutoConfiguration public class ShortenController { public static final String SHORTEN_PREFIX = "localhost:8081/"; @Autowired private ShortenService shortenService; @RequestMapping(value = "/shorten", method = RequestMethod.GET) public @ResponseBody List<ShortenResult> shorten(@RequestParam("url") String url ) { List<String> list = Arrays.asList(url.split(",")); if (list.isEmpty()) { return new ArrayList<>(); } List<ShortenResult> results = new ArrayList<>(); for (String longUrl : list) { ShortenResult result = new ShortenResult(); result.setLongUrl(longUrl); String shortUrl = SHORTEN_PREFIX.concat(shortenService.shorten(longUrl)); result.setShortUrl(shortUrl); results.add(result); } return results; } }
[ "32005235@qq.com" ]
32005235@qq.com
5035b69a005f46d89ef701749eeeeef7c1e16d70
78348f3d385a2d1eddcf3d7bfee7eaf1259d3c6e
/examples/modularized-state-machines/fr.inria.diverse.puzzle.examples.composedLanguage/src-gen/CompleteDSLPckg/Trigger.java
1302e698a1d2fd6798e8e1ada4a84149bda37832
[]
no_license
damenac/puzzle
6ac0a2fba6eb531ccfa7bec3a5ecabf6abb5795e
f74b23fd14ed5d6024667bf5fbcfe0418dc696fa
refs/heads/master
2021-06-14T21:23:05.874869
2017-03-27T10:24:31
2017-03-27T10:24:31
40,361,967
3
1
null
null
null
null
UTF-8
Java
false
false
1,312
java
/** */ package CompleteDSLPckg; import org.eclipse.emf.ecore.EObject; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Trigger</b></em>'. * <!-- end-user-doc --> * * <p> * The following features are supported: * <ul> * <li>{@link CompleteDSLPckg.Trigger#getExpression <em>Expression</em>}</li> * </ul> * </p> * * @see CompleteDSLPckg.CompleteDSLPckgPackage#getTrigger() * @model * @generated */ public interface Trigger extends EObject { /** * Returns the value of the '<em><b>Expression</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Expression</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Expression</em>' attribute. * @see #setExpression(String) * @see CompleteDSLPckg.CompleteDSLPckgPackage#getTrigger_Expression() * @model * @generated */ String getExpression(); /** * Sets the value of the '{@link CompleteDSLPckg.Trigger#getExpression <em>Expression</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Expression</em>' attribute. * @see #getExpression() * @generated */ void setExpression(String value); } // Trigger
[ "damenac@gmail.com" ]
damenac@gmail.com
653f4ec33d09ee38790f46d4266be1c41d182324
161029f981098a020633681e0f42bf4d2aae2cf5
/redmine-jclient/src/main/java/jizai/tools/redmine/jclient/ToolConfig.java
df71aae67c242617da9792d295151cb832a592ab
[]
no_license
luozengbin/java-samples
ee49f7bddb1c5eb3dddf242d09b9529dc2f9f018
41f622c0308017b9add6d2bde930c46c4cdf26a1
refs/heads/master
2019-01-02T01:54:51.668994
2015-06-14T12:58:27
2015-06-14T12:58:27
21,026,342
0
0
null
null
null
null
UTF-8
Java
false
false
2,514
java
/* * Copyright (C) 2014, 2015 Akira Wakana * * Author: Akira Wakana <jalen.cn@gmail.com> * URL: https://luozengbin.github.io * Keywords: bts, redmine, tool * Version: 1.0.0 * * 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 3 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, see <http://www.gnu.org/licenses/>. */ package jizai.tools.redmine.jclient; import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.Reader; import javax.ws.rs.core.MediaType; import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; import javax.xml.transform.stream.StreamSource; import org.eclipse.persistence.jaxb.UnmarshallerProperties; import lombok.Data; @Data public class ToolConfig { public static final String TOOL_CONF = "jizai.tools.redmine.jclient.ToolConfig"; public static final String CHARSET_NAME = "UTF-8"; private static final Object lock = new Object(); private static ToolConfig singleInstance = null; /** * TOOL_CONFシステムプロパティ値でconfファイルを読み込み. * @return */ public static ToolConfig instance() { if (singleInstance == null) { synchronized (lock) { try { if (singleInstance == null) { JAXBContext jaxbContext = JAXBContext.newInstance(ToolConfig.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, MediaType.APPLICATION_JSON); unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false); String confFile = System.getProperty(TOOL_CONF); Reader entityReader = new InputStreamReader(new FileInputStream(confFile), CHARSET_NAME); StreamSource jsonSource = new StreamSource(entityReader); singleInstance = unmarshaller.unmarshal(jsonSource, ToolConfig.class).getValue(); } } catch (Exception e) { throw new RuntimeException(e); } } } return singleInstance; } private String hostURL; private String apiKey; }
[ "jalen.cn@gmail.com" ]
jalen.cn@gmail.com
ef095c2b9c2490474f2ff5a2b41226c7d7894427
6ca790e000149014f3ecab082446277e548d8fa4
/src/main/java/com/mall/service/CartService.java
7bb53c224e07e30b04f6a8585f15ac3f17154f46
[]
no_license
xiruitao/mall
8800290acfa38640f26b7d65cb1b033b4beacc43
f40f112dd2834a3356a094f4b421f3988da6ff27
refs/heads/master
2022-12-23T21:58:49.575244
2020-01-10T06:30:32
2020-01-10T06:30:32
205,385,990
0
0
null
2022-12-16T04:37:57
2019-08-30T13:17:58
Java
UTF-8
Java
false
false
1,437
java
package com.mall.service; import com.mall.error.BusinessException; import com.mall.service.model.CartModel; import java.util.List; /** * @Description: 购物车功能定义 * @Author: ruitao xi ruitao.xi@luckincoffee.com * @Date: 2019/8/2 12:25 */ public interface CartService { /** * 将商品加入购物车 * @param userId 用户ID * @param itemId 商品ID * @param amount 购买数量 * @throws BusinessException 业务异常 * @return CartModel */ void addCart(Integer userId,Integer itemId,Integer amount) throws BusinessException; /** * 删除购物车中某个商品 * @param cartId 购物车ID */ void deleteCart(Integer cartId); /** * 批量删除商品 * @param cartIds 购物车ID集合 */ void deleteCartMore(List<Integer> cartIds); /** * 清空用户购物车 * @param userId 用户ID */ void deleteCartAll(Integer userId); /** * 用户购物车展示 * @param userId 用户ID * @return CartModel */ List<CartModel> selectCart(Integer userId); /** * 通过购物车ID查询购物车中商品 * @param cartId 商品ID * @return CartModel */ CartModel getCartById(Integer cartId); /** * 修改购买数量 * @param cartId 购物车ID * @param number 更改数 */ void updateAmount(Integer cartId,Integer number); }
[ "2660363758@qq.com" ]
2660363758@qq.com
ebf4f0206b8a19ea82fc12f47af35facb8c1cf7e
a0468f3ef55be38b308fc2cb6dcf0f7244c7864c
/Grade2/TextBook/MenuAndColorChooserEx.java
8a36a725cbd15ec35db5b5b6ebfe60251c49572c
[]
no_license
YangNayoung/JAVA
ba395b14383e38f8addc970c097cf9c1af082369
1e9d381f130ed41540d48a0e40f29dff3b9738c6
refs/heads/master
2022-07-28T10:49:21.891626
2020-05-14T10:23:10
2020-05-14T10:23:10
263,881,142
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
1,268
java
import javax.swing.*; import java.awt.event.*; import java.awt.*; public class MenuAndColorChooserEx extends JFrame { private JLabel label = new JLabel("Hello"); public MenuAndColorChooserEx() { setTitle("JColorChooser ¿¹Á¦"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = getContentPane(); label.setHorizontalAlignment(SwingConstants.CENTER); label.setFont(new Font("Ravie", Font.ITALIC, 30)); c.add(label, BorderLayout.CENTER); createMenu(); setSize(250,200); setVisible(true); } private void createMenu() { JMenuBar mb = new JMenuBar(); JMenuItem colorMenuItem = new JMenuItem("Color"); JMenu fileMenu = new JMenu("Text"); colorMenuItem.addActionListener(new MenuActionListener()); fileMenu.add(colorMenuItem); mb.add(fileMenu); this.setJMenuBar(mb); } class MenuActionListener implements ActionListener { public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if(cmd.equals("Color")) { Color selectedColor = JColorChooser.showDialog(null, "Color", Color.YELLOW); if(selectedColor != null) label.setForeground(selectedColor); } } } public static void main(String [] args) { new MenuAndColorChooserEx(); } }
[ "s2018s32@e-mirim.hs.kr" ]
s2018s32@e-mirim.hs.kr
0348d2ede2e65f2ee2eaa00d73217d4862752ae5
6d38df664eb46a6f7015c329e2ce8110f67ab73d
/lib-showField/src/main/java/com/lib/showfield/interfaces/OnPrectionListener.java
4f998a731e8391445e6b8086e07ffa3d35681238
[]
no_license
sengeiou/live_sdk
59ef61cc5237023c213b6dd83c0fdbf5c668baa8
af221f50feb37f118b1212a178e89c799d87b706
refs/heads/master
2023-01-22T21:55:55.539271
2020-12-02T05:42:16
2020-12-02T05:42:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
270
java
package com.lib.showfield.interfaces; import com.hpplay.sdk.source.browse.api.LelinkServiceInfo; /** * 投屏 */ public interface OnPrectionListener { void onStartConnect(); void onConnectSuccess(LelinkServiceInfo selectInfo); void onDisConnectFail(); }
[ "wangzhiyong@wangzhiyongdeMacBook-Pro.local" ]
wangzhiyong@wangzhiyongdeMacBook-Pro.local
335f29f611bb03109e2ff285243b55b852a86b5f
ec70e437327bf2ef0330142f39b0587b56a57d0c
/Pattern24.java
7bd340e1e3b7a1ec6ebf0f0f1051f3082f15d9f0
[]
no_license
Mahesh-stack/PatternPrograms
0ac5227d52b4520d78e41abc1adc41ad107e62a4
fd3d1f1a0148fe518ada951171cfbc0cd9b9fc7c
refs/heads/master
2022-11-21T14:08:23.930299
2020-07-18T08:43:27
2020-07-18T08:43:27
280,616,763
0
0
null
null
null
null
UTF-8
Java
false
false
496
java
public class Pattern24 { public static void main(String[] args) { int lines=5; int starCount=5; for (int i=1;i<=lines;i++) { for (int j=1;j<=starCount;j++) { if(j==5||i==1) { System.out.print("*"); } else { System.out.print(" "); } } System.out.println(); } } }
[ "maheshdevraye13@gmail.com" ]
maheshdevraye13@gmail.com
833be379ca9fdc5cc119b8cfb2ee64db0a3cbc90
8429cf3dd9adfc1846e1591bf8845df67ebcf696
/src/Entity/UserEnity.java
a262c9b96f92097c85a9091b7fa97297f8ce8a60
[]
no_license
CJTSAJ/bookStore-backEnd
04098a830a5f61638bc4a8b88e5bc8d7f3cc41a6
ebb26b442bb1bb2c4b59dc5ee477c203a43bbdf6
refs/heads/master
2020-03-19T04:07:08.707600
2018-06-03T06:18:03
2018-06-03T06:18:03
135,796,550
0
0
null
null
null
null
UTF-8
Java
false
false
731
java
package Entity; public class UserEnity { private String id; private String password; private String email; private String phone; public UserEnity() {} public String getId() { return id; } public void setId(String id) { this.id = id; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return this.email; } public void setEmail(String Email) { this.email = Email; } public String getPhone() { return this.phone; } public void setPhone(String phone) { this.phone = phone; } }
[ "997149731@qq.com" ]
997149731@qq.com
f73ea54dbf284fbf5e800f9c25301c45b21057d0
4fb1f54fd18fabd69cc776de3410d4a4069ae995
/bookmark-server/src/test/java/org/example/app/bookmark/testutils/TestUtils.java
5893393b8bab70c57efdfcc8fa3328142e8c7efd
[ "Apache-2.0" ]
permissive
mmilja/java-rest-app
927a74edb4efb886569fee265161c49851d23011
fbd0668c1bf5c3152b86625f33afe5efbf647bf3
refs/heads/main
2023-01-22T02:47:53.572438
2020-11-24T15:38:47
2020-11-24T15:38:47
314,920,816
0
0
null
null
null
null
UTF-8
Java
false
false
952
java
package org.example.app.bookmark.testutils; public class TestUtils { /** * Delimiter string. */ private static final String testCaseDelimiter = "------------------------------------------------------------------"; /** * Prints test header. * Should be called in method annotated with @Before. * * @param testName to print */ public static void printTestHeader(String testName) { System.out.println(testCaseDelimiter + "\nStarting: " + testName + "\n" + testCaseDelimiter + "\n"); } /** * Prints test footer. * Should be called in method annotated with @After. */ public static void printTestFooter() { System.out.println(testCaseDelimiter + "\n"); } /** * Prints information for test. * * @param info to print. */ public static void printTestInfo(String info) { System.out.println("TEST INFO: " + info); } }
[ "Marko.Miljak.00@fesb.hr" ]
Marko.Miljak.00@fesb.hr
d8b7e37e6cd4c319bc7fe1971ea0ab34ba3eb394
cf02a593f6eec593a59a43087602d144944d2e63
/src/main/java/br/com/roavila/pontocloud/json/RelatorioPontoJson.java
fb76919e6af94509bf0c0d41f2fd416c3a87b985
[]
no_license
roavilaIT/pontocloud
08877124e4b0071ca230b72c6cc26203a7d572eb
888411f813c8e98af162f18c99e141101255fb5c
refs/heads/master
2022-03-01T08:55:25.419261
2020-02-27T00:53:48
2020-02-27T00:53:48
243,396,707
0
0
null
2022-01-21T23:38:34
2020-02-27T00:39:42
Java
UTF-8
Java
false
false
1,064
java
package br.com.roavila.pontocloud.json; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.google.common.collect.Lists; import br.com.roavila.pontocloud.mapper.Json; import br.com.roavila.pontocloud.mapper.PontoMapper; import br.com.roavila.pontocloud.model.RelatorioPonto; import java.util.List; import java.util.stream.Collectors; @JsonIgnoreProperties(ignoreUnknown = true) public class RelatorioPontoJson implements Json { private final List<PontoJson> pontos; private final String totalHoras; public RelatorioPontoJson(RelatorioPonto relatorioPonto) { this.pontos = relatorioPonto.getPontos().stream().map(ponto -> new PontoMapper().convertModelToJson(ponto)).collect(Collectors.toList()); this.totalHoras = relatorioPonto.totalHoras(); } protected RelatorioPontoJson() { this.pontos = Lists.newArrayList(); this.totalHoras = ""; } public List<PontoJson> getPontos() { return pontos; } public String getTotalHoras() { return totalHoras; } }
[ "rogerio.avila@gmail.com" ]
rogerio.avila@gmail.com
becfdee72d798fc7fb8f9d9827aecb49e054f511
d1e94a95111c5192a33f37b2f60e63ec52a3d6ce
/server/src/main/java/facultad/trendz/config/model/MyUserDetails.java
62bdde17bba66ca185fdac95cf506a0b1bb26b5e
[]
no_license
AgustinBettati/trendz
cc2e7e8707bf6c0dcb470961b533b1d2328dcae3
30a7760d57d53b06c25d7afcb56ff694e2d0e97a
refs/heads/release/4.0
2023-01-23T11:42:18.638296
2020-11-17T19:34:04
2020-11-17T19:34:04
273,098,166
0
0
null
2020-11-17T19:34:05
2020-06-17T23:29:05
Java
UTF-8
Java
false
false
2,475
java
package facultad.trendz.config.model; import com.fasterxml.jackson.annotation.JsonIgnore; import facultad.trendz.model.User; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Objects; public class MyUserDetails implements UserDetails { private static final long serialVersionUID = 1L; private Long id; private String username; private String email; @JsonIgnore private String password; private GrantedAuthority authority; public MyUserDetails(Long id, String username, String email, String password, GrantedAuthority authority) { this.id = id; this.username = username; this.email = email; this.password = password; this.authority = authority; } public static MyUserDetails build(User user) { return new MyUserDetails( user.getId(), user.getUsername(), user.getEmail(), user.getPassword(), new SimpleGrantedAuthority(user.getRole().getEnumRole().name())); } @Override public Collection<? extends GrantedAuthority> getAuthorities() { List<GrantedAuthority> authorities = new ArrayList<>(); authorities.add(authority); return authorities; } public Long getId() { return id; } public String getEmail() { return email; } @Override public String getPassword() { return password; } @Override public String getUsername() { return username; } @Override public boolean isAccountNonExpired() { return true; } @Override public boolean isAccountNonLocked() { return true; } @Override public boolean isCredentialsNonExpired() { return true; } @Override public boolean isEnabled() { return true; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MyUserDetails user = (MyUserDetails) o; return Objects.equals(id, user.id); } @Override public int hashCode() { return super.hashCode(); } }
[ "delavega.agus@gmail.com" ]
delavega.agus@gmail.com
99596af2e2662cd2f2e89efa3070402cea879fa3
8741c505aca71cf9d607236e8f669a69a3e04396
/src/cn/edu/qtech/util/Md5Utils.java
ca973a0b80a1c103fecdd2aa8a4674669da5af44
[]
no_license
efinedxq/xueshengxuanke
ae8cd066080a5bc36875d75696c7502bc9249de4
a5625a03ed8840b467b11ab2da7561b80b74c659
refs/heads/master
2020-12-03T03:43:03.830356
2017-06-30T08:27:11
2017-06-30T08:27:11
95,765,182
0
0
null
null
null
null
UTF-8
Java
false
false
794
java
package cn.edu.qtech.util; import java.security.MessageDigest; import java.util.Scanner; public class Md5Utils { private static char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; public final static String md5(String s) { try { byte[] btInput = s.getBytes(); MessageDigest mdInst = MessageDigest.getInstance("MD5"); mdInst.update(btInput); byte[] md = mdInst.digest(); int j = md.length; char str[] = new char[j * 2]; int k = 0; for (int i = 0; i < j; i++) { byte byte0 = md[i]; str[k++] = hexDigits[byte0 >>> 4 & 0xf]; str[k++] = hexDigits[byte0 & 0xf]; } return new String(str); } catch (Exception e) { e.printStackTrace(); return null; } } }
[ "efinedxq@DESKTOP-MD145LD" ]
efinedxq@DESKTOP-MD145LD
4746caf662137652cfc8d2dc236c3791d7a38857
7304952f40d96163e8f58f014c5fd813a3be024c
/app/src/main/java/com/smartstudy/xxd/mvp/model/SchoolModel.java
f3a3cd8b3b760e052bef6ffb8eebffb5b6bf744e
[]
no_license
lymluck/proj_abroad
c6268a5bb5e3af9a0117170ac9f18029c6d77d9e
d0c1ac1e3b85561dc2e49826b9db4aba09537254
refs/heads/master
2020-03-27T08:25:45.694061
2018-09-04T09:16:02
2018-09-04T09:16:02
146,253,422
2
0
null
null
null
null
UTF-8
Java
false
false
4,973
java
package com.smartstudy.xxd.mvp.model; import android.text.TextUtils; import com.smartstudy.commonlib.base.callback.BaseCallback; import com.smartstudy.commonlib.base.config.BaseRequestConfig; import com.smartstudy.commonlib.base.server.RequestManager; import com.smartstudy.commonlib.utils.HttpUrlUtils; import com.smartstudy.commonlib.utils.ParameterUtils; import java.util.HashMap; import java.util.Map; /** * Created by louis on 17/4/6. */ public class SchoolModel { public static void getSchools(final String country_id, final String rankRange, final String egRange, final String feeRange, final int page, BaseCallback<String> callback) { RequestManager.getInstance().doGet(ParameterUtils.NETWORK_ELSE_CACHED, new BaseRequestConfig() { @Override public String getUrl() { return HttpUrlUtils.getUrl(HttpUrlUtils.URL_SCHOOLS); } @Override public Map getParams() { Map map = new HashMap(); if (!TextUtils.isEmpty(country_id)) { map.put("countryId", country_id); } if (!TextUtils.isEmpty(rankRange)) { map.put("localRank", rankRange); } if (!TextUtils.isEmpty(feeRange)) { map.put("feeTotal", feeRange); } if (!TextUtils.isEmpty(egRange)) { String type = TextUtils.split(egRange, ":")[0]; String value = TextUtils.split(egRange, ":")[1]; if ("toefl".equals(type)) { map.put("scoreToefl", value); } else if ("ielts".equals(type)) { map.put("scoreIelts", value); } } map.put("page", page + ""); return map; } }, callback); } public static void getSchools(final String ids, BaseCallback<String> callback) { RequestManager.getInstance().doGet(ParameterUtils.NETWORK_ELSE_CACHED, new BaseRequestConfig() { @Override public String getUrl() { return HttpUrlUtils.getUrl(HttpUrlUtils.URL_SCHOOLS); } @Override public Map getParams() { Map map = new HashMap(); map.put("ids", ids); return map; } }, callback); } public static void getCollegeIntro(final String id, BaseCallback<String> callback) { RequestManager.getInstance().doGet(ParameterUtils.CACHED_ELSE_NETWORK, new BaseRequestConfig() { @Override public String getUrl() { return HttpUrlUtils.getUrl(HttpUrlUtils.URL_SCHOOL_INFO); } @Override public Map getParams() { Map map = new HashMap(); map.put("id", id); return map; } }, callback); } public static void getCollegeInfo(final String id, BaseCallback<String> callback) { RequestManager.getInstance().doGet(ParameterUtils.NETWORK_ELSE_CACHED, new BaseRequestConfig() { @Override public String getUrl() { return HttpUrlUtils.getUrl(HttpUrlUtils.URL_SCHOOL_DETAIL); } @Override public Map getParams() { Map map = new HashMap(); map.put("id", id); return map; } }, callback); } public static void getHighSchoolInfo(final String schoolId, BaseCallback<String> callback) { RequestManager.getInstance().doGet(ParameterUtils.NETWORK_ELSE_CACHED, new BaseRequestConfig() { @Override public String getUrl() { return HttpUrlUtils.getUrl(HttpUrlUtils.URL_HIGHSCHOOL_DETAIL); } @Override public Map getParams() { Map map = new HashMap(); map.put("id", schoolId); return map; } }, callback); } public static void postErr(final String schoolId, final String section, final String content, BaseCallback<String> callback) { RequestManager.getInstance().doPost(new BaseRequestConfig() { @Override public String getUrl() { return HttpUrlUtils.getUrl(HttpUrlUtils.URL_APP_SCHOOL_ERR); } @Override public Map getParams() { Map map = new HashMap(); map.put("schoolId", schoolId); map.put("section", section); map.put("content", content); return map; } }, callback); } }
[ "luoyongming@innobuddy.com" ]
luoyongming@innobuddy.com
837ec147fd0968e8e9b5f336c276e3916f7fa0db
5efcf840b0a23c16347e0771f1c238f18dad84d2
/src/colasJava_LinkedList/Cola.java
9a65b32d0764ac08ac5353afce1502e340328ffc
[]
no_license
erlinda7/ejerciciosJava
f8fee4c912319458eb9b3fef8acc05a15d25d3bc
02d17133f201c6ca6438175e1d86ba328d40c908
refs/heads/master
2021-02-05T07:26:07.017529
2020-03-05T18:41:27
2020-03-05T18:41:27
243,756,665
0
0
null
null
null
null
UTF-8
Java
false
false
688
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 colasJava_LinkedList; import java.util.LinkedList; import java.util.Queue; /** La cola en la cola del supermercado FIFO First In First Out Primero que entra, primero que sale */ public class Cola { public static void main(String[] args) { Queue<Integer> cola= new LinkedList<>(); for (int i = 0; i < 10; i++) { cola.offer(i); } cola.remove();//remueve el primero 0 System.out.println(cola.peek()); //muestra el primero } }
[ "'erlindachambimanzanoerlinda@gamil.com'" ]
'erlindachambimanzanoerlinda@gamil.com'
6184f03c71b93a4f5848aed8b9b2a6b325373c07
f206ab9bcee00f84906551c0879ddbef72831c9b
/GUI1_LI_S13579/src/zad1/BankingTest.java
9c71f12c30b18293e0023aa4dc6bf07a26efbb54
[]
no_license
IlyaLoshchinin/GUI
37bc43a5952d5ba4de0afced85d3a68898f9d18d
24756ddf6327fb74b35cb271682ea3671cf700fe
refs/heads/master
2020-04-13T02:07:18.469708
2016-06-03T20:40:56
2016-06-03T20:40:56
50,718,119
0
0
null
null
null
null
UTF-8
Java
false
false
701
java
/** * * @author Loshchinin Illia S13579 * */ package zad1; public class BankingTest { public static void main(String[] args) { Person janP = new Person("Jan"), alaP = new Person("Ala"); BankCustomer jan = new BankCustomer(janP); BankCustomer ala = new BankCustomer(alaP); jan.getAccount().deposit(1000); ala.getAccount().deposit(2000); jan.getAccount().transfer(ala.getAccount(), 500); ala.getAccount().withdraw(1000); System.out.println(jan); System.out.println(ala); Account.setInterestRate(4.5); jan.getAccount().addInterest(); ala.getAccount().addInterest(); System.out.println(jan); System.out.println(ala); } }
[ "ilyapje@gmail.com" ]
ilyapje@gmail.com
b446ab91611e5ddf1fea6343362e0737fd3c3ecc
afe57c8275abfc05290c9edfb6924a35c988981c
/src/banco/entidade/Estabelecimentos.java
157f7f4d58f73b7df7e168f204754acd6145f586
[]
no_license
Brunohvc/AtividadeFinalBancoDeDados2
7c4e394bc824e9e7d06110c7a593b531692e3777
44dd71602679eeccfd0c705b9ed5d9e1daa07010
refs/heads/master
2020-04-05T00:59:48.658090
2018-11-27T22:04:00
2018-11-27T22:04:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,252
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 banco.entidade; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.xml.bind.annotation.XmlRootElement; /** * * @author Bruno */ @Entity @Table(name = "estabelecimentos") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Estabelecimentos.findAll", query = "SELECT e FROM Estabelecimentos e") , @NamedQuery(name = "Estabelecimentos.findByIdEstabelecimento", query = "SELECT e FROM Estabelecimentos e WHERE e.idEstabelecimento = :idEstabelecimento") , @NamedQuery(name = "Estabelecimentos.findByRazaoSocial", query = "SELECT e FROM Estabelecimentos e WHERE e.razaoSocial = :razaoSocial") , @NamedQuery(name = "Estabelecimentos.findByCnpj", query = "SELECT e FROM Estabelecimentos e WHERE e.cnpj = :cnpj") , @NamedQuery(name = "Estabelecimentos.findByNomeFantasia", query = "SELECT e FROM Estabelecimentos e WHERE e.nomeFantasia = :nomeFantasia")}) public class Estabelecimentos implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "idEstabelecimento") private Integer idEstabelecimento; @Column(name = "razaoSocial") private String razaoSocial; @Column(name = "cnpj") private String cnpj; @Column(name = "nomeFantasia") private String nomeFantasia; @JoinColumn(name = "idDadoGeral", referencedColumnName = "idDadoGeral") @ManyToOne(optional = false) private Dadosgerais idDadoGeral; @JoinColumn(name = "idUsuario", referencedColumnName = "idUsuario") @ManyToOne(optional = false) private Usuarios idUsuario; public Estabelecimentos() { } public Estabelecimentos(Integer idEstabelecimento) { this.idEstabelecimento = idEstabelecimento; } public Integer getIdEstabelecimento() { return idEstabelecimento; } public void setIdEstabelecimento(Integer idEstabelecimento) { this.idEstabelecimento = idEstabelecimento; } public String getRazaoSocial() { return razaoSocial; } public void setRazaoSocial(String razaoSocial) { this.razaoSocial = razaoSocial; } public String getCnpj() { return cnpj; } public void setCnpj(String cnpj) { this.cnpj = cnpj; } public String getNomeFantasia() { return nomeFantasia; } public void setNomeFantasia(String nomeFantasia) { this.nomeFantasia = nomeFantasia; } public Dadosgerais getIdDadoGeral() { return idDadoGeral; } public void setIdDadoGeral(Dadosgerais idDadoGeral) { this.idDadoGeral = idDadoGeral; } public Usuarios getIdUsuario() { return idUsuario; } public void setIdUsuario(Usuarios idUsuario) { this.idUsuario = idUsuario; } @Override public int hashCode() { int hash = 0; hash += (idEstabelecimento != null ? idEstabelecimento.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 Estabelecimentos)) { return false; } Estabelecimentos other = (Estabelecimentos) object; if ((this.idEstabelecimento == null && other.idEstabelecimento != null) || (this.idEstabelecimento != null && !this.idEstabelecimento.equals(other.idEstabelecimento))) { return false; } return true; } @Override public String toString() { return "banco.entidade.Estabelecimentos[ idEstabelecimento=" + idEstabelecimento + " ]"; } }
[ "bruninho.carvalho159@gmail.com" ]
bruninho.carvalho159@gmail.com
bcd2397d57aa2d5e426a771e85242b6051bdb25b
a708cd4adb98a6f57705340d38013031760e72fb
/src/test/java/com/whitehat/sentinel/plugin/jenkins/test/ValidateConnectionTest.java
54685471d5983498b1088ed97994ed8b94f5f000
[ "MIT" ]
permissive
joe-reece/jenkins-plugin
e66247bc48fb07d6e9014f7786a07eb9e3df2126
62d122ce22a3507bb1ac22d68a64de2e72d25a9b
refs/heads/master
2022-04-09T13:52:56.124236
2020-02-14T23:09:31
2020-02-27T19:08:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,566
java
package com.whitehat.sentinel.plugin.jenkins.test; import static org.junit.Assert.assertEquals; import java.io.IOException; import javax.servlet.ServletException; import org.junit.Test; import com.whitehat.sentinel.plugin.jenkins.controller.Connection; import com.whitehat.sentinel.plugin.jenkins.controller.ValidateException; import com.whitehat.sentinel.plugin.jenkins.ui.UiPublisher.DescriptorImpl; import hudson.util.FormValidation; public class ValidateConnectionTest { public String apiKey = "65ee5a89-62e1-4696-8cd8-8178da12cffc"; public String sentinelUrl = "https://sentinel.localdomain.lan"; @Test public void testSuccessfullConnection() throws IOException, ServletException{ DescriptorImpl descriptorImpl = new DescriptorImpl(); descriptorImpl.setConnection(new Connection() { @Override public boolean validate(String apiKey, String url) throws ValidateException { return true; } }); FormValidation formValidation = descriptorImpl.doValidateConnection(apiKey,sentinelUrl, null, null); assertEquals("OK", formValidation.kind.name()); } @Test public void testFailedConnection() throws IOException, ServletException{ DescriptorImpl descriptorImpl = new DescriptorImpl(); descriptorImpl.setConnection(new Connection() { @Override public boolean validate(String apiKey, String url) throws ValidateException { return false; } }); FormValidation formValidation = descriptorImpl.doValidateConnection(apiKey,sentinelUrl, null, null); assertEquals("ERROR", formValidation.kind.name()); } }
[ "jigar.mehta@whitehatsec.com" ]
jigar.mehta@whitehatsec.com
e3364b4dbb4284db2d80012f0f3430cf960b2f7f
faa3081cde5f493b1a5ee9f15c8a4a00ee0a173f
/index/index/PostingList.java
e5231eeab15185fbc0475ea42726c2c5ac4a00d3
[]
no_license
zhengcharlie8/Search-Engine
e5c7ba22be9dacffabb4bfc892e096cd96c370e7
e2c7ab2138bc561e7d0b560f2bb4009fb508fc7d
refs/heads/main
2023-01-24T11:16:21.467013
2020-12-02T00:59:08
2020-12-02T00:59:08
317,339,257
0
0
null
2020-12-01T22:42:35
2020-11-30T20:34:23
Java
UTF-8
Java
false
false
3,560
java
package index; import java.util.ArrayList; import java.util.List; /** * Inverted List interface * NB: the interface is minimalist and could present more support for iteration * */ /** * @author dfisher * */ public class PostingList { List<Posting> postings; private int postingsIndex; public PostingList () { postings = new ArrayList<Posting>(); postingsIndex = -1; } /** * reset the list pointer to the first element */ public void startIteration () { postingsIndex = 0; } /** * are there any more * @return true if there are remaining elements in the list */ public boolean hasMore() { return (postingsIndex >= 0 && postingsIndex < postings.size()); } /** * skip to or past the specified document id * @param docid the id to skip to * */ public void skipTo (int docid) { while (postingsIndex < postings.size() && getCurrentPosting().getDocId() < docid) { postingsIndex++; } } /** * * @return the current posting in the list or null if the list is empty * or consumed */ public Posting getCurrentPosting() { Posting retval = null; try { retval = postings.get(postingsIndex); } catch (IndexOutOfBoundsException ex) { // ignore } return retval; } /** * @param index the index of the Posting to return * @return the index'th Posting of the list */ public Posting get(int index) { return postings.get(index); } /** * @return the number of Postings in the list */ public int documentCount() { return postings.size(); } /** * @param posting the Posting to add */ public void add(Posting posting) { postings.add(posting); postingsIndex++; } /** * @param docid the document to add a position to * @param position the position to add */ public void add(Integer docid, Integer position) { //TODO: this needs to be an Extent... Posting current = getCurrentPosting(); if (current != null && current.getDocId().equals(docid) ) { current.add(position); } else { Posting posting = new Posting(docid, position); add(posting); } } /** * Transform to an array of integers for encoding * @return the list as a flat array of Integers * * format is (docid count position+)+ */ public Integer[] toIntegerArray () { ArrayList <Integer> retval = new ArrayList<Integer>(); // format is (docid count positions)+ for (Posting p : postings) { retval.addAll(p.toIntegerArray()); } return retval.toArray(new Integer[retval.size()]); } public void fromIntegerArray(int[] input) { // format is (docid count positions)+ int idx = 0; while (idx < input.length) { int docid = input[idx++]; int count = input[idx++]; for (int j = 0; j < count; j++) { int position = input[idx++]; add(docid, position); } } postingsIndex = 0; // reset the list pointer } public int termFrequency() { return postings.stream().mapToInt(p -> p.getTermFreq()).sum(); } @Override public String toString() { StringBuffer buf = new StringBuffer(); int savedIdx = postingsIndex; startIteration(); while (hasMore()) { Posting p = getCurrentPosting(); int doc = p.getDocId(); Integer [] positions = p.getPositionsArray(); buf.append("{").append(doc).append(", "); buf.append(positions.length).append(" ["); for (int i : positions) { buf.append(i).append(" "); } buf.append(" ]} "); skipTo(doc + 1); } postingsIndex = savedIdx; return buf.toString(); } }
[ "44006237+zhengcharlie8@users.noreply.github.com" ]
44006237+zhengcharlie8@users.noreply.github.com
393579e59009410d2cc89bc851c1e7a1c365323f
2aad1d68fbedd1bf4034bc295a07fca429bcbb91
/src/au/edu/unsw/soacourse/dao/UserDao.java
f90e0a07ed8bd45c6b05eb4d5167c1fd16d05d33
[]
no_license
Zaw-Myo-Htun/COMP9322-assignment2-client
8802fcf24cdd46d24042ddda653a9aca822c42ca
0e3e98cddc0c6865032418247eef645369e15bdd
refs/heads/master
2021-01-01T05:23:24.976880
2016-05-26T09:04:23
2016-05-26T09:04:23
59,642,388
0
0
null
null
null
null
UTF-8
Java
false
false
2,952
java
package au.edu.unsw.soacourse.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import au.edu.unsw.soacourse.model.User; import au.edu.unsw.soacourse.util.JDBC_Connection; ; public class UserDao { private Connection connection; public UserDao() { JDBC_Connection conn = new JDBC_Connection(); connection = conn.getConnection(); } public User getUser(String username) { User user = new User(); try { PreparedStatement preparedStatement = connection .prepareStatement("select * from LOCALJOBSEEKER where EMAIL=?"); ResultSet rs = preparedStatement.executeQuery(); if (rs.next()) { user.setUserID(rs.getString("USERID")); user.setName(rs.getString("NAME")); user.setEmail(rs.getString("EMAIL")); user.setPassword(rs.getString("PASSWORD")); } } catch (SQLException e) { e.printStackTrace(); } return user; } public boolean isUserExist(String username, String password) { try { PreparedStatement preparedStatement = connection .prepareStatement("select * from LOCALJOBSEEKER where EMAIL='" + username + " and PASSWORD='" + password + "'"); ResultSet rs = preparedStatement.executeQuery(); return rs.next(); } catch (SQLException e) { e.printStackTrace(); } return false; } public boolean isUserExistAndVerified(String username) { PreparedStatement preparedStatement; try { preparedStatement = connection .prepareStatement("select * from LOCALJOBSEEKER where EMAIL='" + username + "' and VERIFICATION='Yes'"); ResultSet rs = preparedStatement.executeQuery(); return rs.next(); } catch (SQLException e) { e.printStackTrace(); } return false; } public boolean isEmailExist(String email) { PreparedStatement preparedStatement; try { preparedStatement = connection .prepareStatement("select * from LOCALJOBSEEKER where EMAIL=" + email + "'"); ResultSet rs = preparedStatement.executeQuery(); return rs.next(); } catch (SQLException e) { // TOD0 Auto-generated catch block e.printStackTrace(); } return false; } public void addUser (User user) { try { PreparedStatement preparedStatement = connection .prepareStatement("insert into LOCALJOBSEEKER" + "(USERID, EMAIL, PASSWORD, NAME, VERIFICATION) values (?, ?, ?, ?, ?)"); preparedStatement.setString(1, user.getUserID()); preparedStatement.setString (2, user.getEmail ()); preparedStatement.setString(3, user.getPassword()); preparedStatement.setString (4, user.getName()); preparedStatement.setString(5, user. getVerified()); preparedStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } } }
[ "Zaw@Zaws-MacBook-Pro.local" ]
Zaw@Zaws-MacBook-Pro.local
e41901afc0f76d24ba55babb9eef4689446e972e
2c72ba9bb0aca283c24e96ae6f76aa05e8c7a2e6
/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/SearchListFragment.java
2553592889ab087a262d3a18a2449d8e1c99c147
[ "MIT" ]
permissive
Cvalladares/AntennaPod_Instrumented
46828ab514e573e403b40e5ac2c37ab279115444
b5a961b35c33e147eb5f72925593eea9d7adc38c
refs/heads/master
2020-07-17T23:36:40.259854
2019-09-03T16:52:14
2019-09-03T16:52:14
206,123,145
0
0
null
null
null
null
UTF-8
Java
false
false
2,705
java
package de.danoeh.antennapod.fragment.gpodnet; import android.os.Bundle; import androidx.core.view.MenuItemCompat; import androidx.appcompat.widget.SearchView; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import org.apache.commons.lang3.Validate; import java.util.List; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.gpoddernet.GpodnetService; import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException; import de.danoeh.antennapod.core.gpoddernet.model.GpodnetPodcast; import de.danoeh.antennapod.menuhandler.MenuItemUtils; /** * Performs a search on the gpodder.net directory and displays the results. */ public class SearchListFragment extends PodcastListFragment { private static final String ARG_QUERY = "query"; private String query; public static SearchListFragment newInstance(String query) { SearchListFragment fragment = new SearchListFragment(); Bundle args = new Bundle(); args.putString(ARG_QUERY, query); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null && getArguments().containsKey(ARG_QUERY)) { this.query = getArguments().getString(ARG_QUERY); } else { this.query = ""; } } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); // parent already inflated menu MenuItem searchItem = menu.findItem(R.id.action_search); final SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem); MenuItemUtils.adjustTextColor(getActivity(), sv); sv.setQueryHint(getString(R.string.gpodnet_search_hint)); sv.setQuery(query, false); sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { sv.clearFocus(); changeQuery(s); return true; } @Override public boolean onQueryTextChange(String s) { return false; } }); } @Override protected List<GpodnetPodcast> loadPodcastData(GpodnetService service) throws GpodnetServiceException { return service.searchPodcasts(query, 0); } private void changeQuery(String query) { Validate.notNull(query); this.query = query; loadData(); } }
[ "Cvalladares4837@gmail.com" ]
Cvalladares4837@gmail.com
8f55fae02c8f3349c538d42c19f49e74ea02f685
b7a3c81fee30fda918fa8d83135dbc132e4347e5
/src/de/bananaco/bpermissions/api/CalculableMeta.java
27b32ec4bbd5f8aee770a95f0d4ba198c9567875
[]
no_license
boozaa/bPermissions
ab1376a3a641d9ce6e4fb4a25aaecf13588865b7
ca771d42464af0058311a0728e1210dc8f89e11e
refs/heads/master
2021-01-24T01:30:17.415860
2013-02-13T16:21:04
2013-02-13T16:21:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,180
java
package de.bananaco.bpermissions.api; import java.util.HashMap; import java.util.Map; import java.util.Set; public class CalculableMeta extends GroupCarrier { Map<String, String> effectiveMeta; @SuppressWarnings({ "unchecked", "rawtypes" }) protected CalculableMeta(Set<String> groups, Set<Permission> permissions, String world) { super(groups, permissions, world); effectiveMeta = new HashMap(); } /** * Used to calculate the total permissions gained by the object * @throws RecursiveGroupException */ public void calculateEffectiveMeta() throws RecursiveGroupException { try { // Implement meta priorities effectiveMeta.clear(); Map<String, Integer> pr = new HashMap<String, Integer>(); for (String gr : serialiseGroups()) { Group group = WorldManager.getInstance().getWorld(getWorld()).getGroup(gr); // Calculate down the tree of the child group group.calculateEffectiveMeta(); Map<String, String> meta = group.getEffectiveMeta(); for(String key : meta.keySet()) { // If the effectiveMeta does not contain the key or the priority is greater than the current if(!pr.containsKey(key) || group.getPriority() > pr.get(key)) { // Store the priority too! effectiveMeta.put(key, meta.get(key)); pr.put(key, group.getPriority()); } } } pr.clear(); // Obviously local priority wins every time Map<String, String> meta = this.getMeta(); for(String key : meta.keySet()) { effectiveMeta.put(key, meta.get(key)); } } catch (StackOverflowError e) { throw new RecursiveGroupException(this); } } public Map<String, String> getEffectiveMeta() { return effectiveMeta; } /** * Here you go MiracleM4n! * Returns the stored "effective" meta value (calculated with inheritance/priority) * @param key * @return String (or "" if no value) */ public String getEffectiveValue(String key) { if(containsEffectiveValue(key)) return effectiveMeta.get(key); return ""; } public boolean containsEffectiveValue(String key) { return effectiveMeta.containsKey(key); } @Override public void clear() { this.effectiveMeta.clear(); super.clear(); } }
[ "benbenben001@gmail.com" ]
benbenben001@gmail.com
334e170ba2dd3d2fa8f58d0b7dd2d2106de8fa39
dd671451b71b16dcade3b77e6bc7ad73b87d3470
/project/app/src/main/java/com/example/dhaval/project/principal/p_result.java
8ac6de7be09154c58d2500b267fdd4209a6ce69d
[]
no_license
iamdhavalparmar/college-mangement-app
3956e638c322ad2e44d6651279f63fd4316da7fc
e947ee5c6552321c9fe6b7adaca189735d1c5f45
refs/heads/master
2022-12-23T09:53:27.853706
2020-09-18T12:32:46
2020-09-18T12:32:46
296,612,556
1
0
null
null
null
null
UTF-8
Java
false
false
801
java
package com.example.dhaval.project.principal; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import com.example.dhaval.project.R; public class p_result extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_p_result); } public void res1(View view) { Intent it = new Intent(this,p_res1.class); startActivity(it); } public void res2(View view) { Intent it = new Intent(this,p_res2.class); startActivity(it); } public void res3(View view) { Intent it = new Intent(this,p_res3.class); startActivity(it); } }
[ "dkp48107@gmail.com" ]
dkp48107@gmail.com
86dec49538a878ab99c190c2304b619ec52e2c56
782e8594e564d7ef98f8ac846137f3f648e0309f
/Java/test/com/github/emman_b/problems/BalancedParenthesesTest.java
d5ba1f61d420e8acc5a088f60e0e58f984832588
[]
no_license
Emman-B/DataStructures-And-Algorithms
ed9d494c4afcaf2885cefb786d5cad2c9313ad2f
b67782f360ea1c706e9e8a6875b7b4ee1ec86a44
refs/heads/main
2023-08-15T22:19:31.766104
2021-09-30T04:03:59
2021-09-30T04:03:59
402,214,265
0
0
null
null
null
null
UTF-8
Java
false
false
1,385
java
package com.github.emman_b.problems; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class BalancedParenthesesTest { BalancedParentheses bp = new BalancedParentheses(); @Test void BalancedParentheses_WithOneSetOfParentheses_ShouldReturnTrue() { String input = "()"; assertTrue(bp.isParenthesesBalanced(input)); } @Test void BalancedParentheses_WithSingleParenthesis_ShouldReturnFalse() { String input1 = "("; String input2 = ")"; assertFalse(bp.isParenthesesBalanced(input1)); assertFalse(bp.isParenthesesBalanced(input2)); } @Test void BalancedParentheses_WithOneSetOfParenthesesBackwards_ShouldReturnFalse() { String input = ")("; assertFalse(bp.isParenthesesBalanced(input)); } @Test void BalancedParentheses_WithValidAdjacentSetsOfParentheses_ShouldReturnTrue() { String input = "()()"; assertTrue(bp.isParenthesesBalanced(input)); } @Test void BalancedParentheses_WithValidNestedParentheses_ShouldReturnTrue() { String input = "(()())"; assertTrue(bp.isParenthesesBalanced(input)); } @Test void BalancedParentheses_WithInvalidNestedParentheses_ShouldReturnTrue() { String input = "(()()))"; assertFalse(bp.isParenthesesBalanced(input)); } }
[ "emmanuelbutor.mehs@gmail.com" ]
emmanuelbutor.mehs@gmail.com
e4b12ab05d6237d931f2282d03560db7c686f33d
d4aa30664a3610f9906aa665716289677b82b6b1
/src/main/java/chapter5/Product.java
874590330138df53585d321675358d7ce6ec7bd8
[]
no_license
gfyan/concurrent-programming
49d037ac34ab0cd265e1b397fdf5741fe33041cd
ea040825b6a138b40ad955797d58abb753e21726
refs/heads/master
2021-05-15T20:59:31.283648
2018-02-02T11:57:33
2018-02-02T11:57:33
107,916,511
2
0
null
2017-10-23T01:10:21
2017-10-23T01:10:21
null
UTF-8
Java
false
false
511
java
package chapter5; /** * Created by 13 on 2017/5/6. */ public final class Product { private final String no; private final String name; private final String price; public Product(String no, String name, String price) { super(); this.no = no; this.name = name; this.price = price; } public String getNo() { return no; } public String getName() { return name; } public String getPrice() { return price; } }
[ "1034683568@qq.com" ]
1034683568@qq.com
6634c1b73535cc849c5161855e657c368c77dd24
33fa9b6d6bfc73b77bf4a439101c0d14e165f67a
/src/main/java/com/imagine/neatfeat/model/dal/dao/DeliveryStatusDAO.java
4ecfabfc6df4b072f8ce5358f9f08bb78aab7606
[]
no_license
mnet3030/neat-feet
a7f927e413dc90ea7237fff625f98567a7837e3f
d25e9822c991d45867d96a7c1394327e328e9b28
refs/heads/master
2020-05-02T07:59:38.452330
2019-04-27T11:22:10
2019-04-27T21:04:29
177,831,754
0
0
null
null
null
null
UTF-8
Java
false
false
307
java
package com.imagine.neatfeat.model.dal.dao; import com.imagine.neatfeat.model.dal.entity.DeliveryStatus; import org.hibernate.Session; public class DeliveryStatusDAO extends GenericDAO<DeliveryStatus> { public DeliveryStatusDAO(Session session) { super(session, DeliveryStatus.class); } }
[ "Eng.Mahmoud.Shereif@gmail.com" ]
Eng.Mahmoud.Shereif@gmail.com
87ae3452a48af95a02b40aca61495650fd64879d
cea022866103ef4d84b0e6551926905029f69f34
/android/app/src/main/java/ku/kuku/adab_makan/MainActivity.java
ac0aaaaea4de3f5ea666a779258eab1430babf1f
[]
no_license
alizainal213/adab_makan
1b613edea7e375178b7bf6af47f47e74513ebffa
7a84bc8991390c8339068c6398e475c7d95ccbe9
refs/heads/master
2020-09-17T02:06:36.282173
2019-11-25T13:35:09
2019-11-25T13:35:09
223,956,586
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
package ku.kuku.adab_makan; import android.os.Bundle; import io.flutter.app.FlutterActivity; import io.flutter.plugins.GeneratedPluginRegistrant; public class MainActivity extends FlutterActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GeneratedPluginRegistrant.registerWith(this); } }
[ "alizainalabidin213@gmail.com" ]
alizainalabidin213@gmail.com
7f8f32c3f50857a90d1b3ef1f3b14152f992cca2
6ed8d9f062d435243a2f198dad175240dc8fce00
/src/robotbuilder/data/RobotComponent.java
f190dc576276899becce42633d3e7aff4c741aa2
[]
no_license
FRCTeam1073-TheForceTeam/SLOC-Oriented-Robot-Builder
2bc48c1bd7ff26893c1d1f750177b05f876313e2
89b9078f204713cf19d664aa11b2dc0b3e4da9bd
refs/heads/master
2021-01-01T16:34:58.730716
2012-12-08T22:15:37
2012-12-08T22:15:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,275
java
package robotbuilder.data; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import java.util.Vector; import javax.swing.tree.DefaultMutableTreeNode; import robotbuilder.palette.Palette; import robotbuilder.robottree.RobotTree; import robotbuilder.data.properties.Property; /** *nameToAdd * @author Alex Henning */ public class RobotComponent extends DefaultMutableTreeNode { private String name; private PaletteComponent base; private RobotTree robot; private Map<String, Property> properties; public RobotComponent() { super(); } /** * Creates a new RobotComponent. * @param name The name of the new component. * @param base The PaletteComponent that will be exported. * @param robot The RobotTree that contains this. */ public RobotComponent(String name, PaletteComponent base, RobotTree robot) { super(); this.name = name; this.base = base; this.robot = robot; properties = new HashMap<String, Property>(); for (String propName : base.getPropertiesKeys()) { properties.put(propName, base.getProperty(propName).copy()); properties.get(propName).setComponent(this); } for (String propName : base.getPropertiesKeys()) { properties.get(propName).setUnique(); } robot.addName(name); } /** * Creates a new RobotComponent. * @param name The name of the new component. * @param type The type of the new component (like in the {@link Palette}). * @param robot The RobotTree that this will be created in. */ public RobotComponent(String name, String type, RobotTree robot) { this(name, Palette.getInstance().getItem(type), robot); } public Property getProperty(String key) { return properties.get(key); } public String[] getPropertyKeys() { return base.getPropertiesKeys().toArray(new String[0]); } public boolean isValid() { for (Property property : properties.values()) { property.update(); if (!property.isValid()) { return false; } } if (children != null) { for (Object comp : children) { if (!((RobotComponent) comp).isValid()) { return false; } } } return true; } @Override public boolean equals(Object oth) { if (oth instanceof RobotComponent) { RobotComponent other = (RobotComponent) oth; boolean equal = getFullName().equals(other.getFullName()) && getBaseType().equals(other.getBaseType()) && getProperties().equals(other.getProperties()) && getChildren().size() == other.getChildren().size(); if (equal) { for (int i = 0; i < getChildren().size(); i++) { equal = equal && getChildren().elementAt(i).equals(other.getChildren().elementAt(i)); } } return equal; } return false; } @Override public int hashCode() { return base.hashCode(); } @Override public String toString() { return name; } public String getName() { return name; } public final void setName(String name) { if (this.name != null) { robot.removeName(getFullName()); this.name = name; robot.addName(getFullName()); } else { this.name = name; } } public PaletteComponent getBase() { return base; } public void setProperty(String key, Object val) { properties.get(key).setValue(val); } public Map<String, Property> getProperties() { return properties; } public void setProperties(Map<String, Property> properties) { this.properties = properties; } public Vector<DefaultMutableTreeNode> getChildren() { if (children != null) return children; else return new Vector<DefaultMutableTreeNode>(); } public void setChildren(Vector<DefaultMutableTreeNode> children) { this.children = children; } public String getBaseType() { return base.getName(); } public void setBaseType(String baseType) { this.base = Palette.getInstance().getItem(baseType); } /** * @param component The component type to check. * @return Whether it can support adding another component of that type. */ public boolean supports(PaletteComponent component) { String type = component.getType(); if (base.getSupports().containsKey(type)) { if (base.getSupports().get(type) == Palette.UNLIMITED) { return true; } else { int typeCount = 0; for (Enumeration i = children(); i.hasMoreElements();) { if (type.equals(((RobotComponent) i.nextElement()).getBase().getType())) { typeCount++; } } return typeCount < base.getSupports().get(type); } } return false; } /** * @param component The component type to check. * @return Whether it can support adding another component of that type. */ public boolean supports(RobotComponent data) { return (children != null && children.contains(data)) || this.supports(data.getBase()); } public boolean supportsChildren() { return base.supportsChildren(); } public void walk(RobotWalker walker) { for (Enumeration i = this.children(); i.hasMoreElements();) { RobotComponent child = (RobotComponent) i.nextElement(); child.walk(walker); } walker.handleRobotComponent(this); } public <T> T visit(RobotVisitor<T> visitor, Object...extra) { return visitor.visit(this, extra); } public String getSubsystem() { if (getBase().getType().equals("Subsystem")) return getName()+" "; else if (getParent() == null) return ""; else return ((RobotComponent) getParent()).getSubsystem(); } /** * @return The full name of this component including it's subsystem name. */ public String getFullName() { if (getBase().getType().equals("Subsystem")) return name; else return getSubsystem()+name; } public Vector<String> getChildrenOfTypeNames(String type) { if (children == null) return new Vector<String>(); Vector<String> names = new Vector<String>(); for (Object child : children) { if (type.equals(((RobotComponent) child).getBase().getType())) { names.add(((RobotComponent) child).getFullName()); } names.addAll(((RobotComponent) child).getChildrenOfTypeNames(type)); } return names; } public Vector<String> getChildrenOfComponentNames(String componentName) { if (children == null) return new Vector<String>(); Vector<String> names = new Vector<String>(); for (Object child : children) { if (componentName.equals(((RobotComponent) child).getBase().getName())) { names.add(((RobotComponent) child).getFullName()); } names.addAll(((RobotComponent) child).getChildrenOfComponentNames(componentName)); } return names; } public void setRobotTree(RobotTree robot) { this.robot = robot; } public RobotTree getRobotTree() { return robot; } public void addChild(RobotComponent child) { if(this.allowsChildren && this.supports(child)) this.add(child); } public String getErrorMessage() { String message = ""; for (String propertyName : getPropertyKeys()) { final Property property = getProperty(propertyName); if (!property.isValid()) { message += property.getName()+": "+property.getErrorMessage()+"\n"; } } if (children != null) { for (Object comp : children) { String m = ((RobotComponent) comp).getErrorMessage(); if (m != null && !m.equals("")) { message += ""+((RobotComponent) comp).getFullName()+":\n"+m; } } } return message; } /** * Handle being deleted by cleaning up validators and so forth. */ public void handleDelete() { for (Property prop : properties.values()) { if (prop.getValidators() != null) { for (String validatorName : prop.getValidators()) { Validator validator = getRobotTree().getValidator(validatorName); if (validator != null) { validator.delete(this, prop.getName()); } } } } } }
[ "evinoog96@gmail.com" ]
evinoog96@gmail.com
b4633b6cbeca47bd0d2896092f4ac4e1031b24e6
d2b517787fd523808024b108c983c049bd7ff593
/Hieu.NguyenVan/Java_Core/Assignment1/VTI_TTS_1/src/EX3/Ford.java
7b4f5135cbbce37bd589503a2e0791823834b6ed
[]
no_license
vietduc030496/VTI-Java07-08
8ae0af38aa94631ccfd5fc22d363e27de45f734a
8badb215627029dd8748128673ba16227f3c889c
refs/heads/master
2023-07-09T12:28:02.764911
2021-08-17T15:23:13
2021-08-17T15:23:13
385,857,685
0
1
null
null
null
null
UTF-8
Java
false
false
877
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 EX3; /** * * @author hieu.nguyenvan1 */ public class Ford extends Car{ private int year; private int manufactureDiscount; public Ford() { super(); } public Ford(int year, int manufactureDiscount) { super(); this.year = year; this.manufactureDiscount = manufactureDiscount; } public Ford(int year, int manufactureDiscount, int speed, double regularPrice, String color) { super(speed, regularPrice, color); this.year = year; this.manufactureDiscount = manufactureDiscount; } public double getSalePrice(){ return this.getRegularPrice()-manufactureDiscount; } }
[ "hieuhamhocpro@gmail.com" ]
hieuhamhocpro@gmail.com
b1003c0ffe706f775fe6ce479e386ab4a09eae43
485df7677253fc9f7756168efe0211f936e779a4
/ins-modules/ins-mc-service/src/main/java/ins/platform/aggpay/mc/handler/DingTalkMessageHandler.java
c2a28c273555de9485cc7d45ab985137cc98eac2
[]
no_license
cuiouyang/Feat_cuiouyang
20cf18d12503165ccf5edba1809441e8d796b4f0
674d25bb1334abebd63b7143c7874a745fefadbf
refs/heads/master
2020-03-28T19:18:58.823364
2018-09-15T08:48:33
2018-09-15T08:48:33
148,964,365
0
2
null
null
null
null
UTF-8
Java
false
false
1,448
java
package ins.platform.aggpay.mc.handler; import ins.platform.aggpay.common.util.template.DingTalkMsgTemplate; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.alibaba.fastjson.JSONObject; import ins.platform.aggpay.mc.config.DingTalkPropertiesConfig; import com.xiaoleilu.hutool.http.HttpUtil; import com.xiaoleilu.hutool.util.StrUtil; /** * @author lengleng * @date 2018/4/22 * 发送钉钉消息逻辑 */ @Slf4j @Component public class DingTalkMessageHandler { @Autowired private DingTalkPropertiesConfig dingTalkPropertiesConfig; /** * 业务处理 * * @param text 消息 */ public boolean process(String text) { String webhook = dingTalkPropertiesConfig.getWebhook(); if (StrUtil.isBlank(webhook)) { log.error("钉钉配置错误,webhook为空"); return false; } DingTalkMsgTemplate dingTalkMsgTemplate = new DingTalkMsgTemplate(); dingTalkMsgTemplate.setMsgtype("text"); DingTalkMsgTemplate.TextBean textBean = new DingTalkMsgTemplate.TextBean(); textBean.setContent(text); dingTalkMsgTemplate.setText(textBean); String result = HttpUtil.post(webhook, JSONObject.toJSONString(dingTalkMsgTemplate)); log.info("钉钉提醒成功,报文响应:{}", result); return true; } }
[ "yanshuiping925@163.com" ]
yanshuiping925@163.com
e1c8327b3c05a3992ed52a8fa470ebacd423056a
5a320698c0804e4789840373d17f931a5caaf5b7
/td2/src/main/java/com/tdm/esi/td2/Main2Activity.java
c74416a2fd9ec3158d00425fdbbf80157ac728bb
[]
no_license
Dehmane/TDM_Visio
258858e5d12534e8d2c8e97714c8b89714ad0271
a02723ac908e4cab992cb84a4ba15b57aad6efe4
refs/heads/master
2021-01-10T18:00:41.300331
2016-03-22T09:05:14
2016-03-22T09:05:14
54,460,466
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
package com.tdm.esi.td2; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class Main2Activity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); } }
[ "Abderrahmane" ]
Abderrahmane
211d0a7fbed54ecc415b6c7b83ef8c30f1d40cae
8326e7207db51b0c356a94a739be8339868647d0
/Projects/Luggage/codeSources/new/backend/restServices/src/main/java/com/entities/colis/Colis.java
cbe19738bfca3a82f66be1c8f1e4a151e2b41d2f
[]
no_license
tchatchouang/babyProject2
a955d6aa78da7b18916374aed12faceb655ca096
f245571a082cab0f3c00d611599fd64af641b8e8
refs/heads/master
2020-03-26T11:53:38.312719
2018-09-05T20:07:52
2018-09-05T20:07:52
144,864,918
0
0
null
null
null
null
UTF-8
Java
false
false
2,057
java
package com.entities.colis; import com.entities.colisReceptionner.ColisReceptionner; import com.entities.colisTransporter.ColisTransporter; import com.entities.proposerColis.ProposerColis; import com.entities.typeColis.TypeColis; import com.fasterxml.jackson.annotation.JsonIgnore; import javax.persistence.*; import java.io.Serializable; import java.util.HashSet; import java.util.Set; @Entity public class Colis implements Serializable{ /** * */ private static final long serialVersionUID = 1L; //variables @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long idColis; private String libelleColis; private double poidColis; @JsonIgnore @OneToMany(fetch = FetchType.LAZY, mappedBy = "id.colis", cascade = CascadeType.ALL) private Set<ColisReceptionner> colisReceptionner = new HashSet<ColisReceptionner>(); @JsonIgnore @OneToMany(fetch = FetchType.LAZY, mappedBy = "id.colis", cascade = CascadeType.ALL) private Set<ProposerColis> proposerColis = new HashSet<ProposerColis>(); @JsonIgnore @OneToMany(fetch = FetchType.LAZY, mappedBy = "id.colis", cascade = CascadeType.ALL) private Set<ColisTransporter> colisTransporter = new HashSet<ColisTransporter>(); public Colis() { super(); } public Colis(String libelleColis, double poidColis, Set<ColisReceptionner> colisReceptionner, Set<ProposerColis> proposerColis, Set<ColisTransporter> colisTransporter, TypeColis typeColis) { super(); this.libelleColis = libelleColis; this.poidColis = poidColis; this.colisReceptionner = new HashSet<>(); this.proposerColis = new HashSet<>(); this.colisTransporter = new HashSet<>(); } public Long getIdColis() { return idColis; } public void setIdColis(Long idColis) { this.idColis = idColis; } public String getLibelleColis() { return libelleColis; } public void setLibelleColis(String libelleColis) { this.libelleColis = libelleColis; } public double getTaille() { return poidColis; } public void setTaille(double poidColis) { this.poidColis = poidColis; } }
[ "willi.tchatchouang@yahoo.ca" ]
willi.tchatchouang@yahoo.ca
6d5be98ef90f4b4912f3c8fdb76d3e72b5747960
c3648862740da9c00f0bba4f713fd361baf8f8ed
/BOJ/2020.05/Solution_2146_다리만들기.java
74d5422eac06131c253017eba287078cd951ff3e
[]
no_license
SURAMCHOI/algorithm
de560f21eab2b2af027daa8a6f97b7250618d209
62effb824e4d4f1db7d749414d666b345855cd4d
refs/heads/master
2021-07-09T15:42:42.304588
2020-08-31T15:52:06
2020-08-31T15:52:06
181,139,185
0
0
null
null
null
null
UTF-8
Java
false
false
2,229
java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.Queue; import java.util.StringTokenizer; public class Solution_2146_다리만들기 { static int N,islandIdx,answer; static int map[][]; public static void main(String[] args)throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); N=Integer.parseInt(br.readLine()); map=new int [N][N]; islandIdx=2; answer=Integer.MAX_VALUE; for(int i=0;i<N;i++){ StringTokenizer st=new StringTokenizer(br.readLine()," "); for(int j=0;j<N;j++){ map[i][j]=Integer.parseInt(st.nextToken()); } } for(int i=0;i<N;i++){ for(int j=0;j<N;j++){ if(map[i][j]==1){ bfs(i,j); islandIdx++; } } } for(int i=2;i<islandIdx;i++){ int num=make_bridge(i); System.out.println(num); answer=Math.min(answer,num); } System.out.println(answer); } //end of main private static int make_bridge(int startnum) { Queue<int []> q=new LinkedList<>(); boolean check[][]=new boolean [N][N]; for(int i=0;i<N;i++){ for(int j=0;j<N;j++){ if(map[i][j]==startnum){ q.add(new int [] {i,j}); check[i][j]=true; } } } int cnt=0; while(!q.isEmpty()){ int qsize=q.size(); for(int qi=0;qi<qsize;qi++){ int cur[]=q.poll(); int x=cur[0]; int y=cur[1]; for(int d=0;d<4;d++){ int nx=x+dir[d][0]; int ny=y+dir[d][1]; if(nx<0||nx>=N||ny<0||ny>=N) continue; if(!check[nx][ny]&&map[nx][ny]==0){ check[nx][ny]=true; q.add(new int []{nx,ny}); }else if(map[nx][ny]!=0 && map[nx][ny]!=startnum){ return cnt; } } } cnt++; } return 0; } static int dir[][]={{-1,0},{1,0},{0,-1},{0,1}}; private static void bfs(int i, int j) { Queue<int []> queue=new LinkedList<int[]>(); queue.add(new int []{i,j}); map[i][j]=islandIdx; while(!queue.isEmpty()){ int cur[]=queue.poll(); int x=cur[0]; int y=cur[1]; for(int d=0;d<4;d++){ int nx=x+dir[d][0]; int ny=y+dir[d][1]; if(nx<0||nx>=N||ny<0||ny>=N) continue; if(map[nx][ny]==1){ map[nx][ny]=islandIdx; queue.offer(new int []{nx,ny}); } } } } }//end of class
[ "tnfka905@naver.com" ]
tnfka905@naver.com
08f9dc8076b2ac060a71f8b62c68151f566a2cdf
e43a4e3e25cf33935827dbc07226d6e0b04c6f87
/Aula02/Atividade02/WebAppSpring1/src/java/br/ufg/inf/service/ClienteService.java
cf1eb5a748c8810375896aae4a4d50fcca1f09d4
[]
no_license
mayconspirlandelli/spring
ea31c2129937d0de204c18c3109b45ca1866f7da
e9a767b7a150381f237ab34571caae70a8edcb9f
refs/heads/master
2021-03-12T23:20:05.401161
2015-01-16T17:34:22
2015-01-16T17:34:22
25,914,996
0
0
null
null
null
null
UTF-8
Java
false
false
675
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package br.ufg.inf.service; import br.ufg.inf.model.Cliente; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * * @author vinicius */ @Service public class ClienteService { private Cliente cliente; @Autowired public void setCliente(Cliente cliente){ this.cliente = cliente; } public Cliente getCliente(){ return cliente; } @Override public String toString(){ return "O cliente \"" + cliente.getNome() + "\" foi inserido com sucesso!"; } }
[ "mayconspirlandelli@yahoo.com.br" ]
mayconspirlandelli@yahoo.com.br
3bd2e06972f00bdb89a1dea30b6b5184bbf203d8
e55abfae76976470cc8d2f6b9d106be511518b3a
/src/main/java/corejava/corejava9/v1ch10/preferences/PreferencesTest.java
d6537b20ffa0c4e9418066ca34f067cf34d22a54
[]
no_license
edgarseu/javacore
778b144cf0e9a7614c7db70ecaa88403d2ab6483
4c519ec2ce7ee58ad505d6833781c151464ec068
refs/heads/master
2022-05-29T07:50:50.597241
2019-10-26T02:52:04
2019-10-26T02:52:17
140,532,572
0
0
null
2020-10-13T03:54:17
2018-07-11T06:39:07
Java
UTF-8
Java
false
false
4,368
java
package corejava.corejava9.v1ch10.preferences; import java.awt.EventQueue; import java.awt.event.*; import java.io.*; import java.util.prefs.*; import javax.swing.*; /** * A program to test preference settings. The program remembers the frame position, size, and title. * @version 1.02 2007-06-12 * @author Cay Horstmann */ public class PreferencesTest { public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { PreferencesFrame frame = new PreferencesFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }); } } /** * A frame that restores position and size from user preferences and updates the preferences upon * exit. */ class PreferencesFrame extends JFrame { private static final int DEFAULT_WIDTH = 300; private static final int DEFAULT_HEIGHT = 200; public PreferencesFrame() { // get position, size, title from preferences Preferences root = Preferences.userRoot(); final Preferences node = root.node("/com/horstmann/corejava"); int left = node.getInt("left", 0); int top = node.getInt("top", 0); int width = node.getInt("width", DEFAULT_WIDTH); int height = node.getInt("height", DEFAULT_HEIGHT); setBounds(left, top, width, height); // if no title given, ask user String title = node.get("title", ""); if (title.equals("")) title = JOptionPane.showInputDialog("Please supply a frame title:"); if (title == null) title = ""; setTitle(title); // set up file chooser that shows XML files final JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new File(".")); // accept all files ending with .xml chooser.setFileFilter(new javax.swing.filechooser.FileFilter() { public boolean accept(File f) { return f.getName().toLowerCase().endsWith(".xml") || f.isDirectory(); } public String getDescription() { return "XML files"; } }); // set up menus JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu menu = new JMenu("File"); menuBar.add(menu); JMenuItem exportItem = new JMenuItem("Export preferences"); menu.add(exportItem); exportItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (chooser.showSaveDialog(PreferencesFrame.this) == JFileChooser.APPROVE_OPTION) { try { OutputStream out = new FileOutputStream(chooser.getSelectedFile()); node.exportSubtree(out); out.close(); } catch (Exception e) { e.printStackTrace(); } } } }); JMenuItem importItem = new JMenuItem("Import preferences"); menu.add(importItem); importItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (chooser.showOpenDialog(PreferencesFrame.this) == JFileChooser.APPROVE_OPTION) { try { InputStream in = new FileInputStream(chooser.getSelectedFile()); Preferences.importPreferences(in); in.close(); } catch (Exception e) { e.printStackTrace(); } } } }); JMenuItem exitItem = new JMenuItem("Exit"); menu.add(exitItem); exitItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { node.putInt("left", getX()); node.putInt("top", getY()); node.putInt("width", getWidth()); node.putInt("height", getHeight()); node.put("title", getTitle()); System.exit(0); } }); } }
[ "caozy@Ctrip.com" ]
caozy@Ctrip.com
1272ff3961c83d5df307d5f8bc255e1b6cb041f3
02df0e0bf689e40330b83727e05d04c9c467efa4
/week3/spring-boot-et/room-web-app/src/main/java/com/wizeline/techmentoring/roomwebapp/controller/StaffController.java
4bc2a28c8f45fc3a0e4eded1b82f74c014d20f2d
[]
no_license
paopileno/tech-mentoring
58368a607429968cbc08eca0dc668f79ef4e2e38
ef4c193554774a98e4b35cea0413a0a1d7f4e02f
refs/heads/master
2023-06-13T22:52:45.077008
2021-07-24T17:47:57
2021-07-24T17:47:57
379,090,548
0
0
null
2021-07-24T17:47:57
2021-06-21T23:45:19
Java
UTF-8
Java
false
false
662
java
package com.wizeline.techmentoring.roomwebapp.controller; 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 com.wizeline.techmentoring.roomwebapp.service.StaffService; import lombok.AllArgsConstructor; @Controller @RequestMapping("/staff") @AllArgsConstructor public class StaffController { private final StaffService staffService; @GetMapping public String getStaff(Model model) { model.addAttribute("staff", staffService.getDBStaff()); return "staff"; } }
[ "paola.pileno@wizeline.com" ]
paola.pileno@wizeline.com
bce846ff99ac8a3514c139ec083db01a052e037d
f08256664e46e5ac1466f5c67dadce9e19b4e173
/sources/p520io/reactivex/processors/C11966c.java
b93287467463951bcf3e27e838690cec4a2f0f96
[]
no_license
IOIIIO/DisneyPlusSource
5f981420df36bfbc3313756ffc7872d84246488d
658947960bd71c0582324f045a400ae6c3147cc3
refs/heads/master
2020-09-30T22:33:43.011489
2019-12-11T22:27:58
2019-12-11T22:27:58
227,382,471
6
3
null
null
null
null
UTF-8
Java
false
false
9,374
java
package p520io.reactivex.processors; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import org.reactivestreams.C14314c; import org.reactivestreams.Subscriber; import p520io.reactivex.p523c0.C11915a; import p520io.reactivex.p531y.p533b.C12036b; import p520io.reactivex.p531y.p543f.C12491c; import p520io.reactivex.p531y.p546i.C12533a; import p520io.reactivex.p531y.p546i.C12536d; import p520io.reactivex.p531y.p546i.C12539g; import p520io.reactivex.p531y.p547j.C12544d; /* renamed from: io.reactivex.processors.c */ /* compiled from: UnicastProcessor */ public final class C11966c<T> extends C11964a<T> { /* renamed from: U */ final C12491c<T> f27639U; /* renamed from: V */ final AtomicReference<Runnable> f27640V; /* renamed from: W */ final boolean f27641W; /* renamed from: X */ volatile boolean f27642X; /* renamed from: Y */ Throwable f27643Y; /* renamed from: Z */ final AtomicReference<Subscriber<? super T>> f27644Z; /* renamed from: a0 */ volatile boolean f27645a0; /* renamed from: b0 */ final AtomicBoolean f27646b0; /* renamed from: c0 */ final C12533a<T> f27647c0; /* renamed from: d0 */ final AtomicLong f27648d0; /* renamed from: e0 */ boolean f27649e0; /* renamed from: io.reactivex.processors.c$a */ /* compiled from: UnicastProcessor */ final class C11967a extends C12533a<T> { C11967a() { } /* renamed from: a */ public int mo30285a(int i) { if ((i & 2) == 0) { return 0; } C11966c.this.f27649e0 = true; return 2; } /* renamed from: b */ public void mo29946b(long j) { if (C12539g.m39330c(j)) { C12544d.m39341a(C11966c.this.f27648d0, j); C11966c.this.mo30284l(); } } public void cancel() { if (!C11966c.this.f27645a0) { C11966c cVar = C11966c.this; cVar.f27645a0 = true; cVar.mo30283k(); C11966c cVar2 = C11966c.this; if (!cVar2.f27649e0 && cVar2.f27647c0.getAndIncrement() == 0) { C11966c.this.f27639U.clear(); C11966c.this.f27644Z.lazySet(null); } } } public void clear() { C11966c.this.f27639U.clear(); } public boolean isEmpty() { return C11966c.this.f27639U.isEmpty(); } public T poll() { return C11966c.this.f27639U.poll(); } } C11966c(int i) { this(i, null, true); } /* renamed from: a */ public static <T> C11966c<T> m38535a(int i) { return new C11966c<>(i); } /* access modifiers changed from: 0000 */ /* renamed from: b */ public void mo30281b(Subscriber<? super T> subscriber) { C12491c<T> cVar = this.f27639U; int i = 1; boolean z = !this.f27641W; while (!this.f27645a0) { boolean z2 = this.f27642X; if (!z || !z2 || this.f27643Y == null) { subscriber.onNext(null); if (z2) { this.f27644Z.lazySet(null); Throwable th = this.f27643Y; if (th != null) { subscriber.onError(th); } else { subscriber.onComplete(); } return; } i = this.f27647c0.addAndGet(-i); if (i == 0) { return; } } else { cVar.clear(); this.f27644Z.lazySet(null); subscriber.onError(this.f27643Y); return; } } cVar.clear(); this.f27644Z.lazySet(null); } /* access modifiers changed from: 0000 */ /* renamed from: c */ public void mo30282c(Subscriber<? super T> subscriber) { int i; long j; C12491c<T> cVar = this.f27639U; boolean z = !this.f27641W; int i2 = 1; while (true) { long j2 = this.f27648d0.get(); long j3 = 0; while (true) { i = (j2 > j3 ? 1 : (j2 == j3 ? 0 : -1)); if (i == 0) { j = j3; break; } boolean z2 = this.f27642X; Object poll = cVar.poll(); boolean z3 = poll == null; Object obj = poll; j = j3; if (!mo30280a(z, z2, z3, subscriber, cVar)) { if (z3) { break; } subscriber.onNext(obj); j3 = 1 + j; } else { return; } } Subscriber<? super T> subscriber2 = subscriber; if (i == 0) { if (mo30280a(z, this.f27642X, cVar.isEmpty(), subscriber, cVar)) { return; } } if (!(j == 0 || j2 == Long.MAX_VALUE)) { this.f27648d0.addAndGet(-j); } i2 = this.f27647c0.addAndGet(-i2); if (i2 == 0) { return; } } } /* access modifiers changed from: 0000 */ /* renamed from: k */ public void mo30283k() { Runnable runnable = (Runnable) this.f27640V.getAndSet(null); if (runnable != null) { runnable.run(); } } /* access modifiers changed from: 0000 */ /* renamed from: l */ public void mo30284l() { if (this.f27647c0.getAndIncrement() == 0) { int i = 1; Subscriber subscriber = (Subscriber) this.f27644Z.get(); while (subscriber == null) { i = this.f27647c0.addAndGet(-i); if (i != 0) { subscriber = (Subscriber) this.f27644Z.get(); } else { return; } } if (this.f27649e0) { mo30281b(subscriber); } else { mo30282c(subscriber); } } } public void onComplete() { if (!this.f27642X && !this.f27645a0) { this.f27642X = true; mo30283k(); mo30284l(); } } public void onError(Throwable th) { C12036b.m38663a(th, "onError called with null. Null values are generally not allowed in 2.x operators and sources."); if (this.f27642X || this.f27645a0) { C11915a.m38466b(th); return; } this.f27643Y = th; this.f27642X = true; mo30283k(); mo30284l(); } public void onNext(T t) { C12036b.m38663a(t, "onNext called with null. Null values are generally not allowed in 2.x operators and sources."); if (!this.f27642X && !this.f27645a0) { this.f27639U.offer(t); mo30284l(); } } C11966c(int i, Runnable runnable, boolean z) { C12036b.m38660a(i, "capacityHint"); this.f27639U = new C12491c<>(i); this.f27640V = new AtomicReference<>(runnable); this.f27641W = z; this.f27644Z = new AtomicReference<>(); this.f27646b0 = new AtomicBoolean(); this.f27647c0 = new C11967a(); this.f27648d0 = new AtomicLong(); } /* access modifiers changed from: 0000 */ /* renamed from: a */ public boolean mo30280a(boolean z, boolean z2, boolean z3, Subscriber<? super T> subscriber, C12491c<T> cVar) { if (this.f27645a0) { cVar.clear(); this.f27644Z.lazySet(null); return true; } if (z2) { if (z && this.f27643Y != null) { cVar.clear(); this.f27644Z.lazySet(null); subscriber.onError(this.f27643Y); return true; } else if (z3) { Throwable th = this.f27643Y; this.f27644Z.lazySet(null); if (th != null) { subscriber.onError(th); } else { subscriber.onComplete(); } return true; } } return false; } /* renamed from: a */ public void mo29945a(C14314c cVar) { if (this.f27642X || this.f27645a0) { cVar.cancel(); } else { cVar.mo29946b(Long.MAX_VALUE); } } /* access modifiers changed from: protected */ /* renamed from: a */ public void mo29935a(Subscriber<? super T> subscriber) { if (this.f27646b0.get() || !this.f27646b0.compareAndSet(false, true)) { C12536d.m39310a(new IllegalStateException("This processor allows only a single Subscriber"), subscriber); return; } subscriber.mo29945a(this.f27647c0); this.f27644Z.set(subscriber); if (this.f27645a0) { this.f27644Z.lazySet(null); } else { mo30284l(); } } }
[ "101110@vivaldi.net" ]
101110@vivaldi.net