In this example I am showing you how to use the crontab in order to reload a fresh copy of a DB at 12 noon and 12 midnight everyday. Lets take a look:
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
0 12,0 * * * /usr/bin/mysql -u username -ppassword database_name < ~/backupfile.sql
You can see that I am connecting to mysql with my -u username and -ppassword ( And no, I did not make a mistake by not putting a space in between -ppassword, its supposed to be like that, if you put a space in between it thinks that *space* is part of your password.) and telling it to import the sql file backupfile.sql to the database database_name. This script is good if you need to reload a DB with fresh new data everyday. For example if you have a TEST CRM that people can use and test, you dont want people to input so much junk, so you have to reset the test data ever so often.
I love cron. hes a good friend of mine! 
Web Developing
Im trying to get back in it! ahhhhh.. I got a golf tournament to play in this Sunday! Im gonna win for sure!!
Chatterlings
Valentines day is stupid… I think the only reason why people celebrate this day is cause they have to brag about all the things their boyfriend or girlfriend got for them. This day is retarded cause why would you have to remind each other that you still love each other? Its fake love. Everyday should be valentines day when your in love… Its just another day for people to have an opportunity to reach their hands in your shallow ass pockets; cause you know your going to spend the money just so she wont be “mad” that you didn’t get her anything. Any girl that gets mad because you didn’t get her anything for valentines day is a whore. It doesn’t mean that we forgot about you, it just means that we don’t feel like we have to buy you something for you to LOVE us.. and if we do have to buy something for you to love us than your a whore.
These feelings I have could exist because i’m single maybe?
Chatterlings
My god was this a pain in the ass.. It was impossible finding the correct solutions on the web to do this in Ubuntu, so for those of you who are looking to do a crontab in Ubuntu check out the following:
What im doing here is creating a crontab to backup my www root folder and my db.
To begin the process we first do the following in terminal as root or a regular user:
#>crontab -e
this will invoke nano, and you can input something similar to the following lines:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don’t have to run the crontab
# command to install the new version when you edit this file
# This file also has a username field, that none of the other crontabs do
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=mailer@mailer.com
# m h dom mon dow user command
01 01 * * 0 /bin/tar cfP /mnt/nas/backup/www/`date +\%y-\%m-\%d`-server-name-www.tar /var/www
01 01 * * 0 /usr/bin/mysqldump –opt –all-databases > /mnt/nas/backup/mysql/`date +\%y-\%m-\%d`-server-name-mysql.sql
So basically whats happening here is we are tar-ing the www folder and sending it to the NAS drive with a timestamp. file ex will be: 09-01-01-server-name-www.tar
And its basically the same exact thing for the database backup.. Im just doing a mysqldump and the output goes to a sql file that ends up with the filename: 09-01-01-server-name-mysql.sql
Hope this helps someone..
Web Developing
This little code will check to see what page is current, then set the CSS color class “active”. It will make the text/link look selected and stay selected.
index.rhtml
<div id=”nav”>
<a <% if params[:controller] == ‘name_here’ %>class=”active”<% end %> href=”../name_here”>Link name</a>
</div>
and then make sure that you have the class “active” defined in your CSS:
main.css
#nav .active {color: #RED}
Web Developing
Stay on plane!
Ever wonder why pro golfers are so consistent? Well its cause they spend countless hours every day practicing these perfect positions!
One thing I would like to focus on in this post is spine tilt in the golf swing. Spine tilt is important when swinging the club. The reason for this is because it keeps us consistent and rotating on an axis which creates a better swing plane. If a golfer has a 90 degree spine tilt (which would be the spine being perpendicular to the ground) he would lose power and have no time for the club to lag behind his body. Having a spine tilt to the right, for a right handed golfer gives them time to lag the club and stay behind the ball rather than getting ahead of it and hitting a blocked shot or a high slice! When your spine gets too ahead and upright (90%) you tend to release the club way too early to get the club face to catch up to hit the ball squarely.
So the next time you go out to practice, think about your spine tilt. Do you have any?
Golf
Stay on plane!
Ever wonder why you cant stop hitting that HUGE slice or HUGE snap hook!? well most of these shots come from having a swing that is OFF plane. With a few simple flashlights and about an hour of practice a day you can be hitting on plane and bombing it down the middle for only $3.00!
Head over to wal-mart and grab 2 flashlights (preferably exactly the same). Tape them both together with the butt end of the handles against each other. You should end up with a double ended light SABER! Ok, now take your perfect setup as if you were going to hit a shot. Make sure you turn on both flashlights, and swing the flashlights on a line going all the way back and through. The best way to do this is to stand next to a wall and swing the lights along the bottom of the wall, staying on the line. Remember both flashlights should point at the line. Do this a few million times and you’ll be on your way to a perfect plane!
Golf
COIL drill
Want to see more power in your drives and iron shots? Well the key ingredient is making a good and full shoulder turn with minimal hip rotation. In the golf world this is called the “X” factor. A proper turn should have about 45 degrees of hip turn and about 90 degrees of shoulder turn in the back swing. If your tiger, your looking at more of about 40 degrees hip turn and about 100 to 110 degrees of shoulder turn. I don’t know if that’s exact but it must be close.
A good drill to incorporate this massive turn into your golf swing is right around the corner, keep reading. With a club in your hand (preferably a driver), grab the club so that it is parallel with the ground. Hold it so that it looks like your going to lay it flat on a table. Take your perfect golf stance and with the club still in your hands, take your backswing and focus on making a good shoulder turn and laying that club on the imaginary table. If you have made a bad shoulder turn then there will be no angle in your back. A good way to see if you are doing this is to make swings in front of a mirror. When you swing back, you should see your left should over your right knee and if you were to draw a line on your back, it would be angled. In another words, the angle your back creates is NOT straight up and down. Try this drill over and over again till you can do it in your real swing. You’ll be hitting drives right past those buddy’s your play with.
Golf
There is a great article on how to read directories and output their results with Ruby on Rails. If you would like to find out how this works and how to implement check out this website! It explains perfectly on how to do this. This is a great tip because I could never find anything on google that worked properly, but this does!
**The tutorial is here…
Web Developing