Arrow

Posts on this site are never sponsored.

Oatmeal cookies recipe

These cookies taste pretty good, so the basic recipe must be of some value. Truthfully, though, the ingredient amounts don’t look that healthy (some people might wish to reduce the sugar and butter).

I stole this recipe from the back of an oatmeal package. I’m putting this online because… the paper that I wrote it on is getting a bit wrinkled and I’d really like a reliable place to store the recipe. This is the first post on Peter’s Useful Crap that is primarily for Peter!

And yeah, I know it’s the easiest recipe you’ve ever seen. But hey, I’m not exactly a baker. If you haven’t noticed, most of my posts are really nerdy.

I’ve made these cookies about 5 times in my life, which is 4 times more than I’ve ever made any other baked goods. Maybe I should get a bit daring and start baking other stuff.

250mL butter
125mL sugar
250mL brown sugar
2 eggs
10mL vanilla
300mL flour
5mL baking soda
2mL salt
625mL oatmeal

For extra fun:
250mL chocolate chips
250mL raisins

Directions:
Preheat the oven to 375 degrees F.
Cream butter, brown sugar, sugar. Note: butter is a lot easier to cream at room temperature! Add eggs and vanilla.
In a separate bowl, combine flour, baking soda, salt. Add two mixtures together.
Add oatmeal, plus whatever extras you have. White chocolate and milk chocolate chips together taste goooood.
Drop the clumps onto greased cookie sheets. Yeah, this recipe has a lot of butter. You could probably use less.
Bake for 8-9 minutes for softer cookies, and 10-12 minutes for harder cookies. Yum yum.
Makes about 40 cookies.

Convert an IP address to binary

When I was learning the basics about computer networks, the Internet, etc., the concept of binary numbers was an essential building block in understanding concepts such as subnet masks and other nerdy stuff (admittedly, I don’t actually remember how subnet masks work, but that’s beside the point). IP addresses look something like this: 192.168.0.1 but are actually represented by a number such as this: 11000000.10101000.00000000.00000001.

How the heck do they come up with that? Well, each binary string in an IP address has 8 numbers, which we will call “slots”. Slots are read from right to left. A “1” means that the slot is “open” or “on” and a “0” means that the slot is “closed” or “off”. 11111111 means that every slot is open. From right to left, the first slot’s value is 1, and each successive slot’s value is double the previous one (128, 64, 32, 16, 8, 4, 2, 1). To calculate the value of binary string, add up each open slot’s value.

00001100 represents the number 12. Why? The third slot (from the right) is open (because it has a 1) and has a value of 4. The fourth slot is open and has a value of 8. By adding up the value of all open slots, you arrive at 12.

Using only 0’s and 1’s, a set of 8 slots can represent every number between 0 and 255. Each number in an IP address can only be between 0 and 255.

Here’s a calculator to check whether you know how to convert normal IP addresses to binary numbers.

What the heck is Linkie Winkie?

Who knows… but it just crawled my site. There needs to be a Linkie Winkie entry in Wikipedia. By the way, has anybody noticed that Linkie Winkie has trouble with its and it’s:

“We’re not going to tell you much about it, except that its a very altruistic little site and loves to be talked about.”

No bikes allowed at the McDonald’s drive thru

Just so you know, bicycles aren’t allowed at a McDonald’s drive thru. Only motorized vehicles are allowed. Apparently it’s a safety issue. Motorcycles, however, are more than welcome at the drive thru. And does McDonald’s offer bike racks? This then gives the bike rider no choice but to leave his/her bike unattended outside (well, I suppose one could bring one’s bike inside, or are there safety rules against that to?).

Since I refuse to write a personal blog, let’s just say that “somebody” tried to get service at the McDonald’s drive thru while riding a bike and was denied. This made him/her a bit upset… and he/she concluded that not only is McDonald’s bad for one’s body, but also bad for one’s spirit.

Date countdown code in php

This was the first php script that I ever looked up sooooo many years ago. It’s really quite simple. You want to show visitors a countdown in days to a certain event in the future. Since PHP can provide the current time on the server to the very second, simply calculate the desired date (in seconds) and subtract from the server date. More complicated scripts can give a choice between hours, months, or days remaining, can compensate for a server time different than your current time, and can probably dress up the output a bit better.

I’ve spiced this code up a bit by making it a function (thus enhancing reusability), but otherwise, let’s go with simple, shall we?

Here’s the code:

<?php
function countdown( $event, $month, $day, $year )
{
    // subtract desired date from current date and give an answer in terms of days
    $remain = ceil( ( mktime( 0,0,0,$month,$day,$year ) - time() ) / 86400 );
    // show the number of days left
    if( $remain > 0 )
    {
        print "<p><strong>$remain</strong> more sleeps until $event</p>";
    }
    // if the event has arrived, say so!
    else
    {
        print "<p>$event has arrived!</p>";
    }
}

// call the function
countdown( "Christmas", 12, 25, 2020 );
?>

How about some more fun:

Christmas countdown

Update: I have since made a countdown plugin for WordPress that incorporates the basic concept.