LCD text in NetBeans
Finally figured out how to enable sub-pixel rendering (also known as LCD text) in NetBeans. Just add -J-Dawt.useSystemAAFontSettings=lcd to netbeans_default_options variable in your ~/.netbeans/6.1/etc/netbeans.conf
Discoveries and thoughts about code.
Finally figured out how to enable sub-pixel rendering (also known as LCD text) in NetBeans. Just add -J-Dawt.useSystemAAFontSettings=lcd to netbeans_default_options variable in your ~/.netbeans/6.1/etc/netbeans.conf
Posted by
Nicholas Sushkin
at
2:26 PM
0
comments
Labels: java
Here is a bash function which returns a random permutation of the input lines of text.
#****f* shadegrowncode/randomShuffle
# NAME
# randomShuffle - prints random permutation of lines in standard input
# FUNCTION
# Prints all or the first N lines of a random permutation of the
# lines of standard input. The random permutation is obtained using
# Durstenfeld shuffle algorithm. Performance is O(N) in memory and
# CPU. Limit the input to 32768 lines or rewrite using a different
# random generator.
# SEE ALSO
# http://en.wikipedia.org/wiki/Knuth_shuffle
# PARAMETERS
# * 1 - (optional) return only the first N of the random lines of input
# SOURCE
function randomShuffle
{
typeset -a elements
typeset length=0
while read line
do
elements[$length]=$line
length=$(($length + 1))
done
typeset firstN=${1:-$length}
if [ $firstN -gt $length ]
then
firstN=$length
fi
for ((i=0; $i < $firstN; i++))
do
randPos=$(($RANDOM % ($length - $i) ))
printf "%s\n" "${elements[$randPos]}"
elements[$randPos]=${elements[$length - $i - 1]}
done
}
#***
$ cut -d: -f1 /etc/passwd | randomShuffle 3
sync
sysadmin
vcsa
$ echo $(printf "%s\n" 0 1 2 3 4 5 6 7 8 9 | randomShuffle)
4 1 0 6 8 7 2 5 3 9
Posted by
Nicholas Sushkin
at
4:41 PM
1 comments
Labels: bash
Patrick Volkerding (Slackware Project Lead) gives glowing thumbs up to KDE4 and slates it for inclusion into Slackware 14. Slackware is currently at version 12 and releases once a year. At this rate, KDE4 will be in Slackware in 2009. Among other things, Patrick says the following.
The look of the new [KDE] desktop is stunning, and the use of SVG and hardware acceleration gives (IMHO) even something like MacOS a run for its money in terms of appearance and user-friendliness. We look forward with great anticipation to merging KDE4 when it is mature enough (and it's getting there fast), and then watching it just get better and better.The full quote can be found in Slackware ChangeLog.
Posted by
Nicholas Sushkin
at
8:25 PM
0
comments
Windows taskbar clock cannot display seconds since Windows 95.
Why? Because when installed on a 4 Mb machine, Windows 95 was too slow to display seconds. This and other lame excuses are blogged at MSDN. There is a whole shareware industry around Windows to fix this problem. If you want to measure time, use online javascript stop watch or US atomic clock at time.gov
Posted by
Nicholas Sushkin
at
2:15 AM
0
comments
Looking at this cup of soy milk in Taipei, I thought at first that somebody stole Java logo. Then, looking closer, I realized it's a genuine ad for Java training. Something you won't see on a milk container in the US...
Posted by
Nicholas Sushkin
at
7:59 PM
0
comments
The following code uses only shell scripting and curl to log in to a website protected by a form based authentication and download contents of page "about.jspx". We pay special attention to returning reasonable error messages. These snippets were tested with Tomcat 5.5.
eval set -- $(getopt "u:p:b:" "$@")
while [ "$1" != "--" ]
do
case "$1" in
-u) shift; WEB_UID="$1"; shift; ;;
-p) shift; WEB_PWD="$1"; shift; ;;
-b) shift; BASE_URL="${1%\/}"; shift; ;;
esac
done
typeset aboutUrl="$BASE_URL/about.jspx"
typeset securityAction="$BASE_URL/j_security_check"
typeset logoffUrl="$BASE_URL/logoff.jsp"
headers="$(curl -s -S -f -L -D - -o /dev/null --url "$aboutUrl" 2>&1)" \
|| error "Error accessing $aboutUrl: $headers"
if [[ "$headers" =~ 'Set-Cookie: JSESSIONID=([^;]*)' ]]
then
sid="${BASH_REMATCH[1]}"
fi
about="$(curl -s -S -L -f -b "JSESSIONID=$sid" -o - \
-d "j_username=$WEB_UID" \
-d "j_password=$WEB_PWD" \
--url "$securityAction" 2>&1)" \
|| error "Error submitting credentials to $securityAction: $about"
if [[ "$about" =~ 'sysdate date=\"([^\"]*)\"' ]]
then
date="${BASH_REMATCH[1]}"
fi
curl -s -f -b "JSESSIONID=$sid" --url "$logoffUrl" -o /dev/null
September 11th was a Sun NetBeans day in Boston. Here's what I learned:
Posted by
Nicholas Sushkin
at
2:48 PM
0
comments
Learn about my employer - OpenFinance