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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.mycorp.project</groupId> | |
<artifactId>project</artifactId> | |
<packaging>war</packaging> | |
<version>1.0-SNAPSHOT</version> | |
<name>Sample Maven Webapp</name> | |
<url>http://www.example.com</url> | |
<build> |
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
# http://folkets-lexikon.csc.kth.se/folkets/om.en.html | |
# http://folkets-lexikon.csc.kth.se/folkets/folkets_en_sv_public.xml | |
# http://folkets-lexikon.csc.kth.se/folkets/folkets_sv_en_public.xml | |
require "rexml/document" | |
require 'cgi' | |
file = File.new("folkets_en_sv_public.xml") | |
doc = REXML::Document.new 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
<html> | |
<head> | |
<!-- load your javascript libs here with script tags --> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
// timer code goes inside here, it will be called when the page loads fully | |
}); | |
</script> | |
</head> | |
<body> |
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
<html> | |
<head> | |
<!-- load your javascript libs here with script tags --> | |
</head> | |
<body> | |
<!-- html goes here --> | |
<script type="text/javascript"> | |
// timer code goes inside here, it should work because your DOM elements exist when this code is evaluated. | |
</script> | |
</body> |
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
# get file as object | |
$a = Get-Item .\export.xlsx | |
# and then you can just set properties. wow | |
$a.LastWriteTime="5/1/2012 13:02" | |
$a.CreationTime="4/1/2012 12:22" | |
$a.LastAccessTime="5/13/2014 15:24:22" | |
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
SELECT | |
relname as "Table", | |
pg_size_pretty(pg_total_relation_size(relid)) As "Size", | |
pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as "External Size" | |
FROM pg_catalog.pg_statio_user_tables | |
where relname like {{table_name}} | |
ORDER BY pg_total_relation_size(relid) DESC; |
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 abstract class StringRenderableController | |
{ | |
@Autowired | |
ViewResolver viewResolver; | |
protected String renderViewToString(Model model, HttpServletRequest request, HttpServletResponse httpServletResponse, final String viewName) | |
{ | |
final StringWriter html = new StringWriter(); | |
View renderView = new View() | |
{ |
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 byte[] getPdf(String html) { | |
byte[] results = null; | |
try { | |
// For piping in and out, we need separate args for this for some reason | |
String[] command = {"/usr/local/bin/wkhtmltopdf", "-", "-"}; | |
ProcessBuilder builder = new ProcessBuilder(command); | |
// this eats up stderr but prevents us from having to handle it ourselves | |
builder.redirectErrorStream(false); | |
Process process = builder.start(); |