Easy On/Off Debugging and Profiling in PHP

PHP Code

If you’re like me, you’re often putting var_dump or $this->output->enable_profiler() in your source code while you’re debugging it.

I got tired of commenting and un-commenting these lines, so I came up with an easier system. Some of you may be familiar with the PHP XDEBUG extension. Whether or not you use it, the Firefox add-on Easy XDebug (any also, I believe, the Chrome add-on Xdebug Helper) provides a really nice way to turn our debugging messages on and off.

For all else they may do, the extensions do one interesting thing in particular: set or delete two special cookies (XDEBUG_SESSION and XDBUG_PROFILE) that we can use to let our app know if we’re in “debugging mode” or “profile mode”.

So here’s what I came up with:
Continue reading ⇒


How to Take Care of Your Laptop Battery

From http://www.batteryuniversity.com/parttwo-34.htm

Simple Guidelines

  • Avoid frequent full discharges because this puts additional strain on the battery. Several partial discharges with frequent recharges are better for lithium-ion than one deep one. Recharging a partially charged lithium-ion does not cause harm because there is no memory. (In this respect, lithium-ion differs from nickel-based batteries.) Short battery life in a laptop is mainly cause by heat rather than charge / discharge patterns.
  • Batteries with fuel gauge (laptops) should be calibrated by applying a deliberate full discharge once every 30 charges. Running the pack down in the equipment does this. If ignored, the fuel gauge will become increasingly less accurate and in some cases cut off the device prematurely.
  • Keep the lithium-ion battery cool. Avoid a hot car. For prolonged storage, keep the battery at a 40% charge level.
  • Consider removing the battery from a laptop when running on fixed power. (Some laptop manufacturers are concerned about dust and moisture accumulating inside the battery casing.)
  • Avoid purchasing spare lithium-ion batteries for later use. Observe manufacturing dates. Do not buy old stock, even if sold at clearance prices.
  • If you have a spare lithium-ion battery, use one to the fullest and keep the other cool by placing it in the refrigerator. Do not freeze the battery. For best results, store the battery at 40% state-of-charge.
  • Tags:

    Solution for “A disk read error occurred.”

    This is one of the most frustrating error messages you can ever deal with. Sometimes the fix is simple, sometimes it’s a complete pain. Having recently dealt with this again, I thought I’d post my thoughts in the hopes that it helps someone else out there.

    So you receive the dreaded “a disk read error occurred. Press Ctrl+Alt+Del to restart”. Multiple restarts result in the same error message.

    If you put your drive into another computer, or connecting it as a slave on your own computer, it will typically work fine, and no data is missing.

    Because this error is not usually associated with data loss, DO NOT RE-PARTITION THE DRIVE. Your data is likely safe and sound.

    Here’s how we’ll recover your data. Continue reading ⇒

    Tags: ,

    Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.

    If you’re getting this message in your event log, here’s all you have to do to fix it:

    Locate your MySQL data directory and and delete the files “ib_logfile0” and “ib_logfile1” contained therein. The files will be recreated after your restart the MySQL service (or simply reboot if you don’t know how to restart a service). You will NOT lose any data. It will very likely fix your error.

    Your MySQL data directory is typically something like

    C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\Data

    although it may be located in an entirely different place, such as


    If you can’t find it, search your drive for one of those two files.

    If that doesn’t fix the problem for you, check to see if the directories exist for the environment variables TEMP and TMP.


    How to Stop Outlook from Making itself the Default Mail Client

    Outlook is a great program that’s handles calendar functions quite well. Many people love using the calendar functions but don’t like to use Outlook as an email client. Unfortunately, if you are using another email program (such as Mozilla’s excellent Thunderbird client), Outlook will often hijack your preferences and make itself the default email client. Simply setting the option in Outlook to stop this often doesn’t have any effect.

    If you want to stop Outlook from hijacking the default mail client settings, and keep YOUR choice as the default email program, we need to go over Outlook’s head and employ the operating system itself as a security guard.

    Here is how we do that:

    Continue reading ⇒

    Big Government says no walking or biking for you

    Government big enough to give you everything you need is big enough to take everything you have.

    According to http://www.timesunion.com/AspStories/story.asp?storyID=847190 school officials “will not tolerate” kids walking or biking to school:

    The 12-year-old and his mother, Janette Kaddo Marino, are defying Saratoga Springs school policy by biking to Maple Avenue Middle School

    But on the night before classes started, school authorities called parents to say that walking and biking to school would not be tolerated.
    When the pair stuck with their plan, they were met by school administrators and a state trooper

    Socialized Medicine and the Cross-Border Incident

    Socialized Medicine:

    Somewhere in America Alone, I cite an example of the logical reduction of socialized health care: “the ten-month wait for the maternity ward.” I’ve been adding to the file ever since. Here’s the latest entry, from Hamilton, Ontario:

    Hamilton’s neonatal intensive care unit (NICU) was full when Ava Isabella Stinson was born 14 weeks premature at St. Joseph’s Hospital Thursday at 12:24 p.m. A provincewide search for an open NICU bed came up empty, leaving no choice but to send the two-pound, four-ounce preemie to Buffalo that evening.

    Well, it would be unreasonable to expect Hamilton, a city of half-a-million people just down the road from Canada’s largest city (Greater Toronto Area, five-and-a-half million) in the most densely populated part of Canada’s most populous province (Ontario, 13 million people) to be able to offer the same level of neonatal care as Buffalo, a post-industrial ruin in steep population decline for half-a-century.

    But wait! The fun and games are only just beginning. When a decrepit and incompetent Canadian health bureaucracy meets a boneheaded and inhuman American border “security” bureaucracy, you’ll be getting a birth experience you’ll treasure forever:

    Her parents, Natalie Paquette and Richard Stinson, couldn’t follow their baby because as of June 1, a passport is required to cross the border into the United States. They’re having to approve medical procedures over the phone and are terrified something will happen to their baby before they get there.

    Once Buffalo enjoys the benefits of Hamilton-level health care, I wonder where Ontario will be shipping the preemies to. Costa Rica?

    We now return you to your 24/7 Michael Jackson coverage…

    From Mark Steyn

    How to remove Logitech Easy Synchronization and bluetooth

    To bypass my rant, scroll to the bottom of this post to see the quick solution.

    I’ve quickly learned to dislike how Logitech engineers their software for their wireless keyboard and mouse systems.

    Once again, this is a case of yet another software “suite” that does so much more than we want or need. Adding a mouse and keyboard apparently requires several services and background tasks running that do provide more clutter. It seems that everyone wants to jump on this bandwagon. I dare you to install a Logitech device, Roxio CD/DVD creator, Apple iTunes, and Norton Antivirus. You’ll have at least a dozen system processes running everywhere, slowing things down.

    (Wait for it… can you hear it? The hoofbeats of several company men who work for one of the above-mentioned firms to pick apart every comma and period above to inform us all that their software is really great, despite all the crap it loads? Wait for it… they show up like a cloud of bees every time.)

    It’s high time that software manufacturers STOP MAKING “SUITES” and begin putting together highly-focused, simple software that simply does the job well. Rather than several individual processes designed for every possible scenario (I’m talking to you, Apple) just give us a program that works only when it’s open, and unloads itself when we’re done. Please?

    Okay, there’s my rant. Here’s the promised solution to removing that infernal “Easy Synchronization” program.

    1. Copy this line:

    RunDll32 C:\PROGRA~1\COMMON~1\INSTAL~1\PROFES~1\RunTime\0701\Intel32\Ctor.dll,LaunchSetup “C:\Program Files\InstallShield Installation Information\{AC134D03-97F1-45B9-B32A-52E885AFA895}\setup.exe” -l0x9

    (make sure it copies all as one line, and not several individual lines.)

    2. Now press Windows-R on your keyboard (or go to the start menu and click “Run”.

    3. Paste the line you just copied into the Run box and hit enter.
    The uninstall process will begin.

    4. Yay!

    Tags: , ,

    Does Macroevolution Work?

    An interesting article on why macroevolution doesn’t work.

    A major problem for evolutionists is how could partially-evolved plant and animal species survive over, supposedly, millions of years if their vital organs and tissues were still in the process of evolving?

    Tags: ,

    Very Cool Creation

    The heavens declare the glory of God:

    Tags: , ,