Thought for the Day – July 21, 2009

Posted: under Geek Stuff, Humor.
Tags: , , , ,

Computers never do what you want them to do, only what you tell them to do. Unless there’s a bug. Then you’re just screwed…

Grrrr… nothing like a MySql bug to really make your day.

I had need to generate a sum for a column of duration values with the type of TIME.  Orginally I used this as part of my query:

sum(call_duration) as totalhours

Turns out this does not work properly and has apparently been a problem since 2005!

http://bugs.mysql.com/bug.php?id=12108

From reading the comments, there appears to be some argument as to the validity of the bug.  For what it’s worth, I found that the problem is more pronounced with more results.  I found that it was non-existant (that is that the sum returned the correct value) with result sets with only a few rows.   The problem seemed to get more severe based on more rows in the results.  In my case, a result set with about 2000 rows in it had an error of on the order of three hours.

The work around is to modify the query slightly:

sum(TIME_TO_SEC(crf_call_duration)) as totalhours

This converts the time to essentially an integer which is then properly handled by the sum.  You can then either work with the result as a count of seconds, or use the function SEC_TO_TIME to convert it back to a TIME value.

I hope this helps someone else.  It cost me a number of hours…

Comments (0) Jul 21 2009

Geek Marketing Slogan of the Year

Posted: under Amateur Radio, Geek Stuff, Humor.
Tags: , , ,

The Michigan Privately Owned Repeater Network (P.O.R.N) was offering (wire) strippers at the Dayton Hamvention this year!

dscf6353.jpg   dscf6354.jpg

Comments (0) May 20 2009

Tech Note for Today – March 9, 2009

Posted: under Geek Stuff.
Tags: , , , , , , , , ,

Well, I hope this helps out someone else.  I’ve been beating my head against the wall on and off for several days on it.  I’m working on an embedded ARM platform from Technologic Systems, a TS-7200.  I have it set up to boot a Debian build from a compact flash card.  This is my first experience with both embedded ARM and Debian.  So far, both ROCK.. but I digress.

One of the things I needed to do was get an FTP installation working so I could send stuff to the board.  Apt-get did a fantastic job of getting and installing Proftpd and I had the daemon up and running in like five minutes.  So far so good.  Until I tried to log in.

Nada.  Damn.

Endless searches and configuration changes and log checks did me no good.  For a while in fact, I wasn’t even getting a log at all.  Turns out the default setup doesn’t include logging.  They don’t do a good job of telling you that either.  My log setup is:

# Logging formats
LogFormat default “%h %l %u %t \”%r\” %s %b”
LogFormat auth “%v [%P] %h %t \”%r\” %s”
LogFormat write “%h %l %u %t \”%r\” %s %b”


# activate logging

# every login
ExtendedLog /var/log/ftp_auth.log AUTH auth

# file/dir access
ExtendedLog /var/log/ftp_access.log WRITE,READ write

# forr paranoid (big logfiles!)
ExtendedLog /var/log/ftp_paranoid.log ALL default

Yes I know it’s probably overkill, but this will be for low volume use, so I don’t care if the logs have big entries.  There won’t be many.  That fixed my logging problem.  It didn’t get me logged in though.  After what was probably endless hours of searching, I found this post:

http://raetsel.wordpress.com/2007/03/28/proftpd-shells-and-nobody/

Turns out that my problem was the “gotcha” he mentions first.  If you are using actual system users for FTP (as opposed to virtual users) you need to be sure the shell is set properly.  Apparently when you adduser it isn’t.  It requires use of chsh to set to a valid shell in order to log in.  I set my user to /bin/bash and voila!  If you’re not sure what the shell is for the user you want to use, check out /etc/passwd.  Its the last field in the entry.  If there is a setting there (unlike mine which was blank) and it still doesn’t work, make sure that the shell that is assigned is actually a valid one (my first attempt was bin/bash not /bin/bash which didn’t work either).

If you have assigned a shell that is proper then you can next check /etc/shells to make sure that the one you’ve assigned is a valid login shell.  I didn’t need to.  Your mileage may vary (YMMV).  If this helps you, please feel free to leave a comment to that effect.

I hate computers.  Never do what you want them to do, only what you tell them to do.

Comments (0) Mar 09 2009