Subscribe to RSS Subscribe to Comments

Alan Blaine Whitney

Reloading Information

The other day I was thinking some about reloading shells. The process of taking spent rifle brass, and making them ready to go again. I am reloading for .270 winchester. The load my rifle has fellen in love with is 130 grain hornady SST in front of 55 grains of IMR-4350, touched off by a CCI 200 primers. Rifle groups pretty good with them.

Just thought I would share my cost. For 100 rounds, I need about 3/4 of a pound of powder, 100 bullets, 100 primers. I have plenty of brass, so this assumes that is not an issue. Plus 30.06 brass is easy to come by, which is one trip in the resizing die and becomes 270 brass.

Here are the cost of making 100 rounds of ammo.

Van Raymonds Midway Cabelas
100 x CCI 200 large rifle primers $4.50 $3.09 $3.29
1 lb x IMR-4350 $33.99 $22.99 $24.99
100 x 130 grain hornady SST $37.99 $26.99 $26.99
total reloading cost per 100 $76.48 $53.07 $55.27
100 rounds of purchased live ammo $179.95 $124.95 $129.95

So midwayusa is the cheapest, but it cost about 30 to ship the stuff. Cabelas is pretty good too, but about a three hour drive away. Even buying components locally at van raymonds is cheaper than buying pre-loaded ammo at cabelas.

So in theory reloading saves about 55% the cost of buying pre-loaded factory ammo. It’s generally more accurate to boot and you can customize loads to your gun. Reloading is fun too.

The down side of reloading, you actually don’t save a penny. I am not even talking about the up front equipment cost. I mean, you will shoot twice as much as before, and you shoot away any savings you may of had, but it’s fun.

SQL CSV Export

Nothing new here, but had forgot how easy it is to export to csv in mysql

SELECT * INTO OUTFILE 'result.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM my_table;

Note that this file will be created on the mysql server, not the client.

Recursive Find and Replace

This works on most linux boxes.

find /path/to/start/from/ -type f | xargs perl -pi -e ’s/applicationX/applicationY/g’

Debian & svn

For those of you who just updated your Debian Lenny install and and had your subversion stop working, this is for you.  If you are getting this error:

svn: OPTIONS of 'http://dust.sephone.com/projects/mslha': could not connect to server (http://dust.sephone.com)

You need to put

http-library=serf

On the last line of ~/.subversion/servers

Moving Subversion Repositories

Here is a how to on moving subversion repositories from one server to another.

First, go to your old server, find the directory and do svnadmin dump name > dumpfile.

FTP over dumpfile to your new server.

Go to your new server and do svnadmin create newname; svnadmin import newname < dumpfile

How you need to update the places where you have this repository checked out with this command svn switch –relocate http://<old-server>/<old-name> http://<new-server>/<new-name>

Just like that.

Comments in RSS feed

For the most part, every project I do starts with cakephp, jquery and 960 grid.  Just about everytime I need to do an rss feed, I follow the directions in the cook book.  This has worked great.

Today I got wondering about the how feedburner does the comment count within their feed flare.  It seems to work with word press.  Auto-magically.  I wanted to make it happen outside of wordpress.  Turns out that it is pretty easy.  It uses a new namespace in the XML, wfw.

To add that namespace, one first needs to put a new xmlns attribuate in the rss tag, like below.

<rss xmlns:wfw="http://wellformedweb.org/CommentAPI/"  version="2.0">

Well, you would think that is pretty easy in cake, add an array to some $rss method call.  Well, this was a rare instance in cake where I couldn’t quite get it to work.  So I had to make changes to the rss help.  First, copy the rss helper from  cake/libs/view/helpers/rss.php to app/views/helpers/rss.php. Once it’s copied, I manually changed the document method to this

	function document($attrib = array(), $content = null) {
		if ($content === null) {
			$content = $attrib;
			$attrib = array();
		}
		if (!isset($attrib['version']) || empty($attrib['version'])) {
			$attrib['version'] = $this->version;
		}
 
		if (!isset($attrib['xmlns:wfw']) || empty($attrib['xmlns:wfw'])) {
			$attrib['xmlns:wfw'] = 'http://wellformedweb.org/CommentAPI/';
		}
 
		return $this->elem('rss', $attrib, $content);
	}

Now just one last change to make, in the my view, which was located at app/views/articles/rss/feed.ctp, where the item is added

        echo  $rss->item(array(), array(
            'title' => $article['Article']['title'],
			'comments' => array_merge(array('#' => 'comments'), $url),
			'wfw:commentRss' => 'http://' . $_SERVER['SERVER_NAME'] . '/comments/' . 
				'index/' . $article['Article']['id'] . '.rss',
			'link' => $url,
			'guid' => array('url' => $url, 'isPermaLink' => 'true'),
            'description' =>  $bodyText,
            'pubDate' => $article['Article']['created']));

And that is about it, then it just worked with feedburner’s feed flare comment counter. Just like wordpress.

Cake 1.2 Final Auth Problems

I had auth working in 1.2RC3 just fine. What I wanted was all of the non-admin stuff to not need auth, but all of the admin stuff to have auth. Here is what my code used to look like

	function beforeFilter() {
		$this->Auth->allow('*');
		if (isset($this->params['admin'])) {
 			$this->Auth->deny("*");
		}
       }

That didn’t work in 1.2 final, here was the modification I had to make to get it working again.

	function beforeFilter() {
		$this->Auth->allow('*'); // Allow Everything by default
		$admin = (Configure::read('Routing.admin'));
		$strlen = strlen($admin);
		foreach ($this->Auth->allowedActions as $key) { 
			if (substr($key, 0, $strlen) == $admin) { 
				$this->Auth->deny($key); // Disable an admin_ like action
			}
		}
 
		if (is_a($this, "UsersController")) { 
			$this->Auth->deny('login');
		}
 
		if (isset($this->params['admin'])) { 
			$this->layout='admin';
		}
 
		if ($this->RequestHandler->isAjax()) { 
			$this->layout='ajax';
		}
    }

That seemed to fix it up. Go figure.

Cake 1.2RC3 to Final

Recently the cake 1.2 has been released.  On several of my applications I have upgrading all along the 1.2 release cycle.  Here are my tweaks that I needed to do from RC3 to 1.2 Final.

To start the upgrade, I simply swapped out my cake directory for the new one.  Dropped the tmp dir with this command.

find app/tmp/ -name ‘cake*’ | xargs rm

For the most part it worked right off the back.  The only problem I had was to switch some things in my “app/app_controller.php”.  In RC3, if it was an ajax request, it automatically switched to an ajax layout.  It stopped doing that in RC4 and final.  So I when to put functionality back in.

To start I added the request handler component and use beforeFilter().

	var $components = array('RequestHandler');
 
	function beforeFilter() {
		if ($this->RequestHandler->isAjax()) {
			$this->layout='ajax';
		}
    }

I actually had several things happening in my ‘app/app_controller.php’ already, here is my actual file.

	var $components = array('Auth', 'Email', 'RequestHandler');
 
	function beforeFilter() {
        $this->Auth->fields = array('username'=>'username', 'password' => 'password');
		$this->Auth->loginAction = array('admin' => false, 'controller' => 'users', 'action' => 'login');
		$this->Auth->allow('*');
 
		$this->set('navPoint', 'home');
 
		if (isset($this->params['admin'])) { 
			$this->layout='admin';
			$this->Auth->deny('*');
 
			// Lets set the sort order
			if (!$this->Session->check('sort')) {
				$this->Session->write('sort', 'Application.date_created DESC');
			}
		}
 
		if ($this->RequestHandler->isAjax()) { 
			$this->layout='ajax';
		}
    }

In The Morning

Starting tomorrow, I am going to change the way I start my work day.  Normally, I check email, phone messages, check my feed reader, maybe even make a few phone calls.  I think I am wasting my mornings.  The first hour, maybe two hours of my day are sort of quick.  Not everyone is in the office.

More than just that it is still quick, also my mind is still fresh.  Once I read emails, feed reader, etc.  I have stuff on my mind.  I am already distracted some.

So here is my game plan tomorrow morning.  Come in and get right two it.  Check email and feedreader before lunch sometime but later.  I will comment with how it worked.

Work time

Google allows it’s people to work 20% of their work time on whatever they feel passionate about.  Recently, I read a post about 37 signals switching to 4 day work weeks.  It got me thinking

If you have the right type of people, it’s good to let them have freedom to play around with stuff, just experiment.  One they learn stuff, making them a better employee, it’s cheaper than college or often going to conferences.  Another thing is that the people are fresher, feel less bogged down.  Just a few random thoughts on that.

Next Page »

Based on FluidityTheme Redesigned by Kaushal Sheth Sponsored by Send Flowers