Posts

Showing posts from April, 2009

Linux/Unix misc

http://linux.101hacks.com

bash, profile, sourcing, environment inheritance, et. al.

network connection monitoring tcptrack

Use the following to avoid coding paths or using environment variables in scripts:
BASEDIR=$(dirname $0)

Erasing contents of a file with /dev/zero

/dev/null
/dev/zero

Creating a RamDisk


List CPUs and types:
cat /proc/cpuinfo

Filesystem structure

Filesystem Hierarchy Standard (FHS)

chrontab quick reference

LD_LIBRARY_PATH - don't set it, set-uid programs ignore it
List linked files
ldd

Iterate what make install will do:
make -n install <makefile>

Virtual IP configuration: Unix, Linux, Windows

HA failover with keepalived: Linux

HA through award-winning 'Failover': Solaris, Linux

Load balancing/clustering: Window, Linux
Ultra Monkey: load balancing and HA

To kill process where pid is in file:
backtick replaces command with command execution, see bash programming
kill `cat pid.file`

Reboot Solaris:
shutdown -y -i6 -g0

Solaris logs:
dmesg command - kernel message buffer (boot…

SharePoint as a Wiki

FireFox 3.0.8 caches more aggressively than Internet Explorer (IE)

When changing the DNS and/or destination of a load balancer, had issues where the content displayed did not represent the new destination. IE updated and showed the correct page, however FireFox had to be restarted in both cases. Neither Ctrl Refresh or opening a new tab resolved the issue. Restarting FireFox fixed the issue in both cases.

HTML, Latin-1, MS uses CP1252 not latin-1

Coding Horror

Ubuntu Compiz Fusion Java 3D issue

This didn't work for me

tried putting it in
/etc/environment
/etc/profile
.profile
.bashrc

Another entry
sudo gedit /etc/profile
add
export AWT_TOOLKIT=”MToolkit”

The below didn't work for me with Ubuntu 8.04 and Java 1.6.0_12

Resolution:

sudo gedit /etc/environment

Add the following below the path line:

AWT_TOOLKIT=”MToolkit”

shell scripting

`basename $0` - script name

List dir in loop
> while true; do clear; ls; sleep 2; done;

for jar in *.jar; do echo $jar; unzip -l ${jar} | grep SomeText; done

find . -name target | xargs rm -rf

Kill all of one type of session
Use with care - test grep first
ps aux | grep sql | awk '{print $2}' | xargs kill -9

Workflow

JSF components

Java Media Framework - recording and playing audio and video

Java Spell Checking

Java Text-to-Speech and Speech Recongnition

Ubuntu playing non-free media formats

Eclipse external tools ant build scp

To configure unprompted scp ant task:

Install/Create .ssh dir in the home dir with auth_keys or authorized_keys and known_hosts files on xnix server

In eclipse external tools ant script config, add ssh library:
jsch.0.1.33.jar

Copy private key to system with ant/eclipse and point to private key file with ant task

google solaris scp without password

Unix stuff

Flash is king, Silverlight has issues

Flash installed on 99% of browsers
Silverlight 25% of browsers - requires admin rights to install

ZDNet article

Concurrency / Threading Testing

Just google it

Load Balancing

HAProxy:

HAProxy vs Nginx description

HAProxy vs Nginx latest graphs

HAProxy was simple to setup and configure for sticky sessions and x-forwarded-for source IP pass-through, see HOWTO

It was in the Ubuntu Synaptic Package Manager, so it was a click to install.

Edited the /etc/haproxy.cfg to configure

Started with:

sudo /etc/init.d/haproxy [start|stop]

Comes with admin stats that by default is on the same balancer front-end address and port, i.e., http://<balancer-address>:<port>/haproxy?stats
The docs indicate default is /admin?stats

Hot reconfig:

${HAPROXY} -p ${PIDFILE} -f ${CONFIG} ${HAPROXY_OPT} -sf $(cat ${PIDFILE})


# haproxy.cfg file example

global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#debug
#quiet
user haproxy
group haproxy

defaults
log global
mode http
option httplog
option dontlognull
retries 3
redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000

listen eon 0.0.0.0:8282
mode http
stats enable
stats uri /ad…

Create new VMware Virtual Machine

Web 2.0 Performance

More readable and maintainable code

Instead of regex:

Pattern.compile("\\b\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\b");

Use:

"\\b\\p{Digit}{10}\\b"
or
"\\b\\d{10}\\b"
or
"\\b[0-9]{10}\\b"