Skip to content

MySQL – How to drop all Foreign Keys on a table


I recently was working with a 3rd party DB that was designed well and used lots of foreign keys to enforce referential integrity. Unfortunately, the application that used the DB structure was very poorly written and caused all sorts of problems when the foreign keys were applied. I had to quickly remove all the foreign keys from about 160 tables. The code below will quickly create a script that removes all Foreign Keys from a database.

select concat(‘alter table ‘,table_schema,’.',table_name,’ DROP FOREIGN KEY ‘,constraint_name,’;') from information_schema.table_constraints
where constraint_type=’FOREIGN KEY’;

You can limit by schema by adding the line : AND table_schema rlike ‘Schema Name’

Remember, Foreign keys are only valid when using Innodb, MyISAM does not support foreign keys.

Share and Enjoy:
  • Digg
  • Yahoo! Buzz
  • del.icio.us
  • StumbleUpon
  • Facebook
  • LinkedIn
  • Technorati
  • Mixx
  • Google Bookmarks
  • email
  • Print

Cookie Monster – Wordpress URL Parameter Utility


I recently had a situation in which I needed to pass a URL parameter into WordPress so that it could be inserted into all links off of a blog page.  For example, a partner would pass traffic to a blog using the format http://www.myblog.com?refcode=joe.  All links embedded in the post would need to pass the value of refcode if it existed, even if the visitor requested multiple pages after the initial visit.

I created a Plugin (Cookie Monster) that will allow a Blog Admin to define which URL parameters should be captured, and then creates a shortcode so that the value can be used in your Posts and Pages.  A WordPress shortcode is a macro code that is embedded in your content.

In the example above, if you define refcode in the Cookie Monster Admin Settings, and if that URL parameter refcode contains a value in the querystring, it will automatically be saved into a cookie in the visitors browser. Anywhere that you place the shortcode in your Post, Cookie Monster will insert the querystring value into your Post.  The cookie value will persist across browser sessions.

If you click on this link, you will see that the querystring value refcode is now

Try changing refcode= in the link and reload this page.  Let me know if you have any further ideas for expanding this plugin.

You can download the latest copy here.

Share and Enjoy:
  • Digg
  • Yahoo! Buzz
  • del.icio.us
  • StumbleUpon
  • Facebook
  • LinkedIn
  • Technorati
  • Mixx
  • Google Bookmarks
  • email
  • Print

Grandpa’s Handyman Secrets by Dr Miles Bader – Lowest Price


Grandpa's 5001 Handyman Secrets

Dr Miles Bader reveals all of the tips, tricks and hints that show you just how quick and easy it is to do repairs around your house and save money at the same time!   This is a perfect book for so many people who are facing tough fiscal times.  It shows you how to save money and time by fixing thousands of items around your house.  This book is packed with more usable, easy, money saving household tips and tricks than any book in recent history!

This book is THE perfect gift for friends, family members & neighbors; they won’t be able to thank you enough!

• Easy Do-It-Yourself Repairs that save  you money!
• Easy to understand!
• Will Turn Anyone Into A Handyman   or Handywoman!

It is a book with secret tips to intricate problems of household repairs which every person should know.  Grandpa’s Handyman Secrets by Dr Miles Bader is a do it yourself tool book.  The book is fun to read with its money saving, simple but extremely useful tips. The book is written in the simplest words possibly keeping in mind every people with little or no knowledge about tools. The only thing you will require before using this book is a toolbox and you are all set for the overhaul mission of your beloved house.

Grandpa’s Handyman Secrets is a treasure which you will like to gift to your children to make them self-reliant. It reveals the tips and tricks of how to make a quick and easy home repair. Over 5000 tips and tricks will surely make your life smoother than it ever was. So go and grab the last few copies of this book and save money.  Click here to get the lowest price on the book anywhere.

Other books for sale!

Share and Enjoy:
  • Digg
  • Yahoo! Buzz
  • del.icio.us
  • StumbleUpon
  • Facebook
  • LinkedIn
  • Technorati
  • Mixx
  • Google Bookmarks
  • email
  • Print

Tilt your head sideways and prepare to be amazed!


Ok Equals a Person

Ok Equals a Person, or a Ninja...

The origin of the word OK is with American president  Martin Van Buren, who was elected in 1836.   He would always say everything would be all right, everything would be fine, etc.   His nickname was named after his birthplace, Old Kinderhook, New York.  So, for short people called him O.K.  This then became a substitute for what he stood for, everything will be alright, etc. and thus OK was born.  Don’t believe folks who tell you that it is from  Okay…

Share and Enjoy:
  • Digg
  • Yahoo! Buzz
  • del.icio.us
  • StumbleUpon
  • Facebook
  • LinkedIn
  • Technorati
  • Mixx
  • Google Bookmarks
  • email
  • Print

Dinner at VOLT: Order the Beets!


So I’ve been suggesting husband to make reservations at VOLT restaurant in Frederick for a while now – hoping we could get in before one of the Voltaggio brothers wins Top Chef this season — brother Bryan is chef at VOLT (http://www.bravotv.com/top-chef/season-6/bios) (http://www.voltrestaurant.com/). Brunch was booked up, so husband kindly made dinner reservations for Sunday.

We arrived a bit early and sat in the open bar/lounge area of the ‘mansion’ to await our table… Gary wasn’t convinced an entire Sam Adams fit into his fancy glass, though the barman insisted it did… We were seated in the main dining room (in addition there’s the noisy kitchen-view tasting dining room and a glassed-in Chef’s Table) with white linens and coppery brown ceiling – elegant and populated with nearly as many servers and sommelier-types as diners.

We selected three of the four courses from the four course menu including, starting with the beet salad which was the tasiest dish of the night: as Gary put it, 75 cents worth of beets for $12, but they looked very pretty on the huge plate, swirled with tasty oil, a cheese mousse, and tiny green ‘weeds’ and tasted lovely.

Next up was goat cheese ravioli in brown butter — nutty flavor but Gary said too oily. Teeny-tiny scallops (seriously, as big as a dime) atop some sort of nutty grain were overpowered by the grain, and it was hard to tell the flavors of the white, orange and green ’smears’ of sauces on that plate.

We both selected fish as main plates, with Gary’s striped bass a winner featuring crispy skin and a deep earthy flavor. My slightly rare halibut was a disappointment in comparison. The accompanying hot, puffy dinner rolls in various flavors (from sea salt to bacon) were lovely – we should’ve ordered more!

For dessert I ordered the banana split dish – a ‘deconstruction’ similar to something Bryan made in restaurant wars. It was interesting, but unsatisfying-with nut powders beneath teaspoon size samples of chocolate and vanilla ice creams and a strawberry sorbet that would’ve been great as its own serving in a cone or normal size bowl. There was a strange tofu-like-textured banana ‘mousse’ winding across the plate and a ’spherical’ maraschino ball that burst when I tried to spoon it up. Gary fared a bit better with his peanut butter and chocolate combination, decorated with organic chocolate and some micro-green cilantro and cilantro powder(!) If was amusing to look around the dining room and watch the other diners eating their tiny servings with great care and precision of fork, most leaning forward and examining the food items thoughtfully while taking itty-bitty bites.

The yummiest dessert came as a complement of the pastry chef, a dish of miniature ice cream sandwiches on various cookies. And the check was delivered hidden beneath two tulle-wrapped citrus/pumpkin muffins, ‘in case you’re still hungry, you can eat them on the way home’ is what the waiter actually said. If you have to hide the check under muffins so folks don’t get upset at the cost while their bellies are still empty, that sums it all up…

It was a pleasant dining experience, and was interesting to taste and see some of the flavors and styles of food that we’ve been seeing on Top Chef, though we both agree that the restaurant across the street — Acacia — offers more flavorful and more satisfying food for Frederick visitors.

Good luck Bryan Voltaggio – we’re still rooting for you!

Share and Enjoy:
  • Digg
  • Yahoo! Buzz
  • del.icio.us
  • StumbleUpon
  • Facebook
  • LinkedIn
  • Technorati
  • Mixx
  • Google Bookmarks
  • email
  • Print

Snakes on a Plane – Or at Least in my Backyard


We have had several friendly snake visitors to our house the past few months.  While I often dismiss them as harmless, my wife is always concerned that we have poisonous rattlers roaming the yard.  I usually try to get a picture of each one so that I can try and make a positive identification.   Here are two of the most recent vipers.

This little guy appears to be a Eastern Ribbon Snake, Thamnophis sauritus.

dash 035

I believe that this is a Black Rat Snake (Elaphe obsoleta), although my wife is convinced that it is a Timber Rattlesnake (Crotalus horridus).  What do you think?

IMAGE_007

Share and Enjoy:
  • Digg
  • Yahoo! Buzz
  • del.icio.us
  • StumbleUpon
  • Facebook
  • LinkedIn
  • Technorati
  • Mixx
  • Google Bookmarks
  • email
  • Print

Close plane encounter over Tampa


Southwest 737 on final approach to Tampa

Southwest 737 on final approach to Tampa

Great view while landing today at Tampa International Airport.   As we came in, we had another plane join us on approach.   While this friend looked like he was right next to us, it was not as close as it seemed.   However, it got me thinking on what the requirements for plane separation actually are now. 

After some research, I found the following information for lateral separation, airplanes that are en route between airports must have at least 5 nautical miles between them. When the airplanes enter the approach controller’s airspace, that requirement goes down to 3 nautical miles.  When the airplane is finally in the control of an airport’s tower controller, planes can be spaced much closer if that controller has visual contact with the airplanes or if at least one pilot reports they have the other aircraft in sight. 

This visual separation doesn’t apply when airplanes are in the clouds, in which case the controllers keep airplanes spaced about 2 and a half nautical miles apart, more if the preceding aircraft is a heavy (over 250,000 pounds, which would be a 757 or larger) and the following aircraft is not.  This limitation is a function of the wake turbulence generated by larger airplanes.

However, because of some technology improvements to corporate jets and airliners, most of the world has adopted the Reduced Vertical Separation Minima (RVSM) standards. This allows aircraft flying above 29,000 feet to be spaced at 1,000 foot intervals. In the past, that number was 2,000 feet apart.

Share and Enjoy:
  • Digg
  • Yahoo! Buzz
  • del.icio.us
  • StumbleUpon
  • Facebook
  • LinkedIn
  • Technorati
  • Mixx
  • Google Bookmarks
  • email
  • Print

The world now makes sense – 3.14 = PIE!


Pie

I looked in the mirror this morning, and this is what I found.  Who knew 3.14 was a Palindrome?  It is clear that some higher being must certainly exist…

pie

Now I find that 3.14 does not actually equal pie…   \pi\ne\text{pie} and apparantly \pi\ne 3.14.

What do you see in the mirror?

Share and Enjoy:
  • Digg
  • Yahoo! Buzz
  • del.icio.us
  • StumbleUpon
  • Facebook
  • LinkedIn
  • Technorati
  • Mixx
  • Google Bookmarks
  • email
  • Print

Meerkats are the Cutest! Pandas are boring…


409903837_S3MFE-XL

This Meerkat was a very curious creature when we visited him at the San Diego Zoo.   They have been made famous through the wildly popular show on The Discovery Channel, Meerkat Manor.   Meerkats live in colonies, and one or more meerkats always stand sentry.  As they watch over, the others go about foraging or playing.  If a predator is spotted, the sentry meerkat  gives a warning bark, and other members of the colony will run and hide in one of the many holes they have spread across their territory.  The San Diego Zoo has a huge exhibit, if you stop by, I am sure like me you will be mesmerized by these interesting animals.

409892543_VRSbD-XL

Some people find Panda’s interesting, but I honestly find them pretty boring.  Like this one, most just lay around and sleep.  Quite the life!


Zoobooks Magazine

Share and Enjoy:
  • Digg
  • Yahoo! Buzz
  • del.icio.us
  • StumbleUpon
  • Facebook
  • LinkedIn
  • Technorati
  • Mixx
  • Google Bookmarks
  • email
  • Print

Ever been face to face with a Rattle Snake?


405761723_k4K49-XL

Have you ever found yourself next to a Rattle Snake?  Last year while hiking in the Torrey Pines State Natural Reserve, I had the opportunity to find myself in that exact situation.   Torrey Pines Park is the home of our nation’s rarest pine tree - Pinus torreyana.  Once this tree covered a larger area, but the  fragile environment it requires now only exists here and on Santa Rosa Island off the coast near Santa Barbara.  As my wife and I walked down a trail leading to the ocean, which was completely obscured by an incoming fog bank off the coast, we suddenly heard a very loud buzz.  This was a sound I had never heard in my life, and immediately started my heart racing.  I jumped backwards and sprinted back up the trail.  Turning back, I pulled out my camera and took a few shots before he slithered off into the brush.  He was easily over six feet long and as wide as the business end of a baseball bat.

When I got back, I signed my kids up for this great magazine (ZooBooks) that teaches children all about animals.  Give it a try, I am sure your kids will love it to.
Zoobooks Magazine

Share and Enjoy:
  • Digg
  • Yahoo! Buzz
  • del.icio.us
  • StumbleUpon
  • Facebook
  • LinkedIn
  • Technorati
  • Mixx
  • Google Bookmarks
  • email
  • Print