Recent Notes
Displaying notes 41 - 50
Created by Fang on January 04, 2013 09:02:44
Last update: January 04, 2013 09:02:44
This snippet sets system properties from Maven surefire test plugin. This is useful when you want to set logging (for example, log4j) properties based on Maven project properties.
Example that sets system property testlog.dir :
<plugins>
<plugin>
<groupId>org.apach...
Example log4j.xml that uses system property testlog.dir :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYP...
Created by Fang on January 04, 2013 08:00:37
Last update: January 04, 2013 08:00:37
This is a Maven POM that prints out some built-in project properties:
<project
xmlns="http://maven.apache.org/PO...
Output:
$ mvn validate
[INFO] Scanning for projects.....
Created by magnum on December 25, 2012 15:14:42
Last update: December 25, 2012 15:14:42
The C function strtok tokenizes a string when you call it repeated with a NULL pointer. It should be mentioned that it destroys (alters) the original string.
#include <stdio.h>
#include <stdlib.h>
#incl...
Created by woolf on November 26, 2012 20:54:07
Last update: November 26, 2012 20:54:07
Use the shortcut CTRL+ALT+T to bring up a terminal in Ubuntu.
Created by woolf on September 07, 2011 08:16:10
Last update: November 26, 2012 20:50:39
Follow these steps to restore the Gnome panel if you deleted it by accident:
Open a terminal by bringing up the Run dialog and entering gnome-terminal
In the terminal enter:
$ gconftool-2 --shutdown
$ rm -rf ~/.gconf/apps...
For Unity, use:
unity --reset
unity --replace
Created by magnum on November 10, 2012 18:42:19
Last update: November 10, 2012 18:42:19
IFS : The Internal Field Separator that is used for word splitting after expansion and to split lines into words with the read builtin command. The default value is "<space><tab><newline>".
$ echo "$IFS" | cat -vte
^I$
$
Created by magnum on November 03, 2012 08:57:35
Last update: November 03, 2012 08:57:35
Code snippet to check user name and password in C in Linux
#include <sys/types.h>
#include <pwd.h>
#inc...
Created by James on November 01, 2012 13:51:42
Last update: November 01, 2012 13:51:42
One way to vertically center a line of text in a container div is to set line-height to be the same as the height of the container. But that requires specifying line-height in pixels. This technique avoids that.
<!doctype html>
<html>
<head>
<style typ...
Created by Fang on October 31, 2011 12:54:05
Last update: October 23, 2012 12:31:16
In JSP you output the web application context path with:
${pageContext.request.contextPath}
Facelets are not JSPs, and there's no pageContext . So the above does not work.
But in facelets you can use request directly:
${request.contextPath}
For example, a link to the root URL:
<a href="${request.contextPath}">Home</a>
Servlet request URL:
<h2>#{request.requestURL}</h2>
Created by magnum on October 22, 2012 20:03:05
Last update: October 22, 2012 20:03:05
First, the test command that sleeps random number of seconds ( sleeper.sh ):
#!/bin/bash
stime=$[$RANDOM % 20]
sleep $sti...
As comparison, synchronous pipe code:
#include <sys/wait.h>
#include <stdio.h>
#in...
Asynchronous pipe code:
#include <sys/wait.h>
#include <stdio.h>
#in...