Recent Notes

Displaying notes 71 - 80
Created by Fang on January 10, 2014 14:07:20    Last update: January 10, 2014 14:07:20
An example project with Spring MVC and Apache Tiles. List of files: ./pom.xml ./src/main/webapp/WEB-INF/web.xml... ./pom.xml : <?xml version="1.0" encoding="UTF-8"?> <pro... ./src/main/webapp/WEB-INF/web.xml : <?xml version="1.0" encoding="UTF-8"?> <web-app... ./src/main/webapp/WEB-INF/applicationContext.xml : <?xml version="1.0" encoding="UTF-8"?> <beans x... ./src/main/webapp/WEB-INF/spring-servlet.xml : <?xml version="1.0" encoding="UTF-8"?> <beans x... ./src/main/webapp/WEB-INF/tiles-definitions.xml : <?xml version="1.0" encoding="UTF-8"?> <!DOCTYP... ./src/main/webapp/WEB-INF/jsp/template.jsp : <!DOCTYPE html> <%@ page pageEncoding="UTF-8" %... ./src/main/java/com/example/MyController.java : package com.example; import javax.servlet.S...
Created by Fang on January 06, 2014 12:22:17    Last update: January 06, 2014 12:22:17
Add <mvc:default-servlet-handler/> to the spring servlet config ( spring-servlet.xml ?) so that static files can be handled by the default servlet handler. This is a full configuration file for example: <?xml version="1.0" encoding="UTF-8"?> <beans x...
Created by Fang on December 30, 2013 14:50:08    Last update: December 30, 2013 14:50:08
Starting with 3.1 M1 you can register HttpMessageConverters through a sub-element of mvc:annotation-driven . <?xml version="1.0" encoding="UTF-8"?> <beans x...
Created by Fang on December 30, 2013 14:40:40    Last update: December 30, 2013 14:42:17
Sample code to return an image as a byte array, with @ResponseBody annotation. Content type is controlled by the produces attribute. Calling HttpServletResponse.setContentType has no effect. // import org.apache.commons.io.IOUtils; //...
Created by Fang on December 30, 2013 14:20:28    Last update: December 30, 2013 14:20:28
Example code that injects servletContext in a controller: import javax.servlet.ServletContext; import...
Created by woolf on December 24, 2013 14:41:10    Last update: December 24, 2013 14:41:10
Install needed packages: $ opkg update $ opkg install tc iptables-mo... Insert a kernel module (for example, token bucket filter): $ insmod sch_tbf Limit out-going rate on WAN (upload bandwidth): $ tc qdisc add dev eth0 root tbf rate 2mbit burst ... Limit out-going rate on LAN (download bandwidth): $ tc qdisc add dev br-lan root tbf rate 4mbit burs...
Created by voodoo on December 12, 2013 13:19:42    Last update: December 12, 2013 13:19:42
You can use the command locate to find files on a Linux box. For example, find libGL.so : $ locate libGL.so
Created by Dr. Xi on December 03, 2013 09:14:45    Last update: December 03, 2013 09:14:45
To test the effects of proxy settings http.proxyHost and http.proxyPort , I set these values to a non-existing proxy server: java -Dhttp.proxyHost=example.com -Dhttp.proxyPort... To my surprise, the Google is retrieved successfully! Is Java ignoring these settings? It turns out that Java tries to fetch the URL directly after the proxy connection fails. If a working proxy is found at proxyHost:proxyPort , then the request is routed through the proxy, otherwise a direct connection is tried. The settings are documented here: http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html . For HTTPS use these properties: htttps.proxyHost htttps.proxyPort
Created by James on November 09, 2013 20:54:03    Last update: November 09, 2013 20:54:03
This page draws an interactive parabola on HTML5 Canvas. <!DOCTYPE HTML> <html> <head> <...
Created by Dr. Xi on October 12, 2013 13:20:34    Last update: November 01, 2013 10:35:58
>>> import Crypto.PublicKey.RSA as RSA >>> key ... The signature can be verified with either the private or the public key. For RSA, the second parameter to key.sign does not matter, key.sign('a6385c1250835d65fb2bd1ae55250f3b', 1) would have generated exactly the same signature. Update: signature created with above method is discouraged by the PyCrypto author. The generated signature is not compatible with Java. Use this method to create a Java compatible signature: >>> from Crypto.PublicKey import RSA >>> from C...
Previous  3 4 5 6 7 8 9 10 11 12 Next