This file contains hidden or 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 libxmljs = require('libxmljs'); | |
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; | |
var xmlhttp1 = new XMLHttpRequest(); | |
xmlhttp1.open('GET','http://www.telegraphindia.com/feeds/rss.jsp?id=3',false); | |
xmlhttp1.send(); | |
var responseXML = xmlhttp1.responseText; | |
var xmldoc = libxmljs.parseXmlString(responseXML); | |
var title = xmldoc.find('//title'); |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.10.3/dijit/themes/claro/claro.css"> | |
<script type="text/javascript"> | |
dojoConfig = { | |
parseOnLoad: true | |
}; | |
</script> |
This file contains hidden or 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 ExodusWriter { | |
private JdbcTemplate jdbcTemplate; | |
private TransactionTemplate transactionTemplate; | |
public ExodusWriter(DataSource dataSource) { | |
DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(dataSource); | |
jdbcTemplate = new JdbcTemplate(transactionManager.getDataSource()); | |
transactionTemplate = new TransactionTemplate(transactionManager); | |
} |
This file contains hidden or 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
/** | |
* Disclaimer: | |
* This file is an example on how to use the Cassandra SSTableSimpleUnsortedWriter class to create | |
* sstables from a csv input file. | |
* While this has been tested to work, this program is provided "as is" with no guarantee. Moreover, | |
* it's primary aim is toward simplicity rather than completness. In partical, don't use this as an | |
* example to parse csv files at home. | |
*/ | |
import java.nio.ByteBuffer; | |
import java.io.*; |
This file contains hidden or 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
package org.apache.spark.sql | |
import java.io.ByteArrayOutputStream | |
import com.esotericsoftware.kryo.io.Input | |
import org.apache.hadoop.io.{NullWritable, BytesWritable} | |
import org.apache.spark.rdd.RDD | |
import org.apache.spark.serializer.KryoSerializer | |
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan | |
import org.apache.spark.{SparkContext, SparkConf} |
This file contains hidden or 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
object TypeClasses { | |
// the trait defined independent of thing(type A) & evidence(type CanFoo[A]) | |
trait CanFoo[A] { | |
def foos(x: A): String | |
} | |
// object defined whose apply method takes an implicit param of type CanFoo[A] | |
object CanFoo { | |
def apply[A:CanFoo]: CanFoo[A] = implicitly | |
} |
This file contains hidden or 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
package com.sap.sync; | |
class SynchronizationTest { | |
public int i; | |
// synchronize locks a block of code printB or method like printA | |
// only one thread can access a synchronized block at a single point in time. | |
public synchronized void printA(int a) { | |
for (int count=0;count < 5;count++) { | |
System.out.println(a); |
This file contains hidden or 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
package org.example; | |
import java.util.concurrent.*; | |
class TestThread implements Runnable { | |
public final String name; | |
public final int newcount; | |
public final long newtimesleep; | |
public TestThread(String name, int newcount, long newtimeSleep) { |
This file contains hidden or 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
import urllib | |
import urllib2 | |
import json | |
import random | |
import time | |
min = 20 | |
max = 60 | |
url = "https://iotmmsd774d7966.us2.hana.ondemand.com/com.sap.iotservices.mms/v1/api/http/data/2cf26839-0425-4bb1-bec2-084124331e18" |
This file contains hidden or 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
package com.sap.java; | |
public class WaitLockTestApp { | |
private static int sum = 0; | |
public static void main(String[] args) throws InterruptedException { | |
final WaitLockTestApp app = new WaitLockTestApp(); | |
Thread thread1 = new Thread(new Runnable() { |
OlderNewer