Stephen Nimmo

17Aug/100

Tuesday Running Workout

Ordered all my training stuff last night for the half. 2XU Compression Calf sleeves. Headsweats visor. 3 new pair of Balega socks. Got a new nike dry-fit shirt from Academy. I LOVE Nike's dry fit stuff, both their regular dry fit t-shirts or their golf shirts.

Playing 9 at Tour 18 this evening.

Good run today. Next Run: Thursday at 6:30a.

Filed under: Code No Comments
15Aug/100

I have not been running…and I can tell.

So last Sunday's run was canceled due to festivities at my house the night before. Unfortunately, prior to those festivities I was trying to move a trash can and the handle broke. Five stitches in my left hand between my thumb and forefinger. So no golf and no running for at least a couple of days to make sure nothing got infected.

3 days turned into 7.

So what's the problem? Little excuses turn into big, run-canceling excuses. I have a 13.1 mile race in 12 weeks in San Antonio. San Antonio and Houston have many differences but only a single one will be on my mind that day - Hills. These little excuses have to go. This can't be about training anymore, but rather a lifestyle change. If there is something that is going to interfere with my running schedule, it stops today. I know what to look for. I know what I need to do. It's not a matter of whether or not I can physically do it. It's a matter of whether I can focus and sacrifice for the goal.

Today, I sacrificed. After a week off, I got up two hours later on a Sunday and went for a run at 8:30a. I was overheated and couldn't keep my heart rate down. Where I can normally maintain a 160 for at least 3 or 4 miles, I was at 170 before I knew it and it killed my run, both on pace and distance. My de facto running coach said that your HR is a tell-tale sign of how your body is sustaining itself during the run. A high rate rate is the first sign that your body is saying it's tired. When I got to the end my heart rate was 183 and I could barely walk. It's been 45 minutes since with a 20 minute freezing cold shower and I am still sweating. Granted, I did play golf during the heat of the day yesterday and sweated a few gallons of water but that shouldn't affect me this hard. Needless to say, I have a bit of work ahead of me.

Next Run: Tuesday at 6:30. Running Workout, 3 miles and 3 sets.

Filed under: Code No Comments
6May/100

Fast Coherence Updates

Let's say we want to update a list located in a cache somewhere. Typically, this would be done like this.

List<String> names = new ArrayList<String>();
names.add("Bob");
NamedCache cache = CacheFactory.getCache("test");
cache.put("B", names);

List<String> names2 = (List<String>)cache.get("B");
names2.add("Bill");
cache.put("B", names2);

But what this does actually requires a complete serialization of the payload both from the (possibly) remote location and back to the backup node when the put is executed. Network traffic and IO no bueno.

Instead, extend the AbstractProcessor and ship that work out to the node, cutting network IO in half.

public class AddNameProcessor extends AbstractProcessor {

	private String name;

	public AddNameProcessor(String name) {
		this.name = name;
	}

	@SuppressWarnings("unchecked")
	public Object process(Entry entry) {
		List<String> list = null;
		if (entry.getValue() == null){
			list = new ArrayList<String>();
			list.add(name);
			entry.setValue(list);
			return list;
		} else {
			list = (List<String>)entry.getValue();
			list.add(name);
			entry.setValue(list);
			return list;
		}
	}

}

And call it in a similar way.

NamedCache cache = CacheFactory.getCache("test");
List<String> names = (List<String>) cache.invoke("B", new AddNameProcessor ("Bill"));
Tagged as: , No Comments
23Dec/094

Ubuntu 9.10 – Apache2 + Tomcat6

1) sudo apt-get install apache2 tomcat6 libapache2-mod-jk
2) sudo vim /etc/apache2/workers.properties
and type/past in:
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

3) sudo vim /etc/apache2/apache2.conf
and type/past in:
# Load mod_jk module
# Update this path to match your modules location
LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
# Declare the module for (remove this line on Apache 2.x)
#AddModule mod_jk.c
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile /etc/apache2/workers.properties
# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile /var/log/apache2/mod_jk.shm
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile /var/log/apache2/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

6) sudo vim /etc/apache2/sites-enabled/000-default
Delete "DocumentRoot /var/www"
And type in
JkMount / worker1
JkMount /* worker1
note, you can use JkUnMount to define directories you want apache to serve

7) Enable port 8009 on tomcat
sudo vim /etc/tomcat6/server.xml
remove the "" that is a line below

8) restart tomcat
sudo /etc/init.d/tomcat6 restart

9) restart apache
sudo /etc/init.d/apache2 restart

10) wget localhost
You should see the default tomcat page

Courtesy of: http://rcpeters.blogspot.com/2009/05/installing-apache2-and-tomcat6-on.html

3Nov/092

ActiveMQ Clustered and Bulletproof

It's easy to create a clustered instance of ActiveMQ and have your clients connect via multicast. This gives you the ability to create ActiveMQ instances all over the place, have them autodiscover each other and failover seamlessly and automatically. Here's the ActiveMQ configuration.


<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:amq="http://activemq.apache.org/schema/core"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  		http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
  		http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">

	<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />

	<broker xmlns="http://activemq.apache.org/schema/core" brokerName="MyBroker" dataDirectory="${activemq.base}/data">

		<destinations>
			<queue physicalName="MyQueue" />
		</destinations>

		<transportConnectors>
			<transportConnector name="openwire" uri="tcp://localhost:0" discoveryUri="multicast://default"/>
		</transportConnectors>

		<networkConnectors>
      		<networkConnector uri="multicast://default"/>
    	</networkConnectors>

	    <persistenceAdapter>
	      	<memoryPersistenceAdapter/>
	    </persistenceAdapter>

	</broker>

	<jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
        <connectors>
            <nioConnector port="8161"/>
        </connectors>

        <handlers>
            <webAppContext contextPath="/admin" resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true"/>
        </handlers>
    </jetty>

</beans>

And here is the Spring code for the client.


<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
 		<property name="brokerURL">
 			<value>discovery:(multicast://default)</value>
 		</property>
 	</bean>

 	<bean id="destination" class="org.apache.activemq.command.ActiveMQQueue">
 		<constructor-arg index="0">
 			<value>MyQueue</value>
 		</constructor-arg>
 	</bean>

 	<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
 		<property name="connectionFactory">
 			<bean class="org.springframework.jms.connection.SingleConnectionFactory">
 				<property name="targetConnectionFactory" ref="jmsConnectionFactory" />
 			</bean>
 		</property>
 	</bean>

If you will notice, the ActiveMQ client uses the discovery mechanisms for finding the queue, which allows it to connect to any piece of hardware without actually having to know physical locations. You can replace your multicast://default (which happens to be multicast://239.255.2.3:6155) with whatever multicast address you would like. You could even DNS-it-up and have a url look like multicast://MyBroker.mydomain.com:6166.

Enjoy.

http://activemq.apache.org/multicast-transport-reference.html

Tagged as: 2 Comments
8Apr/090

Maven and the Enterprise

Sounds like a band from the 70's, huh? Here's a quick picture for part of a presentation I am putting together for my colleagues.

maven-enterprise

Here's a basic drawing describing a minimum development environment for any company. The "servers" can be consolidated to a certain point, especially if you are using virtualization software.

Also, the source control, continuous integration and maven repository manager can realistically all run on a single server. You MIGHT be able to get away with running the actual builds on the box but might run into some performance issues, particularly if you are running a big build and simultaneously checking in a bunch of source code.

26Mar/090

Requirements Documents are the suck.

http://www.scottberkun.com/blog/2009/why-requirements-stink/

Filed under: Code No Comments
10Mar/090

10 Papers Every Software Architect Should Read (At Least Twice)

http://www.rgoarchitects.com/nblog/2009/02/27/10PapersEverySoftwareArchitectShouldReadAtLeastTwice.aspx

Filed under: Code No Comments
10Mar/090

Pics from Corporate Cup

Running with the coworkers.

Filed under: Code No Comments
10Mar/090

Big Ball of Mud

http://www.laputan.org/mud/

My personal favorite is "Keep It Working".

Must read for people who "prototype".

Filed under: Code No Comments