Dougy Mak’s Blog

MY BLOG!

Archive for January, 2010

Class 02 – Order of Magnitude, Units, Unit Analysis, Unit Conversions

Class 02 – Order of Magnitude, Units, Unit Analysis, Unit Conversions

No comments

Class 01 – Physics, Sig Figs

The recording is better heard through earphones. I’ll place the recorder closer to the teacher next time.

Class 01 – Physics, Sig Figs 1-22-10

No comments

Horrible Headache

I had the worst headache in my life yesterday night. I came home with my throbbing head pain and thought about taking a Tylenol, but I didn’t think I wouldn’t need it since it is usually gone by my wakening. I went to sleep hoping it will slowly dissolve away, but it just ruined my whole night of sleep. Tossing and turning, and constantly waking, I felt such pain as if I was going to drop dead. I still feel minor pain and minor strain and tension around my neck. Horrible headache. Pops a Tylenol. While I doubt it was caused by our dinner at Chevys, the food there was displeasing. I haven’t ate there for 5 years or so, and it was a great opportunity to bring my girl friend since she had never ate there before. Anyways, after my meal, I felt like crap. Normally, I wouldn’t get this “crap” feeling after a extensive large meal especially when it’s fresh and healthy. Feeling like crap after a meal is my body’s way of telling me this food is crap. Going to Chevys served as a reminder for why I never went back in the past years and a reminder to me for why I choose local joints over chains any day.

No comments

MangaStream’s new feature

From MangaStream’s Twitter:

You can now navigate manga chapters on mangastream using your right and left keyboard arrows.

Finally! The only problem I have now is when there’s a 2-page manga scene, I can’t use the arrow keys to scroll to the right to see the right side of the page anymore.


No comments

Avatar was awesome!

I watched Avatar a few weeks back and it was AWESOME! Those “animators” from G.I. Joe should really learn a thing or two from watching Avatar. It’s movies like these that put movies like G.I. Joe to shame. Why is it that movies with great titles always suck? Anyways… What a complete movie! Story was above average, animation was great, and the fantasy world design was great. If you haven’t watched it yet, go watch it now in 3D!

No comments

[PHP] Uppercase & Lowercase

Another few functions for I find useful:

  • ucfirst() – Make a string’s first character uppercase
  • lcfirst() – Make a string’s first character lowercase
  • strtolower() – Make a string lowercase
  • strtoupper() – Make a string uppercase
  • ucwords() – Uppercase the first character of each word in a string

From the looks of things, ucfirst() was coined from it’s function uppercase first letter (unlike some functions!). So goes for lcfirst() and ucwords(): lowercase first letter and uppercase first letter of each word. strtolower() lowercases every letter in every word in a string and strupper() functions in opposite, uppercases each letter in every word in a string.

ucfirst() examples:

<?php
$foo = 'hello world!';
$foo = ucfirst($foo); // Hello world!

$bar = 'HELLO WORLD!';
$bar = ucfirst($bar); // HELLO WORLD!
$bar = ucfirst(strtolower($bar)); // Hello world!
?>

lcfirst() examples:

<?php
$foo = 'HelloWorld';
$foo = lcfirst($foo); // helloWorld


$bar = 'HELLO WORLD!';
$bar = lcfirst($bar); // hELLO WORLD!
$bar = lcfirst(strtoupper($bar)); // hELLO WORLD!
?>

strtolower() examples:

<?php
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtolower($str);
echo $str; // Prints mary had a little lamb and she loved it so
?>

strtoupper() examples:

<?php
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtoupper($str);
echo $str; // Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>

ucwords() examples:


<?php
$foo = 'hello world!';
$foo = ucwords($foo); // Hello World!


$bar = 'HELLO WORLD!';
$bar = ucwords($bar); // HELLO WORLD!
$bar = ucwords(strtolower($bar)); // Hello World!
?>

No comments

Watchmen, Not what I expected

This is what I think about the movie and be warned, there are spoilers.

No comments

Winterbreak Movies

Well well, haven’t posted in a while, but wanted to give a few quick movie recommendations. Some people may find them to be a little old and dusty, but a little dust shouldn’t stop you from watching it. They’re still relatively new.

Frost / Nixon – Loved it. Watch it. I think people who have no interest in politics would find this movie to be very boring, otherwise you’ll love it.
The Invention of Lying - I wouldn’t recommend it. If you’re open minded to an alternate view, then be my guest.
Star Trek - Loved it. Watch it. Too much to say, just watch it. You’ll like it.
Surrogates – I would recommend you to skip this movie. I turned it off half way through the movie.

No comments

It’s about time America!

America (NYC at least) is finally stepping it up in promoting a healthy lifestyle.

No comments

[PHP] Rounding up and down

I just discovered a few cool functions:

  • ceil() – Round fractions up
  • floor() – Round fractions down
  • round() – Rounds a float

I’m guessing ceil() is short for ceiling. When looking up, you have a ceiling whereas when looking down, you have a floor(). The functions’ names correspond to their actual function which makes it pretty easy to remember. And then we also have round which is just basic rounding.

ceil() examples:

<?php
echo ceil(4.3); // 5
echo ceil(9.999); // 10
echo ceil(-3.14); // -3
?>

floor() examples:

<?php
echo floor(4.3); // 4
echo floor(9.999); // 9
echo floor(-3.14); // -4
?>

round() examples:

<?php
echo round(3.4); // 3
echo round(3.5); // 4
echo round(3.6); // 4
echo round(3.6, 0); // 4
echo round(1.95583, 2); // 1.96
echo round(1241757, -3); // 1242000
echo round(5.045, 2); // 5.05
echo round(5.055, 2); // 5.06
?>
<?php
echo round(9.5, 0, PHP_ROUND_HALF_UP); // 10
echo round(9.5, 0, PHP_ROUND_HALF_DOWN); // 9
echo round(9.5, 0, PHP_ROUND_HALF_EVEN); // 10
echo round(9.5, 0, PHP_ROUND_HALF_ODD); // 9echo round(8.5, 0, PHP_ROUND_HALF_UP); // 9
echo round(8.5, 0, PHP_ROUND_HALF_DOWN); // 8
echo round(8.5, 0, PHP_ROUND_HALF_EVEN); // 8
echo round(8.5, 0, PHP_ROUND_HALF_ODD); // 9
?>

No comments