Posts

Showing posts from 2008

Java Comm API

Downloaded comm3.0 and followed install instructions Port Opener Followed this Downloaded rxtx-2.1.7 from here Parallel Port Status Signalling Windows configuration and debug info GUC232A Ubuntu 8.04

POJO server - remotable thick-client

Harbor Original site Pojo Application Server

MapReduce

Chris Wensel - Cascading

RMI dynamic class downloading

Java RMI since very early version has been able to dynamically download classes. Java RMI properties Dynamic code downloading using RMI 4.0 Using codebase in RMI for more than just stub downloading In addition to downloading stubs and their associated classes to clients, the java.rmi.server.codebase property can be used to specify a location from which any class, not only stubs, can be downloaded.

JMX

Throw standard java exceptions vs. custom exceptions in custom jmx mbeans. If custom exceptions are thrown and they were not included on classpath when starting jconsole, a classNotFoundException will be thrown and the exception message will not be displayed. Java 6 Enhancements HOWTO Object naming MBean interface names must end with MBean, and the MBean class for the FooMBean interface must be called Foo. (You can lift this restriction by using a more advanced JMX feature, dynamic MBeans.) public interface FooMBean public class Foo Create and register MBean instance: Foo foo = new Foo(...); MBeanServer server = ManagementFactory.getPlatformMBeanServer(); Alternatively for JBoss: MBeanServer server = MBeanServerLocator.locateJBoss(); server.registerMBean((FooMBean)foo, new ObjectName("myapp:type=foo,name=uniqueString")); Alternatively: server.registerMBean(foo, new ObjectName("topLevelNodeName:subNodeName=foo,subNode2Name=bar,mbeanName=uniqueNodeNameString")); In J

Gimp text how-to

Gimp text how-to

Web Service Coordination and Trasactions

Distributed transactions with WS-AtomicTransaction and JTA

Installing Java on Ubuntu 8.10 Intrepid Ibis

Several versions are available through System -> Administration -> Synaptic Package Manager The following did not work: Installing Java JDK sudo apt-get install sun-java6-jdk sun-java6-plugin JRE sudo apt-get install sun-java6-jre sun-java6-plugin

update BADSIG Ubuntu 8.10 Intrepid Ibis

Fixed with First time: sudo apt-get update -o Acquire::http::No-Cache=true Second time above didn't work, used: Go to Administration, "Software sources" Click "Download from" drop-down Select "Other" Click button on upper right "Select Best server". After it tests the servers, click on "Choose Server" Problem W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used.GPG error: http://us.archive.ubuntu.com intrepid-updates Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/intrepid-updates/Release W: Some index files failed to download, they have been ignored, or old ones used instead. W: You may want to run apt-get update to correct these problems

Disk Partitioning with Ubuntu Partition Manager

With the Partition Manager shipped with Ubuntu 8.04, don't move empty partitions, it takes forever. Partition manager moves them sector by sector. Delete empty partitions and create new partitions which is very quick. All changes in partition manager are queued and then all run sequentially. If you move a partition left then right, it queues both actions and performs both which can take a long time. It doesn't evaluate changes and aggregate or eliminate unnecessary actions. There is an Undu button, use it. Why ext3

Dell Studio setup

/dev/sda1 ntfs 25 GB MS Vista boot /dev/sda2 extended 207 GB /dev/sda5 ext3 20 GB Ubuntu linux 8.10 Intrepid Ibis boot unallocated 48 GB Spare /dev/sda6 ext3 35 GB Ubuntu linux 8.04 Hardy Heron boot /dev/sda7 ext3 35 GB XP GWNB VMware /dev/sda8 ext3 34 GB XP eMach 64 bit VMware /dev/sda9 ext3 34 GB Spare /dev/sda3 linux-swap 5 GB

Sites, Newsletters, and Blogs

BLOGS Java.net Weblogs Martin Fowler's blog Paul Graham Ruminations of a Programmer Form Follows Function Newsletters Core Java Tech Tips Enterprise Java Tech Tips JavaSpecialists.EU TheServerSide.com Sites Java.net Today Hot Java Sites CSS Zen Garden Evernote Hacker News Pragmatic Programmer

Web development plugins and tools

Fiddler - Web Debugging Proxy For linux use firebug (free) inside firefox or use Charles - web debugging proxy $50 WireShark - cross platform network protocol analyzer FireFox plugins: Tamper Data: Use tamperdata to view and modify HTTP/HTTPS headers and post parameters. Trace and time http response/requests. Web Developer: Adds a menu and a toolbar to the browser with various web developer tools. FireBug: You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page. IE Developer Toolbar Eclipse ATF JavaScript Debugger Also available from eclipse.org/atf

AboutTime

AboutTime is a scheduling system that schedules human resources based upon constraints and availability in MS Exchange.

Search & indexing

Java open-source search engines Compass Lucene Java Search Engine

Open-source software listings

Java Specific Manageability Open Source Java-Source.net Enhydra.org JCraft Java cURL Non-Java specific Open-source software listing

Network/Application Management

Nagios monitors hosts and services, notifies of failures/responsiveness and recoveries - free open source linux Icinga fork of Nagios SPLUNK data indexing and mining companion for Nagios. Allows searching data like distributed log files for root cause analysis to failures reported by Nagios. Free version limited to 500 MB /day, no distributed search and clustering, can't receive data from other SPLUNK servers, no access controls and multiple user accounts. AWStats GNU logfile analyzer Nagios plugins MRTG stored in RRD format MRTG multi-router traffic grapher Cacti - network graphing solution

JBoss 4.2.x

The following VM option is required to run JConsole without clutter of JBoss JMX beans -Dcom.sun.management.jmxremote Add the following as Program Arguments if you want the clutter of JBoss JMX beans. Unfortunately, you have to drill down to the standard VM JMX beans. -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl -Djboss.platform.mbeanserver -Dcom.sun.management.jmxremote To run multiple instances under one install copy the jboss-4.2.x/server/<serverName> to new instance names. To change ports to eliminate conflicts , edit jboss-4.2.x/server/<serverName>/deploy/conf/jboss-service.xml To change default 8080 web port , edit and change the connector: jboss-4.2.2.GA\server\default\deploy\jboss-web.deployer\server.xml edit and change the invoker: jboss-4.2.2.GA\server\default\deploy\http-invoker.sar\META-INF\jboss-service.xml To create custom startup scripts , copy and edit jboss-4.2.x/bin/ run.sh and run.conf Enabling logging of load bal

JProfiler

JProfiler VM options that work with JBoss 4.2.2 -agentlib:jprofilerti=port=8849 "-Xbootclasspath/a:C:\Program Files\jprofiler5\bin\agent.jar"

Premature Optimization - early load testing and profiling

Premature optimization applied broadly is often a bad thing, however, a good developer will utilize common sense and experience when selecting and applying design idioms and patterns. When you are dealing with a singleton shared resource like the highly utilized core database, it is absolutely necessary to be aware of best and bad practices and to design appropriately around them. Every query either good or bad affects every other user of the system. With respect to the database, spending up front time to consider and design optimal access is warranted. Those choices pay off later as the system is enhanced and scaled. One common theme I have experienced at the last few companies and on the last few projects is that lots of code was implement and deployed without early and regular load testing and profiling. By the time performance issues became apparent, bad selections had become embedded and bad practices had proliferated through the code base. At that point it was very time consuming

JavaServerFaces (JSF) excessive heap new generation objects

Observing 10s - 100s MB of Java heap growth on 10s - 100s KB JSF pages. Observeing > 100:1 ratio (heap growth / page response). Creation or growing many Collections and/or the underlying arrays without knowing the necessary final size can generate excessive garbage. This is not to say that this is in any way expensive. In fact, quite to the contrary, testing has proven that this type of garbage is often quite cheaply created and reclaimed. However, if many or large objects of this type live beyond a young generation GC cycle, they might very well spill into the tenured generation. If this occurs often enough, they will adversely affect full GC (stop-the-world) time.

Ubuntu 8.10 Intrepid Ibex

Installs with Compiz Fusion, to install the configuration manager execute: sudo apt-get install compizconfig-settings-manager

JBoss 4.2.x JConsole MyEclipse Java 1.6u10

To get JConsole to successfully connect to JBoss 4.2.2 under Java 1.6.0_10 started from MyEclipse 6.6.0 based upon Eclipse 3.3.2, I had to add the following to the VM arguments: Don't load JBoss MBeans - reduced clutter -Dcom.sun.management.jmxremote JBoss -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl -Djboss.platform.mbeanserver -Dcom.sun.management.jmxremote Remote JConsole connection args hostName:portNum service:jmx:rmi:///jndi/rmi://hostName:portNum/jmxrmi Remote config args -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=6002 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false

JVM Options

Comprehensive JVM options 1.3 - 1.6, has lots of links many about tuning SDN JVM options -Xms100M initial heap -Xmx100M max heap -Xmn100M young gen -Xss1M max stack size -XX:MaxPermSize=64m -Xbootclasspath[/a|/p]:<path> -XX:+DisableExplicitGC -Xloggc:<file> -XX:+PrintGC -XX:+PrintGCDetails -XX:NewSize=2.125m -XX:SurvivorRatio=8

SEAM

SEAM JBoss 4.2 Reference Guide for SEAM SEAM Tutorial and Overview Facelets/JSF

Fixing grub MBR

How to fix grub MBR fsck Other disk utilities smartmontools command line tools is 'smartctl' background monitoring daemon is 'smartd'

Strings and interning

String.substring does not copy or intern the substring, it points to the char array within the original base string, encumbering it so that it can't be garbage collected. The original base String is encumbered even if the substring is zero length. As of Java 1.2 any interned String with no references may be garbage collected since they are weak references. See post The above site indicates String.inter stores utilizes Heap, some other sites indicate that interned Strings are stored in perm gen. Testing validates that interned Strings are stored in perm gen.

Fix windows XP MBR with Ubuntu Live CD

After I recovered a Windows XP partition with Acronis, I followed this posting to restore the MBR which previously had a GRUB loader from a dual-boot Ubuntu installation. It worked perfectly however you have to download the ms-sys and manually install it from: http://packages.ubuntu.com/gutsy/ms-sys sudo fdisk -l This gives you a list of partitions. Using the info from the windows partition you want to boot into execute the following, be sure not to include the number. sudo ms-sys -m /dev/sda Now reboot and windows should load.

Enterprise Architect on Ubuntu with CodeWeaver's Wine

Save yourself a lot of trouble and just run it on Windows under VirtualBox. It works perfectly. It runs under WINE, but the help menus don't work and the ODBC for reverse engineering seems quite difficult to configure. Did get Sybase freeTDS to connect, but couldn't see the ODBC DSNs in EA. Gave up and decided to run it on Windows. For forward/reverse engineering of databases, setup unixODBC Setup unixODBC Wine integration by sudo gedit /etc/profile Add: export LIB_ODBC_DRIVER_MANAGER=/usr/lib/libodbc.so.1.0.0 Follow EA on linux setup CodeWeaver's Wine

Ubuntu ODBC

Via Applications : Add/Remove Installed OpenOffice.org Database Via System : Administration : Synaptic Package Manager Installed tdsodbc, unixodbc, unixodbc-bin Created a freetds.conf per freetds docs cp /usr/share/libct3/freetds.conf ~/.freetds.conf Added entry: [arbitrary name for server/service] host = 10.12.10.19 port = 1433 tds version = 5.0 Using unixODBC Configured Sybase tds driver sudo ODBCconfig selected Drivers tab and clicked Add filled out the form based on tooltips the drivers are in /usr/lib/odbc the checkmark at the top is the save button logged out and logged back in without sudo The above created /etc/odbcinst.ini with the entry: [arbitrary name for driver] Description = Sybase tdsodbc Driver = /usr/lib/odbc/libtdsodbc.so Setup = /usr/lib/odbc/libtdsS.so UsageCount = 1 CPTimeout = CPReuse = System DSN tab edits /etc/odbc.ini and creates an entry like: [arbitrary name for system DSN] Description = some desc Driver = tdsodbc Servername = somename entry from ~/.fr

Ubuntu create screencasts

Use xwininfo -frame to get any frames coordinates and size

Ubuntu Hardy Heron ssh server setup

sudo apt-get install openssh-server sudo gedit /etc/ssh/sshd_config PermitRootLogin no sudo /etc/init.d/ssh restart Followed this post to install ssh server

Ubuntu Hardy Eclipse too many open files

Followed this post and raised limits To check maximum # fd in system cat /proc/sys/fs/file-max To count open fd for a process lsof -p 460 | wc -l 460 is PID To check shell level fd ulimit -n To change it sudo gedit /etc/security/limits.conf add * soft nofile 65536 * hard nofile 65536 troy - nofile unlimited sudo gedit  /etc/pam.d/common-session Then add the line: session required pam_limits.so Save the file logout and login to take affect http://posidev.com/blog/2009/06/04/set-ulimit-parameters-on-ubuntu/

Oracle vs. PostreSQL vs. MySQL

Google search: database feature postgres mysql Database market share graphs Recent article - PostgreSQL looks best as a free alternative to Oracle Non standard MySQL stuff Why PostgreSQL Instead of MySQL: Comparing Reliability and Speed in 2007 Five Compelling Reasons to Use MySQL History and Licensing Postgres vs. MySQL 2004 Why is MySQL more popular than PostgreSQL? Josh Berkus: Two great open source databases: a comparison (2008-06-26) - While it seems to favor Postres, after reading it, I felt more confident in MySQL. Summary: The biggest gripe I have with MySQL is its deviation from standards. MySQL's acceptance and adoption by heavyweights are votes of confidence and proof of capability. Given that the cost, feature matrices, and performance are comparable, I would put my support behind the industry leader. Of course in the interest of full disclosure, I would pick Unix/Linux over Microsoft. MySQL Customer list PostreSQL Customer List Sabre Holdings Corporation - a transac

Vmware player windows sceen size

Trying to set MS Windows display running in VMware player to size of Ubuntu screen. Custom screen resolutions Knowledge base article 1003 Tried this, no luck Trying this

Ubuntu mic on Lenova ThinkCentre

Had trouble getting it to work: Opened volume control File : Change Device : 3 Capture: Monitor Source of ALSA PCM on front:0(AD198x Analog) via DMA (PulseAudio Mixer) On Recording tab adjust Master record volume up File : Change Device : 0: HDA Itel (Alsa mixer) Adjust as necessary, now the Recording tab Digital mic level will adjust the recording level Right click on volume control and Preferences Select HDA Intel (Alsa mixer) Select PCM so volume bar will adjust volume Not sure it this was necessary, but also followed the following post : sudo gedit /etc/modprobe.d/alsa-base added at end of file options snd-hda-intel model=6stack-digout then reboot. After that you have to increase volume in MASTER, PCM, FRONT, FRONT MIC , SURROUND (nothing else, otherwise it won't work), and set input source to FRONT MIC, 8ch.

Windows VirtualBox in physical partition

Installed VirtualBox with this post , but used latest version Ubuntu deb package Warning When launching a Virtual OS, don't ever boot into the current or host OS or corruption will occur. Followed this link and it works Initially mouse and keyboard were not capturing, click the do not show again checkbox on the popup message and it fixes the capture problem. Create a new hardware profile for windows so VirtualBox dosn't alter the base profile Be sure to set profile selection to manual or preferred, set the new profile ahead of the base profile so don't accidentally boot into the base from virtual boot * Click Start : Control Panel : System * On the hardware tab, select Hardware Profiles * Click Copy, and name the new hardware profile Virtual * Set the selection to manual * Move the Virtual profile to the top Add yourself to the disk group so when you run VirtualBox, it has permission to write to the disk sudo usermod -G disk,vboxusers -a `whoami` Create

Editing MBR

The following forum post has links that discuss editing the MBR: You can reinstall Ubuntu's grub IPL to the mbr, using the live cd You could add a configfile entry to boot Xubuntu: See the section on booting multiple linux distros...also, this link will explain everything you need to know about grub.

Ubuntu install on windows box

This post explains the steps to install Ubuntu under Windows with the Wubi installer. It then continues to outline the steps to move the Ubuntu install with LVPM to its own partition and make it the primary OS. Next it explains how to replace the Ubuntu install with another Ubuntu install. Finally it explains how to make the original Windows OS run virtually within/under the Ubuntu OS with VMWare and VirtualBox. Installing Ubuntu in Windows with Wubi - Cleanup, compress, remove unnecessary cruft, and empty the trash from existing windows install - Backup existing windows install with something like Acronis - Download Wubi Ubuntu installer and install Ubuntu in a file within the existing windows partition Note: Now Ubuntu will be listed in the boot list and you can boot into either OS. Moving Ubuntu to its own partition - Reboot into the Ubuntu live CD and repartition the drive. - Enter the BIOS menu and set the boot order to CD/DVD drive before HDD, i.e., Restart the com

Developer Humor

Development Interviews The only true measure of code quality - WTFs per minute Geek Programmer Cool mail signatures Programming Languages History

Agile and continuous integration

Adopting Agile Development Design vs Knowledge Creation: Attacking risk early along with early and continuous integration improves development. Agile attitude: Transparency Forget Burn-down, Use Burn-up charts : graph both total and completed, that way you can see when backlog was added or removed along with iteration velocity. It is then obvious why decreases in remaining occurred - whether due to backlog changes or velocity changes. I would recommend adding annotations with links to notes indicating what changed. What was added/removed to backlog? Were there less team members due to vacations, etc? Were team members shuffled? Agile Anti-patterns

Eclipse Ganymede on Ubuntu Hardy Heron 8.04

Install procedure: wget http://ftp.osuosl.org/pub/eclipse/technology/epp/downloads/release/ganymede/R/eclipse-java-ganymede-linux-gtk.tar.gz tar xzvf eclipse-java-ganymede-linux-gtk.tar.gz

Ubuntu Kung Fu

Ubuntu kung fu tips site Ubuntu psychocats tips site text editor features log file descriptions /proc - filesystem window into hardware Setting environment variables, see forum ~/.profile - per-user environment, source reloads in current terminal /etc/environment - simple key=values, no expansion, system wide environment loaded at boot, source reloads in current terminal shell A single dot followed by a file is the same as 'source file' which runs in the same shell not a new shell, i.e., '. .bashrc' sudo gedit /etc/profile - system wide bourn shell environment, only gets read by login shells. For graphical logins you don't get a login shell so it's up to the X session configuration to read /etc/profile. It seems that gdm and kdm are doing this with most Linux distributions, but others may not. gedit ~/.bashrc to edit local environment /etc/bash.bashrc group management List all groups a user belongs to: groups linux cheat-sheet To get list of UUIDs: ls /dev/disk

Keys randomly stuck repeating and cursor randomly jumping around in Ubuntu Hardy Heron 8.04

Turning of mouse clicks on touchpad fixed the cursor jumping around. System : Preferences : Mouse Touchpad tab Disable mouse clicks with touchpad According to this forum , disconnecting all USB devices for 10 seconds and reconnecting them resets something on the USB bus fixing the randomly stuck keys. This appears to have fixed the problem and I'm not seeing stuck repeating keys anymore. I only had a trackball connected.

Saw GTK errors with JConsole running and it seemed slow to respond

Found BLOG entry about slowness with NetBeans and GTK that switching to metal Look an Feel resolved. Saw some console errors about GTK, switched to Metal L&F and errors were no longer reported. jconsole -J-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel& C:\Progra~1\java\jdk1.6.0_02\bin\jconsole -help Usage: jconsole [ -interval=n ] [ -notile ] [ -pluginpath ] [ -version ] [ connection ... ] -interval Set the update interval to n seconds (default is 4 seconds) -notile Do not tile windows initially (for two or more connections) -pluginpath Specify the path that jconsole uses to look up the plugins -version Print program version connection = pid || host:port || JMX URL (service:jmx: ://...) pid The process id of a target process host A remote host name or IP address port The port number for the remote connection -J Specify the input arguments to the Java virtual machine on which jconsole is running

Java 6 Trouble-shooting guide

Sun trouble-shooting guide

Ubuntu desktop/window manager freezes up/locks up with multiple windows grouped with Compiz on Hardy Heron 8.04

Existing bug

Setting Window title and initial position Ubuntu Hardy Heron 8.04 with Compiz Fusion

Programmatically setting window titles, see forum entry . Using Escape Sequences To Set Gnome Terminal Options 1. Edit the Terminal Profile (Edit - Profiles - Title and Command Tab), change dynamically-set title option to "replaces initial title". 2. Edit a script file or run on the command line and change the PROMPT_COMMAND line to PROMPT_COMMAND='echo -ne "\033]0;"myWindowTitle"\007"' where (in octal) \033 => 0 => Ps = 0 (use string as a new icon name and title) ; => non-digit character string => "myWindowTitle" \007 => (non-printing character) The escape sequence I've employed is :- ESC ] Ps ND string NP OSC Mode ND can be any non-digit Character (it's discarded) NP can be any non-printing Character (it's discarded) string can be any ASCII printable string (max 511 characters) Ps = 0 -> use string as a new icon name and title Ps = 1 -> use string is a new icon name only Ps = 2 -> use string is a new

JConsole with JBoss 4.2.3 on Java 6

You must set the following when starting JBoss or you will get .ClassNotFoundException when trying to connect JConsole to the JBoss process see forum entry . Edit the JBoss startup script Add to run JConsole without JBoss MBeans JAVA_OPTS="-Dcom.sun.management.jmxremote $JAVA_OPTS" Add to run JConsole with only JBoss MBeans JAVA_OPTS="-Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl -Djboss.platform.mbeanserver -Dcom.sun.management.jmxremote $JAVA_OPTS" JBossMBeansInJConsole # Enable the jconsole agent locally JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote" # Tell JBossAS to use the platform MBean server JAVA_OPTS="$JAVA_OPTS -Djboss.platform.mbeanserver" # Make the platform MBean server able to work with JBossAS MBeans JAVA_OPTS="$JAVA_OPTS -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl" Can get JBoss MBeans through Jboss web consoles.

JConsole not connecting under Linux

In /etc/hosts, the hostname is not mapped to 127.0.0.1 Needs to be mapped to be mapped to 127.0.0.1 or it won't connect because it thinks it is trying to connect remotely Host file changes: 127.0.0.1 localhost 127.0.0.1 troy-laptop # fix for JConsole See blog entry JMX FAQ

Ubuntu Hardy Heron 8.04 sound buttons

Re: sound buttons not working correctly Go into System -> Preferences -> Sound, then select PCM (and PCM only) in the list near the bottom of the page.

Relabel partition Ubuntu Hardy Heron 8.04

The attached link explains how to manually relabel a partition.

VMware player 2.0.5 on Ubuntu Hardy Heron 8.04

Tried various methods, but couldn't get VMware player 2.5 to install and work. Trying this with bundle. I used the following method to get VMware player 2.0.5 installed and it is working flawlessly. sudo aptitude install build-essential linux-headers-generic downloaded VMware-player-2.0.5-109488.i386.tar.gz to /usr/local/bin/vmware-player cd /usr/local/bin/vmware-player tar xf VMware-player-2.0.5-109488.i386.tar.gz cd vmware-tools-distrib/ sudo ./vmware-install.pl

Fix VMware player 2.0.5 Windows clock sync under Ubuntu Hardy Heron 8.04

sudo gedit /etc/vmware/config add hostinfo.noTSC = "TRUE" tools.syncTime = "TRUE"

Ubuntu 8.04 Hardy Heron Hibernate/Resume on Dell Studio 1735

Used: uname -r - to verify kernel version sudo fdisk -l - to check all partitions mount - to see what was mounted more /etc/fstab - to get filesystem and mount points ls /dev/disk/by-uuid -alh - to get a list of UUIDs Edited /boot/grub/menu.lst per instructions below Got Hibernate/Resume working using: zcat Says: September 14th, 2008 at 4:32 pm What I did was three things to get hibernate to work with Ubuntu Hardy 2.6.24.21 ... 1. change platform to shutdown >sudo gedit /usr/lib/pm-utils/functions change from “platform” to “shutdown” 2. whitelist ptyq4 >sudo gedit /etc/default/acpi-support: # Add modules to this list to have them removed before suspend and reloaded # on resume. An example would be MODULES=”em8300 yenta_socket” # # Note that network cards and USB controllers will automatically be unloaded # unless they’re listed in MODULES_WHITELIST MODULES=”ptyq4″ 3. Changes grub to point to swap on resume >sudo gedit /boot/grub/menu.lst UUID (for your swap

EE 5

Why use EE 5 EE Blueprints EE directory structure - Blueprints

Setting up jvmstat and visualgc in Linux Ubuntu Hardy Heron

download jvmstat In a terminal, run: gksudo nautilus That will start a root file manager (GNOME) - graphical file browser with root access double click the jvmstat download and uncompress it to /usr/local/bin Copy /usr/local/bin/jvmstat/bin/visualgc to vgc so the command is shorter edit ~/.bashrc add the following two lines: export JVMSTAT_JAVA_HOME='/usr/lib/jvm/java-6-sun' PATH=$PATH:/usr/local/bin/jvmstat/bin To run visualgc, from a terminal, run jps to get a list of java process ids, then run vgc

Ubuntu Linux with Compiz Fusion = awesome!

It all just worked - including the integrated wifi, bluetooth, sound, mic, and integrated 2 MP web camera. I only had to do manual config to get hibernate/resume working, see details . Bought a new Dell Studio and upon booting Windows Vista for the first time, I discovered Vista is a pig consuming ~1 GB just to boot up. Had already been playing around with Ubuntu for many months and liked it, however, I wasn't sure it would support all my needs. I was wrong. I installed Ubuntu with Wubi. Ubuntu only takes ~350 MB to boot up. I added the Compiz Fusion composite window manager and enable 3D for productivity and the sheer enjoyment of using it. Can't keep my kids off my computer now. I configured the Evolution mail client for my various mail accounts and am quite pleased. Installed Skype, Java 6, Maven, Ant, Apache Tomcat, JBoss, GlassFish, MySQL, Eclipse, and NetBeans so my development environment is mostly good-to-go. With Eclipse, NetBeans, MySQL, FireFox, Evolution, and Skype

Big-O notation

Big-O Sorting Big O comparison graph Sorting algorithm comparisons and performance graphs SkipLists

Windows quotes and path separators compatible with Java

Windows sub-paths need to be quoted if they have spaces and the sub-paths should not end with path separators. Either of these issues causes problems for JWSDP-2.0. Correct example: C:\Java\jdk1.6.0\bin;%ANT_HOME%\bin;%SystemRoot%\system32;"C:\Program Files\MySQL\MySQL Server 5.0\bin" Incorrect examples: Missing quotes around a sub-path which includes spaces C:\Java\jdk1.6.0\bin;C:\Program Files\MySQL\MySQL Server 5.0\bin Sub-path quoted, but incorrectly ends in a file separator C:\Java\jdk1.6.0\bin;"C:\Program Files\MySQL\MySQL Server 5.0\bin \ ";%ANT_HOME%\bin

Why is the default answer always a web app?

Thick vs. Thin Client

CSS

selector {property: value; ...} selector HTML element or tag, or element or tag dot selector ex: p or p.class or .class properties = color: or font-family: or text-alight: or clear: or float: Resource list w3schools Tabless layout Zen Garden

Java vs. C++ performance

2008 comparison of Java, C++, Ruby, Python, Jython, JRuby, Groovy Performance article Java Urban Legends

Java GraphVis - Graph visualization library

Allows graphing software automatically. GraphVis home Maven setup Ubuntu install: sudo apt-get install graphviz Graphviz on steroids

Browser and OS and display resolution statistics

Statistics RIA statistics Stat Counter

GlassFish hosting

GlassFish hosting GlassFish hosting FAQ Solaris VPS GlassFish setup on etnic.net VPS vpslink - ubuntu $7.95

Embeddable/Distributable JMS

Getting Started with JMS Apache ActiveMQ Supported Protocols and URIs Apache ActiveMQ API EE 1.4 API EE 5 API Round trip topic and queue producer and consumer JUnit example code import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotSame; import javax.jms.JMSException; import javax.jms.MapMessage; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.Queue; import javax.jms.QueueConnection; import javax.jms.QueueReceiver; import javax.jms.QueueSender; import javax.jms.QueueSession; import javax.jms.Session; import javax.jms.TextMessage; import javax.jms.Topic; import javax.jms.TopicConnection; import javax.jms.TopicPublisher; import javax.jms.TopicSession; import javax.jms.TopicSubscriber; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.broker.BrokerService; import org.junit.After; import org.junit.Before; import org.junit.Test; public class TestMessaging

SGE

SGE download page Grid Engine on Windows DRMAA Java binding API DRMAA Java binding examples SGE info blog Windows can't be used as an SGE Master, only as a compute node Windows requires SUA/SFU to run SGE On Windows, can't run DRMAA Java binding API and submit jobs, could create a proxy to linux/unix system. SGE Master must be run on linux/unix based system SessionFactory factory = SessionFactory.getFactory (); Session session = factory.getSession (); //getContact() returns comma delimited list of DRMs final String contacts = session.getContact(); final String contact = //select one from list session.init(contact); String id = session.runJob(JobTemplate);

Memory Analyzer

Eclipse Memory Analyzer Tool (MAT) PDF

Swallowed Exception

It has been observed an application can have a significant amount of unnoticed Exception swallowing occurring. These exceptions are of a benign nature that are not flaws in the functionality, however they are bad practices to leave occurring unnoticed. Unless monitored, it can grow unnoticed until it becomes significant enough to notice. By the time it is noticed it can be prolific in the code and will be a major job to deal with. Exceptions have been observered with malformed URLs, XML parsers, Logging, JAXB, etc. Everytime an exception is created a collection is created and the stack trace is filled-in. Recommend instrumenting Throwable to track swallowed exceptions.

Finding swallowed exceptions or errors

To figure out how to identify swallowed Exceptions/Errors I wrote a test in Eclipse. I added conditional breakpoints on all Throwable constructors and printed out all stacktraces whenever any Throwable is constructed. It works, but you couldn't get at the message to print it since it is set as the last line of the Throwable constructor and the constructor message argument is not available to conditional breakpoint code. If you don't care about Exception/Error messages, just call this.printStackTrace() in conditional breakpoints on all Throwable constructors and look for Exceptions/Errors that reported the Throwable constructor but not logged later. These are possible swallowed exception/error candidates. As an alternative, copy the Throwable source code and instrument the constructor implementations. Then simply -Xbootclasspath/p: the implementation into the VM ahead of the default Java Throwable implementation. This would allow you to print the message and report all exception

Accessibility 508 Resource Injection

Greg Kedge documentation mailto:gkedge@gmail.com

Getting JVM main class and program args via JMX

See how to get pid in previous post See the article about how to get main class and program args via JMX from anywhere in app, not passed from main which would require clients to make them available. public class RuntimeInfo { private static volatile RuntimeInfo instance; private String host; private String pid; private String mainClass; private String args; private RuntimeInfo() { } public static synchronized RuntimeInfo getInstance() { if (instance != null) { return instance; } instance = new RuntimeInfo(); instance.acquireHostAndPid(); instance.acquireMainClassAndArgs(); return instance; } private void acquireMainClassAndArgs() { for (VirtualMachineDescriptor vd : VirtualMachine.list()) { final String[] virtualMachineNameTokens = vd.toString().split(" "); if (!virtualMachineNameTokens[1].equals(pid)) { continue; }

JavaSource.net

Java OpenSource Solutions

Java pid from within program

Returns pid@hostname RuntimeMXBean r = ManagementFactory.getRuntimeMXBean(); System.out.println("RuntimeMXBean=" + r.getName()); On linux java -Dpid=$$ yourclass Then java expression System.getProperty("pid") will give you the process id.

OutOfMemoryException

JVM Lies: The OutOfMemory Myth

ByteCode and Aspects

Part 1, " Classes and class loading " (April 2003) Part 2, " Introducing reflection " (June 2003) Part 3, " Applied reflection " (July 2003) Part 5, " Transforming classes on-the-fly " (February 2004) Part 6, " Aspect-oriented changes with Javassist " (March 2004) Part 7, " Bytecode engineering with BCEL " (April 2004) Part 8, " Replacing reflection with code generation " (June 2004)

JavaRanch Atomic Variables vs Synchronization

Threading with java.util.concurrent Henry Wong

Embeddable SQL editor

DataStorm Can launch from code with one line.

Delete directory

/** * Recurse through directories if present, deleting all contents first so that the directory itself can be deleted. * * @param file * @return */ private boolean delete(final File file) { boolean deleted = true; if (file.isDirectory()) { for (final File f : file.listFiles()) { if (f.isDirectory()) { deleted &= delete(f); if (!deleted) { LOGGER.error("Coulnd't delete " + f); return deleted; } } else { deleted &= f.delete(); if (!deleted) { LOGGER.error("Coulnd't delete " + f); return deleted; } } } } deleted &= file.delete(); if (!deleted) { LOGGER.error("Coulnd't delete

Debugging into Java core libraries with Eclipse

Unzip the jdk src.zip file Create a project and build the java source Open the Eclipse project run dialog for the project you want to debug into the java source from Click on the Classpath tab Click on the Bootstrap Entries Click the Add Projects button Add the java source project Click on the Up/Down buttons to move the java source project above the JRE System Library (equivalent to -Xbootclasspath/p) Debug your project as normal and you will be able inspect variables as you step through the java core libraries Alter the java source to add instrumentation for things like recording last mutator thread stack trace of Collections for debugging and discovering the source of ConcurrentModificationException, etc.

Zip/Jar

Random access of ZIP TrueZip encapsulates random access, but only works with files NestedArchiveToolkit

Perm generation memory space

forum.java.sun.com Class information is stored in the perm generation. Also constant strings are stored there. Strings created dynamically in your application with String.intern() will also be stored in the perm generation. Additionally, the hotspot compiled code resides in the perm generation. Class unloading: every instance has a reference to its class, and every class has a reference to its class loader, and every class loader has a reference to all the classes that it loaded. Usually if you want classes to get unloaded, you have to have thought about that beforehand and set up separate class loaders to allow for that. you cannot change the configured sizes for the Perm generation during runtime. The parameters for setting initial and max size are -XX:PermSize=xM and -XX:MaxPermSize=yM. sub-area of the perm space, called the code cache separate JVM parameter to also bump up the code cache size

MaintainJ Eclipse plug-in

Create sequence diagrams from use cases at runtime

DocBook

DocBook java publishing libs

Java metrics

Metrics collection

Java career companion

Career companion web site

Performance questions

Java Urban Performance Legends When is it important to set the default collection sizes? What is the time cost of growing an ArrayList? What is the time cost of growing/rehashing a HashMap with defaults from zero to 'n' entries? initial capacity 16, load factor .75 growth algorithm if (size++ >= threshold) resize(2 * table.length) size should always be power of 2 0-1 million objects ? sec 0-10 million objects ? sec 0-20 million objects - it takes three times the current size to rehash since it doubles the internal array and copies the old array - with a 700M heap couldn't rehash 20 M objects without running out of memory 0-20 million objects with 1 GB heap ? sec Is synchronization expensive? What is the time cost of un-contented synchronization? What is the time cost of contended synchronization? When would pooling of objects yield significant performance gains? How much memory do empty objects require? How much time do objec

TDD

Evolution of Test and Code Via Test-First Design TDD debate Coplien and Martin - architecture TDD makes you faster Uncle Bob's three rules of TDD

HotSpot adaptive (native) compilation

Warming up HotSpot, native compilation HotSpot options

Sharing mouse and keyboard across systems

Input Director Windows only - LifeHacker writeup Synergy cross platform - LifeHacker writeup Teleport for Mac - LifeHacker writeup

Windows Tools

Map sftp as windows drive SftpDrive Windows Sysinternals Remote server tools WinSCP Putty SSH Cygwin Console2

JProfiler

Replacing Finalizers with Phantom References