Running WordPress CRON with Xdebug Remote Dubugger
It has been a joy using PHPStorm and XDebug for debugging PHP web applications. I've been using the Xdebug helper chrome extension which adds a toggle to automatically enable debugging on a page. I can simply set a breakpoint in PHPStorm, reload the page, and it will open up PHPStorm with the debugging window active allowing me to inspect variables at that point. But why were my breakpoints inside WP CRON hooks not being triggered?
I checked how the extension does trigger the XDebug remote debugger, and it appears it's through a cookie with key "XDEBUG_SESSION" with value "PHPSTORM". Internally, WordPress makes another request to spawn WP CRON so this cookie was probably not set. What I did was I disabled WP CRON by defining DISABLE_WP_CRON in wp-config.php
define( 'DISABLE_WP_CRON', true );
Then, I had to manually trigger WP CRON.
while true; do curl 'http://wp.dev/wp-cron.php?doing_wp_cron' --cookie "XDEBUG_SESSION=PHPSTORM;path=/;" -s;sleep 2; done
That's it! The breakpoints I enabled start working. F*ck yeah.
The 4 Types of Answering Machine Messages You're Most Likely to Receive in the Philippines
I don’t know what the deal is with my fellow Filipinos and answering machines. Sure, hardly anyone ever uses them here — but haven’t we all seen how they work on TV and in the movies???
I kind of love having an answering machine because the only people who ever call my landline anymore are telemarketers, bank people and other similar undesirables. I like having the option to answer or call back at my convenience, when I’m done with um, more important things.
I also feel guilty when I force the maids to lie.
Thing is, of the hundreds of answering machine messages I receive (and promptly delete), I’d say only 2% are actual messages. The rest can be categorized as follows:
1. The Hangup. This is the most popular Filipino answering machine message — a click and a dial tone — and usually means one of two things: impatience… or performance anxiety.
2. The “I KNOW You’re Screening Again” Message
You mostly get these messages from people in the know – like your Mom, MiL, and friends who have lived in the States — who have already tried your mobile and are convinced you’re avoiding them.
3. The “I Don’t Know This Answering Machine, I Only Know Fax Machine” Message
The people who leave these types of messages (1) think the answering machine voice is a real person, (2) still use fax machines in this day and age and (3) still try to send a fax even if they’ve received no response whatsoever to their fax tone request. For all the above reasons, they should just be ignored.
4. The “I Don’t Realize I’m Being Recorded After the Beep” Message.
These can be really entertaining, and almost make the chore of having to listen to all your crap messages worthwhile.
When you want to use a different SSH key from the default ~/.ssh/id_rsa most of the available ways I have read from blogs are either you:
Use a custom host and assign it in ~/.ssh/config
Use the GIT_SSH and remember to prepend it everytime you will pull/push from remote
Here's my alternative approach.
SSH Key
I assume you already have created your private key. You will also need to create a program git will invoke instead of ssh through the GIT_SSH environment variable.
#!/bin/bash PRIVATE_KEY=$(/usr/local/bin/git config --get user.ssh) if [ -z $PRIVATE_KEY ]; then exec git $@ else GIT_SSH="$PRIVATE_KEY" exec git $@ fi
Now, every time you need to pull/push to a repo you won't have to remember to prepend the GIT_SSH variable. You won't also have to edit your ~/.ssh/config and make up another weird host every time you need to use another SSH key, you just set it in the as a local git config (which is much more convenient, I think)!
I have something to admit. I have been procrastinating for about half a month now. I stopped from working. The assigned project to me was just too big and complicated for me. Every time I start working on it, I get stuck on thinking about the implementation on one part of the project. This had me visiting reddit for a while browsing memes, gifs. It was occassional. This procrastination then occured more often that I stopped working on the project at all.
I stopped opening the Slack app so my boss won't be able to contact me. All I have been doing the whole day is browse through facebook and reddit posts, read top articles submitted to hacker news, check emails. Rinse and repeat. This went on until recently, when the Panic monster suddenly appeared.
My bank account's running empty and I have recurrent bills to pay. My cellular postpaid plan, car loan, house lease, utility bills. They're all piling up. I can't be irresponsible else I'd go bankrupt. The bank will surely reposses my car and I'm back living with my mom.
This was an eye opener for me on how procrastinating can severely change the direction of your life. You can't just stop working because you now have responsibilities as an adult unlike a kid who can just quit on his new hobby because he got tired of it. I had to find a solution to my severe procrastination.
After reading a few helpful articles here and there, I have come up with a list of things to do:
Work on creating good habits
It seems that recently, all I have been doing the whole day is practically nothing. I just turn on my macbook and lie down in bed the whole day. But now my day goes like this:
5AM - Wake up and read HN news while drinking coffee.
6.30AM - Prepare breakfast and take a bath. Do house chores.
9AM - write on the blog, browse reddit, facebook.
Okay, I don't know yet what to do for the rest of the day but I'll figure it out.
Love what you do
It also seems I didn't seem to love what I was working on. The project I was assigned to - it used to be my baby. I was very meticulous on how I did every bit of code - Dependency injection, antipatterns. I researched on every bit of topic related to this project to make sure I get everything right but as the code started to get big and complicated I started to lose interest from it.
This is how I realized I accepted a project that was too hard for me. I should've seeked for help from my fellow workmates instead of owning up the difficulty. Every once in a while my boss would seek for my help on another project and I would get so excited and motivated to work on it. I was very interested on it and keen on working on a solution to those problems because I loved the side projects I was assigned to.
Conclusion
This appears to be it. The solutions to procrastination though this might be incomplete so I have listed a few links to articles which have helped me:
4 ways to get motivated when you don’t feel like working
Why Procrastinators Procrastinate
How to Beat Procrastination
PS: I forgot to tell you what happened when I reopened the slack app and my boss was worried where I went. We're still discussing if he should let me work again or not.
I was checking my Pinboard bookmarks looking at items I never got the time to visit. They were neatly arranged in tags. Each bookmark has a title, the URL, description and they can be neatly arranged with tags. Which made me think, why can't I just use Tumblr for such?
With Tumblr I can provide a title and a description for links and I can also arrange them with tags. Plus, I get to upload images! I'm rethinking why I bothered getting a subscription and if I should still renew my Pinboard subscription.
It has been great at doing a very simple thing though, which is bookmarking. Kudos!
This blog was created in effort to improve my writing by writing everyday as much as I can. The time as of writing is 8.27 AM. I want to be able to write in a way that I am able to use the right words so I will need to expand my vocabulary for this. I want to be able to write in a way that you, the reader, doesn't get bored. And so it begins. I'll see you again tomorrow!