Recent Notes

Displaying keyword search results 1 - 10
Created by Fang on March 30, 2012 10:07:25    Last update: March 08, 2013 13:41:57
After a user resets a password, I want to force the user to change the password before she gets access to secured content. This is usually done with a servlet filter. But with Spring MVC, you can also use a HandlerInterceptor . According to Spring JavaDoc: HandlerInterceptor is basically similar to a Servlet 2.3 Filter, but in contrast to the latter it just allows custom pre-processing with the option of prohibiting the execution of the handler itself, and custom post-processing. Filters are more powerful, for example they allow for exchanging the request and response objects that are handed down the chain. Note that a filter gets configured in web.xml, a HandlerInterceptor in the application context. As a basic guideline, fine-grained handler-related preprocessing tasks are candidates...
Created by freyo on February 09, 2013 14:17:32    Last update: February 09, 2013 14:17:32
More info on how to change DNS setting on the Android phone: How do you change the DNS? Custom DNS Servers
Created by Fang on January 04, 2013 14:16:58    Last update: January 04, 2013 14:16:58
Junit does not support specifying execution order of tests until 4.11. The methods were simply invoked in the order returned by the reflection API. So, the tests are executed in a unspecified but deterministic order, i.e., you have no control over the order of execution, but if you repeat the tests, they are run in the same sequence each time. For version 4.11, you can specify the order with the FixMethodOrder annotation: import org.junit.runners.MethodSorters; imp... From the release notes : Test execution order By design, JUnit does not specify the execution order of test method invocations. Until now, the methods were simply invoked in the order returned by the reflection API. However, using the JVM order is unwise since the Java platform does not specify...
Created by voodoo on September 17, 2012 15:02:15    Last update: September 17, 2012 15:02:15
Start gdb with the executable and coredump: $ gdb <path to executable> core While in the debugger, use the following commands: (gdb) where ("shows a summary of the stack") ... Example debug session from Debugging Under Unix: gdb Tutorial : Use backtrace (or bt ) to see the callstack: (gdb) backtrace #0 Node<int>::next (this=0x0) ... Inspect the value of item_to_remove at address 0xffbef014 (the value is 1): (gdb) x 0xffbef014 0xffbef014: 0x00000001 (g... Note: The program must be compiled with the debug switch -g in order to see the source code. More resources: Linux software debugging with GDB Debugging with gdb
Created by Dr. Xi on August 24, 2012 14:20:19    Last update: August 26, 2012 11:48:22
Converting hex number to decimal is surprisingly easy in Python: $ python Python 2.7.3 (default, Aug 1 2012, 05...
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 magnum on July 04, 2012 20:52:12    Last update: July 04, 2012 20:52:12
Example 1: Proxy-Authenticate: Basic realm="proxy" Example 2: Proxy-Authenticate: Digest realm="atlanta.com", ... Example 3: Proxy-Authenticate: NTLM More examples from SIP: Session Initiation Protocol (RFC 3261)
Created by Dr. Xi on June 06, 2009 18:31:44    Last update: June 25, 2012 12:37:35
You can use the system call from the os module to execute an external program: >>> import os >>> os.system(the_command_line_st... However, the path to the executable contains a space character, the system call treats the strings after the first space as arguments, causing an error. Python doc recommends the use of the subprocess module: The subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using this function. For example, using wget to get the google home page: >>> from subprocess import Popen, PIPE >>> (out... or >>> import subprocess >>> subprocess.call(['cur...
Created by James on April 25, 2012 08:50:18    Last update: April 25, 2012 08:50:18
All DOM manipulation methods can move an element from one place to another, but the .appendTo() and .insertBefore variations are more convenient: // moves h2 before .detail if there's one h2 a...
Previous  1 2 3 4 5 6 7 8 9 10 Next