Displaying keyword search results 1 - 10
Created by Fang on August 28, 2013 20:37:17 Last update: August 28, 2013 20:37:17
The default extension for JSF facelet files is .xhtml, which looks so out-of-date these days. I wanted to change the extension from .xhtml to .html, to make it look more modern, even though I still use JSF xhtml in reality. This didn't work ( web.xml ):
<servlet-mapping> <servlet-name>Faces Ser...Using the servlet-mapping config without the context-param works, given that the actual file extensions are still .xhtml . But the caveat is, if you request the .xhtml file directly, it will be sent to the browser unprocessed. This worked:
<servlet-mapping> <servlet-name>Faces Ser...I'm using myfaces 2.1.11.
Created by Dr. Xi on August 01, 2012 11:40:19 Last update: August 01, 2012 11:40:19
Use copyfile in shutil :
$ python Python 2.7.3 (default, Apr 20 2012, 22...
Created by voodoo on July 25, 2012 12:25:42 Last update: July 25, 2012 12:25:42
Suppose I have a file ( passcode.txt ) containing the characters " 1234 " and I dump the file with od:
$ od -x -c passcode.txt 0000000 3231 343...The numbers for 12 and 34 are reversed in the octal dump, i.e., 1 is 31, 2 is 32. But the printout is "3231". Dumping 1 character a group shows this more clearly:
$ od -t x1 -c passcode.txt 0000000 31 32 33...
Created by Fang on March 30, 2012 10:23:21 Last update: March 30, 2012 10:23:21
These bean types are essential for the Spring MVC framework. I copied them here from the Spring Documentation for quick reference. Bean type Explanation HandlerMapping Maps incoming requests to handlers and a list of pre- and post-processors (handler interceptors) based on some criteria the details of which vary by HandlerMapping implementation. The most popular implementation supports annotated controllers but other implementations exists as well. HandlerAdapter Helps the DispatcherServlet to invoke a handler mapped to a request regardless of the handler is actually invoked. For example, invoking an annotated controller requires resolving various annotations. Thus the main purpose of a HandlerAdapter is to shield the DispatcherServlet from such details. HandlerExceptionResolver Maps exceptions to views also allowing for more complex exception handling code. ViewResolver Resolves logical String-based...
Created by Fang on November 10, 2011 09:26:12 Last update: November 10, 2011 09:26:12
Syntax highlighted XML schema for JSF 2.0 Application Configuration Resource File ( faces-config.xml ). Almost 3000 lines!
<?xml version="1.0" encoding="UTF-8"?> <xsd:sch...
Created by Dr. Xi on February 12, 2010 22:52:27 Last update: November 08, 2011 19:48:09
For Tomcat 6, there's no default manager username and password. You do have to set it up yourself, though it's pretty straightforward. The Tomcat manager webapp is restricted to users with a role named manager . So you'll need to create a user and assign the manager role to it. Edit $CATALINA_BASE/conf/tomcat-users.xml to read:
<?xml version='1.0' encoding='utf-8'?> <!-- ...For tomcat 7:
<tomcat-users> <role rolename="manager"/> ...
Created by Fang on September 07, 2009 20:44:15 Last update: November 03, 2011 14:43:19
Step 1: Repackage a web app as EAR A Java EE application is a multimodule Maven project. At the very least you'll need to package a WAR and an EAR. To get started, I'll simply re-package the simple webapp as an EAR. Create a directory named javaee-app Copy the webapp from here to javaee-app . Rename struts1app to webapp . Create pom.xml under javaee-app :
<project> <modelVersion>4.0.0</modelVersion>...Create a directory named ear under javaee-app . Create pom.xml under ear :
<project> <modelVersion>4.0.0</modelVersion>...Modify pom.xml in the webapp directory so that it looks like this:
<project> <modelVersion>4.0.0</modelVersion> ...Build with " mvn package " in the javaee-app directory. You can see that ear-1.0.ear is successfully generated in javaee-app/ear/target . Maven successfully resolves dependencies between the sub-projects....
Created by magnum on October 08, 2011 20:37:04 Last update: October 08, 2011 20:37:35
Three APIs for event based non-blocking I/O: select() select() is limited to FD_SETSIZE handles. This limit is compiled in to the standard library and user programs. poll() There is no hardcoded limit to the number of file descriptors poll() can handle, but it does get slow about a few thousand. epoll() The epoll event mechanism is much more scalable than the traditional poll when there are thousands of file descriptors in the interest set. The work done by poll depends on the size of the interest set whereas with epoll (like Solaris /dev/poll ) the registration of interest is separated from the retrieval of the events. Reference: The C10K problem
Created by magnum on September 27, 2011 09:32:18 Last update: September 27, 2011 09:33:04
Use tcpdump to monitor traffic on a network: To print all incoming and outgoing packets on host 192.168.0.1 :
tcpdump host 192.168.0.1To print all incoming and outgoing IP packets on host firebird :
tcpdump ip host firebirdTo write raw packets to a file, rather than parsing and printing them out:
tcpdump ip host firebird -w /tmp/firebird.pcapTo listen on interface eth0 (without this, tcpdump listens on the lowest numbered, configured up interface except loopback):
tcpdump -i eth0 ipUse switch -X for more verbose output:
tcpdump -i eth0 ip -X host 192.168.0.1Outgoing from 192.168.0.1 :
tcpdump -i eth0 ip -X src host 192.168.0.1Incoming to 192.168.0.1 :
tcpdump -i eth0 ip -X dst host 192.168.0.1More verbose output:
tcpdump -i eth0 tcp -vvX host 192.168.0.1...
Created by magnum on September 21, 2011 16:01:16 Last update: September 21, 2011 16:02:33
More like assign a second ip address to the same nic, instead of a virtual nic. Multiple IP addresses can be assigned to the same NIC, but all IP addresses must be on the same subnet - otherwise some IP addresses will not be accessible. From command line, assign IP address 192.168.0.2 to alias eth0:0 :
sudo ifconfig eth0:0 192.168.0.2 netmask 255.255.2...But IP addresses added this way are not persistent. They are lost whent he OS is restarted. To make the additions persistent: For Fedora:
$ su - # cd /etc/sysconfig/network-scripts/ ...The contents of ifcfg-eth0:0 should look like this:
DEVICE=eth0:0 IPADDR=192.168.0.2 NETMASK=255...Restart network:
# service network restartFor Ubuntu:
$ sudo vi /etc/network/interfacesAppend this to the file:
auto eth0:0 iface eth0:0 inet static name Et......