id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
a0fc56ed-b1f3-417a-aa6f-e57fc18669d3 | public String getInfoPuntiRaccolta() {
return infoPuntiRaccolta;
} |
a37c2557-5291-4535-a66f-a161463fc799 | public void setInfoPuntiRaccolta(String infoPuntiRaccolta) {
this.infoPuntiRaccolta = infoPuntiRaccolta;
} |
ed694ebc-854c-4013-b01f-04d0f39daa99 | public String getName() {
return name;
} |
29468815-cd92-4944-8071-43ec133cf676 | public void setName(String name) {
this.name = name;
} |
ad312f2e-303a-4b3e-b291-9f057af4fb0e | public String getDescription() {
return description;
} |
7dd01bab-9df0-4fc7-95e5-512562701136 | public void setDescription(String description) {
this.description = description;
} |
37a3fad5-c073-43f2-85b0-c5988e2815ab | public double getLat() {
return lat;
} |
08df84e5-dc4d-45ce-98f0-16c221e63123 | public void setLat(double lat) {
this.lat = lat;
} |
001e57ca-fadf-4aa0-8388-ec531d5bd5a9 | public double getLon() {
return lon;
} |
2bc4ea17-1cd3-4f19-b2f6-470cff7bf100 | public void setLon(double lon) {
this.lon = lon;
} |
6e066daf-6cf4-4ca7-a53d-7e302de6486a | public static Map<String,Collection<KMLData>> readIsole() {
Multimap<String, KMLData> multiResult = ArrayListMultimap.create();
final Kml kml = Kml.unmarshal(new File("src/main/resources/isole.kml"));
final Document document = (Document)kml.getFeature();
System.out.println(document.getName());
List<Fea... |
101de8a2-b4d1-4ce8-aace-220f62b7dd4c | public static Map<String,Collection<KMLData>> readCRM() {
Multimap<String, KMLData> multiResult = ArrayListMultimap.create();
final Kml kml = Kml.unmarshal(new File("src/main/resources/crm.kml"));
final Document document = (Document)kml.getFeature();
System.out.println(document.getName());
List<Feature... |
fdebeecb-7b25-40eb-9020-3a86a1722c41 | @Test
public void testIsole() throws Exception {
SQLQueries q = new SQLQueries();
List<Aree> aree = q.getAree();
ProfiloUtente pu = new ProfiloUtente();
pu.setUtenza("utenza domestica");
for (Aree a : aree) {
if (a.getComune() == null || a.getComune().isEmpty()) {
continue;
}
System.err.print... |
de9ab180-546b-4df7-92fa-e0344ed04cbd | public static void main(String[] args) throws IOException, InterruptedException {
// Start Program From Here.
// Menu Options and Choices to Pick From.
int choice = -1;
System.out.println(".---------------------------------------.");
System.out.println("| Distributed Computing - Project 1 |");
System.ou... |
ce00c0c4-eb64-42c8-86b0-9513cae6d136 | public static void p(Object x){
System.out.println(x);
} |
28da6156-0379-4c35-822d-8ad5282ae1de | public Client(String routerIP, int port){
_routerIP = routerIP;
_portNum = port;
} |
4cb755ab-e006-4241-929e-d2bd3f4bb759 | public void run(){
try{
connect();
Message x = new Message();
x.readFileIntoData("pic.jpg");
x.setDestination("10.0.0.5");
x.setType(2);
_out.writeObject(x);
Message n = new Message();
n = (Message)_in.readObject();
@SuppressWarnings("unused")
int q = 10;
}catch(Exception ex){
log(e... |
de96c67a-469d-4d4a-a148-c3db2c0f4945 | public boolean connect() throws UnknownHostException, IOException{
_socket = new Socket(_routerIP, _portNum);
_out = new ObjectOutputStream(_socket.getOutputStream());
_in = new ObjectInputStream(_socket.getInputStream());
return true;
} |
99ce7309-93aa-4520-8e36-8a9de8a5cb2e | public static void log(String x){
System.out.println(x);
} |
a9e1769e-6874-4974-991a-5730c1dbb094 | public Router(int port, int numOfRowsInTable){
_port = port;
_numOfRowsInTable = numOfRowsInTable;
} |
49712ab4-1a09-456e-89b1-365cb1ea2d89 | public void run(){
RTable = new ArrayList<Connection>();
boolean running = true;
try{
Socket newSocket = null;
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(_port);
}
catch (IOException e) {
return;
}
while (running == true)
{
try {
newSocket ... |
e802b1fc-95ec-4fe1-b670-7026f2e86f6e | public void removeClosedConnections(){
for(Connection c : RTable){
if(!c.isConnected())
RTable.remove(c);
}
} |
b69cc95e-aed7-47eb-864c-ab70aaf1b7d6 | public int findIndex(String addr){
for(int i = 0; i < RTable.size(); i++){
if(RTable.get(i).getAddr().equals(addr) && RTable.get(i).isConnected())
return i;
}
return -1;
} |
b25c157c-1764-4ab0-85e2-6a15890fbd13 | public Message(){
} |
86b1b1e9-d39a-44df-b2e7-226505ec7e05 | public Message(int type, String destination, String myIP, String method, Object data, Object dataType){
setType(type);
setDestination(destination);
setMethod(method);
setDataType(dataType);
setData(data);
setMyIP(myIP);
if(dataType == null)
_dataType = data.getClass();
else
_dataType = dataType;
... |
00549845-88ce-40ff-acce-100fcbdc8cfb | public boolean readFileIntoData(String filePath){
try {
Path path = Paths.get(filePath);
setData(Files.readAllBytes(path));
return true;
}
catch(Exception ex) {
System.out.print(ex.toString());
return false;
}
} |
f14d3464-964c-429a-8b9a-2c329b4a6d26 | public boolean writeFileFromData(String filePath){
try {
FileOutputStream outputStream =
new FileOutputStream(filePath);
outputStream.write((byte[])getData(false));
outputStream.close();
return true;
}
catch(Exception ex) {
Syst... |
ddff6ef0-49f8-4096-92cf-ba92440978b7 | private byte[] compress(byte[] data) throws IOException {
Deflater deflater = new Deflater();
deflater.setLevel(Deflater.BEST_COMPRESSION);
deflater.setInput(data);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(data.length);
deflater.finish();
byte[] buffer = new byte[1024];
while (!... |
c3b4088f-113d-4760-bbc2-6f633506d6df | private static byte[] decompress(byte[] data) throws IOException, DataFormatException {
Inflater inflater = new Inflater();
inflater.setInput(data);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(data.length);
byte[] buffer = new byte[1024];
while (!inflater.finished()) {
int count =... |
66fac807-d14b-4991-b86b-2890b8e62326 | public int getDataLength(){
return _data.length;
} |
843c0921-542d-4b2d-b06e-da736c436386 | public boolean setData(Object data){
try{
if(data.getClass().equals(byte[].class)){
_data = compress((byte[])data);
}else{
ByteArrayOutputStream b = new ByteArrayOutputStream();
ObjectOutputStream o = new ObjectOutputStream(b);
o.writeObject(data);
_data = compress(b.toByteArray());
}
... |
e815ea2e-d375-4b2b-97f4-4030bc8d1a69 | public Object getData(boolean asObject){
try{
if(asObject)
return new ObjectInputStream(new ByteArrayInputStream(decompress(_data))).readObject();
else
return decompress(_data);
}catch(Exception ex){
return false;
}
} |
20b10ad5-e361-49a3-8c43-ab279173e392 | public void setMyIP(String myIP){
_myIP = myIP;
} |
268df32d-7d7c-4123-8ca0-2804d34f7fb8 | public String getMyIP(){
return _myIP;
} |
bb6e9b24-142a-4d1f-8725-abad357cc2fb | public void setDataType(Object dataType){
_dataType = dataType;
} |
d6be1417-5f06-483c-bc54-38aee367a97f | public Object getDataType(){
return _dataType;
} |
34a81fb5-272c-4ce9-a283-e2764c531db9 | public void setMethod(String method){
_method = method;
} |
004c846a-54cb-4edf-b733-e105b74ec37b | public String getMethod(){
return _method;
} |
4589abc1-634f-43d4-af3b-aa14befaf23c | public void setType(int type){
_type = type;
} |
0bade7ec-d9f2-44d9-967a-9940102f3396 | public int getType(){
return _type;
} |
38a02e2d-6cc6-41bf-8277-d577e1fe13fd | public void setDestination(String destination){
_destinationIP = destination;
} |
bf8e5f98-0ba6-4f5f-ab24-b6b6b5bcfe7f | public String getDestination(){
return _destinationIP;
} |
3c2b26eb-f453-4d72-ae9d-fe9b1f2bede2 | public Server(String routerIP, int port){
_routerIP = routerIP;
_portNum = port;
} |
f06cd213-9b30-4473-90ca-faed61b41e94 | public void run(){
try{
connect();
while(!_kill){
Message msg = (Message)_in.readObject();
if(msg.getDataLength() > 0){
msg.writeFileFromData("newPic.jpg");
}
Message complete = new Message();
complete.done = true;
_out.writeObject(complete);
}
}catch(Exception ex){
log(ex.t... |
e6b5b416-f4fb-4684-93de-2f70a411488c | public boolean connect() throws UnknownHostException, IOException{
_socket = new Socket(_routerIP, _portNum);
_out = new ObjectOutputStream(_socket.getOutputStream());
_in = new ObjectInputStream(_socket.getInputStream());
Message c = new Message();
c.setType(1);
_out.writeObject(c);
return true;
} |
3f84f002-f649-4c98-a1f3-a8f29406f06a | public static void log(String x){
System.out.println(x);
} |
fe65346e-c4ee-4d7f-9444-0aeb8e4cb033 | public Connection(Socket socket, String addr){
setSocket(socket);
setAddr(addr);
} |
936acb31-81bd-4e77-8e69-a651ee887aa3 | public void setType(String type){
_type = type;
} |
075710ec-050a-430c-948d-630b247b650a | public String getType(){
return _type;
} |
aaa3e896-33f4-4727-b537-5e7ab2d8bb62 | public void setWaiting(boolean waiting){
_isWaiting = waiting;
} |
182488a6-a845-47b9-a9cf-ebee3809dfcc | public boolean getWaiting(){
return _isWaiting;
} |
32e9e5ee-46d2-4240-b9a3-81432c6c57b7 | public void setSocket(Socket socket){
_socket = (socket.isConnected() ? socket:null);
} |
02e1a216-55a1-4bda-8d8b-ac23dd99829d | public Socket getSocket(){
return (_socket == null ? null:(_socket.isConnected() ? _socket:null));
} |
2129a3fd-8562-4467-ba38-b9e1cb298800 | public void setAddr(String addr){
_addr = addr;
} |
abea0d69-5510-4901-9105-8c983db991ed | public String getAddr(){
return _addr;
} |
f14ace9e-31f7-47af-bd23-4ab07fb57722 | public boolean isConnected(){
return (_socket == null ? false:(_socket.isConnected() ? true:false));
} |
fd115535-5278-4ee8-9760-02ba9ad857b1 | public SocketClient(){
} |
03639a6e-6113-4f58-acf4-509e33fdbcd5 | public String RunServer() {
try{
Server ser = new Server("10.0.0.16", 5555);
ser.start();
System.out.println("| Running... ");
//This is the reporting and terminating means of the thread.
//._report is a filed that the Thread post messages to and
//._message is an error where ._flag indicates if t... |
1413f714-086f-4c98-97d8-92d42b84bb8e | public String RunClient() {
try{
Client cli = new Client("l3lawns.com", 5555);
cli.start();
//This is the reporting and terminating means of the thread.
//._report is a filed that the Thread post messages to and
//._message is an error where ._flag indicates if there is
// an error/
cli.join... |
93c4004d-3cfb-48ad-a97c-25b138d782aa | public String RunServerRouter() {
try{
//Starts a Thread Class ServerRouter.
Router router = new Router(5555, 100);
router.start();
//This is the reporting and terminating means of the thread.
//._report is a filed that the Thread post messages to and
//._message is an error where ._flag indicat... |
db5ac5d7-e5b0-4161-9a0e-4f80bddba20d | public RouterThread(Socket socket, ArrayList<Connection> RTable, int index) throws IOException, ClassNotFoundException{
_RTable = RTable;
_responseMessage = new Message();
if(index == -1){
_RTable.add(new Connection(socket, socket.getInetAddress().getHostAddress()));
_current = _RTable.get(_RTable.size()-1)... |
dfcb475f-5f76-40ca-9c9c-d511d5bde075 | public void run(){
try{
ObjectOutputStream outTo1 = new ObjectOutputStream(_current.getSocket().getOutputStream());
ObjectInputStream inFrom1 = new ObjectInputStream(_current.getSocket().getInputStream());
_message = (Message)inFrom1.readObject();
if(_message.getType() == 1)
serverRun(outTo1, inFrom... |
70fbd697-bb20-40b5-9c78-b3127be2b758 | public void serverRun(ObjectOutputStream outTo1, ObjectInputStream inFrom1) throws IOException{
_outToServer = outTo1;
_inFromServer = inFrom1;
_current.setWaiting(true);
_current.setType("SERVER");
_current._inFromServer = _inFromServer;
_current._outToServer = _outToServer;
} |
68ba1a76-55cf-414e-aad8-1d7b6e8e6da3 | public void clientRun(ObjectOutputStream outTo1, ObjectInputStream inFrom1) throws InterruptedException, IOException, ClassNotFoundException{
_outToClient = outTo1;
_inFromClient = inFrom1;
int index;
while((index = findConnectionIndex(_message.getDestination())) == -1){
Thread.sleep(100);
}
while(... |
8683b238-a732-49ad-b391-c20e0f00ae20 | public int findConnectionIndex(String addr){
for(int i = 0; i < _RTable.size(); i++){
if(_RTable.get(i).getAddr().equals(addr) && _RTable.get(i).isConnected())
return i;
}
return -1;
} |
e34f0fa1-a612-4d13-952c-3af052d6b0f9 | public QueryResult<OrderedRows<String, String, byte[]>> query() {
IndexedSlicesQuery<String, String, byte[]> indexedSlicesQuery =
HFactory.createIndexedSlicesQuery(this.getKeyspace(), StringSerializer.get(), StringSerializer.get(), BytesArraySerializer.get());
indexedSlicesQuery.setColumnFa... |
c97ba4b9-3fd7-49e4-83f5-c429343b82a4 | public List<Object> doTest() {
ResultStatus result = query();
if ( result != null) {
return printToLog(result);
}
return null;
} |
7fb95c6e-ce92-4a66-8cdf-ea0a5fad6ab4 | public static void main( String[] args ) {
DemoQuerySecondaryIndexRawBytes test = new DemoQuerySecondaryIndexRawBytes();
test.init();
test.doTest();
test.treminate();
} |
ff46f56f-2887-49a7-9ac6-ae728eeccc00 | public Map<String, String> buildCustomerMap (String firstName, String lastName) {
Map<String, String> customer = new HashMap<String, String>();
customer.put(DEF_COL_FIRST_NAME, firstName);
customer.put(DEF_COL_LAST_NAME, lastName);
return customer;
} |
071a9708-ec64-4c7f-8100-520d86809069 | public void createKeyspace() {
createKeyspace(DEF_LOCALHOST_ID, DEF_CLUSTER, DEF_KEYSPACE_NAME, DEF_USER_CF_NAME);
} |
ecb76a40-0e1a-47dc-b4f9-4851a99b04ab | public void createKeyspace(String strHostID, String clusterName, String keyspaceName, String cfName) {
clusterKeyspaceTest = HFactory.getOrCreateCluster(clusterName, strHostID);
System.out.println("Cluster instantiated");
customerCFDef = HFactory.createColumnFamilyDefinition(keyspaceName, cfName... |
bdac35af-c4c4-4d6c-b91d-8a26c2654baf | public String dropKeyspace () {
System.out.println("Drop Keyspace " + DEF_KEYSPACE_NAME );
String retCode = clusterKeyspaceTest.dropKeyspace(DEF_KEYSPACE_NAME, true);
System.out.println("Drop Keyspace return " + retCode );
return retCode;
} |
55d8d4ba-58ce-4fc0-b9a7-d208bb32fb98 | public void update(String key, String firstName, String lastName) {
ColumnFamilyUpdater<String, String> updater = customerCFTemplate.createUpdater(key);
updater.setString(DEF_COL_FIRST_NAME, firstName);
updater.setString(DEF_COL_LAST_NAME, lastName);
try {
customerCFTemplate.update(updater);
... |
33ea98e1-cf49-4fd7-ae9a-c873ef2a1681 | public void update(String key, Map<String, String> customer) {
if (customer==null) {
return ;
}
ColumnFamilyUpdater<String, String> updater = customerCFTemplate.createUpdater(key);
updater.setString(DEF_COL_FIRST_NAME, customer.get(DEF_COL_FIRST_NAME));
updater.setString(DEF_COL_LAST_NAME, custom... |
60e1a5e1-b5d1-4cbd-9b98-c6b80abadfd5 | public void read(String key) {
try {
ColumnFamilyResult<String, String> result = customerCFTemplate.queryColumns(key);
System.out.println("User: " + result.getString(DEF_COL_FIRST_NAME) + " " + result.getString(DEF_COL_LAST_NAME));
} catch (HectorException e) {
System.out.println("Not possible to rea... |
744bff61-c7d2-417e-b1ce-183f7d72160b | public boolean equalMapsString(Map<String, String>m1, Map<String, String>m2) {
if (m1.size() != m2.size()) {
return false;
}
for (String key: m1.keySet()) {
if (!m1.get(key).equals(m2.get(key)))
return false;
}
return true;
} |
06940865-7b73-4010-8a24-1a6f64fb5e6b | public boolean equalMaps(Map<?, ?> map1, Map<?, ?>map2) {
if (map1==null || map2==null || map1.size() != map2.size()) {
return false;
}
for (Object key: map1.keySet()) {
if (!map1.get(key).equals(map2.get(key))) {
return false;
}
}
return true;
} |
9178a8ee-28ea-42c2-bc27-4b9595dc4db1 | public Map<String, String> readCustomer(String key) {
Map<String, String> customer = new HashMap<String, String>();
try {
ColumnFamilyResult<String, String> result = customerCFTemplate.queryColumns(key);
customer.put(DEF_COL_FIRST_NAME, result.getString(DEF_COL_FIRST_NAME));
customer.put(DEF_COL_LAST_NAME,... |
83362cae-f70d-432a-8d75-e48b6ce8902a | private void delete(String key) {
try {
customerCFTemplate.deleteRow(key);
} catch (HectorException e) {
System.out.println("Not possible to delete row with key " + key);
System.out.println(e.getMessage());
}
} |
0f710521-5fe7-4435-9970-70c76d6a1d2b | public void printMap (Map <?, ?> map) {
for (Map.Entry<?,?> entry : map.entrySet()) {
System.out.println("key: " + entry.getKey() + " value: " + entry.getValue());
}
} |
f7fccbfa-0c08-48de-80fd-b5f396ad9ca2 | public void printMapV2 (Map <?, ?> map) {
StringBuilder sb = new StringBuilder(128);
sb.append("{");
for (Map.Entry<?,?> entry : map.entrySet()) {
if (sb.length()>1) {
sb.append(", ");
}
sb.append(entry.getKey()).append("=").append(entry.getValue());
}
sb.append("}");
System.out.println(sb);
} |
b9043f3c-26c1-4293-8314-28494f99b2bb | public static void main( String[] args )
{
KeyspaceTest test = new KeyspaceTest();
System.out.println("instantiates cluster, keyspace and column family");
test.createKeyspace();
System.out.println("Insert a row in " + DEF_USER_CF_NAME);
test.update("key1", "alan", "chang");
System.out.printl... |
4aedb7df-d6ef-4113-82b9-5cd38a789d92 | public QueryResult<ColumnSlice<String,String>> query() {
SliceQuery<String, String, String> sliceQuery =
HFactory.createSliceQuery(this.getKeyspace(), StringSerializer.get(), StringSerializer.get(), StringSerializer.get());
sliceQuery.setColumnFamily(DEF_USER_CF_NAME);
sliceQuery.se... |
6f994a62-eff3-4c17-beb7-1e4bec5ed0a3 | public List<Object> doTest() {
ResultStatus result = query();
if ( result != null) {
return printToLog(result);
}
return null;
} |
cbf3ceb7-290d-4860-b8fd-2b6f836aa163 | public static void main( String[] args ) {
DemoQueryRowColumnList test = new DemoQueryRowColumnList();
test.init();
test.doTest();
test.treminate();
} |
09ed912f-d9ea-4e59-9241-bae749463426 | public QueryResult<ColumnSlice<Composite, String>> query() {
CompositeSerializer cs = new CompositeSerializer();
Mutator<String> mutator = HFactory.createMutator(this.getKeyspace(), StringSerializer.get() );
HColumnImpl<Composite, String> column = new HColumnImpl<Composite, String>(cs, Str... |
6907e9d4-81b2-4ff2-9b2e-668371f52d49 | public List<Object> doTest() {
ResultStatus result = query();
if ( result != null) {
return printToLog(result);
}
return null;
} |
298d7769-9af5-4d66-891d-92757d575eb0 | public static void main( String[] args ) {
DemoCompositeInsertQuery test = new DemoCompositeInsertQuery();
test.init();
test.doTest();
test.treminate();
} |
8fa40fab-de44-4628-8f98-01f78a0fb699 | public QueryResult<OrderedRows<String,String,String>> query() {
RangeSlicesQuery<String, String, String> rangeSlicesQuery =
HFactory.createRangeSlicesQuery(this.getKeyspace(), StringSerializer.get(), StringSerializer.get(), StringSerializer.get());
rangeSlicesQuery.setColumnFamily... |
37ff3189-e909-449c-b28b-194d4dc126d4 | public List<Object> doTest() {
ResultStatus result = query();
if ( result != null) {
return printToLog(result);
}
return null;
} |
a7eaad69-cc46-408f-b858-a9148672948e | public static void main( String[] args ) {
DemoTest test = new DemoQueryRowRangeColumnList();
test.init();
test.doTest();
test.treminate();
} |
eae6c689-83ab-4417-aba9-0bb0742cb773 | public List<Object> deleteRowColumn () {
List<Object> list = this.insertRow();
String rowkey = "mike_johnson";
ColumnFamilyTemplate<String, String> userCFTemplate = new ThriftColumnFamilyTemplate<String, String>(
this.getKeyspace(),
DEF_USER_CF_NAME, StringSerializer.get(), Stri... |
0758c6ef-6dae-4567-84b2-1da0f8d7989d | public List<Object> doTest () {
return deleteRowColumn ();
} |
58e9c079-224f-4945-984f-86a86c497588 | public static void main( String[] args ) {
DemoDeleteColumnValues test = new DemoDeleteColumnValues();
test.init();
test.doTest();
test.treminate();
} |
d2e29083-1d40-445e-905d-ce130235f187 | public QueryResult<Rows<String,String,String>> query() {
MultigetSliceQuery<String, String, String> multigetSlicesQuery =
HFactory.createMultigetSliceQuery( this.getKeyspace(), StringSerializer.get(), StringSerializer.get(), StringSerializer.get());
multigetSlicesQuery.setColumnFamily(... |
2bd908ea-8791-4e02-8d36-04143baea469 | public List<Object> doTest() {
ResultStatus result = query();
if ( result != null) {
return printToLog(result);
}
return null;
} |
5e9159c0-270b-4f84-b0bc-efdface71003 | public static void main( String[] args ) {
DemoQueryMultiKeyColumns test = new DemoQueryMultiKeyColumns();
test.init();
test.doTest();
test.treminate();
} |
11c96331-28d5-49db-9f48-e875419d5af7 | public QueryResult<OrderedRows<String, String, String>> query() {
IndexedSlicesQuery<String, String, String> indexedSlicesQuery =
HFactory.createIndexedSlicesQuery(this.getKeyspace(), StringSerializer.get(), StringSerializer.get(), StringSerializer.get());
indexedSlicesQuery.setColumnFamily... |
21031d27-2411-43ab-bc35-4c0d73d98e0c | public List<Object> doTest() {
ResultStatus result = query();
if ( result != null) {
return printToLog(result);
}
return null;
} |
a66853ba-9a9c-440b-a6e1-403307f94395 | public static void main( String[] args ) {
DemoQuerySecondaryIndex test = new DemoQuerySecondaryIndex();
test.init();
test.doTest();
test.treminate();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.