Wednesday, November 29, 2006

Book Review: How to Win Friends & Influence People


I’ve decided to make a concerted effort to read more, so last week I started reading the book “How to Win Friends & Influence People” by Dale Carnegie. The book has sold over 15,000,000 copies since being published in 1937. The book was written after teaching over twenty years worth of educational courses on the topic in New York City. The book is divided into four parts, each part ending with a set of principles that Carnegie suggests are the keys to remember when dealing with people. The four parts of the book are:


  1. Fundamental Techniques in Handling People
  2. Six Ways to Make People Like You
  3. How to Win People to Your Way of Thinking
  4. Be a Leader: How to Change People without Giving Offense or Arousing Resentment

Each principle is examined by looking at real life examples either from famous personalities such as Abraham Lincoln and Charles Schwab, to everyday people who he taught in his courses. Carnegie gives examples from business, teaching, parenting, and many other avenues to show that his principles apply to every part of your life. Carnegie gives just enough information about each principle to make his point, but doesn’t bore the reader by repeating the same thing over and over. Carnegie suggests that each chapter should be read twice and I agree.

I was so impressed by this book that I made a cheat sheet with every principle and formatted it onto a single piece of paper. I plan on referencing this cheat sheet on a daily basis so that the ideas will stay fresh in my memory.

Truncating MySQL Log Files

Often I want to have MySQL logging turned on so that when there are problems I can quickly tail the log file to see what is causing the problem. The problem with leaving MySQL logging on for an extended period of time is that the log files can get big quickly. So I usually leave logging turned off and only turn it on when needed. Which works fine, but in order to turn off or on MySQL logging you have to restart the server. This is not ideal in most cases because a restart means that any clients trying to connect during the process of restarting will get an error.

Typical log rotation scripts won't work because when the file is rotated the MySQL server won't recreate the file or log to a new file even if you create it by hand.

Last week I thought of a solution that seems to be working well. I realized that I could leave logging turned on but have a nightly script that simply truncated the file with this command:

echo '' > /var/log/mysql.log

This will reduce the size of the file to zero bytes and at the same time MySQL will continue to log to the file without requiring a restart.

But this method doesn't allow you to actually rotate the log file in case you wanted to keep it around. So after researching a bit, I found this:

shell> mv host_name.log host_name-old.log
shell> mysqladmin flush-logs
shell> cp host_name-old.log backup-directory
shell> rm host_name-old.log
This would allow you to do an actual log rotation instead of just deleting the old file.

If you installed from RPM there is a log rotate script provided, and details can be found here:

http://dev.mysql.com/doc/refman/4.1/en/log-file-maintenance.html

Friday, November 17, 2006

Softball Season

On Tuesday we played our final softball game of the season. We lost 6-4 in the first game of the playoffs. We finished the season 1-11. Our co-ed league has three division: A, B, and C. We joined the B league (A is for the best skilled teams, C is the worse skilled teams) by a majority vote from our team members. This was the first year we have joined a softball league, and the first time I have coached a softball team. We had a number of players on our team that had no softball experience at all, so needless to say we had a lot to learn. I certainly learned a lot about coaching and since hindsight is 20/20 here is a list of things I would do differently or keep the same next year.

Changes for next year:

  • Join the C league. We had absolutely no chance of beating some of the better teams in the B league. There were 2 teams in particular that were way better than us. There were 2 teams I thought we could beat, and 2 teams that were slightly better than us. But if I had to do it over again, I would join the C league, nobody likes to lose every game.

  • Buy equipment not uniforms. We pooled our money to buy everyone a cool looking, tight fiting, uncomfortable shirt for the season. They had a really great design with our number and nickname on the back. They were extra expensive because of the lettering and the company that made the shirts made them too small and they felt as if they were on backwards when you wore them. Funny stuff, but I think our money would have been better spent on a couple of good bats. I don't think anyone on our team realizes how a good bat can make all of the difference in the world. I'm sure our team average would have been better if we had a few good bats. I do appreciate all of the hard work that Manny, Cameron, and Velvet put into those cool shirts.

  • Better batting instructions. I spent so much time each practice going over fielding, relays, defense, etc that we never had much time to break down each persons swing and go into details on how to become a better hitter. We had so much work to do fielding wise that I never felt that batting would matter that much, and it probably didn't, but in those few close games that we lost an extra run or two would of put us over the top.

  • Walk. The real difference between the good teams and the bad teams is that good teams don't swing at bad pitches. Good teams generate a lot of walks. I never drilled this point home enough. The best teams beat us by 10 or more runs each time we played them, but they didn't hit 20 home runs. They hit one or two home runs, but the bases were usually loaded when they hit those homers. They know how to take a lot of pitches, get base on balls, and not strikeout. It's a lot harder than it sounds and it takes practice. When you get a strike your natural instinct is to swing at the next pitch no matter where it's at because you don't want to strikeout. But the better hitters know how to identify a ball and not swing, even if they already have a strike.

  • Don't keep statistics. Who cares anyway? Let's focus on wins, not stats.

  • We need more females. League rules require that half of the team on the field is female, half is male. We barely had enough females each game and it made substitutions really hard. I wish I had more options so that I could put in a pinch hitter or move people around in the field. I'm proud of the girls we had, they played hard and gave 100%, I just wish we had more of them.

Things we did right:

  • Practice. Our team was pretty dedicated when it came to practicing. I'm proud of them for working so hard, we came a long way from the first practice to the last game. Heck, we even skipped the first game because we had a scheduled practice. :)

  • Cut-Offs. There are two points I worked on over and over in practice and the first one was hitting your cut-off. From the first game to the last game we did an excellent job of knowing where to be and who to throw the ball to when we had it.

  • Backing Up. The second point I worked on over and over was backing up the cut-off. We did this better than any team in the league, I have no doubt about this.

  • Base running. I thought for a first year team we did an excellent job running the bases.

  • Communication. On defense we did a great job of yelling out where to throw the ball, and when we were base running we did a great job helping the runners along. I've seen teams do this terribly and for a first year team we did a great job.

  • PK's. Thank goodness for a cold beer, hot pizza, and the camaraderie of friends after each game.

Looking at our defense:

  • Outfield. It didn't take long for me to realize that our fastest players needed to be in the outfield. The majority of the hits go to the outfield and there is a lot of territory to cover. I thought after the first few games we got it right and were doing a great job out there. Brian probably had more outfield assists than anyone else in the league and gets my vote for team MVP.

  • Pitching. Mike was our only pitcher the entire season. It's way harder than it looks and he did a great job. It took about half the season before I realized he was gripping the ball wrong resulting in too many walks, but overall he did a great job. I still don't know who I would of put at pitcher if he wasn't there every game.

  • Catcher. Beth was a trooper and probably our most improved player from the beginning of the year to the end. That first few games the umpire did more catching than she did, but by the end of the year she was doing awesome. It's a tough gig back there and she never once complained.

  • Shortstop. Becky was by far the best female shortstop in our league

  • Second base. I'll never forget Marisa missing that one throw and it hitting the dude right in the, ugh, well, “private parts”. Awesome stuff, no way was I putting anyone else at second base after that gold-glove play. :)

  • First base, third base. I had a lot of options to choose from at these positions. I'm sorry I couldn't get everyone all of the playing team they wanted. It's hard to plan out substitutions when you only get to play 4 or 5 innings. I think everyone who played did a great job, we just needed more innings so that everyone could get more playing time.

Overall we came a long way from that first game to our last game. I'm proud of our team. We played together, never argued, never gave up, and were always encouraging each other. Thanks for a great year and I can't wait to kick some (C league) butt next season. :)

The New Blogger

When I logged into blogger today I was asked if I wanted to upgrade to the new version. I have read that the new version was built on Google's well known architecture so I decided to go ahead and upgrade. I wanted to check out any new features they may have added as well. I guess my blog is somewhat large because after waiting a few minutes for the upgrade to complete, I got a message saying that they would send me an email when they finished the upgrade process. One interesting note is that before I was allowed to upgrade I had to supply a valid GMail account to use for future logins...hmmm.

After 20 mins or so I finally got the email and was able to login to the beta of blogger. I love the new spell checker and the improved speed. Seems like there are a few bugs with "Delete Post" and the preview pane, but overall it seems pretty stable. The speed at which blogs are posted is very fast so I'm sure they worked primarily on speed and scaling in this version.

gunzip, grep, sed, awk, sort, and mail

These are by far my favorite UNIX commands. I use most of them on a daily basis. Let's go through a simple problem to help understand how to use each tool.

Let's say that your UNIX server is configured to rotate your email logs nightly. After the log rotation you want to setup a script that will give a quick summary of the top email recipients on your server.

Here is some example output from the log:

[root@server1 root]# tail -n 40 /var/log/maillog

Nov 17 09:40:28 server1 postfix/qmgr[31224]: E602E44C002: removed
Nov 17 09:40:35 server1 postfix/pickup[6300]: DDD6C44C002: uid=0 from=
Nov 17 09:40:35 server1 postfix/cleanup[6045]: DDD6C44C002: message-id=<20061117144035.ddd6c44c002@server1>
Nov 17 09:40:35 server1 postfix/qmgr[31224]: DDD6C44C002: from=, size=805, nrcpt=2 (queue active)
Nov 17 09:40:36 server1 postfix/smtp[6060]: DDD6C44C002: to=johnsmith@webmail.us relay=192.168.127.1[192.168.127.1], delay=1, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as E091B44C17E)
...

The only line I'm interested in is the last line, so I can easily 'grep' for that data:

[root@server1 root]# grep "postfix/smtp" /var/log/maillog

Nov 17 09:22:33 server1 postfix/smtp[4077]: A63D444C002: to=johnsmith@webmail.us relay=192.168.127.1[192.168.127.1], delay=0, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as ABB8E44C188)
Nov 17 09:22:58 server1 postfix/smtp[4077]: AAD5244C002: to=jsmith@gmail.com relay=192.168.127.1[192.168.127.1], delay=0, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as ADF86C1DC)

...

That's great, but what I really need is only the email address part of that line, that's where 'awk' is very useful:

[root@server1 root]# grep "postfix/smtp" /var/log/maillog | awk '/.*/ {print $7}'

to=johnsmith@webmail.us
to=jsmith@gmail.com
to=johnsmith@webmail.us
to=vvv@webmail.us
...

Almost there, but I only need the part after the 'to=', here comes 'sed' to the rescue:

[root@server1 root]# grep "postfix/smtp" /var/log/maillog | awk '/.*/ {print $7}' | sed {s/to=//}

johnsmith@webmail.us
jsmith@gmail.com
johnsmith@webmail.us
...

Now, the tricky part, I want to group all of the duplicate lines together and get a count of the number of 'johnsmith@webmail.us' entries, luckily I stumbled upon this great awk script which helps me do this:

# histsort.awk -- compact a shell history file
# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
# May 1993
# Thanks to Byron Rakitzis for the general idea
{
if (data[$0]++ == 0)
lines[++count] = $0
}

END {
for (i = 1; i <= count; i++)
print data[lines[i]], lines[i]
}


[root@server1 root]# grep "postfix/smtp" /var/log/maillog | awk '/.*/ {print $7}' | sed {s/to=//} | awk -f history.awk

17 johnsmith@webmail.us
1 jsmith@gmail.com
16 vvv@webmail.us


Now it's easy to sort the list, numerically, in reverse order:

[root@server1 root]# grep "postfix/smtp" /var/log/maillog | awk '/.*/ {print $7}' | sed {s/to=//} | awk -f history.awk | sort -r -n

17 johnsmith@webmail.us
16 vvv@webmail.us
1 jsmith@gmail.com


And finally, let's email the results to myself:

[root@server1 root]# grep "postfix/smtp" /var/log/maillog | awk '/.*/ {print $7}' | sed {s/to=//} | awk -f history.awk | sort -r -n | mail -s "Daily Summary" jsmith@gmail.com

Oh, I almost forgot, I need to gunzip the nightly version an put it in cron:

[root@server1 root]# gunzip -c /var/log/maillog.1.gz | grep "postfix/smtp" | awk '/.*/ {print $7}' | sed {s/to=//} | awk -f history.awk | sort -r -n | mail -s "Daily Summary" jsmith@gmail.com

Combining all of these really simple tools allows you to create just about any type of report imaginable.

Thursday, November 09, 2006

Computer Science Majors

I had another opportunity to speak to a group of students at Virginia Tech on Monday. I was on a 5 member panel talking to freshman "General Engineering" majors about computer science. General engineering majors haven't yet chosen a specialty such as electrical engineering, computer engineering, etc. The purpose of the panel was to talk about the CS major. The students filled out a survey before the session about their current thoughts on the computer science major and if they were interested in the major. The majority, like 99%, were not interested in CS. The two major themes of the survey were:

1. Computer Science is boring
2. They didn't want to sit at a desk all day.

The other members of the panel represented IBM, Lockheed Martin, and Eastman Kodak. Although I really liked all of them, they all managed to crack me up at one point or another. They tried their hardest to explain that computer science wasn't boring and you don't spend all day coding (one guy said 30 minutes / day was the average). I didn't say it, because I wanted to get invited back, but if you need convincing that CS is a great major, please major in something besides CS.

The best computer scientist could spend all day in front of computer and love every minute. If my programmers only spent 30 mins a day programming I would be an unhappy person. I don't know what goes on at IBM, but at a small nimble company your programmers should be coding / debugging at least 6 hours a day. The other 4 hours are for the meetings, designing, etc. The point I'm trying to make is that you should have a passion for computers, you shouldn't need to be convinced or talked into the computer science major. Sure, I wish there were more CS majors, but on the other hand, people who aren't passionate about CS won't make good developers. And let's face it, that is what CS is all about. Despite how often some professor tells you that CS is more than programming, that's not the real world. CS is about programming, it's about writing great software, and writing it as quickly as possible, with as few defects as possible.

Wikipedia lists the following fields in computer science:

* 4 Fields of computer science
o 4.1 Mathematical foundations
o 4.2 Theory of computation
o 4.3 Algorithms and data structures
o 4.4 Programming languages and compilers
o 4.5 Concurrent, parallel, and distributed systems
o 4.6 Software engineering
o 4.7 Computer architecture
o 4.8 Communications
o 4.9 Databases
o 4.10 Artificial intelligence
o 4.11 Soft computing
o 4.12 Computer graphics
o 4.13 Scientific computing

11 of the 13 fields require programming. CS is about programming, don't let the recruiters fool you. That's why it's important to find a job where you are working on interesting projects that are actually going to be released.

If you want to find people who will be great at computer science, you need to start at the high school level. I'm convinced that students who take any type of programming class in high school have a huge advantage in college. If you want more females to major in CS, start teaching them CS at the high school level. This panel would of been great for high school students, not for college freshman.

Sunday, November 05, 2006

Running 101

Today was the first day of my running workout. Velvet pointed me to a 10 week beginner workout that I'm going to try:

Week Run Walk Repeat Total Time
1 1 min 2 min 7x 21 min
2 1 min 1 min 10x 20 min
3 2 min 1 min 7x 21 min
4 3 min 1 min 5x 20 min
5 4 min 1 min 4x 20 min
6 6 min 1 min 3x 21 min
7 9 min 1 min 2x 20 min
8 12 min 1 min Then run 7 min 20 min
9 15 min 1 min Then run 4 min 20 min
10 20 min
Leap for joy

20 min

Today was rather easy, but I can tell that I'm really out of shape when it comes to endurance. My goal here isn't to run marathons, I'm really just trying to become more fit. I don't think I've ever run more than 15 mins at a time, here goes nothing...

Webmail Mobile w/ Treo 600

I have a Treo 600 and the new Webmail Mobile works great, but one tip that took awhile for me to figure out is that there is a bug in the Treo 600 that prevents cookies from working.

The solution is to delete the cookie file. From the main application screen hit Menu->Delete scroll down until you see the entry "Web Cookies", highlight it and delete.

My Blog

Last night while hanging out with friends watching the VT game, Pat gave me some great feedback on my blog. Pat's feedback was:

1. He hates how my blog is on so many random topics.
2. He could care less about my bench press statistics and other personal topics.
3. The technical topics are often too technical.

I love user feedback. I have spent much of the last 24 hours debating in my mind what I should do differently. So I started thinking about my blogging over the last year, my favorite bloggers, and blogs I wish other people would write.

I like my blog because I find it a very convenient place to record information about my life. For instance, if I learn about a useful new UNIX command that I won't necessarily need everyday, but I might want to use it in the future, I put it on my blog so that I can easily google for it when I need it. I certainly could put this information on my desktop or on the network drive someplace, but I like the fact that Google will crawl my page and make it easy for me to find later. I also believe that other people will find the information useful and I've certainly had enough feedback over the last year to know that to be true.

I realize that some people don't like the mix of personal and work related posts. But my work is a huge part of my life and I like having a single place to record everything. I'm certain that the majority of my readership is either co-workers or family and I'm certain that they care about both work and personal topics. I think I would split my blog in two if I blogged about a very specific topic often. For example, if I decided to focus on a specific topic like MySQL and put myself out there as a MySQL expert I would certainly break that blog out into a new one.

But that's not what I'm trying to do, more times than not my goal is simply to record the information so that I can reference it at a later date.

I have several personal goals when it comes to weighlifting, but the main one revolves around bench pressing. I certainly don't blog about bench pressing because I'm bragging or I'm the biggest guy at the gym. I'm certainly proud of where I'm at and where I want to go, but I'm still a really small guy. I blog about it because it's an easy way for me to track my progress. It's also very motiviational because I know my co-workers are reading this blog and I will be less likely to quit if I'm trying to prove that I can reach the goals I set for myself.

My blog really only focuses on these topics:

1. Goals
2. Work
3. College Football
4. Hobbies
5. Family

I could definitely stop blogging about college football. It's my favorite sport and I love
talking about it, but I would hardly consider myself an expert. So from here forward, no more
college football posts.

I consider baseball, softball, and golf as my hobbies. I like blogging about them, again, to
track my progress and have some sort of history recorded.

I think I'll keep my blog the way it is, except I'm going to cut out talking about my favorite
sport. Thanks for the feedback Pat, it was good to hear and gave me a chance to reflect on
exactly why I blog. The cool thing about blogging is that it is super easy to "unsubscribe". ;)

This also gave me the oppurtunity to review the blogs I subscribe to and why I like reading those blogs. Here are my favorite blogs:

Joel on Software
----------------
Joel is always spot-on when it comes to software development. His blog is very focused and rarely drifts off topic. I think it's the type of blog that Pat would love to read because you gain
useful knowledge with each post. He rarely posts but when he does the article is usually gold.

Jeremy Zawodny
--------------
Jeremy's style is much like mine. He is all over the place and you usually have to filter out the topics that don't interest you. But overall it's a very entertaining blog and well worth following. Similar to how Pat doesn't care about my bench pressing, I really don't have any interest in hearing about Jeremy's flying hobby. I follow Jeremy's blog because he doesn't have any problem telling it how it is and calling out BS when he sees it. It's a good window into Yahoo! too.

Liz
---
Liz's blog is great because she's not afraid to blog about anything. She'll tell you exactly how she feels about a topic and you can really tell it's genuine and not faked. I only know Liz via her boyfriend Jesse, but by following her blog I feel like I know more about her than I do Jesse.

That's a pretty amazing statement considering I knew Jesse for four years in college. I like people who blog often enough that you get the feeling that you know them, even though you may have never even met.

I wish many of friends who blog more often. Here are the people I wish blogged more and why:

Velvet
------
I love Velvet's flickr site, you can really get a feel for her personality from her pictures. I
love her blog too, but I just wish she posted more frequently. She has accomplished so much with her running, weight loss, and raising two great kids that I feel she is holding back on us.

Pat
---
I'm guessing Pat would like to blog more often but probably has trouble find the time. I think Pat is the expert when it comes to email hosting and he should just lay it all out there. I also think many of our employees could learn a great deal about sales, marketing, and running a business from Pat and he could use his blog to help educate us all.

Mike
----
I'm sure Mike learns something new about web development everyday. I would love for him to start sharing this information with the rest of us. Teach us about prototype, javascript, php, browser bugs, etc. I consider Mike to be an expert at web development and I would love to see him become more widely recognized as such.

Bill
----
This cat knows more about spam, smtp, and infrastructure than anyone. Please share!!!


My Developers
-------------
I wish it was a requirement for all of my developers to blog daily. Give me a paragraph on what you accomplished today. What better way for me to stay on top of everything but at the same time stay out of your hair. :)

OK, this post is getting long, I'll stop now. But just for you Pat, I'll give you an update on my running in a bit... ;)

Friday, November 03, 2006

Velvet's Birthday

Velvet turns 29 again on Sunday, be sure to wish her a happy birthday!!!

Wednesday, November 01, 2006

Doctor Visit

One of my goals for this year was to visit the doctor and have a physical. Two weeks ago I finally made the appointment with a doctor that was new to me. I haven't had a physical in ten years. I thought this was really bad, but my new doctor says that's not too bad when you are young. I was told after this visit that I don't need another physical for 3 more years. Already I was very happy. So after several basic checks I had lab tests on my blood and urine. He said if everything was OK he would send me a letter in about 3 weeks with a detailed explanation of all the tests. If something was wrong he would give me a call.

Yesterday I received in the mail the letter he promised. (Luckily I never got the phone call.) Everything looks great including cholesterol. The only issue is that my "good" cholesterol levels are low. He recommends eating fish (not fried), nuts, vegetables and fruits. OK, no problem, I can handle a piece of fish every week, and we'll see if in 3 years I can get this number up a bit.

In just 56 days I turn the big 3-0. I'm not overly depressed or anything. But, this letter certainly cheered me up a bit. In my head it's a clear green light to continue eating what I've been eating for the last 10 years. :) For the most part I feel like I eat healthy, but I'm not the kind of guy that's going to turn down a slice of pizza or a basket of cheese fries if the opportunity presents itself. ;)

I also wanted to start running now that baseball and softball seasons are over. I need to do some cardiovascular exercises so that I'm not completely worthless when basketball season rolls around. I'm also very inspired by Velvet and how fit she has become over the last year. So I asked my doctor if he saw any reason not to start running. His advice was to start slow and run on surfaces that were not hard on the knees. So this weekend I'm going to start running, hopefully with the help of Velvet. More on that later...