id
stringlengths
36
36
text
stringlengths
1
1.25M
0e1b394c-97f3-4547-b55c-a812a5c3ffcd
public List<Object> getColumnValues (String rowkey) { List<Object> listColumnObj = new LinkedList<Object> (); try { ColumnFamilyTemplate<String, String> userCFTemplate = new ThriftColumnFamilyTemplate<String, String>( this.getKeyspace(), DEF_USER_CF_NAME, StringSerializer.get(), Strin...
357380a4-c2ff-4ff4-adf1-d9c03a15133a
public List<Object> doTest () { return getColumnValues ("john_smith"); }
d8d4cdc7-6a19-41e6-93c0-8634af69dcce
public static void main( String[] args ) { DemoGetColumnValues test = new DemoGetColumnValues(); test.init(); test.doTest(); test.treminate(); }
ba836a10-1218-4418-b389-b3126d0a9c09
public static void main( String[] args ) { System.out.println( "Hello World!" ); }
2e05471d-f1b6-4d53-85f7-fea48436ff3c
public List<Object> insertRow () { String rowkey = "mike_johnson"; ColumnFamilyTemplate<String, String> userCFTemplate = new ThriftColumnFamilyTemplate<String, String>( this.getKeyspace(), DEF_USER_CF_NAME, StringSerializer.get(), StringSerializer.get()); ColumnFamilyUpdater<String, ...
e09314ef-2f1f-4802-83cd-faefd164b82d
public List<Object> insertRowV2 () { Mutator<String> mutator = HFactory.createMutator(this.getKeyspace(), StringSerializer.get() ); mutator.addInsertion("michael_johnson", "users", HFactory.createStringColumn("full_name", "michael johnson")); mutator.addInsertion("michael_johnson", "users", HFactory.crea...
811a14dc-e8ca-45ea-aa2e-02cec1ac1c68
public List<Object> doTest () { //return insertRow (); return insertRowV2 (); }
5957f482-4b49-4c70-a33f-56fd2bac13b0
public static void main( String[] args ) { DemoInsertColumnValues test = new DemoInsertColumnValues(); test.init(); test.doTest(); test.treminate(); }
0fb58c71-6589-4f0a-9316-dc112fbdb4eb
public Cluster getCluster() { return cluster; }
5580acab-422a-4d05-9126-f5507544163b
public Keyspace getKeyspace() { return keyspace; }
34beecbb-66a7-4d33-ad7d-ef561690402a
public void connect() { cluster = HFactory.getOrCreateCluster(DEF_CLUSTER, DEF_LOCALHOST_ID); System.out.println("Cluster instantiated"); ConfigurableConsistencyLevel ccl = new ConfigurableConsistencyLevel(); ccl.setDefaultReadConsistencyLevel(HConsistencyLevel.ONE); keyspace = HFactory.createKeyspace("demo",...
e77d17c0-c55d-41bf-a298-215345a17608
public void disconnect() { cluster.getConnectionManager().shutdown(); }
1ebabf3f-a23a-40d6-8afc-4f7b36ece747
public void init() { connect(); }
2b58c3a5-fe77-4a65-bf2a-2f5c2ceddf2f
public void treminate() { disconnect(); }
cf20be12-34a6-4f49-bede-5184dc71c0aa
public List<Object> doTest() { ResultStatus result = execute(); if ( result != null) { return printToLog(result); } return null; }
4b8d7c15-7670-4c45-ba05-8656ce466e97
public ResultStatus doQuery() { HColumnFamily<String, String> columnFamily = new HColumnFamilyImpl<String, String>(keyspace, "users", StringSerializer.get(), StringSerializer.get() ); columnFamily.addKey("john_smith"); columnFamily.addColumnName("email") .addColumnN...
e25283f0-9614-4293-b613-64958876a06b
public QueryResult<ColumnSlice<Composite, String>> execute() { CompositeSerializer cs = new CompositeSerializer(); Mutator<String> mutator = HFactory.createMutator(keyspace, StringSerializer.get() ); HColumnImpl<Composite, String> column = new HColumnImpl<Composite, String>(cs, Strin...
1c9464a9-2002-4979-b666-6d69ce9a4c2b
@SuppressWarnings("unchecked") public List<Object> printToLog(ResultStatus result) { log.info("======================================================================="); List<Object> listObj = new LinkedList<Object> (); log.info("Result executed in: {} microseconds against host: {}", ...
c29d56eb-27fb-47e9-985e-7c9b645ddb47
public static void main( String[] args ) { DemoTest test = new DemoTest(); test.init(); List<Object> list = test.doTest(); //System.out.println("list.size() " + list.size()); test.doQuery(); test.treminate(); }
050ca446-6cff-4ade-8d6a-69a86338cad8
static Object getColumnValue (String colName, ByteBuffer value) { AbstractSerializer<?> type = ColumnToValueMapping.get(colName); if (type==null) { type = StringSerializer.get(); } return type.fromByteBuffer(value); }
f5d8b45f-29a7-4b8d-b208-423ac0c685f3
private List<Object> listAllEntries() { return listAllEntries(1000); }
82d25c6a-0da7-420c-8663-f204bf1d4447
private List<Object> listAllEntries(int maxRowCount) { List<Object> list = new ArrayList<Object> (); RangeSlicesQuery<String, String, ByteBuffer> rangeSlicesQuery = HFactory.createRangeSlicesQuery(this.getKeyspace(), StringSerializer.get(), StringSerializer.get(), ByteBufferSerializer.get())...
07bd945e-97bf-484e-ab2e-60bd67e006d6
public List<Object> doTest () { return listAllEntries(); }
d485a96e-6aa0-4aed-a395-8bc4536041fe
public static void main( String[] args ) { DemoListAllColumnValues test = new DemoListAllColumnValues(); test.init(); test.doTest(); test.treminate(); }
43d0abe5-d2ca-4513-90c1-40f959f8ac68
public QueryResult<ColumnSlice<String,String>> query() { SliceQuery<String, String, String> sliceQuery = HFactory.createSliceQuery(this.getKeyspace(), StringSerializer.get(), StringSerializer.get(), StringSerializer.get()); sliceQuery.setColumnFamily("stock_close_prices"); ...
b6049268-bea7-4c88-9890-256f0e9344bb
public List<Object> doTest() { ResultStatus result = query(); if ( result != null) { return printToLog(result); } return null; }
8c592994-2af1-4ecf-ba4a-36524f99ef66
public static void main( String[] args ) { DemoRangeColumns test = new DemoRangeColumns(); test.init(); test.doTest(); test.treminate(); }
c21fea8b-4eb0-47c7-a10a-aa23acc47cf0
public QueryResult<HColumn<String,String>> query() { ColumnQuery<String, String, String> columnQuery = HFactory.createStringColumnQuery(this.getKeyspace()); columnQuery.setColumnFamily(DEF_USER_CF_NAME); columnQuery.setKey("john_smith"); columnQuery.setName("full_name"); ...
8273c1a7-563b-4b5d-946d-4e3e3c778c8b
public List<Object> doTest() { ResultStatus result = query(); if ( result != null) { return printToLog(result); } return null; }
1db09262-4135-44ea-a855-9a360951951a
public static void main( String[] args ) { DemoQueryRowColumn test = new DemoQueryRowColumn(); test.init(); test.doTest(); test.treminate(); }
e7243f92-e955-434c-ae77-1f8057c483a1
public List<Object> deleteRow() { 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(), StringSerializer....
5b5caaa4-24db-4849-95fd-8c513726a370
public List<Object> deleteRowV2() { List<Object> list = this.insertRowV2(); String rowkey = "michael_johnson"; Mutator<String> mutator = HFactory.createMutator(this.getKeyspace(), StringSerializer.get() ); mutator.addDeletion(rowkey, "users", null, StringSerializer.get() ); ...
d192e953-c312-4260-b293-40e343b0a148
public List<Object> doTest () { //return deleteRow (); return deleteRowV2 (); }
ccbbbd30-1e4c-4978-93f8-1e9eee430d2f
public static void main( String[] args ) { DemoDeleteRow test = new DemoDeleteRow(); test.init(); test.doTest(); test.treminate(); }
3d21e0a4-4d15-4ce9-a0b4-df9fa3c18697
@BeforeClass static public void startUp() { System.out.println("startUp() ..... "); }
e17fcc87-bcdf-48c2-b987-418259406233
@AfterClass static public void shutDown() { System.out.println("tearDown() ..... "); }
a5b7c229-fbc3-47de-b2d7-571761a480b0
@Test public void testInsert() { KeyspaceTest test = new KeyspaceTest(); test.createKeyspace(); System.out.println("Inserting ..... "); Map<String, String> customer = test.buildCustomerMap ("Tim", "Bird"); test.printMapV2 (customer); test.update("tim_bird", customer); System....
2ca22d74-8bba-4796-838b-6c9379a0d154
public void testResultStatus() { DemoTest demoTest = new DemoTest(); demoTest.init(); List<Object> list = demoTest.doTest(); assertTrue( list!=null && list.size()>0 ); }
9f177392-9f5d-45c1-b04c-8f97a533702d
@Test public void testDemoGetColumnValues() { DemoGetColumnValues demoTest = new DemoGetColumnValues(); demoTest.init(); List<Object> list = demoTest.doTest(); assertTrue( list!=null && list.size()>0 ); }
1d2d517e-e1ef-49c4-b29c-2ba303dca8b7
@Test public void testDemoInsertColumnValues() { DemoInsertColumnValues test = new DemoInsertColumnValues(); test.init(); List<Object> list = test.doTest(); assertTrue( list!=null && list.size()>0 ); }
c9c46b86-c211-419e-95c4-507edb6c2994
@Test public void testDemoDeleteColumnValues() { DemoDeleteColumnValues test = new DemoDeleteColumnValues(); test.init(); List<Object> list = test.doTest(); assertTrue( list!=null && list.size()>0 ); }
1cee834c-a085-4874-bc9f-89f1f66108ba
@Test public void testDemoDeleteRow() { DemoDeleteRow test = new DemoDeleteRow(); test.init(); List<Object> list = test.doTest(); assertTrue( list!=null && list.size()>0 ); }
2433e649-af3a-49df-aebb-4db402b632a8
@Test public void testDemoListAllColumnValues() { DemoListAllColumnValues test = new DemoListAllColumnValues(); test.init(); List<Object> list = test.doTest(); assertTrue( list!=null && list.size()>0 ); }
bdeec0a6-9a26-469d-83a4-1b92de044b6f
@Test public void testDemoQueryRowColumnList() { DemoQueryRowColumnList test = new DemoQueryRowColumnList(); test.init(); List<Object> list = test.doTest(); assertTrue( list!=null && list.size()>0 ); }
e158d62b-8aa8-4415-bd3d-bf63d8c5679b
@Test public void testDemoQueryRowRangeColumnList() { DemoQueryRowRangeColumnList test = new DemoQueryRowRangeColumnList(); test.init(); List<Object> list = test.doTest(); assertTrue( list!=null && list.size()>0 ); }
21d434c6-ca1a-4afd-8da3-8f6f25a9c9ab
@Test public void testDemoRangeColumns() { DemoRangeColumns test = new DemoRangeColumns(); test.init(); List<Object> list = test.doTest(); assertTrue( list!=null && list.size()>0 ); }
5bbe5243-41f5-4069-9fa1-01351a48f776
@Test public void testDemoQueryMultiKeyColumns() { DemoQueryMultiKeyColumns test = new DemoQueryMultiKeyColumns(); test.init(); List<Object> list = test.doTest(); assertTrue( list!=null && list.size()>0 ); }
9f379e67-dc63-4bb4-bac4-277c73b40094
@Test public void testDemoQuerySecondaryIndex() { DemoQuerySecondaryIndex test = new DemoQuerySecondaryIndex(); test.init(); List<Object> list = test.doTest(); assertTrue( list!=null && list.size()>0 ); }
f8e3c20e-8e30-486d-864e-fe131d9380bc
@Test public void testDemoQuerySecondaryIndexRawBytes() { DemoQuerySecondaryIndexRawBytes test = new DemoQuerySecondaryIndexRawBytes(); test.init(); List<Object> list = test.doTest(); assertTrue( list!=null && list.size()>0 ); }
afadafb1-6ce8-4344-8b1c-fa9bbdecac3b
public AppTest( String testName ) { super( testName ); }
bff2068a-1208-4bf6-94a3-7009c2db362a
public static Test suite() { return new TestSuite( AppTest.class ); }
ed402839-ce93-423a-855a-878998e8f615
public void testApp() { assertTrue( true ); }
10b52d2e-9262-4f99-a1d6-30bc85e9446e
public static void main(String args[]) { PerKeyListner obj = new PerKeyListner(); obj.init(); }
17100277-1587-4130-9afc-eb9de8a04f80
public void init() { // setup layout mainFrame.setSize(300,600); mainFrame.add(mainPanel); mainPanel.setLayout(new BorderLayout()); mainPanel.add(btnSearch,BorderLayout.SOUTH); // dynamic init dynInit(); // show frame mainFrame.setVisible(true...
6a9e493d-5750-457c-9299-7b2fe008360e
public void dynInit() { btnSearch.addActionListener(this); }
2ae8b4d3-9212-4892-b084-6c1cce91ca9d
public void btnUpPress () { try { Robot r = new Robot(); r.keyPress(KeyEvent.VK_UP); r.keyRelease(KeyEvent.VK_UP); } catch (AWTException ex) { System.err.println(ex.getMessage()); } }
390978ab-9bb5-4121-9c35-55da5e9e5206
@Override public void actionPerformed(ActionEvent actionEvent) { if (btnSearch == actionEvent.getSource()) { btnUpPress(); JOptionPane.showMessageDialog(mainFrame,"UpPress Action for this command","worring",JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane....
a07e195a-b613-4992-abd4-97d11e7c0195
public void init() throws BluetoothStateException, InterruptedException { devicesDiscovered.clear(); synchronized (inquiryCompletedEvent) { boolean started = LocalDevice.getLocalDevice().getDiscoveryAgent().startInquiry(DiscoveryAgent.GIAC, this); if (started) { System.out.println("wait for device inq...
a6d40887-5444-4972-a6a8-21fc850c6fc6
public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) { System.out.println("Device " + btDevice.getBluetoothAddress()+ " found"); try { System.out.println(" - Device name " + btDevice.getFriendlyName(true)+ " - "); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTr...
219ec9cf-4ab6-422e-845f-16f7ee6ac129
public void inquiryCompleted(int discType) { System.out.println("Device Inquiry completed!"); synchronized (inquiryCompletedEvent) { inquiryCompletedEvent.notifyAll(); } }
5c4ba4a3-7fbe-4ce4-ad68-3429d149a65d
public void serviceSearchCompleted(int transID, int respCode) { }
4250e8a6-c22c-445a-b0e3-0b3ca58fe2e9
public void servicesDiscovered(int transID, ServiceRecord[] servRecord) { }
81ab95d9-b49e-408f-9dd4-de542af31fe7
public static void main(String[] args) throws IOException,InterruptedException { RemoteDeviceDiscovery rdd = new RemoteDeviceDiscovery(); rdd.init(); }
392d88ae-cb93-43f3-8bed-f34d70a39120
public BluetoothServer () throws IOException { // This block configure the logger with handler and formatter fh = new FileHandler(System.getProperty("java.io.tmpdir")+"//presentation_log.log", true); log.addHandler(fh); log.setLevel(Level.ALL); SimpleFormatter formatter = new S...
6202314d-8af3-40a4-a0cf-0dda04969d88
public void startServer() throws IOException { // Create a UUID for SPP uuid = new UUID("1101", true); // print uuid logString.append("UUID : " + uuid.toString()); logString.append("\n"); // Create the service url connectionString = "btspp://localhost:" + uuid +...
f47f6ea7-dca1-4682-b6ff-a9baab001f12
public void stopService () throws IOException{ // send response to spp client stopService = true; logString.append("blueServer : service is stopped"); logString.append("\n"); }
464773b6-0ae3-42c0-ab51-60bacdd13f33
public static void main(String[] args) throws IOException { BluetoothServer sampleSPPServer = new BluetoothServer(); sampleSPPServer.startServer(); logString.append("class server terminate normally"); logString.append("\n"); }
1c1c8ea7-be63-474b-bf25-0a5b2264c258
public static void main(String[] args) throws IOException { BluetoothClient client=new BluetoothClient(); //display local device address and name LocalDevice localDevice = LocalDevice.getLocalDevice(); System.out.println("Address: "+localDevice.getBluetoothAddress()); System.out...
9d3f0b6e-d746-4b4d-b0fd-616c9ea72d8a
public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) { //add the device to the vector if(!vecDevices.contains(btDevice)){ vecDevices.addElement(btDevice); } }
752b6cf7-b697-4ad0-9852-b838dac7d84c
public void servicesDiscovered(int transID, ServiceRecord[] servRecord) { System.out.println("Inside Service Discovered"); if(servRecord!=null && servRecord.length>0){ connectionURL=servRecord[0].getConnectionURL(0,false); for (int i = 0; i < servRecord.length; i++) { ...
d653b7df-92d3-4e50-a313-cc44f153c0ea
public void serviceSearchCompleted(int transID, int respCode) { synchronized(lock){ lock.notify(); } }
5494b88e-00e6-4ed3-9f3e-f2927b28e9e4
public void inquiryCompleted(int discType) { synchronized(lock){ lock.notify(); } }//end method
f7b7dd40-9902-41b8-bfe7-c738a8d49dd4
public Main() { init(); dynInit(); new Thread() { @Override public void run() { while(true) { textArea1.setText(bluetoothServer.logString.toString()); try { sleep(100); ...
1871bfc9-79a9-4487-8b57-4ee4f4a0db78
@Override public void run() { while(true) { textArea1.setText(bluetoothServer.logString.toString()); try { sleep(100); } catch (InterruptedException e) { e.printStackTrace(); ...
7eb00ea2-d2a4-41cf-b088-8df4ccdb58a5
private void onStart() { new Thread() { @Override public void run() { try { if(bluetoothServer != null) bluetoothServer.startServer(); textArea1.setText(bluetoothServer.logString...
2f1632fb-f788-4b2c-a36b-896ee1adccbf
@Override public void run() { try { if(bluetoothServer != null) bluetoothServer.startServer(); textArea1.setText(bluetoothServer.logString.toString()); } catch (IOException e) { ...
d2d9f2cb-9b25-49e9-b1ee-3da901e9e547
private void onExit() { // add your code here if necessary try { if(bluetoothServer != null) bluetoothServer.stopService(); } catch (IOException e) { bluetoothServer.logString.append(e.getMessage() + "\n"); e.printStackTrace(); textArea1....
db2a3117-7e41-4c4f-bbb6-2448f95f2fb9
public void init () { try { if(bluetoothServer == null) bluetoothServer = new BluetoothServer(); textArea1.setText(bluetoothServer.logString.toString()); } catch (IOException e) { bluetoothServer.logString.append(e.getMessage() + "\n"); ...
3e6fe45d-b132-40f7-82c9-caddfa0c1338
public void dynInit () { setSize(500,1000); setLocation(100,50); setContentPane(contentPane); setTitle("Main Presentation Controller"); getRootPane().setDefaultButton(buttonStart); buttonStart.addActionListener(new ActionListener() { public void actionPerfo...
c11e1d4e-7fe8-4d84-b9b2-0897d4ea872d
public void actionPerformed(ActionEvent e) { onStart(); }
ad294410-80d1-4e84-a23b-b294e469db90
public void actionPerformed(ActionEvent e) { onExit(); }
f23a5d69-09a3-4b28-9517-c050f2dfd27b
public void actionPerformed(ActionEvent e) { bluetoothServer.logString = new StringBuffer(); textArea1.setText(""); }
2e0b2437-d36e-4d1b-82bd-a30948221f98
public void actionPerformed(ActionEvent e) { try { if(bluetoothServer != null) bluetoothServer.stopService(); } catch (IOException e1) { bluetoothServer.logString.append(e1.getMessage()+"\n"); e1.printSt...
068574d1-204b-49c9-815a-c937d31e332a
public static void main(String[] args) { Main dialog = new Main(); dialog.pack(); dialog.setVisible(true); //System.exit(0); }
dad51116-e837-421e-acd8-8335309c165e
public static void main(String[] args) { new Main(); }
b0d87bce-ab4d-4fc9-ad5b-3b903f47525d
public Main() { System.out.println("Application startup : F1 telemetry on RPI"); System.out.println("Version : " + getClass().getPackage().getImplementationVersion()); System.out.println("Author : Benoit Mouquet"); System.out.println("Website : http://code4pi.fr"); F1TelemetryProperties properties = new F...
79bd664d-af45-43cc-9b2b-4b1c5246aec0
public void run() { // Notify that we close the application closureInProgress = true; // Close the socket if it is open if (localDatagramSocket != null && !localDatagramSocket.isClosed()) { localDatagramSocket.close(); } // End all thread if (ledStatus) { led.finishThread(); ...
c1435376-b12b-4a39-b602-d73834cdfa7d
private LedParameter() { }
3133fc00-9288-4a6e-b71b-918fe401edfa
public LedManager(Pin pin1, Pin pin2, Pin pin3) { GpioController gpio = GpioFactory.getInstance(); this.pin1 = gpio.provisionDigitalOutputPin(pin1, "MyLED", PinState.LOW); this.pin2 = gpio.provisionDigitalOutputPin(pin2, "MyLED", PinState.LOW); this.pin3 = gpio.provisionDigitalOutputPin(pin3, "MyLED", PinStat...
1c6f8392-4309-4675-a005-00fe0ab92c7b
public void setCustomLimit(int rpmForPin1, int rpmForPin2, int rpmForPin3, int rpmForBlinking) { this.rpmForPin1 = rpmForPin1; this.rpmForPin2 = rpmForPin2; this.rpmForPin3 = rpmForPin3; this.rpmForBlinking = rpmForBlinking; }
982ebc7c-217a-4f55-b437-1c79377505eb
public void updateLed(double rpm) { if (rpm >= rpmForPin1 && rpm < rpmForPin2) { stopBlinking(); pin1.high(); pin2.low(); pin3.low(); } else if (rpm >= rpmForPin2 && rpm < rpmForPin3) { stopBlinking(); pin1.high(); pin2.high(); pin3.low(); } else if (rpm >= rpmForPin3 && rpm < rpmForBlinki...
c5eea5e4-2a6f-4682-9fbc-048bd9fcd3ec
public void finishThread() { stopBlinking(); pin1.low(); pin2.low(); pin3.low(); }
f84d655b-eb38-4702-9e7c-20401dfefb3f
private void stopBlinking() { if (ledBlinking.isAlive()) { ledBlinking.stopThread(); try { ledBlinking.waitForThread(); } catch (InterruptedException e) { e.printStackTrace(); } } }
490c8156-cd88-47db-b9e5-5d4c4c7825be
public void testLeds(int duration) { ledBlinking.startThread(); try { Thread.sleep(duration); } catch (InterruptedException e) { e.printStackTrace(); } stopBlinking(); }
c5fb5012-091a-4133-ac47-3f0aee035fa6
public int getRpmForPin1() { return rpmForPin1; }
b4255b62-f8f4-4663-8268-89faf75cf112
public void setRpmForPin1(int rpmForPin1) { this.rpmForPin1 = rpmForPin1; }
f3c73f4b-263b-4606-b77b-f1e1b7330b5f
public int getRpmForPin2() { return rpmForPin2; }
e763ec9f-e1b9-4024-b9a7-3eee9f405ef2
public void setRpmForPin2(int rpmForPin2) { this.rpmForPin2 = rpmForPin2; }
ed6f8ae8-839a-4f9d-9aac-8ea393c43d89
public int getRpmForPin3() { return rpmForPin3; }
f2412309-14cf-4f7d-a6a3-35d9b6001e9d
public void setRpmForPin3(int rpmForPin3) { this.rpmForPin3 = rpmForPin3; }