blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
400af7066f57b798e048d1fb4de1976e1db91b06 | c1b1be8033bf542ab5fdb6ed5f23826ee023558f | /app/src/main/java/leo/activitylifetest/Activity2.java | 7f2d299fd9dd6e7cad3d7d0b00b01f50695ff9cd | [] | no_license | lleo11/ActivityLifeTest | 1c58f947cde6a928641dcc3899bc0d578770a3b3 | b13e650421e84e3b852bdee6672eaedc46d40f26 | refs/heads/master | 2021-01-17T21:06:41.574149 | 2016-07-30T01:36:39 | 2016-07-30T01:36:39 | 64,520,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 777 | java | package leo.activitylifetest;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.widget.TextView;
import android.widget.Toast;
/**
* Created by lsx on 2016/7/22.
*/
public class Activity2 extends AppCompatActivity{
TextView textView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.second_activity);
String info = getIntent().getStringExtra("name");
textView =(TextView) findViewById(R.id.the_second_activity_textView);
textView.setText(info);
Toast.makeText(Activity2.this, info, Toast.LENGTH_SHORT).show();
}
}
| [
"lsx@163.com"
] | lsx@163.com |
2b355938c074c8e2c766f10cf380d3f236914074 | d4500ce956e5dee232269bab47bb8a8aaed65908 | /src/main/java/tech/jhipster/sample/web/rest/EntityWithServiceImplAndPaginationResource.java | 01a84024f123d5295bc84aba1186f02fbc83e62d | [] | no_license | mraible/webflux-couchbase | fa654f98179e0405b39fa7777ca363f85e17d677 | 45280f14b6724501b365f9035092b3ad78e0f4fb | refs/heads/main | 2023-02-26T22:40:28.771789 | 2021-02-04T21:31:47 | 2021-02-04T21:31:47 | 334,759,144 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 11,094 | java | package tech.jhipster.sample.web.rest;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ResponseStatusException;
import org.springframework.web.util.UriComponentsBuilder;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import tech.jhipster.sample.domain.EntityWithServiceImplAndPagination;
import tech.jhipster.sample.service.EntityWithServiceImplAndPaginationService;
import tech.jhipster.sample.web.rest.errors.BadRequestAlertException;
import tech.jhipster.web.util.HeaderUtil;
import tech.jhipster.web.util.PaginationUtil;
import tech.jhipster.web.util.reactive.ResponseUtil;
/**
* REST controller for managing {@link tech.jhipster.sample.domain.EntityWithServiceImplAndPagination}.
*/
@RestController
@RequestMapping("/api")
public class EntityWithServiceImplAndPaginationResource {
private final Logger log = LoggerFactory.getLogger(EntityWithServiceImplAndPaginationResource.class);
private static final String ENTITY_NAME = "entityWithServiceImplAndPagination";
@Value("${jhipster.clientApp.name}")
private String applicationName;
private final EntityWithServiceImplAndPaginationService entityWithServiceImplAndPaginationService;
public EntityWithServiceImplAndPaginationResource(EntityWithServiceImplAndPaginationService entityWithServiceImplAndPaginationService) {
this.entityWithServiceImplAndPaginationService = entityWithServiceImplAndPaginationService;
}
/**
* {@code POST /entity-with-service-impl-and-paginations} : Create a new entityWithServiceImplAndPagination.
*
* @param entityWithServiceImplAndPagination the entityWithServiceImplAndPagination to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new entityWithServiceImplAndPagination, or with status {@code 400 (Bad Request)} if the entityWithServiceImplAndPagination has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/entity-with-service-impl-and-paginations")
public Mono<ResponseEntity<EntityWithServiceImplAndPagination>> createEntityWithServiceImplAndPagination(
@RequestBody EntityWithServiceImplAndPagination entityWithServiceImplAndPagination
) throws URISyntaxException {
log.debug("REST request to save EntityWithServiceImplAndPagination : {}", entityWithServiceImplAndPagination);
if (entityWithServiceImplAndPagination.getId() != null) {
throw new BadRequestAlertException(
"A new entityWithServiceImplAndPagination cannot already have an ID",
ENTITY_NAME,
"idexists"
);
}
return entityWithServiceImplAndPaginationService
.save(entityWithServiceImplAndPagination)
.map(
result -> {
try {
return ResponseEntity
.created(new URI("/api/entity-with-service-impl-and-paginations/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId()))
.body(result);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
);
}
/**
* {@code PUT /entity-with-service-impl-and-paginations} : Updates an existing entityWithServiceImplAndPagination.
*
* @param entityWithServiceImplAndPagination the entityWithServiceImplAndPagination to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated entityWithServiceImplAndPagination,
* or with status {@code 400 (Bad Request)} if the entityWithServiceImplAndPagination is not valid,
* or with status {@code 500 (Internal Server Error)} if the entityWithServiceImplAndPagination couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PutMapping("/entity-with-service-impl-and-paginations")
public Mono<ResponseEntity<EntityWithServiceImplAndPagination>> updateEntityWithServiceImplAndPagination(
@RequestBody EntityWithServiceImplAndPagination entityWithServiceImplAndPagination
) throws URISyntaxException {
log.debug("REST request to update EntityWithServiceImplAndPagination : {}", entityWithServiceImplAndPagination);
if (entityWithServiceImplAndPagination.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
return entityWithServiceImplAndPaginationService
.save(entityWithServiceImplAndPagination)
.switchIfEmpty(Mono.error(new ResponseStatusException(HttpStatus.NOT_FOUND)))
.map(
result ->
ResponseEntity
.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, result.getId()))
.body(result)
);
}
/**
* {@code PATCH /entity-with-service-impl-and-paginations} : Updates given fields of an existing entityWithServiceImplAndPagination.
*
* @param entityWithServiceImplAndPagination the entityWithServiceImplAndPagination to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated entityWithServiceImplAndPagination,
* or with status {@code 400 (Bad Request)} if the entityWithServiceImplAndPagination is not valid,
* or with status {@code 404 (Not Found)} if the entityWithServiceImplAndPagination is not found,
* or with status {@code 500 (Internal Server Error)} if the entityWithServiceImplAndPagination couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PatchMapping(value = "/entity-with-service-impl-and-paginations", consumes = "application/merge-patch+json")
public Mono<ResponseEntity<EntityWithServiceImplAndPagination>> partialUpdateEntityWithServiceImplAndPagination(
@RequestBody EntityWithServiceImplAndPagination entityWithServiceImplAndPagination
) throws URISyntaxException {
log.debug("REST request to update EntityWithServiceImplAndPagination partially : {}", entityWithServiceImplAndPagination);
if (entityWithServiceImplAndPagination.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
Mono<EntityWithServiceImplAndPagination> result = entityWithServiceImplAndPaginationService.partialUpdate(
entityWithServiceImplAndPagination
);
return result
.switchIfEmpty(Mono.error(new ResponseStatusException(HttpStatus.NOT_FOUND)))
.map(
res ->
ResponseEntity
.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, res.getId()))
.body(res)
);
}
/**
* {@code GET /entity-with-service-impl-and-paginations} : get all the entityWithServiceImplAndPaginations.
*
* @param pageable the pagination information.
* @param request a {@link ServerHttpRequest} request.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of entityWithServiceImplAndPaginations in body.
*/
@GetMapping("/entity-with-service-impl-and-paginations")
public Mono<ResponseEntity<List<EntityWithServiceImplAndPagination>>> getAllEntityWithServiceImplAndPaginations(
Pageable pageable,
ServerHttpRequest request
) {
log.debug("REST request to get a page of EntityWithServiceImplAndPaginations");
return entityWithServiceImplAndPaginationService
.countAll()
.zipWith(entityWithServiceImplAndPaginationService.findAll(pageable).collectList())
.map(
countWithEntities -> {
return ResponseEntity
.ok()
.headers(
PaginationUtil.generatePaginationHttpHeaders(
UriComponentsBuilder.fromHttpRequest(request),
new PageImpl<>(countWithEntities.getT2(), pageable, countWithEntities.getT1())
)
)
.body(countWithEntities.getT2());
}
);
}
/**
* {@code GET /entity-with-service-impl-and-paginations/:id} : get the "id" entityWithServiceImplAndPagination.
*
* @param id the id of the entityWithServiceImplAndPagination to retrieve.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the entityWithServiceImplAndPagination, or with status {@code 404 (Not Found)}.
*/
@GetMapping("/entity-with-service-impl-and-paginations/{id}")
public Mono<ResponseEntity<EntityWithServiceImplAndPagination>> getEntityWithServiceImplAndPagination(@PathVariable String id) {
log.debug("REST request to get EntityWithServiceImplAndPagination : {}", id);
Mono<EntityWithServiceImplAndPagination> entityWithServiceImplAndPagination = entityWithServiceImplAndPaginationService.findOne(id);
return ResponseUtil.wrapOrNotFound(entityWithServiceImplAndPagination);
}
/**
* {@code DELETE /entity-with-service-impl-and-paginations/:id} : delete the "id" entityWithServiceImplAndPagination.
*
* @param id the id of the entityWithServiceImplAndPagination to delete.
* @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}.
*/
@DeleteMapping("/entity-with-service-impl-and-paginations/{id}")
@ResponseStatus(code = HttpStatus.NO_CONTENT)
public Mono<ResponseEntity<Void>> deleteEntityWithServiceImplAndPagination(@PathVariable String id) {
log.debug("REST request to delete EntityWithServiceImplAndPagination : {}", id);
return entityWithServiceImplAndPaginationService
.delete(id)
.then(
Mono.just(
ResponseEntity.noContent().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id)).build()
)
);
}
}
| [
"matt.raible@okta.com"
] | matt.raible@okta.com |
eb07eac33ff634cf23f7357795143ee8d76de279 | d4800a3e39d85f6642e646e404fa1a58d3b1ace5 | /testing-lib/testing-lib-v1/src/main/java/testing_lib/dataTypeIfazeMethodReturnTypeNarrowing/DataTypeIfazeMethodReturnTypeNarrowing.java | e6ab78228b15e88c56760e41c452ba13b094f899 | [] | no_license | AugustaRudolf/backward-compatibility-test-lib | c9fafce4fa824eaea93d45e147d912afc44e782f | 93553966e2c5583c02ed9fa5d741cf4194f1a558 | refs/heads/master | 2021-01-01T03:56:49.858114 | 2016-05-11T17:17:08 | 2016-05-11T17:17:08 | 58,561,457 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | package testing_lib.dataTypeIfazeMethodReturnTypeNarrowing;
public interface DataTypeIfazeMethodReturnTypeNarrowing {
public double method1();
}
| [
"augustar@c76f9247-7709-4348-9403-dde0860217d6"
] | augustar@c76f9247-7709-4348-9403-dde0860217d6 |
4b0d6d60336c49bd2881dc8a921dd0b62565cb9a | 4bfc69c39d2682d2fe06db588033f2c291c9a129 | /src/com/example/appcasa/ServiceSocketUPD.java | 7bf01960a2adbfabaa78792b24eab2ed0aed137a | [] | no_license | andersonprado/appcasa | 35c0cd4fe7595dbcaac6002ea012757f99af0383 | 34c3b3c67e5ac7a0e540092d24cafa7446ee4422 | refs/heads/master | 2021-01-22T04:36:36.426227 | 2014-12-13T01:14:14 | 2014-12-13T01:14:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 935 | java | package com.example.appcasa;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class ServiceSocketUPD {
private final int PORTA = 15000;
private final String IP = "192.168.0.150";
public void conectar(char entrada) {
DatagramSocket socket;
try {
String messageStr = String.valueOf(entrada);
socket = new DatagramSocket();
InetAddress local = InetAddress.getByName(IP);
int msg_length = messageStr.length();
byte[] message = messageStr.getBytes();
DatagramPacket p = new DatagramPacket(message, msg_length, local,
PORTA);
socket.send(p);
socket.close();
} catch (UnknownHostException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"andersonlprado@yahoo.com.br"
] | andersonlprado@yahoo.com.br |
6949f392c1da09ba679e6d9764169e283004eb58 | 9cf029213d31147e3550d3b7053ec3abbdc7151d | /IACNA/src/main/java/com/cplsys/iacna/app/ui/workingarea/material/MaterialPrepesadoVisorWorkArea.java | d2574527ee185700182159dd65929ff2cfd7419a | [] | no_license | ca4los-palalia/14CN4 | 81b9ca434d79bf6311e91308aa0b3b463d519984 | dec1b4d0748628dfcd6725c1bfd35aa6afd0cdb6 | refs/heads/master | 2016-08-11T19:02:18.858750 | 2016-03-22T14:45:51 | 2016-03-22T14:45:51 | 54,481,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,088 | java | package com.cplsys.iacna.app.ui.workingarea.material;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import javax.annotation.PostConstruct;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import net.miginfocom.swing.MigLayout;
import org.apache.poi.hssf.OldExcelFormatException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.cplsys.iacna.app.ui.statusbar.IACNAStatusBar;
import com.cplsys.iacna.app.ui.workingarea.formula.FormulaWorkArea;
import com.cplsys.iacna.app.ui.workingarea.formula.ProccessStack;
import com.cplsys.iacna.domain.Formula;
import com.cplsys.iacna.domain.IACNADispatcher;
import com.cplsys.iacna.domain.Ingrediente;
import com.cplsys.iacna.domain.Turno;
import com.cplsys.iacna.services.BasculaService;
import com.cplsys.iacna.services.FormulaService;
import com.cplsys.iacna.services.IACNADispatcherService;
import com.cplsys.iacna.services.IngredienteService;
import com.cplsys.iacna.services.ProductoService;
import com.cplsys.iacna.services.TurnoService;
import com.cplsys.iacna.ui.SheetWindowExcel;
import com.cplsys.iacna.utils.CellExcel;
import com.cplsys.iacna.utils.ifaces.IACNAIface;
import com.cplsys.iacna.utils.ifaces.LogginListener;
@Repository
public class MaterialPrepesadoVisorWorkArea extends JPanel implements
IACNAIface, LogginListener {
private static final long serialVersionUID = -7592306703221764280L;
private JPanel headerContent;
private JLabel materialLabel;
private JTextField materialNameLabel;
private JLabel productoLabel;
private JTextField productoNameLabel;
private JLabel productoDescripcionLabel;
private JTextField productoDescripcionNameLabel;
private JLabel formulaLabel;
private JTextField formulaNameLabel;
private JLabel locationLegend;
private JLabel turnoLegend;
private JLabel batchLegend;
private JTextField pathLocationField;
private JSpinner spinnerBatch;
private JButton saveToProducction;
private JButton cancel;
private JComboBox turnoComboBox;
private JLabel title;
private JTable excelViewer;
private JScrollPane scroller;
private JPanel titlePanel;
private JPanel container;
private JPanel footerContent;
private File file;
private List sheetData, data;//, list;
private FileInputStream stream;
private XSSFWorkbook workbook;
private int indexsheet;
private XSSFSheet sheet;
private Iterator rows;
private XSSFRow row;
private XSSFCell cell;
@Autowired
private IACNAStatusBar statusBar;
@Autowired
private ProductoService productoServicio;
@Autowired
private FormulaService formulaService;
@Autowired
private BasculaService basculaService;
@Autowired
private TurnoService turnoService;
@Autowired
private IACNADispatcherService iacnaDispatcherService;
private DefaultComboBoxModel cModel;
@Autowired
private IngredienteService ingredienteService;
@Autowired
private ProccessStack proccessStack;
@Autowired
private SheetWindowExcel sheetWindow;
@PostConstruct
public void init() {
initObjects();
initProperties();
initListeners();
createUI();
}
@Override
public void sessionActivated() {
cModel.removeAllElements();
List<Turno> turnos = turnoService.getAll();
for (Turno turno : turnos) {
cModel.addElement(turno.getNombre());
}
}
@Override
public void sessionDeactivated() {
cleanComponents();
}
@Override
public void initProperties() {
setLayout(new MigLayout("insets 25 50 0 0"));
title.setFont(new Font("arial", Font.BOLD, 14));
saveToProducction.setEnabled(false);
cancel.setEnabled(false);
pathLocationField.setEditable(false);
pathLocationField.setFont(new Font("Arial", Font.PLAIN, 8));
spinnerBatch.setEnabled(false);
spinnerBatch.setModel(new javax.swing.SpinnerNumberModel(1, 1, 99, 1));
turnoComboBox.setModel(cModel);
turnoComboBox.setEnabled(false);
saveToProducction.setIcon(new ImageIcon(getClass().getResource(
"/media/acceptIcon.png")));
cancel.setIcon(new ImageIcon(getClass().getResource(
"/media/cancelIcon.png")));
materialNameLabel.setEditable(false);
productoNameLabel.setEditable(false);
productoDescripcionNameLabel.setEditable(false);
formulaNameLabel.setEditable(false);
materialNameLabel.setFont(new Font("Arial", Font.PLAIN, 9));
productoDescripcionNameLabel.setFont(new Font("Arial", Font.PLAIN, 9));
formulaNameLabel.setFont(new Font("Arial", Font.PLAIN, 9));
excelViewer.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
/*
excelViewer.setMaximumSize(new Dimension(2147483647, 64));
excelViewer.setMinimumSize(new Dimension(60, 64));
excelViewer.setPreferredSize(new Dimension(300, 64));
*/
excelViewer.setPreferredScrollableViewportSize(new Dimension(640, 800));
excelViewer.setFont(new Font("Arial", Font.PLAIN, 9));
}
@Override
public void initObjects() {
excelViewer = new JTable();
//scroller = new JScrollPane(excelViewer);
scroller = new JScrollPane();
scroller.setViewportView(excelViewer);
title = new JLabel("INFORMACION MATERIAL PREPESADO");
materialLabel = new JLabel("Material: ");
materialNameLabel = new JTextField();
productoLabel = new JLabel("Producto: ");
productoNameLabel = new JTextField();
productoDescripcionLabel = new JLabel("Descripcion: ");
productoDescripcionNameLabel = new JTextField();
formulaLabel = new JLabel("Nombre: ");
formulaNameLabel = new JTextField();
spinnerBatch = new JSpinner();
saveToProducction = new JButton("Confirmar");
cancel = new JButton("Cancelar");
turnoComboBox = new JComboBox();
locationLegend = new JLabel("Ruta: ");
turnoLegend = new JLabel("Turno: ");
batchLegend = new JLabel("Batch: ");
pathLocationField = new JTextField();
titlePanel = new JPanel(new MigLayout("insets 15 350 0 0"));
headerContent = new JPanel(new MigLayout("insets 20 0 0 0"));
container = new JPanel(new MigLayout("insets 10 0 0 0"));
footerContent = new JPanel(new MigLayout("insets 15 0 0 0"));
sheetData = new ArrayList();
cModel = new DefaultComboBoxModel();
List<Turno> turnos = turnoService.getAll();
for (Turno turno : turnos) {
cModel.addElement(turno.getNombre());
}
turnoComboBox.setModel(cModel);
}
@Override
public void initListeners() {
saveToProducction.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (isTurnoValido()) {
String isExcede = excedeNumeroDeRegistrosEnPLC(new Integer(spinnerBatch
.getValue().toString()));
//if (!isExcede.equals("")) {
int opc = JOptionPane.showConfirmDialog(null,
"Esta seguro de transferir\n"
+ "esta formula a produccion", "",
JOptionPane.YES_NO_OPTION);
if (opc == JOptionPane.OK_OPTION) {
IACNADispatcher iacnaDispatcher = new IACNADispatcher();
Formula formula = new Formula();
formula.setDescripcion(productoDescripcionNameLabel
.getText());
formula.setNombre(formulaNameLabel.getText());
formula.setTotalBatchAProcesar(new Integer(spinnerBatch
.getValue().toString()));
formula.setTurno(turnoComboBox.getSelectedItem()
.toString());
formula.setPrepesado(true);
formulaService.saveFormula(formula);
for (int i = 0; i < excelViewer.getRowCount(); i++) {
Ingrediente ingrediente = new Ingrediente();
ingrediente.setFormula(formula);
ingrediente.setFormulaIdForWS(String
.valueOf(formula.getIdFormula()));
for (int j = 0; j < excelViewer.getColumnCount(); j++) {
switch (j) {
case 0:
ingrediente.setBascula(excelViewer
.getValueAt(i, j).toString());
if (excelViewer.getValueAt(i, j).toString()
.equals("6")) {
ingrediente.setPrepesadoBascula(true);
} else {
ingrediente.setPrepesadoBascula(false);
}
break;
case 1:
ingrediente.setMp(excelViewer.getValueAt(i,
j).toString());
break;
case 2:
ingrediente.setDescripcion(excelViewer
.getValueAt(i, j).toString());
ingrediente.setNombre(excelViewer
.getValueAt(i, j).toString());
break;
case 3:
ingrediente.setEspecificacion(Double
.parseDouble(excelViewer.getValueAt(i,
j).toString()));
break;
case 4:
double valorMinimo =
Double
.parseDouble(excelViewer.getValueAt(i,
3).toString()) -
Double
.parseDouble(excelViewer.getValueAt(i,
j).toString());
ingrediente.setToleranciaMinima(valorMinimo);
/*ingrediente.setToleranciaMinima(Double
.parseDouble(excelViewer.getValueAt(i,
j).toString()));*/
break;
case 5:
double valorMaximo =
Double
.parseDouble(excelViewer.getValueAt(i,
3).toString()) +
Double
.parseDouble(excelViewer.getValueAt(i,
j).toString());
ingrediente.setToleranciaMaxima(valorMaximo);
/*ingrediente.setToleranciaMaxima(Double
.parseDouble(excelViewer.getValueAt(i,
j).toString()));*/
break;
}
}
ingredienteService.saveIngrediente(ingrediente);
}
iacnaDispatcher.setFormula(formula);
iacnaDispatcherService
.saveIACNADispatcher(iacnaDispatcher);
proccessStack.pushToProccessStack(iacnaDispatcher);
statusBar.updateEmergencyStopManager();
excelViewer.setModel(new DefaultTableModel());
spinnerBatch.setValue(new Integer(1));
spinnerBatch.setEnabled(false);
saveToProducction.setEnabled(false);
cancel.setEnabled(false);
pathLocationField.setText("");
turnoComboBox.setEnabled(false);
materialNameLabel.setText("");
productoNameLabel.setText("");
productoDescripcionNameLabel.setText("");
formulaNameLabel.setText("");
setFile(null);
statusBar.publishMessageOnStatusBar("Datos enviados");
}
//}
/*else {
JOptionPane.showMessageDialog(null,
"Error, el sistema no puede procesar esta solicitud\n" +
"La memoria del plc esta limitada a 20 Ingredientes, la\n" +
"solicitud actual consta de:\n\n" + isExcede +
"\n\nPor favor intente nuevamente con un numero menor\n" +
"de ingredientes o de batchs.", "",
JOptionPane.INFORMATION_MESSAGE);
}
*/
} else {
JOptionPane.showMessageDialog(null,
"EL TURNO SELECCIONADO ES INCORRECTO\n" +
"POR FAVOR SELECCIONE UN TURNO VALIDO",
"", JOptionPane.WARNING_MESSAGE);
}
}
});
cancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
cleanComponents();
}
});
}
@Override
public void createUI() {
titlePanel.add(title);
headerContent.add(locationLegend);
headerContent.add(pathLocationField, "width 608:608:608, span, grow");
JPanel descripcionFormulaPanel = new JPanel(new MigLayout(
"insets 0 0 0 0"));
descripcionFormulaPanel.add(materialLabel);
descripcionFormulaPanel.add(materialNameLabel, "width 50:50:50");
descripcionFormulaPanel.add(productoLabel, "gap unrelated");
descripcionFormulaPanel.add(productoNameLabel, "width 80:80:80");
descripcionFormulaPanel.add(productoDescripcionLabel, "gap unrelated");
descripcionFormulaPanel.add(productoDescripcionNameLabel,
"width 130:130:130");
descripcionFormulaPanel.add(formulaLabel, "gap unrelated");
descripcionFormulaPanel.add(formulaNameLabel, "width 100:100:100");
headerContent.add(descripcionFormulaPanel, "span, grow");
headerContent.add(buildSeparator(), "width 640:640:640, span");
container.add(scroller, "height 400:400:400, width 855:855:855, span");
container.add(scroller, "span");
container.add(buildSeparator(), "width 640:640:640, span");
container.add(batchLegend);
container.add(spinnerBatch);
container.add(turnoLegend);
container.add(turnoComboBox, "width 100:100:100, wrap");
container.add(saveToProducction);
container.add(cancel);
this.add(titlePanel, "wrap");
this.add(headerContent, "wrap");
this.add(container, "wrap");
this.add(footerContent);
}
public void cleanComponents() {
excelViewer.setModel(new DefaultTableModel());
spinnerBatch.setValue(new Integer(1));
spinnerBatch.setEnabled(false);
saveToProducction.setEnabled(false);
cancel.setEnabled(false);
pathLocationField.setText("");
materialNameLabel.setText("");
productoNameLabel.setText("");
productoDescripcionNameLabel.setText("");
formulaNameLabel.setText("");
turnoComboBox.setSelectedIndex(0);
turnoComboBox.setEnabled(false);
setFile(null);
}
private void generarColumna(String title, int col) {
DefaultTableModel dtm = (DefaultTableModel) excelViewer.getModel();
dtm.addColumn(title);
TableColumn column = excelViewer.getColumnModel().getColumn(col);
column.setPreferredWidth(150);
}
private void generarFila() {
DefaultTableModel model = (DefaultTableModel) excelViewer.getModel();
model.addRow(new Object[] {});
}
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
private String getDataCell(XSSFCell cel) {
String salida = "";
switch (cel.getCellType()) {
case Cell.CELL_TYPE_STRING:
salida = cel.getRichStringCellValue().getString();
break;
case Cell.CELL_TYPE_NUMERIC:
if (DateUtil.isCellDateFormatted(cel)) {
salida = cel.getDateCellValue().toString();
} else {
salida = String.valueOf(((int) cel.getNumericCellValue()));
}
break;
case Cell.CELL_TYPE_BOOLEAN:
salida = String.valueOf(cel.getBooleanCellValue());
break;
case Cell.CELL_TYPE_FORMULA:
salida = String.valueOf(cel.getCellFormula());
break;
}
return salida;
}
private JSeparator buildSeparator() {
JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
separator.setForeground(Color.BLACK);
return separator;
}
private boolean isTurnoValido() {
Calendar turnoHoras;
DateFormat dateFormat;
int hora;
int minuto;
Date date = null;
boolean turnoCorrecto = false;
List<Turno> turnos = turnoService.getAll();
switch (turnoComboBox.getSelectedIndex()) {
case 0:
for (Turno turno2 : turnos) {
if (turno2.getNombre().equals(Turno.PRIMER_TURNO)) {
Calendar calendarActual = Calendar.getInstance();
int horaActual = calendarActual.get(Calendar.HOUR_OF_DAY);
int minutoActual = calendarActual.get(Calendar.MINUTE);
Calendar horaInicio = Calendar.getInstance();
horaInicio.set(Calendar.HOUR_OF_DAY, Integer
.parseInt(turno2.getHorario().substring(0, 2)));
horaInicio.set(Calendar.MINUTE, Integer.parseInt(turno2
.getHorario().substring(3, 5)));
Calendar horaFinal = Calendar.getInstance();
horaFinal.set(
Calendar.HOUR_OF_DAY,
Integer.parseInt(turno2.getHorario().substring(11,
13)));
horaFinal.set(
Calendar.MINUTE,
Integer.parseInt(turno2.getHorario().substring(14,
16)));
if (calendarActual.after(horaInicio)
&& calendarActual.before(horaFinal)) {
return true;
}
}
}
break;
case 1:
for (Turno turno2 : turnos) {
if (turno2.getNombre().equals(Turno.SEGUNDO_TURNO)) {
Calendar calendarActual = Calendar.getInstance();
int horaActual = calendarActual.get(Calendar.HOUR_OF_DAY);
int minutoActual = calendarActual.get(Calendar.MINUTE);
Calendar horaInicio = Calendar.getInstance();
horaInicio.set(Calendar.HOUR_OF_DAY, Integer
.parseInt(turno2.getHorario().substring(0, 2)));
horaInicio.set(Calendar.MINUTE, Integer.parseInt(turno2
.getHorario().substring(3, 5)));
Calendar horaFinal = Calendar.getInstance();
horaFinal.set(
Calendar.HOUR_OF_DAY,
Integer.parseInt(turno2.getHorario().substring(11,
13)));
horaFinal.set(
Calendar.MINUTE,
Integer.parseInt(turno2.getHorario().substring(14,
16)));
if (calendarActual.after(horaInicio)
&& calendarActual.before(horaFinal)) {
return true;
}
}
}
break;
case 2:
for (Turno turno2 : turnos) {
if (turno2.getNombre().equals(Turno.TERCER_TURNO)) {
Calendar calendarActual = Calendar.getInstance();
int horaActual = calendarActual.get(Calendar.HOUR_OF_DAY);
int minutoActual = calendarActual.get(Calendar.MINUTE);
Calendar horaInicio = Calendar.getInstance();
horaInicio.set(Calendar.HOUR_OF_DAY, Integer
.parseInt(turno2.getHorario().substring(0, 2)));
horaInicio.set(Calendar.MINUTE, Integer.parseInt(turno2
.getHorario().substring(3, 5)));
Calendar horaFinal = Calendar.getInstance();
horaFinal.set(
Calendar.HOUR_OF_DAY,
Integer.parseInt(turno2.getHorario().substring(11,
13)));
horaFinal.set(
Calendar.MINUTE,
Integer.parseInt(turno2.getHorario().substring(14,
16)));
if (calendarActual.after(horaInicio)
&& calendarActual.before(horaFinal)) {
return true;
}
}
}
break;
}
return turnoCorrecto;
}
private String excedeNumeroDeRegistrosEnPLC(int batch){
String returnValue = "";
int bascula = 0;
int conteoDeBasculas = 0;
int basculaAContar=0;
for (int i = 0; i < excelViewer.getRowCount(); i++) {
bascula = Integer.parseInt(excelViewer.getValueAt(i, 0).toString());
conteoDeBasculas = 0;
for (int j = 0; j < excelViewer.getRowCount(); j++) {
basculaAContar = Integer.parseInt(excelViewer.getValueAt(j, 0).toString());
if (bascula == basculaAContar) {
conteoDeBasculas ++;
}
}
if( (conteoDeBasculas * batch) > 20) {
returnValue = conteoDeBasculas
+" Ingredientes en bascula "
+ bascula+"\n"
+ "Numero de registros en PLC solicitados: "+ (conteoDeBasculas * batch);
break;
}
}
return returnValue;
}
//---------------------
public void iniciarSecuenciaDeCargadoDeDatos(File archivo) {
file = archivo;
statusBar.publishMessageOnStatusBar("Abriendo Archivo xls");
try {
sheetData=getDataXlsFile(file, 0);
if(sheetData!=null){
excelViewer.setModel(new DefaultTableModel());
showExcelData(sheetData, true);
pathLocationField.setText(file.toString());
spinnerBatch.setEnabled(true);
saveToProducction.setEnabled(true);
cancel.setEnabled(true);
turnoComboBox.setEnabled(true);
}
else {
cleanComponents();
}
} catch (Exception e1) {
cleanComponents();
e1.printStackTrace();
}
}
public List getDataXlsFile(File archivo, int tipo)
throws InvalidFormatException {
List sheetDataTemp = new ArrayList();
statusBar.publishMessageOnStatusBar("Leyendo archivo xls "+archivo.getName());
try {
stream =new FileInputStream(archivo.toString());
try {
workbook = new XSSFWorkbook(stream);
//SheetWindow sheetWindow = new SheetWindow(workbook.getNumberOfSheets(), workbook);
sheetWindow.loadSheets(workbook.getNumberOfSheets(), workbook);
switch(tipo){
case 0:
statusBar.publishMessageOnStatusBar("Hojas contenidas en el archivo "+archivo.getName());
sheetWindow.setVisible(true);
if(sheetWindow.isCancel()) {
indexsheet = 0;
sheetWindow.setIndexSheet(0);
}
else
indexsheet=sheetWindow.getIndexSheet();
break;
case 1:
break;
}
if(indexsheet!=0) {
sheet = workbook.getSheetAt(indexsheet);
rows = sheet.rowIterator();
sheetDataTemp = new ArrayList();
while (rows.hasNext()) {
row = ((XSSFRow) rows.next());
Iterator cells = row.cellIterator();
data = new ArrayList();
while (cells.hasNext()) {
cell = (XSSFCell) cells.next();
data.add(cell);
}
sheetDataTemp.add(data);
}
return sheetDataTemp;
}
else {
if(!sheetWindow.isCancel()) {
JOptionPane.showMessageDialog(null,
"Posible estructura incorrecta de lectura en el archivo","" +
"Error al cargar el archivo", JOptionPane.WARNING_MESSAGE);
}
return null;
}
}
catch(OldExcelFormatException e){
JOptionPane.showMessageDialog(null,
"Incompatibilidad del archivo",
"Error al cargar el archivo",
JOptionPane.WARNING_MESSAGE);
return null;
}
} catch (Exception e1) {
System.err.println(e1);
JOptionPane.showMessageDialog(null, "Error en el archivo\n"+e1,"Error al cargar el archivo", JOptionPane.ERROR_MESSAGE);
return null;
}
}
public void showExcelData(List sheetData, boolean prepesado) {
excelViewer.setModel(new DefaultTableModel());
XSSFWorkbook workbook;
XSSFSheet sheet;
Iterator rows;
XSSFCell cell;
Vector campos;
int col = 0, row = -1, tempRow = 0;
String salida = "";
List list = null;
cell = null;
boolean start = false;
CellExcel celResultsTable = new CellExcel();
boolean title = false;
boolean activarExtraccionPrePesado = false;
FormulaWorkArea formulaWorkArea = new FormulaWorkArea();
try {
for (int i = 0; i < sheetData.size(); i++) {
campos = new Vector();
list = (List) sheetData.get(i);
for (int j = 0; j < list.size(); j++) {
cell = (XSSFCell) list.get(j);
salida = getDataCell(cell);
if (salida.equalsIgnoreCase("Material")) {
try {
materialNameLabel
.setText(getDataCell((XSSFCell) list
.get(j + 1)));
productoNameLabel
.setText(getDataCell((XSSFCell) list
.get(j + 3)));
productoDescripcionNameLabel
.setText(getDataCell((XSSFCell) list
.get(j + 5)));
formulaNameLabel
.setText(getDataCell((XSSFCell) list
.get(j + 7)));
} catch (Exception e3) {
JOptionPane.showMessageDialog(null,
"Error en el formato");
}
}
// Identificar informacion para la tabla
if (!salida.isEmpty() && salida.length() > 9) {
if (salida.substring(0, 8).equalsIgnoreCase("Formulac"))
start = true;
}
if (tempRow == 2) {// Generar Columnas
if (j < 7)
if (!salida.isEmpty()) {
generarColumna(salida,
(cell.getColumnIndex() + col));
} else
col -= 1;
}
if (tempRow > 3) {// pre carga de informacion
if (j < 7) {
if (!salida.equals("")) {
if (prepesado == false) {
if(j > 3 && j <= 6 && start == true) {
try {
salida = String.valueOf(Double.parseDouble(cell.toString()));
}
catch (Exception e) {}
}
campos.add(salida);
if (cell.getColumnIndex() == 0) {
celResultsTable.setValueAtCelda(cell
.getRowIndex());
}
} else {
if (cell.getColumnIndex() == 0) {
if (salida.equalsIgnoreCase("5")) {
activarExtraccionPrePesado = true;
celResultsTable
.setValueAtCelda(cell
.getRowIndex());
}
}
if (activarExtraccionPrePesado == true) {
if(j > 3 && j <= 6 && start == true) {
try {
salida = String.valueOf(Double.parseDouble(cell.toString()));
}
catch (Exception e) {}
}
campos.add(salida);
}
}
}
if (salida.equalsIgnoreCase("TOTAL"))
start = false;
}
}
if (j < list.size() - 1)
salida = "";// Celda Vacia
}// END for columnas
activarExtraccionPrePesado = false;
if (start == true) {
tempRow++;
if (tempRow > 4) {
row++;
if (campos.size() > 4) {
generarFila();
for (int k = 0; k < campos.size(); k++) {
excelViewer.setValueAt(campos.get(k), row, k);
if (k != 0) {
excelViewer.isCellEditable(row, k);
}
}
} else
row -= 1;
}
}
campos.clear();
}// END for Filas
// --------------
pathLocationField.setText(file.toString());
spinnerBatch.setEnabled(true);
saveToProducction.setEnabled(true);
cancel.setEnabled(true);
turnoComboBox.setEnabled(true);
// --------------
if (excelViewer.getModel().getRowCount() == 0) {
excelViewer.setModel(new DefaultTableModel());
statusBar
.publishMessageOnStatusBar("No existen Componentes para Prepesado");
} else
statusBar
.publishMessageOnStatusBar("Componentes de para prepesado");
} catch (Exception e) {
e.printStackTrace();
}
}
//---------------------
}
| [
"carlos.palalia@gmail.com"
] | carlos.palalia@gmail.com |
2e5db97adce0aa9967c3bcb1224a1187068d01b7 | b7b870158ac741a303b854876f73173b3c984730 | /4.JavaCollections/src/com/codegym/task/task33/task3310/strategy/FileStorageStrategy.java | 3406e084059c71ade17e62bdcf9a8b8463f921f1 | [] | no_license | KrisTovski/CodeGym | b788c65b0ec2cc71c7a75dfd39b4221b571090e4 | 74be0793b2b1f8e9e7dc576e2cb5d25da505417a | refs/heads/master | 2021-12-13T01:22:09.284904 | 2021-11-28T19:23:57 | 2021-11-28T19:23:57 | 246,921,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,571 | java | package com.codegym.task.task33.task3310.strategy;
import java.util.Objects;
public class FileStorageStrategy implements StorageStrategy {
private static final int DEFAULT_INITIAL_CAPACITY = 16;
private static final long DEFAULT_BUCKET_SIZE_LIMIT = 10000;
private FileBucket[] table = new FileBucket[DEFAULT_INITIAL_CAPACITY];
private long bucketSizeLimit = DEFAULT_BUCKET_SIZE_LIMIT;
private int size;
private long maxBucketSize;
public FileStorageStrategy() {
for (int i = 0; i < table.length; i++) {
table[i] = new FileBucket();
}
}
public long getBucketSizeLimit() {
return bucketSizeLimit;
}
public void setBucketSizeLimit(final long bucketSizeLimit) {
this.bucketSizeLimit = bucketSizeLimit;
}
public int getSize() {
return size;
}
public long getMaxBucketSize() {
return maxBucketSize;
}
private int hash(int h) {
h ^= (h >>> 20) ^ (h >>> 12);
return h ^ (h >>> 7) ^ (h >>> 4);
}
private int indexFor(final int hash, final int length) {
return hash & (length - 1);
}
private Entry getEntry(final Long key) {
final int hash = (key == null) ? 0 : hash(key.hashCode());
final int index = indexFor(hash, table.length);
for (Entry e = table[index].getEntry(); e != null; e = e.next) {
final Long eKey = e.key;
if (e.hash == hash && Objects.equals(key, eKey))
return e;
}
return null;
}
private void resize(final int newCapacity) {
FileBucket[] newTable = new FileBucket[newCapacity];
transfer(newTable);
table = newTable;
}
private void transfer(final FileBucket[] newTable) {
for (final FileBucket bucket : table) {
Entry e = bucket.getEntry();
while (e != null) {
final Entry next = e.next;
final int index = indexFor(e.hash, newTable.length);
e.next = newTable[index].getEntry();
newTable[index].putEntry(e);
e = next;
}
bucket.remove();
}
}
private void addEntry(final int hash, final Long key, final String value, final int bucketIndex) {
final Entry e = table[bucketIndex].getEntry();
table[bucketIndex].putEntry(new Entry(hash, key, value, e));
size++;
final long currentBucketSize = table[bucketIndex].getFileSize();
maxBucketSize = currentBucketSize > maxBucketSize ? currentBucketSize : maxBucketSize;
if (maxBucketSize > bucketSizeLimit) resize(2 * table.length);
}
private void createEntry(final int hash, final Long key, final String value, final int bucketIndex) {
table[bucketIndex].putEntry(new Entry(hash, key, value, null));
size++;
final long currentBucketSize = table[bucketIndex].getFileSize();
maxBucketSize = currentBucketSize > maxBucketSize ? currentBucketSize : maxBucketSize;
}
@Override
public boolean containsKey(final Long key) {
return getEntry(key) != null;
}
@Override
public boolean containsValue(final String value) {
for (final FileBucket bucket : table) {
for (Entry e = bucket.getEntry(); e != null; e = e.next) {
if (Objects.equals(e.value, value))
return true;
}
}
return false;
}
@Override
public void put(final Long key, final String value) {
final int hash = (key == null) ? 0 : hash(key.hashCode());
final int index = indexFor(hash, table.length);
if (table[index].getEntry() != null) {
for (Entry e = table[index].getEntry(); e != null; e = e.next) {
if (e.hash == hash && Objects.equals(e.key, key)) {
e.value = value;
return;
}
}
addEntry(hash, key, value, index);
} else {
createEntry(hash, key, value, index);
}
}
@Override
public Long getKey(final String value) {
for (final FileBucket bucket : table) {
for (Entry e = bucket.getEntry(); e != null; e = e.next) {
if (Objects.equals(e.value, value))
return e.key;
}
}
return null;
}
@Override
public String getValue(final Long key) {
final Entry e = getEntry(key);
return e == null ? null : e.value;
}
} | [
"kfilak@onet.eu"
] | kfilak@onet.eu |
e08029515aad5bfd271a251d35679cd1f77fa8d9 | 560470d0fd60a17e6d80a52952fb08b42b9af2b9 | /app/src/main/java/me/sparker0i/lawnchair/pixelify/DateWidgetView.java | c5050406eec3609eed5cc4bd47f74b37b10a83bb | [
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-proprietary-license",
"Apache-2.0"
] | permissive | Sparker0i/LockLaunch | 01e20f2547ebc6b6aac0665367efa0e2a0a8ba4e | 920debb0978e4f6b6704c4f9e5e0753a260a45ce | refs/heads/master | 2021-01-22T01:21:41.407420 | 2017-11-12T19:37:03 | 2017-11-12T19:37:03 | 102,217,081 | 4 | 3 | Apache-2.0 | 2020-06-14T20:07:39 | 2017-09-02T18:53:06 | Java | UTF-8 | Java | false | false | 5,129 | java | package me.sparker0i.lawnchair.pixelify;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.graphics.Paint;
import android.graphics.Rect;
import android.net.Uri;
import android.provider.CalendarContract;
import android.text.Editable;
import android.text.TextPaint;
import android.text.TextWatcher;
import android.text.format.DateFormat;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import java.util.Locale;
import me.sparker0i.lawnchair.DeviceProfile;
import me.sparker0i.lawnchair.Launcher;
import me.sparker0i.lawnchair.R;
public class DateWidgetView extends LinearLayout implements TextWatcher, View.OnClickListener {
private String text = "";
private float dateText1TextSize;
private DoubleShadowTextClock dateText1;
private DoubleShadowTextClock dateText2;
private int width = 0;
public DateWidgetView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
dateText1 = findViewById(R.id.date_text1);
dateText1TextSize = dateText1.getTextSize();
dateText1.addTextChangedListener(this);
dateText1.setFormat(DateFormat.getBestDateTimePattern(Locale.getDefault(), "MMMMd"));
dateText1.setOnClickListener(this);
dateText2 = findViewById(R.id.date_text2);
dateText2.setFormat(getContext().getString(R.string.week_day_format, "EEEE", "yyyy"));
dateText2.setOnClickListener(this);
init();
}
private void init() {
Locale locale = Locale.getDefault();
if (locale != null && Locale.ENGLISH.getLanguage().equals(locale.getLanguage())) {
Paint paint = dateText1.getPaint();
Rect rect = new Rect();
paint.getTextBounds("x", 0, 1, rect);
int height = rect.height();
dateText2.setPadding(0, 0, 0, ((int) (Math.abs(paint.getFontMetrics().ascent) - ((float) height))) / 2);
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
DeviceProfile deviceProfile = Launcher.getLauncher(getContext()).getDeviceProfile();
int size = MeasureSpec.getSize(widthMeasureSpec) / deviceProfile.inv.numColumnsOriginal;
int marginEnd = (size - deviceProfile.iconSizePxOriginal) / 2;
width = (deviceProfile.inv.numColumnsOriginal - Math.max(1, (int) Math.ceil((double) (getResources().getDimension(R.dimen.qsb_min_width_with_mic) / ((float) size))))) * size;
text = "";
update();
setMarginEnd(dateText1, marginEnd);
setMarginEnd(dateText2, marginEnd);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
private void setMarginEnd(View view, int marginEnd) {
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
layoutParams.setMarginEnd(marginEnd);
layoutParams.resolveLayoutDirection(layoutParams.getLayoutDirection());
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable editable) {
update();
}
private void update() {
if (width > 0) {
String dateText1Text = dateText1.getText().toString();
if (!text.equals(dateText1Text)) {
text = dateText1Text;
if (!dateText1Text.isEmpty()) {
TextPaint paint = dateText1.getPaint();
float textSize = paint.getTextSize();
float size = dateText1TextSize;
for (int i = 0; i < 10; i++) {
paint.setTextSize(size);
float measureText = paint.measureText(dateText1Text);
if (measureText <= ((float) width)) {
break;
}
size = (size * ((float) width)) / measureText;
}
if (Float.compare(size, textSize) == 0) {
paint.setTextSize(textSize);
} else {
dateText1.setTextSize(0, size);
init();
}
}
}
}
}
@Override
public void onClick(View v) {
Context context = v.getContext();
long currentTime = System.currentTimeMillis();
Uri.Builder builder = CalendarContract.CONTENT_URI.buildUpon();
builder.appendPath("time");
ContentUris.appendId(builder, currentTime);
Launcher launcher = Launcher.getLauncher(getContext());
Intent intent = new Intent(Intent.ACTION_VIEW).setData(builder.build());
intent.setSourceBounds(launcher.getViewBounds(dateText1));
context.startActivity(intent, launcher.getActivityLaunchOptions(dateText1));
}
} | [
"aadityamenon007@gmail.com"
] | aadityamenon007@gmail.com |
263909533bb27f40b168b2489f1da2a4c2da01d4 | d98a0183566b849f65d74ef9a9594c1c8e10132e | /springboot-rabbitmq/src/main/java/com/wuwii/basic/RabbitMQConfig.java | b9c56e67cdb793dbf0c1c2b75e7128f1f7db7368 | [
"Apache-2.0"
] | permissive | lanxiaozhu/springboot_rabbitmq | b0f46ca70c33d590ae4fa7f93b6b3fc0deeb43ba | dc82e929a21799bf255c0164ed79bdcd488b50bd | refs/heads/master | 2020-04-04T09:32:00.315994 | 2018-11-02T06:07:02 | 2018-11-02T06:07:02 | 155,821,925 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,482 | java | package com.wuwii.basic;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* RabbitMQ 消费者的配置属性
*
* @author moyu
* @version 1.0
* @since <pre>2018/3/19 10:04</pre>
*/
@Configuration
public class RabbitMQConfig {
public final static String QUEUE_NAME = "springboot.demo.test1";
public final static String ROUTING_KEY = "route-key";
public final static String EXCHANGES_NAME = "demo-exchanges";
@Bean
public Queue queue() {
// 是否持久化
boolean durable = true;
// 仅创建者可以使用的私有队列,断开后自动删除
boolean exclusive = false;
// 当所有消费客户端连接断开后,是否自动删除队列
boolean autoDelete = false;
return new Queue(QUEUE_NAME, durable, exclusive, autoDelete);
}
/**
* 设置交换器,这里我使用的是 topic exchange
*/
@Bean
public TopicExchange exchange() {
// 是否持久化
boolean durable = true;
// 当所有消费客户端连接断开后,是否自动删除队列
boolean autoDelete = false;
return new TopicExchange(EXCHANGES_NAME, durable, autoDelete);
}
/**
* 绑定路由
*/
@Bean
public Binding binding(Queue queue, TopicExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY);
}
@Bean
public SimpleMessageListenerContainer container(ConnectionFactory connectionFactory,MessageReceiver messageReceiver) {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.setQueueNames(QUEUE_NAME);
container.setMessageListener(messageReceiver);
//container.setMaxConcurrentConsumers(1);
//container.setConcurrentConsumers(1); 默认为1
//container.setExposeListenerChannel(true);
container.setAcknowledgeMode(AcknowledgeMode.MANUAL); // 设置为手动,默认为 AUTO,如果设置了手动应答 basicack,就要设置manual
return container;
}
@Bean
public MessageReceiver receiver() {
return new MessageReceiver();
}
}
| [
"guoxianjun@letto8.com"
] | guoxianjun@letto8.com |
11dddd048d4d2b667d1e393e5e2750e28a1dfb7d | 03a08b97d547eee0d1bdada9fab74b8cd8321450 | /deeplearning4j-core/src/main/java/org/deeplearning4j/optimize/VectorizedBackTrackLineSearch.java | 864dbfcd7096aa3e04093a5b416c076b6ae4eac8 | [] | no_license | YesBarJALL/java-deeplearning | b3d3df6d3eb7fba5ab5dfccf0ab8f286ea2fea10 | 80ef4a8afc21ad5c3a5453d2054553f329b525d7 | refs/heads/master | 2020-12-29T02:54:44.557329 | 2014-09-01T14:41:36 | 2014-09-01T14:41:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,197 | java | package org.deeplearning4j.optimize;
/* Copyright (C) 2002 Univ. of Massachusetts Amherst, Computer Science Dept.
This file is part of "MALLET" (MAchine Learning for LanguagE Toolkit).
http://www.cs.umass.edu/~mccallum/mallet
This software is provided under the terms of the Common Public License,
version 1.0, as published by http://www.opensource.org. For further
information, see the file `LICENSE' included with this distribution. */
/**
@author Aron Culotta <a href="mailto:culotta@cs.umass.edu">culotta@cs.umass.edu</a>
@author Adam Gibson
Adapted from mallet with original authors above.
Modified to be a vectorized version that uses jblas matrices
for computation rather than the mallet ops.
*/
/**
Numerical Recipes in C: p.385. lnsrch. A simple backtracking line
search. No attempt at accurately finding the true minimum is
made. The goal is only to ensure that BackTrackLineSearch will
return a position of higher value.
*/
import org.apache.commons.math3.util.FastMath;
import org.deeplearning4j.util.MatrixUtil;
import org.jblas.DoubleMatrix;
import org.jblas.MatrixFunctions;
import org.jblas.SimpleBlas;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cc.mallet.optimize.InvalidOptimizableException;
//"Line Searches and Backtracking", p385, "Numeric Recipes in C"
public class VectorizedBackTrackLineSearch implements LineOptimizerMatrix
{
private static Logger logger = LoggerFactory.getLogger(VectorizedBackTrackLineSearch.class.getName());
OptimizableByGradientValueMatrix function;
public VectorizedBackTrackLineSearch (OptimizableByGradientValueMatrix optimizable) {
this.function = optimizable;
}
final int maxIterations = 100;
double stpmax = 100;
final double EPS = 3.0e-12;
// termination conditions: either
// a) abs(delta x/x) < REL_TOLX for all coordinates
// b) abs(delta x) < ABS_TOLX for all coordinates
// c) sufficient function increase (uses ALF)
private double relTolx = 1e-10;
private double absTolx = 1e-4; // tolerance on absolute value difference
final double ALF = 1e-4;
public void setStpmax(double stpmax) {
this.stpmax = stpmax;
}
public double getStpmax() {
return stpmax;
}
/**
* Sets the tolerance of relative diff in function value.
* Line search converges if <tt>abs(delta x / x) < tolx</tt>
* for all coordinates. */
public void setRelTolx (double tolx) { relTolx = tolx; }
/**
* Sets the tolerance of absolute diff in function value.
* Line search converges if <tt>abs(delta x) < tolx</tt>
* for all coordinates. */
public void setAbsTolx (double tolx) { absTolx = tolx; }
// initialStep is ignored. This is b/c if the initial step is not 1.0,
// it sometimes confuses the backtracking for reasons I don't
// understand. (That is, the jump gets LARGER on iteration 1.)
// returns fraction of step size (alam) if found a good step
// returns 0.0 if could not step in direction
public double optimize (DoubleMatrix line, double initialStep)
{
DoubleMatrix g, x, oldParameters;
double slope, test, alamin, alam, alam2, tmplam;
double rhs1, rhs2, a, b, disc, oldAlam;
double f, fold, f2;
g = function.getValueGradient(); // gradient
x = function.getParameters(); // parameters
oldParameters = x.dup();
alam2 = tmplam = 0.0;
f2 = fold = function.getValue();
if (logger.isDebugEnabled()) {
logger.trace ("ENTERING BACKTRACK\n");
logger.trace("Entering BackTrackLnSrch, value="+fold+",\ndirection.oneNorm:"
+ line.norm1() + " direction.infNorm:"+ FastMath.max(Double.NEGATIVE_INFINITY,MatrixFunctions.abs(line).max()));
}
assert (!MatrixUtil.isNaN(g));
double sum = line.norm2();
if(sum > stpmax) {
logger.warn("attempted step too big. scaling: sum= " + sum +
", stpmax= "+ stpmax);
line.muli(stpmax / sum);
}
//dot product
slope = SimpleBlas.dot(g, line);
logger.debug("slope = " + slope);
if (slope < 0) {
throw new InvalidOptimizableException("Slope = " + slope + " is negative");
}
if (slope == 0)
throw new InvalidOptimizableException ("Slope = " + slope + " is zero");
// find maximum lambda
// converge when (delta x) / x < REL_TOLX for all coordinates.
// the largest step size that triggers this threshold is
// precomputed and saved in alamin
DoubleMatrix maxOldParams = new DoubleMatrix(line.length);
for(int i = 0;i < line.length; i++) {
if(line.length >= oldParameters.length)
break;
maxOldParams.put(i,Math.max(Math.abs(oldParameters.get(i)), 1.0));
}
DoubleMatrix testMatrix = MatrixFunctions.abs(line).div(maxOldParams);
test = testMatrix.max();
alamin = relTolx / test;
alam = 1.0;
oldAlam = 0.0;
int iteration = 0;
// look for step size in direction given by "line"
for(iteration = 0; iteration < maxIterations; iteration++) {
// x = oldParameters + alam*line
// initially, alam = 1.0, i.e. take full Newton step
logger.trace("BackTrack loop iteration " + iteration +" : alam="+
alam+" oldAlam="+oldAlam);
logger.trace ("before step, x.1norm: " + x.norm1() +
"\nalam: " + alam + "\noldAlam: " + oldAlam);
assert(alam != oldAlam) : "alam == oldAlam";
x.addi(line.mul(alam - oldAlam)); // step
logger.debug ("after step, x.1norm: " + x.norm1());
// check for convergence
//convergence on delta x
if ((alam < alamin) || smallAbsDiff (oldParameters, x)) {
// if ((alam < alamin)) {
function.setParameters(oldParameters);
f = function.getValue();
logger.trace("EXITING BACKTRACK: Jump too small (alamin="+ alamin + "). Exiting and using xold. Value="+f);
return 0.0;
}
function.setParameters(x);
oldAlam = alam;
f = function.getValue();
logger.debug("value = " + f);
// sufficient function increase (Wolf condition)
if(f >= fold + ALF * alam * slope) {
logger.debug("EXITING BACKTRACK: value="+f);
if (f<fold)
throw new IllegalStateException
("Function did not increase: f=" + f +
" < " + fold + "=fold");
return alam;
}
// if value is infinite, i.e. we've
// jumped to unstable territory, then scale down jump
else if(Double.isInfinite(f) || Double.isInfinite(f2)) {
logger.warn ("Value is infinite after jump " + oldAlam + ". f="+ f +", f2=" + f2 + ". Scaling back step size...");
tmplam = .2 * alam;
if(alam < alamin) { //convergence on delta x
function.setParameters(oldParameters);
f = function.getValue();
logger.warn("EXITING BACKTRACK: Jump too small. Exiting and using xold. Value="+ f );
return 0.0;
}
}
else { // backtrack
if(alam == 1.0) // first time through
tmplam = -slope / (2.0 * ( f - fold - slope ));
else {
rhs1 = f - fold- alam * slope;
rhs2 = f2 - fold - alam2 * slope;
assert((alam - alam2) != 0): "FAILURE: dividing by alam-alam2. alam="+alam;
a = ( rhs1 / (FastMath.pow(alam, 2)) - rhs2 / ( FastMath.pow(alam2, 2) )) / (alam-alam2);
b = ( -alam2* rhs1/( alam* alam ) + alam * rhs2 / ( alam2 * alam2 )) / ( alam - alam2);
if(a == 0.0)
tmplam = -slope / (2.0 * b);
else {
disc = b * b - 3.0 * a * slope;
if(disc < 0.0) {
tmplam = .5 * alam;
}
else if (b <= 0.0)
tmplam = (-b + FastMath.sqrt(disc))/(3.0 * a );
else
tmplam = -slope / (b + FastMath.sqrt(disc));
}
if (tmplam > .5 * alam)
tmplam = .5 * alam; // lambda <= .5 lambda_1
}
}
alam2 = alam;
f2 = f;
logger.debug("tmplam:" + tmplam);
alam = Math.max(tmplam, .1*alam); // lambda >= .1*Lambda_1
}
if(iteration >= maxIterations)
throw new IllegalStateException ("Too many iterations.");
return 0.0;
}
// returns true iff we've converged based on absolute x difference
private boolean smallAbsDiff (DoubleMatrix x, DoubleMatrix xold)
{
for (int i = 0; i < x.length; i++) {
double comp = Math.abs (x.get(i) - xold.get(i));
if ( comp > absTolx) {
return false;
}
}
return true;
}
}
| [
"agibson@clevercloudcomputing.com"
] | agibson@clevercloudcomputing.com |
2bb655df25bec674f476e5c8690a7150a32dc903 | 87bb36b03f8069f2a9ffb4025b5eb3410905f217 | /app/src/main/java/com/cvicse/stock/markets/data/HSBarChartData.java | 68c87fcc8c0aa75b1d7c7021dcb858f79985cd68 | [] | no_license | 883111LB/app_stock | 14fee33c2e4e3104a09276816efda9a38bf05406 | 6e89ee5809a600173e317246a56a67446b5ebe53 | refs/heads/master | 2022-08-28T00:48:44.988011 | 2020-05-27T07:29:03 | 2020-05-27T07:29:03 | 267,245,079 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,386 | java | package com.cvicse.stock.markets.data;
/**
* Created by shi_yhui on 2018/12/3.
*/
public class HSBarChartData {
private String name = "";
//颜色
private int mColor = 0;
//数值
private String mValue = "";
private String mValueformat = "";
//是否是正
private boolean isPlus = true;
//高度
private float mHeight;
public HSBarChartData(String name,String value,int color){
this.name = name;
this.mValue = value;
this.mColor = color;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getmColor() {
return mColor;
}
public void setmColor(int mColor) {
this.mColor = mColor;
}
public String getmValue() {
return mValue;
}
public void setmValue(String mValue) {
this.mValue = mValue;
}
public boolean isPlus() {
return isPlus;
}
public void setPlus(boolean plus) {
isPlus = plus;
}
public float getmHeight() {
return mHeight;
}
public void setmHeight(float mHeight) {
this.mHeight = mHeight;
}
public String getmValueformat() {
return mValueformat;
}
public void setmValueformat(String mValueformat) {
this.mValueformat = mValueformat;
}
}
| [
"3140704209.l"
] | 3140704209.l |
72d967d25ed4bb1e34900b8923e535cd511b2e31 | 772e96c73167ffdf1c7afe20ebe9114cb759ef86 | /src/main/java/com/morgajel/spoe/controller/ReviewController.java | e8f2fd71338967bdf44f19a0d72c487b5e05d81f | [] | no_license | morgajel/spoe | 7380361e01941c49ed6933e6948f42df6dbe4cff | dd7c00706c937644adb2abeb502c16706d963078 | refs/heads/master | 2021-01-25T08:54:45.664220 | 2013-06-27T14:00:06 | 2013-06-27T14:00:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,521 | java | package com.morgajel.spoe.controller;
import javax.validation.Valid;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailSender;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.morgajel.spoe.model.Account;
import com.morgajel.spoe.model.Review;
import com.morgajel.spoe.service.AccountService;
import com.morgajel.spoe.service.ReviewService;
import com.morgajel.spoe.web.EditReviewForm;
/**
* Controls all review interactions, etc.
*/
@Controller
@RequestMapping(value = "/review")
public class ReviewController {
@Autowired
private AccountService accountService;
@Autowired
private ReviewService reviewService;
private MailSender mailSender;
private static final transient Logger LOGGER = Logger.getLogger(ReviewController.class);
public void setMailSender(MailSender pMailSender) {
//NOTE this may not be used anytime soon.
this.mailSender = pMailSender;
}
public MailSender getMailSender() {
//TODO is this needed?
return this.mailSender;
}
/**
* Saves the results of the incoming review form.
* @param editReviewForm the form you are submitting with review data.
* @return ModelAndView mav
*/
@RequestMapping(value = "/save", method = RequestMethod.POST)
//TODO figure out why I can't mark editReviewForm @Valid
public ModelAndView saveReview(EditReviewForm editReviewForm) {
ModelAndView mav = new ModelAndView();
try {
//FIXME refactor this whole try block
LOGGER.debug("trying to save " + editReviewForm);
Account account = getContextAccount();
if (editReviewForm.getReviewId() == null) {
LOGGER.info("no reviewId found, saving as a new review " + editReviewForm);
Review review = new Review();
review.configure(editReviewForm);
reviewService.saveReview(review);
editReviewForm.importReview(review);
// FIXME how do I get reviewID in there??
LOGGER.info("saved new review " + review);
mav.setViewName("review/editReview");
mav.addObject("message", "Review saved.");
} else {
LOGGER.info("reviewId found, verifying it's a real review " + editReviewForm);
Review review = reviewService.loadById(editReviewForm.getReviewId());
if (review != null) {
if (review.getAuthor().getUsername().equals(account.getUsername())) {
LOGGER.info("look, '" + review.getReviewId() + "' is a real review and owned by " + account.getUsername());
review.configure(editReviewForm);
reviewService.saveReview(review);
LOGGER.info("saved existing review " + review.getReviewId());
editReviewForm.importReview(review);
LOGGER.info("refreshing editReviewForm with " + editReviewForm);
mav.setViewName("review/editReview");
mav.addObject("message", "Review saved.");
} else {
mav.setViewName("review/reviewFailure");
mav.addObject("message", "I'm sorry, you're not the author of this review.");
}
} else {
mav.setViewName("review/reviewFailure");
mav.addObject("message", "I'm sorry, that review wasn't found.");
}
}
} catch (Exception ex) {
// TODO catch actual errors and handle them
// TODO tell the user wtf happened
LOGGER.error("It couldn't save " + editReviewForm);
LOGGER.error("damnit, something failed.", ex);
mav.setViewName("review/reviewFailure");
mav.addObject("message", "something failed.");
}
mav.addObject("editReviewForm", editReviewForm);
return mav;
}
/**
* Displays the form for editing a given review.
* @param reviewId The ID of the review you wish to edit.
* @return ModelAndView mav
*/
@RequestMapping(value = "/edit/{reviewId}", method = RequestMethod.GET)
public ModelAndView editReview(@PathVariable Long reviewId) {
LOGGER.debug("trying to edit " + reviewId);
ModelAndView mav = new ModelAndView();
try {
Review review = reviewService.loadById(reviewId);
Account account = getContextAccount();
EditReviewForm editReviewForm = new EditReviewForm();
LOGGER.info(review);
if (review != null) {
LOGGER.info("Review found");
if (account != null && review.getAuthor().getUsername().equals(account.getUsername())) {
LOGGER.info("Username matches " + review.getAuthor().getUsername());
mav.setViewName("review/editReview");
editReviewForm.importReview(review);
mav.addObject("editReviewForm", editReviewForm);
} else {
LOGGER.info(SecurityContextHolder.getContext().getAuthentication().getName() + " isn't the author " + review.getAuthor().getUsername());
String message = "I'm sorry, Only the author can edit a review.";
mav.setViewName("review/viewReview");
mav.addObject("review", review);
mav.addObject("message", message);
}
} else {
LOGGER.info("review doesn't exist");
String message = "I'm sorry, " + reviewId + " was not found.";
mav.setViewName("review/reviewFailure");
mav.addObject("message", message);
}
} catch (Exception ex) {
// TODO catch actual errors and handle them
// TODO tell the user wtf happened
LOGGER.error("Something failed while trying to display " + reviewId + ".", ex);
mav.addObject("message", "Something failed while trying to display " + reviewId + ".");
mav.setViewName("review/reviewFailure");
}
return mav;
}
/**
* Displays the basic info for a given Review.
* @param reviewId The review you wish to display.
* @return ModelAndView mav
*/
@RequestMapping(value = "/id/{reviewId}", method = RequestMethod.GET)
public ModelAndView displayReview(@PathVariable Long reviewId) {
LOGGER.debug("trying to display " + reviewId);
ModelAndView mav = new ModelAndView();
try {
Account account = getContextAccount();
Review review = reviewService.loadById(reviewId);
LOGGER.info(review);
if (review != null) {
if (account != null && review.getAuthor().getUsername().equals(account.getUsername())) {
// user logged in and owns it.
mav.addObject("editlink", "<div style='float:right;'><a href='/review/edit/" + review.getReviewId() + "'>[edit]</a></div>");
mav.addObject("review", review);
mav.setViewName("review/viewReview");
} else if (review.getPublished()) {
// user not logged in or doesn't own it
mav.addObject("review", review);
mav.setViewName("review/viewReview");
} else {
// note is not published
String message = "I'm sorry, " + reviewId + " is not available.";
LOGGER.error(message);
mav.setViewName("review/reviewFailure");
mav.addObject("message", message);
}
} else {
String message = "I'm sorry, " + reviewId + " was not found.";
LOGGER.error(message);
mav.setViewName("review/reviewFailure");
mav.addObject("message", message);
}
} catch (Exception ex) {
// TODO catch actual errors and handle them
// TODO tell the user wtf happened
LOGGER.error("Something failed while trying to display " + reviewId + ".", ex);
mav.addObject("message", "Something failed while trying to display " + reviewId + ".");
mav.setViewName("review/reviewFailure");
}
return mav;
}
/**
* This will display the user's reviews.
* @return ModelAndView mav
*/
@RequestMapping("/my")
public ModelAndView showMyReviews() {
LOGGER.info("showing user reviews");
ModelAndView mav = new ModelAndView();
try {
Account account = getContextAccount();
if (account != null) {
mav.addObject("account", account);
mav.setViewName("review/myReviews");
} else {
String message = "Odd, I couldn't find your account.";
LOGGER.error(message);
mav.addObject("message", message);
mav.setViewName("review/reviewFailure");
}
} catch (Exception ex) {
String message = "Something failed while trying to display user reviews.";
LOGGER.error(message, ex);
mav.addObject("message", message);
mav.setViewName("review/reviewFailure");
}
return mav;
}
/**
* This will display the review creation form.
* @return ModelAndView mav
*/
@RequestMapping("/create")
public ModelAndView createReviewForm() {
LOGGER.info("showing the createReviewForm");
ModelAndView mav = new ModelAndView();
mav.setViewName("review/editReview");
mav.addObject("editReviewForm", new EditReviewForm());
return mav;
}
/**
* This is the default view for review, a catch-all for most any one-offs.
* Will show the generic review page.
* @return ModelAndView mav
*/
@RequestMapping("/")
public ModelAndView defaultView() {
LOGGER.info("showing the default view");
ModelAndView mav = new ModelAndView();
mav.setViewName("review/view");
mav.addObject("message", "show the default view for reviews");
return mav;
}
public void setAccountService(AccountService pAccountService) {
this.accountService = pAccountService;
}
public AccountService getAccountService() {
return this.accountService;
}
public void setReviewService(ReviewService pReviewService) {
this.reviewService = pReviewService;
}
public ReviewService getReviewService() {
return this.reviewService;
}
/**
* Returns the account for the current context.
* @return Account
*/
public Account getContextAccount() {
String username = SecurityContextHolder.getContext().getAuthentication().getName();
return accountService.loadByUsername(username);
}
}
| [
"morgajel@97df6cfb-9eb4-4c22-a9bc-2131cb5d0d81"
] | morgajel@97df6cfb-9eb4-4c22-a9bc-2131cb5d0d81 |
5e8e412cfb00fa0152fba442e3c1218d75d5eb0e | cf0af1e232df83518034fc61ba857b35975dbd5f | /src/ArinaMainBackend.java | b4af8cbd551581fcd3709aa66adcb2751f7715e7 | [] | no_license | CRINOL/ARINA-SERVER-JAVA | cfc64bcc6b98a4e40590aee28cab23afb25d1478 | 693fe7716f875713004bdcb7995e1f4c49dfe8b9 | refs/heads/master | 2022-04-17T21:41:40.330279 | 2020-04-13T23:28:08 | 2020-04-13T23:28:08 | 255,463,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,939 | java |
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class ArinaMainBackend
*/
@WebServlet("/ArinaMainBackend")
public class ArinaMainBackend extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final String ROOT = "/home/technet/Arina";
private static final String PROF_DIR = ROOT + "/Profiles/";
private static final String REQ_DIR = ROOT + "/Requests/";
private static final String ACTIVE_DIR = ROOT + "/Active/";
private static final String APPR_DIR = ROOT + "/Approved/";
private static final String CMD_DIR = ROOT + "/Command/";
private static final String CONN_DIR = ROOT + "/Connected/";
private static final String FORM_DIR = ROOT + "/Formats/";
private static String COUNTRY = "";
private static String USER_NAME = "";
/**
* @see HttpServlet#HttpServlet()
*/
public ArinaMainBackend() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see Servlet#init(ServletConfig)
*/
public void init(ServletConfig config) throws ServletException {
// TODO Auto-generated method stub
}
/**
* @see Servlet#destroy()
*/
public void destroy() {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
private String FROM_CLIENT;
private static OutputStream SERVER_OUT;
private InputStream SERVER_IN;
private IOSupport IOS;
private DataParser DP;
HttpServletResponse RESPONSE;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
//doGet(request, response);
try {
SERVER_IN = request.getInputStream();
SERVER_OUT = response.getOutputStream();
RESPONSE = response;
IOS = new IOSupport(SERVER_IN);
FROM_CLIENT = IOS.readMsg();
System.out.println(FROM_CLIENT);
DP = new DataParser(FROM_CLIENT);
String type = "";
if(DP.getTotalItems() == 0) {
type = DP.getValue("DATA_TYPE");
}else {
type = DP.getValue(0,"DATA_TYPE");
}
switch(type) {
case "PROFILE":regUser();
break;
case "REQUESTS":getRequests();
break;
case "REQUEST":postRequest();
break;
case "REQUEST_S":postApproved();
break;
case "ACTIVE":getActive();
break;
case "USERS":getUsers();
break;
case "APPROVED":getApproved();
break;
case "INITIATE":postInitiate();
break;
case "WAITING":postInitiate();
break;
case "CONN_IN_NOTICE":postConnectIn();
break;
case "CONN_PASS_NOTICE":postConnectPass();
break;
case "COMMAND_PICK":getCommands();
break;
case "COMMANDS":postCmd();
break;
case "FORMATS_IN":postFormat();
break;
case "FORMATS_OUT":getFormat();
break;
default: System.out.println("UNKNOWN POST OPS CODE");
}
}catch(Exception e) {
e.printStackTrace();
}
}
private void regUser() {
COUNTRY = DP.getValue("COUNTRY");
USER_NAME = DP.getValue("NAME");
if(!(new File(PROF_DIR + COUNTRY).exists())) {
System.out.println("PROFE");
new File(PROF_DIR + COUNTRY).mkdirs();
IOS.writeStr(PROF_DIR + COUNTRY + "/Profiles.data",DP.getCleanJSON(),false);
IOS.writeStr(PROF_DIR + COUNTRY + "/Profiles.pop","1",false);
IOS.writeStr(PROF_DIR + COUNTRY + "/" + USER_NAME + ".data",FROM_CLIENT,false);
}else {
IOS.writeStr(PROF_DIR + COUNTRY + "/Profiles.data",("," + DP.getCleanJSON()),true);
updateIndex(PROF_DIR + COUNTRY + "/Profiles.pop");
IOS.writeStr(PROF_DIR + COUNTRY + "/" + USER_NAME + ".data",FROM_CLIENT,false);
}
updateProfDtb();
IOS.writeMsg(SERVER_OUT,"DONE");
}
public void updateProfDtb() {
if(IOS.readStr(PROF_DIR + "Profiles.pop").equals("")) {
IOS.writeStr(PROF_DIR + "Profiles.pop","1",false);
IOS.writeStr(PROF_DIR + "Profiles.data",DP.getCleanJSON(),false);
IOS.writeStr(PROF_DIR + "Names.data",DP.getIndexedPair("NAME",0,USER_NAME),false);
/*getIndexedPair returns {NAME0:$USER_NAME}*/
}else {
int pop = Integer.valueOf(IOS.readStr(PROF_DIR + "Profiles.pop")) + 1;
IOS.writeStr(PROF_DIR + "Profiles.pop",String.valueOf(pop),false);
IOS.writeStr(PROF_DIR + "Profiles.data",("," + DP.getCleanJSON()),true);
IOS.writeStr(PROF_DIR + "Names.data",("," + DP.getIndexedPair("NAME",0,USER_NAME)),true);
}
}
public void updateIndex(String dir) {
int pop = Integer.valueOf(IOS.readStr(dir)) + 1;
IOS.writeStr(dir,String.valueOf(pop),false);
}
private void getRequests() {
COUNTRY = DP.getValue("COUNTRY");
USER_NAME = DP.getValue("NAME");
if(!(new File(REQ_DIR + COUNTRY + "/" + USER_NAME + ".rqs").exists())) {
IOS.writeMsg(SERVER_OUT,"NO_REQUESTS");
}else {
IOS.writeMsg(SERVER_OUT,"[" + IOS.readStr(REQ_DIR + COUNTRY + "/" + USER_NAME + ".rqs") + "]");
}
}
private void getUsers() {
COUNTRY = DP.getValue("COUNTRY");
if(!(new File(PROF_DIR + COUNTRY).exists())){
IOS.writeMsg(SERVER_OUT,"NO_USERS");
}else {
IOS.writeMsg(SERVER_OUT,"[" + IOS.readStr(PROF_DIR + COUNTRY + "/Profiles.data") + "]");
}
}
private void getActive() {
COUNTRY = DP.getValue("COUNTRY");
USER_NAME = DP.getValue("NAME");
if(!(new File(ACTIVE_DIR + COUNTRY + "/" + USER_NAME + ".act").exists())) {
IOS.writeMsg(SERVER_OUT,"NO_ACTIVE");
}else {
IOS.writeMsg(SERVER_OUT,"[" + IOS.readStr(ACTIVE_DIR + COUNTRY + "/" + USER_NAME + ".act") + "]");
}
}
private void getApproved() {
COUNTRY = DP.getValue("COUNTRY");
USER_NAME = DP.getValue("NAME");
if(!(new File(APPR_DIR + COUNTRY + "/" + USER_NAME + ".appr").exists())) {
IOS.writeMsg(SERVER_OUT,"NO_CONFIRMS");
}else {
if(new File(APPR_DIR + COUNTRY + "/" + USER_NAME + ".appr").length() > 4) {
String data = "[" + IOS.readStr(APPR_DIR + COUNTRY + "/" + USER_NAME + ".appr") + "]";
DP = new DataParser(data);
data = DP.removeObjs("DATA_TYPE","REQUEST_S");
//System.out.println("rem" + "----" + data);
IOS.writeMsg(SERVER_OUT,data);
}else {
IOS.writeMsg(SERVER_OUT,"NO_CONFIRMS");
}
//IOS.writeMsg(SERVER_OUT,"[" + IOS.readStr(APPR_DIR + COUNTRY + "/" + USER_NAME + ".appr") + "]");
}
}
public void getCommands() {
COUNTRY = DP.getValue("COUNTRY");
USER_NAME = DP.getValue("NAME");
System.out.println(CMD_DIR + COUNTRY + "/" + USER_NAME + ".cmd");
if((new File(CMD_DIR + COUNTRY + "/" + USER_NAME + ".cmd").exists())) {
IOS.writeMsg(SERVER_OUT,"[" + IOS.readStr(CMD_DIR + COUNTRY + "/" + USER_NAME + ".cmd") + "]");
}else {
IOS.writeMsg(SERVER_OUT,"NO_COMMANDS");
}
}
public void postInitiate() {
COUNTRY = DP.getValue("DEST_COUNTRY");
USER_NAME = DP.getValue("DEST_NAME");
new File(ACTIVE_DIR + COUNTRY).mkdir();
if(!(new File(ACTIVE_DIR + COUNTRY + "/" + USER_NAME + ".act").exists())) {
IOS.writeStr(ACTIVE_DIR + COUNTRY + "/" + USER_NAME + ".act",DP.getCleanJSON(),false);
IOS.writeMsg(SERVER_OUT,"DONE");
}else {
String data = IOS.readStr(ACTIVE_DIR + COUNTRY + "/" + USER_NAME + ".act");
if(data.equals("")) {
IOS.writeStr(ACTIVE_DIR + COUNTRY + "/" + USER_NAME + ".act",DP.getCleanJSON(),false);
IOS.writeMsg(SERVER_OUT,"DONE");
}else {
DP = new DataParser("[" + data + "]");
if(DP.check4Same("NAME",DP.getValue("NAME"))) {
System.out.println(CONN_DIR + COUNTRY + "/" + USER_NAME + ".cnt");
if(new File(CONN_DIR + COUNTRY + "/" + USER_NAME + ".cnt" ).exists()) {
if(IOS.readStr(CONN_DIR + COUNTRY + "/" + USER_NAME + ".cnt").equals("CONNECTED")) {
IOS.writeMsg(SERVER_OUT,"CONNECTED");
}
if(IOS.readStr(CONN_DIR + COUNTRY + "/" + USER_NAME + ".cnt").equals("CONNECTING")) {
System.out.println(CONN_DIR + COUNTRY + "/" + USER_NAME + ".cnt");
IOS.writeMsg(SERVER_OUT,"CONNECTING");
}
}else {
//System.out.println("kooooooooooooo");
IOS.writeMsg(SERVER_OUT,"DONE");
}
}else {
DP = new DataParser(FROM_CLIENT);
IOS.writeStr(ACTIVE_DIR + COUNTRY + "/" + USER_NAME + ".act",("," + DP.getCleanJSON()),true);
IOS.writeMsg(SERVER_OUT,"DONE");
}
}
}
}
public void postRequest() {
COUNTRY = DP.getValue("DEST_COUNTRY");
USER_NAME = DP.getValue("DEST_NAME");
if(!(new File(REQ_DIR + COUNTRY).exists())) {
new File(REQ_DIR + COUNTRY).mkdir();
IOS.writeStr(REQ_DIR + COUNTRY + "/" + USER_NAME + ".rqs", DP.getCleanJSON(),false);
}else {
if(!(new File(REQ_DIR + COUNTRY + "/" + USER_NAME + ".rqs").exists())) {
IOS.writeStr(REQ_DIR + COUNTRY + "/" + USER_NAME + ".rqs", DP.getCleanJSON(),false);
}else {
IOS.writeStr(REQ_DIR + COUNTRY + "/" + USER_NAME + ".rqs", ("," + DP.getCleanJSON()),true);
}
}
IOS.writeMsg(SERVER_OUT,"DONE");
}
public void postApproved() {
COUNTRY = DP.getValue(1,"COUNTRY");
USER_NAME = DP.getValue(1,"NAME");
if(!(new File(APPR_DIR + COUNTRY).exists())) {
new File(APPR_DIR + COUNTRY).mkdir();
IOS.writeStr(APPR_DIR + COUNTRY + "/" + USER_NAME + ".appr", DP.getCleanJSON(),false);
}else {
if(!(new File(APPR_DIR + COUNTRY + "/" + USER_NAME + ".appr").exists())) {
IOS.writeStr(APPR_DIR + COUNTRY + "/" + USER_NAME + ".appr", DP.getCleanJSON(),false);
}else {
IOS.writeStr(APPR_DIR + COUNTRY + "/" + USER_NAME + ".appr", ("," + DP.getCleanJSON()),true);
}
}
IOS.writeMsg(SERVER_OUT,"DONE");
}
public void postConnectIn() {
COUNTRY = DP.getValue("COUNTRY");
USER_NAME = DP.getValue("NAME");
new File(CONN_DIR + COUNTRY).mkdir();
IOS.writeStr(CONN_DIR + COUNTRY + "/" + USER_NAME + ".cnt", "CONNECTING", false);
IOS.writeMsg(SERVER_OUT,"DONE");
}
public void postFormat() {
COUNTRY = DP.getValue("COUNTRY");
USER_NAME = DP.getValue("NAME");
new File(FORM_DIR + COUNTRY).mkdir();
IOS.writeStr(FORM_DIR + COUNTRY + "/" + USER_NAME + ".fmt", DP.getValue("FORMAT"), false);
IOS.writeMsg(SERVER_OUT,"DONE");
}
public void getFormat() {
COUNTRY = DP.getValue("COUNTRY");
USER_NAME = DP.getValue("NAME");
IOS.writeMsg(SERVER_OUT,IOS.readStr(FORM_DIR + COUNTRY + "/" + USER_NAME + ".fmt"));
}
public void postConnectPass() {
COUNTRY = DP.getValue("COUNTRY");
USER_NAME = DP.getValue("NAME");
new File(CONN_DIR + COUNTRY).mkdir();
IOS.writeStr(CONN_DIR + COUNTRY + "/" + USER_NAME + ".cnt", "CONNECTED", false);
IOS.writeMsg(SERVER_OUT,"CONNECTED");
}
public void postCmd() {
COUNTRY = DP.getValue("COUNTRY");
USER_NAME = DP.getValue("NAME");
new File(CMD_DIR + COUNTRY).mkdir();
IOS.writeStr(CMD_DIR + COUNTRY + "/" + USER_NAME + ".cmd", DP.getCleanJSON(), false);
IOS.writeMsg(SERVER_OUT,"DONE");
}
public void getCmd() {
COUNTRY = DP.getValue("COUNTRY");
USER_NAME = DP.getValue("NAME");
IOS.writeMsg(SERVER_OUT,IOS.readStr(CMD_DIR + COUNTRY + "/" + USER_NAME + ".cnt"));
}
/**
* @see HttpServlet#doPut(HttpServletRequest, HttpServletResponse)
*/
protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}
| [
"crusal2012@gmail.com"
] | crusal2012@gmail.com |
42b228f2e648e041fa085d56d49fed6bd017af92 | 92bc62155b019803a992ced373f4f2e8b01c598f | /app/src/main/java/com/java_lang_programming/android_material_design_demo/ui/MyItemRecyclerViewAdapter.java | bab011dd6f9fd839686683319f2ea957592b7808 | [] | no_license | java-lang-programming/Android-Material-Design-Demo | c7275093bc0f3ed82c929f9b3061936df097b395 | ad736c181cd4b474a403636130074348bc65976d | refs/heads/master | 2020-04-12T03:58:02.014624 | 2016-12-18T01:43:02 | 2016-12-18T01:43:02 | 62,648,564 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,688 | java | package com.java_lang_programming.android_material_design_demo.ui;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.java_lang_programming.android_material_design_demo.R;
import com.java_lang_programming.android_material_design_demo.ui.dummy.DummyContent.DummyItem;
import java.util.List;
/**
* {@link RecyclerView.Adapter} that can display a {@link DummyItem} and makes a call to the
* TODO: Replace the implementation with code for your data type.
*/
public class MyItemRecyclerViewAdapter extends RecyclerView.Adapter<MyItemRecyclerViewAdapter.ViewHolder> {
private final List<DummyItem> mValues;
private final CustomRecyclerViewFragment.OnListFragmentInteractionListener mListener;
public MyItemRecyclerViewAdapter(List<DummyItem> items, CustomRecyclerViewFragment.OnListFragmentInteractionListener listener) {
mValues = items;
mListener = listener;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.fragment_item, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
holder.mItem = mValues.get(position);
holder.mIdView.setText(mValues.get(position).id);
holder.mContentView.setText(mValues.get(position).content);
holder.mView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (null != mListener) {
// Notify the active callbacks interface (the activity, if the
// fragment is attached to one) that an item has been selected.
mListener.onListFragmentInteraction(holder.mItem);
}
}
});
}
@Override
public int getItemCount() {
return mValues.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public final View mView;
public final TextView mIdView;
public final TextView mContentView;
public DummyItem mItem;
public ViewHolder(View view) {
super(view);
mView = view;
mIdView = (TextView) view.findViewById(R.id.id);
mContentView = (TextView) view.findViewById(R.id.content);
}
@Override
public String toString() {
return super.toString() + " '" + mContentView.getText() + "'";
}
}
}
| [
"msuzuki@masayasuzuki-no-Mac-mini.local"
] | msuzuki@masayasuzuki-no-Mac-mini.local |
23f9c014170710b40f0511a91c6cfd43351f5004 | 961eb34239ca13b04dfa7562be83b37f4a3290e5 | /Java-Fundamentals/7.RegularExpression/src/QueryMess.java | 6ebab19af47b1c71aad6818853f33ad0394fb968 | [] | no_license | inaabadjieva/SoftUni-Java | 9304f36b77f6624c1a3ebea475312dd6fd0af4f7 | 0a2fc33e59a35243486e6d12ab8c7f8bca67f1df | refs/heads/master | 2021-01-13T04:39:23.520696 | 2017-02-23T14:12:54 | 2017-02-23T14:12:54 | 79,350,439 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,504 | java | import com.sun.org.apache.xpath.internal.SourceTree;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class QueryMess {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
Pattern pattern = Pattern.compile("[^&?]+=[^&?]+");
String line = reader.readLine();
while(!"END".equals(line)){
LinkedHashMap<String, ArrayList<String>> result = new LinkedHashMap<>();
Matcher matcher = pattern.matcher(line);
while (matcher.find()){
String[] tokens = matcher.group().split("=");
String key = tokens[0].replaceAll("%20|\\+"," ").trim();
String value = tokens[1].replaceAll("%20|\\+"," ").replaceAll("\\s+", " ").trim();
if(result.containsKey(key)){
result.get(key).add(value);
} else {
ArrayList<String> val = new ArrayList<>();
val.add(value);
result.put(key,val);
}
}
for (String key : result.keySet()) {
System.out.print(key + "=" + result.get(key));
}
System.out.println();
line = reader.readLine();
}
}
}
| [
"ina_abadjieva@yahoo.com"
] | ina_abadjieva@yahoo.com |
a3b4b52e3da24ec103d78c456f469b07fac3e4ef | a725378e1ed25966ebdfd85c4c051aa74227cde7 | /src/main/java/com/example/demo/controller/HelloSpringBoot.java | 82eda31312257c2e4e0ab5ee96be311f8e5fe1da | [] | no_license | YTW-RX/Demo5173 | 8e3afdad5513d214ff3661426f634dd3e2823b9c | 77248ecf6f0725bff98151ecaf5bc15f689670fc | refs/heads/master | 2023-02-07T19:05:27.226626 | 2020-12-29T11:36:40 | 2020-12-29T11:36:40 | 323,773,748 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 316 | java | package com.example.demo.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* @author 殷涛文
*/
@Controller
public class HelloSpringBoot {
@RequestMapping("/index")
public String index() {
return "index";
}
}
| [
"1732773103@qq.com"
] | 1732773103@qq.com |
843ad05df7471a037a26ca39ad602cc787fda167 | ed63f4b1d0abfeca34faa25c3cee0597510137ab | /spring-boot-jpa/src/main/java/com/example/springbootmvc/service/UserService.java | de32d3edb2e53695dab94541bae7aac5dee6923d | [] | no_license | xplx/SpringBoot | 7e2f21718a3fe3b7e169aaf8e418e5625e3b05fb | fdcf19596c152d687237bb481bb4034b8a9cc850 | refs/heads/master | 2022-09-16T10:21:56.793157 | 2021-12-27T08:30:18 | 2021-12-27T08:30:18 | 143,109,663 | 0 | 0 | null | 2022-09-01T23:21:37 | 2018-08-01T05:50:23 | Java | UTF-8 | Java | false | false | 706 | java | package com.example.springbootmvc.service;
import java.util.List;
import com.example.springbootmvc.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
public interface UserService {
public User findUser(int id);
public Integer addUser(User user);
public List<User> getAllUser(int start, int end);
public User getUser(String name);
public User getUser(String name, Integer departmentId);
public Page<User> queryUser(Integer departmentId, Pageable page);
public Page<User> queryUser2(Integer departmentId, Pageable page);
public List<User> getByExample(String name) ;
public void updateUser(User user);
public int getCredit(int userId);
}
| [
"xpxl12@163.COM"
] | xpxl12@163.COM |
19a8db1f1ca000c302c0677721e5f2a6c6a0690e | 0895ee3be3fead56f778eeab62314619bfd89fd3 | /.svn/pristine/19/19a8db1f1ca000c302c0677721e5f2a6c6a0690e.svn-base | 15c9c874624ec6a7868ddb27bc6f74a2750d00ea | [] | no_license | yanhongyu110/escq | 451608d2eac45ac7163205cc35c15d1326d527e5 | 1c3f4eb49320aaf9cf5e56dea83c7db4177a8ef7 | refs/heads/master | 2021-03-30T22:19:30.522792 | 2018-03-13T02:43:31 | 2018-03-13T02:43:31 | 124,982,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,570 | package com.jero.esc.po.userinfo;
public class ArrangementInfo {
private String arrId;
private String arrSeverid;
private String arrStarttime;
private String arrEndtime;
private String arrCurday;
private String arrContent;
private String arrComment;
public String getArrId() {
return arrId;
}
public void setArrId(String arrId) {
this.arrId = arrId;
}
public String getArrSeverid() {
return arrSeverid;
}
public void setArrSeverid(String arrSeverid) {
this.arrSeverid = arrSeverid;
}
public String getArrStarttime() {
return arrStarttime;
}
public void setArrStarttime(String arrStarttime) {
this.arrStarttime = arrStarttime;
}
public String getArrEndtime() {
return arrEndtime;
}
public void setArrEndtime(String arrEndtime) {
this.arrEndtime = arrEndtime;
}
public String getArrCurday() {
return arrCurday;
}
public void setArrCurday(String arrCurday) {
this.arrCurday = arrCurday;
}
public String getArrContent() {
return arrContent;
}
public void setArrContent(String arrContent) {
this.arrContent = arrContent;
}
public String getArrComment() {
return arrComment;
}
public void setArrComment(String arrComment) {
this.arrComment = arrComment;
}
public String toString() {
return "Arrange [arrId=" + arrId + ", arrSeverid=" + arrSeverid + ", arrStarttime=" + arrStarttime
+ ", arrEndtime=" + arrEndtime + ", arrCurday=" + arrCurday + ", arrContent=" + arrContent
+ ", arrComment=" + arrComment + "]";
}
}
| [
"517444425@qq.com"
] | 517444425@qq.com | |
c7ee20afaa7860d9545e6cd1932bc0a4bd1aff15 | 989acabc2d8e62e0f9166e8b8311e1840dfbead9 | /test1023/src/추상클래스/ApplePhone.java | 00d4b0e797f3da2b022cbea64decb6a2ae209a2a | [] | no_license | dlwjdgn8720/androidjava | 214cf40d845fe1523a2b7401df78e91998124c98 | 7cb8407f82f01fb5894b151f3586785f19acf8ef | refs/heads/master | 2023-01-22T19:50:39.635282 | 2020-11-18T09:58:46 | 2020-11-18T09:58:46 | 288,131,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,094 | java | package 추상클래스;
//추상 클래스는 객체 생성 불가능
public abstract class ApplePhone implements MegaPhone {
String tel = "010-111-2222";
//추상 메서드가 하나라도 포함되어 있으면,
//추상 클래스라고 부른다.
public abstract void camera();
@Override
public void internet() {
// TODO Auto-generated method stub
System.out.println("애플폰으로 인터넷을하다.");
}
@Override
public void call() {
// TODO Auto-generated method stub
System.out.println(tel+ "전화하다.");
}
@Override
public void text() {
// TODO Auto-generated method stub
System.out.println("애플폰으로 문자하다.");
}
@Override
public void kakao() {
// TODO Auto-generated method stub
System.out.println("애플폰으로 카카오를하다.");
}
@Override
public void map() {
// TODO Auto-generated method stub
System.out.println("애플폰으로 맵을 사용하다.");
}
@Override
public void siri() {
// TODO Auto-generated method stub
System.out.println("애플폰으로 시리를 사용하다.");
}
}
| [
"noreply@github.com"
] | noreply@github.com |
53eafb370fef730cf01013cd4afa1b497c32c806 | 7af4e856e4959ebf852ce31df42a35481683de27 | /src/main/java/io/github/anantharajuc/sbtest/backend/persistence/domain/backend/Geo.java | 288ae0a83b6d942fcf0be5161a53603356b5201f | [] | no_license | dumpala412/Spring-Boot-Application-Template | a931ef0b345387fba27910dcf2f3019729b7d18e | 658d86a9d6ddc7d489f5224c3b6daa04dab47843 | refs/heads/master | 2022-12-14T13:08:30.712916 | 2020-08-24T16:01:37 | 2020-08-24T16:01:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 887 | java | package io.github.anantharajuc.sbtest.backend.persistence.domain.backend;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import com.fasterxml.jackson.annotation.JsonBackReference;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "geo")
@EntityListeners(AuditingEntityListener.class)
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class Geo extends BaseEntity
{
private static final long serialVersionUID = 1L;
@Column(name = "lat")
private String lat;
@Column(name = "lng")
private String lng;
@JsonBackReference
@OneToOne(mappedBy = "geo")
private Address address;
}
| [
"arcswdev@gmail.com"
] | arcswdev@gmail.com |
cd17d1bd153de676707c19b71643b7c8b6bd833f | 9d9d0c49f5941473467c5789a3ba417582af8d07 | /weapp-webs/weapp-webs-admin/src/main/java/com/weapp/web/admin/config/RootConfig.java | 9b8a2af958811a39da4dc58c10f3d3a54fec4fae | [] | no_license | 18019675002/weapp | 3bebcb96dc0c38f060d1852c29b00192323a6b33 | e6b65faa42ce78b51a536dc3ce93ad86b5f1c13e | refs/heads/master | 2021-01-19T22:09:06.818505 | 2017-04-24T16:22:01 | 2017-04-24T16:22:01 | 88,761,329 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 673 | java | package com.weapp.web.admin.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
/**
* @Description: TODO
* @author Wangjie
* @date 创建时间:2017年4月7日 上午12:50:04
* @version 1.0
* @since
*/
@Configuration
@ComponentScan(basePackages={"weapp"},excludeFilters={@Filter(type=FilterType.ANNOTATION,value=EnableWebMvc.class)})
public class RootConfig {
}
| [
"591961691@qq.com"
] | 591961691@qq.com |
d4bbe5be737c1d242dcafeecdf00636442fd6b4a | 7673681971457f4f827c0860e6ca44b801355c62 | /projet1/src/module-info.java | d2bebed8118c46540cb7298ff4d6f081f0eb2ab3 | [] | no_license | Nahjoo/JAVA | a373282137c572e840cc338ed6abb09294bbbd36 | 1f9a072316fb5e3e454b4b913bd2a5f0b58086db | refs/heads/master | 2020-07-19T02:17:58.386425 | 2019-09-09T14:18:15 | 2019-09-09T14:18:15 | 206,152,951 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 58 | java | /**
*
*/
/**
* @author Johan
*
*/
module projet1 {
} | [
"johan-delcourt62@hotmail.fr"
] | johan-delcourt62@hotmail.fr |
65c0eb16a5fe575e06972dcfa6bd37abca8f0030 | 0120335b010faa4149dc5611a0d0df2ed4972df0 | /config/src/main/java/com/piggymetrics/config/ConfigApplication.java | 4963a3ca3c45b3d3cb67f8c6c0fa98e505c2dd28 | [
"MIT"
] | permissive | karthiklabs/microservice-finance | e7c1ae1bdf6e93a0bbd58c10f4a699ff4668f128 | a4791fdeb4b0878065e0a9a0592c90f14927e674 | refs/heads/master | 2020-03-28T01:16:14.172480 | 2018-09-27T12:30:50 | 2018-09-27T12:30:50 | 147,491,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 593 | java | package com.piggymetrics.config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SpringBootApplication
@EnableConfigServer
public class ConfigApplication {
private static final Logger LOG = LoggerFactory.getLogger(ConfigApplication.class.getName());
public static void main(String[] args) {
LOG.info("Starting config server");
SpringApplication.run(ConfigApplication.class, args);
}
}
| [
"32713545+javakarthik@users.noreply.github.com"
] | 32713545+javakarthik@users.noreply.github.com |
c226cb1e3c39149f0dab9f5ad1a22f4cec473ca3 | cd1066a1342b9feab357c1cb565a6d9d533e0c8f | /src/main/java/ru/wildbot/wildbotcore/vk/server/VkHttpHandler.java | f8f7264a6ca95a817297aa5158ac9fb706e8d6cf | [
"Apache-2.0"
] | permissive | CatCoderr/WildBot | eac626e5e2d328d2db9d709347f69a6151848ae1 | 9e0149c83bb5a6ccc0002adbc6b0ec30bd5aca92 | refs/heads/master | 2021-07-23T15:14:39.989249 | 2017-10-28T21:58:28 | 2017-10-28T21:58:28 | 105,394,363 | 0 | 0 | null | 2017-09-30T19:13:19 | 2017-09-30T19:13:19 | null | UTF-8 | Java | false | false | 19,281 | java | /*
* Apache License
* Version 2.0, January 2004
* http://www.apache.org/licenses/
*
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
*
* 1. Definitions.
*
* "License" shall mean the terms and conditions for use, reproduction,
* and distribution as defined by Sections 1 through 9 of this document.
*
* "Licensor" shall mean the copyright owner or entity authorized by
* the copyright owner that is granting the License.
*
* "Legal Entity" shall mean the union of the acting entity and all
* other entities that control, are controlled by, or are under common
* control with that entity. For the purposes of this definition,
* "control" means (i) the power, direct or indirect, to cause the
* direction or management of such entity, whether by contract or
* otherwise, or (ii) ownership of fifty percent (50%) or more of the
* outstanding shares, or (iii) beneficial ownership of such entity.
*
* "You" (or "Your") shall mean an individual or Legal Entity
* exercising permissions granted by this License.
*
* "Source" form shall mean the preferred form for making modifications,
* including but not limited to software source code, documentation
* source, and configuration files.
*
* "Object" form shall mean any form resulting from mechanical
* transformation or translation of a Source form, including but
* not limited to compiled object code, generated documentation,
* and conversions to other media types.
*
* "Work" shall mean the work of authorship, whether in Source or
* Object form, made available under the License, as indicated by a
* copyright notice that is included in or attached to the work
* (an example is provided in the Appendix below).
*
* "Derivative Works" shall mean any work, whether in Source or Object
* form, that is based on (or derived from) the Work and for which the
* editorial revisions, annotations, elaborations, or other modifications
* represent, as a whole, an original work of authorship. For the purposes
* of this License, Derivative Works shall not include works that remain
* separable from, or merely link (or bind by name) to the interfaces of,
* the Work and Derivative Works thereof.
*
* "Contribution" shall mean any work of authorship, including
* the original version of the Work and any modifications or additions
* to that Work or Derivative Works thereof, that is intentionally
* submitted to Licensor for inclusion in the Work by the copyright owner
* or by an individual or Legal Entity authorized to submit on behalf of
* the copyright owner. For the purposes of this definition, "submitted"
* means any form of electronic, verbal, or written communication sent
* to the Licensor or its representatives, including but not limited to
* communication on electronic mailing lists, source code control systems,
* and issue tracking systems that are managed by, or on behalf of, the
* Licensor for the purpose of discussing and improving the Work, but
* excluding communication that is conspicuously marked or otherwise
* designated in writing by the copyright owner as "Not a Contribution."
*
* "Contributor" shall mean Licensor and any individual or Legal Entity
* on behalf of whom a Contribution has been received by Licensor and
* subsequently incorporated within the Work.
*
* 2. Grant of Copyright License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* copyright license to reproduce, prepare Derivative Works of,
* publicly display, publicly perform, sublicense, and distribute the
* Work and such Derivative Works in Source or Object form.
*
* 3. Grant of Patent License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* (except as stated in this section) patent license to make, have made,
* use, offer to sell, sell, import, and otherwise transfer the Work,
* where such license applies only to those patent claims licensable
* by such Contributor that are necessarily infringed by their
* Contribution(s) alone or by combination of their Contribution(s)
* with the Work to which such Contribution(s) was submitted. If You
* institute patent litigation against any entity (including a
* cross-claim or counterclaim in a lawsuit) alleging that the Work
* or a Contribution incorporated within the Work constitutes direct
* or contributory patent infringement, then any patent licenses
* granted to You under this License for that Work shall terminate
* as of the date such litigation is filed.
*
* 4. Redistribution. You may reproduce and distribute copies of the
* Work or Derivative Works thereof in any medium, with or without
* modifications, and in Source or Object form, provided that You
* meet the following conditions:
*
* (a) You must give any other recipients of the Work or
* Derivative Works a copy of this License; and
*
* (b) You must cause any modified files to carry prominent notices
* stating that You changed the files; and
*
* (c) You must retain, in the Source form of any Derivative Works
* that You distribute, all copyright, patent, trademark, and
* attribution notices from the Source form of the Work,
* excluding those notices that do not pertain to any part of
* the Derivative Works; and
*
* (d) If the Work includes a "NOTICE" text file as part of its
* distribution, then any Derivative Works that You distribute must
* include a readable copy of the attribution notices contained
* within such NOTICE file, excluding those notices that do not
* pertain to any part of the Derivative Works, in at least one
* of the following places: within a NOTICE text file distributed
* as part of the Derivative Works; within the Source form or
* documentation, if provided along with the Derivative Works; or,
* within a display generated by the Derivative Works, if and
* wherever such third-party notices normally appear. The contents
* of the NOTICE file are for informational purposes only and
* do not modify the License. You may add Your own attribution
* notices within Derivative Works that You distribute, alongside
* or as an addendum to the NOTICE text from the Work, provided
* that such additional attribution notices cannot be construed
* as modifying the License.
*
* You may add Your own copyright statement to Your modifications and
* may provide additional or different license terms and conditions
* for use, reproduction, or distribution of Your modifications, or
* for any such Derivative Works as a whole, provided Your use,
* reproduction, and distribution of the Work otherwise complies with
* the conditions stated in this License.
*
* 5. Submission of Contributions. Unless You explicitly state otherwise,
* any Contribution intentionally submitted for inclusion in the Work
* by You to the Licensor shall be under the terms and conditions of
* this License, without any additional terms or conditions.
* Notwithstanding the above, nothing herein shall supersede or modify
* the terms of any separate license agreement you may have executed
* with Licensor regarding such Contributions.
*
* 6. Trademarks. This License does not grant permission to use the trade
* names, trademarks, service marks, or product names of the Licensor,
* except as required for reasonable and customary use in describing the
* origin of the Work and reproducing the content of the NOTICE file.
*
* 7. Disclaimer of Warranty. Unless required by applicable law or
* agreed to in writing, Licensor provides the Work (and each
* Contributor provides its Contributions) on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied, including, without limitation, any warranties or conditions
* of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
* PARTICULAR PURPOSE. You are solely responsible for determining the
* appropriateness of using or redistributing the Work and assume any
* risks associated with Your exercise of permissions under this License.
*
* 8. Limitation of Liability. In no event and under no legal theory,
* whether in tort (including negligence), contract, or otherwise,
* unless required by applicable law (such as deliberate and grossly
* negligent acts) or agreed to in writing, shall any Contributor be
* liable to You for damages, including any direct, indirect, special,
* incidental, or consequential damages of any character arising as a
* result of this License or out of the use or inability to use the
* Work (including but not limited to damages for loss of goodwill,
* work stoppage, computer failure or malfunction, or any and all
* other commercial damages or losses), even if such Contributor
* has been advised of the possibility of such damages.
*
* 9. Accepting Warranty or Additional Liability. While redistributing
* the Work or Derivative Works thereof, You may choose to offer,
* and charge a fee for, acceptance of support, warranty, indemnity,
* or other liability obligations and/or rights consistent with this
* License. However, in accepting such obligations, You may act only
* on Your own behalf and on Your sole responsibility, not on behalf
* of any other Contributor, and only if You agree to indemnify,
* defend, and hold each Contributor harmless for any liability
* incurred by, or claims asserted against, such Contributor by reason
* of your accepting any such warranty or additional liability.
*
* END OF TERMS AND CONDITIONS
*
* APPENDIX: How to apply the Apache License to your work.
*
* To apply the Apache License to your work, attach the following
* boilerplate notice, with the fields enclosed by brackets "{}"
* replaced with your own identifying information. (Don't include
* the brackets!) The text should be enclosed in the appropriate
* comment syntax for the file format. We also recommend that a
* file or class name and description of purpose be included on the
* same "printed page" as the copyright notice for easier
* identification within third-party archives.
*
* Copyright 2017 JARvis (Peter P.) PROgrammer
*
* 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 ru.wildbot.wildbotcore.vk.server;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.reflect.TypeToken;
import com.vk.api.sdk.callback.objects.messages.CallbackMessage;
import com.vk.api.sdk.callback.objects.messages.CallbackMessageType;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.codec.http.*;
import lombok.*;
import ru.wildbot.wildbotcore.console.logging.Tracer;
import ru.wildbot.wildbotcore.vk.VkApiManager;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import static io.netty.buffer.Unpooled.copiedBuffer;
public class VkHttpHandler extends ChannelInboundHandlerAdapter {
@NonNull private final VkApiManager vkApiManager;
@NonNull private final String confirmationCode;
private final Charset UTF_8_CHARSET = StandardCharsets.UTF_8;
private final Gson gson = new Gson();
private final VkCallbackApiHandler callbackApiHandler = new VkCallbackApiHandler();
@Getter @Setter private String htmlErrorContent = "<html><h1>This project is using WildBot</h1>" +
"<h2>by JARvis (Peter P.) PROgrammer</h2></html>";
@Getter private final String OK_RESPONSE = "ok";
public static final String ERROR_HTML_FILE_NAME = "vk_callback_error.html";
public VkHttpHandler(final VkApiManager vkApiManager, final String confirmationCode) {
Tracer.info("Initialising Handler for VK-Callbacks");
if (confirmationCode == null) throw new NullPointerException("No confirmation code present");
this.confirmationCode = confirmationCode;
if (vkApiManager == null) throw new NullPointerException("No vk api manager present");
this.vkApiManager = vkApiManager;
File errorFile = new File(ERROR_HTML_FILE_NAME);
try {
if (!errorFile.exists() || errorFile.isDirectory()) {
Tracer.info("Could not find File \"vk_callback_error.html\", creating it now");
@Cleanup val outputStream = new FileOutputStream(errorFile);
outputStream.write(htmlErrorContent.getBytes());
Tracer.info("File \"vk_callback_error.html\" has been successfully created");
}
val htmlLines = Files.readAllLines(errorFile.toPath());
val htmlErrorContentBuilder = new StringBuilder();
for (String htmlLine : htmlLines) htmlErrorContentBuilder.append(htmlLine);
htmlErrorContent = htmlErrorContentBuilder.toString();
} catch (IOException e) {
Tracer.error("An exception occurred while trying to load error-HTML page", e, "Using default one");
}
}
@Override
public void channelRead(ChannelHandlerContext context, Object message) throws Exception {
if (message instanceof FullHttpRequest) {
val request = (FullHttpRequest) message;
val requestContent = parseIfPossibleCallback(request);
CallbackMessage callback;
try {
callback = gson.fromJson(requestContent, new TypeToken<CallbackMessage<JsonObject>>(){}.getType());
} catch (JsonParseException e) {
callback = null;
}
// If is not callback (this HTTP is ONLY FOR CALLBACKS) then send error response
if (callback != null && callback.getGroupId().equals(vkApiManager.getGroupId())) {
if (callback.getType() == CallbackMessageType.CONFIRMATION) {
sendConfirmationResponse(context, request);
return;
} else {
if (callbackApiHandler.parse(requestContent)) {
sendOkResponse(context, request);
return;
}
}
}
sendErrorResponse(context, request);
} else {
Tracer.warn("Unexpected http-message appeared while handling vk-callback," +
"using default handling method");
super.channelRead(context, message);
}
}
@Override
public void channelReadComplete(ChannelHandlerContext context) throws Exception {
context.flush();
}
@Override
public void exceptionCaught(ChannelHandlerContext context, Throwable cause) throws Exception {
context.writeAndFlush(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.INTERNAL_SERVER_ERROR, copiedBuffer(cause.getMessage().getBytes())));
}
// Gets Callback (if everything OK and not confirmation)
private String parseIfPossibleCallback(final FullHttpRequest request) {
if (request == null || request.getMethod() != HttpMethod.POST) return null;
return request.content().toString(UTF_8_CHARSET);
}
// Response (confirmation code)
private void sendConfirmationResponse(final ChannelHandlerContext context, final FullHttpRequest request) {
//Main content
final FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.OK, copiedBuffer(confirmationCode.getBytes()));
// Required headers
if (HttpHeaders.isKeepAlive(request)) response.headers().set(HttpHeaders.Names.CONNECTION,
HttpHeaders.Values.KEEP_ALIVE);
response.headers().set(HttpHeaders.Names.CONTENT_TYPE, "text/html;charset=utf-8");
response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, confirmationCode.length());
// Write and Flush (send)
context.writeAndFlush(response);
}
// Response (confirmation code)
private void sendOkResponse(final ChannelHandlerContext context, final FullHttpRequest request) {
//Main content
final FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.OK, copiedBuffer(OK_RESPONSE.getBytes()));
// Required headers
if (HttpHeaders.isKeepAlive(request)) response.headers().set(HttpHeaders.Names.CONNECTION,
HttpHeaders.Values.KEEP_ALIVE);
response.headers().set(HttpHeaders.Names.CONTENT_TYPE, "text/html;charset=utf-8");
response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, OK_RESPONSE.length());
// Write and Flush (send)
context.writeAndFlush(response);
}
// Response (error)
private void sendErrorResponse(final ChannelHandlerContext context, final FullHttpRequest request) {
//Main content
final FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.OK, copiedBuffer(htmlErrorContent.getBytes()));
// Required headers
if (HttpHeaders.isKeepAlive(request)) response.headers().set(HttpHeaders.Names.CONNECTION,
HttpHeaders.Values.KEEP_ALIVE);
response.headers().set(HttpHeaders.Names.CONTENT_TYPE, "text/html;charset=utf-8");
response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, htmlErrorContent.length());
// Write and Flush (send)
context.writeAndFlush(response);
}
}
| [
"mrjarviscraft@gmail.com"
] | mrjarviscraft@gmail.com |
a98bacaac0aa292dd91cc21300eee9d7cc8042de | 30472cec0dbe044d52b029530051ab404701687f | /src/main/java/com/nawforce/platform/ConnectApi/SortOrder.java | 92e50c5bc34a79c9737a699d87b9501d9632283e | [
"BSD-3-Clause"
] | permissive | madmax983/ApexLink | f8e9dcf8f697ed4e34ddcac353c13bec707f3670 | 30c989ce2c0098097bfaf586b87b733853913155 | refs/heads/master | 2020-05-07T16:03:15.046972 | 2019-04-08T21:08:06 | 2019-04-08T21:08:06 | 180,655,963 | 1 | 0 | null | 2019-04-10T20:08:30 | 2019-04-10T20:08:30 | null | UTF-8 | Java | false | false | 1,581 | java | /*
[The "BSD licence"]
Copyright (c) 2019 Kevin Jones
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.nawforce.platform.ConnectApi;
@SuppressWarnings("unused")
public enum SortOrder {
Ascending,
Descending,
MostRecentlyViewed
}
| [
"nawforce@gmail.com"
] | nawforce@gmail.com |
221a21ec9cda52ab08d89b64b58f16c427a675f3 | b6820ab1305896299b32327063e57a0796cc94b4 | /trunk/src/test/java/webcrawl/request/TestHostNameRule.java | 059f7ca88e990305a366c1c243b6823aa287ed5b | [] | no_license | jingjingzhi/crawlman | 3c8f88bac5c619dab7640b932b0d2c97e75d2f1c | e8c283be25cb116fdaab6323262e3e4c89f310b9 | refs/heads/master | 2020-06-03T18:13:22.746207 | 2012-07-28T13:12:50 | 2012-07-28T13:12:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package webcrawl.request;
import junit.framework.Assert;
import org.junit.Test;
import webcrawl.request.HttpRequest;
import webcrawl.rule.accept.HostNameAcceptRule;
public class TestHostNameRule {
@Test
public void test() {
try {
HostNameAcceptRule HostNameRule = new HostNameAcceptRule(
"www.cogoo.net");
Assert.assertEquals(true, HostNameRule.match(new HttpRequest(
"http://www.cogoo.net/sell/show.php?itemid=41", 3)));
} catch (Exception e) {
Assert.fail();
}
}
}
| [
"jingjingzhi@gmail.com"
] | jingjingzhi@gmail.com |
1b67df56ab32a8e7c9384be7268d48f8cc0aba97 | 74c9b268d6492c7e7f1f18f6546415567ec7e607 | /src/test/java/be/thomaswinters/wordapproximation/fixer/WordEndFixerTest.java | 7ae23007bb986d795142eb83c8b33635840aac94 | [] | no_license | twinters/samson-bot | 9e249b00345a9e9693d45403762d917c9c3261ac | 51c8fa302fe4cd75e2764c3b14f1cbe89a491448 | refs/heads/master | 2020-07-22T01:00:59.790256 | 2019-09-07T21:33:17 | 2019-09-07T21:33:17 | 207,024,125 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,573 | java | package be.thomaswinters.wordapproximation.fixer;
import be.thomaswinters.samsonworld.samson.knowledge.SamsonCharacterSubstitutionCalculator;
import be.thomaswinters.wordapproximation.WordApproximator;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class WordEndFixerTest {
@Test
public void EndLetter_OneLetter() {
testGoal("kakelvers", "burgemeester", 3, "burgemeesters");
}
@Test
public void Identity_TooLargeMaxFixLength() {
testGoal("bla", "burgemeester", 15, "burgemeesterbla");
}
@Test
public void Identity_SpaceExtra() {
testGoal("bla", "burgemeester ", 2, "burgemeesterla");
}
@Test
public void EndLetters_NoOverlap() {
testGoal("aaaaaa", "bbbbb", 3, "bbbbbaaa");
}
@Test
public void EndLetters_TwoLetters() {
testGoal("geit", "bergge", 3, "berggeit");
}
@Test
public void EndLetters_NotSameLettersAtEnd() {
testGoal("meermeits", "geik", 5, "geits");
}
@Test
public void EndLetters_NotSameLettersAtEnd_2_3() {
testGoal("geuts", "keur", 5, "keuts");
}
private void testGoal(String inputWord, String wordInDatabase, int maxFixLength, String goalOutput) {
WordEndFixer fixer = new WordEndFixer(new WordApproximator(Arrays.asList(wordInDatabase), new SamsonCharacterSubstitutionCalculator()), maxFixLength);
assertEquals(Optional.of(goalOutput), fixer.findBestFit(inputWord));
}
} | [
"info@thomaswinters.be"
] | info@thomaswinters.be |
7996741b7d1cd367dabe82764a9dc68bf8eaccb2 | a36adf8a47774f4ca296c6daea7cea4e086f10cc | /Server/Database.java | 6c4c3a42a54649e51b84fbef66c985d5ad5c6b25 | [] | no_license | Sumrakbro/Lab8 | cf097ae9a6114f5c0424ff5de7229b44780ea61c | 00b73623e1e460464327fbc07cc23075403d1c8b | refs/heads/master | 2022-11-16T22:51:27.444336 | 2020-07-06T08:17:35 | 2020-07-06T08:17:35 | 277,482,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,456 | java | package Server;
import Lab5.com.company.Coordinates;
import Lab5.com.company.Person;
import Lab5.com.company.Ticket;
import Lab5.com.company.TicketType;
import Lab5.commands.A_command;
import java.sql.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.TreeSet;
public class Database {
String url;
String user;
String password;
String driverPath;
static Connection connection;
public Database(String url, String user, String password, String driverPath) {
this.url = url;
this.user = user;
this.password = password;
this.driverPath = driverPath;
}
public void downloadDriver() {
try {
Class.forName(this.driverPath);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
public static Connection getConnection() {
return connection;
}
public void connectionToDatabase() throws SQLException {
this.downloadDriver();
connection = DriverManager.getConnection(url, user, password);
if (connection != null) {
System.out.println("You made it, take control your database now!");
} else {
System.out.println("Failed to make connection!");
}
this.createType();
createSeq();
this.createTable();
}
public ArrayList<String> AuthorizationUser(User user) throws SQLException {
if(Server.checkAuthorization(user.getLogin())) return new ArrayList<>(Collections.singleton("This login is already authorized"));
if (checkLogin(user)) {
if (checkPassword(user)) {
Server.addUser(user.getLogin());
return new ArrayList<>(Collections.singleton("Successful"));
} else return new ArrayList<>(Collections.singleton("Wrong password"));
}
return new ArrayList<>(Collections.singleton("There is no user with this nickname"));
}
private boolean checkLogin(User user) throws SQLException {
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM Users");
while (resultSet.next()) {
String login = resultSet.getString(1);
System.out.println("1:" + login + " 2:" + user.getLogin());
if (user.getLogin().equals(login)) return true;
}
return false;
}
private synchronized boolean checkPassword(User user) throws SQLException {
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM Users");
while (resultSet.next()) {
String login = resultSet.getString(1);
if (user.getLogin().equals(login)) {
return Hashcode.crypt(user, resultSet.getString(3)).equals(resultSet.getString(2));
}
}
return false;
}
public synchronized ArrayList<String> registerUser(User user) throws SQLException {
if (!checkLogin(user)) {
String hashedPassword = Hashcode.crypt(user);
System.out.println("Ник:" + user.getLogin() + " Пароль:" + user.getPassword());
String sql = "INSERT INTO Users (login,password,salt) Values (?, ?, ?)";
PreparedStatement preparedStatement = connection.prepareStatement(sql);
preparedStatement.setString(1, user.getLogin());
preparedStatement.setString(2, hashedPassword);
preparedStatement.setString(3, user.getSalt());
preparedStatement.execute();
return new ArrayList<>(Collections.singleton("Successful registration " + user.getLogin()));
}
return new ArrayList<>(Collections.singleton("Пользователь с данным логином существует."));
}
public synchronized static void executor(String command) {
Statement stmt;
try {
stmt = connection.createStatement();
if (stmt != null) {
stmt.executeUpdate(command);
}
} catch (SQLException ignored) {
}
}
public void createType() {
executor("CREATE TYPE person AS(passportID text,y bigint);");
executor(" CREATE TYPE coordinates AS( x integer,y integer);");
executor("CREATE TYPE type AS ENUM" +
" ('cheap','budgetary','usual','vip');");
}
public void createTable() {
executor("CREATE TABLE Tickets" + "(ID serial primary key,Title text," +
"coordinates text,creationdate timestamp DEFAULT NOW(),price double precision," +
"type text, person text,owner text);");
executor("CREATE TABLE Users" + "(login text," + " password text," + "salt text);");
}
public void createSeq() {
executor(" CREATE SEQUENCE iterator " + "start 1" + " increment 1 " + " NO MAXVALUE " + " CACHE 1;");
}
public static void readData() throws SQLException {
TreeSet<Ticket> set = new TreeSet<>();
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM Tickets");
Ticket newTicket;
while (resultSet.next()) {
long id = resultSet.getInt(1);
String title = resultSet.getString(2);
String coordinates_str = resultSet.getString(3);
String substring = coordinates_str.substring(coordinates_str.indexOf("(") + 1,
coordinates_str.indexOf(","));
String substring1 = coordinates_str.substring(coordinates_str.indexOf(",") + 1,
coordinates_str.indexOf(")"));
Coordinates coordinates = new Coordinates(Double.parseDouble(substring), Float.parseFloat(substring1));
Timestamp timestamp = resultSet.getTimestamp(4);
double price = resultSet.getDouble(5);
String type_str = resultSet.getString(6);
TicketType type = null;
if (type_str != null && !type_str.isEmpty()&&!type_str.equals("null")) type = TicketType.valueOf(type_str.toUpperCase());
String person_str = resultSet.getString(7);
String owner = resultSet.getString(8);
Person person = null;
if (person_str != null && !person_str.isEmpty()) {
substring = person_str.substring(person_str.indexOf("(") + 1,
person_str.indexOf(","));
substring1 = person_str.substring(person_str.indexOf(",") + 1,
person_str.indexOf(")"));
person = new Person(Long.parseLong(substring1), substring);
}
if (person != null && type != null)
newTicket = new Ticket(title, coordinates, price, type, person, timestamp);
else if (person != null) newTicket = new Ticket(title, coordinates, price, person, timestamp);
else newTicket = new Ticket(title, coordinates, price, type, timestamp);
newTicket.setid(id);
newTicket.setOwner(owner);
set.add(newTicket);
}
for (Ticket t: set) {
System.out.println("Кол:"+t);
}
A_command.setSet(set);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
9290cd90423165ef39c6bb658682e92b6e589fcf | 4aec378d7de665b64fbea0d29713147332b499df | /code/netty-lecture/src/main/java/com/malone/netty/App.java | 5ffc5140ddb2bc718c5ff89b4d55bf5f22836541 | [
"MIT"
] | permissive | malone081021/programimg-resource | ec44eb4aeb9e849b496a9ea8d3090b39962ef842 | 09d4a8eb9316b6035764aed51890af15ae472874 | refs/heads/master | 2021-07-08T00:01:29.165766 | 2019-10-23T15:17:22 | 2019-10-23T15:17:22 | 201,421,630 | 0 | 0 | MIT | 2019-10-29T18:11:58 | 2019-08-09T08:05:19 | JavaScript | UTF-8 | Java | false | false | 179 | java | package com.malone.netty;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"malone081021@gmail.com"
] | malone081021@gmail.com |
09ea8166c3a8bc61a751bd016e835efd8a6ffd7a | 0122519ea0806a02b024e552d77ce872c2174713 | /Struts2/src/dao/streetDao.java | 6eab7c348b6cb7ca5d273c55056559117c65167f | [] | no_license | LuoBaiLin/House | 02818c5af5f58bcfcc90cc365ae27a395f43ff8a | dc89b96ac735184a8465abfb23ec4e4f1590d841 | refs/heads/master | 2021-01-12T10:18:22.235564 | 2016-12-23T08:01:33 | 2016-12-23T08:01:33 | 76,414,815 | 0 | 1 | null | null | null | null | GB18030 | Java | false | false | 536 | java | package dao;
import java.util.List;
import entity.street;
public interface streetDao {
/**
* 新增街道
* @param dis
*/
int insert(street dis);
/**
* 根据id查询街道信息
* @param id
* @return
*/
street selectById(Short id);
/**
* 根据id删除街道信息
* @param id
* @return
*/
int deleteById(Short id);
/**
* 修改街道信息
* @return
*/
int update(street id);
/**
* 查询所有的街道信息
* @return
*/
List<street> selectAll();
}
| [
"罗柏林1@LuoBaiLin"
] | 罗柏林1@LuoBaiLin |
9f38f4dbc80e0f21180767a8342b0c3cdb7dac5a | 64bb3b81e831317bcc773f7ec9f91a553aa729d1 | /app/src/main/java/com/example/lbf/imatationofwechat/moments/MomentsPresenter.java | 88519a60fbda816646adf987873c1b07ef73ee12 | [] | no_license | xuhuawei131/ImitationOfWechat | 2ed164e833eed099e22f64f7b3c9300f76915545 | d18d60e5a08f1a1fd37c7b4568fa6bf58fdb80ec | refs/heads/master | 2020-11-24T04:15:08.899643 | 2019-12-18T14:21:55 | 2019-12-18T16:17:20 | 227,958,783 | 0 | 0 | null | 2019-12-14T03:12:36 | 2019-12-14T03:12:36 | null | UTF-8 | Java | false | false | 9,043 | java | package com.example.lbf.imatationofwechat.moments;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.ImageSpan;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Toast;
import com.example.lbf.imatationofwechat.R;
import com.example.lbf.imatationofwechat.adapter.EmojiPagerAdapter;
import com.example.lbf.imatationofwechat.beans.CommentBean;
import com.example.lbf.imatationofwechat.beans.ContactBean;
import com.example.lbf.imatationofwechat.beans.MomentBean;
import com.example.lbf.imatationofwechat.common.CommonAdapter;
import com.example.lbf.imatationofwechat.common.CommonViewHolder;
import com.example.lbf.imatationofwechat.data.source.ChatsRepository;
import com.example.lbf.imatationofwechat.data.source.MomentsLoader;
import com.example.lbf.imatationofwechat.util.CommonUtil;
import com.example.lbf.imatationofwechat.util.DataUtil;
import com.example.lbf.imatationofwechat.views.CommentsTextView;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
/**
* Created by lbf on 2016/7/29.
*/
public class MomentsPresenter implements MomentsContract.Presenter, LoaderManager.LoaderCallbacks<List<MomentBean>> {
private static final int LOAD_MOMENTS = 1;
private Context mContext;
private MomentsContract.View mView;
private ChatsRepository mRepository;
private LoaderManager mLoaderManager;
private int inputMethodHeight;
private int targetContactId;
public MomentsPresenter(Context context, LoaderManager loaderManager, MomentsContract.View view, ChatsRepository repository) {
mContext = context;
mLoaderManager = CommonUtil.checkNotNull(loaderManager);
mView = CommonUtil.checkNotNull(view,"view cannot be null!");
mRepository = CommonUtil.checkNotNull(repository);
mView.setPresenter(this);
SharedPreferences sharedPreferences = mContext.getSharedPreferences(DataUtil.PREF_NAME, Context.MODE_PRIVATE);
inputMethodHeight = sharedPreferences.getInt(DataUtil.PREF_KEY_INPUT_METHOD_HEIGHT, 0);
}
@Override
public void start() {
mView.setPanelHeight(inputMethodHeight);
Bundle bundle = new Bundle();
bundle.putInt("page",0);
mLoaderManager.initLoader(LOAD_MOMENTS,bundle,this);
}
@Override
public void loadData(int page) {
Bundle bundle = new Bundle();
bundle.putInt("page",page);
mLoaderManager.restartLoader(LOAD_MOMENTS,bundle,this);
}
@Override
public void addComment( CommentsTextView view) {
String text = mView.getTextInputViewContent();
if(TextUtils.isEmpty(text)){
Toast.makeText(mContext,"评论内容不能为空!",Toast.LENGTH_SHORT).show();
return;
}
ContactBean contactFrom = mRepository.getContactInfo(0);
ContactBean contactTo = mRepository.getContactInfo(targetContactId);
CommentBean commentBean = new CommentBean(text,contactFrom,contactTo);
view.addComment(commentBean);
mView.clearTextInputViewContent();
mView.hideBottomBar();
mView.hideEmojiPanel();
mView.hideKeyboard();
}
@Override
public void startComment(int targetContactId) {
this.targetContactId = targetContactId;
mView.showBottomBar();
mView.showKeyboard();
}
@Override
public void clickContact(int id) {
CommonUtil.showNoImplementText(mContext);
}
@Override
public void setEmojiPanelData() {
List<RecyclerView> views = new ArrayList<>(5);
for (int i = 0; i < 5; i++) {
RecyclerView gridView = new RecyclerView(mContext);
List<String> expressionList = new ArrayList<>();
for (int j = i * 20; j < (i + 1) * 20; j++) {
expressionList.add("smiley_" + j);
}
expressionList.add("emoji_delete");
gridView.setLayoutManager(new GridLayoutManager(mContext, 7));
gridView.setAdapter(new CommonAdapter<String>(mContext, expressionList, R.layout.chat_aty_emoji_grid_item) {
@Override
protected void convert(CommonViewHolder holder, final String s) {
Field field = null;
try {
field = R.drawable.class.getDeclaredField(s);
final int resourceId = Integer.parseInt(field.get(null).toString());
holder.setImageRes(R.id.iv_expression, resourceId)
.setOnClickLisener(R.id.iv_expression, new View.OnClickListener() {
@Override
public void onClick(View v) {
addEmojiExpression(resourceId,s);
}
});
ViewGroup root = (ViewGroup) holder.get(R.id.fl_chat_root);
ViewGroup.LayoutParams params = root.getLayoutParams();
params.height = inputMethodHeight/3;
root.setLayoutParams(params);
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
});
views.add(gridView);
}
mView.setPanelAdapter(new EmojiPagerAdapter(views));
}
@Override
public void addEmojiExpression(int resourceId, String s) {
if(resourceId == R.drawable.emoji_delete){
if(!mView.isTextInputViewEmpty()){
deleteEmojiExpression();
}
return;
}
BitmapFactory.Options options = new BitmapFactory.Options();
int size = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP,24,mContext.getResources().getDisplayMetrics());
Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), resourceId,options);
bitmap = Bitmap.createScaledBitmap(bitmap,size,size,true);
// 根据Bitmap对象创建ImageSpan对象
ImageSpan imageSpan = new ImageSpan(mContext, bitmap);
// 创建一个SpannableString对象,以便插入用ImageSpan对象封装的图像
SpannableString spannableString = new SpannableString("["+s+"]");
// 用ImageSpan对象替换string
spannableString.setSpan(imageSpan, 0, spannableString.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
mView.appendString(spannableString);
}
@Override
public void deleteEmojiExpression() {
String text = mView.getTextInputViewContent();
int index2 = mView.getTextInputViewIndex();
if(text.isEmpty()||index2 == 0){
return;
}
int index1 = text.substring(0,index2-1).lastIndexOf("[");
if(text.charAt(index2-1)!=']'||index1==-1){
mView.deleteString(index2-1,index2);
}else{
mView.deleteString(index1,index2);
}
}
@Override
public void showOrHideEmojiPanel(boolean showPanel) {
if (showPanel) {
setInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
mView.hideKeyboard();
mView.showEmojiPanel();
} else {
mView.hideEmojiPanelDelayed();
}
}
@Override
public void setInputMode(int mode) {
WindowManager.LayoutParams layoutParams = ((Activity)mContext).getWindow().getAttributes();
if(layoutParams.softInputMode!=mode){
layoutParams.softInputMode = mode;
((Activity)mContext).getWindow().setAttributes(layoutParams);
}
}
@Override
public Loader<List<MomentBean>> onCreateLoader(int id, Bundle args) {
mView.showLoading();
MomentsLoader loader = new MomentsLoader(mContext,mRepository);
int page = args.getInt("page");
loader.setPage(page);
return loader;
}
@Override
public void onLoadFinished(android.support.v4.content.Loader<List<MomentBean>> loader, List<MomentBean> data) {
if(((MomentsLoader) loader).getPage() == 0){
mView.setMomentList(data);
}else{
mView.addMomentList(data);
}
mView.hideLoading();
}
@Override
public void onLoaderReset(android.support.v4.content.Loader<List<MomentBean>> loader) {
}
}
| [
"395953134@qq.com"
] | 395953134@qq.com |
59b42368f2bde7111462038fc4bca674eee94e1c | 1743435345570baf216889340c120e72c554c615 | /Parking/src/parking/NoMoreParkingSpaces.java | 145ea034da6f7f28cb156c6f4416821e9e395bb7 | [] | no_license | yo-yo-g/JAVA | 97064fcd04dd23c2887b7fd402e065110c966ae7 | 8062f00c0cd101cdb901257685e70240691aec56 | refs/heads/master | 2021-09-21T20:53:50.000884 | 2018-08-31T08:41:41 | 2018-08-31T08:41:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 119 | java | package parking;
public class NoMoreParkingSpaces extends Exception{
NoMoreParkingSpaces(String s){
super(s);
}
}
| [
"dilqn.palermo@gmail.com"
] | dilqn.palermo@gmail.com |
2d46eac15eb387c7f678b6038cb6b83c413e4f3c | 23c2ca1e479ad409615b191591cf0bee31848fcf | /Java/14일차/StudentRepo.java | 2d942f0b8c9666d6923da1be75eb1a07f3e5cec6 | [] | no_license | jungeun8/Class | b3d782fc0caef6f5a34546bf421e5035314e1bd6 | f87c219eb6f085e90a0990777d4c3b0d8d4d7dd2 | refs/heads/master | 2023-07-21T12:42:31.424062 | 2021-08-29T08:12:45 | 2021-08-29T08:12:45 | 400,976,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,059 | java | package day5.inner.example;
public class StudentRepo implements Repo{
private Student[] students = new Student[5];
public StudentRepo() {
students[0] = new Student("홍길동", 50, 100, 60);
students[1] = new Student("김유신", 100, 70, 80);
students[2] = new Student("강감찬", 90, 40, 70);
students[3] = new Student("이순신", 80, 90, 90);
students[4] = new Student("류관순", 70, 100, 60);
}
public Stats getStats() {
return new StudentStats();
}
// 인스턴스 내부 클래스
// 학생들의 성적을 기반으로 총합과 평균을 제공하는 Stats인터페이스 구현 클래스
private class StudentStats implements Stats{
@Override
public int total() {
int totalScore = 0;
for(Student stud : students) {
totalScore += stud.getKor();
totalScore += stud.getEng();
totalScore += stud.getMath();
}
return totalScore;
}
@Override
public int average() {
int totalScore = this.total();
int average = totalScore/(3*students.length);
return average;
}
}
}
| [
"3eun7@naver.com"
] | 3eun7@naver.com |
2c31afc678b91a17ead96d04f2f56658ca7a441f | f20c153d6b8c5ce26b24a07dbfd2e560c7ab0ef8 | /src/com/scjp/main/denguemodel/MainDenguePredictorActivity.java | 20347275daf753d133546b46d7654372498d204f | [] | no_license | bilalabdulkany/CrowdSourceThis | 681cca4655410140bffa11b5553e8bdc9f2e6eec | 30cae415ad9fa21a27c1b3fe3688ed9623e540a2 | refs/heads/master | 2021-01-23T16:36:01.004128 | 2016-03-26T17:56:53 | 2016-03-26T17:56:53 | 47,411,617 | 1 | 0 | null | 2016-01-06T18:06:01 | 2015-12-04T15:20:26 | Java | UTF-8 | Java | false | false | 19,014 | java | /*
* Copyright 2010-2012 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.scjp.main.denguemodel;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.scjp.tracker.GPSTracker;
import com.scjp.weka.bean.DengueBean;
import com.scjp.weka.model.ClassifyDengueCases;
import com.scjp.weka.util.NormalizedDengueData;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
public class MainDenguePredictorActivity extends Activity {
private static final String TAG = "CrowdSourceThis";
public static AmazonClientManager clientManager = null;
private android.widget.EditText txtStatus = null;
private static String statusMessage = "Not Set..";
GPSTracker gps = null;
private double latitude = 0f;
private double longitude = 0f;
private double temp = 0f;
private double pressure = 0f;
private double humidity = 0f;
private double windspeed=0f;
private String district = "Null";
private String iconCode = "01d";
private String Maincity="Null";
private int predictedDengueValue=0;
DengueBean bean=null;
com.scjp.tracker.AlertDialogManager alert = new com.scjp.tracker.AlertDialogManager();
ImageView img;
Bitmap bitmap;
// flag for Internet connection status
Boolean isInternetPresent = false;
private com.scjp.tracker.ConnectionDetector cd;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
cd = new com.scjp.tracker.ConnectionDetector(getApplicationContext());
// Check if Internet present
isInternetPresent = cd.isConnectingToInternet();
if (!isInternetPresent) {
// Internet Connection is not present
alert.showAlertDialog(MainDenguePredictorActivity.this, "Internet Connection Error",
"Please connect to working Internet connection", false);
// stop executing code by return
// return;
}
clientManager = new AmazonClientManager(this);
txtStatus = (EditText) findViewById(R.id.txtStatus);
img = (ImageView) findViewById(R.id.img);
final Button btnShowLocation = (Button) findViewById(R.id.btnShowLocation);
// show location button click event
btnShowLocation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// create class object
gps = new GPSTracker(MainDenguePredictorActivity.this);
// check if GPS enabled
if (gps.canGetLocation()) {
latitude = gps.getLatitude();
longitude = gps.getLongitude();
// \n is for new line
Toast.makeText(getApplicationContext(),
"Your Location is - \nLat: " + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show();
} else {
// can't get location
// GPS or Network is not enabled
// Ask user to enable GPS/network in settings
gps.showSettingsAlert();
}
}
});
final Button createTableBttn = (Button) findViewById(R.id.create_table_bttn);
createTableBttn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.i(TAG, "createTableBttn clicked.");
new DynamoDBManagerTask().execute(DynamoDBManagerType.CREATE_TABLE);
}
});
final Button insertUsersBttn = (Button) findViewById(R.id.insert_users_bttn);
insertUsersBttn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.i(TAG, "insertUsersBttn clicked.");
new DynamoDBManagerTask().execute(DynamoDBManagerType.INSERT_USER);
}
});
final Button listUsersBttn = (Button) findViewById(R.id.list_users_bttn);
listUsersBttn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.i(TAG, "listUsersBttn clicked.");
new DynamoDBManagerTask().execute(DynamoDBManagerType.LIST_USERS);
}
});
final Button deleteTableBttn = (Button) findViewById(R.id.delete_table_bttn);
deleteTableBttn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.i(TAG, "deleteTableBttn clicked.");
new DynamoDBManagerTask().execute(DynamoDBManagerType.CLEAN_UP);
}
});
//Predict Dengue Cases
final Button predictButton = (Button) findViewById(R.id.predict_bttn);
predictButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.i(TAG, "PredictBttn clicked.");
ClassifyDengueCases predictCase = new ClassifyDengueCases();
double predictionValue=0;
try{
Context ctx=getApplicationContext();
predictionValue=predictCase.readClassifier(bean, "2010-2012", "Colombo",ctx);
}catch(Exception e){
Log.e("Error", "Error in file"+e);
}
Toast.makeText(getApplicationContext(), "The Model Predicts: "+predictionValue+" Dengue Cases today for city: "+Maincity+" District: "+district, Toast.LENGTH_LONG).show();
}
});
final Button getWeatherData = (Button) findViewById(R.id.GetWeatherData);
getWeatherData.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.i(TAG, "getWeatherData clicked.");
HashMap<String, String> urlMap = new HashMap<String, String>();
String serverURL = "http://api.openweathermap.org/data/2.5/weather?lat=" + latitude + "&lon="
+ longitude + "&appid=f428c77a063e968735f60f9c82878238";
String iconUrl = "http://openweathermap.org/img/w/" + iconCode + ".png";
String type = "weather";
urlMap.put("weather", serverURL);
urlMap.put("weatherType", type);
serverURL = "http://api.geonames.org/findNearbyPostalCodesJSON?lat=" + latitude + "&lng=" + longitude
+ "&username=merdocbilal";
type = "district";
urlMap.put("district", serverURL);
//urlMap.put("districtType", type);
urlMap.put("icon", iconUrl);
new LongOperation().execute(urlMap);
// executing district
}
});
}
/**
*
* @author Bilal
*
*/
private class LongOperation extends AsyncTask<HashMap<String, String>, Void, Bitmap> {
// Required initialization
private final HttpClient Client = new DefaultHttpClient();
private String Content;
private String weatherContent;
private String districtContent;
private String Error = null;
private ProgressDialog Dialog = new ProgressDialog(MainDenguePredictorActivity.this);
String data = "";
String type = "";
String uiUpdate, jsonParsed, serverText;
private String getJSONContents(URL url) {
BufferedReader reader = null;
// Send data
try {
// Defined URL where to send data
// URL url = new URL(urls[0]);
// type = urls[1];
// Send POST data request
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
// Get the server response
reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuilder sb = new StringBuilder();
String line = null;
// Read Server Response
while ((line = reader.readLine()) != null) {
// Append server response in string
sb.append(line + "");
}
// Append Server Response To Content String
Content = sb.toString();
// bitmap = BitmapFactory.decodeStream((InputStream)new
// URL(urls[2]).getContent());
} catch (Exception ex) {
Error = ex.getMessage();
} finally {
try {
reader.close();
}
catch (Exception ex) {
}
return Content;
}
}
// TextView uiUpdate = (TextView) findViewById(R.id.output);
// TextView jsonParsed = (TextView) findViewById(R.id.jsonParsed);
int sizeData = 0;
// EditText serverText = (EditText) findViewById(R.id.serverText);
protected void onPreExecute() {
// NOTE: You can call UI Element here.
// Start Progress Dialog (Message)
Dialog.setMessage("Please wait..");
Dialog.show();
}
// Call after onPreExecute method
protected Bitmap doInBackground(HashMap<String, String>... map) {
/************ Make Post Call To Web Server ***********/
// type = map[0].get("weatherType").toString();// urls[1];
BufferedReader reader = null;
try {
Log.i("WEATHER", map[0].get("weather").toString());
Log.i("DISTRICT", map[0].get("district").toString());
weatherContent = getJSONContents(new URL(map[0].get("weather").toString()));// urls[0]));
//Log.i("WEATHER", map[0].get("weather").toString());
districtContent = getJSONContents(new URL(map[0].get("district").toString()));// urls[0]));
bitmap = BitmapFactory.decodeStream((InputStream) new URL(map[0].get("icon").toString()).getContent());
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}catch(Exception e){
Log.e("Error on map", e.getMessage());
}
// Send data
return bitmap;
/*****************************************************/
}
protected void onPostExecute(Bitmap bitmap) {
// NOTE: You can call UI Element here.
// Close progress dialog
Dialog.dismiss();
if (Error != null) {
Toast.makeText(getApplicationContext(), "output:" + Error, Toast.LENGTH_SHORT);// uiUpdate.setText("Output
// :
// "+Error);
} else {
// Show Response Json On Screen (activity)
Toast.makeText(getApplicationContext(), "output:" + Error, Toast.LENGTH_LONG);
/******************
* Start Parse Response JSON Data
*************/
String OutputData = "";
JSONObject jsonResponse;
try {
/******
* Creates a new JSONObject with name/value mappings from
* the JSON string.
********/
jsonResponse = new JSONObject(weatherContent);
JSONArray jsonMainNode;
JSONObject jsonChildNode;
/*****
* Returns the value mapped by name if it exists and is a
* JSONArray.
***/
/******* Returns null otherwise. *******/
/**
* Getting the json parsed format for Weather
*
* {"coord":{"lon":79.92,"lat":6.9},
* "weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02n"}],
* "base":"stations","main":{"temp":303.15,"pressure":1012,"humidity":70,"temp_min":303.15,"temp_max":303.15},
* "visibility":10000,"wind":{"speed":2.1,"deg":290},
* "clouds":{"all":20},"dt":1459005000,"sys":{"type":1,"id":7864,"message":0.008,"country":"LK","sunrise":1458952870,"sunset":1458996619},
* "id":1250164,"name":"Battaramulla South","cod":200}
*/
{
jsonMainNode = jsonResponse.optJSONArray("weather");
JSONObject jsonMain = jsonResponse.optJSONObject("main");
/*********** Process each JSON Node ************/
// for(int i=0; i < lengthJsonArr; i++)
{
/****** Get Object for each JSON node. ***********/
jsonChildNode = jsonMainNode.getJSONObject(0);
temp = jsonMain.getDouble("temp") - 273.15;
pressure = jsonMain.getDouble("pressure");
pressure=pressure/10;//convert pressure to kPa
humidity = jsonMain.getDouble("humidity");
/*******Get the Wind Speed***********/
jsonMain=jsonResponse.optJSONObject("wind");
windspeed=jsonMain.getDouble("speed");
Log.i("Wind", windspeed+"");
/******* Fetch node values **********/
String main = jsonChildNode.optString("main").toString();
String weatherdata = "T:" + temp + " P:" + pressure + " H:" + humidity+
"W: "+windspeed;
String icon = jsonChildNode.optString("icon").toString();
String iconUrl = "http://openweathermap.org/img/w/" + icon + ".png";
Log.i("Weather: ", weatherdata);
iconCode = icon;
Toast.makeText(getApplicationContext(), "Main:" + main, Toast.LENGTH_LONG).show();
}
}
/*
* Getting the json parsed format for District
*/
{
jsonResponse = new JSONObject(districtContent);
jsonMainNode = jsonResponse.optJSONArray("postalCodes");
/*********** Process each JSON Node ************/
int lengthJsonArr = jsonMainNode.length();
// for(int i=0; i < lengthJsonArr; i++)
{
/****** Get Object for each JSON node. ***********/
jsonChildNode = jsonMainNode.getJSONObject(0);
/******* Fetch node values **********/
String name = jsonChildNode.optString("adminName2").toString();
String city = jsonChildNode.optString("placeName").toString();
String longit = jsonChildNode.optString("lng").toString();
String latid = jsonChildNode.optString("lat").toString();
OutputData += " Name : " + name + " " + "longitude : " + longit + " "
+ "Time : " + latid + " "
+ "-------------------------------------------------"+" City: "+city;
Log.i("District", name);
district = name;
Maincity=city;
//Convert to normalized data
int _temp=NormalizedDengueData.getNormalizedTemp(temp);
int _humidity=NormalizedDengueData.getNormalizedHumidity(humidity);
int _windspeed=NormalizedDengueData.getNormalizedWindSpeed(windspeed);
int _pressure=NormalizedDengueData.getNormalizedPressure(pressure);
//Add the weather data info to the DengueBean
bean = new DengueBean(_temp+"", _humidity+"", _windspeed+"", "?", _pressure+"");
Toast.makeText(getApplicationContext(), "District:" + name+"\n"+"city: "+city, Toast.LENGTH_LONG).show();
}
}
if (bitmap != null) {
img.setImageBitmap(bitmap);
// Dialog.dismiss();
} else {
Dialog.dismiss();
Toast.makeText(MainDenguePredictorActivity.this, "Image Does Not exist or Network Error",
Toast.LENGTH_SHORT).show();
}
Toast.makeText(getApplicationContext(),
"District:" + district + "\n " + "Weather: T:" + temp + " P:" + pressure + " H:" + humidity+"\n"+" W:"+windspeed,
Toast.LENGTH_LONG).show();
/******************
* End Parse Response JSON Data
*************/
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
private class DynamoDBManagerTask extends AsyncTask<DynamoDBManagerType, Void, DynamoDBManagerTaskResult> {
protected DynamoDBManagerTaskResult doInBackground(DynamoDBManagerType... types) {
String tableStatus = DynamoDBManager.getTestTableStatus();
statusMessage = txtStatus.getText().toString();
Log.e("Status", statusMessage + "");
DynamoDBManagerTaskResult result = new DynamoDBManagerTaskResult();
result.setTableStatus(tableStatus);
result.setTaskType(types[0]);
if (types[0] == DynamoDBManagerType.CREATE_TABLE) {
if (tableStatus.length() == 0) {
DynamoDBManager.createTable();
}
} else if (types[0] == DynamoDBManagerType.INSERT_USER) {
// Double.toString(gps.getLatitude());
// Double.toString(gps.getLongitude());
Log.e("Latitude", latitude + "");
Log.e("Longitude", longitude + "");
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
String updateStaticDate = dateFormatter.format(new Date());
// txtStatus.setText((txtStatus.getText().equals(""))?"Null":txtStatus.getText().toString());
if (tableStatus.equalsIgnoreCase("ACTIVE")) {
Log.e("Inserting", "Inserting users...");
Log.e("Inserting", "Status message..." + statusMessage);
DynamoDBManager.insertUsers(statusMessage, latitude, longitude,updateStaticDate);
DynamoDBManager.insertCurrentWeather(district, temp + "", humidity + "",windspeed+"", pressure + "", predictedDengueValue,
latitude + "", longitude + "","Bilal",updateStaticDate,Maincity);
}
} else if (types[0] == DynamoDBManagerType.LIST_USERS) {
if (tableStatus.equalsIgnoreCase("ACTIVE")) {
DynamoDBManager.getUserList();
}
} else if (types[0] == DynamoDBManagerType.CLEAN_UP) {
if (tableStatus.equalsIgnoreCase("ACTIVE")) {
DynamoDBManager.cleanUp();
}
}
return result;
}
protected void onPostExecute(DynamoDBManagerTaskResult result) {
if (result.getTaskType() == DynamoDBManagerType.CREATE_TABLE) {
if (result.getTableStatus().length() != 0) {
Toast.makeText(MainDenguePredictorActivity.this,
"The test table already exists.\nTable Status: " + result.getTableStatus(),
Toast.LENGTH_LONG).show();
}
} else if (result.getTaskType() == DynamoDBManagerType.LIST_USERS
&& result.getTableStatus().equalsIgnoreCase("ACTIVE")) {
startActivity(new Intent(MainDenguePredictorActivity.this, UserListActivity.class));
} else if (!result.getTableStatus().equalsIgnoreCase("ACTIVE")) {
Toast.makeText(MainDenguePredictorActivity.this,
"The test table is not ready yet.\nTable Status: " + result.getTableStatus(), Toast.LENGTH_LONG)
.show();
} else if (result.getTableStatus().equalsIgnoreCase("ACTIVE")
&& result.getTaskType() == DynamoDBManagerType.INSERT_USER) {
Toast.makeText(MainDenguePredictorActivity.this, "Users inserted successfully!", Toast.LENGTH_SHORT)
.show();
}
}
}
private enum DynamoDBManagerType {
GET_TABLE_STATUS, CREATE_TABLE, INSERT_USER, LIST_USERS, CLEAN_UP
}
private class DynamoDBManagerTaskResult {
private DynamoDBManagerType taskType;
private String tableStatus;
public DynamoDBManagerType getTaskType() {
return taskType;
}
public void setTaskType(DynamoDBManagerType taskType) {
this.taskType = taskType;
}
public String getTableStatus() {
return tableStatus;
}
public void setTableStatus(String tableStatus) {
this.tableStatus = tableStatus;
}
}
}
| [
"merdocbilal.89@gmail.com"
] | merdocbilal.89@gmail.com |
3500494c6c7075a1f76b126c98fc2947dd4e442c | e349965c5085b7ec6576c696efe977f40775a07b | /src/Uoc_chung_lon_nhat.java | f9169b0d64fb149568945fad4a9e5232e83cc767 | [] | no_license | dungchv13/day_2_loop_module2 | 816c0c83effd83625e05eb49500771d6c8ea73fc | 696f0cb3dca6d001628d0fbe98afd3aeabe1b60b | refs/heads/master | 2022-12-27T08:05:26.853952 | 2020-10-05T14:41:01 | 2020-10-05T14:41:01 | 301,439,893 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | import java.util.Scanner;
public class Uoc_chung_lon_nhat {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("nhap so nguyen a:");
int a = scanner.nextInt();
System.out.println("nhap so nguyen b:");
int b = scanner.nextInt();;
a = Math.abs(a);
b = Math.abs(b);
if(a == 0 || b == 0){
System.out.println("No greatest common factor");
}else{
while(a != b){
if(a > b){
a = a - b;
}else{
b = b - a;
}
}
System.out.println("uoc chung lon nhat cua a va b la: "+a);
}
}
}
| [
"Dungutc13@gmail.com"
] | Dungutc13@gmail.com |
0a58b459ec3ae6cb6d7bd9f36720c87e3cb37b34 | 97905a68f074065af8f8b986e27cec3176f8defa | /DaRIS/src/daris/client/ui/object/action/DObjectCreateActionGUI.java | f9e7125f93f4354686ac84c75b37413713230eb4 | [] | no_license | Mygi/MBI-Method-Builder | 4eb7d6404a08f4057a4b9d3682210184dac802de | 506aab79539e1601e04d48720067d9dff31a0bdf | refs/heads/master | 2020-06-03T06:38:15.582049 | 2012-01-27T05:28:26 | 2012-01-27T05:28:26 | 3,261,478 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,225 | java | package daris.client.ui.object.action;
import java.util.List;
import arc.gui.ValidatedInterfaceComponent;
import arc.gui.form.FormEditMode;
import arc.gui.gwt.message.StatusArea;
import arc.gui.gwt.widget.panel.SimplePanel;
import arc.gui.object.action.precondition.ActionPrecondition;
import arc.gui.object.action.precondition.ActionPreconditionInterface;
import arc.mf.client.util.ActionListener;
import arc.mf.client.util.AsynchronousAction;
import arc.mf.client.util.IsNotValid;
import arc.mf.client.util.StateChangeListener;
import arc.mf.client.util.Validity;
import arc.mf.object.ObjectMessageResponse;
import com.google.gwt.user.client.ui.Widget;
import daris.client.model.Model;
import daris.client.model.object.DObject;
import daris.client.model.object.DObjectRef;
import daris.client.ui.object.DObjectDetails;
public class DObjectCreateActionGUI extends ValidatedInterfaceComponent implements AsynchronousAction {
private DObjectRef _po;
private DObject _o;
private SimplePanel _gui;
private boolean _checkedPreconditions;
public DObjectCreateActionGUI(DObjectRef po, DObject o, List<ActionPrecondition> preconditions) {
_po = po;
_o = o;
_gui = new SimplePanel();
_gui.fitToParent();
StatusArea sa = new StatusArea();
_gui.setContent(sa);
_checkedPreconditions = false;
ActionPreconditionInterface pci = new ActionPreconditionInterface(sa, preconditions);
pci.addChangeListener(new StateChangeListener() {
@Override
public void notifyOfChangeInState() {
_checkedPreconditions = true;
DObjectDetails details = DObjectDetails.detailsFor(_po, _o, FormEditMode.CREATE);
DObjectCreateActionGUI.this.addMustBeValid(details);
_gui.setContent(details.gui());
}
});
pci.execute();
}
@Override
public Validity valid() {
if (_checkedPreconditions) {
return super.valid();
} else {
return IsNotValid.INSTANCE;
}
}
@Override
public Widget gui() {
return _gui;
}
@Override
public void execute(final ActionListener l) {
_o.create(_po, new ObjectMessageResponse<DObjectRef>() {
@Override
public void responded(DObjectRef r) {
l.executed(r != null);
if (r != null) {
Model.objectCreated(r);
}
}
});
}
}
| [
"andrew.glenn@orco.com.au"
] | andrew.glenn@orco.com.au |
e52b11c90f77a1aaed0b36099f26f1b6fccbeae8 | 0e9a34b0afe176a888171c138505d4b723674a51 | /E1/src/geometries/Triangle.java | a1ca6c749e678284f9d777bbef3fcaa1f72ff14b | [] | no_license | yoelbassin/PSWE | bcc2ca82b3363389c2ba9c3ae63d0409d4d4206b | 1216f45e97c5e911e8f578ff3d9e06d1c4e00015 | refs/heads/master | 2023-03-08T14:53:04.399214 | 2021-02-25T14:42:33 | 2021-02-25T14:42:33 | 224,479,041 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,335 | java | package geometries;
import primitives.*;
/**
* @author bassi class triangle represents a triangle via 3 points on the same
* plane
*/
public class Triangle extends Polygon {
// ***************** Constructor ********************** //
/**
* constructs a triangle from three points
*
* @param p1, first point
* @param p2, second point
* @param p3, third point
*/
public Triangle(Point3D p1, Point3D p2, Point3D p3) {
super(p1, p2, p3);
}
/**
* constructs a triangle from three points and a color
*
* @param emission the color of the triangle
* @param p1, first point
* @param p2, second point
* @param p3, third point
*/
public Triangle(Color emission, Point3D p1, Point3D p2, Point3D p3) {
super(emission, p1, p2, p3);
}
/**
* constructs a triangle from three points and a color
*
* @param emission the color of the triangle
* @param material the material of the triangle
* @param p1, first point
* @param p2, second point
* @param p3, third point
*/
public Triangle(Color emission, Material material, Point3D p1, Point3D p2, Point3D p3) {
super(emission, material, p1, p2, p3);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
07858780f3a3e2cca22c78dd2b110d81eb172ec8 | 0a2e00f7fe982d8a2f291ff01a582f43abc45b4d | /flow-tests/test-root-context/src/test/java/com/vaadin/flow/ClientResourceIT.java | a0230ff322e801d4e339fcf7ae5ab7515dbb952e | [
"Apache-2.0"
] | permissive | manolo/flow | 94173e03aa836577b675319c9ebfc14c5e59c162 | 123bb931f304d02a177f0f7549448191a814da28 | refs/heads/master | 2023-02-06T13:11:05.070053 | 2022-05-10T04:45:50 | 2022-05-10T04:45:50 | 131,289,664 | 0 | 0 | Apache-2.0 | 2023-08-02T07:14:42 | 2018-04-27T11:48:31 | Java | UTF-8 | Java | false | false | 2,334 | java | /*
* Copyright 2000-2022 Vaadin 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.vaadin.flow;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import org.junit.Assert;
import org.junit.Test;
import com.vaadin.flow.testutil.ChromeBrowserTest;
public class ClientResourceIT extends ChromeBrowserTest {
@Test
public void clientResourcesAreNotExposed() throws IOException {
assertResourceIsUnavailable("frontend/Flow.js");
assertResourceIsUnavailable("frontend/Flow.js.map");
assertResourceIsUnavailable("frontend/VaadinDevmodeGizmo.js.map");
assertResourceIsUnavailable("frontend/VaadinDevmodeGizmo.d.ts");
assertResourceIsUnavailable("frontend/FlowBootstrap.d.ts");
assertResourceIsUnavailable("frontend/index.js");
assertResourceIsUnavailable("frontend/Flow.d.ts");
assertResourceIsUnavailable("frontend/index.js.map");
assertResourceIsUnavailable("frontend/index.d.ts");
assertResourceIsUnavailable("frontend/FlowClient.d.ts");
assertResourceIsUnavailable("frontend/VaadinDevmodeGizmo.js");
assertResourceIsUnavailable("frontend/copy-to-clipboard.js");
assertResourceIsUnavailable("frontend/FlowClient.js");
}
private void assertResourceIsUnavailable(String path) throws IOException {
URL url = getResourceURL(path);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
int responseCode = connection.getResponseCode();
Assert.assertEquals(HttpURLConnection.HTTP_NOT_FOUND, responseCode);
}
private URL getResourceURL(String path) throws MalformedURLException {
String url = getRootURL() + "/" + path;
return new URL(url);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
cd607346041881032aea2001dbb58e8b99b778fd | 45dc6c503db457c4f606cb01b215df1b1e727e4e | /Monopoly/Monopoly/src/edu/towson/cis/cosc603/project2/monopoly/GoToJailCell.java | 0b1425d4e77414b66612cb01d41d25e2e13908d5 | [
"Apache-2.0"
] | permissive | mtendu/cosc603-tendulkar-project2 | 87af1186da385e2d0f469526183ff08fead5b5fc | 189c00a4af64c70f1a8fde0eff81b4e0e7896261 | refs/heads/master | 2021-01-10T06:49:37.349853 | 2016-03-03T21:38:05 | 2016-03-03T21:38:05 | 52,687,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,108 | java | package edu.towson.cis.cosc603.project2.monopoly;
// TODO: Auto-generated Javadoc
/**
* The Class GoToJailCell.
*/
public class GoToJailCell extends Cell {
/**
* Instantiates a new go to jail cell.
*/
public GoToJailCell() {
setName("Go to Jail");
}
/* (non-Javadoc)
* @see edu.towson.cis.cosc442.project1.monopoly.Cell#playAction()
*/
public boolean playAction(String msg) {
Player currentPlayer = GameMaster.instance().getCurrentPlayer();
GameMaster.instance().getGameBoard().queryCell("Jail");
GameMaster.instance().sendToJail(currentPlayer);
return false;
}
/* (non-Javadoc)
* @see edu.towson.cis.cosc603.project2.monopoly.Cell#playerMoved(edu.towson.cis.cosc603.project2.monopoly.Player, int, edu.towson.cis.cosc603.project2.monopoly.GameMaster)
*/
public void playerMoved(Player player, int playerIndex,
GameMaster gameMaster) {
if (this.isAvailable()) {
int price = this.getPrice();
if (price <= player.getMoney() && price > 0) {
gameMaster.getGUI().enablePurchaseBtn(playerIndex);
}
}
gameMaster.getGUI().enableEndTurnBtn(playerIndex);
}
}
| [
"madhuratendulkar09@gmail.com"
] | madhuratendulkar09@gmail.com |
aae18d9b61173d83261944808f92d93f2d5adc89 | 664c4f5ed2a17a0e825b93060556ef6b57959685 | /src/backend/src/main/java/ru/duckest/service/implementation/UserServiceImpl.java | a48259a107b6458390b914b5e9f10d58d4ef13ac | [
"MIT"
] | permissive | Duckest/Duckest | 7a4d00420446b073c5de6c6d9428c23d9df652e2 | b84b61e5a76387c5bc690b0490a4d8dcbc9dce21 | refs/heads/dev | 2023-05-31T16:05:00.958937 | 2021-06-10T14:57:58 | 2021-06-10T14:57:58 | 340,424,151 | 0 | 1 | MIT | 2021-06-20T12:15:49 | 2021-02-19T16:18:43 | Java | UTF-8 | Java | false | false | 1,590 | java | package ru.duckest.service.implementation;
import lombok.RequiredArgsConstructor;
import org.apache.commons.validator.routines.EmailValidator;
import org.springframework.stereotype.Service;
import ru.duckest.converter.UserConverter;
import ru.duckest.dto.UserDto;
import ru.duckest.service.UserService;
import ru.duckest.utils.user.UserSaver;
import ru.duckest.utils.user.UserSelector;
import ru.duckest.utils.user.UserUpdater;
@Service
@RequiredArgsConstructor
public class UserServiceImpl implements UserService {
private final UserSaver userSaver;
private final UserSelector userSelector;
private final UserUpdater userUpdater;
private final UserConverter converter;
private final EmailValidator emailValidator = EmailValidator.getInstance();
@Override
public void save(UserDto user) {
var convertedUser = converter.convert(user);
userSaver.save(convertedUser);
}
@Override
public UserDto getUserBy(String email) {
if (!emailValidator.isValid(email)) {
throw new IllegalArgumentException("Invalid email when getting user");
}
var user = userSelector.getUserBy(email);
return converter.convert(user);
}
@Override
public void update(UserDto user) {
var userEntity = userSelector.getUserBy(user.getEmail());
userEntity.setEmail(user.getEmail());
userEntity.setFirstName(user.getFirstName());
userEntity.setLastName(user.getLastName());
userEntity.setMiddleName(user.getMiddleName());
userUpdater.update(userEntity);
}
}
| [
"dgeehi@gmail.com"
] | dgeehi@gmail.com |
1df6b9d3670c86826f4d31b333e16aec957a8a00 | 84db1cda98a6f6a36990e8364b3c6c2516e3a8c0 | /ch13-ajax/ch13-gwt-StockWatcher/src/main/java/com/google/gwt/sample/stockwatcher/client/StockWatcher.java | e0838e10c822d459508c70f4b73e1fda09d1ed2e | [
"Apache-2.0"
] | permissive | aronerry/Book_JUnitInAction2 | 0c84d4bd0d60a9a5ff03c2e00d6023cbc9b71cc5 | b7b4b3d72ad29bc57d0278fd1e3c90266ac3041c | refs/heads/master | 2020-05-29T17:59:29.182521 | 2015-03-31T05:26:24 | 2015-03-31T05:26:24 | 32,120,630 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 9,451 | java | package com.google.gwt.sample.stockwatcher.client;
import java.util.ArrayList;
import java.util.Date;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
public class StockWatcher implements EntryPoint {
private static final int REFRESH_INTERVAL = 5000; // ms
private VerticalPanel mainPanel = new VerticalPanel();
private FlexTable stocksFlexTable;
private HorizontalPanel addPanel = new HorizontalPanel();
private TextBox newSymbolTextBox = new TextBox();
private Button addStockButton = new Button("Add");
private Label lastUpdatedLabel = new Label();
private ArrayList<String> stocks = new ArrayList<String>();
private StockPriceServiceAsync stockPriceSvc = GWT.create(StockPriceService.class);
private Throwable lastRefreshThrowable;
/**
* Add stock to FlexTable. Executed when the user clicks the addStockButton
* or presses enter in the newSymbolTextBox.
*/
void addStock() {
final String symbol = this.newSymbolTextBox.getText().toUpperCase().trim();
this.newSymbolTextBox.setFocus(true);
// Stock code must be between 1 and 10 chars that are numbers, letters,
// or dots.
if (!symbol.matches("^[0-9a-zA-Z\\.]{1,10}$")) {
Window.alert("'" + symbol + "' is not a valid symbol.");
this.newSymbolTextBox.selectAll();
return;
}
this.newSymbolTextBox.setText("");
// Don't add the stock if it's already in the table.
if (this.getStocks().contains(symbol)) {
return;
}
// Add the stock to the table.
int row = this.getStocksFlexTable().getRowCount();
this.getStocks().add(symbol);
this.getStocksFlexTable().setText(row, 0, symbol);
this.getStocksFlexTable().setWidget(row, 2, new Label());
this.getStocksFlexTable().getCellFormatter().addStyleName(row, 1, "watchListNumericColumn");
this.getStocksFlexTable().getCellFormatter().addStyleName(row, 2, "watchListNumericColumn");
this.getStocksFlexTable().getCellFormatter().addStyleName(row, 3, "watchListRemoveColumn");
// Add a button to remove this stock from the table.
Button removeStockButton = new Button("x");
removeStockButton.addStyleDependentName("remove");
removeStockButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
int removedIndex = StockWatcher.this.getStocks().indexOf(symbol);
StockWatcher.this.getStocks().remove(removedIndex);
StockWatcher.this.getStocksFlexTable().removeRow(removedIndex + 1);
}
});
this.getStocksFlexTable().setWidget(row, 3, removeStockButton);
// Get the stock price.
this.refreshWatchList();
}
public Throwable getLastRefreshThrowable() {
return this.lastRefreshThrowable;
}
ArrayList<String> getStocks() {
return this.stocks;
}
FlexTable getStocksFlexTable() {
if (this.stocksFlexTable == null) {
this.stocksFlexTable = new FlexTable();
this.stocksFlexTable.setText(0, 0, "Symbol");
this.stocksFlexTable.setText(0, 1, "Price");
this.stocksFlexTable.setText(0, 2, "Change");
this.stocksFlexTable.setText(0, 3, "Remove");
// Add styles to elements in the stock list table.
this.stocksFlexTable.setCellPadding(6);
this.stocksFlexTable.getRowFormatter().addStyleName(0, "watchListHeader");
this.stocksFlexTable.addStyleName("watchList");
this.stocksFlexTable.getCellFormatter().addStyleName(0, 1, "watchListNumericColumn");
this.stocksFlexTable.getCellFormatter().addStyleName(0, 2, "watchListNumericColumn");
this.stocksFlexTable.getCellFormatter().addStyleName(0, 3, "watchListRemoveColumn");
}
return this.stocksFlexTable;
}
/**
* Entry point method.
*/
public void onModuleLoad() {
// Assemble Add Stock panel.
this.addPanel.add(this.newSymbolTextBox);
this.addPanel.add(this.addStockButton);
this.addPanel.addStyleName("addPanel");
// Assemble Main panel.
this.mainPanel.add(this.getStocksFlexTable());
this.mainPanel.add(this.addPanel);
this.mainPanel.add(this.lastUpdatedLabel);
// Associate the Main panel with the HTML host page.
RootPanel.get("stockList").add(this.mainPanel);
// Move cursor focus to the input box.
this.newSymbolTextBox.setFocus(true);
// Setup timer to refresh list automatically.
Timer refreshTimer = new Timer() {
@Override
public void run() {
StockWatcher.this.refreshWatchList();
}
};
refreshTimer.scheduleRepeating(REFRESH_INTERVAL);
// Listen for mouse events on the Add button.
this.addStockButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
StockWatcher.this.addStock();
}
});
// Listen for keyboard events in the input box.
this.newSymbolTextBox.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
if (event.getCharCode() == KeyCodes.KEY_ENTER) {
StockWatcher.this.addStock();
}
}
});
}
void refreshWatchList() {
// Initialize the service proxy.
if (this.stockPriceSvc == null) {
this.stockPriceSvc = GWT.create(StockPriceService.class);
}
// Set up the callback object.
AsyncCallback<StockPrice[]> callback = new AsyncCallback<StockPrice[]>() {
public void onFailure(Throwable caught) {
StockWatcher.this.setLastRefreshThrowable(caught);
}
public void onSuccess(StockPrice[] result) {
StockWatcher.this.updateTable(result);
}
};
// Make the call to the stock price service.
this.stockPriceSvc.getPrices(this.getStocks().toArray(new String[0]), callback);
}
void setLastRefreshThrowable(Throwable lastRefreshThrowable) {
this.lastRefreshThrowable = lastRefreshThrowable;
}
void setStocks(ArrayList<String> stocks) {
this.stocks = stocks;
}
void setStocksFlexTable(FlexTable stocksFlexTable) {
this.stocksFlexTable = stocksFlexTable;
}
/**
* Update a single row in the stock table.
*
* @param price
* Stock data for a single row.
*/
private void updateTable(StockPrice price) {
// Make sure the stock is still in the stock table.
if (!this.getStocks().contains(price.getSymbol())) {
return;
}
int row = this.getStocks().indexOf(price.getSymbol()) + 1;
// Format the data in the Price and Change fields.
String priceText = NumberFormat.getFormat("#,##0.00").format(price.getPrice());
NumberFormat changeFormat = NumberFormat.getFormat("+#,##0.00;-#,##0.00");
String changeText = changeFormat.format(price.getChange());
String changePercentText = changeFormat.format(price.getChangePercent());
// Populate the Price and Change fields with new data.
this.getStocksFlexTable().setText(row, 1, priceText);
this.getStocksFlexTable().setWidget(row, 2, new Label());
Label changeWidget = (Label) this.getStocksFlexTable().getWidget(row, 2);
changeWidget.setText(changeText + " (" + changePercentText + "%)");
// Change the color of text in the Change field based on its value.
String changeStyleName = "noChange";
if (price.getChangePercent() < -0.1f) {
changeStyleName = "negativeChange";
} else if (price.getChangePercent() > 0.1f) {
changeStyleName = "positiveChange";
}
changeWidget.setStyleName(changeStyleName);
}
/**
* Update the Price and Change fields all the rows in the stock table.
*
* @param prices
* Stock data for all rows.
*/
void updateTable(StockPrice[] prices) {
for (StockPrice price : prices) {
this.updateTable(price);
}
// Display timestamp showing last refresh.
this.lastUpdatedLabel.setText("Last update : " + DateTimeFormat.getMediumDateTimeFormat().format(new Date()));
}
}
| [
"aron.seven@qq.com"
] | aron.seven@qq.com |
0867326fe10c4634118ba98778271ce112f10145 | d06ed479c8d24cf2eab53df763db4d778e0f49e7 | /src/main/java/ex26/App.java | cc4badb167c5e641e1915b7978ef185dca78701e | [] | no_license | Zenmunist22/Chang-cop3330-assignment2 | 38665652d83e3f699b8246b239caf5e42296bf9c | 4391111bf99ca782d63d27f91a0b9b459c96fb2b | refs/heads/master | 2023-05-28T12:09:39.089330 | 2021-06-14T03:45:30 | 2021-06-14T03:45:30 | 376,678,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 834 | java | package ex26;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Arrays;
import java.util.Scanner;
/*
* UCF COP3330 Summer 2021 Assignment 2 Solution
* Copyright 2021 Tommy Chang
*/
public class App {
public static void main(String[] args){
double b, apr, monthlyPayment;
Scanner sc = new Scanner(System.in);
System.out.print("What is your balance? ");
b = sc.nextDouble();
System.out.print("What is the APR on the card (as a percent)? " );
apr = sc.nextDouble();
System.out.print("What is the monthly payment you can make? " );
monthlyPayment = sc.nextDouble();
System.out.printf("It will take you %.0f months to pay off this card.",PaymentCalculator.calculateMonthsUntilPaidOff(b, apr, monthlyPayment));
}
}
| [
"tommychang@knights.ucf.edu"
] | tommychang@knights.ucf.edu |
313963c38351dc8b9d56e2334fdc1068af791984 | 7a8b6aa72c2a6a0476847b59ea42d70f917c5136 | /src/test/java/com/vtiger/testscripts/ClrearTripFutureDate.java | 229e3e4438e1b71621fd753d42fe82ce37c2ae0b | [] | no_license | supriyamallikarjun/SDET-Supriya | 35162052d9a450f9027fec3e8d003504eb71a986 | 1de06023a41498a32fbfc89ca4c7eb72422c8775 | refs/heads/master | 2023-04-04T07:44:10.738646 | 2021-04-16T06:11:41 | 2021-04-16T06:11:41 | 357,160,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,453 | java | package com.vtiger.testscripts;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.testng.annotations.Test;
public class ClrearTripFutureDate {
static {
System.setProperty("webdriver.chrome.driver", "./driver/chromedriver.exe");
}
@Test
public void selectExpectedDate() {
ChromeOptions option = new ChromeOptions();
option.addArguments("--disable-notifications");
WebDriver driver=new ChromeDriver(option);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://www.cleartrip.com/");
driver.findElement(By.xpath("//input[@id='FromTag']")).sendKeys("BAN");
driver.findElement(By.xpath("//a[contains(text(),'BLR')]")).click();
driver.findElement(By.xpath("//input[@id='ToTag']")).sendKeys("PNQ");
driver.findElement(By.xpath("//a[contains(text(),'PNQ')]")).click();
driver.findElement(By.xpath("//input[@id='DepartDate']")).click();
int i=0;
while(i<11) {
try {
driver.findElement(By.xpath("(//tbody/tr[2]/td[@data-month='8'])[1]/a")).click();
break;
}
catch (Exception e) {
driver.findElement(By.xpath("//a[@title='Next' and @class='nextMonth ']")).click();
i++;
}
}
System.out.println(i);
driver.close();
}
}
| [
"91854@LAPTOP-1RDVGC8P"
] | 91854@LAPTOP-1RDVGC8P |
dedbe21de795740665e9e7e8d12e485d48fff8d6 | 8b929caf6fb870bb482bf9caf02ad5c2b61ea8d6 | /client/src/main/java/client/grafic/locals/English.java | ec4021f05e11e6fdfb53ace0f4bc4b3519f6c094 | [] | no_license | tchn11/lab8 | 250f333b3d8b06931ebd9acbdf3331bbb1644773 | d0567d60535f00deb9aca0073b6653a0db3b9749 | refs/heads/master | 2023-05-09T23:36:47.296638 | 2021-05-31T20:32:14 | 2021-05-31T20:32:14 | 372,145,924 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,768 | java | package client.grafic.locals;
public class English extends Local{
{
LOGIN = "Login";
PASSWORD = "Password";
BUTTON = "Login";
ARE_REGISTERED = "Are you already registered?";
LOGIN_ERROR = "Login error";
CONNECTION_ERROR = "Connection error";
SUCCESSFUL_LOGIN = "Loginned";
VISUALIZATION = "Visualize data";
COMMAND_MODE = "Commands";
TABLE_MODE = "Table";
RETURN = "Return";
SEND = "Send";
ENTER_COMMANDS = "Enter here:";
ENTER_NAME = "Name:";
ENTER_X = "X:";
ENTER_Y = "Y:";
ENTER_STUDENTS_COUNT = "Students count:";
ENTER_EXPELLED_STUDENTS = "Expelled students count:";
ENTER_AVEREGE_MARK = "Average mark:";
ENTER_ADMIN_NAME = "Admin name:";
ENTER_ADMIN_BIRHDAY = "Admin birthday in format:";
ENTER_ADMIN_WEIGTHT = "Admin weight:";
ENTER_PASSPORT_ID = "Admin passport ID:";
SEND_BUTTON = "Send";
TIME_DATE_FORMAT = "dd-MM-uuuu HH:mm";
ENTER_SEMESTER = "Semester from variants:";
MAP_LEGEND = "Map legend: ";
COORDINATES_COLUMN = "Coordinates";
NAME_COLUMN = "Name";
ADD_DATE_COLUMN = "Add date";
COUNT_COLUMN = "Students count";
EXPELLED_COLUMN = "Expelled students count";
AVEREGE_COLUMN = "Average mark";
SEMESTER_COLUMN = "Semester";
ADMIN_NAME_COLUMN = "Admin name";
ADMIN_BIRTHDAY_COLUMN = "Admin birthday";
ADMIN_WEIGHT_COLUMN = "Admin weight";
ADMIN_PASSPORT_COLUMN = "Admin passport";
OWNER_COLUMN = "Owner";
ADD_BUTTON = "Add";
REMOVE_BUTTON = "Remove";
FILTER_BUTTON = "Filter";
}
}
| [
"akonany11@gmail.com"
] | akonany11@gmail.com |
939b7d7c97ec40284d68361abdacec8f2f158116 | 235de083e39d63059b12984da28e5f4d9cee13bb | /src/easy/RemovePalindromicSubsequences.java | 2c7595fc53961d8fb224b3c77d10373571f1c0b4 | [
"MIT"
] | permissive | ehabarman/Leetcode | 25a2665463184cdd6d2abb13b97504e61e9c9b8c | d006692ec7c43f2672890c3df8a9bfd6844a5c0d | refs/heads/master | 2021-08-11T03:27:01.309034 | 2020-10-02T12:24:06 | 2020-10-02T12:24:06 | 225,615,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | package easy;
public class RemovePalindromicSubsequences {
public int removePalindromeSub(String s) {
if(s.isEmpty()) return 0;
if(isPalindrome(s)) return 1;
return 2;
}
public boolean isPalindrome(String s) {
int start = 0;
int end = s.length()-1;
while (end > start)
if(s.charAt(start++) != s.charAt(end--)) return false;
return true;
}
}
| [
"ehabarman@gmail.com"
] | ehabarman@gmail.com |
a78ae8c813a49a10a3543664088c7f4cd40d9f4c | fdce74e3dcde9f1e6d85c755e3a46d8b6717d3a2 | /p6/src/main/java/es/ucm/fdi/model/NewVehicle.java | 3b51d17706574aedded4f99283016e9e5849c1dc | [] | no_license | alberto-maurel/Practica-TP-6 | 0708e6b2b8e4dcd77ea266bb22bf2716ad0a79e9 | 67de9dfb83ed2ff0269fca2f32f8ba60f7755052 | refs/heads/master | 2020-03-16T00:44:09.202684 | 2018-05-20T08:55:04 | 2018-05-20T08:55:04 | 132,424,167 | 0 | 0 | null | 2018-05-19T11:26:30 | 2018-05-07T07:35:21 | Java | UTF-8 | Java | false | false | 2,819 | java | package es.ucm.fdi.model;
import java.util.ArrayList;
import java.util.Map;
import es.ucm.fdi.ini.IniSection;
public class NewVehicle extends Event {
protected int max_speed;
protected ArrayList<String> itinerario; //Guardamos los cruces en forma de ID
public NewVehicle(int time, String id, int max_speed, ArrayList<String> itinerario) {
super(time, id);
this.max_speed = max_speed;
this.itinerario = itinerario;
}
public static class Builder implements EventBuilder {
public Event parse(IniSection sec) throws SimulationException {
if (!sec.getTag().equals("new_vehicle")) {
return null;
}
if(sec.getValue("type") == null) {
if(parseInt(sec, "time", 0) && parseIdList(sec, "id") &&
isValidId(sec.getValue("id")) && parseInt(sec, "max_speed", 0)) {
ArrayList<String> itinerario = parsearItinerario(sec);
//Tenemos garantizado que los argumentos que nos han introducido son válidos
return new NewVehicle(Integer.parseInt(sec.getValue("time")), sec.getValue("id"),
Integer.parseInt(sec.getValue("max_speed")), itinerario);
}
throw new SimulationException("Algún parámetro no existe o es inválido");
}
//Devolvemos null si es un vehículo sin tipo
return null;
}
}
public void execute(RoadMap roadMap) throws SimulationException {
//Comprobamos que no existiera previamente el vehículo
if(roadMap.getConstantSimObjects().get(id) == null) {
ArrayList<Junction> itinerarioVehiculoJunctions = crearItinerario(roadMap);
//Llamamos al constructor del vehículo
Vehicle nuevoVehiculo = new Vehicle(id, max_speed, itinerarioVehiculoJunctions);
//Y lo insertamos en el roadMap
roadMap.getVehicles().add(nuevoVehiculo);
roadMap.getSimObjects().put(id, nuevoVehiculo);
} else {
throw new SimulationException("Identificador de objeto duplicado");
}
}
protected ArrayList<Junction> crearItinerario(RoadMap roadMap) throws SimulationException{
//Creamos el itinerario
ArrayList<Junction> itinerarioVehiculoJunctions = new ArrayList<Junction> ();
//Para cada cruce que pertenezca al itinerario del vehículo
for(String idJunction: itinerario) {
//Añadimos el cruce al arrayList de Junctions que representa el itinerario del vehículo
if(roadMap.getConstantSimObjects().get(idJunction) == null) {
throw new SimulationException("El cruce no existe");
}
itinerarioVehiculoJunctions.add((Junction) roadMap.getSimObjects().get(idJunction));
}
return itinerarioVehiculoJunctions;
}
public void describe(Map<String,String> out, String rowIndex) {
out.put("#", rowIndex);
out.put("Time", "" + time);
out.put("Type", "New Vehicle " + id);
}
}
| [
"lauracastilla@users.noreply.github.com"
] | lauracastilla@users.noreply.github.com |
fe2d93b0c5b7261dcc4fddbcfb0796dd50c73af3 | b180f69a78dc7233f85af375212e8af1e7791c1a | /BOJ_Algorithm/src/BOJ_9019.java | 3893b296c0e6f6d8494ecc945bdb2f3e374bf61a | [] | no_license | Youngyul/BOJ_Algorithm | 093953368332a5fd59a32ce82011bd7b64faa25f | 5460ff877332a2528700b41413bef9efe105240c | refs/heads/master | 2020-04-14T16:30:15.130446 | 2019-04-26T01:13:12 | 2019-04-26T01:13:12 | 163,953,611 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,549 | java | import java.util.*;
import java.io.*;
public class BOJ_9019 {
static int Testcase;
static int before,after;
static boolean check [] = new boolean [100001];
static String times = "";
static String result [] = new String [100001];
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Testcase = Integer.parseInt(br.readLine().trim());
for(int i = 0; i<Testcase;i++) {
String str [] = br.readLine().split(" ");
before = Integer.parseInt(str[0]);
after = Integer.parseInt(str[1]);
BFS(before,after);
}
}
static void BFS(int a, int b) {
Queue<Node> q = new LinkedList<>();
q.add(new Node(a,""));
check[a]=true;
while(!q.isEmpty()) {
Node now= q.poll();
int nowpo = now.end;
String value = now.value;
if(now.end==b) {
System.out.println(now.value);
return ;
}
for(int i = 0; i<4;i++) {
int next = 0;
if(i==0) {
next = D(nowpo);
if(check[next]==false) {
check[next]=true;
q.add(new Node(next,value+"D"));
result[next]=value+"D";
}
}else if(i==1) {
next = S(nowpo);
if(check[next]==false) {
check[next]=true;
q.add(new Node(next,value+"S"));
result[next]=value+"S";
}
}else if(i==2) {
next = L(nowpo);
if(check[next]==false) {
check[next]=true;
q.add(new Node(next,value+"L"));
result[next]=value+"L";
}
}else {
next = R(nowpo);
if(check[next]==false) {
check[next]=true;
q.add(new Node(next,value+"R"));
result[next]=value+"R";
}
}
}
}
}
static int D(int a) {
int k = a*2;
int result =0;
if(k>=0&&k<9999) {
result = k;
}else {
result = k%10000;
}
return result;
}
static int S(int a) {
int result = 0;
int k = a-1;
if(k==0) {
result = 9999;
}else {
result = k;
}
return result;
}
static int L(int a) {
int k=a;
int result=0;
int q = k/1000;
int w = (k%1000)/100;
int e = (k%100)/10;
int r = (k%10);
result = w*1000+e*100+r*10+q;
return result;
}
static int R(int a) {
int k = a;
int result=0;
int q = k/1000;
int w = (k%1000)/100;
int e = (k%100)/10;
int r = (k%10);
result = r*1000+q*100+w*10+e;
return result;
}
static class Node{
int end;
String value;
Node(int end,String value){
this.end=end;
this.value=value;
}
}
}
| [
"31728373+Youngyul@users.noreply.github.com"
] | 31728373+Youngyul@users.noreply.github.com |
fd0e00f05841bb8e314c8f7e5270154651a54a3e | f1ae6372ca2eca39e00b4949d787c1983bb8b8ad | /app/src/main/java/com/example/a1/propertyanimtest/GoodsAdapter.java | e93d58f8b935d1a2ea3e8fe349e0efa74c03490a | [] | no_license | HotBloodMan/PropertyAnimTest | e8c3fb5eb27634cc7d4a0deb1d8ddd5ada83c6c3 | 86391cbb2dcce5a59b5f9bdc7a04e3d18d0fbdac | refs/heads/master | 2021-07-14T01:51:56.400977 | 2017-11-20T02:02:55 | 2017-11-20T02:02:55 | 95,633,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,777 | java | package com.example.a1.propertyanimtest;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import java.util.ArrayList;
import java.util.List;
/**
* Created by 1 on 2017/6/28.
*/
public class GoodsAdapter extends BaseAdapter {
//数据源(购物车商品图片
private List<GoodsModel> mData;
//布局
private LayoutInflater mLayoutInflater;
//回调监听
private CallBackListener mCallBackListener;
public GoodsAdapter(Context context, List<GoodsModel> mData){
mLayoutInflater = LayoutInflater.from(context);
this.mData = mData;
}
@Override
public int getCount() {
return mData !=null ? mData.size() :0 ;
}
@Override
public Object getItem(int position) {
return mData !=null?mData.get(position):null;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if(convertView==null){
convertView=mLayoutInflater.inflate(R.layout.adapter_shopping_cart_item,null);
viewHolder=new ViewHolder(convertView);
convertView.setTag(viewHolder);
}else{
//复用ViewHolder
viewHolder= (ViewHolder) convertView.getTag();
}
//更新UI
if(position<mData.size()){
viewHolder.updataUI(mData.get(position));
}
return convertView;
}
class ViewHolder{
//显示商品图片
ImageView mShoppingCartItemIV;
public ViewHolder(View view){
mShoppingCartItemIV = (ImageView) view.findViewById(R.id.iv_shopping_cart_item);
view.findViewById(R.id.tv_shopping_cart_item).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(mShoppingCartItemIV !=null&&mCallBackListener!=null){
mCallBackListener.callBackImg(mShoppingCartItemIV);
}
}
});
}
public void updataUI(GoodsModel goodsModel){
if(goodsModel!=null&& goodsModel.getmGoodBitmap()!=null
&& mShoppingCartItemIV!=null){
mShoppingCartItemIV.setImageBitmap(goodsModel.getmGoodBitmap());
}
}
}
public void setmCallBackListener(CallBackListener mCallBackListener) {
this.mCallBackListener = mCallBackListener;
}
public interface CallBackListener{
void callBackImg(ImageView goodImg);
}
}
| [
"18303011272@163.com"
] | 18303011272@163.com |
488cdcff2e02757fbca07dae8dec96a4ceafca78 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/12/12_5dffe45cee5025c3d06fe354b4d4bfec127fe9b2/CategoryASTTransformation/12_5dffe45cee5025c3d06fe354b4d4bfec127fe9b2_CategoryASTTransformation_s.java | e93174ace1b65e0a9d3b57ff6aedd4e39f077909 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 6,901 | java | /*
* Copyright 2008 the original author or authors.
*
* 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.codehaus.groovy.transform;
import org.codehaus.groovy.control.CompilePhase;
import org.codehaus.groovy.control.SourceUnit;
import org.codehaus.groovy.control.messages.SyntaxErrorMessage;
import org.codehaus.groovy.transform.ASTTransformation;
import org.codehaus.groovy.transform.GroovyASTTransformation;
import org.codehaus.groovy.ast.expr.*;
import org.codehaus.groovy.ast.stmt.BlockStatement;
import org.codehaus.groovy.ast.stmt.ExpressionStatement;
import org.codehaus.groovy.ast.*;
import org.codehaus.groovy.syntax.SyntaxException;
import org.objectweb.asm.Opcodes;
import java.util.Set;
import java.util.LinkedList;
import java.util.HashSet;
/**
* Handles generation of code for the @Category annotation
* - all non-static methods converted to static ones with additional parameter 'self'
*
* @author Alex Tkachman
*/
@GroovyASTTransformation(phase=CompilePhase.CANONICALIZATION)
public class CategoryASTTransformation implements ASTTransformation, Opcodes {
private static final VariableExpression THIS_EXPRESSION = new VariableExpression("$this");
/**
* Property invocations done on 'this' reference are transformed so that the invocations at runtime are
* done on the additional parameter 'self'
*
*/
public void visit(ASTNode[] nodes, final SourceUnit source) {
AnnotationNode annotation = (AnnotationNode) nodes[0];
ClassNode parent = (ClassNode) nodes[1];
ClassNode targetClass = getTargetClass(source, annotation);
final LinkedList<Set<String>> varStack = new LinkedList<Set<String>> ();
Set<String> names = new HashSet<String>();
for (FieldNode field : parent.getFields()) {
names.add(field.getName());
}
varStack.add(names);
final ClassCodeExpressionTransformer expressionTransformer = new ClassCodeExpressionTransformer() {
protected SourceUnit getSourceUnit() {
return source;
}
public void visitMethod(MethodNode node) {
Set<String> names = new HashSet<String>();
names.addAll(varStack.getLast());
final Parameter[] params = node.getParameters();
for (int i = 0; i < params.length; i++) {
Parameter param = params[i];
names.add(param.getName());
}
varStack.add(names);
super.visitMethod(node);
varStack.removeLast();
}
public void visitBlockStatement(BlockStatement block) {
Set<String> names = new HashSet<String>();
names.addAll(varStack.getLast());
varStack.add(names);
super.visitBlockStatement(block);
varStack.remove(names);
}
public void visitDeclarationExpression(DeclarationExpression expression) {
varStack.getLast().add(expression.getVariableExpression().getName());
super.visitDeclarationExpression(expression);
}
public void visitExpressionStatement(ExpressionStatement es) {
// GROOVY-3543: visit the declaration expressions so that declaration variables get added on the varStack
Expression exp = es.getExpression();
if(exp instanceof DeclarationExpression) {
exp.visit(this);
}
super.visitExpressionStatement(es);
}
public Expression transform(Expression exp) {
if (exp instanceof VariableExpression) {
VariableExpression ve = (VariableExpression) exp;
if (ve.getName().equals("this"))
return THIS_EXPRESSION;
else {
if (!varStack.getLast().contains(ve.getName())) {
return new PropertyExpression(THIS_EXPRESSION, ve.getName());
}
}
} else if(exp instanceof PropertyExpression) {
PropertyExpression pe = (PropertyExpression) exp;
if (pe.getObjectExpression() instanceof VariableExpression) {
VariableExpression vex = (VariableExpression) pe.getObjectExpression();
if (vex.isThisExpression()) {
pe.setObjectExpression(THIS_EXPRESSION);
return pe;
}
}
}
return super.transform(exp);
}
};
for (MethodNode method : parent.getMethods() ) {
if (!method.isStatic()) {
method.setModifiers(method.getModifiers() | Opcodes.ACC_STATIC);
final Parameter[] origParams = method.getParameters();
final Parameter[] newParams = new Parameter [origParams.length + 1];
newParams [0] = new Parameter(targetClass, "$this");
System.arraycopy(origParams, 0, newParams, 1, origParams.length);
method.setParameters(newParams);
expressionTransformer.visitMethod(method);
}
}
}
private ClassNode getTargetClass(SourceUnit source, AnnotationNode annotation) {
final Expression value = annotation.getMember("value");
if (value == null || !(value instanceof ClassExpression)) {
//noinspection ThrowableInstanceNeverThrown
source.getErrorCollector().addErrorAndContinue(
new SyntaxErrorMessage(new SyntaxException(
"@groovy.lang.Category must define 'value' which is class to apply this category",
annotation.getLineNumber(),
annotation.getColumnNumber()),
source));
}
ClassNode targetClass = ((ClassExpression)value).getType();
return targetClass;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
5691e5e8b05aa7e923573603e3cbe4efcfbe32a1 | 667d3fb5ccc9228c6f24741efce1ea57de663c1d | /src/main/java/com/globalknowledge/gestibank/GestibankApplication.java | bec00cd1f63bb1fba4bd7e63b7b7d0074a4e2ae0 | [] | no_license | Xewtwo/gestibank | 3cc3b7357f42290f18366a23dffd1e6e7fe7a357 | 770384d3c0b717afbd0590a1f5e53015099c10c8 | refs/heads/master | 2020-12-23T06:12:41.106361 | 2020-01-29T19:13:44 | 2020-01-29T19:47:12 | 237,062,117 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package com.globalknowledge.gestibank;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class GestibankApplication {
public static void main(String[] args) {
SpringApplication.run(GestibankApplication.class, args);
}
}
| [
"quentin@lemairepro.fr"
] | quentin@lemairepro.fr |
fec9195b00f07145c5a4d544e7bb3ac04e056979 | ef36c72e6b010434ac851ed30fc8e73abdfac0c6 | /addressbook_selenium_tests/src/com/example/tests/Sample.java | 918adf422382a66d523c8c7b482e1c77a9bb7386 | [
"Apache-2.0"
] | permissive | pavlenkonata/PFT-17_nataliia.pavlenko | 4dbc785b68e284d310c5c4d2e8a76c403460fbab | e1297366c5912bab1ea18dd7980388aa2b869599 | refs/heads/master | 2021-03-12T19:38:47.134505 | 2014-05-07T22:23:48 | 2014-05-07T22:23:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 580 | java | package com.example.tests;
import org.testng.annotations.Test;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
import com.example.fw.ApplicationManager;
import com.example.fw.JdbcHelper;
public class Sample {
public static void main(String[] args) throws IOException {
Properties properties = new Properties();
properties.load(new FileReader(new File("application.properties")));
ApplicationManager app = new ApplicationManager(properties);
System.out.println(app.getHibernateHelper().listContacts());
}
}
| [
"nataliia.pavlenko@gmail.com"
] | nataliia.pavlenko@gmail.com |
cc8e0f4fc2292db285f1b8baba8dede32341e784 | ebf6778ae441200864368698f88f692c26253055 | /src/kareta/lab7/NumericalMethods.java | 3597a9f4f6192ea3c1ad0d432fd17ed2383113f7 | [] | no_license | kareta/java-algorithms | cf2e27b9f7d7c468b323763a77595c5307acf846 | 0a406b19a73ca78057cbbadec6eb930b30698454 | refs/heads/master | 2020-12-30T12:34:47.760163 | 2017-05-15T21:49:30 | 2017-05-15T21:49:30 | 91,387,463 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,043 | java | package kareta.lab7;
import kareta.lab7.function.Function;
/**
* Created by vitya on 26.04.17.
*/
public class NumericalMethods {
private Function function;
private int a;
private int b;
private double step;
public NumericalMethods(Function function, int a, int b, double step) {
this.function = function;
this.a = a;
this.b = b;
this.step = step;
}
public Function getFunction() {
return function;
}
public void setFunction(Function function) {
this.function = function;
}
double rectangle() {
double result = 0;
int segmentsNumber = (int) ((b - a) / step);
for (int i = 0; i < segmentsNumber; i++) {
result += function.run(a + step * (i + 0.5));
}
return result * step;
}
double simpson() {
int segmentsNumber = (int) ((b - a) / step);
double result = (function.run(a) + function.run(b)) * 0.5;
for (int i = 1; i <= (segmentsNumber - 1); i++) {
double temporary = a + step * i;
double temporaryIMinusOne = a + step * (i - 1);
result += function.run(temporary)
+ 2 * function.run((temporaryIMinusOne + temporary) / 2);
}
double temporaryLast = a + step * segmentsNumber;
double temporarySecondLoopLast = a + step * (segmentsNumber - 1);
result += 2 * function.run((temporarySecondLoopLast + temporaryLast) / 2);
return result * (step / 3.0);
}
double trapezoid() {
int segmentsNumber = (int) ((b - a) / step);
double sum = 0;
if (0 == segmentsNumber){
return sum;
}
double temporaryStep = (b - a) / (1.0 * segmentsNumber);
for (int i = 1; i < segmentsNumber; i++) {
sum += function.run(a + i * temporaryStep);
}
sum += (function.run(a) + function.run(b)) / 2;
sum *= temporaryStep;
return sum;
}
}
| [
"karetavictor@gmail.com"
] | karetavictor@gmail.com |
3262ddac8dfedb67ceb226897fd301cd68fed944 | d98610da5dc8c8f14b4360ae5c77fe845ccb4211 | /app/src/main/java/com/boxuanjia/style/ui/BaseFragment.java | 1f0564b3b4eac184b86c65774c027c9607e4d318 | [] | no_license | wherego/Style | b71817a5e0261f1b620b70ba86d4d44c92f4868c | f9bc2cf184af6b6850beee1e14302aa36e5a4942 | refs/heads/master | 2021-01-20T12:29:12.863454 | 2016-02-25T04:54:56 | 2016-02-25T04:54:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,747 | java | package com.boxuanjia.style.ui;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public abstract class BaseFragment extends Fragment {
@Override
public void onAttach(Context context) {
super.onAttach(context);
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Override
public void onStart() {
super.onStart();
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
@Override
public void onPause() {
super.onPause();
}
@Override
public void onStop() {
super.onStop();
}
@Override
public void onDestroyView() {
super.onDestroyView();
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public void onDetach() {
super.onDetach();
}
}
| [
"boxuanjia@gmail.com"
] | boxuanjia@gmail.com |
7315995961b83db12de4af028f451388285b9e93 | 7c12ca9bdcb5bc43c406ecea69e037c6f834048a | /src/main/java/ru/stepintegrator/dmccPhone/DMCC.java | 6b16b64d2e15b84e208587da415cc62925903e74 | [] | no_license | seven1240/DmccPhones | 00758daa6cc734807860d8f2fcc44b2047057ac9 | de52efbf7f4f9afb7b2f05599abc011ca124da0c | refs/heads/master | 2022-03-03T20:59:47.831117 | 2019-04-02T13:31:17 | 2019-04-02T13:31:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,643 | java | package ru.stepintegrator.dmccPhone;
import ch.ecma.csta.binding.DeviceID;
import ch.ecma.csta.callcontrol.CallControlServices;
import ch.ecma.csta.logical.LogicalDeviceFeatureServices;
import ch.ecma.csta.media.MediaServices;
import ch.ecma.csta.monitor.MonitoringServices;
import ch.ecma.csta.physical.PhysicalDeviceServices;
import ch.ecma.csta.voiceunit.VoiceUnitServices;
import com.avaya.cmapi.APIProtocolVersion;
import com.avaya.cmapi.ServiceProvider;
import com.avaya.csta.binding.*;
import com.avaya.csta.device.DeviceServices;
import com.avaya.csta.registration.RegistrationServices;
import com.avaya.mvcs.framework.CmapiKeys;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class DMCC {
private static final Log log = LogFactory.getLog(DMCC.class);
private static final String dmccPropertiesFileName = "dmcc.properties";
private static DeviceServices deviceServices;
private static CallControlServices callControlServices;
private static LogicalDeviceFeatureServices logicalDeviceFeatureServices;
private static MonitoringServices monitoringServices;
private static PhysicalDeviceServices physicalDeviceServices;
private static RegistrationServices registrationServices;
private static MediaServices mediaServices;
private static VoiceUnitServices voiceSvcs;
public static void main(String[] args) throws Exception {
Properties properties = loadProperty(dmccPropertiesFileName);
System.out.println("6.3"+APIProtocolVersion.VERSION_6_3);
System.out.println("6.3.3"+APIProtocolVersion.VERSION_6_3_3);
ServiceProvider serviceProvider = ServiceProvider.getServiceProvider(properties);
System.out.println(serviceProvider.getSessionID());
deviceServices = deviceServices(serviceProvider);
callControlServices = callControlServices(serviceProvider);
monitoringServices = monitoringServices(serviceProvider);
physicalDeviceServices = physicalDeviceServices(serviceProvider);
registrationServices = registrationServices(serviceProvider);
// mediaServices=mediaServices(serviceProvider);
voiceSvcs=voiceUnitServices(serviceProvider);
logicalDeviceFeatureServices=logicalDeviceFeatureServices(serviceProvider);
new PhoneService().init();
}
//---------------------------getters----------------
public static DeviceServices getDeviceServices() {
return deviceServices;
}
public static CallControlServices getCallControlServices() {
return callControlServices;
}
public static LogicalDeviceFeatureServices getLogicalDeviceFeatureServices() {
return logicalDeviceFeatureServices;
}
public static MonitoringServices getMonitoringServices() {
return monitoringServices;
}
public static PhysicalDeviceServices getPhysicalDeviceServices() {
return physicalDeviceServices;
}
public static RegistrationServices getRegistrationServices() {
return registrationServices;
}
public static MediaServices getMediaServices() {
return mediaServices;
}
public static VoiceUnitServices getVoiceSvcs() {
return voiceSvcs;
}
///------------------------------------services----------------
private static DeviceServices deviceServices(ServiceProvider serviceProvider) throws Exception {
return (DeviceServices) serviceProvider.getService(com.avaya.csta.device.DeviceServices.class.getName());
}
private static CallControlServices callControlServices(ServiceProvider serviceProvider) throws Exception {
return (CallControlServices) serviceProvider.getService(CallControlServices.class.getName());
}
private static LogicalDeviceFeatureServices logicalDeviceFeatureServices(ServiceProvider serviceProvider) throws Exception {
return (LogicalDeviceFeatureServices) serviceProvider.getService(LogicalDeviceFeatureServices.class.getName());
}
private static MonitoringServices monitoringServices(ServiceProvider serviceProvider) throws Exception {
return (MonitoringServices) serviceProvider.getService(ch.ecma.csta.monitor.MonitoringServices.class.getName());
}
private static PhysicalDeviceServices physicalDeviceServices(ServiceProvider serviceProvider) throws Exception {
return (PhysicalDeviceServices) serviceProvider.getService(ch.ecma.csta.physical.PhysicalDeviceServices.class.getName());
}
private static RegistrationServices registrationServices(ServiceProvider serviceProvider) throws Exception {
return (RegistrationServices) serviceProvider.getService(com.avaya.csta.registration.RegistrationServices.class.getName());
}
// private static MediaServices mediaServices(ServiceProvider serviceProvider) throws Exception {
// return (MediaServices) serviceProvider.getService(ch.ecma.csta.media.MediaServices.class.getName());
// }
private static VoiceUnitServices voiceUnitServices(ServiceProvider serviceProvider) throws Exception {
return (VoiceUnitServices) serviceProvider.getService(ch.ecma.csta.voiceunit.VoiceUnitServices.class.getName());
}
private static Properties loadProperty(String dmccPropertiesFileName) throws IOException {
Properties properties = new Properties();
try (InputStream inputStream = ClassLoader.getSystemResourceAsStream(dmccPropertiesFileName)) {
properties.load(inputStream);
}
return properties;
}
}
| [
"melnikoffaa@mail.ru"
] | melnikoffaa@mail.ru |
c2f81ea532837b85e3ba1bcae9ab65be8e49ce71 | b02ca5421ad78d9154c2158c43b0673402f89223 | /PE34.java | f12360c2e0e7a318f49a51ce53490082e061dc3a | [] | no_license | dariandaji/Project-Euler | 4f3389ec0fe958029396e27bf4efb235504aa36e | 425cb4b9606c8993206c048dd58bf05e550adcab | refs/heads/master | 2020-07-30T05:27:37.452282 | 2020-07-03T13:14:31 | 2020-07-03T13:14:31 | 210,102,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 791 | java | import java.io.*;
import java.math.*;
import java.util.*;
class PE34 {
public static void main(String args[])throws IOException {
final long startTime = System.currentTimeMillis();
int i,digit,n,r;
long sum = 0;
long endTime = System.currentTimeMillis();
ArrayList<Integer> arr = new ArrayList<Integer>();
for(i=3;endTime-startTime<=2000;i++) {
n = i;
sum = 0;
while(n!=0) {
r = n%10;
sum+=factorial(r);
n=n/10;
}
if(sum==i) {
System.out.println(i);
arr.add(i);
}
endTime = System.currentTimeMillis();
}
sum=0;
for(i=0;i<arr.size();i++)
sum+=arr.get(i);
System.out.println("Total sum = "+sum);
}
public static long factorial(int a) {
int i;
int fact=1;
for(i=2;i<=a;i++)
fact *= i;
return fact;
}
}
| [
"dariandaji@hotmail.com"
] | dariandaji@hotmail.com |
085af013d7ae6817f941c8c4253455db340ce079 | 150cc3bca7e62b3c527c66511cb3b593776c02c6 | /src/main/java/com/example/regexp/RegexpApplication.java | fccf9e1cb61289fd1aace844d14a33ff749e9b4f | [] | no_license | DorraChen/regexp | ba0bf41a0dd417208f91f3f33f3ca4b2f9ce5dc7 | 0bff0eaea70cde924a16602a7004ed4ed0686de5 | refs/heads/master | 2023-05-06T04:51:45.261959 | 2021-05-23T14:58:12 | 2021-05-23T14:58:12 | 370,069,924 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package com.example.regexp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class RegexpApplication {
public static void main(String[] args) {
SpringApplication.run(RegexpApplication.class, args);
}
}
| [
"1814786186@qq.com"
] | 1814786186@qq.com |
0fc280b2606e20bae87a57aa81e16fb1b3d893f3 | 7990b4df7478100b24e8a970ba10fc6887b78adf | /APPLICATIONS/SpringBootMvcAndRestExample/src/main/java/com/espark/adarsh/web/bean/ResponseBean.java | 268245fcd16b4682fba19fbb6d2d8112a6b1cc8f | [] | no_license | adarshkumarsingh83/spring_boot | b206a9f8426d92a9f32fa6505916a2637a9a74a7 | b41a25c9903744beaada3fa91122fdd54cb01f39 | refs/heads/master | 2023-08-25T05:02:25.643761 | 2023-08-16T05:22:36 | 2023-08-16T05:22:36 | 58,055,108 | 7 | 18 | null | 2022-12-16T17:24:41 | 2016-05-04T13:39:59 | Java | UTF-8 | Java | false | false | 3,228 | java | /*
* Copyright (c) 2015 Espark And ©Adarsh Development Services @copyright All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Espark nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.espark.adarsh.web.bean;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
/**
* @author Adarsh Kumar
* @author $LastChangedBy: Adarsh Kumar$
* @version $Revision: 0001 $, $Date:: 1/1/10 0:00 AM#$
* @Espark @copyright all right reserve
*/
@XmlRootElement(name = "response")
@XmlAccessorType(XmlAccessType.FIELD)
public class ResponseBean<T> implements Serializable{
private T data;
private String message;
@XmlElement(name = "statusCode")
private Integer statusCode = 200;
@XmlElement(name = "statusMessage")
private String statusMessage = "Success";
@XmlElement(name = "success")
private Boolean success = true;
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Integer getStatusCode() {
return statusCode;
}
public void setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
}
public String getStatusMessage() {
return statusMessage;
}
public void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
}
public Boolean getSuccess() {
return success;
}
public void setSuccess(Boolean success) {
this.success = success;
}
}
| [
"adarsh.kumar@photoninfotech.net"
] | adarsh.kumar@photoninfotech.net |
5d76aaef1ac827c38ce5613f99cda34fd122a28c | 6805ad10ab183249f6a4bd4cf70664a6800151a9 | /app/src/main/java/com/example/android/moodindigo/EventsAdapter.java | 3817ffcf6f6ce3ca76dcddb2405f8548f3ec29de | [] | no_license | Sanidhya27/MusicPlayerService | 26554d115ec6de0eedadef7569c3e87937c350f8 | f1e4a569b1d1766561a279145c9236d35658d94b | refs/heads/master | 2021-08-28T04:48:10.445575 | 2017-12-11T07:48:40 | 2017-12-11T07:48:40 | 113,828,563 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,473 | java | package com.example.android.moodindigo;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.example.android.moodindigo.data.EventDetailResponse;
import com.example.android.moodindigo.data.GenresResponse;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by mrunz on 22/9/17.
*/
public class EventsAdapter extends RecyclerView.Adapter<EventsAdapter.myViewHolder>{
public static class myViewHolder extends RecyclerView.ViewHolder{
public myViewHolder(View itemView) {
super(itemView);
}
}
public EventsAdapter(){
}
@Override
public EventsAdapter.myViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
View itemView = LayoutInflater.from(parent.getContext()).
inflate(R.layout.eventitem, parent,false);
EventsAdapter.myViewHolder vh = new EventsAdapter.myViewHolder(itemView);
return vh;
}
@Override
public void onBindViewHolder(final EventsAdapter.myViewHolder holder, int position){
}
@Override
public int getItemCount(){
return 10;
}
}
| [
"cool.sanidhyagwl@gmail.com"
] | cool.sanidhyagwl@gmail.com |
0d806e7c56a24e9ec89f68a00c960378f234c0b7 | ec7777e904ce099417000e7b1113e29912194dd3 | /src/test/java/testbase/TestBase.java | a5c38a7c9349c166c001d8c4e3cce5fb7569eafc | [
"MIT"
] | permissive | jryanthe4th/PomFrameworkDemo | 54fd21efb4bd900edc2c4b74f649ab0f2443082b | 32c0bedca11c941759f9b7b85189ed61f93c7133 | refs/heads/main | 2023-04-24T00:50:41.011827 | 2021-05-19T01:16:51 | 2021-05-19T01:16:51 | 368,708,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 696 | java | package testbase;
import com.jmr.driver.DriverFactory;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.*;
public class TestBase {
public WebDriver driver;
@BeforeSuite(alwaysRun = true)
public static void instantiateDriver() {
DriverFactory.instantiateDriverObject();
}
@BeforeClass
public void setUp() throws Exception {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
}
@AfterClass
public void tearDown() throws Exception {
if (driver != null)
driver.quit();
}
}
| [
"joseph.ryan.iv@gmail.com"
] | joseph.ryan.iv@gmail.com |
a6bd90c2b88ba2cded31e134020a42691a9b0b5c | 8d316b7a4f247869514b36ac009c46fd0e64f5f1 | /Datepicker/app/src/androidTest/java/android/example/com/datepicker/ExampleInstrumentedTest.java | 456cba86e131aff5b5e0ca399f57cc06e93460d5 | [] | no_license | prajktik/date_picker_demo | e9f2c716e48fcdcc8514e3869164343a2b89fc45 | 6690abdcbd120286a14dc056237c6220b0370c96 | refs/heads/master | 2021-07-14T08:52:06.618387 | 2017-10-18T01:35:28 | 2017-10-18T01:35:28 | 107,343,845 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 763 | java | package android.example.com.datepicker;
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("android.example.com.datepicker", appContext.getPackageName());
}
}
| [
"noreply@github.com"
] | noreply@github.com |
adeae08c10b86a10c4c996568dcb247a3da80ba0 | 7c24fa6ab4d1cdc0f4490d82de61ddb31684999f | /logginghub-messaging3/src/test/java/com/logginghub/messaging/fixture/HelloService.java | c770dd5f86c168b8432264a2dc9dc833fc7002bd | [
"Apache-2.0"
] | permissive | logginghub/core | e4e0d46780d99561127f531f600f2bb5b01cb46d | c04545c3261258f8d54aeb30eb43f58a7ba58493 | refs/heads/master | 2022-12-13T03:46:39.295908 | 2022-12-08T08:55:57 | 2022-12-08T08:55:57 | 28,720,138 | 0 | 2 | Apache-2.0 | 2022-07-07T21:04:39 | 2015-01-02T17:16:52 | Java | UTF-8 | Java | false | false | 224 | java | package com.logginghub.messaging.fixture;
public interface HelloService {
String hello(String name);
void addListener(HelloListener listener);
void removeListener(HelloListener listener);
}
| [
"james@vertexlabs.co.uk"
] | james@vertexlabs.co.uk |
7f0834c3eeeadc155a9f4ef162330763ffbe7220 | 83e934b83e10ec240d543b1981a9205e525a4889 | /06. 1. Java-OOP-Advanced-Unit-Testing/src/main/java/Hero.java | 6311045979a613af62dbfedc0d6b536f429c22b3 | [
"MIT"
] | permissive | kostadinlambov/Java-OOP-Advanced | dca49a1b0750092cc713684403629ff9ca06d39e | 12db2a30422deef057fc25cf2947d8bc22cce77c | refs/heads/master | 2021-05-12T10:59:24.753433 | 2018-01-20T19:01:45 | 2018-01-20T19:01:45 | 117,370,385 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 703 | java | import interfaces.Target;
import interfaces.Weapon;
import java.util.Random;
public class Hero {
private String name;
private int experience;
private Weapon weapon;
public Hero(String name, Weapon weapon) {
this.name = name;
this.experience = 0;
this.weapon = weapon;
}
public String getName() {
return this.name;
}
public int getExperience() {
return this.experience;
}
public Weapon getWeapon() {
return this.weapon;
}
public void attack(Target target) {
this.weapon.attack(target);
if (target.isDead()) {
this.experience += target.giveExperience();
}
}
}
| [
"valchak@abv.bg"
] | valchak@abv.bg |
8bbd2c27d886074558045e2ae50ae9192e35c167 | 043df4d5dd73ff71dcd98ccd7b117526581f2efb | /src/main/java/com/visconde/configserver/ConfigServerApplication.java | a6899e1a13d773b82118ccae8a81f56836d08986 | [] | no_license | renangv11/config-server | 00d954fecb05bcbf8ed9bc0deabf3c4a90a74eaf | da533da5e7b8ddb9831304fc16636b105961740c | refs/heads/master | 2020-08-08T08:31:35.573380 | 2019-10-09T01:36:58 | 2019-10-09T01:36:58 | 213,793,280 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | package com.visconde.configserver;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
@EnableConfigServer
@SpringBootApplication
public class ConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}
| [
"renangv11@hotmail.com"
] | renangv11@hotmail.com |
19d2692ffdc94e87241db72f4019b2dd5cf8b61b | 038ee6b20cae51169a2ed4ed64a7b8e99b5cbaad | /schemaOrgDomaConv/src/org/kyojo/schemaOrg/m3n3/doma/core/container/PriceValidUntilConverter.java | 8b1c9c2b6c6c2a311f031d7423ff8bba348eea3b | [
"Apache-2.0"
] | permissive | nagaikenshin/schemaOrg | 3dec1626781913930da5585884e3484e0b525aea | 4c9d6d098a2741c2dc2a814f1c708ee55c36e9a8 | refs/heads/master | 2021-06-25T04:52:49.995840 | 2019-05-12T06:22:37 | 2019-05-12T06:22:37 | 134,319,974 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | package org.kyojo.schemaorg.m3n3.doma.core.container;
import java.sql.Date;
import org.seasar.doma.ExternalDomain;
import org.seasar.doma.jdbc.domain.DomainConverter;
import org.kyojo.schemaorg.m3n3.core.impl.PRICE_VALID_UNTIL;
import org.kyojo.schemaorg.m3n3.core.Container.PriceValidUntil;
@ExternalDomain
public class PriceValidUntilConverter implements DomainConverter<PriceValidUntil, Date> {
@Override
public Date fromDomainToValue(PriceValidUntil domain) {
if(domain != null && domain.getDateList() != null && domain.getDateList().size() > 0) {
return Date.valueOf(domain.getDateList().get(0).getDate());
} else {
return null;
}
}
@Override
public PriceValidUntil fromValueToDomain(Date value) {
return new PRICE_VALID_UNTIL(value);
}
}
| [
"nagai@nagaikenshin.com"
] | nagai@nagaikenshin.com |
466c4623882565fd4807f782b02d130c0ca0f18f | 79b863a54b15c4289c718c6bb4a903377bf5d81d | /MvvmDemo/app/src/androidTest/java/com/example/mvvmdemo/ExampleInstrumentedTest.java | 02c967ffb01b8d1cdee21722f88c35787ff73ec7 | [] | no_license | ShravaniH/MVVMDemo | 92c0786c86bcd92f01a8bbfddc01bb6fdfd41105 | 30451b732db0975e1766fef7a60a991d8d8f7987 | refs/heads/master | 2022-11-12T14:34:28.968782 | 2020-05-05T09:16:10 | 2020-05-05T09:53:36 | 261,409,497 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | package com.example.mvvmdemo;
import android.content.Context;
import org.junit.Test;
import org.junit.runner.RunWith;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
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.mvvmdemo", appContext.getPackageName());
}
}
| [
"shravani_hui@yahoo.com"
] | shravani_hui@yahoo.com |
609479c90e04144a24a11d7f388cf1017f4769d6 | 8c6cddaed75b2fb09dff607dc8e98e1d7c8a50f4 | /app/src/main/java/com/example/potoyang/mybike/OnlineActivity.java | 3011cdb61d00d703049c3756a864e3a6fc4f602b | [] | no_license | PotoYang/MyBike | 2a3d867e7f62a5791e703b7e199dabdf46d28715 | be087ad27263eb144892bfddce89188da0582595 | refs/heads/master | 2021-06-23T23:46:09.168201 | 2017-09-10T05:58:05 | 2017-09-10T05:58:05 | 103,007,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,557 | java | package com.example.potoyang.mybike;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import java.util.List;
import cn.bmob.v3.Bmob;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.FindListener;
public class OnlineActivity extends AppCompatActivity implements View.OnClickListener {
private EditText et_online_num;
private EditText et_online_password;
private Button btn_online, btn_online_to_offline;
@Override
protected void onCreate(Bundle savedInstanceState) {
//getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_online);
Bmob.initialize(OnlineActivity.this, "23f790c817e60450aedbf5b24a30e43e");
et_online_num = (EditText) findViewById(R.id.et_online_num);
et_online_password = (EditText) findViewById(R.id.et_online_password);
btn_online = (Button) findViewById(R.id.btn_online);
btn_online_to_offline = (Button) findViewById(R.id.btn_online_to_offline);
btn_online.setOnClickListener(this);
btn_online_to_offline.setOnClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.action, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_add_data:
Intent intent = new Intent(OnlineActivity.this, AddDataActivity.class);
startActivity(intent);
break;
default:
break;
}
return true;
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_online:
Query();
break;
case R.id.btn_online_to_offline:
Intent intent = new Intent(this, OfflineActivity.class);
startActivity(intent);
break;
default:
break;
}
}
private void Query() {
String num = et_online_num.getText().toString().trim();
BmobQuery<bike_num> query = new BmobQuery<>();
query.addWhereEqualTo("username", num);
query.findObjects(new FindListener<bike_num>() {
@Override
public void done(List<bike_num> list, BmobException e) {
if (e == null) {
if (list.isEmpty()) {
Toast.makeText(OnlineActivity.this, "未收录此车信息!", Toast.LENGTH_SHORT).show();
} else {
for (bike_num feed : list) {
et_online_password.setText(feed.getPassword().toString());
}
Toast.makeText(OnlineActivity.this, "获取成功!", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(OnlineActivity.this, "获取失败,请检查网络连接或进入离线版!", Toast.LENGTH_SHORT).show();
}
}
});
}
}
| [
"715792648@qq.com"
] | 715792648@qq.com |
f2158124aebaafd344d5598d1766d2b5a50d7d86 | 030e2bb6e5965561bace55783536e85c1076e63a | /src/main/java/de/springboot/service/StackoverflowServiceTemp.java | 4b66b581cf7afff4ca23dad9238f18f3722936a6 | [] | no_license | aromanchenkonn/SpringBootMongoTest | 3f580b4d3902af8f41741dbc2211008f1cd25a23 | 4ca43d999d6768f766744726f7ae9007016b36a2 | refs/heads/master | 2021-07-05T22:59:37.028857 | 2017-10-01T21:09:48 | 2017-10-01T21:09:48 | 105,439,974 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,442 | java | package de.springboot.service;
import de.springboot.model.StackoverflowWebsite;
import de.springboot.persistence.StackOverflowWebsiteRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class StackoverflowServiceTemp {
@Autowired
private StackOverflowWebsiteRepository repository;
// private static List<StackoverflowWebsite> items = new ArrayList<>();
// static {
// items.add(
// new StackoverflowWebsite(
// "#1"
// , "https://www.santouka.co.jp/wp/wp-content/themes/santouka/img/home/icon-mark.png"
// , "http://www.google.com"
// , "google"
// , "google home page"));
//
// items.add(
// new StackoverflowWebsite(
// "#2"
// , "https://www.santouka.co.jp/wp/wp-content/themes/santouka/img/home/icon-mark.png"
// , "http://www.yandex.ru"
// , "yandex"
// , "yandex home page"));
//
// items.add(
// new StackoverflowWebsite(
// "#3"
// , "https://www.santouka.co.jp/wp/wp-content/themes/santouka/img/home/icon-mark.png"
// , "http://www.mail.ru"
// , "mail.ru"
// , "mail.ru home page"));
//
// items.add(
// new StackoverflowWebsite(
// "#4"
// , "https://www.santouka.co.jp/wp/wp-content/themes/santouka/img/home/icon-mark.png"
// , "https://www.sputnik.ru/"
// , "sputnik"
// , "sputnik home page"));
//
// items.add(
// new StackoverflowWebsite(
// "#5"
// , "https://www.santouka.co.jp/wp/wp-content/themes/santouka/img/home/icon-mark.png"
// , "https://www.rambler.ru/"
// , "rambler"
// , "rambler home page"));
//
// }
//
// @PostConstruct
// public void init(){
// repository.save(items);
// }
public List<StackoverflowWebsite> findAll() {
return repository.findAll();
}
}
| [
"a.romanchenko.nn@gmail.com"
] | a.romanchenko.nn@gmail.com |
ddc5802627c5e374147573e249a247070b9316e3 | 80d677e2477ad396732ce0d34716bdf4ca285fc3 | /fish-shopping/src/main/java/ua/lviv/iot/fishStore/Order.java | 1f8de4e5e2a331460ac919bd0c37e6db75e3e4e3 | [] | no_license | MyroslavPro/Lab8 | d4f3bf01123f642d7e8edd6676b0c7bf05b8401a | 3fd6cae0b114dcd105aaceb23c2695df741f2d05 | refs/heads/main | 2023-05-07T00:39:39.996428 | 2021-06-03T19:13:23 | 2021-06-03T19:13:23 | 368,063,404 | 0 | 0 | null | 2021-06-03T19:22:57 | 2021-05-17T05:15:33 | Java | UTF-8 | Java | false | false | 69 | java | package ua.lviv.iot.fishStore;
public enum Order {
ASC,DESC
}
| [
"myropro@gmail.com"
] | myropro@gmail.com |
4cdda64c268a38a073707bf07f9f828d1a1acde5 | 2badedbfd5f38f08e67ccebf847d54d56cb4a224 | /src/main/java/org/wildcards/springboot/domain/model/MemberInformation.java | 042849d9721f1afaa0377db9005f251f9470fb15 | [] | no_license | wildcardsolutions/fundgen | aebb82f094a5f4401f2d20d1dd3a6e7167d55aec | 930e2ede0fc01f8bac2f2a22ace355969e6d4260 | refs/heads/master | 2021-01-10T02:20:11.753393 | 2015-10-14T23:54:49 | 2015-10-14T23:54:49 | 36,638,708 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,065 | java | package org.wildcards.springboot.domain.model;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
@Entity
@Table(name="member")
public class MemberInformation extends AbstractModel {
@Column(nullable = false)
private String firstname;
@Column(nullable = false)
private String middlename;
@Column(nullable = false)
private String lastname;
@Temporal(TemporalType.DATE)
@Column(nullable = false)
private Date dateOfBirth;
@Column(nullable = false)
private int age;
@Column
private String address;
@Column
private String cellphoneNumber;
@Column
private String homephoneNumber;
@Column
private String officephoneNumber;
@OneToMany(cascade = CascadeType.ALL)
@JoinTable(name = "member_cards",
joinColumns = { @JoinColumn(name = "member.id") },
inverseJoinColumns = { @JoinColumn(name = "member_cards.id") })
private List<MembershipCard> membershipCards;
@Transient
private MembershipDetails membership;
public MembershipDetails getMembership() {
return membership;
}
public void setMembership(MembershipDetails membership) {
this.membership = membership;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getMiddlename() {
return middlename;
}
public void setMiddlename(String middlename) {
this.middlename = middlename;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public Date getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCellphoneNumber() {
return cellphoneNumber;
}
public void setCellphoneNumber(String cellphoneNumber) {
this.cellphoneNumber = cellphoneNumber;
}
public String getHomephoneNumber() {
return homephoneNumber;
}
public void setHomephoneNumber(String homephoneNumber) {
this.homephoneNumber = homephoneNumber;
}
public String getOfficephoneNumber() {
return officephoneNumber;
}
public void setOfficephoneNumber(String officephoneNumber) {
this.officephoneNumber = officephoneNumber;
}
public List<MembershipCard> getMembershipCards() {
return membershipCards;
}
public void setMembershipCards(List<MembershipCard> membershipCards) {
this.membershipCards = membershipCards;
}
public String getFullName() {
return lastname + ", " + firstname + " " + middlename;
}
}
| [
"wildcardsolutions15@gmail.com"
] | wildcardsolutions15@gmail.com |
f3ed2b435d818eb7e5a97b1d79071d85b7654376 | 998d00177429e7445f67231b083246494ffba93b | /src/main/java/net/cakelancelot/heroes/extension/reqhandlers/MoveActor.java | 02a8a483d9b146e8bf7bfe8b4e3a1a612e1fe9bc | [
"MIT"
] | permissive | Juansecu/HeroesExtension | 16fb8f995ba17dff9311e5f3c184cb354bde7f31 | 68303248930bbbee469cea99ef324faab7dc5913 | refs/heads/master | 2023-06-02T00:25:31.544388 | 2021-06-15T13:36:42 | 2021-06-16T09:17:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,176 | java | package net.cakelancelot.heroes.extension.reqhandlers;
import com.smartfoxserver.v2.entities.Room;
import com.smartfoxserver.v2.entities.User;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.entities.data.SFSObject;
import com.smartfoxserver.v2.extensions.BaseClientRequestHandler;
import net.cakelancelot.heroes.extension.HeroesZoneExtension;
public class MoveActor extends BaseClientRequestHandler {
@Override
public void handleClientRequest(User sender, ISFSObject params) {
Room currentRoom = sender.getLastJoinedRoom();
HeroesZoneExtension parentExt = (HeroesZoneExtension) getParentExtension();
ISFSObject data = new SFSObject();
data.putUtfString("id", String.valueOf(sender.getId()));
data.putFloat("dest_x", params.getFloat("dest_x"));
data.putFloat("dest_y", params.getFloat("dest_y"));
data.putFloat("dest_z", params.getFloat("dest_z"));
data.putBool("orient", params.getBool("orient"));
data.putFloat("speed", params.getFloat("speed"));
parentExt.send("cmd_move_actor", parentExt.addTimeStamp(data), currentRoom.getUserList());
}
}
| [
"CakeLancelot@users.noreply.github.com"
] | CakeLancelot@users.noreply.github.com |
f614785608743d6b8ccbea77a1cf1e8fe4abfc09 | 61ad8437f48d1db58b89b233d74794f1dea8ce89 | /src/main/java/com/gioov/oryx/common/properties/AppProperties.java | cd5a5d99db774a4e2cf77666658f51e5c3698fa7 | [
"MIT"
] | permissive | godcheese/oryx | 238ae5440093bab3aeea08819fcfe8cc0a11b1a2 | 8f112e6923cb91c5cac01535fa7e0122998eecff | refs/heads/master | 2022-07-06T10:07:52.327644 | 2022-06-30T02:40:29 | 2022-06-30T02:40:29 | 178,159,244 | 6 | 6 | MIT | 2022-06-30T02:40:30 | 2019-03-28T08:26:33 | Java | UTF-8 | Java | false | false | 1,878 | java | package com.gioov.oryx.common.properties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* @author godcheese [godcheese@outlook.com]
* @date 2018-02-22
*/
@Component
@ConfigurationProperties(prefix = "app", ignoreUnknownFields = true, ignoreInvalidFields = true)
public class AppProperties {
private String name;
private String version;
private String url;
private List<String> systemAdminRole = new ArrayList<>(Collections.singletonList("SYSTEM_ADMIN"));
private String fileUploadPath = "/upload";
private String[] permitUrl;
private String i18n = "zh_cn";
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public List<String> getSystemAdminRole() {
return systemAdminRole;
}
public void setSystemAdminRole(List<String> systemAdminRole) {
this.systemAdminRole = systemAdminRole;
}
public String getFileUploadPath() {
return fileUploadPath;
}
public void setFileUploadPath(String fileUploadPath) {
this.fileUploadPath = fileUploadPath;
}
public String[] getPermitUrl() {
return permitUrl;
}
public void setPermitUrl(String[] permitUrl) {
this.permitUrl = permitUrl;
}
public String getI18n() {
return i18n != null ? i18n : "zh_cn";
}
public void setI18n(String i18n) {
this.i18n = i18n;
}
}
| [
"godcheese@outlook.com"
] | godcheese@outlook.com |
8388ee6ec49f32c431781599c697db525104d2ac | b51c35420c6a030875a1ab83bd8d51c8ef83a54e | /app/src/main/java/ir/zconf/zconfapp/Entity/SubjectEntity.java | cee0174c86d2227be4b213ea1fbbe8e19662dbd0 | [] | no_license | behdad222/zconfapp | 1836757d7f009bc21d76be4fc2272186e8fd8ef4 | e931a325f83131c4015a6058289faecb5e67555d | refs/heads/master | 2021-01-23T13:17:44.867343 | 2015-09-16T18:45:55 | 2015-09-16T18:45:55 | 42,545,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,058 | java | package ir.zconf.zconfapp.Entity;
public class SubjectEntity {
private String title;
private String time;
private String start;
private String speaker;
private String image;
private String type;
public String getTitle() {
return title + "";
}
public void setTitle(String title) {
this.title = title;
}
public String getTime() {
return time + "";
}
public void setTime(String time) {
this.time = time;
}
public String getStart() {
return start + "";
}
public void setStart(String start) {
this.start = start;
}
public String getSpeaker() {
return speaker + "";
}
public void setSpeaker(String speaker) {
this.speaker = speaker;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
| [
"behdad.222@gmail.com"
] | behdad.222@gmail.com |
17e34669e0ee12dfded3c6cffe21c76a07a86adc | 07ed3fc87ea0f10b295faea090bda5f1aae71c45 | /app/src/main/java/com/jszf/jingdong/market/adapter/HomePagerAdapter.java | f17201b2d57ac213343d394e8dc4611461d40a12 | [] | no_license | dhyking/JingDong | 5e15205fef3b3db8fe0a804f0af6685625f0ffd5 | 9db5aab8b1a9618aad1ad28ebe3f182369523c54 | refs/heads/master | 2021-01-20T19:00:23.773553 | 2016-07-14T06:47:25 | 2016-07-14T06:47:25 | 62,624,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,034 | java | package com.jszf.jingdong.market.adapter;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import java.util.List;
/**
* Created by Administrator on 2016/7/11.
*/
public class HomePagerAdapter extends PagerAdapter {
private List<ImageView> list;
public HomePagerAdapter(List<ImageView> mList) {
list = mList;
}
@Override
public int getCount() {
return Integer.MAX_VALUE;
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
container.addView(list.get(position % list.size()));
return list.get(position % list.size());
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
ImageView mImageView = list.get(position % list.size());
container.removeView(mImageView);
}
}
| [
"779339753@qq.com"
] | 779339753@qq.com |
6cb373926ac76d4b6291f9201a0f223c67b7987e | 581055ff95779811101974c7444e7bda290cceee | /main/src/main/java/net/oneandone/stool/scm/Subversion.java | b3ea056ee8cc0f26a3ae1ef9195c1a5cf7eea3f4 | [
"Apache-2.0"
] | permissive | maxbraun/stool | bedb7128f5fae4aa1e64d9ba4866de3a2f8ea04e | 2daf684ebffcad634fe159eea91a7ccef1bcc83e | refs/heads/master | 2021-01-20T01:45:41.317246 | 2017-08-23T11:42:20 | 2017-08-23T11:42:20 | 39,130,548 | 0 | 0 | null | 2015-07-15T10:22:13 | 2015-07-15T10:22:13 | null | UTF-8 | Java | false | false | 3,345 | java | /*
* Copyright 1&1 Internet AG, https://github.com/1and1/
*
* 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 net.oneandone.stool.scm;
import net.oneandone.stool.stage.Stage;
import net.oneandone.stool.util.Credentials;
import net.oneandone.sushi.fs.file.FileNode;
import net.oneandone.sushi.launcher.Failure;
import net.oneandone.sushi.launcher.Launcher;
import net.oneandone.sushi.util.Separator;
import net.oneandone.sushi.util.Strings;
import java.io.IOException;
import java.io.Writer;
public class Subversion extends Scm {
/** Caution, does not work for nested directories */
public static String svnCheckoutUrlOpt(FileNode dir) throws Failure {
if (dir.join(".svn").isDirectory()) {
return "svn:" + svnCheckoutUrl(dir);
} else {
return null;
}
}
private static String svnCheckoutUrl(FileNode dir) throws Failure {
Launcher launcher;
String str;
int idx;
launcher = new Launcher(dir, "svn", "info");
launcher.env("LC_ALL", "C");
str = launcher.exec();
idx = str.indexOf("URL:") + 4;
return str.substring(idx, str.indexOf("\n", idx)).trim();
}
//--
public final Credentials credentials;
public Subversion(Credentials credentials) {
super("svn @svnCredentials@ up");
this.credentials = credentials;
}
@Override
public void checkout(String url, FileNode dir, Writer dest) throws Failure {
launcher(dir.getParent(), "co", Strings.removeLeft(url, "svn:"), dir.getName()).exec(dest);
}
@Override
public boolean isCommitted(Stage stage) throws IOException {
FileNode directory;
String str;
directory = stage.getDirectory();
if (!directory.join(".svn").isDirectory()) {
return true; // artifact stage
}
str = status(directory);
return !isModified(str);
}
private String status(FileNode cwd) throws Failure {
Launcher launcher;
launcher = launcher(cwd, "status");
launcher.env("LC_ALL", "C");
return launcher.exec();
}
private static boolean isModified(String lines) {
for (String line : Separator.on("\n").split(lines)) {
if (line.trim().length() > 0) {
if (line.startsWith("X") || line.startsWith("Performing status on external item")) {
// needed for external references
} else {
return true;
}
}
}
return false;
}
private Launcher launcher(FileNode cwd, String... args) {
Launcher launcher;
launcher = new Launcher(cwd, "svn");
launcher.arg(credentials.svnArguments());
launcher.arg(args);
return launcher;
}
}
| [
"mlhartme@github.com"
] | mlhartme@github.com |
1f714cd0f96873963f8fcb7ba82c2eb5739cc611 | 30b283672504bdfc22142ecd7764ea447b129965 | /src/main/java/com/zzlhr/service/impl/ArticleServiceImpl.java | 6abefb208a99940313db5445269f0b2de0d272d0 | [] | no_license | zzlhr/myblog | 7688164248577e2b843ebc0a1807c02793edb068 | 874567fd4623d17d74c3d4b22d9dc10b967ec4b7 | refs/heads/master | 2021-01-01T17:49:38.781223 | 2018-04-26T08:37:17 | 2018-04-26T08:37:17 | 98,166,500 | 7 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,846 | java | package com.zzlhr.service.impl;
import com.zzlhr.dao.ArticleDao;
import com.zzlhr.entity.Article;
import com.zzlhr.enums.ArticleStatus;
import com.zzlhr.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* Created by 刘浩然 on 2017/9/7.
*/
@Service
public class ArticleServiceImpl implements ArticleService {
@Autowired
private ArticleDao articleDao;
@Override
public List<Article> getArticleListShow(String keyword, int page) {
if ("".equals(keyword) || keyword == null){
return articleDao.findAll(new PageRequest(page - 1, 10,
new Sort(Sort.Direction.DESC, "id"))).getContent();
}
return articleDao.findByArticleKeywordLikeAndArticleStatus(
keyword, 0,
new PageRequest(page - 1, 10,
new Sort(Sort.Direction.DESC, "id")))
.getContent();
}
@Override
public Page<Article> getArticleList(String keyword, int page) {
if ("".equals(keyword) || keyword == null){
return articleDao.findAll(new PageRequest(page - 1, 10,
new Sort(Sort.Direction.DESC, "id")));
}
return articleDao.findByArticleKeywordLike(
keyword,
new PageRequest(page - 1, 10,
new Sort(Sort.Direction.DESC, "id")));
}
@Override
public List<Article> getCommendArticle(int commend, int page) {
PageRequest pageRequest = new PageRequest(page,5);
Page<Article> articlePage = articleDao.findByArticleCommendAndArticleStatus(commend, ArticleStatus.SHOW.getCode(), pageRequest);
List<Article> articleList = articlePage.getContent();
return articleList;
}
@Override
public Page<Article> getArticleToClass(String clazz, int page) {
PageRequest pageRequest = new PageRequest(page,5);
Page<Article> result = articleDao.findByArticleClassAndArticleStatus(clazz, ArticleStatus.SHOW.getCode(), pageRequest);
// List<Article> articleList = articlePage.getContent();
return result;
}
@Override
public Article getArticleDetails(int articleId) {
return articleDao.findOne(articleId);
}
@Override
public void addArticleClick(int id, String ip) {
Article article = articleDao.findOne(id);
article.setArticleClick(article.getArticleClick() + 1);
articleDao.save(article);
}
@Override
public Article saveArticle(Article article) {
return articleDao.save(article);
}
}
| [
"2388399752@qq.com"
] | 2388399752@qq.com |
d279b6a3b4f9035ba78f904803693602a002aa6e | 30781128a435c6e7e132b6d1a36473f89b016fa7 | /app/src/main/java/com/hexi/lifehelper/base/BaseActivity.java | fb65ca4317c2b5a81f9838a10ee60cb2196125e9 | [] | no_license | PatrickStart/LifeHelper | 814f6ed6d255ea82c09567d21e68829f25ad381e | 89cad5475ef65ecb75ef1d6cdaa23da7a64c0c4c | refs/heads/master | 2021-04-09T10:23:41.451640 | 2016-08-02T06:20:02 | 2016-08-02T06:20:02 | 64,522,946 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,527 | java | package com.hexi.lifehelper.base;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
/**
* Created by he.xx on 2016/7/30.
*/
public abstract class BaseActivity extends AppCompatActivity implements View.OnClickListener {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setLayout();
loadData();
setView();
}
//设置布局
public abstract void setLayout();
//加载数据
public abstract void loadData();
//设置View
public abstract void setView();
/**
* 启动跳转
* @param c 目标Activity
* @param inId 页面载入动画
* @param outId 页面退出动画
*/
public void startActivity(Class c, int inId, int outId){
Intent intent=new Intent(this,c);
startActivity(intent);
overridePendingTransition(inId,outId);
}
/**
* 带参数传递的跳转方法
* @param c 目标Activity
* @param inId 页面载入动画
* @param outId 页面退出动画
* @param bundle 参数传递体
*/
public void startActivity(Class c, int inId, int outId,Bundle bundle){
Intent intent=new Intent(this,c);
intent.putExtras(bundle);
startActivity(intent);
overridePendingTransition(inId,outId);
}
}
| [
"he.xx9527@gmail.com"
] | he.xx9527@gmail.com |
ee25111dee75d7f934868709126cfb51ce46f052 | 08de66069805abf754913fb750422a126efa016f | /hamakko/src/main/java/com/nami/hamakko/constance/EnShisetsuShousaiKind.java | 511229d1c028f5413df7aaf9b1b534237cc281de | [] | no_license | namiheiF/springDbHeroku | 390c7042d7ee6a334b42bcf8a2994894b76108cd | 521c8d98ffb7fe32d0c866705fbda2d52af60c4f | refs/heads/master | 2022-11-11T21:58:11.186493 | 2020-07-01T08:55:15 | 2020-07-01T08:55:15 | 271,944,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package com.nami.hamakko.constance;
public enum EnShisetsuShousaiKind {
/** 全面*/
ALL("0"),
/** A面 */
A("1"),
/** B面 */
B("2");
private String code;
private EnShisetsuShousaiKind(String code){
this.code = code;
}
public String getCode(){
return code;
}
}
| [
"fujinami.yuji@jsm.co.jp"
] | fujinami.yuji@jsm.co.jp |
95684074fe25f7e27a91444054f07f523fdf4c97 | 0c26288e21673b8509d4aa657168dac5f5f28cca | /app/src/main/java/cube/ware/ui/recent/RecentSessionFragment.java | c1b6da164c65618d8f890cf1f4f53d3f6555fe62 | [
"MIT"
] | permissive | spysoos/CubeWare-Android | 94d8aa785649e0b2c0361ccb031c235e13ee3792 | 86c1bf477116225fc0848ea4a197c5e30cccb3c0 | refs/heads/master | 2020-05-13T04:01:25.992058 | 2019-03-26T12:00:31 | 2019-03-26T12:00:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,750 | java | package cube.ware.ui.recent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.common.mvp.base.BaseFragment;
import com.common.mvp.base.BasePresenter;
import com.common.mvp.rx.RxBus;
import com.common.sdk.RouterUtil;
import com.common.utils.receiver.NetworkStateReceiver;
import com.common.utils.utils.DateUtil;
import com.common.utils.utils.NetworkUtil;
import com.common.utils.utils.ScreenUtil;
import com.common.utils.utils.log.LogUtil;
import org.greenrobot.eventbus.Subscribe;
import java.util.List;
import cube.data.model.db.RecentSession;
import cube.service.CubeEngine;
import cube.service.common.CubeCallback;
import cube.service.common.CubeState;
import cube.service.common.model.CubeError;
import cube.service.recent.RecentSessionListener;
import cube.ware.AppConstants;
import cube.ware.CubeUI;
import cube.ware.R;
import cube.ware.data.model.dataModel.enmu.CubeSessionType;
import cube.ware.eventbus.CubeEvent;
import cube.ware.eventbus.UpdateRecentListAboutGroup;
import cube.ware.service.engine.CubeEngineWorkerListener;
import cube.ware.ui.chat.activity.group.GroupChatCustomization;
import cube.ware.ui.chat.activity.p2p.P2PChatCustomization;
import cube.ware.ui.recent.adapter.RecentSessionAdapter;
import cube.ware.widget.DividerItemDecoration;
import cube.ware.widget.emptyview.EmptyView;
import cube.ware.widget.emptyview.EmptyViewUtil;
/**
* Created by dth
* Des: 基于引擎最近会话的fragment,不需要应用层额外添加处理逻辑
* Date: 2018/9/28.
*/
public class RecentSessionFragment extends BaseFragment implements NetworkStateReceiver.NetworkStateChangedListener, CubeEngineWorkerListener, RecentSessionListener {
private RecyclerView mMessageRecyclerView;
private ImageView mToolbarSearch;
private ImageView mToolbarAdd;
private TextView mTitleTv;
private RelativeLayout mToolBarLayout;
private View mHeaderView;
private TextView mRecentMessageTv;// 消息大文字标题
private TextView mRecentMessageErrorTv;// 引擎连接失败标题
private ProgressBar mRecentMessagePb;
private TextView mRecentStatusTv;// 引擎连接状态标题
private RelativeLayout mRecentMessageRl;
private LinearLayout mNoNetworkTipLl; //网络未连接tips
private ImageView mOtherPlatLoginTipIv;//其他端登录文字
private TextView mOtherPlatLoginTipTv;//网络未连接文字
private LinearLayout mOtherPlatLoginTipLl;//其他端登录tips
private RecentSessionAdapter mRecentSessionAdapter;
private EmptyView mEmptyView;
private PopupWindow popupWindow;
private RelativeLayout tool_bar_layout;
@Override
protected int getContentViewId() {
return R.layout.fragment_recent;
}
@Override
protected BasePresenter createPresenter() {
return null;
}
@Override
protected void initView() {
mMessageRecyclerView = (RecyclerView) mRootView.findViewById(R.id.message_rv);
mToolbarSearch = (ImageView) mRootView.findViewById(R.id.toolbar_search);
mToolbarAdd = (ImageView) mRootView.findViewById(R.id.toolbar_add);
mTitleTv = (TextView) mRootView.findViewById(R.id.title_tv);
mToolBarLayout = (RelativeLayout) mRootView.findViewById(R.id.tool_bar_layout);
mRecentSessionAdapter = new RecentSessionAdapter(R.layout.item_recent);
mMessageRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
DividerItemDecoration itemDecoration = new DividerItemDecoration(getContext(), DividerItemDecoration.HORIZONTAL_LIST, 2, getResources().getColor(R.color.primary_divider));
mMessageRecyclerView.addItemDecoration(itemDecoration);
tool_bar_layout = ((RelativeLayout) mRootView.findViewById(R.id.tool_bar_layout));
// mHeaderView = View.inflate(getContext(),R.layout.header_recent_session_recyclerview, null);
mHeaderView = getLayoutInflater().inflate(R.layout.header_recent_session_recyclerview, (ViewGroup) mMessageRecyclerView.getParent(), false);
mRecentMessageTv = (TextView) mHeaderView.findViewById(R.id.recent_message_tv);
mRecentMessageErrorTv = (TextView) mHeaderView.findViewById(R.id.recent_message_error_tv);
mRecentMessagePb = (ProgressBar) mHeaderView.findViewById(R.id.recent_message_pb);
mRecentStatusTv = (TextView) mHeaderView.findViewById(R.id.recent_status_tv);
mRecentMessageRl = (RelativeLayout) mHeaderView.findViewById(R.id.recent_message_rl);
mNoNetworkTipLl = (LinearLayout) mHeaderView.findViewById(R.id.no_network_tip_ll);
mOtherPlatLoginTipIv = (ImageView) mHeaderView.findViewById(R.id.other_plat_login_tip_iv);
mOtherPlatLoginTipTv = (TextView) mHeaderView.findViewById(R.id.other_plat_login_tip_tv);
mOtherPlatLoginTipLl = (LinearLayout) mHeaderView.findViewById(R.id.other_plat_login_tip_ll);
mRecentMessageTv.setVisibility(View.GONE);
mRecentMessageErrorTv.setVisibility(View.GONE);
mRecentMessagePb.setVisibility(View.GONE);
mRecentStatusTv.setVisibility(View.VISIBLE);
mRecentSessionAdapter.addHeaderView(mHeaderView);//添加头视图
mMessageRecyclerView.setAdapter(mRecentSessionAdapter);
if (NetworkUtil.isNetworkConnected(getContext()) && NetworkUtil.isNetAvailable(getContext())) {
//if (!CubeSpUtil.isFirstSync(CubeSpUtil.getCubeUser().getCubeId())) {
// 设置无数据时显示内容
mEmptyView = EmptyViewUtil.EmptyViewBuilder.getInstance(getActivity()).setItemCountToShowEmptyView(1).setEmptyText(R.string.no_data_message).setShowText(true).setIconSrc(R.drawable.ic_nodata_message).setShowIcon(true).bindView(this.mMessageRecyclerView);
//}
mNoNetworkTipLl.setVisibility(View.GONE);
}
else {
//设置无网络无数据时显示内容
mEmptyView = EmptyViewUtil.EmptyViewBuilder.getInstance(getActivity()).setItemCountToShowEmptyView(1).setEmptyText(R.string.no_data_no_net_tip).setShowText(true).setIconSrc(R.drawable.ic_nodata_no_net).setShowIcon(true).bindView(this.mMessageRecyclerView);
mNoNetworkTipLl.setVisibility(View.VISIBLE);
}
}
@Override
protected void initListener() {
NetworkStateReceiver.getInstance().addNetworkStateChangedListener(this);
CubeUI.getInstance().addCubeEngineWorkerListener(this);
CubeEngine.getInstance().getRecentSessionService().addRecentSessionListener(this);
this.mNoNetworkTipLl.setOnClickListener(this);
this.mOtherPlatLoginTipLl.setOnClickListener(this);
this.mToolbarAdd.setOnClickListener(this);
this.mMessageRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int result = getScollYDistance(recyclerView);
if (result < 100) {
mTitleTv.setVisibility(View.GONE);
}
else if (result >= 100) {
mTitleTv.setVisibility(View.VISIBLE);
}
}
});
mRecentSessionAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
RecentSession recentSession = mRecentSessionAdapter.getData().get(position);
if (recentSession.sessionType == CubeSessionType.Group.getType()) {
ARouter.getInstance().build(AppConstants.Router.GroupChatActivity)
.withString(AppConstants.EXTRA_CHAT_ID, recentSession.sessionId)
.withString(AppConstants.EXTRA_CHAT_NAME, TextUtils.isEmpty(recentSession.displayName) ? recentSession.sessionId : recentSession.displayName)
.withSerializable(AppConstants.EXTRA_CHAT_CUSTOMIZATION, new GroupChatCustomization())
.navigation();
} else {
ARouter.getInstance().build(AppConstants.Router.P2PChatActivity)
.withString(AppConstants.EXTRA_CHAT_ID,recentSession.sessionId)
.withString(AppConstants.EXTRA_CHAT_NAME,TextUtils.isEmpty(recentSession.displayName) ? recentSession.sessionId : recentSession.displayName)
.withSerializable(AppConstants.EXTRA_CHAT_CUSTOMIZATION,new P2PChatCustomization())
.navigation();
}
}
});
}
@Override
public void onClick(View v) {
super.onClick(v);
switch (v.getId()) {
case R.id.toolbar_add:
showMorePopWindow();
break;
}
}
/**
* 弹出popWindow
*/
private void showMorePopWindow() {
if (popupWindow != null && popupWindow.isShowing()) {
return;
}
View popView = LayoutInflater.from(getActivity()).inflate(R.layout.main_plus_popupwindow, null);
TextView createGroupTv = (TextView) popView.findViewById(R.id.create_group_tv);
TextView addFriendTv = (TextView) popView.findViewById(R.id.add_friend_tv);
TextView scanTv = (TextView) popView.findViewById(R.id.scan_tv);
popupWindow = new PopupWindow(popView, ScreenUtil.dip2px(134), ViewGroup.LayoutParams.WRAP_CONTENT, true);
popupWindow.setTouchable(true);// 设置弹出窗体可触摸
popupWindow.setOutsideTouchable(true); // 设置点击弹出框之外的区域后,弹出框消失
popupWindow.setAnimationStyle(R.style.TitleMorePopAnimationStyle); // 设置动画
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));// 设置背景透明
ScreenUtil.setBackgroundAlpha(getActivity(), 0.9f);
popupWindow.getContentView().measure(0, 0);
int popWidth = popupWindow.getContentView().getMeasuredWidth();
int windowWidth = ScreenUtil.getDisplayWidth();
int xOff = windowWidth - popWidth - ScreenUtil.dip2px(12); // x轴的偏移量
popupWindow.showAsDropDown(tool_bar_layout, xOff, -ScreenUtil.dip2px(4)); // 设置弹出框显示的位置
popupWindow.setOnDismissListener(() -> ScreenUtil.setBackgroundAlpha(getActivity(), 1.0f));
// 添加好友
addFriendTv.setOnClickListener(view -> {
popupWindow.dismiss();
RouterUtil.navigation(getContext(), AppConstants.Router.AddFriendActivity);
getActivity().overridePendingTransition(R.anim.activity_open, 0);
});
// 创建群组
createGroupTv.setOnClickListener(view -> {
popupWindow.dismiss();
RouterUtil.navigation(AppConstants.Router.SelectContactActivity);
getActivity().overridePendingTransition(R.anim.activity_open, 0);
});
}
@Override
protected void initData() {
CubeEngine.getInstance().getRecentSessionService().queryRecentSessions(new CubeCallback<List<RecentSession>>() {
@Override
public void onSucceed(List<RecentSession> recentSessions) {
LogUtil.i("queryRecentSessions: " + recentSessions);
mRecentSessionAdapter.setNewData(recentSessions);
RxBus.getInstance().post(CubeEvent.EVENT_UNREAD_MESSAGE_SUM,calcAllUnreadCount(recentSessions));
}
@Override
public void onFailed(CubeError error) {
LogUtil.e("queryRecentSessions failed: " + error.toString());
}
});
}
private int getScollYDistance(RecyclerView recyclerView) {
LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
int position = layoutManager.findFirstVisibleItemPosition();
View firstVisiableChildView = layoutManager.findViewByPosition(position);
int itemHeight = firstVisiableChildView.getHeight();
return (position) * itemHeight - firstVisiableChildView.getTop();
}
/**
* 设置其他平台登录提示显示或隐藏
*
* @param visible
*/
public void setOtherPlatVisibility(boolean visible) {
if (visible) {
mOtherPlatLoginTipLl.setVisibility(View.VISIBLE);
}
else {
mOtherPlatLoginTipLl.setVisibility(View.GONE);
}
}
/**
* 设置其他平台登录提示字、提示图标
*
* @param tip
* @param iconSrc
*/
public void setOtherPlatTipAndIcon(String tip, int iconSrc) {
mOtherPlatLoginTipTv.setText(tip);
mOtherPlatLoginTipIv.setImageResource(iconSrc);
}
/**
* 当列表中的群组有会议产生时,更新群组头,作为提示
* @param updateRecentListAboutGroup
*/
@Subscribe
private void updateGroupIcon(UpdateRecentListAboutGroup updateRecentListAboutGroup){
if (updateRecentListAboutGroup !=null){
}
}
@Override
public void onNetworkStateChanged(boolean isNetAvailable) {
if (isNetAvailable) {
if (mEmptyView != null) {
mEmptyView.setIcon(R.drawable.ic_nodata_message);
mEmptyView.setEmptyText(CubeUI.getInstance().getContext().getString(R.string.no_data_message));
}
mNoNetworkTipLl.setVisibility(View.GONE);
RxBus.getInstance().post(CubeEvent.EVENT_REFRESH_SYSTEM_MESSAGE, true);
// queryOtherPlayLoginTip();
}
else {
if (mEmptyView != null) {
mEmptyView.setIcon(R.drawable.ic_nodata_no_net);
mEmptyView.setEmptyText(CubeUI.getInstance().getContext().getString(R.string.no_data_no_net_tip));
}
mNoNetworkTipLl.setVisibility(View.VISIBLE);
mOtherPlatLoginTipLl.setVisibility(View.GONE);
}
}
@Override
public void onStarted() {
mRecentMessageTv.setVisibility(View.GONE);
if (mRecentMessagePb != null) {
mRecentMessagePb.setVisibility(View.VISIBLE);
}
mRecentStatusTv.setVisibility(View.VISIBLE);
}
@Override
public void onStateChange(CubeState cubeState) {
LogUtil.i("CubeEngine_state -> time: " + DateUtil.formatTimestamp(System.currentTimeMillis()) + " , state: " + cubeState);
mRecentMessageTv.setVisibility(View.GONE);
mRecentMessageErrorTv.setVisibility(View.GONE);
mRecentStatusTv.setVisibility(View.VISIBLE);
if (cubeState == CubeState.START) { // 引擎正在连接
if (mRecentMessagePb != null) {
mRecentMessagePb.setVisibility(View.VISIBLE);
}
mRecentStatusTv.setText(CubeUI.getInstance().getContext().getString(R.string.connecting));
}
else if (cubeState == CubeState.PAUSE) { // 未连接
if (mRecentMessagePb != null) {
mRecentMessagePb.setVisibility(View.GONE);
}
mRecentStatusTv.setVisibility(View.GONE);
mRecentMessageTv.setVisibility(View.VISIBLE);
mRecentMessageErrorTv.setVisibility(View.VISIBLE);
}
else if (cubeState == CubeState.BUSY) { // 正在收消息
if (mRecentMessagePb != null) {
mRecentMessagePb.setVisibility(View.VISIBLE);
}
mRecentStatusTv.setText(CubeUI.getInstance().getContext().getString(R.string.receiving));
}
else {
mRecentMessageTv.setVisibility(View.VISIBLE);
if (mRecentMessagePb != null) {
mRecentMessagePb.setVisibility(View.GONE);
}
mRecentStatusTv.setVisibility(View.GONE);
}
}
@Override
public void onStopped() {
}
@Override
public void onFailed(CubeError cubeError) {
LogUtil.i("CubeEngine_onFailed -> " +cubeError.toString());
if (mRecentMessagePb != null) {
mRecentMessagePb.setVisibility(View.GONE);
if (null != mRecentStatusTv) {
mRecentStatusTv.setText(CubeUI.getInstance().getContext().getString(R.string.no_connection));
mRecentStatusTv.setVisibility(View.VISIBLE);
mRecentMessageTv.setVisibility(View.GONE);
}
}
}
@Override
public void onRecentSessionAdded(List<RecentSession> recentSessions) {
LogUtil.i("onRecentSessionAdded: ----> " + recentSessions);
}
@Override
public void onRecentSessionDeleted(List<RecentSession> recentSessions) {
mRecentSessionAdapter.getData().removeAll(recentSessions);
mRecentSessionAdapter.notifyDataSetChanged();
RxBus.getInstance().post(CubeEvent.EVENT_UNREAD_MESSAGE_SUM,calcAllUnreadCount(mRecentSessionAdapter.getData()));
}
@Override
public void onRecentSessionChanged(List<RecentSession> recentSessions) {
LogUtil.i("onRecentSessionChanged: ----> " + recentSessions);
if (recentSessions != null && recentSessions.size() > 1) {
CubeEngine.getInstance().getRecentSessionService().queryRecentSessions(new CubeCallback<List<RecentSession>>() {
@Override
public void onSucceed(List<RecentSession> recentSessions) {
mRecentSessionAdapter.replaceData(recentSessions);
RxBus.getInstance().post(CubeEvent.EVENT_UNREAD_MESSAGE_SUM,calcAllUnreadCount(recentSessions));
}
@Override
public void onFailed(CubeError error) {
}
});
} else if (recentSessions != null && recentSessions.size() == 1) {
List<RecentSession> data = mRecentSessionAdapter.getData();
RecentSession recentSession = recentSessions.get(0);
if (data.contains(recentSession)) {
data.remove(recentSession);
data.add(0,recentSession);
mRecentSessionAdapter.notifyDataSetChanged();
} else {
mRecentSessionAdapter.addData(0,recentSession);
}
RxBus.getInstance().post(CubeEvent.EVENT_UNREAD_MESSAGE_SUM,calcAllUnreadCount(data));
// ThreadUtil.request(new Runnable() {
// @Override
// public void run() {
// int allUnreadCount = CubeEngine.getInstance().getRecentSessionService().getAllUnreadCount();
// RxBus.getInstance().post(CubeEvent.EVENT_UNREAD_MESSAGE_SUM,allUnreadCount);
// }
// });
}
}
private int calcAllUnreadCount(List<RecentSession> recentSessions) {
int count = 0;
for (RecentSession recentSession : recentSessions) {
count += recentSession.unreadCount;
}
return count;
}
}
| [
"120146859@qq.com"
] | 120146859@qq.com |
3780c6a3d05338c30788e6312dc57cfad435829f | 913a9fa7e414f02b44e918ce872f378557124bdd | /src/main/java/com/company/Fixtures/AddChange.java | 07557e6c94b604ad3216299e4825e53ec6bbc764 | [] | no_license | nkauvmaalr/FitnesseDemo | 74d0ae8c6701e8d8effd2abbfec20c728c904f2f | 9712b0fe0e9cb2b6ee870f93be8baaef289df1e5 | refs/heads/main | 2023-05-05T10:37:56.364225 | 2021-05-26T08:50:49 | 2021-05-26T08:50:49 | 370,944,999 | 0 | 1 | null | 2021-05-26T08:47:48 | 2021-05-26T07:28:32 | Java | UTF-8 | Java | false | false | 1,020 | java | package com.company.Fixtures;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
public class AddChange {
private Integer totalCents = 0;
private static Map<String, Integer> COIN_VALUES = new HashMap<String, Integer>();
static {
COIN_VALUES.put("1c", 1);
COIN_VALUES.put("5c", 5);
COIN_VALUES.put("10c", 10);
COIN_VALUES.put("25c", 25);
COIN_VALUES.put("50c", 50);
COIN_VALUES.put("$1", 100);
}
public void reset() {
totalCents = 0;
}
public void set(String coin, Integer amount) {
if (!COIN_VALUES.containsKey(coin)) {
throw new IllegalArgumentException("Unknown coin type " + coin);
}
totalCents += amount * COIN_VALUES.get(coin);
}
public String get(String requestedValue) {
if ("$ total".equals(requestedValue)) {
return String.format(Locale.US, "%.2f", totalCents / 100.0);
}
return String.format("%d", totalCents);
}
}
| [
"73358495+nkauvmaalr@users.noreply.github.com"
] | 73358495+nkauvmaalr@users.noreply.github.com |
111f06068a400e96d91ad8c98af99826d1fe9220 | bc794d54ef1311d95d0c479962eb506180873375 | /keren-edu/keren-edu-core-ifaces/src/main/java/com/kerenedu/configuration/ClasseManager.java | 679b3b6528bd41edb6b05b657bb53ebcdfb1709a | [] | no_license | Teratech2018/Teratech | d1abb0f71a797181630d581cf5600c50e40c9663 | 612f1baf9636034cfa5d33a91e44bbf3a3f0a0cb | refs/heads/master | 2021-04-28T05:31:38.081955 | 2019-04-01T08:35:34 | 2019-04-01T08:35:34 | 122,177,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java |
package com.kerenedu.configuration;
import com.bekosoftware.genericmanagerlayer.core.ifaces.GenericManager;
/**
* Interface etendue par les interfaces locale et remote du manager
* @since Thu Jan 11 10:03:44 WAT 2018
*
*/
public interface ClasseManager
extends GenericManager<Classe, Long>
{
public final static String SERVICE_NAME = "ClasseManager";
}
| [
"wntchuente@gmail.com"
] | wntchuente@gmail.com |
44cfba65a2fae6f727ecba5440884f3685834745 | f930b8ce979acfed7c924c017118b291af3e8d7e | /src/main/java/com/example/demo/entity/Tip.java | 5dd3c760a55f3f78c5560ae34bd1935c3befe899 | [
"Apache-2.0"
] | permissive | nonese/LAN-Network-Security-Review-System-Based-on-Network-protect-level-2.0 | 2ac63d2e5ff12604b17699a890df158aa753098a | bf8447a66ba22591d71ae9720b883b36fad43fed | refs/heads/master | 2023-01-23T21:39:53.270141 | 2020-12-02T07:36:48 | 2020-12-02T07:36:48 | 290,750,223 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 567 | java | package com.example.demo.entity;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author Yaojiaqi
* @since 2020-11-10
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Tip implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
private String date;
private String content;
private String uuid;
private String readed;
}
| [
"nonese@cankbird.com"
] | nonese@cankbird.com |
b52ca425c8a40a22f31f094254b0c8bd7309f125 | 9edb30f886aff88a9d6bcf4e55f1e6fa1e83047e | /ui/CUPUSMobileApplication/CUPUSMobileApplication/src/main/java/org/openiot/cupus/mobile/application/MenuActivity.java | 6428bfc4abc5603a54ace661fdb0f2e37f0b2810 | [] | no_license | OpenIotOrg/openiot | 3a40e1c9a5a7d3f58f0c83cb58fb45c56b050575 | 9bc0a7ee0272b8566252aec53c858308dfc361cd | refs/heads/develop | 2023-07-07T20:15:38.704027 | 2022-10-07T02:54:30 | 2022-10-07T02:54:30 | 9,221,446 | 418 | 188 | null | 2023-02-22T00:39:31 | 2013-04-04T15:35:29 | Java | UTF-8 | Java | false | false | 1,611 | java | package org.openiot.cupus.mobile.application;
/**
* Created by kpripuzic on 1/14/14.
*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MenuActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
Button button = (Button) findViewById(R.id.button5);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MenuActivity.this,
MobileBrokerActivity.class);
startActivity(intent);
}
});
button = (Button) findViewById(R.id.button6);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MenuActivity.this,
SensorServiceActivity.class);
startActivity(intent);
}
});
button = (Button) findViewById(R.id.button7);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MenuActivity.this,
SubscriptionActivity.class);
startActivity(intent);
}
});
}
}
| [
"kikivg@gmail.com"
] | kikivg@gmail.com |
482585b80650ced4a3614bb5e4495c2710c9be86 | df1c1f300b75a56be10cda0d0ed0bd4f46143c46 | /app/src/main/java/com/watershooter/lighting/common/utils/BundleUtils.java | 55a950d188b620b121e4feab069d3b5e56074b14 | [] | no_license | DeatHades/CallingLighting | 65611511220e6359dc9e8c47c3c70d08abaace6e | 76fe262c59c3968db07ceb917908b0336abc93fc | refs/heads/master | 2020-12-08T09:30:42.627078 | 2017-04-29T03:10:31 | 2017-04-29T03:10:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,067 | java | package com.watershooter.lighting.common.utils;
import android.content.Context;
import android.os.Bundle;
import com.watershooter.lighting.common.bundle.BundleType;
import com.watershooter.lighting.common.bundle.BundleValue;
import java.io.Serializable;
import java.lang.reflect.Field;
/**
* 内存清理后数据的保存和恢复工具类
* Created by macchen on 15/4/28.
*/
public class BundleUtils {
/**
* 禁止构造方法访问
*/
private BundleUtils() {
throw new AssertionError();
}
/**
* 保存数据
*
* @return
*/
public static void save(Context mContext, Bundle outSate) {
Class<?> handlerType = mContext.getClass();
//开始注解
Field[] fields = handlerType.getDeclaredFields();
if (fields != null && fields.length > 0) {
for (Field field : fields) {
try {
BundleValue bundleValue = field.getAnnotation(BundleValue.class);
if(bundleValue==null)
continue;
field.setAccessible(true);
BundleType value = bundleValue.type();
String name = bundleValue.name();
if (name != null) {
name = field.getName();
}
LogUtils.i("BundleUtils--save--"+name+"-----"+field.get(mContext));
switch (value) {
case BOOLEAN:
outSate.putBoolean(name, field.getBoolean(mContext));
break;
case BYTE:
outSate.putByte(name, field.getByte(mContext));
break;
case DOUBLE:
outSate.putDouble(name, field.getDouble(mContext));
break;
case FLOAT:
outSate.putFloat(name, field.getFloat(mContext));
break;
case INTEGER:
outSate.putInt(name, field.getInt(mContext));
break;
case LONG:
outSate.putLong(name, field.getLong(mContext));
break;
case SERIALIZABLE:
outSate.putSerializable(name, (Serializable) field.get(mContext));
break;
case SHORT:
outSate.putShort(name, field.getShort(mContext));
break;
case STRING:
outSate.putString(name, (String) field.get(mContext));
break;
default:
break;
}
} catch (Exception e) {
LogUtils.e(field.getName() + "保存错误!");
e.printStackTrace();
}
}
}
}
/**
* 恢复数据
*
* @return
*/
public static void restore(Context mContext, Bundle savedInstanceState) {
Class<?> handlerType = mContext.getClass();
//开始注解
Field[] fields = handlerType.getDeclaredFields();
LogUtils.i("fields--length---"+fields.length);
if (fields != null && fields.length > 0) {
for (Field field : fields) {
try {
BundleValue bundleValue = field.getAnnotation(BundleValue.class);
if(bundleValue==null)
continue;
field.setAccessible(true);
BundleType value = bundleValue.type();
String name = bundleValue.name();
if (name != null) {
name = field.getName();
}
if (savedInstanceState.containsKey(name)) {
LogUtils.i("BundleUtils--restore--"+name+"-----"+field.get(mContext));
switch (value) {
case BOOLEAN:
field.setBoolean(mContext, savedInstanceState.getBoolean(name));
break;
case BYTE:
field.setByte(mContext, savedInstanceState.getByte(name));
break;
case DOUBLE:
field.setDouble(mContext, savedInstanceState.getDouble(name));
break;
case FLOAT:
field.setFloat(mContext, savedInstanceState.getFloat(name));
break;
case INTEGER:
field.setInt(mContext, savedInstanceState.getInt(name));
break;
case LONG:
field.setLong(mContext, savedInstanceState.getLong(name));
break;
case SERIALIZABLE:
field.set(mContext, savedInstanceState.getSerializable(name));
break;
case SHORT:
field.setShort(mContext, savedInstanceState.getShort(name));
break;
case STRING:
field.set(mContext, savedInstanceState.getString(name));
break;
default:
break;
}
}
} catch (Exception e) {
LogUtils.e(field.getName() + "恢复错误!");
e.printStackTrace();
}
}
}
}
}
| [
"xuwei@njbandou.com"
] | xuwei@njbandou.com |
1911f07a50aec27b148ab71a346b259dbe02004a | be3169c6835017b8979f23656b952f345bab5af6 | /zebra/layer-2/zebra-oa/src/main/java/com/bee32/zebra/oa/calendar/DiaryTag.java | 029663aa098aab36bb1f128500327a751500c404 | [] | no_license | lenik/stack | 5ca08d14a71e661f1d5007ba756eff264716f3a3 | a69e2719d56d08a410c19cc73febf0f415d8d045 | refs/heads/master | 2023-07-10T10:54:14.351577 | 2017-07-23T00:10:15 | 2017-07-23T00:12:33 | 395,319,044 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | package com.bee32.zebra.oa.calendar;
import net.bodz.lily.model.base.CoCode;
public class DiaryTag
extends CoCode<DiaryTag> {
private static final long serialVersionUID = 1L;
public DiaryTag() {
super();
}
public DiaryTag(DiaryTag parent) {
super(parent);
}
}
| [
"xjl@99jsj.com"
] | xjl@99jsj.com |
552e8c5ab937de21525f874cca65a65c26a3d723 | bd57de10e04e73583b70e1b1bc0c7cd3e47036d2 | /Nanifarfalla/src/main/java/nanifarfalla/app/controller/ProductoController.java | 2f3f9f6fea14c51b1da8f1d8a2fd8b215d952c1a | [] | no_license | CarloDelgado/NanifarfallaApp | a09b45058f80b46eeb24cd10d7b5d2cd0afa9678 | c5cbeafe2a99f4e1734ae3ff631f09bdad75260c | refs/heads/master | 2022-11-14T12:55:44.976420 | 2020-07-13T00:38:34 | 2020-07-13T00:38:34 | 279,413,597 | 1 | 0 | null | 2020-07-13T21:16:59 | 2020-07-13T21:16:59 | null | UTF-8 | Java | false | false | 4,670 | java | package nanifarfalla.app.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import nanifarfalla.app.model.Producto;
import nanifarfalla.app.service.ILineasService;
import nanifarfalla.app.service.IProductoService;
import nanifarfalla.app.util.Utileria;
@Controller
@RequestMapping("/productos")
public class ProductoController {
@Autowired
private IProductoService productoService;
@Autowired
private ILineasService serviceLineas;
@GetMapping(value = "/create")
public String crear(@ModelAttribute Producto producto, Model model) {
List<Producto> productos = productoService.buscarTodas();
model.addAttribute("productos", productos);
model.addAttribute("lineas", serviceLineas.buscarTodas());
return "productos/formProducto";
}
@GetMapping("/index")
public String mostrarIndex(Model model) {
List<Producto> productos = productoService.buscarTodas();
model.addAttribute("productos", productos);
return "productos/listProductos";
}
@RequestMapping(value = "/detalle", method = RequestMethod.GET)
public String mostrarDetalle(Model model, @RequestParam("codigo_producto") int codigo_producto) {
List<String> listaFechas = Utileria.getNextDays(4);
System.out.println("Buscamos el producto : " + codigo_producto);
model.addAttribute("producto", productoService.buscarPorId(codigo_producto));
// model.addAttribute("linea", serviceLineas.buscarPorId(codigo_linea));
model.addAttribute("productos", productoService.buscarTodas());
model.addAttribute("fechas", listaFechas);
// String tituloLinea = "Carteras";
// String estado = "disponible";
// int stock = 136;
// double precio = 34.5;
//
// model.addAttribute("linea", tituloLinea);
// model.addAttribute("estado", estado);
// model.addAttribute("stock", stock);
// model.addAttribute("precio", precio);
return "productos/detalleProducto";
}
@PostMapping(value = "/save")
public String guardar(@ModelAttribute Producto productos, BindingResult result, RedirectAttributes attributes,
@RequestParam("archivoImagen") MultipartFile multiPart, HttpServletRequest request) {
System.out.println("Recibiendo objeto productos: " + productos);
// Pendiente: Guardar el objeto producto en la BD
if (result.hasErrors()) {
System.out.println("Existen errores");
return "productos/formProducto";
}
if (!multiPart.isEmpty()) {
String nombreImagen = Utileria.guardarImagen(multiPart, request);
productos.setFoto_ruta(nombreImagen);
}
for (ObjectError error : result.getAllErrors()) {
System.out.println(error.getDefaultMessage() + " ");
}
// serviceAnuncios.guardar(productos);
System.out.println("Recibiendo objeto Productos: " + productos);
System.out.println("Elementos en la lista antes de la insersion: " + productoService.buscarTodas().size());
productoService.inserta(productos);
System.out.println("Elementos en la lista despues de la insersion: " + productoService.buscarTodas().size());
// return "anuncios/formAnuncio";
attributes.addFlashAttribute("mensaje", "El producto fue guardado");
return "redirect:/productos/index";
}
@GetMapping(value = "/indexPaginate")
public String mostrarIndexPaginado(Model model, Pageable page) {
Page<Producto> lista = productoService.buscarTodas(page);
model.addAttribute("productos", lista);
return "productos/listProductos";
}
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
}
}
| [
"joffre.hermosilla@gmail.com"
] | joffre.hermosilla@gmail.com |
be6c2744d96b3277991c8b3e2f4d31ffe714cdb6 | b5766e6df53087f975b4be7c5b68bd6f267203f6 | /common/common_utils/src/main/java/com/xunle/commonutils/MD5.java | eb8621d7e211c05d1ec67d029953b1f4f5346616 | [
"MIT"
] | permissive | Xunle1/cqupt_academy | 9d9a44969e5ecc3e951ba8ff31f69e48d6cc903b | 4646fa8518c34bf465385eeecea7210cf497c3d9 | refs/heads/master | 2023-07-30T07:42:22.729665 | 2021-09-15T17:06:03 | 2021-09-15T17:06:03 | 386,552,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,130 | java | package com.xunle.commonutils;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public final class MD5 {
public static String encrypt(String strSrc) {
try {
char hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', 'a', 'b', 'c', 'd', 'e', 'f' };
byte[] bytes = strSrc.getBytes();
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(bytes);
bytes = md.digest();
int j = bytes.length;
char[] chars = new char[j * 2];
int k = 0;
for (int i = 0; i < bytes.length; i++) {
byte b = bytes[i];
chars[k++] = hexChars[b >>> 4 & 0xf];
chars[k++] = hexChars[b & 0xf];
}
return new String(chars);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
throw new RuntimeException("MD5加密出错!!+" + e);
}
}
public static void main(String[] args) {
System.out.println(MD5.encrypt("111111"));
}
}
| [
"1601315809@qq.com"
] | 1601315809@qq.com |
73404df8440cef7f3a6309dfee5f92e892e2eff0 | f5411e3c599cc179c7573c72e0672a2aa2b88f96 | /CS151-group-project/Pit.java | 9e05ed2dcd576fc85f2780abb03e7d0c3593f765 | [] | no_license | firen777/CS151_Object_Orientation_archive | ad4d03788e75bd94425576a7898f2e245e5ae905 | 8db033e220448bb030c42701b1a6666f45d89524 | refs/heads/master | 2021-05-10T19:53:30.073280 | 2018-02-20T20:41:20 | 2018-02-20T20:41:20 | 118,170,622 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 811 | java | /**
* A helper model class for MancalaModel that stores
* number of stones in a pit.
*
* @author Eric Au
*/
public class Pit
{
private int amount;
/**
* Finds the number of stones in pits.
* @return number of stones
*/
public int getAmount()
{
return amount;
}
/**
* Add a stone to the pit.
*/
public void addStone()
{
amount++;
}
/**
* Removes all stones in pit.
* @return number of stones that was in the pit
*/
public int take()
{
int result = amount;
amount = 0;
return result;
}
/**
* Sets number of stones in pit.
* @param stones initial number to be set
*/
public void setStones(int stones)
{
amount = stones;
}
} | [
"hivemindac1995@gmail.com"
] | hivemindac1995@gmail.com |
f8bbaaf4939bf3150187a86bd48c0bc2b3b68b9c | 665a74a090a8e9dc23d53df538b24f98379bedab | /server/src/main/java/cn/keking/service/impl/CodeFilePreviewImpl.java | 7a9f9eacdb68574030eca59a51829086bbf85c44 | [
"Apache-2.0"
] | permissive | 386845154a/kkFileView | c423f78036cb9bcd2471209627973b1cc92427f3 | 97531cf7cabbc0d16d144093ab8ffbfd6d984861 | refs/heads/master | 2023-04-06T13:21:10.564188 | 2021-04-23T08:15:31 | 2021-04-23T08:15:31 | 332,701,709 | 1 | 0 | Apache-2.0 | 2021-04-23T08:15:34 | 2021-01-25T09:57:07 | null | UTF-8 | Java | false | false | 749 | java | package cn.keking.service.impl;
import cn.keking.model.FileAttribute;
import cn.keking.service.FilePreview;
import org.springframework.stereotype.Component;
import org.springframework.ui.Model;
/**
* @author kl (http://kailing.pub)
* @since 2021/2/18
*/
@Component
public class CodeFilePreviewImpl implements FilePreview {
private final SimTextFilePreviewImpl filePreviewHandle;
public CodeFilePreviewImpl(SimTextFilePreviewImpl filePreviewHandle) {
this.filePreviewHandle = filePreviewHandle;
}
@Override
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
filePreviewHandle.filePreviewHandle(url, model, fileAttribute);
return CODE_FILE_PREVIEW_PAGE;
}
}
| [
"chenkailing@xd.com"
] | chenkailing@xd.com |
69c39c944fb0db1223999e7ca8694700e6853fe0 | e9960d83b66ce8df6e504657b56b7b33446aa439 | /BroadcastReceiverSample/app/src/androidTest/java/com/example/masahironishiyama/broadcastreceiversample/ApplicationTest.java | a55904019a80454e81bdf8ddcd5c168ee436d6c5 | [] | no_license | mn200030/androidprojects | fc1c117eaf9b1719ac51798634a41ba91e443c1c | 789a2453c806f15c1b21b2017e6016f5a06b5939 | refs/heads/master | 2016-09-06T16:03:13.966710 | 2015-02-27T09:07:38 | 2015-02-27T09:07:38 | 30,452,585 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 384 | java | package com.example.masahironishiyama.broadcastreceiversample;
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);
}
} | [
"qfwrd509@gmail.com"
] | qfwrd509@gmail.com |
54a891a2a57fa535fe27d1d4051dfcfa40f036cd | 4aa90348abcb2119011728dc067afd501f275374 | /app/src/main/java/com/tencent/mm/pluginsdk/ui/tools/AppChooserUI$5.java | 707878640b18bd87fd84de382204fe5c93a43d20 | [] | no_license | jambestwick/HackWechat | 0d4ceb2d79ccddb45004ca667e9a6a984a80f0f6 | 6a34899c8bfd50d19e5a5ec36a58218598172a6b | refs/heads/master | 2022-01-27T12:48:43.446804 | 2021-12-29T10:36:30 | 2021-12-29T10:36:30 | 249,366,791 | 0 | 0 | null | 2020-03-23T07:48:32 | 2020-03-23T07:48:32 | null | UTF-8 | Java | false | false | 430 | java | package com.tencent.mm.pluginsdk.ui.tools;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
class AppChooserUI$5 implements OnDismissListener {
final /* synthetic */ AppChooserUI vwh;
AppChooserUI$5(AppChooserUI appChooserUI) {
this.vwh = appChooserUI;
}
public final void onDismiss(DialogInterface dialogInterface) {
this.vwh.finish();
}
}
| [
"malin.myemail@163.com"
] | malin.myemail@163.com |
2aefb8523d9ce5c0e212a40e5468097d0788e4bc | 87903d96ca453221c66dbbea5b9acd987f21f7d3 | /src/main/java/com/example/demo/Test.java | 5f9647750c4403891a33895b92effc3572ca43b2 | [] | no_license | GCRoots/rfidDemo | ca42723729d076e1706ae0f548752c2227ddcdda | e9af8ce2a0fe6bad8f72a60743e1be05ac26961f | refs/heads/master | 2022-10-14T03:02:36.953381 | 2019-12-17T14:56:47 | 2019-12-17T14:56:47 | 217,436,633 | 0 | 1 | null | 2022-10-04T23:53:53 | 2019-10-25T02:41:10 | Java | UTF-8 | Java | false | false | 491 | java | package com.example.demo;
/**
* @author shipengfei
* @data 19-11-23
*/
public class Test {
public static void main(String[] args) {
// String uuid = UUID.randomUUID().toString().replaceAll("-", "");
//
// System.out.println(uuid);
//
// Map<String, List<String>> map=new HashMap<>();
// List<String> s=new ArrayList<>();
// s.add("A");
// s.add("B");
// map.put(uuid,s);
// System.out.println(map.toString());
}
}
| [
"1007879951@qq.com"
] | 1007879951@qq.com |
d37f1491dc51201b17820d70d67ac4c3677113cb | a00326c0e2fc8944112589cd2ad638b278f058b9 | /src/main/java/000/144/431/CWE78_OS_Command_Injection__PropertiesFile_08.java | 2151af7ad0b75ec8b9cb77ecc83ec240576880a1 | [] | no_license | Lanhbao/Static-Testing-for-Juliet-Test-Suite | 6fd3f62713be7a084260eafa9ab221b1b9833be6 | b095b11c7cb6d4a5bb2b76181e35d6ee00e96e68 | refs/heads/master | 2020-08-24T13:34:04.004149 | 2019-10-25T09:26:00 | 2019-10-25T09:26:00 | 216,822,684 | 0 | 1 | null | 2019-11-08T09:51:54 | 2019-10-22T13:37:13 | Java | UTF-8 | Java | false | false | 5,828 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__PropertiesFile_08.java
Label Definition File: CWE78_OS_Command_Injection.label.xml
Template File: sources-sink-08.tmpl.java
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: PropertiesFile Read data from a .properties file (in property named data)
* GoodSource: A hardcoded string
* BadSink: exec dynamic command execution with Runtime.getRuntime().exec()
* Flow Variant: 08 Control flow: if(privateReturnsTrue()) and if(privateReturnsFalse())
*
* */
import java.util.Properties;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.logging.Level;
public class CWE78_OS_Command_Injection__PropertiesFile_08 extends AbstractTestCase
{
/* The methods below always return the same value, so a tool
* should be able to figure out that every call to these
* methods will return true or return false.
*/
private boolean privateReturnsTrue()
{
return true;
}
private boolean privateReturnsFalse()
{
return false;
}
/* uses badsource and badsink */
public void bad() throws Throwable
{
String data;
if (privateReturnsTrue())
{
data = ""; /* Initialize data */
/* retrieve the property */
{
Properties properties = new Properties();
FileInputStream streamFileInput = null;
try
{
streamFileInput = new FileInputStream("../common/config.properties");
properties.load(streamFileInput);
/* POTENTIAL FLAW: Read data from a .properties file */
data = properties.getProperty("data");
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO);
}
finally
{
/* Close stream reading object */
try
{
if (streamFileInput != null)
{
streamFileInput.close();
}
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error closing FileInputStream", exceptIO);
}
}
}
}
else
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run
* but ensure data is inititialized before the Sink to avoid compiler errors */
data = null;
}
String osCommand;
if(System.getProperty("os.name").toLowerCase().indexOf("win") >= 0)
{
/* running on Windows */
osCommand = "c:\\WINDOWS\\SYSTEM32\\cmd.exe /c dir ";
}
else
{
/* running on non-Windows */
osCommand = "/bin/ls ";
}
/* POTENTIAL FLAW: command injection */
Process process = Runtime.getRuntime().exec(osCommand + data);
process.waitFor();
}
/* goodG2B1() - use goodsource and badsink by changing privateReturnsTrue() to privateReturnsFalse() */
private void goodG2B1() throws Throwable
{
String data;
if (privateReturnsFalse())
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run
* but ensure data is inititialized before the Sink to avoid compiler errors */
data = null;
}
else
{
/* FIX: Use a hardcoded string */
data = "foo";
}
String osCommand;
if(System.getProperty("os.name").toLowerCase().indexOf("win") >= 0)
{
/* running on Windows */
osCommand = "c:\\WINDOWS\\SYSTEM32\\cmd.exe /c dir ";
}
else
{
/* running on non-Windows */
osCommand = "/bin/ls ";
}
/* POTENTIAL FLAW: command injection */
Process process = Runtime.getRuntime().exec(osCommand + data);
process.waitFor();
}
/* goodG2B2() - use goodsource and badsink by reversing statements in if */
private void goodG2B2() throws Throwable
{
String data;
if (privateReturnsTrue())
{
/* FIX: Use a hardcoded string */
data = "foo";
}
else
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run
* but ensure data is inititialized before the Sink to avoid compiler errors */
data = null;
}
String osCommand;
if(System.getProperty("os.name").toLowerCase().indexOf("win") >= 0)
{
/* running on Windows */
osCommand = "c:\\WINDOWS\\SYSTEM32\\cmd.exe /c dir ";
}
else
{
/* running on non-Windows */
osCommand = "/bin/ls ";
}
/* POTENTIAL FLAW: command injection */
Process process = Runtime.getRuntime().exec(osCommand + data);
process.waitFor();
}
public void good() throws Throwable
{
goodG2B1();
goodG2B2();
}
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
| [
"anhtluet12@gmail.com"
] | anhtluet12@gmail.com |
09017774eeaecff480862c63441c2e729b777363 | a2f1216bdead100c8a2b9d721c3302aaf4eda95a | /app/src/main/java/com/exoplayer2demo/MainActivity.java | b6597fda65a1199a3ab0ed135f0a0dfbb8884432 | [] | no_license | ankitPagalGuy/Exoplayer2demo | 2b5b872d074a19cb2476e42db473cd35ae8b3c42 | 6bcc68be02a247df2adb9a74c6466a5f91487b41 | refs/heads/master | 2020-07-21T23:34:19.862366 | 2016-11-15T17:48:23 | 2016-11-15T17:48:23 | 73,839,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | package com.exoplayer2demo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"ankit.choudhary@pagalguy.com"
] | ankit.choudhary@pagalguy.com |
7406d04e021f8336a040a6601733b125d4c14a4e | fa8966513e17d4746cff7accba7e65eb726ff774 | /workplace/MusicProject-V2/app/src/main/java/com/itheima/musicproject/util/AlbumDrawableUtil.java | 6c6d30ac95cc760167d54ed011ede18470476090 | [] | no_license | StardustJK/emotional-based-music-recommendation | 45ccc0254ee2b692918a99d5127f0675f7b8fb65 | 8c6c52e55fc57fb466cdf8e6c192ed82b9914703 | refs/heads/master | 2020-04-26T22:11:12.463914 | 2019-09-09T14:23:00 | 2019-09-09T14:23:00 | 173,864,202 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,657 | java | package com.itheima.musicproject.util;
import android.animation.ValueAnimator;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.view.animation.AccelerateInterpolator;
/**
* Created by smile on 2018/6/12.
*/
public class AlbumDrawableUtil {
private static final int INDEX_BACKGROUND = 0;
private static final int INDEX_FOREGROUND = 1;
private static final int DEFAULT_DURATION_ANIMATION = 300;
private final LayerDrawable layerDrawable;
private ValueAnimator animator;
public AlbumDrawableUtil(Drawable backgroundDrawable, Drawable foregroundDrawable) {
Drawable[] drawables = new Drawable[2];
drawables[INDEX_BACKGROUND] = backgroundDrawable;
drawables[INDEX_FOREGROUND] = foregroundDrawable;
layerDrawable = new LayerDrawable(drawables);
initAnimation();
}
private void initAnimation() {
animator = ValueAnimator.ofFloat(0f, 255.0f);
animator.setDuration(DEFAULT_DURATION_ANIMATION);
animator.setInterpolator(new AccelerateInterpolator());
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float foregroundAlpha = (float)animation.getAnimatedValue();
//前景慢慢变的不透明
layerDrawable.getDrawable(INDEX_FOREGROUND).setAlpha((int) foregroundAlpha);
}
});
}
public Drawable getDrawable() {
return layerDrawable;
}
public void start() {
animator.start();
}
}
| [
"1115159016@qq.com"
] | 1115159016@qq.com |
1665c9da7b3fa2727a804b8e76dffc0fb41e9c31 | 1692d40430e4409f79abb7739e97dd7d0c0662a0 | /wp-common/src/main/java/com/zhiliao/wpserver/utils/WDWUtil.java | dadab79a0061fdaf589ae9b0ed21a4c9c6fab3b3 | [] | no_license | OnlyIsssilence/wisdom-park-server | 382e2c775b3fb0a3c3501dd8649229098e05a654 | 04dccc3e2cb494f10b26332538afe7600c50e875 | refs/heads/master | 2022-07-22T19:47:48.227768 | 2019-07-10T17:03:42 | 2019-07-10T17:03:42 | 195,855,411 | 0 | 0 | null | 2022-06-21T01:25:38 | 2019-07-08T17:12:24 | Java | UTF-8 | Java | false | false | 544 | java | package com.zhiliao.wpserver.utils;
/**
* Copyright 2019 OnlyIssilence, Inc. All rights reserved.
*
* @Author: MuYa
* @Date: 2019/7/9
* @Time: 0:06
* @Desc:
*/
public class WDWUtil {
// @描述:是否是2003的excel,返回true是2003
public static boolean isExcel2003(String filePath) {
return filePath.matches("^.+\\.(?i)(xls)$");
}
//@描述:是否是2007的excel,返回true是2007
public static boolean isExcel2007(String filePath) {
return filePath.matches("^.+\\.(?i)(xlsx)$");
}
}
| [
"zhangmq@re.netease.com"
] | zhangmq@re.netease.com |
608d6b65fc7067d3ec4361d1f8b6b17f950cbbb8 | 585f37fccd36f2ea4bf80daa59e466c1e260f210 | /Battleship/src/main/java/edu/neu/ccs/cs5004/model/ship/BattleShip.java | 8ac4a81c6bf745085eb137c2d8f50a1454cb7c74 | [] | no_license | Sakamono/Object-Oriented-Design | 8914897092bf447f19ea32a1650aaa4ce93706d6 | 2671d3831b2cc07d99ce7e2e4ae0133793207586 | refs/heads/master | 2020-04-08T22:13:07.397383 | 2018-11-30T16:11:39 | 2018-11-30T16:11:39 | 159,774,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 971 | java | package edu.neu.ccs.cs5004.model.ship;
/**
* Represents a BattleShip.
* Where size is the number of cells which is greater than 0 and less or equal to 4, and
* number of hit cells is the number of cells that were hit, which is greater or equal to 0
* and less or equal to size
*/
public class BattleShip extends AbstractShip {
private static final Integer CELL_OCCUPY = 4;
private static final Integer UN_HIT_SHIP_CELL = 0;
/**
* Creates a BattleShip with fixed size and zero hit cell.
*/
BattleShip() {
super(CELL_OCCUPY, UN_HIT_SHIP_CELL);
}
@Override
public String toString() {
return "BattleShip{"
+ "size=" + this.getSize()
+ ", hitCell=" + this.getHitCell()
+ '}';
}
@Override
public boolean equals(Object object) {
return super.equals(object);
}
@Override
public int hashCode() {
return super.hashCode();
}
@Override
public String getName() {
return "BattleShip";
}
}
| [
"zhang.xiaoyu1@husky.neu.edu"
] | zhang.xiaoyu1@husky.neu.edu |
f023e16f0b70c18a4a6f22fdf731be4e9d36771d | 0febab7bd73dfd280cec0fdc41ae00447637d3d0 | /src/main/java/io/choerodon/devops/app/service/impl/SonarServiceImpl.java | a953746280256bd7dddf7eac5f8324e5bc76a2ce | [] | no_license | pologood/devops-service | 57180be39bf245419a4d3b559bf0ffe121c3bbee | 7ba911b0a2a08144a58267bbacce9d899b634c83 | refs/heads/master | 2020-06-10T21:17:41.504799 | 2019-06-25T09:35:53 | 2019-06-25T09:35:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 753 | java | package io.choerodon.devops.app.service.impl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import io.choerodon.devops.api.dto.SonarInfoDTO;
import io.choerodon.devops.app.service.SonarService;
/**
* Creator: ChangpingShi0213@gmail.com
* Date: 16:10 2019/5/8
* Description:
*/
@Component
public class SonarServiceImpl implements SonarService {
@Value("${services.sonarqube.username:}")
private String userName;
@Value("${services.sonarqube.password:}")
private String password;
@Value("${services.sonarqube.url:}")
private String url;
@Override
public SonarInfoDTO getSonarInfo() {
return new SonarInfoDTO(userName, password, url);
}
}
| [
"changpingshi0213@gmail.com"
] | changpingshi0213@gmail.com |
59be493d113b6841b413eed1b0e9bf9eebd42cbe | 24af3c20a585b8a2a0bfee84e4f5fea462777914 | /Visitorswebsites/main/java/com/Visitorswebsite/service/VisitorsServlet.java | 4acccc4010a06b138bfc73cac0379b6e064cccb9 | [] | no_license | Evanslisa/project | 383021f92b97f7bbd4afffb1386bf485bae28061 | 275a802148c9d7a954d0324fb79bd1be4700d631 | refs/heads/master | 2020-04-17T15:02:43.372740 | 2016-09-07T18:47:38 | 2016-09-07T18:47:38 | 67,540,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,493 | java | package com.Visitorswebsite.service;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.Visitorswebsite.DaoImp.VisitorsDaoImp;
import com.Visitorswebsite.model.Visitors;
@WebServlet("/VisitorsServlet")
public class VisitorsServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@SuppressWarnings("unused")
private static final String sql = null;
Connection conn=null;
PreparedStatement pstmt=null;
int inserted=0;
public void destroy() {
System.out.println("Servlet destroyed...");
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out=response.getWriter();
try {
Visitors books=new Visitors();
books.setName(request.getParameter("name"));
books.setDis(request.getParameter("dis"));
books.setTelephone(request.getParameter("telephone"));
books.setIdnumber(request.getParameter("idnumber"));
books.setGender(request.getParameter("gender"));
books.setAddress(request.getParameter("address"));
books.setEmailAddress(request.getParameter("emailAddress"));
VisitorsDaoImp book=new VisitorsDaoImp();
book.savevisitor(books);
// try {
// conn=ConnectionJDBCFactory.getInstance().getConnection();
// String sql="select NAME, DISCRIPTION, TELEPHONE, IDNUMBER, GENDER, ADDRESS, EMAILADDRESS, TIME from visitors where NAME=? and DISCRIPTION=? ";
// pstmt=conn.prepareStatement(sql);
// ResultSet rs=pstmt.executeQuery();
// if(rs.next()){
// out.println("Your record is saved in the database....");
// }else {
// out.println("THE RECORD YOURE TRYING TO SUBMIT DO EXIST IN THE DATABASE PLEASE TRY A NEW REGISTRATION.....");
//
// }
// } catch (Exception e) {
// System.out.println("Error:" + e.getMessage());
//
// }
if(book.equals("")){
out.println("Your record is not saved in the database....");
}else {
out.println("Your record is saved in the database....");
}
} catch (Exception e) {
System.out.println("Error:" + e.getMessage());
}
}
}
| [
"lisa@lisah"
] | lisa@lisah |
7ab2a9d447ceccd6b22cffeed651eedeb206c516 | 05925b128b259b949255cccdb85304aaf3373481 | /src/com/twu/tictactoe/strategies/Strategy.java | c21552e6d46e517c45d02ba41dfeca88ee2fc3cb | [] | no_license | ajablonski/TWU-tictactoe | e2174e60d0415694757d4c89417bfa33dcbfcba4 | 947bd889a9384de7279cdebf54a63e901fb9a2d9 | refs/heads/master | 2021-01-22T04:41:01.807000 | 2014-08-03T22:52:09 | 2014-08-03T22:52:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package com.twu.tictactoe.strategies;
public interface Strategy {
public boolean canBeUsed();
public int getNextSquare();
}
| [
"ajablons@thoughtworks.com"
] | ajablons@thoughtworks.com |
54be83efa3c94d8ae406de0f3c227ec2c7b3c106 | e3c4870c8e8192df2c5735b0c27f51c22e059720 | /src/sun/nio/fs/WindowsPathType.java | 670e886a5aa6c1607e6ae66de42151502ef89b6d | [] | no_license | xiangtch/Java | fec461aee7fd1dfd71dd21a482a75022ce35af9d | 64440428d9af03779ba96b120dbb4503c83283b1 | refs/heads/master | 2020-07-14T01:23:46.298973 | 2019-08-29T17:49:18 | 2019-08-29T17:49:18 | 205,199,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | package sun.nio.fs;
enum WindowsPathType
{
ABSOLUTE, UNC, RELATIVE, DIRECTORY_RELATIVE, DRIVE_RELATIVE;
private WindowsPathType() {}
}
/* Location: E:\java_source\rt.jar!\sun\nio\fs\WindowsPathType.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 0.7.1
*/ | [
"imsmallmouse@gmail"
] | imsmallmouse@gmail |
675a438ccd55e448478a664bfac3d64c6907105a | 6b87c990a0f1a16321a5dfdd8162a0076cb774d6 | /usct/app/src/main/java/com/frico/usct/widget/gridpager/ViewPagerAdapter.java | 0997d8f1d0e9de74bb9056532410ed03ecaf84df | [] | no_license | ltg263/usct | bb3bef375551e82f6f1aae54eabda51aacb53bbd | 0fd2c9008d2bfcdf8d4beaefed2afe78747cad2c | refs/heads/master | 2021-03-25T14:32:56.423659 | 2020-03-16T06:35:24 | 2020-03-16T06:35:24 | 247,626,547 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 990 | java | package com.frico.usct.widget.gridpager;
import androidx.viewpager.widget.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
/**
* Created on 2018/9/12.
*/
public class ViewPagerAdapter<T extends View> extends PagerAdapter {
private List<T> mViewList;
public ViewPagerAdapter(List<T> mViewList) {
this.mViewList = mViewList;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView(mViewList.get(position));
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
container.addView(mViewList.get(position));
return (mViewList.get(position));
}
@Override
public int getCount() {
if (mViewList == null)
return 0;
return mViewList.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
} | [
"ltg263@126.com"
] | ltg263@126.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.