This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = "https://api.twitter.com/1/statuses/user_timeline.json"; | |
var data = { include_entities:true,include_rts:true,screen_name:"wso2",count:1 }; | |
var twitterJson = get(url, data ,"json", function(data, xhr){ | |
print(data); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getAddress = function(transport){ | |
var process = require("process"), | |
host = process.getProperty('server.host'), | |
ip = process.getProperty('carbon.local.ip'); | |
var log = new Log(); | |
var port; | |
if(transport=="http"){ | |
port = process.getProperty('mgt.transport.http.proxyPort'); | |
if(!port){ | |
//can use http.port as well |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"memory_info": { | |
"sdram_p_volate": 1.23, | |
"sdram_c_volate": 1.2, | |
"used_memory": 150163456, | |
"shared_memory": 0, | |
"total_memory": 459505664, | |
"sdram_i_volate": 1.2, | |
"cached_memory": 100642816, | |
"memory_buffers": 15024128, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void run() { | |
dhtSensor.read(); | |
float temperature = dhtSensor.getTemperature(false); | |
int humidity = dhtSensor.getHumidity(); | |
try { | |
String message = "Temperature:" + Float.toString(temperature); | |
String humidityMsg = "Humidity:" + Integer.toString(humidity); | |
mqttClient.publish(1,message.getBytes()); | |
} catch (MqttException e) { | |
e.printStackTrace(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Receiver{ | |
final GpioController gpio; | |
final GpioPinDigitalOutput pin; | |
{ | |
gpio = GpioFactory.getInstance(); | |
pin = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Relay"); | |
} | |
public void run(String message){ | |
System.out.println("Message received "+message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Promise = require('bluebird') | |
var fs = require('fs'); | |
Promise.promisifyAll(fs); | |
fs.readFile("bb", function(err, data) { | |
if (err) return next(err); | |
fs.writeFile("bba", data, function() { | |
console.log("File written"); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The objective of this class is to manage localization options in CDM. | |
2 types Use cases:- | |
1) Localize the product based on a configuration | |
2) Localize components based on user preference. | |
Use case 2:- Localize the license file | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="header"> | |
<h1>Jaggery intro</h1> | |
<ul ng-repeat="todo in todos"> | |
<li><input type="checkbox" ng-model="todo.status"> <span ng-model="todo.text">{{todo.text}}</span></li> | |
</ul> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Exact sequence name as below should be there. This name is used inside the API implementation in Synapse --> | |
<sequence xmlns="http://ws.apache.org/ns/synapse" name="_resource_mismatch_handler_"> | |
<log level="full"/> | |
<property name="HTTP_SC" value="404" scope="axis2"></property> | |
<respond/> | |
<drop></drop> | |
</sequence> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Splitter { | |
public String[] split(String original, String separator) { | |
Vector nodes = new Vector(); | |
// Parse nodes into vector | |
int index = original.indexOf(separator); | |
while (index >= 0) { | |
nodes.addElement(original.substring(0, index)); | |
original = original.substring(index + separator.length()); | |
index = original.indexOf(separator); | |
} |
OlderNewer