Working with Data in Pivot Tables using Laravel 4 Eloquent ORM (SELECT, UPDATE and DELETE)

Working with the pivote table data was not clear to me initially - especially deleting from the pivote table. I thought Laravel would handle this since it already handles the inserting and updating of the data. But it turns out this needs to be handled at the database level.

When setting up your pivot table, you need to set the referential actions to cascade on delete and update. This will force any update to the parent table to cascade down the data in the pivote table.

Below is a simplified example using a blog with posts and tags.

Continue reading →

9 Words Women Use (and Men Need to Know)

\"Fine\"
This is the word women use to end an argument when they are right and you need to shut up.
\"Five Minutes\"
If she is getting dressed, this means a half an hour. Five minutes is only five minutes if you have just been given five more minutes to watch the game before helping around the house.
\"Nothing\"
This is the calm before the storm. This means something, and you should be on your toes. Arguments that begin with nothing usually end in fine.
Continue reading →

jQuery AJAX Loading – Display Images or Text Until Script is Finished (Part 2)

This is a more practical way to display an image or text while an AJAX request is loading.

What we're basically doing is forcing a DIV to have a starting image and then replacing it with the text return from the AJAX request.

<script>
function loadingAjax(div_id)  
{  
    $("#"+div_id).html('<img src="ajax-loader.gif"> saving...');  
    $.ajax({  
        type: "POST",  
        url: "script.php",  
        data: "name=John&id=28",  
        success: function(msg){  
            $("#"+div_id).html(msg);  
        }  
    });  
} 
</script>

<!-- usage -->
<a href="#" onclick="loadingAjax('myDiv');">save page</a>  
<div id="myDiv"></div>

If you're looking for a sweet AJAX loading image, check out ajaxload.info

Continue reading →

How To Hug A Baby If You're A Dog

Step 1: Find a baby.
Step 2: Be sure that the object you found was indeed a baby.
Step 3: Next you will need to flatten the baby before actually beginning the hugging process.
Step 4: The "paw slide" - simply slide paws around baby and prepare for possible close-up.

Note: The added slobber should help in future steps by making the "paw slide" easier.
Step 5: Finally, if a camera is present, you will need to execute the difficult and patented "hug, smile, and lean" so as to achieve the best photo quality

Dogs, if this is properly done, it will secure you a warm, dry, climate-controlled environment for the rest of Your life.

Continue reading →

There's a Bug on My Nose!

Continue reading →

Javascript Close Popup and Refresh or Redirect Parent Window with OnLoad (Solution)

This one about drove me crazy all night trying to think of why this does not work and to be honest I still don\'t understand why it doesn\'t. But below is a solution to the problem.

The problem was I was trying to close a popup and force the parent page to load a URL using onload.

So within the popup, I saved the form changes to the database and if everything was saved fine it would return to the popup with the code below.

Continue reading →

Copy/Transfer Files Between Two Linux Servers Using SCP

The other day we ran into a good problem that our site has grown and we are in need of a new server. So we ordered the server and now we need to transfer all the files from the old server to the new one. But rather than downloading all the files to our local machines then re-cuploading them to the new server, we're going to show you how you can skip the middle man and transfer files from server to server.

The only requirements is that you need to have SSH access to both servers.

Continue reading →

Free Dog Screen Savers

Due to popular demand, below is a list of a handful of free dog screen savers. Please check them out and leave a comment if you like one better than the other.

C'mon And Swim

ss_cmon_swim

Features:

  • This scuba diving pup invites you in, the water`s fine. Easy install. Plays the complete song by Bobby Freeman while bubbles float.

Download C'mon And Swim Screensaver (986 KB exe)

Continue reading →

Christmas Cards from My Daughter

Out of all the gifts I received this Christmas, none touched my heart as much as the cards given to me from my 7 year old daughter Makenzy. I remember my parents telling me when I was younger all they wanted for Christmas was for me to make them something. Now I understand why they said that.

Below are the cards that she made for me this year. Hope you all had a great Christmas and a happy new year.

Merry Christmas Daddy
Continue reading →

Funny Animal Pictures

HELP!!! Someone dial 911, I'm being mauled by a troll!
Continue reading →