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
import unittest | |
class FooTests(unittest.TestCase): | |
def testFoo(self): | |
self.failUnless(False) | |
def main(): | |
unittest.main() |
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
java.io.InputStream inputStream = getClass().getClassLoader().getResourceAsStream("relative-path"); |
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
import java.security.KeyPairGenerator; | |
import java.security.KeyPair; | |
import java.security.PrivateKey; | |
import java.security.PublicKey; | |
import java.security.KeyFactory; | |
import java.security.spec.EncodedKeySpec; | |
import java.security.spec.PKCS8EncodedKeySpec; | |
import java.security.spec.X509EncodedKeySpec; | |
import java.security.spec.InvalidKeySpecException; | |
import java.security.NoSuchAlgorithmException; |
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
<build> | |
<plugins> | |
<plugin> | |
<artifactId>maven-assembly-plugin</artifactId> | |
<configuration> | |
<archive> | |
<manifest> | |
<mainClass>package.MainClass</mainClass> | |
</manifest> | |
</archive> |
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
<properties> | |
<maven.compiler.source>1.6</maven.compiler.source> | |
<maven.compiler.target>1.6</maven.compiler.target> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
</properties> |
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
File folder = new File(FOLDER); | |
if ( folder.isDirectory() == true ) { | |
File[] docList = folder.listFiles(); | |
if ( docList != null ) { | |
for ( File doc : docList ) { | |
} | |
} | |
} |
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
System.setProperty("http.proxyHost", "host"); | |
System.setProperty("http.proxyPort", "port"); |
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
private void printMap(Map<String, String> map) { | |
Set<String> keys = map.keySet(); | |
Iterator<String> iter = keys.iterator(); | |
while ( iter.hasNext() ) { | |
String key = iter.next(); | |
System.out.println("Key: " + key); | |
String obj = map.get(key); | |
System.out.println(obj); | |
} | |
} |
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
private String applyXslt(String xsltString, String xmlToLift, String lodUri) throws ParserConfigurationException, SAXException, IOException, TransformerException { | |
// create transformer | |
Transformer xsltTransformer = HtmlTransformerFactory.createXsltTransformerByContent(xsltString); | |
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); | |
DocumentBuilder parser = factory.newDocumentBuilder(); | |
Document document = parser.parse(new ByteArrayInputStream(xmlToLift.getBytes()), null); | |
DOMSource source = new DOMSource(document); | |
ByteArrayOutputStream bout = new ByteArrayOutputStream(); | |
StreamResult result = new StreamResult(bout); | |
if ( lodUri != null ) { |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE xsl:stylesheet [ | |
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#"> | |
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"> | |
<!ENTITY foaf "http://xmlns.com/foaf/0.1/"> | |
<!ENTITY dcterms "http://purl.org/dc/terms/"> | |
<!ENTITY dc "http://purl.org/dc/elements/1.1/"> | |
<!ENTITY mo "http://purl.org/ontology/mo/"> | |
]> |